]>
Commit | Line | Data |
---|---|---|
718e3744 | 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" | |
3b8b1855 | 31 | #include "memory.h" |
4bf6a362 | 32 | #include "hash.h" |
3f9c7369 | 33 | #include "queue.h" |
718e3744 | 34 | |
35 | #include "bgpd/bgpd.h" | |
4bf6a362 | 36 | #include "bgpd/bgp_advertise.h" |
718e3744 | 37 | #include "bgpd/bgp_attr.h" |
38 | #include "bgpd/bgp_aspath.h" | |
39 | #include "bgpd/bgp_community.h" | |
4bf6a362 PJ |
40 | #include "bgpd/bgp_ecommunity.h" |
41 | #include "bgpd/bgp_damp.h" | |
718e3744 | 42 | #include "bgpd/bgp_debug.h" |
e0701b79 | 43 | #include "bgpd/bgp_fsm.h" |
718e3744 | 44 | #include "bgpd/bgp_mplsvpn.h" |
4bf6a362 | 45 | #include "bgpd/bgp_nexthop.h" |
718e3744 | 46 | #include "bgpd/bgp_open.h" |
4bf6a362 | 47 | #include "bgpd/bgp_regex.h" |
718e3744 | 48 | #include "bgpd/bgp_route.h" |
49 | #include "bgpd/bgp_zebra.h" | |
fee0f4c6 | 50 | #include "bgpd/bgp_table.h" |
94f2b392 | 51 | #include "bgpd/bgp_vty.h" |
165b5fff | 52 | #include "bgpd/bgp_mpath.h" |
cb1faec9 | 53 | #include "bgpd/bgp_packet.h" |
3f9c7369 | 54 | #include "bgpd/bgp_updgrp.h" |
718e3744 | 55 | |
18a6dce6 | 56 | extern struct in_addr router_id_zebra; |
57 | ||
718e3744 | 58 | /* Utility function to get address family from current node. */ |
59 | afi_t | |
60 | bgp_node_afi (struct vty *vty) | |
61 | { | |
25ffbdc1 | 62 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 63 | return AFI_IP6; |
64 | return AFI_IP; | |
65 | } | |
66 | ||
67 | /* Utility function to get subsequent address family from current | |
68 | node. */ | |
69 | safi_t | |
70 | bgp_node_safi (struct vty *vty) | |
71 | { | |
72 | if (vty->node == BGP_VPNV4_NODE) | |
73 | return SAFI_MPLS_VPN; | |
25ffbdc1 | 74 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 75 | return SAFI_MULTICAST; |
76 | return SAFI_UNICAST; | |
77 | } | |
78 | ||
94f2b392 | 79 | static int |
718e3744 | 80 | peer_address_self_check (union sockunion *su) |
81 | { | |
82 | struct interface *ifp = NULL; | |
83 | ||
84 | if (su->sa.sa_family == AF_INET) | |
85 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); | |
86 | #ifdef HAVE_IPV6 | |
87 | else if (su->sa.sa_family == AF_INET6) | |
88 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); | |
89 | #endif /* HAVE IPV6 */ | |
90 | ||
91 | if (ifp) | |
92 | return 1; | |
93 | ||
94 | return 0; | |
95 | } | |
96 | ||
97 | /* Utility function for looking up peer from VTY. */ | |
f14e6fdb DS |
98 | /* This is used only for configuration, so disallow if attempted on |
99 | * a dynamic neighbor. | |
100 | */ | |
94f2b392 | 101 | static struct peer * |
fd79ac91 | 102 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 103 | { |
104 | int ret; | |
105 | struct bgp *bgp; | |
106 | union sockunion su; | |
107 | struct peer *peer; | |
108 | ||
109 | bgp = vty->index; | |
110 | ||
111 | ret = str2sockunion (ip_str, &su); | |
112 | if (ret < 0) | |
113 | { | |
a80beece DS |
114 | peer = peer_lookup_by_conf_if (bgp, ip_str); |
115 | if (!peer) | |
116 | { | |
117 | vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE); | |
118 | return NULL; | |
119 | } | |
718e3744 | 120 | } |
a80beece | 121 | else |
718e3744 | 122 | { |
a80beece DS |
123 | peer = peer_lookup (bgp, &su); |
124 | if (! peer) | |
125 | { | |
126 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
127 | VTY_NEWLINE); | |
128 | return NULL; | |
129 | } | |
f14e6fdb DS |
130 | if (peer_dynamic_neighbor (peer)) |
131 | { | |
132 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
133 | VTY_NEWLINE); | |
134 | return NULL; | |
135 | } | |
136 | ||
718e3744 | 137 | } |
138 | return peer; | |
139 | } | |
140 | ||
141 | /* Utility function for looking up peer or peer group. */ | |
f14e6fdb DS |
142 | /* This is used only for configuration, so disallow if attempted on |
143 | * a dynamic neighbor. | |
144 | */ | |
94f2b392 | 145 | static struct peer * |
fd79ac91 | 146 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 147 | { |
148 | int ret; | |
149 | struct bgp *bgp; | |
150 | union sockunion su; | |
f14e6fdb DS |
151 | struct peer *peer = NULL; |
152 | struct peer_group *group = NULL; | |
718e3744 | 153 | |
154 | bgp = vty->index; | |
155 | ||
156 | ret = str2sockunion (peer_str, &su); | |
157 | if (ret == 0) | |
158 | { | |
f14e6fdb | 159 | /* IP address, locate peer. */ |
718e3744 | 160 | peer = peer_lookup (bgp, &su); |
718e3744 | 161 | } |
162 | else | |
163 | { | |
f14e6fdb | 164 | /* Not IP, could match either peer configured on interface or a group. */ |
a80beece | 165 | peer = peer_lookup_by_conf_if (bgp, peer_str); |
f14e6fdb DS |
166 | if (!peer) |
167 | group = peer_group_lookup (bgp, peer_str); | |
168 | } | |
a80beece | 169 | |
f14e6fdb DS |
170 | if (peer) |
171 | { | |
172 | if (peer_dynamic_neighbor (peer)) | |
173 | { | |
174 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
175 | VTY_NEWLINE); | |
176 | return NULL; | |
177 | } | |
178 | ||
179 | return peer; | |
718e3744 | 180 | } |
181 | ||
f14e6fdb DS |
182 | if (group) |
183 | return group->conf; | |
184 | ||
718e3744 | 185 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
186 | VTY_NEWLINE); | |
187 | ||
188 | return NULL; | |
189 | } | |
190 | ||
94f2b392 | 191 | static int |
718e3744 | 192 | bgp_vty_return (struct vty *vty, int ret) |
193 | { | |
fd79ac91 | 194 | const char *str = NULL; |
718e3744 | 195 | |
196 | switch (ret) | |
197 | { | |
198 | case BGP_ERR_INVALID_VALUE: | |
199 | str = "Invalid value"; | |
200 | break; | |
201 | case BGP_ERR_INVALID_FLAG: | |
202 | str = "Invalid flag"; | |
203 | break; | |
204 | case BGP_ERR_PEER_INACTIVE: | |
205 | str = "Activate the neighbor for the address family first"; | |
206 | break; | |
207 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: | |
208 | str = "Invalid command for a peer-group member"; | |
209 | break; | |
210 | case BGP_ERR_PEER_GROUP_SHUTDOWN: | |
211 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
212 | break; | |
213 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: | |
214 | str = "This peer is a peer-group member. Please change peer-group configuration"; | |
215 | break; | |
216 | case BGP_ERR_PEER_FLAG_CONFLICT: | |
217 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
218 | break; | |
219 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: | |
220 | str = "No activate for peergroup can be given only if peer-group has no members"; | |
221 | break; | |
222 | case BGP_ERR_PEER_BELONGS_TO_GROUP: | |
223 | str = "No activate for an individual peer-group member is invalid"; | |
224 | break; | |
225 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: | |
226 | str = "Activate the peer-group for the address family first"; | |
227 | break; | |
228 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: | |
229 | str = "Specify remote-as or peer-group remote AS first"; | |
230 | break; | |
231 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
232 | str = "Cannot change the peer-group. Deconfigure first"; | |
233 | break; | |
234 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
235 | str = "Cannot have different peer-group for the neighbor"; | |
236 | break; | |
237 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
238 | str = "Prefix/distribute list can not co-exist"; | |
239 | break; | |
240 | case BGP_ERR_NOT_INTERNAL_PEER: | |
241 | str = "Invalid command. Not an internal neighbor"; | |
242 | break; | |
243 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
5000f21c | 244 | str = "remove-private-AS cannot be configured for IBGP peers"; |
718e3744 | 245 | break; |
246 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
247 | str = "Local-AS allowed only for EBGP peers"; | |
248 | break; | |
249 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
250 | str = "Cannot have local-as same as BGP AS number"; | |
251 | break; | |
0df7c91f PJ |
252 | case BGP_ERR_TCPSIG_FAILED: |
253 | str = "Error while applying TCP-Sig to session(s)"; | |
254 | break; | |
fa411a21 NH |
255 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
256 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
257 | break; | |
f5a4827d SH |
258 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
259 | str = "ttl-security only allowed for EBGP peers"; | |
260 | break; | |
c7122e14 DS |
261 | case BGP_ERR_AS_OVERRIDE: |
262 | str = "as-override cannot be configured for IBGP peers"; | |
263 | break; | |
f14e6fdb DS |
264 | case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT: |
265 | str = "Invalid limit for number of dynamic neighbors"; | |
266 | break; | |
267 | case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS: | |
268 | str = "Dynamic neighbor listen range already exists"; | |
269 | break; | |
270 | case BGP_ERR_INVALID_FOR_DYNAMIC_PEER: | |
271 | str = "Operation not allowed on a dynamic neighbor"; | |
272 | break; | |
718e3744 | 273 | } |
274 | if (str) | |
275 | { | |
276 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
277 | return CMD_WARNING; | |
278 | } | |
279 | return CMD_SUCCESS; | |
280 | } | |
281 | ||
282 | /* BGP global configuration. */ | |
283 | ||
284 | DEFUN (bgp_multiple_instance_func, | |
285 | bgp_multiple_instance_cmd, | |
286 | "bgp multiple-instance", | |
287 | BGP_STR | |
288 | "Enable bgp multiple instance\n") | |
289 | { | |
290 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
291 | return CMD_SUCCESS; | |
292 | } | |
293 | ||
294 | DEFUN (no_bgp_multiple_instance, | |
295 | no_bgp_multiple_instance_cmd, | |
296 | "no bgp multiple-instance", | |
297 | NO_STR | |
298 | BGP_STR | |
299 | "BGP multiple instance\n") | |
300 | { | |
301 | int ret; | |
302 | ||
303 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
304 | if (ret < 0) | |
305 | { | |
306 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
307 | return CMD_WARNING; | |
308 | } | |
309 | return CMD_SUCCESS; | |
310 | } | |
311 | ||
312 | DEFUN (bgp_config_type, | |
313 | bgp_config_type_cmd, | |
314 | "bgp config-type (cisco|zebra)", | |
315 | BGP_STR | |
316 | "Configuration type\n" | |
317 | "cisco\n" | |
318 | "zebra\n") | |
319 | { | |
320 | if (strncmp (argv[0], "c", 1) == 0) | |
321 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
322 | else | |
323 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
324 | ||
325 | return CMD_SUCCESS; | |
326 | } | |
327 | ||
328 | DEFUN (no_bgp_config_type, | |
329 | no_bgp_config_type_cmd, | |
330 | "no bgp config-type", | |
331 | NO_STR | |
332 | BGP_STR | |
333 | "Display configuration type\n") | |
334 | { | |
335 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
336 | return CMD_SUCCESS; | |
337 | } | |
338 | ||
339 | DEFUN (no_synchronization, | |
340 | no_synchronization_cmd, | |
341 | "no synchronization", | |
342 | NO_STR | |
343 | "Perform IGP synchronization\n") | |
344 | { | |
345 | return CMD_SUCCESS; | |
346 | } | |
347 | ||
348 | DEFUN (no_auto_summary, | |
349 | no_auto_summary_cmd, | |
350 | "no auto-summary", | |
351 | NO_STR | |
352 | "Enable automatic network number summarization\n") | |
353 | { | |
354 | return CMD_SUCCESS; | |
355 | } | |
3d515fd9 | 356 | |
357 | DEFUN_DEPRECATED (neighbor_version, | |
358 | neighbor_version_cmd, | |
359 | NEIGHBOR_CMD "version (4|4-)", | |
360 | NEIGHBOR_STR | |
361 | NEIGHBOR_ADDR_STR | |
362 | "Set the BGP version to match a neighbor\n" | |
363 | "Neighbor's BGP version\n") | |
364 | { | |
365 | return CMD_SUCCESS; | |
366 | } | |
6b0655a2 | 367 | |
718e3744 | 368 | /* "router bgp" commands. */ |
369 | DEFUN (router_bgp, | |
370 | router_bgp_cmd, | |
320da874 | 371 | "router bgp " CMD_AS_RANGE, |
718e3744 | 372 | ROUTER_STR |
373 | BGP_STR | |
374 | AS_STR) | |
375 | { | |
376 | int ret; | |
377 | as_t as; | |
378 | struct bgp *bgp; | |
fd79ac91 | 379 | const char *name = NULL; |
718e3744 | 380 | |
0b2aa3a0 | 381 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 382 | |
383 | if (argc == 2) | |
384 | name = argv[1]; | |
385 | ||
386 | ret = bgp_get (&bgp, &as, name); | |
387 | switch (ret) | |
388 | { | |
389 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
390 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
391 | VTY_NEWLINE); | |
392 | return CMD_WARNING; | |
718e3744 | 393 | case BGP_ERR_AS_MISMATCH: |
aea339f7 | 394 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); |
718e3744 | 395 | return CMD_WARNING; |
718e3744 | 396 | case BGP_ERR_INSTANCE_MISMATCH: |
397 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); | |
aea339f7 | 398 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
718e3744 | 399 | as, VTY_NEWLINE); |
400 | return CMD_WARNING; | |
718e3744 | 401 | } |
402 | ||
403 | vty->node = BGP_NODE; | |
404 | vty->index = bgp; | |
405 | ||
406 | return CMD_SUCCESS; | |
407 | } | |
408 | ||
409 | ALIAS (router_bgp, | |
410 | router_bgp_view_cmd, | |
320da874 | 411 | "router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 412 | ROUTER_STR |
413 | BGP_STR | |
414 | AS_STR | |
415 | "BGP view\n" | |
416 | "view name\n") | |
6b0655a2 | 417 | |
718e3744 | 418 | /* "no router bgp" commands. */ |
419 | DEFUN (no_router_bgp, | |
420 | no_router_bgp_cmd, | |
320da874 | 421 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 422 | NO_STR |
423 | ROUTER_STR | |
424 | BGP_STR | |
425 | AS_STR) | |
426 | { | |
427 | as_t as; | |
428 | struct bgp *bgp; | |
fd79ac91 | 429 | const char *name = NULL; |
718e3744 | 430 | |
0b2aa3a0 | 431 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 432 | |
433 | if (argc == 2) | |
434 | name = argv[1]; | |
435 | ||
436 | /* Lookup bgp structure. */ | |
437 | bgp = bgp_lookup (as, name); | |
438 | if (! bgp) | |
439 | { | |
440 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
441 | return CMD_WARNING; | |
442 | } | |
443 | ||
444 | bgp_delete (bgp); | |
445 | ||
446 | return CMD_SUCCESS; | |
447 | } | |
448 | ||
449 | ALIAS (no_router_bgp, | |
450 | no_router_bgp_view_cmd, | |
320da874 | 451 | "no router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 452 | NO_STR |
453 | ROUTER_STR | |
454 | BGP_STR | |
455 | AS_STR | |
456 | "BGP view\n" | |
457 | "view name\n") | |
6b0655a2 | 458 | |
718e3744 | 459 | /* BGP router-id. */ |
460 | ||
461 | DEFUN (bgp_router_id, | |
462 | bgp_router_id_cmd, | |
463 | "bgp router-id A.B.C.D", | |
464 | BGP_STR | |
465 | "Override configured router identifier\n" | |
466 | "Manually configured router identifier\n") | |
467 | { | |
468 | int ret; | |
469 | struct in_addr id; | |
470 | struct bgp *bgp; | |
471 | ||
472 | bgp = vty->index; | |
473 | ||
474 | ret = inet_aton (argv[0], &id); | |
475 | if (! ret) | |
476 | { | |
477 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
478 | return CMD_WARNING; | |
479 | } | |
480 | ||
18a6dce6 | 481 | bgp->router_id_static = id; |
718e3744 | 482 | bgp_router_id_set (bgp, &id); |
483 | ||
484 | return CMD_SUCCESS; | |
485 | } | |
486 | ||
487 | DEFUN (no_bgp_router_id, | |
488 | no_bgp_router_id_cmd, | |
489 | "no bgp router-id", | |
490 | NO_STR | |
491 | BGP_STR | |
492 | "Override configured router identifier\n") | |
493 | { | |
494 | int ret; | |
495 | struct in_addr id; | |
496 | struct bgp *bgp; | |
497 | ||
498 | bgp = vty->index; | |
499 | ||
500 | if (argc == 1) | |
501 | { | |
502 | ret = inet_aton (argv[0], &id); | |
503 | if (! ret) | |
504 | { | |
505 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
506 | return CMD_WARNING; | |
507 | } | |
508 | ||
18a6dce6 | 509 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
718e3744 | 510 | { |
511 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
512 | return CMD_WARNING; | |
513 | } | |
514 | } | |
515 | ||
18a6dce6 | 516 | bgp->router_id_static.s_addr = 0; |
517 | bgp_router_id_set (bgp, &router_id_zebra); | |
718e3744 | 518 | |
519 | return CMD_SUCCESS; | |
520 | } | |
521 | ||
522 | ALIAS (no_bgp_router_id, | |
523 | no_bgp_router_id_val_cmd, | |
524 | "no bgp router-id A.B.C.D", | |
525 | NO_STR | |
526 | BGP_STR | |
527 | "Override configured router identifier\n" | |
528 | "Manually configured router identifier\n") | |
6b0655a2 | 529 | |
718e3744 | 530 | /* BGP Cluster ID. */ |
531 | ||
532 | DEFUN (bgp_cluster_id, | |
533 | bgp_cluster_id_cmd, | |
534 | "bgp cluster-id A.B.C.D", | |
535 | BGP_STR | |
536 | "Configure Route-Reflector Cluster-id\n" | |
537 | "Route-Reflector Cluster-id in IP address format\n") | |
538 | { | |
539 | int ret; | |
540 | struct bgp *bgp; | |
541 | struct in_addr cluster; | |
542 | ||
543 | bgp = vty->index; | |
544 | ||
545 | ret = inet_aton (argv[0], &cluster); | |
546 | if (! ret) | |
547 | { | |
548 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
549 | return CMD_WARNING; | |
550 | } | |
551 | ||
552 | bgp_cluster_id_set (bgp, &cluster); | |
553 | ||
554 | return CMD_SUCCESS; | |
555 | } | |
556 | ||
557 | ALIAS (bgp_cluster_id, | |
558 | bgp_cluster_id32_cmd, | |
559 | "bgp cluster-id <1-4294967295>", | |
560 | BGP_STR | |
561 | "Configure Route-Reflector Cluster-id\n" | |
562 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
563 | ||
564 | DEFUN (no_bgp_cluster_id, | |
565 | no_bgp_cluster_id_cmd, | |
566 | "no bgp cluster-id", | |
567 | NO_STR | |
568 | BGP_STR | |
569 | "Configure Route-Reflector Cluster-id\n") | |
570 | { | |
571 | int ret; | |
572 | struct bgp *bgp; | |
573 | struct in_addr cluster; | |
574 | ||
575 | bgp = vty->index; | |
576 | ||
577 | if (argc == 1) | |
578 | { | |
579 | ret = inet_aton (argv[0], &cluster); | |
580 | if (! ret) | |
581 | { | |
582 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
583 | return CMD_WARNING; | |
584 | } | |
585 | } | |
586 | ||
587 | bgp_cluster_id_unset (bgp); | |
588 | ||
589 | return CMD_SUCCESS; | |
590 | } | |
591 | ||
592 | ALIAS (no_bgp_cluster_id, | |
593 | no_bgp_cluster_id_arg_cmd, | |
594 | "no bgp cluster-id A.B.C.D", | |
595 | NO_STR | |
596 | BGP_STR | |
597 | "Configure Route-Reflector Cluster-id\n" | |
598 | "Route-Reflector Cluster-id in IP address format\n") | |
6b0655a2 | 599 | |
718e3744 | 600 | DEFUN (bgp_confederation_identifier, |
601 | bgp_confederation_identifier_cmd, | |
320da874 | 602 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 603 | "BGP specific commands\n" |
604 | "AS confederation parameters\n" | |
605 | "AS number\n" | |
606 | "Set routing domain confederation AS\n") | |
607 | { | |
608 | struct bgp *bgp; | |
609 | as_t as; | |
610 | ||
611 | bgp = vty->index; | |
612 | ||
0b2aa3a0 | 613 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 614 | |
615 | bgp_confederation_id_set (bgp, as); | |
616 | ||
617 | return CMD_SUCCESS; | |
618 | } | |
619 | ||
620 | DEFUN (no_bgp_confederation_identifier, | |
621 | no_bgp_confederation_identifier_cmd, | |
622 | "no bgp confederation identifier", | |
623 | NO_STR | |
624 | "BGP specific commands\n" | |
625 | "AS confederation parameters\n" | |
626 | "AS number\n") | |
627 | { | |
628 | struct bgp *bgp; | |
629 | as_t as; | |
630 | ||
631 | bgp = vty->index; | |
632 | ||
633 | if (argc == 1) | |
0b2aa3a0 | 634 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 635 | |
636 | bgp_confederation_id_unset (bgp); | |
637 | ||
638 | return CMD_SUCCESS; | |
639 | } | |
640 | ||
641 | ALIAS (no_bgp_confederation_identifier, | |
642 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 643 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 644 | NO_STR |
645 | "BGP specific commands\n" | |
646 | "AS confederation parameters\n" | |
647 | "AS number\n" | |
648 | "Set routing domain confederation AS\n") | |
6b0655a2 | 649 | |
718e3744 | 650 | DEFUN (bgp_confederation_peers, |
651 | bgp_confederation_peers_cmd, | |
320da874 | 652 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 653 | "BGP specific commands\n" |
654 | "AS confederation parameters\n" | |
655 | "Peer ASs in BGP confederation\n" | |
656 | AS_STR) | |
657 | { | |
658 | struct bgp *bgp; | |
659 | as_t as; | |
660 | int i; | |
661 | ||
662 | bgp = vty->index; | |
663 | ||
664 | for (i = 0; i < argc; i++) | |
665 | { | |
0b2aa3a0 | 666 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 667 | |
668 | if (bgp->as == as) | |
669 | { | |
670 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
671 | VTY_NEWLINE); | |
672 | continue; | |
673 | } | |
674 | ||
675 | bgp_confederation_peers_add (bgp, as); | |
676 | } | |
677 | return CMD_SUCCESS; | |
678 | } | |
679 | ||
680 | DEFUN (no_bgp_confederation_peers, | |
681 | no_bgp_confederation_peers_cmd, | |
320da874 | 682 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 683 | NO_STR |
684 | "BGP specific commands\n" | |
685 | "AS confederation parameters\n" | |
686 | "Peer ASs in BGP confederation\n" | |
687 | AS_STR) | |
688 | { | |
689 | struct bgp *bgp; | |
690 | as_t as; | |
691 | int i; | |
692 | ||
693 | bgp = vty->index; | |
694 | ||
695 | for (i = 0; i < argc; i++) | |
696 | { | |
0b2aa3a0 PJ |
697 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
698 | ||
718e3744 | 699 | bgp_confederation_peers_remove (bgp, as); |
700 | } | |
701 | return CMD_SUCCESS; | |
702 | } | |
6b0655a2 | 703 | |
5e242b0d DS |
704 | /** |
705 | * Central routine for maximum-paths configuration. | |
706 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
707 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
708 | */ | |
709 | int | |
710 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, char *mpaths, | |
711 | u_int16_t options, int set) | |
165b5fff JB |
712 | { |
713 | struct bgp *bgp; | |
714 | u_int16_t maxpaths; | |
715 | int ret; | |
5e242b0d DS |
716 | afi_t afi; |
717 | safi_t safi; | |
165b5fff JB |
718 | |
719 | bgp = vty->index; | |
5e242b0d DS |
720 | afi = bgp_node_afi (vty); |
721 | safi = bgp_node_safi (vty); | |
165b5fff | 722 | |
5e242b0d DS |
723 | if (set) |
724 | { | |
73ac8160 DS |
725 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
726 | BGP_MAXIMUM_MAXPATHS); | |
5e242b0d DS |
727 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
728 | options); | |
729 | } | |
730 | else | |
731 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 732 | |
165b5fff JB |
733 | if (ret < 0) |
734 | { | |
735 | vty_out (vty, | |
5e242b0d DS |
736 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
737 | (set == 1) ? "" : "un", | |
738 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
739 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
740 | return CMD_WARNING; |
741 | } | |
742 | ||
743 | return CMD_SUCCESS; | |
744 | } | |
745 | ||
abc920f8 DS |
746 | DEFUN (bgp_maxmed_admin, |
747 | bgp_maxmed_admin_cmd, | |
748 | "bgp max-med administrative ", | |
749 | BGP_STR | |
750 | "Advertise routes with max-med\n" | |
751 | "Administratively applied, for an indefinite period\n") | |
752 | { | |
753 | struct bgp *bgp; | |
754 | ||
755 | bgp = vty->index; | |
756 | ||
757 | bgp->v_maxmed_admin = 1; | |
758 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
759 | ||
760 | bgp_maxmed_update(bgp); | |
761 | ||
762 | return CMD_SUCCESS; | |
763 | } | |
764 | ||
765 | DEFUN (bgp_maxmed_admin_medv, | |
766 | bgp_maxmed_admin_medv_cmd, | |
767 | "bgp max-med administrative <0-4294967294>", | |
768 | BGP_STR | |
769 | "Advertise routes with max-med\n" | |
770 | "Administratively applied, for an indefinite period\n" | |
771 | "Max MED value to be used\n") | |
772 | { | |
773 | struct bgp *bgp; | |
774 | ||
775 | bgp = vty->index; | |
776 | ||
777 | bgp->v_maxmed_admin = 1; | |
778 | VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]); | |
779 | ||
780 | bgp_maxmed_update(bgp); | |
781 | ||
782 | return CMD_SUCCESS; | |
783 | } | |
784 | ||
785 | DEFUN (no_bgp_maxmed_admin, | |
786 | no_bgp_maxmed_admin_cmd, | |
787 | "no bgp max-med administrative", | |
788 | NO_STR | |
789 | BGP_STR | |
790 | "Advertise routes with max-med\n" | |
791 | "Administratively applied, for an indefinite period\n") | |
792 | { | |
793 | struct bgp *bgp; | |
794 | ||
795 | bgp = vty->index; | |
796 | ||
797 | bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED; | |
798 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
799 | ||
800 | bgp_maxmed_update(bgp); | |
801 | ||
802 | return CMD_SUCCESS; | |
803 | } | |
804 | ||
805 | ALIAS (no_bgp_maxmed_admin, | |
806 | no_bgp_maxmed_admin_medv_cmd, | |
807 | "no bgp max-med administrative <0-4294967294>", | |
808 | NO_STR | |
809 | BGP_STR | |
810 | "Advertise routes with max-med\n" | |
811 | "Administratively applied, for an indefinite period\n" | |
812 | "Max MED value to be used\n") | |
813 | ||
814 | ||
815 | DEFUN (bgp_maxmed_onstartup, | |
816 | bgp_maxmed_onstartup_cmd, | |
817 | "bgp max-med on-startup <5-86400>", | |
818 | BGP_STR | |
819 | "Advertise routes with max-med\n" | |
820 | "Effective on a startup\n" | |
821 | "Time (seconds) period for max-med\n") | |
822 | { | |
823 | struct bgp *bgp; | |
824 | ||
825 | bgp = vty->index; | |
826 | ||
827 | if (argc != 1) | |
828 | { | |
829 | vty_out (vty, "%% Must supply max-med on-startup period"); | |
830 | return CMD_WARNING; | |
831 | } | |
832 | ||
833 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
834 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
835 | ||
836 | bgp_maxmed_update(bgp); | |
837 | ||
838 | return CMD_SUCCESS; | |
839 | } | |
840 | ||
841 | DEFUN (bgp_maxmed_onstartup_medv, | |
842 | bgp_maxmed_onstartup_medv_cmd, | |
843 | "bgp max-med on-startup <5-86400> <0-4294967294>", | |
844 | BGP_STR | |
845 | "Advertise routes with max-med\n" | |
846 | "Effective on a startup\n" | |
847 | "Time (seconds) period for max-med\n" | |
848 | "Max MED value to be used\n") | |
849 | { | |
850 | struct bgp *bgp; | |
851 | ||
852 | bgp = vty->index; | |
853 | ||
854 | if (argc != 2) | |
855 | { | |
856 | vty_out (vty, "%% Must supply max-med on-startup period and med value"); | |
857 | return CMD_WARNING; | |
858 | } | |
859 | ||
860 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
861 | VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]); | |
862 | ||
863 | bgp_maxmed_update(bgp); | |
864 | ||
865 | return CMD_SUCCESS; | |
866 | } | |
867 | ||
868 | DEFUN (no_bgp_maxmed_onstartup, | |
869 | no_bgp_maxmed_onstartup_cmd, | |
870 | "no bgp max-med on-startup", | |
871 | NO_STR | |
872 | BGP_STR | |
873 | "Advertise routes with max-med\n" | |
874 | "Effective on a startup\n") | |
875 | { | |
876 | struct bgp *bgp; | |
877 | ||
878 | bgp = vty->index; | |
879 | ||
880 | /* Cancel max-med onstartup if its on */ | |
881 | if (bgp->t_maxmed_onstartup) | |
882 | { | |
883 | THREAD_TIMER_OFF (bgp->t_maxmed_onstartup); | |
884 | bgp->maxmed_onstartup_over = 1; | |
885 | } | |
886 | ||
887 | bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED; | |
888 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
889 | ||
890 | bgp_maxmed_update(bgp); | |
891 | ||
892 | return CMD_SUCCESS; | |
893 | } | |
894 | ||
895 | ALIAS (no_bgp_maxmed_onstartup, | |
896 | no_bgp_maxmed_onstartup_period_cmd, | |
897 | "no bgp max-med on-startup <5-86400>", | |
898 | NO_STR | |
899 | BGP_STR | |
900 | "Advertise routes with max-med\n" | |
901 | "Effective on a startup\n" | |
902 | "Time (seconds) period for max-med\n") | |
903 | ||
904 | ALIAS (no_bgp_maxmed_onstartup, | |
905 | no_bgp_maxmed_onstartup_period_medv_cmd, | |
906 | "no bgp max-med on-startup <5-86400> <0-4294967294>", | |
907 | NO_STR | |
908 | BGP_STR | |
909 | "Advertise routes with max-med\n" | |
910 | "Effective on a startup\n" | |
911 | "Time (seconds) period for max-med\n" | |
912 | "Max MED value to be used\n") | |
913 | ||
f188f2c4 DS |
914 | static int |
915 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
916 | const char *wait) | |
917 | { | |
918 | struct bgp *bgp; | |
919 | u_int16_t update_delay; | |
920 | u_int16_t establish_wait; | |
921 | ||
922 | ||
923 | bgp = vty->index; | |
924 | ||
925 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
926 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
927 | ||
928 | if (!wait) /* update-delay <delay> */ | |
929 | { | |
930 | bgp->v_update_delay = update_delay; | |
931 | bgp->v_establish_wait = bgp->v_update_delay; | |
932 | return CMD_SUCCESS; | |
933 | } | |
934 | ||
935 | /* update-delay <delay> <establish-wait> */ | |
936 | establish_wait = atoi (wait); | |
937 | if (update_delay < establish_wait) | |
938 | { | |
939 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
940 | VTY_NEWLINE); | |
941 | return CMD_WARNING; | |
942 | } | |
943 | ||
944 | bgp->v_update_delay = update_delay; | |
945 | bgp->v_establish_wait = establish_wait; | |
946 | ||
947 | return CMD_SUCCESS; | |
948 | } | |
949 | ||
950 | static int | |
951 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
952 | { | |
953 | struct bgp *bgp; | |
954 | ||
955 | bgp = vty->index; | |
956 | ||
957 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
958 | bgp->v_establish_wait = bgp->v_update_delay; | |
959 | ||
960 | return CMD_SUCCESS; | |
961 | } | |
962 | ||
963 | int | |
964 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
965 | { | |
966 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
967 | { | |
968 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
969 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
970 | vty_out (vty, " %d", bgp->v_establish_wait); | |
971 | vty_out (vty, "%s", VTY_NEWLINE); | |
972 | } | |
973 | ||
974 | return 0; | |
975 | } | |
976 | ||
977 | ||
978 | /* Update-delay configuration */ | |
979 | DEFUN (bgp_update_delay, | |
980 | bgp_update_delay_cmd, | |
981 | "update-delay <0-3600>", | |
982 | "Force initial delay for best-path and updates\n" | |
983 | "Seconds\n") | |
984 | { | |
985 | return bgp_update_delay_config_vty(vty, argv[0], NULL); | |
986 | } | |
987 | ||
988 | DEFUN (bgp_update_delay_establish_wait, | |
989 | bgp_update_delay_establish_wait_cmd, | |
990 | "update-delay <0-3600> <1-3600>", | |
991 | "Force initial delay for best-path and updates\n" | |
992 | "Seconds\n" | |
993 | "Wait for peers to be established\n" | |
994 | "Seconds\n") | |
995 | { | |
996 | return bgp_update_delay_config_vty(vty, argv[0], argv[1]); | |
997 | } | |
998 | ||
999 | /* Update-delay deconfiguration */ | |
1000 | DEFUN (no_bgp_update_delay, | |
1001 | no_bgp_update_delay_cmd, | |
1002 | "no update-delay <0-3600>", | |
1003 | "Force initial delay for best-path and updates\n" | |
1004 | "Seconds\n") | |
1005 | { | |
1006 | return bgp_update_delay_deconfig_vty(vty); | |
1007 | } | |
1008 | ||
1009 | ALIAS (no_bgp_update_delay, | |
1010 | no_bgp_update_delay_establish_wait_cmd, | |
1011 | "no update-delay <0-3600> <1-3600>", | |
1012 | "Force initial delay for best-path and updates\n" | |
1013 | "Seconds\n" | |
1014 | "Wait for peers to be established\n" | |
1015 | "Seconds\n") | |
5e242b0d | 1016 | |
cb1faec9 DS |
1017 | int |
1018 | bgp_wpkt_quanta_config_vty (struct vty *vty, char *num, char set) | |
1019 | { | |
1020 | struct bgp *bgp; | |
1021 | u_int16_t update_delay; | |
1022 | ||
1023 | bgp = vty->index; | |
1024 | ||
1025 | if (set) | |
1026 | VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num, | |
1027 | 1, 4294967295); | |
1028 | else | |
1029 | bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX; | |
1030 | ||
1031 | return CMD_SUCCESS; | |
1032 | } | |
1033 | ||
1034 | int | |
1035 | bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) | |
1036 | { | |
1037 | if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX) | |
1038 | vty_out (vty, " write-quanta %d%s", | |
1039 | bgp->wpkt_quanta, VTY_NEWLINE); | |
1040 | ||
1041 | return 0; | |
1042 | } | |
1043 | ||
1044 | ||
1045 | /* Update-delay configuration */ | |
1046 | DEFUN (bgp_wpkt_quanta, | |
1047 | bgp_wpkt_quanta_cmd, | |
1048 | "write-quanta <1-4294967295>", | |
1049 | "How many packets to write to peer socket per run\n" | |
1050 | "Number of packets\n") | |
1051 | { | |
1052 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 1); | |
1053 | } | |
1054 | ||
1055 | /* Update-delay deconfiguration */ | |
1056 | DEFUN (no_bgp_wpkt_quanta, | |
1057 | no_bgp_wpkt_quanta_cmd, | |
1058 | "no write-quanta <1-4294967295>", | |
1059 | "How many packets to write to peer socket per run\n" | |
1060 | "Number of packets\n") | |
1061 | { | |
1062 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); | |
1063 | } | |
1064 | ||
3f9c7369 DS |
1065 | int |
1066 | bgp_coalesce_config_vty (struct vty *vty, const char *num, char set) | |
1067 | { | |
1068 | struct bgp *bgp; | |
1069 | ||
1070 | bgp = vty->index; | |
1071 | ||
1072 | if (set) | |
1073 | VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num, | |
1074 | 0, 4294967295); | |
1075 | else | |
1076 | bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; | |
1077 | ||
1078 | return CMD_SUCCESS; | |
1079 | } | |
1080 | ||
1081 | int | |
1082 | bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp) | |
1083 | { | |
1084 | if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME) | |
1085 | vty_out (vty, " coalesce-time %d%s", | |
1086 | bgp->coalesce_time, VTY_NEWLINE); | |
1087 | ||
1088 | return 0; | |
1089 | } | |
1090 | ||
1091 | ||
1092 | DEFUN (bgp_coalesce_time, | |
1093 | bgp_coalesce_time_cmd, | |
1094 | "coalesce-time <0-4294967295>", | |
1095 | "Subgroup coalesce timer\n" | |
1096 | "Subgroup coalesce timer value (in ms)\n") | |
1097 | { | |
1098 | return bgp_coalesce_config_vty(vty, argv[0], 1); | |
1099 | } | |
1100 | ||
1101 | DEFUN (no_bgp_coalesce_time, | |
1102 | no_bgp_coalesce_time_cmd, | |
1103 | "no coalesce-time <0-4294967295>", | |
1104 | "Subgroup coalesce timer\n" | |
1105 | "Subgroup coalesce timer value (in ms)\n") | |
1106 | { | |
1107 | return bgp_coalesce_config_vty(vty, argv[0], 0); | |
1108 | } | |
1109 | ||
5e242b0d DS |
1110 | /* Maximum-paths configuration */ |
1111 | DEFUN (bgp_maxpaths, | |
1112 | bgp_maxpaths_cmd, | |
1113 | "maximum-paths <1-255>", | |
1114 | "Forward packets over multiple paths\n" | |
1115 | "Number of paths\n") | |
1116 | { | |
1117 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); | |
1118 | } | |
1119 | ||
165b5fff JB |
1120 | DEFUN (bgp_maxpaths_ibgp, |
1121 | bgp_maxpaths_ibgp_cmd, | |
1122 | "maximum-paths ibgp <1-255>", | |
1123 | "Forward packets over multiple paths\n" | |
1124 | "iBGP-multipath\n" | |
1125 | "Number of paths\n") | |
1126 | { | |
5e242b0d DS |
1127 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); |
1128 | } | |
165b5fff | 1129 | |
5e242b0d DS |
1130 | DEFUN (bgp_maxpaths_ibgp_cluster, |
1131 | bgp_maxpaths_ibgp_cluster_cmd, | |
1132 | "maximum-paths ibgp <1-255> equal-cluster-length", | |
1133 | "Forward packets over multiple paths\n" | |
1134 | "iBGP-multipath\n" | |
1135 | "Number of paths\n" | |
1136 | "Match the cluster length\n") | |
1137 | { | |
1138 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], | |
1139 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); | |
165b5fff JB |
1140 | } |
1141 | ||
1142 | DEFUN (no_bgp_maxpaths, | |
1143 | no_bgp_maxpaths_cmd, | |
1144 | "no maximum-paths", | |
1145 | NO_STR | |
1146 | "Forward packets over multiple paths\n" | |
1147 | "Number of paths\n") | |
1148 | { | |
5e242b0d | 1149 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
1150 | } |
1151 | ||
1152 | ALIAS (no_bgp_maxpaths, | |
1153 | no_bgp_maxpaths_arg_cmd, | |
1154 | "no maximum-paths <1-255>", | |
1155 | NO_STR | |
1156 | "Forward packets over multiple paths\n" | |
1157 | "Number of paths\n") | |
1158 | ||
1159 | DEFUN (no_bgp_maxpaths_ibgp, | |
1160 | no_bgp_maxpaths_ibgp_cmd, | |
1161 | "no maximum-paths ibgp", | |
1162 | NO_STR | |
1163 | "Forward packets over multiple paths\n" | |
1164 | "iBGP-multipath\n" | |
1165 | "Number of paths\n") | |
1166 | { | |
5e242b0d | 1167 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
1168 | } |
1169 | ||
1170 | ALIAS (no_bgp_maxpaths_ibgp, | |
1171 | no_bgp_maxpaths_ibgp_arg_cmd, | |
1172 | "no maximum-paths ibgp <1-255>", | |
1173 | NO_STR | |
1174 | "Forward packets over multiple paths\n" | |
1175 | "iBGP-multipath\n" | |
1176 | "Number of paths\n") | |
1177 | ||
5e242b0d DS |
1178 | ALIAS (no_bgp_maxpaths_ibgp, |
1179 | no_bgp_maxpaths_ibgp_cluster_cmd, | |
1180 | "no maximum-paths ibgp <1-255> equal-cluster-length", | |
1181 | NO_STR | |
1182 | "Forward packets over multiple paths\n" | |
1183 | "iBGP-multipath\n" | |
1184 | "Number of paths\n" | |
1185 | "Match the cluster length\n") | |
1186 | ||
165b5fff JB |
1187 | int |
1188 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
1189 | safi_t safi, int *write) | |
1190 | { | |
1191 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) | |
1192 | { | |
1193 | bgp_config_write_family_header (vty, afi, safi, write); | |
1194 | vty_out (vty, " maximum-paths %d%s", | |
1195 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); | |
1196 | } | |
1197 | ||
1198 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) | |
1199 | { | |
1200 | bgp_config_write_family_header (vty, afi, safi, write); | |
5e242b0d DS |
1201 | vty_out (vty, " maximum-paths ibgp %d", |
1202 | bgp->maxpaths[afi][safi].maxpaths_ibgp); | |
1203 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
1204 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
1205 | vty_out (vty, " equal-cluster-length"); | |
1206 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
1207 | } |
1208 | ||
1209 | return 0; | |
1210 | } | |
6b0655a2 | 1211 | |
718e3744 | 1212 | /* BGP timers. */ |
1213 | ||
1214 | DEFUN (bgp_timers, | |
1215 | bgp_timers_cmd, | |
1216 | "timers bgp <0-65535> <0-65535>", | |
1217 | "Adjust routing timers\n" | |
1218 | "BGP timers\n" | |
1219 | "Keepalive interval\n" | |
1220 | "Holdtime\n") | |
1221 | { | |
1222 | struct bgp *bgp; | |
1223 | unsigned long keepalive = 0; | |
1224 | unsigned long holdtime = 0; | |
1225 | ||
1226 | bgp = vty->index; | |
1227 | ||
1228 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
1229 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
1230 | ||
1231 | /* Holdtime value check. */ | |
1232 | if (holdtime < 3 && holdtime != 0) | |
1233 | { | |
1234 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
1235 | VTY_NEWLINE); | |
1236 | return CMD_WARNING; | |
1237 | } | |
1238 | ||
1239 | bgp_timers_set (bgp, keepalive, holdtime); | |
1240 | ||
1241 | return CMD_SUCCESS; | |
1242 | } | |
1243 | ||
1244 | DEFUN (no_bgp_timers, | |
1245 | no_bgp_timers_cmd, | |
1246 | "no timers bgp", | |
1247 | NO_STR | |
1248 | "Adjust routing timers\n" | |
1249 | "BGP timers\n") | |
1250 | { | |
1251 | struct bgp *bgp; | |
1252 | ||
1253 | bgp = vty->index; | |
1254 | bgp_timers_unset (bgp); | |
1255 | ||
1256 | return CMD_SUCCESS; | |
1257 | } | |
1258 | ||
1259 | ALIAS (no_bgp_timers, | |
1260 | no_bgp_timers_arg_cmd, | |
1261 | "no timers bgp <0-65535> <0-65535>", | |
1262 | NO_STR | |
1263 | "Adjust routing timers\n" | |
1264 | "BGP timers\n" | |
1265 | "Keepalive interval\n" | |
1266 | "Holdtime\n") | |
6b0655a2 | 1267 | |
718e3744 | 1268 | DEFUN (bgp_client_to_client_reflection, |
1269 | bgp_client_to_client_reflection_cmd, | |
1270 | "bgp client-to-client reflection", | |
1271 | "BGP specific commands\n" | |
1272 | "Configure client to client route reflection\n" | |
1273 | "reflection of routes allowed\n") | |
1274 | { | |
1275 | struct bgp *bgp; | |
1276 | ||
1277 | bgp = vty->index; | |
1278 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
1279 | return CMD_SUCCESS; | |
1280 | } | |
1281 | ||
1282 | DEFUN (no_bgp_client_to_client_reflection, | |
1283 | no_bgp_client_to_client_reflection_cmd, | |
1284 | "no bgp client-to-client reflection", | |
1285 | NO_STR | |
1286 | "BGP specific commands\n" | |
1287 | "Configure client to client route reflection\n" | |
1288 | "reflection of routes allowed\n") | |
1289 | { | |
1290 | struct bgp *bgp; | |
1291 | ||
1292 | bgp = vty->index; | |
1293 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
1294 | return CMD_SUCCESS; | |
1295 | } | |
1296 | ||
1297 | /* "bgp always-compare-med" configuration. */ | |
1298 | DEFUN (bgp_always_compare_med, | |
1299 | bgp_always_compare_med_cmd, | |
1300 | "bgp always-compare-med", | |
1301 | "BGP specific commands\n" | |
1302 | "Allow comparing MED from different neighbors\n") | |
1303 | { | |
1304 | struct bgp *bgp; | |
1305 | ||
1306 | bgp = vty->index; | |
1307 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
1308 | return CMD_SUCCESS; | |
1309 | } | |
1310 | ||
1311 | DEFUN (no_bgp_always_compare_med, | |
1312 | no_bgp_always_compare_med_cmd, | |
1313 | "no bgp always-compare-med", | |
1314 | NO_STR | |
1315 | "BGP specific commands\n" | |
1316 | "Allow comparing MED from different neighbors\n") | |
1317 | { | |
1318 | struct bgp *bgp; | |
1319 | ||
1320 | bgp = vty->index; | |
1321 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
1322 | return CMD_SUCCESS; | |
1323 | } | |
6b0655a2 | 1324 | |
718e3744 | 1325 | /* "bgp deterministic-med" configuration. */ |
1326 | DEFUN (bgp_deterministic_med, | |
1327 | bgp_deterministic_med_cmd, | |
1328 | "bgp deterministic-med", | |
1329 | "BGP specific commands\n" | |
1330 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1331 | { | |
1332 | struct bgp *bgp; | |
1333 | ||
1334 | bgp = vty->index; | |
1335 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1336 | return CMD_SUCCESS; | |
1337 | } | |
1338 | ||
1339 | DEFUN (no_bgp_deterministic_med, | |
1340 | no_bgp_deterministic_med_cmd, | |
1341 | "no bgp deterministic-med", | |
1342 | NO_STR | |
1343 | "BGP specific commands\n" | |
1344 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1345 | { | |
1346 | struct bgp *bgp; | |
1347 | ||
1348 | bgp = vty->index; | |
1349 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1350 | return CMD_SUCCESS; | |
1351 | } | |
538621f2 | 1352 | |
1353 | /* "bgp graceful-restart" configuration. */ | |
1354 | DEFUN (bgp_graceful_restart, | |
1355 | bgp_graceful_restart_cmd, | |
1356 | "bgp graceful-restart", | |
1357 | "BGP specific commands\n" | |
1358 | "Graceful restart capability parameters\n") | |
1359 | { | |
1360 | struct bgp *bgp; | |
1361 | ||
1362 | bgp = vty->index; | |
1363 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1364 | return CMD_SUCCESS; | |
1365 | } | |
1366 | ||
1367 | DEFUN (no_bgp_graceful_restart, | |
1368 | no_bgp_graceful_restart_cmd, | |
1369 | "no bgp graceful-restart", | |
1370 | NO_STR | |
1371 | "BGP specific commands\n" | |
1372 | "Graceful restart capability parameters\n") | |
1373 | { | |
1374 | struct bgp *bgp; | |
1375 | ||
1376 | bgp = vty->index; | |
1377 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1378 | return CMD_SUCCESS; | |
1379 | } | |
1380 | ||
93406d87 | 1381 | DEFUN (bgp_graceful_restart_stalepath_time, |
1382 | bgp_graceful_restart_stalepath_time_cmd, | |
1383 | "bgp graceful-restart stalepath-time <1-3600>", | |
1384 | "BGP specific commands\n" | |
1385 | "Graceful restart capability parameters\n" | |
1386 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1387 | "Delay value (seconds)\n") | |
1388 | { | |
1389 | struct bgp *bgp; | |
1390 | u_int32_t stalepath; | |
1391 | ||
1392 | bgp = vty->index; | |
1393 | if (! bgp) | |
1394 | return CMD_WARNING; | |
1395 | ||
1396 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
1397 | bgp->stalepath_time = stalepath; | |
1398 | return CMD_SUCCESS; | |
1399 | } | |
1400 | ||
1401 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
1402 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1403 | "no bgp graceful-restart stalepath-time", | |
1404 | NO_STR | |
1405 | "BGP specific commands\n" | |
1406 | "Graceful restart capability parameters\n" | |
1407 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1408 | { | |
1409 | struct bgp *bgp; | |
1410 | ||
1411 | bgp = vty->index; | |
1412 | if (! bgp) | |
1413 | return CMD_WARNING; | |
1414 | ||
1415 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1416 | return CMD_SUCCESS; | |
1417 | } | |
1418 | ||
1419 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
1420 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
1421 | "no bgp graceful-restart stalepath-time <1-3600>", | |
1422 | NO_STR | |
1423 | "BGP specific commands\n" | |
1424 | "Graceful restart capability parameters\n" | |
1425 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1426 | "Delay value (seconds)\n") | |
1427 | ||
718e3744 | 1428 | /* "bgp fast-external-failover" configuration. */ |
1429 | DEFUN (bgp_fast_external_failover, | |
1430 | bgp_fast_external_failover_cmd, | |
1431 | "bgp fast-external-failover", | |
1432 | BGP_STR | |
1433 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1434 | { | |
1435 | struct bgp *bgp; | |
1436 | ||
1437 | bgp = vty->index; | |
1438 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1439 | return CMD_SUCCESS; | |
1440 | } | |
1441 | ||
1442 | DEFUN (no_bgp_fast_external_failover, | |
1443 | no_bgp_fast_external_failover_cmd, | |
1444 | "no bgp fast-external-failover", | |
1445 | NO_STR | |
1446 | BGP_STR | |
1447 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1448 | { | |
1449 | struct bgp *bgp; | |
1450 | ||
1451 | bgp = vty->index; | |
1452 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1453 | return CMD_SUCCESS; | |
1454 | } | |
6b0655a2 | 1455 | |
718e3744 | 1456 | /* "bgp enforce-first-as" configuration. */ |
1457 | DEFUN (bgp_enforce_first_as, | |
1458 | bgp_enforce_first_as_cmd, | |
1459 | "bgp enforce-first-as", | |
1460 | BGP_STR | |
1461 | "Enforce the first AS for EBGP routes\n") | |
1462 | { | |
1463 | struct bgp *bgp; | |
1464 | ||
1465 | bgp = vty->index; | |
1466 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
1467 | return CMD_SUCCESS; | |
1468 | } | |
1469 | ||
1470 | DEFUN (no_bgp_enforce_first_as, | |
1471 | no_bgp_enforce_first_as_cmd, | |
1472 | "no bgp enforce-first-as", | |
1473 | NO_STR | |
1474 | BGP_STR | |
1475 | "Enforce the first AS for EBGP routes\n") | |
1476 | { | |
1477 | struct bgp *bgp; | |
1478 | ||
1479 | bgp = vty->index; | |
1480 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
1481 | return CMD_SUCCESS; | |
1482 | } | |
6b0655a2 | 1483 | |
718e3744 | 1484 | /* "bgp bestpath compare-routerid" configuration. */ |
1485 | DEFUN (bgp_bestpath_compare_router_id, | |
1486 | bgp_bestpath_compare_router_id_cmd, | |
1487 | "bgp bestpath compare-routerid", | |
1488 | "BGP specific commands\n" | |
1489 | "Change the default bestpath selection\n" | |
1490 | "Compare router-id for identical EBGP paths\n") | |
1491 | { | |
1492 | struct bgp *bgp; | |
1493 | ||
1494 | bgp = vty->index; | |
1495 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
1496 | return CMD_SUCCESS; | |
1497 | } | |
1498 | ||
1499 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1500 | no_bgp_bestpath_compare_router_id_cmd, | |
1501 | "no bgp bestpath compare-routerid", | |
1502 | NO_STR | |
1503 | "BGP specific commands\n" | |
1504 | "Change the default bestpath selection\n" | |
1505 | "Compare router-id for identical EBGP paths\n") | |
1506 | { | |
1507 | struct bgp *bgp; | |
1508 | ||
1509 | bgp = vty->index; | |
1510 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
1511 | return CMD_SUCCESS; | |
1512 | } | |
6b0655a2 | 1513 | |
718e3744 | 1514 | /* "bgp bestpath as-path ignore" configuration. */ |
1515 | DEFUN (bgp_bestpath_aspath_ignore, | |
1516 | bgp_bestpath_aspath_ignore_cmd, | |
1517 | "bgp bestpath as-path ignore", | |
1518 | "BGP specific commands\n" | |
1519 | "Change the default bestpath selection\n" | |
1520 | "AS-path attribute\n" | |
1521 | "Ignore as-path length in selecting a route\n") | |
1522 | { | |
1523 | struct bgp *bgp; | |
1524 | ||
1525 | bgp = vty->index; | |
1526 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
1527 | return CMD_SUCCESS; | |
1528 | } | |
1529 | ||
1530 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
1531 | no_bgp_bestpath_aspath_ignore_cmd, | |
1532 | "no bgp bestpath as-path ignore", | |
1533 | NO_STR | |
1534 | "BGP specific commands\n" | |
1535 | "Change the default bestpath selection\n" | |
1536 | "AS-path attribute\n" | |
1537 | "Ignore as-path length in selecting a route\n") | |
1538 | { | |
1539 | struct bgp *bgp; | |
1540 | ||
1541 | bgp = vty->index; | |
1542 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
1543 | return CMD_SUCCESS; | |
1544 | } | |
6b0655a2 | 1545 | |
6811845b | 1546 | /* "bgp bestpath as-path confed" configuration. */ |
1547 | DEFUN (bgp_bestpath_aspath_confed, | |
1548 | bgp_bestpath_aspath_confed_cmd, | |
1549 | "bgp bestpath as-path confed", | |
1550 | "BGP specific commands\n" | |
1551 | "Change the default bestpath selection\n" | |
1552 | "AS-path attribute\n" | |
1553 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1554 | { | |
1555 | struct bgp *bgp; | |
1556 | ||
1557 | bgp = vty->index; | |
1558 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
1559 | return CMD_SUCCESS; | |
1560 | } | |
1561 | ||
1562 | DEFUN (no_bgp_bestpath_aspath_confed, | |
1563 | no_bgp_bestpath_aspath_confed_cmd, | |
1564 | "no bgp bestpath as-path confed", | |
1565 | NO_STR | |
1566 | "BGP specific commands\n" | |
1567 | "Change the default bestpath selection\n" | |
1568 | "AS-path attribute\n" | |
1569 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1570 | { | |
1571 | struct bgp *bgp; | |
1572 | ||
1573 | bgp = vty->index; | |
1574 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
1575 | return CMD_SUCCESS; | |
1576 | } | |
6b0655a2 | 1577 | |
2fdd455c PM |
1578 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
1579 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
1580 | bgp_bestpath_aspath_multipath_relax_cmd, | |
1581 | "bgp bestpath as-path multipath-relax", | |
1582 | "BGP specific commands\n" | |
1583 | "Change the default bestpath selection\n" | |
1584 | "AS-path attribute\n" | |
1585 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1586 | { | |
1587 | struct bgp *bgp; | |
1588 | ||
1589 | bgp = vty->index; | |
1590 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
16fc1eec | 1591 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); |
2fdd455c PM |
1592 | return CMD_SUCCESS; |
1593 | } | |
1594 | ||
1595 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, | |
1596 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
1597 | "no bgp bestpath as-path multipath-relax", | |
1598 | NO_STR | |
1599 | "BGP specific commands\n" | |
1600 | "Change the default bestpath selection\n" | |
1601 | "AS-path attribute\n" | |
1602 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1603 | { | |
1604 | struct bgp *bgp; | |
1605 | ||
1606 | bgp = vty->index; | |
1607 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
16fc1eec DS |
1608 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); |
1609 | return CMD_SUCCESS; | |
1610 | } | |
1611 | ||
1612 | /* "bgp bestpath as-path multipath-relax no-as-set" configuration. */ | |
1613 | DEFUN (bgp_bestpath_aspath_multipath_relax_no_as_set, | |
1614 | bgp_bestpath_aspath_multipath_relax_no_as_set_cmd, | |
1615 | "bgp bestpath as-path multipath-relax no-as-set", | |
1616 | "BGP specific commands\n" | |
1617 | "Change the default bestpath selection\n" | |
1618 | "AS-path attribute\n" | |
1619 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
1620 | "Do not generate an AS_SET\n") | |
1621 | { | |
1622 | struct bgp *bgp; | |
1623 | ||
1624 | bgp = vty->index; | |
1625 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1626 | bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); | |
1627 | return CMD_SUCCESS; | |
1628 | } | |
1629 | ||
1630 | DEFUN (no_bgp_bestpath_aspath_multipath_relax_no_as_set, | |
1631 | no_bgp_bestpath_aspath_multipath_relax_no_as_set_cmd, | |
1632 | "no bgp bestpath as-path multipath-relax no-as-set", | |
1633 | NO_STR | |
1634 | "BGP specific commands\n" | |
1635 | "Change the default bestpath selection\n" | |
1636 | "AS-path attribute\n" | |
1637 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
1638 | "Do not generate an AS_SET\n") | |
1639 | { | |
1640 | struct bgp *bgp; | |
1641 | ||
1642 | bgp = vty->index; | |
1643 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1644 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); | |
2fdd455c PM |
1645 | return CMD_SUCCESS; |
1646 | } | |
6b0655a2 | 1647 | |
848973c7 | 1648 | /* "bgp log-neighbor-changes" configuration. */ |
1649 | DEFUN (bgp_log_neighbor_changes, | |
1650 | bgp_log_neighbor_changes_cmd, | |
1651 | "bgp log-neighbor-changes", | |
1652 | "BGP specific commands\n" | |
1653 | "Log neighbor up/down and reset reason\n") | |
1654 | { | |
1655 | struct bgp *bgp; | |
1656 | ||
1657 | bgp = vty->index; | |
1658 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1659 | return CMD_SUCCESS; | |
1660 | } | |
1661 | ||
1662 | DEFUN (no_bgp_log_neighbor_changes, | |
1663 | no_bgp_log_neighbor_changes_cmd, | |
1664 | "no bgp log-neighbor-changes", | |
1665 | NO_STR | |
1666 | "BGP specific commands\n" | |
1667 | "Log neighbor up/down and reset reason\n") | |
1668 | { | |
1669 | struct bgp *bgp; | |
1670 | ||
1671 | bgp = vty->index; | |
1672 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1673 | return CMD_SUCCESS; | |
1674 | } | |
6b0655a2 | 1675 | |
718e3744 | 1676 | /* "bgp bestpath med" configuration. */ |
1677 | DEFUN (bgp_bestpath_med, | |
1678 | bgp_bestpath_med_cmd, | |
1679 | "bgp bestpath med (confed|missing-as-worst)", | |
1680 | "BGP specific commands\n" | |
1681 | "Change the default bestpath selection\n" | |
1682 | "MED attribute\n" | |
1683 | "Compare MED among confederation paths\n" | |
1684 | "Treat missing MED as the least preferred one\n") | |
1685 | { | |
1686 | struct bgp *bgp; | |
1687 | ||
1688 | bgp = vty->index; | |
1689 | ||
1690 | if (strncmp (argv[0], "confed", 1) == 0) | |
1691 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
1692 | else | |
1693 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1694 | ||
1695 | return CMD_SUCCESS; | |
1696 | } | |
1697 | ||
1698 | DEFUN (bgp_bestpath_med2, | |
1699 | bgp_bestpath_med2_cmd, | |
1700 | "bgp bestpath med confed missing-as-worst", | |
1701 | "BGP specific commands\n" | |
1702 | "Change the default bestpath selection\n" | |
1703 | "MED attribute\n" | |
1704 | "Compare MED among confederation paths\n" | |
1705 | "Treat missing MED as the least preferred one\n") | |
1706 | { | |
1707 | struct bgp *bgp; | |
1708 | ||
1709 | bgp = vty->index; | |
1710 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
1711 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1712 | return CMD_SUCCESS; | |
1713 | } | |
1714 | ||
1715 | ALIAS (bgp_bestpath_med2, | |
1716 | bgp_bestpath_med3_cmd, | |
1717 | "bgp bestpath med missing-as-worst confed", | |
1718 | "BGP specific commands\n" | |
1719 | "Change the default bestpath selection\n" | |
1720 | "MED attribute\n" | |
1721 | "Treat missing MED as the least preferred one\n" | |
1722 | "Compare MED among confederation paths\n") | |
1723 | ||
1724 | DEFUN (no_bgp_bestpath_med, | |
1725 | no_bgp_bestpath_med_cmd, | |
1726 | "no bgp bestpath med (confed|missing-as-worst)", | |
1727 | NO_STR | |
1728 | "BGP specific commands\n" | |
1729 | "Change the default bestpath selection\n" | |
1730 | "MED attribute\n" | |
1731 | "Compare MED among confederation paths\n" | |
1732 | "Treat missing MED as the least preferred one\n") | |
1733 | { | |
1734 | struct bgp *bgp; | |
1735 | ||
1736 | bgp = vty->index; | |
1737 | ||
1738 | if (strncmp (argv[0], "confed", 1) == 0) | |
1739 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
1740 | else | |
1741 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1742 | ||
1743 | return CMD_SUCCESS; | |
1744 | } | |
1745 | ||
1746 | DEFUN (no_bgp_bestpath_med2, | |
1747 | no_bgp_bestpath_med2_cmd, | |
1748 | "no bgp bestpath med confed missing-as-worst", | |
1749 | NO_STR | |
1750 | "BGP specific commands\n" | |
1751 | "Change the default bestpath selection\n" | |
1752 | "MED attribute\n" | |
1753 | "Compare MED among confederation paths\n" | |
1754 | "Treat missing MED as the least preferred one\n") | |
1755 | { | |
1756 | struct bgp *bgp; | |
1757 | ||
1758 | bgp = vty->index; | |
1759 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
1760 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1761 | return CMD_SUCCESS; | |
1762 | } | |
1763 | ||
1764 | ALIAS (no_bgp_bestpath_med2, | |
1765 | no_bgp_bestpath_med3_cmd, | |
1766 | "no bgp bestpath med missing-as-worst confed", | |
1767 | NO_STR | |
1768 | "BGP specific commands\n" | |
1769 | "Change the default bestpath selection\n" | |
1770 | "MED attribute\n" | |
1771 | "Treat missing MED as the least preferred one\n" | |
1772 | "Compare MED among confederation paths\n") | |
6b0655a2 | 1773 | |
718e3744 | 1774 | /* "no bgp default ipv4-unicast". */ |
1775 | DEFUN (no_bgp_default_ipv4_unicast, | |
1776 | no_bgp_default_ipv4_unicast_cmd, | |
1777 | "no bgp default ipv4-unicast", | |
1778 | NO_STR | |
1779 | "BGP specific commands\n" | |
1780 | "Configure BGP defaults\n" | |
1781 | "Activate ipv4-unicast for a peer by default\n") | |
1782 | { | |
1783 | struct bgp *bgp; | |
1784 | ||
1785 | bgp = vty->index; | |
1786 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
1787 | return CMD_SUCCESS; | |
1788 | } | |
1789 | ||
1790 | DEFUN (bgp_default_ipv4_unicast, | |
1791 | bgp_default_ipv4_unicast_cmd, | |
1792 | "bgp default ipv4-unicast", | |
1793 | "BGP specific commands\n" | |
1794 | "Configure BGP defaults\n" | |
1795 | "Activate ipv4-unicast for a peer by default\n") | |
1796 | { | |
1797 | struct bgp *bgp; | |
1798 | ||
1799 | bgp = vty->index; | |
1800 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
1801 | return CMD_SUCCESS; | |
1802 | } | |
6b0655a2 | 1803 | |
718e3744 | 1804 | /* "bgp import-check" configuration. */ |
1805 | DEFUN (bgp_network_import_check, | |
1806 | bgp_network_import_check_cmd, | |
1807 | "bgp network import-check", | |
1808 | "BGP specific commands\n" | |
1809 | "BGP network command\n" | |
1810 | "Check BGP network route exists in IGP\n") | |
1811 | { | |
1812 | struct bgp *bgp; | |
1813 | ||
1814 | bgp = vty->index; | |
1815 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
1816 | return CMD_SUCCESS; | |
1817 | } | |
1818 | ||
1819 | DEFUN (no_bgp_network_import_check, | |
1820 | no_bgp_network_import_check_cmd, | |
1821 | "no bgp network import-check", | |
1822 | NO_STR | |
1823 | "BGP specific commands\n" | |
1824 | "BGP network command\n" | |
1825 | "Check BGP network route exists in IGP\n") | |
1826 | { | |
1827 | struct bgp *bgp; | |
1828 | ||
1829 | bgp = vty->index; | |
1830 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
1831 | return CMD_SUCCESS; | |
1832 | } | |
6b0655a2 | 1833 | |
718e3744 | 1834 | DEFUN (bgp_default_local_preference, |
1835 | bgp_default_local_preference_cmd, | |
1836 | "bgp default local-preference <0-4294967295>", | |
1837 | "BGP specific commands\n" | |
1838 | "Configure BGP defaults\n" | |
1839 | "local preference (higher=more preferred)\n" | |
1840 | "Configure default local preference value\n") | |
1841 | { | |
1842 | struct bgp *bgp; | |
1843 | u_int32_t local_pref; | |
1844 | ||
1845 | bgp = vty->index; | |
1846 | ||
1847 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
1848 | ||
1849 | bgp_default_local_preference_set (bgp, local_pref); | |
1850 | ||
1851 | return CMD_SUCCESS; | |
1852 | } | |
1853 | ||
1854 | DEFUN (no_bgp_default_local_preference, | |
1855 | no_bgp_default_local_preference_cmd, | |
1856 | "no bgp default local-preference", | |
1857 | NO_STR | |
1858 | "BGP specific commands\n" | |
1859 | "Configure BGP defaults\n" | |
1860 | "local preference (higher=more preferred)\n") | |
1861 | { | |
1862 | struct bgp *bgp; | |
1863 | ||
1864 | bgp = vty->index; | |
1865 | bgp_default_local_preference_unset (bgp); | |
1866 | return CMD_SUCCESS; | |
1867 | } | |
1868 | ||
1869 | ALIAS (no_bgp_default_local_preference, | |
1870 | no_bgp_default_local_preference_val_cmd, | |
1871 | "no bgp default local-preference <0-4294967295>", | |
1872 | NO_STR | |
1873 | "BGP specific commands\n" | |
1874 | "Configure BGP defaults\n" | |
1875 | "local preference (higher=more preferred)\n" | |
1876 | "Configure default local preference value\n") | |
6b0655a2 | 1877 | |
3f9c7369 DS |
1878 | DEFUN (bgp_default_subgroup_pkt_queue_max, |
1879 | bgp_default_subgroup_pkt_queue_max_cmd, | |
1880 | "bgp default subgroup-pkt-queue-max <20-100>", | |
1881 | "BGP specific commands\n" | |
1882 | "Configure BGP defaults\n" | |
1883 | "subgroup-pkt-queue-max\n" | |
1884 | "Configure subgroup packet queue max\n") | |
8bd9d948 | 1885 | { |
3f9c7369 DS |
1886 | struct bgp *bgp; |
1887 | u_int32_t max_size; | |
8bd9d948 | 1888 | |
3f9c7369 DS |
1889 | bgp = vty->index; |
1890 | ||
1891 | VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]); | |
1892 | ||
1893 | bgp_default_subgroup_pkt_queue_max_set (bgp, max_size); | |
1894 | ||
1895 | return CMD_SUCCESS; | |
1896 | } | |
1897 | ||
1898 | DEFUN (no_bgp_default_subgroup_pkt_queue_max, | |
1899 | no_bgp_default_subgroup_pkt_queue_max_cmd, | |
1900 | "no bgp default subgroup-pkt-queue-max", | |
1901 | NO_STR | |
1902 | "BGP specific commands\n" | |
1903 | "Configure BGP defaults\n" | |
1904 | "subgroup-pkt-queue-max\n") | |
1905 | { | |
1906 | struct bgp *bgp; | |
1907 | ||
1908 | bgp = vty->index; | |
1909 | bgp_default_subgroup_pkt_queue_max_unset (bgp); | |
1910 | return CMD_SUCCESS; | |
8bd9d948 DS |
1911 | } |
1912 | ||
1913 | DEFUN (bgp_rr_allow_outbound_policy, | |
1914 | bgp_rr_allow_outbound_policy_cmd, | |
1915 | "bgp route-reflector allow-outbound-policy", | |
1916 | "BGP specific commands\n" | |
1917 | "Allow modifications made by out route-map\n" | |
1918 | "on ibgp neighbors\n") | |
1919 | { | |
1920 | struct bgp *bgp; | |
1921 | u_int32_t local_pref; | |
1922 | int ret; | |
1923 | ||
1924 | bgp = vty->index; | |
1925 | ||
1926 | if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
1927 | { | |
1928 | bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 1929 | update_group_announce_rrclients(bgp); |
8bd9d948 DS |
1930 | } |
1931 | ||
1932 | return CMD_SUCCESS; | |
1933 | } | |
1934 | ||
1935 | DEFUN (no_bgp_rr_allow_outbound_policy, | |
1936 | no_bgp_rr_allow_outbound_policy_cmd, | |
1937 | "no bgp route-reflector allow-outbound-policy", | |
1938 | NO_STR | |
1939 | "BGP specific commands\n" | |
1940 | "Allow modifications made by out route-map\n" | |
1941 | "on ibgp neighbors\n") | |
1942 | { | |
1943 | struct bgp *bgp; | |
1944 | u_int32_t local_pref; | |
1945 | ||
1946 | bgp = vty->index; | |
1947 | ||
1948 | if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
1949 | { | |
1950 | bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 1951 | update_group_announce_rrclients(bgp); |
8bd9d948 DS |
1952 | } |
1953 | ||
1954 | return CMD_SUCCESS; | |
1955 | } | |
1956 | ||
f14e6fdb DS |
1957 | DEFUN (bgp_listen_limit, |
1958 | bgp_listen_limit_cmd, | |
1959 | "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
1960 | "BGP specific commands\n" | |
1961 | "Configure BGP defaults\n" | |
1962 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
1963 | "Configure Dynamic Neighbors listen limit value\n") | |
1964 | { | |
1965 | struct bgp *bgp; | |
1966 | int listen_limit; | |
1967 | ||
1968 | bgp = vty->index; | |
1969 | ||
1970 | VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0], | |
1971 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN, | |
1972 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX); | |
1973 | ||
1974 | bgp_listen_limit_set (bgp, listen_limit); | |
1975 | ||
1976 | return CMD_SUCCESS; | |
1977 | } | |
1978 | ||
1979 | DEFUN (no_bgp_listen_limit, | |
1980 | no_bgp_listen_limit_cmd, | |
1981 | "no bgp listen limit", | |
1982 | "BGP specific commands\n" | |
1983 | "Configure BGP defaults\n" | |
1984 | "unset maximum number of BGP Dynamic Neighbors that can be created\n" | |
1985 | "Configure Dynamic Neighbors listen limit value to default\n") | |
1986 | { | |
1987 | struct bgp *bgp; | |
1988 | ||
1989 | bgp = vty->index; | |
1990 | bgp_listen_limit_unset (bgp); | |
1991 | return CMD_SUCCESS; | |
1992 | } | |
1993 | ||
1994 | ||
1995 | DEFUN (bgp_listen_range, | |
1996 | bgp_listen_range_cmd, | |
1997 | LISTEN_RANGE_CMD "peer-group WORD" , | |
1998 | "BGP specific commands\n" | |
1999 | "Configure BGP Dynamic Neighbors\n" | |
2000 | "add a listening range for Dynamic Neighbors\n" | |
2001 | LISTEN_RANGE_ADDR_STR) | |
2002 | { | |
2003 | struct bgp *bgp; | |
2004 | struct prefix range; | |
2005 | struct peer_group *group; | |
2006 | afi_t afi; | |
2007 | int ret; | |
2008 | ||
2009 | bgp = vty->index; | |
2010 | ||
2011 | //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2012 | ||
2013 | /* Convert IP prefix string to struct prefix. */ | |
2014 | ret = str2prefix (argv[0], &range); | |
2015 | if (! ret) | |
2016 | { | |
2017 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2018 | return CMD_WARNING; | |
2019 | } | |
2020 | ||
2021 | afi = family2afi(range.family); | |
2022 | ||
2023 | #ifdef HAVE_IPV6 | |
2024 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2025 | { | |
2026 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2027 | VTY_NEWLINE); | |
2028 | return CMD_WARNING; | |
2029 | } | |
2030 | #endif /* HAVE_IPV6 */ | |
2031 | ||
2032 | apply_mask (&range); | |
2033 | ||
2034 | ||
2035 | group = peer_group_lookup (bgp, argv[1]); | |
2036 | if (! group) | |
2037 | { | |
2038 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2039 | return CMD_WARNING; | |
2040 | } | |
2041 | ||
2042 | ret = peer_group_listen_range_add(group, &range); | |
2043 | return bgp_vty_return (vty, ret); | |
2044 | } | |
2045 | ||
2046 | DEFUN (no_bgp_listen_range, | |
2047 | no_bgp_listen_range_cmd, | |
2048 | "no bgp listen range A.B.C.D/M peer-group WORD" , | |
2049 | "BGP specific commands\n" | |
2050 | "Configure BGP defaults\n" | |
2051 | "delete a listening range for Dynamic Neighbors\n" | |
2052 | "Remove Dynamic Neighbors listening range\n") | |
2053 | { | |
2054 | struct bgp *bgp; | |
2055 | struct prefix range; | |
2056 | struct peer_group *group; | |
2057 | afi_t afi; | |
2058 | int ret; | |
2059 | ||
2060 | bgp = vty->index; | |
2061 | ||
2062 | // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2063 | ||
2064 | /* Convert IP prefix string to struct prefix. */ | |
2065 | ret = str2prefix (argv[0], &range); | |
2066 | if (! ret) | |
2067 | { | |
2068 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2069 | return CMD_WARNING; | |
2070 | } | |
2071 | ||
2072 | afi = family2afi(range.family); | |
2073 | ||
2074 | #ifdef HAVE_IPV6 | |
2075 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2076 | { | |
2077 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2078 | VTY_NEWLINE); | |
2079 | return CMD_WARNING; | |
2080 | } | |
2081 | #endif /* HAVE_IPV6 */ | |
2082 | ||
2083 | apply_mask (&range); | |
2084 | ||
2085 | ||
2086 | group = peer_group_lookup (bgp, argv[1]); | |
2087 | if (! group) | |
2088 | { | |
2089 | vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); | |
2090 | return CMD_WARNING; | |
2091 | } | |
2092 | ||
2093 | ret = peer_group_listen_range_del(group, &range); | |
2094 | return bgp_vty_return (vty, ret); | |
2095 | } | |
2096 | ||
2097 | int | |
2098 | bgp_config_write_listen (struct vty *vty, struct bgp *bgp) | |
2099 | { | |
2100 | struct peer_group *group; | |
2101 | struct listnode *node, *nnode, *rnode, *nrnode; | |
2102 | struct prefix *range; | |
2103 | afi_t afi; | |
2104 | char buf[128]; | |
2105 | ||
2106 | if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT) | |
2107 | vty_out (vty, " bgp listen limit %d%s", | |
2108 | bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
2109 | ||
2110 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2111 | { | |
2112 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
2113 | { | |
2114 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range)) | |
2115 | { | |
2116 | prefix2str(range, buf, sizeof(buf)); | |
2117 | vty_out(vty, " bgp listen range %s peer-group %s%s", | |
2118 | buf, group->name, VTY_NEWLINE); | |
2119 | } | |
2120 | } | |
2121 | } | |
2122 | ||
2123 | return 0; | |
2124 | } | |
2125 | ||
2126 | ||
907f92c8 DS |
2127 | DEFUN (bgp_disable_connected_route_check, |
2128 | bgp_disable_connected_route_check_cmd, | |
2129 | "bgp disable-ebgp-connected-route-check", | |
2130 | "BGP specific commands\n" | |
2131 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2132 | { | |
2133 | struct bgp *bgp; | |
2134 | ||
2135 | bgp = vty->index; | |
2136 | bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
2137 | return CMD_SUCCESS; | |
2138 | } | |
2139 | ||
2140 | DEFUN (no_bgp_disable_connected_route_check, | |
2141 | no_bgp_disable_connected_route_check_cmd, | |
2142 | "no bgp disable-ebgp-connected-route-check", | |
2143 | NO_STR | |
2144 | "BGP specific commands\n" | |
2145 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2146 | { | |
2147 | struct bgp *bgp; | |
2148 | ||
2149 | bgp = vty->index; | |
2150 | bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
2151 | return CMD_SUCCESS; | |
2152 | } | |
2153 | ||
2154 | ||
718e3744 | 2155 | static int |
fd79ac91 | 2156 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
2157 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 2158 | { |
2159 | int ret; | |
2160 | struct bgp *bgp; | |
2161 | as_t as; | |
2162 | union sockunion su; | |
2163 | ||
2164 | bgp = vty->index; | |
2165 | ||
2166 | /* Get AS number. */ | |
0b2aa3a0 | 2167 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); |
718e3744 | 2168 | |
2169 | /* If peer is peer group, call proper function. */ | |
2170 | ret = str2sockunion (peer_str, &su); | |
2171 | if (ret < 0) | |
2172 | { | |
a80beece DS |
2173 | /* Check for peer by interface */ |
2174 | ret = peer_remote_as (bgp, NULL, peer_str, &as, afi, safi); | |
718e3744 | 2175 | if (ret < 0) |
a80beece DS |
2176 | { |
2177 | ret = peer_group_remote_as (bgp, peer_str, &as); | |
2178 | if (ret < 0) | |
2179 | { | |
2180 | vty_out (vty, "%% Create the peer-group or interface first%s", | |
2181 | VTY_NEWLINE); | |
2182 | return CMD_WARNING; | |
2183 | } | |
2184 | return CMD_SUCCESS; | |
2185 | } | |
718e3744 | 2186 | } |
a80beece | 2187 | else |
718e3744 | 2188 | { |
a80beece DS |
2189 | if (peer_address_self_check (&su)) |
2190 | { | |
2191 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2192 | VTY_NEWLINE); | |
2193 | return CMD_WARNING; | |
2194 | } | |
2195 | ret = peer_remote_as (bgp, &su, NULL, &as, afi, safi); | |
718e3744 | 2196 | } |
2197 | ||
718e3744 | 2198 | /* This peer belongs to peer group. */ |
2199 | switch (ret) | |
2200 | { | |
2201 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 2202 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 2203 | return CMD_WARNING; |
718e3744 | 2204 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 2205 | 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); |
718e3744 | 2206 | return CMD_WARNING; |
718e3744 | 2207 | } |
2208 | return bgp_vty_return (vty, ret); | |
2209 | } | |
2210 | ||
2211 | DEFUN (neighbor_remote_as, | |
2212 | neighbor_remote_as_cmd, | |
320da874 | 2213 | NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, |
718e3744 | 2214 | NEIGHBOR_STR |
2215 | NEIGHBOR_ADDR_STR2 | |
2216 | "Specify a BGP neighbor\n" | |
2217 | AS_STR) | |
2218 | { | |
2219 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
2220 | } | |
6b0655a2 | 2221 | |
a80beece DS |
2222 | DEFUN (neighbor_interface_config, |
2223 | neighbor_interface_config_cmd, | |
2224 | "neighbor WORD interface", | |
2225 | NEIGHBOR_STR | |
2226 | "Interface name or neighbor tag\n" | |
2227 | "Enable BGP on interface\n") | |
2228 | { | |
2229 | struct bgp *bgp; | |
2230 | struct peer *peer; | |
2231 | struct peer_group *group; | |
2232 | ||
2233 | bgp = vty->index; | |
2234 | group = peer_group_lookup (bgp, argv[0]); | |
2235 | if (group) | |
2236 | { | |
2237 | vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE); | |
2238 | return CMD_WARNING; | |
2239 | } | |
2240 | ||
2241 | peer = peer_conf_interface_get (bgp, argv[0], AFI_IP, SAFI_UNICAST); | |
2242 | if (!peer) | |
2243 | return CMD_WARNING; | |
2244 | ||
2245 | return CMD_SUCCESS; | |
2246 | } | |
2247 | ||
2248 | ||
718e3744 | 2249 | DEFUN (neighbor_peer_group, |
2250 | neighbor_peer_group_cmd, | |
2251 | "neighbor WORD peer-group", | |
2252 | NEIGHBOR_STR | |
a80beece | 2253 | "Interface name or neighbor tag\n" |
718e3744 | 2254 | "Configure peer-group\n") |
2255 | { | |
2256 | struct bgp *bgp; | |
a80beece | 2257 | struct peer *peer; |
718e3744 | 2258 | struct peer_group *group; |
2259 | ||
2260 | bgp = vty->index; | |
a80beece DS |
2261 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2262 | if (peer) | |
2263 | { | |
2264 | vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); | |
2265 | return CMD_WARNING; | |
2266 | } | |
718e3744 | 2267 | |
2268 | group = peer_group_get (bgp, argv[0]); | |
2269 | if (! group) | |
2270 | return CMD_WARNING; | |
2271 | ||
2272 | return CMD_SUCCESS; | |
2273 | } | |
2274 | ||
2275 | DEFUN (no_neighbor, | |
2276 | no_neighbor_cmd, | |
2277 | NO_NEIGHBOR_CMD2, | |
2278 | NO_STR | |
2279 | NEIGHBOR_STR | |
2280 | NEIGHBOR_ADDR_STR2) | |
2281 | { | |
2282 | int ret; | |
2283 | union sockunion su; | |
2284 | struct peer_group *group; | |
2285 | struct peer *peer; | |
1ff9a340 | 2286 | struct peer *other; |
718e3744 | 2287 | |
2288 | ret = str2sockunion (argv[0], &su); | |
2289 | if (ret < 0) | |
2290 | { | |
a80beece DS |
2291 | /* look up for neighbor by interface name config. */ |
2292 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2293 | if (peer) | |
2294 | { | |
2295 | peer_delete (peer); | |
2296 | return CMD_SUCCESS; | |
2297 | } | |
2298 | ||
718e3744 | 2299 | group = peer_group_lookup (vty->index, argv[0]); |
2300 | if (group) | |
2301 | peer_group_delete (group); | |
2302 | else | |
2303 | { | |
2304 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2305 | return CMD_WARNING; | |
2306 | } | |
2307 | } | |
2308 | else | |
2309 | { | |
2310 | peer = peer_lookup (vty->index, &su); | |
2311 | if (peer) | |
1ff9a340 | 2312 | { |
f14e6fdb DS |
2313 | if (peer_dynamic_neighbor (peer)) |
2314 | { | |
2315 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
2316 | VTY_NEWLINE); | |
2317 | return CMD_WARNING; | |
2318 | } | |
2319 | ||
1ff9a340 DS |
2320 | other = peer->doppelganger; |
2321 | peer_delete (peer); | |
2322 | if (other && other->status != Deleted) | |
2323 | peer_delete(other); | |
2324 | } | |
718e3744 | 2325 | } |
2326 | ||
2327 | return CMD_SUCCESS; | |
2328 | } | |
2329 | ||
2330 | ALIAS (no_neighbor, | |
2331 | no_neighbor_remote_as_cmd, | |
320da874 | 2332 | NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, |
718e3744 | 2333 | NO_STR |
2334 | NEIGHBOR_STR | |
2335 | NEIGHBOR_ADDR_STR | |
2336 | "Specify a BGP neighbor\n" | |
2337 | AS_STR) | |
2338 | ||
a80beece DS |
2339 | DEFUN (no_neighbor_interface_config, |
2340 | no_neighbor_interface_config_cmd, | |
2341 | "no neighbor WORD interface", | |
2342 | NO_STR | |
2343 | NEIGHBOR_STR | |
2344 | "Interface name\n" | |
2345 | "Configure BGP on interface\n") | |
2346 | { | |
2347 | struct peer *peer; | |
2348 | ||
2349 | /* look up for neighbor by interface name config. */ | |
2350 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2351 | if (peer) | |
2352 | { | |
2353 | peer_delete (peer); | |
2354 | } | |
2355 | else | |
2356 | { | |
2357 | vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE); | |
2358 | return CMD_WARNING; | |
2359 | } | |
2360 | return CMD_SUCCESS; | |
2361 | } | |
2362 | ||
718e3744 | 2363 | DEFUN (no_neighbor_peer_group, |
2364 | no_neighbor_peer_group_cmd, | |
2365 | "no neighbor WORD peer-group", | |
2366 | NO_STR | |
2367 | NEIGHBOR_STR | |
2368 | "Neighbor tag\n" | |
2369 | "Configure peer-group\n") | |
2370 | { | |
2371 | struct peer_group *group; | |
2372 | ||
2373 | group = peer_group_lookup (vty->index, argv[0]); | |
2374 | if (group) | |
2375 | peer_group_delete (group); | |
2376 | else | |
2377 | { | |
2378 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2379 | return CMD_WARNING; | |
2380 | } | |
2381 | return CMD_SUCCESS; | |
2382 | } | |
2383 | ||
a80beece DS |
2384 | DEFUN (no_neighbor_interface_peer_group_remote_as, |
2385 | no_neighbor_interface_peer_group_remote_as_cmd, | |
320da874 | 2386 | "no neighbor WORD remote-as " CMD_AS_RANGE, |
718e3744 | 2387 | NO_STR |
2388 | NEIGHBOR_STR | |
a80beece | 2389 | "Interface name or neighbor tag\n" |
718e3744 | 2390 | "Specify a BGP neighbor\n" |
2391 | AS_STR) | |
2392 | { | |
2393 | struct peer_group *group; | |
a80beece DS |
2394 | struct peer *peer; |
2395 | ||
2396 | /* look up for neighbor by interface name config. */ | |
2397 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2398 | if (peer) | |
2399 | { | |
2400 | peer_as_change (peer, 0); | |
2401 | return CMD_SUCCESS; | |
2402 | } | |
718e3744 | 2403 | |
2404 | group = peer_group_lookup (vty->index, argv[0]); | |
2405 | if (group) | |
2406 | peer_group_remote_as_delete (group); | |
2407 | else | |
2408 | { | |
a80beece | 2409 | vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE); |
718e3744 | 2410 | return CMD_WARNING; |
2411 | } | |
2412 | return CMD_SUCCESS; | |
2413 | } | |
6b0655a2 | 2414 | |
718e3744 | 2415 | DEFUN (neighbor_local_as, |
2416 | neighbor_local_as_cmd, | |
320da874 | 2417 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 2418 | NEIGHBOR_STR |
2419 | NEIGHBOR_ADDR_STR2 | |
2420 | "Specify a local-as number\n" | |
2421 | "AS number used as local AS\n") | |
2422 | { | |
2423 | struct peer *peer; | |
2424 | int ret; | |
2425 | ||
2426 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2427 | if (! peer) | |
2428 | return CMD_WARNING; | |
2429 | ||
9d3f9705 | 2430 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
718e3744 | 2431 | return bgp_vty_return (vty, ret); |
2432 | } | |
2433 | ||
2434 | DEFUN (neighbor_local_as_no_prepend, | |
2435 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 2436 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 2437 | NEIGHBOR_STR |
2438 | NEIGHBOR_ADDR_STR2 | |
2439 | "Specify a local-as number\n" | |
2440 | "AS number used as local AS\n" | |
2441 | "Do not prepend local-as to updates from ebgp peers\n") | |
2442 | { | |
2443 | struct peer *peer; | |
2444 | int ret; | |
2445 | ||
2446 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2447 | if (! peer) | |
2448 | return CMD_WARNING; | |
2449 | ||
9d3f9705 | 2450 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
718e3744 | 2451 | return bgp_vty_return (vty, ret); |
2452 | } | |
2453 | ||
9d3f9705 AC |
2454 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
2455 | neighbor_local_as_no_prepend_replace_as_cmd, | |
2456 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
2457 | NEIGHBOR_STR | |
2458 | NEIGHBOR_ADDR_STR2 | |
2459 | "Specify a local-as number\n" | |
2460 | "AS number used as local AS\n" | |
2461 | "Do not prepend local-as to updates from ebgp peers\n" | |
2462 | "Do not prepend local-as to updates from ibgp peers\n") | |
2463 | { | |
2464 | struct peer *peer; | |
2465 | int ret; | |
2466 | ||
2467 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2468 | if (! peer) | |
2469 | return CMD_WARNING; | |
2470 | ||
2471 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); | |
2472 | return bgp_vty_return (vty, ret); | |
2473 | } | |
2474 | ||
2475 | ||
718e3744 | 2476 | DEFUN (no_neighbor_local_as, |
2477 | no_neighbor_local_as_cmd, | |
2478 | NO_NEIGHBOR_CMD2 "local-as", | |
2479 | NO_STR | |
2480 | NEIGHBOR_STR | |
2481 | NEIGHBOR_ADDR_STR2 | |
2482 | "Specify a local-as number\n") | |
2483 | { | |
2484 | struct peer *peer; | |
2485 | int ret; | |
2486 | ||
2487 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2488 | if (! peer) | |
2489 | return CMD_WARNING; | |
2490 | ||
2491 | ret = peer_local_as_unset (peer); | |
2492 | return bgp_vty_return (vty, ret); | |
2493 | } | |
2494 | ||
2495 | ALIAS (no_neighbor_local_as, | |
2496 | no_neighbor_local_as_val_cmd, | |
320da874 | 2497 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 2498 | NO_STR |
2499 | NEIGHBOR_STR | |
2500 | NEIGHBOR_ADDR_STR2 | |
2501 | "Specify a local-as number\n" | |
2502 | "AS number used as local AS\n") | |
2503 | ||
2504 | ALIAS (no_neighbor_local_as, | |
2505 | no_neighbor_local_as_val2_cmd, | |
320da874 | 2506 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 2507 | NO_STR |
2508 | NEIGHBOR_STR | |
2509 | NEIGHBOR_ADDR_STR2 | |
2510 | "Specify a local-as number\n" | |
2511 | "AS number used as local AS\n" | |
2512 | "Do not prepend local-as to updates from ebgp peers\n") | |
9d3f9705 AC |
2513 | |
2514 | ALIAS (no_neighbor_local_as, | |
2515 | no_neighbor_local_as_val3_cmd, | |
2516 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
2517 | NO_STR | |
2518 | NEIGHBOR_STR | |
2519 | NEIGHBOR_ADDR_STR2 | |
2520 | "Specify a local-as number\n" | |
2521 | "AS number used as local AS\n" | |
2522 | "Do not prepend local-as to updates from ebgp peers\n" | |
2523 | "Do not prepend local-as to updates from ibgp peers\n") | |
6b0655a2 | 2524 | |
3f9c7369 DS |
2525 | DEFUN (neighbor_solo, |
2526 | neighbor_solo_cmd, | |
2527 | NEIGHBOR_CMD2 "solo", | |
2528 | NEIGHBOR_STR | |
2529 | NEIGHBOR_ADDR_STR2 | |
2530 | "Solo peer - part of its own update group\n") | |
2531 | { | |
2532 | struct peer *peer; | |
2533 | int ret; | |
2534 | ||
2535 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2536 | if (! peer) | |
2537 | return CMD_WARNING; | |
2538 | ||
2539 | ret = update_group_adjust_soloness(peer, 1); | |
2540 | return bgp_vty_return (vty, ret); | |
2541 | } | |
2542 | ||
2543 | DEFUN (no_neighbor_solo, | |
2544 | no_neighbor_solo_cmd, | |
2545 | NO_NEIGHBOR_CMD2 "solo", | |
2546 | NO_STR | |
2547 | NEIGHBOR_STR | |
2548 | NEIGHBOR_ADDR_STR2 | |
2549 | "Solo peer - part of its own update group\n") | |
2550 | { | |
2551 | struct peer *peer; | |
2552 | int ret; | |
2553 | ||
2554 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2555 | if (! peer) | |
2556 | return CMD_WARNING; | |
2557 | ||
2558 | ret = update_group_adjust_soloness(peer, 0); | |
2559 | return bgp_vty_return (vty, ret); | |
2560 | } | |
2561 | ||
0df7c91f PJ |
2562 | DEFUN (neighbor_password, |
2563 | neighbor_password_cmd, | |
2564 | NEIGHBOR_CMD2 "password LINE", | |
2565 | NEIGHBOR_STR | |
2566 | NEIGHBOR_ADDR_STR2 | |
2567 | "Set a password\n" | |
2568 | "The password\n") | |
2569 | { | |
2570 | struct peer *peer; | |
2571 | int ret; | |
2572 | ||
2573 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2574 | if (! peer) | |
2575 | return CMD_WARNING; | |
2576 | ||
2577 | ret = peer_password_set (peer, argv[1]); | |
2578 | return bgp_vty_return (vty, ret); | |
2579 | } | |
2580 | ||
2581 | DEFUN (no_neighbor_password, | |
2582 | no_neighbor_password_cmd, | |
2583 | NO_NEIGHBOR_CMD2 "password", | |
2584 | NO_STR | |
2585 | NEIGHBOR_STR | |
2586 | NEIGHBOR_ADDR_STR2 | |
2587 | "Set a password\n") | |
2588 | { | |
2589 | struct peer *peer; | |
2590 | int ret; | |
2591 | ||
2592 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2593 | if (! peer) | |
2594 | return CMD_WARNING; | |
2595 | ||
2596 | ret = peer_password_unset (peer); | |
2597 | return bgp_vty_return (vty, ret); | |
2598 | } | |
6b0655a2 | 2599 | |
718e3744 | 2600 | DEFUN (neighbor_activate, |
2601 | neighbor_activate_cmd, | |
2602 | NEIGHBOR_CMD2 "activate", | |
2603 | NEIGHBOR_STR | |
2604 | NEIGHBOR_ADDR_STR2 | |
2605 | "Enable the Address Family for this Neighbor\n") | |
2606 | { | |
2607 | struct peer *peer; | |
2608 | ||
2609 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2610 | if (! peer) | |
2611 | return CMD_WARNING; | |
2612 | ||
2613 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
2614 | ||
2615 | return CMD_SUCCESS; | |
2616 | } | |
2617 | ||
2618 | DEFUN (no_neighbor_activate, | |
2619 | no_neighbor_activate_cmd, | |
2620 | NO_NEIGHBOR_CMD2 "activate", | |
2621 | NO_STR | |
2622 | NEIGHBOR_STR | |
2623 | NEIGHBOR_ADDR_STR2 | |
2624 | "Enable the Address Family for this Neighbor\n") | |
2625 | { | |
2626 | int ret; | |
2627 | struct peer *peer; | |
2628 | ||
2629 | /* Lookup peer. */ | |
2630 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2631 | if (! peer) | |
2632 | return CMD_WARNING; | |
2633 | ||
2634 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
2635 | ||
2636 | return bgp_vty_return (vty, ret); | |
2637 | } | |
6b0655a2 | 2638 | |
718e3744 | 2639 | DEFUN (neighbor_set_peer_group, |
2640 | neighbor_set_peer_group_cmd, | |
a80beece | 2641 | NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 2642 | NEIGHBOR_STR |
a80beece | 2643 | NEIGHBOR_ADDR_STR2 |
718e3744 | 2644 | "Member of the peer-group\n" |
2645 | "peer-group name\n") | |
2646 | { | |
2647 | int ret; | |
2648 | as_t as; | |
2649 | union sockunion su; | |
2650 | struct bgp *bgp; | |
a80beece | 2651 | struct peer *peer; |
718e3744 | 2652 | struct peer_group *group; |
2653 | ||
2654 | bgp = vty->index; | |
a80beece | 2655 | peer = NULL; |
718e3744 | 2656 | |
2657 | ret = str2sockunion (argv[0], &su); | |
2658 | if (ret < 0) | |
2659 | { | |
a80beece DS |
2660 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2661 | if (!peer) | |
2662 | { | |
2663 | vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); | |
2664 | return CMD_WARNING; | |
2665 | } | |
2666 | } | |
2667 | else | |
2668 | { | |
2669 | if (peer_address_self_check (&su)) | |
2670 | { | |
2671 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2672 | VTY_NEWLINE); | |
2673 | return CMD_WARNING; | |
2674 | } | |
f14e6fdb DS |
2675 | |
2676 | /* Disallow for dynamic neighbor. */ | |
2677 | peer = peer_lookup (bgp, &su); | |
2678 | if (peer && peer_dynamic_neighbor (peer)) | |
2679 | { | |
2680 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
2681 | VTY_NEWLINE); | |
2682 | return CMD_WARNING; | |
2683 | } | |
718e3744 | 2684 | } |
2685 | ||
2686 | group = peer_group_lookup (bgp, argv[1]); | |
2687 | if (! group) | |
2688 | { | |
2689 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2690 | return CMD_WARNING; | |
2691 | } | |
2692 | ||
a80beece | 2693 | ret = peer_group_bind (bgp, &su, peer, group, bgp_node_afi (vty), |
718e3744 | 2694 | bgp_node_safi (vty), &as); |
2695 | ||
2696 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
2697 | { | |
aea339f7 | 2698 | 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); |
718e3744 | 2699 | return CMD_WARNING; |
2700 | } | |
2701 | ||
2702 | return bgp_vty_return (vty, ret); | |
2703 | } | |
2704 | ||
2705 | DEFUN (no_neighbor_set_peer_group, | |
2706 | no_neighbor_set_peer_group_cmd, | |
a80beece | 2707 | NO_NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 2708 | NO_STR |
2709 | NEIGHBOR_STR | |
a80beece | 2710 | NEIGHBOR_ADDR_STR2 |
718e3744 | 2711 | "Member of the peer-group\n" |
2712 | "peer-group name\n") | |
2713 | { | |
2714 | int ret; | |
2715 | struct bgp *bgp; | |
2716 | struct peer *peer; | |
2717 | struct peer_group *group; | |
2718 | ||
2719 | bgp = vty->index; | |
2720 | ||
2721 | peer = peer_lookup_vty (vty, argv[0]); | |
2722 | if (! peer) | |
2723 | return CMD_WARNING; | |
2724 | ||
2725 | group = peer_group_lookup (bgp, argv[1]); | |
2726 | if (! group) | |
2727 | { | |
2728 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2729 | return CMD_WARNING; | |
2730 | } | |
2731 | ||
2732 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), | |
2733 | bgp_node_safi (vty)); | |
2734 | ||
2735 | return bgp_vty_return (vty, ret); | |
2736 | } | |
6b0655a2 | 2737 | |
94f2b392 | 2738 | static int |
fd79ac91 | 2739 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
2740 | u_int16_t flag, int set) | |
718e3744 | 2741 | { |
2742 | int ret; | |
2743 | struct peer *peer; | |
2744 | ||
2745 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2746 | if (! peer) | |
2747 | return CMD_WARNING; | |
2748 | ||
2749 | if (set) | |
2750 | ret = peer_flag_set (peer, flag); | |
2751 | else | |
2752 | ret = peer_flag_unset (peer, flag); | |
2753 | ||
2754 | return bgp_vty_return (vty, ret); | |
2755 | } | |
2756 | ||
94f2b392 | 2757 | static int |
fd79ac91 | 2758 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 2759 | { |
2760 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
2761 | } | |
2762 | ||
94f2b392 | 2763 | static int |
fd79ac91 | 2764 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 2765 | { |
2766 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
2767 | } | |
2768 | ||
2769 | /* neighbor passive. */ | |
2770 | DEFUN (neighbor_passive, | |
2771 | neighbor_passive_cmd, | |
2772 | NEIGHBOR_CMD2 "passive", | |
2773 | NEIGHBOR_STR | |
2774 | NEIGHBOR_ADDR_STR2 | |
2775 | "Don't send open messages to this neighbor\n") | |
2776 | { | |
2777 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
2778 | } | |
2779 | ||
2780 | DEFUN (no_neighbor_passive, | |
2781 | no_neighbor_passive_cmd, | |
2782 | NO_NEIGHBOR_CMD2 "passive", | |
2783 | NO_STR | |
2784 | NEIGHBOR_STR | |
2785 | NEIGHBOR_ADDR_STR2 | |
2786 | "Don't send open messages to this neighbor\n") | |
2787 | { | |
2788 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
2789 | } | |
6b0655a2 | 2790 | |
718e3744 | 2791 | /* neighbor shutdown. */ |
2792 | DEFUN (neighbor_shutdown, | |
2793 | neighbor_shutdown_cmd, | |
2794 | NEIGHBOR_CMD2 "shutdown", | |
2795 | NEIGHBOR_STR | |
2796 | NEIGHBOR_ADDR_STR2 | |
2797 | "Administratively shut down this neighbor\n") | |
2798 | { | |
2799 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
2800 | } | |
2801 | ||
2802 | DEFUN (no_neighbor_shutdown, | |
2803 | no_neighbor_shutdown_cmd, | |
2804 | NO_NEIGHBOR_CMD2 "shutdown", | |
2805 | NO_STR | |
2806 | NEIGHBOR_STR | |
2807 | NEIGHBOR_ADDR_STR2 | |
2808 | "Administratively shut down this neighbor\n") | |
2809 | { | |
2810 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
2811 | } | |
6b0655a2 | 2812 | |
d5a5c8f0 DS |
2813 | /* neighbor bfd. */ |
2814 | DEFUN (neighbor_bfd, | |
2815 | neighbor_bfd_cmd, | |
2816 | NEIGHBOR_CMD2 "bfd", | |
2817 | NEIGHBOR_STR | |
2818 | NEIGHBOR_ADDR_STR2 | |
2819 | "Respond to BFD session event\n") | |
2820 | { | |
2821 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_BFD); | |
2822 | } | |
2823 | ||
2824 | DEFUN (no_neighbor_bfd, | |
2825 | no_neighbor_bfd_cmd, | |
2826 | NO_NEIGHBOR_CMD2 "bfd", | |
2827 | NO_STR | |
2828 | NEIGHBOR_STR | |
2829 | NEIGHBOR_ADDR_STR2 | |
2830 | "Respond to BFD session event\n") | |
2831 | { | |
2832 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_BFD); | |
2833 | } | |
2834 | ||
c9502438 | 2835 | /* Deprecated neighbor capability route-refresh. */ |
2836 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, | |
2837 | neighbor_capability_route_refresh_cmd, | |
2838 | NEIGHBOR_CMD2 "capability route-refresh", | |
2839 | NEIGHBOR_STR | |
2840 | NEIGHBOR_ADDR_STR2 | |
2841 | "Advertise capability to the peer\n" | |
2842 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 2843 | { |
c9502438 | 2844 | return CMD_SUCCESS; |
718e3744 | 2845 | } |
2846 | ||
c9502438 | 2847 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
2848 | no_neighbor_capability_route_refresh_cmd, | |
2849 | NO_NEIGHBOR_CMD2 "capability route-refresh", | |
2850 | NO_STR | |
2851 | NEIGHBOR_STR | |
2852 | NEIGHBOR_ADDR_STR2 | |
2853 | "Advertise capability to the peer\n" | |
2854 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 2855 | { |
c9502438 | 2856 | return CMD_SUCCESS; |
718e3744 | 2857 | } |
6b0655a2 | 2858 | |
718e3744 | 2859 | /* neighbor capability dynamic. */ |
2860 | DEFUN (neighbor_capability_dynamic, | |
2861 | neighbor_capability_dynamic_cmd, | |
2862 | NEIGHBOR_CMD2 "capability dynamic", | |
2863 | NEIGHBOR_STR | |
2864 | NEIGHBOR_ADDR_STR2 | |
2865 | "Advertise capability to the peer\n" | |
2866 | "Advertise dynamic capability to this neighbor\n") | |
2867 | { | |
2868 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
2869 | } | |
2870 | ||
2871 | DEFUN (no_neighbor_capability_dynamic, | |
2872 | no_neighbor_capability_dynamic_cmd, | |
2873 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
2874 | NO_STR | |
2875 | NEIGHBOR_STR | |
2876 | NEIGHBOR_ADDR_STR2 | |
2877 | "Advertise capability to the peer\n" | |
2878 | "Advertise dynamic capability to this neighbor\n") | |
2879 | { | |
2880 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
2881 | } | |
6b0655a2 | 2882 | |
718e3744 | 2883 | /* neighbor dont-capability-negotiate */ |
2884 | DEFUN (neighbor_dont_capability_negotiate, | |
2885 | neighbor_dont_capability_negotiate_cmd, | |
2886 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
2887 | NEIGHBOR_STR | |
2888 | NEIGHBOR_ADDR_STR2 | |
2889 | "Do not perform capability negotiation\n") | |
2890 | { | |
2891 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
2892 | } | |
2893 | ||
2894 | DEFUN (no_neighbor_dont_capability_negotiate, | |
2895 | no_neighbor_dont_capability_negotiate_cmd, | |
2896 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
2897 | NO_STR | |
2898 | NEIGHBOR_STR | |
2899 | NEIGHBOR_ADDR_STR2 | |
2900 | "Do not perform capability negotiation\n") | |
2901 | { | |
2902 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
2903 | } | |
6b0655a2 | 2904 | |
94f2b392 | 2905 | static int |
fd79ac91 | 2906 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 2907 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 2908 | { |
2909 | int ret; | |
2910 | struct peer *peer; | |
2911 | ||
2912 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2913 | if (! peer) | |
2914 | return CMD_WARNING; | |
2915 | ||
2916 | if (set) | |
2917 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
2918 | else | |
2919 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
2920 | ||
2921 | return bgp_vty_return (vty, ret); | |
2922 | } | |
2923 | ||
94f2b392 | 2924 | static int |
fd79ac91 | 2925 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 2926 | safi_t safi, u_int32_t flag) |
718e3744 | 2927 | { |
2928 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
2929 | } | |
2930 | ||
94f2b392 | 2931 | static int |
fd79ac91 | 2932 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 2933 | safi_t safi, u_int32_t flag) |
718e3744 | 2934 | { |
2935 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
2936 | } | |
6b0655a2 | 2937 | |
718e3744 | 2938 | /* neighbor capability orf prefix-list. */ |
2939 | DEFUN (neighbor_capability_orf_prefix, | |
2940 | neighbor_capability_orf_prefix_cmd, | |
2941 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
2942 | NEIGHBOR_STR | |
2943 | NEIGHBOR_ADDR_STR2 | |
2944 | "Advertise capability to the peer\n" | |
2945 | "Advertise ORF capability to the peer\n" | |
2946 | "Advertise prefixlist ORF capability to this neighbor\n" | |
2947 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
2948 | "Capability to RECEIVE the ORF from this neighbor\n" | |
2949 | "Capability to SEND the ORF to this neighbor\n") | |
2950 | { | |
2951 | u_int16_t flag = 0; | |
2952 | ||
2953 | if (strncmp (argv[1], "s", 1) == 0) | |
2954 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
2955 | else if (strncmp (argv[1], "r", 1) == 0) | |
2956 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
2957 | else if (strncmp (argv[1], "b", 1) == 0) | |
2958 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
2959 | else | |
2960 | return CMD_WARNING; | |
2961 | ||
2962 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2963 | bgp_node_safi (vty), flag); | |
2964 | } | |
2965 | ||
2966 | DEFUN (no_neighbor_capability_orf_prefix, | |
2967 | no_neighbor_capability_orf_prefix_cmd, | |
2968 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
2969 | NO_STR | |
2970 | NEIGHBOR_STR | |
2971 | NEIGHBOR_ADDR_STR2 | |
2972 | "Advertise capability to the peer\n" | |
2973 | "Advertise ORF capability to the peer\n" | |
2974 | "Advertise prefixlist ORF capability to this neighbor\n" | |
2975 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
2976 | "Capability to RECEIVE the ORF from this neighbor\n" | |
2977 | "Capability to SEND the ORF to this neighbor\n") | |
2978 | { | |
2979 | u_int16_t flag = 0; | |
2980 | ||
2981 | if (strncmp (argv[1], "s", 1) == 0) | |
2982 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
2983 | else if (strncmp (argv[1], "r", 1) == 0) | |
2984 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
2985 | else if (strncmp (argv[1], "b", 1) == 0) | |
2986 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
2987 | else | |
2988 | return CMD_WARNING; | |
2989 | ||
2990 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2991 | bgp_node_safi (vty), flag); | |
2992 | } | |
6b0655a2 | 2993 | |
718e3744 | 2994 | /* neighbor next-hop-self. */ |
2995 | DEFUN (neighbor_nexthop_self, | |
2996 | neighbor_nexthop_self_cmd, | |
9e7a53c1 | 2997 | NEIGHBOR_CMD2 "next-hop-self {all}", |
718e3744 | 2998 | NEIGHBOR_STR |
2999 | NEIGHBOR_ADDR_STR2 | |
9e7a53c1 TT |
3000 | "Disable the next hop calculation for this neighbor\n" |
3001 | "Apply also to ibgp-learned routes when acting as a route reflector\n") | |
718e3744 | 3002 | { |
9e7a53c1 TT |
3003 | u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0; |
3004 | int rc; | |
3005 | ||
3006 | /* Check if "all" is specified */ | |
3007 | if (argv[1] != NULL) | |
3008 | flags |= PEER_FLAG_NEXTHOP_SELF_ALL; | |
3009 | else | |
3010 | unset |= PEER_FLAG_NEXTHOP_SELF_ALL; | |
3011 | ||
3012 | rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3013 | bgp_node_safi (vty), flags); | |
3014 | if ( rc == CMD_SUCCESS && unset ) | |
3015 | rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3016 | bgp_node_safi (vty), unset); | |
3017 | return rc; | |
718e3744 | 3018 | } |
3019 | ||
3020 | DEFUN (no_neighbor_nexthop_self, | |
3021 | no_neighbor_nexthop_self_cmd, | |
9e7a53c1 | 3022 | NO_NEIGHBOR_CMD2 "next-hop-self {all}", |
718e3744 | 3023 | NO_STR |
3024 | NEIGHBOR_STR | |
3025 | NEIGHBOR_ADDR_STR2 | |
9e7a53c1 TT |
3026 | "Disable the next hop calculation for this neighbor\n" |
3027 | "Apply also to ibgp-learned routes when acting as a route reflector\n") | |
718e3744 | 3028 | { |
3029 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
9e7a53c1 TT |
3030 | bgp_node_safi (vty), |
3031 | PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL); | |
718e3744 | 3032 | } |
6b0655a2 | 3033 | |
c7122e14 DS |
3034 | /* neighbor as-override */ |
3035 | DEFUN (neighbor_as_override, | |
3036 | neighbor_as_override_cmd, | |
3037 | NEIGHBOR_CMD2 "as-override", | |
3038 | NEIGHBOR_STR | |
3039 | NEIGHBOR_ADDR_STR2 | |
3040 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3041 | { | |
3042 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3043 | bgp_node_safi (vty), | |
3044 | PEER_FLAG_AS_OVERRIDE); | |
3045 | } | |
3046 | ||
3047 | DEFUN (no_neighbor_as_override, | |
3048 | no_neighbor_as_override_cmd, | |
3049 | NO_NEIGHBOR_CMD2 "as-override", | |
3050 | NO_STR | |
3051 | NEIGHBOR_STR | |
3052 | NEIGHBOR_ADDR_STR2 | |
3053 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3054 | { | |
3055 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3056 | bgp_node_safi (vty), | |
3057 | PEER_FLAG_AS_OVERRIDE); | |
3058 | } | |
3059 | ||
718e3744 | 3060 | /* neighbor remove-private-AS. */ |
3061 | DEFUN (neighbor_remove_private_as, | |
3062 | neighbor_remove_private_as_cmd, | |
3063 | NEIGHBOR_CMD2 "remove-private-AS", | |
3064 | NEIGHBOR_STR | |
3065 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3066 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3067 | { |
5000f21c DS |
3068 | peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
3069 | bgp_node_safi (vty), | |
3070 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL| | |
3071 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
718e3744 | 3072 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3073 | bgp_node_safi (vty), | |
3074 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
3075 | } | |
3076 | ||
5000f21c DS |
3077 | DEFUN (neighbor_remove_private_as_all, |
3078 | neighbor_remove_private_as_all_cmd, | |
3079 | NEIGHBOR_CMD2 "remove-private-AS all", | |
3080 | NEIGHBOR_STR | |
3081 | NEIGHBOR_ADDR_STR2 | |
3082 | "Remove private ASNs in outbound updates\n" | |
3083 | "Apply to all AS numbers") | |
3084 | { | |
3085 | peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3086 | bgp_node_safi (vty), | |
3087 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3088 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3089 | bgp_node_safi (vty), | |
3090 | PEER_FLAG_REMOVE_PRIVATE_AS| | |
3091 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3092 | } | |
3093 | ||
3094 | DEFUN (neighbor_remove_private_as_replace_as, | |
3095 | neighbor_remove_private_as_replace_as_cmd, | |
3096 | NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3097 | NEIGHBOR_STR | |
3098 | NEIGHBOR_ADDR_STR2 | |
3099 | "Remove private ASNs in outbound updates\n" | |
3100 | "Replace private ASNs with our ASN in outbound updates\n") | |
3101 | { | |
3102 | peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3103 | bgp_node_safi (vty), | |
3104 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3105 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3106 | bgp_node_safi (vty), | |
3107 | PEER_FLAG_REMOVE_PRIVATE_AS| | |
3108 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3109 | } | |
3110 | ||
3111 | DEFUN (neighbor_remove_private_as_all_replace_as, | |
3112 | neighbor_remove_private_as_all_replace_as_cmd, | |
3113 | NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3114 | NEIGHBOR_STR | |
3115 | NEIGHBOR_ADDR_STR2 | |
3116 | "Remove private ASNs in outbound updates\n" | |
3117 | "Apply to all AS numbers" | |
3118 | "Replace private ASNs with our ASN in outbound updates\n") | |
3119 | { | |
3120 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3121 | bgp_node_safi (vty), | |
3122 | PEER_FLAG_REMOVE_PRIVATE_AS| | |
3123 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL| | |
3124 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3125 | } | |
3126 | ||
718e3744 | 3127 | DEFUN (no_neighbor_remove_private_as, |
3128 | no_neighbor_remove_private_as_cmd, | |
3129 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
3130 | NO_STR | |
3131 | NEIGHBOR_STR | |
3132 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3133 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3134 | { |
3135 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3136 | bgp_node_safi (vty), | |
5000f21c DS |
3137 | PEER_FLAG_REMOVE_PRIVATE_AS| |
3138 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL| | |
3139 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
718e3744 | 3140 | } |
6b0655a2 | 3141 | |
5000f21c DS |
3142 | ALIAS (no_neighbor_remove_private_as, |
3143 | no_neighbor_remove_private_as_all_cmd, | |
3144 | NO_NEIGHBOR_CMD2 "remove-private-AS all", | |
3145 | NO_STR | |
3146 | NEIGHBOR_STR | |
3147 | NEIGHBOR_ADDR_STR2 | |
3148 | "Remove private ASNs in outbound updates\n" | |
3149 | "Apply to all AS numbers") | |
3150 | ||
3151 | ALIAS (no_neighbor_remove_private_as, | |
3152 | no_neighbor_remove_private_as_replace_as_cmd, | |
3153 | NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3154 | NO_STR | |
3155 | NEIGHBOR_STR | |
3156 | NEIGHBOR_ADDR_STR2 | |
3157 | "Remove private ASNs in outbound updates\n" | |
3158 | "Replace private ASNs with our ASN in outbound updates\n") | |
3159 | ||
3160 | ALIAS (no_neighbor_remove_private_as, | |
3161 | no_neighbor_remove_private_as_all_replace_as_cmd, | |
3162 | NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3163 | NO_STR | |
3164 | NEIGHBOR_STR | |
3165 | NEIGHBOR_ADDR_STR2 | |
3166 | "Remove private ASNs in outbound updates\n" | |
3167 | "Apply to all AS numbers" | |
3168 | "Replace private ASNs with our ASN in outbound updates\n") | |
3169 | ||
3170 | ||
718e3744 | 3171 | /* neighbor send-community. */ |
3172 | DEFUN (neighbor_send_community, | |
3173 | neighbor_send_community_cmd, | |
3174 | NEIGHBOR_CMD2 "send-community", | |
3175 | NEIGHBOR_STR | |
3176 | NEIGHBOR_ADDR_STR2 | |
3177 | "Send Community attribute to this neighbor\n") | |
3178 | { | |
3179 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3180 | bgp_node_safi (vty), | |
3181 | PEER_FLAG_SEND_COMMUNITY); | |
3182 | } | |
3183 | ||
3184 | DEFUN (no_neighbor_send_community, | |
3185 | no_neighbor_send_community_cmd, | |
3186 | NO_NEIGHBOR_CMD2 "send-community", | |
3187 | NO_STR | |
3188 | NEIGHBOR_STR | |
3189 | NEIGHBOR_ADDR_STR2 | |
3190 | "Send Community attribute to this neighbor\n") | |
3191 | { | |
3192 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3193 | bgp_node_safi (vty), | |
3194 | PEER_FLAG_SEND_COMMUNITY); | |
3195 | } | |
6b0655a2 | 3196 | |
718e3744 | 3197 | /* neighbor send-community extended. */ |
3198 | DEFUN (neighbor_send_community_type, | |
3199 | neighbor_send_community_type_cmd, | |
3200 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3201 | NEIGHBOR_STR | |
3202 | NEIGHBOR_ADDR_STR2 | |
3203 | "Send Community attribute to this neighbor\n" | |
3204 | "Send Standard and Extended Community attributes\n" | |
3205 | "Send Extended Community attributes\n" | |
3206 | "Send Standard Community attributes\n") | |
3207 | { | |
3208 | if (strncmp (argv[1], "s", 1) == 0) | |
3209 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3210 | bgp_node_safi (vty), | |
3211 | PEER_FLAG_SEND_COMMUNITY); | |
3212 | if (strncmp (argv[1], "e", 1) == 0) | |
3213 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3214 | bgp_node_safi (vty), | |
3215 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3216 | ||
3217 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3218 | bgp_node_safi (vty), | |
3219 | (PEER_FLAG_SEND_COMMUNITY| | |
3220 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3221 | } | |
3222 | ||
3223 | DEFUN (no_neighbor_send_community_type, | |
3224 | no_neighbor_send_community_type_cmd, | |
3225 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3226 | NO_STR | |
3227 | NEIGHBOR_STR | |
3228 | NEIGHBOR_ADDR_STR2 | |
3229 | "Send Community attribute to this neighbor\n" | |
3230 | "Send Standard and Extended Community attributes\n" | |
3231 | "Send Extended Community attributes\n" | |
3232 | "Send Standard Community attributes\n") | |
3233 | { | |
3234 | if (strncmp (argv[1], "s", 1) == 0) | |
3235 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3236 | bgp_node_safi (vty), | |
3237 | PEER_FLAG_SEND_COMMUNITY); | |
3238 | if (strncmp (argv[1], "e", 1) == 0) | |
3239 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3240 | bgp_node_safi (vty), | |
3241 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3242 | ||
3243 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3244 | bgp_node_safi (vty), | |
3245 | (PEER_FLAG_SEND_COMMUNITY | | |
3246 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3247 | } | |
6b0655a2 | 3248 | |
718e3744 | 3249 | /* neighbor soft-reconfig. */ |
3250 | DEFUN (neighbor_soft_reconfiguration, | |
3251 | neighbor_soft_reconfiguration_cmd, | |
3252 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3253 | NEIGHBOR_STR | |
3254 | NEIGHBOR_ADDR_STR2 | |
3255 | "Per neighbor soft reconfiguration\n" | |
3256 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3257 | { | |
3258 | return peer_af_flag_set_vty (vty, argv[0], | |
3259 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3260 | PEER_FLAG_SOFT_RECONFIG); | |
3261 | } | |
3262 | ||
3263 | DEFUN (no_neighbor_soft_reconfiguration, | |
3264 | no_neighbor_soft_reconfiguration_cmd, | |
3265 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3266 | NO_STR | |
3267 | NEIGHBOR_STR | |
3268 | NEIGHBOR_ADDR_STR2 | |
3269 | "Per neighbor soft reconfiguration\n" | |
3270 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3271 | { | |
3272 | return peer_af_flag_unset_vty (vty, argv[0], | |
3273 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3274 | PEER_FLAG_SOFT_RECONFIG); | |
3275 | } | |
6b0655a2 | 3276 | |
718e3744 | 3277 | DEFUN (neighbor_route_reflector_client, |
3278 | neighbor_route_reflector_client_cmd, | |
3279 | NEIGHBOR_CMD2 "route-reflector-client", | |
3280 | NEIGHBOR_STR | |
3281 | NEIGHBOR_ADDR_STR2 | |
3282 | "Configure a neighbor as Route Reflector client\n") | |
3283 | { | |
3284 | struct peer *peer; | |
3285 | ||
3286 | ||
3287 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3288 | if (! peer) | |
3289 | return CMD_WARNING; | |
3290 | ||
3291 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3292 | bgp_node_safi (vty), | |
3293 | PEER_FLAG_REFLECTOR_CLIENT); | |
3294 | } | |
3295 | ||
3296 | DEFUN (no_neighbor_route_reflector_client, | |
3297 | no_neighbor_route_reflector_client_cmd, | |
3298 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
3299 | NO_STR | |
3300 | NEIGHBOR_STR | |
3301 | NEIGHBOR_ADDR_STR2 | |
3302 | "Configure a neighbor as Route Reflector client\n") | |
3303 | { | |
3304 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3305 | bgp_node_safi (vty), | |
3306 | PEER_FLAG_REFLECTOR_CLIENT); | |
3307 | } | |
6b0655a2 | 3308 | |
94f2b392 | 3309 | static int |
fd79ac91 | 3310 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
3311 | int afi, int safi) | |
fee0f4c6 | 3312 | { |
3313 | int ret; | |
3314 | struct bgp *bgp; | |
3315 | struct peer *peer; | |
3316 | struct peer_group *group; | |
1eb8ef25 | 3317 | struct listnode *node, *nnode; |
fee0f4c6 | 3318 | struct bgp_filter *pfilter; |
3319 | struct bgp_filter *gfilter; | |
228da428 | 3320 | int locked_and_added = 0; |
fee0f4c6 | 3321 | |
3322 | bgp = vty->index; | |
3323 | ||
3324 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3325 | if ( ! peer ) | |
3326 | return CMD_WARNING; | |
3327 | ||
3328 | /* If it is already a RS-Client, don't do anything. */ | |
3329 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
3330 | return CMD_SUCCESS; | |
3331 | ||
3332 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 3333 | { |
3334 | peer = peer_lock (peer); /* rsclient peer list reference */ | |
3335 | listnode_add_sort (bgp->rsclient, peer); | |
228da428 | 3336 | locked_and_added = 1; |
200df115 | 3337 | } |
fee0f4c6 | 3338 | |
3339 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3340 | if (ret < 0) | |
228da428 CC |
3341 | { |
3342 | if (locked_and_added) | |
3343 | { | |
3344 | listnode_delete (bgp->rsclient, peer); | |
3345 | peer_unlock (peer); /* rsclient peer list reference */ | |
3346 | } | |
3347 | ||
3348 | return bgp_vty_return (vty, ret); | |
3349 | } | |
fee0f4c6 | 3350 | |
64e580a7 | 3351 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
fee0f4c6 | 3352 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
228da428 CC |
3353 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
3354 | peer->rib[afi][safi]->owner = peer_lock (peer); | |
fee0f4c6 | 3355 | |
3356 | /* Check for existing 'network' and 'redistribute' routes. */ | |
3357 | bgp_check_local_routes_rsclient (peer, afi, safi); | |
3358 | ||
3359 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ | |
3360 | bgp_soft_reconfig_rsclient (peer, afi, safi); | |
3361 | ||
3362 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
3363 | { | |
3364 | group = peer->group; | |
3365 | gfilter = &peer->filter[afi][safi]; | |
3366 | ||
1eb8ef25 | 3367 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 3368 | { |
3369 | pfilter = &peer->filter[afi][safi]; | |
3370 | ||
3371 | /* Members of a non-RS-Client group should not be RS-Clients, as that | |
3372 | is checked when the become part of the peer-group */ | |
3373 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3374 | if (ret < 0) | |
3375 | return bgp_vty_return (vty, ret); | |
3376 | ||
3377 | /* Make peer's RIB point to group's RIB. */ | |
3378 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; | |
3379 | ||
3380 | /* Import policy. */ | |
3381 | if (pfilter->map[RMAP_IMPORT].name) | |
3382 | free (pfilter->map[RMAP_IMPORT].name); | |
3383 | if (gfilter->map[RMAP_IMPORT].name) | |
3384 | { | |
3385 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); | |
3386 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; | |
3387 | } | |
3388 | else | |
3389 | { | |
3390 | pfilter->map[RMAP_IMPORT].name = NULL; | |
3391 | pfilter->map[RMAP_IMPORT].map =NULL; | |
3392 | } | |
3393 | ||
3394 | /* Export policy. */ | |
3395 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) | |
3396 | { | |
3397 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); | |
3398 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; | |
3399 | } | |
3400 | } | |
3401 | } | |
3402 | return CMD_SUCCESS; | |
3403 | } | |
3404 | ||
94f2b392 | 3405 | static int |
fd79ac91 | 3406 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
3407 | int afi, int safi) | |
fee0f4c6 | 3408 | { |
3409 | int ret; | |
3410 | struct bgp *bgp; | |
3411 | struct peer *peer; | |
3412 | struct peer_group *group; | |
1eb8ef25 | 3413 | struct listnode *node, *nnode; |
fee0f4c6 | 3414 | |
3415 | bgp = vty->index; | |
3416 | ||
3417 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3418 | if ( ! peer ) | |
3419 | return CMD_WARNING; | |
3420 | ||
3421 | /* If it is not a RS-Client, don't do anything. */ | |
3422 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
3423 | return CMD_SUCCESS; | |
3424 | ||
3425 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
3426 | { | |
3427 | group = peer->group; | |
3428 | ||
1eb8ef25 | 3429 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 3430 | { |
3431 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3432 | if (ret < 0) | |
3433 | return bgp_vty_return (vty, ret); | |
3434 | ||
3435 | peer->rib[afi][safi] = NULL; | |
3436 | } | |
3437 | ||
3438 | peer = group->conf; | |
3439 | } | |
3440 | ||
3441 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3442 | if (ret < 0) | |
3443 | return bgp_vty_return (vty, ret); | |
3444 | ||
3445 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 3446 | { |
228da428 | 3447 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
200df115 | 3448 | listnode_delete (bgp->rsclient, peer); |
228da428 | 3449 | peer_unlock (peer); /* peer bgp rsclient reference */ |
200df115 | 3450 | } |
fee0f4c6 | 3451 | |
b608d5b5 | 3452 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
fee0f4c6 | 3453 | |
3454 | return CMD_SUCCESS; | |
3455 | } | |
6b0655a2 | 3456 | |
718e3744 | 3457 | /* neighbor route-server-client. */ |
3458 | DEFUN (neighbor_route_server_client, | |
3459 | neighbor_route_server_client_cmd, | |
3460 | NEIGHBOR_CMD2 "route-server-client", | |
3461 | NEIGHBOR_STR | |
3462 | NEIGHBOR_ADDR_STR2 | |
3463 | "Configure a neighbor as Route Server client\n") | |
3464 | { | |
fee0f4c6 | 3465 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
3466 | bgp_node_safi(vty)); | |
718e3744 | 3467 | } |
3468 | ||
3469 | DEFUN (no_neighbor_route_server_client, | |
3470 | no_neighbor_route_server_client_cmd, | |
3471 | NO_NEIGHBOR_CMD2 "route-server-client", | |
3472 | NO_STR | |
3473 | NEIGHBOR_STR | |
3474 | NEIGHBOR_ADDR_STR2 | |
3475 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 3476 | { |
3477 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), | |
3478 | bgp_node_safi(vty)); | |
3479 | } | |
6b0655a2 | 3480 | |
fee0f4c6 | 3481 | DEFUN (neighbor_nexthop_local_unchanged, |
3482 | neighbor_nexthop_local_unchanged_cmd, | |
3483 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3484 | NEIGHBOR_STR | |
3485 | NEIGHBOR_ADDR_STR2 | |
3486 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
3487 | "Leave link-local nexthop unchanged for this peer\n") | |
3488 | { | |
3489 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3490 | bgp_node_safi (vty), | |
3491 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
3492 | } | |
6b0655a2 | 3493 | |
fee0f4c6 | 3494 | DEFUN (no_neighbor_nexthop_local_unchanged, |
3495 | no_neighbor_nexthop_local_unchanged_cmd, | |
3496 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3497 | NO_STR | |
3498 | NEIGHBOR_STR | |
3499 | NEIGHBOR_ADDR_STR2 | |
3500 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
3501 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 3502 | { |
3503 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3504 | bgp_node_safi (vty), | |
fee0f4c6 | 3505 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 3506 | } |
6b0655a2 | 3507 | |
718e3744 | 3508 | DEFUN (neighbor_attr_unchanged, |
3509 | neighbor_attr_unchanged_cmd, | |
3510 | NEIGHBOR_CMD2 "attribute-unchanged", | |
3511 | NEIGHBOR_STR | |
3512 | NEIGHBOR_ADDR_STR2 | |
3513 | "BGP attribute is propagated unchanged to this neighbor\n") | |
3514 | { | |
3515 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3516 | bgp_node_safi (vty), | |
3517 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
3518 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
3519 | PEER_FLAG_MED_UNCHANGED)); | |
3520 | } | |
3521 | ||
3522 | DEFUN (neighbor_attr_unchanged1, | |
3523 | neighbor_attr_unchanged1_cmd, | |
3524 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
3525 | NEIGHBOR_STR | |
3526 | NEIGHBOR_ADDR_STR2 | |
3527 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3528 | "As-path attribute\n" | |
3529 | "Nexthop attribute\n" | |
3530 | "Med attribute\n") | |
3531 | { | |
3532 | u_int16_t flags = 0; | |
3533 | ||
3534 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3535 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3536 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3537 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3538 | else if (strncmp (argv[1], "med", 1) == 0) | |
3539 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3540 | ||
3541 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3542 | bgp_node_safi (vty), flags); | |
3543 | } | |
3544 | ||
3545 | DEFUN (neighbor_attr_unchanged2, | |
3546 | neighbor_attr_unchanged2_cmd, | |
3547 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
3548 | NEIGHBOR_STR | |
3549 | NEIGHBOR_ADDR_STR2 | |
3550 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3551 | "As-path attribute\n" | |
3552 | "Nexthop attribute\n" | |
3553 | "Med attribute\n") | |
3554 | { | |
3555 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
3556 | ||
3557 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
3558 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3559 | else if (strncmp (argv[1], "med", 1) == 0) | |
3560 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3561 | ||
3562 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3563 | bgp_node_safi (vty), flags); | |
3564 | ||
3565 | } | |
3566 | ||
3567 | DEFUN (neighbor_attr_unchanged3, | |
3568 | neighbor_attr_unchanged3_cmd, | |
3569 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
3570 | NEIGHBOR_STR | |
3571 | NEIGHBOR_ADDR_STR2 | |
3572 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3573 | "Nexthop attribute\n" | |
3574 | "As-path attribute\n" | |
3575 | "Med attribute\n") | |
3576 | { | |
3577 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
3578 | ||
3579 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3580 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3581 | else if (strncmp (argv[1], "med", 1) == 0) | |
3582 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3583 | ||
3584 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3585 | bgp_node_safi (vty), flags); | |
3586 | } | |
3587 | ||
3588 | DEFUN (neighbor_attr_unchanged4, | |
3589 | neighbor_attr_unchanged4_cmd, | |
3590 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
3591 | NEIGHBOR_STR | |
3592 | NEIGHBOR_ADDR_STR2 | |
3593 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3594 | "Med attribute\n" | |
3595 | "As-path attribute\n" | |
3596 | "Nexthop attribute\n") | |
3597 | { | |
3598 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
3599 | ||
3600 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3601 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3602 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3603 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3604 | ||
3605 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3606 | bgp_node_safi (vty), flags); | |
3607 | } | |
3608 | ||
3609 | ALIAS (neighbor_attr_unchanged, | |
3610 | neighbor_attr_unchanged5_cmd, | |
3611 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
3612 | NEIGHBOR_STR | |
3613 | NEIGHBOR_ADDR_STR2 | |
3614 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3615 | "As-path attribute\n" | |
3616 | "Nexthop attribute\n" | |
3617 | "Med attribute\n") | |
3618 | ||
3619 | ALIAS (neighbor_attr_unchanged, | |
3620 | neighbor_attr_unchanged6_cmd, | |
3621 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
3622 | NEIGHBOR_STR | |
3623 | NEIGHBOR_ADDR_STR2 | |
3624 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3625 | "As-path attribute\n" | |
3626 | "Med attribute\n" | |
3627 | "Nexthop attribute\n") | |
3628 | ||
3629 | ALIAS (neighbor_attr_unchanged, | |
3630 | neighbor_attr_unchanged7_cmd, | |
3631 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
3632 | NEIGHBOR_STR | |
3633 | NEIGHBOR_ADDR_STR2 | |
3634 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3635 | "Nexthop attribute\n" | |
3636 | "Med attribute\n" | |
3637 | "As-path attribute\n") | |
3638 | ||
3639 | ALIAS (neighbor_attr_unchanged, | |
3640 | neighbor_attr_unchanged8_cmd, | |
3641 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
3642 | NEIGHBOR_STR | |
3643 | NEIGHBOR_ADDR_STR2 | |
3644 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3645 | "Nexthop attribute\n" | |
3646 | "As-path attribute\n" | |
3647 | "Med attribute\n") | |
3648 | ||
3649 | ALIAS (neighbor_attr_unchanged, | |
3650 | neighbor_attr_unchanged9_cmd, | |
3651 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
3652 | NEIGHBOR_STR | |
3653 | NEIGHBOR_ADDR_STR2 | |
3654 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3655 | "Med attribute\n" | |
3656 | "Nexthop attribute\n" | |
3657 | "As-path attribute\n") | |
3658 | ||
3659 | ALIAS (neighbor_attr_unchanged, | |
3660 | neighbor_attr_unchanged10_cmd, | |
3661 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
3662 | NEIGHBOR_STR | |
3663 | NEIGHBOR_ADDR_STR2 | |
3664 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3665 | "Med attribute\n" | |
3666 | "As-path attribute\n" | |
3667 | "Nexthop attribute\n") | |
3668 | ||
3669 | DEFUN (no_neighbor_attr_unchanged, | |
3670 | no_neighbor_attr_unchanged_cmd, | |
3671 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
3672 | NO_STR | |
3673 | NEIGHBOR_STR | |
3674 | NEIGHBOR_ADDR_STR2 | |
3675 | "BGP attribute is propagated unchanged to this neighbor\n") | |
3676 | { | |
3677 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3678 | bgp_node_safi (vty), | |
3679 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
3680 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
3681 | PEER_FLAG_MED_UNCHANGED)); | |
3682 | } | |
3683 | ||
3684 | DEFUN (no_neighbor_attr_unchanged1, | |
3685 | no_neighbor_attr_unchanged1_cmd, | |
3686 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
3687 | NO_STR | |
3688 | NEIGHBOR_STR | |
3689 | NEIGHBOR_ADDR_STR2 | |
3690 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3691 | "As-path attribute\n" | |
3692 | "Nexthop attribute\n" | |
3693 | "Med attribute\n") | |
3694 | { | |
3695 | u_int16_t flags = 0; | |
3696 | ||
3697 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3698 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3699 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3700 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3701 | else if (strncmp (argv[1], "med", 1) == 0) | |
3702 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3703 | ||
3704 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3705 | bgp_node_safi (vty), flags); | |
3706 | } | |
3707 | ||
3708 | DEFUN (no_neighbor_attr_unchanged2, | |
3709 | no_neighbor_attr_unchanged2_cmd, | |
3710 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
3711 | NO_STR | |
3712 | NEIGHBOR_STR | |
3713 | NEIGHBOR_ADDR_STR2 | |
3714 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3715 | "As-path attribute\n" | |
3716 | "Nexthop attribute\n" | |
3717 | "Med attribute\n") | |
3718 | { | |
3719 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
3720 | ||
3721 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
3722 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3723 | else if (strncmp (argv[1], "med", 1) == 0) | |
3724 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3725 | ||
3726 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3727 | bgp_node_safi (vty), flags); | |
3728 | } | |
3729 | ||
3730 | DEFUN (no_neighbor_attr_unchanged3, | |
3731 | no_neighbor_attr_unchanged3_cmd, | |
3732 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
3733 | NO_STR | |
3734 | NEIGHBOR_STR | |
3735 | NEIGHBOR_ADDR_STR2 | |
3736 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3737 | "Nexthop attribute\n" | |
3738 | "As-path attribute\n" | |
3739 | "Med attribute\n") | |
3740 | { | |
3741 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
3742 | ||
3743 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3744 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3745 | else if (strncmp (argv[1], "med", 1) == 0) | |
3746 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3747 | ||
3748 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3749 | bgp_node_safi (vty), flags); | |
3750 | } | |
3751 | ||
3752 | DEFUN (no_neighbor_attr_unchanged4, | |
3753 | no_neighbor_attr_unchanged4_cmd, | |
3754 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
3755 | NO_STR | |
3756 | NEIGHBOR_STR | |
3757 | NEIGHBOR_ADDR_STR2 | |
3758 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3759 | "Med attribute\n" | |
3760 | "As-path attribute\n" | |
3761 | "Nexthop attribute\n") | |
3762 | { | |
3763 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
3764 | ||
3765 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3766 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3767 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3768 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3769 | ||
3770 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3771 | bgp_node_safi (vty), flags); | |
3772 | } | |
3773 | ||
3774 | ALIAS (no_neighbor_attr_unchanged, | |
3775 | no_neighbor_attr_unchanged5_cmd, | |
3776 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
3777 | NO_STR | |
3778 | NEIGHBOR_STR | |
3779 | NEIGHBOR_ADDR_STR2 | |
3780 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3781 | "As-path attribute\n" | |
3782 | "Nexthop attribute\n" | |
3783 | "Med attribute\n") | |
3784 | ||
3785 | ALIAS (no_neighbor_attr_unchanged, | |
3786 | no_neighbor_attr_unchanged6_cmd, | |
3787 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
3788 | NO_STR | |
3789 | NEIGHBOR_STR | |
3790 | NEIGHBOR_ADDR_STR2 | |
3791 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3792 | "As-path attribute\n" | |
3793 | "Med attribute\n" | |
3794 | "Nexthop attribute\n") | |
3795 | ||
3796 | ALIAS (no_neighbor_attr_unchanged, | |
3797 | no_neighbor_attr_unchanged7_cmd, | |
3798 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
3799 | NO_STR | |
3800 | NEIGHBOR_STR | |
3801 | NEIGHBOR_ADDR_STR2 | |
3802 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3803 | "Nexthop attribute\n" | |
3804 | "Med attribute\n" | |
3805 | "As-path attribute\n") | |
3806 | ||
3807 | ALIAS (no_neighbor_attr_unchanged, | |
3808 | no_neighbor_attr_unchanged8_cmd, | |
3809 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
3810 | NO_STR | |
3811 | NEIGHBOR_STR | |
3812 | NEIGHBOR_ADDR_STR2 | |
3813 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3814 | "Nexthop attribute\n" | |
3815 | "As-path attribute\n" | |
3816 | "Med attribute\n") | |
3817 | ||
3818 | ALIAS (no_neighbor_attr_unchanged, | |
3819 | no_neighbor_attr_unchanged9_cmd, | |
3820 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
3821 | NO_STR | |
3822 | NEIGHBOR_STR | |
3823 | NEIGHBOR_ADDR_STR2 | |
3824 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3825 | "Med attribute\n" | |
3826 | "Nexthop attribute\n" | |
3827 | "As-path attribute\n") | |
3828 | ||
3829 | ALIAS (no_neighbor_attr_unchanged, | |
3830 | no_neighbor_attr_unchanged10_cmd, | |
3831 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
3832 | NO_STR | |
3833 | NEIGHBOR_STR | |
3834 | NEIGHBOR_ADDR_STR2 | |
3835 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3836 | "Med attribute\n" | |
3837 | "As-path attribute\n" | |
3838 | "Nexthop attribute\n") | |
3839 | ||
3840 | /* For old version Zebra compatibility. */ | |
dd4c593f | 3841 | DEFUN_DEPRECATED (neighbor_transparent_as, |
3842 | neighbor_transparent_as_cmd, | |
3843 | NEIGHBOR_CMD "transparent-as", | |
3844 | NEIGHBOR_STR | |
3845 | NEIGHBOR_ADDR_STR | |
3846 | "Do not append my AS number even peer is EBGP peer\n") | |
718e3744 | 3847 | { |
3848 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3849 | bgp_node_safi (vty), | |
3850 | PEER_FLAG_AS_PATH_UNCHANGED); | |
3851 | } | |
3852 | ||
dd4c593f | 3853 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
3854 | neighbor_transparent_nexthop_cmd, | |
3855 | NEIGHBOR_CMD "transparent-nexthop", | |
3856 | NEIGHBOR_STR | |
3857 | NEIGHBOR_ADDR_STR | |
3858 | "Do not change nexthop even peer is EBGP peer\n") | |
718e3744 | 3859 | { |
3860 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3861 | bgp_node_safi (vty), | |
3862 | PEER_FLAG_NEXTHOP_UNCHANGED); | |
3863 | } | |
6b0655a2 | 3864 | |
718e3744 | 3865 | /* EBGP multihop configuration. */ |
94f2b392 | 3866 | static int |
fd79ac91 | 3867 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
3868 | const char *ttl_str) | |
718e3744 | 3869 | { |
3870 | struct peer *peer; | |
fd79ac91 | 3871 | unsigned int ttl; |
718e3744 | 3872 | |
3873 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3874 | if (! peer) | |
3875 | return CMD_WARNING; | |
3876 | ||
3877 | if (! ttl_str) | |
3878 | ttl = TTL_MAX; | |
3879 | else | |
3880 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); | |
3881 | ||
89b6d1f8 | 3882 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 3883 | } |
3884 | ||
94f2b392 | 3885 | static int |
fd79ac91 | 3886 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3887 | { |
3888 | struct peer *peer; | |
3889 | ||
3890 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3891 | if (! peer) | |
3892 | return CMD_WARNING; | |
3893 | ||
89b6d1f8 | 3894 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 3895 | } |
3896 | ||
3897 | /* neighbor ebgp-multihop. */ | |
3898 | DEFUN (neighbor_ebgp_multihop, | |
3899 | neighbor_ebgp_multihop_cmd, | |
3900 | NEIGHBOR_CMD2 "ebgp-multihop", | |
3901 | NEIGHBOR_STR | |
3902 | NEIGHBOR_ADDR_STR2 | |
3903 | "Allow EBGP neighbors not on directly connected networks\n") | |
3904 | { | |
3905 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
3906 | } | |
3907 | ||
3908 | DEFUN (neighbor_ebgp_multihop_ttl, | |
3909 | neighbor_ebgp_multihop_ttl_cmd, | |
3910 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
3911 | NEIGHBOR_STR | |
3912 | NEIGHBOR_ADDR_STR2 | |
3913 | "Allow EBGP neighbors not on directly connected networks\n" | |
3914 | "maximum hop count\n") | |
3915 | { | |
3916 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
3917 | } | |
3918 | ||
3919 | DEFUN (no_neighbor_ebgp_multihop, | |
3920 | no_neighbor_ebgp_multihop_cmd, | |
3921 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
3922 | NO_STR | |
3923 | NEIGHBOR_STR | |
3924 | NEIGHBOR_ADDR_STR2 | |
3925 | "Allow EBGP neighbors not on directly connected networks\n") | |
3926 | { | |
3927 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
3928 | } | |
3929 | ||
3930 | ALIAS (no_neighbor_ebgp_multihop, | |
3931 | no_neighbor_ebgp_multihop_ttl_cmd, | |
3932 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
3933 | NO_STR | |
3934 | NEIGHBOR_STR | |
3935 | NEIGHBOR_ADDR_STR2 | |
3936 | "Allow EBGP neighbors not on directly connected networks\n" | |
3937 | "maximum hop count\n") | |
6b0655a2 | 3938 | |
6ffd2079 | 3939 | /* disable-connected-check */ |
3940 | DEFUN (neighbor_disable_connected_check, | |
3941 | neighbor_disable_connected_check_cmd, | |
3942 | NEIGHBOR_CMD2 "disable-connected-check", | |
3943 | NEIGHBOR_STR | |
3944 | NEIGHBOR_ADDR_STR2 | |
3945 | "one-hop away EBGP peer using loopback address\n") | |
3946 | { | |
3947 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
3948 | } | |
3949 | ||
3950 | DEFUN (no_neighbor_disable_connected_check, | |
3951 | no_neighbor_disable_connected_check_cmd, | |
3952 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
3953 | NO_STR | |
3954 | NEIGHBOR_STR | |
3955 | NEIGHBOR_ADDR_STR2 | |
3956 | "one-hop away EBGP peer using loopback address\n") | |
3957 | { | |
3958 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
3959 | } | |
3960 | ||
718e3744 | 3961 | /* Enforce multihop. */ |
6ffd2079 | 3962 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 3963 | neighbor_enforce_multihop_cmd, |
3964 | NEIGHBOR_CMD2 "enforce-multihop", | |
3965 | NEIGHBOR_STR | |
3966 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 3967 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 3968 | |
6ffd2079 | 3969 | /* Enforce multihop. */ |
3970 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 3971 | no_neighbor_enforce_multihop_cmd, |
3972 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
3973 | NO_STR | |
3974 | NEIGHBOR_STR | |
3975 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 3976 | "Enforce EBGP neighbors perform multihop\n") |
6b0655a2 | 3977 | |
718e3744 | 3978 | DEFUN (neighbor_description, |
3979 | neighbor_description_cmd, | |
3980 | NEIGHBOR_CMD2 "description .LINE", | |
3981 | NEIGHBOR_STR | |
3982 | NEIGHBOR_ADDR_STR2 | |
3983 | "Neighbor specific description\n" | |
3984 | "Up to 80 characters describing this neighbor\n") | |
3985 | { | |
3986 | struct peer *peer; | |
718e3744 | 3987 | char *str; |
718e3744 | 3988 | |
3989 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3990 | if (! peer) | |
3991 | return CMD_WARNING; | |
3992 | ||
3993 | if (argc == 1) | |
3994 | return CMD_SUCCESS; | |
3995 | ||
3b8b1855 | 3996 | str = argv_concat(argv, argc, 1); |
718e3744 | 3997 | |
3998 | peer_description_set (peer, str); | |
3999 | ||
3b8b1855 | 4000 | XFREE (MTYPE_TMP, str); |
718e3744 | 4001 | |
4002 | return CMD_SUCCESS; | |
4003 | } | |
4004 | ||
4005 | DEFUN (no_neighbor_description, | |
4006 | no_neighbor_description_cmd, | |
4007 | NO_NEIGHBOR_CMD2 "description", | |
4008 | NO_STR | |
4009 | NEIGHBOR_STR | |
4010 | NEIGHBOR_ADDR_STR2 | |
4011 | "Neighbor specific description\n") | |
4012 | { | |
4013 | struct peer *peer; | |
4014 | ||
4015 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4016 | if (! peer) | |
4017 | return CMD_WARNING; | |
4018 | ||
4019 | peer_description_unset (peer); | |
4020 | ||
4021 | return CMD_SUCCESS; | |
4022 | } | |
4023 | ||
4024 | ALIAS (no_neighbor_description, | |
4025 | no_neighbor_description_val_cmd, | |
4026 | NO_NEIGHBOR_CMD2 "description .LINE", | |
4027 | NO_STR | |
4028 | NEIGHBOR_STR | |
4029 | NEIGHBOR_ADDR_STR2 | |
4030 | "Neighbor specific description\n" | |
4031 | "Up to 80 characters describing this neighbor\n") | |
6b0655a2 | 4032 | |
718e3744 | 4033 | /* Neighbor update-source. */ |
94f2b392 | 4034 | static int |
fd79ac91 | 4035 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
4036 | const char *source_str) | |
718e3744 | 4037 | { |
4038 | struct peer *peer; | |
718e3744 | 4039 | |
4040 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4041 | if (! peer) | |
4042 | return CMD_WARNING; | |
4043 | ||
a80beece DS |
4044 | if (peer->conf_if) |
4045 | return CMD_WARNING; | |
4046 | ||
718e3744 | 4047 | if (source_str) |
4048 | { | |
c63b83fe JBD |
4049 | union sockunion su; |
4050 | int ret = str2sockunion (source_str, &su); | |
4051 | ||
4052 | if (ret == 0) | |
4053 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 4054 | else |
4055 | peer_update_source_if_set (peer, source_str); | |
4056 | } | |
4057 | else | |
4058 | peer_update_source_unset (peer); | |
4059 | ||
4060 | return CMD_SUCCESS; | |
4061 | } | |
4062 | ||
9a1a331d | 4063 | #define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)" |
369688c0 PJ |
4064 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
4065 | "IPv4 address\n" \ | |
9a1a331d PJ |
4066 | "IPv6 address\n" \ |
4067 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 4068 | |
718e3744 | 4069 | DEFUN (neighbor_update_source, |
4070 | neighbor_update_source_cmd, | |
369688c0 | 4071 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR, |
718e3744 | 4072 | NEIGHBOR_STR |
4073 | NEIGHBOR_ADDR_STR2 | |
4074 | "Source of routing updates\n" | |
369688c0 | 4075 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 4076 | { |
4077 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
4078 | } | |
4079 | ||
4080 | DEFUN (no_neighbor_update_source, | |
4081 | no_neighbor_update_source_cmd, | |
4082 | NO_NEIGHBOR_CMD2 "update-source", | |
4083 | NO_STR | |
4084 | NEIGHBOR_STR | |
4085 | NEIGHBOR_ADDR_STR2 | |
369688c0 | 4086 | "Source of routing updates\n") |
718e3744 | 4087 | { |
4088 | return peer_update_source_vty (vty, argv[0], NULL); | |
4089 | } | |
6b0655a2 | 4090 | |
94f2b392 | 4091 | static int |
fd79ac91 | 4092 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
4093 | afi_t afi, safi_t safi, | |
4094 | const char *rmap, int set) | |
718e3744 | 4095 | { |
4096 | int ret; | |
4097 | struct peer *peer; | |
4098 | ||
4099 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4100 | if (! peer) | |
4101 | return CMD_WARNING; | |
4102 | ||
4103 | if (set) | |
4104 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
4105 | else | |
4106 | ret = peer_default_originate_unset (peer, afi, safi); | |
4107 | ||
4108 | return bgp_vty_return (vty, ret); | |
4109 | } | |
4110 | ||
4111 | /* neighbor default-originate. */ | |
4112 | DEFUN (neighbor_default_originate, | |
4113 | neighbor_default_originate_cmd, | |
4114 | NEIGHBOR_CMD2 "default-originate", | |
4115 | NEIGHBOR_STR | |
4116 | NEIGHBOR_ADDR_STR2 | |
4117 | "Originate default route to this neighbor\n") | |
4118 | { | |
4119 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4120 | bgp_node_safi (vty), NULL, 1); | |
4121 | } | |
4122 | ||
4123 | DEFUN (neighbor_default_originate_rmap, | |
4124 | neighbor_default_originate_rmap_cmd, | |
4125 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4126 | NEIGHBOR_STR | |
4127 | NEIGHBOR_ADDR_STR2 | |
4128 | "Originate default route to this neighbor\n" | |
4129 | "Route-map to specify criteria to originate default\n" | |
4130 | "route-map name\n") | |
4131 | { | |
4132 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4133 | bgp_node_safi (vty), argv[1], 1); | |
4134 | } | |
4135 | ||
4136 | DEFUN (no_neighbor_default_originate, | |
4137 | no_neighbor_default_originate_cmd, | |
4138 | NO_NEIGHBOR_CMD2 "default-originate", | |
4139 | NO_STR | |
4140 | NEIGHBOR_STR | |
4141 | NEIGHBOR_ADDR_STR2 | |
4142 | "Originate default route to this neighbor\n") | |
4143 | { | |
4144 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4145 | bgp_node_safi (vty), NULL, 0); | |
4146 | } | |
4147 | ||
4148 | ALIAS (no_neighbor_default_originate, | |
4149 | no_neighbor_default_originate_rmap_cmd, | |
4150 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4151 | NO_STR | |
4152 | NEIGHBOR_STR | |
4153 | NEIGHBOR_ADDR_STR2 | |
4154 | "Originate default route to this neighbor\n" | |
4155 | "Route-map to specify criteria to originate default\n" | |
4156 | "route-map name\n") | |
6b0655a2 | 4157 | |
718e3744 | 4158 | /* Set neighbor's BGP port. */ |
94f2b392 | 4159 | static int |
fd79ac91 | 4160 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
4161 | const char *port_str) | |
718e3744 | 4162 | { |
4163 | struct peer *peer; | |
4164 | u_int16_t port; | |
4165 | struct servent *sp; | |
4166 | ||
4167 | peer = peer_lookup_vty (vty, ip_str); | |
4168 | if (! peer) | |
4169 | return CMD_WARNING; | |
4170 | ||
4171 | if (! port_str) | |
4172 | { | |
4173 | sp = getservbyname ("bgp", "tcp"); | |
4174 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
4175 | } | |
4176 | else | |
4177 | { | |
4178 | VTY_GET_INTEGER("port", port, port_str); | |
4179 | } | |
4180 | ||
4181 | peer_port_set (peer, port); | |
4182 | ||
4183 | return CMD_SUCCESS; | |
4184 | } | |
4185 | ||
f418446b | 4186 | /* Set specified peer's BGP port. */ |
718e3744 | 4187 | DEFUN (neighbor_port, |
4188 | neighbor_port_cmd, | |
4189 | NEIGHBOR_CMD "port <0-65535>", | |
4190 | NEIGHBOR_STR | |
4191 | NEIGHBOR_ADDR_STR | |
4192 | "Neighbor's BGP port\n" | |
4193 | "TCP port number\n") | |
4194 | { | |
4195 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
4196 | } | |
4197 | ||
4198 | DEFUN (no_neighbor_port, | |
4199 | no_neighbor_port_cmd, | |
4200 | NO_NEIGHBOR_CMD "port", | |
4201 | NO_STR | |
4202 | NEIGHBOR_STR | |
4203 | NEIGHBOR_ADDR_STR | |
4204 | "Neighbor's BGP port\n") | |
4205 | { | |
4206 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
4207 | } | |
4208 | ||
4209 | ALIAS (no_neighbor_port, | |
4210 | no_neighbor_port_val_cmd, | |
4211 | NO_NEIGHBOR_CMD "port <0-65535>", | |
4212 | NO_STR | |
4213 | NEIGHBOR_STR | |
4214 | NEIGHBOR_ADDR_STR | |
4215 | "Neighbor's BGP port\n" | |
4216 | "TCP port number\n") | |
6b0655a2 | 4217 | |
718e3744 | 4218 | /* neighbor weight. */ |
94f2b392 | 4219 | static int |
fd79ac91 | 4220 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
4221 | const char *weight_str) | |
718e3744 | 4222 | { |
4223 | int ret; | |
4224 | struct peer *peer; | |
4225 | unsigned long weight; | |
4226 | ||
4227 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4228 | if (! peer) | |
4229 | return CMD_WARNING; | |
4230 | ||
4231 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
4232 | ||
4233 | ret = peer_weight_set (peer, weight); | |
4234 | ||
4235 | return CMD_SUCCESS; | |
4236 | } | |
4237 | ||
94f2b392 | 4238 | static int |
fd79ac91 | 4239 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4240 | { |
4241 | struct peer *peer; | |
4242 | ||
4243 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4244 | if (! peer) | |
4245 | return CMD_WARNING; | |
4246 | ||
4247 | peer_weight_unset (peer); | |
4248 | ||
4249 | return CMD_SUCCESS; | |
4250 | } | |
4251 | ||
4252 | DEFUN (neighbor_weight, | |
4253 | neighbor_weight_cmd, | |
4254 | NEIGHBOR_CMD2 "weight <0-65535>", | |
4255 | NEIGHBOR_STR | |
4256 | NEIGHBOR_ADDR_STR2 | |
4257 | "Set default weight for routes from this neighbor\n" | |
4258 | "default weight\n") | |
4259 | { | |
4260 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
4261 | } | |
4262 | ||
4263 | DEFUN (no_neighbor_weight, | |
4264 | no_neighbor_weight_cmd, | |
4265 | NO_NEIGHBOR_CMD2 "weight", | |
4266 | NO_STR | |
4267 | NEIGHBOR_STR | |
4268 | NEIGHBOR_ADDR_STR2 | |
4269 | "Set default weight for routes from this neighbor\n") | |
4270 | { | |
4271 | return peer_weight_unset_vty (vty, argv[0]); | |
4272 | } | |
4273 | ||
4274 | ALIAS (no_neighbor_weight, | |
4275 | no_neighbor_weight_val_cmd, | |
4276 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
4277 | NO_STR | |
4278 | NEIGHBOR_STR | |
4279 | NEIGHBOR_ADDR_STR2 | |
4280 | "Set default weight for routes from this neighbor\n" | |
4281 | "default weight\n") | |
6b0655a2 | 4282 | |
718e3744 | 4283 | /* Override capability negotiation. */ |
4284 | DEFUN (neighbor_override_capability, | |
4285 | neighbor_override_capability_cmd, | |
4286 | NEIGHBOR_CMD2 "override-capability", | |
4287 | NEIGHBOR_STR | |
4288 | NEIGHBOR_ADDR_STR2 | |
4289 | "Override capability negotiation result\n") | |
4290 | { | |
4291 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4292 | } | |
4293 | ||
4294 | DEFUN (no_neighbor_override_capability, | |
4295 | no_neighbor_override_capability_cmd, | |
4296 | NO_NEIGHBOR_CMD2 "override-capability", | |
4297 | NO_STR | |
4298 | NEIGHBOR_STR | |
4299 | NEIGHBOR_ADDR_STR2 | |
4300 | "Override capability negotiation result\n") | |
4301 | { | |
4302 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4303 | } | |
6b0655a2 | 4304 | |
718e3744 | 4305 | DEFUN (neighbor_strict_capability, |
4306 | neighbor_strict_capability_cmd, | |
4307 | NEIGHBOR_CMD "strict-capability-match", | |
4308 | NEIGHBOR_STR | |
4309 | NEIGHBOR_ADDR_STR | |
4310 | "Strict capability negotiation match\n") | |
4311 | { | |
4312 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4313 | } | |
4314 | ||
4315 | DEFUN (no_neighbor_strict_capability, | |
4316 | no_neighbor_strict_capability_cmd, | |
4317 | NO_NEIGHBOR_CMD "strict-capability-match", | |
4318 | NO_STR | |
4319 | NEIGHBOR_STR | |
4320 | NEIGHBOR_ADDR_STR | |
4321 | "Strict capability negotiation match\n") | |
4322 | { | |
4323 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4324 | } | |
6b0655a2 | 4325 | |
94f2b392 | 4326 | static int |
fd79ac91 | 4327 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
4328 | const char *keep_str, const char *hold_str) | |
718e3744 | 4329 | { |
4330 | int ret; | |
4331 | struct peer *peer; | |
4332 | u_int32_t keepalive; | |
4333 | u_int32_t holdtime; | |
4334 | ||
4335 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4336 | if (! peer) | |
4337 | return CMD_WARNING; | |
4338 | ||
4339 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
4340 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
4341 | ||
4342 | ret = peer_timers_set (peer, keepalive, holdtime); | |
4343 | ||
4344 | return bgp_vty_return (vty, ret); | |
4345 | } | |
6b0655a2 | 4346 | |
94f2b392 | 4347 | static int |
fd79ac91 | 4348 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4349 | { |
4350 | int ret; | |
4351 | struct peer *peer; | |
4352 | ||
4353 | peer = peer_lookup_vty (vty, ip_str); | |
4354 | if (! peer) | |
4355 | return CMD_WARNING; | |
4356 | ||
4357 | ret = peer_timers_unset (peer); | |
4358 | ||
4359 | return bgp_vty_return (vty, ret); | |
4360 | } | |
4361 | ||
4362 | DEFUN (neighbor_timers, | |
4363 | neighbor_timers_cmd, | |
4364 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4365 | NEIGHBOR_STR | |
4366 | NEIGHBOR_ADDR_STR2 | |
4367 | "BGP per neighbor timers\n" | |
4368 | "Keepalive interval\n" | |
4369 | "Holdtime\n") | |
4370 | { | |
4371 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
4372 | } | |
4373 | ||
4374 | DEFUN (no_neighbor_timers, | |
4375 | no_neighbor_timers_cmd, | |
4376 | NO_NEIGHBOR_CMD2 "timers", | |
4377 | NO_STR | |
4378 | NEIGHBOR_STR | |
4379 | NEIGHBOR_ADDR_STR2 | |
4380 | "BGP per neighbor timers\n") | |
4381 | { | |
4382 | return peer_timers_unset_vty (vty, argv[0]); | |
4383 | } | |
6b0655a2 | 4384 | |
94f2b392 | 4385 | static int |
fd79ac91 | 4386 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
4387 | const char *time_str) | |
718e3744 | 4388 | { |
4389 | int ret; | |
4390 | struct peer *peer; | |
4391 | u_int32_t connect; | |
4392 | ||
966f821c | 4393 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4394 | if (! peer) |
4395 | return CMD_WARNING; | |
4396 | ||
4397 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
4398 | ||
4399 | ret = peer_timers_connect_set (peer, connect); | |
4400 | ||
966f821c | 4401 | return bgp_vty_return (vty, ret); |
718e3744 | 4402 | } |
4403 | ||
94f2b392 | 4404 | static int |
fd79ac91 | 4405 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4406 | { |
4407 | int ret; | |
4408 | struct peer *peer; | |
4409 | ||
4410 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4411 | if (! peer) | |
4412 | return CMD_WARNING; | |
4413 | ||
4414 | ret = peer_timers_connect_unset (peer); | |
4415 | ||
966f821c | 4416 | return bgp_vty_return (vty, ret); |
718e3744 | 4417 | } |
4418 | ||
4419 | DEFUN (neighbor_timers_connect, | |
4420 | neighbor_timers_connect_cmd, | |
966f821c | 4421 | NEIGHBOR_CMD2 "timers connect <0-65535>", |
718e3744 | 4422 | NEIGHBOR_STR |
966f821c | 4423 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4424 | "BGP per neighbor timers\n" |
4425 | "BGP connect timer\n" | |
4426 | "Connect timer\n") | |
4427 | { | |
4428 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
4429 | } | |
4430 | ||
4431 | DEFUN (no_neighbor_timers_connect, | |
4432 | no_neighbor_timers_connect_cmd, | |
966f821c | 4433 | NO_NEIGHBOR_CMD2 "timers connect", |
718e3744 | 4434 | NO_STR |
4435 | NEIGHBOR_STR | |
966f821c | 4436 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4437 | "BGP per neighbor timers\n" |
4438 | "BGP connect timer\n") | |
4439 | { | |
4440 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
4441 | } | |
4442 | ||
4443 | ALIAS (no_neighbor_timers_connect, | |
4444 | no_neighbor_timers_connect_val_cmd, | |
966f821c | 4445 | NO_NEIGHBOR_CMD2 "timers connect <0-65535>", |
718e3744 | 4446 | NO_STR |
4447 | NEIGHBOR_STR | |
966f821c | 4448 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4449 | "BGP per neighbor timers\n" |
4450 | "BGP connect timer\n" | |
4451 | "Connect timer\n") | |
6b0655a2 | 4452 | |
94f2b392 | 4453 | static int |
fd79ac91 | 4454 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
4455 | const char *time_str, int set) | |
718e3744 | 4456 | { |
4457 | int ret; | |
4458 | struct peer *peer; | |
4459 | u_int32_t routeadv = 0; | |
4460 | ||
966f821c | 4461 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4462 | if (! peer) |
4463 | return CMD_WARNING; | |
4464 | ||
4465 | if (time_str) | |
4466 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
4467 | ||
4468 | if (set) | |
4469 | ret = peer_advertise_interval_set (peer, routeadv); | |
4470 | else | |
4471 | ret = peer_advertise_interval_unset (peer); | |
4472 | ||
966f821c | 4473 | return bgp_vty_return (vty, ret); |
718e3744 | 4474 | } |
4475 | ||
4476 | DEFUN (neighbor_advertise_interval, | |
4477 | neighbor_advertise_interval_cmd, | |
966f821c | 4478 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4479 | NEIGHBOR_STR |
966f821c | 4480 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4481 | "Minimum interval between sending BGP routing updates\n" |
4482 | "time in seconds\n") | |
4483 | { | |
4484 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
4485 | } | |
4486 | ||
4487 | DEFUN (no_neighbor_advertise_interval, | |
4488 | no_neighbor_advertise_interval_cmd, | |
966f821c | 4489 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
718e3744 | 4490 | NO_STR |
4491 | NEIGHBOR_STR | |
966f821c | 4492 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4493 | "Minimum interval between sending BGP routing updates\n") |
4494 | { | |
4495 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
4496 | } | |
4497 | ||
4498 | ALIAS (no_neighbor_advertise_interval, | |
4499 | no_neighbor_advertise_interval_val_cmd, | |
966f821c | 4500 | NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4501 | NO_STR |
4502 | NEIGHBOR_STR | |
966f821c | 4503 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4504 | "Minimum interval between sending BGP routing updates\n" |
4505 | "time in seconds\n") | |
6b0655a2 | 4506 | |
518f0eb1 DS |
4507 | /* Time to wait before processing route-map updates */ |
4508 | DEFUN (bgp_set_route_map_delay_timer, | |
4509 | bgp_set_route_map_delay_timer_cmd, | |
4510 | "bgp route-map delay-timer <0-600>", | |
4511 | SET_STR | |
4512 | "BGP route-map delay timer\n" | |
4513 | "Time in secs to wait before processing route-map changes\n" | |
4514 | "0 disables the timer and no route updates happen when\n" | |
4515 | "route-maps change") | |
4516 | { | |
4517 | u_int32_t rmap_delay_timer; | |
4518 | struct bgp *bgp; | |
4519 | ||
4520 | bgp = vty->index; | |
4521 | if (argv[0]) | |
4522 | { | |
4523 | VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); | |
4524 | bgp->rmap_update_timer = rmap_delay_timer; | |
4525 | ||
4526 | /* if the dynamic update handling is being disabled, and a timer is | |
4527 | * running, stop the timer and act as if the timer has already fired. | |
4528 | */ | |
4529 | if (!rmap_delay_timer && bgp->t_rmap_update ) | |
4530 | { | |
4531 | BGP_TIMER_OFF(bgp->t_rmap_update); | |
4532 | thread_execute (bm->master, bgp_route_map_update_timer, &bgp, 0); | |
4533 | } | |
4534 | return CMD_SUCCESS; | |
4535 | } | |
4536 | else | |
4537 | CMD_WARNING; | |
4538 | } | |
4539 | ||
4540 | DEFUN (no_bgp_set_route_map_delay_timer, | |
4541 | no_bgp_set_route_map_delay_timer_cmd, | |
4542 | "no bgp route-map delay-timer", | |
4543 | NO_STR | |
4544 | "Default BGP route-map delay timer\n" | |
4545 | "Reset to default time to wait for processing route-map changes") | |
4546 | { | |
4547 | u_int32_t rmap_delay_timer; | |
4548 | struct bgp *bgp; | |
4549 | ||
4550 | bgp = vty->index; | |
4551 | bgp->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER; | |
4552 | ||
4553 | return CMD_SUCCESS; | |
4554 | } | |
4555 | ||
718e3744 | 4556 | /* neighbor interface */ |
94f2b392 | 4557 | static int |
fd79ac91 | 4558 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 4559 | { |
4560 | int ret; | |
4561 | struct peer *peer; | |
4562 | ||
4563 | peer = peer_lookup_vty (vty, ip_str); | |
a80beece | 4564 | if (! peer || peer->conf_if) |
718e3744 | 4565 | return CMD_WARNING; |
4566 | ||
4567 | if (str) | |
4568 | ret = peer_interface_set (peer, str); | |
4569 | else | |
4570 | ret = peer_interface_unset (peer); | |
4571 | ||
4572 | return CMD_SUCCESS; | |
4573 | } | |
4574 | ||
4575 | DEFUN (neighbor_interface, | |
4576 | neighbor_interface_cmd, | |
4577 | NEIGHBOR_CMD "interface WORD", | |
4578 | NEIGHBOR_STR | |
4579 | NEIGHBOR_ADDR_STR | |
4580 | "Interface\n" | |
4581 | "Interface name\n") | |
4582 | { | |
4583 | return peer_interface_vty (vty, argv[0], argv[1]); | |
4584 | } | |
4585 | ||
4586 | DEFUN (no_neighbor_interface, | |
4587 | no_neighbor_interface_cmd, | |
4588 | NO_NEIGHBOR_CMD "interface WORD", | |
4589 | NO_STR | |
4590 | NEIGHBOR_STR | |
4591 | NEIGHBOR_ADDR_STR | |
4592 | "Interface\n" | |
4593 | "Interface name\n") | |
4594 | { | |
4595 | return peer_interface_vty (vty, argv[0], NULL); | |
4596 | } | |
6b0655a2 | 4597 | |
718e3744 | 4598 | /* Set distribute list to the peer. */ |
94f2b392 | 4599 | static int |
fd79ac91 | 4600 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
4601 | afi_t afi, safi_t safi, | |
4602 | const char *name_str, const char *direct_str) | |
718e3744 | 4603 | { |
4604 | int ret; | |
4605 | struct peer *peer; | |
4606 | int direct = FILTER_IN; | |
4607 | ||
4608 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4609 | if (! peer) | |
4610 | return CMD_WARNING; | |
4611 | ||
4612 | /* Check filter direction. */ | |
4613 | if (strncmp (direct_str, "i", 1) == 0) | |
4614 | direct = FILTER_IN; | |
4615 | else if (strncmp (direct_str, "o", 1) == 0) | |
4616 | direct = FILTER_OUT; | |
4617 | ||
4618 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
4619 | ||
4620 | return bgp_vty_return (vty, ret); | |
4621 | } | |
4622 | ||
94f2b392 | 4623 | static int |
fd79ac91 | 4624 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4625 | safi_t safi, const char *direct_str) | |
718e3744 | 4626 | { |
4627 | int ret; | |
4628 | struct peer *peer; | |
4629 | int direct = FILTER_IN; | |
4630 | ||
4631 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4632 | if (! peer) | |
4633 | return CMD_WARNING; | |
4634 | ||
4635 | /* Check filter direction. */ | |
4636 | if (strncmp (direct_str, "i", 1) == 0) | |
4637 | direct = FILTER_IN; | |
4638 | else if (strncmp (direct_str, "o", 1) == 0) | |
4639 | direct = FILTER_OUT; | |
4640 | ||
4641 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
4642 | ||
4643 | return bgp_vty_return (vty, ret); | |
4644 | } | |
4645 | ||
4646 | DEFUN (neighbor_distribute_list, | |
4647 | neighbor_distribute_list_cmd, | |
4648 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
4649 | NEIGHBOR_STR | |
4650 | NEIGHBOR_ADDR_STR2 | |
4651 | "Filter updates to/from this neighbor\n" | |
4652 | "IP access-list number\n" | |
4653 | "IP access-list number (expanded range)\n" | |
4654 | "IP Access-list name\n" | |
4655 | "Filter incoming updates\n" | |
4656 | "Filter outgoing updates\n") | |
4657 | { | |
4658 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4659 | bgp_node_safi (vty), argv[1], argv[2]); | |
4660 | } | |
4661 | ||
4662 | DEFUN (no_neighbor_distribute_list, | |
4663 | no_neighbor_distribute_list_cmd, | |
4664 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
4665 | NO_STR | |
4666 | NEIGHBOR_STR | |
4667 | NEIGHBOR_ADDR_STR2 | |
4668 | "Filter updates to/from this neighbor\n" | |
4669 | "IP access-list number\n" | |
4670 | "IP access-list number (expanded range)\n" | |
4671 | "IP Access-list name\n" | |
4672 | "Filter incoming updates\n" | |
4673 | "Filter outgoing updates\n") | |
4674 | { | |
4675 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4676 | bgp_node_safi (vty), argv[2]); | |
4677 | } | |
6b0655a2 | 4678 | |
718e3744 | 4679 | /* Set prefix list to the peer. */ |
94f2b392 | 4680 | static int |
fd79ac91 | 4681 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4682 | safi_t safi, const char *name_str, | |
4683 | const char *direct_str) | |
718e3744 | 4684 | { |
4685 | int ret; | |
4686 | struct peer *peer; | |
4687 | int direct = FILTER_IN; | |
4688 | ||
4689 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4690 | if (! peer) | |
4691 | return CMD_WARNING; | |
4692 | ||
4693 | /* Check filter direction. */ | |
4694 | if (strncmp (direct_str, "i", 1) == 0) | |
4695 | direct = FILTER_IN; | |
4696 | else if (strncmp (direct_str, "o", 1) == 0) | |
4697 | direct = FILTER_OUT; | |
4698 | ||
4699 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
4700 | ||
4701 | return bgp_vty_return (vty, ret); | |
4702 | } | |
4703 | ||
94f2b392 | 4704 | static int |
fd79ac91 | 4705 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4706 | safi_t safi, const char *direct_str) | |
718e3744 | 4707 | { |
4708 | int ret; | |
4709 | struct peer *peer; | |
4710 | int direct = FILTER_IN; | |
4711 | ||
4712 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4713 | if (! peer) | |
4714 | return CMD_WARNING; | |
4715 | ||
4716 | /* Check filter direction. */ | |
4717 | if (strncmp (direct_str, "i", 1) == 0) | |
4718 | direct = FILTER_IN; | |
4719 | else if (strncmp (direct_str, "o", 1) == 0) | |
4720 | direct = FILTER_OUT; | |
4721 | ||
4722 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
4723 | ||
4724 | return bgp_vty_return (vty, ret); | |
4725 | } | |
4726 | ||
4727 | DEFUN (neighbor_prefix_list, | |
4728 | neighbor_prefix_list_cmd, | |
4729 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
4730 | NEIGHBOR_STR | |
4731 | NEIGHBOR_ADDR_STR2 | |
4732 | "Filter updates to/from this neighbor\n" | |
4733 | "Name of a prefix list\n" | |
4734 | "Filter incoming updates\n" | |
4735 | "Filter outgoing updates\n") | |
4736 | { | |
4737 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4738 | bgp_node_safi (vty), argv[1], argv[2]); | |
4739 | } | |
4740 | ||
4741 | DEFUN (no_neighbor_prefix_list, | |
4742 | no_neighbor_prefix_list_cmd, | |
4743 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
4744 | NO_STR | |
4745 | NEIGHBOR_STR | |
4746 | NEIGHBOR_ADDR_STR2 | |
4747 | "Filter updates to/from this neighbor\n" | |
4748 | "Name of a prefix list\n" | |
4749 | "Filter incoming updates\n" | |
4750 | "Filter outgoing updates\n") | |
4751 | { | |
4752 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4753 | bgp_node_safi (vty), argv[2]); | |
4754 | } | |
6b0655a2 | 4755 | |
94f2b392 | 4756 | static int |
fd79ac91 | 4757 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
4758 | afi_t afi, safi_t safi, | |
4759 | const char *name_str, const char *direct_str) | |
718e3744 | 4760 | { |
4761 | int ret; | |
4762 | struct peer *peer; | |
4763 | int direct = FILTER_IN; | |
4764 | ||
4765 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4766 | if (! peer) | |
4767 | return CMD_WARNING; | |
4768 | ||
4769 | /* Check filter direction. */ | |
4770 | if (strncmp (direct_str, "i", 1) == 0) | |
4771 | direct = FILTER_IN; | |
4772 | else if (strncmp (direct_str, "o", 1) == 0) | |
4773 | direct = FILTER_OUT; | |
4774 | ||
4775 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
4776 | ||
4777 | return bgp_vty_return (vty, ret); | |
4778 | } | |
4779 | ||
94f2b392 | 4780 | static int |
fd79ac91 | 4781 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
4782 | afi_t afi, safi_t safi, | |
4783 | const char *direct_str) | |
718e3744 | 4784 | { |
4785 | int ret; | |
4786 | struct peer *peer; | |
4787 | int direct = FILTER_IN; | |
4788 | ||
4789 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4790 | if (! peer) | |
4791 | return CMD_WARNING; | |
4792 | ||
4793 | /* Check filter direction. */ | |
4794 | if (strncmp (direct_str, "i", 1) == 0) | |
4795 | direct = FILTER_IN; | |
4796 | else if (strncmp (direct_str, "o", 1) == 0) | |
4797 | direct = FILTER_OUT; | |
4798 | ||
4799 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
4800 | ||
4801 | return bgp_vty_return (vty, ret); | |
4802 | } | |
4803 | ||
4804 | DEFUN (neighbor_filter_list, | |
4805 | neighbor_filter_list_cmd, | |
4806 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
4807 | NEIGHBOR_STR | |
4808 | NEIGHBOR_ADDR_STR2 | |
4809 | "Establish BGP filters\n" | |
4810 | "AS path access-list name\n" | |
4811 | "Filter incoming routes\n" | |
4812 | "Filter outgoing routes\n") | |
4813 | { | |
4814 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4815 | bgp_node_safi (vty), argv[1], argv[2]); | |
4816 | } | |
4817 | ||
4818 | DEFUN (no_neighbor_filter_list, | |
4819 | no_neighbor_filter_list_cmd, | |
4820 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
4821 | NO_STR | |
4822 | NEIGHBOR_STR | |
4823 | NEIGHBOR_ADDR_STR2 | |
4824 | "Establish BGP filters\n" | |
4825 | "AS path access-list name\n" | |
4826 | "Filter incoming routes\n" | |
4827 | "Filter outgoing routes\n") | |
4828 | { | |
4829 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4830 | bgp_node_safi (vty), argv[2]); | |
4831 | } | |
6b0655a2 | 4832 | |
718e3744 | 4833 | /* Set route-map to the peer. */ |
94f2b392 | 4834 | static int |
fd79ac91 | 4835 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
4836 | afi_t afi, safi_t safi, | |
4837 | const char *name_str, const char *direct_str) | |
718e3744 | 4838 | { |
4839 | int ret; | |
4840 | struct peer *peer; | |
fee0f4c6 | 4841 | int direct = RMAP_IN; |
718e3744 | 4842 | |
4843 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4844 | if (! peer) | |
4845 | return CMD_WARNING; | |
4846 | ||
4847 | /* Check filter direction. */ | |
fee0f4c6 | 4848 | if (strncmp (direct_str, "in", 2) == 0) |
4849 | direct = RMAP_IN; | |
718e3744 | 4850 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 4851 | direct = RMAP_OUT; |
4852 | else if (strncmp (direct_str, "im", 2) == 0) | |
4853 | direct = RMAP_IMPORT; | |
4854 | else if (strncmp (direct_str, "e", 1) == 0) | |
4855 | direct = RMAP_EXPORT; | |
718e3744 | 4856 | |
4857 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
4858 | ||
4859 | return bgp_vty_return (vty, ret); | |
4860 | } | |
4861 | ||
94f2b392 | 4862 | static int |
fd79ac91 | 4863 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4864 | safi_t safi, const char *direct_str) | |
718e3744 | 4865 | { |
4866 | int ret; | |
4867 | struct peer *peer; | |
fee0f4c6 | 4868 | int direct = RMAP_IN; |
718e3744 | 4869 | |
4870 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4871 | if (! peer) | |
4872 | return CMD_WARNING; | |
4873 | ||
4874 | /* Check filter direction. */ | |
fee0f4c6 | 4875 | if (strncmp (direct_str, "in", 2) == 0) |
4876 | direct = RMAP_IN; | |
718e3744 | 4877 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 4878 | direct = RMAP_OUT; |
4879 | else if (strncmp (direct_str, "im", 2) == 0) | |
4880 | direct = RMAP_IMPORT; | |
4881 | else if (strncmp (direct_str, "e", 1) == 0) | |
4882 | direct = RMAP_EXPORT; | |
718e3744 | 4883 | |
4884 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
4885 | ||
4886 | return bgp_vty_return (vty, ret); | |
4887 | } | |
4888 | ||
4889 | DEFUN (neighbor_route_map, | |
4890 | neighbor_route_map_cmd, | |
fee0f4c6 | 4891 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 4892 | NEIGHBOR_STR |
4893 | NEIGHBOR_ADDR_STR2 | |
4894 | "Apply route map to neighbor\n" | |
4895 | "Name of route map\n" | |
4896 | "Apply map to incoming routes\n" | |
fee0f4c6 | 4897 | "Apply map to outbound routes\n" |
4898 | "Apply map to routes going into a Route-Server client's table\n" | |
4899 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 4900 | { |
4901 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4902 | bgp_node_safi (vty), argv[1], argv[2]); | |
4903 | } | |
4904 | ||
4905 | DEFUN (no_neighbor_route_map, | |
4906 | no_neighbor_route_map_cmd, | |
fee0f4c6 | 4907 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 4908 | NO_STR |
4909 | NEIGHBOR_STR | |
4910 | NEIGHBOR_ADDR_STR2 | |
4911 | "Apply route map to neighbor\n" | |
4912 | "Name of route map\n" | |
4913 | "Apply map to incoming routes\n" | |
fee0f4c6 | 4914 | "Apply map to outbound routes\n" |
4915 | "Apply map to routes going into a Route-Server client's table\n" | |
4916 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 4917 | { |
4918 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4919 | bgp_node_safi (vty), argv[2]); | |
4920 | } | |
6b0655a2 | 4921 | |
718e3744 | 4922 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 4923 | static int |
fd79ac91 | 4924 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4925 | safi_t safi, const char *name_str) | |
718e3744 | 4926 | { |
4927 | int ret; | |
4928 | struct peer *peer; | |
4929 | ||
4930 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4931 | if (! peer) | |
4932 | return CMD_WARNING; | |
4933 | ||
4934 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
4935 | ||
4936 | return bgp_vty_return (vty, ret); | |
4937 | } | |
4938 | ||
4939 | /* Unset route-map from the peer. */ | |
94f2b392 | 4940 | static int |
fd79ac91 | 4941 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 4942 | safi_t safi) |
4943 | { | |
4944 | int ret; | |
4945 | struct peer *peer; | |
4946 | ||
4947 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4948 | if (! peer) | |
4949 | return CMD_WARNING; | |
4950 | ||
4951 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
4952 | ||
4953 | return bgp_vty_return (vty, ret); | |
4954 | } | |
4955 | ||
4956 | DEFUN (neighbor_unsuppress_map, | |
4957 | neighbor_unsuppress_map_cmd, | |
4958 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
4959 | NEIGHBOR_STR | |
4960 | NEIGHBOR_ADDR_STR2 | |
4961 | "Route-map to selectively unsuppress suppressed routes\n" | |
4962 | "Name of route map\n") | |
4963 | { | |
4964 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4965 | bgp_node_safi (vty), argv[1]); | |
4966 | } | |
4967 | ||
4968 | DEFUN (no_neighbor_unsuppress_map, | |
4969 | no_neighbor_unsuppress_map_cmd, | |
4970 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
4971 | NO_STR | |
4972 | NEIGHBOR_STR | |
4973 | NEIGHBOR_ADDR_STR2 | |
4974 | "Route-map to selectively unsuppress suppressed routes\n" | |
4975 | "Name of route map\n") | |
4976 | { | |
4977 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4978 | bgp_node_safi (vty)); | |
4979 | } | |
6b0655a2 | 4980 | |
94f2b392 | 4981 | static int |
fd79ac91 | 4982 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4983 | safi_t safi, const char *num_str, | |
0a486e5f | 4984 | const char *threshold_str, int warning, |
4985 | const char *restart_str) | |
718e3744 | 4986 | { |
4987 | int ret; | |
4988 | struct peer *peer; | |
4989 | u_int32_t max; | |
e0701b79 | 4990 | u_char threshold; |
0a486e5f | 4991 | u_int16_t restart; |
718e3744 | 4992 | |
4993 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4994 | if (! peer) | |
4995 | return CMD_WARNING; | |
4996 | ||
e6ec1c36 | 4997 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 4998 | if (threshold_str) |
4999 | threshold = atoi (threshold_str); | |
5000 | else | |
5001 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 5002 | |
0a486e5f | 5003 | if (restart_str) |
5004 | restart = atoi (restart_str); | |
5005 | else | |
5006 | restart = 0; | |
5007 | ||
5008 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 5009 | |
5010 | return bgp_vty_return (vty, ret); | |
5011 | } | |
5012 | ||
94f2b392 | 5013 | static int |
fd79ac91 | 5014 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5015 | safi_t safi) |
5016 | { | |
5017 | int ret; | |
5018 | struct peer *peer; | |
5019 | ||
5020 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5021 | if (! peer) | |
5022 | return CMD_WARNING; | |
5023 | ||
5024 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
5025 | ||
5026 | return bgp_vty_return (vty, ret); | |
5027 | } | |
5028 | ||
5029 | /* Maximum number of prefix configuration. prefix count is different | |
5030 | for each peer configuration. So this configuration can be set for | |
5031 | each peer configuration. */ | |
5032 | DEFUN (neighbor_maximum_prefix, | |
5033 | neighbor_maximum_prefix_cmd, | |
5034 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5035 | NEIGHBOR_STR | |
5036 | NEIGHBOR_ADDR_STR2 | |
5037 | "Maximum number of prefix accept from this peer\n" | |
5038 | "maximum no. of prefix limit\n") | |
5039 | { | |
5040 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5041 | bgp_node_safi (vty), argv[1], NULL, 0, |
5042 | NULL); | |
718e3744 | 5043 | } |
5044 | ||
e0701b79 | 5045 | DEFUN (neighbor_maximum_prefix_threshold, |
5046 | neighbor_maximum_prefix_threshold_cmd, | |
5047 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
5048 | NEIGHBOR_STR | |
5049 | NEIGHBOR_ADDR_STR2 | |
5050 | "Maximum number of prefix accept from this peer\n" | |
5051 | "maximum no. of prefix limit\n" | |
5052 | "Threshold value (%) at which to generate a warning msg\n") | |
5053 | { | |
5054 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5055 | bgp_node_safi (vty), argv[1], argv[2], 0, |
5056 | NULL); | |
5057 | } | |
e0701b79 | 5058 | |
718e3744 | 5059 | DEFUN (neighbor_maximum_prefix_warning, |
5060 | neighbor_maximum_prefix_warning_cmd, | |
5061 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5062 | NEIGHBOR_STR | |
5063 | NEIGHBOR_ADDR_STR2 | |
5064 | "Maximum number of prefix accept from this peer\n" | |
5065 | "maximum no. of prefix limit\n" | |
5066 | "Only give warning message when limit is exceeded\n") | |
5067 | { | |
5068 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5069 | bgp_node_safi (vty), argv[1], NULL, 1, |
5070 | NULL); | |
718e3744 | 5071 | } |
5072 | ||
e0701b79 | 5073 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
5074 | neighbor_maximum_prefix_threshold_warning_cmd, | |
5075 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
5076 | NEIGHBOR_STR | |
5077 | NEIGHBOR_ADDR_STR2 | |
5078 | "Maximum number of prefix accept from this peer\n" | |
5079 | "maximum no. of prefix limit\n" | |
5080 | "Threshold value (%) at which to generate a warning msg\n" | |
5081 | "Only give warning message when limit is exceeded\n") | |
5082 | { | |
5083 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5084 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
5085 | } | |
5086 | ||
5087 | DEFUN (neighbor_maximum_prefix_restart, | |
5088 | neighbor_maximum_prefix_restart_cmd, | |
5089 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
5090 | NEIGHBOR_STR | |
5091 | NEIGHBOR_ADDR_STR2 | |
5092 | "Maximum number of prefix accept from this peer\n" | |
5093 | "maximum no. of prefix limit\n" | |
5094 | "Restart bgp connection after limit is exceeded\n" | |
5095 | "Restart interval in minutes") | |
5096 | { | |
5097 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5098 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
5099 | } | |
5100 | ||
5101 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
5102 | neighbor_maximum_prefix_threshold_restart_cmd, | |
5103 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5104 | NEIGHBOR_STR | |
5105 | NEIGHBOR_ADDR_STR2 | |
5106 | "Maximum number of prefix accept from this peer\n" | |
5107 | "maximum no. of prefix limit\n" | |
5108 | "Threshold value (%) at which to generate a warning msg\n" | |
5109 | "Restart bgp connection after limit is exceeded\n" | |
5110 | "Restart interval in minutes") | |
5111 | { | |
5112 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5113 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
5114 | } | |
e0701b79 | 5115 | |
718e3744 | 5116 | DEFUN (no_neighbor_maximum_prefix, |
5117 | no_neighbor_maximum_prefix_cmd, | |
5118 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
5119 | NO_STR | |
5120 | NEIGHBOR_STR | |
5121 | NEIGHBOR_ADDR_STR2 | |
5122 | "Maximum number of prefix accept from this peer\n") | |
5123 | { | |
5124 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5125 | bgp_node_safi (vty)); | |
5126 | } | |
5127 | ||
5128 | ALIAS (no_neighbor_maximum_prefix, | |
5129 | no_neighbor_maximum_prefix_val_cmd, | |
5130 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5131 | NO_STR | |
5132 | NEIGHBOR_STR | |
5133 | NEIGHBOR_ADDR_STR2 | |
5134 | "Maximum number of prefix accept from this peer\n" | |
5135 | "maximum no. of prefix limit\n") | |
5136 | ||
5137 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5138 | no_neighbor_maximum_prefix_threshold_cmd, |
5139 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5140 | NO_STR | |
5141 | NEIGHBOR_STR | |
5142 | NEIGHBOR_ADDR_STR2 | |
5143 | "Maximum number of prefix accept from this peer\n" | |
5144 | "maximum no. of prefix limit\n" | |
5145 | "Threshold value (%) at which to generate a warning msg\n") | |
5146 | ||
5147 | ALIAS (no_neighbor_maximum_prefix, | |
5148 | no_neighbor_maximum_prefix_warning_cmd, | |
5149 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5150 | NO_STR | |
5151 | NEIGHBOR_STR | |
5152 | NEIGHBOR_ADDR_STR2 | |
5153 | "Maximum number of prefix accept from this peer\n" | |
5154 | "maximum no. of prefix limit\n" | |
e8e1946e | 5155 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 5156 | |
5157 | ALIAS (no_neighbor_maximum_prefix, | |
5158 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 5159 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
5160 | NO_STR | |
5161 | NEIGHBOR_STR | |
5162 | NEIGHBOR_ADDR_STR2 | |
5163 | "Maximum number of prefix accept from this peer\n" | |
5164 | "maximum no. of prefix limit\n" | |
5165 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 5166 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 5167 | |
5168 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5169 | no_neighbor_maximum_prefix_restart_cmd, |
5170 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 5171 | NO_STR |
5172 | NEIGHBOR_STR | |
5173 | NEIGHBOR_ADDR_STR2 | |
5174 | "Maximum number of prefix accept from this peer\n" | |
5175 | "maximum no. of prefix limit\n" | |
0a486e5f | 5176 | "Restart bgp connection after limit is exceeded\n" |
5177 | "Restart interval in minutes") | |
5178 | ||
5179 | ALIAS (no_neighbor_maximum_prefix, | |
5180 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
5181 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5182 | NO_STR | |
5183 | NEIGHBOR_STR | |
5184 | NEIGHBOR_ADDR_STR2 | |
5185 | "Maximum number of prefix accept from this peer\n" | |
5186 | "maximum no. of prefix limit\n" | |
5187 | "Threshold value (%) at which to generate a warning msg\n" | |
5188 | "Restart bgp connection after limit is exceeded\n" | |
5189 | "Restart interval in minutes") | |
6b0655a2 | 5190 | |
718e3744 | 5191 | /* "neighbor allowas-in" */ |
5192 | DEFUN (neighbor_allowas_in, | |
5193 | neighbor_allowas_in_cmd, | |
5194 | NEIGHBOR_CMD2 "allowas-in", | |
5195 | NEIGHBOR_STR | |
5196 | NEIGHBOR_ADDR_STR2 | |
5197 | "Accept as-path with my AS present in it\n") | |
5198 | { | |
5199 | int ret; | |
5200 | struct peer *peer; | |
fd79ac91 | 5201 | unsigned int allow_num; |
718e3744 | 5202 | |
5203 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5204 | if (! peer) | |
5205 | return CMD_WARNING; | |
5206 | ||
5207 | if (argc == 1) | |
5208 | allow_num = 3; | |
5209 | else | |
5210 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
5211 | ||
5212 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
5213 | allow_num); | |
5214 | ||
5215 | return bgp_vty_return (vty, ret); | |
5216 | } | |
5217 | ||
5218 | ALIAS (neighbor_allowas_in, | |
5219 | neighbor_allowas_in_arg_cmd, | |
5220 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5221 | NEIGHBOR_STR | |
5222 | NEIGHBOR_ADDR_STR2 | |
5223 | "Accept as-path with my AS present in it\n" | |
5224 | "Number of occurances of AS number\n") | |
5225 | ||
5226 | DEFUN (no_neighbor_allowas_in, | |
5227 | no_neighbor_allowas_in_cmd, | |
5228 | NO_NEIGHBOR_CMD2 "allowas-in", | |
5229 | NO_STR | |
5230 | NEIGHBOR_STR | |
5231 | NEIGHBOR_ADDR_STR2 | |
5232 | "allow local ASN appears in aspath attribute\n") | |
5233 | { | |
5234 | int ret; | |
5235 | struct peer *peer; | |
5236 | ||
5237 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5238 | if (! peer) | |
5239 | return CMD_WARNING; | |
5240 | ||
5241 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
5242 | ||
5243 | return bgp_vty_return (vty, ret); | |
5244 | } | |
6b0655a2 | 5245 | |
fa411a21 NH |
5246 | DEFUN (neighbor_ttl_security, |
5247 | neighbor_ttl_security_cmd, | |
5248 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5249 | NEIGHBOR_STR | |
5250 | NEIGHBOR_ADDR_STR2 | |
5251 | "Specify the maximum number of hops to the BGP peer\n") | |
5252 | { | |
5253 | struct peer *peer; | |
89b6d1f8 | 5254 | int gtsm_hops; |
fa411a21 NH |
5255 | |
5256 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5257 | if (! peer) | |
5258 | return CMD_WARNING; | |
5259 | ||
5260 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); | |
5261 | ||
89b6d1f8 | 5262 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
5263 | } |
5264 | ||
5265 | DEFUN (no_neighbor_ttl_security, | |
5266 | no_neighbor_ttl_security_cmd, | |
5267 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5268 | NO_STR | |
5269 | NEIGHBOR_STR | |
5270 | NEIGHBOR_ADDR_STR2 | |
5271 | "Specify the maximum number of hops to the BGP peer\n") | |
5272 | { | |
5273 | struct peer *peer; | |
fa411a21 NH |
5274 | |
5275 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5276 | if (! peer) | |
5277 | return CMD_WARNING; | |
5278 | ||
89b6d1f8 | 5279 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 5280 | } |
6b0655a2 | 5281 | |
718e3744 | 5282 | /* Address family configuration. */ |
5283 | DEFUN (address_family_ipv4, | |
5284 | address_family_ipv4_cmd, | |
5285 | "address-family ipv4", | |
5286 | "Enter Address Family command mode\n" | |
5287 | "Address family\n") | |
5288 | { | |
5289 | vty->node = BGP_IPV4_NODE; | |
5290 | return CMD_SUCCESS; | |
5291 | } | |
5292 | ||
5293 | DEFUN (address_family_ipv4_safi, | |
5294 | address_family_ipv4_safi_cmd, | |
5295 | "address-family ipv4 (unicast|multicast)", | |
5296 | "Enter Address Family command mode\n" | |
5297 | "Address family\n" | |
5298 | "Address Family modifier\n" | |
5299 | "Address Family modifier\n") | |
5300 | { | |
5301 | if (strncmp (argv[0], "m", 1) == 0) | |
5302 | vty->node = BGP_IPV4M_NODE; | |
5303 | else | |
5304 | vty->node = BGP_IPV4_NODE; | |
5305 | ||
5306 | return CMD_SUCCESS; | |
5307 | } | |
5308 | ||
25ffbdc1 | 5309 | DEFUN (address_family_ipv6, |
5310 | address_family_ipv6_cmd, | |
5311 | "address-family ipv6", | |
718e3744 | 5312 | "Enter Address Family command mode\n" |
25ffbdc1 | 5313 | "Address family\n") |
718e3744 | 5314 | { |
5315 | vty->node = BGP_IPV6_NODE; | |
5316 | return CMD_SUCCESS; | |
5317 | } | |
5318 | ||
25ffbdc1 | 5319 | DEFUN (address_family_ipv6_safi, |
5320 | address_family_ipv6_safi_cmd, | |
5321 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 5322 | "Enter Address Family command mode\n" |
25ffbdc1 | 5323 | "Address family\n" |
5324 | "Address Family modifier\n" | |
5325 | "Address Family modifier\n") | |
5326 | { | |
5327 | if (strncmp (argv[0], "m", 1) == 0) | |
5328 | vty->node = BGP_IPV6M_NODE; | |
5329 | else | |
5330 | vty->node = BGP_IPV6_NODE; | |
5331 | ||
5332 | return CMD_SUCCESS; | |
5333 | } | |
718e3744 | 5334 | |
5335 | DEFUN (address_family_vpnv4, | |
5336 | address_family_vpnv4_cmd, | |
5337 | "address-family vpnv4", | |
5338 | "Enter Address Family command mode\n" | |
5339 | "Address family\n") | |
5340 | { | |
5341 | vty->node = BGP_VPNV4_NODE; | |
5342 | return CMD_SUCCESS; | |
5343 | } | |
5344 | ||
5345 | ALIAS (address_family_vpnv4, | |
5346 | address_family_vpnv4_unicast_cmd, | |
5347 | "address-family vpnv4 unicast", | |
5348 | "Enter Address Family command mode\n" | |
5349 | "Address family\n" | |
5350 | "Address Family Modifier\n") | |
5351 | ||
5352 | DEFUN (exit_address_family, | |
5353 | exit_address_family_cmd, | |
5354 | "exit-address-family", | |
5355 | "Exit from Address Family configuration mode\n") | |
5356 | { | |
a8a80d53 | 5357 | if (vty->node == BGP_IPV4_NODE |
5358 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 5359 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 5360 | || vty->node == BGP_IPV6_NODE |
5361 | || vty->node == BGP_IPV6M_NODE) | |
718e3744 | 5362 | vty->node = BGP_NODE; |
5363 | return CMD_SUCCESS; | |
5364 | } | |
6b0655a2 | 5365 | |
718e3744 | 5366 | /* BGP clear sort. */ |
5367 | enum clear_sort | |
5368 | { | |
5369 | clear_all, | |
5370 | clear_peer, | |
5371 | clear_group, | |
5372 | clear_external, | |
5373 | clear_as | |
5374 | }; | |
5375 | ||
94f2b392 | 5376 | static void |
718e3744 | 5377 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
5378 | safi_t safi, int error) | |
5379 | { | |
5380 | switch (error) | |
5381 | { | |
5382 | case BGP_ERR_AF_UNCONFIGURED: | |
5383 | vty_out (vty, | |
5384 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
5385 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
5386 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
5387 | peer->host, VTY_NEWLINE); | |
5388 | break; | |
5389 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
5390 | 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); | |
5391 | break; | |
5392 | default: | |
5393 | break; | |
5394 | } | |
5395 | } | |
5396 | ||
5397 | /* `clear ip bgp' functions. */ | |
94f2b392 | 5398 | static int |
718e3744 | 5399 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, |
fd79ac91 | 5400 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
718e3744 | 5401 | { |
5402 | int ret; | |
5403 | struct peer *peer; | |
1eb8ef25 | 5404 | struct listnode *node, *nnode; |
718e3744 | 5405 | |
5406 | /* Clear all neighbors. */ | |
1ff9a340 DS |
5407 | /* |
5408 | * Pass along pointer to next node to peer_clear() when walking all nodes | |
5409 | * on the BGP instance as that may get freed if it is a doppelganger | |
5410 | */ | |
718e3744 | 5411 | if (sort == clear_all) |
5412 | { | |
1eb8ef25 | 5413 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 5414 | { |
5415 | if (stype == BGP_CLEAR_SOFT_NONE) | |
1ff9a340 | 5416 | ret = peer_clear (peer, &nnode); |
718e3744 | 5417 | else |
5418 | ret = peer_clear_soft (peer, afi, safi, stype); | |
5419 | ||
5420 | if (ret < 0) | |
5421 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
5422 | } | |
f188f2c4 DS |
5423 | |
5424 | /* This is to apply read-only mode on this clear. */ | |
5425 | if (stype == BGP_CLEAR_SOFT_NONE) | |
5426 | bgp->update_delay_over = 0; | |
5427 | ||
0b2aa3a0 | 5428 | return CMD_SUCCESS; |
718e3744 | 5429 | } |
5430 | ||
5431 | /* Clear specified neighbors. */ | |
5432 | if (sort == clear_peer) | |
5433 | { | |
5434 | union sockunion su; | |
5435 | int ret; | |
5436 | ||
5437 | /* Make sockunion for lookup. */ | |
5438 | ret = str2sockunion (arg, &su); | |
5439 | if (ret < 0) | |
a80beece DS |
5440 | { |
5441 | peer = peer_lookup_by_conf_if (bgp, arg); | |
5442 | if (!peer) | |
5443 | { | |
5444 | vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE); | |
5445 | return CMD_WARNING; | |
5446 | } | |
5447 | } | |
5448 | else | |
5449 | { | |
5450 | peer = peer_lookup (bgp, &su); | |
5451 | if (! peer) | |
5452 | { | |
5453 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
5454 | return CMD_WARNING; | |
5455 | } | |
5456 | } | |
718e3744 | 5457 | |
5458 | if (stype == BGP_CLEAR_SOFT_NONE) | |
1ff9a340 | 5459 | ret = peer_clear (peer, NULL); |
718e3744 | 5460 | else |
5461 | ret = peer_clear_soft (peer, afi, safi, stype); | |
5462 | ||
5463 | if (ret < 0) | |
5464 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
5465 | ||
0b2aa3a0 | 5466 | return CMD_SUCCESS; |
718e3744 | 5467 | } |
5468 | ||
5469 | /* Clear all peer-group members. */ | |
5470 | if (sort == clear_group) | |
5471 | { | |
5472 | struct peer_group *group; | |
5473 | ||
5474 | group = peer_group_lookup (bgp, arg); | |
5475 | if (! group) | |
5476 | { | |
5477 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
0b2aa3a0 | 5478 | return CMD_WARNING; |
718e3744 | 5479 | } |
5480 | ||
1eb8ef25 | 5481 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
718e3744 | 5482 | { |
5483 | if (stype == BGP_CLEAR_SOFT_NONE) | |
5484 | { | |
1ff9a340 | 5485 | ret = peer_clear (peer, NULL); |
718e3744 | 5486 | continue; |
5487 | } | |
5488 | ||
5489 | if (! peer->af_group[afi][safi]) | |
5490 | continue; | |
5491 | ||
5492 | ret = peer_clear_soft (peer, afi, safi, stype); | |
5493 | ||
5494 | if (ret < 0) | |
5495 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
5496 | } | |
0b2aa3a0 | 5497 | return CMD_SUCCESS; |
718e3744 | 5498 | } |
5499 | ||
5500 | if (sort == clear_external) | |
5501 | { | |
1eb8ef25 | 5502 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 5503 | { |
6d85b15b | 5504 | if (peer->sort == BGP_PEER_IBGP) |
718e3744 | 5505 | continue; |
5506 | ||
5507 | if (stype == BGP_CLEAR_SOFT_NONE) | |
1ff9a340 | 5508 | ret = peer_clear (peer, &nnode); |
718e3744 | 5509 | else |
5510 | ret = peer_clear_soft (peer, afi, safi, stype); | |
5511 | ||
5512 | if (ret < 0) | |
5513 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
5514 | } | |
0b2aa3a0 | 5515 | return CMD_SUCCESS; |
718e3744 | 5516 | } |
5517 | ||
5518 | if (sort == clear_as) | |
5519 | { | |
5520 | as_t as; | |
718e3744 | 5521 | int find = 0; |
5522 | ||
bde12e3f | 5523 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); |
0b2aa3a0 | 5524 | |
1eb8ef25 | 5525 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 5526 | { |
5527 | if (peer->as != as) | |
5528 | continue; | |
5529 | ||
5530 | find = 1; | |
5531 | if (stype == BGP_CLEAR_SOFT_NONE) | |
1ff9a340 | 5532 | ret = peer_clear (peer, &nnode); |
718e3744 | 5533 | else |
5534 | ret = peer_clear_soft (peer, afi, safi, stype); | |
5535 | ||
5536 | if (ret < 0) | |
5537 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
5538 | } | |
5539 | if (! find) | |
5540 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
5541 | VTY_NEWLINE); | |
0b2aa3a0 | 5542 | return CMD_SUCCESS; |
718e3744 | 5543 | } |
5544 | ||
0b2aa3a0 | 5545 | return CMD_SUCCESS; |
718e3744 | 5546 | } |
5547 | ||
8ad7271d DS |
5548 | /* Recalculate bestpath and re-advertise a prefix */ |
5549 | static int | |
5550 | bgp_clear_prefix (struct vty *vty, char *view_name, const char *ip_str, | |
5551 | afi_t afi, safi_t safi, struct prefix_rd *prd) | |
5552 | { | |
5553 | int ret; | |
5554 | struct prefix match; | |
5555 | struct bgp_node *rn; | |
5556 | struct bgp_node *rm; | |
5557 | struct bgp_info *ri; | |
5558 | struct bgp_info *ri_temp; | |
5559 | struct bgp *bgp; | |
5560 | struct bgp_table *table; | |
5561 | struct bgp_table *rib; | |
5562 | ||
5563 | /* BGP structure lookup. */ | |
5564 | if (view_name) | |
5565 | { | |
5566 | bgp = bgp_lookup_by_name (view_name); | |
5567 | if (bgp == NULL) | |
5568 | { | |
5569 | vty_out (vty, "%% Can't find BGP view %s%s", view_name, VTY_NEWLINE); | |
5570 | return CMD_WARNING; | |
5571 | } | |
5572 | } | |
5573 | else | |
5574 | { | |
5575 | bgp = bgp_get_default (); | |
5576 | if (bgp == NULL) | |
5577 | { | |
5578 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
5579 | return CMD_WARNING; | |
5580 | } | |
5581 | } | |
5582 | ||
5583 | /* Check IP address argument. */ | |
5584 | ret = str2prefix (ip_str, &match); | |
5585 | if (! ret) | |
5586 | { | |
5587 | vty_out (vty, "%% address is malformed%s", VTY_NEWLINE); | |
5588 | return CMD_WARNING; | |
5589 | } | |
5590 | ||
5591 | match.family = afi2family (afi); | |
5592 | rib = bgp->rib[afi][safi]; | |
5593 | ||
5594 | if (safi == SAFI_MPLS_VPN) | |
5595 | { | |
5596 | for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn)) | |
5597 | { | |
5598 | if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) | |
5599 | continue; | |
5600 | ||
5601 | if ((table = rn->info) != NULL) | |
5602 | { | |
5603 | if ((rm = bgp_node_match (table, &match)) != NULL) | |
5604 | { | |
5605 | if (rm->p.prefixlen == match.prefixlen) | |
5606 | { | |
5607 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5608 | bgp_process (bgp, rm, afi, safi); | |
5609 | } | |
5610 | bgp_unlock_node (rm); | |
5611 | } | |
5612 | } | |
5613 | } | |
5614 | } | |
5615 | else | |
5616 | { | |
5617 | if ((rn = bgp_node_match (rib, &match)) != NULL) | |
5618 | { | |
5619 | if (rn->p.prefixlen == match.prefixlen) | |
5620 | { | |
5621 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5622 | bgp_process (bgp, rn, afi, safi); | |
5623 | } | |
5624 | bgp_unlock_node (rn); | |
5625 | } | |
5626 | } | |
5627 | ||
5628 | return CMD_SUCCESS; | |
5629 | } | |
5630 | ||
94f2b392 | 5631 | static int |
fd79ac91 | 5632 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
5633 | enum clear_sort sort, enum bgp_clear_type stype, | |
5634 | const char *arg) | |
718e3744 | 5635 | { |
718e3744 | 5636 | struct bgp *bgp; |
5637 | ||
5638 | /* BGP structure lookup. */ | |
5639 | if (name) | |
5640 | { | |
5641 | bgp = bgp_lookup_by_name (name); | |
5642 | if (bgp == NULL) | |
5643 | { | |
5644 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); | |
5645 | return CMD_WARNING; | |
5646 | } | |
5647 | } | |
5648 | else | |
5649 | { | |
5650 | bgp = bgp_get_default (); | |
5651 | if (bgp == NULL) | |
5652 | { | |
5653 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
5654 | return CMD_WARNING; | |
5655 | } | |
5656 | } | |
5657 | ||
0b2aa3a0 | 5658 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
718e3744 | 5659 | } |
5660 | ||
5661 | DEFUN (clear_ip_bgp_all, | |
5662 | clear_ip_bgp_all_cmd, | |
5663 | "clear ip bgp *", | |
5664 | CLEAR_STR | |
5665 | IP_STR | |
5666 | BGP_STR | |
5667 | "Clear all peers\n") | |
5668 | { | |
5669 | if (argc == 1) | |
5670 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5671 | ||
5672 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5673 | } | |
5674 | ||
5675 | ALIAS (clear_ip_bgp_all, | |
5676 | clear_bgp_all_cmd, | |
5677 | "clear bgp *", | |
5678 | CLEAR_STR | |
5679 | BGP_STR | |
5680 | "Clear all peers\n") | |
5681 | ||
5682 | ALIAS (clear_ip_bgp_all, | |
5683 | clear_bgp_ipv6_all_cmd, | |
5684 | "clear bgp ipv6 *", | |
5685 | CLEAR_STR | |
5686 | BGP_STR | |
5687 | "Address family\n" | |
5688 | "Clear all peers\n") | |
5689 | ||
5690 | ALIAS (clear_ip_bgp_all, | |
5691 | clear_ip_bgp_instance_all_cmd, | |
5692 | "clear ip bgp view WORD *", | |
5693 | CLEAR_STR | |
5694 | IP_STR | |
5695 | BGP_STR | |
5696 | "BGP view\n" | |
5697 | "view name\n" | |
5698 | "Clear all peers\n") | |
5699 | ||
5700 | ALIAS (clear_ip_bgp_all, | |
5701 | clear_bgp_instance_all_cmd, | |
5702 | "clear bgp view WORD *", | |
5703 | CLEAR_STR | |
5704 | BGP_STR | |
5705 | "BGP view\n" | |
5706 | "view name\n" | |
5707 | "Clear all peers\n") | |
5708 | ||
5709 | DEFUN (clear_ip_bgp_peer, | |
5710 | clear_ip_bgp_peer_cmd, | |
a80beece | 5711 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5712 | CLEAR_STR |
5713 | IP_STR | |
5714 | BGP_STR | |
5715 | "BGP neighbor IP address to clear\n" | |
a80beece DS |
5716 | "BGP IPv6 neighbor to clear\n" |
5717 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5718 | { |
5719 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5720 | } | |
5721 | ||
5722 | ALIAS (clear_ip_bgp_peer, | |
5723 | clear_bgp_peer_cmd, | |
a80beece | 5724 | "clear bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5725 | CLEAR_STR |
5726 | BGP_STR | |
5727 | "BGP neighbor address to clear\n" | |
a80beece DS |
5728 | "BGP IPv6 neighbor to clear\n" |
5729 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5730 | |
5731 | ALIAS (clear_ip_bgp_peer, | |
5732 | clear_bgp_ipv6_peer_cmd, | |
a80beece | 5733 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5734 | CLEAR_STR |
5735 | BGP_STR | |
5736 | "Address family\n" | |
5737 | "BGP neighbor address to clear\n" | |
a80beece DS |
5738 | "BGP IPv6 neighbor to clear\n" |
5739 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5740 | |
5741 | DEFUN (clear_ip_bgp_peer_group, | |
5742 | clear_ip_bgp_peer_group_cmd, | |
5743 | "clear ip bgp peer-group WORD", | |
5744 | CLEAR_STR | |
5745 | IP_STR | |
5746 | BGP_STR | |
5747 | "Clear all members of peer-group\n" | |
5748 | "BGP peer-group name\n") | |
5749 | { | |
5750 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5751 | } | |
5752 | ||
5753 | ALIAS (clear_ip_bgp_peer_group, | |
5754 | clear_bgp_peer_group_cmd, | |
5755 | "clear bgp peer-group WORD", | |
5756 | CLEAR_STR | |
5757 | BGP_STR | |
5758 | "Clear all members of peer-group\n" | |
5759 | "BGP peer-group name\n") | |
5760 | ||
5761 | ALIAS (clear_ip_bgp_peer_group, | |
5762 | clear_bgp_ipv6_peer_group_cmd, | |
5763 | "clear bgp ipv6 peer-group WORD", | |
5764 | CLEAR_STR | |
5765 | BGP_STR | |
5766 | "Address family\n" | |
5767 | "Clear all members of peer-group\n" | |
5768 | "BGP peer-group name\n") | |
5769 | ||
5770 | DEFUN (clear_ip_bgp_external, | |
5771 | clear_ip_bgp_external_cmd, | |
5772 | "clear ip bgp external", | |
5773 | CLEAR_STR | |
5774 | IP_STR | |
5775 | BGP_STR | |
5776 | "Clear all external peers\n") | |
5777 | { | |
5778 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
5779 | } | |
5780 | ||
5781 | ALIAS (clear_ip_bgp_external, | |
5782 | clear_bgp_external_cmd, | |
5783 | "clear bgp external", | |
5784 | CLEAR_STR | |
5785 | BGP_STR | |
5786 | "Clear all external peers\n") | |
5787 | ||
5788 | ALIAS (clear_ip_bgp_external, | |
5789 | clear_bgp_ipv6_external_cmd, | |
5790 | "clear bgp ipv6 external", | |
5791 | CLEAR_STR | |
5792 | BGP_STR | |
5793 | "Address family\n" | |
5794 | "Clear all external peers\n") | |
5795 | ||
8ad7271d DS |
5796 | DEFUN (clear_ip_bgp_prefix, |
5797 | clear_ip_bgp_prefix_cmd, | |
5798 | "clear ip bgp prefix A.B.C.D/M", | |
5799 | CLEAR_STR | |
5800 | IP_STR | |
5801 | BGP_STR | |
5802 | "Clear bestpath and re-advertise\n" | |
5803 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
5804 | { | |
5805 | return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL); | |
5806 | } | |
5807 | ||
5808 | ALIAS (clear_ip_bgp_prefix, | |
5809 | clear_bgp_prefix_cmd, | |
5810 | "clear bgp prefix A.B.C.D/M", | |
5811 | CLEAR_STR | |
5812 | BGP_STR | |
5813 | "Clear bestpath and re-advertise\n" | |
5814 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
5815 | ||
5816 | ||
718e3744 | 5817 | DEFUN (clear_ip_bgp_as, |
5818 | clear_ip_bgp_as_cmd, | |
320da874 | 5819 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 5820 | CLEAR_STR |
5821 | IP_STR | |
5822 | BGP_STR | |
5823 | "Clear peers with the AS number\n") | |
5824 | { | |
5825 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5826 | } | |
5827 | ||
5828 | ALIAS (clear_ip_bgp_as, | |
5829 | clear_bgp_as_cmd, | |
320da874 | 5830 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 5831 | CLEAR_STR |
5832 | BGP_STR | |
5833 | "Clear peers with the AS number\n") | |
5834 | ||
5835 | ALIAS (clear_ip_bgp_as, | |
5836 | clear_bgp_ipv6_as_cmd, | |
320da874 | 5837 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 5838 | CLEAR_STR |
5839 | BGP_STR | |
5840 | "Address family\n" | |
5841 | "Clear peers with the AS number\n") | |
6b0655a2 | 5842 | |
718e3744 | 5843 | /* Outbound soft-reconfiguration */ |
5844 | DEFUN (clear_ip_bgp_all_soft_out, | |
5845 | clear_ip_bgp_all_soft_out_cmd, | |
5846 | "clear ip bgp * soft out", | |
5847 | CLEAR_STR | |
5848 | IP_STR | |
5849 | BGP_STR | |
5850 | "Clear all peers\n" | |
e0bce756 DS |
5851 | BGP_SOFT_STR |
5852 | BGP_SOFT_OUT_STR) | |
718e3744 | 5853 | { |
5854 | if (argc == 1) | |
5855 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5856 | BGP_CLEAR_SOFT_OUT, NULL); | |
5857 | ||
5858 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5859 | BGP_CLEAR_SOFT_OUT, NULL); | |
5860 | } | |
5861 | ||
5862 | ALIAS (clear_ip_bgp_all_soft_out, | |
5863 | clear_ip_bgp_all_out_cmd, | |
5864 | "clear ip bgp * out", | |
5865 | CLEAR_STR | |
5866 | IP_STR | |
5867 | BGP_STR | |
5868 | "Clear all peers\n" | |
e0bce756 | 5869 | BGP_SOFT_OUT_STR) |
718e3744 | 5870 | |
5871 | ALIAS (clear_ip_bgp_all_soft_out, | |
5872 | clear_ip_bgp_instance_all_soft_out_cmd, | |
5873 | "clear ip bgp view WORD * soft out", | |
5874 | CLEAR_STR | |
5875 | IP_STR | |
5876 | BGP_STR | |
5877 | "BGP view\n" | |
5878 | "view name\n" | |
5879 | "Clear all peers\n" | |
e0bce756 DS |
5880 | BGP_SOFT_STR |
5881 | BGP_SOFT_OUT_STR) | |
718e3744 | 5882 | |
5883 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
5884 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
5885 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
5886 | CLEAR_STR | |
5887 | IP_STR | |
5888 | BGP_STR | |
5889 | "Clear all peers\n" | |
5890 | "Address family\n" | |
5891 | "Address Family modifier\n" | |
5892 | "Address Family modifier\n" | |
e0bce756 DS |
5893 | BGP_SOFT_STR |
5894 | BGP_SOFT_OUT_STR) | |
718e3744 | 5895 | { |
5896 | if (strncmp (argv[0], "m", 1) == 0) | |
5897 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
5898 | BGP_CLEAR_SOFT_OUT, NULL); | |
5899 | ||
5900 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5901 | BGP_CLEAR_SOFT_OUT, NULL); | |
5902 | } | |
5903 | ||
5904 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, | |
5905 | clear_ip_bgp_all_ipv4_out_cmd, | |
5906 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
5907 | CLEAR_STR | |
5908 | IP_STR | |
5909 | BGP_STR | |
5910 | "Clear all peers\n" | |
5911 | "Address family\n" | |
5912 | "Address Family modifier\n" | |
5913 | "Address Family modifier\n" | |
e0bce756 | 5914 | BGP_SOFT_OUT_STR) |
718e3744 | 5915 | |
5916 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, | |
5917 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
5918 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", | |
5919 | CLEAR_STR | |
5920 | IP_STR | |
5921 | BGP_STR | |
5922 | "BGP view\n" | |
5923 | "view name\n" | |
5924 | "Clear all peers\n" | |
5925 | "Address family\n" | |
5926 | "Address Family modifier\n" | |
5927 | "Address Family modifier\n" | |
e0bce756 | 5928 | BGP_SOFT_OUT_STR) |
718e3744 | 5929 | { |
5930 | if (strncmp (argv[1], "m", 1) == 0) | |
5931 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
5932 | BGP_CLEAR_SOFT_OUT, NULL); | |
5933 | ||
5934 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5935 | BGP_CLEAR_SOFT_OUT, NULL); | |
5936 | } | |
5937 | ||
5938 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
5939 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
5940 | "clear ip bgp * vpnv4 unicast soft out", | |
5941 | CLEAR_STR | |
5942 | IP_STR | |
5943 | BGP_STR | |
5944 | "Clear all peers\n" | |
5945 | "Address family\n" | |
5946 | "Address Family Modifier\n" | |
e0bce756 DS |
5947 | BGP_SOFT_STR |
5948 | BGP_SOFT_OUT_STR) | |
718e3744 | 5949 | { |
5950 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
5951 | BGP_CLEAR_SOFT_OUT, NULL); | |
5952 | } | |
5953 | ||
5954 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
5955 | clear_ip_bgp_all_vpnv4_out_cmd, | |
5956 | "clear ip bgp * vpnv4 unicast out", | |
5957 | CLEAR_STR | |
5958 | IP_STR | |
5959 | BGP_STR | |
5960 | "Clear all peers\n" | |
5961 | "Address family\n" | |
5962 | "Address Family Modifier\n" | |
e0bce756 | 5963 | BGP_SOFT_OUT_STR) |
718e3744 | 5964 | |
5965 | DEFUN (clear_bgp_all_soft_out, | |
5966 | clear_bgp_all_soft_out_cmd, | |
5967 | "clear bgp * soft out", | |
5968 | CLEAR_STR | |
5969 | BGP_STR | |
5970 | "Clear all peers\n" | |
e0bce756 DS |
5971 | BGP_SOFT_STR |
5972 | BGP_SOFT_OUT_STR) | |
718e3744 | 5973 | { |
5974 | if (argc == 1) | |
5975 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
5976 | BGP_CLEAR_SOFT_OUT, NULL); | |
5977 | ||
5978 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
5979 | BGP_CLEAR_SOFT_OUT, NULL); | |
5980 | } | |
5981 | ||
5982 | ALIAS (clear_bgp_all_soft_out, | |
5983 | clear_bgp_instance_all_soft_out_cmd, | |
5984 | "clear bgp view WORD * soft out", | |
5985 | CLEAR_STR | |
5986 | BGP_STR | |
5987 | "BGP view\n" | |
5988 | "view name\n" | |
5989 | "Clear all peers\n" | |
e0bce756 DS |
5990 | BGP_SOFT_STR |
5991 | BGP_SOFT_OUT_STR) | |
718e3744 | 5992 | |
5993 | ALIAS (clear_bgp_all_soft_out, | |
5994 | clear_bgp_all_out_cmd, | |
5995 | "clear bgp * out", | |
5996 | CLEAR_STR | |
5997 | BGP_STR | |
5998 | "Clear all peers\n" | |
e0bce756 | 5999 | BGP_SOFT_OUT_STR) |
718e3744 | 6000 | |
6001 | ALIAS (clear_bgp_all_soft_out, | |
6002 | clear_bgp_ipv6_all_soft_out_cmd, | |
6003 | "clear bgp ipv6 * soft out", | |
6004 | CLEAR_STR | |
6005 | BGP_STR | |
6006 | "Address family\n" | |
6007 | "Clear all peers\n" | |
e0bce756 DS |
6008 | BGP_SOFT_STR |
6009 | BGP_SOFT_OUT_STR) | |
718e3744 | 6010 | |
6011 | ALIAS (clear_bgp_all_soft_out, | |
6012 | clear_bgp_ipv6_all_out_cmd, | |
6013 | "clear bgp ipv6 * out", | |
6014 | CLEAR_STR | |
6015 | BGP_STR | |
6016 | "Address family\n" | |
6017 | "Clear all peers\n" | |
e0bce756 | 6018 | BGP_SOFT_OUT_STR) |
718e3744 | 6019 | |
8ad7271d DS |
6020 | DEFUN (clear_bgp_ipv6_safi_prefix, |
6021 | clear_bgp_ipv6_safi_prefix_cmd, | |
6022 | "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6023 | CLEAR_STR | |
6024 | BGP_STR | |
6025 | "Address family\n" | |
6026 | "Address Family Modifier\n" | |
6027 | "Clear bestpath and re-advertise\n" | |
6028 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6029 | { | |
6030 | if (strncmp (argv[0], "m", 1) == 0) | |
6031 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL); | |
6032 | else | |
6033 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL); | |
6034 | } | |
6035 | ||
718e3744 | 6036 | DEFUN (clear_ip_bgp_peer_soft_out, |
6037 | clear_ip_bgp_peer_soft_out_cmd, | |
6038 | "clear ip bgp A.B.C.D soft out", | |
6039 | CLEAR_STR | |
6040 | IP_STR | |
6041 | BGP_STR | |
6042 | "BGP neighbor address to clear\n" | |
e0bce756 DS |
6043 | BGP_SOFT_STR |
6044 | BGP_SOFT_OUT_STR) | |
718e3744 | 6045 | { |
6046 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6047 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6048 | } | |
6049 | ||
6050 | ALIAS (clear_ip_bgp_peer_soft_out, | |
6051 | clear_ip_bgp_peer_out_cmd, | |
6052 | "clear ip bgp A.B.C.D out", | |
6053 | CLEAR_STR | |
6054 | IP_STR | |
6055 | BGP_STR | |
6056 | "BGP neighbor address to clear\n" | |
e0bce756 | 6057 | BGP_SOFT_OUT_STR) |
718e3744 | 6058 | |
6059 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, | |
6060 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
6061 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", | |
6062 | CLEAR_STR | |
6063 | IP_STR | |
6064 | BGP_STR | |
6065 | "BGP neighbor address to clear\n" | |
6066 | "Address family\n" | |
6067 | "Address Family modifier\n" | |
6068 | "Address Family modifier\n" | |
e0bce756 DS |
6069 | BGP_SOFT_STR |
6070 | BGP_SOFT_OUT_STR) | |
718e3744 | 6071 | { |
6072 | if (strncmp (argv[1], "m", 1) == 0) | |
6073 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6074 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6075 | ||
6076 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6077 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6078 | } | |
6079 | ||
6080 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, | |
6081 | clear_ip_bgp_peer_ipv4_out_cmd, | |
6082 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", | |
6083 | CLEAR_STR | |
6084 | IP_STR | |
6085 | BGP_STR | |
6086 | "BGP neighbor address to clear\n" | |
6087 | "Address family\n" | |
6088 | "Address Family modifier\n" | |
6089 | "Address Family modifier\n" | |
e0bce756 | 6090 | BGP_SOFT_OUT_STR) |
718e3744 | 6091 | |
6092 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, | |
6093 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
6094 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", | |
6095 | CLEAR_STR | |
6096 | IP_STR | |
6097 | BGP_STR | |
6098 | "BGP neighbor address to clear\n" | |
6099 | "Address family\n" | |
6100 | "Address Family Modifier\n" | |
e0bce756 DS |
6101 | BGP_SOFT_STR |
6102 | BGP_SOFT_OUT_STR) | |
718e3744 | 6103 | { |
6104 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6105 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6106 | } | |
6107 | ||
6108 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
6109 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
6110 | "clear ip bgp A.B.C.D vpnv4 unicast out", | |
6111 | CLEAR_STR | |
6112 | IP_STR | |
6113 | BGP_STR | |
6114 | "BGP neighbor address to clear\n" | |
6115 | "Address family\n" | |
6116 | "Address Family Modifier\n" | |
e0bce756 | 6117 | BGP_SOFT_OUT_STR) |
718e3744 | 6118 | |
6119 | DEFUN (clear_bgp_peer_soft_out, | |
6120 | clear_bgp_peer_soft_out_cmd, | |
a80beece | 6121 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6122 | CLEAR_STR |
6123 | BGP_STR | |
6124 | "BGP neighbor address to clear\n" | |
6125 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6126 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6127 | BGP_SOFT_STR |
6128 | BGP_SOFT_OUT_STR) | |
718e3744 | 6129 | { |
6130 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6131 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6132 | } | |
6133 | ||
6134 | ALIAS (clear_bgp_peer_soft_out, | |
6135 | clear_bgp_ipv6_peer_soft_out_cmd, | |
a80beece | 6136 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6137 | CLEAR_STR |
6138 | BGP_STR | |
6139 | "Address family\n" | |
6140 | "BGP neighbor address to clear\n" | |
6141 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6142 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6143 | BGP_SOFT_STR |
6144 | BGP_SOFT_OUT_STR) | |
718e3744 | 6145 | |
6146 | ALIAS (clear_bgp_peer_soft_out, | |
6147 | clear_bgp_peer_out_cmd, | |
a80beece | 6148 | "clear bgp (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 6149 | CLEAR_STR |
6150 | BGP_STR | |
6151 | "BGP neighbor address to clear\n" | |
6152 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6153 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6154 | BGP_SOFT_OUT_STR) |
718e3744 | 6155 | |
6156 | ALIAS (clear_bgp_peer_soft_out, | |
6157 | clear_bgp_ipv6_peer_out_cmd, | |
a80beece | 6158 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 6159 | CLEAR_STR |
6160 | BGP_STR | |
6161 | "Address family\n" | |
6162 | "BGP neighbor address to clear\n" | |
6163 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6164 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6165 | BGP_SOFT_OUT_STR) |
718e3744 | 6166 | |
6167 | DEFUN (clear_ip_bgp_peer_group_soft_out, | |
6168 | clear_ip_bgp_peer_group_soft_out_cmd, | |
6169 | "clear ip bgp peer-group WORD soft out", | |
6170 | CLEAR_STR | |
6171 | IP_STR | |
6172 | BGP_STR | |
6173 | "Clear all members of peer-group\n" | |
6174 | "BGP peer-group name\n" | |
e0bce756 DS |
6175 | BGP_SOFT_STR |
6176 | BGP_SOFT_OUT_STR) | |
718e3744 | 6177 | { |
6178 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6179 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6180 | } | |
6181 | ||
6182 | ALIAS (clear_ip_bgp_peer_group_soft_out, | |
6183 | clear_ip_bgp_peer_group_out_cmd, | |
6184 | "clear ip bgp peer-group WORD out", | |
6185 | CLEAR_STR | |
6186 | IP_STR | |
6187 | BGP_STR | |
6188 | "Clear all members of peer-group\n" | |
6189 | "BGP peer-group name\n" | |
e0bce756 | 6190 | BGP_SOFT_OUT_STR) |
718e3744 | 6191 | |
6192 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, | |
6193 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
6194 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
6195 | CLEAR_STR | |
6196 | IP_STR | |
6197 | BGP_STR | |
6198 | "Clear all members of peer-group\n" | |
6199 | "BGP peer-group name\n" | |
6200 | "Address family\n" | |
6201 | "Address Family modifier\n" | |
6202 | "Address Family modifier\n" | |
e0bce756 DS |
6203 | BGP_SOFT_STR |
6204 | BGP_SOFT_OUT_STR) | |
718e3744 | 6205 | { |
6206 | if (strncmp (argv[1], "m", 1) == 0) | |
6207 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6208 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6209 | ||
6210 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6211 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6212 | } | |
6213 | ||
6214 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, | |
6215 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
6216 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
6217 | CLEAR_STR | |
6218 | IP_STR | |
6219 | BGP_STR | |
6220 | "Clear all members of peer-group\n" | |
6221 | "BGP peer-group name\n" | |
6222 | "Address family\n" | |
6223 | "Address Family modifier\n" | |
6224 | "Address Family modifier\n" | |
e0bce756 | 6225 | BGP_SOFT_OUT_STR) |
718e3744 | 6226 | |
6227 | DEFUN (clear_bgp_peer_group_soft_out, | |
6228 | clear_bgp_peer_group_soft_out_cmd, | |
6229 | "clear bgp peer-group WORD soft out", | |
6230 | CLEAR_STR | |
6231 | BGP_STR | |
6232 | "Clear all members of peer-group\n" | |
6233 | "BGP peer-group name\n" | |
e0bce756 DS |
6234 | BGP_SOFT_STR |
6235 | BGP_SOFT_OUT_STR) | |
718e3744 | 6236 | { |
6237 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6238 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6239 | } | |
6240 | ||
6241 | ALIAS (clear_bgp_peer_group_soft_out, | |
6242 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
6243 | "clear bgp ipv6 peer-group WORD soft out", | |
6244 | CLEAR_STR | |
6245 | BGP_STR | |
6246 | "Address family\n" | |
6247 | "Clear all members of peer-group\n" | |
6248 | "BGP peer-group name\n" | |
e0bce756 DS |
6249 | BGP_SOFT_STR |
6250 | BGP_SOFT_OUT_STR) | |
718e3744 | 6251 | |
6252 | ALIAS (clear_bgp_peer_group_soft_out, | |
6253 | clear_bgp_peer_group_out_cmd, | |
6254 | "clear bgp peer-group WORD out", | |
6255 | CLEAR_STR | |
6256 | BGP_STR | |
6257 | "Clear all members of peer-group\n" | |
6258 | "BGP peer-group name\n" | |
e0bce756 | 6259 | BGP_SOFT_OUT_STR) |
718e3744 | 6260 | |
6261 | ALIAS (clear_bgp_peer_group_soft_out, | |
6262 | clear_bgp_ipv6_peer_group_out_cmd, | |
6263 | "clear bgp ipv6 peer-group WORD out", | |
6264 | CLEAR_STR | |
6265 | BGP_STR | |
6266 | "Address family\n" | |
6267 | "Clear all members of peer-group\n" | |
6268 | "BGP peer-group name\n" | |
e0bce756 | 6269 | BGP_SOFT_OUT_STR) |
718e3744 | 6270 | |
6271 | DEFUN (clear_ip_bgp_external_soft_out, | |
6272 | clear_ip_bgp_external_soft_out_cmd, | |
6273 | "clear ip bgp external soft out", | |
6274 | CLEAR_STR | |
6275 | IP_STR | |
6276 | BGP_STR | |
6277 | "Clear all external peers\n" | |
e0bce756 DS |
6278 | BGP_SOFT_STR |
6279 | BGP_SOFT_OUT_STR) | |
718e3744 | 6280 | { |
6281 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6282 | BGP_CLEAR_SOFT_OUT, NULL); | |
6283 | } | |
6284 | ||
6285 | ALIAS (clear_ip_bgp_external_soft_out, | |
6286 | clear_ip_bgp_external_out_cmd, | |
6287 | "clear ip bgp external out", | |
6288 | CLEAR_STR | |
6289 | IP_STR | |
6290 | BGP_STR | |
6291 | "Clear all external peers\n" | |
e0bce756 | 6292 | BGP_SOFT_OUT_STR) |
718e3744 | 6293 | |
6294 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
6295 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
6296 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
6297 | CLEAR_STR | |
6298 | IP_STR | |
6299 | BGP_STR | |
6300 | "Clear all external peers\n" | |
6301 | "Address family\n" | |
6302 | "Address Family modifier\n" | |
6303 | "Address Family modifier\n" | |
e0bce756 DS |
6304 | BGP_SOFT_STR |
6305 | BGP_SOFT_OUT_STR) | |
718e3744 | 6306 | { |
6307 | if (strncmp (argv[0], "m", 1) == 0) | |
6308 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6309 | BGP_CLEAR_SOFT_OUT, NULL); | |
6310 | ||
6311 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6312 | BGP_CLEAR_SOFT_OUT, NULL); | |
6313 | } | |
6314 | ||
6315 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, | |
6316 | clear_ip_bgp_external_ipv4_out_cmd, | |
6317 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
6318 | CLEAR_STR | |
6319 | IP_STR | |
6320 | BGP_STR | |
6321 | "Clear all external peers\n" | |
6322 | "Address family\n" | |
6323 | "Address Family modifier\n" | |
6324 | "Address Family modifier\n" | |
e0bce756 | 6325 | BGP_SOFT_OUT_STR) |
718e3744 | 6326 | |
6327 | DEFUN (clear_bgp_external_soft_out, | |
6328 | clear_bgp_external_soft_out_cmd, | |
6329 | "clear bgp external soft out", | |
6330 | CLEAR_STR | |
6331 | BGP_STR | |
6332 | "Clear all external peers\n" | |
e0bce756 DS |
6333 | BGP_SOFT_STR |
6334 | BGP_SOFT_OUT_STR) | |
718e3744 | 6335 | { |
6336 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6337 | BGP_CLEAR_SOFT_OUT, NULL); | |
6338 | } | |
6339 | ||
6340 | ALIAS (clear_bgp_external_soft_out, | |
6341 | clear_bgp_ipv6_external_soft_out_cmd, | |
6342 | "clear bgp ipv6 external soft out", | |
6343 | CLEAR_STR | |
6344 | BGP_STR | |
6345 | "Address family\n" | |
6346 | "Clear all external peers\n" | |
e0bce756 DS |
6347 | BGP_SOFT_STR |
6348 | BGP_SOFT_OUT_STR) | |
718e3744 | 6349 | |
6350 | ALIAS (clear_bgp_external_soft_out, | |
6351 | clear_bgp_external_out_cmd, | |
6352 | "clear bgp external out", | |
6353 | CLEAR_STR | |
6354 | BGP_STR | |
6355 | "Clear all external peers\n" | |
e0bce756 | 6356 | BGP_SOFT_OUT_STR) |
718e3744 | 6357 | |
6358 | ALIAS (clear_bgp_external_soft_out, | |
6359 | clear_bgp_ipv6_external_out_cmd, | |
6360 | "clear bgp ipv6 external WORD out", | |
6361 | CLEAR_STR | |
6362 | BGP_STR | |
6363 | "Address family\n" | |
6364 | "Clear all external peers\n" | |
e0bce756 | 6365 | BGP_SOFT_OUT_STR) |
718e3744 | 6366 | |
6367 | DEFUN (clear_ip_bgp_as_soft_out, | |
6368 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 6369 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 6370 | CLEAR_STR |
6371 | IP_STR | |
6372 | BGP_STR | |
6373 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6374 | BGP_SOFT_STR |
6375 | BGP_SOFT_OUT_STR) | |
718e3744 | 6376 | { |
6377 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6378 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6379 | } | |
6380 | ||
6381 | ALIAS (clear_ip_bgp_as_soft_out, | |
6382 | clear_ip_bgp_as_out_cmd, | |
320da874 | 6383 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 6384 | CLEAR_STR |
6385 | IP_STR | |
6386 | BGP_STR | |
6387 | "Clear peers with the AS number\n" | |
e0bce756 | 6388 | BGP_SOFT_OUT_STR) |
718e3744 | 6389 | |
6390 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, | |
6391 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 6392 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 6393 | CLEAR_STR |
6394 | IP_STR | |
6395 | BGP_STR | |
6396 | "Clear peers with the AS number\n" | |
6397 | "Address family\n" | |
6398 | "Address Family modifier\n" | |
6399 | "Address Family modifier\n" | |
e0bce756 DS |
6400 | BGP_SOFT_STR |
6401 | BGP_SOFT_OUT_STR) | |
718e3744 | 6402 | { |
6403 | if (strncmp (argv[1], "m", 1) == 0) | |
6404 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6405 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6406 | ||
6407 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6408 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6409 | } | |
6410 | ||
6411 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, | |
6412 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 6413 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 6414 | CLEAR_STR |
6415 | IP_STR | |
6416 | BGP_STR | |
6417 | "Clear peers with the AS number\n" | |
6418 | "Address family\n" | |
6419 | "Address Family modifier\n" | |
6420 | "Address Family modifier\n" | |
e0bce756 | 6421 | BGP_SOFT_OUT_STR) |
718e3744 | 6422 | |
6423 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, | |
6424 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 6425 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 6426 | CLEAR_STR |
6427 | IP_STR | |
6428 | BGP_STR | |
6429 | "Clear peers with the AS number\n" | |
6430 | "Address family\n" | |
6431 | "Address Family modifier\n" | |
e0bce756 DS |
6432 | BGP_SOFT_STR |
6433 | BGP_SOFT_OUT_STR) | |
718e3744 | 6434 | { |
6435 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
6436 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6437 | } | |
6438 | ||
6439 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
6440 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 6441 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 6442 | CLEAR_STR |
6443 | IP_STR | |
6444 | BGP_STR | |
6445 | "Clear peers with the AS number\n" | |
6446 | "Address family\n" | |
6447 | "Address Family modifier\n" | |
e0bce756 | 6448 | BGP_SOFT_OUT_STR) |
718e3744 | 6449 | |
6450 | DEFUN (clear_bgp_as_soft_out, | |
6451 | clear_bgp_as_soft_out_cmd, | |
320da874 | 6452 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 6453 | CLEAR_STR |
6454 | BGP_STR | |
6455 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6456 | BGP_SOFT_STR |
6457 | BGP_SOFT_OUT_STR) | |
718e3744 | 6458 | { |
6459 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6460 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6461 | } | |
6462 | ||
6463 | ALIAS (clear_bgp_as_soft_out, | |
6464 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 6465 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 6466 | CLEAR_STR |
6467 | BGP_STR | |
6468 | "Address family\n" | |
6469 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6470 | BGP_SOFT_STR |
6471 | BGP_SOFT_OUT_STR) | |
718e3744 | 6472 | |
6473 | ALIAS (clear_bgp_as_soft_out, | |
6474 | clear_bgp_as_out_cmd, | |
320da874 | 6475 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 6476 | CLEAR_STR |
6477 | BGP_STR | |
6478 | "Clear peers with the AS number\n" | |
e0bce756 | 6479 | BGP_SOFT_OUT_STR) |
718e3744 | 6480 | |
6481 | ALIAS (clear_bgp_as_soft_out, | |
6482 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 6483 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 6484 | CLEAR_STR |
6485 | BGP_STR | |
6486 | "Address family\n" | |
6487 | "Clear peers with the AS number\n" | |
e0bce756 | 6488 | BGP_SOFT_OUT_STR) |
6b0655a2 | 6489 | |
718e3744 | 6490 | /* Inbound soft-reconfiguration */ |
6491 | DEFUN (clear_ip_bgp_all_soft_in, | |
6492 | clear_ip_bgp_all_soft_in_cmd, | |
6493 | "clear ip bgp * soft in", | |
6494 | CLEAR_STR | |
6495 | IP_STR | |
6496 | BGP_STR | |
6497 | "Clear all peers\n" | |
e0bce756 DS |
6498 | BGP_SOFT_STR |
6499 | BGP_SOFT_IN_STR) | |
718e3744 | 6500 | { |
6501 | if (argc == 1) | |
6502 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6503 | BGP_CLEAR_SOFT_IN, NULL); | |
6504 | ||
6505 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6506 | BGP_CLEAR_SOFT_IN, NULL); | |
6507 | } | |
6508 | ||
6509 | ALIAS (clear_ip_bgp_all_soft_in, | |
6510 | clear_ip_bgp_instance_all_soft_in_cmd, | |
6511 | "clear ip bgp view WORD * soft in", | |
6512 | CLEAR_STR | |
6513 | IP_STR | |
6514 | BGP_STR | |
6515 | "BGP view\n" | |
6516 | "view name\n" | |
6517 | "Clear all peers\n" | |
e0bce756 DS |
6518 | BGP_SOFT_STR |
6519 | BGP_SOFT_IN_STR) | |
718e3744 | 6520 | |
6521 | ALIAS (clear_ip_bgp_all_soft_in, | |
6522 | clear_ip_bgp_all_in_cmd, | |
6523 | "clear ip bgp * in", | |
6524 | CLEAR_STR | |
6525 | IP_STR | |
6526 | BGP_STR | |
6527 | "Clear all peers\n" | |
e0bce756 | 6528 | BGP_SOFT_IN_STR) |
718e3744 | 6529 | |
6530 | DEFUN (clear_ip_bgp_all_in_prefix_filter, | |
6531 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
6532 | "clear ip bgp * in prefix-filter", | |
6533 | CLEAR_STR | |
6534 | IP_STR | |
6535 | BGP_STR | |
6536 | "Clear all peers\n" | |
e0bce756 | 6537 | BGP_SOFT_IN_STR |
718e3744 | 6538 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6539 | { | |
6540 | if (argc== 1) | |
6541 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6542 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6543 | ||
6544 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6545 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6546 | } | |
6547 | ||
6548 | ALIAS (clear_ip_bgp_all_in_prefix_filter, | |
6549 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, | |
6550 | "clear ip bgp view WORD * in prefix-filter", | |
6551 | CLEAR_STR | |
6552 | IP_STR | |
6553 | BGP_STR | |
6554 | "BGP view\n" | |
6555 | "view name\n" | |
6556 | "Clear all peers\n" | |
e0bce756 | 6557 | BGP_SOFT_IN_STR |
718e3744 | 6558 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6559 | ||
6560 | ||
6561 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, | |
6562 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
6563 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
6564 | CLEAR_STR | |
6565 | IP_STR | |
6566 | BGP_STR | |
6567 | "Clear all peers\n" | |
6568 | "Address family\n" | |
6569 | "Address Family modifier\n" | |
6570 | "Address Family modifier\n" | |
e0bce756 DS |
6571 | BGP_SOFT_STR |
6572 | BGP_SOFT_IN_STR) | |
718e3744 | 6573 | { |
6574 | if (strncmp (argv[0], "m", 1) == 0) | |
6575 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6576 | BGP_CLEAR_SOFT_IN, NULL); | |
6577 | ||
6578 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6579 | BGP_CLEAR_SOFT_IN, NULL); | |
6580 | } | |
6581 | ||
6582 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, | |
6583 | clear_ip_bgp_all_ipv4_in_cmd, | |
6584 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
6585 | CLEAR_STR | |
6586 | IP_STR | |
6587 | BGP_STR | |
6588 | "Clear all peers\n" | |
6589 | "Address family\n" | |
6590 | "Address Family modifier\n" | |
6591 | "Address Family modifier\n" | |
e0bce756 | 6592 | BGP_SOFT_IN_STR) |
718e3744 | 6593 | |
6594 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, | |
6595 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
6596 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", | |
6597 | CLEAR_STR | |
6598 | IP_STR | |
6599 | BGP_STR | |
6600 | "BGP view\n" | |
6601 | "view name\n" | |
6602 | "Clear all peers\n" | |
6603 | "Address family\n" | |
6604 | "Address Family modifier\n" | |
6605 | "Address Family modifier\n" | |
e0bce756 DS |
6606 | BGP_SOFT_STR |
6607 | BGP_SOFT_IN_STR) | |
718e3744 | 6608 | { |
6609 | if (strncmp (argv[1], "m", 1) == 0) | |
6610 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6611 | BGP_CLEAR_SOFT_IN, NULL); | |
6612 | ||
6613 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6614 | BGP_CLEAR_SOFT_IN, NULL); | |
6615 | } | |
6616 | ||
6617 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, | |
6618 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
6619 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
6620 | CLEAR_STR | |
6621 | IP_STR | |
6622 | BGP_STR | |
6623 | "Clear all peers\n" | |
6624 | "Address family\n" | |
6625 | "Address Family modifier\n" | |
6626 | "Address Family modifier\n" | |
e0bce756 | 6627 | BGP_SOFT_IN_STR |
718e3744 | 6628 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6629 | { | |
6630 | if (strncmp (argv[0], "m", 1) == 0) | |
6631 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6632 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6633 | ||
6634 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6635 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6636 | } | |
6637 | ||
6638 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, | |
6639 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, | |
6640 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", | |
6641 | CLEAR_STR | |
6642 | IP_STR | |
6643 | BGP_STR | |
6644 | "Clear all peers\n" | |
6645 | "Address family\n" | |
6646 | "Address Family modifier\n" | |
6647 | "Address Family modifier\n" | |
e0bce756 | 6648 | BGP_SOFT_IN_STR |
718e3744 | 6649 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6650 | { | |
6651 | if (strncmp (argv[1], "m", 1) == 0) | |
6652 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6653 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6654 | ||
6655 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6656 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6657 | } | |
6658 | ||
6659 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
6660 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
6661 | "clear ip bgp * vpnv4 unicast soft in", | |
6662 | CLEAR_STR | |
6663 | IP_STR | |
6664 | BGP_STR | |
6665 | "Clear all peers\n" | |
6666 | "Address family\n" | |
6667 | "Address Family Modifier\n" | |
e0bce756 DS |
6668 | BGP_SOFT_STR |
6669 | BGP_SOFT_IN_STR) | |
718e3744 | 6670 | { |
6671 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6672 | BGP_CLEAR_SOFT_IN, NULL); | |
6673 | } | |
6674 | ||
6675 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
6676 | clear_ip_bgp_all_vpnv4_in_cmd, | |
6677 | "clear ip bgp * vpnv4 unicast in", | |
6678 | CLEAR_STR | |
6679 | IP_STR | |
6680 | BGP_STR | |
6681 | "Clear all peers\n" | |
6682 | "Address family\n" | |
6683 | "Address Family Modifier\n" | |
e0bce756 | 6684 | BGP_SOFT_IN_STR) |
718e3744 | 6685 | |
6686 | DEFUN (clear_bgp_all_soft_in, | |
6687 | clear_bgp_all_soft_in_cmd, | |
6688 | "clear bgp * soft in", | |
6689 | CLEAR_STR | |
6690 | BGP_STR | |
6691 | "Clear all peers\n" | |
e0bce756 DS |
6692 | BGP_SOFT_STR |
6693 | BGP_SOFT_IN_STR) | |
718e3744 | 6694 | { |
6695 | if (argc == 1) | |
6696 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6697 | BGP_CLEAR_SOFT_IN, NULL); | |
6698 | ||
6699 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6700 | BGP_CLEAR_SOFT_IN, NULL); | |
6701 | } | |
6702 | ||
6703 | ALIAS (clear_bgp_all_soft_in, | |
6704 | clear_bgp_instance_all_soft_in_cmd, | |
6705 | "clear bgp view WORD * soft in", | |
6706 | CLEAR_STR | |
6707 | BGP_STR | |
6708 | "BGP view\n" | |
6709 | "view name\n" | |
6710 | "Clear all peers\n" | |
e0bce756 DS |
6711 | BGP_SOFT_STR |
6712 | BGP_SOFT_IN_STR) | |
718e3744 | 6713 | |
6714 | ALIAS (clear_bgp_all_soft_in, | |
6715 | clear_bgp_ipv6_all_soft_in_cmd, | |
6716 | "clear bgp ipv6 * soft in", | |
6717 | CLEAR_STR | |
6718 | BGP_STR | |
6719 | "Address family\n" | |
6720 | "Clear all peers\n" | |
e0bce756 DS |
6721 | BGP_SOFT_STR |
6722 | BGP_SOFT_IN_STR) | |
718e3744 | 6723 | |
6724 | ALIAS (clear_bgp_all_soft_in, | |
6725 | clear_bgp_all_in_cmd, | |
6726 | "clear bgp * in", | |
6727 | CLEAR_STR | |
6728 | BGP_STR | |
6729 | "Clear all peers\n" | |
e0bce756 | 6730 | BGP_SOFT_IN_STR) |
718e3744 | 6731 | |
6732 | ALIAS (clear_bgp_all_soft_in, | |
6733 | clear_bgp_ipv6_all_in_cmd, | |
6734 | "clear bgp ipv6 * in", | |
6735 | CLEAR_STR | |
6736 | BGP_STR | |
6737 | "Address family\n" | |
6738 | "Clear all peers\n" | |
e0bce756 | 6739 | BGP_SOFT_IN_STR) |
718e3744 | 6740 | |
6741 | DEFUN (clear_bgp_all_in_prefix_filter, | |
6742 | clear_bgp_all_in_prefix_filter_cmd, | |
6743 | "clear bgp * in prefix-filter", | |
6744 | CLEAR_STR | |
6745 | BGP_STR | |
6746 | "Clear all peers\n" | |
e0bce756 | 6747 | BGP_SOFT_IN_STR |
718e3744 | 6748 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6749 | { | |
6750 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6751 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6752 | } | |
6753 | ||
6754 | ALIAS (clear_bgp_all_in_prefix_filter, | |
6755 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
6756 | "clear bgp ipv6 * in prefix-filter", | |
6757 | CLEAR_STR | |
6758 | BGP_STR | |
6759 | "Address family\n" | |
6760 | "Clear all peers\n" | |
e0bce756 | 6761 | BGP_SOFT_IN_STR |
718e3744 | 6762 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6763 | ||
6764 | DEFUN (clear_ip_bgp_peer_soft_in, | |
6765 | clear_ip_bgp_peer_soft_in_cmd, | |
6766 | "clear ip bgp A.B.C.D soft in", | |
6767 | CLEAR_STR | |
6768 | IP_STR | |
6769 | BGP_STR | |
6770 | "BGP neighbor address to clear\n" | |
e0bce756 DS |
6771 | BGP_SOFT_STR |
6772 | BGP_SOFT_IN_STR) | |
718e3744 | 6773 | { |
6774 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6775 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6776 | } | |
6777 | ||
6778 | ALIAS (clear_ip_bgp_peer_soft_in, | |
6779 | clear_ip_bgp_peer_in_cmd, | |
6780 | "clear ip bgp A.B.C.D in", | |
6781 | CLEAR_STR | |
6782 | IP_STR | |
6783 | BGP_STR | |
6784 | "BGP neighbor address to clear\n" | |
e0bce756 | 6785 | BGP_SOFT_IN_STR) |
718e3744 | 6786 | |
6787 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, | |
6788 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
6789 | "clear ip bgp A.B.C.D in prefix-filter", | |
6790 | CLEAR_STR | |
6791 | IP_STR | |
6792 | BGP_STR | |
6793 | "BGP neighbor address to clear\n" | |
e0bce756 | 6794 | BGP_SOFT_IN_STR |
718e3744 | 6795 | "Push out the existing ORF prefix-list\n") |
6796 | { | |
6797 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6798 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6799 | } | |
6800 | ||
6801 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
6802 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
6803 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", | |
6804 | CLEAR_STR | |
6805 | IP_STR | |
6806 | BGP_STR | |
6807 | "BGP neighbor address to clear\n" | |
6808 | "Address family\n" | |
6809 | "Address Family modifier\n" | |
6810 | "Address Family modifier\n" | |
e0bce756 DS |
6811 | BGP_SOFT_STR |
6812 | BGP_SOFT_IN_STR) | |
718e3744 | 6813 | { |
6814 | if (strncmp (argv[1], "m", 1) == 0) | |
6815 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6816 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6817 | ||
6818 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6819 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6820 | } | |
6821 | ||
6822 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, | |
6823 | clear_ip_bgp_peer_ipv4_in_cmd, | |
6824 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", | |
6825 | CLEAR_STR | |
6826 | IP_STR | |
6827 | BGP_STR | |
6828 | "BGP neighbor address to clear\n" | |
6829 | "Address family\n" | |
6830 | "Address Family modifier\n" | |
6831 | "Address Family modifier\n" | |
e0bce756 | 6832 | BGP_SOFT_IN_STR) |
718e3744 | 6833 | |
6834 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, | |
6835 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
6836 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", | |
6837 | CLEAR_STR | |
6838 | IP_STR | |
6839 | BGP_STR | |
6840 | "BGP neighbor address to clear\n" | |
6841 | "Address family\n" | |
6842 | "Address Family modifier\n" | |
6843 | "Address Family modifier\n" | |
e0bce756 | 6844 | BGP_SOFT_IN_STR |
718e3744 | 6845 | "Push out the existing ORF prefix-list\n") |
6846 | { | |
6847 | if (strncmp (argv[1], "m", 1) == 0) | |
6848 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6849 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6850 | ||
6851 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6852 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6853 | } | |
6854 | ||
6855 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
6856 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
6857 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", | |
6858 | CLEAR_STR | |
6859 | IP_STR | |
6860 | BGP_STR | |
6861 | "BGP neighbor address to clear\n" | |
6862 | "Address family\n" | |
6863 | "Address Family Modifier\n" | |
e0bce756 DS |
6864 | BGP_SOFT_STR |
6865 | BGP_SOFT_IN_STR) | |
718e3744 | 6866 | { |
6867 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6868 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6869 | } | |
6870 | ||
6871 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
6872 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
6873 | "clear ip bgp A.B.C.D vpnv4 unicast in", | |
6874 | CLEAR_STR | |
6875 | IP_STR | |
6876 | BGP_STR | |
6877 | "BGP neighbor address to clear\n" | |
6878 | "Address family\n" | |
6879 | "Address Family Modifier\n" | |
e0bce756 | 6880 | BGP_SOFT_IN_STR) |
718e3744 | 6881 | |
6882 | DEFUN (clear_bgp_peer_soft_in, | |
6883 | clear_bgp_peer_soft_in_cmd, | |
a80beece | 6884 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 6885 | CLEAR_STR |
6886 | BGP_STR | |
6887 | "BGP neighbor address to clear\n" | |
6888 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6889 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6890 | BGP_SOFT_STR |
6891 | BGP_SOFT_IN_STR) | |
718e3744 | 6892 | { |
6893 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6894 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6895 | } | |
6896 | ||
6897 | ALIAS (clear_bgp_peer_soft_in, | |
6898 | clear_bgp_ipv6_peer_soft_in_cmd, | |
a80beece | 6899 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 6900 | CLEAR_STR |
6901 | BGP_STR | |
6902 | "Address family\n" | |
6903 | "BGP neighbor address to clear\n" | |
6904 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6905 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6906 | BGP_SOFT_STR |
6907 | BGP_SOFT_IN_STR) | |
718e3744 | 6908 | |
6909 | ALIAS (clear_bgp_peer_soft_in, | |
6910 | clear_bgp_peer_in_cmd, | |
a80beece | 6911 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 6912 | CLEAR_STR |
6913 | BGP_STR | |
6914 | "BGP neighbor address to clear\n" | |
6915 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6916 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6917 | BGP_SOFT_IN_STR) |
718e3744 | 6918 | |
6919 | ALIAS (clear_bgp_peer_soft_in, | |
6920 | clear_bgp_ipv6_peer_in_cmd, | |
a80beece | 6921 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 6922 | CLEAR_STR |
6923 | BGP_STR | |
6924 | "Address family\n" | |
6925 | "BGP neighbor address to clear\n" | |
6926 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6927 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6928 | BGP_SOFT_IN_STR) |
718e3744 | 6929 | |
6930 | DEFUN (clear_bgp_peer_in_prefix_filter, | |
6931 | clear_bgp_peer_in_prefix_filter_cmd, | |
a80beece | 6932 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 6933 | CLEAR_STR |
6934 | BGP_STR | |
6935 | "BGP neighbor address to clear\n" | |
6936 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6937 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6938 | BGP_SOFT_IN_STR |
718e3744 | 6939 | "Push out the existing ORF prefix-list\n") |
6940 | { | |
6941 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6942 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6943 | } | |
6944 | ||
6945 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
6946 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
a80beece | 6947 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 6948 | CLEAR_STR |
6949 | BGP_STR | |
6950 | "Address family\n" | |
6951 | "BGP neighbor address to clear\n" | |
6952 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6953 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6954 | BGP_SOFT_IN_STR |
718e3744 | 6955 | "Push out the existing ORF prefix-list\n") |
6956 | ||
6957 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
6958 | clear_ip_bgp_peer_group_soft_in_cmd, | |
6959 | "clear ip bgp peer-group WORD soft in", | |
6960 | CLEAR_STR | |
6961 | IP_STR | |
6962 | BGP_STR | |
6963 | "Clear all members of peer-group\n" | |
6964 | "BGP peer-group name\n" | |
e0bce756 DS |
6965 | BGP_SOFT_STR |
6966 | BGP_SOFT_IN_STR) | |
718e3744 | 6967 | { |
6968 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6969 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6970 | } | |
6971 | ||
6972 | ALIAS (clear_ip_bgp_peer_group_soft_in, | |
6973 | clear_ip_bgp_peer_group_in_cmd, | |
6974 | "clear ip bgp peer-group WORD in", | |
6975 | CLEAR_STR | |
6976 | IP_STR | |
6977 | BGP_STR | |
6978 | "Clear all members of peer-group\n" | |
6979 | "BGP peer-group name\n" | |
e0bce756 | 6980 | BGP_SOFT_IN_STR) |
718e3744 | 6981 | |
6982 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, | |
6983 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
6984 | "clear ip bgp peer-group WORD in prefix-filter", | |
6985 | CLEAR_STR | |
6986 | IP_STR | |
6987 | BGP_STR | |
6988 | "Clear all members of peer-group\n" | |
6989 | "BGP peer-group name\n" | |
e0bce756 | 6990 | BGP_SOFT_IN_STR |
718e3744 | 6991 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6992 | { | |
6993 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6994 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6995 | } | |
6996 | ||
6997 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
6998 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
6999 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
7000 | CLEAR_STR | |
7001 | IP_STR | |
7002 | BGP_STR | |
7003 | "Clear all members of peer-group\n" | |
7004 | "BGP peer-group name\n" | |
7005 | "Address family\n" | |
7006 | "Address Family modifier\n" | |
7007 | "Address Family modifier\n" | |
e0bce756 DS |
7008 | BGP_SOFT_STR |
7009 | BGP_SOFT_IN_STR) | |
718e3744 | 7010 | { |
7011 | if (strncmp (argv[1], "m", 1) == 0) | |
7012 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7013 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7014 | ||
7015 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7016 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7017 | } | |
7018 | ||
7019 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, | |
7020 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
7021 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
7022 | CLEAR_STR | |
7023 | IP_STR | |
7024 | BGP_STR | |
7025 | "Clear all members of peer-group\n" | |
7026 | "BGP peer-group name\n" | |
7027 | "Address family\n" | |
7028 | "Address Family modifier\n" | |
7029 | "Address Family modifier\n" | |
e0bce756 | 7030 | BGP_SOFT_IN_STR) |
718e3744 | 7031 | |
7032 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, | |
7033 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
7034 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
7035 | CLEAR_STR | |
7036 | IP_STR | |
7037 | BGP_STR | |
7038 | "Clear all members of peer-group\n" | |
7039 | "BGP peer-group name\n" | |
7040 | "Address family\n" | |
7041 | "Address Family modifier\n" | |
7042 | "Address Family modifier\n" | |
e0bce756 | 7043 | BGP_SOFT_IN_STR |
718e3744 | 7044 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7045 | { | |
7046 | if (strncmp (argv[1], "m", 1) == 0) | |
7047 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7048 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7049 | ||
7050 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7051 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7052 | } | |
7053 | ||
7054 | DEFUN (clear_bgp_peer_group_soft_in, | |
7055 | clear_bgp_peer_group_soft_in_cmd, | |
7056 | "clear bgp peer-group WORD soft in", | |
7057 | CLEAR_STR | |
7058 | BGP_STR | |
7059 | "Clear all members of peer-group\n" | |
7060 | "BGP peer-group name\n" | |
e0bce756 DS |
7061 | BGP_SOFT_STR |
7062 | BGP_SOFT_IN_STR) | |
718e3744 | 7063 | { |
7064 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7065 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7066 | } | |
7067 | ||
7068 | ALIAS (clear_bgp_peer_group_soft_in, | |
7069 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
7070 | "clear bgp ipv6 peer-group WORD soft in", | |
7071 | CLEAR_STR | |
7072 | BGP_STR | |
7073 | "Address family\n" | |
7074 | "Clear all members of peer-group\n" | |
7075 | "BGP peer-group name\n" | |
e0bce756 DS |
7076 | BGP_SOFT_STR |
7077 | BGP_SOFT_IN_STR) | |
718e3744 | 7078 | |
7079 | ALIAS (clear_bgp_peer_group_soft_in, | |
7080 | clear_bgp_peer_group_in_cmd, | |
7081 | "clear bgp peer-group WORD in", | |
7082 | CLEAR_STR | |
7083 | BGP_STR | |
7084 | "Clear all members of peer-group\n" | |
7085 | "BGP peer-group name\n" | |
e0bce756 | 7086 | BGP_SOFT_IN_STR) |
718e3744 | 7087 | |
7088 | ALIAS (clear_bgp_peer_group_soft_in, | |
7089 | clear_bgp_ipv6_peer_group_in_cmd, | |
7090 | "clear bgp ipv6 peer-group WORD in", | |
7091 | CLEAR_STR | |
7092 | BGP_STR | |
7093 | "Address family\n" | |
7094 | "Clear all members of peer-group\n" | |
7095 | "BGP peer-group name\n" | |
e0bce756 | 7096 | BGP_SOFT_IN_STR) |
718e3744 | 7097 | |
7098 | DEFUN (clear_bgp_peer_group_in_prefix_filter, | |
7099 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
7100 | "clear bgp peer-group WORD in prefix-filter", | |
7101 | CLEAR_STR | |
7102 | BGP_STR | |
7103 | "Clear all members of peer-group\n" | |
7104 | "BGP peer-group name\n" | |
e0bce756 | 7105 | BGP_SOFT_IN_STR |
718e3744 | 7106 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7107 | { | |
7108 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7109 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7110 | } | |
7111 | ||
7112 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
7113 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
7114 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
7115 | CLEAR_STR | |
7116 | BGP_STR | |
7117 | "Address family\n" | |
7118 | "Clear all members of peer-group\n" | |
7119 | "BGP peer-group name\n" | |
e0bce756 | 7120 | BGP_SOFT_IN_STR |
718e3744 | 7121 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7122 | ||
7123 | DEFUN (clear_ip_bgp_external_soft_in, | |
7124 | clear_ip_bgp_external_soft_in_cmd, | |
7125 | "clear ip bgp external soft in", | |
7126 | CLEAR_STR | |
7127 | IP_STR | |
7128 | BGP_STR | |
7129 | "Clear all external peers\n" | |
e0bce756 DS |
7130 | BGP_SOFT_STR |
7131 | BGP_SOFT_IN_STR) | |
718e3744 | 7132 | { |
7133 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7134 | BGP_CLEAR_SOFT_IN, NULL); | |
7135 | } | |
7136 | ||
7137 | ALIAS (clear_ip_bgp_external_soft_in, | |
7138 | clear_ip_bgp_external_in_cmd, | |
7139 | "clear ip bgp external in", | |
7140 | CLEAR_STR | |
7141 | IP_STR | |
7142 | BGP_STR | |
7143 | "Clear all external peers\n" | |
e0bce756 | 7144 | BGP_SOFT_IN_STR) |
718e3744 | 7145 | |
7146 | DEFUN (clear_ip_bgp_external_in_prefix_filter, | |
7147 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
7148 | "clear ip bgp external in prefix-filter", | |
7149 | CLEAR_STR | |
7150 | IP_STR | |
7151 | BGP_STR | |
7152 | "Clear all external peers\n" | |
e0bce756 | 7153 | BGP_SOFT_IN_STR |
718e3744 | 7154 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7155 | { | |
7156 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7157 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7158 | } | |
7159 | ||
7160 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
7161 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
7162 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
7163 | CLEAR_STR | |
7164 | IP_STR | |
7165 | BGP_STR | |
7166 | "Clear all external peers\n" | |
7167 | "Address family\n" | |
7168 | "Address Family modifier\n" | |
7169 | "Address Family modifier\n" | |
e0bce756 DS |
7170 | BGP_SOFT_STR |
7171 | BGP_SOFT_IN_STR) | |
718e3744 | 7172 | { |
7173 | if (strncmp (argv[0], "m", 1) == 0) | |
7174 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7175 | BGP_CLEAR_SOFT_IN, NULL); | |
7176 | ||
7177 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7178 | BGP_CLEAR_SOFT_IN, NULL); | |
7179 | } | |
7180 | ||
7181 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, | |
7182 | clear_ip_bgp_external_ipv4_in_cmd, | |
7183 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
7184 | CLEAR_STR | |
7185 | IP_STR | |
7186 | BGP_STR | |
7187 | "Clear all external peers\n" | |
7188 | "Address family\n" | |
7189 | "Address Family modifier\n" | |
7190 | "Address Family modifier\n" | |
e0bce756 | 7191 | BGP_SOFT_IN_STR) |
718e3744 | 7192 | |
7193 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, | |
7194 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
7195 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
7196 | CLEAR_STR | |
7197 | IP_STR | |
7198 | BGP_STR | |
7199 | "Clear all external peers\n" | |
7200 | "Address family\n" | |
7201 | "Address Family modifier\n" | |
7202 | "Address Family modifier\n" | |
e0bce756 | 7203 | BGP_SOFT_IN_STR |
718e3744 | 7204 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7205 | { | |
7206 | if (strncmp (argv[0], "m", 1) == 0) | |
7207 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7208 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7209 | ||
7210 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7211 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7212 | } | |
7213 | ||
7214 | DEFUN (clear_bgp_external_soft_in, | |
7215 | clear_bgp_external_soft_in_cmd, | |
7216 | "clear bgp external soft in", | |
7217 | CLEAR_STR | |
7218 | BGP_STR | |
7219 | "Clear all external peers\n" | |
e0bce756 DS |
7220 | BGP_SOFT_STR |
7221 | BGP_SOFT_IN_STR) | |
718e3744 | 7222 | { |
7223 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7224 | BGP_CLEAR_SOFT_IN, NULL); | |
7225 | } | |
7226 | ||
7227 | ALIAS (clear_bgp_external_soft_in, | |
7228 | clear_bgp_ipv6_external_soft_in_cmd, | |
7229 | "clear bgp ipv6 external soft in", | |
7230 | CLEAR_STR | |
7231 | BGP_STR | |
7232 | "Address family\n" | |
7233 | "Clear all external peers\n" | |
e0bce756 DS |
7234 | BGP_SOFT_STR |
7235 | BGP_SOFT_IN_STR) | |
718e3744 | 7236 | |
7237 | ALIAS (clear_bgp_external_soft_in, | |
7238 | clear_bgp_external_in_cmd, | |
7239 | "clear bgp external in", | |
7240 | CLEAR_STR | |
7241 | BGP_STR | |
7242 | "Clear all external peers\n" | |
e0bce756 | 7243 | BGP_SOFT_IN_STR) |
718e3744 | 7244 | |
7245 | ALIAS (clear_bgp_external_soft_in, | |
7246 | clear_bgp_ipv6_external_in_cmd, | |
7247 | "clear bgp ipv6 external WORD in", | |
7248 | CLEAR_STR | |
7249 | BGP_STR | |
7250 | "Address family\n" | |
7251 | "Clear all external peers\n" | |
e0bce756 | 7252 | BGP_SOFT_IN_STR) |
718e3744 | 7253 | |
7254 | DEFUN (clear_bgp_external_in_prefix_filter, | |
7255 | clear_bgp_external_in_prefix_filter_cmd, | |
7256 | "clear bgp external in prefix-filter", | |
7257 | CLEAR_STR | |
7258 | BGP_STR | |
7259 | "Clear all external peers\n" | |
e0bce756 | 7260 | BGP_SOFT_IN_STR |
718e3744 | 7261 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7262 | { | |
7263 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7264 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7265 | } | |
7266 | ||
7267 | ALIAS (clear_bgp_external_in_prefix_filter, | |
7268 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
7269 | "clear bgp ipv6 external in prefix-filter", | |
7270 | CLEAR_STR | |
7271 | BGP_STR | |
7272 | "Address family\n" | |
7273 | "Clear all external peers\n" | |
e0bce756 | 7274 | BGP_SOFT_IN_STR |
718e3744 | 7275 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7276 | ||
7277 | DEFUN (clear_ip_bgp_as_soft_in, | |
7278 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 7279 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 7280 | CLEAR_STR |
7281 | IP_STR | |
7282 | BGP_STR | |
7283 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7284 | BGP_SOFT_STR |
7285 | BGP_SOFT_IN_STR) | |
718e3744 | 7286 | { |
7287 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7288 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7289 | } | |
7290 | ||
7291 | ALIAS (clear_ip_bgp_as_soft_in, | |
7292 | clear_ip_bgp_as_in_cmd, | |
320da874 | 7293 | "clear ip bgp " CMD_AS_RANGE " in", |
718e3744 | 7294 | CLEAR_STR |
7295 | IP_STR | |
7296 | BGP_STR | |
7297 | "Clear peers with the AS number\n" | |
e0bce756 | 7298 | BGP_SOFT_IN_STR) |
718e3744 | 7299 | |
7300 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
7301 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 7302 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7303 | CLEAR_STR |
7304 | IP_STR | |
7305 | BGP_STR | |
7306 | "Clear peers with the AS number\n" | |
e0bce756 | 7307 | BGP_SOFT_IN_STR |
718e3744 | 7308 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7309 | { | |
7310 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7311 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7312 | } | |
7313 | ||
7314 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
7315 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 7316 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 7317 | CLEAR_STR |
7318 | IP_STR | |
7319 | BGP_STR | |
7320 | "Clear peers with the AS number\n" | |
7321 | "Address family\n" | |
7322 | "Address Family modifier\n" | |
7323 | "Address Family modifier\n" | |
e0bce756 DS |
7324 | BGP_SOFT_STR |
7325 | BGP_SOFT_IN_STR) | |
718e3744 | 7326 | { |
7327 | if (strncmp (argv[1], "m", 1) == 0) | |
7328 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7329 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7330 | ||
7331 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7332 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7333 | } | |
7334 | ||
7335 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, | |
7336 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 7337 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 7338 | CLEAR_STR |
7339 | IP_STR | |
7340 | BGP_STR | |
7341 | "Clear peers with the AS number\n" | |
7342 | "Address family\n" | |
7343 | "Address Family modifier\n" | |
7344 | "Address Family modifier\n" | |
e0bce756 | 7345 | BGP_SOFT_IN_STR) |
718e3744 | 7346 | |
7347 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, | |
7348 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 7349 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 7350 | CLEAR_STR |
7351 | IP_STR | |
7352 | BGP_STR | |
7353 | "Clear peers with the AS number\n" | |
7354 | "Address family\n" | |
7355 | "Address Family modifier\n" | |
7356 | "Address Family modifier\n" | |
e0bce756 | 7357 | BGP_SOFT_IN_STR |
718e3744 | 7358 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7359 | { | |
7360 | if (strncmp (argv[1], "m", 1) == 0) | |
7361 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7362 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7363 | ||
7364 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7365 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7366 | } | |
7367 | ||
7368 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
7369 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 7370 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 7371 | CLEAR_STR |
7372 | IP_STR | |
7373 | BGP_STR | |
7374 | "Clear peers with the AS number\n" | |
7375 | "Address family\n" | |
7376 | "Address Family modifier\n" | |
e0bce756 DS |
7377 | BGP_SOFT_STR |
7378 | BGP_SOFT_IN_STR) | |
718e3744 | 7379 | { |
7380 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7381 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7382 | } | |
7383 | ||
7384 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
7385 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 7386 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 7387 | CLEAR_STR |
7388 | IP_STR | |
7389 | BGP_STR | |
7390 | "Clear peers with the AS number\n" | |
7391 | "Address family\n" | |
7392 | "Address Family modifier\n" | |
e0bce756 | 7393 | BGP_SOFT_IN_STR) |
718e3744 | 7394 | |
7395 | DEFUN (clear_bgp_as_soft_in, | |
7396 | clear_bgp_as_soft_in_cmd, | |
320da874 | 7397 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 7398 | CLEAR_STR |
7399 | BGP_STR | |
7400 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7401 | BGP_SOFT_STR |
7402 | BGP_SOFT_IN_STR) | |
718e3744 | 7403 | { |
7404 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7405 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7406 | } | |
7407 | ||
7408 | ALIAS (clear_bgp_as_soft_in, | |
7409 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 7410 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 7411 | CLEAR_STR |
7412 | BGP_STR | |
7413 | "Address family\n" | |
7414 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7415 | BGP_SOFT_STR |
7416 | BGP_SOFT_IN_STR) | |
718e3744 | 7417 | |
7418 | ALIAS (clear_bgp_as_soft_in, | |
7419 | clear_bgp_as_in_cmd, | |
320da874 | 7420 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 7421 | CLEAR_STR |
7422 | BGP_STR | |
7423 | "Clear peers with the AS number\n" | |
e0bce756 | 7424 | BGP_SOFT_IN_STR) |
718e3744 | 7425 | |
7426 | ALIAS (clear_bgp_as_soft_in, | |
7427 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 7428 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 7429 | CLEAR_STR |
7430 | BGP_STR | |
7431 | "Address family\n" | |
7432 | "Clear peers with the AS number\n" | |
e0bce756 | 7433 | BGP_SOFT_IN_STR) |
718e3744 | 7434 | |
7435 | DEFUN (clear_bgp_as_in_prefix_filter, | |
7436 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 7437 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7438 | CLEAR_STR |
7439 | BGP_STR | |
7440 | "Clear peers with the AS number\n" | |
e0bce756 | 7441 | BGP_SOFT_IN_STR |
718e3744 | 7442 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7443 | { | |
7444 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7445 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7446 | } | |
7447 | ||
7448 | ALIAS (clear_bgp_as_in_prefix_filter, | |
7449 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 7450 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7451 | CLEAR_STR |
7452 | BGP_STR | |
7453 | "Address family\n" | |
7454 | "Clear peers with the AS number\n" | |
e0bce756 | 7455 | BGP_SOFT_IN_STR |
718e3744 | 7456 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6b0655a2 | 7457 | |
718e3744 | 7458 | /* Both soft-reconfiguration */ |
7459 | DEFUN (clear_ip_bgp_all_soft, | |
7460 | clear_ip_bgp_all_soft_cmd, | |
7461 | "clear ip bgp * soft", | |
7462 | CLEAR_STR | |
7463 | IP_STR | |
7464 | BGP_STR | |
7465 | "Clear all peers\n" | |
e0bce756 | 7466 | BGP_SOFT_STR) |
718e3744 | 7467 | { |
7468 | if (argc == 1) | |
7469 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
7470 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7471 | ||
7472 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7473 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7474 | } | |
7475 | ||
7476 | ALIAS (clear_ip_bgp_all_soft, | |
7477 | clear_ip_bgp_instance_all_soft_cmd, | |
7478 | "clear ip bgp view WORD * soft", | |
7479 | CLEAR_STR | |
7480 | IP_STR | |
7481 | BGP_STR | |
7482 | "BGP view\n" | |
7483 | "view name\n" | |
7484 | "Clear all peers\n" | |
e0bce756 | 7485 | BGP_SOFT_STR) |
718e3744 | 7486 | |
7487 | ||
7488 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
7489 | clear_ip_bgp_all_ipv4_soft_cmd, | |
7490 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
7491 | CLEAR_STR | |
7492 | IP_STR | |
7493 | BGP_STR | |
7494 | "Clear all peers\n" | |
7495 | "Address family\n" | |
7496 | "Address Family Modifier\n" | |
7497 | "Address Family Modifier\n" | |
e0bce756 | 7498 | BGP_SOFT_STR) |
718e3744 | 7499 | { |
7500 | if (strncmp (argv[0], "m", 1) == 0) | |
7501 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7502 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7503 | ||
7504 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7505 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7506 | } | |
7507 | ||
7508 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
7509 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
7510 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", | |
7511 | CLEAR_STR | |
7512 | IP_STR | |
7513 | BGP_STR | |
7514 | "BGP view\n" | |
7515 | "view name\n" | |
7516 | "Clear all peers\n" | |
7517 | "Address family\n" | |
7518 | "Address Family Modifier\n" | |
7519 | "Address Family Modifier\n" | |
e0bce756 | 7520 | BGP_SOFT_STR) |
718e3744 | 7521 | { |
7522 | if (strncmp (argv[1], "m", 1) == 0) | |
7523 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7524 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7525 | ||
7526 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7527 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7528 | } | |
7529 | ||
7530 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
7531 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
7532 | "clear ip bgp * vpnv4 unicast soft", | |
7533 | CLEAR_STR | |
7534 | IP_STR | |
7535 | BGP_STR | |
7536 | "Clear all peers\n" | |
7537 | "Address family\n" | |
7538 | "Address Family Modifier\n" | |
e0bce756 | 7539 | BGP_SOFT_STR) |
718e3744 | 7540 | { |
7541 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
7542 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7543 | } | |
7544 | ||
7545 | DEFUN (clear_bgp_all_soft, | |
7546 | clear_bgp_all_soft_cmd, | |
7547 | "clear bgp * soft", | |
7548 | CLEAR_STR | |
7549 | BGP_STR | |
7550 | "Clear all peers\n" | |
e0bce756 | 7551 | BGP_SOFT_STR) |
718e3744 | 7552 | { |
7553 | if (argc == 1) | |
7554 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
7555 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7556 | ||
7557 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7558 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7559 | } | |
7560 | ||
7561 | ALIAS (clear_bgp_all_soft, | |
7562 | clear_bgp_instance_all_soft_cmd, | |
7563 | "clear bgp view WORD * soft", | |
7564 | CLEAR_STR | |
7565 | BGP_STR | |
7566 | "BGP view\n" | |
7567 | "view name\n" | |
7568 | "Clear all peers\n" | |
e0bce756 | 7569 | BGP_SOFT_STR) |
718e3744 | 7570 | |
7571 | ALIAS (clear_bgp_all_soft, | |
7572 | clear_bgp_ipv6_all_soft_cmd, | |
7573 | "clear bgp ipv6 * soft", | |
7574 | CLEAR_STR | |
7575 | BGP_STR | |
7576 | "Address family\n" | |
7577 | "Clear all peers\n" | |
e0bce756 | 7578 | BGP_SOFT_STR) |
718e3744 | 7579 | |
7580 | DEFUN (clear_ip_bgp_peer_soft, | |
7581 | clear_ip_bgp_peer_soft_cmd, | |
7582 | "clear ip bgp A.B.C.D soft", | |
7583 | CLEAR_STR | |
7584 | IP_STR | |
7585 | BGP_STR | |
7586 | "BGP neighbor address to clear\n" | |
e0bce756 | 7587 | BGP_SOFT_STR) |
718e3744 | 7588 | { |
7589 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7590 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7591 | } | |
7592 | ||
7593 | DEFUN (clear_ip_bgp_peer_ipv4_soft, | |
7594 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
7595 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", | |
7596 | CLEAR_STR | |
7597 | IP_STR | |
7598 | BGP_STR | |
7599 | "BGP neighbor address to clear\n" | |
7600 | "Address family\n" | |
7601 | "Address Family Modifier\n" | |
7602 | "Address Family Modifier\n" | |
e0bce756 | 7603 | BGP_SOFT_STR) |
718e3744 | 7604 | { |
7605 | if (strncmp (argv[1], "m", 1) == 0) | |
7606 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
7607 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7608 | ||
7609 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7610 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7611 | } | |
7612 | ||
7613 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, | |
7614 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
7615 | "clear ip bgp A.B.C.D vpnv4 unicast soft", | |
7616 | CLEAR_STR | |
7617 | IP_STR | |
7618 | BGP_STR | |
7619 | "BGP neighbor address to clear\n" | |
7620 | "Address family\n" | |
7621 | "Address Family Modifier\n" | |
e0bce756 | 7622 | BGP_SOFT_STR) |
718e3744 | 7623 | { |
7624 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
7625 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7626 | } | |
7627 | ||
7628 | DEFUN (clear_bgp_peer_soft, | |
7629 | clear_bgp_peer_soft_cmd, | |
a80beece | 7630 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 7631 | CLEAR_STR |
7632 | BGP_STR | |
7633 | "BGP neighbor address to clear\n" | |
7634 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7635 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7636 | BGP_SOFT_STR) |
718e3744 | 7637 | { |
7638 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7639 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7640 | } | |
7641 | ||
7642 | ALIAS (clear_bgp_peer_soft, | |
7643 | clear_bgp_ipv6_peer_soft_cmd, | |
a80beece | 7644 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 7645 | CLEAR_STR |
7646 | BGP_STR | |
7647 | "Address family\n" | |
7648 | "BGP neighbor address to clear\n" | |
7649 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7650 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7651 | BGP_SOFT_STR) |
718e3744 | 7652 | |
7653 | DEFUN (clear_ip_bgp_peer_group_soft, | |
7654 | clear_ip_bgp_peer_group_soft_cmd, | |
7655 | "clear ip bgp peer-group WORD soft", | |
7656 | CLEAR_STR | |
7657 | IP_STR | |
7658 | BGP_STR | |
7659 | "Clear all members of peer-group\n" | |
7660 | "BGP peer-group name\n" | |
e0bce756 | 7661 | BGP_SOFT_STR) |
718e3744 | 7662 | { |
7663 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7664 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7665 | } | |
7666 | ||
7667 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, | |
7668 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
7669 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
7670 | CLEAR_STR | |
7671 | IP_STR | |
7672 | BGP_STR | |
7673 | "Clear all members of peer-group\n" | |
7674 | "BGP peer-group name\n" | |
7675 | "Address family\n" | |
7676 | "Address Family modifier\n" | |
7677 | "Address Family modifier\n" | |
e0bce756 | 7678 | BGP_SOFT_STR) |
718e3744 | 7679 | { |
7680 | if (strncmp (argv[1], "m", 1) == 0) | |
7681 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7682 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7683 | ||
7684 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7685 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7686 | } | |
7687 | ||
7688 | DEFUN (clear_bgp_peer_group_soft, | |
7689 | clear_bgp_peer_group_soft_cmd, | |
7690 | "clear bgp peer-group WORD soft", | |
7691 | CLEAR_STR | |
7692 | BGP_STR | |
7693 | "Clear all members of peer-group\n" | |
7694 | "BGP peer-group name\n" | |
e0bce756 | 7695 | BGP_SOFT_STR) |
718e3744 | 7696 | { |
7697 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7698 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7699 | } | |
7700 | ||
7701 | ALIAS (clear_bgp_peer_group_soft, | |
7702 | clear_bgp_ipv6_peer_group_soft_cmd, | |
7703 | "clear bgp ipv6 peer-group WORD soft", | |
7704 | CLEAR_STR | |
7705 | BGP_STR | |
7706 | "Address family\n" | |
7707 | "Clear all members of peer-group\n" | |
7708 | "BGP peer-group name\n" | |
e0bce756 | 7709 | BGP_SOFT_STR) |
718e3744 | 7710 | |
7711 | DEFUN (clear_ip_bgp_external_soft, | |
7712 | clear_ip_bgp_external_soft_cmd, | |
7713 | "clear ip bgp external soft", | |
7714 | CLEAR_STR | |
7715 | IP_STR | |
7716 | BGP_STR | |
7717 | "Clear all external peers\n" | |
e0bce756 | 7718 | BGP_SOFT_STR) |
718e3744 | 7719 | { |
7720 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7721 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7722 | } | |
7723 | ||
7724 | DEFUN (clear_ip_bgp_external_ipv4_soft, | |
7725 | clear_ip_bgp_external_ipv4_soft_cmd, | |
7726 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
7727 | CLEAR_STR | |
7728 | IP_STR | |
7729 | BGP_STR | |
7730 | "Clear all external peers\n" | |
7731 | "Address family\n" | |
7732 | "Address Family modifier\n" | |
7733 | "Address Family modifier\n" | |
e0bce756 | 7734 | BGP_SOFT_STR) |
718e3744 | 7735 | { |
7736 | if (strncmp (argv[0], "m", 1) == 0) | |
7737 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7738 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7739 | ||
7740 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7741 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7742 | } | |
7743 | ||
7744 | DEFUN (clear_bgp_external_soft, | |
7745 | clear_bgp_external_soft_cmd, | |
7746 | "clear bgp external soft", | |
7747 | CLEAR_STR | |
7748 | BGP_STR | |
7749 | "Clear all external peers\n" | |
e0bce756 | 7750 | BGP_SOFT_STR) |
718e3744 | 7751 | { |
7752 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7753 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7754 | } | |
7755 | ||
7756 | ALIAS (clear_bgp_external_soft, | |
7757 | clear_bgp_ipv6_external_soft_cmd, | |
7758 | "clear bgp ipv6 external soft", | |
7759 | CLEAR_STR | |
7760 | BGP_STR | |
7761 | "Address family\n" | |
7762 | "Clear all external peers\n" | |
e0bce756 | 7763 | BGP_SOFT_STR) |
718e3744 | 7764 | |
7765 | DEFUN (clear_ip_bgp_as_soft, | |
7766 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 7767 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 7768 | CLEAR_STR |
7769 | IP_STR | |
7770 | BGP_STR | |
7771 | "Clear peers with the AS number\n" | |
e0bce756 | 7772 | BGP_SOFT_STR) |
718e3744 | 7773 | { |
7774 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7775 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7776 | } | |
7777 | ||
7778 | DEFUN (clear_ip_bgp_as_ipv4_soft, | |
7779 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 7780 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 7781 | CLEAR_STR |
7782 | IP_STR | |
7783 | BGP_STR | |
7784 | "Clear peers with the AS number\n" | |
7785 | "Address family\n" | |
7786 | "Address Family Modifier\n" | |
7787 | "Address Family Modifier\n" | |
e0bce756 | 7788 | BGP_SOFT_STR) |
718e3744 | 7789 | { |
7790 | if (strncmp (argv[1], "m", 1) == 0) | |
7791 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7792 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7793 | ||
7794 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
7795 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7796 | } | |
7797 | ||
7798 | DEFUN (clear_ip_bgp_as_vpnv4_soft, | |
7799 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 7800 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 7801 | CLEAR_STR |
7802 | IP_STR | |
7803 | BGP_STR | |
7804 | "Clear peers with the AS number\n" | |
7805 | "Address family\n" | |
7806 | "Address Family Modifier\n" | |
e0bce756 | 7807 | BGP_SOFT_STR) |
718e3744 | 7808 | { |
7809 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7810 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7811 | } | |
7812 | ||
7813 | DEFUN (clear_bgp_as_soft, | |
7814 | clear_bgp_as_soft_cmd, | |
320da874 | 7815 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 7816 | CLEAR_STR |
7817 | BGP_STR | |
7818 | "Clear peers with the AS number\n" | |
e0bce756 | 7819 | BGP_SOFT_STR) |
718e3744 | 7820 | { |
7821 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7822 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7823 | } | |
7824 | ||
7825 | ALIAS (clear_bgp_as_soft, | |
7826 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 7827 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 7828 | CLEAR_STR |
7829 | BGP_STR | |
7830 | "Address family\n" | |
7831 | "Clear peers with the AS number\n" | |
e0bce756 | 7832 | BGP_SOFT_STR) |
6b0655a2 | 7833 | |
fee0f4c6 | 7834 | /* RS-client soft reconfiguration. */ |
7835 | #ifdef HAVE_IPV6 | |
7836 | DEFUN (clear_bgp_all_rsclient, | |
7837 | clear_bgp_all_rsclient_cmd, | |
7838 | "clear bgp * rsclient", | |
7839 | CLEAR_STR | |
7840 | BGP_STR | |
7841 | "Clear all peers\n" | |
e0bce756 | 7842 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7843 | { |
7844 | if (argc == 1) | |
7845 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
7846 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
7847 | ||
7848 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7849 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
7850 | } | |
7851 | ||
7852 | ALIAS (clear_bgp_all_rsclient, | |
7853 | clear_bgp_ipv6_all_rsclient_cmd, | |
7854 | "clear bgp ipv6 * rsclient", | |
7855 | CLEAR_STR | |
7856 | BGP_STR | |
7857 | "Address family\n" | |
7858 | "Clear all peers\n" | |
e0bce756 | 7859 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7860 | |
7861 | ALIAS (clear_bgp_all_rsclient, | |
7862 | clear_bgp_instance_all_rsclient_cmd, | |
7863 | "clear bgp view WORD * rsclient", | |
7864 | CLEAR_STR | |
7865 | BGP_STR | |
7866 | "BGP view\n" | |
7867 | "view name\n" | |
7868 | "Clear all peers\n" | |
e0bce756 | 7869 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7870 | |
7871 | ALIAS (clear_bgp_all_rsclient, | |
7872 | clear_bgp_ipv6_instance_all_rsclient_cmd, | |
7873 | "clear bgp ipv6 view WORD * rsclient", | |
7874 | CLEAR_STR | |
7875 | BGP_STR | |
7876 | "Address family\n" | |
7877 | "BGP view\n" | |
7878 | "view name\n" | |
7879 | "Clear all peers\n" | |
e0bce756 | 7880 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7881 | #endif /* HAVE_IPV6 */ |
7882 | ||
7883 | DEFUN (clear_ip_bgp_all_rsclient, | |
7884 | clear_ip_bgp_all_rsclient_cmd, | |
7885 | "clear ip bgp * rsclient", | |
7886 | CLEAR_STR | |
7887 | IP_STR | |
7888 | BGP_STR | |
7889 | "Clear all peers\n" | |
e0bce756 | 7890 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7891 | { |
7892 | if (argc == 1) | |
7893 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
7894 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
7895 | ||
7896 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7897 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
7898 | } | |
7899 | ||
7900 | ALIAS (clear_ip_bgp_all_rsclient, | |
7901 | clear_ip_bgp_instance_all_rsclient_cmd, | |
7902 | "clear ip bgp view WORD * rsclient", | |
7903 | CLEAR_STR | |
7904 | IP_STR | |
7905 | BGP_STR | |
7906 | "BGP view\n" | |
7907 | "view name\n" | |
7908 | "Clear all peers\n" | |
e0bce756 | 7909 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7910 | |
7911 | #ifdef HAVE_IPV6 | |
7912 | DEFUN (clear_bgp_peer_rsclient, | |
7913 | clear_bgp_peer_rsclient_cmd, | |
a80beece | 7914 | "clear bgp (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7915 | CLEAR_STR |
7916 | BGP_STR | |
7917 | "BGP neighbor IP address to clear\n" | |
7918 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7919 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7920 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7921 | { |
7922 | if (argc == 2) | |
7923 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, | |
7924 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
7925 | ||
7926 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7927 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
7928 | } | |
7929 | ||
7930 | ALIAS (clear_bgp_peer_rsclient, | |
7931 | clear_bgp_ipv6_peer_rsclient_cmd, | |
a80beece | 7932 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7933 | CLEAR_STR |
7934 | BGP_STR | |
7935 | "Address family\n" | |
7936 | "BGP neighbor IP address to clear\n" | |
7937 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7938 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7939 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7940 | |
7941 | ALIAS (clear_bgp_peer_rsclient, | |
7942 | clear_bgp_instance_peer_rsclient_cmd, | |
a80beece | 7943 | "clear bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7944 | CLEAR_STR |
7945 | BGP_STR | |
7946 | "BGP view\n" | |
7947 | "view name\n" | |
7948 | "BGP neighbor IP address to clear\n" | |
7949 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7950 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7951 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7952 | |
7953 | ALIAS (clear_bgp_peer_rsclient, | |
7954 | clear_bgp_ipv6_instance_peer_rsclient_cmd, | |
a80beece | 7955 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7956 | CLEAR_STR |
7957 | BGP_STR | |
7958 | "Address family\n" | |
7959 | "BGP view\n" | |
7960 | "view name\n" | |
7961 | "BGP neighbor IP address to clear\n" | |
7962 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7963 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7964 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7965 | #endif /* HAVE_IPV6 */ |
7966 | ||
7967 | DEFUN (clear_ip_bgp_peer_rsclient, | |
7968 | clear_ip_bgp_peer_rsclient_cmd, | |
a80beece | 7969 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7970 | CLEAR_STR |
7971 | IP_STR | |
7972 | BGP_STR | |
7973 | "BGP neighbor IP address to clear\n" | |
7974 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7975 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7976 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7977 | { |
7978 | if (argc == 2) | |
7979 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, | |
7980 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
7981 | ||
7982 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7983 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
7984 | } | |
7985 | ||
7986 | ALIAS (clear_ip_bgp_peer_rsclient, | |
7987 | clear_ip_bgp_instance_peer_rsclient_cmd, | |
a80beece | 7988 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7989 | CLEAR_STR |
7990 | IP_STR | |
7991 | BGP_STR | |
7992 | "BGP view\n" | |
7993 | "view name\n" | |
7994 | "BGP neighbor IP address to clear\n" | |
7995 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7996 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7997 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7998 | |
e0081f70 ML |
7999 | DEFUN (show_bgp_views, |
8000 | show_bgp_views_cmd, | |
8001 | "show bgp views", | |
8002 | SHOW_STR | |
8003 | BGP_STR | |
8004 | "Show the defined BGP views\n") | |
8005 | { | |
8006 | struct list *inst = bm->bgp; | |
8007 | struct listnode *node; | |
8008 | struct bgp *bgp; | |
8009 | ||
8010 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
8011 | { | |
8012 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); | |
8013 | return CMD_WARNING; | |
8014 | } | |
8015 | ||
8016 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
8017 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
8018 | vty_out (vty, "\t%s (AS%u)%s", | |
8019 | bgp->name ? bgp->name : "(null)", | |
8020 | bgp->as, VTY_NEWLINE); | |
8021 | ||
8022 | return CMD_SUCCESS; | |
8023 | } | |
8024 | ||
4bf6a362 PJ |
8025 | DEFUN (show_bgp_memory, |
8026 | show_bgp_memory_cmd, | |
8027 | "show bgp memory", | |
8028 | SHOW_STR | |
8029 | BGP_STR | |
8030 | "Global BGP memory statistics\n") | |
8031 | { | |
8032 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
8033 | unsigned long count; | |
8034 | ||
8035 | /* RIB related usage stats */ | |
8036 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
8037 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
8038 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8039 | count * sizeof (struct bgp_node)), | |
8040 | VTY_NEWLINE); | |
8041 | ||
8042 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
8043 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
8044 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8045 | count * sizeof (struct bgp_info)), | |
8046 | VTY_NEWLINE); | |
fb982c25 PJ |
8047 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
8048 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
8049 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8050 | count * sizeof (struct bgp_info_extra)), | |
8051 | VTY_NEWLINE); | |
4bf6a362 PJ |
8052 | |
8053 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
8054 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
8055 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8056 | count * sizeof (struct bgp_static)), | |
8057 | VTY_NEWLINE); | |
3f9c7369 DS |
8058 | |
8059 | if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET))) | |
8060 | vty_out (vty, "%ld Packets, using %s of memory%s", count, | |
8061 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8062 | count * sizeof (struct bpacket)), | |
8063 | VTY_NEWLINE); | |
4bf6a362 PJ |
8064 | |
8065 | /* Adj-In/Out */ | |
8066 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
8067 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
8068 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8069 | count * sizeof (struct bgp_adj_in)), | |
8070 | VTY_NEWLINE); | |
8071 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
8072 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
8073 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8074 | count * sizeof (struct bgp_adj_out)), | |
8075 | VTY_NEWLINE); | |
8076 | ||
8077 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
8078 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
8079 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8080 | count * sizeof (struct bgp_nexthop_cache)), | |
8081 | VTY_NEWLINE); | |
8082 | ||
8083 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
8084 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
8085 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8086 | count * sizeof (struct bgp_damp_info)), | |
8087 | VTY_NEWLINE); | |
8088 | ||
8089 | /* Attributes */ | |
8090 | count = attr_count(); | |
8091 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
8092 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8093 | count * sizeof(struct attr)), | |
8094 | VTY_NEWLINE); | |
fb982c25 PJ |
8095 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
8096 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
8097 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8098 | count * sizeof(struct attr_extra)), | |
8099 | VTY_NEWLINE); | |
4bf6a362 PJ |
8100 | |
8101 | if ((count = attr_unknown_count())) | |
8102 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
8103 | ||
8104 | /* AS_PATH attributes */ | |
8105 | count = aspath_count (); | |
8106 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
8107 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8108 | count * sizeof (struct aspath)), | |
8109 | VTY_NEWLINE); | |
8110 | ||
8111 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
8112 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
8113 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8114 | count * sizeof (struct assegment)), | |
8115 | VTY_NEWLINE); | |
8116 | ||
8117 | /* Other attributes */ | |
8118 | if ((count = community_count ())) | |
8119 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
8120 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8121 | count * sizeof (struct community)), | |
8122 | VTY_NEWLINE); | |
8123 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
8124 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
8125 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8126 | count * sizeof (struct ecommunity)), | |
8127 | VTY_NEWLINE); | |
8128 | ||
8129 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
8130 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
8131 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8132 | count * sizeof (struct cluster_list)), | |
8133 | VTY_NEWLINE); | |
8134 | ||
8135 | /* Peer related usage */ | |
8136 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
8137 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
8138 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8139 | count * sizeof (struct peer)), | |
8140 | VTY_NEWLINE); | |
8141 | ||
8142 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) | |
8143 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, | |
8144 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8145 | count * sizeof (struct peer_group)), | |
8146 | VTY_NEWLINE); | |
8147 | ||
8148 | /* Other */ | |
8149 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
8150 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
8151 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8152 | count * sizeof (struct hash)), | |
8153 | VTY_NEWLINE); | |
8154 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
8155 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
8156 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8157 | count * sizeof (struct hash_backet)), | |
8158 | VTY_NEWLINE); | |
8159 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
8160 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
8161 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8162 | count * sizeof (regex_t)), | |
8163 | VTY_NEWLINE); | |
8164 | return CMD_SUCCESS; | |
8165 | } | |
fee0f4c6 | 8166 | |
47fc97cc DS |
8167 | static int |
8168 | bgp_adj_out_count (struct peer *peer, int afi, int safi) | |
8169 | { | |
8170 | struct bgp_table *table; | |
8171 | struct bgp_node *rn; | |
8172 | struct bgp_adj_out *adj; | |
8173 | int count = 0; | |
8174 | ||
8175 | if (!peer) return(0); | |
8176 | ||
8177 | table = peer->bgp->rib[afi][safi]; | |
8178 | if (!table) return(0); | |
8179 | for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) | |
8180 | if (bgp_adj_out_lookup(peer, NULL, afi, safi, rn)) | |
8181 | count++; | |
8182 | return (count); | |
8183 | } | |
8184 | ||
718e3744 | 8185 | /* Show BGP peer's summary information. */ |
94f2b392 | 8186 | static int |
b05a1c8b DS |
8187 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, |
8188 | u_char use_json) | |
718e3744 | 8189 | { |
8190 | struct peer *peer; | |
1eb8ef25 | 8191 | struct listnode *node, *nnode; |
f14e6fdb DS |
8192 | unsigned int count = 0, dn_count = 0; |
8193 | char timebuf[BGP_UPTIME_LEN], dn_flag[2]; | |
718e3744 | 8194 | int len; |
f14e6fdb | 8195 | struct peer_group *group; |
b05a1c8b DS |
8196 | json_object *json; |
8197 | json_object *json_int; | |
8198 | json_object *json_string; | |
8199 | json_object *json_peer; | |
8200 | json_object *json_peers; | |
8201 | json_object *json_boolean_true; | |
718e3744 | 8202 | |
8203 | /* Header string for each address family. */ | |
8204 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; | |
47fc97cc DS |
8205 | static char header_csv[] = "Neighbor, V, AS, MsgRcvd, MsgSent, TblVer, InQ, OutQ, Up/Down, State/PfxRcd, PfxAdv"; |
8206 | ||
b05a1c8b DS |
8207 | if (use_json) |
8208 | { | |
8209 | json = json_object_new_object(); | |
8210 | json_peers = json_object_new_array(); | |
8211 | json_boolean_true = json_object_new_boolean(1); | |
8212 | } | |
8213 | ||
1eb8ef25 | 8214 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 8215 | { |
1ff9a340 DS |
8216 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
8217 | continue; | |
8218 | ||
718e3744 | 8219 | if (peer->afc[afi][safi]) |
8220 | { | |
b05a1c8b | 8221 | if (!count) |
4bf6a362 PJ |
8222 | { |
8223 | unsigned long ents; | |
8224 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
b05a1c8b | 8225 | |
4bf6a362 | 8226 | /* Usage summary and header */ |
b05a1c8b DS |
8227 | if (use_json) |
8228 | { | |
8229 | json_string = json_object_new_string(inet_ntoa (bgp->router_id)); | |
8230 | json_object_object_add(json, "router-id", json_string); | |
8231 | ||
8232 | json_int = json_object_new_int(bgp->as); | |
8233 | json_object_object_add(json, "as", json_int); | |
8234 | } | |
8235 | else | |
8236 | { | |
8237 | vty_out (vty, | |
8238 | "BGP router identifier %s, local AS number %u%s", | |
8239 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); | |
8240 | } | |
8241 | ||
f188f2c4 DS |
8242 | if (bgp_update_delay_configured(bgp)) |
8243 | { | |
b05a1c8b | 8244 | if (use_json) |
f188f2c4 | 8245 | { |
b05a1c8b DS |
8246 | json_int = json_object_new_int(bgp->v_update_delay); |
8247 | json_object_object_add(json, "update-delay-limit", json_int); | |
8248 | ||
8249 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
8250 | { | |
8251 | json_int = json_object_new_int(bgp->v_establish_wait); | |
8252 | json_object_object_add(json, "update-delay-establish-wait", json_int); | |
8253 | } | |
8254 | ||
8255 | if (bgp_update_delay_active(bgp)) | |
8256 | { | |
8257 | json_string = json_object_new_string(bgp->update_delay_begin_time); | |
8258 | json_object_object_add(json, "update-delay-first-neighbor", json_string); | |
8259 | json_object_object_add(json, "update-delay-in-progress", json_boolean_true); | |
8260 | } | |
8261 | else | |
8262 | { | |
8263 | if (bgp->update_delay_over) | |
8264 | { | |
8265 | json_string = json_object_new_string(bgp->update_delay_begin_time); | |
8266 | json_object_object_add(json, "update-delay-first-neighbor", json_string); | |
8267 | ||
8268 | json_string = json_object_new_string(bgp->update_delay_end_time); | |
8269 | json_object_object_add(json, "update-delay-bestpath-resumed", json_string); | |
8270 | ||
8271 | json_string = json_object_new_string(bgp->update_delay_zebra_resume_time); | |
8272 | json_object_object_add(json, "update-delay-zebra-update-resume", json_string); | |
8273 | ||
8274 | json_string = json_object_new_string(bgp->update_delay_peers_resume_time); | |
8275 | json_object_object_add(json, "update-delay-peer-update-resume", json_string); | |
8276 | } | |
8277 | } | |
f188f2c4 DS |
8278 | } |
8279 | else | |
8280 | { | |
b05a1c8b DS |
8281 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", |
8282 | bgp->v_update_delay, VTY_NEWLINE); | |
8283 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
8284 | vty_out (vty, " Establish wait: %d seconds%s", | |
8285 | bgp->v_establish_wait, VTY_NEWLINE); | |
8286 | ||
8287 | if (bgp_update_delay_active(bgp)) | |
f188f2c4 DS |
8288 | { |
8289 | vty_out (vty, " First neighbor established: %s%s", | |
8290 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
b05a1c8b DS |
8291 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); |
8292 | } | |
8293 | else | |
8294 | { | |
8295 | if (bgp->update_delay_over) | |
8296 | { | |
8297 | vty_out (vty, " First neighbor established: %s%s", | |
8298 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
8299 | vty_out (vty, " Best-paths resumed: %s%s", | |
8300 | bgp->update_delay_end_time, VTY_NEWLINE); | |
8301 | vty_out (vty, " zebra update resumed: %s%s", | |
8302 | bgp->update_delay_zebra_resume_time, VTY_NEWLINE); | |
8303 | vty_out (vty, " peers update resumed: %s%s", | |
8304 | bgp->update_delay_peers_resume_time, VTY_NEWLINE); | |
8305 | } | |
f188f2c4 DS |
8306 | } |
8307 | } | |
8308 | } | |
4bf6a362 | 8309 | |
b05a1c8b DS |
8310 | if (use_json) |
8311 | { | |
8312 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
8313 | json_object_object_add(json, "max-med-on-startup", json_boolean_true); | |
8314 | if (bgp->v_maxmed_admin) | |
8315 | json_object_object_add(json, "max-med-administrative", json_boolean_true); | |
8316 | ||
8317 | json_int = json_object_new_int(bgp_table_version(bgp->rib[afi][safi])); | |
8318 | json_object_object_add(json, "table-version", json_int); | |
8319 | ||
8320 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
8321 | json_int = json_object_new_int(ents); | |
8322 | json_object_object_add(json, "rib-count", json_int); | |
8323 | json_int = json_object_new_int(ents * sizeof (struct bgp_node)); | |
8324 | json_object_object_add(json, "rib-memory", json_int); | |
8325 | ||
8326 | ents = listcount (bgp->peer); | |
8327 | json_int = json_object_new_int(ents); | |
8328 | json_object_object_add(json, "peer-count", json_int); | |
8329 | json_int = json_object_new_int(ents * sizeof (struct peer)); | |
8330 | json_object_object_add(json, "peer-memory", json_int); | |
8331 | ||
8332 | if ((ents = listcount (bgp->rsclient))) | |
8333 | { | |
8334 | json_int = json_object_new_int(ents); | |
8335 | json_object_object_add(json, "rsclient-count", json_int); | |
8336 | json_int = json_object_new_int(ents * sizeof (struct peer)); | |
8337 | json_object_object_add(json, "rsclient-memory", json_int); | |
8338 | } | |
abc920f8 | 8339 | |
b05a1c8b DS |
8340 | if ((ents = listcount (bgp->group))) |
8341 | { | |
8342 | json_int = json_object_new_int(ents); | |
8343 | json_object_object_add(json, "peer-group-count", json_int); | |
8344 | json_int = json_object_new_int(ents * sizeof (struct peer_group)); | |
8345 | json_object_object_add(json, "peer-group-memory", json_int); | |
8346 | } | |
3f9c7369 | 8347 | |
b05a1c8b DS |
8348 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
8349 | json_object_object_add(json, "dampening-enabled", json_boolean_true); | |
8350 | } | |
8351 | else | |
8352 | { | |
8353 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
8354 | vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE); | |
8355 | if (bgp->v_maxmed_admin) | |
8356 | vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE); | |
8357 | ||
8358 | vty_out(vty, "BGP table version %llu%s", | |
8359 | bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE); | |
8360 | ||
8361 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
8362 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
8363 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8364 | ents * sizeof (struct bgp_node)), | |
8365 | VTY_NEWLINE); | |
8366 | ||
8367 | /* Peer related usage */ | |
8368 | ents = listcount (bgp->peer); | |
8369 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
8370 | ents, | |
8371 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8372 | ents * sizeof (struct peer)), | |
8373 | VTY_NEWLINE); | |
8374 | ||
8375 | if ((ents = listcount (bgp->rsclient))) | |
8376 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", | |
8377 | ents, | |
8378 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8379 | ents * sizeof (struct peer)), | |
8380 | VTY_NEWLINE); | |
8381 | ||
8382 | if ((ents = listcount (bgp->group))) | |
8383 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
8384 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8385 | ents * sizeof (struct peer_group)), | |
8386 | VTY_NEWLINE); | |
8387 | ||
8388 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
8389 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
8390 | vty_out (vty, "%s", VTY_NEWLINE); | |
8391 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
8392 | } | |
4bf6a362 PJ |
8393 | } |
8394 | ||
b05a1c8b | 8395 | count++; |
718e3744 | 8396 | |
b05a1c8b DS |
8397 | if (use_json) |
8398 | { | |
8399 | json_peer = json_object_new_object(); | |
f14e6fdb | 8400 | |
b05a1c8b DS |
8401 | if (peer_dynamic_neighbor(peer)) |
8402 | json_object_object_add(json_peer, "dynamic-peer", json_boolean_true); | |
718e3744 | 8403 | |
b05a1c8b DS |
8404 | json_string = json_object_new_string(peer->host); |
8405 | json_object_object_add(json_peer, "ip", json_string); | |
8406 | ||
8407 | json_int = json_object_new_int(peer->as); | |
8408 | json_object_object_add(json_peer, "remote-as", json_int); | |
8409 | ||
8410 | json_int = json_object_new_int(4); | |
8411 | json_object_object_add(json_peer, "version", json_int); | |
8412 | ||
8413 | json_int = json_object_new_int(peer->open_in + peer->update_in + peer->keepalive_in | |
8414 | + peer->notify_in + peer->refresh_in | |
8415 | + peer->dynamic_cap_in); | |
8416 | json_object_object_add(json_peer, "msgrcvd", json_int); | |
8417 | ||
8418 | json_int = json_object_new_int(peer->open_out + peer->update_out + peer->keepalive_out | |
8419 | + peer->notify_out + peer->refresh_out | |
8420 | + peer->dynamic_cap_out); | |
8421 | json_object_object_add(json_peer, "msgsent", json_int); | |
8422 | ||
8423 | json_int = json_object_new_int(peer->version[afi][safi]); | |
8424 | json_object_object_add(json_peer, "table-version", json_int); | |
8425 | ||
8426 | json_int = json_object_new_int(peer->obuf->count); | |
8427 | json_object_object_add(json_peer, "outq", json_int); | |
8428 | ||
8429 | json_string = json_object_new_string(peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); | |
8430 | json_object_object_add(json_peer, "uptime", json_string); | |
8431 | ||
8432 | json_int = json_object_new_int(peer->pcount[afi][safi]); | |
8433 | json_object_object_add(json_peer, "prefix-received-count", json_int); | |
8434 | ||
8435 | json_int = json_object_new_int(bgp_adj_out_count(peer, afi, safi)); | |
8436 | json_object_object_add(json_peer, "prefix-advertised-count", json_int); | |
8437 | ||
8438 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
8439 | json_string = json_object_new_string("Idle (Admin)"); | |
8440 | ||
8441 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
8442 | json_string = json_object_new_string("Idle (PfxCt)"); | |
8443 | ||
8444 | else | |
8445 | json_string = json_object_new_string(LOOKUP(bgp_status_msg, peer->status)); | |
8446 | ||
8447 | json_object_object_add(json_peer, "state", json_string); | |
8448 | ||
8449 | json_object_array_add(json_peers, json_peer); | |
8450 | } | |
8451 | else | |
8452 | { | |
8453 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
8454 | if (peer_dynamic_neighbor(peer)) | |
8455 | { | |
8456 | dn_count++; | |
8457 | dn_flag[0] = '*'; | |
8458 | } | |
8459 | ||
8460 | len = vty_out (vty, "%s%s", dn_flag, peer->host); | |
8461 | len = 16 - len; | |
8462 | ||
8463 | if (len < 1) | |
8464 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
8465 | else | |
8466 | vty_out (vty, "%*s", len, " "); | |
8467 | ||
8468 | vty_out (vty, "4 "); | |
8469 | ||
8470 | vty_out (vty, "%5u %7d %7d %8lu %4d %4u ", | |
8471 | peer->as, | |
8472 | peer->open_in + peer->update_in + peer->keepalive_in | |
8473 | + peer->notify_in + peer->refresh_in | |
8474 | + peer->dynamic_cap_in, | |
8475 | peer->open_out + peer->update_out + peer->keepalive_out | |
8476 | + peer->notify_out + peer->refresh_out | |
8477 | + peer->dynamic_cap_out, | |
8478 | peer->version[afi][safi], | |
8479 | 0, | |
8480 | (unsigned long) peer->obuf->count); | |
8481 | ||
8482 | vty_out (vty, "%8s", | |
8483 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); | |
8484 | ||
8485 | if (peer->status == Established) | |
8486 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); | |
8487 | else | |
8488 | { | |
8489 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
8490 | vty_out (vty, " Idle (Admin)"); | |
8491 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
8492 | vty_out (vty, " Idle (PfxCt)"); | |
8493 | else | |
8494 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
8495 | } | |
8496 | vty_out (vty, "%s", VTY_NEWLINE); | |
8497 | } | |
718e3744 | 8498 | } |
8499 | } | |
8500 | ||
b05a1c8b DS |
8501 | if (use_json) |
8502 | { | |
8503 | json_object_object_add(json, "peers", json_peers); | |
8504 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
f14e6fdb | 8505 | |
b05a1c8b DS |
8506 | // Recursively free all json structures |
8507 | json_object_put(json); | |
8508 | } | |
8509 | else | |
f14e6fdb | 8510 | { |
b05a1c8b DS |
8511 | if (count) |
8512 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
8513 | count, VTY_NEWLINE); | |
8514 | else | |
8515 | vty_out (vty, "No %s neighbor is configured%s", | |
8516 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
8517 | ||
8518 | if (dn_count) | |
8519 | { | |
8520 | vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE); | |
8521 | vty_out(vty, | |
8522 | "%d dynamic neighbor(s), limit %d%s", | |
8523 | dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
8524 | } | |
f14e6fdb DS |
8525 | } |
8526 | ||
718e3744 | 8527 | return CMD_SUCCESS; |
8528 | } | |
8529 | ||
47fc97cc DS |
8530 | static int |
8531 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
b05a1c8b | 8532 | afi_t afi, safi_t safi, u_char use_json) |
718e3744 | 8533 | { |
8534 | struct bgp *bgp; | |
8535 | ||
8536 | if (name) | |
8537 | { | |
8538 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 8539 | |
718e3744 | 8540 | if (! bgp) |
8541 | { | |
47fc97cc | 8542 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 8543 | return CMD_WARNING; |
8544 | } | |
8545 | ||
b05a1c8b | 8546 | bgp_show_summary (vty, bgp, afi, safi, use_json); |
718e3744 | 8547 | return CMD_SUCCESS; |
8548 | } | |
47fc97cc | 8549 | |
718e3744 | 8550 | bgp = bgp_get_default (); |
8551 | ||
8552 | if (bgp) | |
b05a1c8b | 8553 | bgp_show_summary (vty, bgp, afi, safi, use_json); |
47fc97cc | 8554 | |
718e3744 | 8555 | return CMD_SUCCESS; |
8556 | } | |
8557 | ||
8558 | /* `show ip bgp summary' commands. */ | |
47fc97cc | 8559 | DEFUN (show_ip_bgp_summary, |
718e3744 | 8560 | show_ip_bgp_summary_cmd, |
b05a1c8b | 8561 | "show ip bgp summary {json}", |
47fc97cc DS |
8562 | SHOW_STR |
8563 | IP_STR | |
8564 | BGP_STR | |
b05a1c8b DS |
8565 | "Summary of BGP neighbor status\n" |
8566 | "JavaScript Object Notation\n") | |
47fc97cc | 8567 | { |
b05a1c8b DS |
8568 | u_char use_json = (argv[0] != NULL); |
8569 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, use_json); | |
718e3744 | 8570 | } |
8571 | ||
8572 | DEFUN (show_ip_bgp_instance_summary, | |
8573 | show_ip_bgp_instance_summary_cmd, | |
b05a1c8b | 8574 | "show ip bgp view WORD summary {json}", |
718e3744 | 8575 | SHOW_STR |
8576 | IP_STR | |
8577 | BGP_STR | |
8578 | "BGP view\n" | |
8579 | "View name\n" | |
b05a1c8b DS |
8580 | "Summary of BGP neighbor status\n" |
8581 | "JavaScript Object Notation\n") | |
718e3744 | 8582 | { |
b05a1c8b DS |
8583 | u_char use_json = (argv[1] != NULL); |
8584 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, use_json); | |
718e3744 | 8585 | } |
8586 | ||
8587 | DEFUN (show_ip_bgp_ipv4_summary, | |
8588 | show_ip_bgp_ipv4_summary_cmd, | |
b05a1c8b | 8589 | "show ip bgp ipv4 (unicast|multicast) summary {json}", |
718e3744 | 8590 | SHOW_STR |
8591 | IP_STR | |
8592 | BGP_STR | |
8593 | "Address family\n" | |
8594 | "Address Family modifier\n" | |
8595 | "Address Family modifier\n" | |
b05a1c8b DS |
8596 | "Summary of BGP neighbor status\n" |
8597 | "JavaScript Object Notation\n") | |
718e3744 | 8598 | { |
b05a1c8b | 8599 | u_char use_json = (argv[1] != NULL); |
718e3744 | 8600 | if (strncmp (argv[0], "m", 1) == 0) |
b05a1c8b | 8601 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, use_json); |
718e3744 | 8602 | |
b05a1c8b | 8603 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, use_json); |
718e3744 | 8604 | } |
8605 | ||
95cbbd2a ML |
8606 | ALIAS (show_ip_bgp_ipv4_summary, |
8607 | show_bgp_ipv4_safi_summary_cmd, | |
b05a1c8b | 8608 | "show bgp ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8609 | SHOW_STR |
8610 | BGP_STR | |
8611 | "Address family\n" | |
8612 | "Address Family modifier\n" | |
8613 | "Address Family modifier\n" | |
8614 | "Summary of BGP neighbor status\n") | |
8615 | ||
718e3744 | 8616 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
8617 | show_ip_bgp_instance_ipv4_summary_cmd, | |
b05a1c8b | 8618 | "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}", |
718e3744 | 8619 | SHOW_STR |
8620 | IP_STR | |
8621 | BGP_STR | |
8622 | "BGP view\n" | |
8623 | "View name\n" | |
8624 | "Address family\n" | |
8625 | "Address Family modifier\n" | |
8626 | "Address Family modifier\n" | |
b05a1c8b DS |
8627 | "Summary of BGP neighbor status\n" |
8628 | "JavaScript Object Notation\n") | |
718e3744 | 8629 | { |
b05a1c8b | 8630 | u_char use_json = (argv[2] != NULL); |
718e3744 | 8631 | if (strncmp (argv[1], "m", 1) == 0) |
b05a1c8b | 8632 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, use_json); |
718e3744 | 8633 | else |
b05a1c8b | 8634 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, use_json); |
718e3744 | 8635 | } |
8636 | ||
95cbbd2a ML |
8637 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
8638 | show_bgp_instance_ipv4_safi_summary_cmd, | |
b05a1c8b | 8639 | "show bgp view WORD ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8640 | SHOW_STR |
8641 | BGP_STR | |
8642 | "BGP view\n" | |
8643 | "View name\n" | |
8644 | "Address family\n" | |
8645 | "Address Family modifier\n" | |
8646 | "Address Family modifier\n" | |
8647 | "Summary of BGP neighbor status\n") | |
8648 | ||
718e3744 | 8649 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
8650 | show_ip_bgp_vpnv4_all_summary_cmd, | |
b05a1c8b | 8651 | "show ip bgp vpnv4 all summary {json}", |
718e3744 | 8652 | SHOW_STR |
8653 | IP_STR | |
8654 | BGP_STR | |
8655 | "Display VPNv4 NLRI specific information\n" | |
8656 | "Display information about all VPNv4 NLRIs\n" | |
b05a1c8b DS |
8657 | "Summary of BGP neighbor status\n" |
8658 | "JavaScript Object Notation\n") | |
718e3744 | 8659 | { |
b05a1c8b DS |
8660 | u_char use_json = (argv[0] != NULL); |
8661 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json); | |
718e3744 | 8662 | } |
8663 | ||
8664 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
8665 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
b05a1c8b | 8666 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}", |
718e3744 | 8667 | SHOW_STR |
8668 | IP_STR | |
8669 | BGP_STR | |
8670 | "Display VPNv4 NLRI specific information\n" | |
8671 | "Display information for a route distinguisher\n" | |
8672 | "VPN Route Distinguisher\n" | |
b05a1c8b DS |
8673 | "Summary of BGP neighbor status\n" |
8674 | "JavaScript Object Notation\n") | |
718e3744 | 8675 | { |
8676 | int ret; | |
8677 | struct prefix_rd prd; | |
b05a1c8b | 8678 | u_char use_json = (argv[1] != NULL); |
718e3744 | 8679 | |
8680 | ret = str2prefix_rd (argv[0], &prd); | |
8681 | if (! ret) | |
8682 | { | |
8683 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
8684 | return CMD_WARNING; | |
8685 | } | |
8686 | ||
b05a1c8b | 8687 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json); |
718e3744 | 8688 | } |
8689 | ||
8690 | #ifdef HAVE_IPV6 | |
47fc97cc | 8691 | DEFUN (show_bgp_summary, |
718e3744 | 8692 | show_bgp_summary_cmd, |
b05a1c8b | 8693 | "show bgp summary {json}", |
718e3744 | 8694 | SHOW_STR |
8695 | BGP_STR | |
b05a1c8b DS |
8696 | "Summary of BGP neighbor status\n" |
8697 | "JavaScript Object Notation\n") | |
718e3744 | 8698 | { |
b05a1c8b DS |
8699 | u_char use_json = (argv[0] != NULL); |
8700 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json); | |
718e3744 | 8701 | } |
8702 | ||
8703 | DEFUN (show_bgp_instance_summary, | |
8704 | show_bgp_instance_summary_cmd, | |
b05a1c8b | 8705 | "show bgp view WORD summary {json}", |
718e3744 | 8706 | SHOW_STR |
8707 | BGP_STR | |
8708 | "BGP view\n" | |
8709 | "View name\n" | |
b05a1c8b DS |
8710 | "Summary of BGP neighbor status\n" |
8711 | "JavaScript Object Notation\n") | |
718e3744 | 8712 | { |
b05a1c8b DS |
8713 | u_char use_json = (argv[1] != NULL); |
8714 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, use_json); | |
718e3744 | 8715 | } |
8716 | ||
8717 | ALIAS (show_bgp_summary, | |
8718 | show_bgp_ipv6_summary_cmd, | |
b05a1c8b | 8719 | "show bgp ipv6 summary {json}", |
718e3744 | 8720 | SHOW_STR |
8721 | BGP_STR | |
8722 | "Address family\n" | |
8723 | "Summary of BGP neighbor status\n") | |
8724 | ||
8725 | ALIAS (show_bgp_instance_summary, | |
8726 | show_bgp_instance_ipv6_summary_cmd, | |
b05a1c8b | 8727 | "show bgp view WORD ipv6 summary {json}", |
718e3744 | 8728 | SHOW_STR |
8729 | BGP_STR | |
8730 | "BGP view\n" | |
8731 | "View name\n" | |
8732 | "Address family\n" | |
8733 | "Summary of BGP neighbor status\n") | |
8734 | ||
95cbbd2a ML |
8735 | DEFUN (show_bgp_ipv6_safi_summary, |
8736 | show_bgp_ipv6_safi_summary_cmd, | |
b05a1c8b | 8737 | "show bgp ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8738 | SHOW_STR |
8739 | BGP_STR | |
8740 | "Address family\n" | |
8741 | "Address Family modifier\n" | |
8742 | "Address Family modifier\n" | |
b05a1c8b DS |
8743 | "Summary of BGP neighbor status\n" |
8744 | "JavaScript Object Notation\n") | |
95cbbd2a | 8745 | { |
b05a1c8b | 8746 | u_char use_json = (argv[1] != NULL); |
95cbbd2a | 8747 | if (strncmp (argv[0], "m", 1) == 0) |
b05a1c8b | 8748 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, use_json); |
95cbbd2a | 8749 | |
b05a1c8b | 8750 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json); |
95cbbd2a ML |
8751 | } |
8752 | ||
8753 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
8754 | show_bgp_instance_ipv6_safi_summary_cmd, | |
b05a1c8b | 8755 | "show bgp view WORD ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8756 | SHOW_STR |
8757 | BGP_STR | |
8758 | "BGP view\n" | |
8759 | "View name\n" | |
8760 | "Address family\n" | |
8761 | "Address Family modifier\n" | |
8762 | "Address Family modifier\n" | |
b05a1c8b DS |
8763 | "Summary of BGP neighbor status\n" |
8764 | "JavaScript Object Notation\n") | |
95cbbd2a | 8765 | { |
b05a1c8b | 8766 | u_char use_json = (argv[2] != NULL); |
95cbbd2a | 8767 | if (strncmp (argv[1], "m", 1) == 0) |
b05a1c8b | 8768 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST, use_json); |
95cbbd2a | 8769 | |
b05a1c8b | 8770 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, use_json); |
95cbbd2a ML |
8771 | } |
8772 | ||
718e3744 | 8773 | /* old command */ |
8774 | DEFUN (show_ipv6_bgp_summary, | |
8775 | show_ipv6_bgp_summary_cmd, | |
b05a1c8b | 8776 | "show ipv6 bgp summary {json}", |
718e3744 | 8777 | SHOW_STR |
8778 | IPV6_STR | |
8779 | BGP_STR | |
b05a1c8b DS |
8780 | "Summary of BGP neighbor status\n" |
8781 | "JavaScript Object Notation\n") | |
718e3744 | 8782 | { |
b05a1c8b DS |
8783 | u_char use_json = (argv[0] != NULL); |
8784 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json); | |
718e3744 | 8785 | } |
8786 | ||
8787 | /* old command */ | |
8788 | DEFUN (show_ipv6_mbgp_summary, | |
8789 | show_ipv6_mbgp_summary_cmd, | |
b05a1c8b | 8790 | "show ipv6 mbgp summary {json}", |
718e3744 | 8791 | SHOW_STR |
8792 | IPV6_STR | |
8793 | MBGP_STR | |
b05a1c8b DS |
8794 | "Summary of BGP neighbor status\n" |
8795 | "JavaScript Object Notation\n") | |
718e3744 | 8796 | { |
b05a1c8b DS |
8797 | u_char use_json = (argv[0] != NULL); |
8798 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, use_json); | |
718e3744 | 8799 | } |
8800 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 8801 | |
fd79ac91 | 8802 | const char * |
538621f2 | 8803 | afi_safi_print (afi_t afi, safi_t safi) |
8804 | { | |
8805 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
8806 | return "IPv4 Unicast"; | |
8807 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
8808 | return "IPv4 Multicast"; | |
8809 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
8810 | return "VPNv4 Unicast"; | |
8811 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) | |
8812 | return "IPv6 Unicast"; | |
8813 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
8814 | return "IPv6 Multicast"; | |
8815 | else | |
8816 | return "Unknown"; | |
8817 | } | |
8818 | ||
718e3744 | 8819 | /* Show BGP peer's information. */ |
8820 | enum show_type | |
8821 | { | |
8822 | show_all, | |
8823 | show_peer | |
8824 | }; | |
8825 | ||
94f2b392 | 8826 | static void |
718e3744 | 8827 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
8828 | afi_t afi, safi_t safi, | |
8829 | u_int16_t adv_smcap, u_int16_t adv_rmcap, | |
8830 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) | |
8831 | { | |
8832 | /* Send-Mode */ | |
8833 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
8834 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8835 | { | |
8836 | vty_out (vty, " Send-mode: "); | |
8837 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
8838 | vty_out (vty, "advertised"); | |
8839 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8840 | vty_out (vty, "%sreceived", | |
8841 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
8842 | ", " : ""); | |
8843 | vty_out (vty, "%s", VTY_NEWLINE); | |
8844 | } | |
8845 | ||
8846 | /* Receive-Mode */ | |
8847 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
8848 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
8849 | { | |
8850 | vty_out (vty, " Receive-mode: "); | |
8851 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
8852 | vty_out (vty, "advertised"); | |
8853 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
8854 | vty_out (vty, "%sreceived", | |
8855 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
8856 | ", " : ""); | |
8857 | vty_out (vty, "%s", VTY_NEWLINE); | |
8858 | } | |
8859 | } | |
8860 | ||
94f2b392 | 8861 | static void |
718e3744 | 8862 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
8863 | { | |
8864 | struct bgp_filter *filter; | |
3f9c7369 | 8865 | struct peer_af *paf; |
718e3744 | 8866 | char orf_pfx_name[BUFSIZ]; |
8867 | int orf_pfx_count; | |
8868 | ||
8869 | filter = &p->filter[afi][safi]; | |
8870 | ||
538621f2 | 8871 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
718e3744 | 8872 | VTY_NEWLINE); |
538621f2 | 8873 | |
718e3744 | 8874 | if (p->af_group[afi][safi]) |
8875 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); | |
8876 | ||
3f9c7369 DS |
8877 | paf = peer_af_find(p, afi, safi); |
8878 | if (paf && PAF_SUBGRP(paf)) | |
8879 | { | |
8880 | vty_out (vty, " Update group %llu, subgroup %llu%s", | |
8881 | PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE); | |
8882 | vty_out (vty, " Packet Queue length %d%s", | |
8883 | bpacket_queue_virtual_length(paf), VTY_NEWLINE); | |
8884 | } else | |
8885 | { | |
8886 | vty_out(vty, " Not part of any update group%s", VTY_NEWLINE); | |
8887 | } | |
718e3744 | 8888 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
8889 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
8890 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
8891 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
8892 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
8893 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
8894 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
8895 | ||
8896 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
8897 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
8898 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
8899 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
8900 | { | |
8901 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
8902 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
8903 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
8904 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
8905 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
8906 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
8907 | PEER_CAP_ORF_PREFIX_RM_RCV); | |
8908 | } | |
8909 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
8910 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
8911 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
8912 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
8913 | { | |
8914 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
8915 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
8916 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
8917 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
8918 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
8919 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
8920 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); | |
8921 | } | |
8922 | ||
8923 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
8924 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); | |
8925 | ||
8926 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
8927 | || orf_pfx_count) | |
8928 | { | |
8929 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
8930 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
8931 | vty_out (vty, " sent;"); | |
8932 | if (orf_pfx_count) | |
8933 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
8934 | vty_out (vty, "%s", VTY_NEWLINE); | |
8935 | } | |
8936 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
8937 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
8938 | ||
8939 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
8940 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
8941 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
8942 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
8943 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
8944 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
5000f21c DS |
8945 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) |
8946 | vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE); | |
8947 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) | |
8948 | vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE); | |
8949 | ||
c7122e14 DS |
8950 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
8951 | vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE); | |
8952 | ||
5000f21c DS |
8953 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || |
8954 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF_ALL)) | |
718e3744 | 8955 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
8956 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
8957 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
8958 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
8959 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
8960 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
8961 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
8962 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
8963 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
8964 | { | |
8965 | vty_out (vty, " Community attribute sent to this neighbor"); | |
8966 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
8967 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
538621f2 | 8968 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
718e3744 | 8969 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
538621f2 | 8970 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
718e3744 | 8971 | else |
538621f2 | 8972 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
718e3744 | 8973 | } |
8974 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
8975 | { | |
8976 | vty_out (vty, " Default information originate,"); | |
8977 | ||
8978 | if (p->default_rmap[afi][safi].name) | |
8979 | vty_out (vty, " default route-map %s%s,", | |
8980 | p->default_rmap[afi][safi].map ? "*" : "", | |
8981 | p->default_rmap[afi][safi].name); | |
3f9c7369 DS |
8982 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, |
8983 | SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
718e3744 | 8984 | vty_out (vty, " default sent%s", VTY_NEWLINE); |
8985 | else | |
8986 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
8987 | } | |
8988 | ||
8989 | if (filter->plist[FILTER_IN].name | |
8990 | || filter->dlist[FILTER_IN].name | |
8991 | || filter->aslist[FILTER_IN].name | |
fee0f4c6 | 8992 | || filter->map[RMAP_IN].name) |
718e3744 | 8993 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
8994 | if (filter->plist[FILTER_OUT].name | |
8995 | || filter->dlist[FILTER_OUT].name | |
8996 | || filter->aslist[FILTER_OUT].name | |
fee0f4c6 | 8997 | || filter->map[RMAP_OUT].name |
718e3744 | 8998 | || filter->usmap.name) |
8999 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
fee0f4c6 | 9000 | if (filter->map[RMAP_IMPORT].name) |
9001 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); | |
9002 | if (filter->map[RMAP_EXPORT].name) | |
9003 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); | |
718e3744 | 9004 | |
9005 | /* prefix-list */ | |
9006 | if (filter->plist[FILTER_IN].name) | |
9007 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
9008 | filter->plist[FILTER_IN].plist ? "*" : "", | |
9009 | filter->plist[FILTER_IN].name, | |
9010 | VTY_NEWLINE); | |
9011 | if (filter->plist[FILTER_OUT].name) | |
9012 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
9013 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
9014 | filter->plist[FILTER_OUT].name, | |
9015 | VTY_NEWLINE); | |
9016 | ||
9017 | /* distribute-list */ | |
9018 | if (filter->dlist[FILTER_IN].name) | |
9019 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
9020 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
9021 | filter->dlist[FILTER_IN].name, | |
9022 | VTY_NEWLINE); | |
9023 | if (filter->dlist[FILTER_OUT].name) | |
9024 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
9025 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
9026 | filter->dlist[FILTER_OUT].name, | |
9027 | VTY_NEWLINE); | |
9028 | ||
9029 | /* filter-list. */ | |
9030 | if (filter->aslist[FILTER_IN].name) | |
9031 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
9032 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
9033 | filter->aslist[FILTER_IN].name, | |
9034 | VTY_NEWLINE); | |
9035 | if (filter->aslist[FILTER_OUT].name) | |
9036 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
9037 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
9038 | filter->aslist[FILTER_OUT].name, | |
9039 | VTY_NEWLINE); | |
9040 | ||
9041 | /* route-map. */ | |
fee0f4c6 | 9042 | if (filter->map[RMAP_IN].name) |
718e3744 | 9043 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
fee0f4c6 | 9044 | filter->map[RMAP_IN].map ? "*" : "", |
9045 | filter->map[RMAP_IN].name, | |
718e3744 | 9046 | VTY_NEWLINE); |
fee0f4c6 | 9047 | if (filter->map[RMAP_OUT].name) |
718e3744 | 9048 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
fee0f4c6 | 9049 | filter->map[RMAP_OUT].map ? "*" : "", |
9050 | filter->map[RMAP_OUT].name, | |
9051 | VTY_NEWLINE); | |
9052 | if (filter->map[RMAP_IMPORT].name) | |
9053 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", | |
9054 | filter->map[RMAP_IMPORT].map ? "*" : "", | |
9055 | filter->map[RMAP_IMPORT].name, | |
9056 | VTY_NEWLINE); | |
9057 | if (filter->map[RMAP_EXPORT].name) | |
9058 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", | |
9059 | filter->map[RMAP_EXPORT].map ? "*" : "", | |
9060 | filter->map[RMAP_EXPORT].name, | |
718e3744 | 9061 | VTY_NEWLINE); |
9062 | ||
9063 | /* unsuppress-map */ | |
9064 | if (filter->usmap.name) | |
9065 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
9066 | filter->usmap.map ? "*" : "", | |
9067 | filter->usmap.name, VTY_NEWLINE); | |
9068 | ||
9069 | /* Receive prefix count */ | |
e0701b79 | 9070 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
9071 | ||
718e3744 | 9072 | /* Maximum prefix */ |
9073 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
9074 | { | |
0a486e5f | 9075 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
718e3744 | 9076 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
0a486e5f | 9077 | ? " (warning-only)" : "", VTY_NEWLINE); |
9078 | vty_out (vty, " Threshold for warning message %d%%", | |
9079 | p->pmax_threshold[afi][safi]); | |
9080 | if (p->pmax_restart[afi][safi]) | |
9081 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
9082 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 9083 | } |
718e3744 | 9084 | |
9085 | vty_out (vty, "%s", VTY_NEWLINE); | |
9086 | } | |
9087 | ||
94f2b392 | 9088 | static void |
718e3744 | 9089 | bgp_show_peer (struct vty *vty, struct peer *p) |
9090 | { | |
9091 | struct bgp *bgp; | |
a80beece | 9092 | char buf1[BUFSIZ], buf[SU_ADDRSTRLEN]; |
718e3744 | 9093 | char timebuf[BGP_UPTIME_LEN]; |
f14e6fdb | 9094 | char dn_flag[2]; |
538621f2 | 9095 | afi_t afi; |
9096 | safi_t safi; | |
d6661008 DS |
9097 | u_int16_t i; |
9098 | u_char *msg; | |
718e3744 | 9099 | |
9100 | bgp = p->bgp; | |
9101 | ||
a80beece DS |
9102 | if (p->conf_if) /* Configured interface name. */ |
9103 | vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if, | |
9104 | BGP_PEER_SU_UNSPEC(p) ? "None" : | |
9105 | sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
9106 | else /* Configured IP address. */ | |
f14e6fdb DS |
9107 | { |
9108 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
9109 | if (peer_dynamic_neighbor(p)) | |
9110 | dn_flag[0] = '*'; | |
9111 | ||
9112 | vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host); | |
9113 | } | |
9114 | ||
aea339f7 | 9115 | vty_out (vty, "remote AS %u, ", p->as); |
9d3f9705 | 9116 | vty_out (vty, "local AS %u%s%s, ", |
718e3744 | 9117 | p->change_local_as ? p->change_local_as : p->local_as, |
9118 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
9d3f9705 AC |
9119 | " no-prepend" : "", |
9120 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
9121 | " replace-as" : ""); | |
718e3744 | 9122 | vty_out (vty, "%s link%s", |
9123 | p->as == p->local_as ? "internal" : "external", | |
9124 | VTY_NEWLINE); | |
9125 | ||
9126 | /* Description. */ | |
9127 | if (p->desc) | |
9128 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
9129 | ||
9130 | /* Peer-group */ | |
9131 | if (p->group) | |
f14e6fdb DS |
9132 | { |
9133 | vty_out (vty, " Member of peer-group %s for session parameters%s", | |
9134 | p->group->name, VTY_NEWLINE); | |
9135 | ||
9136 | if (dn_flag[0]) | |
9137 | { | |
9138 | struct prefix *prefix = NULL, *range = NULL; | |
9139 | ||
9140 | prefix = sockunion2hostprefix(&(p->su)); | |
9141 | if (prefix) | |
9142 | range = peer_group_lookup_dynamic_neighbor_range (p->group, | |
9143 | prefix); | |
9144 | if (range) | |
9145 | { | |
9146 | prefix2str(range, buf1, sizeof(buf1)); | |
9147 | vty_out (vty, " Belongs to the subnet range group: %s%s", | |
9148 | buf1, VTY_NEWLINE); | |
9149 | } | |
9150 | } | |
9151 | } | |
718e3744 | 9152 | |
9153 | /* Administrative shutdown. */ | |
9154 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
9155 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
9156 | ||
9157 | /* BGP Version. */ | |
9158 | vty_out (vty, " BGP version 4"); | |
718e3744 | 9159 | vty_out (vty, ", remote router ID %s%s", |
9160 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
9161 | VTY_NEWLINE); | |
9162 | ||
9163 | /* Confederation */ | |
e0701b79 | 9164 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
9165 | && bgp_confederation_peers_check (bgp, p->as)) | |
718e3744 | 9166 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
9167 | ||
9168 | /* Status. */ | |
9169 | vty_out (vty, " BGP state = %s", | |
9170 | LOOKUP (bgp_status_msg, p->status)); | |
9171 | if (p->status == Established) | |
9172 | vty_out (vty, ", up for %8s", | |
9173 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); | |
93406d87 | 9174 | else if (p->status == Active) |
9175 | { | |
9176 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
9177 | vty_out (vty, " (passive)"); | |
9178 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
9179 | vty_out (vty, " (NSF passive)"); | |
9180 | } | |
718e3744 | 9181 | vty_out (vty, "%s", VTY_NEWLINE); |
9182 | ||
9183 | /* read timer */ | |
9184 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); | |
cb1faec9 DS |
9185 | vty_out (vty, ", Last write %s%s", |
9186 | peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN), VTY_NEWLINE); | |
718e3744 | 9187 | |
9188 | /* Configured timer values. */ | |
cb1faec9 | 9189 | vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s", |
718e3744 | 9190 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
9191 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
9192 | { | |
9193 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
9194 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
9195 | p->keepalive, VTY_NEWLINE); | |
9196 | } | |
93406d87 | 9197 | |
718e3744 | 9198 | /* Capability. */ |
9199 | if (p->status == Established) | |
9200 | { | |
538621f2 | 9201 | if (p->cap |
718e3744 | 9202 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
9203 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
9204 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
9205 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
9206 | #ifdef HAVE_IPV6 | |
9207 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
9208 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
9209 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
9210 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
9211 | #endif /* HAVE_IPV6 */ | |
9212 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] | |
9213 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
9214 | { | |
9215 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
9216 | ||
0b2aa3a0 PJ |
9217 | /* AS4 */ |
9218 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
9219 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9220 | { | |
9221 | vty_out (vty, " 4 Byte AS:"); | |
9222 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9223 | vty_out (vty, " advertised"); | |
9224 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
9225 | vty_out (vty, " %sreceived", | |
9226 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
9227 | vty_out (vty, "%s", VTY_NEWLINE); | |
9228 | } | |
a82478b9 DS |
9229 | |
9230 | /* AddPath */ | |
9231 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
9232 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
9233 | { | |
9234 | vty_out (vty, " AddPath:%s", VTY_NEWLINE); | |
9235 | ||
9236 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9237 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9238 | { | |
9239 | ||
9240 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
9241 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
9242 | { | |
9243 | vty_out (vty, " %s: TX ", afi_safi_print (afi, safi)); | |
9244 | ||
9245 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) | |
9246 | vty_out (vty, "advertised", afi_safi_print (afi, safi)); | |
9247 | ||
9248 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
9249 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" ); | |
9250 | ||
9251 | vty_out (vty, "%s", VTY_NEWLINE); | |
9252 | } | |
9253 | ||
9254 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
9255 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9256 | { | |
9257 | vty_out (vty, " %s: RX ", afi_safi_print (afi, safi)); | |
9258 | ||
9259 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) | |
9260 | vty_out (vty, "advertised", afi_safi_print (afi, safi)); | |
9261 | ||
9262 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9263 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" ); | |
9264 | ||
9265 | vty_out (vty, "%s", VTY_NEWLINE); | |
9266 | } | |
9267 | } | |
9268 | } | |
9269 | ||
718e3744 | 9270 | /* Dynamic */ |
9271 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
9272 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9273 | { | |
9274 | vty_out (vty, " Dynamic:"); | |
9275 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9276 | vty_out (vty, " advertised"); | |
9277 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
538621f2 | 9278 | vty_out (vty, " %sreceived", |
9279 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
718e3744 | 9280 | vty_out (vty, "%s", VTY_NEWLINE); |
9281 | } | |
9282 | ||
9283 | /* Route Refresh */ | |
9284 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
9285 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
9286 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9287 | { | |
9288 | vty_out (vty, " Route refresh:"); | |
9289 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
9290 | vty_out (vty, " advertised"); | |
9291 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
9292 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
538621f2 | 9293 | vty_out (vty, " %sreceived(%s)", |
9294 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
9295 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
9296 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
9297 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
718e3744 | 9298 | |
718e3744 | 9299 | vty_out (vty, "%s", VTY_NEWLINE); |
9300 | } | |
538621f2 | 9301 | |
9302 | /* Multiprotocol Extensions */ | |
9303 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9304 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9305 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
718e3744 | 9306 | { |
538621f2 | 9307 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
9308 | if (p->afc_adv[afi][safi]) | |
9309 | vty_out (vty, " advertised"); | |
9310 | if (p->afc_recv[afi][safi]) | |
9311 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
9312 | vty_out (vty, "%s", VTY_NEWLINE); | |
9313 | } | |
9314 | ||
9315 | /* Gracefull Restart */ | |
9316 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
9317 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 9318 | { |
538621f2 | 9319 | vty_out (vty, " Graceful Restart Capabilty:"); |
9320 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 9321 | vty_out (vty, " advertised"); |
538621f2 | 9322 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
9323 | vty_out (vty, " %sreceived", | |
9324 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
718e3744 | 9325 | vty_out (vty, "%s", VTY_NEWLINE); |
538621f2 | 9326 | |
9327 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
718e3744 | 9328 | { |
538621f2 | 9329 | int restart_af_count = 0; |
9330 | ||
9331 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
93406d87 | 9332 | p->v_gr_restart, VTY_NEWLINE); |
9333 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
538621f2 | 9334 | |
9335 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9336 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9337 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
9338 | { | |
93406d87 | 9339 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
9340 | afi_safi_print (afi, safi), | |
9341 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
9342 | "preserved" : "not preserved"); | |
538621f2 | 9343 | restart_af_count++; |
93406d87 | 9344 | } |
538621f2 | 9345 | if (! restart_af_count) |
9346 | vty_out (vty, "none"); | |
9347 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 9348 | } |
718e3744 | 9349 | } |
718e3744 | 9350 | } |
9351 | } | |
9352 | ||
93406d87 | 9353 | /* graceful restart information */ |
9354 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
9355 | || p->t_gr_restart | |
9356 | || p->t_gr_stale) | |
9357 | { | |
9358 | int eor_send_af_count = 0; | |
9359 | int eor_receive_af_count = 0; | |
9360 | ||
9361 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
9362 | if (p->status == Established) | |
9363 | { | |
9364 | vty_out (vty, " End-of-RIB send: "); | |
9365 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9366 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9367 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
9368 | { | |
9369 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
9370 | afi_safi_print (afi, safi)); | |
9371 | eor_send_af_count++; | |
9372 | } | |
9373 | vty_out (vty, "%s", VTY_NEWLINE); | |
9374 | ||
9375 | vty_out (vty, " End-of-RIB received: "); | |
9376 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9377 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9378 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
9379 | { | |
9380 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
9381 | afi_safi_print (afi, safi)); | |
9382 | eor_receive_af_count++; | |
9383 | } | |
9384 | vty_out (vty, "%s", VTY_NEWLINE); | |
9385 | } | |
9386 | ||
9387 | if (p->t_gr_restart) | |
0b2aa3a0 PJ |
9388 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
9389 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
9390 | ||
93406d87 | 9391 | if (p->t_gr_stale) |
0b2aa3a0 PJ |
9392 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
9393 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
93406d87 | 9394 | } |
9395 | ||
718e3744 | 9396 | /* Packet counts. */ |
93406d87 | 9397 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
9398 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
0b2aa3a0 | 9399 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); |
93406d87 | 9400 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
9401 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
9402 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
9403 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
9404 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
9405 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
9406 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
9407 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
9408 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
9409 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
9410 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 9411 | |
9412 | /* advertisement-interval */ | |
9413 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
9414 | p->v_routeadv, VTY_NEWLINE); | |
9415 | ||
9416 | /* Update-source. */ | |
9417 | if (p->update_if || p->update_source) | |
9418 | { | |
9419 | vty_out (vty, " Update source is "); | |
9420 | if (p->update_if) | |
9421 | vty_out (vty, "%s", p->update_if); | |
9422 | else if (p->update_source) | |
9423 | vty_out (vty, "%s", | |
9424 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
9425 | vty_out (vty, "%s", VTY_NEWLINE); | |
9426 | } | |
9427 | ||
9428 | /* Default weight */ | |
9429 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
9430 | vty_out (vty, " Default weight %d%s", p->weight, | |
9431 | VTY_NEWLINE); | |
9432 | ||
9433 | vty_out (vty, "%s", VTY_NEWLINE); | |
9434 | ||
9435 | /* Address Family Information */ | |
538621f2 | 9436 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
9437 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9438 | if (p->afc[afi][safi]) | |
9439 | bgp_show_peer_afi (vty, p, afi, safi); | |
718e3744 | 9440 | |
9441 | vty_out (vty, " Connections established %d; dropped %d%s", | |
9442 | p->established, p->dropped, | |
9443 | VTY_NEWLINE); | |
9444 | ||
d6661008 | 9445 | if (! p->last_reset) |
e0701b79 | 9446 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
9447 | else | |
d6661008 DS |
9448 | { |
9449 | vty_out (vty, " Last reset %s, due to %s%s", | |
9450 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), | |
9451 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
9452 | ||
9453 | if (p->last_reset_cause_size) | |
9454 | { | |
9455 | msg = p->last_reset_cause; | |
9456 | vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); | |
9457 | for (i = 1; i <= p->last_reset_cause_size; i++) | |
9458 | { | |
9459 | vty_out(vty, "%02X", *msg++); | |
9460 | ||
9461 | if (i != p->last_reset_cause_size) | |
9462 | if (i % 16 == 0) | |
9463 | vty_out(vty, "%s ", VTY_NEWLINE); | |
9464 | else if (i % 4 == 0) | |
9465 | vty_out(vty, " "); | |
9466 | } | |
9467 | vty_out(vty, "%s", VTY_NEWLINE); | |
9468 | } | |
9469 | } | |
848973c7 | 9470 | |
718e3744 | 9471 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
9472 | { | |
9473 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 9474 | |
9475 | if (p->t_pmax_restart) | |
9476 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
9477 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
9478 | VTY_NEWLINE); | |
9479 | else | |
9480 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
9481 | p->host, VTY_NEWLINE); | |
718e3744 | 9482 | } |
9483 | ||
f5a4827d | 9484 | /* EBGP Multihop and GTSM */ |
6d85b15b | 9485 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d SH |
9486 | { |
9487 | if (p->gtsm_hops > 0) | |
9488 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
9489 | p->gtsm_hops, VTY_NEWLINE); | |
9490 | else if (p->ttl > 1) | |
9491 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
9492 | p->ttl, VTY_NEWLINE); | |
9493 | } | |
5d804b43 PM |
9494 | else |
9495 | { | |
9496 | if (p->gtsm_hops > 0) | |
9497 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
9498 | p->gtsm_hops, VTY_NEWLINE); | |
9499 | } | |
718e3744 | 9500 | |
9501 | /* Local address. */ | |
9502 | if (p->su_local) | |
9503 | { | |
93406d87 | 9504 | vty_out (vty, "Local host: %s, Local port: %d%s", |
718e3744 | 9505 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
9506 | ntohs (p->su_local->sin.sin_port), | |
718e3744 | 9507 | VTY_NEWLINE); |
9508 | } | |
9509 | ||
9510 | /* Remote address. */ | |
9511 | if (p->su_remote) | |
9512 | { | |
9513 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
9514 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), | |
9515 | ntohs (p->su_remote->sin.sin_port), | |
9516 | VTY_NEWLINE); | |
9517 | } | |
9518 | ||
9519 | /* Nexthop display. */ | |
9520 | if (p->su_local) | |
9521 | { | |
9522 | vty_out (vty, "Nexthop: %s%s", | |
9523 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
9524 | VTY_NEWLINE); | |
9525 | #ifdef HAVE_IPV6 | |
9526 | vty_out (vty, "Nexthop global: %s%s", | |
9527 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
9528 | VTY_NEWLINE); | |
9529 | vty_out (vty, "Nexthop local: %s%s", | |
9530 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
9531 | VTY_NEWLINE); | |
9532 | vty_out (vty, "BGP connection: %s%s", | |
9533 | p->shared_network ? "shared network" : "non shared network", | |
9534 | VTY_NEWLINE); | |
9535 | #endif /* HAVE_IPV6 */ | |
9536 | } | |
9537 | ||
9538 | /* Timer information. */ | |
9539 | if (p->t_start) | |
9540 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
9541 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
9542 | if (p->t_connect) | |
9543 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
9544 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
cb1faec9 | 9545 | if (p->t_routeadv) |
3f9c7369 | 9546 | vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s", |
cb1faec9 DS |
9547 | p->v_routeadv, thread_timer_remain_second (p->t_routeadv), |
9548 | VTY_NEWLINE); | |
9549 | ||
9550 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
718e3744 | 9551 | p->t_read ? "on" : "off", |
9552 | p->t_write ? "on" : "off", | |
9553 | VTY_NEWLINE); | |
9554 | ||
9555 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
9556 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
9557 | bgp_capability_vty_out (vty, p); | |
9558 | ||
9559 | vty_out (vty, "%s", VTY_NEWLINE); | |
9560 | } | |
9561 | ||
94f2b392 | 9562 | static int |
718e3744 | 9563 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
a80beece | 9564 | enum show_type type, union sockunion *su, const char *conf_if) |
718e3744 | 9565 | { |
1eb8ef25 | 9566 | struct listnode *node, *nnode; |
718e3744 | 9567 | struct peer *peer; |
9568 | int find = 0; | |
9569 | ||
1eb8ef25 | 9570 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 9571 | { |
1ff9a340 DS |
9572 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
9573 | continue; | |
9574 | ||
718e3744 | 9575 | switch (type) |
9576 | { | |
9577 | case show_all: | |
9578 | bgp_show_peer (vty, peer); | |
9579 | break; | |
9580 | case show_peer: | |
a80beece DS |
9581 | if (conf_if) |
9582 | { | |
9583 | if (peer->conf_if && !strcmp(peer->conf_if, conf_if)) | |
9584 | { | |
9585 | find = 1; | |
9586 | bgp_show_peer (vty, peer); | |
9587 | } | |
9588 | } | |
9589 | else | |
9590 | { | |
9591 | if (sockunion_same (&peer->su, su)) | |
9592 | { | |
9593 | find = 1; | |
9594 | bgp_show_peer (vty, peer); | |
9595 | } | |
9596 | } | |
718e3744 | 9597 | break; |
9598 | } | |
9599 | } | |
9600 | ||
9601 | if (type == show_peer && ! find) | |
9602 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
9603 | ||
9604 | return CMD_SUCCESS; | |
9605 | } | |
9606 | ||
94f2b392 | 9607 | static int |
fd79ac91 | 9608 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
9609 | enum show_type type, const char *ip_str) | |
718e3744 | 9610 | { |
9611 | int ret; | |
9612 | struct bgp *bgp; | |
9613 | union sockunion su; | |
9614 | ||
718e3744 | 9615 | if (name) |
9616 | { | |
9617 | bgp = bgp_lookup_by_name (name); | |
718e3744 | 9618 | if (! bgp) |
9619 | { | |
9620 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
9621 | return CMD_WARNING; | |
9622 | } | |
718e3744 | 9623 | } |
a80beece DS |
9624 | else |
9625 | { | |
9626 | bgp = bgp_get_default (); | |
9627 | } | |
718e3744 | 9628 | |
9629 | if (bgp) | |
a80beece DS |
9630 | { |
9631 | if (ip_str) | |
9632 | { | |
9633 | ret = str2sockunion (ip_str, &su); | |
9634 | if (ret < 0) | |
9635 | bgp_show_neighbor (vty, bgp, type, NULL, ip_str); | |
9636 | else | |
9637 | bgp_show_neighbor (vty, bgp, type, &su, NULL); | |
9638 | } | |
9639 | else | |
9640 | { | |
9641 | bgp_show_neighbor (vty, bgp, type, NULL, NULL); | |
9642 | } | |
9643 | } | |
718e3744 | 9644 | |
9645 | return CMD_SUCCESS; | |
9646 | } | |
9647 | ||
9648 | /* "show ip bgp neighbors" commands. */ | |
9649 | DEFUN (show_ip_bgp_neighbors, | |
9650 | show_ip_bgp_neighbors_cmd, | |
9651 | "show ip bgp neighbors", | |
9652 | SHOW_STR | |
9653 | IP_STR | |
9654 | BGP_STR | |
9655 | "Detailed information on TCP and BGP neighbor connections\n") | |
9656 | { | |
9657 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); | |
9658 | } | |
9659 | ||
9660 | ALIAS (show_ip_bgp_neighbors, | |
9661 | show_ip_bgp_ipv4_neighbors_cmd, | |
9662 | "show ip bgp ipv4 (unicast|multicast) neighbors", | |
9663 | SHOW_STR | |
9664 | IP_STR | |
9665 | BGP_STR | |
9666 | "Address family\n" | |
9667 | "Address Family modifier\n" | |
9668 | "Address Family modifier\n" | |
9669 | "Detailed information on TCP and BGP neighbor connections\n") | |
9670 | ||
9671 | ALIAS (show_ip_bgp_neighbors, | |
9672 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
9673 | "show ip bgp vpnv4 all neighbors", | |
9674 | SHOW_STR | |
9675 | IP_STR | |
9676 | BGP_STR | |
9677 | "Display VPNv4 NLRI specific information\n" | |
9678 | "Display information about all VPNv4 NLRIs\n" | |
9679 | "Detailed information on TCP and BGP neighbor connections\n") | |
9680 | ||
9681 | ALIAS (show_ip_bgp_neighbors, | |
9682 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
9683 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", | |
9684 | SHOW_STR | |
9685 | IP_STR | |
9686 | BGP_STR | |
9687 | "Display VPNv4 NLRI specific information\n" | |
9688 | "Display information for a route distinguisher\n" | |
9689 | "VPN Route Distinguisher\n" | |
9690 | "Detailed information on TCP and BGP neighbor connections\n") | |
9691 | ||
9692 | ALIAS (show_ip_bgp_neighbors, | |
9693 | show_bgp_neighbors_cmd, | |
9694 | "show bgp neighbors", | |
9695 | SHOW_STR | |
9696 | BGP_STR | |
9697 | "Detailed information on TCP and BGP neighbor connections\n") | |
9698 | ||
9699 | ALIAS (show_ip_bgp_neighbors, | |
9700 | show_bgp_ipv6_neighbors_cmd, | |
9701 | "show bgp ipv6 neighbors", | |
9702 | SHOW_STR | |
9703 | BGP_STR | |
9704 | "Address family\n" | |
9705 | "Detailed information on TCP and BGP neighbor connections\n") | |
9706 | ||
9707 | DEFUN (show_ip_bgp_neighbors_peer, | |
9708 | show_ip_bgp_neighbors_peer_cmd, | |
a80beece | 9709 | "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9710 | SHOW_STR |
9711 | IP_STR | |
9712 | BGP_STR | |
9713 | "Detailed information on TCP and BGP neighbor connections\n" | |
9714 | "Neighbor to display information about\n" | |
a80beece DS |
9715 | "Neighbor to display information about\n" |
9716 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9717 | { |
9718 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); | |
9719 | } | |
9720 | ||
9721 | ALIAS (show_ip_bgp_neighbors_peer, | |
9722 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
a80beece | 9723 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9724 | SHOW_STR |
9725 | IP_STR | |
9726 | BGP_STR | |
9727 | "Address family\n" | |
9728 | "Address Family modifier\n" | |
9729 | "Address Family modifier\n" | |
9730 | "Detailed information on TCP and BGP neighbor connections\n" | |
9731 | "Neighbor to display information about\n" | |
a80beece DS |
9732 | "Neighbor to display information about\n" |
9733 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9734 | |
9735 | ALIAS (show_ip_bgp_neighbors_peer, | |
9736 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
9737 | "show ip bgp vpnv4 all neighbors A.B.C.D", | |
9738 | SHOW_STR | |
9739 | IP_STR | |
9740 | BGP_STR | |
9741 | "Display VPNv4 NLRI specific information\n" | |
9742 | "Display information about all VPNv4 NLRIs\n" | |
9743 | "Detailed information on TCP and BGP neighbor connections\n" | |
9744 | "Neighbor to display information about\n") | |
9745 | ||
9746 | ALIAS (show_ip_bgp_neighbors_peer, | |
9747 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
9748 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", | |
9749 | SHOW_STR | |
9750 | IP_STR | |
9751 | BGP_STR | |
9752 | "Display VPNv4 NLRI specific information\n" | |
9753 | "Display information about all VPNv4 NLRIs\n" | |
9754 | "Detailed information on TCP and BGP neighbor connections\n" | |
9755 | "Neighbor to display information about\n") | |
9756 | ||
9757 | ALIAS (show_ip_bgp_neighbors_peer, | |
9758 | show_bgp_neighbors_peer_cmd, | |
a80beece | 9759 | "show bgp neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9760 | SHOW_STR |
9761 | BGP_STR | |
9762 | "Detailed information on TCP and BGP neighbor connections\n" | |
9763 | "Neighbor to display information about\n" | |
a80beece DS |
9764 | "Neighbor to display information about\n" |
9765 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9766 | |
9767 | ALIAS (show_ip_bgp_neighbors_peer, | |
9768 | show_bgp_ipv6_neighbors_peer_cmd, | |
a80beece | 9769 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9770 | SHOW_STR |
9771 | BGP_STR | |
9772 | "Address family\n" | |
9773 | "Detailed information on TCP and BGP neighbor connections\n" | |
9774 | "Neighbor to display information about\n" | |
a80beece DS |
9775 | "Neighbor to display information about\n" |
9776 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9777 | |
9778 | DEFUN (show_ip_bgp_instance_neighbors, | |
9779 | show_ip_bgp_instance_neighbors_cmd, | |
9780 | "show ip bgp view WORD neighbors", | |
9781 | SHOW_STR | |
9782 | IP_STR | |
9783 | BGP_STR | |
9784 | "BGP view\n" | |
9785 | "View name\n" | |
9786 | "Detailed information on TCP and BGP neighbor connections\n") | |
9787 | { | |
9788 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); | |
9789 | } | |
9790 | ||
bb46e94f | 9791 | ALIAS (show_ip_bgp_instance_neighbors, |
9792 | show_bgp_instance_neighbors_cmd, | |
9793 | "show bgp view WORD neighbors", | |
9794 | SHOW_STR | |
9795 | BGP_STR | |
9796 | "BGP view\n" | |
9797 | "View name\n" | |
9798 | "Detailed information on TCP and BGP neighbor connections\n") | |
9799 | ||
9800 | ALIAS (show_ip_bgp_instance_neighbors, | |
9801 | show_bgp_instance_ipv6_neighbors_cmd, | |
9802 | "show bgp view WORD ipv6 neighbors", | |
9803 | SHOW_STR | |
9804 | BGP_STR | |
9805 | "BGP view\n" | |
9806 | "View name\n" | |
9807 | "Address family\n" | |
9808 | "Detailed information on TCP and BGP neighbor connections\n") | |
9809 | ||
718e3744 | 9810 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
9811 | show_ip_bgp_instance_neighbors_peer_cmd, | |
a80beece | 9812 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9813 | SHOW_STR |
9814 | IP_STR | |
9815 | BGP_STR | |
9816 | "BGP view\n" | |
9817 | "View name\n" | |
9818 | "Detailed information on TCP and BGP neighbor connections\n" | |
9819 | "Neighbor to display information about\n" | |
a80beece DS |
9820 | "Neighbor to display information about\n" |
9821 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9822 | { |
9823 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); | |
9824 | } | |
bb46e94f | 9825 | |
9826 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
9827 | show_bgp_instance_neighbors_peer_cmd, | |
a80beece | 9828 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD)", |
bb46e94f | 9829 | SHOW_STR |
9830 | BGP_STR | |
9831 | "BGP view\n" | |
9832 | "View name\n" | |
9833 | "Detailed information on TCP and BGP neighbor connections\n" | |
9834 | "Neighbor to display information about\n" | |
a80beece DS |
9835 | "Neighbor to display information about\n" |
9836 | "Neighbor on bgp configured interface\n") | |
bb46e94f | 9837 | |
9838 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
9839 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
a80beece | 9840 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD)", |
bb46e94f | 9841 | SHOW_STR |
9842 | BGP_STR | |
9843 | "BGP view\n" | |
9844 | "View name\n" | |
9845 | "Address family\n" | |
9846 | "Detailed information on TCP and BGP neighbor connections\n" | |
9847 | "Neighbor to display information about\n" | |
a80beece DS |
9848 | "Neighbor to display information about\n" |
9849 | "Neighbor on bgp configured interface\n") | |
6b0655a2 | 9850 | |
718e3744 | 9851 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
9852 | paths' and `show ip mbgp paths'. Those functions results are the | |
9853 | same.*/ | |
9854 | DEFUN (show_ip_bgp_paths, | |
9855 | show_ip_bgp_paths_cmd, | |
9856 | "show ip bgp paths", | |
9857 | SHOW_STR | |
9858 | IP_STR | |
9859 | BGP_STR | |
9860 | "Path information\n") | |
9861 | { | |
9862 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
9863 | aspath_print_all_vty (vty); | |
9864 | return CMD_SUCCESS; | |
9865 | } | |
9866 | ||
9867 | DEFUN (show_ip_bgp_ipv4_paths, | |
9868 | show_ip_bgp_ipv4_paths_cmd, | |
9869 | "show ip bgp ipv4 (unicast|multicast) paths", | |
9870 | SHOW_STR | |
9871 | IP_STR | |
9872 | BGP_STR | |
9873 | "Address family\n" | |
9874 | "Address Family modifier\n" | |
9875 | "Address Family modifier\n" | |
9876 | "Path information\n") | |
9877 | { | |
9878 | vty_out (vty, "Address Refcnt Path\r\n"); | |
9879 | aspath_print_all_vty (vty); | |
9880 | ||
9881 | return CMD_SUCCESS; | |
9882 | } | |
6b0655a2 | 9883 | |
718e3744 | 9884 | #include "hash.h" |
9885 | ||
94f2b392 | 9886 | static void |
718e3744 | 9887 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
9888 | { | |
9889 | struct community *com; | |
9890 | ||
9891 | com = (struct community *) backet->data; | |
9892 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, | |
9893 | community_str (com), VTY_NEWLINE); | |
9894 | } | |
9895 | ||
9896 | /* Show BGP's community internal data. */ | |
9897 | DEFUN (show_ip_bgp_community_info, | |
9898 | show_ip_bgp_community_info_cmd, | |
9899 | "show ip bgp community-info", | |
9900 | SHOW_STR | |
9901 | IP_STR | |
9902 | BGP_STR | |
9903 | "List all bgp community information\n") | |
9904 | { | |
9905 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
9906 | ||
9907 | hash_iterate (community_hash (), | |
9908 | (void (*) (struct hash_backet *, void *)) | |
9909 | community_show_all_iterator, | |
9910 | vty); | |
9911 | ||
9912 | return CMD_SUCCESS; | |
9913 | } | |
9914 | ||
9915 | DEFUN (show_ip_bgp_attr_info, | |
9916 | show_ip_bgp_attr_info_cmd, | |
9917 | "show ip bgp attribute-info", | |
9918 | SHOW_STR | |
9919 | IP_STR | |
9920 | BGP_STR | |
9921 | "List all bgp attribute information\n") | |
9922 | { | |
9923 | attr_show_all (vty); | |
9924 | return CMD_SUCCESS; | |
9925 | } | |
6b0655a2 | 9926 | |
94f2b392 | 9927 | static int |
fee0f4c6 | 9928 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
9929 | afi_t afi, safi_t safi) | |
9930 | { | |
9931 | char timebuf[BGP_UPTIME_LEN]; | |
9932 | char rmbuf[14]; | |
fd79ac91 | 9933 | const char *rmname; |
fee0f4c6 | 9934 | struct peer *peer; |
1eb8ef25 | 9935 | struct listnode *node, *nnode; |
fee0f4c6 | 9936 | int len; |
9937 | int count = 0; | |
9938 | ||
9939 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) | |
9940 | { | |
1eb8ef25 | 9941 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
fee0f4c6 | 9942 | { |
9943 | count++; | |
9944 | bgp_write_rsclient_summary (vty, peer, afi, safi); | |
9945 | } | |
9946 | return count; | |
9947 | } | |
9948 | ||
9949 | len = vty_out (vty, "%s", rsclient->host); | |
9950 | len = 16 - len; | |
9951 | ||
9952 | if (len < 1) | |
9953 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
9954 | else | |
9955 | vty_out (vty, "%*s", len, " "); | |
9956 | ||
3d515fd9 | 9957 | vty_out (vty, "4 "); |
fee0f4c6 | 9958 | |
0b2aa3a0 | 9959 | vty_out (vty, "%11d ", rsclient->as); |
fee0f4c6 | 9960 | |
9961 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); | |
9962 | if ( rmname && strlen (rmname) > 13 ) | |
9963 | { | |
9964 | sprintf (rmbuf, "%13s", "..."); | |
9965 | rmname = strncpy (rmbuf, rmname, 10); | |
9966 | } | |
9967 | else if (! rmname) | |
9968 | rmname = "<none>"; | |
9969 | vty_out (vty, " %13s ", rmname); | |
9970 | ||
9971 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); | |
9972 | if ( rmname && strlen (rmname) > 13 ) | |
9973 | { | |
9974 | sprintf (rmbuf, "%13s", "..."); | |
9975 | rmname = strncpy (rmbuf, rmname, 10); | |
9976 | } | |
9977 | else if (! rmname) | |
9978 | rmname = "<none>"; | |
9979 | vty_out (vty, " %13s ", rmname); | |
9980 | ||
9981 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); | |
9982 | ||
9983 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) | |
9984 | vty_out (vty, " Idle (Admin)"); | |
9985 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
9986 | vty_out (vty, " Idle (PfxCt)"); | |
9987 | else | |
9988 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); | |
9989 | ||
9990 | vty_out (vty, "%s", VTY_NEWLINE); | |
9991 | ||
9992 | return 1; | |
9993 | } | |
9994 | ||
94f2b392 | 9995 | static int |
fd79ac91 | 9996 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
9997 | afi_t afi, safi_t safi) | |
fee0f4c6 | 9998 | { |
9999 | struct peer *peer; | |
1eb8ef25 | 10000 | struct listnode *node, *nnode; |
fee0f4c6 | 10001 | int count = 0; |
10002 | ||
10003 | /* Header string for each address family. */ | |
10004 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; | |
10005 | ||
1eb8ef25 | 10006 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
fee0f4c6 | 10007 | { |
10008 | if (peer->afc[afi][safi] && | |
10009 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
10010 | { | |
10011 | if (! count) | |
10012 | { | |
10013 | vty_out (vty, | |
10014 | "Route Server's BGP router identifier %s%s", | |
10015 | inet_ntoa (bgp->router_id), VTY_NEWLINE); | |
10016 | vty_out (vty, | |
aea339f7 | 10017 | "Route Server's local AS number %u%s", bgp->as, |
fee0f4c6 | 10018 | VTY_NEWLINE); |
10019 | ||
10020 | vty_out (vty, "%s", VTY_NEWLINE); | |
10021 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
10022 | } | |
10023 | ||
10024 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); | |
10025 | } | |
10026 | } | |
10027 | ||
10028 | if (count) | |
10029 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, | |
10030 | count, VTY_NEWLINE); | |
10031 | else | |
10032 | vty_out (vty, "No %s Route Server Client is configured%s", | |
10033 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
10034 | ||
10035 | return CMD_SUCCESS; | |
10036 | } | |
10037 | ||
94f2b392 | 10038 | static int |
fd79ac91 | 10039 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
10040 | afi_t afi, safi_t safi) | |
fee0f4c6 | 10041 | { |
10042 | struct bgp *bgp; | |
10043 | ||
10044 | if (name) | |
10045 | { | |
10046 | bgp = bgp_lookup_by_name (name); | |
10047 | ||
10048 | if (! bgp) | |
10049 | { | |
10050 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
10051 | return CMD_WARNING; | |
10052 | } | |
10053 | ||
10054 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
10055 | return CMD_SUCCESS; | |
10056 | } | |
10057 | ||
10058 | bgp = bgp_get_default (); | |
10059 | ||
10060 | if (bgp) | |
10061 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
10062 | ||
10063 | return CMD_SUCCESS; | |
10064 | } | |
10065 | ||
10066 | /* 'show bgp rsclient' commands. */ | |
10067 | DEFUN (show_ip_bgp_rsclient_summary, | |
10068 | show_ip_bgp_rsclient_summary_cmd, | |
10069 | "show ip bgp rsclient summary", | |
10070 | SHOW_STR | |
10071 | IP_STR | |
10072 | BGP_STR | |
10073 | "Information about Route Server Clients\n" | |
10074 | "Summary of all Route Server Clients\n") | |
10075 | { | |
10076 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
10077 | } | |
10078 | ||
10079 | DEFUN (show_ip_bgp_instance_rsclient_summary, | |
10080 | show_ip_bgp_instance_rsclient_summary_cmd, | |
10081 | "show ip bgp view WORD rsclient summary", | |
10082 | SHOW_STR | |
10083 | IP_STR | |
10084 | BGP_STR | |
10085 | "BGP view\n" | |
10086 | "View name\n" | |
10087 | "Information about Route Server Clients\n" | |
10088 | "Summary of all Route Server Clients\n") | |
10089 | { | |
10090 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
10091 | } | |
10092 | ||
10093 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, | |
10094 | show_ip_bgp_ipv4_rsclient_summary_cmd, | |
10095 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", | |
10096 | SHOW_STR | |
10097 | IP_STR | |
10098 | BGP_STR | |
10099 | "Address family\n" | |
10100 | "Address Family modifier\n" | |
10101 | "Address Family modifier\n" | |
10102 | "Information about Route Server Clients\n" | |
10103 | "Summary of all Route Server Clients\n") | |
10104 | { | |
10105 | if (strncmp (argv[0], "m", 1) == 0) | |
10106 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); | |
10107 | ||
10108 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
10109 | } | |
10110 | ||
10111 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, | |
10112 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, | |
10113 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
10114 | SHOW_STR | |
10115 | IP_STR | |
10116 | BGP_STR | |
10117 | "BGP view\n" | |
10118 | "View name\n" | |
10119 | "Address family\n" | |
10120 | "Address Family modifier\n" | |
10121 | "Address Family modifier\n" | |
10122 | "Information about Route Server Clients\n" | |
10123 | "Summary of all Route Server Clients\n") | |
10124 | { | |
10125 | if (strncmp (argv[1], "m", 1) == 0) | |
10126 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); | |
10127 | ||
10128 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
10129 | } | |
10130 | ||
95cbbd2a ML |
10131 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
10132 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, | |
10133 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
10134 | SHOW_STR | |
10135 | BGP_STR | |
10136 | "BGP view\n" | |
10137 | "View name\n" | |
10138 | "Address family\n" | |
10139 | "Address Family modifier\n" | |
10140 | "Address Family modifier\n" | |
10141 | "Information about Route Server Clients\n" | |
10142 | "Summary of all Route Server Clients\n") | |
10143 | { | |
10144 | safi_t safi; | |
10145 | ||
10146 | if (argc == 2) { | |
10147 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10148 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); | |
10149 | } else { | |
10150 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10151 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); | |
10152 | } | |
10153 | } | |
10154 | ||
10155 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, | |
10156 | show_bgp_ipv4_safi_rsclient_summary_cmd, | |
10157 | "show bgp ipv4 (unicast|multicast) rsclient summary", | |
10158 | SHOW_STR | |
10159 | BGP_STR | |
10160 | "Address family\n" | |
10161 | "Address Family modifier\n" | |
10162 | "Address Family modifier\n" | |
10163 | "Information about Route Server Clients\n" | |
10164 | "Summary of all Route Server Clients\n") | |
10165 | ||
fee0f4c6 | 10166 | #ifdef HAVE_IPV6 |
10167 | DEFUN (show_bgp_rsclient_summary, | |
10168 | show_bgp_rsclient_summary_cmd, | |
10169 | "show bgp rsclient summary", | |
10170 | SHOW_STR | |
10171 | BGP_STR | |
10172 | "Information about Route Server Clients\n" | |
10173 | "Summary of all Route Server Clients\n") | |
10174 | { | |
10175 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
10176 | } | |
10177 | ||
10178 | DEFUN (show_bgp_instance_rsclient_summary, | |
10179 | show_bgp_instance_rsclient_summary_cmd, | |
10180 | "show bgp view WORD rsclient summary", | |
10181 | SHOW_STR | |
10182 | BGP_STR | |
10183 | "BGP view\n" | |
10184 | "View name\n" | |
10185 | "Information about Route Server Clients\n" | |
10186 | "Summary of all Route Server Clients\n") | |
10187 | { | |
10188 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); | |
10189 | } | |
10190 | ||
10191 | ALIAS (show_bgp_rsclient_summary, | |
10192 | show_bgp_ipv6_rsclient_summary_cmd, | |
10193 | "show bgp ipv6 rsclient summary", | |
10194 | SHOW_STR | |
10195 | BGP_STR | |
10196 | "Address family\n" | |
10197 | "Information about Route Server Clients\n" | |
10198 | "Summary of all Route Server Clients\n") | |
10199 | ||
10200 | ALIAS (show_bgp_instance_rsclient_summary, | |
10201 | show_bgp_instance_ipv6_rsclient_summary_cmd, | |
10202 | "show bgp view WORD ipv6 rsclient summary", | |
10203 | SHOW_STR | |
10204 | BGP_STR | |
10205 | "BGP view\n" | |
10206 | "View name\n" | |
10207 | "Address family\n" | |
10208 | "Information about Route Server Clients\n" | |
10209 | "Summary of all Route Server Clients\n") | |
95cbbd2a ML |
10210 | |
10211 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, | |
10212 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, | |
10213 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", | |
10214 | SHOW_STR | |
10215 | BGP_STR | |
10216 | "BGP view\n" | |
10217 | "View name\n" | |
10218 | "Address family\n" | |
10219 | "Address Family modifier\n" | |
10220 | "Address Family modifier\n" | |
10221 | "Information about Route Server Clients\n" | |
10222 | "Summary of all Route Server Clients\n") | |
10223 | { | |
10224 | safi_t safi; | |
10225 | ||
10226 | if (argc == 2) { | |
10227 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10228 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); | |
10229 | } else { | |
10230 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10231 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); | |
10232 | } | |
10233 | } | |
10234 | ||
10235 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, | |
10236 | show_bgp_ipv6_safi_rsclient_summary_cmd, | |
10237 | "show bgp ipv6 (unicast|multicast) rsclient summary", | |
10238 | SHOW_STR | |
10239 | BGP_STR | |
10240 | "Address family\n" | |
10241 | "Address Family modifier\n" | |
10242 | "Address Family modifier\n" | |
10243 | "Information about Route Server Clients\n" | |
10244 | "Summary of all Route Server Clients\n") | |
10245 | ||
fee0f4c6 | 10246 | #endif /* HAVE IPV6 */ |
6b0655a2 | 10247 | |
3f9c7369 DS |
10248 | DEFUN (show_ip_bgp_updgrps, |
10249 | show_ip_bgp_updgrps_cmd, | |
10250 | "show ip bgp update-groups summary", | |
10251 | SHOW_STR | |
10252 | IP_STR | |
10253 | BGP_STR | |
10254 | "BGP update groups\n" | |
10255 | "Summary information\n") | |
10256 | { | |
10257 | struct bgp *bgp; | |
10258 | ||
10259 | bgp = bgp_get_default(); | |
10260 | if (bgp) | |
10261 | update_group_show(bgp, AFI_IP, SAFI_UNICAST, vty); | |
10262 | return CMD_SUCCESS; | |
10263 | } | |
10264 | ||
10265 | DEFUN (show_bgp_ipv6_updgrps, | |
10266 | show_bgp_ipv6_updgrps_cmd, | |
10267 | "show bgp update-groups summary", | |
10268 | SHOW_STR | |
10269 | BGP_STR | |
10270 | "BGP update groups\n" | |
10271 | "Summary information\n") | |
10272 | { | |
10273 | struct bgp *bgp; | |
10274 | ||
10275 | bgp = bgp_get_default(); | |
10276 | if (bgp) | |
10277 | update_group_show(bgp, AFI_IP6, SAFI_UNICAST, vty); | |
10278 | return CMD_SUCCESS; | |
10279 | } | |
10280 | ||
10281 | DEFUN (show_bgp_updgrps, | |
10282 | show_bgp_updgrps_cmd, | |
10283 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups summary", | |
10284 | SHOW_STR | |
10285 | BGP_STR | |
10286 | "Address family\n" | |
10287 | "Address family\n" | |
10288 | "Address Family modifier\n" | |
10289 | "Address Family modifier\n" | |
10290 | "BGP update groups\n" | |
10291 | "Summary information\n") | |
10292 | { | |
10293 | struct bgp *bgp; | |
10294 | afi_t afi; | |
10295 | safi_t safi; | |
10296 | ||
10297 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
10298 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10299 | bgp = bgp_get_default(); | |
10300 | if (bgp) | |
10301 | update_group_show(bgp, afi, safi, vty); | |
10302 | return CMD_SUCCESS; | |
10303 | } | |
10304 | ||
10305 | DEFUN (show_bgp_updgrps_stats, | |
10306 | show_bgp_updgrps_stats_cmd, | |
10307 | "show bgp update-groups statistics", | |
10308 | SHOW_STR | |
10309 | BGP_STR | |
10310 | "BGP update groups\n" | |
10311 | "Statistics\n") | |
10312 | { | |
10313 | struct bgp *bgp; | |
10314 | ||
10315 | bgp = bgp_get_default(); | |
10316 | if (bgp) | |
10317 | update_group_show_stats(bgp, vty); | |
10318 | ||
10319 | return CMD_SUCCESS; | |
10320 | } | |
10321 | ||
10322 | static void | |
10323 | show_bgp_updgrps_adj_info_aux (struct vty *vty, afi_t afi, safi_t safi, | |
10324 | const char *what, u_int64_t subgrp_id) | |
10325 | { | |
10326 | struct bgp *bgp; | |
10327 | bgp = bgp_get_default(); | |
10328 | if (bgp) | |
10329 | { | |
10330 | if (!strcmp(what, "advertise-queue")) | |
10331 | update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id); | |
10332 | else if (!strcmp(what, "advertised-routes")) | |
10333 | update_group_show_advertised(bgp, afi, safi, vty, subgrp_id); | |
10334 | else if (!strcmp(what, "packet-queue")) | |
10335 | update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id); | |
10336 | } | |
10337 | } | |
10338 | ||
10339 | DEFUN (show_ip_bgp_updgrps_adj, | |
10340 | show_ip_bgp_updgrps_adj_cmd, | |
10341 | "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
10342 | SHOW_STR | |
10343 | IP_STR | |
10344 | BGP_STR | |
10345 | "BGP update groups\n" | |
10346 | "Advertisement queue\n" | |
10347 | "Announced routes\n" | |
10348 | "Packet queue\n") | |
10349 | { | |
10350 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP, SAFI_UNICAST, argv[0], 0); | |
10351 | return CMD_SUCCESS; | |
10352 | } | |
10353 | ||
10354 | DEFUN (show_bgp_updgrps_afi_adj, | |
10355 | show_bgp_updgrps_afi_adj_cmd, | |
10356 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)", | |
10357 | SHOW_STR | |
10358 | BGP_STR | |
10359 | "Address family\n" | |
10360 | "Address family\n" | |
10361 | "Address Family modifier\n" | |
10362 | "Address Family modifier\n" | |
10363 | "BGP update groups\n" | |
10364 | "Advertisement queue\n" | |
10365 | "Announced routes\n" | |
10366 | "Packet queue\n") | |
10367 | { | |
10368 | afi_t afi; | |
10369 | safi_t safi; | |
10370 | ||
10371 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
10372 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10373 | show_bgp_updgrps_adj_info_aux(vty, afi, safi, argv[2], 0); | |
10374 | } | |
10375 | ||
10376 | DEFUN (show_bgp_updgrps_adj, | |
10377 | show_bgp_updgrps_adj_cmd, | |
10378 | "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
10379 | SHOW_STR | |
10380 | BGP_STR | |
10381 | "BGP update groups\n" | |
10382 | "Advertisement queue\n" | |
10383 | "Announced routes\n" | |
10384 | "Packet queue\n") | |
10385 | { | |
10386 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP6, SAFI_UNICAST, argv[0], 0); | |
10387 | return CMD_SUCCESS; | |
10388 | } | |
10389 | ||
10390 | DEFUN (show_ip_bgp_updgrps_adj_s, | |
10391 | show_ip_bgp_updgrps_adj_subgroup_cmd, | |
10392 | "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
10393 | SHOW_STR | |
10394 | IP_STR | |
10395 | BGP_STR | |
10396 | "BGP update groups\n" | |
10397 | "64-bit subgroup id\n" | |
10398 | "Advertisement queue\n" | |
10399 | "Announced routes\n" | |
10400 | "Packet queue\n") | |
10401 | { | |
10402 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP, SAFI_UNICAST, argv[1], | |
10403 | atoll(argv[0])); | |
10404 | return CMD_SUCCESS; | |
10405 | } | |
10406 | ||
10407 | DEFUN (show_bgp_updgrps_adj_s, | |
10408 | show_bgp_updgrps_adj_subgroup_cmd, | |
10409 | "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
10410 | SHOW_STR | |
10411 | BGP_STR | |
10412 | "BGP update groups\n" | |
10413 | "64-bit subgroup id\n" | |
10414 | "Advertisement queue\n" | |
10415 | "Announced routes\n" | |
10416 | "Packet queue\n") | |
10417 | { | |
10418 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP6, SAFI_UNICAST, argv[1], | |
10419 | atoll(argv[0])); | |
10420 | return CMD_SUCCESS; | |
10421 | } | |
10422 | ||
10423 | DEFUN (show_bgp_updgrps_afi_adj_subgroup, | |
10424 | show_bgp_updgrps_afi_adj_subgroup_cmd, | |
10425 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
10426 | SHOW_STR | |
10427 | BGP_STR | |
10428 | "Address family\n" | |
10429 | "Address family\n" | |
10430 | "Address Family modifier\n" | |
10431 | "Address Family modifier\n" | |
10432 | "BGP update groups\n" | |
10433 | "64-bit subgroup id\n" | |
10434 | "Advertisement queue\n" | |
10435 | "Announced routes\n" | |
10436 | "Packet queue\n") | |
10437 | { | |
10438 | afi_t afi; | |
10439 | safi_t safi; | |
10440 | ||
10441 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
10442 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10443 | show_bgp_updgrps_adj_info_aux(vty, afi, safi, argv[3], atoll(argv[2])); | |
10444 | } | |
10445 | ||
f14e6fdb DS |
10446 | static int |
10447 | bgp_show_one_peer_group (struct vty *vty, struct peer_group *group) | |
10448 | { | |
10449 | struct listnode *node, *nnode; | |
10450 | struct prefix *range; | |
10451 | struct peer *conf; | |
10452 | struct peer *peer; | |
10453 | char buf[128]; | |
10454 | afi_t afi; | |
10455 | safi_t safi; | |
10456 | char *peer_status, *af_str; | |
10457 | int lr_count; | |
10458 | int dynamic; | |
10459 | int af_cfgd; | |
10460 | ||
10461 | conf = group->conf; | |
10462 | ||
10463 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", | |
10464 | VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE); | |
10465 | ||
10466 | if (group->bgp->as == conf->as) | |
10467 | vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE); | |
10468 | else | |
10469 | vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE); | |
10470 | ||
10471 | /* Display AFs configured. */ | |
10472 | vty_out (vty, " Configured address-families:"); | |
10473 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
10474 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10475 | { | |
10476 | if (conf->afc[afi][safi]) | |
10477 | { | |
10478 | af_cfgd = 1; | |
10479 | vty_out (vty, " %s;", afi_safi_print(afi, safi)); | |
10480 | } | |
10481 | } | |
10482 | if (!af_cfgd) | |
10483 | vty_out (vty, " none%s", VTY_NEWLINE); | |
10484 | else | |
10485 | vty_out (vty, "%s", VTY_NEWLINE); | |
10486 | ||
10487 | /* Display listen ranges (for dynamic neighbors), if any */ | |
10488 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
10489 | { | |
10490 | if (afi == AFI_IP) | |
10491 | af_str = "IPv4"; | |
10492 | else if (afi == AFI_IP6) | |
10493 | af_str = "IPv6"; | |
10494 | lr_count = listcount(group->listen_range[afi]); | |
10495 | if (lr_count) | |
10496 | { | |
10497 | vty_out(vty, | |
10498 | " %d %s listen range(s)%s", | |
10499 | lr_count, af_str, VTY_NEWLINE); | |
10500 | ||
10501 | ||
10502 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node, | |
10503 | nnode, range)) | |
10504 | { | |
10505 | prefix2str(range, buf, sizeof(buf)); | |
10506 | vty_out(vty, " %s%s", buf, VTY_NEWLINE); | |
10507 | } | |
10508 | } | |
10509 | } | |
10510 | ||
10511 | /* Display group members and their status */ | |
10512 | if (listcount(group->peer)) | |
10513 | { | |
10514 | vty_out (vty, " Peer-group members:%s", VTY_NEWLINE); | |
10515 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
10516 | { | |
10517 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
10518 | peer_status = "Idle (Admin)"; | |
10519 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
10520 | peer_status = "Idle (PfxCt)"; | |
10521 | else | |
10522 | peer_status = LOOKUP(bgp_status_msg, peer->status); | |
10523 | ||
10524 | dynamic = peer_dynamic_neighbor(peer); | |
10525 | vty_out (vty, " %s %s %s %s", | |
10526 | peer->host, dynamic ? "(dynamic)" : "", | |
10527 | peer_status, VTY_NEWLINE); | |
10528 | } | |
10529 | } | |
10530 | ||
10531 | return CMD_SUCCESS; | |
10532 | } | |
10533 | ||
10534 | /* Show BGP peer group's information. */ | |
10535 | enum show_group_type | |
10536 | { | |
10537 | show_all_groups, | |
10538 | show_peer_group | |
10539 | }; | |
10540 | ||
10541 | static int | |
10542 | bgp_show_peer_group (struct vty *vty, struct bgp *bgp, | |
10543 | enum show_group_type type, const char *group_name) | |
10544 | { | |
10545 | struct listnode *node, *nnode; | |
10546 | struct peer_group *group; | |
10547 | int find = 0; | |
10548 | ||
10549 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
10550 | { | |
10551 | switch (type) | |
10552 | { | |
10553 | case show_all_groups: | |
10554 | bgp_show_one_peer_group (vty, group); | |
10555 | break; | |
10556 | case show_peer_group: | |
10557 | if (group_name && (strcmp(group->name, group_name) == 0)) | |
10558 | { | |
10559 | find = 1; | |
10560 | bgp_show_one_peer_group (vty, group); | |
10561 | } | |
10562 | break; | |
10563 | } | |
10564 | } | |
10565 | ||
10566 | if (type == show_peer_group && ! find) | |
10567 | vty_out (vty, "%% No such peer-groupr%s", VTY_NEWLINE); | |
10568 | ||
10569 | return CMD_SUCCESS; | |
10570 | } | |
10571 | ||
10572 | static int | |
10573 | bgp_show_peer_group_vty (struct vty *vty, const char *name, | |
10574 | enum show_group_type type, const char *group_name) | |
10575 | { | |
10576 | struct bgp *bgp; | |
10577 | int ret = CMD_SUCCESS; | |
10578 | ||
10579 | if (name) | |
10580 | { | |
10581 | bgp = bgp_lookup_by_name (name); | |
10582 | ||
10583 | if (! bgp) | |
10584 | { | |
10585 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
10586 | return CMD_WARNING; | |
10587 | } | |
10588 | } | |
10589 | ||
10590 | bgp = bgp_get_default (); | |
10591 | ||
10592 | if (bgp) | |
10593 | ret = bgp_show_peer_group (vty, bgp, type, group_name); | |
10594 | ||
10595 | return ret; | |
10596 | } | |
10597 | ||
10598 | DEFUN (show_ip_bgp_peer_groups, | |
10599 | show_ip_bgp_peer_groups_cmd, | |
10600 | "show ip bgp peer-group", | |
10601 | SHOW_STR | |
10602 | IP_STR | |
10603 | BGP_STR | |
10604 | "Detailed information on all BGP peer groups\n") | |
10605 | { | |
10606 | return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL); | |
10607 | } | |
10608 | ||
10609 | DEFUN (show_ip_bgp_instance_peer_groups, | |
10610 | show_ip_bgp_instance_peer_groups_cmd, | |
10611 | "show ip bgp view WORD peer-group", | |
10612 | SHOW_STR | |
10613 | IP_STR | |
10614 | BGP_STR | |
10615 | "BGP View\n" | |
10616 | "Detailed information on all BGP peer groups\n") | |
10617 | { | |
10618 | return bgp_show_peer_group_vty (vty, argv[0], show_all_groups, NULL); | |
10619 | } | |
10620 | ||
10621 | DEFUN (show_ip_bgp_peer_group, | |
10622 | show_ip_bgp_peer_group_cmd, | |
10623 | "show ip bgp peer-group WORD", | |
10624 | SHOW_STR | |
10625 | IP_STR | |
10626 | BGP_STR | |
10627 | "BGP peer-group name\n" | |
10628 | "Detailed information on a BGP peer group\n") | |
10629 | { | |
10630 | return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]); | |
10631 | } | |
10632 | ||
10633 | DEFUN (show_ip_bgp_instance_peer_group, | |
10634 | show_ip_bgp_instance_peer_group_cmd, | |
10635 | "show ip bgp view WORD peer-group WORD", | |
10636 | SHOW_STR | |
10637 | IP_STR | |
10638 | BGP_STR | |
10639 | "BGP View\n" | |
10640 | "BGP peer-group name\n" | |
10641 | "Detailed information on a BGP peer group\n") | |
10642 | { | |
10643 | return bgp_show_peer_group_vty (vty, argv[0], show_peer_group, argv[1]); | |
10644 | } | |
3f9c7369 | 10645 | |
718e3744 | 10646 | /* Redistribute VTY commands. */ |
10647 | ||
718e3744 | 10648 | DEFUN (bgp_redistribute_ipv4, |
10649 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 10650 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 10651 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 10652 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 10653 | { |
10654 | int type; | |
10655 | ||
e0ca5fde DL |
10656 | type = proto_redistnum (AFI_IP, argv[0]); |
10657 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 10658 | { |
10659 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
10660 | return CMD_WARNING; | |
10661 | } | |
7c8ff89e | 10662 | bgp_redist_add(vty->index, AFI_IP, type, 0); |
8bb0831e | 10663 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 10664 | } |
10665 | ||
10666 | DEFUN (bgp_redistribute_ipv4_rmap, | |
10667 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 10668 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 10669 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 10670 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 10671 | "Route map reference\n" |
10672 | "Pointer to route-map entries\n") | |
10673 | { | |
10674 | int type; | |
7c8ff89e | 10675 | struct bgp_redist *red; |
718e3744 | 10676 | |
e0ca5fde DL |
10677 | type = proto_redistnum (AFI_IP, argv[0]); |
10678 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 10679 | { |
10680 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
10681 | return CMD_WARNING; | |
10682 | } | |
10683 | ||
7c8ff89e DS |
10684 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
10685 | bgp_redistribute_rmap_set (red, argv[1]); | |
8bb0831e | 10686 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 10687 | } |
10688 | ||
10689 | DEFUN (bgp_redistribute_ipv4_metric, | |
10690 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 10691 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 10692 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 10693 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 10694 | "Metric for redistributed routes\n" |
10695 | "Default metric\n") | |
10696 | { | |
10697 | int type; | |
10698 | u_int32_t metric; | |
7c8ff89e | 10699 | struct bgp_redist *red; |
718e3744 | 10700 | |
e0ca5fde DL |
10701 | type = proto_redistnum (AFI_IP, argv[0]); |
10702 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 10703 | { |
10704 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
10705 | return CMD_WARNING; | |
10706 | } | |
10707 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
10708 | ||
7c8ff89e DS |
10709 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
10710 | bgp_redistribute_metric_set (red, metric); | |
8bb0831e | 10711 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 10712 | } |
10713 | ||
10714 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
10715 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 10716 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 10717 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 10718 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 10719 | "Route map reference\n" |
10720 | "Pointer to route-map entries\n" | |
10721 | "Metric for redistributed routes\n" | |
10722 | "Default metric\n") | |
10723 | { | |
10724 | int type; | |
10725 | u_int32_t metric; | |
7c8ff89e | 10726 | struct bgp_redist *red; |
718e3744 | 10727 | |
e0ca5fde DL |
10728 | type = proto_redistnum (AFI_IP, argv[0]); |
10729 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 10730 | { |
10731 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
10732 | return CMD_WARNING; | |
10733 | } | |
10734 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
10735 | ||
7c8ff89e DS |
10736 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
10737 | bgp_redistribute_rmap_set (red, argv[1]); | |
10738 | bgp_redistribute_metric_set (red, metric); | |
8bb0831e | 10739 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 10740 | } |
10741 | ||
10742 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
10743 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 10744 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 10745 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 10746 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 10747 | "Metric for redistributed routes\n" |
10748 | "Default metric\n" | |
10749 | "Route map reference\n" | |
10750 | "Pointer to route-map entries\n") | |
10751 | { | |
10752 | int type; | |
10753 | u_int32_t metric; | |
7c8ff89e | 10754 | struct bgp_redist *red; |
718e3744 | 10755 | |
e0ca5fde DL |
10756 | type = proto_redistnum (AFI_IP, argv[0]); |
10757 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 10758 | { |
10759 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
10760 | return CMD_WARNING; | |
10761 | } | |
10762 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
10763 | ||
7c8ff89e DS |
10764 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
10765 | bgp_redistribute_metric_set (red, metric); | |
10766 | bgp_redistribute_rmap_set (red, argv[2]); | |
8bb0831e | 10767 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 10768 | } |
10769 | ||
7c8ff89e DS |
10770 | DEFUN (bgp_redistribute_ipv4_ospf, |
10771 | bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 10772 | "redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
10773 | "Redistribute information from another routing protocol\n" |
10774 | "Open Shortest Path First (OSPFv2)\n" | |
10775 | "Instance ID\n") | |
10776 | { | |
10777 | u_short instance; | |
7a4bb9c5 | 10778 | u_short protocol; |
7c8ff89e | 10779 | |
7a4bb9c5 DS |
10780 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
10781 | ||
10782 | if (strncmp(argv[0], "o", 1) == 0) | |
10783 | protocol = ZEBRA_ROUTE_OSPF; | |
10784 | else | |
10785 | protocol = ZEBRA_ROUTE_TABLE; | |
10786 | ||
10787 | bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
8bb0831e | 10788 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
10789 | } |
10790 | ||
10791 | DEFUN (bgp_redistribute_ipv4_ospf_rmap, | |
10792 | bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 10793 | "redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
10794 | "Redistribute information from another routing protocol\n" |
10795 | "Open Shortest Path First (OSPFv2)\n" | |
10796 | "Instance ID\n" | |
10797 | "Route map reference\n" | |
10798 | "Pointer to route-map entries\n") | |
10799 | { | |
10800 | struct bgp_redist *red; | |
10801 | u_short instance; | |
7a4bb9c5 | 10802 | int protocol; |
7c8ff89e | 10803 | |
7a4bb9c5 DS |
10804 | if (strncmp(argv[0], "o", 1) == 0) |
10805 | protocol = ZEBRA_ROUTE_OSPF; | |
10806 | else | |
10807 | protocol = ZEBRA_ROUTE_TABLE; | |
10808 | ||
10809 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); | |
10810 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
10811 | bgp_redistribute_rmap_set (red, argv[2]); | |
8bb0831e | 10812 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
10813 | } |
10814 | ||
10815 | DEFUN (bgp_redistribute_ipv4_ospf_metric, | |
10816 | bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 10817 | "redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
10818 | "Redistribute information from another routing protocol\n" |
10819 | "Open Shortest Path First (OSPFv2)\n" | |
10820 | "Instance ID\n" | |
10821 | "Metric for redistributed routes\n" | |
10822 | "Default metric\n") | |
10823 | { | |
10824 | u_int32_t metric; | |
10825 | struct bgp_redist *red; | |
10826 | u_short instance; | |
7a4bb9c5 | 10827 | int protocol; |
7c8ff89e | 10828 | |
7a4bb9c5 DS |
10829 | if (strncmp(argv[0], "o", 1) == 0) |
10830 | protocol = ZEBRA_ROUTE_OSPF; | |
10831 | else | |
10832 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 10833 | |
7a4bb9c5 DS |
10834 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
10835 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
10836 | ||
10837 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
7c8ff89e | 10838 | bgp_redistribute_metric_set (red, metric); |
8bb0831e | 10839 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
10840 | } |
10841 | ||
10842 | DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, | |
10843 | bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 10844 | "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
10845 | "Redistribute information from another routing protocol\n" |
10846 | "Open Shortest Path First (OSPFv2)\n" | |
10847 | "Instance ID\n" | |
10848 | "Route map reference\n" | |
10849 | "Pointer to route-map entries\n" | |
10850 | "Metric for redistributed routes\n" | |
10851 | "Default metric\n") | |
10852 | { | |
10853 | u_int32_t metric; | |
10854 | struct bgp_redist *red; | |
10855 | u_short instance; | |
7a4bb9c5 | 10856 | int protocol; |
7c8ff89e | 10857 | |
7a4bb9c5 DS |
10858 | if (strncmp(argv[0], "o", 1) == 0) |
10859 | protocol = ZEBRA_ROUTE_OSPF; | |
10860 | else | |
10861 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 10862 | |
7a4bb9c5 DS |
10863 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
10864 | VTY_GET_INTEGER ("metric", metric, argv[3]); | |
10865 | ||
10866 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
10867 | bgp_redistribute_rmap_set (red, argv[2]); | |
7c8ff89e | 10868 | bgp_redistribute_metric_set (red, metric); |
8bb0831e | 10869 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
10870 | } |
10871 | ||
10872 | DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, | |
10873 | bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 10874 | "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
10875 | "Redistribute information from another routing protocol\n" |
10876 | "Open Shortest Path First (OSPFv2)\n" | |
10877 | "Instance ID\n" | |
10878 | "Metric for redistributed routes\n" | |
10879 | "Default metric\n" | |
10880 | "Route map reference\n" | |
10881 | "Pointer to route-map entries\n") | |
10882 | { | |
10883 | u_int32_t metric; | |
10884 | struct bgp_redist *red; | |
10885 | u_short instance; | |
7a4bb9c5 | 10886 | int protocol; |
7c8ff89e | 10887 | |
7a4bb9c5 DS |
10888 | if (strncmp(argv[0], "o", 1) == 0) |
10889 | protocol = ZEBRA_ROUTE_OSPF; | |
10890 | else | |
10891 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 10892 | |
7a4bb9c5 DS |
10893 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
10894 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
10895 | ||
10896 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
7c8ff89e | 10897 | bgp_redistribute_metric_set (red, metric); |
7a4bb9c5 | 10898 | bgp_redistribute_rmap_set (red, argv[3]); |
8bb0831e | 10899 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
10900 | } |
10901 | ||
10902 | DEFUN (no_bgp_redistribute_ipv4_ospf, | |
10903 | no_bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 10904 | "no redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
10905 | NO_STR |
10906 | "Redistribute information from another routing protocol\n" | |
10907 | "Open Shortest Path First (OSPFv2)\n" | |
10908 | "Instance ID\n") | |
10909 | { | |
10910 | u_short instance; | |
7a4bb9c5 DS |
10911 | int protocol; |
10912 | ||
10913 | if (strncmp(argv[0], "o", 1) == 0) | |
10914 | protocol = ZEBRA_ROUTE_OSPF; | |
10915 | else | |
10916 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 10917 | |
7a4bb9c5 DS |
10918 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
10919 | return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); | |
7c8ff89e DS |
10920 | } |
10921 | ||
10922 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
10923 | no_bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 10924 | "no redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
10925 | NO_STR |
10926 | "Redistribute information from another routing protocol\n" | |
10927 | "Open Shortest Path First (OSPFv2)\n" | |
10928 | "Instance ID\n" | |
10929 | "Route map reference\n" | |
10930 | "Pointer to route-map entries\n") | |
10931 | ||
10932 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
10933 | no_bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 10934 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
10935 | NO_STR |
10936 | "Redistribute information from another routing protocol\n" | |
10937 | "Open Shortest Path First (OSPFv2)\n" | |
10938 | "Instance ID\n" | |
10939 | "Metric for redistributed routes\n" | |
10940 | "Default metric\n") | |
10941 | ||
10942 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
10943 | no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 10944 | "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
10945 | NO_STR |
10946 | "Redistribute information from another routing protocol\n" | |
10947 | "Open Shortest Path First (OSPFv2)\n" | |
10948 | "Instance ID\n" | |
10949 | "Route map reference\n" | |
10950 | "Pointer to route-map entries\n" | |
10951 | "Metric for redistributed routes\n" | |
10952 | "Default metric\n") | |
10953 | ||
10954 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
10955 | no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 10956 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
10957 | NO_STR |
10958 | "Redistribute information from another routing protocol\n" | |
10959 | "Open Shortest Path First (OSPFv2)\n" | |
10960 | "Instance ID\n" | |
10961 | "Metric for redistributed routes\n" | |
10962 | "Default metric\n" | |
10963 | "Route map reference\n" | |
10964 | "Pointer to route-map entries\n") | |
10965 | ||
718e3744 | 10966 | DEFUN (no_bgp_redistribute_ipv4, |
10967 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 10968 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 10969 | NO_STR |
10970 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 10971 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 10972 | { |
10973 | int type; | |
10974 | ||
e0ca5fde DL |
10975 | type = proto_redistnum (AFI_IP, argv[0]); |
10976 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 10977 | { |
10978 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
10979 | return CMD_WARNING; | |
10980 | } | |
7c8ff89e | 10981 | return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); |
718e3744 | 10982 | } |
10983 | ||
503006bc | 10984 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 10985 | no_bgp_redistribute_ipv4_rmap_cmd, |
e0ca5fde | 10986 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 10987 | NO_STR |
10988 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 10989 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 10990 | "Route map reference\n" |
10991 | "Pointer to route-map entries\n") | |
718e3744 | 10992 | |
503006bc | 10993 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 10994 | no_bgp_redistribute_ipv4_metric_cmd, |
e0ca5fde | 10995 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 10996 | NO_STR |
10997 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 10998 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 10999 | "Metric for redistributed routes\n" |
11000 | "Default metric\n") | |
718e3744 | 11001 | |
503006bc | 11002 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 11003 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
e0ca5fde | 11004 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 11005 | NO_STR |
11006 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11007 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11008 | "Route map reference\n" |
11009 | "Pointer to route-map entries\n" | |
11010 | "Metric for redistributed routes\n" | |
11011 | "Default metric\n") | |
718e3744 | 11012 | |
503006bc | 11013 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 11014 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
e0ca5fde | 11015 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 11016 | NO_STR |
11017 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11018 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11019 | "Metric for redistributed routes\n" |
11020 | "Default metric\n" | |
11021 | "Route map reference\n" | |
11022 | "Pointer to route-map entries\n") | |
6b0655a2 | 11023 | |
718e3744 | 11024 | #ifdef HAVE_IPV6 |
11025 | DEFUN (bgp_redistribute_ipv6, | |
11026 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 11027 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 11028 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11029 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 11030 | { |
11031 | int type; | |
11032 | ||
e0ca5fde DL |
11033 | type = proto_redistnum (AFI_IP6, argv[0]); |
11034 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11035 | { |
11036 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11037 | return CMD_WARNING; | |
11038 | } | |
11039 | ||
7c8ff89e | 11040 | bgp_redist_add(vty->index, AFI_IP6, type, 0); |
8bb0831e | 11041 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11042 | } |
11043 | ||
11044 | DEFUN (bgp_redistribute_ipv6_rmap, | |
11045 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 11046 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 11047 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11048 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11049 | "Route map reference\n" |
11050 | "Pointer to route-map entries\n") | |
11051 | { | |
11052 | int type; | |
7c8ff89e | 11053 | struct bgp_redist *red; |
718e3744 | 11054 | |
e0ca5fde DL |
11055 | type = proto_redistnum (AFI_IP6, argv[0]); |
11056 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11057 | { |
11058 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11059 | return CMD_WARNING; | |
11060 | } | |
11061 | ||
7c8ff89e DS |
11062 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
11063 | bgp_redistribute_rmap_set (red, argv[1]); | |
8bb0831e | 11064 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11065 | } |
11066 | ||
11067 | DEFUN (bgp_redistribute_ipv6_metric, | |
11068 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 11069 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 11070 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11071 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11072 | "Metric for redistributed routes\n" |
11073 | "Default metric\n") | |
11074 | { | |
11075 | int type; | |
11076 | u_int32_t metric; | |
7c8ff89e | 11077 | struct bgp_redist *red; |
718e3744 | 11078 | |
e0ca5fde DL |
11079 | type = proto_redistnum (AFI_IP6, argv[0]); |
11080 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11081 | { |
11082 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11083 | return CMD_WARNING; | |
11084 | } | |
11085 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
11086 | ||
7c8ff89e DS |
11087 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
11088 | bgp_redistribute_metric_set (red, metric); | |
8bb0831e | 11089 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11090 | } |
11091 | ||
11092 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
11093 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 11094 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 11095 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11096 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11097 | "Route map reference\n" |
11098 | "Pointer to route-map entries\n" | |
11099 | "Metric for redistributed routes\n" | |
11100 | "Default metric\n") | |
11101 | { | |
11102 | int type; | |
11103 | u_int32_t metric; | |
7c8ff89e | 11104 | struct bgp_redist *red; |
718e3744 | 11105 | |
e0ca5fde DL |
11106 | type = proto_redistnum (AFI_IP6, argv[0]); |
11107 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11108 | { |
11109 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11110 | return CMD_WARNING; | |
11111 | } | |
11112 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
11113 | ||
7c8ff89e DS |
11114 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
11115 | bgp_redistribute_rmap_set (red, argv[1]); | |
11116 | bgp_redistribute_metric_set (red, metric); | |
8bb0831e | 11117 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11118 | } |
11119 | ||
11120 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
11121 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 11122 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 11123 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11124 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11125 | "Metric for redistributed routes\n" |
11126 | "Default metric\n" | |
11127 | "Route map reference\n" | |
11128 | "Pointer to route-map entries\n") | |
11129 | { | |
11130 | int type; | |
11131 | u_int32_t metric; | |
7c8ff89e | 11132 | struct bgp_redist *red; |
718e3744 | 11133 | |
e0ca5fde DL |
11134 | type = proto_redistnum (AFI_IP6, argv[0]); |
11135 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11136 | { |
11137 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11138 | return CMD_WARNING; | |
11139 | } | |
11140 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
11141 | ||
7c8ff89e DS |
11142 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
11143 | bgp_redistribute_metric_set (red, metric); | |
11144 | bgp_redistribute_rmap_set (red, argv[2]); | |
8bb0831e | 11145 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11146 | } |
11147 | ||
11148 | DEFUN (no_bgp_redistribute_ipv6, | |
11149 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 11150 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 11151 | NO_STR |
11152 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11153 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 11154 | { |
11155 | int type; | |
11156 | ||
e0ca5fde DL |
11157 | type = proto_redistnum (AFI_IP6, argv[0]); |
11158 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11159 | { |
11160 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11161 | return CMD_WARNING; | |
11162 | } | |
11163 | ||
7c8ff89e | 11164 | return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0); |
718e3744 | 11165 | } |
11166 | ||
503006bc | 11167 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 11168 | no_bgp_redistribute_ipv6_rmap_cmd, |
e0ca5fde | 11169 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 11170 | NO_STR |
11171 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11172 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11173 | "Route map reference\n" |
11174 | "Pointer to route-map entries\n") | |
718e3744 | 11175 | |
503006bc | 11176 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 11177 | no_bgp_redistribute_ipv6_metric_cmd, |
e0ca5fde | 11178 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 11179 | NO_STR |
11180 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11181 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11182 | "Metric for redistributed routes\n" |
11183 | "Default metric\n") | |
718e3744 | 11184 | |
503006bc | 11185 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 11186 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
e0ca5fde | 11187 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 11188 | NO_STR |
11189 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11190 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11191 | "Route map reference\n" |
11192 | "Pointer to route-map entries\n" | |
11193 | "Metric for redistributed routes\n" | |
11194 | "Default metric\n") | |
718e3744 | 11195 | |
503006bc | 11196 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 11197 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
e0ca5fde | 11198 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 11199 | NO_STR |
11200 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11201 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11202 | "Metric for redistributed routes\n" |
11203 | "Default metric\n" | |
11204 | "Route map reference\n" | |
11205 | "Pointer to route-map entries\n") | |
11206 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 11207 | |
718e3744 | 11208 | int |
11209 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
11210 | safi_t safi, int *write) | |
11211 | { | |
11212 | int i; | |
718e3744 | 11213 | |
11214 | /* Unicast redistribution only. */ | |
11215 | if (safi != SAFI_UNICAST) | |
11216 | return 0; | |
11217 | ||
11218 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
11219 | { | |
11220 | /* Redistribute BGP does not make sense. */ | |
7c8ff89e | 11221 | if (i != ZEBRA_ROUTE_BGP) |
718e3744 | 11222 | { |
7c8ff89e DS |
11223 | struct list *red_list; |
11224 | struct listnode *node; | |
11225 | struct bgp_redist *red; | |
718e3744 | 11226 | |
7c8ff89e DS |
11227 | red_list = bgp->redist[afi][i]; |
11228 | if (!red_list) | |
11229 | continue; | |
718e3744 | 11230 | |
7c8ff89e DS |
11231 | for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) |
11232 | { | |
11233 | /* Display "address-family" when it is not yet diplayed. */ | |
11234 | bgp_config_write_family_header (vty, afi, safi, write); | |
11235 | ||
11236 | /* "redistribute" configuration. */ | |
11237 | vty_out (vty, " redistribute %s", zebra_route_string(i)); | |
11238 | if (red->instance) | |
11239 | vty_out (vty, " %d", red->instance); | |
11240 | if (red->redist_metric_flag) | |
11241 | vty_out (vty, " metric %u", red->redist_metric); | |
11242 | if (red->rmap.name) | |
11243 | vty_out (vty, " route-map %s", red->rmap.name); | |
11244 | vty_out (vty, "%s", VTY_NEWLINE); | |
11245 | } | |
718e3744 | 11246 | } |
11247 | } | |
11248 | return *write; | |
11249 | } | |
6b0655a2 | 11250 | |
718e3744 | 11251 | /* BGP node structure. */ |
7fc626de | 11252 | static struct cmd_node bgp_node = |
718e3744 | 11253 | { |
11254 | BGP_NODE, | |
11255 | "%s(config-router)# ", | |
11256 | 1, | |
11257 | }; | |
11258 | ||
7fc626de | 11259 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 11260 | { |
11261 | BGP_IPV4_NODE, | |
11262 | "%s(config-router-af)# ", | |
11263 | 1, | |
11264 | }; | |
11265 | ||
7fc626de | 11266 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 11267 | { |
11268 | BGP_IPV4M_NODE, | |
11269 | "%s(config-router-af)# ", | |
11270 | 1, | |
11271 | }; | |
11272 | ||
7fc626de | 11273 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 11274 | { |
11275 | BGP_IPV6_NODE, | |
11276 | "%s(config-router-af)# ", | |
11277 | 1, | |
11278 | }; | |
11279 | ||
7fc626de | 11280 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 11281 | { |
11282 | BGP_IPV6M_NODE, | |
11283 | "%s(config-router-af)# ", | |
11284 | 1, | |
11285 | }; | |
11286 | ||
7fc626de | 11287 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 11288 | { |
11289 | BGP_VPNV4_NODE, | |
11290 | "%s(config-router-af)# ", | |
11291 | 1 | |
11292 | }; | |
6b0655a2 | 11293 | |
1f8ae70b | 11294 | static void community_list_vty (void); |
11295 | ||
718e3744 | 11296 | void |
94f2b392 | 11297 | bgp_vty_init (void) |
718e3744 | 11298 | { |
718e3744 | 11299 | /* Install bgp top node. */ |
11300 | install_node (&bgp_node, bgp_config_write); | |
11301 | install_node (&bgp_ipv4_unicast_node, NULL); | |
11302 | install_node (&bgp_ipv4_multicast_node, NULL); | |
11303 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 11304 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 11305 | install_node (&bgp_vpnv4_node, NULL); |
11306 | ||
11307 | /* Install default VTY commands to new nodes. */ | |
11308 | install_default (BGP_NODE); | |
11309 | install_default (BGP_IPV4_NODE); | |
11310 | install_default (BGP_IPV4M_NODE); | |
11311 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 11312 | install_default (BGP_IPV6M_NODE); |
718e3744 | 11313 | install_default (BGP_VPNV4_NODE); |
11314 | ||
11315 | /* "bgp multiple-instance" commands. */ | |
11316 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
11317 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
11318 | ||
11319 | /* "bgp config-type" commands. */ | |
11320 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
11321 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); | |
11322 | ||
11323 | /* Dummy commands (Currently not supported) */ | |
11324 | install_element (BGP_NODE, &no_synchronization_cmd); | |
11325 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
11326 | ||
11327 | /* "router bgp" commands. */ | |
11328 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
11329 | install_element (CONFIG_NODE, &router_bgp_view_cmd); | |
11330 | ||
11331 | /* "no router bgp" commands. */ | |
11332 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
11333 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); | |
11334 | ||
11335 | /* "bgp router-id" commands. */ | |
11336 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
11337 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
11338 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
11339 | ||
11340 | /* "bgp cluster-id" commands. */ | |
11341 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
11342 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
11343 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
11344 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); | |
11345 | ||
11346 | /* "bgp confederation" commands. */ | |
11347 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
11348 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
11349 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
11350 | ||
11351 | /* "bgp confederation peers" commands. */ | |
11352 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
11353 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
11354 | ||
abc920f8 DS |
11355 | /* bgp max-med command */ |
11356 | install_element (BGP_NODE, &bgp_maxmed_admin_cmd); | |
11357 | install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd); | |
11358 | install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); | |
11359 | install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd); | |
11360 | install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); | |
11361 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); | |
11362 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd); | |
11363 | install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); | |
11364 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd); | |
11365 | ||
907f92c8 DS |
11366 | /* bgp disable-ebgp-connected-nh-check */ |
11367 | install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd); | |
11368 | install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd); | |
11369 | ||
f188f2c4 DS |
11370 | /* bgp update-delay command */ |
11371 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
11372 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
11373 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
11374 | install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); | |
11375 | ||
cb1faec9 DS |
11376 | install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); |
11377 | install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); | |
11378 | ||
3f9c7369 DS |
11379 | install_element (BGP_NODE, &bgp_coalesce_time_cmd); |
11380 | install_element (BGP_NODE, &no_bgp_coalesce_time_cmd); | |
11381 | ||
165b5fff JB |
11382 | /* "maximum-paths" commands. */ |
11383 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
11384 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
11385 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); | |
11386 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); | |
11387 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
11388 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); | |
431aa9f9 DS |
11389 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
11390 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
11391 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); | |
165b5fff | 11392 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 11393 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff JB |
11394 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
11395 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 11396 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 11397 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 11398 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 11399 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
5e242b0d | 11400 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 11401 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
431aa9f9 | 11402 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 11403 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 DS |
11404 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
11405 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 11406 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 11407 | |
718e3744 | 11408 | /* "timers bgp" commands. */ |
11409 | install_element (BGP_NODE, &bgp_timers_cmd); | |
11410 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
11411 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
11412 | ||
518f0eb1 DS |
11413 | /* route-map delay-timer commands */ |
11414 | install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd); | |
11415 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
11416 | ||
718e3744 | 11417 | /* "bgp client-to-client reflection" commands */ |
11418 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
11419 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
11420 | ||
11421 | /* "bgp always-compare-med" commands */ | |
11422 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
11423 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
11424 | ||
11425 | /* "bgp deterministic-med" commands */ | |
11426 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
11427 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 11428 | |
538621f2 | 11429 | /* "bgp graceful-restart" commands */ |
11430 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
11431 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 11432 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
11433 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
11434 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 11435 | |
11436 | /* "bgp fast-external-failover" commands */ | |
11437 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
11438 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
11439 | ||
11440 | /* "bgp enforce-first-as" commands */ | |
11441 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
11442 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
11443 | ||
11444 | /* "bgp bestpath compare-routerid" commands */ | |
11445 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
11446 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
11447 | ||
11448 | /* "bgp bestpath as-path ignore" commands */ | |
11449 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
11450 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
11451 | ||
6811845b | 11452 | /* "bgp bestpath as-path confed" commands */ |
11453 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
11454 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
11455 | ||
2fdd455c PM |
11456 | /* "bgp bestpath as-path multipath-relax" commands */ |
11457 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
11458 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
11459 | ||
16fc1eec DS |
11460 | /* "bgp bestpath as-path multipath-relax no-as-set" commands */ |
11461 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_no_as_set_cmd); | |
11462 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_no_as_set_cmd); | |
11463 | ||
848973c7 | 11464 | /* "bgp log-neighbor-changes" commands */ |
11465 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
11466 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
11467 | ||
718e3744 | 11468 | /* "bgp bestpath med" commands */ |
11469 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
11470 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
11471 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
11472 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
11473 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
11474 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
11475 | ||
11476 | /* "no bgp default ipv4-unicast" commands. */ | |
11477 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
11478 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
11479 | ||
11480 | /* "bgp network import-check" commands. */ | |
11481 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
11482 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); | |
11483 | ||
11484 | /* "bgp default local-preference" commands. */ | |
11485 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
11486 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
11487 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
11488 | ||
3f9c7369 DS |
11489 | /* "bgp default subgroup-pkt-queue-max" commands. */ |
11490 | install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd); | |
11491 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd); | |
11492 | ||
8bd9d948 DS |
11493 | /* bgp ibgp-allow-policy-mods command */ |
11494 | install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd); | |
11495 | install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd); | |
11496 | ||
f14e6fdb DS |
11497 | /* "bgp listen limit" commands. */ |
11498 | install_element (BGP_NODE, &bgp_listen_limit_cmd); | |
11499 | install_element (BGP_NODE, &no_bgp_listen_limit_cmd); | |
11500 | ||
11501 | /* "bgp listen range" commands. */ | |
11502 | install_element (BGP_NODE, &bgp_listen_range_cmd); | |
11503 | install_element (BGP_NODE, &no_bgp_listen_range_cmd); | |
11504 | ||
718e3744 | 11505 | /* "neighbor remote-as" commands. */ |
11506 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
a80beece | 11507 | install_element (BGP_NODE, &neighbor_interface_config_cmd); |
718e3744 | 11508 | install_element (BGP_NODE, &no_neighbor_cmd); |
11509 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
a80beece | 11510 | install_element (BGP_NODE, &no_neighbor_interface_config_cmd); |
718e3744 | 11511 | |
11512 | /* "neighbor peer-group" commands. */ | |
11513 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
11514 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
a80beece | 11515 | install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd); |
718e3744 | 11516 | |
11517 | /* "neighbor local-as" commands. */ | |
11518 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
11519 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 11520 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 11521 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
11522 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
11523 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
9d3f9705 | 11524 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
718e3744 | 11525 | |
3f9c7369 DS |
11526 | /* "neighbor solo" commands. */ |
11527 | install_element (BGP_NODE, &neighbor_solo_cmd); | |
11528 | install_element (BGP_NODE, &no_neighbor_solo_cmd); | |
11529 | ||
0df7c91f PJ |
11530 | /* "neighbor password" commands. */ |
11531 | install_element (BGP_NODE, &neighbor_password_cmd); | |
11532 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
11533 | ||
718e3744 | 11534 | /* "neighbor activate" commands. */ |
11535 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
11536 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
11537 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
11538 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 11539 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 11540 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
11541 | ||
11542 | /* "no neighbor activate" commands. */ | |
11543 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
11544 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
11545 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
11546 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 11547 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 11548 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
11549 | ||
11550 | /* "neighbor peer-group set" commands. */ | |
11551 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); | |
11552 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
11553 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
11554 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 11555 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 11556 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
11557 | ||
718e3744 | 11558 | /* "no neighbor peer-group unset" commands. */ |
11559 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
11560 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
11561 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
11562 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 11563 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 11564 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
11565 | ||
718e3744 | 11566 | /* "neighbor softreconfiguration inbound" commands.*/ |
11567 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
11568 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
11569 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
11570 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
11571 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
11572 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
11573 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
11574 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 11575 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
11576 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 11577 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
11578 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 11579 | |
11580 | /* "neighbor attribute-unchanged" commands. */ | |
11581 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
11582 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
11583 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
11584 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
11585 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
11586 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
11587 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
11588 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
11589 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
11590 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
11591 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
11592 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
11593 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
11594 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
11595 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
11596 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
11597 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
11598 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
11599 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
11600 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
11601 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
11602 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
11603 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
11604 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
11605 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
11606 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
11607 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
11608 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
11609 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
11610 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
11611 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
11612 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
11613 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
11614 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
11615 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
11616 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
11617 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
11618 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
11619 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
11620 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
11621 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
11622 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
11623 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
11624 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
11625 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
11626 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
11627 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
11628 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
11629 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
11630 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
11631 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
11632 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
11633 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
11634 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
11635 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
11636 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
11637 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
11638 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
11639 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
11640 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
11641 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
11642 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
11643 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
11644 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
11645 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
11646 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
11647 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
11648 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
11649 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
11650 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
11651 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
11652 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
11653 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
11654 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
11655 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
11656 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
11657 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
11658 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
11659 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
11660 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
11661 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
11662 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
11663 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
11664 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
11665 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
11666 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
11667 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
11668 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 11669 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
11670 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
11671 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
11672 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
11673 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
11674 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
11675 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
11676 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
11677 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
11678 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
11679 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
11680 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
11681 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
11682 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
11683 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
11684 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
11685 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
11686 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
11687 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
11688 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
11689 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
11690 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 11691 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
11692 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
11693 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
11694 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
11695 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
11696 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
11697 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
11698 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
11699 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
11700 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
11701 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
11702 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
11703 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
11704 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
11705 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
11706 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
11707 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
11708 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
11709 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
11710 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
11711 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
11712 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
11713 | ||
fee0f4c6 | 11714 | /* "nexthop-local unchanged" commands */ |
11715 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
11716 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
11717 | ||
718e3744 | 11718 | /* "transparent-as" and "transparent-nexthop" for old version |
11719 | compatibility. */ | |
11720 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); | |
11721 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); | |
11722 | ||
11723 | /* "neighbor next-hop-self" commands. */ | |
11724 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
11725 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
11726 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
11727 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
11728 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
11729 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
11730 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
11731 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 11732 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
11733 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 11734 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
11735 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
11736 | ||
c7122e14 DS |
11737 | /* "neighbor as-override" commands. */ |
11738 | install_element (BGP_NODE, &neighbor_as_override_cmd); | |
11739 | install_element (BGP_NODE, &no_neighbor_as_override_cmd); | |
11740 | install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd); | |
11741 | install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd); | |
11742 | install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd); | |
11743 | install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd); | |
11744 | install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd); | |
11745 | install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd); | |
11746 | install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd); | |
11747 | install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd); | |
11748 | install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd); | |
11749 | install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd); | |
11750 | ||
718e3744 | 11751 | /* "neighbor remove-private-AS" commands. */ |
11752 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
11753 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
11754 | install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd); |
11755 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd); | |
11756 | install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
11757 | install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
11758 | install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
11759 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 11760 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
11761 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
11762 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd); |
11763 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
11764 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
11765 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
11766 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
11767 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 11768 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
11769 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
11770 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd); |
11771 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
11772 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
11773 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
11774 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
11775 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 11776 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
11777 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
11778 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd); |
11779 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
11780 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
11781 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
11782 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
11783 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
25ffbdc1 | 11784 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
11785 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
11786 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd); |
11787 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
11788 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
11789 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
11790 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
11791 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 11792 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
11793 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
11794 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd); |
11795 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
11796 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
11797 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
11798 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
11799 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 11800 | |
11801 | /* "neighbor send-community" commands.*/ | |
11802 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
11803 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
11804 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
11805 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
11806 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
11807 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
11808 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
11809 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
11810 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
11811 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
11812 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
11813 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
11814 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
11815 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
11816 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
11817 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 11818 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
11819 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
11820 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
11821 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 11822 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
11823 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
11824 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
11825 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
11826 | ||
11827 | /* "neighbor route-reflector" commands.*/ | |
11828 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
11829 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
11830 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
11831 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
11832 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
11833 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
11834 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
11835 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 11836 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
11837 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 11838 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
11839 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
11840 | ||
11841 | /* "neighbor route-server" commands.*/ | |
11842 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
11843 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
11844 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
11845 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
11846 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
11847 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
11848 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
11849 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 11850 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
11851 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 11852 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
11853 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
11854 | ||
11855 | /* "neighbor passive" commands. */ | |
11856 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
11857 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
11858 | ||
d5a5c8f0 DS |
11859 | /* "neighbor bfd" commands. */ |
11860 | install_element (BGP_NODE, &neighbor_bfd_cmd); | |
11861 | install_element (BGP_NODE, &no_neighbor_bfd_cmd); | |
11862 | ||
718e3744 | 11863 | /* "neighbor shutdown" commands. */ |
11864 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
11865 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
11866 | ||
c9502438 | 11867 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
718e3744 | 11868 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
11869 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); | |
11870 | ||
11871 | /* "neighbor capability orf prefix-list" commands.*/ | |
11872 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
11873 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
11874 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
11875 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
11876 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
11877 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
11878 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
11879 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 11880 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
11881 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 11882 | |
11883 | /* "neighbor capability dynamic" commands.*/ | |
11884 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
11885 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
11886 | ||
11887 | /* "neighbor dont-capability-negotiate" commands. */ | |
11888 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
11889 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
11890 | ||
11891 | /* "neighbor ebgp-multihop" commands. */ | |
11892 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
11893 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
11894 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
11895 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
11896 | ||
6ffd2079 | 11897 | /* "neighbor disable-connected-check" commands. */ |
11898 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
11899 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 11900 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
11901 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
11902 | ||
11903 | /* "neighbor description" commands. */ | |
11904 | install_element (BGP_NODE, &neighbor_description_cmd); | |
11905 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
11906 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
11907 | ||
11908 | /* "neighbor update-source" commands. "*/ | |
11909 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
11910 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
11911 | ||
11912 | /* "neighbor default-originate" commands. */ | |
11913 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
11914 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
11915 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
11916 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
11917 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
11918 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
11919 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
11920 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
11921 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
11922 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
11923 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
11924 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
11925 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
11926 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
11927 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
11928 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 11929 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
11930 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
11931 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
11932 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 11933 | |
11934 | /* "neighbor port" commands. */ | |
11935 | install_element (BGP_NODE, &neighbor_port_cmd); | |
11936 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
11937 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
11938 | ||
11939 | /* "neighbor weight" commands. */ | |
11940 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
11941 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
11942 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
11943 | ||
11944 | /* "neighbor override-capability" commands. */ | |
11945 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
11946 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
11947 | ||
11948 | /* "neighbor strict-capability-match" commands. */ | |
11949 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
11950 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
11951 | ||
11952 | /* "neighbor timers" commands. */ | |
11953 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
11954 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
11955 | ||
11956 | /* "neighbor timers connect" commands. */ | |
11957 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
11958 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
11959 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
11960 | ||
11961 | /* "neighbor advertisement-interval" commands. */ | |
11962 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
11963 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
11964 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
11965 | ||
11966 | /* "neighbor version" commands. */ | |
11967 | install_element (BGP_NODE, &neighbor_version_cmd); | |
718e3744 | 11968 | |
11969 | /* "neighbor interface" commands. */ | |
11970 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
11971 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
11972 | ||
11973 | /* "neighbor distribute" commands. */ | |
11974 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
11975 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
11976 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
11977 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
11978 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
11979 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
11980 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
11981 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 11982 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
11983 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 11984 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
11985 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
11986 | ||
11987 | /* "neighbor prefix-list" commands. */ | |
11988 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
11989 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
11990 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
11991 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
11992 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
11993 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
11994 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
11995 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 11996 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
11997 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 11998 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
11999 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
12000 | ||
12001 | /* "neighbor filter-list" commands. */ | |
12002 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
12003 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
12004 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
12005 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
12006 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
12007 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
12008 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
12009 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 12010 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
12011 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 12012 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
12013 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
12014 | ||
12015 | /* "neighbor route-map" commands. */ | |
12016 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
12017 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
12018 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
12019 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
12020 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
12021 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
12022 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
12023 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 12024 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
12025 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 12026 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
12027 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
12028 | ||
12029 | /* "neighbor unsuppress-map" commands. */ | |
12030 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
12031 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
12032 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
12033 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
12034 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
12035 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
12036 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
12037 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 12038 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
12039 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 12040 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
12041 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 12042 | |
12043 | /* "neighbor maximum-prefix" commands. */ | |
12044 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 12045 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12046 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12047 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12048 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
12049 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12050 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
12051 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12052 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12053 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12054 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12055 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12056 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12057 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 12058 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12059 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12060 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12061 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
12062 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12063 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
12064 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12065 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12066 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12067 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12068 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12069 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12070 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 12071 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12072 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12073 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12074 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
12075 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12076 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
12077 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12078 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12079 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12080 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12081 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12082 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12083 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 12084 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12085 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12086 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12087 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
12088 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12089 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
12090 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12091 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12092 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12093 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12094 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12095 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 12096 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
12097 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
12098 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
12099 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
12100 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
12101 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
12102 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
12103 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
12104 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
12105 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12106 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12107 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12108 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12109 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 12110 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12111 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12112 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12113 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
12114 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12115 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
12116 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12117 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12118 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12119 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12120 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12121 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12122 | |
12123 | /* "neighbor allowas-in" */ | |
12124 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
12125 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
12126 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
12127 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); | |
12128 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
12129 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
12130 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); | |
12131 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
12132 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
12133 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); | |
12134 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
12135 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
25ffbdc1 | 12136 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
12137 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
12138 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
718e3744 | 12139 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
12140 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
12141 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
12142 | ||
12143 | /* address-family commands. */ | |
12144 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
12145 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
12146 | #ifdef HAVE_IPV6 | |
12147 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 12148 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 12149 | #endif /* HAVE_IPV6 */ |
12150 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
12151 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
12152 | ||
12153 | /* "exit-address-family" command. */ | |
12154 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
12155 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
12156 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 12157 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 12158 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
12159 | ||
12160 | /* "clear ip bgp commands" */ | |
12161 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
12162 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
12163 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
12164 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); | |
12165 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); | |
12166 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); | |
12167 | #ifdef HAVE_IPV6 | |
12168 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); | |
12169 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
12170 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
12171 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); | |
12172 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); | |
12173 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); | |
12174 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); | |
12175 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); | |
12176 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); | |
12177 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); | |
12178 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); | |
12179 | #endif /* HAVE_IPV6 */ | |
12180 | ||
12181 | /* "clear ip bgp neighbor soft in" */ | |
12182 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
12183 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
12184 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
12185 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); | |
12186 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); | |
12187 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); | |
12188 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); | |
12189 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); | |
12190 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
12191 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); | |
12192 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); | |
12193 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
12194 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); | |
12195 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); | |
12196 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
12197 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); | |
12198 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); | |
12199 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
12200 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
12201 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
12202 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); | |
12203 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); | |
12204 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); | |
12205 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); | |
12206 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); | |
12207 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
12208 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); | |
12209 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); | |
12210 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
12211 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); | |
12212 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); | |
12213 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
12214 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); | |
12215 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); | |
12216 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
12217 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
12218 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
12219 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
12220 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
12221 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
12222 | #ifdef HAVE_IPV6 | |
12223 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); | |
12224 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
12225 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
12226 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); | |
12227 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
12228 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); | |
12229 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); | |
12230 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
12231 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); | |
12232 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); | |
12233 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
12234 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); | |
12235 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); | |
12236 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
12237 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); | |
12238 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); | |
12239 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
12240 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); | |
12241 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); | |
12242 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
12243 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); | |
12244 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); | |
12245 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
12246 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); | |
12247 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); | |
12248 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
12249 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); | |
12250 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); | |
12251 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
12252 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); | |
12253 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); | |
12254 | #endif /* HAVE_IPV6 */ | |
12255 | ||
8ad7271d DS |
12256 | /* clear ip bgp prefix */ |
12257 | install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); | |
12258 | install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); | |
12259 | ||
718e3744 | 12260 | /* "clear ip bgp neighbor soft out" */ |
12261 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
12262 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
12263 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
12264 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); | |
12265 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); | |
12266 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); | |
12267 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); | |
12268 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); | |
12269 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); | |
12270 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); | |
12271 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); | |
12272 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); | |
12273 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
12274 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
12275 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); | |
12276 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); | |
12277 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); | |
12278 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); | |
12279 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); | |
12280 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); | |
12281 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); | |
12282 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); | |
12283 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); | |
12284 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
12285 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
12286 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
12287 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
12288 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
12289 | #ifdef HAVE_IPV6 | |
12290 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); | |
12291 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
12292 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
12293 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); | |
12294 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); | |
12295 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); | |
12296 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); | |
12297 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); | |
12298 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); | |
12299 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); | |
12300 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); | |
12301 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); | |
12302 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); | |
12303 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); | |
12304 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); | |
12305 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); | |
12306 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); | |
12307 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); | |
12308 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); | |
12309 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); | |
12310 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); | |
12311 | #endif /* HAVE_IPV6 */ | |
12312 | ||
12313 | /* "clear ip bgp neighbor soft" */ | |
12314 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
12315 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
12316 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
12317 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); | |
12318 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); | |
12319 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); | |
12320 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); | |
12321 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
12322 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
12323 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); | |
12324 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); | |
12325 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); | |
12326 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); | |
12327 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
12328 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
12329 | #ifdef HAVE_IPV6 | |
12330 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); | |
12331 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
12332 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
12333 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); | |
12334 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); | |
12335 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); | |
12336 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); | |
12337 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); | |
12338 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); | |
12339 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); | |
12340 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); | |
12341 | #endif /* HAVE_IPV6 */ | |
12342 | ||
fee0f4c6 | 12343 | /* "clear ip bgp neighbor rsclient" */ |
12344 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); | |
12345 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); | |
12346 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); | |
12347 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); | |
12348 | #ifdef HAVE_IPV6 | |
12349 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); | |
12350 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); | |
12351 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); | |
12352 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); | |
12353 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); | |
12354 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); | |
12355 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); | |
12356 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); | |
12357 | #endif /* HAVE_IPV6 */ | |
12358 | ||
718e3744 | 12359 | /* "show ip bgp summary" commands. */ |
12360 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
12361 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); |
12362 | install_element (VIEW_NODE, &show_bgp_updgrps_cmd); | |
12363 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd); | |
12364 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); | |
12365 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd); | |
12366 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
12367 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_subgroup_cmd); | |
12368 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_subgroup_cmd); | |
12369 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_subgroup_cmd); | |
718e3744 | 12370 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
12371 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 12372 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 12373 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 12374 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 12375 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
12376 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
12377 | #ifdef HAVE_IPV6 | |
12378 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
12379 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); | |
12380 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 12381 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 12382 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 12383 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
12384 | #endif /* HAVE_IPV6 */ |
12385 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
12386 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); |
12387 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd); | |
12388 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd); | |
12389 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd); | |
12390 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd); | |
12391 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
12392 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_subgroup_cmd); | |
12393 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_subgroup_cmd); | |
12394 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_subgroup_cmd); | |
62687ff1 PJ |
12395 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
12396 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 12397 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
62687ff1 | 12398 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 12399 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
62687ff1 PJ |
12400 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
12401 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
12402 | #ifdef HAVE_IPV6 | |
12403 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
12404 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); | |
12405 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 12406 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
62687ff1 | 12407 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 12408 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 12409 | #endif /* HAVE_IPV6 */ |
12410 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
12411 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); |
12412 | install_element (ENABLE_NODE, &show_bgp_updgrps_cmd); | |
12413 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd); | |
12414 | install_element (ENABLE_NODE, &show_bgp_updgrps_stats_cmd); | |
12415 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd); | |
12416 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd); | |
12417 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
12418 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_subgroup_cmd); | |
12419 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_subgroup_cmd); | |
12420 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_subgroup_cmd); | |
718e3744 | 12421 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
12422 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 12423 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 12424 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 12425 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 12426 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
12427 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
12428 | #ifdef HAVE_IPV6 | |
12429 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
12430 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); | |
12431 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 12432 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 12433 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 12434 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 12435 | #endif /* HAVE_IPV6 */ |
12436 | ||
12437 | /* "show ip bgp neighbors" commands. */ | |
12438 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
12439 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
12440 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
12441 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
12442 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
12443 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
12444 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
12445 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
12446 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
12447 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
62687ff1 PJ |
12448 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
12449 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
12450 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
12451 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
12452 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 12453 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
12454 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
12455 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
12456 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
12457 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
12458 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
12459 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
12460 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
12461 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
12462 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
12463 | ||
12464 | #ifdef HAVE_IPV6 | |
12465 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
12466 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
12467 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
12468 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 12469 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
12470 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
12471 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
12472 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
12473 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
12474 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
12475 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
12476 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 12477 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
12478 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
12479 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
12480 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 12481 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
12482 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
12483 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
12484 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 12485 | |
12486 | /* Old commands. */ | |
12487 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
12488 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
12489 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
12490 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
12491 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 12492 | |
f14e6fdb DS |
12493 | /* "show ip bgp peer-group" commands. */ |
12494 | install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); | |
12495 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
12496 | install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd); | |
12497 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
12498 | install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd); | |
12499 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
12500 | install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd); | |
12501 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
12502 | ||
fee0f4c6 | 12503 | /* "show ip bgp rsclient" commands. */ |
12504 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); | |
12505 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
12506 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
12507 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
12508 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
12509 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
12510 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
12511 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
12512 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
12513 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
12514 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
12515 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 12516 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
12517 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
12518 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
12519 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
12520 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
12521 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 12522 | |
12523 | #ifdef HAVE_IPV6 | |
12524 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); | |
12525 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
12526 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
12527 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
12528 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
12529 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
12530 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
12531 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
12532 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
12533 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
12534 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
12535 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 12536 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
12537 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
12538 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
12539 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
12540 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
12541 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 12542 | #endif /* HAVE_IPV6 */ |
718e3744 | 12543 | |
12544 | /* "show ip bgp paths" commands. */ | |
12545 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
12546 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
12547 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
12548 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
12549 | ||
12550 | /* "show ip bgp community" commands. */ | |
12551 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
12552 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
12553 | ||
12554 | /* "show ip bgp attribute-info" commands. */ | |
12555 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
12556 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
12557 | ||
12558 | /* "redistribute" commands. */ | |
12559 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
12560 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
12561 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
12562 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
12563 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
12564 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
12565 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
12566 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
12567 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
12568 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
7c8ff89e DS |
12569 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd); |
12570 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
12571 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
12572 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
12573 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
12574 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
12575 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
12576 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
12577 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
12578 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
718e3744 | 12579 | #ifdef HAVE_IPV6 |
12580 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
12581 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
12582 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
12583 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
12584 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
12585 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
12586 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
12587 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
12588 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
12589 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
12590 | #endif /* HAVE_IPV6 */ | |
12591 | ||
fa411a21 NH |
12592 | /* ttl_security commands */ |
12593 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
12594 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
12595 | ||
4bf6a362 PJ |
12596 | /* "show bgp memory" commands. */ |
12597 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 12598 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
12599 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
12600 | ||
e0081f70 ML |
12601 | /* "show bgp views" commands. */ |
12602 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
12603 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
12604 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
12605 | ||
718e3744 | 12606 | /* Community-list. */ |
12607 | community_list_vty (); | |
12608 | } | |
6b0655a2 | 12609 | |
718e3744 | 12610 | #include "memory.h" |
12611 | #include "bgp_regex.h" | |
12612 | #include "bgp_clist.h" | |
12613 | #include "bgp_ecommunity.h" | |
12614 | ||
12615 | /* VTY functions. */ | |
12616 | ||
12617 | /* Direction value to string conversion. */ | |
94f2b392 | 12618 | static const char * |
718e3744 | 12619 | community_direct_str (int direct) |
12620 | { | |
12621 | switch (direct) | |
12622 | { | |
12623 | case COMMUNITY_DENY: | |
12624 | return "deny"; | |
718e3744 | 12625 | case COMMUNITY_PERMIT: |
12626 | return "permit"; | |
718e3744 | 12627 | default: |
12628 | return "unknown"; | |
718e3744 | 12629 | } |
12630 | } | |
12631 | ||
12632 | /* Display error string. */ | |
94f2b392 | 12633 | static void |
718e3744 | 12634 | community_list_perror (struct vty *vty, int ret) |
12635 | { | |
12636 | switch (ret) | |
12637 | { | |
12638 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 12639 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 12640 | break; |
12641 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
12642 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
12643 | break; | |
12644 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
12645 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
12646 | break; | |
12647 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
12648 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
12649 | break; | |
12650 | } | |
12651 | } | |
12652 | ||
12653 | /* VTY interface for community_set() function. */ | |
94f2b392 | 12654 | static int |
fd79ac91 | 12655 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
12656 | int style, int reject_all_digit_name) | |
718e3744 | 12657 | { |
12658 | int ret; | |
12659 | int direct; | |
12660 | char *str; | |
12661 | ||
12662 | /* Check the list type. */ | |
12663 | if (strncmp (argv[1], "p", 1) == 0) | |
12664 | direct = COMMUNITY_PERMIT; | |
12665 | else if (strncmp (argv[1], "d", 1) == 0) | |
12666 | direct = COMMUNITY_DENY; | |
12667 | else | |
12668 | { | |
12669 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
12670 | VTY_NEWLINE); | |
12671 | return CMD_WARNING; | |
12672 | } | |
12673 | ||
12674 | /* All digit name check. */ | |
12675 | if (reject_all_digit_name && all_digit (argv[0])) | |
12676 | { | |
12677 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
12678 | return CMD_WARNING; | |
12679 | } | |
12680 | ||
12681 | /* Concat community string argument. */ | |
12682 | if (argc > 1) | |
12683 | str = argv_concat (argv, argc, 2); | |
12684 | else | |
12685 | str = NULL; | |
12686 | ||
12687 | /* When community_list_set() return nevetive value, it means | |
12688 | malformed community string. */ | |
12689 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
12690 | ||
12691 | /* Free temporary community list string allocated by | |
12692 | argv_concat(). */ | |
12693 | if (str) | |
12694 | XFREE (MTYPE_TMP, str); | |
12695 | ||
12696 | if (ret < 0) | |
12697 | { | |
12698 | /* Display error string. */ | |
12699 | community_list_perror (vty, ret); | |
12700 | return CMD_WARNING; | |
12701 | } | |
12702 | ||
12703 | return CMD_SUCCESS; | |
12704 | } | |
12705 | ||
718e3744 | 12706 | /* Communiyt-list entry delete. */ |
94f2b392 | 12707 | static int |
fee6e4e4 | 12708 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
12709 | int style) | |
718e3744 | 12710 | { |
12711 | int ret; | |
fee6e4e4 | 12712 | int direct = 0; |
12713 | char *str = NULL; | |
718e3744 | 12714 | |
fee6e4e4 | 12715 | if (argc > 1) |
718e3744 | 12716 | { |
fee6e4e4 | 12717 | /* Check the list direct. */ |
12718 | if (strncmp (argv[1], "p", 1) == 0) | |
12719 | direct = COMMUNITY_PERMIT; | |
12720 | else if (strncmp (argv[1], "d", 1) == 0) | |
12721 | direct = COMMUNITY_DENY; | |
12722 | else | |
12723 | { | |
12724 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
12725 | VTY_NEWLINE); | |
12726 | return CMD_WARNING; | |
12727 | } | |
718e3744 | 12728 | |
fee6e4e4 | 12729 | /* Concat community string argument. */ |
12730 | str = argv_concat (argv, argc, 2); | |
12731 | } | |
718e3744 | 12732 | |
12733 | /* Unset community list. */ | |
12734 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); | |
12735 | ||
12736 | /* Free temporary community list string allocated by | |
12737 | argv_concat(). */ | |
fee6e4e4 | 12738 | if (str) |
12739 | XFREE (MTYPE_TMP, str); | |
718e3744 | 12740 | |
12741 | if (ret < 0) | |
12742 | { | |
12743 | community_list_perror (vty, ret); | |
12744 | return CMD_WARNING; | |
12745 | } | |
12746 | ||
12747 | return CMD_SUCCESS; | |
12748 | } | |
12749 | ||
12750 | /* "community-list" keyword help string. */ | |
12751 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
12752 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" | |
12753 | ||
718e3744 | 12754 | DEFUN (ip_community_list_standard, |
12755 | ip_community_list_standard_cmd, | |
12756 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
12757 | IP_STR | |
12758 | COMMUNITY_LIST_STR | |
12759 | "Community list number (standard)\n" | |
12760 | "Specify community to reject\n" | |
12761 | "Specify community to accept\n" | |
12762 | COMMUNITY_VAL_STR) | |
12763 | { | |
12764 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
12765 | } | |
12766 | ||
12767 | ALIAS (ip_community_list_standard, | |
12768 | ip_community_list_standard2_cmd, | |
12769 | "ip community-list <1-99> (deny|permit)", | |
12770 | IP_STR | |
12771 | COMMUNITY_LIST_STR | |
12772 | "Community list number (standard)\n" | |
12773 | "Specify community to reject\n" | |
12774 | "Specify community to accept\n") | |
12775 | ||
12776 | DEFUN (ip_community_list_expanded, | |
12777 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 12778 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 12779 | IP_STR |
12780 | COMMUNITY_LIST_STR | |
12781 | "Community list number (expanded)\n" | |
12782 | "Specify community to reject\n" | |
12783 | "Specify community to accept\n" | |
12784 | "An ordered list as a regular-expression\n") | |
12785 | { | |
12786 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
12787 | } | |
12788 | ||
12789 | DEFUN (ip_community_list_name_standard, | |
12790 | ip_community_list_name_standard_cmd, | |
12791 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
12792 | IP_STR | |
12793 | COMMUNITY_LIST_STR | |
12794 | "Add a standard community-list entry\n" | |
12795 | "Community list name\n" | |
12796 | "Specify community to reject\n" | |
12797 | "Specify community to accept\n" | |
12798 | COMMUNITY_VAL_STR) | |
12799 | { | |
12800 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
12801 | } | |
12802 | ||
12803 | ALIAS (ip_community_list_name_standard, | |
12804 | ip_community_list_name_standard2_cmd, | |
12805 | "ip community-list standard WORD (deny|permit)", | |
12806 | IP_STR | |
12807 | COMMUNITY_LIST_STR | |
12808 | "Add a standard community-list entry\n" | |
12809 | "Community list name\n" | |
12810 | "Specify community to reject\n" | |
12811 | "Specify community to accept\n") | |
12812 | ||
12813 | DEFUN (ip_community_list_name_expanded, | |
12814 | ip_community_list_name_expanded_cmd, | |
12815 | "ip community-list expanded WORD (deny|permit) .LINE", | |
12816 | IP_STR | |
12817 | COMMUNITY_LIST_STR | |
12818 | "Add an expanded community-list entry\n" | |
12819 | "Community list name\n" | |
12820 | "Specify community to reject\n" | |
12821 | "Specify community to accept\n" | |
12822 | "An ordered list as a regular-expression\n") | |
12823 | { | |
12824 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
12825 | } | |
12826 | ||
fee6e4e4 | 12827 | DEFUN (no_ip_community_list_standard_all, |
12828 | no_ip_community_list_standard_all_cmd, | |
12829 | "no ip community-list <1-99>", | |
12830 | NO_STR | |
12831 | IP_STR | |
12832 | COMMUNITY_LIST_STR | |
12833 | "Community list number (standard)\n") | |
12834 | { | |
12835 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
12836 | } | |
12837 | ||
12838 | DEFUN (no_ip_community_list_expanded_all, | |
12839 | no_ip_community_list_expanded_all_cmd, | |
12840 | "no ip community-list <100-500>", | |
718e3744 | 12841 | NO_STR |
12842 | IP_STR | |
12843 | COMMUNITY_LIST_STR | |
718e3744 | 12844 | "Community list number (expanded)\n") |
12845 | { | |
fee6e4e4 | 12846 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 12847 | } |
12848 | ||
fee6e4e4 | 12849 | DEFUN (no_ip_community_list_name_standard_all, |
12850 | no_ip_community_list_name_standard_all_cmd, | |
12851 | "no ip community-list standard WORD", | |
718e3744 | 12852 | NO_STR |
12853 | IP_STR | |
12854 | COMMUNITY_LIST_STR | |
12855 | "Add a standard community-list entry\n" | |
718e3744 | 12856 | "Community list name\n") |
12857 | { | |
fee6e4e4 | 12858 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
718e3744 | 12859 | } |
12860 | ||
fee6e4e4 | 12861 | DEFUN (no_ip_community_list_name_expanded_all, |
12862 | no_ip_community_list_name_expanded_all_cmd, | |
12863 | "no ip community-list expanded WORD", | |
718e3744 | 12864 | NO_STR |
12865 | IP_STR | |
12866 | COMMUNITY_LIST_STR | |
fee6e4e4 | 12867 | "Add an expanded community-list entry\n" |
12868 | "Community list name\n") | |
718e3744 | 12869 | { |
fee6e4e4 | 12870 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 12871 | } |
12872 | ||
12873 | DEFUN (no_ip_community_list_standard, | |
12874 | no_ip_community_list_standard_cmd, | |
12875 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
12876 | NO_STR | |
12877 | IP_STR | |
12878 | COMMUNITY_LIST_STR | |
12879 | "Community list number (standard)\n" | |
12880 | "Specify community to reject\n" | |
12881 | "Specify community to accept\n" | |
12882 | COMMUNITY_VAL_STR) | |
12883 | { | |
12884 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
12885 | } | |
12886 | ||
12887 | DEFUN (no_ip_community_list_expanded, | |
12888 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 12889 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 12890 | NO_STR |
12891 | IP_STR | |
12892 | COMMUNITY_LIST_STR | |
12893 | "Community list number (expanded)\n" | |
12894 | "Specify community to reject\n" | |
12895 | "Specify community to accept\n" | |
12896 | "An ordered list as a regular-expression\n") | |
12897 | { | |
12898 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
12899 | } | |
12900 | ||
12901 | DEFUN (no_ip_community_list_name_standard, | |
12902 | no_ip_community_list_name_standard_cmd, | |
12903 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
12904 | NO_STR | |
12905 | IP_STR | |
12906 | COMMUNITY_LIST_STR | |
12907 | "Specify a standard community-list\n" | |
12908 | "Community list name\n" | |
12909 | "Specify community to reject\n" | |
12910 | "Specify community to accept\n" | |
12911 | COMMUNITY_VAL_STR) | |
12912 | { | |
12913 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
12914 | } | |
12915 | ||
12916 | DEFUN (no_ip_community_list_name_expanded, | |
12917 | no_ip_community_list_name_expanded_cmd, | |
12918 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
12919 | NO_STR | |
12920 | IP_STR | |
12921 | COMMUNITY_LIST_STR | |
12922 | "Specify an expanded community-list\n" | |
12923 | "Community list name\n" | |
12924 | "Specify community to reject\n" | |
12925 | "Specify community to accept\n" | |
12926 | "An ordered list as a regular-expression\n") | |
12927 | { | |
12928 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
12929 | } | |
12930 | ||
94f2b392 | 12931 | static void |
718e3744 | 12932 | community_list_show (struct vty *vty, struct community_list *list) |
12933 | { | |
12934 | struct community_entry *entry; | |
12935 | ||
12936 | for (entry = list->head; entry; entry = entry->next) | |
12937 | { | |
12938 | if (entry == list->head) | |
12939 | { | |
12940 | if (all_digit (list->name)) | |
12941 | vty_out (vty, "Community %s list %s%s", | |
12942 | entry->style == COMMUNITY_LIST_STANDARD ? | |
12943 | "standard" : "(expanded) access", | |
12944 | list->name, VTY_NEWLINE); | |
12945 | else | |
12946 | vty_out (vty, "Named Community %s list %s%s", | |
12947 | entry->style == COMMUNITY_LIST_STANDARD ? | |
12948 | "standard" : "expanded", | |
12949 | list->name, VTY_NEWLINE); | |
12950 | } | |
12951 | if (entry->any) | |
12952 | vty_out (vty, " %s%s", | |
12953 | community_direct_str (entry->direct), VTY_NEWLINE); | |
12954 | else | |
12955 | vty_out (vty, " %s %s%s", | |
12956 | community_direct_str (entry->direct), | |
12957 | entry->style == COMMUNITY_LIST_STANDARD | |
12958 | ? community_str (entry->u.com) : entry->config, | |
12959 | VTY_NEWLINE); | |
12960 | } | |
12961 | } | |
12962 | ||
12963 | DEFUN (show_ip_community_list, | |
12964 | show_ip_community_list_cmd, | |
12965 | "show ip community-list", | |
12966 | SHOW_STR | |
12967 | IP_STR | |
12968 | "List community-list\n") | |
12969 | { | |
12970 | struct community_list *list; | |
12971 | struct community_list_master *cm; | |
12972 | ||
fee6e4e4 | 12973 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 12974 | if (! cm) |
12975 | return CMD_SUCCESS; | |
12976 | ||
12977 | for (list = cm->num.head; list; list = list->next) | |
12978 | community_list_show (vty, list); | |
12979 | ||
12980 | for (list = cm->str.head; list; list = list->next) | |
12981 | community_list_show (vty, list); | |
12982 | ||
12983 | return CMD_SUCCESS; | |
12984 | } | |
12985 | ||
12986 | DEFUN (show_ip_community_list_arg, | |
12987 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 12988 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 12989 | SHOW_STR |
12990 | IP_STR | |
12991 | "List community-list\n" | |
12992 | "Community-list number\n" | |
12993 | "Community-list name\n") | |
12994 | { | |
12995 | struct community_list *list; | |
12996 | ||
fee6e4e4 | 12997 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 12998 | if (! list) |
12999 | { | |
b729294c | 13000 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 13001 | return CMD_WARNING; |
13002 | } | |
13003 | ||
13004 | community_list_show (vty, list); | |
13005 | ||
13006 | return CMD_SUCCESS; | |
13007 | } | |
6b0655a2 | 13008 | |
94f2b392 | 13009 | static int |
fd79ac91 | 13010 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
13011 | int style, int reject_all_digit_name) | |
718e3744 | 13012 | { |
13013 | int ret; | |
13014 | int direct; | |
13015 | char *str; | |
13016 | ||
13017 | /* Check the list type. */ | |
13018 | if (strncmp (argv[1], "p", 1) == 0) | |
13019 | direct = COMMUNITY_PERMIT; | |
13020 | else if (strncmp (argv[1], "d", 1) == 0) | |
13021 | direct = COMMUNITY_DENY; | |
13022 | else | |
13023 | { | |
13024 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
13025 | VTY_NEWLINE); | |
13026 | return CMD_WARNING; | |
13027 | } | |
13028 | ||
13029 | /* All digit name check. */ | |
13030 | if (reject_all_digit_name && all_digit (argv[0])) | |
13031 | { | |
13032 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
13033 | return CMD_WARNING; | |
13034 | } | |
13035 | ||
13036 | /* Concat community string argument. */ | |
13037 | if (argc > 1) | |
13038 | str = argv_concat (argv, argc, 2); | |
13039 | else | |
13040 | str = NULL; | |
13041 | ||
13042 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
13043 | ||
13044 | /* Free temporary community list string allocated by | |
13045 | argv_concat(). */ | |
13046 | if (str) | |
13047 | XFREE (MTYPE_TMP, str); | |
13048 | ||
13049 | if (ret < 0) | |
13050 | { | |
13051 | community_list_perror (vty, ret); | |
13052 | return CMD_WARNING; | |
13053 | } | |
13054 | return CMD_SUCCESS; | |
13055 | } | |
13056 | ||
94f2b392 | 13057 | static int |
fee6e4e4 | 13058 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
13059 | int style) | |
718e3744 | 13060 | { |
13061 | int ret; | |
fee6e4e4 | 13062 | int direct = 0; |
13063 | char *str = NULL; | |
718e3744 | 13064 | |
fee6e4e4 | 13065 | if (argc > 1) |
718e3744 | 13066 | { |
fee6e4e4 | 13067 | /* Check the list direct. */ |
13068 | if (strncmp (argv[1], "p", 1) == 0) | |
13069 | direct = COMMUNITY_PERMIT; | |
13070 | else if (strncmp (argv[1], "d", 1) == 0) | |
13071 | direct = COMMUNITY_DENY; | |
13072 | else | |
13073 | { | |
13074 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
13075 | VTY_NEWLINE); | |
13076 | return CMD_WARNING; | |
13077 | } | |
718e3744 | 13078 | |
fee6e4e4 | 13079 | /* Concat community string argument. */ |
13080 | str = argv_concat (argv, argc, 2); | |
718e3744 | 13081 | } |
13082 | ||
718e3744 | 13083 | /* Unset community list. */ |
13084 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); | |
13085 | ||
13086 | /* Free temporary community list string allocated by | |
13087 | argv_concat(). */ | |
fee6e4e4 | 13088 | if (str) |
13089 | XFREE (MTYPE_TMP, str); | |
718e3744 | 13090 | |
13091 | if (ret < 0) | |
13092 | { | |
13093 | community_list_perror (vty, ret); | |
13094 | return CMD_WARNING; | |
13095 | } | |
13096 | ||
13097 | return CMD_SUCCESS; | |
13098 | } | |
13099 | ||
13100 | /* "extcommunity-list" keyword help string. */ | |
13101 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
13102 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
13103 | ||
13104 | DEFUN (ip_extcommunity_list_standard, | |
13105 | ip_extcommunity_list_standard_cmd, | |
13106 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
13107 | IP_STR | |
13108 | EXTCOMMUNITY_LIST_STR | |
13109 | "Extended Community list number (standard)\n" | |
13110 | "Specify community to reject\n" | |
13111 | "Specify community to accept\n" | |
13112 | EXTCOMMUNITY_VAL_STR) | |
13113 | { | |
13114 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
13115 | } | |
13116 | ||
13117 | ALIAS (ip_extcommunity_list_standard, | |
13118 | ip_extcommunity_list_standard2_cmd, | |
13119 | "ip extcommunity-list <1-99> (deny|permit)", | |
13120 | IP_STR | |
13121 | EXTCOMMUNITY_LIST_STR | |
13122 | "Extended Community list number (standard)\n" | |
13123 | "Specify community to reject\n" | |
13124 | "Specify community to accept\n") | |
13125 | ||
13126 | DEFUN (ip_extcommunity_list_expanded, | |
13127 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 13128 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 13129 | IP_STR |
13130 | EXTCOMMUNITY_LIST_STR | |
13131 | "Extended Community list number (expanded)\n" | |
13132 | "Specify community to reject\n" | |
13133 | "Specify community to accept\n" | |
13134 | "An ordered list as a regular-expression\n") | |
13135 | { | |
13136 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
13137 | } | |
13138 | ||
13139 | DEFUN (ip_extcommunity_list_name_standard, | |
13140 | ip_extcommunity_list_name_standard_cmd, | |
13141 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
13142 | IP_STR | |
13143 | EXTCOMMUNITY_LIST_STR | |
13144 | "Specify standard extcommunity-list\n" | |
13145 | "Extended Community list name\n" | |
13146 | "Specify community to reject\n" | |
13147 | "Specify community to accept\n" | |
13148 | EXTCOMMUNITY_VAL_STR) | |
13149 | { | |
13150 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
13151 | } | |
13152 | ||
13153 | ALIAS (ip_extcommunity_list_name_standard, | |
13154 | ip_extcommunity_list_name_standard2_cmd, | |
13155 | "ip extcommunity-list standard WORD (deny|permit)", | |
13156 | IP_STR | |
13157 | EXTCOMMUNITY_LIST_STR | |
13158 | "Specify standard extcommunity-list\n" | |
13159 | "Extended Community list name\n" | |
13160 | "Specify community to reject\n" | |
13161 | "Specify community to accept\n") | |
13162 | ||
13163 | DEFUN (ip_extcommunity_list_name_expanded, | |
13164 | ip_extcommunity_list_name_expanded_cmd, | |
13165 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
13166 | IP_STR | |
13167 | EXTCOMMUNITY_LIST_STR | |
13168 | "Specify expanded extcommunity-list\n" | |
13169 | "Extended Community list name\n" | |
13170 | "Specify community to reject\n" | |
13171 | "Specify community to accept\n" | |
13172 | "An ordered list as a regular-expression\n") | |
13173 | { | |
13174 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
13175 | } | |
13176 | ||
fee6e4e4 | 13177 | DEFUN (no_ip_extcommunity_list_standard_all, |
13178 | no_ip_extcommunity_list_standard_all_cmd, | |
13179 | "no ip extcommunity-list <1-99>", | |
13180 | NO_STR | |
13181 | IP_STR | |
13182 | EXTCOMMUNITY_LIST_STR | |
13183 | "Extended Community list number (standard)\n") | |
13184 | { | |
13185 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
13186 | } | |
13187 | ||
13188 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
13189 | no_ip_extcommunity_list_expanded_all_cmd, | |
13190 | "no ip extcommunity-list <100-500>", | |
718e3744 | 13191 | NO_STR |
13192 | IP_STR | |
13193 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 13194 | "Extended Community list number (expanded)\n") |
13195 | { | |
fee6e4e4 | 13196 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 13197 | } |
13198 | ||
fee6e4e4 | 13199 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
13200 | no_ip_extcommunity_list_name_standard_all_cmd, | |
13201 | "no ip extcommunity-list standard WORD", | |
718e3744 | 13202 | NO_STR |
13203 | IP_STR | |
13204 | EXTCOMMUNITY_LIST_STR | |
13205 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 13206 | "Extended Community list name\n") |
13207 | { | |
13208 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
13209 | } | |
13210 | ||
13211 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
13212 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
13213 | "no ip extcommunity-list expanded WORD", | |
13214 | NO_STR | |
13215 | IP_STR | |
13216 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 13217 | "Specify expanded extcommunity-list\n" |
13218 | "Extended Community list name\n") | |
13219 | { | |
fee6e4e4 | 13220 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 13221 | } |
13222 | ||
13223 | DEFUN (no_ip_extcommunity_list_standard, | |
13224 | no_ip_extcommunity_list_standard_cmd, | |
13225 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
13226 | NO_STR | |
13227 | IP_STR | |
13228 | EXTCOMMUNITY_LIST_STR | |
13229 | "Extended Community list number (standard)\n" | |
13230 | "Specify community to reject\n" | |
13231 | "Specify community to accept\n" | |
13232 | EXTCOMMUNITY_VAL_STR) | |
13233 | { | |
13234 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
13235 | } | |
13236 | ||
13237 | DEFUN (no_ip_extcommunity_list_expanded, | |
13238 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 13239 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 13240 | NO_STR |
13241 | IP_STR | |
13242 | EXTCOMMUNITY_LIST_STR | |
13243 | "Extended Community list number (expanded)\n" | |
13244 | "Specify community to reject\n" | |
13245 | "Specify community to accept\n" | |
13246 | "An ordered list as a regular-expression\n") | |
13247 | { | |
13248 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
13249 | } | |
13250 | ||
13251 | DEFUN (no_ip_extcommunity_list_name_standard, | |
13252 | no_ip_extcommunity_list_name_standard_cmd, | |
13253 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
13254 | NO_STR | |
13255 | IP_STR | |
13256 | EXTCOMMUNITY_LIST_STR | |
13257 | "Specify standard extcommunity-list\n" | |
13258 | "Extended Community list name\n" | |
13259 | "Specify community to reject\n" | |
13260 | "Specify community to accept\n" | |
13261 | EXTCOMMUNITY_VAL_STR) | |
13262 | { | |
13263 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
13264 | } | |
13265 | ||
13266 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
13267 | no_ip_extcommunity_list_name_expanded_cmd, | |
13268 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
13269 | NO_STR | |
13270 | IP_STR | |
13271 | EXTCOMMUNITY_LIST_STR | |
13272 | "Specify expanded extcommunity-list\n" | |
13273 | "Community list name\n" | |
13274 | "Specify community to reject\n" | |
13275 | "Specify community to accept\n" | |
13276 | "An ordered list as a regular-expression\n") | |
13277 | { | |
13278 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
13279 | } | |
13280 | ||
94f2b392 | 13281 | static void |
718e3744 | 13282 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
13283 | { | |
13284 | struct community_entry *entry; | |
13285 | ||
13286 | for (entry = list->head; entry; entry = entry->next) | |
13287 | { | |
13288 | if (entry == list->head) | |
13289 | { | |
13290 | if (all_digit (list->name)) | |
13291 | vty_out (vty, "Extended community %s list %s%s", | |
13292 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
13293 | "standard" : "(expanded) access", | |
13294 | list->name, VTY_NEWLINE); | |
13295 | else | |
13296 | vty_out (vty, "Named extended community %s list %s%s", | |
13297 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
13298 | "standard" : "expanded", | |
13299 | list->name, VTY_NEWLINE); | |
13300 | } | |
13301 | if (entry->any) | |
13302 | vty_out (vty, " %s%s", | |
13303 | community_direct_str (entry->direct), VTY_NEWLINE); | |
13304 | else | |
13305 | vty_out (vty, " %s %s%s", | |
13306 | community_direct_str (entry->direct), | |
13307 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
13308 | entry->u.ecom->str : entry->config, | |
13309 | VTY_NEWLINE); | |
13310 | } | |
13311 | } | |
13312 | ||
13313 | DEFUN (show_ip_extcommunity_list, | |
13314 | show_ip_extcommunity_list_cmd, | |
13315 | "show ip extcommunity-list", | |
13316 | SHOW_STR | |
13317 | IP_STR | |
13318 | "List extended-community list\n") | |
13319 | { | |
13320 | struct community_list *list; | |
13321 | struct community_list_master *cm; | |
13322 | ||
fee6e4e4 | 13323 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 13324 | if (! cm) |
13325 | return CMD_SUCCESS; | |
13326 | ||
13327 | for (list = cm->num.head; list; list = list->next) | |
13328 | extcommunity_list_show (vty, list); | |
13329 | ||
13330 | for (list = cm->str.head; list; list = list->next) | |
13331 | extcommunity_list_show (vty, list); | |
13332 | ||
13333 | return CMD_SUCCESS; | |
13334 | } | |
13335 | ||
13336 | DEFUN (show_ip_extcommunity_list_arg, | |
13337 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 13338 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 13339 | SHOW_STR |
13340 | IP_STR | |
13341 | "List extended-community list\n" | |
13342 | "Extcommunity-list number\n" | |
13343 | "Extcommunity-list name\n") | |
13344 | { | |
13345 | struct community_list *list; | |
13346 | ||
fee6e4e4 | 13347 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 13348 | if (! list) |
13349 | { | |
b729294c | 13350 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 13351 | return CMD_WARNING; |
13352 | } | |
13353 | ||
13354 | extcommunity_list_show (vty, list); | |
13355 | ||
13356 | return CMD_SUCCESS; | |
13357 | } | |
6b0655a2 | 13358 | |
718e3744 | 13359 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 13360 | static const char * |
718e3744 | 13361 | community_list_config_str (struct community_entry *entry) |
13362 | { | |
fd79ac91 | 13363 | const char *str; |
718e3744 | 13364 | |
13365 | if (entry->any) | |
13366 | str = ""; | |
13367 | else | |
13368 | { | |
13369 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
13370 | str = community_str (entry->u.com); | |
13371 | else | |
13372 | str = entry->config; | |
13373 | } | |
13374 | return str; | |
13375 | } | |
13376 | ||
13377 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 13378 | static int |
718e3744 | 13379 | community_list_config_write (struct vty *vty) |
13380 | { | |
13381 | struct community_list *list; | |
13382 | struct community_entry *entry; | |
13383 | struct community_list_master *cm; | |
13384 | int write = 0; | |
13385 | ||
13386 | /* Community-list. */ | |
fee6e4e4 | 13387 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 13388 | |
13389 | for (list = cm->num.head; list; list = list->next) | |
13390 | for (entry = list->head; entry; entry = entry->next) | |
13391 | { | |
fee6e4e4 | 13392 | vty_out (vty, "ip community-list %s %s %s%s", |
13393 | list->name, community_direct_str (entry->direct), | |
13394 | community_list_config_str (entry), | |
13395 | VTY_NEWLINE); | |
718e3744 | 13396 | write++; |
13397 | } | |
13398 | for (list = cm->str.head; list; list = list->next) | |
13399 | for (entry = list->head; entry; entry = entry->next) | |
13400 | { | |
13401 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
13402 | entry->style == COMMUNITY_LIST_STANDARD | |
13403 | ? "standard" : "expanded", | |
13404 | list->name, community_direct_str (entry->direct), | |
13405 | community_list_config_str (entry), | |
13406 | VTY_NEWLINE); | |
13407 | write++; | |
13408 | } | |
13409 | ||
13410 | /* Extcommunity-list. */ | |
fee6e4e4 | 13411 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 13412 | |
13413 | for (list = cm->num.head; list; list = list->next) | |
13414 | for (entry = list->head; entry; entry = entry->next) | |
13415 | { | |
fee6e4e4 | 13416 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
13417 | list->name, community_direct_str (entry->direct), | |
13418 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 13419 | write++; |
13420 | } | |
13421 | for (list = cm->str.head; list; list = list->next) | |
13422 | for (entry = list->head; entry; entry = entry->next) | |
13423 | { | |
13424 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
13425 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
13426 | ? "standard" : "expanded", | |
13427 | list->name, community_direct_str (entry->direct), | |
13428 | community_list_config_str (entry), VTY_NEWLINE); | |
13429 | write++; | |
13430 | } | |
13431 | return write; | |
13432 | } | |
13433 | ||
7fc626de | 13434 | static struct cmd_node community_list_node = |
718e3744 | 13435 | { |
13436 | COMMUNITY_LIST_NODE, | |
13437 | "", | |
13438 | 1 /* Export to vtysh. */ | |
13439 | }; | |
13440 | ||
94f2b392 | 13441 | static void |
13442 | community_list_vty (void) | |
718e3744 | 13443 | { |
13444 | install_node (&community_list_node, community_list_config_write); | |
13445 | ||
13446 | /* Community-list. */ | |
718e3744 | 13447 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
13448 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
13449 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
13450 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
13451 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
13452 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 13453 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
13454 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); | |
13455 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
13456 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 13457 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
13458 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
13459 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
13460 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); | |
13461 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
13462 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
13463 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
13464 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
13465 | ||
13466 | /* Extcommunity-list. */ | |
13467 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
13468 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
13469 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
13470 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
13471 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
13472 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 13473 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
13474 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); | |
13475 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
13476 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 13477 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
13478 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
13479 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
13480 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); | |
13481 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
13482 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
13483 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
13484 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
13485 | } |