]>
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 | ||
856ca177 | 23 | #include "lib/json.h" |
718e3744 | 24 | #include "command.h" |
25 | #include "prefix.h" | |
26 | #include "plist.h" | |
27 | #include "buffer.h" | |
28 | #include "linklist.h" | |
29 | #include "stream.h" | |
30 | #include "thread.h" | |
31 | #include "log.h" | |
3b8b1855 | 32 | #include "memory.h" |
4bf6a362 | 33 | #include "hash.h" |
3f9c7369 | 34 | #include "queue.h" |
039f3a34 | 35 | #include "filter.h" |
718e3744 | 36 | |
37 | #include "bgpd/bgpd.h" | |
4bf6a362 | 38 | #include "bgpd/bgp_advertise.h" |
718e3744 | 39 | #include "bgpd/bgp_attr.h" |
40 | #include "bgpd/bgp_aspath.h" | |
41 | #include "bgpd/bgp_community.h" | |
4bf6a362 PJ |
42 | #include "bgpd/bgp_ecommunity.h" |
43 | #include "bgpd/bgp_damp.h" | |
718e3744 | 44 | #include "bgpd/bgp_debug.h" |
e0701b79 | 45 | #include "bgpd/bgp_fsm.h" |
718e3744 | 46 | #include "bgpd/bgp_mplsvpn.h" |
4bf6a362 | 47 | #include "bgpd/bgp_nexthop.h" |
718e3744 | 48 | #include "bgpd/bgp_open.h" |
4bf6a362 | 49 | #include "bgpd/bgp_regex.h" |
718e3744 | 50 | #include "bgpd/bgp_route.h" |
51 | #include "bgpd/bgp_zebra.h" | |
fee0f4c6 | 52 | #include "bgpd/bgp_table.h" |
94f2b392 | 53 | #include "bgpd/bgp_vty.h" |
165b5fff | 54 | #include "bgpd/bgp_mpath.h" |
cb1faec9 | 55 | #include "bgpd/bgp_packet.h" |
3f9c7369 | 56 | #include "bgpd/bgp_updgrp.h" |
c43ed2e4 | 57 | #include "bgpd/bgp_bfd.h" |
718e3744 | 58 | |
20eb8864 | 59 | static struct peer_group * |
60 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact); | |
61 | ||
718e3744 | 62 | /* Utility function to get address family from current node. */ |
63 | afi_t | |
64 | bgp_node_afi (struct vty *vty) | |
65 | { | |
8ecd3266 | 66 | if (vty->node == BGP_IPV6_NODE || |
67 | vty->node == BGP_IPV6M_NODE || | |
8b1fb8be LB |
68 | vty->node == BGP_VPNV6_NODE || |
69 | vty->node == BGP_ENCAPV6_NODE) | |
718e3744 | 70 | return AFI_IP6; |
71 | return AFI_IP; | |
72 | } | |
73 | ||
74 | /* Utility function to get subsequent address family from current | |
75 | node. */ | |
76 | safi_t | |
77 | bgp_node_safi (struct vty *vty) | |
78 | { | |
6407da5a | 79 | if (vty->node == BGP_VPNV4_NODE || vty->node == BGP_VPNV6_NODE) |
8ecd3266 | 80 | return SAFI_MPLS_VPN; |
8b1fb8be LB |
81 | if (vty->node == BGP_ENCAP_NODE || vty->node == BGP_ENCAPV6_NODE) |
82 | return SAFI_ENCAP; | |
25ffbdc1 | 83 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 84 | return SAFI_MULTICAST; |
85 | return SAFI_UNICAST; | |
86 | } | |
87 | ||
8b1fb8be LB |
88 | int |
89 | bgp_parse_afi(const char *str, afi_t *afi) | |
90 | { | |
91 | if (!strcmp(str, "ipv4")) { | |
92 | *afi = AFI_IP; | |
93 | return 0; | |
94 | } | |
95 | #ifdef HAVE_IPV6 | |
96 | if (!strcmp(str, "ipv6")) { | |
97 | *afi = AFI_IP6; | |
98 | return 0; | |
99 | } | |
100 | #endif /* HAVE_IPV6 */ | |
101 | return -1; | |
102 | } | |
103 | ||
104 | int | |
105 | bgp_parse_safi(const char *str, safi_t *safi) | |
106 | { | |
107 | if (!strcmp(str, "encap")) { | |
108 | *safi = SAFI_ENCAP; | |
109 | return 0; | |
110 | } | |
111 | if (!strcmp(str, "multicast")) { | |
112 | *safi = SAFI_MULTICAST; | |
113 | return 0; | |
114 | } | |
115 | if (!strcmp(str, "unicast")) { | |
116 | *safi = SAFI_UNICAST; | |
117 | return 0; | |
118 | } | |
119 | if (!strcmp(str, "vpn")) { | |
120 | *safi = SAFI_MPLS_VPN; | |
121 | return 0; | |
122 | } | |
123 | return -1; | |
124 | } | |
125 | ||
94f2b392 | 126 | static int |
6aeb9e78 | 127 | peer_address_self_check (struct bgp *bgp, union sockunion *su) |
718e3744 | 128 | { |
129 | struct interface *ifp = NULL; | |
130 | ||
131 | if (su->sa.sa_family == AF_INET) | |
6aeb9e78 | 132 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr, bgp->vrf_id); |
718e3744 | 133 | #ifdef HAVE_IPV6 |
134 | else if (su->sa.sa_family == AF_INET6) | |
f2345335 | 135 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr, |
6aeb9e78 | 136 | su->sin6.sin6_scope_id, bgp->vrf_id); |
718e3744 | 137 | #endif /* HAVE IPV6 */ |
138 | ||
139 | if (ifp) | |
140 | return 1; | |
141 | ||
142 | return 0; | |
143 | } | |
144 | ||
145 | /* Utility function for looking up peer from VTY. */ | |
f14e6fdb DS |
146 | /* This is used only for configuration, so disallow if attempted on |
147 | * a dynamic neighbor. | |
148 | */ | |
94f2b392 | 149 | static struct peer * |
fd79ac91 | 150 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 151 | { |
152 | int ret; | |
153 | struct bgp *bgp; | |
154 | union sockunion su; | |
155 | struct peer *peer; | |
156 | ||
157 | bgp = vty->index; | |
158 | ||
159 | ret = str2sockunion (ip_str, &su); | |
160 | if (ret < 0) | |
161 | { | |
a80beece DS |
162 | peer = peer_lookup_by_conf_if (bgp, ip_str); |
163 | if (!peer) | |
164 | { | |
04b6bdc0 DW |
165 | if ((peer = peer_lookup_by_hostname(bgp, ip_str)) == NULL) |
166 | { | |
167 | vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE); | |
168 | return NULL; | |
169 | } | |
a80beece | 170 | } |
718e3744 | 171 | } |
a80beece | 172 | else |
718e3744 | 173 | { |
a80beece DS |
174 | peer = peer_lookup (bgp, &su); |
175 | if (! peer) | |
176 | { | |
177 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
178 | VTY_NEWLINE); | |
179 | return NULL; | |
180 | } | |
f14e6fdb DS |
181 | if (peer_dynamic_neighbor (peer)) |
182 | { | |
183 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
184 | VTY_NEWLINE); | |
185 | return NULL; | |
186 | } | |
187 | ||
718e3744 | 188 | } |
189 | return peer; | |
190 | } | |
191 | ||
192 | /* Utility function for looking up peer or peer group. */ | |
f14e6fdb DS |
193 | /* This is used only for configuration, so disallow if attempted on |
194 | * a dynamic neighbor. | |
195 | */ | |
c43ed2e4 | 196 | struct peer * |
fd79ac91 | 197 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 198 | { |
199 | int ret; | |
200 | struct bgp *bgp; | |
201 | union sockunion su; | |
f14e6fdb DS |
202 | struct peer *peer = NULL; |
203 | struct peer_group *group = NULL; | |
718e3744 | 204 | |
205 | bgp = vty->index; | |
206 | ||
207 | ret = str2sockunion (peer_str, &su); | |
208 | if (ret == 0) | |
209 | { | |
f14e6fdb | 210 | /* IP address, locate peer. */ |
718e3744 | 211 | peer = peer_lookup (bgp, &su); |
718e3744 | 212 | } |
213 | else | |
214 | { | |
f14e6fdb | 215 | /* Not IP, could match either peer configured on interface or a group. */ |
a80beece | 216 | peer = peer_lookup_by_conf_if (bgp, peer_str); |
f14e6fdb DS |
217 | if (!peer) |
218 | group = peer_group_lookup (bgp, peer_str); | |
219 | } | |
a80beece | 220 | |
f14e6fdb DS |
221 | if (peer) |
222 | { | |
223 | if (peer_dynamic_neighbor (peer)) | |
224 | { | |
225 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
226 | VTY_NEWLINE); | |
227 | return NULL; | |
228 | } | |
229 | ||
230 | return peer; | |
718e3744 | 231 | } |
232 | ||
f14e6fdb DS |
233 | if (group) |
234 | return group->conf; | |
235 | ||
718e3744 | 236 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
237 | VTY_NEWLINE); | |
238 | ||
239 | return NULL; | |
240 | } | |
241 | ||
c43ed2e4 | 242 | int |
718e3744 | 243 | bgp_vty_return (struct vty *vty, int ret) |
244 | { | |
fd79ac91 | 245 | const char *str = NULL; |
718e3744 | 246 | |
247 | switch (ret) | |
248 | { | |
249 | case BGP_ERR_INVALID_VALUE: | |
250 | str = "Invalid value"; | |
251 | break; | |
252 | case BGP_ERR_INVALID_FLAG: | |
253 | str = "Invalid flag"; | |
254 | break; | |
718e3744 | 255 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
256 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
257 | break; | |
718e3744 | 258 | case BGP_ERR_PEER_FLAG_CONFLICT: |
259 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
260 | break; | |
718e3744 | 261 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
262 | str = "Specify remote-as or peer-group remote AS first"; | |
263 | break; | |
264 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
265 | str = "Cannot change the peer-group. Deconfigure first"; | |
266 | break; | |
267 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
4c48cf63 | 268 | str = "Peer is not a member of this peer-group"; |
718e3744 | 269 | break; |
270 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
271 | str = "Prefix/distribute list can not co-exist"; | |
272 | break; | |
273 | case BGP_ERR_NOT_INTERNAL_PEER: | |
274 | str = "Invalid command. Not an internal neighbor"; | |
275 | break; | |
276 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
5000f21c | 277 | str = "remove-private-AS cannot be configured for IBGP peers"; |
718e3744 | 278 | break; |
279 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
280 | str = "Local-AS allowed only for EBGP peers"; | |
281 | break; | |
282 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
283 | str = "Cannot have local-as same as BGP AS number"; | |
284 | break; | |
0df7c91f PJ |
285 | case BGP_ERR_TCPSIG_FAILED: |
286 | str = "Error while applying TCP-Sig to session(s)"; | |
287 | break; | |
fa411a21 NH |
288 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
289 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
290 | break; | |
f5a4827d SH |
291 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
292 | str = "ttl-security only allowed for EBGP peers"; | |
293 | break; | |
c7122e14 DS |
294 | case BGP_ERR_AS_OVERRIDE: |
295 | str = "as-override cannot be configured for IBGP peers"; | |
296 | break; | |
f14e6fdb DS |
297 | case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT: |
298 | str = "Invalid limit for number of dynamic neighbors"; | |
299 | break; | |
300 | case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS: | |
301 | str = "Dynamic neighbor listen range already exists"; | |
302 | break; | |
303 | case BGP_ERR_INVALID_FOR_DYNAMIC_PEER: | |
304 | str = "Operation not allowed on a dynamic neighbor"; | |
305 | break; | |
63fa10b5 QY |
306 | case BGP_ERR_INVALID_FOR_DIRECT_PEER: |
307 | str = "Operation not allowed on a directly connected neighbor"; | |
308 | break; | |
718e3744 | 309 | } |
310 | if (str) | |
311 | { | |
312 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
313 | return CMD_WARNING; | |
314 | } | |
315 | return CMD_SUCCESS; | |
316 | } | |
317 | ||
7aafcaca DS |
318 | /* BGP clear sort. */ |
319 | enum clear_sort | |
320 | { | |
321 | clear_all, | |
322 | clear_peer, | |
323 | clear_group, | |
324 | clear_external, | |
325 | clear_as | |
326 | }; | |
327 | ||
7aafcaca DS |
328 | static void |
329 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, | |
330 | safi_t safi, int error) | |
331 | { | |
332 | switch (error) | |
333 | { | |
334 | case BGP_ERR_AF_UNCONFIGURED: | |
335 | vty_out (vty, | |
336 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
337 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
338 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
339 | peer->host, VTY_NEWLINE); | |
340 | break; | |
341 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
342 | 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); | |
343 | break; | |
344 | default: | |
345 | break; | |
346 | } | |
347 | } | |
348 | ||
349 | /* `clear ip bgp' functions. */ | |
350 | static int | |
351 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, | |
352 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) | |
353 | { | |
354 | int ret; | |
355 | struct peer *peer; | |
356 | struct listnode *node, *nnode; | |
357 | ||
358 | /* Clear all neighbors. */ | |
359 | /* | |
360 | * Pass along pointer to next node to peer_clear() when walking all nodes | |
361 | * on the BGP instance as that may get freed if it is a doppelganger | |
362 | */ | |
363 | if (sort == clear_all) | |
364 | { | |
365 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
366 | { | |
367 | if (stype == BGP_CLEAR_SOFT_NONE) | |
368 | ret = peer_clear (peer, &nnode); | |
369 | else if (peer->afc[afi][safi]) | |
370 | ret = peer_clear_soft (peer, afi, safi, stype); | |
371 | else | |
372 | ret = 0; | |
373 | ||
374 | if (ret < 0) | |
375 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
376 | } | |
377 | ||
378 | /* This is to apply read-only mode on this clear. */ | |
379 | if (stype == BGP_CLEAR_SOFT_NONE) | |
380 | bgp->update_delay_over = 0; | |
381 | ||
382 | return CMD_SUCCESS; | |
383 | } | |
384 | ||
385 | /* Clear specified neighbors. */ | |
386 | if (sort == clear_peer) | |
387 | { | |
388 | union sockunion su; | |
389 | int ret; | |
390 | ||
391 | /* Make sockunion for lookup. */ | |
392 | ret = str2sockunion (arg, &su); | |
393 | if (ret < 0) | |
394 | { | |
395 | peer = peer_lookup_by_conf_if (bgp, arg); | |
396 | if (!peer) | |
397 | { | |
04b6bdc0 DW |
398 | peer = peer_lookup_by_hostname(bgp, arg); |
399 | if (!peer) | |
400 | { | |
401 | vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE); | |
402 | return CMD_WARNING; | |
403 | } | |
7aafcaca DS |
404 | } |
405 | } | |
406 | else | |
407 | { | |
408 | peer = peer_lookup (bgp, &su); | |
409 | if (! peer) | |
410 | { | |
411 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
412 | return CMD_WARNING; | |
413 | } | |
414 | } | |
415 | ||
416 | if (stype == BGP_CLEAR_SOFT_NONE) | |
417 | ret = peer_clear (peer, NULL); | |
418 | else | |
419 | ret = peer_clear_soft (peer, afi, safi, stype); | |
420 | ||
421 | if (ret < 0) | |
422 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
423 | ||
424 | return CMD_SUCCESS; | |
425 | } | |
426 | ||
427 | /* Clear all peer-group members. */ | |
428 | if (sort == clear_group) | |
429 | { | |
430 | struct peer_group *group; | |
431 | ||
432 | group = peer_group_lookup (bgp, arg); | |
433 | if (! group) | |
434 | { | |
435 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
436 | return CMD_WARNING; | |
437 | } | |
438 | ||
439 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
440 | { | |
441 | if (stype == BGP_CLEAR_SOFT_NONE) | |
442 | { | |
18f1dc06 | 443 | peer_clear (peer, NULL); |
7aafcaca DS |
444 | continue; |
445 | } | |
446 | ||
c8560b44 | 447 | if (! peer->afc[afi][safi]) |
7aafcaca DS |
448 | continue; |
449 | ||
450 | ret = peer_clear_soft (peer, afi, safi, stype); | |
451 | ||
452 | if (ret < 0) | |
453 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
454 | } | |
455 | return CMD_SUCCESS; | |
456 | } | |
457 | ||
458 | if (sort == clear_external) | |
459 | { | |
460 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
461 | { | |
462 | if (peer->sort == BGP_PEER_IBGP) | |
463 | continue; | |
464 | ||
465 | if (stype == BGP_CLEAR_SOFT_NONE) | |
466 | ret = peer_clear (peer, &nnode); | |
467 | else | |
468 | ret = peer_clear_soft (peer, afi, safi, stype); | |
469 | ||
470 | if (ret < 0) | |
471 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
472 | } | |
473 | return CMD_SUCCESS; | |
474 | } | |
475 | ||
476 | if (sort == clear_as) | |
477 | { | |
478 | as_t as; | |
479 | int find = 0; | |
480 | ||
481 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); | |
482 | ||
483 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
484 | { | |
485 | if (peer->as != as) | |
486 | continue; | |
487 | ||
488 | find = 1; | |
489 | if (stype == BGP_CLEAR_SOFT_NONE) | |
490 | ret = peer_clear (peer, &nnode); | |
491 | else | |
492 | ret = peer_clear_soft (peer, afi, safi, stype); | |
493 | ||
494 | if (ret < 0) | |
495 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
496 | } | |
497 | if (! find) | |
498 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
499 | VTY_NEWLINE); | |
500 | return CMD_SUCCESS; | |
501 | } | |
502 | ||
503 | return CMD_SUCCESS; | |
504 | } | |
505 | ||
506 | static int | |
507 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, | |
508 | enum clear_sort sort, enum bgp_clear_type stype, | |
509 | const char *arg) | |
510 | { | |
511 | struct bgp *bgp; | |
512 | ||
513 | /* BGP structure lookup. */ | |
514 | if (name) | |
515 | { | |
516 | bgp = bgp_lookup_by_name (name); | |
517 | if (bgp == NULL) | |
518 | { | |
6aeb9e78 | 519 | vty_out (vty, "Can't find BGP instance %s%s", name, VTY_NEWLINE); |
7aafcaca DS |
520 | return CMD_WARNING; |
521 | } | |
522 | } | |
523 | else | |
524 | { | |
f31fa004 | 525 | bgp = bgp_get_default (); |
7aafcaca DS |
526 | if (bgp == NULL) |
527 | { | |
528 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
529 | return CMD_WARNING; | |
530 | } | |
531 | } | |
532 | ||
533 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); | |
534 | } | |
535 | ||
536 | /* clear soft inbound */ | |
537 | static void | |
f31fa004 | 538 | bgp_clear_star_soft_in (struct vty *vty, const char *name) |
7aafcaca | 539 | { |
f31fa004 | 540 | bgp_clear_vty (vty,name, AFI_IP, SAFI_UNICAST, clear_all, |
7aafcaca | 541 | BGP_CLEAR_SOFT_IN, NULL); |
f31fa004 | 542 | bgp_clear_vty (vty, name, AFI_IP6, SAFI_UNICAST, clear_all, |
7aafcaca | 543 | BGP_CLEAR_SOFT_IN, NULL); |
7aafcaca DS |
544 | } |
545 | ||
546 | /* clear soft outbound */ | |
547 | static void | |
f31fa004 | 548 | bgp_clear_star_soft_out (struct vty *vty, const char *name) |
7aafcaca | 549 | { |
f31fa004 | 550 | bgp_clear_vty (vty, name, AFI_IP, SAFI_UNICAST, clear_all, |
7aafcaca | 551 | BGP_CLEAR_SOFT_OUT, NULL); |
f31fa004 | 552 | bgp_clear_vty (vty, name, AFI_IP6, SAFI_UNICAST, clear_all, |
7aafcaca | 553 | BGP_CLEAR_SOFT_OUT, NULL); |
7aafcaca DS |
554 | } |
555 | ||
556 | ||
718e3744 | 557 | /* BGP global configuration. */ |
558 | ||
559 | DEFUN (bgp_multiple_instance_func, | |
560 | bgp_multiple_instance_cmd, | |
561 | "bgp multiple-instance", | |
562 | BGP_STR | |
563 | "Enable bgp multiple instance\n") | |
564 | { | |
565 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
566 | return CMD_SUCCESS; | |
567 | } | |
568 | ||
569 | DEFUN (no_bgp_multiple_instance, | |
570 | no_bgp_multiple_instance_cmd, | |
571 | "no bgp multiple-instance", | |
572 | NO_STR | |
573 | BGP_STR | |
574 | "BGP multiple instance\n") | |
575 | { | |
576 | int ret; | |
577 | ||
578 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
579 | if (ret < 0) | |
580 | { | |
581 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
582 | return CMD_WARNING; | |
583 | } | |
584 | return CMD_SUCCESS; | |
585 | } | |
586 | ||
587 | DEFUN (bgp_config_type, | |
588 | bgp_config_type_cmd, | |
589 | "bgp config-type (cisco|zebra)", | |
590 | BGP_STR | |
591 | "Configuration type\n" | |
592 | "cisco\n" | |
593 | "zebra\n") | |
594 | { | |
595 | if (strncmp (argv[0], "c", 1) == 0) | |
596 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
597 | else | |
598 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
599 | ||
600 | return CMD_SUCCESS; | |
601 | } | |
602 | ||
603 | DEFUN (no_bgp_config_type, | |
604 | no_bgp_config_type_cmd, | |
605 | "no bgp config-type", | |
606 | NO_STR | |
607 | BGP_STR | |
608 | "Display configuration type\n") | |
609 | { | |
610 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
611 | return CMD_SUCCESS; | |
612 | } | |
613 | ||
813d4307 DW |
614 | ALIAS (no_bgp_config_type, |
615 | no_bgp_config_type_val_cmd, | |
616 | "no bgp config-type (cisco|zebra)", | |
617 | NO_STR | |
618 | BGP_STR | |
619 | "Configuration type\n" | |
620 | "cisco\n" | |
621 | "zebra\n") | |
622 | ||
718e3744 | 623 | DEFUN (no_synchronization, |
624 | no_synchronization_cmd, | |
625 | "no synchronization", | |
626 | NO_STR | |
627 | "Perform IGP synchronization\n") | |
628 | { | |
629 | return CMD_SUCCESS; | |
630 | } | |
631 | ||
632 | DEFUN (no_auto_summary, | |
633 | no_auto_summary_cmd, | |
634 | "no auto-summary", | |
635 | NO_STR | |
636 | "Enable automatic network number summarization\n") | |
637 | { | |
638 | return CMD_SUCCESS; | |
639 | } | |
3d515fd9 | 640 | |
718e3744 | 641 | /* "router bgp" commands. */ |
642 | DEFUN (router_bgp, | |
643 | router_bgp_cmd, | |
320da874 | 644 | "router bgp " CMD_AS_RANGE, |
718e3744 | 645 | ROUTER_STR |
646 | BGP_STR | |
647 | AS_STR) | |
648 | { | |
649 | int ret; | |
650 | as_t as; | |
651 | struct bgp *bgp; | |
fd79ac91 | 652 | const char *name = NULL; |
ad4cbda1 | 653 | enum bgp_instance_type inst_type; |
718e3744 | 654 | |
2385a876 DW |
655 | // "router bgp" without an ASN |
656 | if (argc < 1) | |
657 | { | |
6aeb9e78 | 658 | //Pending: Make VRF option available for ASN less config |
2385a876 | 659 | bgp = bgp_get_default(); |
718e3744 | 660 | |
2385a876 DW |
661 | if (bgp == NULL) |
662 | { | |
663 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
664 | return CMD_WARNING; | |
665 | } | |
718e3744 | 666 | |
2385a876 DW |
667 | if (listcount(bm->bgp) > 1) |
668 | { | |
669 | vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE); | |
670 | return CMD_WARNING; | |
671 | } | |
672 | } | |
673 | ||
674 | // "router bgp X" | |
675 | else | |
718e3744 | 676 | { |
2385a876 DW |
677 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
678 | ||
ad4cbda1 | 679 | inst_type = BGP_INSTANCE_TYPE_DEFAULT; |
6aeb9e78 | 680 | if (argc == 3) |
ad4cbda1 | 681 | { |
682 | name = argv[2]; | |
683 | if (!strcmp(argv[1], "vrf")) | |
684 | inst_type = BGP_INSTANCE_TYPE_VRF; | |
685 | else if (!strcmp(argv[1], "view")) | |
686 | inst_type = BGP_INSTANCE_TYPE_VIEW; | |
687 | } | |
2385a876 | 688 | |
ad4cbda1 | 689 | ret = bgp_get (&bgp, &as, name, inst_type); |
2385a876 DW |
690 | switch (ret) |
691 | { | |
692 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
693 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
694 | VTY_NEWLINE); | |
695 | return CMD_WARNING; | |
696 | case BGP_ERR_AS_MISMATCH: | |
697 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); | |
698 | return CMD_WARNING; | |
699 | case BGP_ERR_INSTANCE_MISMATCH: | |
6aeb9e78 | 700 | vty_out (vty, "BGP instance name and AS number mismatch%s", VTY_NEWLINE); |
2385a876 DW |
701 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
702 | as, VTY_NEWLINE); | |
703 | return CMD_WARNING; | |
704 | } | |
6aeb9e78 DS |
705 | |
706 | /* Pending: handle when user tries to change a view to vrf n vv. */ | |
718e3744 | 707 | } |
708 | ||
709 | vty->node = BGP_NODE; | |
710 | vty->index = bgp; | |
711 | ||
712 | return CMD_SUCCESS; | |
713 | } | |
714 | ||
715 | ALIAS (router_bgp, | |
6aeb9e78 DS |
716 | router_bgp_instance_cmd, |
717 | "router bgp " CMD_AS_RANGE " (view|vrf) WORD", | |
718e3744 | 718 | ROUTER_STR |
719 | BGP_STR | |
720 | AS_STR | |
6aeb9e78 | 721 | "BGP view\nBGP VRF\n" |
8386ac43 | 722 | "View/VRF name\n") |
6b0655a2 | 723 | |
2385a876 DW |
724 | ALIAS (router_bgp, |
725 | router_bgp_noasn_cmd, | |
726 | "router bgp", | |
727 | ROUTER_STR | |
728 | BGP_STR) | |
729 | ||
718e3744 | 730 | /* "no router bgp" commands. */ |
731 | DEFUN (no_router_bgp, | |
732 | no_router_bgp_cmd, | |
320da874 | 733 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 734 | NO_STR |
735 | ROUTER_STR | |
736 | BGP_STR | |
737 | AS_STR) | |
738 | { | |
739 | as_t as; | |
740 | struct bgp *bgp; | |
fd79ac91 | 741 | const char *name = NULL; |
718e3744 | 742 | |
718e3744 | 743 | |
7fb21a9f QY |
744 | // "no router bgp" without an ASN |
745 | if (argc < 1) | |
746 | { | |
747 | //Pending: Make VRF option available for ASN less config | |
748 | bgp = bgp_get_default(); | |
718e3744 | 749 | |
7fb21a9f QY |
750 | if (bgp == NULL) |
751 | { | |
752 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
753 | return CMD_WARNING; | |
754 | } | |
755 | ||
756 | if (listcount(bm->bgp) > 1) | |
757 | { | |
758 | vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE); | |
759 | return CMD_WARNING; | |
760 | } | |
761 | } | |
762 | else | |
718e3744 | 763 | { |
7fb21a9f QY |
764 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
765 | ||
766 | if (argc == 3) | |
767 | name = argv[2]; | |
768 | ||
769 | /* Lookup bgp structure. */ | |
770 | bgp = bgp_lookup (as, name); | |
771 | if (! bgp) | |
772 | { | |
773 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
774 | return CMD_WARNING; | |
775 | } | |
718e3744 | 776 | } |
777 | ||
778 | bgp_delete (bgp); | |
779 | ||
780 | return CMD_SUCCESS; | |
781 | } | |
782 | ||
783 | ALIAS (no_router_bgp, | |
6aeb9e78 DS |
784 | no_router_bgp_instance_cmd, |
785 | "no router bgp " CMD_AS_RANGE " (view|vrf) WORD", | |
718e3744 | 786 | NO_STR |
787 | ROUTER_STR | |
788 | BGP_STR | |
789 | AS_STR | |
6aeb9e78 | 790 | "BGP view\nBGP VRF\n" |
8386ac43 | 791 | "View/VRF name\n") |
6b0655a2 | 792 | |
7fb21a9f QY |
793 | ALIAS (no_router_bgp, |
794 | no_router_bgp_noasn_cmd, | |
795 | "no router bgp", | |
796 | NO_STR | |
797 | ROUTER_STR | |
798 | BGP_STR) | |
799 | ||
718e3744 | 800 | /* BGP router-id. */ |
801 | ||
802 | DEFUN (bgp_router_id, | |
803 | bgp_router_id_cmd, | |
804 | "bgp router-id A.B.C.D", | |
805 | BGP_STR | |
806 | "Override configured router identifier\n" | |
807 | "Manually configured router identifier\n") | |
808 | { | |
809 | int ret; | |
810 | struct in_addr id; | |
811 | struct bgp *bgp; | |
812 | ||
813 | bgp = vty->index; | |
814 | ||
815 | ret = inet_aton (argv[0], &id); | |
816 | if (! ret) | |
817 | { | |
818 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
819 | return CMD_WARNING; | |
820 | } | |
821 | ||
0e6cb743 | 822 | bgp_router_id_static_set (bgp, id); |
718e3744 | 823 | |
824 | return CMD_SUCCESS; | |
825 | } | |
826 | ||
827 | DEFUN (no_bgp_router_id, | |
828 | no_bgp_router_id_cmd, | |
829 | "no bgp router-id", | |
830 | NO_STR | |
831 | BGP_STR | |
832 | "Override configured router identifier\n") | |
833 | { | |
834 | int ret; | |
835 | struct in_addr id; | |
836 | struct bgp *bgp; | |
837 | ||
838 | bgp = vty->index; | |
839 | ||
840 | if (argc == 1) | |
841 | { | |
842 | ret = inet_aton (argv[0], &id); | |
843 | if (! ret) | |
e018c7cc SK |
844 | { |
845 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
846 | return CMD_WARNING; | |
847 | } | |
718e3744 | 848 | |
18a6dce6 | 849 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
e018c7cc SK |
850 | { |
851 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
852 | return CMD_WARNING; | |
853 | } | |
718e3744 | 854 | } |
855 | ||
0e6cb743 DL |
856 | id.s_addr = 0; |
857 | bgp_router_id_static_set (bgp, id); | |
718e3744 | 858 | |
859 | return CMD_SUCCESS; | |
860 | } | |
861 | ||
862 | ALIAS (no_bgp_router_id, | |
863 | no_bgp_router_id_val_cmd, | |
864 | "no bgp router-id A.B.C.D", | |
865 | NO_STR | |
866 | BGP_STR | |
867 | "Override configured router identifier\n" | |
868 | "Manually configured router identifier\n") | |
6b0655a2 | 869 | |
718e3744 | 870 | /* BGP Cluster ID. */ |
871 | ||
872 | DEFUN (bgp_cluster_id, | |
873 | bgp_cluster_id_cmd, | |
874 | "bgp cluster-id A.B.C.D", | |
875 | BGP_STR | |
876 | "Configure Route-Reflector Cluster-id\n" | |
877 | "Route-Reflector Cluster-id in IP address format\n") | |
878 | { | |
879 | int ret; | |
880 | struct bgp *bgp; | |
881 | struct in_addr cluster; | |
882 | ||
883 | bgp = vty->index; | |
884 | ||
885 | ret = inet_aton (argv[0], &cluster); | |
886 | if (! ret) | |
887 | { | |
888 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
889 | return CMD_WARNING; | |
890 | } | |
891 | ||
892 | bgp_cluster_id_set (bgp, &cluster); | |
f31fa004 | 893 | bgp_clear_star_soft_out (vty, bgp->name); |
718e3744 | 894 | |
895 | return CMD_SUCCESS; | |
896 | } | |
897 | ||
898 | ALIAS (bgp_cluster_id, | |
899 | bgp_cluster_id32_cmd, | |
900 | "bgp cluster-id <1-4294967295>", | |
901 | BGP_STR | |
902 | "Configure Route-Reflector Cluster-id\n" | |
903 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
904 | ||
905 | DEFUN (no_bgp_cluster_id, | |
906 | no_bgp_cluster_id_cmd, | |
907 | "no bgp cluster-id", | |
908 | NO_STR | |
909 | BGP_STR | |
910 | "Configure Route-Reflector Cluster-id\n") | |
911 | { | |
912 | int ret; | |
913 | struct bgp *bgp; | |
914 | struct in_addr cluster; | |
915 | ||
916 | bgp = vty->index; | |
917 | ||
918 | if (argc == 1) | |
919 | { | |
920 | ret = inet_aton (argv[0], &cluster); | |
921 | if (! ret) | |
922 | { | |
923 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
924 | return CMD_WARNING; | |
925 | } | |
926 | } | |
927 | ||
928 | bgp_cluster_id_unset (bgp); | |
f31fa004 | 929 | bgp_clear_star_soft_out (vty, bgp->name); |
718e3744 | 930 | |
931 | return CMD_SUCCESS; | |
932 | } | |
933 | ||
934 | ALIAS (no_bgp_cluster_id, | |
813d4307 | 935 | no_bgp_cluster_id_ip_cmd, |
718e3744 | 936 | "no bgp cluster-id A.B.C.D", |
937 | NO_STR | |
938 | BGP_STR | |
939 | "Configure Route-Reflector Cluster-id\n" | |
940 | "Route-Reflector Cluster-id in IP address format\n") | |
6b0655a2 | 941 | |
813d4307 DW |
942 | ALIAS (no_bgp_cluster_id, |
943 | no_bgp_cluster_id_decimal_cmd, | |
944 | "no bgp cluster-id <1-4294967295>", | |
945 | NO_STR | |
946 | BGP_STR | |
947 | "Configure Route-Reflector Cluster-id\n" | |
948 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
949 | ||
718e3744 | 950 | DEFUN (bgp_confederation_identifier, |
951 | bgp_confederation_identifier_cmd, | |
320da874 | 952 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 953 | "BGP specific commands\n" |
954 | "AS confederation parameters\n" | |
955 | "AS number\n" | |
956 | "Set routing domain confederation AS\n") | |
957 | { | |
958 | struct bgp *bgp; | |
959 | as_t as; | |
960 | ||
961 | bgp = vty->index; | |
962 | ||
0b2aa3a0 | 963 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 964 | |
965 | bgp_confederation_id_set (bgp, as); | |
966 | ||
967 | return CMD_SUCCESS; | |
968 | } | |
969 | ||
970 | DEFUN (no_bgp_confederation_identifier, | |
971 | no_bgp_confederation_identifier_cmd, | |
972 | "no bgp confederation identifier", | |
973 | NO_STR | |
974 | "BGP specific commands\n" | |
975 | "AS confederation parameters\n" | |
976 | "AS number\n") | |
977 | { | |
978 | struct bgp *bgp; | |
718e3744 | 979 | |
980 | bgp = vty->index; | |
981 | ||
718e3744 | 982 | bgp_confederation_id_unset (bgp); |
983 | ||
984 | return CMD_SUCCESS; | |
985 | } | |
986 | ||
987 | ALIAS (no_bgp_confederation_identifier, | |
988 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 989 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 990 | NO_STR |
991 | "BGP specific commands\n" | |
992 | "AS confederation parameters\n" | |
993 | "AS number\n" | |
994 | "Set routing domain confederation AS\n") | |
6b0655a2 | 995 | |
718e3744 | 996 | DEFUN (bgp_confederation_peers, |
997 | bgp_confederation_peers_cmd, | |
320da874 | 998 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 999 | "BGP specific commands\n" |
1000 | "AS confederation parameters\n" | |
1001 | "Peer ASs in BGP confederation\n" | |
1002 | AS_STR) | |
1003 | { | |
1004 | struct bgp *bgp; | |
1005 | as_t as; | |
1006 | int i; | |
1007 | ||
1008 | bgp = vty->index; | |
1009 | ||
1010 | for (i = 0; i < argc; i++) | |
1011 | { | |
0b2aa3a0 | 1012 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 1013 | |
1014 | if (bgp->as == as) | |
1015 | { | |
1016 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
1017 | VTY_NEWLINE); | |
1018 | continue; | |
1019 | } | |
1020 | ||
1021 | bgp_confederation_peers_add (bgp, as); | |
1022 | } | |
1023 | return CMD_SUCCESS; | |
1024 | } | |
1025 | ||
1026 | DEFUN (no_bgp_confederation_peers, | |
1027 | no_bgp_confederation_peers_cmd, | |
320da874 | 1028 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 1029 | NO_STR |
1030 | "BGP specific commands\n" | |
1031 | "AS confederation parameters\n" | |
1032 | "Peer ASs in BGP confederation\n" | |
1033 | AS_STR) | |
1034 | { | |
1035 | struct bgp *bgp; | |
1036 | as_t as; | |
1037 | int i; | |
1038 | ||
1039 | bgp = vty->index; | |
1040 | ||
1041 | for (i = 0; i < argc; i++) | |
1042 | { | |
0b2aa3a0 PJ |
1043 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
1044 | ||
718e3744 | 1045 | bgp_confederation_peers_remove (bgp, as); |
1046 | } | |
1047 | return CMD_SUCCESS; | |
1048 | } | |
6b0655a2 | 1049 | |
5e242b0d DS |
1050 | /** |
1051 | * Central routine for maximum-paths configuration. | |
1052 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
1053 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
1054 | */ | |
ffd0c037 DS |
1055 | static int |
1056 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, | |
5e242b0d | 1057 | u_int16_t options, int set) |
165b5fff JB |
1058 | { |
1059 | struct bgp *bgp; | |
ffd0c037 | 1060 | u_int16_t maxpaths = 0; |
165b5fff | 1061 | int ret; |
5e242b0d DS |
1062 | afi_t afi; |
1063 | safi_t safi; | |
165b5fff JB |
1064 | |
1065 | bgp = vty->index; | |
5e242b0d DS |
1066 | afi = bgp_node_afi (vty); |
1067 | safi = bgp_node_safi (vty); | |
165b5fff | 1068 | |
5e242b0d DS |
1069 | if (set) |
1070 | { | |
73ac8160 | 1071 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
5b964da3 | 1072 | MULTIPATH_NUM); |
5e242b0d DS |
1073 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
1074 | options); | |
1075 | } | |
1076 | else | |
1077 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 1078 | |
165b5fff JB |
1079 | if (ret < 0) |
1080 | { | |
1081 | vty_out (vty, | |
5e242b0d DS |
1082 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
1083 | (set == 1) ? "" : "un", | |
1084 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
1085 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
1086 | return CMD_WARNING; |
1087 | } | |
1088 | ||
7aafcaca DS |
1089 | bgp_recalculate_all_bestpaths (bgp); |
1090 | ||
165b5fff JB |
1091 | return CMD_SUCCESS; |
1092 | } | |
1093 | ||
abc920f8 DS |
1094 | DEFUN (bgp_maxmed_admin, |
1095 | bgp_maxmed_admin_cmd, | |
1096 | "bgp max-med administrative ", | |
1097 | BGP_STR | |
1098 | "Advertise routes with max-med\n" | |
1099 | "Administratively applied, for an indefinite period\n") | |
1100 | { | |
1101 | struct bgp *bgp; | |
1102 | ||
1103 | bgp = vty->index; | |
1104 | ||
1105 | bgp->v_maxmed_admin = 1; | |
1106 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1107 | ||
1108 | bgp_maxmed_update(bgp); | |
1109 | ||
1110 | return CMD_SUCCESS; | |
1111 | } | |
1112 | ||
1113 | DEFUN (bgp_maxmed_admin_medv, | |
1114 | bgp_maxmed_admin_medv_cmd, | |
1115 | "bgp max-med administrative <0-4294967294>", | |
1116 | BGP_STR | |
1117 | "Advertise routes with max-med\n" | |
1118 | "Administratively applied, for an indefinite period\n" | |
1119 | "Max MED value to be used\n") | |
1120 | { | |
1121 | struct bgp *bgp; | |
1122 | ||
1123 | bgp = vty->index; | |
1124 | ||
1125 | bgp->v_maxmed_admin = 1; | |
1126 | VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]); | |
1127 | ||
1128 | bgp_maxmed_update(bgp); | |
1129 | ||
1130 | return CMD_SUCCESS; | |
1131 | } | |
1132 | ||
1133 | DEFUN (no_bgp_maxmed_admin, | |
1134 | no_bgp_maxmed_admin_cmd, | |
1135 | "no bgp max-med administrative", | |
1136 | NO_STR | |
1137 | BGP_STR | |
1138 | "Advertise routes with max-med\n" | |
1139 | "Administratively applied, for an indefinite period\n") | |
1140 | { | |
1141 | struct bgp *bgp; | |
1142 | ||
1143 | bgp = vty->index; | |
1144 | ||
1145 | bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED; | |
1146 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1147 | ||
1148 | bgp_maxmed_update(bgp); | |
1149 | ||
1150 | return CMD_SUCCESS; | |
1151 | } | |
1152 | ||
1153 | ALIAS (no_bgp_maxmed_admin, | |
1154 | no_bgp_maxmed_admin_medv_cmd, | |
1155 | "no bgp max-med administrative <0-4294967294>", | |
1156 | NO_STR | |
1157 | BGP_STR | |
1158 | "Advertise routes with max-med\n" | |
1159 | "Administratively applied, for an indefinite period\n" | |
1160 | "Max MED value to be used\n") | |
1161 | ||
1162 | ||
1163 | DEFUN (bgp_maxmed_onstartup, | |
1164 | bgp_maxmed_onstartup_cmd, | |
1165 | "bgp max-med on-startup <5-86400>", | |
1166 | BGP_STR | |
1167 | "Advertise routes with max-med\n" | |
1168 | "Effective on a startup\n" | |
1169 | "Time (seconds) period for max-med\n") | |
1170 | { | |
1171 | struct bgp *bgp; | |
1172 | ||
1173 | bgp = vty->index; | |
1174 | ||
1175 | if (argc != 1) | |
1176 | { | |
1177 | vty_out (vty, "%% Must supply max-med on-startup period"); | |
1178 | return CMD_WARNING; | |
1179 | } | |
1180 | ||
1181 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1182 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1183 | ||
1184 | bgp_maxmed_update(bgp); | |
1185 | ||
1186 | return CMD_SUCCESS; | |
1187 | } | |
1188 | ||
1189 | DEFUN (bgp_maxmed_onstartup_medv, | |
1190 | bgp_maxmed_onstartup_medv_cmd, | |
1191 | "bgp max-med on-startup <5-86400> <0-4294967294>", | |
1192 | BGP_STR | |
1193 | "Advertise routes with max-med\n" | |
1194 | "Effective on a startup\n" | |
1195 | "Time (seconds) period for max-med\n" | |
1196 | "Max MED value to be used\n") | |
1197 | { | |
1198 | struct bgp *bgp; | |
1199 | ||
1200 | bgp = vty->index; | |
1201 | ||
1202 | if (argc != 2) | |
1203 | { | |
1204 | vty_out (vty, "%% Must supply max-med on-startup period and med value"); | |
1205 | return CMD_WARNING; | |
1206 | } | |
1207 | ||
1208 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1209 | VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]); | |
1210 | ||
1211 | bgp_maxmed_update(bgp); | |
1212 | ||
1213 | return CMD_SUCCESS; | |
1214 | } | |
1215 | ||
1216 | DEFUN (no_bgp_maxmed_onstartup, | |
1217 | no_bgp_maxmed_onstartup_cmd, | |
1218 | "no bgp max-med on-startup", | |
1219 | NO_STR | |
1220 | BGP_STR | |
1221 | "Advertise routes with max-med\n" | |
1222 | "Effective on a startup\n") | |
1223 | { | |
1224 | struct bgp *bgp; | |
1225 | ||
1226 | bgp = vty->index; | |
1227 | ||
1228 | /* Cancel max-med onstartup if its on */ | |
1229 | if (bgp->t_maxmed_onstartup) | |
1230 | { | |
1231 | THREAD_TIMER_OFF (bgp->t_maxmed_onstartup); | |
1232 | bgp->maxmed_onstartup_over = 1; | |
1233 | } | |
1234 | ||
1235 | bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED; | |
1236 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1237 | ||
1238 | bgp_maxmed_update(bgp); | |
1239 | ||
1240 | return CMD_SUCCESS; | |
1241 | } | |
1242 | ||
1243 | ALIAS (no_bgp_maxmed_onstartup, | |
1244 | no_bgp_maxmed_onstartup_period_cmd, | |
1245 | "no bgp max-med on-startup <5-86400>", | |
1246 | NO_STR | |
1247 | BGP_STR | |
1248 | "Advertise routes with max-med\n" | |
1249 | "Effective on a startup\n" | |
1250 | "Time (seconds) period for max-med\n") | |
1251 | ||
1252 | ALIAS (no_bgp_maxmed_onstartup, | |
1253 | no_bgp_maxmed_onstartup_period_medv_cmd, | |
1254 | "no bgp max-med on-startup <5-86400> <0-4294967294>", | |
1255 | NO_STR | |
1256 | BGP_STR | |
1257 | "Advertise routes with max-med\n" | |
1258 | "Effective on a startup\n" | |
1259 | "Time (seconds) period for max-med\n" | |
1260 | "Max MED value to be used\n") | |
1261 | ||
f188f2c4 DS |
1262 | static int |
1263 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
1264 | const char *wait) | |
1265 | { | |
1266 | struct bgp *bgp; | |
1267 | u_int16_t update_delay; | |
1268 | u_int16_t establish_wait; | |
1269 | ||
1270 | ||
1271 | bgp = vty->index; | |
1272 | ||
1273 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
1274 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
1275 | ||
1276 | if (!wait) /* update-delay <delay> */ | |
1277 | { | |
1278 | bgp->v_update_delay = update_delay; | |
1279 | bgp->v_establish_wait = bgp->v_update_delay; | |
1280 | return CMD_SUCCESS; | |
1281 | } | |
1282 | ||
1283 | /* update-delay <delay> <establish-wait> */ | |
1284 | establish_wait = atoi (wait); | |
1285 | if (update_delay < establish_wait) | |
1286 | { | |
1287 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
1288 | VTY_NEWLINE); | |
1289 | return CMD_WARNING; | |
1290 | } | |
1291 | ||
1292 | bgp->v_update_delay = update_delay; | |
1293 | bgp->v_establish_wait = establish_wait; | |
1294 | ||
1295 | return CMD_SUCCESS; | |
1296 | } | |
1297 | ||
1298 | static int | |
1299 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
1300 | { | |
1301 | struct bgp *bgp; | |
1302 | ||
1303 | bgp = vty->index; | |
1304 | ||
1305 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
1306 | bgp->v_establish_wait = bgp->v_update_delay; | |
1307 | ||
1308 | return CMD_SUCCESS; | |
1309 | } | |
1310 | ||
1311 | int | |
1312 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
1313 | { | |
1314 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
1315 | { | |
1316 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
1317 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
1318 | vty_out (vty, " %d", bgp->v_establish_wait); | |
1319 | vty_out (vty, "%s", VTY_NEWLINE); | |
1320 | } | |
1321 | ||
1322 | return 0; | |
1323 | } | |
1324 | ||
1325 | ||
1326 | /* Update-delay configuration */ | |
1327 | DEFUN (bgp_update_delay, | |
1328 | bgp_update_delay_cmd, | |
1329 | "update-delay <0-3600>", | |
1330 | "Force initial delay for best-path and updates\n" | |
1331 | "Seconds\n") | |
1332 | { | |
1333 | return bgp_update_delay_config_vty(vty, argv[0], NULL); | |
1334 | } | |
1335 | ||
1336 | DEFUN (bgp_update_delay_establish_wait, | |
1337 | bgp_update_delay_establish_wait_cmd, | |
1338 | "update-delay <0-3600> <1-3600>", | |
1339 | "Force initial delay for best-path and updates\n" | |
1340 | "Seconds\n" | |
1341 | "Wait for peers to be established\n" | |
1342 | "Seconds\n") | |
1343 | { | |
1344 | return bgp_update_delay_config_vty(vty, argv[0], argv[1]); | |
1345 | } | |
1346 | ||
1347 | /* Update-delay deconfiguration */ | |
1348 | DEFUN (no_bgp_update_delay, | |
1349 | no_bgp_update_delay_cmd, | |
1350 | "no update-delay <0-3600>", | |
1351 | "Force initial delay for best-path and updates\n" | |
1352 | "Seconds\n") | |
1353 | { | |
1354 | return bgp_update_delay_deconfig_vty(vty); | |
1355 | } | |
1356 | ||
1357 | ALIAS (no_bgp_update_delay, | |
1358 | no_bgp_update_delay_establish_wait_cmd, | |
1359 | "no update-delay <0-3600> <1-3600>", | |
1360 | "Force initial delay for best-path and updates\n" | |
1361 | "Seconds\n" | |
1362 | "Wait for peers to be established\n" | |
1363 | "Seconds\n") | |
5e242b0d | 1364 | |
ffd0c037 DS |
1365 | static int |
1366 | bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set) | |
cb1faec9 DS |
1367 | { |
1368 | struct bgp *bgp; | |
cb1faec9 DS |
1369 | |
1370 | bgp = vty->index; | |
1371 | ||
1372 | if (set) | |
1373 | VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num, | |
4543bbb4 | 1374 | 1, 10000); |
cb1faec9 DS |
1375 | else |
1376 | bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX; | |
1377 | ||
1378 | return CMD_SUCCESS; | |
1379 | } | |
1380 | ||
1381 | int | |
1382 | bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) | |
1383 | { | |
1384 | if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX) | |
1385 | vty_out (vty, " write-quanta %d%s", | |
1386 | bgp->wpkt_quanta, VTY_NEWLINE); | |
1387 | ||
1388 | return 0; | |
1389 | } | |
1390 | ||
1391 | ||
1392 | /* Update-delay configuration */ | |
1393 | DEFUN (bgp_wpkt_quanta, | |
1394 | bgp_wpkt_quanta_cmd, | |
4543bbb4 | 1395 | "write-quanta <1-10000>", |
cb1faec9 DS |
1396 | "How many packets to write to peer socket per run\n" |
1397 | "Number of packets\n") | |
1398 | { | |
1399 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 1); | |
1400 | } | |
1401 | ||
1402 | /* Update-delay deconfiguration */ | |
1403 | DEFUN (no_bgp_wpkt_quanta, | |
1404 | no_bgp_wpkt_quanta_cmd, | |
4543bbb4 | 1405 | "no write-quanta <1-10000>", |
cb1faec9 DS |
1406 | "How many packets to write to peer socket per run\n" |
1407 | "Number of packets\n") | |
1408 | { | |
1409 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); | |
1410 | } | |
1411 | ||
ffd0c037 | 1412 | static int |
3f9c7369 DS |
1413 | bgp_coalesce_config_vty (struct vty *vty, const char *num, char set) |
1414 | { | |
1415 | struct bgp *bgp; | |
1416 | ||
1417 | bgp = vty->index; | |
1418 | ||
1419 | if (set) | |
1420 | VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num, | |
1421 | 0, 4294967295); | |
1422 | else | |
1423 | bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; | |
1424 | ||
1425 | return CMD_SUCCESS; | |
1426 | } | |
1427 | ||
1428 | int | |
1429 | bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp) | |
1430 | { | |
1431 | if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME) | |
1432 | vty_out (vty, " coalesce-time %d%s", | |
1433 | bgp->coalesce_time, VTY_NEWLINE); | |
1434 | ||
1435 | return 0; | |
1436 | } | |
1437 | ||
1438 | ||
1439 | DEFUN (bgp_coalesce_time, | |
1440 | bgp_coalesce_time_cmd, | |
1441 | "coalesce-time <0-4294967295>", | |
1442 | "Subgroup coalesce timer\n" | |
1443 | "Subgroup coalesce timer value (in ms)\n") | |
1444 | { | |
1445 | return bgp_coalesce_config_vty(vty, argv[0], 1); | |
1446 | } | |
1447 | ||
1448 | DEFUN (no_bgp_coalesce_time, | |
1449 | no_bgp_coalesce_time_cmd, | |
1450 | "no coalesce-time <0-4294967295>", | |
1451 | "Subgroup coalesce timer\n" | |
1452 | "Subgroup coalesce timer value (in ms)\n") | |
1453 | { | |
1454 | return bgp_coalesce_config_vty(vty, argv[0], 0); | |
1455 | } | |
1456 | ||
5e242b0d DS |
1457 | /* Maximum-paths configuration */ |
1458 | DEFUN (bgp_maxpaths, | |
1459 | bgp_maxpaths_cmd, | |
a565fbdd | 1460 | "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), |
5e242b0d DS |
1461 | "Forward packets over multiple paths\n" |
1462 | "Number of paths\n") | |
1463 | { | |
1464 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); | |
1465 | } | |
1466 | ||
165b5fff JB |
1467 | DEFUN (bgp_maxpaths_ibgp, |
1468 | bgp_maxpaths_ibgp_cmd, | |
a565fbdd | 1469 | "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1470 | "Forward packets over multiple paths\n" |
1471 | "iBGP-multipath\n" | |
1472 | "Number of paths\n") | |
1473 | { | |
5e242b0d DS |
1474 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); |
1475 | } | |
165b5fff | 1476 | |
5e242b0d DS |
1477 | DEFUN (bgp_maxpaths_ibgp_cluster, |
1478 | bgp_maxpaths_ibgp_cluster_cmd, | |
a565fbdd | 1479 | "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", |
5e242b0d DS |
1480 | "Forward packets over multiple paths\n" |
1481 | "iBGP-multipath\n" | |
1482 | "Number of paths\n" | |
1483 | "Match the cluster length\n") | |
1484 | { | |
1485 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], | |
1486 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); | |
165b5fff JB |
1487 | } |
1488 | ||
1489 | DEFUN (no_bgp_maxpaths, | |
1490 | no_bgp_maxpaths_cmd, | |
1491 | "no maximum-paths", | |
1492 | NO_STR | |
1493 | "Forward packets over multiple paths\n" | |
1494 | "Number of paths\n") | |
1495 | { | |
5e242b0d | 1496 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
1497 | } |
1498 | ||
1499 | ALIAS (no_bgp_maxpaths, | |
1500 | no_bgp_maxpaths_arg_cmd, | |
a565fbdd | 1501 | "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1502 | NO_STR |
1503 | "Forward packets over multiple paths\n" | |
1504 | "Number of paths\n") | |
1505 | ||
1506 | DEFUN (no_bgp_maxpaths_ibgp, | |
1507 | no_bgp_maxpaths_ibgp_cmd, | |
1508 | "no maximum-paths ibgp", | |
1509 | NO_STR | |
1510 | "Forward packets over multiple paths\n" | |
1511 | "iBGP-multipath\n" | |
1512 | "Number of paths\n") | |
1513 | { | |
5e242b0d | 1514 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
1515 | } |
1516 | ||
1517 | ALIAS (no_bgp_maxpaths_ibgp, | |
1518 | no_bgp_maxpaths_ibgp_arg_cmd, | |
a565fbdd | 1519 | "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1520 | NO_STR |
1521 | "Forward packets over multiple paths\n" | |
1522 | "iBGP-multipath\n" | |
1523 | "Number of paths\n") | |
1524 | ||
5e242b0d DS |
1525 | ALIAS (no_bgp_maxpaths_ibgp, |
1526 | no_bgp_maxpaths_ibgp_cluster_cmd, | |
a565fbdd | 1527 | "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", |
5e242b0d DS |
1528 | NO_STR |
1529 | "Forward packets over multiple paths\n" | |
1530 | "iBGP-multipath\n" | |
1531 | "Number of paths\n" | |
1532 | "Match the cluster length\n") | |
1533 | ||
165b5fff JB |
1534 | int |
1535 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
1536 | safi_t safi, int *write) | |
1537 | { | |
d5b77cc2 | 1538 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != MULTIPATH_NUM) |
165b5fff JB |
1539 | { |
1540 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1541 | vty_out (vty, " maximum-paths %d%s", |
165b5fff JB |
1542 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); |
1543 | } | |
1544 | ||
d5b77cc2 | 1545 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != MULTIPATH_NUM) |
165b5fff JB |
1546 | { |
1547 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1548 | vty_out (vty, " maximum-paths ibgp %d", |
5e242b0d DS |
1549 | bgp->maxpaths[afi][safi].maxpaths_ibgp); |
1550 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
1551 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
1552 | vty_out (vty, " equal-cluster-length"); | |
1553 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
1554 | } |
1555 | ||
1556 | return 0; | |
1557 | } | |
6b0655a2 | 1558 | |
718e3744 | 1559 | /* BGP timers. */ |
1560 | ||
1561 | DEFUN (bgp_timers, | |
1562 | bgp_timers_cmd, | |
1563 | "timers bgp <0-65535> <0-65535>", | |
1564 | "Adjust routing timers\n" | |
1565 | "BGP timers\n" | |
1566 | "Keepalive interval\n" | |
1567 | "Holdtime\n") | |
1568 | { | |
1569 | struct bgp *bgp; | |
1570 | unsigned long keepalive = 0; | |
1571 | unsigned long holdtime = 0; | |
1572 | ||
1573 | bgp = vty->index; | |
1574 | ||
1575 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
1576 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
1577 | ||
1578 | /* Holdtime value check. */ | |
1579 | if (holdtime < 3 && holdtime != 0) | |
1580 | { | |
1581 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
1582 | VTY_NEWLINE); | |
1583 | return CMD_WARNING; | |
1584 | } | |
1585 | ||
1586 | bgp_timers_set (bgp, keepalive, holdtime); | |
1587 | ||
1588 | return CMD_SUCCESS; | |
1589 | } | |
1590 | ||
1591 | DEFUN (no_bgp_timers, | |
1592 | no_bgp_timers_cmd, | |
1593 | "no timers bgp", | |
1594 | NO_STR | |
1595 | "Adjust routing timers\n" | |
1596 | "BGP timers\n") | |
1597 | { | |
1598 | struct bgp *bgp; | |
1599 | ||
1600 | bgp = vty->index; | |
1601 | bgp_timers_unset (bgp); | |
1602 | ||
1603 | return CMD_SUCCESS; | |
1604 | } | |
1605 | ||
1606 | ALIAS (no_bgp_timers, | |
1607 | no_bgp_timers_arg_cmd, | |
1608 | "no timers bgp <0-65535> <0-65535>", | |
1609 | NO_STR | |
1610 | "Adjust routing timers\n" | |
1611 | "BGP timers\n" | |
1612 | "Keepalive interval\n" | |
1613 | "Holdtime\n") | |
6b0655a2 | 1614 | |
718e3744 | 1615 | DEFUN (bgp_client_to_client_reflection, |
1616 | bgp_client_to_client_reflection_cmd, | |
1617 | "bgp client-to-client reflection", | |
1618 | "BGP specific commands\n" | |
1619 | "Configure client to client route reflection\n" | |
1620 | "reflection of routes allowed\n") | |
1621 | { | |
1622 | struct bgp *bgp; | |
1623 | ||
1624 | bgp = vty->index; | |
1625 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
f31fa004 | 1626 | bgp_clear_star_soft_out (vty, bgp->name); |
7aafcaca | 1627 | |
718e3744 | 1628 | return CMD_SUCCESS; |
1629 | } | |
1630 | ||
1631 | DEFUN (no_bgp_client_to_client_reflection, | |
1632 | no_bgp_client_to_client_reflection_cmd, | |
1633 | "no bgp client-to-client reflection", | |
1634 | NO_STR | |
1635 | "BGP specific commands\n" | |
1636 | "Configure client to client route reflection\n" | |
1637 | "reflection of routes allowed\n") | |
1638 | { | |
1639 | struct bgp *bgp; | |
1640 | ||
1641 | bgp = vty->index; | |
1642 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
f31fa004 | 1643 | bgp_clear_star_soft_out (vty, bgp->name); |
7aafcaca | 1644 | |
718e3744 | 1645 | return CMD_SUCCESS; |
1646 | } | |
1647 | ||
1648 | /* "bgp always-compare-med" configuration. */ | |
1649 | DEFUN (bgp_always_compare_med, | |
1650 | bgp_always_compare_med_cmd, | |
1651 | "bgp always-compare-med", | |
1652 | "BGP specific commands\n" | |
1653 | "Allow comparing MED from different neighbors\n") | |
1654 | { | |
1655 | struct bgp *bgp; | |
1656 | ||
1657 | bgp = vty->index; | |
1658 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1659 | bgp_recalculate_all_bestpaths (bgp); |
1660 | ||
718e3744 | 1661 | return CMD_SUCCESS; |
1662 | } | |
1663 | ||
1664 | DEFUN (no_bgp_always_compare_med, | |
1665 | no_bgp_always_compare_med_cmd, | |
1666 | "no bgp always-compare-med", | |
1667 | NO_STR | |
1668 | "BGP specific commands\n" | |
1669 | "Allow comparing MED from different neighbors\n") | |
1670 | { | |
1671 | struct bgp *bgp; | |
1672 | ||
1673 | bgp = vty->index; | |
1674 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1675 | bgp_recalculate_all_bestpaths (bgp); |
1676 | ||
718e3744 | 1677 | return CMD_SUCCESS; |
1678 | } | |
6b0655a2 | 1679 | |
718e3744 | 1680 | /* "bgp deterministic-med" configuration. */ |
1681 | DEFUN (bgp_deterministic_med, | |
1682 | bgp_deterministic_med_cmd, | |
1683 | "bgp deterministic-med", | |
1684 | "BGP specific commands\n" | |
1685 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1686 | { | |
1687 | struct bgp *bgp; | |
1688 | ||
1689 | bgp = vty->index; | |
1475ac87 DW |
1690 | |
1691 | if (!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1692 | { | |
1693 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1694 | bgp_recalculate_all_bestpaths (bgp); | |
1695 | } | |
7aafcaca | 1696 | |
718e3744 | 1697 | return CMD_SUCCESS; |
1698 | } | |
1699 | ||
1700 | DEFUN (no_bgp_deterministic_med, | |
1701 | no_bgp_deterministic_med_cmd, | |
1702 | "no bgp deterministic-med", | |
1703 | NO_STR | |
1704 | "BGP specific commands\n" | |
1705 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1706 | { | |
1707 | struct bgp *bgp; | |
06370dac DW |
1708 | int bestpath_per_as_used; |
1709 | afi_t afi; | |
1710 | safi_t safi; | |
1711 | struct peer *peer; | |
1712 | struct listnode *node, *nnode; | |
718e3744 | 1713 | |
1714 | bgp = vty->index; | |
1475ac87 DW |
1715 | |
1716 | if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1717 | { | |
06370dac DW |
1718 | bestpath_per_as_used = 0; |
1719 | ||
1720 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
1721 | { | |
1722 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
1723 | for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) | |
1724 | if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) | |
1725 | { | |
1726 | bestpath_per_as_used = 1; | |
1727 | break; | |
1728 | } | |
1729 | ||
1730 | if (bestpath_per_as_used) | |
1731 | break; | |
1732 | } | |
1733 | ||
1734 | if (bestpath_per_as_used) | |
1735 | { | |
1736 | vty_out (vty, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s", | |
1737 | VTY_NEWLINE); | |
1738 | return CMD_WARNING; | |
1739 | } | |
1740 | else | |
1741 | { | |
1742 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1743 | bgp_recalculate_all_bestpaths (bgp); | |
1744 | } | |
1475ac87 | 1745 | } |
7aafcaca | 1746 | |
718e3744 | 1747 | return CMD_SUCCESS; |
1748 | } | |
538621f2 | 1749 | |
1750 | /* "bgp graceful-restart" configuration. */ | |
1751 | DEFUN (bgp_graceful_restart, | |
1752 | bgp_graceful_restart_cmd, | |
1753 | "bgp graceful-restart", | |
1754 | "BGP specific commands\n" | |
1755 | "Graceful restart capability parameters\n") | |
1756 | { | |
1757 | struct bgp *bgp; | |
1758 | ||
1759 | bgp = vty->index; | |
1760 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1761 | return CMD_SUCCESS; | |
1762 | } | |
1763 | ||
1764 | DEFUN (no_bgp_graceful_restart, | |
1765 | no_bgp_graceful_restart_cmd, | |
1766 | "no bgp graceful-restart", | |
1767 | NO_STR | |
1768 | "BGP specific commands\n" | |
1769 | "Graceful restart capability parameters\n") | |
1770 | { | |
1771 | struct bgp *bgp; | |
1772 | ||
1773 | bgp = vty->index; | |
1774 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1775 | return CMD_SUCCESS; | |
1776 | } | |
1777 | ||
93406d87 | 1778 | DEFUN (bgp_graceful_restart_stalepath_time, |
1779 | bgp_graceful_restart_stalepath_time_cmd, | |
1780 | "bgp graceful-restart stalepath-time <1-3600>", | |
1781 | "BGP specific commands\n" | |
1782 | "Graceful restart capability parameters\n" | |
1783 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1784 | "Delay value (seconds)\n") | |
1785 | { | |
1786 | struct bgp *bgp; | |
1787 | u_int32_t stalepath; | |
1788 | ||
1789 | bgp = vty->index; | |
1790 | if (! bgp) | |
1791 | return CMD_WARNING; | |
1792 | ||
1793 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
1794 | bgp->stalepath_time = stalepath; | |
1795 | return CMD_SUCCESS; | |
1796 | } | |
1797 | ||
1798 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
1799 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1800 | "no bgp graceful-restart stalepath-time", | |
1801 | NO_STR | |
1802 | "BGP specific commands\n" | |
1803 | "Graceful restart capability parameters\n" | |
1804 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1805 | { | |
1806 | struct bgp *bgp; | |
1807 | ||
1808 | bgp = vty->index; | |
1809 | if (! bgp) | |
1810 | return CMD_WARNING; | |
1811 | ||
1812 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1813 | return CMD_SUCCESS; | |
1814 | } | |
1815 | ||
1816 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
1817 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
1818 | "no bgp graceful-restart stalepath-time <1-3600>", | |
1819 | NO_STR | |
1820 | "BGP specific commands\n" | |
1821 | "Graceful restart capability parameters\n" | |
1822 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1823 | "Delay value (seconds)\n") | |
1824 | ||
718e3744 | 1825 | /* "bgp fast-external-failover" configuration. */ |
1826 | DEFUN (bgp_fast_external_failover, | |
1827 | bgp_fast_external_failover_cmd, | |
1828 | "bgp fast-external-failover", | |
1829 | BGP_STR | |
1830 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1831 | { | |
1832 | struct bgp *bgp; | |
1833 | ||
1834 | bgp = vty->index; | |
1835 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1836 | return CMD_SUCCESS; | |
1837 | } | |
1838 | ||
1839 | DEFUN (no_bgp_fast_external_failover, | |
1840 | no_bgp_fast_external_failover_cmd, | |
1841 | "no bgp fast-external-failover", | |
1842 | NO_STR | |
1843 | BGP_STR | |
1844 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1845 | { | |
1846 | struct bgp *bgp; | |
1847 | ||
1848 | bgp = vty->index; | |
1849 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1850 | return CMD_SUCCESS; | |
1851 | } | |
6b0655a2 | 1852 | |
718e3744 | 1853 | /* "bgp enforce-first-as" configuration. */ |
1854 | DEFUN (bgp_enforce_first_as, | |
1855 | bgp_enforce_first_as_cmd, | |
1856 | "bgp enforce-first-as", | |
1857 | BGP_STR | |
1858 | "Enforce the first AS for EBGP routes\n") | |
1859 | { | |
1860 | struct bgp *bgp; | |
1861 | ||
1862 | bgp = vty->index; | |
1863 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
f31fa004 | 1864 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 1865 | |
718e3744 | 1866 | return CMD_SUCCESS; |
1867 | } | |
1868 | ||
1869 | DEFUN (no_bgp_enforce_first_as, | |
1870 | no_bgp_enforce_first_as_cmd, | |
1871 | "no bgp enforce-first-as", | |
1872 | NO_STR | |
1873 | BGP_STR | |
1874 | "Enforce the first AS for EBGP routes\n") | |
1875 | { | |
1876 | struct bgp *bgp; | |
1877 | ||
1878 | bgp = vty->index; | |
1879 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
f31fa004 | 1880 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 1881 | |
718e3744 | 1882 | return CMD_SUCCESS; |
1883 | } | |
6b0655a2 | 1884 | |
718e3744 | 1885 | /* "bgp bestpath compare-routerid" configuration. */ |
1886 | DEFUN (bgp_bestpath_compare_router_id, | |
1887 | bgp_bestpath_compare_router_id_cmd, | |
1888 | "bgp bestpath compare-routerid", | |
1889 | "BGP specific commands\n" | |
1890 | "Change the default bestpath selection\n" | |
1891 | "Compare router-id for identical EBGP paths\n") | |
1892 | { | |
1893 | struct bgp *bgp; | |
1894 | ||
1895 | bgp = vty->index; | |
1896 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1897 | bgp_recalculate_all_bestpaths (bgp); |
1898 | ||
718e3744 | 1899 | return CMD_SUCCESS; |
1900 | } | |
1901 | ||
1902 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1903 | no_bgp_bestpath_compare_router_id_cmd, | |
1904 | "no bgp bestpath compare-routerid", | |
1905 | NO_STR | |
1906 | "BGP specific commands\n" | |
1907 | "Change the default bestpath selection\n" | |
1908 | "Compare router-id for identical EBGP paths\n") | |
1909 | { | |
1910 | struct bgp *bgp; | |
1911 | ||
1912 | bgp = vty->index; | |
1913 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1914 | bgp_recalculate_all_bestpaths (bgp); |
1915 | ||
718e3744 | 1916 | return CMD_SUCCESS; |
1917 | } | |
6b0655a2 | 1918 | |
718e3744 | 1919 | /* "bgp bestpath as-path ignore" configuration. */ |
1920 | DEFUN (bgp_bestpath_aspath_ignore, | |
1921 | bgp_bestpath_aspath_ignore_cmd, | |
1922 | "bgp bestpath as-path ignore", | |
1923 | "BGP specific commands\n" | |
1924 | "Change the default bestpath selection\n" | |
1925 | "AS-path attribute\n" | |
1926 | "Ignore as-path length in selecting a route\n") | |
1927 | { | |
1928 | struct bgp *bgp; | |
1929 | ||
1930 | bgp = vty->index; | |
1931 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1932 | bgp_recalculate_all_bestpaths (bgp); |
1933 | ||
718e3744 | 1934 | return CMD_SUCCESS; |
1935 | } | |
1936 | ||
1937 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
1938 | no_bgp_bestpath_aspath_ignore_cmd, | |
1939 | "no bgp bestpath as-path ignore", | |
1940 | NO_STR | |
1941 | "BGP specific commands\n" | |
1942 | "Change the default bestpath selection\n" | |
1943 | "AS-path attribute\n" | |
1944 | "Ignore as-path length in selecting a route\n") | |
1945 | { | |
1946 | struct bgp *bgp; | |
1947 | ||
1948 | bgp = vty->index; | |
1949 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1950 | bgp_recalculate_all_bestpaths (bgp); |
1951 | ||
718e3744 | 1952 | return CMD_SUCCESS; |
1953 | } | |
6b0655a2 | 1954 | |
6811845b | 1955 | /* "bgp bestpath as-path confed" configuration. */ |
1956 | DEFUN (bgp_bestpath_aspath_confed, | |
1957 | bgp_bestpath_aspath_confed_cmd, | |
1958 | "bgp bestpath as-path confed", | |
1959 | "BGP specific commands\n" | |
1960 | "Change the default bestpath selection\n" | |
1961 | "AS-path attribute\n" | |
1962 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1963 | { | |
1964 | struct bgp *bgp; | |
1965 | ||
1966 | bgp = vty->index; | |
1967 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1968 | bgp_recalculate_all_bestpaths (bgp); |
1969 | ||
6811845b | 1970 | return CMD_SUCCESS; |
1971 | } | |
1972 | ||
1973 | DEFUN (no_bgp_bestpath_aspath_confed, | |
1974 | no_bgp_bestpath_aspath_confed_cmd, | |
1975 | "no bgp bestpath as-path confed", | |
1976 | NO_STR | |
1977 | "BGP specific commands\n" | |
1978 | "Change the default bestpath selection\n" | |
1979 | "AS-path attribute\n" | |
1980 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1981 | { | |
1982 | struct bgp *bgp; | |
1983 | ||
1984 | bgp = vty->index; | |
1985 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1986 | bgp_recalculate_all_bestpaths (bgp); |
1987 | ||
6811845b | 1988 | return CMD_SUCCESS; |
1989 | } | |
6b0655a2 | 1990 | |
2fdd455c PM |
1991 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
1992 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
1993 | bgp_bestpath_aspath_multipath_relax_cmd, | |
219178b6 | 1994 | "bgp bestpath as-path multipath-relax {as-set|no-as-set}", |
16fc1eec DS |
1995 | "BGP specific commands\n" |
1996 | "Change the default bestpath selection\n" | |
1997 | "AS-path attribute\n" | |
1998 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
219178b6 | 1999 | "Generate an AS_SET\n" |
16fc1eec DS |
2000 | "Do not generate an AS_SET\n") |
2001 | { | |
2002 | struct bgp *bgp; | |
2003 | ||
2004 | bgp = vty->index; | |
2005 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
219178b6 DW |
2006 | |
2007 | /* no-as-set is now the default behavior so we can silently | |
2008 | * ignore it */ | |
2009 | if (argv[0] != NULL && strncmp (argv[0], "a", 1) == 0) | |
2010 | bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); | |
2011 | else | |
2012 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ; | |
2013 | ||
7aafcaca DS |
2014 | bgp_recalculate_all_bestpaths (bgp); |
2015 | ||
16fc1eec DS |
2016 | return CMD_SUCCESS; |
2017 | } | |
2018 | ||
219178b6 DW |
2019 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, |
2020 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
2021 | "no bgp bestpath as-path multipath-relax {as-set|no-as-set}", | |
16fc1eec DS |
2022 | NO_STR |
2023 | "BGP specific commands\n" | |
2024 | "Change the default bestpath selection\n" | |
2025 | "AS-path attribute\n" | |
2026 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
219178b6 | 2027 | "Generate an AS_SET\n" |
16fc1eec DS |
2028 | "Do not generate an AS_SET\n") |
2029 | { | |
2030 | struct bgp *bgp; | |
2031 | ||
2032 | bgp = vty->index; | |
2033 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
219178b6 | 2034 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); |
7aafcaca DS |
2035 | bgp_recalculate_all_bestpaths (bgp); |
2036 | ||
2fdd455c PM |
2037 | return CMD_SUCCESS; |
2038 | } | |
6b0655a2 | 2039 | |
848973c7 | 2040 | /* "bgp log-neighbor-changes" configuration. */ |
2041 | DEFUN (bgp_log_neighbor_changes, | |
2042 | bgp_log_neighbor_changes_cmd, | |
2043 | "bgp log-neighbor-changes", | |
2044 | "BGP specific commands\n" | |
2045 | "Log neighbor up/down and reset reason\n") | |
2046 | { | |
2047 | struct bgp *bgp; | |
2048 | ||
2049 | bgp = vty->index; | |
2050 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
2051 | return CMD_SUCCESS; | |
2052 | } | |
2053 | ||
2054 | DEFUN (no_bgp_log_neighbor_changes, | |
2055 | no_bgp_log_neighbor_changes_cmd, | |
2056 | "no bgp log-neighbor-changes", | |
2057 | NO_STR | |
2058 | "BGP specific commands\n" | |
2059 | "Log neighbor up/down and reset reason\n") | |
2060 | { | |
2061 | struct bgp *bgp; | |
2062 | ||
2063 | bgp = vty->index; | |
2064 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
2065 | return CMD_SUCCESS; | |
2066 | } | |
6b0655a2 | 2067 | |
718e3744 | 2068 | /* "bgp bestpath med" configuration. */ |
2069 | DEFUN (bgp_bestpath_med, | |
2070 | bgp_bestpath_med_cmd, | |
2071 | "bgp bestpath med (confed|missing-as-worst)", | |
2072 | "BGP specific commands\n" | |
2073 | "Change the default bestpath selection\n" | |
2074 | "MED attribute\n" | |
2075 | "Compare MED among confederation paths\n" | |
2076 | "Treat missing MED as the least preferred one\n") | |
2077 | { | |
2078 | struct bgp *bgp; | |
2079 | ||
2080 | bgp = vty->index; | |
2081 | ||
2082 | if (strncmp (argv[0], "confed", 1) == 0) | |
2083 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2084 | else | |
2085 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2086 | ||
7aafcaca DS |
2087 | bgp_recalculate_all_bestpaths (bgp); |
2088 | ||
718e3744 | 2089 | return CMD_SUCCESS; |
2090 | } | |
2091 | ||
2092 | DEFUN (bgp_bestpath_med2, | |
2093 | bgp_bestpath_med2_cmd, | |
2094 | "bgp bestpath med confed missing-as-worst", | |
2095 | "BGP specific commands\n" | |
2096 | "Change the default bestpath selection\n" | |
2097 | "MED attribute\n" | |
2098 | "Compare MED among confederation paths\n" | |
2099 | "Treat missing MED as the least preferred one\n") | |
2100 | { | |
2101 | struct bgp *bgp; | |
2102 | ||
2103 | bgp = vty->index; | |
2104 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2105 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2106 | bgp_recalculate_all_bestpaths (bgp); |
2107 | ||
718e3744 | 2108 | return CMD_SUCCESS; |
2109 | } | |
2110 | ||
2111 | ALIAS (bgp_bestpath_med2, | |
2112 | bgp_bestpath_med3_cmd, | |
2113 | "bgp bestpath med missing-as-worst confed", | |
2114 | "BGP specific commands\n" | |
2115 | "Change the default bestpath selection\n" | |
2116 | "MED attribute\n" | |
2117 | "Treat missing MED as the least preferred one\n" | |
2118 | "Compare MED among confederation paths\n") | |
2119 | ||
2120 | DEFUN (no_bgp_bestpath_med, | |
2121 | no_bgp_bestpath_med_cmd, | |
2122 | "no bgp bestpath med (confed|missing-as-worst)", | |
2123 | NO_STR | |
2124 | "BGP specific commands\n" | |
2125 | "Change the default bestpath selection\n" | |
2126 | "MED attribute\n" | |
2127 | "Compare MED among confederation paths\n" | |
2128 | "Treat missing MED as the least preferred one\n") | |
2129 | { | |
2130 | struct bgp *bgp; | |
2131 | ||
2132 | bgp = vty->index; | |
2133 | ||
2134 | if (strncmp (argv[0], "confed", 1) == 0) | |
2135 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2136 | else | |
2137 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2138 | ||
7aafcaca DS |
2139 | bgp_recalculate_all_bestpaths (bgp); |
2140 | ||
718e3744 | 2141 | return CMD_SUCCESS; |
2142 | } | |
2143 | ||
2144 | DEFUN (no_bgp_bestpath_med2, | |
2145 | no_bgp_bestpath_med2_cmd, | |
2146 | "no bgp bestpath med confed missing-as-worst", | |
2147 | NO_STR | |
2148 | "BGP specific commands\n" | |
2149 | "Change the default bestpath selection\n" | |
2150 | "MED attribute\n" | |
2151 | "Compare MED among confederation paths\n" | |
2152 | "Treat missing MED as the least preferred one\n") | |
2153 | { | |
2154 | struct bgp *bgp; | |
2155 | ||
2156 | bgp = vty->index; | |
2157 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2158 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2159 | bgp_recalculate_all_bestpaths (bgp); |
2160 | ||
718e3744 | 2161 | return CMD_SUCCESS; |
2162 | } | |
2163 | ||
2164 | ALIAS (no_bgp_bestpath_med2, | |
2165 | no_bgp_bestpath_med3_cmd, | |
2166 | "no bgp bestpath med missing-as-worst confed", | |
2167 | NO_STR | |
2168 | "BGP specific commands\n" | |
2169 | "Change the default bestpath selection\n" | |
2170 | "MED attribute\n" | |
2171 | "Treat missing MED as the least preferred one\n" | |
2172 | "Compare MED among confederation paths\n") | |
6b0655a2 | 2173 | |
718e3744 | 2174 | /* "no bgp default ipv4-unicast". */ |
2175 | DEFUN (no_bgp_default_ipv4_unicast, | |
2176 | no_bgp_default_ipv4_unicast_cmd, | |
2177 | "no bgp default ipv4-unicast", | |
2178 | NO_STR | |
2179 | "BGP specific commands\n" | |
2180 | "Configure BGP defaults\n" | |
2181 | "Activate ipv4-unicast for a peer by default\n") | |
2182 | { | |
2183 | struct bgp *bgp; | |
2184 | ||
2185 | bgp = vty->index; | |
2186 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2187 | return CMD_SUCCESS; | |
2188 | } | |
2189 | ||
2190 | DEFUN (bgp_default_ipv4_unicast, | |
2191 | bgp_default_ipv4_unicast_cmd, | |
2192 | "bgp default ipv4-unicast", | |
2193 | "BGP specific commands\n" | |
2194 | "Configure BGP defaults\n" | |
2195 | "Activate ipv4-unicast for a peer by default\n") | |
2196 | { | |
2197 | struct bgp *bgp; | |
2198 | ||
2199 | bgp = vty->index; | |
2200 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2201 | return CMD_SUCCESS; | |
2202 | } | |
6b0655a2 | 2203 | |
04b6bdc0 DW |
2204 | /* Display hostname in certain command outputs */ |
2205 | DEFUN (bgp_default_show_hostname, | |
2206 | bgp_default_show_hostname_cmd, | |
2207 | "bgp default show-hostname", | |
2208 | "BGP specific commands\n" | |
2209 | "Configure BGP defaults\n" | |
2210 | "Show hostname in certain command ouputs\n") | |
2211 | { | |
2212 | struct bgp *bgp; | |
2213 | ||
2214 | bgp = vty->index; | |
2215 | bgp_flag_set (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2216 | return CMD_SUCCESS; | |
2217 | } | |
2218 | ||
2219 | DEFUN (no_bgp_default_show_hostname, | |
2220 | no_bgp_default_show_hostname_cmd, | |
2221 | "no bgp default show-hostname", | |
2222 | NO_STR | |
2223 | "BGP specific commands\n" | |
2224 | "Configure BGP defaults\n" | |
2225 | "Show hostname in certain command ouputs\n") | |
2226 | { | |
2227 | struct bgp *bgp; | |
2228 | ||
2229 | bgp = vty->index; | |
2230 | bgp_flag_unset (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2231 | return CMD_SUCCESS; | |
2232 | } | |
2233 | ||
8233ef81 | 2234 | /* "bgp network import-check" configuration. */ |
718e3744 | 2235 | DEFUN (bgp_network_import_check, |
2236 | bgp_network_import_check_cmd, | |
5623e905 | 2237 | "bgp network import-check", |
718e3744 | 2238 | "BGP specific commands\n" |
2239 | "BGP network command\n" | |
5623e905 | 2240 | "Check BGP network route exists in IGP\n") |
718e3744 | 2241 | { |
2242 | struct bgp *bgp; | |
2243 | ||
2244 | bgp = vty->index; | |
078430f6 DS |
2245 | if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2246 | { | |
2247 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
5623e905 | 2248 | bgp_static_redo_import_check(bgp); |
078430f6 DS |
2249 | } |
2250 | ||
718e3744 | 2251 | return CMD_SUCCESS; |
2252 | } | |
2253 | ||
8233ef81 DW |
2254 | ALIAS_HIDDEN (bgp_network_import_check, |
2255 | bgp_network_import_check_exact_cmd, | |
2256 | "bgp network import-check exact", | |
2257 | "BGP specific commands\n" | |
2258 | "BGP network command\n" | |
2259 | "Check BGP network route exists in IGP\n" | |
2260 | "Match route precisely\n") | |
2261 | ||
718e3744 | 2262 | DEFUN (no_bgp_network_import_check, |
2263 | no_bgp_network_import_check_cmd, | |
5623e905 | 2264 | "no bgp network import-check", |
718e3744 | 2265 | NO_STR |
2266 | "BGP specific commands\n" | |
2267 | "BGP network command\n" | |
2268 | "Check BGP network route exists in IGP\n") | |
2269 | { | |
2270 | struct bgp *bgp; | |
2271 | ||
2272 | bgp = vty->index; | |
078430f6 DS |
2273 | if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2274 | { | |
2275 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
078430f6 DS |
2276 | bgp_static_redo_import_check(bgp); |
2277 | } | |
5623e905 | 2278 | |
718e3744 | 2279 | return CMD_SUCCESS; |
2280 | } | |
6b0655a2 | 2281 | |
718e3744 | 2282 | DEFUN (bgp_default_local_preference, |
2283 | bgp_default_local_preference_cmd, | |
2284 | "bgp default local-preference <0-4294967295>", | |
2285 | "BGP specific commands\n" | |
2286 | "Configure BGP defaults\n" | |
2287 | "local preference (higher=more preferred)\n" | |
2288 | "Configure default local preference value\n") | |
2289 | { | |
2290 | struct bgp *bgp; | |
2291 | u_int32_t local_pref; | |
2292 | ||
2293 | bgp = vty->index; | |
2294 | ||
2295 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
2296 | ||
2297 | bgp_default_local_preference_set (bgp, local_pref); | |
f31fa004 | 2298 | bgp_clear_star_soft_in (vty, bgp->name); |
718e3744 | 2299 | |
2300 | return CMD_SUCCESS; | |
2301 | } | |
2302 | ||
2303 | DEFUN (no_bgp_default_local_preference, | |
2304 | no_bgp_default_local_preference_cmd, | |
2305 | "no bgp default local-preference", | |
2306 | NO_STR | |
2307 | "BGP specific commands\n" | |
2308 | "Configure BGP defaults\n" | |
2309 | "local preference (higher=more preferred)\n") | |
2310 | { | |
2311 | struct bgp *bgp; | |
2312 | ||
2313 | bgp = vty->index; | |
2314 | bgp_default_local_preference_unset (bgp); | |
f31fa004 | 2315 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 2316 | |
718e3744 | 2317 | return CMD_SUCCESS; |
2318 | } | |
2319 | ||
2320 | ALIAS (no_bgp_default_local_preference, | |
2321 | no_bgp_default_local_preference_val_cmd, | |
2322 | "no bgp default local-preference <0-4294967295>", | |
2323 | NO_STR | |
2324 | "BGP specific commands\n" | |
2325 | "Configure BGP defaults\n" | |
2326 | "local preference (higher=more preferred)\n" | |
2327 | "Configure default local preference value\n") | |
6b0655a2 | 2328 | |
3f9c7369 DS |
2329 | DEFUN (bgp_default_subgroup_pkt_queue_max, |
2330 | bgp_default_subgroup_pkt_queue_max_cmd, | |
2331 | "bgp default subgroup-pkt-queue-max <20-100>", | |
2332 | "BGP specific commands\n" | |
2333 | "Configure BGP defaults\n" | |
2334 | "subgroup-pkt-queue-max\n" | |
2335 | "Configure subgroup packet queue max\n") | |
8bd9d948 | 2336 | { |
3f9c7369 DS |
2337 | struct bgp *bgp; |
2338 | u_int32_t max_size; | |
8bd9d948 | 2339 | |
3f9c7369 DS |
2340 | bgp = vty->index; |
2341 | ||
2342 | VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]); | |
2343 | ||
2344 | bgp_default_subgroup_pkt_queue_max_set (bgp, max_size); | |
2345 | ||
2346 | return CMD_SUCCESS; | |
2347 | } | |
2348 | ||
2349 | DEFUN (no_bgp_default_subgroup_pkt_queue_max, | |
2350 | no_bgp_default_subgroup_pkt_queue_max_cmd, | |
2351 | "no bgp default subgroup-pkt-queue-max", | |
2352 | NO_STR | |
2353 | "BGP specific commands\n" | |
2354 | "Configure BGP defaults\n" | |
2355 | "subgroup-pkt-queue-max\n") | |
2356 | { | |
2357 | struct bgp *bgp; | |
2358 | ||
2359 | bgp = vty->index; | |
2360 | bgp_default_subgroup_pkt_queue_max_unset (bgp); | |
2361 | return CMD_SUCCESS; | |
8bd9d948 DS |
2362 | } |
2363 | ||
813d4307 DW |
2364 | ALIAS (no_bgp_default_subgroup_pkt_queue_max, |
2365 | no_bgp_default_subgroup_pkt_queue_max_val_cmd, | |
2366 | "no bgp default subgroup-pkt-queue-max <20-100>", | |
2367 | NO_STR | |
2368 | "BGP specific commands\n" | |
2369 | "Configure BGP defaults\n" | |
2370 | "subgroup-pkt-queue-max\n" | |
2371 | "Configure subgroup packet queue max\n") | |
2372 | ||
8bd9d948 DS |
2373 | DEFUN (bgp_rr_allow_outbound_policy, |
2374 | bgp_rr_allow_outbound_policy_cmd, | |
2375 | "bgp route-reflector allow-outbound-policy", | |
2376 | "BGP specific commands\n" | |
2377 | "Allow modifications made by out route-map\n" | |
2378 | "on ibgp neighbors\n") | |
2379 | { | |
2380 | struct bgp *bgp; | |
8bd9d948 DS |
2381 | |
2382 | bgp = vty->index; | |
2383 | ||
2384 | if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2385 | { | |
2386 | bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2387 | update_group_announce_rrclients(bgp); |
f31fa004 | 2388 | bgp_clear_star_soft_out (vty, bgp->name); |
8bd9d948 DS |
2389 | } |
2390 | ||
2391 | return CMD_SUCCESS; | |
2392 | } | |
2393 | ||
2394 | DEFUN (no_bgp_rr_allow_outbound_policy, | |
2395 | no_bgp_rr_allow_outbound_policy_cmd, | |
2396 | "no bgp route-reflector allow-outbound-policy", | |
2397 | NO_STR | |
2398 | "BGP specific commands\n" | |
2399 | "Allow modifications made by out route-map\n" | |
2400 | "on ibgp neighbors\n") | |
2401 | { | |
2402 | struct bgp *bgp; | |
8bd9d948 DS |
2403 | |
2404 | bgp = vty->index; | |
2405 | ||
2406 | if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2407 | { | |
2408 | bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2409 | update_group_announce_rrclients(bgp); |
f31fa004 | 2410 | bgp_clear_star_soft_out (vty, bgp->name); |
8bd9d948 DS |
2411 | } |
2412 | ||
2413 | return CMD_SUCCESS; | |
2414 | } | |
2415 | ||
f14e6fdb DS |
2416 | DEFUN (bgp_listen_limit, |
2417 | bgp_listen_limit_cmd, | |
2418 | "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2419 | "BGP specific commands\n" | |
2420 | "Configure BGP defaults\n" | |
2421 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2422 | "Configure Dynamic Neighbors listen limit value\n") | |
2423 | { | |
2424 | struct bgp *bgp; | |
2425 | int listen_limit; | |
2426 | ||
2427 | bgp = vty->index; | |
2428 | ||
2429 | VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0], | |
2430 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN, | |
2431 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX); | |
2432 | ||
2433 | bgp_listen_limit_set (bgp, listen_limit); | |
2434 | ||
2435 | return CMD_SUCCESS; | |
2436 | } | |
2437 | ||
2438 | DEFUN (no_bgp_listen_limit, | |
2439 | no_bgp_listen_limit_cmd, | |
2440 | "no bgp listen limit", | |
2441 | "BGP specific commands\n" | |
2442 | "Configure BGP defaults\n" | |
2443 | "unset maximum number of BGP Dynamic Neighbors that can be created\n" | |
2444 | "Configure Dynamic Neighbors listen limit value to default\n") | |
2445 | { | |
2446 | struct bgp *bgp; | |
2447 | ||
2448 | bgp = vty->index; | |
2449 | bgp_listen_limit_unset (bgp); | |
2450 | return CMD_SUCCESS; | |
2451 | } | |
2452 | ||
813d4307 DW |
2453 | ALIAS (no_bgp_listen_limit, |
2454 | no_bgp_listen_limit_val_cmd, | |
2455 | "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2456 | NO_STR | |
2457 | "BGP specific commands\n" | |
2458 | "Configure BGP defaults\n" | |
2459 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2460 | "Configure Dynamic Neighbors listen limit value\n") | |
f14e6fdb | 2461 | |
20eb8864 | 2462 | /* |
2463 | * Check if this listen range is already configured. Check for exact | |
2464 | * match or overlap based on input. | |
2465 | */ | |
2466 | static struct peer_group * | |
2467 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact) | |
2468 | { | |
2469 | struct listnode *node, *nnode; | |
2470 | struct listnode *node1, *nnode1; | |
2471 | struct peer_group *group; | |
2472 | struct prefix *lr; | |
2473 | afi_t afi; | |
2474 | int match; | |
2475 | ||
2476 | afi = family2afi(range->family); | |
2477 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2478 | { | |
2479 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node1, | |
2480 | nnode1, lr)) | |
2481 | { | |
2482 | if (exact) | |
2483 | match = prefix_same (range, lr); | |
2484 | else | |
2485 | match = (prefix_match (range, lr) || prefix_match (lr, range)); | |
2486 | if (match) | |
2487 | return group; | |
2488 | } | |
2489 | } | |
2490 | ||
2491 | return NULL; | |
2492 | } | |
2493 | ||
f14e6fdb DS |
2494 | DEFUN (bgp_listen_range, |
2495 | bgp_listen_range_cmd, | |
2496 | LISTEN_RANGE_CMD "peer-group WORD" , | |
2497 | "BGP specific commands\n" | |
2498 | "Configure BGP Dynamic Neighbors\n" | |
2499 | "add a listening range for Dynamic Neighbors\n" | |
2500 | LISTEN_RANGE_ADDR_STR) | |
2501 | { | |
2502 | struct bgp *bgp; | |
2503 | struct prefix range; | |
20eb8864 | 2504 | struct peer_group *group, *existing_group; |
f14e6fdb DS |
2505 | afi_t afi; |
2506 | int ret; | |
2507 | ||
2508 | bgp = vty->index; | |
2509 | ||
2510 | //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2511 | ||
2512 | /* Convert IP prefix string to struct prefix. */ | |
2513 | ret = str2prefix (argv[0], &range); | |
2514 | if (! ret) | |
2515 | { | |
2516 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2517 | return CMD_WARNING; | |
2518 | } | |
2519 | ||
2520 | afi = family2afi(range.family); | |
2521 | ||
2522 | #ifdef HAVE_IPV6 | |
2523 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2524 | { | |
2525 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2526 | VTY_NEWLINE); | |
2527 | return CMD_WARNING; | |
2528 | } | |
2529 | #endif /* HAVE_IPV6 */ | |
2530 | ||
2531 | apply_mask (&range); | |
2532 | ||
20eb8864 | 2533 | /* Check if same listen range is already configured. */ |
2534 | existing_group = listen_range_exists (bgp, &range, 1); | |
2535 | if (existing_group) | |
2536 | { | |
2537 | if (strcmp (existing_group->name, argv[1]) == 0) | |
2538 | return CMD_SUCCESS; | |
2539 | else | |
2540 | { | |
2541 | vty_out (vty, "%% Same listen range is attached to peer-group %s%s", | |
2542 | existing_group->name, VTY_NEWLINE); | |
2543 | return CMD_WARNING; | |
2544 | } | |
2545 | } | |
2546 | ||
2547 | /* Check if an overlapping listen range exists. */ | |
2548 | if (listen_range_exists (bgp, &range, 0)) | |
2549 | { | |
2550 | vty_out (vty, "%% Listen range overlaps with existing listen range%s", | |
2551 | VTY_NEWLINE); | |
2552 | return CMD_WARNING; | |
2553 | } | |
f14e6fdb DS |
2554 | |
2555 | group = peer_group_lookup (bgp, argv[1]); | |
2556 | if (! group) | |
2557 | { | |
2558 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2559 | return CMD_WARNING; | |
2560 | } | |
2561 | ||
2562 | ret = peer_group_listen_range_add(group, &range); | |
2563 | return bgp_vty_return (vty, ret); | |
2564 | } | |
2565 | ||
2566 | DEFUN (no_bgp_listen_range, | |
2567 | no_bgp_listen_range_cmd, | |
2568 | "no bgp listen range A.B.C.D/M peer-group WORD" , | |
2569 | "BGP specific commands\n" | |
2570 | "Configure BGP defaults\n" | |
2571 | "delete a listening range for Dynamic Neighbors\n" | |
2572 | "Remove Dynamic Neighbors listening range\n") | |
2573 | { | |
2574 | struct bgp *bgp; | |
2575 | struct prefix range; | |
2576 | struct peer_group *group; | |
2577 | afi_t afi; | |
2578 | int ret; | |
2579 | ||
2580 | bgp = vty->index; | |
2581 | ||
2582 | // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2583 | ||
2584 | /* Convert IP prefix string to struct prefix. */ | |
2585 | ret = str2prefix (argv[0], &range); | |
2586 | if (! ret) | |
2587 | { | |
2588 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2589 | return CMD_WARNING; | |
2590 | } | |
2591 | ||
2592 | afi = family2afi(range.family); | |
2593 | ||
2594 | #ifdef HAVE_IPV6 | |
2595 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2596 | { | |
2597 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2598 | VTY_NEWLINE); | |
2599 | return CMD_WARNING; | |
2600 | } | |
2601 | #endif /* HAVE_IPV6 */ | |
2602 | ||
2603 | apply_mask (&range); | |
2604 | ||
2605 | ||
2606 | group = peer_group_lookup (bgp, argv[1]); | |
2607 | if (! group) | |
2608 | { | |
2609 | vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); | |
2610 | return CMD_WARNING; | |
2611 | } | |
2612 | ||
2613 | ret = peer_group_listen_range_del(group, &range); | |
2614 | return bgp_vty_return (vty, ret); | |
2615 | } | |
2616 | ||
2617 | int | |
2618 | bgp_config_write_listen (struct vty *vty, struct bgp *bgp) | |
2619 | { | |
2620 | struct peer_group *group; | |
2621 | struct listnode *node, *nnode, *rnode, *nrnode; | |
2622 | struct prefix *range; | |
2623 | afi_t afi; | |
4690c7d7 | 2624 | char buf[PREFIX2STR_BUFFER]; |
f14e6fdb DS |
2625 | |
2626 | if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT) | |
2627 | vty_out (vty, " bgp listen limit %d%s", | |
2628 | bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
2629 | ||
2630 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2631 | { | |
2632 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
2633 | { | |
2634 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range)) | |
2635 | { | |
2636 | prefix2str(range, buf, sizeof(buf)); | |
2637 | vty_out(vty, " bgp listen range %s peer-group %s%s", | |
2638 | buf, group->name, VTY_NEWLINE); | |
2639 | } | |
2640 | } | |
2641 | } | |
2642 | ||
2643 | return 0; | |
2644 | } | |
2645 | ||
2646 | ||
907f92c8 DS |
2647 | DEFUN (bgp_disable_connected_route_check, |
2648 | bgp_disable_connected_route_check_cmd, | |
2649 | "bgp disable-ebgp-connected-route-check", | |
2650 | "BGP specific commands\n" | |
2651 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2652 | { | |
2653 | struct bgp *bgp; | |
2654 | ||
2655 | bgp = vty->index; | |
2656 | bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
f31fa004 | 2657 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 2658 | |
907f92c8 DS |
2659 | return CMD_SUCCESS; |
2660 | } | |
2661 | ||
2662 | DEFUN (no_bgp_disable_connected_route_check, | |
2663 | no_bgp_disable_connected_route_check_cmd, | |
2664 | "no bgp disable-ebgp-connected-route-check", | |
2665 | NO_STR | |
2666 | "BGP specific commands\n" | |
2667 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2668 | { | |
2669 | struct bgp *bgp; | |
2670 | ||
2671 | bgp = vty->index; | |
2672 | bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
f31fa004 | 2673 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 2674 | |
907f92c8 DS |
2675 | return CMD_SUCCESS; |
2676 | } | |
2677 | ||
2678 | ||
718e3744 | 2679 | static int |
fd79ac91 | 2680 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
2681 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 2682 | { |
2683 | int ret; | |
2684 | struct bgp *bgp; | |
2685 | as_t as; | |
0299c004 | 2686 | int as_type = AS_SPECIFIED; |
718e3744 | 2687 | union sockunion su; |
2688 | ||
2689 | bgp = vty->index; | |
2690 | ||
0299c004 DS |
2691 | if (strncmp(as_str, "internal", strlen("internal")) == 0) |
2692 | { | |
2693 | as = 0; | |
2694 | as_type = AS_INTERNAL; | |
2695 | } | |
2696 | else if (strncmp(as_str, "external", strlen("external")) == 0) | |
2697 | { | |
2698 | as = 0; | |
2699 | as_type = AS_EXTERNAL; | |
2700 | } | |
2701 | else | |
2702 | { | |
2703 | /* Get AS number. */ | |
2704 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); | |
2705 | } | |
718e3744 | 2706 | |
2707 | /* If peer is peer group, call proper function. */ | |
2708 | ret = str2sockunion (peer_str, &su); | |
2709 | if (ret < 0) | |
2710 | { | |
a80beece | 2711 | /* Check for peer by interface */ |
0299c004 | 2712 | ret = peer_remote_as (bgp, NULL, peer_str, &as, as_type, afi, safi); |
718e3744 | 2713 | if (ret < 0) |
a80beece | 2714 | { |
0299c004 | 2715 | ret = peer_group_remote_as (bgp, peer_str, &as, as_type); |
a80beece DS |
2716 | if (ret < 0) |
2717 | { | |
2718 | vty_out (vty, "%% Create the peer-group or interface first%s", | |
2719 | VTY_NEWLINE); | |
2720 | return CMD_WARNING; | |
2721 | } | |
2722 | return CMD_SUCCESS; | |
2723 | } | |
718e3744 | 2724 | } |
a80beece | 2725 | else |
718e3744 | 2726 | { |
6aeb9e78 | 2727 | if (peer_address_self_check (bgp, &su)) |
a80beece DS |
2728 | { |
2729 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2730 | VTY_NEWLINE); | |
2731 | return CMD_WARNING; | |
2732 | } | |
0299c004 | 2733 | ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi); |
718e3744 | 2734 | } |
2735 | ||
718e3744 | 2736 | /* This peer belongs to peer group. */ |
2737 | switch (ret) | |
2738 | { | |
2739 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 2740 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 2741 | return CMD_WARNING; |
718e3744 | 2742 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 2743 | 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 | 2744 | return CMD_WARNING; |
718e3744 | 2745 | } |
2746 | return bgp_vty_return (vty, ret); | |
2747 | } | |
2748 | ||
2749 | DEFUN (neighbor_remote_as, | |
2750 | neighbor_remote_as_cmd, | |
0299c004 | 2751 | NEIGHBOR_CMD2 "remote-as (" CMD_AS_RANGE "|external|internal)", |
718e3744 | 2752 | NEIGHBOR_STR |
2753 | NEIGHBOR_ADDR_STR2 | |
2754 | "Specify a BGP neighbor\n" | |
2755 | AS_STR) | |
2756 | { | |
2757 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
2758 | } | |
6b0655a2 | 2759 | |
4c48cf63 DW |
2760 | static int |
2761 | peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, | |
b3a39dc5 DD |
2762 | safi_t safi, int v6only, const char *peer_group_name, |
2763 | const char *as_str) | |
a80beece | 2764 | { |
b3a39dc5 DD |
2765 | as_t as = 0; |
2766 | int as_type = AS_UNSPECIFIED; | |
a80beece DS |
2767 | struct bgp *bgp; |
2768 | struct peer *peer; | |
2769 | struct peer_group *group; | |
4c48cf63 DW |
2770 | int ret = 0; |
2771 | union sockunion su; | |
a80beece DS |
2772 | |
2773 | bgp = vty->index; | |
4c48cf63 DW |
2774 | group = peer_group_lookup (bgp, conf_if); |
2775 | ||
a80beece DS |
2776 | if (group) |
2777 | { | |
2778 | vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE); | |
2779 | return CMD_WARNING; | |
2780 | } | |
2781 | ||
b3a39dc5 DD |
2782 | if (as_str) |
2783 | { | |
2784 | if (strncmp(as_str, "internal", strlen("internal")) == 0) | |
2785 | { | |
2786 | as_type = AS_INTERNAL; | |
2787 | } | |
2788 | else if (strncmp(as_str, "external", strlen("external")) == 0) | |
2789 | { | |
2790 | as_type = AS_EXTERNAL; | |
2791 | } | |
2792 | else | |
2793 | { | |
2794 | /* Get AS number. */ | |
2795 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); | |
2796 | as_type = AS_SPECIFIED; | |
2797 | } | |
2798 | } | |
2799 | ||
4c48cf63 DW |
2800 | peer = peer_lookup_by_conf_if (bgp, conf_if); |
2801 | if (!peer) | |
2802 | { | |
2803 | if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4) | |
2804 | && afi == AFI_IP && safi == SAFI_UNICAST) | |
b3a39dc5 DD |
2805 | peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, 0, 0, |
2806 | NULL); | |
4c48cf63 | 2807 | else |
b3a39dc5 DD |
2808 | peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, afi, safi, |
2809 | NULL); | |
4c48cf63 DW |
2810 | |
2811 | if (peer && v6only) | |
2812 | SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
4a04e5f7 | 2813 | |
2814 | /* Request zebra to initiate IPv6 RAs on this interface. We do this | |
2815 | * any unnumbered peer in order to not worry about run-time transitions | |
2816 | * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address | |
2817 | * gets deleted later etc.) | |
2818 | */ | |
2819 | if (peer->ifp) | |
b3a39dc5 DD |
2820 | { |
2821 | bgp_zebra_initiate_radv (bgp, peer); | |
2822 | } | |
2823 | peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE); | |
4c48cf63 DW |
2824 | } |
2825 | else if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) || | |
2826 | (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))) | |
2827 | { | |
2828 | if (v6only) | |
2829 | SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
2830 | else | |
2831 | UNSET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
2832 | ||
2833 | /* v6only flag changed. Reset bgp seesion */ | |
2834 | if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) | |
2835 | { | |
2836 | peer->last_reset = PEER_DOWN_V6ONLY_CHANGE; | |
2837 | bgp_notify_send (peer, BGP_NOTIFY_CEASE, | |
2838 | BGP_NOTIFY_CEASE_CONFIG_CHANGE); | |
2839 | } | |
2840 | else | |
2841 | bgp_session_reset(peer); | |
2842 | } | |
2843 | ||
a80beece DS |
2844 | if (!peer) |
2845 | return CMD_WARNING; | |
2846 | ||
4c48cf63 DW |
2847 | if (peer_group_name) |
2848 | { | |
2849 | group = peer_group_lookup (bgp, peer_group_name); | |
2850 | if (! group) | |
2851 | { | |
2852 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2853 | return CMD_WARNING; | |
2854 | } | |
2855 | ||
2856 | ret = peer_group_bind (bgp, &su, peer, group, &as); | |
2857 | } | |
2858 | ||
2859 | return bgp_vty_return (vty, ret); | |
a80beece DS |
2860 | } |
2861 | ||
4c48cf63 DW |
2862 | DEFUN (neighbor_interface_config, |
2863 | neighbor_interface_config_cmd, | |
2864 | "neighbor WORD interface", | |
2865 | NEIGHBOR_STR | |
2866 | "Interface name or neighbor tag\n" | |
2867 | "Enable BGP on interface\n") | |
2868 | { | |
2869 | if (argc == 2) | |
b3a39dc5 DD |
2870 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, |
2871 | argv[1], NULL); | |
4c48cf63 | 2872 | else |
b3a39dc5 DD |
2873 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, |
2874 | NULL, NULL); | |
4c48cf63 DW |
2875 | } |
2876 | ||
2877 | ALIAS (neighbor_interface_config, | |
2878 | neighbor_interface_config_peergroup_cmd, | |
2879 | "neighbor WORD interface peer-group WORD", | |
2880 | NEIGHBOR_STR | |
2881 | "Interface name or neighbor tag\n" | |
2882 | "Enable BGP on interface\n" | |
2883 | "Member of the peer-group\n" | |
2884 | "peer-group name\n") | |
2885 | ||
2886 | DEFUN (neighbor_interface_config_v6only, | |
2887 | neighbor_interface_config_v6only_cmd, | |
2888 | "neighbor WORD interface v6only", | |
2889 | NEIGHBOR_STR | |
2890 | "Interface name or neighbor tag\n" | |
2891 | "Enable BGP on interface\n" | |
2892 | "Enable BGP with v6 link-local only\n") | |
2893 | { | |
2894 | if (argc == 2) | |
b3a39dc5 DD |
2895 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, |
2896 | argv[1], NULL); | |
4c48cf63 | 2897 | else |
b3a39dc5 DD |
2898 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, |
2899 | NULL, NULL); | |
4c48cf63 DW |
2900 | } |
2901 | ||
2902 | ALIAS (neighbor_interface_config_v6only, | |
2903 | neighbor_interface_config_v6only_peergroup_cmd, | |
2904 | "neighbor WORD interface v6only peer-group WORD", | |
2905 | NEIGHBOR_STR | |
2906 | "Interface name or neighbor tag\n" | |
2907 | "Enable BGP on interface\n" | |
2908 | "Enable BGP with v6 link-local only\n" | |
2909 | "Member of the peer-group\n" | |
2910 | "peer-group name\n") | |
a80beece | 2911 | |
b3a39dc5 DD |
2912 | DEFUN (neighbor_interface_config_remote_as, |
2913 | neighbor_interface_config_remote_as_cmd, | |
2914 | "neighbor WORD interface remote-as (" CMD_AS_RANGE "|external|internal)", | |
2915 | NEIGHBOR_STR | |
2916 | "Interface name or neighbor tag\n" | |
2917 | "Enable BGP on interface\n" | |
2918 | AS_STR) | |
2919 | { | |
2920 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, | |
2921 | NULL, argv[1]); | |
2922 | } | |
2923 | ||
2924 | DEFUN (neighbor_interface_v6only_config_remote_as, | |
2925 | neighbor_interface_v6only_config_remote_as_cmd, | |
2926 | "neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|external|internal)", | |
2927 | NEIGHBOR_STR | |
2928 | "Interface name or neighbor tag\n" | |
2929 | "Enable BGP on interface\n" | |
2930 | AS_STR) | |
2931 | { | |
2932 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, | |
2933 | NULL, argv[1]); | |
2934 | } | |
2935 | ||
718e3744 | 2936 | DEFUN (neighbor_peer_group, |
2937 | neighbor_peer_group_cmd, | |
2938 | "neighbor WORD peer-group", | |
2939 | NEIGHBOR_STR | |
a80beece | 2940 | "Interface name or neighbor tag\n" |
718e3744 | 2941 | "Configure peer-group\n") |
2942 | { | |
2943 | struct bgp *bgp; | |
a80beece | 2944 | struct peer *peer; |
718e3744 | 2945 | struct peer_group *group; |
2946 | ||
2947 | bgp = vty->index; | |
a80beece DS |
2948 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2949 | if (peer) | |
2950 | { | |
2951 | vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); | |
2952 | return CMD_WARNING; | |
2953 | } | |
718e3744 | 2954 | |
2955 | group = peer_group_get (bgp, argv[0]); | |
2956 | if (! group) | |
2957 | return CMD_WARNING; | |
2958 | ||
2959 | return CMD_SUCCESS; | |
2960 | } | |
2961 | ||
2962 | DEFUN (no_neighbor, | |
2963 | no_neighbor_cmd, | |
2964 | NO_NEIGHBOR_CMD2, | |
2965 | NO_STR | |
2966 | NEIGHBOR_STR | |
2967 | NEIGHBOR_ADDR_STR2) | |
2968 | { | |
2969 | int ret; | |
2970 | union sockunion su; | |
2971 | struct peer_group *group; | |
2972 | struct peer *peer; | |
1ff9a340 | 2973 | struct peer *other; |
718e3744 | 2974 | |
2975 | ret = str2sockunion (argv[0], &su); | |
2976 | if (ret < 0) | |
2977 | { | |
a80beece DS |
2978 | /* look up for neighbor by interface name config. */ |
2979 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2980 | if (peer) | |
2981 | { | |
4a04e5f7 | 2982 | /* Request zebra to terminate IPv6 RAs on this interface. */ |
2983 | if (peer->ifp) | |
2984 | bgp_zebra_terminate_radv (peer->bgp, peer); | |
a80beece DS |
2985 | peer_delete (peer); |
2986 | return CMD_SUCCESS; | |
2987 | } | |
2988 | ||
718e3744 | 2989 | group = peer_group_lookup (vty->index, argv[0]); |
2990 | if (group) | |
2991 | peer_group_delete (group); | |
2992 | else | |
2993 | { | |
2994 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2995 | return CMD_WARNING; | |
2996 | } | |
2997 | } | |
2998 | else | |
2999 | { | |
3000 | peer = peer_lookup (vty->index, &su); | |
3001 | if (peer) | |
1ff9a340 | 3002 | { |
f14e6fdb DS |
3003 | if (peer_dynamic_neighbor (peer)) |
3004 | { | |
3005 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
3006 | VTY_NEWLINE); | |
3007 | return CMD_WARNING; | |
3008 | } | |
3009 | ||
1ff9a340 DS |
3010 | other = peer->doppelganger; |
3011 | peer_delete (peer); | |
3012 | if (other && other->status != Deleted) | |
3013 | peer_delete(other); | |
3014 | } | |
718e3744 | 3015 | } |
3016 | ||
3017 | return CMD_SUCCESS; | |
3018 | } | |
3019 | ||
3020 | ALIAS (no_neighbor, | |
3021 | no_neighbor_remote_as_cmd, | |
0299c004 | 3022 | NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 3023 | NO_STR |
3024 | NEIGHBOR_STR | |
3025 | NEIGHBOR_ADDR_STR | |
3026 | "Specify a BGP neighbor\n" | |
3027 | AS_STR) | |
3028 | ||
a80beece DS |
3029 | DEFUN (no_neighbor_interface_config, |
3030 | no_neighbor_interface_config_cmd, | |
4c48cf63 | 3031 | "no neighbor WORD interface", |
a80beece DS |
3032 | NO_STR |
3033 | NEIGHBOR_STR | |
3034 | "Interface name\n" | |
3035 | "Configure BGP on interface\n") | |
3036 | { | |
3037 | struct peer *peer; | |
3038 | ||
3039 | /* look up for neighbor by interface name config. */ | |
3040 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
3041 | if (peer) | |
3042 | { | |
4a04e5f7 | 3043 | /* Request zebra to terminate IPv6 RAs on this interface. */ |
3044 | if (peer->ifp) | |
3045 | bgp_zebra_terminate_radv (peer->bgp, peer); | |
a80beece DS |
3046 | peer_delete (peer); |
3047 | } | |
3048 | else | |
3049 | { | |
3050 | vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE); | |
3051 | return CMD_WARNING; | |
3052 | } | |
3053 | return CMD_SUCCESS; | |
3054 | } | |
3055 | ||
4c48cf63 DW |
3056 | ALIAS (no_neighbor_interface_config, |
3057 | no_neighbor_interface_config_peergroup_cmd, | |
3058 | "no neighbor WORD interface peer-group WORD", | |
3059 | NO_STR | |
3060 | NEIGHBOR_STR | |
3061 | "Interface name\n" | |
3062 | "Configure BGP on interface\n" | |
3063 | "Member of the peer-group\n" | |
3064 | "peer-group name\n") | |
3065 | ||
3066 | ALIAS (no_neighbor_interface_config, | |
3067 | no_neighbor_interface_config_v6only_cmd, | |
3068 | "no neighbor WORD interface v6only", | |
3069 | NO_STR | |
3070 | NEIGHBOR_STR | |
3071 | "Interface name\n" | |
3072 | "Configure BGP on interface\n" | |
3073 | "Enable BGP with v6 link-local only\n") | |
3074 | ||
3075 | ALIAS (no_neighbor_interface_config, | |
3076 | no_neighbor_interface_config_v6only_peergroup_cmd, | |
3077 | "no neighbor WORD interface v6only peer-group WORD", | |
3078 | NO_STR | |
3079 | NEIGHBOR_STR | |
3080 | "Interface name\n" | |
3081 | "Configure BGP on interface\n" | |
3082 | "Enable BGP with v6 link-local only\n" | |
3083 | "Member of the peer-group\n" | |
3084 | "peer-group name\n") | |
3085 | ||
b3a39dc5 DD |
3086 | ALIAS (no_neighbor_interface_config, |
3087 | no_neighbor_interface_config_remote_as_cmd, | |
3088 | "no neighbor WORD interface remote-as (" CMD_AS_RANGE "|internal|external)", | |
3089 | NO_STR | |
3090 | NEIGHBOR_STR | |
3091 | "Interface name\n" | |
3092 | "Configure BGP on interface\n" | |
3093 | AS_STR) | |
3094 | ||
3095 | ALIAS (no_neighbor_interface_config, | |
3096 | no_neighbor_interface_config_v6only_remote_as_cmd, | |
3097 | "no neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|internal|external)", | |
3098 | NO_STR | |
3099 | NEIGHBOR_STR | |
3100 | "Interface name\n" | |
3101 | "Configure BGP on interface\n" | |
3102 | "Enable BGP with v6 link-local only\n" | |
3103 | AS_STR) | |
4c48cf63 | 3104 | |
718e3744 | 3105 | DEFUN (no_neighbor_peer_group, |
3106 | no_neighbor_peer_group_cmd, | |
3107 | "no neighbor WORD peer-group", | |
3108 | NO_STR | |
3109 | NEIGHBOR_STR | |
3110 | "Neighbor tag\n" | |
3111 | "Configure peer-group\n") | |
3112 | { | |
3113 | struct peer_group *group; | |
3114 | ||
3115 | group = peer_group_lookup (vty->index, argv[0]); | |
3116 | if (group) | |
3117 | peer_group_delete (group); | |
3118 | else | |
3119 | { | |
3120 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
3121 | return CMD_WARNING; | |
3122 | } | |
3123 | return CMD_SUCCESS; | |
3124 | } | |
3125 | ||
a80beece DS |
3126 | DEFUN (no_neighbor_interface_peer_group_remote_as, |
3127 | no_neighbor_interface_peer_group_remote_as_cmd, | |
0299c004 | 3128 | "no neighbor WORD remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 3129 | NO_STR |
3130 | NEIGHBOR_STR | |
a80beece | 3131 | "Interface name or neighbor tag\n" |
718e3744 | 3132 | "Specify a BGP neighbor\n" |
3133 | AS_STR) | |
3134 | { | |
3135 | struct peer_group *group; | |
a80beece DS |
3136 | struct peer *peer; |
3137 | ||
3138 | /* look up for neighbor by interface name config. */ | |
3139 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
3140 | if (peer) | |
3141 | { | |
0299c004 | 3142 | peer_as_change (peer, 0, AS_SPECIFIED); |
a80beece DS |
3143 | return CMD_SUCCESS; |
3144 | } | |
718e3744 | 3145 | |
3146 | group = peer_group_lookup (vty->index, argv[0]); | |
3147 | if (group) | |
3148 | peer_group_remote_as_delete (group); | |
3149 | else | |
3150 | { | |
a80beece | 3151 | vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE); |
718e3744 | 3152 | return CMD_WARNING; |
3153 | } | |
3154 | return CMD_SUCCESS; | |
3155 | } | |
6b0655a2 | 3156 | |
718e3744 | 3157 | DEFUN (neighbor_local_as, |
3158 | neighbor_local_as_cmd, | |
320da874 | 3159 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 3160 | NEIGHBOR_STR |
3161 | NEIGHBOR_ADDR_STR2 | |
3162 | "Specify a local-as number\n" | |
3163 | "AS number used as local AS\n") | |
3164 | { | |
3165 | struct peer *peer; | |
3166 | int ret; | |
3167 | ||
3168 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3169 | if (! peer) | |
3170 | return CMD_WARNING; | |
3171 | ||
9d3f9705 | 3172 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
718e3744 | 3173 | return bgp_vty_return (vty, ret); |
3174 | } | |
3175 | ||
3176 | DEFUN (neighbor_local_as_no_prepend, | |
3177 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 3178 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 3179 | NEIGHBOR_STR |
3180 | NEIGHBOR_ADDR_STR2 | |
3181 | "Specify a local-as number\n" | |
3182 | "AS number used as local AS\n" | |
3183 | "Do not prepend local-as to updates from ebgp peers\n") | |
3184 | { | |
3185 | struct peer *peer; | |
3186 | int ret; | |
3187 | ||
3188 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3189 | if (! peer) | |
3190 | return CMD_WARNING; | |
3191 | ||
9d3f9705 | 3192 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
718e3744 | 3193 | return bgp_vty_return (vty, ret); |
3194 | } | |
3195 | ||
9d3f9705 AC |
3196 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
3197 | neighbor_local_as_no_prepend_replace_as_cmd, | |
3198 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
3199 | NEIGHBOR_STR | |
3200 | NEIGHBOR_ADDR_STR2 | |
3201 | "Specify a local-as number\n" | |
3202 | "AS number used as local AS\n" | |
3203 | "Do not prepend local-as to updates from ebgp peers\n" | |
3204 | "Do not prepend local-as to updates from ibgp peers\n") | |
3205 | { | |
3206 | struct peer *peer; | |
3207 | int ret; | |
3208 | ||
3209 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3210 | if (! peer) | |
3211 | return CMD_WARNING; | |
3212 | ||
3213 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); | |
3214 | return bgp_vty_return (vty, ret); | |
3215 | } | |
3216 | ||
3217 | ||
718e3744 | 3218 | DEFUN (no_neighbor_local_as, |
3219 | no_neighbor_local_as_cmd, | |
3220 | NO_NEIGHBOR_CMD2 "local-as", | |
3221 | NO_STR | |
3222 | NEIGHBOR_STR | |
3223 | NEIGHBOR_ADDR_STR2 | |
3224 | "Specify a local-as number\n") | |
3225 | { | |
3226 | struct peer *peer; | |
3227 | int ret; | |
3228 | ||
3229 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3230 | if (! peer) | |
3231 | return CMD_WARNING; | |
3232 | ||
3233 | ret = peer_local_as_unset (peer); | |
3234 | return bgp_vty_return (vty, ret); | |
3235 | } | |
3236 | ||
3237 | ALIAS (no_neighbor_local_as, | |
3238 | no_neighbor_local_as_val_cmd, | |
320da874 | 3239 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 3240 | NO_STR |
3241 | NEIGHBOR_STR | |
3242 | NEIGHBOR_ADDR_STR2 | |
3243 | "Specify a local-as number\n" | |
3244 | "AS number used as local AS\n") | |
3245 | ||
3246 | ALIAS (no_neighbor_local_as, | |
3247 | no_neighbor_local_as_val2_cmd, | |
320da874 | 3248 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 3249 | NO_STR |
3250 | NEIGHBOR_STR | |
3251 | NEIGHBOR_ADDR_STR2 | |
3252 | "Specify a local-as number\n" | |
3253 | "AS number used as local AS\n" | |
3254 | "Do not prepend local-as to updates from ebgp peers\n") | |
9d3f9705 AC |
3255 | |
3256 | ALIAS (no_neighbor_local_as, | |
3257 | no_neighbor_local_as_val3_cmd, | |
3258 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
3259 | NO_STR | |
3260 | NEIGHBOR_STR | |
3261 | NEIGHBOR_ADDR_STR2 | |
3262 | "Specify a local-as number\n" | |
3263 | "AS number used as local AS\n" | |
3264 | "Do not prepend local-as to updates from ebgp peers\n" | |
3265 | "Do not prepend local-as to updates from ibgp peers\n") | |
6b0655a2 | 3266 | |
3f9c7369 DS |
3267 | DEFUN (neighbor_solo, |
3268 | neighbor_solo_cmd, | |
3269 | NEIGHBOR_CMD2 "solo", | |
3270 | NEIGHBOR_STR | |
3271 | NEIGHBOR_ADDR_STR2 | |
3272 | "Solo peer - part of its own update group\n") | |
3273 | { | |
3274 | struct peer *peer; | |
3275 | int ret; | |
3276 | ||
3277 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3278 | if (! peer) | |
3279 | return CMD_WARNING; | |
3280 | ||
3281 | ret = update_group_adjust_soloness(peer, 1); | |
3282 | return bgp_vty_return (vty, ret); | |
3283 | } | |
3284 | ||
3285 | DEFUN (no_neighbor_solo, | |
3286 | no_neighbor_solo_cmd, | |
3287 | NO_NEIGHBOR_CMD2 "solo", | |
3288 | NO_STR | |
3289 | NEIGHBOR_STR | |
3290 | NEIGHBOR_ADDR_STR2 | |
3291 | "Solo peer - part of its own update group\n") | |
3292 | { | |
3293 | struct peer *peer; | |
3294 | int ret; | |
3295 | ||
3296 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3297 | if (! peer) | |
3298 | return CMD_WARNING; | |
3299 | ||
3300 | ret = update_group_adjust_soloness(peer, 0); | |
3301 | return bgp_vty_return (vty, ret); | |
3302 | } | |
3303 | ||
0df7c91f PJ |
3304 | DEFUN (neighbor_password, |
3305 | neighbor_password_cmd, | |
3306 | NEIGHBOR_CMD2 "password LINE", | |
3307 | NEIGHBOR_STR | |
3308 | NEIGHBOR_ADDR_STR2 | |
3309 | "Set a password\n" | |
3310 | "The password\n") | |
3311 | { | |
3312 | struct peer *peer; | |
3313 | int ret; | |
3314 | ||
3315 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3316 | if (! peer) | |
3317 | return CMD_WARNING; | |
3318 | ||
3319 | ret = peer_password_set (peer, argv[1]); | |
3320 | return bgp_vty_return (vty, ret); | |
3321 | } | |
3322 | ||
3323 | DEFUN (no_neighbor_password, | |
3324 | no_neighbor_password_cmd, | |
3325 | NO_NEIGHBOR_CMD2 "password", | |
3326 | NO_STR | |
3327 | NEIGHBOR_STR | |
3328 | NEIGHBOR_ADDR_STR2 | |
3329 | "Set a password\n") | |
3330 | { | |
3331 | struct peer *peer; | |
3332 | int ret; | |
3333 | ||
3334 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3335 | if (! peer) | |
3336 | return CMD_WARNING; | |
3337 | ||
3338 | ret = peer_password_unset (peer); | |
3339 | return bgp_vty_return (vty, ret); | |
3340 | } | |
6b0655a2 | 3341 | |
813d4307 DW |
3342 | ALIAS (no_neighbor_password, |
3343 | no_neighbor_password_val_cmd, | |
3344 | NO_NEIGHBOR_CMD2 "password LINE", | |
3345 | NO_STR | |
3346 | NEIGHBOR_STR | |
3347 | NEIGHBOR_ADDR_STR2 | |
3348 | "Set a password\n" | |
3349 | "The password\n") | |
3350 | ||
718e3744 | 3351 | DEFUN (neighbor_activate, |
3352 | neighbor_activate_cmd, | |
3353 | NEIGHBOR_CMD2 "activate", | |
3354 | NEIGHBOR_STR | |
3355 | NEIGHBOR_ADDR_STR2 | |
3356 | "Enable the Address Family for this Neighbor\n") | |
3357 | { | |
c8560b44 | 3358 | int ret; |
718e3744 | 3359 | struct peer *peer; |
3360 | ||
3361 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3362 | if (! peer) | |
3363 | return CMD_WARNING; | |
3364 | ||
c8560b44 | 3365 | ret = peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
718e3744 | 3366 | |
c8560b44 DW |
3367 | if (ret) |
3368 | return CMD_WARNING; | |
718e3744 | 3369 | return CMD_SUCCESS; |
3370 | } | |
3371 | ||
3372 | DEFUN (no_neighbor_activate, | |
3373 | no_neighbor_activate_cmd, | |
3374 | NO_NEIGHBOR_CMD2 "activate", | |
3375 | NO_STR | |
3376 | NEIGHBOR_STR | |
3377 | NEIGHBOR_ADDR_STR2 | |
3378 | "Enable the Address Family for this Neighbor\n") | |
3379 | { | |
3380 | int ret; | |
3381 | struct peer *peer; | |
3382 | ||
3383 | /* Lookup peer. */ | |
3384 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3385 | if (! peer) | |
3386 | return CMD_WARNING; | |
3387 | ||
3388 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
3389 | ||
c8560b44 DW |
3390 | if (ret) |
3391 | return CMD_WARNING; | |
3392 | return CMD_SUCCESS; | |
718e3744 | 3393 | } |
6b0655a2 | 3394 | |
718e3744 | 3395 | DEFUN (neighbor_set_peer_group, |
3396 | neighbor_set_peer_group_cmd, | |
a80beece | 3397 | NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3398 | NEIGHBOR_STR |
a80beece | 3399 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3400 | "Member of the peer-group\n" |
3401 | "peer-group name\n") | |
3402 | { | |
3403 | int ret; | |
3404 | as_t as; | |
3405 | union sockunion su; | |
3406 | struct bgp *bgp; | |
a80beece | 3407 | struct peer *peer; |
718e3744 | 3408 | struct peer_group *group; |
3409 | ||
3410 | bgp = vty->index; | |
a80beece | 3411 | peer = NULL; |
718e3744 | 3412 | |
3413 | ret = str2sockunion (argv[0], &su); | |
3414 | if (ret < 0) | |
3415 | { | |
a80beece DS |
3416 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
3417 | if (!peer) | |
3418 | { | |
3419 | vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); | |
3420 | return CMD_WARNING; | |
3421 | } | |
3422 | } | |
3423 | else | |
3424 | { | |
6aeb9e78 | 3425 | if (peer_address_self_check (bgp, &su)) |
a80beece DS |
3426 | { |
3427 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
3428 | VTY_NEWLINE); | |
3429 | return CMD_WARNING; | |
3430 | } | |
f14e6fdb DS |
3431 | |
3432 | /* Disallow for dynamic neighbor. */ | |
3433 | peer = peer_lookup (bgp, &su); | |
3434 | if (peer && peer_dynamic_neighbor (peer)) | |
3435 | { | |
3436 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
3437 | VTY_NEWLINE); | |
3438 | return CMD_WARNING; | |
3439 | } | |
718e3744 | 3440 | } |
3441 | ||
3442 | group = peer_group_lookup (bgp, argv[1]); | |
3443 | if (! group) | |
3444 | { | |
3445 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3446 | return CMD_WARNING; | |
3447 | } | |
3448 | ||
c8560b44 | 3449 | ret = peer_group_bind (bgp, &su, peer, group, &as); |
718e3744 | 3450 | |
3451 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
3452 | { | |
aea339f7 | 3453 | 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 | 3454 | return CMD_WARNING; |
3455 | } | |
3456 | ||
3457 | return bgp_vty_return (vty, ret); | |
3458 | } | |
3459 | ||
3460 | DEFUN (no_neighbor_set_peer_group, | |
3461 | no_neighbor_set_peer_group_cmd, | |
a80beece | 3462 | NO_NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3463 | NO_STR |
3464 | NEIGHBOR_STR | |
a80beece | 3465 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3466 | "Member of the peer-group\n" |
3467 | "peer-group name\n") | |
3468 | { | |
3469 | int ret; | |
3470 | struct bgp *bgp; | |
3471 | struct peer *peer; | |
3472 | struct peer_group *group; | |
3473 | ||
3474 | bgp = vty->index; | |
3475 | ||
3476 | peer = peer_lookup_vty (vty, argv[0]); | |
3477 | if (! peer) | |
3478 | return CMD_WARNING; | |
3479 | ||
3480 | group = peer_group_lookup (bgp, argv[1]); | |
3481 | if (! group) | |
3482 | { | |
3483 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3484 | return CMD_WARNING; | |
3485 | } | |
3486 | ||
c8560b44 | 3487 | ret = peer_group_unbind (bgp, peer, group); |
718e3744 | 3488 | |
3489 | return bgp_vty_return (vty, ret); | |
3490 | } | |
6b0655a2 | 3491 | |
94f2b392 | 3492 | static int |
fd79ac91 | 3493 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
3494 | u_int16_t flag, int set) | |
718e3744 | 3495 | { |
3496 | int ret; | |
3497 | struct peer *peer; | |
3498 | ||
3499 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3500 | if (! peer) | |
3501 | return CMD_WARNING; | |
3502 | ||
8cdabf90 SK |
3503 | /* |
3504 | * If 'neighbor <interface>', then this is for directly connected peers, | |
3505 | * we should not accept disable-connected-check. | |
3506 | */ | |
3507 | if (peer->conf_if && (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK)) { | |
3508 | vty_out (vty, "%s is directly connected peer, cannot accept disable-" | |
3509 | "connected-check%s", ip_str, VTY_NEWLINE); | |
3510 | return CMD_WARNING; | |
3511 | } | |
3512 | ||
718e3744 | 3513 | if (set) |
3514 | ret = peer_flag_set (peer, flag); | |
3515 | else | |
3516 | ret = peer_flag_unset (peer, flag); | |
3517 | ||
3518 | return bgp_vty_return (vty, ret); | |
3519 | } | |
3520 | ||
94f2b392 | 3521 | static int |
fd79ac91 | 3522 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3523 | { |
3524 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
3525 | } | |
3526 | ||
94f2b392 | 3527 | static int |
fd79ac91 | 3528 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3529 | { |
3530 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
3531 | } | |
3532 | ||
3533 | /* neighbor passive. */ | |
3534 | DEFUN (neighbor_passive, | |
3535 | neighbor_passive_cmd, | |
3536 | NEIGHBOR_CMD2 "passive", | |
3537 | NEIGHBOR_STR | |
3538 | NEIGHBOR_ADDR_STR2 | |
3539 | "Don't send open messages to this neighbor\n") | |
3540 | { | |
3541 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3542 | } | |
3543 | ||
3544 | DEFUN (no_neighbor_passive, | |
3545 | no_neighbor_passive_cmd, | |
3546 | NO_NEIGHBOR_CMD2 "passive", | |
3547 | NO_STR | |
3548 | NEIGHBOR_STR | |
3549 | NEIGHBOR_ADDR_STR2 | |
3550 | "Don't send open messages to this neighbor\n") | |
3551 | { | |
3552 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3553 | } | |
6b0655a2 | 3554 | |
718e3744 | 3555 | /* neighbor shutdown. */ |
3556 | DEFUN (neighbor_shutdown, | |
3557 | neighbor_shutdown_cmd, | |
3558 | NEIGHBOR_CMD2 "shutdown", | |
3559 | NEIGHBOR_STR | |
3560 | NEIGHBOR_ADDR_STR2 | |
3561 | "Administratively shut down this neighbor\n") | |
3562 | { | |
3563 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3564 | } | |
3565 | ||
3566 | DEFUN (no_neighbor_shutdown, | |
3567 | no_neighbor_shutdown_cmd, | |
3568 | NO_NEIGHBOR_CMD2 "shutdown", | |
3569 | NO_STR | |
3570 | NEIGHBOR_STR | |
3571 | NEIGHBOR_ADDR_STR2 | |
3572 | "Administratively shut down this neighbor\n") | |
3573 | { | |
3574 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3575 | } | |
6b0655a2 | 3576 | |
718e3744 | 3577 | /* neighbor capability dynamic. */ |
3578 | DEFUN (neighbor_capability_dynamic, | |
3579 | neighbor_capability_dynamic_cmd, | |
3580 | NEIGHBOR_CMD2 "capability dynamic", | |
3581 | NEIGHBOR_STR | |
3582 | NEIGHBOR_ADDR_STR2 | |
3583 | "Advertise capability to the peer\n" | |
3584 | "Advertise dynamic capability to this neighbor\n") | |
3585 | { | |
3586 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3587 | } | |
3588 | ||
3589 | DEFUN (no_neighbor_capability_dynamic, | |
3590 | no_neighbor_capability_dynamic_cmd, | |
3591 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
3592 | NO_STR | |
3593 | NEIGHBOR_STR | |
3594 | NEIGHBOR_ADDR_STR2 | |
3595 | "Advertise capability to the peer\n" | |
3596 | "Advertise dynamic capability to this neighbor\n") | |
3597 | { | |
3598 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3599 | } | |
6b0655a2 | 3600 | |
718e3744 | 3601 | /* neighbor dont-capability-negotiate */ |
3602 | DEFUN (neighbor_dont_capability_negotiate, | |
3603 | neighbor_dont_capability_negotiate_cmd, | |
3604 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3605 | NEIGHBOR_STR | |
3606 | NEIGHBOR_ADDR_STR2 | |
3607 | "Do not perform capability negotiation\n") | |
3608 | { | |
3609 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3610 | } | |
3611 | ||
3612 | DEFUN (no_neighbor_dont_capability_negotiate, | |
3613 | no_neighbor_dont_capability_negotiate_cmd, | |
3614 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3615 | NO_STR | |
3616 | NEIGHBOR_STR | |
3617 | NEIGHBOR_ADDR_STR2 | |
3618 | "Do not perform capability negotiation\n") | |
3619 | { | |
3620 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3621 | } | |
6b0655a2 | 3622 | |
8a92a8a0 DS |
3623 | /* neighbor capability extended next hop encoding */ |
3624 | DEFUN (neighbor_capability_enhe, | |
3625 | neighbor_capability_enhe_cmd, | |
3626 | NEIGHBOR_CMD2 "capability extended-nexthop", | |
3627 | NEIGHBOR_STR | |
3628 | NEIGHBOR_ADDR_STR2 | |
3629 | "Advertise capability to the peer\n" | |
3630 | "Advertise extended next-hop capability to the peer\n") | |
3631 | { | |
3632 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3633 | } | |
3634 | ||
3635 | DEFUN (no_neighbor_capability_enhe, | |
3636 | no_neighbor_capability_enhe_cmd, | |
3637 | NO_NEIGHBOR_CMD2 "capability extended-nexthop", | |
3638 | NO_STR | |
3639 | NEIGHBOR_STR | |
3640 | NEIGHBOR_ADDR_STR2 | |
3641 | "Advertise capability to the peer\n" | |
3642 | "Advertise extended next-hop capability to the peer\n") | |
3643 | { | |
3644 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3645 | } | |
3646 | ||
94f2b392 | 3647 | static int |
fd79ac91 | 3648 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3649 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 3650 | { |
3651 | int ret; | |
3652 | struct peer *peer; | |
3653 | ||
3654 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3655 | if (! peer) | |
3656 | return CMD_WARNING; | |
3657 | ||
3658 | if (set) | |
3659 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
3660 | else | |
3661 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
3662 | ||
3663 | return bgp_vty_return (vty, ret); | |
3664 | } | |
3665 | ||
94f2b392 | 3666 | static int |
fd79ac91 | 3667 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3668 | safi_t safi, u_int32_t flag) |
718e3744 | 3669 | { |
3670 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
3671 | } | |
3672 | ||
94f2b392 | 3673 | static int |
fd79ac91 | 3674 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3675 | safi_t safi, u_int32_t flag) |
718e3744 | 3676 | { |
3677 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
3678 | } | |
6b0655a2 | 3679 | |
718e3744 | 3680 | /* neighbor capability orf prefix-list. */ |
3681 | DEFUN (neighbor_capability_orf_prefix, | |
3682 | neighbor_capability_orf_prefix_cmd, | |
3683 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3684 | NEIGHBOR_STR | |
3685 | NEIGHBOR_ADDR_STR2 | |
3686 | "Advertise capability to the peer\n" | |
3687 | "Advertise ORF capability to the peer\n" | |
3688 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3689 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3690 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3691 | "Capability to SEND the ORF to this neighbor\n") | |
3692 | { | |
3693 | u_int16_t flag = 0; | |
3694 | ||
3695 | if (strncmp (argv[1], "s", 1) == 0) | |
3696 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3697 | else if (strncmp (argv[1], "r", 1) == 0) | |
3698 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3699 | else if (strncmp (argv[1], "b", 1) == 0) | |
3700 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3701 | else | |
3702 | return CMD_WARNING; | |
3703 | ||
3704 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3705 | bgp_node_safi (vty), flag); | |
3706 | } | |
3707 | ||
3708 | DEFUN (no_neighbor_capability_orf_prefix, | |
3709 | no_neighbor_capability_orf_prefix_cmd, | |
3710 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3711 | NO_STR | |
3712 | NEIGHBOR_STR | |
3713 | NEIGHBOR_ADDR_STR2 | |
3714 | "Advertise capability to the peer\n" | |
3715 | "Advertise ORF capability to the peer\n" | |
3716 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3717 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3718 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3719 | "Capability to SEND the ORF to this neighbor\n") | |
3720 | { | |
3721 | u_int16_t flag = 0; | |
3722 | ||
3723 | if (strncmp (argv[1], "s", 1) == 0) | |
3724 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3725 | else if (strncmp (argv[1], "r", 1) == 0) | |
3726 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3727 | else if (strncmp (argv[1], "b", 1) == 0) | |
3728 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3729 | else | |
3730 | return CMD_WARNING; | |
3731 | ||
3732 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3733 | bgp_node_safi (vty), flag); | |
3734 | } | |
6b0655a2 | 3735 | |
718e3744 | 3736 | /* neighbor next-hop-self. */ |
3737 | DEFUN (neighbor_nexthop_self, | |
3738 | neighbor_nexthop_self_cmd, | |
a538debe | 3739 | NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3740 | NEIGHBOR_STR |
3741 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3742 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3743 | { |
a538debe DS |
3744 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3745 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); | |
3746 | } | |
9e7a53c1 | 3747 | |
a538debe DS |
3748 | /* neighbor next-hop-self. */ |
3749 | DEFUN (neighbor_nexthop_self_force, | |
3750 | neighbor_nexthop_self_force_cmd, | |
3751 | NEIGHBOR_CMD2 "next-hop-self force", | |
3752 | NEIGHBOR_STR | |
3753 | NEIGHBOR_ADDR_STR2 | |
3754 | "Disable the next hop calculation for this neighbor\n" | |
3755 | "Set the next hop to self for reflected routes\n") | |
3756 | { | |
3757 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3758 | bgp_node_safi (vty), | |
88b8ed8d | 3759 | PEER_FLAG_FORCE_NEXTHOP_SELF); |
718e3744 | 3760 | } |
3761 | ||
3762 | DEFUN (no_neighbor_nexthop_self, | |
3763 | no_neighbor_nexthop_self_cmd, | |
a538debe | 3764 | NO_NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3765 | NO_STR |
3766 | NEIGHBOR_STR | |
3767 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3768 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3769 | { |
3770 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
9e7a53c1 | 3771 | bgp_node_safi (vty), |
88b8ed8d | 3772 | PEER_FLAG_NEXTHOP_SELF); |
718e3744 | 3773 | } |
6b0655a2 | 3774 | |
88b8ed8d | 3775 | DEFUN (no_neighbor_nexthop_self_force, |
a538debe DS |
3776 | no_neighbor_nexthop_self_force_cmd, |
3777 | NO_NEIGHBOR_CMD2 "next-hop-self force", | |
3778 | NO_STR | |
3779 | NEIGHBOR_STR | |
3780 | NEIGHBOR_ADDR_STR2 | |
3781 | "Disable the next hop calculation for this neighbor\n" | |
3782 | "Set the next hop to self for reflected routes\n") | |
88b8ed8d DW |
3783 | { |
3784 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3785 | bgp_node_safi (vty), | |
3786 | PEER_FLAG_FORCE_NEXTHOP_SELF); | |
3787 | } | |
a538debe | 3788 | |
c7122e14 DS |
3789 | /* neighbor as-override */ |
3790 | DEFUN (neighbor_as_override, | |
3791 | neighbor_as_override_cmd, | |
3792 | NEIGHBOR_CMD2 "as-override", | |
3793 | NEIGHBOR_STR | |
3794 | NEIGHBOR_ADDR_STR2 | |
3795 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3796 | { | |
3797 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3798 | bgp_node_safi (vty), | |
3799 | PEER_FLAG_AS_OVERRIDE); | |
3800 | } | |
3801 | ||
3802 | DEFUN (no_neighbor_as_override, | |
3803 | no_neighbor_as_override_cmd, | |
3804 | NO_NEIGHBOR_CMD2 "as-override", | |
3805 | NO_STR | |
3806 | NEIGHBOR_STR | |
3807 | NEIGHBOR_ADDR_STR2 | |
3808 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3809 | { | |
3810 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3811 | bgp_node_safi (vty), | |
3812 | PEER_FLAG_AS_OVERRIDE); | |
3813 | } | |
3814 | ||
718e3744 | 3815 | /* neighbor remove-private-AS. */ |
3816 | DEFUN (neighbor_remove_private_as, | |
3817 | neighbor_remove_private_as_cmd, | |
3818 | NEIGHBOR_CMD2 "remove-private-AS", | |
3819 | NEIGHBOR_STR | |
3820 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3821 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3822 | { |
3823 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3824 | bgp_node_safi (vty), | |
3825 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
3826 | } | |
3827 | ||
5000f21c DS |
3828 | DEFUN (neighbor_remove_private_as_all, |
3829 | neighbor_remove_private_as_all_cmd, | |
3830 | NEIGHBOR_CMD2 "remove-private-AS all", | |
3831 | NEIGHBOR_STR | |
3832 | NEIGHBOR_ADDR_STR2 | |
3833 | "Remove private ASNs in outbound updates\n" | |
3834 | "Apply to all AS numbers") | |
3835 | { | |
5000f21c DS |
3836 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3837 | bgp_node_safi (vty), | |
5000f21c DS |
3838 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); |
3839 | } | |
3840 | ||
3841 | DEFUN (neighbor_remove_private_as_replace_as, | |
3842 | neighbor_remove_private_as_replace_as_cmd, | |
3843 | NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3844 | NEIGHBOR_STR | |
3845 | NEIGHBOR_ADDR_STR2 | |
3846 | "Remove private ASNs in outbound updates\n" | |
3847 | "Replace private ASNs with our ASN in outbound updates\n") | |
3848 | { | |
5000f21c DS |
3849 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3850 | bgp_node_safi (vty), | |
5000f21c DS |
3851 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); |
3852 | } | |
3853 | ||
3854 | DEFUN (neighbor_remove_private_as_all_replace_as, | |
3855 | neighbor_remove_private_as_all_replace_as_cmd, | |
3856 | NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3857 | NEIGHBOR_STR | |
3858 | NEIGHBOR_ADDR_STR2 | |
3859 | "Remove private ASNs in outbound updates\n" | |
3860 | "Apply to all AS numbers" | |
3861 | "Replace private ASNs with our ASN in outbound updates\n") | |
3862 | { | |
3863 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3864 | bgp_node_safi (vty), | |
88b8ed8d | 3865 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); |
5000f21c DS |
3866 | } |
3867 | ||
718e3744 | 3868 | DEFUN (no_neighbor_remove_private_as, |
3869 | no_neighbor_remove_private_as_cmd, | |
3870 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
3871 | NO_STR | |
3872 | NEIGHBOR_STR | |
3873 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3874 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3875 | { |
3876 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3877 | bgp_node_safi (vty), | |
88b8ed8d | 3878 | PEER_FLAG_REMOVE_PRIVATE_AS); |
718e3744 | 3879 | } |
6b0655a2 | 3880 | |
88b8ed8d | 3881 | DEFUN (no_neighbor_remove_private_as_all, |
5000f21c DS |
3882 | no_neighbor_remove_private_as_all_cmd, |
3883 | NO_NEIGHBOR_CMD2 "remove-private-AS all", | |
3884 | NO_STR | |
3885 | NEIGHBOR_STR | |
3886 | NEIGHBOR_ADDR_STR2 | |
3887 | "Remove private ASNs in outbound updates\n" | |
3888 | "Apply to all AS numbers") | |
88b8ed8d DW |
3889 | { |
3890 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3891 | bgp_node_safi (vty), | |
3892 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3893 | } | |
5000f21c | 3894 | |
88b8ed8d | 3895 | DEFUN (no_neighbor_remove_private_as_replace_as, |
5000f21c DS |
3896 | no_neighbor_remove_private_as_replace_as_cmd, |
3897 | NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3898 | NO_STR | |
3899 | NEIGHBOR_STR | |
3900 | NEIGHBOR_ADDR_STR2 | |
3901 | "Remove private ASNs in outbound updates\n" | |
3902 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d DW |
3903 | { |
3904 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3905 | bgp_node_safi (vty), | |
3906 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3907 | } | |
5000f21c | 3908 | |
88b8ed8d | 3909 | DEFUN (no_neighbor_remove_private_as_all_replace_as, |
5000f21c DS |
3910 | no_neighbor_remove_private_as_all_replace_as_cmd, |
3911 | NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3912 | NO_STR | |
3913 | NEIGHBOR_STR | |
3914 | NEIGHBOR_ADDR_STR2 | |
3915 | "Remove private ASNs in outbound updates\n" | |
3916 | "Apply to all AS numbers" | |
3917 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d DW |
3918 | { |
3919 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3920 | bgp_node_safi (vty), | |
3921 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); | |
3922 | } | |
5000f21c DS |
3923 | |
3924 | ||
718e3744 | 3925 | /* neighbor send-community. */ |
3926 | DEFUN (neighbor_send_community, | |
3927 | neighbor_send_community_cmd, | |
3928 | NEIGHBOR_CMD2 "send-community", | |
3929 | NEIGHBOR_STR | |
3930 | NEIGHBOR_ADDR_STR2 | |
3931 | "Send Community attribute to this neighbor\n") | |
3932 | { | |
3933 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3934 | bgp_node_safi (vty), | |
3935 | PEER_FLAG_SEND_COMMUNITY); | |
3936 | } | |
3937 | ||
3938 | DEFUN (no_neighbor_send_community, | |
3939 | no_neighbor_send_community_cmd, | |
3940 | NO_NEIGHBOR_CMD2 "send-community", | |
3941 | NO_STR | |
3942 | NEIGHBOR_STR | |
3943 | NEIGHBOR_ADDR_STR2 | |
3944 | "Send Community attribute to this neighbor\n") | |
3945 | { | |
3946 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3947 | bgp_node_safi (vty), | |
3948 | PEER_FLAG_SEND_COMMUNITY); | |
3949 | } | |
6b0655a2 | 3950 | |
718e3744 | 3951 | /* neighbor send-community extended. */ |
3952 | DEFUN (neighbor_send_community_type, | |
3953 | neighbor_send_community_type_cmd, | |
3954 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3955 | NEIGHBOR_STR | |
3956 | NEIGHBOR_ADDR_STR2 | |
3957 | "Send Community attribute to this neighbor\n" | |
3958 | "Send Standard and Extended Community attributes\n" | |
3959 | "Send Extended Community attributes\n" | |
3960 | "Send Standard Community attributes\n") | |
3961 | { | |
3962 | if (strncmp (argv[1], "s", 1) == 0) | |
3963 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3964 | bgp_node_safi (vty), | |
3965 | PEER_FLAG_SEND_COMMUNITY); | |
3966 | if (strncmp (argv[1], "e", 1) == 0) | |
3967 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3968 | bgp_node_safi (vty), | |
3969 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3970 | ||
3971 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3972 | bgp_node_safi (vty), | |
3973 | (PEER_FLAG_SEND_COMMUNITY| | |
3974 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3975 | } | |
3976 | ||
3977 | DEFUN (no_neighbor_send_community_type, | |
3978 | no_neighbor_send_community_type_cmd, | |
3979 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3980 | NO_STR | |
3981 | NEIGHBOR_STR | |
3982 | NEIGHBOR_ADDR_STR2 | |
3983 | "Send Community attribute to this neighbor\n" | |
3984 | "Send Standard and Extended Community attributes\n" | |
3985 | "Send Extended Community attributes\n" | |
3986 | "Send Standard Community attributes\n") | |
3987 | { | |
3988 | if (strncmp (argv[1], "s", 1) == 0) | |
3989 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3990 | bgp_node_safi (vty), | |
3991 | PEER_FLAG_SEND_COMMUNITY); | |
3992 | if (strncmp (argv[1], "e", 1) == 0) | |
3993 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3994 | bgp_node_safi (vty), | |
3995 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3996 | ||
3997 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3998 | bgp_node_safi (vty), | |
3999 | (PEER_FLAG_SEND_COMMUNITY | | |
4000 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
4001 | } | |
6b0655a2 | 4002 | |
718e3744 | 4003 | /* neighbor soft-reconfig. */ |
4004 | DEFUN (neighbor_soft_reconfiguration, | |
4005 | neighbor_soft_reconfiguration_cmd, | |
4006 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
4007 | NEIGHBOR_STR | |
4008 | NEIGHBOR_ADDR_STR2 | |
4009 | "Per neighbor soft reconfiguration\n" | |
4010 | "Allow inbound soft reconfiguration for this neighbor\n") | |
4011 | { | |
4012 | return peer_af_flag_set_vty (vty, argv[0], | |
4013 | bgp_node_afi (vty), bgp_node_safi (vty), | |
4014 | PEER_FLAG_SOFT_RECONFIG); | |
4015 | } | |
4016 | ||
4017 | DEFUN (no_neighbor_soft_reconfiguration, | |
4018 | no_neighbor_soft_reconfiguration_cmd, | |
4019 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
4020 | NO_STR | |
4021 | NEIGHBOR_STR | |
4022 | NEIGHBOR_ADDR_STR2 | |
4023 | "Per neighbor soft reconfiguration\n" | |
4024 | "Allow inbound soft reconfiguration for this neighbor\n") | |
4025 | { | |
4026 | return peer_af_flag_unset_vty (vty, argv[0], | |
4027 | bgp_node_afi (vty), bgp_node_safi (vty), | |
4028 | PEER_FLAG_SOFT_RECONFIG); | |
4029 | } | |
6b0655a2 | 4030 | |
718e3744 | 4031 | DEFUN (neighbor_route_reflector_client, |
4032 | neighbor_route_reflector_client_cmd, | |
4033 | NEIGHBOR_CMD2 "route-reflector-client", | |
4034 | NEIGHBOR_STR | |
4035 | NEIGHBOR_ADDR_STR2 | |
4036 | "Configure a neighbor as Route Reflector client\n") | |
4037 | { | |
4038 | struct peer *peer; | |
4039 | ||
4040 | ||
4041 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4042 | if (! peer) | |
4043 | return CMD_WARNING; | |
4044 | ||
4045 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4046 | bgp_node_safi (vty), | |
4047 | PEER_FLAG_REFLECTOR_CLIENT); | |
4048 | } | |
4049 | ||
4050 | DEFUN (no_neighbor_route_reflector_client, | |
4051 | no_neighbor_route_reflector_client_cmd, | |
4052 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
4053 | NO_STR | |
4054 | NEIGHBOR_STR | |
4055 | NEIGHBOR_ADDR_STR2 | |
4056 | "Configure a neighbor as Route Reflector client\n") | |
4057 | { | |
4058 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4059 | bgp_node_safi (vty), | |
4060 | PEER_FLAG_REFLECTOR_CLIENT); | |
4061 | } | |
6b0655a2 | 4062 | |
718e3744 | 4063 | /* neighbor route-server-client. */ |
4064 | DEFUN (neighbor_route_server_client, | |
4065 | neighbor_route_server_client_cmd, | |
4066 | NEIGHBOR_CMD2 "route-server-client", | |
4067 | NEIGHBOR_STR | |
4068 | NEIGHBOR_ADDR_STR2 | |
4069 | "Configure a neighbor as Route Server client\n") | |
4070 | { | |
2a3d5731 DW |
4071 | struct peer *peer; |
4072 | ||
4073 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4074 | if (! peer) | |
4075 | return CMD_WARNING; | |
4076 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4077 | bgp_node_safi (vty), | |
4078 | PEER_FLAG_RSERVER_CLIENT); | |
718e3744 | 4079 | } |
4080 | ||
4081 | DEFUN (no_neighbor_route_server_client, | |
4082 | no_neighbor_route_server_client_cmd, | |
4083 | NO_NEIGHBOR_CMD2 "route-server-client", | |
4084 | NO_STR | |
4085 | NEIGHBOR_STR | |
4086 | NEIGHBOR_ADDR_STR2 | |
4087 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 4088 | { |
2a3d5731 DW |
4089 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
4090 | bgp_node_safi (vty), | |
4091 | PEER_FLAG_RSERVER_CLIENT); | |
fee0f4c6 | 4092 | } |
6b0655a2 | 4093 | |
fee0f4c6 | 4094 | DEFUN (neighbor_nexthop_local_unchanged, |
4095 | neighbor_nexthop_local_unchanged_cmd, | |
4096 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
4097 | NEIGHBOR_STR | |
4098 | NEIGHBOR_ADDR_STR2 | |
4099 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
4100 | "Leave link-local nexthop unchanged for this peer\n") | |
4101 | { | |
4102 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4103 | bgp_node_safi (vty), | |
4104 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
4105 | } | |
6b0655a2 | 4106 | |
fee0f4c6 | 4107 | DEFUN (no_neighbor_nexthop_local_unchanged, |
4108 | no_neighbor_nexthop_local_unchanged_cmd, | |
4109 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
4110 | NO_STR | |
4111 | NEIGHBOR_STR | |
4112 | NEIGHBOR_ADDR_STR2 | |
4113 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
4114 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 4115 | { |
4116 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4117 | bgp_node_safi (vty), | |
fee0f4c6 | 4118 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 4119 | } |
6b0655a2 | 4120 | |
718e3744 | 4121 | DEFUN (neighbor_attr_unchanged, |
4122 | neighbor_attr_unchanged_cmd, | |
4123 | NEIGHBOR_CMD2 "attribute-unchanged", | |
4124 | NEIGHBOR_STR | |
4125 | NEIGHBOR_ADDR_STR2 | |
4126 | "BGP attribute is propagated unchanged to this neighbor\n") | |
4127 | { | |
4128 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4129 | bgp_node_safi (vty), | |
4130 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4131 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4132 | PEER_FLAG_MED_UNCHANGED)); | |
4133 | } | |
4134 | ||
4135 | DEFUN (neighbor_attr_unchanged1, | |
4136 | neighbor_attr_unchanged1_cmd, | |
4137 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4138 | NEIGHBOR_STR | |
4139 | NEIGHBOR_ADDR_STR2 | |
4140 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4141 | "As-path attribute\n" | |
4142 | "Nexthop attribute\n" | |
4143 | "Med attribute\n") | |
4144 | { | |
4145 | u_int16_t flags = 0; | |
4146 | ||
4147 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4148 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4149 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4150 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4151 | else if (strncmp (argv[1], "med", 1) == 0) | |
4152 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4153 | ||
4154 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4155 | bgp_node_safi (vty), flags); | |
4156 | } | |
4157 | ||
4158 | DEFUN (neighbor_attr_unchanged2, | |
4159 | neighbor_attr_unchanged2_cmd, | |
4160 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4161 | NEIGHBOR_STR | |
4162 | NEIGHBOR_ADDR_STR2 | |
4163 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4164 | "As-path attribute\n" | |
4165 | "Nexthop attribute\n" | |
4166 | "Med attribute\n") | |
4167 | { | |
4168 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4169 | ||
4170 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4171 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4172 | else if (strncmp (argv[1], "med", 1) == 0) | |
4173 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4174 | ||
4175 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4176 | bgp_node_safi (vty), flags); | |
4177 | ||
4178 | } | |
4179 | ||
4180 | DEFUN (neighbor_attr_unchanged3, | |
4181 | neighbor_attr_unchanged3_cmd, | |
4182 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4183 | NEIGHBOR_STR | |
4184 | NEIGHBOR_ADDR_STR2 | |
4185 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4186 | "Nexthop attribute\n" | |
4187 | "As-path attribute\n" | |
4188 | "Med attribute\n") | |
4189 | { | |
4190 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4191 | ||
4192 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4193 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4194 | else if (strncmp (argv[1], "med", 1) == 0) | |
4195 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4196 | ||
4197 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4198 | bgp_node_safi (vty), flags); | |
4199 | } | |
4200 | ||
4201 | DEFUN (neighbor_attr_unchanged4, | |
4202 | neighbor_attr_unchanged4_cmd, | |
4203 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4204 | NEIGHBOR_STR | |
4205 | NEIGHBOR_ADDR_STR2 | |
4206 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4207 | "Med attribute\n" | |
4208 | "As-path attribute\n" | |
4209 | "Nexthop attribute\n") | |
4210 | { | |
4211 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4212 | ||
4213 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4214 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4215 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4216 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4217 | ||
4218 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4219 | bgp_node_safi (vty), flags); | |
4220 | } | |
4221 | ||
4222 | ALIAS (neighbor_attr_unchanged, | |
4223 | neighbor_attr_unchanged5_cmd, | |
4224 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4225 | NEIGHBOR_STR | |
4226 | NEIGHBOR_ADDR_STR2 | |
4227 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4228 | "As-path attribute\n" | |
4229 | "Nexthop attribute\n" | |
4230 | "Med attribute\n") | |
4231 | ||
4232 | ALIAS (neighbor_attr_unchanged, | |
4233 | neighbor_attr_unchanged6_cmd, | |
4234 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4235 | NEIGHBOR_STR | |
4236 | NEIGHBOR_ADDR_STR2 | |
4237 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4238 | "As-path attribute\n" | |
4239 | "Med attribute\n" | |
4240 | "Nexthop attribute\n") | |
4241 | ||
4242 | ALIAS (neighbor_attr_unchanged, | |
4243 | neighbor_attr_unchanged7_cmd, | |
4244 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4245 | NEIGHBOR_STR | |
4246 | NEIGHBOR_ADDR_STR2 | |
4247 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4248 | "Nexthop attribute\n" | |
4249 | "Med attribute\n" | |
4250 | "As-path attribute\n") | |
4251 | ||
4252 | ALIAS (neighbor_attr_unchanged, | |
4253 | neighbor_attr_unchanged8_cmd, | |
4254 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4255 | NEIGHBOR_STR | |
4256 | NEIGHBOR_ADDR_STR2 | |
4257 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4258 | "Nexthop attribute\n" | |
4259 | "As-path attribute\n" | |
4260 | "Med attribute\n") | |
4261 | ||
4262 | ALIAS (neighbor_attr_unchanged, | |
4263 | neighbor_attr_unchanged9_cmd, | |
4264 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4265 | NEIGHBOR_STR | |
4266 | NEIGHBOR_ADDR_STR2 | |
4267 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4268 | "Med attribute\n" | |
4269 | "Nexthop attribute\n" | |
4270 | "As-path attribute\n") | |
4271 | ||
4272 | ALIAS (neighbor_attr_unchanged, | |
4273 | neighbor_attr_unchanged10_cmd, | |
4274 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4275 | NEIGHBOR_STR | |
4276 | NEIGHBOR_ADDR_STR2 | |
4277 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4278 | "Med attribute\n" | |
4279 | "As-path attribute\n" | |
4280 | "Nexthop attribute\n") | |
4281 | ||
4282 | DEFUN (no_neighbor_attr_unchanged, | |
4283 | no_neighbor_attr_unchanged_cmd, | |
4284 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
4285 | NO_STR | |
4286 | NEIGHBOR_STR | |
4287 | NEIGHBOR_ADDR_STR2 | |
4288 | "BGP attribute is propagated unchanged to this neighbor\n") | |
4289 | { | |
4290 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4291 | bgp_node_safi (vty), | |
4292 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4293 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4294 | PEER_FLAG_MED_UNCHANGED)); | |
4295 | } | |
4296 | ||
4297 | DEFUN (no_neighbor_attr_unchanged1, | |
4298 | no_neighbor_attr_unchanged1_cmd, | |
4299 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4300 | NO_STR | |
4301 | NEIGHBOR_STR | |
4302 | NEIGHBOR_ADDR_STR2 | |
4303 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4304 | "As-path attribute\n" | |
4305 | "Nexthop attribute\n" | |
4306 | "Med attribute\n") | |
4307 | { | |
4308 | u_int16_t flags = 0; | |
4309 | ||
4310 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4311 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4312 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4313 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4314 | else if (strncmp (argv[1], "med", 1) == 0) | |
4315 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4316 | ||
4317 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4318 | bgp_node_safi (vty), flags); | |
4319 | } | |
4320 | ||
4321 | DEFUN (no_neighbor_attr_unchanged2, | |
4322 | no_neighbor_attr_unchanged2_cmd, | |
4323 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4324 | NO_STR | |
4325 | NEIGHBOR_STR | |
4326 | NEIGHBOR_ADDR_STR2 | |
4327 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4328 | "As-path attribute\n" | |
4329 | "Nexthop attribute\n" | |
4330 | "Med attribute\n") | |
4331 | { | |
4332 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4333 | ||
4334 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4335 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4336 | else if (strncmp (argv[1], "med", 1) == 0) | |
4337 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4338 | ||
4339 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4340 | bgp_node_safi (vty), flags); | |
4341 | } | |
4342 | ||
4343 | DEFUN (no_neighbor_attr_unchanged3, | |
4344 | no_neighbor_attr_unchanged3_cmd, | |
4345 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4346 | NO_STR | |
4347 | NEIGHBOR_STR | |
4348 | NEIGHBOR_ADDR_STR2 | |
4349 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4350 | "Nexthop attribute\n" | |
4351 | "As-path attribute\n" | |
4352 | "Med attribute\n") | |
4353 | { | |
4354 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4355 | ||
4356 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4357 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4358 | else if (strncmp (argv[1], "med", 1) == 0) | |
4359 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4360 | ||
4361 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4362 | bgp_node_safi (vty), flags); | |
4363 | } | |
4364 | ||
4365 | DEFUN (no_neighbor_attr_unchanged4, | |
4366 | no_neighbor_attr_unchanged4_cmd, | |
4367 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4368 | NO_STR | |
4369 | NEIGHBOR_STR | |
4370 | NEIGHBOR_ADDR_STR2 | |
4371 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4372 | "Med attribute\n" | |
4373 | "As-path attribute\n" | |
4374 | "Nexthop attribute\n") | |
4375 | { | |
4376 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4377 | ||
4378 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4379 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4380 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4381 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4382 | ||
4383 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4384 | bgp_node_safi (vty), flags); | |
4385 | } | |
4386 | ||
4387 | ALIAS (no_neighbor_attr_unchanged, | |
4388 | no_neighbor_attr_unchanged5_cmd, | |
4389 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4390 | NO_STR | |
4391 | NEIGHBOR_STR | |
4392 | NEIGHBOR_ADDR_STR2 | |
4393 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4394 | "As-path attribute\n" | |
4395 | "Nexthop attribute\n" | |
4396 | "Med attribute\n") | |
4397 | ||
4398 | ALIAS (no_neighbor_attr_unchanged, | |
4399 | no_neighbor_attr_unchanged6_cmd, | |
4400 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4401 | NO_STR | |
4402 | NEIGHBOR_STR | |
4403 | NEIGHBOR_ADDR_STR2 | |
4404 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4405 | "As-path attribute\n" | |
4406 | "Med attribute\n" | |
4407 | "Nexthop attribute\n") | |
4408 | ||
4409 | ALIAS (no_neighbor_attr_unchanged, | |
4410 | no_neighbor_attr_unchanged7_cmd, | |
4411 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4412 | NO_STR | |
4413 | NEIGHBOR_STR | |
4414 | NEIGHBOR_ADDR_STR2 | |
4415 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4416 | "Nexthop attribute\n" | |
4417 | "Med attribute\n" | |
4418 | "As-path attribute\n") | |
4419 | ||
4420 | ALIAS (no_neighbor_attr_unchanged, | |
4421 | no_neighbor_attr_unchanged8_cmd, | |
4422 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4423 | NO_STR | |
4424 | NEIGHBOR_STR | |
4425 | NEIGHBOR_ADDR_STR2 | |
4426 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4427 | "Nexthop attribute\n" | |
4428 | "As-path attribute\n" | |
4429 | "Med attribute\n") | |
4430 | ||
4431 | ALIAS (no_neighbor_attr_unchanged, | |
4432 | no_neighbor_attr_unchanged9_cmd, | |
4433 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4434 | NO_STR | |
4435 | NEIGHBOR_STR | |
4436 | NEIGHBOR_ADDR_STR2 | |
4437 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4438 | "Med attribute\n" | |
4439 | "Nexthop attribute\n" | |
4440 | "As-path attribute\n") | |
4441 | ||
4442 | ALIAS (no_neighbor_attr_unchanged, | |
4443 | no_neighbor_attr_unchanged10_cmd, | |
4444 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4445 | NO_STR | |
4446 | NEIGHBOR_STR | |
4447 | NEIGHBOR_ADDR_STR2 | |
4448 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4449 | "Med attribute\n" | |
4450 | "As-path attribute\n" | |
4451 | "Nexthop attribute\n") | |
4452 | ||
718e3744 | 4453 | /* EBGP multihop configuration. */ |
94f2b392 | 4454 | static int |
fd79ac91 | 4455 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
4456 | const char *ttl_str) | |
718e3744 | 4457 | { |
4458 | struct peer *peer; | |
fd79ac91 | 4459 | unsigned int ttl; |
718e3744 | 4460 | |
4461 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4462 | if (! peer) | |
4463 | return CMD_WARNING; | |
4464 | ||
63fa10b5 QY |
4465 | if (peer->conf_if) |
4466 | return bgp_vty_return (vty, BGP_ERR_INVALID_FOR_DIRECT_PEER); | |
4467 | ||
718e3744 | 4468 | if (! ttl_str) |
9b1be336 | 4469 | ttl = MAXTTL; |
718e3744 | 4470 | else |
9b1be336 | 4471 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, MAXTTL); |
718e3744 | 4472 | |
89b6d1f8 | 4473 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 4474 | } |
4475 | ||
94f2b392 | 4476 | static int |
fd79ac91 | 4477 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4478 | { |
4479 | struct peer *peer; | |
4480 | ||
4481 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4482 | if (! peer) | |
4483 | return CMD_WARNING; | |
4484 | ||
89b6d1f8 | 4485 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 4486 | } |
4487 | ||
4488 | /* neighbor ebgp-multihop. */ | |
4489 | DEFUN (neighbor_ebgp_multihop, | |
4490 | neighbor_ebgp_multihop_cmd, | |
4491 | NEIGHBOR_CMD2 "ebgp-multihop", | |
4492 | NEIGHBOR_STR | |
4493 | NEIGHBOR_ADDR_STR2 | |
4494 | "Allow EBGP neighbors not on directly connected networks\n") | |
4495 | { | |
4496 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
4497 | } | |
4498 | ||
4499 | DEFUN (neighbor_ebgp_multihop_ttl, | |
4500 | neighbor_ebgp_multihop_ttl_cmd, | |
9b1be336 | 4501 | NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), |
718e3744 | 4502 | NEIGHBOR_STR |
4503 | NEIGHBOR_ADDR_STR2 | |
4504 | "Allow EBGP neighbors not on directly connected networks\n" | |
4505 | "maximum hop count\n") | |
4506 | { | |
4507 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
4508 | } | |
4509 | ||
4510 | DEFUN (no_neighbor_ebgp_multihop, | |
4511 | no_neighbor_ebgp_multihop_cmd, | |
4512 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
4513 | NO_STR | |
4514 | NEIGHBOR_STR | |
4515 | NEIGHBOR_ADDR_STR2 | |
4516 | "Allow EBGP neighbors not on directly connected networks\n") | |
4517 | { | |
4518 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
4519 | } | |
4520 | ||
4521 | ALIAS (no_neighbor_ebgp_multihop, | |
4522 | no_neighbor_ebgp_multihop_ttl_cmd, | |
9b1be336 | 4523 | NO_NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), |
718e3744 | 4524 | NO_STR |
4525 | NEIGHBOR_STR | |
4526 | NEIGHBOR_ADDR_STR2 | |
4527 | "Allow EBGP neighbors not on directly connected networks\n" | |
4528 | "maximum hop count\n") | |
6b0655a2 | 4529 | |
6ffd2079 | 4530 | /* disable-connected-check */ |
4531 | DEFUN (neighbor_disable_connected_check, | |
4532 | neighbor_disable_connected_check_cmd, | |
4533 | NEIGHBOR_CMD2 "disable-connected-check", | |
4534 | NEIGHBOR_STR | |
4535 | NEIGHBOR_ADDR_STR2 | |
4536 | "one-hop away EBGP peer using loopback address\n") | |
4537 | { | |
4538 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4539 | } | |
4540 | ||
4541 | DEFUN (no_neighbor_disable_connected_check, | |
4542 | no_neighbor_disable_connected_check_cmd, | |
4543 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
4544 | NO_STR | |
4545 | NEIGHBOR_STR | |
4546 | NEIGHBOR_ADDR_STR2 | |
4547 | "one-hop away EBGP peer using loopback address\n") | |
4548 | { | |
4549 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4550 | } | |
4551 | ||
718e3744 | 4552 | /* Enforce multihop. */ |
6ffd2079 | 4553 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 4554 | neighbor_enforce_multihop_cmd, |
4555 | NEIGHBOR_CMD2 "enforce-multihop", | |
4556 | NEIGHBOR_STR | |
4557 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4558 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 4559 | |
6ffd2079 | 4560 | /* Enforce multihop. */ |
4561 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 4562 | no_neighbor_enforce_multihop_cmd, |
4563 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
4564 | NO_STR | |
4565 | NEIGHBOR_STR | |
4566 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4567 | "Enforce EBGP neighbors perform multihop\n") |
6b0655a2 | 4568 | |
718e3744 | 4569 | DEFUN (neighbor_description, |
4570 | neighbor_description_cmd, | |
4571 | NEIGHBOR_CMD2 "description .LINE", | |
4572 | NEIGHBOR_STR | |
4573 | NEIGHBOR_ADDR_STR2 | |
4574 | "Neighbor specific description\n" | |
4575 | "Up to 80 characters describing this neighbor\n") | |
4576 | { | |
4577 | struct peer *peer; | |
718e3744 | 4578 | char *str; |
718e3744 | 4579 | |
4580 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4581 | if (! peer) | |
4582 | return CMD_WARNING; | |
4583 | ||
4584 | if (argc == 1) | |
4585 | return CMD_SUCCESS; | |
4586 | ||
3b8b1855 | 4587 | str = argv_concat(argv, argc, 1); |
718e3744 | 4588 | |
4589 | peer_description_set (peer, str); | |
4590 | ||
3b8b1855 | 4591 | XFREE (MTYPE_TMP, str); |
718e3744 | 4592 | |
4593 | return CMD_SUCCESS; | |
4594 | } | |
4595 | ||
4596 | DEFUN (no_neighbor_description, | |
4597 | no_neighbor_description_cmd, | |
4598 | NO_NEIGHBOR_CMD2 "description", | |
4599 | NO_STR | |
4600 | NEIGHBOR_STR | |
4601 | NEIGHBOR_ADDR_STR2 | |
4602 | "Neighbor specific description\n") | |
4603 | { | |
4604 | struct peer *peer; | |
4605 | ||
4606 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4607 | if (! peer) | |
4608 | return CMD_WARNING; | |
4609 | ||
4610 | peer_description_unset (peer); | |
4611 | ||
4612 | return CMD_SUCCESS; | |
4613 | } | |
4614 | ||
4615 | ALIAS (no_neighbor_description, | |
4616 | no_neighbor_description_val_cmd, | |
4617 | NO_NEIGHBOR_CMD2 "description .LINE", | |
4618 | NO_STR | |
4619 | NEIGHBOR_STR | |
4620 | NEIGHBOR_ADDR_STR2 | |
4621 | "Neighbor specific description\n" | |
4622 | "Up to 80 characters describing this neighbor\n") | |
6b0655a2 | 4623 | |
718e3744 | 4624 | /* Neighbor update-source. */ |
94f2b392 | 4625 | static int |
fd79ac91 | 4626 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
4627 | const char *source_str) | |
718e3744 | 4628 | { |
4629 | struct peer *peer; | |
718e3744 | 4630 | |
4631 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4632 | if (! peer) | |
4633 | return CMD_WARNING; | |
4634 | ||
a80beece DS |
4635 | if (peer->conf_if) |
4636 | return CMD_WARNING; | |
4637 | ||
718e3744 | 4638 | if (source_str) |
4639 | { | |
c63b83fe JBD |
4640 | union sockunion su; |
4641 | int ret = str2sockunion (source_str, &su); | |
4642 | ||
4643 | if (ret == 0) | |
4644 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 4645 | else |
4646 | peer_update_source_if_set (peer, source_str); | |
4647 | } | |
4648 | else | |
4649 | peer_update_source_unset (peer); | |
4650 | ||
4651 | return CMD_SUCCESS; | |
4652 | } | |
4653 | ||
dcb52bd5 DS |
4654 | #define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD" |
4655 | #define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")" | |
4656 | #define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}" | |
369688c0 PJ |
4657 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
4658 | "IPv4 address\n" \ | |
9a1a331d PJ |
4659 | "IPv6 address\n" \ |
4660 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 4661 | |
718e3744 | 4662 | DEFUN (neighbor_update_source, |
4663 | neighbor_update_source_cmd, | |
dcb52bd5 | 4664 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_REQ_STR, |
718e3744 | 4665 | NEIGHBOR_STR |
4666 | NEIGHBOR_ADDR_STR2 | |
4667 | "Source of routing updates\n" | |
369688c0 | 4668 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 4669 | { |
4670 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
4671 | } | |
4672 | ||
4673 | DEFUN (no_neighbor_update_source, | |
4674 | no_neighbor_update_source_cmd, | |
dcb52bd5 | 4675 | NO_NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_OPT_STR, |
718e3744 | 4676 | NO_STR |
4677 | NEIGHBOR_STR | |
4678 | NEIGHBOR_ADDR_STR2 | |
dcb52bd5 DS |
4679 | "Source of routing updates\n" |
4680 | BGP_UPDATE_SOURCE_HELP_STR) | |
718e3744 | 4681 | { |
4682 | return peer_update_source_vty (vty, argv[0], NULL); | |
4683 | } | |
6b0655a2 | 4684 | |
94f2b392 | 4685 | static int |
fd79ac91 | 4686 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
4687 | afi_t afi, safi_t safi, | |
4688 | const char *rmap, int set) | |
718e3744 | 4689 | { |
4690 | int ret; | |
4691 | struct peer *peer; | |
4692 | ||
4693 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4694 | if (! peer) | |
4695 | return CMD_WARNING; | |
4696 | ||
4697 | if (set) | |
4698 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
4699 | else | |
4700 | ret = peer_default_originate_unset (peer, afi, safi); | |
4701 | ||
4702 | return bgp_vty_return (vty, ret); | |
4703 | } | |
4704 | ||
4705 | /* neighbor default-originate. */ | |
4706 | DEFUN (neighbor_default_originate, | |
4707 | neighbor_default_originate_cmd, | |
4708 | NEIGHBOR_CMD2 "default-originate", | |
4709 | NEIGHBOR_STR | |
4710 | NEIGHBOR_ADDR_STR2 | |
4711 | "Originate default route to this neighbor\n") | |
4712 | { | |
4713 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4714 | bgp_node_safi (vty), NULL, 1); | |
4715 | } | |
4716 | ||
4717 | DEFUN (neighbor_default_originate_rmap, | |
4718 | neighbor_default_originate_rmap_cmd, | |
4719 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4720 | NEIGHBOR_STR | |
4721 | NEIGHBOR_ADDR_STR2 | |
4722 | "Originate default route to this neighbor\n" | |
4723 | "Route-map to specify criteria to originate default\n" | |
4724 | "route-map name\n") | |
4725 | { | |
4726 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4727 | bgp_node_safi (vty), argv[1], 1); | |
4728 | } | |
4729 | ||
4730 | DEFUN (no_neighbor_default_originate, | |
4731 | no_neighbor_default_originate_cmd, | |
4732 | NO_NEIGHBOR_CMD2 "default-originate", | |
4733 | NO_STR | |
4734 | NEIGHBOR_STR | |
4735 | NEIGHBOR_ADDR_STR2 | |
4736 | "Originate default route to this neighbor\n") | |
4737 | { | |
4738 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4739 | bgp_node_safi (vty), NULL, 0); | |
4740 | } | |
4741 | ||
4742 | ALIAS (no_neighbor_default_originate, | |
4743 | no_neighbor_default_originate_rmap_cmd, | |
4744 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4745 | NO_STR | |
4746 | NEIGHBOR_STR | |
4747 | NEIGHBOR_ADDR_STR2 | |
4748 | "Originate default route to this neighbor\n" | |
4749 | "Route-map to specify criteria to originate default\n" | |
4750 | "route-map name\n") | |
6b0655a2 | 4751 | |
718e3744 | 4752 | /* Set neighbor's BGP port. */ |
94f2b392 | 4753 | static int |
fd79ac91 | 4754 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
4755 | const char *port_str) | |
718e3744 | 4756 | { |
4757 | struct peer *peer; | |
4758 | u_int16_t port; | |
4759 | struct servent *sp; | |
4760 | ||
4761 | peer = peer_lookup_vty (vty, ip_str); | |
4762 | if (! peer) | |
4763 | return CMD_WARNING; | |
4764 | ||
4765 | if (! port_str) | |
4766 | { | |
4767 | sp = getservbyname ("bgp", "tcp"); | |
4768 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
4769 | } | |
4770 | else | |
4771 | { | |
4772 | VTY_GET_INTEGER("port", port, port_str); | |
4773 | } | |
4774 | ||
4775 | peer_port_set (peer, port); | |
4776 | ||
4777 | return CMD_SUCCESS; | |
4778 | } | |
4779 | ||
f418446b | 4780 | /* Set specified peer's BGP port. */ |
718e3744 | 4781 | DEFUN (neighbor_port, |
4782 | neighbor_port_cmd, | |
4783 | NEIGHBOR_CMD "port <0-65535>", | |
4784 | NEIGHBOR_STR | |
4785 | NEIGHBOR_ADDR_STR | |
4786 | "Neighbor's BGP port\n" | |
4787 | "TCP port number\n") | |
4788 | { | |
4789 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
4790 | } | |
4791 | ||
4792 | DEFUN (no_neighbor_port, | |
4793 | no_neighbor_port_cmd, | |
4794 | NO_NEIGHBOR_CMD "port", | |
4795 | NO_STR | |
4796 | NEIGHBOR_STR | |
4797 | NEIGHBOR_ADDR_STR | |
4798 | "Neighbor's BGP port\n") | |
4799 | { | |
4800 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
4801 | } | |
4802 | ||
4803 | ALIAS (no_neighbor_port, | |
4804 | no_neighbor_port_val_cmd, | |
4805 | NO_NEIGHBOR_CMD "port <0-65535>", | |
4806 | NO_STR | |
4807 | NEIGHBOR_STR | |
4808 | NEIGHBOR_ADDR_STR | |
4809 | "Neighbor's BGP port\n" | |
4810 | "TCP port number\n") | |
6b0655a2 | 4811 | |
718e3744 | 4812 | /* neighbor weight. */ |
94f2b392 | 4813 | static int |
fd79ac91 | 4814 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
4815 | const char *weight_str) | |
718e3744 | 4816 | { |
1f9a9fff | 4817 | int ret; |
718e3744 | 4818 | struct peer *peer; |
4819 | unsigned long weight; | |
4820 | ||
4821 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4822 | if (! peer) | |
4823 | return CMD_WARNING; | |
4824 | ||
4825 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
4826 | ||
1f9a9fff PJ |
4827 | ret = peer_weight_set (peer, weight); |
4828 | return bgp_vty_return (vty, ret); | |
718e3744 | 4829 | } |
4830 | ||
94f2b392 | 4831 | static int |
fd79ac91 | 4832 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4833 | { |
1f9a9fff | 4834 | int ret; |
718e3744 | 4835 | struct peer *peer; |
4836 | ||
4837 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4838 | if (! peer) | |
4839 | return CMD_WARNING; | |
4840 | ||
1f9a9fff PJ |
4841 | ret = peer_weight_unset (peer); |
4842 | return bgp_vty_return (vty, ret); | |
718e3744 | 4843 | } |
4844 | ||
4845 | DEFUN (neighbor_weight, | |
4846 | neighbor_weight_cmd, | |
4847 | NEIGHBOR_CMD2 "weight <0-65535>", | |
4848 | NEIGHBOR_STR | |
4849 | NEIGHBOR_ADDR_STR2 | |
4850 | "Set default weight for routes from this neighbor\n" | |
4851 | "default weight\n") | |
4852 | { | |
4853 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
4854 | } | |
4855 | ||
4856 | DEFUN (no_neighbor_weight, | |
4857 | no_neighbor_weight_cmd, | |
4858 | NO_NEIGHBOR_CMD2 "weight", | |
4859 | NO_STR | |
4860 | NEIGHBOR_STR | |
4861 | NEIGHBOR_ADDR_STR2 | |
4862 | "Set default weight for routes from this neighbor\n") | |
4863 | { | |
4864 | return peer_weight_unset_vty (vty, argv[0]); | |
4865 | } | |
4866 | ||
4867 | ALIAS (no_neighbor_weight, | |
4868 | no_neighbor_weight_val_cmd, | |
4869 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
4870 | NO_STR | |
4871 | NEIGHBOR_STR | |
4872 | NEIGHBOR_ADDR_STR2 | |
4873 | "Set default weight for routes from this neighbor\n" | |
4874 | "default weight\n") | |
6b0655a2 | 4875 | |
718e3744 | 4876 | /* Override capability negotiation. */ |
4877 | DEFUN (neighbor_override_capability, | |
4878 | neighbor_override_capability_cmd, | |
4879 | NEIGHBOR_CMD2 "override-capability", | |
4880 | NEIGHBOR_STR | |
4881 | NEIGHBOR_ADDR_STR2 | |
4882 | "Override capability negotiation result\n") | |
4883 | { | |
4884 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4885 | } | |
4886 | ||
4887 | DEFUN (no_neighbor_override_capability, | |
4888 | no_neighbor_override_capability_cmd, | |
4889 | NO_NEIGHBOR_CMD2 "override-capability", | |
4890 | NO_STR | |
4891 | NEIGHBOR_STR | |
4892 | NEIGHBOR_ADDR_STR2 | |
4893 | "Override capability negotiation result\n") | |
4894 | { | |
4895 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4896 | } | |
6b0655a2 | 4897 | |
718e3744 | 4898 | DEFUN (neighbor_strict_capability, |
4899 | neighbor_strict_capability_cmd, | |
4900 | NEIGHBOR_CMD "strict-capability-match", | |
4901 | NEIGHBOR_STR | |
4902 | NEIGHBOR_ADDR_STR | |
4903 | "Strict capability negotiation match\n") | |
4904 | { | |
4905 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4906 | } | |
4907 | ||
4908 | DEFUN (no_neighbor_strict_capability, | |
4909 | no_neighbor_strict_capability_cmd, | |
4910 | NO_NEIGHBOR_CMD "strict-capability-match", | |
4911 | NO_STR | |
4912 | NEIGHBOR_STR | |
4913 | NEIGHBOR_ADDR_STR | |
4914 | "Strict capability negotiation match\n") | |
4915 | { | |
4916 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4917 | } | |
6b0655a2 | 4918 | |
94f2b392 | 4919 | static int |
fd79ac91 | 4920 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
4921 | const char *keep_str, const char *hold_str) | |
718e3744 | 4922 | { |
4923 | int ret; | |
4924 | struct peer *peer; | |
4925 | u_int32_t keepalive; | |
4926 | u_int32_t holdtime; | |
4927 | ||
4928 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4929 | if (! peer) | |
4930 | return CMD_WARNING; | |
4931 | ||
4932 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
4933 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
4934 | ||
4935 | ret = peer_timers_set (peer, keepalive, holdtime); | |
4936 | ||
4937 | return bgp_vty_return (vty, ret); | |
4938 | } | |
6b0655a2 | 4939 | |
94f2b392 | 4940 | static int |
fd79ac91 | 4941 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4942 | { |
4943 | int ret; | |
4944 | struct peer *peer; | |
4945 | ||
0c412461 | 4946 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4947 | if (! peer) |
4948 | return CMD_WARNING; | |
4949 | ||
4950 | ret = peer_timers_unset (peer); | |
4951 | ||
4952 | return bgp_vty_return (vty, ret); | |
4953 | } | |
4954 | ||
4955 | DEFUN (neighbor_timers, | |
4956 | neighbor_timers_cmd, | |
4957 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4958 | NEIGHBOR_STR | |
4959 | NEIGHBOR_ADDR_STR2 | |
4960 | "BGP per neighbor timers\n" | |
4961 | "Keepalive interval\n" | |
4962 | "Holdtime\n") | |
4963 | { | |
4964 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
4965 | } | |
4966 | ||
4967 | DEFUN (no_neighbor_timers, | |
4968 | no_neighbor_timers_cmd, | |
4969 | NO_NEIGHBOR_CMD2 "timers", | |
4970 | NO_STR | |
4971 | NEIGHBOR_STR | |
4972 | NEIGHBOR_ADDR_STR2 | |
4973 | "BGP per neighbor timers\n") | |
4974 | { | |
4975 | return peer_timers_unset_vty (vty, argv[0]); | |
4976 | } | |
6b0655a2 | 4977 | |
813d4307 DW |
4978 | ALIAS (no_neighbor_timers, |
4979 | no_neighbor_timers_val_cmd, | |
4980 | NO_NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4981 | NO_STR | |
4982 | NEIGHBOR_STR | |
4983 | NEIGHBOR_ADDR_STR2 | |
4984 | "BGP per neighbor timers\n" | |
4985 | "Keepalive interval\n" | |
4986 | "Holdtime\n") | |
4987 | ||
94f2b392 | 4988 | static int |
fd79ac91 | 4989 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
4990 | const char *time_str) | |
718e3744 | 4991 | { |
4992 | int ret; | |
4993 | struct peer *peer; | |
4994 | u_int32_t connect; | |
4995 | ||
966f821c | 4996 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4997 | if (! peer) |
4998 | return CMD_WARNING; | |
4999 | ||
5000 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
5001 | ||
5002 | ret = peer_timers_connect_set (peer, connect); | |
5003 | ||
966f821c | 5004 | return bgp_vty_return (vty, ret); |
718e3744 | 5005 | } |
5006 | ||
94f2b392 | 5007 | static int |
fd79ac91 | 5008 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 5009 | { |
5010 | int ret; | |
5011 | struct peer *peer; | |
5012 | ||
5013 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5014 | if (! peer) | |
5015 | return CMD_WARNING; | |
5016 | ||
5017 | ret = peer_timers_connect_unset (peer); | |
5018 | ||
966f821c | 5019 | return bgp_vty_return (vty, ret); |
718e3744 | 5020 | } |
5021 | ||
5022 | DEFUN (neighbor_timers_connect, | |
5023 | neighbor_timers_connect_cmd, | |
8e0d0089 | 5024 | NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 5025 | NEIGHBOR_STR |
966f821c | 5026 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5027 | "BGP per neighbor timers\n" |
5028 | "BGP connect timer\n" | |
5029 | "Connect timer\n") | |
5030 | { | |
5031 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
5032 | } | |
5033 | ||
5034 | DEFUN (no_neighbor_timers_connect, | |
5035 | no_neighbor_timers_connect_cmd, | |
966f821c | 5036 | NO_NEIGHBOR_CMD2 "timers connect", |
718e3744 | 5037 | NO_STR |
5038 | NEIGHBOR_STR | |
966f821c | 5039 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5040 | "BGP per neighbor timers\n" |
5041 | "BGP connect timer\n") | |
5042 | { | |
5043 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
5044 | } | |
5045 | ||
5046 | ALIAS (no_neighbor_timers_connect, | |
5047 | no_neighbor_timers_connect_val_cmd, | |
8e0d0089 | 5048 | NO_NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 5049 | NO_STR |
5050 | NEIGHBOR_STR | |
966f821c | 5051 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5052 | "BGP per neighbor timers\n" |
5053 | "BGP connect timer\n" | |
5054 | "Connect timer\n") | |
6b0655a2 | 5055 | |
94f2b392 | 5056 | static int |
fd79ac91 | 5057 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
5058 | const char *time_str, int set) | |
718e3744 | 5059 | { |
5060 | int ret; | |
5061 | struct peer *peer; | |
5062 | u_int32_t routeadv = 0; | |
5063 | ||
966f821c | 5064 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 5065 | if (! peer) |
5066 | return CMD_WARNING; | |
5067 | ||
5068 | if (time_str) | |
5069 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
5070 | ||
5071 | if (set) | |
5072 | ret = peer_advertise_interval_set (peer, routeadv); | |
5073 | else | |
5074 | ret = peer_advertise_interval_unset (peer); | |
5075 | ||
966f821c | 5076 | return bgp_vty_return (vty, ret); |
718e3744 | 5077 | } |
5078 | ||
5079 | DEFUN (neighbor_advertise_interval, | |
5080 | neighbor_advertise_interval_cmd, | |
966f821c | 5081 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 5082 | NEIGHBOR_STR |
966f821c | 5083 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5084 | "Minimum interval between sending BGP routing updates\n" |
5085 | "time in seconds\n") | |
5086 | { | |
5087 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
5088 | } | |
5089 | ||
5090 | DEFUN (no_neighbor_advertise_interval, | |
5091 | no_neighbor_advertise_interval_cmd, | |
966f821c | 5092 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
718e3744 | 5093 | NO_STR |
5094 | NEIGHBOR_STR | |
966f821c | 5095 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5096 | "Minimum interval between sending BGP routing updates\n") |
5097 | { | |
5098 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
5099 | } | |
5100 | ||
5101 | ALIAS (no_neighbor_advertise_interval, | |
5102 | no_neighbor_advertise_interval_val_cmd, | |
966f821c | 5103 | NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 5104 | NO_STR |
5105 | NEIGHBOR_STR | |
966f821c | 5106 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5107 | "Minimum interval between sending BGP routing updates\n" |
5108 | "time in seconds\n") | |
6b0655a2 | 5109 | |
518f0eb1 DS |
5110 | /* Time to wait before processing route-map updates */ |
5111 | DEFUN (bgp_set_route_map_delay_timer, | |
5112 | bgp_set_route_map_delay_timer_cmd, | |
5113 | "bgp route-map delay-timer <0-600>", | |
5114 | SET_STR | |
5115 | "BGP route-map delay timer\n" | |
5116 | "Time in secs to wait before processing route-map changes\n" | |
f414725f | 5117 | "0 disables the timer, no route updates happen when route-maps change\n") |
518f0eb1 DS |
5118 | { |
5119 | u_int32_t rmap_delay_timer; | |
518f0eb1 | 5120 | |
518f0eb1 DS |
5121 | if (argv[0]) |
5122 | { | |
5123 | VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); | |
5fe9f963 | 5124 | bm->rmap_update_timer = rmap_delay_timer; |
518f0eb1 DS |
5125 | |
5126 | /* if the dynamic update handling is being disabled, and a timer is | |
5127 | * running, stop the timer and act as if the timer has already fired. | |
5128 | */ | |
5fe9f963 | 5129 | if (!rmap_delay_timer && bm->t_rmap_update ) |
518f0eb1 | 5130 | { |
5fe9f963 | 5131 | BGP_TIMER_OFF(bm->t_rmap_update); |
5132 | thread_execute (bm->master, bgp_route_map_update_timer, NULL, 0); | |
518f0eb1 DS |
5133 | } |
5134 | return CMD_SUCCESS; | |
5135 | } | |
5136 | else | |
ffd0c037 | 5137 | return CMD_WARNING; |
518f0eb1 DS |
5138 | } |
5139 | ||
5140 | DEFUN (no_bgp_set_route_map_delay_timer, | |
5141 | no_bgp_set_route_map_delay_timer_cmd, | |
5142 | "no bgp route-map delay-timer", | |
5143 | NO_STR | |
5144 | "Default BGP route-map delay timer\n" | |
f414725f | 5145 | "Reset to default time to wait for processing route-map changes\n") |
518f0eb1 | 5146 | { |
518f0eb1 | 5147 | |
5fe9f963 | 5148 | bm->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER; |
518f0eb1 DS |
5149 | |
5150 | return CMD_SUCCESS; | |
5151 | } | |
5152 | ||
f414725f DS |
5153 | ALIAS (no_bgp_set_route_map_delay_timer, |
5154 | no_bgp_set_route_map_delay_timer_val_cmd, | |
5155 | "no bgp route-map delay-timer <0-600>", | |
5156 | NO_STR | |
5157 | "Default BGP route-map delay timer\n" | |
5158 | "Reset to default time to wait for processing route-map changes\n" | |
5159 | "0 disables the timer, no route updates happen when route-maps change\n") | |
5160 | ||
718e3744 | 5161 | /* neighbor interface */ |
94f2b392 | 5162 | static int |
fd79ac91 | 5163 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 5164 | { |
718e3744 | 5165 | struct peer *peer; |
5166 | ||
5167 | peer = peer_lookup_vty (vty, ip_str); | |
a80beece | 5168 | if (! peer || peer->conf_if) |
718e3744 | 5169 | return CMD_WARNING; |
5170 | ||
5171 | if (str) | |
ffd0c037 | 5172 | peer_interface_set (peer, str); |
718e3744 | 5173 | else |
ffd0c037 | 5174 | peer_interface_unset (peer); |
718e3744 | 5175 | |
5176 | return CMD_SUCCESS; | |
5177 | } | |
5178 | ||
5179 | DEFUN (neighbor_interface, | |
5180 | neighbor_interface_cmd, | |
5181 | NEIGHBOR_CMD "interface WORD", | |
5182 | NEIGHBOR_STR | |
5183 | NEIGHBOR_ADDR_STR | |
5184 | "Interface\n" | |
5185 | "Interface name\n") | |
5186 | { | |
8ffedcea DS |
5187 | if (argc == 3) |
5188 | return peer_interface_vty (vty, argv[0], argv[1]); | |
5189 | else | |
5190 | return peer_interface_vty (vty, argv[0], argv[1]); | |
718e3744 | 5191 | } |
5192 | ||
5193 | DEFUN (no_neighbor_interface, | |
5194 | no_neighbor_interface_cmd, | |
8ffedcea | 5195 | NO_NEIGHBOR_CMD2 "interface WORD", |
718e3744 | 5196 | NO_STR |
5197 | NEIGHBOR_STR | |
5198 | NEIGHBOR_ADDR_STR | |
5199 | "Interface\n" | |
5200 | "Interface name\n") | |
5201 | { | |
5202 | return peer_interface_vty (vty, argv[0], NULL); | |
5203 | } | |
6b0655a2 | 5204 | |
718e3744 | 5205 | /* Set distribute list to the peer. */ |
94f2b392 | 5206 | static int |
fd79ac91 | 5207 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
5208 | afi_t afi, safi_t safi, | |
5209 | const char *name_str, const char *direct_str) | |
718e3744 | 5210 | { |
5211 | int ret; | |
5212 | struct peer *peer; | |
5213 | int direct = FILTER_IN; | |
5214 | ||
5215 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5216 | if (! peer) | |
5217 | return CMD_WARNING; | |
5218 | ||
5219 | /* Check filter direction. */ | |
5220 | if (strncmp (direct_str, "i", 1) == 0) | |
5221 | direct = FILTER_IN; | |
5222 | else if (strncmp (direct_str, "o", 1) == 0) | |
5223 | direct = FILTER_OUT; | |
5224 | ||
5225 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
5226 | ||
5227 | return bgp_vty_return (vty, ret); | |
5228 | } | |
5229 | ||
94f2b392 | 5230 | static int |
fd79ac91 | 5231 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5232 | safi_t safi, const char *direct_str) | |
718e3744 | 5233 | { |
5234 | int ret; | |
5235 | struct peer *peer; | |
5236 | int direct = FILTER_IN; | |
5237 | ||
5238 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5239 | if (! peer) | |
5240 | return CMD_WARNING; | |
5241 | ||
5242 | /* Check filter direction. */ | |
5243 | if (strncmp (direct_str, "i", 1) == 0) | |
5244 | direct = FILTER_IN; | |
5245 | else if (strncmp (direct_str, "o", 1) == 0) | |
5246 | direct = FILTER_OUT; | |
5247 | ||
5248 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
5249 | ||
5250 | return bgp_vty_return (vty, ret); | |
5251 | } | |
5252 | ||
5253 | DEFUN (neighbor_distribute_list, | |
5254 | neighbor_distribute_list_cmd, | |
5255 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5256 | NEIGHBOR_STR | |
5257 | NEIGHBOR_ADDR_STR2 | |
5258 | "Filter updates to/from this neighbor\n" | |
5259 | "IP access-list number\n" | |
5260 | "IP access-list number (expanded range)\n" | |
5261 | "IP Access-list name\n" | |
5262 | "Filter incoming updates\n" | |
5263 | "Filter outgoing updates\n") | |
5264 | { | |
5265 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5266 | bgp_node_safi (vty), argv[1], argv[2]); | |
5267 | } | |
5268 | ||
5269 | DEFUN (no_neighbor_distribute_list, | |
5270 | no_neighbor_distribute_list_cmd, | |
5271 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5272 | NO_STR | |
5273 | NEIGHBOR_STR | |
5274 | NEIGHBOR_ADDR_STR2 | |
5275 | "Filter updates to/from this neighbor\n" | |
5276 | "IP access-list number\n" | |
5277 | "IP access-list number (expanded range)\n" | |
5278 | "IP Access-list name\n" | |
5279 | "Filter incoming updates\n" | |
5280 | "Filter outgoing updates\n") | |
5281 | { | |
5282 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5283 | bgp_node_safi (vty), argv[2]); | |
5284 | } | |
6b0655a2 | 5285 | |
718e3744 | 5286 | /* Set prefix list to the peer. */ |
94f2b392 | 5287 | static int |
fd79ac91 | 5288 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5289 | safi_t safi, const char *name_str, | |
5290 | const char *direct_str) | |
718e3744 | 5291 | { |
5292 | int ret; | |
5293 | struct peer *peer; | |
5294 | int direct = FILTER_IN; | |
5295 | ||
5296 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5297 | if (! peer) | |
5298 | return CMD_WARNING; | |
5299 | ||
5300 | /* Check filter direction. */ | |
5301 | if (strncmp (direct_str, "i", 1) == 0) | |
5302 | direct = FILTER_IN; | |
5303 | else if (strncmp (direct_str, "o", 1) == 0) | |
5304 | direct = FILTER_OUT; | |
5305 | ||
5306 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
5307 | ||
5308 | return bgp_vty_return (vty, ret); | |
5309 | } | |
5310 | ||
94f2b392 | 5311 | static int |
fd79ac91 | 5312 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5313 | safi_t safi, const char *direct_str) | |
718e3744 | 5314 | { |
5315 | int ret; | |
5316 | struct peer *peer; | |
5317 | int direct = FILTER_IN; | |
5318 | ||
5319 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5320 | if (! peer) | |
5321 | return CMD_WARNING; | |
5322 | ||
5323 | /* Check filter direction. */ | |
5324 | if (strncmp (direct_str, "i", 1) == 0) | |
5325 | direct = FILTER_IN; | |
5326 | else if (strncmp (direct_str, "o", 1) == 0) | |
5327 | direct = FILTER_OUT; | |
5328 | ||
5329 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
5330 | ||
5331 | return bgp_vty_return (vty, ret); | |
5332 | } | |
5333 | ||
5334 | DEFUN (neighbor_prefix_list, | |
5335 | neighbor_prefix_list_cmd, | |
5336 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5337 | NEIGHBOR_STR | |
5338 | NEIGHBOR_ADDR_STR2 | |
5339 | "Filter updates to/from this neighbor\n" | |
5340 | "Name of a prefix list\n" | |
5341 | "Filter incoming updates\n" | |
5342 | "Filter outgoing updates\n") | |
5343 | { | |
5344 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5345 | bgp_node_safi (vty), argv[1], argv[2]); | |
5346 | } | |
5347 | ||
5348 | DEFUN (no_neighbor_prefix_list, | |
5349 | no_neighbor_prefix_list_cmd, | |
5350 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5351 | NO_STR | |
5352 | NEIGHBOR_STR | |
5353 | NEIGHBOR_ADDR_STR2 | |
5354 | "Filter updates to/from this neighbor\n" | |
5355 | "Name of a prefix list\n" | |
5356 | "Filter incoming updates\n" | |
5357 | "Filter outgoing updates\n") | |
5358 | { | |
5359 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5360 | bgp_node_safi (vty), argv[2]); | |
5361 | } | |
6b0655a2 | 5362 | |
94f2b392 | 5363 | static int |
fd79ac91 | 5364 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
5365 | afi_t afi, safi_t safi, | |
5366 | const char *name_str, const char *direct_str) | |
718e3744 | 5367 | { |
5368 | int ret; | |
5369 | struct peer *peer; | |
5370 | int direct = FILTER_IN; | |
5371 | ||
5372 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5373 | if (! peer) | |
5374 | return CMD_WARNING; | |
5375 | ||
5376 | /* Check filter direction. */ | |
5377 | if (strncmp (direct_str, "i", 1) == 0) | |
5378 | direct = FILTER_IN; | |
5379 | else if (strncmp (direct_str, "o", 1) == 0) | |
5380 | direct = FILTER_OUT; | |
5381 | ||
5382 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
5383 | ||
5384 | return bgp_vty_return (vty, ret); | |
5385 | } | |
5386 | ||
94f2b392 | 5387 | static int |
fd79ac91 | 5388 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
5389 | afi_t afi, safi_t safi, | |
5390 | const char *direct_str) | |
718e3744 | 5391 | { |
5392 | int ret; | |
5393 | struct peer *peer; | |
5394 | int direct = FILTER_IN; | |
5395 | ||
5396 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5397 | if (! peer) | |
5398 | return CMD_WARNING; | |
5399 | ||
5400 | /* Check filter direction. */ | |
5401 | if (strncmp (direct_str, "i", 1) == 0) | |
5402 | direct = FILTER_IN; | |
5403 | else if (strncmp (direct_str, "o", 1) == 0) | |
5404 | direct = FILTER_OUT; | |
5405 | ||
5406 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
5407 | ||
5408 | return bgp_vty_return (vty, ret); | |
5409 | } | |
5410 | ||
5411 | DEFUN (neighbor_filter_list, | |
5412 | neighbor_filter_list_cmd, | |
5413 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5414 | NEIGHBOR_STR | |
5415 | NEIGHBOR_ADDR_STR2 | |
5416 | "Establish BGP filters\n" | |
5417 | "AS path access-list name\n" | |
5418 | "Filter incoming routes\n" | |
5419 | "Filter outgoing routes\n") | |
5420 | { | |
5421 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5422 | bgp_node_safi (vty), argv[1], argv[2]); | |
5423 | } | |
5424 | ||
5425 | DEFUN (no_neighbor_filter_list, | |
5426 | no_neighbor_filter_list_cmd, | |
5427 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5428 | NO_STR | |
5429 | NEIGHBOR_STR | |
5430 | NEIGHBOR_ADDR_STR2 | |
5431 | "Establish BGP filters\n" | |
5432 | "AS path access-list name\n" | |
5433 | "Filter incoming routes\n" | |
5434 | "Filter outgoing routes\n") | |
5435 | { | |
5436 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5437 | bgp_node_safi (vty), argv[2]); | |
5438 | } | |
6b0655a2 | 5439 | |
718e3744 | 5440 | /* Set route-map to the peer. */ |
94f2b392 | 5441 | static int |
fd79ac91 | 5442 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
5443 | afi_t afi, safi_t safi, | |
5444 | const char *name_str, const char *direct_str) | |
718e3744 | 5445 | { |
5446 | int ret; | |
5447 | struct peer *peer; | |
fee0f4c6 | 5448 | int direct = RMAP_IN; |
718e3744 | 5449 | |
5450 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5451 | if (! peer) | |
5452 | return CMD_WARNING; | |
5453 | ||
5454 | /* Check filter direction. */ | |
fee0f4c6 | 5455 | if (strncmp (direct_str, "in", 2) == 0) |
5456 | direct = RMAP_IN; | |
718e3744 | 5457 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5458 | direct = RMAP_OUT; |
718e3744 | 5459 | |
5460 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
5461 | ||
5462 | return bgp_vty_return (vty, ret); | |
5463 | } | |
5464 | ||
94f2b392 | 5465 | static int |
fd79ac91 | 5466 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5467 | safi_t safi, const char *direct_str) | |
718e3744 | 5468 | { |
5469 | int ret; | |
5470 | struct peer *peer; | |
fee0f4c6 | 5471 | int direct = RMAP_IN; |
718e3744 | 5472 | |
5473 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5474 | if (! peer) | |
5475 | return CMD_WARNING; | |
5476 | ||
5477 | /* Check filter direction. */ | |
fee0f4c6 | 5478 | if (strncmp (direct_str, "in", 2) == 0) |
5479 | direct = RMAP_IN; | |
718e3744 | 5480 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5481 | direct = RMAP_OUT; |
718e3744 | 5482 | |
5483 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
5484 | ||
5485 | return bgp_vty_return (vty, ret); | |
5486 | } | |
5487 | ||
5488 | DEFUN (neighbor_route_map, | |
5489 | neighbor_route_map_cmd, | |
2a3d5731 | 5490 | NEIGHBOR_CMD2 "route-map WORD (in|out)", |
718e3744 | 5491 | NEIGHBOR_STR |
5492 | NEIGHBOR_ADDR_STR2 | |
5493 | "Apply route map to neighbor\n" | |
5494 | "Name of route map\n" | |
5495 | "Apply map to incoming routes\n" | |
2a3d5731 | 5496 | "Apply map to outbound routes\n") |
718e3744 | 5497 | { |
5498 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5499 | bgp_node_safi (vty), argv[1], argv[2]); | |
5500 | } | |
5501 | ||
5502 | DEFUN (no_neighbor_route_map, | |
5503 | no_neighbor_route_map_cmd, | |
2a3d5731 | 5504 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out)", |
718e3744 | 5505 | NO_STR |
5506 | NEIGHBOR_STR | |
5507 | NEIGHBOR_ADDR_STR2 | |
5508 | "Apply route map to neighbor\n" | |
5509 | "Name of route map\n" | |
5510 | "Apply map to incoming routes\n" | |
2a3d5731 | 5511 | "Apply map to outbound routes\n") |
718e3744 | 5512 | { |
5513 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5514 | bgp_node_safi (vty), argv[2]); | |
5515 | } | |
6b0655a2 | 5516 | |
718e3744 | 5517 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 5518 | static int |
fd79ac91 | 5519 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5520 | safi_t safi, const char *name_str) | |
718e3744 | 5521 | { |
5522 | int ret; | |
5523 | struct peer *peer; | |
5524 | ||
5525 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5526 | if (! peer) | |
5527 | return CMD_WARNING; | |
5528 | ||
5529 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
5530 | ||
5531 | return bgp_vty_return (vty, ret); | |
5532 | } | |
5533 | ||
5534 | /* Unset route-map from the peer. */ | |
94f2b392 | 5535 | static int |
fd79ac91 | 5536 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5537 | safi_t safi) |
5538 | { | |
5539 | int ret; | |
5540 | struct peer *peer; | |
5541 | ||
5542 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5543 | if (! peer) | |
5544 | return CMD_WARNING; | |
5545 | ||
5546 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
5547 | ||
5548 | return bgp_vty_return (vty, ret); | |
5549 | } | |
5550 | ||
5551 | DEFUN (neighbor_unsuppress_map, | |
5552 | neighbor_unsuppress_map_cmd, | |
5553 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5554 | NEIGHBOR_STR | |
5555 | NEIGHBOR_ADDR_STR2 | |
5556 | "Route-map to selectively unsuppress suppressed routes\n" | |
5557 | "Name of route map\n") | |
5558 | { | |
5559 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5560 | bgp_node_safi (vty), argv[1]); | |
5561 | } | |
5562 | ||
5563 | DEFUN (no_neighbor_unsuppress_map, | |
5564 | no_neighbor_unsuppress_map_cmd, | |
5565 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5566 | NO_STR | |
5567 | NEIGHBOR_STR | |
5568 | NEIGHBOR_ADDR_STR2 | |
5569 | "Route-map to selectively unsuppress suppressed routes\n" | |
5570 | "Name of route map\n") | |
5571 | { | |
5572 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5573 | bgp_node_safi (vty)); | |
5574 | } | |
6b0655a2 | 5575 | |
94f2b392 | 5576 | static int |
fd79ac91 | 5577 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5578 | safi_t safi, const char *num_str, | |
0a486e5f | 5579 | const char *threshold_str, int warning, |
5580 | const char *restart_str) | |
718e3744 | 5581 | { |
5582 | int ret; | |
5583 | struct peer *peer; | |
5584 | u_int32_t max; | |
e0701b79 | 5585 | u_char threshold; |
0a486e5f | 5586 | u_int16_t restart; |
718e3744 | 5587 | |
5588 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5589 | if (! peer) | |
5590 | return CMD_WARNING; | |
5591 | ||
e6ec1c36 | 5592 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 5593 | if (threshold_str) |
5594 | threshold = atoi (threshold_str); | |
5595 | else | |
5596 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 5597 | |
0a486e5f | 5598 | if (restart_str) |
5599 | restart = atoi (restart_str); | |
5600 | else | |
5601 | restart = 0; | |
5602 | ||
5603 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 5604 | |
5605 | return bgp_vty_return (vty, ret); | |
5606 | } | |
5607 | ||
94f2b392 | 5608 | static int |
fd79ac91 | 5609 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5610 | safi_t safi) |
5611 | { | |
5612 | int ret; | |
5613 | struct peer *peer; | |
5614 | ||
5615 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5616 | if (! peer) | |
5617 | return CMD_WARNING; | |
5618 | ||
5619 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
5620 | ||
5621 | return bgp_vty_return (vty, ret); | |
5622 | } | |
5623 | ||
5624 | /* Maximum number of prefix configuration. prefix count is different | |
5625 | for each peer configuration. So this configuration can be set for | |
5626 | each peer configuration. */ | |
5627 | DEFUN (neighbor_maximum_prefix, | |
5628 | neighbor_maximum_prefix_cmd, | |
5629 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5630 | NEIGHBOR_STR | |
5631 | NEIGHBOR_ADDR_STR2 | |
5632 | "Maximum number of prefix accept from this peer\n" | |
5633 | "maximum no. of prefix limit\n") | |
5634 | { | |
5635 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5636 | bgp_node_safi (vty), argv[1], NULL, 0, |
5637 | NULL); | |
718e3744 | 5638 | } |
5639 | ||
e0701b79 | 5640 | DEFUN (neighbor_maximum_prefix_threshold, |
5641 | neighbor_maximum_prefix_threshold_cmd, | |
5642 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
5643 | NEIGHBOR_STR | |
5644 | NEIGHBOR_ADDR_STR2 | |
5645 | "Maximum number of prefix accept from this peer\n" | |
5646 | "maximum no. of prefix limit\n" | |
5647 | "Threshold value (%) at which to generate a warning msg\n") | |
5648 | { | |
5649 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5650 | bgp_node_safi (vty), argv[1], argv[2], 0, |
5651 | NULL); | |
5652 | } | |
e0701b79 | 5653 | |
718e3744 | 5654 | DEFUN (neighbor_maximum_prefix_warning, |
5655 | neighbor_maximum_prefix_warning_cmd, | |
5656 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5657 | NEIGHBOR_STR | |
5658 | NEIGHBOR_ADDR_STR2 | |
5659 | "Maximum number of prefix accept from this peer\n" | |
5660 | "maximum no. of prefix limit\n" | |
5661 | "Only give warning message when limit is exceeded\n") | |
5662 | { | |
5663 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5664 | bgp_node_safi (vty), argv[1], NULL, 1, |
5665 | NULL); | |
718e3744 | 5666 | } |
5667 | ||
e0701b79 | 5668 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
5669 | neighbor_maximum_prefix_threshold_warning_cmd, | |
5670 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
5671 | NEIGHBOR_STR | |
5672 | NEIGHBOR_ADDR_STR2 | |
5673 | "Maximum number of prefix accept from this peer\n" | |
5674 | "maximum no. of prefix limit\n" | |
5675 | "Threshold value (%) at which to generate a warning msg\n" | |
5676 | "Only give warning message when limit is exceeded\n") | |
5677 | { | |
5678 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5679 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
5680 | } | |
5681 | ||
5682 | DEFUN (neighbor_maximum_prefix_restart, | |
5683 | neighbor_maximum_prefix_restart_cmd, | |
5684 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
5685 | NEIGHBOR_STR | |
5686 | NEIGHBOR_ADDR_STR2 | |
5687 | "Maximum number of prefix accept from this peer\n" | |
5688 | "maximum no. of prefix limit\n" | |
5689 | "Restart bgp connection after limit is exceeded\n" | |
5690 | "Restart interval in minutes") | |
5691 | { | |
5692 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5693 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
5694 | } | |
5695 | ||
5696 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
5697 | neighbor_maximum_prefix_threshold_restart_cmd, | |
5698 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5699 | NEIGHBOR_STR | |
5700 | NEIGHBOR_ADDR_STR2 | |
5701 | "Maximum number of prefix accept from this peer\n" | |
5702 | "maximum no. of prefix limit\n" | |
5703 | "Threshold value (%) at which to generate a warning msg\n" | |
5704 | "Restart bgp connection after limit is exceeded\n" | |
5705 | "Restart interval in minutes") | |
5706 | { | |
5707 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5708 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
5709 | } | |
e0701b79 | 5710 | |
718e3744 | 5711 | DEFUN (no_neighbor_maximum_prefix, |
5712 | no_neighbor_maximum_prefix_cmd, | |
5713 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
5714 | NO_STR | |
5715 | NEIGHBOR_STR | |
5716 | NEIGHBOR_ADDR_STR2 | |
5717 | "Maximum number of prefix accept from this peer\n") | |
5718 | { | |
5719 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5720 | bgp_node_safi (vty)); | |
5721 | } | |
5722 | ||
5723 | ALIAS (no_neighbor_maximum_prefix, | |
5724 | no_neighbor_maximum_prefix_val_cmd, | |
5725 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5726 | NO_STR | |
5727 | NEIGHBOR_STR | |
5728 | NEIGHBOR_ADDR_STR2 | |
5729 | "Maximum number of prefix accept from this peer\n" | |
5730 | "maximum no. of prefix limit\n") | |
5731 | ||
5732 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5733 | no_neighbor_maximum_prefix_threshold_cmd, |
813d4307 | 5734 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
0a486e5f | 5735 | NO_STR |
5736 | NEIGHBOR_STR | |
5737 | NEIGHBOR_ADDR_STR2 | |
5738 | "Maximum number of prefix accept from this peer\n" | |
5739 | "maximum no. of prefix limit\n" | |
5740 | "Threshold value (%) at which to generate a warning msg\n") | |
5741 | ||
5742 | ALIAS (no_neighbor_maximum_prefix, | |
5743 | no_neighbor_maximum_prefix_warning_cmd, | |
5744 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5745 | NO_STR | |
5746 | NEIGHBOR_STR | |
5747 | NEIGHBOR_ADDR_STR2 | |
5748 | "Maximum number of prefix accept from this peer\n" | |
5749 | "maximum no. of prefix limit\n" | |
e8e1946e | 5750 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 5751 | |
5752 | ALIAS (no_neighbor_maximum_prefix, | |
5753 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 5754 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
5755 | NO_STR | |
5756 | NEIGHBOR_STR | |
5757 | NEIGHBOR_ADDR_STR2 | |
5758 | "Maximum number of prefix accept from this peer\n" | |
5759 | "maximum no. of prefix limit\n" | |
5760 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 5761 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 5762 | |
5763 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5764 | no_neighbor_maximum_prefix_restart_cmd, |
5765 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 5766 | NO_STR |
5767 | NEIGHBOR_STR | |
5768 | NEIGHBOR_ADDR_STR2 | |
5769 | "Maximum number of prefix accept from this peer\n" | |
5770 | "maximum no. of prefix limit\n" | |
0a486e5f | 5771 | "Restart bgp connection after limit is exceeded\n" |
5772 | "Restart interval in minutes") | |
5773 | ||
5774 | ALIAS (no_neighbor_maximum_prefix, | |
5775 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
5776 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5777 | NO_STR | |
5778 | NEIGHBOR_STR | |
5779 | NEIGHBOR_ADDR_STR2 | |
5780 | "Maximum number of prefix accept from this peer\n" | |
5781 | "maximum no. of prefix limit\n" | |
5782 | "Threshold value (%) at which to generate a warning msg\n" | |
5783 | "Restart bgp connection after limit is exceeded\n" | |
5784 | "Restart interval in minutes") | |
6b0655a2 | 5785 | |
718e3744 | 5786 | /* "neighbor allowas-in" */ |
5787 | DEFUN (neighbor_allowas_in, | |
5788 | neighbor_allowas_in_cmd, | |
5789 | NEIGHBOR_CMD2 "allowas-in", | |
5790 | NEIGHBOR_STR | |
5791 | NEIGHBOR_ADDR_STR2 | |
5792 | "Accept as-path with my AS present in it\n") | |
5793 | { | |
5794 | int ret; | |
5795 | struct peer *peer; | |
fd79ac91 | 5796 | unsigned int allow_num; |
718e3744 | 5797 | |
5798 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5799 | if (! peer) | |
5800 | return CMD_WARNING; | |
5801 | ||
5802 | if (argc == 1) | |
5803 | allow_num = 3; | |
5804 | else | |
5805 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
5806 | ||
5807 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
5808 | allow_num); | |
5809 | ||
5810 | return bgp_vty_return (vty, ret); | |
5811 | } | |
5812 | ||
5813 | ALIAS (neighbor_allowas_in, | |
5814 | neighbor_allowas_in_arg_cmd, | |
5815 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5816 | NEIGHBOR_STR | |
5817 | NEIGHBOR_ADDR_STR2 | |
5818 | "Accept as-path with my AS present in it\n" | |
5819 | "Number of occurances of AS number\n") | |
5820 | ||
5821 | DEFUN (no_neighbor_allowas_in, | |
5822 | no_neighbor_allowas_in_cmd, | |
5823 | NO_NEIGHBOR_CMD2 "allowas-in", | |
5824 | NO_STR | |
5825 | NEIGHBOR_STR | |
5826 | NEIGHBOR_ADDR_STR2 | |
5827 | "allow local ASN appears in aspath attribute\n") | |
5828 | { | |
5829 | int ret; | |
5830 | struct peer *peer; | |
5831 | ||
5832 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5833 | if (! peer) | |
5834 | return CMD_WARNING; | |
5835 | ||
5836 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
5837 | ||
5838 | return bgp_vty_return (vty, ret); | |
5839 | } | |
6b0655a2 | 5840 | |
813d4307 DW |
5841 | ALIAS (no_neighbor_allowas_in, |
5842 | no_neighbor_allowas_in_val_cmd, | |
5843 | NO_NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5844 | NO_STR | |
5845 | NEIGHBOR_STR | |
5846 | NEIGHBOR_ADDR_STR2 | |
5847 | "allow local ASN appears in aspath attribute\n" | |
5848 | "Number of occurances of AS number\n") | |
5849 | ||
fa411a21 NH |
5850 | DEFUN (neighbor_ttl_security, |
5851 | neighbor_ttl_security_cmd, | |
5852 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5853 | NEIGHBOR_STR | |
5854 | NEIGHBOR_ADDR_STR2 | |
5855 | "Specify the maximum number of hops to the BGP peer\n") | |
5856 | { | |
5857 | struct peer *peer; | |
89b6d1f8 | 5858 | int gtsm_hops; |
fa411a21 NH |
5859 | |
5860 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5861 | if (! peer) | |
5862 | return CMD_WARNING; | |
5863 | ||
5864 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); | |
5865 | ||
8cdabf90 SK |
5866 | /* |
5867 | * If 'neighbor swpX', then this is for directly connected peers, | |
5868 | * we should not accept a ttl-security hops value greater than 1. | |
5869 | */ | |
5870 | if (peer->conf_if && (gtsm_hops > 1)) { | |
5871 | vty_out (vty, "%s is directly connected peer, hops cannot exceed 1%s", | |
5872 | argv[0], VTY_NEWLINE); | |
5873 | return CMD_WARNING; | |
5874 | } | |
5875 | ||
89b6d1f8 | 5876 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
5877 | } |
5878 | ||
5879 | DEFUN (no_neighbor_ttl_security, | |
5880 | no_neighbor_ttl_security_cmd, | |
5881 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5882 | NO_STR | |
5883 | NEIGHBOR_STR | |
5884 | NEIGHBOR_ADDR_STR2 | |
5885 | "Specify the maximum number of hops to the BGP peer\n") | |
5886 | { | |
5887 | struct peer *peer; | |
fa411a21 NH |
5888 | |
5889 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5890 | if (! peer) | |
5891 | return CMD_WARNING; | |
5892 | ||
89b6d1f8 | 5893 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 5894 | } |
6b0655a2 | 5895 | |
adbac85e DW |
5896 | DEFUN (neighbor_addpath_tx_all_paths, |
5897 | neighbor_addpath_tx_all_paths_cmd, | |
5898 | NEIGHBOR_CMD2 "addpath-tx-all-paths", | |
5899 | NEIGHBOR_STR | |
5900 | NEIGHBOR_ADDR_STR2 | |
5901 | "Use addpath to advertise all paths to a neighbor\n") | |
5902 | { | |
5903 | struct peer *peer; | |
5904 | ||
adbac85e DW |
5905 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
5906 | if (! peer) | |
5907 | return CMD_WARNING; | |
5908 | ||
5909 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5910 | bgp_node_safi (vty), | |
5911 | PEER_FLAG_ADDPATH_TX_ALL_PATHS); | |
5912 | } | |
5913 | ||
5914 | DEFUN (no_neighbor_addpath_tx_all_paths, | |
5915 | no_neighbor_addpath_tx_all_paths_cmd, | |
5916 | NO_NEIGHBOR_CMD2 "addpath-tx-all-paths", | |
5917 | NO_STR | |
5918 | NEIGHBOR_STR | |
5919 | NEIGHBOR_ADDR_STR2 | |
5920 | "Use addpath to advertise all paths to a neighbor\n") | |
5921 | { | |
5922 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5923 | bgp_node_safi (vty), | |
5924 | PEER_FLAG_ADDPATH_TX_ALL_PATHS); | |
5925 | } | |
5926 | ||
06370dac DW |
5927 | DEFUN (neighbor_addpath_tx_bestpath_per_as, |
5928 | neighbor_addpath_tx_bestpath_per_as_cmd, | |
5929 | NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", | |
5930 | NEIGHBOR_STR | |
5931 | NEIGHBOR_ADDR_STR2 | |
5932 | "Use addpath to advertise the bestpath per each neighboring AS\n") | |
5933 | { | |
5934 | struct peer *peer; | |
5935 | ||
5936 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5937 | if (! peer) | |
5938 | return CMD_WARNING; | |
5939 | ||
5940 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5941 | bgp_node_safi (vty), | |
5942 | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); | |
5943 | } | |
5944 | ||
5945 | DEFUN (no_neighbor_addpath_tx_bestpath_per_as, | |
5946 | no_neighbor_addpath_tx_bestpath_per_as_cmd, | |
5947 | NO_NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", | |
5948 | NO_STR | |
5949 | NEIGHBOR_STR | |
5950 | NEIGHBOR_ADDR_STR2 | |
5951 | "Use addpath to advertise the bestpath per each neighboring AS\n") | |
5952 | { | |
5953 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5954 | bgp_node_safi (vty), | |
5955 | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); | |
5956 | } | |
5957 | ||
5958 | ||
718e3744 | 5959 | /* Address family configuration. */ |
5960 | DEFUN (address_family_ipv4, | |
5961 | address_family_ipv4_cmd, | |
5962 | "address-family ipv4", | |
5963 | "Enter Address Family command mode\n" | |
5964 | "Address family\n") | |
5965 | { | |
5966 | vty->node = BGP_IPV4_NODE; | |
5967 | return CMD_SUCCESS; | |
5968 | } | |
5969 | ||
5970 | DEFUN (address_family_ipv4_safi, | |
5971 | address_family_ipv4_safi_cmd, | |
5972 | "address-family ipv4 (unicast|multicast)", | |
5973 | "Enter Address Family command mode\n" | |
5974 | "Address family\n" | |
5975 | "Address Family modifier\n" | |
5976 | "Address Family modifier\n") | |
5977 | { | |
5978 | if (strncmp (argv[0], "m", 1) == 0) | |
5979 | vty->node = BGP_IPV4M_NODE; | |
5980 | else | |
5981 | vty->node = BGP_IPV4_NODE; | |
5982 | ||
5983 | return CMD_SUCCESS; | |
5984 | } | |
5985 | ||
25ffbdc1 | 5986 | DEFUN (address_family_ipv6, |
5987 | address_family_ipv6_cmd, | |
5988 | "address-family ipv6", | |
718e3744 | 5989 | "Enter Address Family command mode\n" |
25ffbdc1 | 5990 | "Address family\n") |
718e3744 | 5991 | { |
5992 | vty->node = BGP_IPV6_NODE; | |
5993 | return CMD_SUCCESS; | |
5994 | } | |
5995 | ||
25ffbdc1 | 5996 | DEFUN (address_family_ipv6_safi, |
5997 | address_family_ipv6_safi_cmd, | |
5998 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 5999 | "Enter Address Family command mode\n" |
25ffbdc1 | 6000 | "Address family\n" |
6001 | "Address Family modifier\n" | |
6002 | "Address Family modifier\n") | |
6003 | { | |
6004 | if (strncmp (argv[0], "m", 1) == 0) | |
6005 | vty->node = BGP_IPV6M_NODE; | |
6006 | else | |
6007 | vty->node = BGP_IPV6_NODE; | |
6008 | ||
6009 | return CMD_SUCCESS; | |
6010 | } | |
718e3744 | 6011 | |
6012 | DEFUN (address_family_vpnv4, | |
6013 | address_family_vpnv4_cmd, | |
6014 | "address-family vpnv4", | |
6015 | "Enter Address Family command mode\n" | |
6016 | "Address family\n") | |
6017 | { | |
6018 | vty->node = BGP_VPNV4_NODE; | |
6019 | return CMD_SUCCESS; | |
6020 | } | |
6021 | ||
6022 | ALIAS (address_family_vpnv4, | |
6023 | address_family_vpnv4_unicast_cmd, | |
6024 | "address-family vpnv4 unicast", | |
6025 | "Enter Address Family command mode\n" | |
6026 | "Address family\n" | |
6027 | "Address Family Modifier\n") | |
6028 | ||
8ecd3266 | 6029 | DEFUN (address_family_vpnv6, |
6030 | address_family_vpnv6_cmd, | |
6031 | "address-family vpnv6", | |
6032 | "Enter Address Family command mode\n" | |
6033 | "Address family\n") | |
6034 | { | |
6035 | vty->node = BGP_VPNV6_NODE; | |
6036 | return CMD_SUCCESS; | |
6037 | } | |
6038 | ||
6039 | ALIAS (address_family_vpnv6, | |
6040 | address_family_vpnv6_unicast_cmd, | |
6041 | "address-family vpnv6 unicast", | |
6042 | "Enter Address Family command mode\n" | |
6043 | "Address family\n" | |
6044 | "Address Family Modifier\n") | |
6045 | ||
8b1fb8be LB |
6046 | DEFUN (address_family_encap, |
6047 | address_family_encap_cmd, | |
6048 | "address-family encap", | |
6049 | "Enter Address Family command mode\n" | |
6050 | "Address family\n") | |
6051 | { | |
6052 | vty->node = BGP_ENCAP_NODE; | |
6053 | return CMD_SUCCESS; | |
6054 | } | |
6055 | ||
6056 | ALIAS (address_family_encap, | |
6057 | address_family_encapv4_cmd, | |
6058 | "address-family encapv4", | |
6059 | "Enter Address Family command mode\n" | |
6060 | "Address family\n") | |
6061 | ||
6062 | DEFUN (address_family_encapv6, | |
6063 | address_family_encapv6_cmd, | |
6064 | "address-family encapv6", | |
6065 | "Enter Address Family command mode\n" | |
6066 | "Address family\n") | |
6067 | { | |
6068 | vty->node = BGP_ENCAPV6_NODE; | |
6069 | return CMD_SUCCESS; | |
6070 | } | |
6071 | ||
718e3744 | 6072 | DEFUN (exit_address_family, |
6073 | exit_address_family_cmd, | |
6074 | "exit-address-family", | |
6075 | "Exit from Address Family configuration mode\n") | |
6076 | { | |
a8a80d53 | 6077 | if (vty->node == BGP_IPV4_NODE |
6078 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 6079 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 6080 | || vty->node == BGP_IPV6_NODE |
8ecd3266 | 6081 | || vty->node == BGP_IPV6M_NODE |
8b1fb8be LB |
6082 | || vty->node == BGP_VPNV6_NODE |
6083 | || vty->node == BGP_ENCAP_NODE | |
6084 | || vty->node == BGP_ENCAPV6_NODE) | |
718e3744 | 6085 | vty->node = BGP_NODE; |
6086 | return CMD_SUCCESS; | |
6087 | } | |
6b0655a2 | 6088 | |
8ad7271d DS |
6089 | /* Recalculate bestpath and re-advertise a prefix */ |
6090 | static int | |
01080f7c | 6091 | bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, |
8ad7271d DS |
6092 | afi_t afi, safi_t safi, struct prefix_rd *prd) |
6093 | { | |
6094 | int ret; | |
6095 | struct prefix match; | |
6096 | struct bgp_node *rn; | |
6097 | struct bgp_node *rm; | |
8ad7271d DS |
6098 | struct bgp *bgp; |
6099 | struct bgp_table *table; | |
6100 | struct bgp_table *rib; | |
6101 | ||
6102 | /* BGP structure lookup. */ | |
6103 | if (view_name) | |
6104 | { | |
6105 | bgp = bgp_lookup_by_name (view_name); | |
6106 | if (bgp == NULL) | |
6107 | { | |
6aeb9e78 | 6108 | vty_out (vty, "%% Can't find BGP instance %s%s", view_name, VTY_NEWLINE); |
8ad7271d DS |
6109 | return CMD_WARNING; |
6110 | } | |
6111 | } | |
6112 | else | |
6113 | { | |
6114 | bgp = bgp_get_default (); | |
6115 | if (bgp == NULL) | |
6116 | { | |
6117 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
6118 | return CMD_WARNING; | |
6119 | } | |
6120 | } | |
6121 | ||
6122 | /* Check IP address argument. */ | |
6123 | ret = str2prefix (ip_str, &match); | |
6124 | if (! ret) | |
6125 | { | |
6126 | vty_out (vty, "%% address is malformed%s", VTY_NEWLINE); | |
6127 | return CMD_WARNING; | |
6128 | } | |
6129 | ||
6130 | match.family = afi2family (afi); | |
6131 | rib = bgp->rib[afi][safi]; | |
6132 | ||
6133 | if (safi == SAFI_MPLS_VPN) | |
6134 | { | |
6135 | for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn)) | |
6136 | { | |
6137 | if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) | |
6138 | continue; | |
6139 | ||
6140 | if ((table = rn->info) != NULL) | |
6141 | { | |
6142 | if ((rm = bgp_node_match (table, &match)) != NULL) | |
6143 | { | |
6144 | if (rm->p.prefixlen == match.prefixlen) | |
6145 | { | |
6146 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
6147 | bgp_process (bgp, rm, afi, safi); | |
6148 | } | |
6149 | bgp_unlock_node (rm); | |
6150 | } | |
6151 | } | |
6152 | } | |
6153 | } | |
6154 | else | |
6155 | { | |
6156 | if ((rn = bgp_node_match (rib, &match)) != NULL) | |
6157 | { | |
6158 | if (rn->p.prefixlen == match.prefixlen) | |
6159 | { | |
6160 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
6161 | bgp_process (bgp, rn, afi, safi); | |
6162 | } | |
6163 | bgp_unlock_node (rn); | |
6164 | } | |
6165 | } | |
6166 | ||
6167 | return CMD_SUCCESS; | |
6168 | } | |
6169 | ||
718e3744 | 6170 | DEFUN (clear_ip_bgp_all, |
6171 | clear_ip_bgp_all_cmd, | |
6172 | "clear ip bgp *", | |
6173 | CLEAR_STR | |
6174 | IP_STR | |
6175 | BGP_STR | |
6176 | "Clear all peers\n") | |
6177 | { | |
6aeb9e78 DS |
6178 | if (argc == 2) |
6179 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
718e3744 | 6180 | |
6181 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
6182 | } | |
6183 | ||
01080f7c | 6184 | ALIAS (clear_ip_bgp_all, |
6185 | clear_ip_bgp_instance_all_cmd, | |
6186 | "clear ip bgp " BGP_INSTANCE_CMD " *", | |
6187 | CLEAR_STR | |
6188 | IP_STR | |
6189 | BGP_STR | |
6190 | BGP_INSTANCE_HELP_STR | |
6191 | "Clear all peers\n") | |
6192 | ||
718e3744 | 6193 | ALIAS (clear_ip_bgp_all, |
6194 | clear_bgp_all_cmd, | |
6195 | "clear bgp *", | |
6196 | CLEAR_STR | |
6197 | BGP_STR | |
6198 | "Clear all peers\n") | |
6199 | ||
6200 | ALIAS (clear_ip_bgp_all, | |
01080f7c | 6201 | clear_bgp_instance_all_cmd, |
6202 | "clear bgp " BGP_INSTANCE_CMD " *", | |
718e3744 | 6203 | CLEAR_STR |
6204 | BGP_STR | |
01080f7c | 6205 | BGP_INSTANCE_HELP_STR |
718e3744 | 6206 | "Clear all peers\n") |
6207 | ||
6208 | ALIAS (clear_ip_bgp_all, | |
01080f7c | 6209 | clear_bgp_ipv6_all_cmd, |
6210 | "clear bgp ipv6 *", | |
718e3744 | 6211 | CLEAR_STR |
718e3744 | 6212 | BGP_STR |
01080f7c | 6213 | "Address family\n" |
718e3744 | 6214 | "Clear all peers\n") |
6215 | ||
6216 | ALIAS (clear_ip_bgp_all, | |
01080f7c | 6217 | clear_bgp_instance_ipv6_all_cmd, |
6218 | "clear bgp " BGP_INSTANCE_CMD " ipv6 *", | |
718e3744 | 6219 | CLEAR_STR |
6220 | BGP_STR | |
8386ac43 | 6221 | BGP_INSTANCE_HELP_STR |
01080f7c | 6222 | "Address family\n" |
718e3744 | 6223 | "Clear all peers\n") |
6224 | ||
6225 | DEFUN (clear_ip_bgp_peer, | |
6226 | clear_ip_bgp_peer_cmd, | |
a80beece | 6227 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6228 | CLEAR_STR |
6229 | IP_STR | |
6230 | BGP_STR | |
6231 | "BGP neighbor IP address to clear\n" | |
a80beece DS |
6232 | "BGP IPv6 neighbor to clear\n" |
6233 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6234 | { |
01080f7c | 6235 | if (argc == 3) |
6236 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6237 | ||
718e3744 | 6238 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
6239 | } | |
6240 | ||
01080f7c | 6241 | ALIAS (clear_ip_bgp_peer, |
6242 | clear_ip_bgp_instance_peer_cmd, | |
6243 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", | |
6244 | CLEAR_STR | |
6245 | IP_STR | |
6246 | BGP_STR | |
6247 | BGP_INSTANCE_HELP_STR | |
6248 | "BGP neighbor IP address to clear\n" | |
6249 | "BGP IPv6 neighbor to clear\n" | |
6250 | "BGP neighbor on interface to clear\n") | |
6251 | ||
718e3744 | 6252 | ALIAS (clear_ip_bgp_peer, |
6253 | clear_bgp_peer_cmd, | |
a80beece | 6254 | "clear bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6255 | CLEAR_STR |
6256 | BGP_STR | |
6257 | "BGP neighbor address to clear\n" | |
a80beece DS |
6258 | "BGP IPv6 neighbor to clear\n" |
6259 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6260 | |
01080f7c | 6261 | ALIAS (clear_ip_bgp_peer, |
6262 | clear_bgp_instance_peer_cmd, | |
6263 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", | |
6264 | CLEAR_STR | |
6265 | BGP_STR | |
6266 | BGP_INSTANCE_HELP_STR | |
6267 | "BGP neighbor IP address to clear\n" | |
6268 | "BGP IPv6 neighbor to clear\n" | |
6269 | "BGP neighbor on interface to clear\n") | |
6270 | ||
718e3744 | 6271 | ALIAS (clear_ip_bgp_peer, |
6272 | clear_bgp_ipv6_peer_cmd, | |
a80beece | 6273 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6274 | CLEAR_STR |
6275 | BGP_STR | |
6276 | "Address family\n" | |
6277 | "BGP neighbor address to clear\n" | |
a80beece DS |
6278 | "BGP IPv6 neighbor to clear\n" |
6279 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6280 | |
01080f7c | 6281 | ALIAS (clear_ip_bgp_peer, |
6282 | clear_bgp_instance_ipv6_peer_cmd, | |
6283 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD)", | |
6284 | CLEAR_STR | |
6285 | BGP_STR | |
6286 | BGP_INSTANCE_HELP_STR | |
6287 | "Address family\n" | |
6288 | "BGP neighbor IP address to clear\n" | |
6289 | "BGP IPv6 neighbor to clear\n" | |
6290 | "BGP neighbor on interface to clear\n") | |
6291 | ||
718e3744 | 6292 | DEFUN (clear_ip_bgp_peer_group, |
6293 | clear_ip_bgp_peer_group_cmd, | |
6294 | "clear ip bgp peer-group WORD", | |
6295 | CLEAR_STR | |
6296 | IP_STR | |
6297 | BGP_STR | |
6298 | "Clear all members of peer-group\n" | |
6299 | "BGP peer-group name\n") | |
6300 | { | |
01080f7c | 6301 | if (argc == 3) |
6302 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6303 | ||
718e3744 | 6304 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
6305 | } | |
6306 | ||
01080f7c | 6307 | ALIAS (clear_ip_bgp_peer_group, |
6308 | clear_ip_bgp_instance_peer_group_cmd, | |
6309 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD", | |
6310 | CLEAR_STR | |
6311 | IP_STR | |
6312 | BGP_STR | |
6313 | BGP_INSTANCE_HELP_STR | |
6314 | "Clear all members of peer-group\n" | |
6315 | "BGP peer-group name\n") | |
6316 | ||
718e3744 | 6317 | ALIAS (clear_ip_bgp_peer_group, |
6318 | clear_bgp_peer_group_cmd, | |
6319 | "clear bgp peer-group WORD", | |
6320 | CLEAR_STR | |
6321 | BGP_STR | |
6322 | "Clear all members of peer-group\n" | |
6323 | "BGP peer-group name\n") | |
6324 | ||
01080f7c | 6325 | ALIAS (clear_ip_bgp_peer_group, |
6326 | clear_bgp_instance_peer_group_cmd, | |
6327 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD", | |
6328 | CLEAR_STR | |
6329 | BGP_STR | |
6330 | BGP_INSTANCE_HELP_STR | |
6331 | "Clear all members of peer-group\n" | |
6332 | "BGP peer-group name\n") | |
6333 | ||
718e3744 | 6334 | ALIAS (clear_ip_bgp_peer_group, |
6335 | clear_bgp_ipv6_peer_group_cmd, | |
6336 | "clear bgp ipv6 peer-group WORD", | |
6337 | CLEAR_STR | |
6338 | BGP_STR | |
6339 | "Address family\n" | |
6340 | "Clear all members of peer-group\n" | |
6341 | "BGP peer-group name\n") | |
6342 | ||
01080f7c | 6343 | ALIAS (clear_ip_bgp_peer_group, |
6344 | clear_bgp_instance_ipv6_peer_group_cmd, | |
6345 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD", | |
6346 | CLEAR_STR | |
6347 | BGP_STR | |
6348 | BGP_INSTANCE_HELP_STR | |
6349 | "Address family\n" | |
6350 | "Clear all members of peer-group\n" | |
6351 | "BGP peer-group name\n") | |
6352 | ||
718e3744 | 6353 | DEFUN (clear_ip_bgp_external, |
6354 | clear_ip_bgp_external_cmd, | |
6355 | "clear ip bgp external", | |
6356 | CLEAR_STR | |
6357 | IP_STR | |
6358 | BGP_STR | |
6359 | "Clear all external peers\n") | |
6360 | { | |
01080f7c | 6361 | if (argc == 2) |
6362 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
6363 | ||
718e3744 | 6364 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
6365 | } | |
6366 | ||
01080f7c | 6367 | ALIAS (clear_ip_bgp_external, |
6368 | clear_ip_bgp_instance_external_cmd, | |
6369 | "clear ip bgp " BGP_INSTANCE_CMD " external", | |
6370 | CLEAR_STR | |
6371 | IP_STR | |
6372 | BGP_STR | |
6373 | BGP_INSTANCE_HELP_STR | |
6374 | "Clear all external peers\n") | |
6375 | ||
718e3744 | 6376 | ALIAS (clear_ip_bgp_external, |
6377 | clear_bgp_external_cmd, | |
6378 | "clear bgp external", | |
6379 | CLEAR_STR | |
6380 | BGP_STR | |
6381 | "Clear all external peers\n") | |
6382 | ||
01080f7c | 6383 | ALIAS (clear_ip_bgp_external, |
6384 | clear_bgp_instance_external_cmd, | |
6385 | "clear bgp " BGP_INSTANCE_CMD " external", | |
6386 | CLEAR_STR | |
6387 | BGP_STR | |
6388 | BGP_INSTANCE_HELP_STR | |
6389 | "Clear all external peers\n") | |
6390 | ||
718e3744 | 6391 | ALIAS (clear_ip_bgp_external, |
6392 | clear_bgp_ipv6_external_cmd, | |
6393 | "clear bgp ipv6 external", | |
6394 | CLEAR_STR | |
6395 | BGP_STR | |
6396 | "Address family\n" | |
6397 | "Clear all external peers\n") | |
6398 | ||
01080f7c | 6399 | ALIAS (clear_ip_bgp_external, |
6400 | clear_bgp_instance_ipv6_external_cmd, | |
6401 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external", | |
6402 | CLEAR_STR | |
6403 | BGP_STR | |
6404 | BGP_INSTANCE_HELP_STR | |
6405 | "Address family\n" | |
6406 | "Clear all external peers\n") | |
6407 | ||
8ad7271d DS |
6408 | DEFUN (clear_ip_bgp_prefix, |
6409 | clear_ip_bgp_prefix_cmd, | |
6410 | "clear ip bgp prefix A.B.C.D/M", | |
6411 | CLEAR_STR | |
6412 | IP_STR | |
6413 | BGP_STR | |
6414 | "Clear bestpath and re-advertise\n" | |
6415 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6416 | { | |
01080f7c | 6417 | if (argc == 3) |
6418 | return bgp_clear_prefix (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL); | |
6419 | ||
8ad7271d DS |
6420 | return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL); |
6421 | } | |
6422 | ||
01080f7c | 6423 | ALIAS (clear_ip_bgp_prefix, |
6424 | clear_ip_bgp_instance_prefix_cmd, | |
6425 | "clear ip bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", | |
6426 | CLEAR_STR | |
6427 | IP_STR | |
6428 | BGP_STR | |
6429 | BGP_INSTANCE_HELP_STR | |
6430 | "Clear bestpath and re-advertise\n" | |
6431 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6432 | ||
8ad7271d DS |
6433 | ALIAS (clear_ip_bgp_prefix, |
6434 | clear_bgp_prefix_cmd, | |
6435 | "clear bgp prefix A.B.C.D/M", | |
6436 | CLEAR_STR | |
6437 | BGP_STR | |
6438 | "Clear bestpath and re-advertise\n" | |
6439 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6440 | ||
01080f7c | 6441 | ALIAS (clear_ip_bgp_prefix, |
6442 | clear_bgp_instance_prefix_cmd, | |
6443 | "clear bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", | |
6444 | CLEAR_STR | |
6445 | BGP_STR | |
6446 | BGP_INSTANCE_HELP_STR | |
6447 | "Clear bestpath and re-advertise\n" | |
6448 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
8ad7271d | 6449 | |
718e3744 | 6450 | DEFUN (clear_ip_bgp_as, |
6451 | clear_ip_bgp_as_cmd, | |
320da874 | 6452 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 6453 | CLEAR_STR |
6454 | IP_STR | |
6455 | BGP_STR | |
6456 | "Clear peers with the AS number\n") | |
6457 | { | |
01080f7c | 6458 | if (argc == 3) |
6459 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6460 | ||
718e3744 | 6461 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
6462 | } | |
6463 | ||
01080f7c | 6464 | ALIAS (clear_ip_bgp_as, |
6465 | clear_ip_bgp_instance_as_cmd, | |
6466 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, | |
6467 | CLEAR_STR | |
6468 | IP_STR | |
6469 | BGP_STR | |
6470 | BGP_INSTANCE_HELP_STR | |
6471 | "Clear peers with the AS number\n") | |
6472 | ||
718e3744 | 6473 | ALIAS (clear_ip_bgp_as, |
6474 | clear_bgp_as_cmd, | |
320da874 | 6475 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 6476 | CLEAR_STR |
6477 | BGP_STR | |
6478 | "Clear peers with the AS number\n") | |
6479 | ||
01080f7c | 6480 | ALIAS (clear_ip_bgp_as, |
6481 | clear_bgp_instance_as_cmd, | |
6482 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, | |
6483 | CLEAR_STR | |
6484 | BGP_STR | |
6485 | BGP_INSTANCE_HELP_STR | |
6486 | "Clear peers with the AS number\n") | |
6487 | ||
718e3744 | 6488 | ALIAS (clear_ip_bgp_as, |
6489 | clear_bgp_ipv6_as_cmd, | |
320da874 | 6490 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 6491 | CLEAR_STR |
6492 | BGP_STR | |
6493 | "Address family\n" | |
6494 | "Clear peers with the AS number\n") | |
6b0655a2 | 6495 | |
01080f7c | 6496 | ALIAS (clear_ip_bgp_as, |
6497 | clear_bgp_instance_ipv6_as_cmd, | |
6498 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE, | |
6499 | CLEAR_STR | |
6500 | BGP_STR | |
6501 | BGP_INSTANCE_HELP_STR | |
6502 | "Address family\n" | |
6503 | "Clear peers with the AS number\n") | |
6504 | ||
718e3744 | 6505 | /* Outbound soft-reconfiguration */ |
6506 | DEFUN (clear_ip_bgp_all_soft_out, | |
6507 | clear_ip_bgp_all_soft_out_cmd, | |
6508 | "clear ip bgp * soft out", | |
6509 | CLEAR_STR | |
6510 | IP_STR | |
6511 | BGP_STR | |
6512 | "Clear all peers\n" | |
e0bce756 DS |
6513 | BGP_SOFT_STR |
6514 | BGP_SOFT_OUT_STR) | |
718e3744 | 6515 | { |
6aeb9e78 DS |
6516 | if (argc == 2) |
6517 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 6518 | BGP_CLEAR_SOFT_OUT, NULL); |
6519 | ||
6520 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6521 | BGP_CLEAR_SOFT_OUT, NULL); | |
6522 | } | |
6523 | ||
01080f7c | 6524 | ALIAS (clear_ip_bgp_all_soft_out, |
6525 | clear_ip_bgp_instance_all_soft_out_cmd, | |
6526 | "clear ip bgp " BGP_INSTANCE_CMD " * soft out", | |
6527 | CLEAR_STR | |
6528 | IP_STR | |
6529 | BGP_STR | |
6530 | BGP_INSTANCE_HELP_STR | |
6531 | "Clear all peers\n" | |
6532 | BGP_SOFT_STR | |
6533 | BGP_SOFT_OUT_STR) | |
6534 | ||
718e3744 | 6535 | ALIAS (clear_ip_bgp_all_soft_out, |
6536 | clear_ip_bgp_all_out_cmd, | |
6537 | "clear ip bgp * out", | |
6538 | CLEAR_STR | |
6539 | IP_STR | |
6540 | BGP_STR | |
6541 | "Clear all peers\n" | |
e0bce756 | 6542 | BGP_SOFT_OUT_STR) |
718e3744 | 6543 | |
6544 | ALIAS (clear_ip_bgp_all_soft_out, | |
01080f7c | 6545 | clear_ip_bgp_instance_all_out_cmd, |
6546 | "clear ip bgp " BGP_INSTANCE_CMD " * out", | |
718e3744 | 6547 | CLEAR_STR |
6548 | IP_STR | |
6549 | BGP_STR | |
8386ac43 | 6550 | BGP_INSTANCE_HELP_STR |
718e3744 | 6551 | "Clear all peers\n" |
e0bce756 | 6552 | BGP_SOFT_OUT_STR) |
718e3744 | 6553 | |
6554 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
6555 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
6556 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
6557 | CLEAR_STR | |
6558 | IP_STR | |
6559 | BGP_STR | |
6560 | "Clear all peers\n" | |
6561 | "Address family\n" | |
6562 | "Address Family modifier\n" | |
6563 | "Address Family modifier\n" | |
e0bce756 DS |
6564 | BGP_SOFT_STR |
6565 | BGP_SOFT_OUT_STR) | |
718e3744 | 6566 | { |
6567 | if (strncmp (argv[0], "m", 1) == 0) | |
6568 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6569 | BGP_CLEAR_SOFT_OUT, NULL); | |
6570 | ||
6571 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6572 | BGP_CLEAR_SOFT_OUT, NULL); | |
6573 | } | |
6574 | ||
01080f7c | 6575 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
6576 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
6577 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft out", | |
6578 | CLEAR_STR | |
6579 | IP_STR | |
6580 | BGP_STR | |
6581 | BGP_INSTANCE_HELP_STR | |
6582 | "Clear all peers\n" | |
6583 | "Address family\n" | |
6584 | "Address Family modifier\n" | |
6585 | "Address Family modifier\n" | |
6586 | BGP_SOFT_OUT_STR) | |
6587 | { | |
6588 | if (strncmp (argv[2], "m", 1) == 0) | |
6589 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, | |
6590 | BGP_CLEAR_SOFT_OUT, NULL); | |
6591 | ||
6592 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6593 | BGP_CLEAR_SOFT_OUT, NULL); | |
6594 | } | |
6595 | ||
718e3744 | 6596 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
6597 | clear_ip_bgp_all_ipv4_out_cmd, | |
6598 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
6599 | CLEAR_STR | |
6600 | IP_STR | |
6601 | BGP_STR | |
6602 | "Clear all peers\n" | |
6603 | "Address family\n" | |
6604 | "Address Family modifier\n" | |
6605 | "Address Family modifier\n" | |
e0bce756 | 6606 | BGP_SOFT_OUT_STR) |
718e3744 | 6607 | |
01080f7c | 6608 | ALIAS (clear_ip_bgp_instance_all_ipv4_soft_out, |
6609 | clear_ip_bgp_instance_all_ipv4_out_cmd, | |
6610 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) out", | |
718e3744 | 6611 | CLEAR_STR |
6612 | IP_STR | |
6613 | BGP_STR | |
8386ac43 | 6614 | BGP_INSTANCE_HELP_STR |
718e3744 | 6615 | "Clear all peers\n" |
6616 | "Address family\n" | |
6617 | "Address Family modifier\n" | |
6618 | "Address Family modifier\n" | |
e0bce756 | 6619 | BGP_SOFT_OUT_STR) |
718e3744 | 6620 | |
6621 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
6622 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
6623 | "clear ip bgp * vpnv4 unicast soft out", | |
6624 | CLEAR_STR | |
6625 | IP_STR | |
6626 | BGP_STR | |
6627 | "Clear all peers\n" | |
6628 | "Address family\n" | |
6629 | "Address Family Modifier\n" | |
e0bce756 DS |
6630 | BGP_SOFT_STR |
6631 | BGP_SOFT_OUT_STR) | |
718e3744 | 6632 | { |
6633 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6634 | BGP_CLEAR_SOFT_OUT, NULL); | |
6635 | } | |
6636 | ||
6637 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
6638 | clear_ip_bgp_all_vpnv4_out_cmd, | |
6639 | "clear ip bgp * vpnv4 unicast out", | |
6640 | CLEAR_STR | |
6641 | IP_STR | |
6642 | BGP_STR | |
6643 | "Clear all peers\n" | |
6644 | "Address family\n" | |
6645 | "Address Family Modifier\n" | |
e0bce756 | 6646 | BGP_SOFT_OUT_STR) |
718e3744 | 6647 | |
587ff0fd LB |
6648 | DEFUN (clear_ip_bgp_all_encap_soft_out, |
6649 | clear_ip_bgp_all_encap_soft_out_cmd, | |
6650 | "clear ip bgp * encap unicast soft out", | |
6651 | CLEAR_STR | |
6652 | IP_STR | |
6653 | BGP_STR | |
6654 | "Clear all peers\n" | |
6655 | "Address family\n" | |
6656 | "Address Family Modifier\n" | |
6657 | "Soft reconfig\n" | |
6658 | "Soft reconfig outbound update\n") | |
6659 | { | |
6660 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
6661 | BGP_CLEAR_SOFT_OUT, NULL); | |
6662 | } | |
6663 | ||
6664 | ALIAS (clear_ip_bgp_all_encap_soft_out, | |
6665 | clear_ip_bgp_all_encap_out_cmd, | |
6666 | "clear ip bgp * encap unicast out", | |
6667 | CLEAR_STR | |
6668 | IP_STR | |
6669 | BGP_STR | |
6670 | "Clear all peers\n" | |
6671 | "Address family\n" | |
6672 | "Address Family Modifier\n" | |
6673 | "Soft reconfig outbound update\n") | |
6674 | ||
718e3744 | 6675 | DEFUN (clear_bgp_all_soft_out, |
6676 | clear_bgp_all_soft_out_cmd, | |
6677 | "clear bgp * soft out", | |
6678 | CLEAR_STR | |
6679 | BGP_STR | |
6680 | "Clear all peers\n" | |
e0bce756 DS |
6681 | BGP_SOFT_STR |
6682 | BGP_SOFT_OUT_STR) | |
718e3744 | 6683 | { |
6aeb9e78 DS |
6684 | if (argc == 2) |
6685 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
718e3744 | 6686 | BGP_CLEAR_SOFT_OUT, NULL); |
6687 | ||
6688 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6689 | BGP_CLEAR_SOFT_OUT, NULL); | |
6690 | } | |
6691 | ||
6692 | ALIAS (clear_bgp_all_soft_out, | |
6693 | clear_bgp_instance_all_soft_out_cmd, | |
8386ac43 | 6694 | "clear bgp " BGP_INSTANCE_CMD " * soft out", |
718e3744 | 6695 | CLEAR_STR |
6696 | BGP_STR | |
8386ac43 | 6697 | BGP_INSTANCE_HELP_STR |
718e3744 | 6698 | "Clear all peers\n" |
e0bce756 DS |
6699 | BGP_SOFT_STR |
6700 | BGP_SOFT_OUT_STR) | |
718e3744 | 6701 | |
6702 | ALIAS (clear_bgp_all_soft_out, | |
6703 | clear_bgp_all_out_cmd, | |
6704 | "clear bgp * out", | |
6705 | CLEAR_STR | |
6706 | BGP_STR | |
6707 | "Clear all peers\n" | |
e0bce756 | 6708 | BGP_SOFT_OUT_STR) |
718e3744 | 6709 | |
01080f7c | 6710 | ALIAS (clear_bgp_all_soft_out, |
6711 | clear_bgp_instance_all_out_cmd, | |
6712 | "clear bgp " BGP_INSTANCE_CMD " * out", | |
6713 | CLEAR_STR | |
6714 | BGP_STR | |
6715 | BGP_INSTANCE_HELP_STR | |
6716 | "Clear all peers\n" | |
6717 | BGP_SOFT_OUT_STR) | |
6718 | ||
718e3744 | 6719 | ALIAS (clear_bgp_all_soft_out, |
6720 | clear_bgp_ipv6_all_soft_out_cmd, | |
6721 | "clear bgp ipv6 * soft out", | |
6722 | CLEAR_STR | |
6723 | BGP_STR | |
6724 | "Address family\n" | |
6725 | "Clear all peers\n" | |
e0bce756 DS |
6726 | BGP_SOFT_STR |
6727 | BGP_SOFT_OUT_STR) | |
718e3744 | 6728 | |
01080f7c | 6729 | ALIAS (clear_bgp_all_soft_out, |
6730 | clear_bgp_instance_ipv6_all_soft_out_cmd, | |
6731 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft out", | |
6732 | CLEAR_STR | |
6733 | BGP_STR | |
6734 | BGP_INSTANCE_HELP_STR | |
6735 | "Address family\n" | |
6736 | "Clear all peers\n" | |
6737 | BGP_SOFT_STR | |
6738 | BGP_SOFT_OUT_STR) | |
6739 | ||
718e3744 | 6740 | ALIAS (clear_bgp_all_soft_out, |
6741 | clear_bgp_ipv6_all_out_cmd, | |
6742 | "clear bgp ipv6 * out", | |
6743 | CLEAR_STR | |
6744 | BGP_STR | |
6745 | "Address family\n" | |
6746 | "Clear all peers\n" | |
e0bce756 | 6747 | BGP_SOFT_OUT_STR) |
718e3744 | 6748 | |
01080f7c | 6749 | ALIAS (clear_bgp_all_soft_out, |
6750 | clear_bgp_instance_ipv6_all_out_cmd, | |
6751 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * out", | |
6752 | CLEAR_STR | |
6753 | BGP_STR | |
6754 | BGP_INSTANCE_HELP_STR | |
6755 | "Address family\n" | |
6756 | "Clear all peers\n" | |
6757 | BGP_SOFT_OUT_STR) | |
6758 | ||
8ad7271d DS |
6759 | DEFUN (clear_bgp_ipv6_safi_prefix, |
6760 | clear_bgp_ipv6_safi_prefix_cmd, | |
6761 | "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6762 | CLEAR_STR | |
6763 | BGP_STR | |
6764 | "Address family\n" | |
6765 | "Address Family Modifier\n" | |
6766 | "Clear bestpath and re-advertise\n" | |
6767 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6768 | { | |
6769 | if (strncmp (argv[0], "m", 1) == 0) | |
6770 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL); | |
6771 | else | |
6772 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL); | |
6773 | } | |
6774 | ||
01080f7c | 6775 | DEFUN (clear_bgp_instance_ipv6_safi_prefix, |
6776 | clear_bgp_instance_ipv6_safi_prefix_cmd, | |
6777 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6778 | CLEAR_STR | |
6779 | BGP_STR | |
6780 | BGP_INSTANCE_HELP_STR | |
6781 | "Address family\n" | |
6782 | "Address Family Modifier\n" | |
6783 | "Clear bestpath and re-advertise\n" | |
6784 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6785 | { | |
6786 | if (strncmp (argv[2], "m", 1) == 0) | |
6787 | return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_MULTICAST, NULL); | |
6788 | else | |
6789 | return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_UNICAST, NULL); | |
6790 | } | |
6791 | ||
718e3744 | 6792 | DEFUN (clear_ip_bgp_peer_soft_out, |
6793 | clear_ip_bgp_peer_soft_out_cmd, | |
db64ea86 | 6794 | "clear ip bgp (A.B.C.D|WORD) soft out", |
718e3744 | 6795 | CLEAR_STR |
6796 | IP_STR | |
6797 | BGP_STR | |
6798 | "BGP neighbor address to clear\n" | |
db64ea86 | 6799 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6800 | BGP_SOFT_STR |
6801 | BGP_SOFT_OUT_STR) | |
718e3744 | 6802 | { |
01080f7c | 6803 | if (argc == 3) |
6804 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
6805 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6806 | ||
718e3744 | 6807 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
6808 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6809 | } | |
6810 | ||
01080f7c | 6811 | ALIAS (clear_ip_bgp_peer_soft_out, |
6812 | clear_ip_bgp_instance_peer_soft_out_cmd, | |
6813 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft out", | |
6814 | CLEAR_STR | |
6815 | IP_STR | |
6816 | BGP_STR | |
6817 | BGP_INSTANCE_HELP_STR | |
6818 | "BGP neighbor address to clear\n" | |
6819 | "BGP neighbor on interface to clear\n" | |
6820 | BGP_SOFT_STR | |
6821 | BGP_SOFT_OUT_STR) | |
6822 | ||
718e3744 | 6823 | ALIAS (clear_ip_bgp_peer_soft_out, |
6824 | clear_ip_bgp_peer_out_cmd, | |
db64ea86 | 6825 | "clear ip bgp (A.B.C.D|WORD) out", |
718e3744 | 6826 | CLEAR_STR |
6827 | IP_STR | |
6828 | BGP_STR | |
6829 | "BGP neighbor address to clear\n" | |
db64ea86 | 6830 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6831 | BGP_SOFT_OUT_STR) |
718e3744 | 6832 | |
01080f7c | 6833 | ALIAS (clear_ip_bgp_peer_soft_out, |
6834 | clear_ip_bgp_instance_peer_out_cmd, | |
6835 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) out", | |
6836 | CLEAR_STR | |
6837 | IP_STR | |
6838 | BGP_STR | |
6839 | BGP_INSTANCE_HELP_STR | |
6840 | "BGP neighbor address to clear\n" | |
6841 | "BGP neighbor on interface to clear\n" | |
6842 | BGP_SOFT_OUT_STR) | |
6843 | ||
718e3744 | 6844 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
6845 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
db64ea86 | 6846 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", |
718e3744 | 6847 | CLEAR_STR |
6848 | IP_STR | |
6849 | BGP_STR | |
6850 | "BGP neighbor address to clear\n" | |
db64ea86 | 6851 | "BGP neighbor on interface to clear\n" |
718e3744 | 6852 | "Address family\n" |
6853 | "Address Family modifier\n" | |
6854 | "Address Family modifier\n" | |
e0bce756 DS |
6855 | BGP_SOFT_STR |
6856 | BGP_SOFT_OUT_STR) | |
718e3744 | 6857 | { |
6858 | if (strncmp (argv[1], "m", 1) == 0) | |
6859 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6860 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6861 | ||
6862 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6863 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6864 | } | |
6865 | ||
01080f7c | 6866 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, |
6867 | clear_ip_bgp_instance_peer_ipv4_soft_out_cmd, | |
6868 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", | |
6869 | CLEAR_STR | |
6870 | IP_STR | |
6871 | BGP_STR | |
6872 | BGP_INSTANCE_HELP_STR | |
6873 | "BGP neighbor address to clear\n" | |
6874 | "BGP neighbor on interface to clear\n" | |
6875 | "Address family\n" | |
6876 | "Address Family modifier\n" | |
6877 | "Address Family modifier\n" | |
6878 | BGP_SOFT_STR | |
6879 | BGP_SOFT_OUT_STR) | |
6880 | { | |
6881 | if (strncmp (argv[3], "m", 1) == 0) | |
6882 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, | |
6883 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6884 | ||
6885 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
6886 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6887 | } | |
6888 | ||
718e3744 | 6889 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
6890 | clear_ip_bgp_peer_ipv4_out_cmd, | |
db64ea86 | 6891 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out", |
718e3744 | 6892 | CLEAR_STR |
6893 | IP_STR | |
6894 | BGP_STR | |
6895 | "BGP neighbor address to clear\n" | |
db64ea86 | 6896 | "BGP neighbor on interface to clear\n" |
718e3744 | 6897 | "Address family\n" |
6898 | "Address Family modifier\n" | |
6899 | "Address Family modifier\n" | |
e0bce756 | 6900 | BGP_SOFT_OUT_STR) |
718e3744 | 6901 | |
01080f7c | 6902 | ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_out, |
6903 | clear_ip_bgp_instance_peer_ipv4_out_cmd, | |
6904 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) out", | |
6905 | CLEAR_STR | |
6906 | IP_STR | |
6907 | BGP_STR | |
6908 | BGP_INSTANCE_HELP_STR | |
6909 | "BGP neighbor address to clear\n" | |
6910 | "BGP neighbor on interface to clear\n" | |
6911 | "Address family\n" | |
6912 | "Address Family modifier\n" | |
6913 | "Address Family modifier\n" | |
6914 | BGP_SOFT_OUT_STR) | |
6915 | ||
db64ea86 | 6916 | /* NOTE: WORD peers have not been tested for vpnv4 */ |
718e3744 | 6917 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
6918 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
db64ea86 | 6919 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out", |
718e3744 | 6920 | CLEAR_STR |
6921 | IP_STR | |
6922 | BGP_STR | |
6923 | "BGP neighbor address to clear\n" | |
db64ea86 | 6924 | "BGP neighbor on interface to clear\n" |
718e3744 | 6925 | "Address family\n" |
6926 | "Address Family Modifier\n" | |
e0bce756 DS |
6927 | BGP_SOFT_STR |
6928 | BGP_SOFT_OUT_STR) | |
718e3744 | 6929 | { |
6930 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6931 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6932 | } | |
6933 | ||
6934 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
6935 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
db64ea86 | 6936 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out", |
718e3744 | 6937 | CLEAR_STR |
6938 | IP_STR | |
6939 | BGP_STR | |
6940 | "BGP neighbor address to clear\n" | |
db64ea86 | 6941 | "BGP neighbor on interface to clear\n" |
718e3744 | 6942 | "Address family\n" |
6943 | "Address Family Modifier\n" | |
e0bce756 | 6944 | BGP_SOFT_OUT_STR) |
718e3744 | 6945 | |
587ff0fd LB |
6946 | DEFUN (clear_ip_bgp_peer_encap_soft_out, |
6947 | clear_ip_bgp_peer_encap_soft_out_cmd, | |
6948 | "clear ip bgp A.B.C.D encap unicast soft out", | |
6949 | CLEAR_STR | |
6950 | IP_STR | |
6951 | BGP_STR | |
6952 | "BGP neighbor address to clear\n" | |
6953 | "Address family\n" | |
6954 | "Address Family Modifier\n" | |
6955 | "Soft reconfig\n" | |
6956 | "Soft reconfig outbound update\n") | |
6957 | { | |
6958 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
6959 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6960 | } | |
6961 | ||
6962 | ALIAS (clear_ip_bgp_peer_encap_soft_out, | |
6963 | clear_ip_bgp_peer_encap_out_cmd, | |
6964 | "clear ip bgp A.B.C.D encap unicast out", | |
6965 | CLEAR_STR | |
6966 | IP_STR | |
6967 | BGP_STR | |
6968 | "BGP neighbor address to clear\n" | |
6969 | "Address family\n" | |
6970 | "Address Family Modifier\n" | |
6971 | "Soft reconfig outbound update\n") | |
6972 | ||
718e3744 | 6973 | DEFUN (clear_bgp_peer_soft_out, |
6974 | clear_bgp_peer_soft_out_cmd, | |
a80beece | 6975 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6976 | CLEAR_STR |
6977 | BGP_STR | |
6978 | "BGP neighbor address to clear\n" | |
6979 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6980 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6981 | BGP_SOFT_STR |
6982 | BGP_SOFT_OUT_STR) | |
718e3744 | 6983 | { |
01080f7c | 6984 | if (argc == 3) |
6985 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
6986 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6987 | ||
718e3744 | 6988 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
6989 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6990 | } | |
6991 | ||
01080f7c | 6992 | ALIAS (clear_bgp_peer_soft_out, |
6993 | clear_bgp_instance_peer_soft_out_cmd, | |
6994 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft out", | |
6995 | CLEAR_STR | |
6996 | BGP_STR | |
6997 | BGP_INSTANCE_HELP_STR | |
6998 | "BGP neighbor address to clear\n" | |
6999 | "BGP IPv6 neighbor to clear\n" | |
7000 | "BGP neighbor on interface to clear\n" | |
7001 | BGP_SOFT_STR | |
7002 | BGP_SOFT_OUT_STR) | |
7003 | ||
718e3744 | 7004 | ALIAS (clear_bgp_peer_soft_out, |
7005 | clear_bgp_ipv6_peer_soft_out_cmd, | |
a80beece | 7006 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 7007 | CLEAR_STR |
7008 | BGP_STR | |
7009 | "Address family\n" | |
7010 | "BGP neighbor address to clear\n" | |
7011 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7012 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
7013 | BGP_SOFT_STR |
7014 | BGP_SOFT_OUT_STR) | |
718e3744 | 7015 | |
01080f7c | 7016 | ALIAS (clear_bgp_peer_soft_out, |
7017 | clear_bgp_instance_ipv6_peer_soft_out_cmd, | |
7018 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", | |
7019 | CLEAR_STR | |
7020 | BGP_STR | |
7021 | BGP_INSTANCE_HELP_STR | |
7022 | "Address family\n" | |
7023 | "BGP neighbor address to clear\n" | |
7024 | "BGP IPv6 neighbor to clear\n" | |
7025 | "BGP neighbor on interface to clear\n" | |
7026 | BGP_SOFT_STR | |
7027 | BGP_SOFT_OUT_STR) | |
7028 | ||
718e3744 | 7029 | ALIAS (clear_bgp_peer_soft_out, |
7030 | clear_bgp_peer_out_cmd, | |
a80beece | 7031 | "clear bgp (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 7032 | CLEAR_STR |
7033 | BGP_STR | |
7034 | "BGP neighbor address to clear\n" | |
7035 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7036 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7037 | BGP_SOFT_OUT_STR) |
718e3744 | 7038 | |
01080f7c | 7039 | ALIAS (clear_bgp_peer_soft_out, |
7040 | clear_bgp_instance_peer_out_cmd, | |
7041 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) out", | |
7042 | CLEAR_STR | |
7043 | BGP_STR | |
7044 | BGP_INSTANCE_HELP_STR | |
7045 | "BGP neighbor address to clear\n" | |
7046 | "BGP IPv6 neighbor to clear\n" | |
7047 | "BGP neighbor on interface to clear\n" | |
7048 | BGP_SOFT_OUT_STR) | |
7049 | ||
718e3744 | 7050 | ALIAS (clear_bgp_peer_soft_out, |
7051 | clear_bgp_ipv6_peer_out_cmd, | |
a80beece | 7052 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 7053 | CLEAR_STR |
7054 | BGP_STR | |
7055 | "Address family\n" | |
7056 | "BGP neighbor address to clear\n" | |
7057 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7058 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7059 | BGP_SOFT_OUT_STR) |
718e3744 | 7060 | |
01080f7c | 7061 | ALIAS (clear_bgp_peer_soft_out, |
7062 | clear_bgp_instance_ipv6_peer_out_cmd, | |
7063 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) out", | |
7064 | CLEAR_STR | |
7065 | BGP_STR | |
7066 | BGP_INSTANCE_HELP_STR | |
7067 | "Address family\n" | |
7068 | "BGP neighbor address to clear\n" | |
7069 | "BGP IPv6 neighbor to clear\n" | |
7070 | "BGP neighbor on interface to clear\n" | |
7071 | BGP_SOFT_OUT_STR) | |
7072 | ||
718e3744 | 7073 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
7074 | clear_ip_bgp_peer_group_soft_out_cmd, | |
7075 | "clear ip bgp peer-group WORD soft out", | |
7076 | CLEAR_STR | |
7077 | IP_STR | |
7078 | BGP_STR | |
7079 | "Clear all members of peer-group\n" | |
7080 | "BGP peer-group name\n" | |
e0bce756 DS |
7081 | BGP_SOFT_STR |
7082 | BGP_SOFT_OUT_STR) | |
718e3744 | 7083 | { |
01080f7c | 7084 | if (argc == 3) |
7085 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
7086 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7087 | ||
718e3744 | 7088 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
7089 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7090 | } | |
7091 | ||
01080f7c | 7092 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
7093 | clear_ip_bgp_instance_peer_group_soft_out_cmd, | |
7094 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", | |
7095 | CLEAR_STR | |
7096 | IP_STR | |
7097 | BGP_STR | |
7098 | BGP_INSTANCE_HELP_STR | |
7099 | "Clear all members of peer-group\n" | |
7100 | "BGP peer-group name\n" | |
7101 | BGP_SOFT_STR | |
7102 | BGP_SOFT_OUT_STR) | |
7103 | ||
718e3744 | 7104 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
7105 | clear_ip_bgp_peer_group_out_cmd, | |
7106 | "clear ip bgp peer-group WORD out", | |
7107 | CLEAR_STR | |
7108 | IP_STR | |
7109 | BGP_STR | |
7110 | "Clear all members of peer-group\n" | |
7111 | "BGP peer-group name\n" | |
e0bce756 | 7112 | BGP_SOFT_OUT_STR) |
718e3744 | 7113 | |
01080f7c | 7114 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
7115 | clear_ip_bgp_instance_peer_group_out_cmd, | |
7116 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD out", | |
7117 | CLEAR_STR | |
7118 | IP_STR | |
7119 | BGP_STR | |
7120 | BGP_INSTANCE_HELP_STR | |
7121 | "Clear all members of peer-group\n" | |
7122 | "BGP peer-group name\n" | |
7123 | BGP_SOFT_OUT_STR) | |
7124 | ||
718e3744 | 7125 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
7126 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
7127 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
7128 | CLEAR_STR | |
7129 | IP_STR | |
7130 | BGP_STR | |
7131 | "Clear all members of peer-group\n" | |
7132 | "BGP peer-group name\n" | |
7133 | "Address family\n" | |
7134 | "Address Family modifier\n" | |
7135 | "Address Family modifier\n" | |
e0bce756 DS |
7136 | BGP_SOFT_STR |
7137 | BGP_SOFT_OUT_STR) | |
718e3744 | 7138 | { |
7139 | if (strncmp (argv[1], "m", 1) == 0) | |
7140 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7141 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7142 | ||
7143 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7144 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7145 | } | |
7146 | ||
01080f7c | 7147 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, |
7148 | clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd, | |
7149 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft out", | |
7150 | CLEAR_STR | |
7151 | IP_STR | |
7152 | BGP_STR | |
7153 | BGP_INSTANCE_HELP_STR | |
7154 | "Clear all members of peer-group\n" | |
7155 | "BGP peer-group name\n" | |
7156 | "Address family\n" | |
7157 | "Address Family modifier\n" | |
7158 | "Address Family modifier\n" | |
7159 | BGP_SOFT_STR | |
7160 | BGP_SOFT_OUT_STR) | |
7161 | { | |
7162 | if (strncmp (argv[3], "m", 1) == 0) | |
7163 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, | |
7164 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7165 | ||
7166 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
7167 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7168 | } | |
7169 | ||
718e3744 | 7170 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
7171 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
7172 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
7173 | CLEAR_STR | |
7174 | IP_STR | |
7175 | BGP_STR | |
7176 | "Clear all members of peer-group\n" | |
7177 | "BGP peer-group name\n" | |
7178 | "Address family\n" | |
7179 | "Address Family modifier\n" | |
7180 | "Address Family modifier\n" | |
e0bce756 | 7181 | BGP_SOFT_OUT_STR) |
718e3744 | 7182 | |
01080f7c | 7183 | ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_out, |
7184 | clear_ip_bgp_instance_peer_group_ipv4_out_cmd, | |
7185 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) out", | |
7186 | CLEAR_STR | |
7187 | IP_STR | |
7188 | BGP_STR | |
7189 | BGP_INSTANCE_HELP_STR | |
7190 | "Clear all members of peer-group\n" | |
7191 | "BGP peer-group name\n" | |
7192 | "Address family\n" | |
7193 | "Address Family modifier\n" | |
7194 | "Address Family modifier\n" | |
7195 | BGP_SOFT_OUT_STR) | |
7196 | ||
718e3744 | 7197 | DEFUN (clear_bgp_peer_group_soft_out, |
7198 | clear_bgp_peer_group_soft_out_cmd, | |
7199 | "clear bgp peer-group WORD soft out", | |
7200 | CLEAR_STR | |
7201 | BGP_STR | |
7202 | "Clear all members of peer-group\n" | |
7203 | "BGP peer-group name\n" | |
e0bce756 DS |
7204 | BGP_SOFT_STR |
7205 | BGP_SOFT_OUT_STR) | |
718e3744 | 7206 | { |
01080f7c | 7207 | if (argc == 3) |
7208 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
7209 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7210 | ||
718e3744 | 7211 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
7212 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7213 | } | |
7214 | ||
01080f7c | 7215 | ALIAS (clear_bgp_peer_group_soft_out, |
7216 | clear_bgp_instance_peer_group_soft_out_cmd, | |
7217 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", | |
7218 | CLEAR_STR | |
7219 | BGP_STR | |
7220 | BGP_INSTANCE_HELP_STR | |
7221 | "Clear all members of peer-group\n" | |
7222 | "BGP peer-group name\n" | |
7223 | BGP_SOFT_STR | |
7224 | BGP_SOFT_OUT_STR) | |
7225 | ||
718e3744 | 7226 | ALIAS (clear_bgp_peer_group_soft_out, |
7227 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
7228 | "clear bgp ipv6 peer-group WORD soft out", | |
7229 | CLEAR_STR | |
7230 | BGP_STR | |
7231 | "Address family\n" | |
7232 | "Clear all members of peer-group\n" | |
7233 | "BGP peer-group name\n" | |
e0bce756 DS |
7234 | BGP_SOFT_STR |
7235 | BGP_SOFT_OUT_STR) | |
718e3744 | 7236 | |
01080f7c | 7237 | ALIAS (clear_bgp_peer_group_soft_out, |
7238 | clear_bgp_instance_ipv6_peer_group_soft_out_cmd, | |
7239 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft out", | |
7240 | CLEAR_STR | |
7241 | BGP_STR | |
7242 | BGP_INSTANCE_HELP_STR | |
7243 | "Address family\n" | |
7244 | "Clear all members of peer-group\n" | |
7245 | "BGP peer-group name\n" | |
7246 | BGP_SOFT_STR | |
7247 | BGP_SOFT_OUT_STR) | |
7248 | ||
718e3744 | 7249 | ALIAS (clear_bgp_peer_group_soft_out, |
7250 | clear_bgp_peer_group_out_cmd, | |
7251 | "clear bgp peer-group WORD out", | |
7252 | CLEAR_STR | |
7253 | BGP_STR | |
7254 | "Clear all members of peer-group\n" | |
7255 | "BGP peer-group name\n" | |
e0bce756 | 7256 | BGP_SOFT_OUT_STR) |
718e3744 | 7257 | |
01080f7c | 7258 | ALIAS (clear_bgp_peer_group_soft_out, |
7259 | clear_bgp_instance_peer_group_out_cmd, | |
7260 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD out", | |
7261 | CLEAR_STR | |
7262 | BGP_STR | |
7263 | BGP_INSTANCE_HELP_STR | |
7264 | "Clear all members of peer-group\n" | |
7265 | "BGP peer-group name\n" | |
7266 | BGP_SOFT_OUT_STR) | |
7267 | ||
718e3744 | 7268 | ALIAS (clear_bgp_peer_group_soft_out, |
7269 | clear_bgp_ipv6_peer_group_out_cmd, | |
7270 | "clear bgp ipv6 peer-group WORD out", | |
7271 | CLEAR_STR | |
7272 | BGP_STR | |
7273 | "Address family\n" | |
7274 | "Clear all members of peer-group\n" | |
7275 | "BGP peer-group name\n" | |
e0bce756 | 7276 | BGP_SOFT_OUT_STR) |
718e3744 | 7277 | |
01080f7c | 7278 | ALIAS (clear_bgp_peer_group_soft_out, |
7279 | clear_bgp_instance_ipv6_peer_group_out_cmd, | |
7280 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD out", | |
7281 | CLEAR_STR | |
7282 | BGP_STR | |
7283 | BGP_INSTANCE_HELP_STR | |
7284 | "Address family\n" | |
7285 | "Clear all members of peer-group\n" | |
7286 | "BGP peer-group name\n" | |
7287 | BGP_SOFT_OUT_STR) | |
7288 | ||
718e3744 | 7289 | DEFUN (clear_ip_bgp_external_soft_out, |
7290 | clear_ip_bgp_external_soft_out_cmd, | |
7291 | "clear ip bgp external soft out", | |
7292 | CLEAR_STR | |
7293 | IP_STR | |
7294 | BGP_STR | |
7295 | "Clear all external peers\n" | |
e0bce756 DS |
7296 | BGP_SOFT_STR |
7297 | BGP_SOFT_OUT_STR) | |
01080f7c | 7298 | { |
7299 | if (argc == 2) | |
7300 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
7301 | BGP_CLEAR_SOFT_OUT, NULL); | |
7302 | ||
7303 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7304 | BGP_CLEAR_SOFT_OUT, NULL); | |
7305 | } | |
7306 | ||
7307 | ALIAS (clear_ip_bgp_external_soft_out, | |
7308 | clear_ip_bgp_instance_external_soft_out_cmd, | |
7309 | "clear ip bgp " BGP_INSTANCE_CMD " external soft out", | |
7310 | CLEAR_STR | |
7311 | IP_STR | |
7312 | BGP_STR | |
7313 | BGP_INSTANCE_HELP_STR | |
7314 | "Clear all external peers\n" | |
7315 | BGP_SOFT_STR | |
7316 | BGP_SOFT_OUT_STR) | |
7317 | ||
7318 | ALIAS (clear_ip_bgp_external_soft_out, | |
7319 | clear_ip_bgp_external_out_cmd, | |
7320 | "clear ip bgp external out", | |
7321 | CLEAR_STR | |
7322 | IP_STR | |
7323 | BGP_STR | |
7324 | "Clear all external peers\n" | |
7325 | BGP_SOFT_OUT_STR) | |
718e3744 | 7326 | |
7327 | ALIAS (clear_ip_bgp_external_soft_out, | |
01080f7c | 7328 | clear_ip_bgp_instance_external_out_cmd, |
7329 | "clear ip bgp " BGP_INSTANCE_CMD " external out", | |
718e3744 | 7330 | CLEAR_STR |
7331 | IP_STR | |
7332 | BGP_STR | |
01080f7c | 7333 | BGP_INSTANCE_HELP_STR |
718e3744 | 7334 | "Clear all external peers\n" |
e0bce756 | 7335 | BGP_SOFT_OUT_STR) |
718e3744 | 7336 | |
7337 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
7338 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
7339 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
7340 | CLEAR_STR | |
7341 | IP_STR | |
7342 | BGP_STR | |
7343 | "Clear all external peers\n" | |
7344 | "Address family\n" | |
7345 | "Address Family modifier\n" | |
7346 | "Address Family modifier\n" | |
e0bce756 DS |
7347 | BGP_SOFT_STR |
7348 | BGP_SOFT_OUT_STR) | |
718e3744 | 7349 | { |
7350 | if (strncmp (argv[0], "m", 1) == 0) | |
7351 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7352 | BGP_CLEAR_SOFT_OUT, NULL); | |
7353 | ||
7354 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7355 | BGP_CLEAR_SOFT_OUT, NULL); | |
7356 | } | |
7357 | ||
01080f7c | 7358 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, |
7359 | clear_ip_bgp_instance_external_ipv4_soft_out_cmd, | |
7360 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft out", | |
7361 | CLEAR_STR | |
7362 | IP_STR | |
7363 | BGP_STR | |
7364 | BGP_INSTANCE_HELP_STR | |
7365 | "Clear all external peers\n" | |
7366 | "Address family\n" | |
7367 | "Address Family modifier\n" | |
7368 | "Address Family modifier\n" | |
7369 | BGP_SOFT_STR | |
7370 | BGP_SOFT_OUT_STR) | |
7371 | { | |
7372 | if (strncmp (argv[2], "m", 1) == 0) | |
7373 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, | |
7374 | BGP_CLEAR_SOFT_OUT, NULL); | |
7375 | ||
7376 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
7377 | BGP_CLEAR_SOFT_OUT, NULL); | |
7378 | } | |
7379 | ||
718e3744 | 7380 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
7381 | clear_ip_bgp_external_ipv4_out_cmd, | |
7382 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
7383 | CLEAR_STR | |
7384 | IP_STR | |
7385 | BGP_STR | |
7386 | "Clear all external peers\n" | |
7387 | "Address family\n" | |
7388 | "Address Family modifier\n" | |
7389 | "Address Family modifier\n" | |
e0bce756 | 7390 | BGP_SOFT_OUT_STR) |
718e3744 | 7391 | |
01080f7c | 7392 | ALIAS (clear_ip_bgp_instance_external_ipv4_soft_out, |
7393 | clear_ip_bgp_instance_external_ipv4_out_cmd, | |
7394 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) out", | |
7395 | CLEAR_STR | |
7396 | IP_STR | |
7397 | BGP_STR | |
7398 | BGP_INSTANCE_HELP_STR | |
7399 | "Clear all external peers\n" | |
7400 | "Address family\n" | |
7401 | "Address Family modifier\n" | |
7402 | "Address Family modifier\n" | |
7403 | BGP_SOFT_OUT_STR) | |
7404 | ||
718e3744 | 7405 | DEFUN (clear_bgp_external_soft_out, |
7406 | clear_bgp_external_soft_out_cmd, | |
7407 | "clear bgp external soft out", | |
7408 | CLEAR_STR | |
7409 | BGP_STR | |
7410 | "Clear all external peers\n" | |
e0bce756 DS |
7411 | BGP_SOFT_STR |
7412 | BGP_SOFT_OUT_STR) | |
718e3744 | 7413 | { |
01080f7c | 7414 | if (argc == 2) |
7415 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
7416 | BGP_CLEAR_SOFT_OUT, NULL); | |
7417 | ||
718e3744 | 7418 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
7419 | BGP_CLEAR_SOFT_OUT, NULL); | |
7420 | } | |
7421 | ||
01080f7c | 7422 | ALIAS (clear_bgp_external_soft_out, |
7423 | clear_bgp_instance_external_soft_out_cmd, | |
7424 | "clear bgp " BGP_INSTANCE_CMD " external soft out", | |
7425 | CLEAR_STR | |
7426 | BGP_STR | |
7427 | BGP_INSTANCE_HELP_STR | |
7428 | "Clear all external peers\n" | |
7429 | BGP_SOFT_STR | |
7430 | BGP_SOFT_OUT_STR) | |
7431 | ||
718e3744 | 7432 | ALIAS (clear_bgp_external_soft_out, |
7433 | clear_bgp_ipv6_external_soft_out_cmd, | |
7434 | "clear bgp ipv6 external soft out", | |
7435 | CLEAR_STR | |
7436 | BGP_STR | |
7437 | "Address family\n" | |
7438 | "Clear all external peers\n" | |
e0bce756 DS |
7439 | BGP_SOFT_STR |
7440 | BGP_SOFT_OUT_STR) | |
718e3744 | 7441 | |
01080f7c | 7442 | ALIAS (clear_bgp_external_soft_out, |
7443 | clear_bgp_instance_ipv6_external_soft_out_cmd, | |
7444 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft out", | |
7445 | CLEAR_STR | |
7446 | BGP_STR | |
7447 | BGP_INSTANCE_HELP_STR | |
7448 | "Address family\n" | |
7449 | "Clear all external peers\n" | |
7450 | BGP_SOFT_STR | |
7451 | BGP_SOFT_OUT_STR) | |
7452 | ||
718e3744 | 7453 | ALIAS (clear_bgp_external_soft_out, |
7454 | clear_bgp_external_out_cmd, | |
7455 | "clear bgp external out", | |
7456 | CLEAR_STR | |
7457 | BGP_STR | |
7458 | "Clear all external peers\n" | |
e0bce756 | 7459 | BGP_SOFT_OUT_STR) |
718e3744 | 7460 | |
01080f7c | 7461 | ALIAS (clear_bgp_external_soft_out, |
7462 | clear_bgp_instance_external_out_cmd, | |
7463 | "clear bgp " BGP_INSTANCE_CMD " external out", | |
7464 | CLEAR_STR | |
7465 | BGP_STR | |
7466 | BGP_INSTANCE_HELP_STR | |
7467 | "Clear all external peers\n" | |
7468 | BGP_SOFT_OUT_STR) | |
7469 | ||
718e3744 | 7470 | ALIAS (clear_bgp_external_soft_out, |
7471 | clear_bgp_ipv6_external_out_cmd, | |
7472 | "clear bgp ipv6 external WORD out", | |
7473 | CLEAR_STR | |
7474 | BGP_STR | |
7475 | "Address family\n" | |
7476 | "Clear all external peers\n" | |
e0bce756 | 7477 | BGP_SOFT_OUT_STR) |
718e3744 | 7478 | |
01080f7c | 7479 | ALIAS (clear_bgp_external_soft_out, |
7480 | clear_bgp_instance_ipv6_external_out_cmd, | |
7481 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD out", | |
7482 | CLEAR_STR | |
7483 | BGP_STR | |
7484 | BGP_INSTANCE_HELP_STR | |
7485 | "Address family\n" | |
7486 | "Clear all external peers\n" | |
7487 | BGP_SOFT_OUT_STR) | |
7488 | ||
718e3744 | 7489 | DEFUN (clear_ip_bgp_as_soft_out, |
7490 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 7491 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 7492 | CLEAR_STR |
7493 | IP_STR | |
7494 | BGP_STR | |
7495 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7496 | BGP_SOFT_STR |
7497 | BGP_SOFT_OUT_STR) | |
718e3744 | 7498 | { |
01080f7c | 7499 | if (argc == 3) |
7500 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
7501 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7502 | ||
718e3744 | 7503 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
7504 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7505 | } | |
7506 | ||
01080f7c | 7507 | ALIAS (clear_ip_bgp_as_soft_out, |
7508 | clear_ip_bgp_instance_as_soft_out_cmd, | |
7509 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", | |
7510 | CLEAR_STR | |
7511 | IP_STR | |
7512 | BGP_STR | |
7513 | BGP_INSTANCE_HELP_STR | |
7514 | "Clear peers with the AS number\n" | |
7515 | BGP_SOFT_STR | |
7516 | BGP_SOFT_OUT_STR) | |
7517 | ||
718e3744 | 7518 | ALIAS (clear_ip_bgp_as_soft_out, |
7519 | clear_ip_bgp_as_out_cmd, | |
320da874 | 7520 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 7521 | CLEAR_STR |
7522 | IP_STR | |
7523 | BGP_STR | |
7524 | "Clear peers with the AS number\n" | |
e0bce756 | 7525 | BGP_SOFT_OUT_STR) |
718e3744 | 7526 | |
01080f7c | 7527 | ALIAS (clear_ip_bgp_as_soft_out, |
7528 | clear_ip_bgp_instance_as_out_cmd, | |
7529 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", | |
7530 | CLEAR_STR | |
7531 | IP_STR | |
7532 | BGP_STR | |
7533 | BGP_INSTANCE_HELP_STR | |
7534 | "Clear peers with the AS number\n" | |
7535 | BGP_SOFT_OUT_STR) | |
7536 | ||
718e3744 | 7537 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
7538 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 7539 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 7540 | CLEAR_STR |
7541 | IP_STR | |
7542 | BGP_STR | |
7543 | "Clear peers with the AS number\n" | |
7544 | "Address family\n" | |
7545 | "Address Family modifier\n" | |
7546 | "Address Family modifier\n" | |
e0bce756 DS |
7547 | BGP_SOFT_STR |
7548 | BGP_SOFT_OUT_STR) | |
718e3744 | 7549 | { |
7550 | if (strncmp (argv[1], "m", 1) == 0) | |
7551 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7552 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7553 | ||
7554 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7555 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7556 | } | |
7557 | ||
01080f7c | 7558 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, |
7559 | clear_ip_bgp_instance_as_ipv4_soft_out_cmd, | |
7560 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", | |
7561 | CLEAR_STR | |
7562 | IP_STR | |
7563 | BGP_STR | |
7564 | BGP_INSTANCE_HELP_STR | |
7565 | "Clear peers with the AS number\n" | |
7566 | "Address family\n" | |
7567 | "Address Family modifier\n" | |
7568 | "Address Family modifier\n" | |
7569 | BGP_SOFT_STR | |
7570 | BGP_SOFT_OUT_STR) | |
7571 | { | |
7572 | if (strncmp (argv[3], "m", 1) == 0) | |
7573 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, | |
7574 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7575 | ||
7576 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
7577 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7578 | } | |
7579 | ||
718e3744 | 7580 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
7581 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 7582 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 7583 | CLEAR_STR |
7584 | IP_STR | |
7585 | BGP_STR | |
7586 | "Clear peers with the AS number\n" | |
7587 | "Address family\n" | |
7588 | "Address Family modifier\n" | |
7589 | "Address Family modifier\n" | |
e0bce756 | 7590 | BGP_SOFT_OUT_STR) |
718e3744 | 7591 | |
01080f7c | 7592 | ALIAS (clear_ip_bgp_instance_as_ipv4_soft_out, |
7593 | clear_ip_bgp_instance_as_ipv4_out_cmd, | |
7594 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) out", | |
7595 | CLEAR_STR | |
7596 | IP_STR | |
7597 | BGP_STR | |
7598 | BGP_INSTANCE_HELP_STR | |
7599 | "Clear peers with the AS number\n" | |
7600 | "Address family\n" | |
7601 | "Address Family modifier\n" | |
7602 | "Address Family modifier\n" | |
7603 | BGP_SOFT_OUT_STR) | |
7604 | ||
718e3744 | 7605 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
7606 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 7607 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 7608 | CLEAR_STR |
7609 | IP_STR | |
7610 | BGP_STR | |
7611 | "Clear peers with the AS number\n" | |
7612 | "Address family\n" | |
7613 | "Address Family modifier\n" | |
e0bce756 DS |
7614 | BGP_SOFT_STR |
7615 | BGP_SOFT_OUT_STR) | |
718e3744 | 7616 | { |
7617 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7618 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7619 | } | |
7620 | ||
7621 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
7622 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 7623 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 7624 | CLEAR_STR |
7625 | IP_STR | |
7626 | BGP_STR | |
7627 | "Clear peers with the AS number\n" | |
7628 | "Address family\n" | |
7629 | "Address Family modifier\n" | |
e0bce756 | 7630 | BGP_SOFT_OUT_STR) |
718e3744 | 7631 | |
587ff0fd LB |
7632 | DEFUN (clear_ip_bgp_as_encap_soft_out, |
7633 | clear_ip_bgp_as_encap_soft_out_cmd, | |
7634 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft out", | |
7635 | CLEAR_STR | |
7636 | IP_STR | |
7637 | BGP_STR | |
7638 | "Clear peers with the AS number\n" | |
7639 | "Address family\n" | |
7640 | "Address Family modifier\n" | |
7641 | "Soft reconfig\n" | |
7642 | "Soft reconfig outbound update\n") | |
7643 | { | |
7644 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
7645 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7646 | } | |
7647 | ||
7648 | ALIAS (clear_ip_bgp_as_encap_soft_out, | |
7649 | clear_ip_bgp_as_encap_out_cmd, | |
7650 | "clear ip bgp " CMD_AS_RANGE " encap unicast out", | |
7651 | CLEAR_STR | |
7652 | IP_STR | |
7653 | BGP_STR | |
7654 | "Clear peers with the AS number\n" | |
7655 | "Address family\n" | |
7656 | "Address Family modifier\n" | |
7657 | "Soft reconfig outbound update\n") | |
7658 | ||
718e3744 | 7659 | DEFUN (clear_bgp_as_soft_out, |
7660 | clear_bgp_as_soft_out_cmd, | |
320da874 | 7661 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 7662 | CLEAR_STR |
7663 | BGP_STR | |
7664 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7665 | BGP_SOFT_STR |
7666 | BGP_SOFT_OUT_STR) | |
718e3744 | 7667 | { |
01080f7c | 7668 | if (argc == 3) |
7669 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
7670 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7671 | ||
718e3744 | 7672 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
7673 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7674 | } | |
7675 | ||
01080f7c | 7676 | ALIAS (clear_bgp_as_soft_out, |
7677 | clear_bgp_instance_as_soft_out_cmd, | |
7678 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", | |
7679 | CLEAR_STR | |
7680 | BGP_STR | |
7681 | BGP_INSTANCE_HELP_STR | |
7682 | "Clear peers with the AS number\n" | |
7683 | BGP_SOFT_STR | |
7684 | BGP_SOFT_OUT_STR) | |
7685 | ||
718e3744 | 7686 | ALIAS (clear_bgp_as_soft_out, |
7687 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 7688 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 7689 | CLEAR_STR |
7690 | BGP_STR | |
7691 | "Address family\n" | |
7692 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7693 | BGP_SOFT_STR |
7694 | BGP_SOFT_OUT_STR) | |
718e3744 | 7695 | |
01080f7c | 7696 | ALIAS (clear_bgp_as_soft_out, |
7697 | clear_bgp_instance_ipv6_as_soft_out_cmd, | |
7698 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft out", | |
7699 | CLEAR_STR | |
7700 | BGP_STR | |
7701 | BGP_INSTANCE_HELP_STR | |
7702 | "Address family\n" | |
7703 | "Clear peers with the AS number\n" | |
7704 | BGP_SOFT_STR | |
7705 | BGP_SOFT_OUT_STR) | |
7706 | ||
718e3744 | 7707 | ALIAS (clear_bgp_as_soft_out, |
7708 | clear_bgp_as_out_cmd, | |
320da874 | 7709 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 7710 | CLEAR_STR |
7711 | BGP_STR | |
7712 | "Clear peers with the AS number\n" | |
e0bce756 | 7713 | BGP_SOFT_OUT_STR) |
718e3744 | 7714 | |
01080f7c | 7715 | ALIAS (clear_bgp_as_soft_out, |
7716 | clear_bgp_instance_as_out_cmd, | |
7717 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", | |
7718 | CLEAR_STR | |
7719 | BGP_STR | |
7720 | BGP_INSTANCE_HELP_STR | |
7721 | "Clear peers with the AS number\n" | |
7722 | BGP_SOFT_OUT_STR) | |
7723 | ||
718e3744 | 7724 | ALIAS (clear_bgp_as_soft_out, |
7725 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 7726 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 7727 | CLEAR_STR |
7728 | BGP_STR | |
7729 | "Address family\n" | |
7730 | "Clear peers with the AS number\n" | |
e0bce756 | 7731 | BGP_SOFT_OUT_STR) |
6b0655a2 | 7732 | |
01080f7c | 7733 | ALIAS (clear_bgp_as_soft_out, |
7734 | clear_bgp_instance_ipv6_as_out_cmd, | |
7735 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " out", | |
7736 | CLEAR_STR | |
7737 | BGP_STR | |
7738 | BGP_INSTANCE_HELP_STR | |
7739 | "Address family\n" | |
7740 | "Clear peers with the AS number\n" | |
7741 | BGP_SOFT_OUT_STR) | |
7742 | ||
718e3744 | 7743 | /* Inbound soft-reconfiguration */ |
7744 | DEFUN (clear_ip_bgp_all_soft_in, | |
7745 | clear_ip_bgp_all_soft_in_cmd, | |
7746 | "clear ip bgp * soft in", | |
7747 | CLEAR_STR | |
7748 | IP_STR | |
7749 | BGP_STR | |
7750 | "Clear all peers\n" | |
e0bce756 DS |
7751 | BGP_SOFT_STR |
7752 | BGP_SOFT_IN_STR) | |
718e3744 | 7753 | { |
6aeb9e78 DS |
7754 | if (argc == 2) |
7755 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 7756 | BGP_CLEAR_SOFT_IN, NULL); |
7757 | ||
7758 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7759 | BGP_CLEAR_SOFT_IN, NULL); | |
7760 | } | |
7761 | ||
7762 | ALIAS (clear_ip_bgp_all_soft_in, | |
7763 | clear_ip_bgp_instance_all_soft_in_cmd, | |
8386ac43 | 7764 | "clear ip bgp " BGP_INSTANCE_CMD " * soft in", |
718e3744 | 7765 | CLEAR_STR |
7766 | IP_STR | |
7767 | BGP_STR | |
8386ac43 | 7768 | BGP_INSTANCE_HELP_STR |
718e3744 | 7769 | "Clear all peers\n" |
e0bce756 DS |
7770 | BGP_SOFT_STR |
7771 | BGP_SOFT_IN_STR) | |
718e3744 | 7772 | |
7773 | ALIAS (clear_ip_bgp_all_soft_in, | |
7774 | clear_ip_bgp_all_in_cmd, | |
7775 | "clear ip bgp * in", | |
7776 | CLEAR_STR | |
7777 | IP_STR | |
7778 | BGP_STR | |
7779 | "Clear all peers\n" | |
e0bce756 | 7780 | BGP_SOFT_IN_STR) |
718e3744 | 7781 | |
01080f7c | 7782 | ALIAS (clear_ip_bgp_all_soft_in, |
7783 | clear_ip_bgp_instance_all_in_cmd, | |
7784 | "clear ip bgp " BGP_INSTANCE_CMD " * in", | |
7785 | CLEAR_STR | |
7786 | IP_STR | |
7787 | BGP_STR | |
7788 | BGP_INSTANCE_HELP_STR | |
7789 | "Clear all peers\n" | |
7790 | BGP_SOFT_IN_STR) | |
7791 | ||
718e3744 | 7792 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
7793 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
7794 | "clear ip bgp * in prefix-filter", | |
7795 | CLEAR_STR | |
7796 | IP_STR | |
7797 | BGP_STR | |
7798 | "Clear all peers\n" | |
e0bce756 | 7799 | BGP_SOFT_IN_STR |
718e3744 | 7800 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7801 | { | |
6aeb9e78 DS |
7802 | if (argc== 2) |
7803 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 7804 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
7805 | ||
7806 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7807 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7808 | } | |
7809 | ||
718e3744 | 7810 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
7811 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
7812 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
7813 | CLEAR_STR | |
7814 | IP_STR | |
7815 | BGP_STR | |
7816 | "Clear all peers\n" | |
7817 | "Address family\n" | |
7818 | "Address Family modifier\n" | |
7819 | "Address Family modifier\n" | |
e0bce756 DS |
7820 | BGP_SOFT_STR |
7821 | BGP_SOFT_IN_STR) | |
718e3744 | 7822 | { |
7823 | if (strncmp (argv[0], "m", 1) == 0) | |
7824 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7825 | BGP_CLEAR_SOFT_IN, NULL); | |
7826 | ||
7827 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7828 | BGP_CLEAR_SOFT_IN, NULL); | |
7829 | } | |
7830 | ||
718e3744 | 7831 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
7832 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
8386ac43 | 7833 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft in", |
718e3744 | 7834 | CLEAR_STR |
7835 | IP_STR | |
7836 | BGP_STR | |
8386ac43 | 7837 | BGP_INSTANCE_HELP_STR |
718e3744 | 7838 | "Clear all peers\n" |
7839 | "Address family\n" | |
7840 | "Address Family modifier\n" | |
7841 | "Address Family modifier\n" | |
e0bce756 DS |
7842 | BGP_SOFT_STR |
7843 | BGP_SOFT_IN_STR) | |
718e3744 | 7844 | { |
6aeb9e78 DS |
7845 | if (strncmp (argv[2], "m", 1) == 0) |
7846 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, | |
718e3744 | 7847 | BGP_CLEAR_SOFT_IN, NULL); |
7848 | ||
6aeb9e78 | 7849 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, |
718e3744 | 7850 | BGP_CLEAR_SOFT_IN, NULL); |
7851 | } | |
7852 | ||
01080f7c | 7853 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
7854 | clear_ip_bgp_all_ipv4_in_cmd, | |
7855 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
718e3744 | 7856 | CLEAR_STR |
7857 | IP_STR | |
7858 | BGP_STR | |
7859 | "Clear all peers\n" | |
7860 | "Address family\n" | |
7861 | "Address Family modifier\n" | |
7862 | "Address Family modifier\n" | |
01080f7c | 7863 | BGP_SOFT_IN_STR) |
718e3744 | 7864 | |
01080f7c | 7865 | ALIAS (clear_ip_bgp_instance_all_ipv4_soft_in, |
7866 | clear_ip_bgp_instance_all_ipv4_in_cmd, | |
7867 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) in", | |
7868 | CLEAR_STR | |
7869 | IP_STR | |
7870 | BGP_STR | |
7871 | BGP_INSTANCE_HELP_STR | |
7872 | "Clear all peers\n" | |
7873 | "Address family\n" | |
7874 | "Address Family modifier\n" | |
7875 | "Address Family modifier\n" | |
7876 | BGP_SOFT_IN_STR) | |
718e3744 | 7877 | |
01080f7c | 7878 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
7879 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
7880 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
718e3744 | 7881 | CLEAR_STR |
7882 | IP_STR | |
7883 | BGP_STR | |
7884 | "Clear all peers\n" | |
7885 | "Address family\n" | |
7886 | "Address Family modifier\n" | |
7887 | "Address Family modifier\n" | |
e0bce756 | 7888 | BGP_SOFT_IN_STR |
718e3744 | 7889 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7890 | { | |
01080f7c | 7891 | if (strncmp (argv[0], "m", 1) == 0) |
7892 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7893 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
718e3744 | 7894 | |
01080f7c | 7895 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
7896 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
718e3744 | 7897 | } |
7898 | ||
7899 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
7900 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
7901 | "clear ip bgp * vpnv4 unicast soft in", | |
7902 | CLEAR_STR | |
7903 | IP_STR | |
7904 | BGP_STR | |
7905 | "Clear all peers\n" | |
7906 | "Address family\n" | |
7907 | "Address Family Modifier\n" | |
e0bce756 DS |
7908 | BGP_SOFT_STR |
7909 | BGP_SOFT_IN_STR) | |
718e3744 | 7910 | { |
7911 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
7912 | BGP_CLEAR_SOFT_IN, NULL); | |
7913 | } | |
7914 | ||
7915 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
7916 | clear_ip_bgp_all_vpnv4_in_cmd, | |
7917 | "clear ip bgp * vpnv4 unicast in", | |
7918 | CLEAR_STR | |
7919 | IP_STR | |
7920 | BGP_STR | |
7921 | "Clear all peers\n" | |
7922 | "Address family\n" | |
7923 | "Address Family Modifier\n" | |
e0bce756 | 7924 | BGP_SOFT_IN_STR) |
718e3744 | 7925 | |
587ff0fd LB |
7926 | DEFUN (clear_ip_bgp_all_encap_soft_in, |
7927 | clear_ip_bgp_all_encap_soft_in_cmd, | |
7928 | "clear ip bgp * encap unicast soft in", | |
7929 | CLEAR_STR | |
7930 | IP_STR | |
7931 | BGP_STR | |
7932 | "Clear all peers\n" | |
7933 | "Address family\n" | |
7934 | "Address Family Modifier\n" | |
7935 | "Soft reconfig\n" | |
7936 | "Soft reconfig inbound update\n") | |
7937 | { | |
7938 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
7939 | BGP_CLEAR_SOFT_IN, NULL); | |
7940 | } | |
7941 | ||
7942 | ALIAS (clear_ip_bgp_all_encap_soft_in, | |
7943 | clear_ip_bgp_all_encap_in_cmd, | |
7944 | "clear ip bgp * encap unicast in", | |
7945 | CLEAR_STR | |
7946 | IP_STR | |
7947 | BGP_STR | |
7948 | "Clear all peers\n" | |
7949 | "Address family\n" | |
7950 | "Address Family Modifier\n" | |
7951 | "Soft reconfig inbound update\n") | |
7952 | ||
718e3744 | 7953 | DEFUN (clear_bgp_all_soft_in, |
7954 | clear_bgp_all_soft_in_cmd, | |
7955 | "clear bgp * soft in", | |
7956 | CLEAR_STR | |
7957 | BGP_STR | |
7958 | "Clear all peers\n" | |
e0bce756 DS |
7959 | BGP_SOFT_STR |
7960 | BGP_SOFT_IN_STR) | |
718e3744 | 7961 | { |
6aeb9e78 DS |
7962 | if (argc == 2) |
7963 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
718e3744 | 7964 | BGP_CLEAR_SOFT_IN, NULL); |
7965 | ||
7966 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7967 | BGP_CLEAR_SOFT_IN, NULL); | |
7968 | } | |
7969 | ||
7970 | ALIAS (clear_bgp_all_soft_in, | |
7971 | clear_bgp_instance_all_soft_in_cmd, | |
8386ac43 | 7972 | "clear bgp " BGP_INSTANCE_CMD " * soft in", |
718e3744 | 7973 | CLEAR_STR |
7974 | BGP_STR | |
8386ac43 | 7975 | BGP_INSTANCE_HELP_STR |
718e3744 | 7976 | "Clear all peers\n" |
e0bce756 DS |
7977 | BGP_SOFT_STR |
7978 | BGP_SOFT_IN_STR) | |
718e3744 | 7979 | |
7980 | ALIAS (clear_bgp_all_soft_in, | |
7981 | clear_bgp_ipv6_all_soft_in_cmd, | |
7982 | "clear bgp ipv6 * soft in", | |
7983 | CLEAR_STR | |
7984 | BGP_STR | |
7985 | "Address family\n" | |
7986 | "Clear all peers\n" | |
e0bce756 DS |
7987 | BGP_SOFT_STR |
7988 | BGP_SOFT_IN_STR) | |
718e3744 | 7989 | |
01080f7c | 7990 | ALIAS (clear_bgp_all_soft_in, |
7991 | clear_bgp_instance_ipv6_all_soft_in_cmd, | |
7992 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft in", | |
7993 | CLEAR_STR | |
7994 | BGP_STR | |
7995 | BGP_INSTANCE_HELP_STR | |
7996 | "Address family\n" | |
7997 | "Clear all peers\n" | |
7998 | BGP_SOFT_STR | |
7999 | BGP_SOFT_IN_STR) | |
8000 | ||
718e3744 | 8001 | ALIAS (clear_bgp_all_soft_in, |
8002 | clear_bgp_all_in_cmd, | |
8003 | "clear bgp * in", | |
8004 | CLEAR_STR | |
8005 | BGP_STR | |
8006 | "Clear all peers\n" | |
e0bce756 | 8007 | BGP_SOFT_IN_STR) |
718e3744 | 8008 | |
01080f7c | 8009 | ALIAS (clear_bgp_all_soft_in, |
8010 | clear_bgp_instance_all_in_cmd, | |
8011 | "clear bgp " BGP_INSTANCE_CMD " * in", | |
8012 | CLEAR_STR | |
8013 | BGP_STR | |
8014 | BGP_INSTANCE_HELP_STR | |
8015 | "Clear all peers\n" | |
8016 | BGP_SOFT_IN_STR) | |
8017 | ||
718e3744 | 8018 | ALIAS (clear_bgp_all_soft_in, |
8019 | clear_bgp_ipv6_all_in_cmd, | |
8020 | "clear bgp ipv6 * in", | |
8021 | CLEAR_STR | |
8022 | BGP_STR | |
8023 | "Address family\n" | |
8024 | "Clear all peers\n" | |
e0bce756 | 8025 | BGP_SOFT_IN_STR) |
718e3744 | 8026 | |
01080f7c | 8027 | ALIAS (clear_bgp_all_soft_in, |
8028 | clear_bgp_instance_ipv6_all_in_cmd, | |
8029 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * in", | |
8030 | CLEAR_STR | |
8031 | BGP_STR | |
8032 | BGP_INSTANCE_HELP_STR | |
8033 | "Address family\n" | |
8034 | "Clear all peers\n" | |
8035 | BGP_SOFT_IN_STR) | |
8036 | ||
718e3744 | 8037 | DEFUN (clear_bgp_all_in_prefix_filter, |
8038 | clear_bgp_all_in_prefix_filter_cmd, | |
8039 | "clear bgp * in prefix-filter", | |
8040 | CLEAR_STR | |
8041 | BGP_STR | |
8042 | "Clear all peers\n" | |
e0bce756 | 8043 | BGP_SOFT_IN_STR |
718e3744 | 8044 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8045 | { | |
8046 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
8047 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8048 | } | |
8049 | ||
8050 | ALIAS (clear_bgp_all_in_prefix_filter, | |
8051 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
8052 | "clear bgp ipv6 * in prefix-filter", | |
8053 | CLEAR_STR | |
8054 | BGP_STR | |
8055 | "Address family\n" | |
8056 | "Clear all peers\n" | |
e0bce756 | 8057 | BGP_SOFT_IN_STR |
718e3744 | 8058 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8059 | ||
8060 | DEFUN (clear_ip_bgp_peer_soft_in, | |
8061 | clear_ip_bgp_peer_soft_in_cmd, | |
db64ea86 | 8062 | "clear ip bgp (A.B.C.D|WORD) soft in", |
718e3744 | 8063 | CLEAR_STR |
8064 | IP_STR | |
8065 | BGP_STR | |
8066 | "BGP neighbor address to clear\n" | |
db64ea86 | 8067 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
8068 | BGP_SOFT_STR |
8069 | BGP_SOFT_IN_STR) | |
718e3744 | 8070 | { |
01080f7c | 8071 | if (argc == 3) |
8072 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
8073 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8074 | ||
718e3744 | 8075 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
8076 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8077 | } | |
8078 | ||
01080f7c | 8079 | ALIAS (clear_ip_bgp_peer_soft_in, |
8080 | clear_ip_bgp_instance_peer_soft_in_cmd, | |
8081 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft in", | |
8082 | CLEAR_STR | |
8083 | IP_STR | |
8084 | BGP_STR | |
8085 | BGP_INSTANCE_HELP_STR | |
8086 | "BGP neighbor address to clear\n" | |
8087 | "BGP neighbor on interface to clear\n" | |
8088 | BGP_SOFT_STR | |
8089 | BGP_SOFT_IN_STR) | |
8090 | ||
718e3744 | 8091 | ALIAS (clear_ip_bgp_peer_soft_in, |
8092 | clear_ip_bgp_peer_in_cmd, | |
db64ea86 | 8093 | "clear ip bgp (A.B.C.D|WORD) in", |
718e3744 | 8094 | CLEAR_STR |
8095 | IP_STR | |
8096 | BGP_STR | |
8097 | "BGP neighbor address to clear\n" | |
db64ea86 | 8098 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8099 | BGP_SOFT_IN_STR) |
01080f7c | 8100 | |
8101 | ALIAS (clear_ip_bgp_peer_soft_in, | |
8102 | clear_ip_bgp_instance_peer_in_cmd, | |
8103 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) in", | |
8104 | CLEAR_STR | |
8105 | IP_STR | |
8106 | BGP_STR | |
8107 | BGP_INSTANCE_HELP_STR | |
8108 | "BGP neighbor address to clear\n" | |
8109 | "BGP neighbor on interface to clear\n" | |
8110 | BGP_SOFT_IN_STR) | |
8111 | ||
718e3744 | 8112 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
8113 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
db64ea86 | 8114 | "clear ip bgp (A.B.C.D|WORD) in prefix-filter", |
718e3744 | 8115 | CLEAR_STR |
8116 | IP_STR | |
8117 | BGP_STR | |
8118 | "BGP neighbor address to clear\n" | |
db64ea86 | 8119 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8120 | BGP_SOFT_IN_STR |
718e3744 | 8121 | "Push out the existing ORF prefix-list\n") |
8122 | { | |
8123 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8124 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8125 | } | |
8126 | ||
8127 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
8128 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
db64ea86 | 8129 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", |
718e3744 | 8130 | CLEAR_STR |
8131 | IP_STR | |
8132 | BGP_STR | |
8133 | "BGP neighbor address to clear\n" | |
db64ea86 | 8134 | "BGP neighbor on interface to clear\n" |
718e3744 | 8135 | "Address family\n" |
8136 | "Address Family modifier\n" | |
8137 | "Address Family modifier\n" | |
e0bce756 DS |
8138 | BGP_SOFT_STR |
8139 | BGP_SOFT_IN_STR) | |
718e3744 | 8140 | { |
8141 | if (strncmp (argv[1], "m", 1) == 0) | |
8142 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
8143 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8144 | ||
8145 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8146 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8147 | } | |
8148 | ||
01080f7c | 8149 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, |
8150 | clear_ip_bgp_instance_peer_ipv4_soft_in_cmd, | |
8151 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", | |
8152 | CLEAR_STR | |
8153 | IP_STR | |
8154 | BGP_STR | |
8155 | BGP_INSTANCE_HELP_STR | |
8156 | "BGP neighbor address to clear\n" | |
8157 | "BGP neighbor on interface to clear\n" | |
8158 | "Address family\n" | |
8159 | "Address Family modifier\n" | |
8160 | "Address Family modifier\n" | |
8161 | BGP_SOFT_STR | |
8162 | BGP_SOFT_IN_STR) | |
8163 | { | |
8164 | if (strncmp (argv[3], "m", 1) == 0) | |
8165 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, | |
8166 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8167 | ||
8168 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
8169 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8170 | } | |
8171 | ||
718e3744 | 8172 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
8173 | clear_ip_bgp_peer_ipv4_in_cmd, | |
db64ea86 | 8174 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in", |
718e3744 | 8175 | CLEAR_STR |
8176 | IP_STR | |
8177 | BGP_STR | |
8178 | "BGP neighbor address to clear\n" | |
db64ea86 | 8179 | "BGP neighbor on interface to clear\n" |
718e3744 | 8180 | "Address family\n" |
8181 | "Address Family modifier\n" | |
8182 | "Address Family modifier\n" | |
e0bce756 | 8183 | BGP_SOFT_IN_STR) |
718e3744 | 8184 | |
01080f7c | 8185 | ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_in, |
8186 | clear_ip_bgp_instance_peer_ipv4_in_cmd, | |
8187 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) in", | |
8188 | CLEAR_STR | |
8189 | IP_STR | |
8190 | BGP_STR | |
8191 | BGP_INSTANCE_HELP_STR | |
8192 | "BGP neighbor address to clear\n" | |
8193 | "BGP neighbor on interface to clear\n" | |
8194 | "Address family\n" | |
8195 | "Address Family modifier\n" | |
8196 | "Address Family modifier\n" | |
8197 | BGP_SOFT_IN_STR) | |
8198 | ||
718e3744 | 8199 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
8200 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
db64ea86 | 8201 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 8202 | CLEAR_STR |
8203 | IP_STR | |
8204 | BGP_STR | |
8205 | "BGP neighbor address to clear\n" | |
db64ea86 | 8206 | "BGP neighbor on interface to clear\n" |
718e3744 | 8207 | "Address family\n" |
8208 | "Address Family modifier\n" | |
8209 | "Address Family modifier\n" | |
e0bce756 | 8210 | BGP_SOFT_IN_STR |
718e3744 | 8211 | "Push out the existing ORF prefix-list\n") |
8212 | { | |
8213 | if (strncmp (argv[1], "m", 1) == 0) | |
8214 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
8215 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8216 | ||
8217 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8218 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8219 | } | |
8220 | ||
8221 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
8222 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
db64ea86 | 8223 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in", |
718e3744 | 8224 | CLEAR_STR |
8225 | IP_STR | |
8226 | BGP_STR | |
8227 | "BGP neighbor address to clear\n" | |
db64ea86 | 8228 | "BGP neighbor on interface to clear\n" |
718e3744 | 8229 | "Address family\n" |
8230 | "Address Family Modifier\n" | |
e0bce756 DS |
8231 | BGP_SOFT_STR |
8232 | BGP_SOFT_IN_STR) | |
718e3744 | 8233 | { |
8234 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
8235 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8236 | } | |
8237 | ||
8238 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
8239 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
db64ea86 | 8240 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in", |
718e3744 | 8241 | CLEAR_STR |
8242 | IP_STR | |
8243 | BGP_STR | |
8244 | "BGP neighbor address to clear\n" | |
db64ea86 | 8245 | "BGP neighbor on interface to clear\n" |
718e3744 | 8246 | "Address family\n" |
8247 | "Address Family Modifier\n" | |
e0bce756 | 8248 | BGP_SOFT_IN_STR) |
718e3744 | 8249 | |
587ff0fd LB |
8250 | DEFUN (clear_ip_bgp_peer_encap_soft_in, |
8251 | clear_ip_bgp_peer_encap_soft_in_cmd, | |
8252 | "clear ip bgp A.B.C.D encap unicast soft in", | |
8253 | CLEAR_STR | |
8254 | IP_STR | |
8255 | BGP_STR | |
8256 | "BGP neighbor address to clear\n" | |
8257 | "Address family\n" | |
8258 | "Address Family Modifier\n" | |
8259 | "Soft reconfig\n" | |
8260 | "Soft reconfig inbound update\n") | |
8261 | { | |
8262 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
8263 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8264 | } | |
8265 | ||
8266 | ALIAS (clear_ip_bgp_peer_encap_soft_in, | |
8267 | clear_ip_bgp_peer_encap_in_cmd, | |
8268 | "clear ip bgp A.B.C.D encap unicast in", | |
8269 | CLEAR_STR | |
8270 | IP_STR | |
8271 | BGP_STR | |
8272 | "BGP neighbor address to clear\n" | |
8273 | "Address family\n" | |
8274 | "Address Family Modifier\n" | |
8275 | "Soft reconfig inbound update\n") | |
8276 | ||
718e3744 | 8277 | DEFUN (clear_bgp_peer_soft_in, |
8278 | clear_bgp_peer_soft_in_cmd, | |
a80beece | 8279 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 8280 | CLEAR_STR |
8281 | BGP_STR | |
8282 | "BGP neighbor address to clear\n" | |
8283 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8284 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
8285 | BGP_SOFT_STR |
8286 | BGP_SOFT_IN_STR) | |
718e3744 | 8287 | { |
01080f7c | 8288 | if (argc == 3) |
8289 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
8290 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8291 | ||
718e3744 | 8292 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
8293 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8294 | } | |
8295 | ||
01080f7c | 8296 | ALIAS (clear_bgp_peer_soft_in, |
8297 | clear_bgp_instance_peer_soft_in_cmd, | |
8298 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft in", | |
8299 | CLEAR_STR | |
8300 | BGP_STR | |
8301 | BGP_INSTANCE_HELP_STR | |
8302 | "BGP neighbor address to clear\n" | |
8303 | "BGP IPv6 neighbor to clear\n" | |
8304 | "BGP neighbor on interface to clear\n" | |
8305 | BGP_SOFT_STR | |
8306 | BGP_SOFT_IN_STR) | |
8307 | ||
718e3744 | 8308 | ALIAS (clear_bgp_peer_soft_in, |
8309 | clear_bgp_ipv6_peer_soft_in_cmd, | |
a80beece | 8310 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 8311 | CLEAR_STR |
8312 | BGP_STR | |
8313 | "Address family\n" | |
8314 | "BGP neighbor address to clear\n" | |
8315 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8316 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
8317 | BGP_SOFT_STR |
8318 | BGP_SOFT_IN_STR) | |
718e3744 | 8319 | |
01080f7c | 8320 | ALIAS (clear_bgp_peer_soft_in, |
8321 | clear_bgp_instance_ipv6_peer_soft_in_cmd, | |
8322 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", | |
8323 | CLEAR_STR | |
8324 | BGP_STR | |
8325 | BGP_INSTANCE_HELP_STR | |
8326 | "Address family\n" | |
8327 | "BGP neighbor address to clear\n" | |
8328 | "BGP IPv6 neighbor to clear\n" | |
8329 | "BGP neighbor on interface to clear\n" | |
8330 | BGP_SOFT_STR | |
8331 | BGP_SOFT_IN_STR) | |
8332 | ||
718e3744 | 8333 | ALIAS (clear_bgp_peer_soft_in, |
8334 | clear_bgp_peer_in_cmd, | |
a80beece | 8335 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 8336 | CLEAR_STR |
8337 | BGP_STR | |
8338 | "BGP neighbor address to clear\n" | |
8339 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8340 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8341 | BGP_SOFT_IN_STR) |
718e3744 | 8342 | |
01080f7c | 8343 | ALIAS (clear_bgp_peer_soft_in, |
8344 | clear_bgp_instance_peer_in_cmd, | |
8345 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) in", | |
8346 | CLEAR_STR | |
8347 | BGP_STR | |
8348 | BGP_INSTANCE_HELP_STR | |
8349 | "BGP neighbor address to clear\n" | |
8350 | "BGP IPv6 neighbor to clear\n" | |
8351 | "BGP neighbor on interface to clear\n" | |
8352 | BGP_SOFT_IN_STR) | |
8353 | ||
718e3744 | 8354 | ALIAS (clear_bgp_peer_soft_in, |
8355 | clear_bgp_ipv6_peer_in_cmd, | |
a80beece | 8356 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 8357 | CLEAR_STR |
8358 | BGP_STR | |
8359 | "Address family\n" | |
8360 | "BGP neighbor address to clear\n" | |
8361 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8362 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8363 | BGP_SOFT_IN_STR) |
718e3744 | 8364 | |
01080f7c | 8365 | ALIAS (clear_bgp_peer_soft_in, |
8366 | clear_bgp_instance_ipv6_peer_in_cmd, | |
8367 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) in", | |
8368 | CLEAR_STR | |
8369 | BGP_STR | |
8370 | BGP_INSTANCE_HELP_STR | |
8371 | "Address family\n" | |
8372 | "BGP neighbor address to clear\n" | |
8373 | "BGP IPv6 neighbor to clear\n" | |
8374 | "BGP neighbor on interface to clear\n" | |
8375 | BGP_SOFT_IN_STR) | |
8376 | ||
718e3744 | 8377 | DEFUN (clear_bgp_peer_in_prefix_filter, |
8378 | clear_bgp_peer_in_prefix_filter_cmd, | |
a80beece | 8379 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 8380 | CLEAR_STR |
8381 | BGP_STR | |
8382 | "BGP neighbor address to clear\n" | |
8383 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8384 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8385 | BGP_SOFT_IN_STR |
718e3744 | 8386 | "Push out the existing ORF prefix-list\n") |
8387 | { | |
8388 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
8389 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8390 | } | |
8391 | ||
8392 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
8393 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
a80beece | 8394 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 8395 | CLEAR_STR |
8396 | BGP_STR | |
8397 | "Address family\n" | |
8398 | "BGP neighbor address to clear\n" | |
8399 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8400 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8401 | BGP_SOFT_IN_STR |
718e3744 | 8402 | "Push out the existing ORF prefix-list\n") |
8403 | ||
8404 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
8405 | clear_ip_bgp_peer_group_soft_in_cmd, | |
8406 | "clear ip bgp peer-group WORD soft in", | |
8407 | CLEAR_STR | |
8408 | IP_STR | |
8409 | BGP_STR | |
8410 | "Clear all members of peer-group\n" | |
8411 | "BGP peer-group name\n" | |
e0bce756 DS |
8412 | BGP_SOFT_STR |
8413 | BGP_SOFT_IN_STR) | |
718e3744 | 8414 | { |
01080f7c | 8415 | if (argc == 3) |
8416 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
8417 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8418 | ||
718e3744 | 8419 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
8420 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8421 | } | |
8422 | ||
01080f7c | 8423 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
8424 | clear_ip_bgp_instance_peer_group_soft_in_cmd, | |
8425 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", | |
8426 | CLEAR_STR | |
8427 | IP_STR | |
8428 | BGP_STR | |
8429 | BGP_INSTANCE_HELP_STR | |
8430 | "Clear all members of peer-group\n" | |
8431 | "BGP peer-group name\n" | |
8432 | BGP_SOFT_STR | |
8433 | BGP_SOFT_IN_STR) | |
8434 | ||
718e3744 | 8435 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
8436 | clear_ip_bgp_peer_group_in_cmd, | |
8437 | "clear ip bgp peer-group WORD in", | |
8438 | CLEAR_STR | |
8439 | IP_STR | |
8440 | BGP_STR | |
8441 | "Clear all members of peer-group\n" | |
8442 | "BGP peer-group name\n" | |
e0bce756 | 8443 | BGP_SOFT_IN_STR) |
718e3744 | 8444 | |
01080f7c | 8445 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
8446 | clear_ip_bgp_instance_peer_group_in_cmd, | |
8447 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD in", | |
8448 | CLEAR_STR | |
8449 | IP_STR | |
8450 | BGP_STR | |
8451 | BGP_INSTANCE_HELP_STR | |
8452 | "Clear all members of peer-group\n" | |
8453 | "BGP peer-group name\n" | |
8454 | BGP_SOFT_IN_STR) | |
8455 | ||
718e3744 | 8456 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
8457 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
8458 | "clear ip bgp peer-group WORD in prefix-filter", | |
8459 | CLEAR_STR | |
8460 | IP_STR | |
8461 | BGP_STR | |
8462 | "Clear all members of peer-group\n" | |
8463 | "BGP peer-group name\n" | |
e0bce756 | 8464 | BGP_SOFT_IN_STR |
718e3744 | 8465 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8466 | { | |
8467 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
8468 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8469 | } | |
8470 | ||
8471 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
8472 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
8473 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
8474 | CLEAR_STR | |
8475 | IP_STR | |
8476 | BGP_STR | |
8477 | "Clear all members of peer-group\n" | |
8478 | "BGP peer-group name\n" | |
8479 | "Address family\n" | |
8480 | "Address Family modifier\n" | |
8481 | "Address Family modifier\n" | |
e0bce756 DS |
8482 | BGP_SOFT_STR |
8483 | BGP_SOFT_IN_STR) | |
718e3744 | 8484 | { |
8485 | if (strncmp (argv[1], "m", 1) == 0) | |
8486 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
8487 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8488 | ||
8489 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
8490 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8491 | } | |
8492 | ||
01080f7c | 8493 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, |
8494 | clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd, | |
8495 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft in", | |
8496 | CLEAR_STR | |
8497 | IP_STR | |
8498 | BGP_STR | |
8499 | BGP_INSTANCE_HELP_STR | |
8500 | "Clear all members of peer-group\n" | |
8501 | "BGP peer-group name\n" | |
8502 | "Address family\n" | |
8503 | "Address Family modifier\n" | |
8504 | "Address Family modifier\n" | |
8505 | BGP_SOFT_STR | |
8506 | BGP_SOFT_IN_STR) | |
8507 | { | |
8508 | if (strncmp (argv[3], "m", 1) == 0) | |
8509 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, | |
8510 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8511 | ||
8512 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
8513 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8514 | } | |
8515 | ||
718e3744 | 8516 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
8517 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
8518 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
8519 | CLEAR_STR | |
8520 | IP_STR | |
8521 | BGP_STR | |
8522 | "Clear all members of peer-group\n" | |
8523 | "BGP peer-group name\n" | |
8524 | "Address family\n" | |
8525 | "Address Family modifier\n" | |
8526 | "Address Family modifier\n" | |
e0bce756 | 8527 | BGP_SOFT_IN_STR) |
718e3744 | 8528 | |
01080f7c | 8529 | ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_in, |
8530 | clear_ip_bgp_instance_peer_group_ipv4_in_cmd, | |
8531 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) in", | |
8532 | CLEAR_STR | |
8533 | IP_STR | |
8534 | BGP_STR | |
8535 | BGP_INSTANCE_HELP_STR | |
8536 | "Clear all members of peer-group\n" | |
8537 | "BGP peer-group name\n" | |
8538 | "Address family\n" | |
8539 | "Address Family modifier\n" | |
8540 | "Address Family modifier\n" | |
8541 | BGP_SOFT_IN_STR) | |
8542 | ||
718e3744 | 8543 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
8544 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
8545 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
8546 | CLEAR_STR | |
8547 | IP_STR | |
8548 | BGP_STR | |
8549 | "Clear all members of peer-group\n" | |
8550 | "BGP peer-group name\n" | |
8551 | "Address family\n" | |
8552 | "Address Family modifier\n" | |
8553 | "Address Family modifier\n" | |
e0bce756 | 8554 | BGP_SOFT_IN_STR |
718e3744 | 8555 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8556 | { | |
8557 | if (strncmp (argv[1], "m", 1) == 0) | |
8558 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
8559 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8560 | ||
8561 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
8562 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8563 | } | |
8564 | ||
8565 | DEFUN (clear_bgp_peer_group_soft_in, | |
8566 | clear_bgp_peer_group_soft_in_cmd, | |
8567 | "clear bgp peer-group WORD soft in", | |
8568 | CLEAR_STR | |
8569 | BGP_STR | |
8570 | "Clear all members of peer-group\n" | |
8571 | "BGP peer-group name\n" | |
e0bce756 DS |
8572 | BGP_SOFT_STR |
8573 | BGP_SOFT_IN_STR) | |
718e3744 | 8574 | { |
01080f7c | 8575 | if (argc == 3) |
8576 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
8577 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8578 | ||
718e3744 | 8579 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
8580 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8581 | } | |
8582 | ||
01080f7c | 8583 | ALIAS (clear_bgp_peer_group_soft_in, |
8584 | clear_bgp_instance_peer_group_soft_in_cmd, | |
8585 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", | |
8586 | CLEAR_STR | |
8587 | BGP_STR | |
8588 | BGP_INSTANCE_HELP_STR | |
8589 | "Clear all members of peer-group\n" | |
8590 | "BGP peer-group name\n" | |
8591 | BGP_SOFT_STR | |
8592 | BGP_SOFT_IN_STR) | |
8593 | ||
718e3744 | 8594 | ALIAS (clear_bgp_peer_group_soft_in, |
8595 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
8596 | "clear bgp ipv6 peer-group WORD soft in", | |
8597 | CLEAR_STR | |
8598 | BGP_STR | |
8599 | "Address family\n" | |
8600 | "Clear all members of peer-group\n" | |
8601 | "BGP peer-group name\n" | |
e0bce756 DS |
8602 | BGP_SOFT_STR |
8603 | BGP_SOFT_IN_STR) | |
718e3744 | 8604 | |
01080f7c | 8605 | ALIAS (clear_bgp_peer_group_soft_in, |
8606 | clear_bgp_instance_ipv6_peer_group_soft_in_cmd, | |
8607 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft in", | |
8608 | CLEAR_STR | |
8609 | BGP_STR | |
8610 | BGP_INSTANCE_HELP_STR | |
8611 | "Address family\n" | |
8612 | "Clear all members of peer-group\n" | |
8613 | "BGP peer-group name\n" | |
8614 | BGP_SOFT_STR | |
8615 | BGP_SOFT_IN_STR) | |
8616 | ||
718e3744 | 8617 | ALIAS (clear_bgp_peer_group_soft_in, |
8618 | clear_bgp_peer_group_in_cmd, | |
8619 | "clear bgp peer-group WORD in", | |
8620 | CLEAR_STR | |
8621 | BGP_STR | |
8622 | "Clear all members of peer-group\n" | |
8623 | "BGP peer-group name\n" | |
e0bce756 | 8624 | BGP_SOFT_IN_STR) |
718e3744 | 8625 | |
01080f7c | 8626 | ALIAS (clear_bgp_peer_group_soft_in, |
8627 | clear_bgp_instance_peer_group_in_cmd, | |
8628 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD in", | |
8629 | CLEAR_STR | |
8630 | BGP_STR | |
8631 | BGP_INSTANCE_HELP_STR | |
8632 | "Clear all members of peer-group\n" | |
8633 | "BGP peer-group name\n" | |
8634 | BGP_SOFT_IN_STR) | |
8635 | ||
718e3744 | 8636 | ALIAS (clear_bgp_peer_group_soft_in, |
8637 | clear_bgp_ipv6_peer_group_in_cmd, | |
8638 | "clear bgp ipv6 peer-group WORD in", | |
8639 | CLEAR_STR | |
8640 | BGP_STR | |
8641 | "Address family\n" | |
8642 | "Clear all members of peer-group\n" | |
8643 | "BGP peer-group name\n" | |
e0bce756 | 8644 | BGP_SOFT_IN_STR) |
718e3744 | 8645 | |
01080f7c | 8646 | ALIAS (clear_bgp_peer_group_soft_in, |
8647 | clear_bgp_instance_ipv6_peer_group_in_cmd, | |
8648 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD in", | |
8649 | CLEAR_STR | |
8650 | BGP_STR | |
8651 | BGP_INSTANCE_HELP_STR | |
8652 | "Address family\n" | |
8653 | "Clear all members of peer-group\n" | |
8654 | "BGP peer-group name\n" | |
8655 | BGP_SOFT_IN_STR) | |
8656 | ||
718e3744 | 8657 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
8658 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
8659 | "clear bgp peer-group WORD in prefix-filter", | |
8660 | CLEAR_STR | |
8661 | BGP_STR | |
8662 | "Clear all members of peer-group\n" | |
8663 | "BGP peer-group name\n" | |
e0bce756 | 8664 | BGP_SOFT_IN_STR |
718e3744 | 8665 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8666 | { | |
8667 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
8668 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8669 | } | |
8670 | ||
8671 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
8672 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
8673 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
8674 | CLEAR_STR | |
8675 | BGP_STR | |
8676 | "Address family\n" | |
8677 | "Clear all members of peer-group\n" | |
8678 | "BGP peer-group name\n" | |
e0bce756 | 8679 | BGP_SOFT_IN_STR |
718e3744 | 8680 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8681 | ||
8682 | DEFUN (clear_ip_bgp_external_soft_in, | |
8683 | clear_ip_bgp_external_soft_in_cmd, | |
8684 | "clear ip bgp external soft in", | |
8685 | CLEAR_STR | |
8686 | IP_STR | |
8687 | BGP_STR | |
8688 | "Clear all external peers\n" | |
e0bce756 DS |
8689 | BGP_SOFT_STR |
8690 | BGP_SOFT_IN_STR) | |
718e3744 | 8691 | { |
01080f7c | 8692 | if (argc == 2) |
8693 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
8694 | BGP_CLEAR_SOFT_IN, NULL); | |
8695 | ||
718e3744 | 8696 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
8697 | BGP_CLEAR_SOFT_IN, NULL); | |
8698 | } | |
8699 | ||
01080f7c | 8700 | ALIAS (clear_ip_bgp_external_soft_in, |
8701 | clear_ip_bgp_instance_external_soft_in_cmd, | |
8702 | "clear ip bgp " BGP_INSTANCE_CMD " external soft in", | |
8703 | CLEAR_STR | |
8704 | IP_STR | |
8705 | BGP_STR | |
8706 | BGP_INSTANCE_HELP_STR | |
8707 | "Clear all external peers\n" | |
8708 | BGP_SOFT_STR | |
8709 | BGP_SOFT_IN_STR) | |
8710 | ||
718e3744 | 8711 | ALIAS (clear_ip_bgp_external_soft_in, |
8712 | clear_ip_bgp_external_in_cmd, | |
8713 | "clear ip bgp external in", | |
8714 | CLEAR_STR | |
8715 | IP_STR | |
8716 | BGP_STR | |
8717 | "Clear all external peers\n" | |
e0bce756 | 8718 | BGP_SOFT_IN_STR) |
718e3744 | 8719 | |
01080f7c | 8720 | ALIAS (clear_ip_bgp_external_soft_in, |
8721 | clear_ip_bgp_instance_external_in_cmd, | |
8722 | "clear ip bgp " BGP_INSTANCE_CMD " external in", | |
8723 | CLEAR_STR | |
8724 | IP_STR | |
8725 | BGP_STR | |
8726 | BGP_INSTANCE_HELP_STR | |
8727 | "Clear all external peers\n" | |
8728 | BGP_SOFT_IN_STR) | |
8729 | ||
718e3744 | 8730 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
8731 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
8732 | "clear ip bgp external in prefix-filter", | |
8733 | CLEAR_STR | |
8734 | IP_STR | |
8735 | BGP_STR | |
8736 | "Clear all external peers\n" | |
e0bce756 | 8737 | BGP_SOFT_IN_STR |
718e3744 | 8738 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8739 | { | |
8740 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8741 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8742 | } | |
8743 | ||
8744 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
8745 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
8746 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
8747 | CLEAR_STR | |
8748 | IP_STR | |
8749 | BGP_STR | |
8750 | "Clear all external peers\n" | |
8751 | "Address family\n" | |
8752 | "Address Family modifier\n" | |
8753 | "Address Family modifier\n" | |
e0bce756 DS |
8754 | BGP_SOFT_STR |
8755 | BGP_SOFT_IN_STR) | |
718e3744 | 8756 | { |
8757 | if (strncmp (argv[0], "m", 1) == 0) | |
8758 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
8759 | BGP_CLEAR_SOFT_IN, NULL); | |
8760 | ||
8761 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8762 | BGP_CLEAR_SOFT_IN, NULL); | |
8763 | } | |
8764 | ||
01080f7c | 8765 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, |
8766 | clear_ip_bgp_instance_external_ipv4_soft_in_cmd, | |
8767 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft in", | |
8768 | CLEAR_STR | |
8769 | IP_STR | |
8770 | BGP_STR | |
8771 | BGP_INSTANCE_HELP_STR | |
8772 | "Clear all external peers\n" | |
8773 | "Address family\n" | |
8774 | "Address Family modifier\n" | |
8775 | "Address Family modifier\n" | |
8776 | BGP_SOFT_STR | |
8777 | BGP_SOFT_IN_STR) | |
8778 | { | |
8779 | if (strncmp (argv[2], "m", 1) == 0) | |
8780 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, | |
8781 | BGP_CLEAR_SOFT_IN, NULL); | |
8782 | ||
8783 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
8784 | BGP_CLEAR_SOFT_IN, NULL); | |
8785 | } | |
8786 | ||
718e3744 | 8787 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
8788 | clear_ip_bgp_external_ipv4_in_cmd, | |
8789 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
8790 | CLEAR_STR | |
8791 | IP_STR | |
8792 | BGP_STR | |
8793 | "Clear all external peers\n" | |
8794 | "Address family\n" | |
8795 | "Address Family modifier\n" | |
8796 | "Address Family modifier\n" | |
e0bce756 | 8797 | BGP_SOFT_IN_STR) |
718e3744 | 8798 | |
01080f7c | 8799 | ALIAS (clear_ip_bgp_instance_external_ipv4_soft_in, |
8800 | clear_ip_bgp_instance_external_ipv4_in_cmd, | |
8801 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) in", | |
8802 | CLEAR_STR | |
8803 | IP_STR | |
8804 | BGP_STR | |
8805 | BGP_INSTANCE_HELP_STR | |
8806 | "Clear all external peers\n" | |
8807 | "Address family\n" | |
8808 | "Address Family modifier\n" | |
8809 | "Address Family modifier\n" | |
8810 | BGP_SOFT_IN_STR) | |
8811 | ||
718e3744 | 8812 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
8813 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
8814 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
8815 | CLEAR_STR | |
8816 | IP_STR | |
8817 | BGP_STR | |
8818 | "Clear all external peers\n" | |
8819 | "Address family\n" | |
8820 | "Address Family modifier\n" | |
8821 | "Address Family modifier\n" | |
e0bce756 | 8822 | BGP_SOFT_IN_STR |
718e3744 | 8823 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8824 | { | |
8825 | if (strncmp (argv[0], "m", 1) == 0) | |
8826 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
8827 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8828 | ||
8829 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8830 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8831 | } | |
8832 | ||
8833 | DEFUN (clear_bgp_external_soft_in, | |
8834 | clear_bgp_external_soft_in_cmd, | |
8835 | "clear bgp external soft in", | |
8836 | CLEAR_STR | |
8837 | BGP_STR | |
8838 | "Clear all external peers\n" | |
e0bce756 DS |
8839 | BGP_SOFT_STR |
8840 | BGP_SOFT_IN_STR) | |
718e3744 | 8841 | { |
01080f7c | 8842 | if (argc == 2) |
8843 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
8844 | BGP_CLEAR_SOFT_IN, NULL); | |
8845 | ||
718e3744 | 8846 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
8847 | BGP_CLEAR_SOFT_IN, NULL); | |
8848 | } | |
8849 | ||
01080f7c | 8850 | ALIAS (clear_bgp_external_soft_in, |
8851 | clear_bgp_instance_external_soft_in_cmd, | |
8852 | "clear bgp " BGP_INSTANCE_CMD " external soft in", | |
8853 | CLEAR_STR | |
8854 | BGP_STR | |
8855 | BGP_INSTANCE_HELP_STR | |
8856 | "Clear all external peers\n" | |
8857 | BGP_SOFT_STR | |
8858 | BGP_SOFT_IN_STR) | |
8859 | ||
718e3744 | 8860 | ALIAS (clear_bgp_external_soft_in, |
8861 | clear_bgp_ipv6_external_soft_in_cmd, | |
8862 | "clear bgp ipv6 external soft in", | |
8863 | CLEAR_STR | |
8864 | BGP_STR | |
8865 | "Address family\n" | |
8866 | "Clear all external peers\n" | |
e0bce756 DS |
8867 | BGP_SOFT_STR |
8868 | BGP_SOFT_IN_STR) | |
718e3744 | 8869 | |
01080f7c | 8870 | ALIAS (clear_bgp_external_soft_in, |
8871 | clear_bgp_instance_ipv6_external_soft_in_cmd, | |
8872 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft in", | |
8873 | CLEAR_STR | |
8874 | BGP_STR | |
8875 | BGP_INSTANCE_HELP_STR | |
8876 | "Address family\n" | |
8877 | "Clear all external peers\n" | |
8878 | BGP_SOFT_STR | |
8879 | BGP_SOFT_IN_STR) | |
8880 | ||
718e3744 | 8881 | ALIAS (clear_bgp_external_soft_in, |
8882 | clear_bgp_external_in_cmd, | |
8883 | "clear bgp external in", | |
8884 | CLEAR_STR | |
8885 | BGP_STR | |
8886 | "Clear all external peers\n" | |
e0bce756 | 8887 | BGP_SOFT_IN_STR) |
718e3744 | 8888 | |
01080f7c | 8889 | ALIAS (clear_bgp_external_soft_in, |
8890 | clear_bgp_instance_external_in_cmd, | |
8891 | "clear bgp " BGP_INSTANCE_CMD " external in", | |
8892 | CLEAR_STR | |
8893 | BGP_STR | |
8894 | BGP_INSTANCE_HELP_STR | |
8895 | "Clear all external peers\n" | |
8896 | BGP_SOFT_IN_STR) | |
8897 | ||
718e3744 | 8898 | ALIAS (clear_bgp_external_soft_in, |
8899 | clear_bgp_ipv6_external_in_cmd, | |
8900 | "clear bgp ipv6 external WORD in", | |
8901 | CLEAR_STR | |
8902 | BGP_STR | |
8903 | "Address family\n" | |
8904 | "Clear all external peers\n" | |
e0bce756 | 8905 | BGP_SOFT_IN_STR) |
718e3744 | 8906 | |
01080f7c | 8907 | ALIAS (clear_bgp_external_soft_in, |
8908 | clear_bgp_instance_ipv6_external_in_cmd, | |
8909 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD in", | |
8910 | CLEAR_STR | |
8911 | BGP_STR | |
8912 | BGP_INSTANCE_HELP_STR | |
8913 | "Address family\n" | |
8914 | "Clear all external peers\n" | |
8915 | BGP_SOFT_IN_STR) | |
8916 | ||
718e3744 | 8917 | DEFUN (clear_bgp_external_in_prefix_filter, |
8918 | clear_bgp_external_in_prefix_filter_cmd, | |
8919 | "clear bgp external in prefix-filter", | |
8920 | CLEAR_STR | |
8921 | BGP_STR | |
8922 | "Clear all external peers\n" | |
e0bce756 | 8923 | BGP_SOFT_IN_STR |
718e3744 | 8924 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8925 | { | |
8926 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
8927 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8928 | } | |
8929 | ||
8930 | ALIAS (clear_bgp_external_in_prefix_filter, | |
8931 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
8932 | "clear bgp ipv6 external in prefix-filter", | |
8933 | CLEAR_STR | |
8934 | BGP_STR | |
8935 | "Address family\n" | |
8936 | "Clear all external peers\n" | |
e0bce756 | 8937 | BGP_SOFT_IN_STR |
718e3744 | 8938 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8939 | ||
8940 | DEFUN (clear_ip_bgp_as_soft_in, | |
8941 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 8942 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 8943 | CLEAR_STR |
8944 | IP_STR | |
8945 | BGP_STR | |
8946 | "Clear peers with the AS number\n" | |
e0bce756 DS |
8947 | BGP_SOFT_STR |
8948 | BGP_SOFT_IN_STR) | |
718e3744 | 8949 | { |
01080f7c | 8950 | if (argc == 3) |
8951 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
8952 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8953 | ||
718e3744 | 8954 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
8955 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8956 | } | |
8957 | ||
8958 | ALIAS (clear_ip_bgp_as_soft_in, | |
01080f7c | 8959 | clear_ip_bgp_instance_as_soft_in_cmd, |
8960 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", | |
8961 | CLEAR_STR | |
8962 | IP_STR | |
8963 | BGP_STR | |
8964 | BGP_INSTANCE_HELP_STR | |
8965 | "Clear peers with the AS number\n" | |
8966 | BGP_SOFT_STR | |
8967 | BGP_SOFT_IN_STR) | |
8968 | ||
8969 | ALIAS (clear_ip_bgp_as_soft_in, | |
8970 | clear_ip_bgp_as_in_cmd, | |
8971 | "clear ip bgp " CMD_AS_RANGE " in", | |
8972 | CLEAR_STR | |
8973 | IP_STR | |
8974 | BGP_STR | |
8975 | "Clear peers with the AS number\n" | |
8976 | BGP_SOFT_IN_STR) | |
8977 | ||
8978 | ALIAS (clear_ip_bgp_as_soft_in, | |
8979 | clear_ip_bgp_instance_as_in_cmd, | |
8980 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", | |
718e3744 | 8981 | CLEAR_STR |
8982 | IP_STR | |
8983 | BGP_STR | |
01080f7c | 8984 | BGP_INSTANCE_HELP_STR |
718e3744 | 8985 | "Clear peers with the AS number\n" |
e0bce756 | 8986 | BGP_SOFT_IN_STR) |
718e3744 | 8987 | |
8988 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
8989 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 8990 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 8991 | CLEAR_STR |
8992 | IP_STR | |
8993 | BGP_STR | |
8994 | "Clear peers with the AS number\n" | |
e0bce756 | 8995 | BGP_SOFT_IN_STR |
718e3744 | 8996 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8997 | { | |
8998 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
8999 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
9000 | } | |
9001 | ||
9002 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
9003 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 9004 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 9005 | CLEAR_STR |
9006 | IP_STR | |
9007 | BGP_STR | |
9008 | "Clear peers with the AS number\n" | |
9009 | "Address family\n" | |
9010 | "Address Family modifier\n" | |
9011 | "Address Family modifier\n" | |
e0bce756 DS |
9012 | BGP_SOFT_STR |
9013 | BGP_SOFT_IN_STR) | |
718e3744 | 9014 | { |
9015 | if (strncmp (argv[1], "m", 1) == 0) | |
9016 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
9017 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9018 | ||
9019 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
9020 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9021 | } | |
9022 | ||
01080f7c | 9023 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, |
9024 | clear_ip_bgp_instance_as_ipv4_soft_in_cmd, | |
9025 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", | |
9026 | CLEAR_STR | |
9027 | IP_STR | |
9028 | BGP_STR | |
9029 | BGP_INSTANCE_HELP_STR | |
9030 | "Clear peers with the AS number\n" | |
9031 | "Address family\n" | |
9032 | "Address Family modifier\n" | |
9033 | "Address Family modifier\n" | |
9034 | BGP_SOFT_STR | |
9035 | BGP_SOFT_IN_STR) | |
9036 | { | |
9037 | if (strncmp (argv[3], "m", 1) == 0) | |
9038 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, | |
9039 | BGP_CLEAR_SOFT_IN, argv[2]); | |
9040 | ||
9041 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
9042 | BGP_CLEAR_SOFT_IN, argv[2]); | |
9043 | } | |
9044 | ||
718e3744 | 9045 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
9046 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 9047 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 9048 | CLEAR_STR |
9049 | IP_STR | |
9050 | BGP_STR | |
9051 | "Clear peers with the AS number\n" | |
9052 | "Address family\n" | |
9053 | "Address Family modifier\n" | |
9054 | "Address Family modifier\n" | |
e0bce756 | 9055 | BGP_SOFT_IN_STR) |
718e3744 | 9056 | |
01080f7c | 9057 | ALIAS (clear_ip_bgp_instance_as_ipv4_soft_in, |
9058 | clear_ip_bgp_instance_as_ipv4_in_cmd, | |
9059 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) in", | |
9060 | CLEAR_STR | |
9061 | IP_STR | |
9062 | BGP_STR | |
9063 | BGP_INSTANCE_HELP_STR | |
9064 | "Clear peers with the AS number\n" | |
9065 | "Address family\n" | |
9066 | "Address Family modifier\n" | |
9067 | "Address Family modifier\n" | |
9068 | BGP_SOFT_IN_STR) | |
9069 | ||
718e3744 | 9070 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
9071 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 9072 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 9073 | CLEAR_STR |
9074 | IP_STR | |
9075 | BGP_STR | |
9076 | "Clear peers with the AS number\n" | |
9077 | "Address family\n" | |
9078 | "Address Family modifier\n" | |
9079 | "Address Family modifier\n" | |
e0bce756 | 9080 | BGP_SOFT_IN_STR |
718e3744 | 9081 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
9082 | { | |
9083 | if (strncmp (argv[1], "m", 1) == 0) | |
9084 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
9085 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
9086 | ||
9087 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
9088 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
9089 | } | |
9090 | ||
9091 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
9092 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 9093 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 9094 | CLEAR_STR |
9095 | IP_STR | |
9096 | BGP_STR | |
9097 | "Clear peers with the AS number\n" | |
9098 | "Address family\n" | |
9099 | "Address Family modifier\n" | |
e0bce756 DS |
9100 | BGP_SOFT_STR |
9101 | BGP_SOFT_IN_STR) | |
718e3744 | 9102 | { |
9103 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
9104 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9105 | } | |
9106 | ||
9107 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
9108 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 9109 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 9110 | CLEAR_STR |
9111 | IP_STR | |
9112 | BGP_STR | |
9113 | "Clear peers with the AS number\n" | |
9114 | "Address family\n" | |
9115 | "Address Family modifier\n" | |
e0bce756 | 9116 | BGP_SOFT_IN_STR) |
718e3744 | 9117 | |
587ff0fd LB |
9118 | DEFUN (clear_ip_bgp_as_encap_soft_in, |
9119 | clear_ip_bgp_as_encap_soft_in_cmd, | |
9120 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft in", | |
9121 | CLEAR_STR | |
9122 | IP_STR | |
9123 | BGP_STR | |
9124 | "Clear peers with the AS number\n" | |
9125 | "Address family\n" | |
9126 | "Address Family modifier\n" | |
9127 | "Soft reconfig\n" | |
9128 | "Soft reconfig inbound update\n") | |
9129 | { | |
9130 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
9131 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9132 | } | |
9133 | ||
9134 | ALIAS (clear_ip_bgp_as_encap_soft_in, | |
9135 | clear_ip_bgp_as_encap_in_cmd, | |
9136 | "clear ip bgp " CMD_AS_RANGE " encap unicast in", | |
9137 | CLEAR_STR | |
9138 | IP_STR | |
9139 | BGP_STR | |
9140 | "Clear peers with the AS number\n" | |
9141 | "Address family\n" | |
9142 | "Address Family modifier\n" | |
9143 | "Soft reconfig inbound update\n") | |
9144 | ||
718e3744 | 9145 | DEFUN (clear_bgp_as_soft_in, |
9146 | clear_bgp_as_soft_in_cmd, | |
320da874 | 9147 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 9148 | CLEAR_STR |
9149 | BGP_STR | |
9150 | "Clear peers with the AS number\n" | |
e0bce756 DS |
9151 | BGP_SOFT_STR |
9152 | BGP_SOFT_IN_STR) | |
718e3744 | 9153 | { |
01080f7c | 9154 | if (argc == 3) |
9155 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
9156 | BGP_CLEAR_SOFT_IN, argv[2]); | |
9157 | ||
718e3744 | 9158 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
9159 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9160 | } | |
9161 | ||
01080f7c | 9162 | ALIAS (clear_bgp_as_soft_in, |
9163 | clear_bgp_instance_as_soft_in_cmd, | |
9164 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", | |
9165 | CLEAR_STR | |
9166 | BGP_STR | |
9167 | BGP_INSTANCE_HELP_STR | |
9168 | "Clear peers with the AS number\n" | |
9169 | BGP_SOFT_STR | |
9170 | BGP_SOFT_IN_STR) | |
9171 | ||
718e3744 | 9172 | ALIAS (clear_bgp_as_soft_in, |
9173 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 9174 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 9175 | CLEAR_STR |
9176 | BGP_STR | |
9177 | "Address family\n" | |
9178 | "Clear peers with the AS number\n" | |
e0bce756 DS |
9179 | BGP_SOFT_STR |
9180 | BGP_SOFT_IN_STR) | |
718e3744 | 9181 | |
01080f7c | 9182 | ALIAS (clear_bgp_as_soft_in, |
9183 | clear_bgp_instance_ipv6_as_soft_in_cmd, | |
9184 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft in", | |
9185 | CLEAR_STR | |
9186 | BGP_STR | |
9187 | BGP_INSTANCE_HELP_STR | |
9188 | "Address family\n" | |
9189 | "Clear peers with the AS number\n" | |
9190 | BGP_SOFT_STR | |
9191 | BGP_SOFT_IN_STR) | |
9192 | ||
718e3744 | 9193 | ALIAS (clear_bgp_as_soft_in, |
9194 | clear_bgp_as_in_cmd, | |
320da874 | 9195 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 9196 | CLEAR_STR |
9197 | BGP_STR | |
9198 | "Clear peers with the AS number\n" | |
e0bce756 | 9199 | BGP_SOFT_IN_STR) |
718e3744 | 9200 | |
01080f7c | 9201 | ALIAS (clear_bgp_as_soft_in, |
9202 | clear_bgp_instance_as_in_cmd, | |
9203 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", | |
9204 | CLEAR_STR | |
9205 | BGP_STR | |
9206 | BGP_INSTANCE_HELP_STR | |
9207 | "Clear peers with the AS number\n" | |
9208 | BGP_SOFT_IN_STR) | |
9209 | ||
718e3744 | 9210 | ALIAS (clear_bgp_as_soft_in, |
9211 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 9212 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 9213 | CLEAR_STR |
9214 | BGP_STR | |
9215 | "Address family\n" | |
9216 | "Clear peers with the AS number\n" | |
e0bce756 | 9217 | BGP_SOFT_IN_STR) |
718e3744 | 9218 | |
01080f7c | 9219 | ALIAS (clear_bgp_as_soft_in, |
9220 | clear_bgp_instance_ipv6_as_in_cmd, | |
9221 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " in", | |
9222 | CLEAR_STR | |
9223 | BGP_STR | |
9224 | BGP_INSTANCE_HELP_STR | |
9225 | "Address family\n" | |
9226 | "Clear peers with the AS number\n" | |
9227 | BGP_SOFT_IN_STR) | |
9228 | ||
718e3744 | 9229 | DEFUN (clear_bgp_as_in_prefix_filter, |
9230 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 9231 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 9232 | CLEAR_STR |
9233 | BGP_STR | |
9234 | "Clear peers with the AS number\n" | |
e0bce756 | 9235 | BGP_SOFT_IN_STR |
718e3744 | 9236 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
9237 | { | |
9238 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
9239 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
9240 | } | |
9241 | ||
9242 | ALIAS (clear_bgp_as_in_prefix_filter, | |
9243 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 9244 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 9245 | CLEAR_STR |
9246 | BGP_STR | |
9247 | "Address family\n" | |
9248 | "Clear peers with the AS number\n" | |
e0bce756 | 9249 | BGP_SOFT_IN_STR |
718e3744 | 9250 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6b0655a2 | 9251 | |
718e3744 | 9252 | /* Both soft-reconfiguration */ |
9253 | DEFUN (clear_ip_bgp_all_soft, | |
9254 | clear_ip_bgp_all_soft_cmd, | |
9255 | "clear ip bgp * soft", | |
9256 | CLEAR_STR | |
9257 | IP_STR | |
9258 | BGP_STR | |
9259 | "Clear all peers\n" | |
e0bce756 | 9260 | BGP_SOFT_STR) |
718e3744 | 9261 | { |
6aeb9e78 DS |
9262 | if (argc == 2) |
9263 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 9264 | BGP_CLEAR_SOFT_BOTH, NULL); |
9265 | ||
9266 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9267 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9268 | } | |
9269 | ||
9270 | ALIAS (clear_ip_bgp_all_soft, | |
9271 | clear_ip_bgp_instance_all_soft_cmd, | |
8386ac43 | 9272 | "clear ip bgp " BGP_INSTANCE_CMD " * soft", |
718e3744 | 9273 | CLEAR_STR |
9274 | IP_STR | |
9275 | BGP_STR | |
8386ac43 | 9276 | BGP_INSTANCE_HELP_STR |
718e3744 | 9277 | "Clear all peers\n" |
e0bce756 | 9278 | BGP_SOFT_STR) |
718e3744 | 9279 | |
9280 | ||
9281 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
9282 | clear_ip_bgp_all_ipv4_soft_cmd, | |
9283 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
9284 | CLEAR_STR | |
9285 | IP_STR | |
9286 | BGP_STR | |
9287 | "Clear all peers\n" | |
9288 | "Address family\n" | |
9289 | "Address Family Modifier\n" | |
9290 | "Address Family Modifier\n" | |
e0bce756 | 9291 | BGP_SOFT_STR) |
718e3744 | 9292 | { |
9293 | if (strncmp (argv[0], "m", 1) == 0) | |
9294 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
9295 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9296 | ||
9297 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9298 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9299 | } | |
9300 | ||
9301 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
9302 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
8386ac43 | 9303 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft", |
718e3744 | 9304 | CLEAR_STR |
9305 | IP_STR | |
9306 | BGP_STR | |
8386ac43 | 9307 | BGP_INSTANCE_HELP_STR |
718e3744 | 9308 | "Clear all peers\n" |
9309 | "Address family\n" | |
9310 | "Address Family Modifier\n" | |
9311 | "Address Family Modifier\n" | |
e0bce756 | 9312 | BGP_SOFT_STR) |
718e3744 | 9313 | { |
6aeb9e78 DS |
9314 | if (strncmp (argv[2], "m", 1) == 0) |
9315 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, | |
718e3744 | 9316 | BGP_CLEAR_SOFT_BOTH, NULL); |
9317 | ||
9318 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9319 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9320 | } | |
9321 | ||
9322 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
9323 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
9324 | "clear ip bgp * vpnv4 unicast soft", | |
9325 | CLEAR_STR | |
9326 | IP_STR | |
9327 | BGP_STR | |
9328 | "Clear all peers\n" | |
9329 | "Address family\n" | |
9330 | "Address Family Modifier\n" | |
e0bce756 | 9331 | BGP_SOFT_STR) |
718e3744 | 9332 | { |
9333 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
9334 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9335 | } | |
9336 | ||
587ff0fd LB |
9337 | DEFUN (clear_ip_bgp_all_encap_soft, |
9338 | clear_ip_bgp_all_encap_soft_cmd, | |
9339 | "clear ip bgp * encap unicast soft", | |
9340 | CLEAR_STR | |
9341 | IP_STR | |
9342 | BGP_STR | |
9343 | "Clear all peers\n" | |
9344 | "Address family\n" | |
9345 | "Address Family Modifier\n" | |
9346 | "Soft reconfig\n") | |
9347 | { | |
9348 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
9349 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9350 | } | |
9351 | ||
718e3744 | 9352 | DEFUN (clear_bgp_all_soft, |
9353 | clear_bgp_all_soft_cmd, | |
9354 | "clear bgp * soft", | |
9355 | CLEAR_STR | |
9356 | BGP_STR | |
9357 | "Clear all peers\n" | |
e0bce756 | 9358 | BGP_SOFT_STR) |
718e3744 | 9359 | { |
6aeb9e78 DS |
9360 | if (argc == 2) |
9361 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
01080f7c | 9362 | BGP_CLEAR_SOFT_BOTH, NULL); |
718e3744 | 9363 | |
9364 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
01080f7c | 9365 | BGP_CLEAR_SOFT_BOTH, NULL); |
718e3744 | 9366 | } |
9367 | ||
9368 | ALIAS (clear_bgp_all_soft, | |
9369 | clear_bgp_instance_all_soft_cmd, | |
8386ac43 | 9370 | "clear bgp " BGP_INSTANCE_CMD " * soft", |
718e3744 | 9371 | CLEAR_STR |
9372 | BGP_STR | |
8386ac43 | 9373 | BGP_INSTANCE_HELP_STR |
718e3744 | 9374 | "Clear all peers\n" |
e0bce756 | 9375 | BGP_SOFT_STR) |
718e3744 | 9376 | |
9377 | ALIAS (clear_bgp_all_soft, | |
9378 | clear_bgp_ipv6_all_soft_cmd, | |
9379 | "clear bgp ipv6 * soft", | |
9380 | CLEAR_STR | |
9381 | BGP_STR | |
9382 | "Address family\n" | |
9383 | "Clear all peers\n" | |
e0bce756 | 9384 | BGP_SOFT_STR) |
718e3744 | 9385 | |
01080f7c | 9386 | ALIAS (clear_bgp_all_soft, |
9387 | clear_bgp_instance_ipv6_all_soft_cmd, | |
9388 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft", | |
9389 | CLEAR_STR | |
9390 | BGP_STR | |
9391 | BGP_INSTANCE_HELP_STR | |
9392 | "Address family\n" | |
9393 | "Clear all peers\n" | |
9394 | BGP_SOFT_STR) | |
9395 | ||
718e3744 | 9396 | DEFUN (clear_ip_bgp_peer_soft, |
9397 | clear_ip_bgp_peer_soft_cmd, | |
db64ea86 | 9398 | "clear ip bgp (A.B.C.D|WORD) soft", |
718e3744 | 9399 | CLEAR_STR |
9400 | IP_STR | |
9401 | BGP_STR | |
9402 | "BGP neighbor address to clear\n" | |
db64ea86 | 9403 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9404 | BGP_SOFT_STR) |
718e3744 | 9405 | { |
01080f7c | 9406 | if (argc == 3) |
9407 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
9408 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9409 | ||
718e3744 | 9410 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
9411 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9412 | } | |
9413 | ||
01080f7c | 9414 | ALIAS (clear_ip_bgp_peer_soft, |
9415 | clear_ip_bgp_instance_peer_soft_cmd, | |
9416 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft", | |
9417 | CLEAR_STR | |
9418 | IP_STR | |
9419 | BGP_STR | |
9420 | BGP_INSTANCE_HELP_STR | |
9421 | "BGP neighbor address to clear\n" | |
9422 | "BGP neighbor on interface to clear\n" | |
9423 | BGP_SOFT_STR) | |
9424 | ||
718e3744 | 9425 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
9426 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
db64ea86 | 9427 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", |
718e3744 | 9428 | CLEAR_STR |
9429 | IP_STR | |
9430 | BGP_STR | |
9431 | "BGP neighbor address to clear\n" | |
db64ea86 | 9432 | "BGP neighbor on interface to clear\n" |
718e3744 | 9433 | "Address family\n" |
9434 | "Address Family Modifier\n" | |
9435 | "Address Family Modifier\n" | |
e0bce756 | 9436 | BGP_SOFT_STR) |
718e3744 | 9437 | { |
9438 | if (strncmp (argv[1], "m", 1) == 0) | |
9439 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
9440 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9441 | ||
9442 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
9443 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9444 | } | |
9445 | ||
01080f7c | 9446 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, |
9447 | clear_ip_bgp_instance_peer_ipv4_soft_cmd, | |
9448 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", | |
9449 | CLEAR_STR | |
9450 | IP_STR | |
9451 | BGP_STR | |
9452 | BGP_INSTANCE_HELP_STR | |
9453 | "BGP neighbor address to clear\n" | |
9454 | "BGP neighbor on interface to clear\n" | |
9455 | "Address family\n" | |
9456 | "Address Family Modifier\n" | |
9457 | "Address Family Modifier\n" | |
9458 | BGP_SOFT_STR) | |
9459 | { | |
9460 | if (strncmp (argv[3], "m", 1) == 0) | |
9461 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, | |
9462 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9463 | ||
9464 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
9465 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9466 | } | |
9467 | ||
718e3744 | 9468 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
9469 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
db64ea86 | 9470 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft", |
718e3744 | 9471 | CLEAR_STR |
9472 | IP_STR | |
9473 | BGP_STR | |
9474 | "BGP neighbor address to clear\n" | |
db64ea86 | 9475 | "BGP neighbor on interface to clear\n" |
718e3744 | 9476 | "Address family\n" |
9477 | "Address Family Modifier\n" | |
e0bce756 | 9478 | BGP_SOFT_STR) |
718e3744 | 9479 | { |
9480 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
9481 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9482 | } | |
9483 | ||
587ff0fd LB |
9484 | DEFUN (clear_ip_bgp_peer_encap_soft, |
9485 | clear_ip_bgp_peer_encap_soft_cmd, | |
9486 | "clear ip bgp A.B.C.D encap unicast soft", | |
9487 | CLEAR_STR | |
9488 | IP_STR | |
9489 | BGP_STR | |
9490 | "BGP neighbor address to clear\n" | |
9491 | "Address family\n" | |
9492 | "Address Family Modifier\n" | |
9493 | "Soft reconfig\n") | |
9494 | { | |
9495 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
9496 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9497 | } | |
9498 | ||
718e3744 | 9499 | DEFUN (clear_bgp_peer_soft, |
9500 | clear_bgp_peer_soft_cmd, | |
a80beece | 9501 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 9502 | CLEAR_STR |
9503 | BGP_STR | |
9504 | "BGP neighbor address to clear\n" | |
9505 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 9506 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9507 | BGP_SOFT_STR) |
718e3744 | 9508 | { |
01080f7c | 9509 | if (argc == 3) |
9510 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
9511 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9512 | ||
718e3744 | 9513 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
9514 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9515 | } | |
9516 | ||
01080f7c | 9517 | ALIAS (clear_bgp_peer_soft, |
9518 | clear_bgp_instance_peer_soft_cmd, | |
9519 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft", | |
9520 | CLEAR_STR | |
9521 | BGP_STR | |
9522 | BGP_INSTANCE_HELP_STR | |
9523 | "BGP neighbor address to clear\n" | |
9524 | "BGP IPv6 neighbor to clear\n" | |
9525 | "BGP neighbor on interface to clear\n" | |
9526 | BGP_SOFT_STR) | |
9527 | ||
718e3744 | 9528 | ALIAS (clear_bgp_peer_soft, |
9529 | clear_bgp_ipv6_peer_soft_cmd, | |
a80beece | 9530 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 9531 | CLEAR_STR |
9532 | BGP_STR | |
9533 | "Address family\n" | |
9534 | "BGP neighbor address to clear\n" | |
9535 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 9536 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9537 | BGP_SOFT_STR) |
718e3744 | 9538 | |
01080f7c | 9539 | ALIAS (clear_bgp_peer_soft, |
9540 | clear_bgp_instance_ipv6_peer_soft_cmd, | |
9541 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft", | |
9542 | CLEAR_STR | |
9543 | BGP_STR | |
9544 | BGP_INSTANCE_HELP_STR | |
9545 | "Address family\n" | |
9546 | "BGP neighbor address to clear\n" | |
9547 | "BGP IPv6 neighbor to clear\n" | |
9548 | "BGP neighbor on interface to clear\n" | |
9549 | BGP_SOFT_STR) | |
9550 | ||
718e3744 | 9551 | DEFUN (clear_ip_bgp_peer_group_soft, |
9552 | clear_ip_bgp_peer_group_soft_cmd, | |
9553 | "clear ip bgp peer-group WORD soft", | |
9554 | CLEAR_STR | |
9555 | IP_STR | |
9556 | BGP_STR | |
9557 | "Clear all members of peer-group\n" | |
9558 | "BGP peer-group name\n" | |
e0bce756 | 9559 | BGP_SOFT_STR) |
718e3744 | 9560 | { |
01080f7c | 9561 | if (argc == 3) |
9562 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
9563 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9564 | ||
718e3744 | 9565 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
9566 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9567 | } | |
9568 | ||
01080f7c | 9569 | ALIAS (clear_ip_bgp_peer_group_soft, |
9570 | clear_ip_bgp_instance_peer_group_soft_cmd, | |
9571 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft", | |
9572 | CLEAR_STR | |
9573 | IP_STR | |
9574 | BGP_STR | |
9575 | BGP_INSTANCE_HELP_STR | |
9576 | "Clear all members of peer-group\n" | |
9577 | "BGP peer-group name\n" | |
9578 | BGP_SOFT_STR) | |
9579 | ||
718e3744 | 9580 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
9581 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
9582 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
9583 | CLEAR_STR | |
9584 | IP_STR | |
9585 | BGP_STR | |
9586 | "Clear all members of peer-group\n" | |
9587 | "BGP peer-group name\n" | |
9588 | "Address family\n" | |
9589 | "Address Family modifier\n" | |
9590 | "Address Family modifier\n" | |
e0bce756 | 9591 | BGP_SOFT_STR) |
718e3744 | 9592 | { |
9593 | if (strncmp (argv[1], "m", 1) == 0) | |
9594 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
9595 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9596 | ||
9597 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
9598 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9599 | } | |
9600 | ||
01080f7c | 9601 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, |
9602 | clear_ip_bgp_instance_peer_group_ipv4_soft_cmd, | |
9603 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft", | |
9604 | CLEAR_STR | |
9605 | IP_STR | |
9606 | BGP_STR | |
9607 | BGP_INSTANCE_HELP_STR | |
9608 | "Clear all members of peer-group\n" | |
9609 | "BGP peer-group name\n" | |
9610 | "Address family\n" | |
9611 | "Address Family modifier\n" | |
9612 | "Address Family modifier\n" | |
9613 | BGP_SOFT_STR) | |
9614 | { | |
9615 | if (strncmp (argv[3], "m", 1) == 0) | |
9616 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, | |
9617 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9618 | ||
9619 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
9620 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9621 | } | |
9622 | ||
718e3744 | 9623 | DEFUN (clear_bgp_peer_group_soft, |
9624 | clear_bgp_peer_group_soft_cmd, | |
9625 | "clear bgp peer-group WORD soft", | |
9626 | CLEAR_STR | |
9627 | BGP_STR | |
9628 | "Clear all members of peer-group\n" | |
9629 | "BGP peer-group name\n" | |
e0bce756 | 9630 | BGP_SOFT_STR) |
718e3744 | 9631 | { |
01080f7c | 9632 | if (argc == 3) |
9633 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
9634 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9635 | ||
718e3744 | 9636 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
9637 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9638 | } | |
9639 | ||
01080f7c | 9640 | ALIAS (clear_bgp_peer_group_soft, |
9641 | clear_bgp_instance_peer_group_soft_cmd, | |
9642 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft", | |
9643 | CLEAR_STR | |
9644 | BGP_STR | |
9645 | BGP_INSTANCE_HELP_STR | |
9646 | "Clear all members of peer-group\n" | |
9647 | "BGP peer-group name\n" | |
9648 | BGP_SOFT_STR) | |
9649 | ||
718e3744 | 9650 | ALIAS (clear_bgp_peer_group_soft, |
9651 | clear_bgp_ipv6_peer_group_soft_cmd, | |
9652 | "clear bgp ipv6 peer-group WORD soft", | |
9653 | CLEAR_STR | |
9654 | BGP_STR | |
9655 | "Address family\n" | |
9656 | "Clear all members of peer-group\n" | |
9657 | "BGP peer-group name\n" | |
e0bce756 | 9658 | BGP_SOFT_STR) |
718e3744 | 9659 | |
01080f7c | 9660 | ALIAS (clear_bgp_peer_group_soft, |
9661 | clear_bgp_instance_ipv6_peer_group_soft_cmd, | |
9662 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft", | |
9663 | CLEAR_STR | |
9664 | BGP_STR | |
9665 | BGP_INSTANCE_HELP_STR | |
9666 | "Address family\n" | |
9667 | "Clear all members of peer-group\n" | |
9668 | "BGP peer-group name\n" | |
9669 | BGP_SOFT_STR) | |
9670 | ||
718e3744 | 9671 | DEFUN (clear_ip_bgp_external_soft, |
9672 | clear_ip_bgp_external_soft_cmd, | |
9673 | "clear ip bgp external soft", | |
9674 | CLEAR_STR | |
9675 | IP_STR | |
9676 | BGP_STR | |
9677 | "Clear all external peers\n" | |
e0bce756 | 9678 | BGP_SOFT_STR) |
718e3744 | 9679 | { |
01080f7c | 9680 | if (argc == 2) |
9681 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
9682 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9683 | ||
718e3744 | 9684 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
9685 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9686 | } | |
9687 | ||
01080f7c | 9688 | ALIAS (clear_ip_bgp_external_soft, |
9689 | clear_ip_bgp_instance_external_soft_cmd, | |
9690 | "clear ip bgp " BGP_INSTANCE_CMD " external soft", | |
9691 | CLEAR_STR | |
9692 | IP_STR | |
9693 | BGP_STR | |
9694 | BGP_INSTANCE_HELP_STR | |
9695 | "Clear all external peers\n" | |
9696 | BGP_SOFT_STR) | |
9697 | ||
718e3744 | 9698 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
9699 | clear_ip_bgp_external_ipv4_soft_cmd, | |
9700 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
9701 | CLEAR_STR | |
9702 | IP_STR | |
9703 | BGP_STR | |
9704 | "Clear all external peers\n" | |
9705 | "Address family\n" | |
9706 | "Address Family modifier\n" | |
9707 | "Address Family modifier\n" | |
e0bce756 | 9708 | BGP_SOFT_STR) |
718e3744 | 9709 | { |
9710 | if (strncmp (argv[0], "m", 1) == 0) | |
9711 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
9712 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9713 | ||
9714 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
9715 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9716 | } | |
9717 | ||
01080f7c | 9718 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft, |
9719 | clear_ip_bgp_instance_external_ipv4_soft_cmd, | |
9720 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft", | |
9721 | CLEAR_STR | |
9722 | IP_STR | |
9723 | BGP_STR | |
9724 | BGP_INSTANCE_HELP_STR | |
9725 | "Clear all external peers\n" | |
9726 | "Address family\n" | |
9727 | "Address Family modifier\n" | |
9728 | "Address Family modifier\n" | |
9729 | BGP_SOFT_STR) | |
9730 | { | |
9731 | if (strncmp (argv[2], "m", 1) == 0) | |
9732 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, | |
9733 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9734 | ||
9735 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
9736 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9737 | } | |
9738 | ||
718e3744 | 9739 | DEFUN (clear_bgp_external_soft, |
9740 | clear_bgp_external_soft_cmd, | |
9741 | "clear bgp external soft", | |
9742 | CLEAR_STR | |
9743 | BGP_STR | |
9744 | "Clear all external peers\n" | |
e0bce756 | 9745 | BGP_SOFT_STR) |
718e3744 | 9746 | { |
01080f7c | 9747 | if (argc == 2) |
9748 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
9749 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9750 | ||
718e3744 | 9751 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
9752 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9753 | } | |
9754 | ||
01080f7c | 9755 | ALIAS (clear_bgp_external_soft, |
9756 | clear_bgp_instance_external_soft_cmd, | |
9757 | "clear bgp " BGP_INSTANCE_CMD " external soft", | |
9758 | CLEAR_STR | |
9759 | BGP_STR | |
9760 | BGP_INSTANCE_HELP_STR | |
9761 | "Clear all external peers\n" | |
9762 | BGP_SOFT_STR) | |
9763 | ||
718e3744 | 9764 | ALIAS (clear_bgp_external_soft, |
9765 | clear_bgp_ipv6_external_soft_cmd, | |
9766 | "clear bgp ipv6 external soft", | |
9767 | CLEAR_STR | |
9768 | BGP_STR | |
9769 | "Address family\n" | |
9770 | "Clear all external peers\n" | |
e0bce756 | 9771 | BGP_SOFT_STR) |
718e3744 | 9772 | |
01080f7c | 9773 | ALIAS (clear_bgp_external_soft, |
9774 | clear_bgp_instance_ipv6_external_soft_cmd, | |
9775 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft", | |
9776 | CLEAR_STR | |
9777 | BGP_STR | |
9778 | BGP_INSTANCE_HELP_STR | |
9779 | "Address family\n" | |
9780 | "Clear all external peers\n" | |
9781 | BGP_SOFT_STR) | |
9782 | ||
718e3744 | 9783 | DEFUN (clear_ip_bgp_as_soft, |
9784 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 9785 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 9786 | CLEAR_STR |
9787 | IP_STR | |
9788 | BGP_STR | |
9789 | "Clear peers with the AS number\n" | |
e0bce756 | 9790 | BGP_SOFT_STR) |
718e3744 | 9791 | { |
01080f7c | 9792 | if (argc == 3) |
9793 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
9794 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9795 | ||
718e3744 | 9796 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
9797 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9798 | } | |
9799 | ||
01080f7c | 9800 | ALIAS (clear_ip_bgp_as_soft, |
9801 | clear_ip_bgp_instance_as_soft_cmd, | |
9802 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", | |
9803 | CLEAR_STR | |
9804 | IP_STR | |
9805 | BGP_STR | |
9806 | BGP_INSTANCE_HELP_STR | |
9807 | "Clear peers with the AS number\n" | |
9808 | BGP_SOFT_STR) | |
9809 | ||
718e3744 | 9810 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
9811 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 9812 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 9813 | CLEAR_STR |
9814 | IP_STR | |
9815 | BGP_STR | |
9816 | "Clear peers with the AS number\n" | |
9817 | "Address family\n" | |
9818 | "Address Family Modifier\n" | |
9819 | "Address Family Modifier\n" | |
e0bce756 | 9820 | BGP_SOFT_STR) |
718e3744 | 9821 | { |
9822 | if (strncmp (argv[1], "m", 1) == 0) | |
9823 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
9824 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9825 | ||
9826 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
9827 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9828 | } | |
9829 | ||
01080f7c | 9830 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft, |
9831 | clear_ip_bgp_instance_as_ipv4_soft_cmd, | |
9832 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", | |
9833 | CLEAR_STR | |
9834 | IP_STR | |
9835 | BGP_STR | |
9836 | BGP_INSTANCE_HELP_STR | |
9837 | "Clear peers with the AS number\n" | |
9838 | "Address family\n" | |
9839 | "Address Family Modifier\n" | |
9840 | "Address Family Modifier\n" | |
9841 | BGP_SOFT_STR) | |
9842 | { | |
9843 | if (strncmp (argv[3], "m", 1) == 0) | |
9844 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, | |
9845 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9846 | ||
9847 | return bgp_clear_vty (vty, argv[1],AFI_IP, SAFI_UNICAST, clear_as, | |
9848 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9849 | } | |
9850 | ||
718e3744 | 9851 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
9852 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 9853 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 9854 | CLEAR_STR |
9855 | IP_STR | |
9856 | BGP_STR | |
9857 | "Clear peers with the AS number\n" | |
9858 | "Address family\n" | |
9859 | "Address Family Modifier\n" | |
e0bce756 | 9860 | BGP_SOFT_STR) |
718e3744 | 9861 | { |
9862 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
9863 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9864 | } | |
9865 | ||
587ff0fd LB |
9866 | DEFUN (clear_ip_bgp_as_encap_soft, |
9867 | clear_ip_bgp_as_encap_soft_cmd, | |
9868 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft", | |
9869 | CLEAR_STR | |
9870 | IP_STR | |
9871 | BGP_STR | |
9872 | "Clear peers with the AS number\n" | |
9873 | "Address family\n" | |
9874 | "Address Family Modifier\n" | |
9875 | "Soft reconfig\n") | |
9876 | { | |
9877 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
9878 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9879 | } | |
9880 | ||
718e3744 | 9881 | DEFUN (clear_bgp_as_soft, |
9882 | clear_bgp_as_soft_cmd, | |
320da874 | 9883 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 9884 | CLEAR_STR |
9885 | BGP_STR | |
9886 | "Clear peers with the AS number\n" | |
e0bce756 | 9887 | BGP_SOFT_STR) |
718e3744 | 9888 | { |
01080f7c | 9889 | if (argc == 3) |
9890 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
9891 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9892 | ||
718e3744 | 9893 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
9894 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9895 | } | |
9896 | ||
01080f7c | 9897 | ALIAS (clear_bgp_as_soft, |
9898 | clear_bgp_instance_as_soft_cmd, | |
9899 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", | |
9900 | CLEAR_STR | |
9901 | BGP_STR | |
9902 | BGP_INSTANCE_HELP_STR | |
9903 | "Clear peers with the AS number\n" | |
9904 | BGP_SOFT_STR) | |
9905 | ||
718e3744 | 9906 | ALIAS (clear_bgp_as_soft, |
9907 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 9908 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 9909 | CLEAR_STR |
9910 | BGP_STR | |
9911 | "Address family\n" | |
9912 | "Clear peers with the AS number\n" | |
e0bce756 | 9913 | BGP_SOFT_STR) |
6b0655a2 | 9914 | |
01080f7c | 9915 | ALIAS (clear_bgp_as_soft, |
9916 | clear_bgp_instance_ipv6_as_soft_cmd, | |
9917 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft", | |
9918 | CLEAR_STR | |
9919 | BGP_STR | |
9920 | BGP_INSTANCE_HELP_STR | |
9921 | "Address family\n" | |
9922 | "Clear peers with the AS number\n" | |
9923 | BGP_SOFT_STR) | |
9924 | ||
e0081f70 ML |
9925 | DEFUN (show_bgp_views, |
9926 | show_bgp_views_cmd, | |
9927 | "show bgp views", | |
9928 | SHOW_STR | |
9929 | BGP_STR | |
9930 | "Show the defined BGP views\n") | |
9931 | { | |
9932 | struct list *inst = bm->bgp; | |
9933 | struct listnode *node; | |
9934 | struct bgp *bgp; | |
9935 | ||
9936 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
9937 | { | |
8386ac43 | 9938 | vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE); |
e0081f70 ML |
9939 | return CMD_WARNING; |
9940 | } | |
9941 | ||
9942 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
9943 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
8386ac43 | 9944 | { |
9945 | /* Skip VRFs. */ | |
9946 | if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) | |
9947 | continue; | |
9948 | vty_out (vty, "\t%s (AS%u)%s", | |
9949 | bgp->name ? bgp->name : "(null)", | |
9950 | bgp->as, VTY_NEWLINE); | |
9951 | } | |
e0081f70 ML |
9952 | |
9953 | return CMD_SUCCESS; | |
9954 | } | |
9955 | ||
8386ac43 | 9956 | DEFUN (show_bgp_vrfs, |
9957 | show_bgp_vrfs_cmd, | |
9958 | "show bgp vrfs {json}", | |
9959 | SHOW_STR | |
9960 | BGP_STR | |
9961 | "Show BGP VRFs\n" | |
9962 | "JavaScript Object Notation\n") | |
9963 | { | |
9964 | struct list *inst = bm->bgp; | |
9965 | struct listnode *node; | |
9966 | struct bgp *bgp; | |
9967 | u_char uj = use_json(argc, argv); | |
9968 | json_object *json = NULL; | |
9969 | json_object *json_vrfs = NULL; | |
9970 | int count = 0; | |
9971 | static char header[] = "Type Id RouterId #PeersCfg #PeersEstb Name"; | |
9972 | ||
9973 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
9974 | { | |
9975 | vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE); | |
9976 | return CMD_WARNING; | |
9977 | } | |
9978 | ||
9979 | if (uj) | |
9980 | { | |
9981 | json = json_object_new_object(); | |
9982 | json_vrfs = json_object_new_object(); | |
9983 | } | |
9984 | ||
9985 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
9986 | { | |
9987 | const char *name, *type; | |
9988 | struct peer *peer; | |
9989 | struct listnode *node, *nnode; | |
9990 | int peers_cfg, peers_estb; | |
9991 | json_object *json_vrf = NULL; | |
5c81a5f3 | 9992 | int vrf_id_ui; |
8386ac43 | 9993 | |
9994 | /* Skip Views. */ | |
9995 | if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) | |
9996 | continue; | |
9997 | ||
9998 | count++; | |
9999 | if (!uj && count == 1) | |
10000 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
10001 | ||
10002 | peers_cfg = peers_estb = 0; | |
10003 | if (uj) | |
10004 | json_vrf = json_object_new_object(); | |
10005 | ||
10006 | ||
10007 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
10008 | { | |
10009 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) | |
10010 | continue; | |
10011 | peers_cfg++; | |
10012 | if (peer->status == Established) | |
10013 | peers_estb++; | |
10014 | } | |
10015 | ||
10016 | if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10017 | { | |
10018 | name = "Default"; | |
10019 | type = "DFLT"; | |
10020 | } | |
10021 | else | |
10022 | { | |
10023 | name = bgp->name; | |
10024 | type = "VRF"; | |
10025 | } | |
10026 | ||
5c81a5f3 | 10027 | vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id; |
8386ac43 | 10028 | if (uj) |
10029 | { | |
10030 | json_object_string_add(json_vrf, "type", type); | |
5c81a5f3 | 10031 | json_object_int_add(json_vrf, "vrfId", vrf_id_ui); |
8386ac43 | 10032 | json_object_string_add(json_vrf, "routerId", inet_ntoa (bgp->router_id)); |
10033 | json_object_int_add(json_vrf, "numConfiguredPeers", peers_cfg); | |
10034 | json_object_int_add(json_vrf, "numEstablishedPeers", peers_estb); | |
10035 | ||
10036 | json_object_object_add(json_vrfs, name, json_vrf); | |
10037 | } | |
10038 | else | |
5c81a5f3 | 10039 | vty_out (vty, "%4s %-5d %-16s %9u %10u %s%s", |
10040 | type, vrf_id_ui, inet_ntoa (bgp->router_id), | |
8386ac43 | 10041 | peers_cfg, peers_estb, name, |
10042 | VTY_NEWLINE); | |
10043 | } | |
10044 | ||
10045 | if (uj) | |
10046 | { | |
10047 | json_object_object_add(json, "vrfs", json_vrfs); | |
10048 | ||
10049 | json_object_int_add(json, "totalVrfs", count); | |
10050 | ||
10051 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
10052 | json_object_free(json); | |
10053 | } | |
10054 | else | |
10055 | { | |
10056 | if (count) | |
10057 | vty_out (vty, "%sTotal number of VRFs (including default): %d%s", | |
10058 | VTY_NEWLINE, count, VTY_NEWLINE); | |
10059 | } | |
10060 | ||
10061 | return CMD_SUCCESS; | |
10062 | } | |
10063 | ||
4bf6a362 PJ |
10064 | DEFUN (show_bgp_memory, |
10065 | show_bgp_memory_cmd, | |
10066 | "show bgp memory", | |
10067 | SHOW_STR | |
10068 | BGP_STR | |
10069 | "Global BGP memory statistics\n") | |
10070 | { | |
10071 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
10072 | unsigned long count; | |
10073 | ||
10074 | /* RIB related usage stats */ | |
10075 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
10076 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
10077 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10078 | count * sizeof (struct bgp_node)), | |
10079 | VTY_NEWLINE); | |
10080 | ||
10081 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
10082 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
10083 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10084 | count * sizeof (struct bgp_info)), | |
10085 | VTY_NEWLINE); | |
fb982c25 PJ |
10086 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
10087 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
10088 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10089 | count * sizeof (struct bgp_info_extra)), | |
10090 | VTY_NEWLINE); | |
4bf6a362 PJ |
10091 | |
10092 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
10093 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
10094 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10095 | count * sizeof (struct bgp_static)), | |
10096 | VTY_NEWLINE); | |
3f9c7369 DS |
10097 | |
10098 | if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET))) | |
10099 | vty_out (vty, "%ld Packets, using %s of memory%s", count, | |
10100 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10101 | count * sizeof (struct bpacket)), | |
10102 | VTY_NEWLINE); | |
4bf6a362 PJ |
10103 | |
10104 | /* Adj-In/Out */ | |
10105 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
10106 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
10107 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10108 | count * sizeof (struct bgp_adj_in)), | |
10109 | VTY_NEWLINE); | |
10110 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
10111 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
10112 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10113 | count * sizeof (struct bgp_adj_out)), | |
10114 | VTY_NEWLINE); | |
10115 | ||
10116 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
10117 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
10118 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10119 | count * sizeof (struct bgp_nexthop_cache)), | |
10120 | VTY_NEWLINE); | |
10121 | ||
10122 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
10123 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
10124 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10125 | count * sizeof (struct bgp_damp_info)), | |
10126 | VTY_NEWLINE); | |
10127 | ||
10128 | /* Attributes */ | |
10129 | count = attr_count(); | |
10130 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
10131 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10132 | count * sizeof(struct attr)), | |
10133 | VTY_NEWLINE); | |
fb982c25 PJ |
10134 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
10135 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
10136 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10137 | count * sizeof(struct attr_extra)), | |
10138 | VTY_NEWLINE); | |
4bf6a362 PJ |
10139 | |
10140 | if ((count = attr_unknown_count())) | |
10141 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
10142 | ||
10143 | /* AS_PATH attributes */ | |
10144 | count = aspath_count (); | |
10145 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
10146 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10147 | count * sizeof (struct aspath)), | |
10148 | VTY_NEWLINE); | |
10149 | ||
10150 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
10151 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
10152 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10153 | count * sizeof (struct assegment)), | |
10154 | VTY_NEWLINE); | |
10155 | ||
10156 | /* Other attributes */ | |
10157 | if ((count = community_count ())) | |
10158 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
10159 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10160 | count * sizeof (struct community)), | |
10161 | VTY_NEWLINE); | |
10162 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
10163 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
10164 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10165 | count * sizeof (struct ecommunity)), | |
10166 | VTY_NEWLINE); | |
10167 | ||
10168 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
10169 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
10170 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10171 | count * sizeof (struct cluster_list)), | |
10172 | VTY_NEWLINE); | |
10173 | ||
10174 | /* Peer related usage */ | |
10175 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
10176 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
10177 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10178 | count * sizeof (struct peer)), | |
10179 | VTY_NEWLINE); | |
10180 | ||
6e919709 | 10181 | if ((count = mtype_stats_alloc (MTYPE_BGP_PEER_GROUP))) |
4bf6a362 PJ |
10182 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
10183 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10184 | count * sizeof (struct peer_group)), | |
10185 | VTY_NEWLINE); | |
10186 | ||
10187 | /* Other */ | |
10188 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
10189 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
10190 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10191 | count * sizeof (struct hash)), | |
10192 | VTY_NEWLINE); | |
10193 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
10194 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
10195 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10196 | count * sizeof (struct hash_backet)), | |
10197 | VTY_NEWLINE); | |
10198 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
10199 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
10200 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10201 | count * sizeof (regex_t)), | |
10202 | VTY_NEWLINE); | |
10203 | return CMD_SUCCESS; | |
10204 | } | |
fee0f4c6 | 10205 | |
718e3744 | 10206 | /* Show BGP peer's summary information. */ |
94f2b392 | 10207 | static int |
b05a1c8b | 10208 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, |
9f689658 | 10209 | u_char use_json, json_object *json) |
718e3744 | 10210 | { |
10211 | struct peer *peer; | |
1eb8ef25 | 10212 | struct listnode *node, *nnode; |
f14e6fdb DS |
10213 | unsigned int count = 0, dn_count = 0; |
10214 | char timebuf[BGP_UPTIME_LEN], dn_flag[2]; | |
718e3744 | 10215 | int len; |
ffd0c037 DS |
10216 | json_object *json_peer = NULL; |
10217 | json_object *json_peers = NULL; | |
718e3744 | 10218 | |
10219 | /* Header string for each address family. */ | |
4a7ac06c | 10220 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; |
47fc97cc | 10221 | |
b05a1c8b DS |
10222 | if (use_json) |
10223 | { | |
9f689658 DD |
10224 | if (json == NULL) |
10225 | json = json_object_new_object(); | |
10226 | ||
f1aa5d8a | 10227 | json_peers = json_object_new_object(); |
b05a1c8b DS |
10228 | } |
10229 | ||
1eb8ef25 | 10230 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 10231 | { |
1ff9a340 DS |
10232 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
10233 | continue; | |
10234 | ||
718e3744 | 10235 | if (peer->afc[afi][safi]) |
10236 | { | |
b05a1c8b | 10237 | if (!count) |
4bf6a362 PJ |
10238 | { |
10239 | unsigned long ents; | |
10240 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
5c81a5f3 | 10241 | int vrf_id_ui; |
10242 | ||
10243 | vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id; | |
b05a1c8b | 10244 | |
4bf6a362 | 10245 | /* Usage summary and header */ |
b05a1c8b DS |
10246 | if (use_json) |
10247 | { | |
62d6dca0 | 10248 | json_object_string_add(json, "routerId", inet_ntoa (bgp->router_id)); |
f1aa5d8a | 10249 | json_object_int_add(json, "as", bgp->as); |
9f689658 DD |
10250 | json_object_int_add(json, "vrfId", vrf_id_ui); |
10251 | json_object_string_add(json, "vrfName", | |
10252 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10253 | ? "Default" : bgp->name); | |
b05a1c8b DS |
10254 | } |
10255 | else | |
10256 | { | |
10257 | vty_out (vty, | |
5c81a5f3 | 10258 | "BGP router identifier %s, local AS number %u vrf-id %d", |
10259 | inet_ntoa (bgp->router_id), bgp->as, vrf_id_ui); | |
6aeb9e78 | 10260 | vty_out (vty, "%s", VTY_NEWLINE); |
b05a1c8b DS |
10261 | } |
10262 | ||
f188f2c4 DS |
10263 | if (bgp_update_delay_configured(bgp)) |
10264 | { | |
b05a1c8b | 10265 | if (use_json) |
f188f2c4 | 10266 | { |
62d6dca0 | 10267 | json_object_int_add(json, "updateDelayLimit", bgp->v_update_delay); |
b05a1c8b DS |
10268 | |
10269 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
62d6dca0 | 10270 | json_object_int_add(json, "updateDelayEstablishWait", bgp->v_establish_wait); |
b05a1c8b DS |
10271 | |
10272 | if (bgp_update_delay_active(bgp)) | |
10273 | { | |
62d6dca0 DS |
10274 | json_object_string_add(json, "updateDelayFirstNeighbor", bgp->update_delay_begin_time); |
10275 | json_object_boolean_true_add(json, "updateDelayInProgress"); | |
b05a1c8b DS |
10276 | } |
10277 | else | |
10278 | { | |
10279 | if (bgp->update_delay_over) | |
10280 | { | |
62d6dca0 | 10281 | json_object_string_add(json, "updateDelayFirstNeighbor", |
f1aa5d8a | 10282 | bgp->update_delay_begin_time); |
62d6dca0 | 10283 | json_object_string_add(json, "updateDelayBestpathResumed", |
f1aa5d8a | 10284 | bgp->update_delay_end_time); |
62d6dca0 | 10285 | json_object_string_add(json, "updateDelayZebraUpdateResume", |
f1aa5d8a | 10286 | bgp->update_delay_zebra_resume_time); |
62d6dca0 | 10287 | json_object_string_add(json, "updateDelayPeerUpdateResume", |
f1aa5d8a | 10288 | bgp->update_delay_peers_resume_time); |
b05a1c8b DS |
10289 | } |
10290 | } | |
f188f2c4 DS |
10291 | } |
10292 | else | |
10293 | { | |
b05a1c8b DS |
10294 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", |
10295 | bgp->v_update_delay, VTY_NEWLINE); | |
10296 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
10297 | vty_out (vty, " Establish wait: %d seconds%s", | |
10298 | bgp->v_establish_wait, VTY_NEWLINE); | |
10299 | ||
10300 | if (bgp_update_delay_active(bgp)) | |
f188f2c4 DS |
10301 | { |
10302 | vty_out (vty, " First neighbor established: %s%s", | |
10303 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
b05a1c8b DS |
10304 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); |
10305 | } | |
10306 | else | |
10307 | { | |
10308 | if (bgp->update_delay_over) | |
10309 | { | |
10310 | vty_out (vty, " First neighbor established: %s%s", | |
10311 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
10312 | vty_out (vty, " Best-paths resumed: %s%s", | |
10313 | bgp->update_delay_end_time, VTY_NEWLINE); | |
10314 | vty_out (vty, " zebra update resumed: %s%s", | |
10315 | bgp->update_delay_zebra_resume_time, VTY_NEWLINE); | |
10316 | vty_out (vty, " peers update resumed: %s%s", | |
10317 | bgp->update_delay_peers_resume_time, VTY_NEWLINE); | |
10318 | } | |
f188f2c4 DS |
10319 | } |
10320 | } | |
10321 | } | |
4bf6a362 | 10322 | |
b05a1c8b DS |
10323 | if (use_json) |
10324 | { | |
10325 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
62d6dca0 | 10326 | json_object_boolean_true_add(json, "maxMedOnStartup"); |
b05a1c8b | 10327 | if (bgp->v_maxmed_admin) |
62d6dca0 | 10328 | json_object_boolean_true_add(json, "maxMedAdministrative"); |
b05a1c8b | 10329 | |
62d6dca0 | 10330 | json_object_int_add(json, "tableVersion", bgp_table_version(bgp->rib[afi][safi])); |
b05a1c8b DS |
10331 | |
10332 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
62d6dca0 DS |
10333 | json_object_int_add(json, "ribCount", ents); |
10334 | json_object_int_add(json, "ribMemory", ents * sizeof (struct bgp_node)); | |
b05a1c8b DS |
10335 | |
10336 | ents = listcount (bgp->peer); | |
62d6dca0 DS |
10337 | json_object_int_add(json, "peerCount", ents); |
10338 | json_object_int_add(json, "peerMemory", ents * sizeof (struct peer)); | |
b05a1c8b | 10339 | |
b05a1c8b DS |
10340 | if ((ents = listcount (bgp->group))) |
10341 | { | |
62d6dca0 DS |
10342 | json_object_int_add(json, "peerGroupCount", ents); |
10343 | json_object_int_add(json, "peerGroupMemory", ents * sizeof (struct peer_group)); | |
b05a1c8b | 10344 | } |
3f9c7369 | 10345 | |
b05a1c8b | 10346 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
62d6dca0 | 10347 | json_object_boolean_true_add(json, "dampeningEnabled"); |
b05a1c8b DS |
10348 | } |
10349 | else | |
10350 | { | |
10351 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
10352 | vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE); | |
10353 | if (bgp->v_maxmed_admin) | |
10354 | vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE); | |
10355 | ||
ffd0c037 | 10356 | vty_out(vty, "BGP table version %" PRIu64 "%s", |
b05a1c8b DS |
10357 | bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE); |
10358 | ||
10359 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
10360 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
10361 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10362 | ents * sizeof (struct bgp_node)), | |
10363 | VTY_NEWLINE); | |
10364 | ||
10365 | /* Peer related usage */ | |
10366 | ents = listcount (bgp->peer); | |
10367 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
10368 | ents, | |
10369 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10370 | ents * sizeof (struct peer)), | |
10371 | VTY_NEWLINE); | |
10372 | ||
b05a1c8b DS |
10373 | if ((ents = listcount (bgp->group))) |
10374 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
10375 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10376 | ents * sizeof (struct peer_group)), | |
10377 | VTY_NEWLINE); | |
10378 | ||
10379 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
10380 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
10381 | vty_out (vty, "%s", VTY_NEWLINE); | |
10382 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
10383 | } | |
4bf6a362 PJ |
10384 | } |
10385 | ||
b05a1c8b | 10386 | count++; |
718e3744 | 10387 | |
b05a1c8b DS |
10388 | if (use_json) |
10389 | { | |
10390 | json_peer = json_object_new_object(); | |
f14e6fdb | 10391 | |
b05a1c8b | 10392 | if (peer_dynamic_neighbor(peer)) |
62d6dca0 | 10393 | json_object_boolean_true_add(json_peer, "dynamicPeer"); |
b05a1c8b | 10394 | |
04b6bdc0 DW |
10395 | if (peer->hostname) |
10396 | json_object_string_add(json_peer, "hostname", peer->hostname); | |
10397 | ||
10398 | if (peer->domainname) | |
10399 | json_object_string_add(json_peer, "domainname", peer->domainname); | |
10400 | ||
62d6dca0 | 10401 | json_object_int_add(json_peer, "remoteAs", peer->as); |
f1aa5d8a | 10402 | json_object_int_add(json_peer, "version", 4); |
62d6dca0 | 10403 | json_object_int_add(json_peer, "msgRcvd", |
f1aa5d8a DS |
10404 | peer->open_in + peer->update_in + peer->keepalive_in |
10405 | + peer->notify_in + peer->refresh_in | |
10406 | + peer->dynamic_cap_in); | |
62d6dca0 | 10407 | json_object_int_add(json_peer, "msgSent", |
f1aa5d8a DS |
10408 | peer->open_out + peer->update_out + peer->keepalive_out |
10409 | + peer->notify_out + peer->refresh_out | |
10410 | + peer->dynamic_cap_out); | |
10411 | ||
62d6dca0 | 10412 | json_object_int_add(json_peer, "tableVersion", peer->version[afi][safi]); |
f1aa5d8a DS |
10413 | json_object_int_add(json_peer, "outq", peer->obuf->count); |
10414 | json_object_int_add(json_peer, "inq", 0); | |
856ca177 | 10415 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, use_json, json_peer); |
62d6dca0 | 10416 | json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][safi]); |
b05a1c8b DS |
10417 | |
10418 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
f1aa5d8a | 10419 | json_object_string_add(json_peer, "state", "Idle (Admin)"); |
b05a1c8b | 10420 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
f1aa5d8a | 10421 | json_object_string_add(json_peer, "state", "Idle (PfxCt)"); |
b05a1c8b | 10422 | else |
f1aa5d8a | 10423 | json_object_string_add(json_peer, "state", LOOKUP(bgp_status_msg, peer->status)); |
b05a1c8b | 10424 | |
f1aa5d8a | 10425 | if (peer->conf_if) |
62d6dca0 | 10426 | json_object_string_add(json_peer, "idType", "interface"); |
f1aa5d8a | 10427 | else if (peer->su.sa.sa_family == AF_INET) |
62d6dca0 | 10428 | json_object_string_add(json_peer, "idType", "ipv4"); |
f1aa5d8a | 10429 | else if (peer->su.sa.sa_family == AF_INET6) |
62d6dca0 | 10430 | json_object_string_add(json_peer, "idType", "ipv6"); |
b05a1c8b | 10431 | |
f1aa5d8a | 10432 | json_object_object_add(json_peers, peer->host, json_peer); |
b05a1c8b DS |
10433 | } |
10434 | else | |
10435 | { | |
10436 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
10437 | if (peer_dynamic_neighbor(peer)) | |
10438 | { | |
10439 | dn_count++; | |
10440 | dn_flag[0] = '*'; | |
10441 | } | |
10442 | ||
04b6bdc0 DW |
10443 | if (peer->hostname && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME)) |
10444 | len = vty_out (vty, "%s%s(%s)", dn_flag, peer->hostname, | |
10445 | peer->host); | |
10446 | else | |
10447 | len = vty_out (vty, "%s%s", dn_flag, peer->host); | |
b05a1c8b DS |
10448 | len = 16 - len; |
10449 | ||
10450 | if (len < 1) | |
10451 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
10452 | else | |
10453 | vty_out (vty, "%*s", len, " "); | |
10454 | ||
10455 | vty_out (vty, "4 "); | |
10456 | ||
ee046671 | 10457 | vty_out (vty, "%5u %7d %7d %8" PRIu64 " %4d %4zd ", |
b05a1c8b DS |
10458 | peer->as, |
10459 | peer->open_in + peer->update_in + peer->keepalive_in | |
10460 | + peer->notify_in + peer->refresh_in | |
10461 | + peer->dynamic_cap_in, | |
10462 | peer->open_out + peer->update_out + peer->keepalive_out | |
10463 | + peer->notify_out + peer->refresh_out | |
10464 | + peer->dynamic_cap_out, | |
10465 | peer->version[afi][safi], | |
10466 | 0, | |
ffd0c037 | 10467 | peer->obuf->count); |
b05a1c8b | 10468 | |
f1aa5d8a | 10469 | vty_out (vty, "%-8s", |
856ca177 | 10470 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); |
b05a1c8b DS |
10471 | |
10472 | if (peer->status == Established) | |
10473 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); | |
10474 | else | |
10475 | { | |
10476 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
10477 | vty_out (vty, " Idle (Admin)"); | |
10478 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
10479 | vty_out (vty, " Idle (PfxCt)"); | |
10480 | else | |
10481 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
10482 | } | |
10483 | vty_out (vty, "%s", VTY_NEWLINE); | |
10484 | } | |
718e3744 | 10485 | } |
10486 | } | |
10487 | ||
b05a1c8b DS |
10488 | if (use_json) |
10489 | { | |
10490 | json_object_object_add(json, "peers", json_peers); | |
14151a32 | 10491 | |
62d6dca0 DS |
10492 | json_object_int_add(json, "totalPeers", count); |
10493 | json_object_int_add(json, "dynamicPeers", dn_count); | |
14151a32 | 10494 | |
b05a1c8b | 10495 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); |
f1aa5d8a | 10496 | json_object_free(json); |
b05a1c8b DS |
10497 | } |
10498 | else | |
f14e6fdb | 10499 | { |
b05a1c8b DS |
10500 | if (count) |
10501 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
10502 | count, VTY_NEWLINE); | |
10503 | else | |
9f689658 DD |
10504 | { |
10505 | if (use_json) | |
10506 | vty_out(vty, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s", | |
10507 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
10508 | else | |
10509 | vty_out (vty, "No %s neighbor is configured%s", | |
10510 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
10511 | } | |
b05a1c8b | 10512 | |
9f689658 | 10513 | if (dn_count && ! use_json) |
b05a1c8b DS |
10514 | { |
10515 | vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE); | |
10516 | vty_out(vty, | |
10517 | "%d dynamic neighbor(s), limit %d%s", | |
10518 | dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
10519 | } | |
f14e6fdb DS |
10520 | } |
10521 | ||
718e3744 | 10522 | return CMD_SUCCESS; |
10523 | } | |
10524 | ||
47fc97cc DS |
10525 | static int |
10526 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
b05a1c8b | 10527 | afi_t afi, safi_t safi, u_char use_json) |
718e3744 | 10528 | { |
10529 | struct bgp *bgp; | |
10530 | ||
10531 | if (name) | |
10532 | { | |
10533 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 10534 | |
718e3744 | 10535 | if (! bgp) |
10536 | { | |
47fc97cc | 10537 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 10538 | return CMD_WARNING; |
10539 | } | |
10540 | ||
9f689658 | 10541 | bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); |
718e3744 | 10542 | return CMD_SUCCESS; |
10543 | } | |
47fc97cc | 10544 | |
718e3744 | 10545 | bgp = bgp_get_default (); |
10546 | ||
10547 | if (bgp) | |
9f689658 | 10548 | bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); |
47fc97cc | 10549 | |
718e3744 | 10550 | return CMD_SUCCESS; |
10551 | } | |
10552 | ||
f186de26 | 10553 | static void |
10554 | bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi, | |
10555 | u_char use_json) | |
10556 | { | |
10557 | struct listnode *node, *nnode; | |
10558 | struct bgp *bgp; | |
9f689658 DD |
10559 | json_object *json = NULL; |
10560 | int is_first = 1; | |
10561 | ||
10562 | if (use_json) | |
10563 | vty_out (vty, "{%s", VTY_NEWLINE); | |
f186de26 | 10564 | |
10565 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
10566 | { | |
9f689658 DD |
10567 | if (use_json) |
10568 | { | |
10569 | if (!(json = json_object_new_object())) | |
10570 | { | |
10571 | zlog_err("Unable to allocate memory for JSON object"); | |
10572 | vty_out (vty, | |
10573 | "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s", | |
10574 | VTY_NEWLINE); | |
10575 | return; | |
10576 | } | |
10577 | ||
10578 | if (! is_first) | |
10579 | vty_out (vty, ",%s", VTY_NEWLINE); | |
10580 | else | |
10581 | is_first = 0; | |
10582 | ||
10583 | vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10584 | ? "Default" : bgp->name); | |
10585 | } | |
10586 | else | |
10587 | { | |
10588 | vty_out (vty, "%sInstance %s:%s", | |
10589 | VTY_NEWLINE, | |
10590 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10591 | ? "Default" : bgp->name, VTY_NEWLINE); | |
10592 | } | |
10593 | bgp_show_summary (vty, bgp, afi, safi, use_json, json); | |
f186de26 | 10594 | } |
9f689658 DD |
10595 | |
10596 | if (use_json) | |
10597 | vty_out (vty, "}%s", VTY_NEWLINE); | |
10598 | ||
f186de26 | 10599 | } |
10600 | ||
718e3744 | 10601 | /* `show ip bgp summary' commands. */ |
47fc97cc | 10602 | DEFUN (show_ip_bgp_summary, |
718e3744 | 10603 | show_ip_bgp_summary_cmd, |
b05a1c8b | 10604 | "show ip bgp summary {json}", |
47fc97cc DS |
10605 | SHOW_STR |
10606 | IP_STR | |
10607 | BGP_STR | |
b05a1c8b DS |
10608 | "Summary of BGP neighbor status\n" |
10609 | "JavaScript Object Notation\n") | |
47fc97cc | 10610 | { |
db7c8528 DS |
10611 | u_char uj = use_json(argc, argv); |
10612 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); | |
718e3744 | 10613 | } |
10614 | ||
10615 | DEFUN (show_ip_bgp_instance_summary, | |
10616 | show_ip_bgp_instance_summary_cmd, | |
8386ac43 | 10617 | "show ip bgp " BGP_INSTANCE_CMD " summary {json}", |
718e3744 | 10618 | SHOW_STR |
10619 | IP_STR | |
10620 | BGP_STR | |
8386ac43 | 10621 | BGP_INSTANCE_HELP_STR |
b05a1c8b DS |
10622 | "Summary of BGP neighbor status\n" |
10623 | "JavaScript Object Notation\n") | |
718e3744 | 10624 | { |
db7c8528 | 10625 | u_char uj = use_json(argc, argv); |
6aeb9e78 | 10626 | return bgp_show_summary_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10627 | } |
10628 | ||
f186de26 | 10629 | DEFUN (show_ip_bgp_instance_all_summary, |
10630 | show_ip_bgp_instance_all_summary_cmd, | |
10631 | "show ip bgp " BGP_INSTANCE_ALL_CMD " summary {json}", | |
10632 | SHOW_STR | |
10633 | IP_STR | |
10634 | BGP_STR | |
10635 | BGP_INSTANCE_ALL_HELP_STR | |
10636 | "Summary of BGP neighbor status\n" | |
10637 | "JavaScript Object Notation\n") | |
10638 | { | |
10639 | u_char uj = use_json(argc, argv); | |
10640 | ||
10641 | bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj); | |
10642 | return CMD_SUCCESS; | |
10643 | } | |
10644 | ||
718e3744 | 10645 | DEFUN (show_ip_bgp_ipv4_summary, |
10646 | show_ip_bgp_ipv4_summary_cmd, | |
b05a1c8b | 10647 | "show ip bgp ipv4 (unicast|multicast) summary {json}", |
718e3744 | 10648 | SHOW_STR |
10649 | IP_STR | |
10650 | BGP_STR | |
10651 | "Address family\n" | |
10652 | "Address Family modifier\n" | |
10653 | "Address Family modifier\n" | |
b05a1c8b DS |
10654 | "Summary of BGP neighbor status\n" |
10655 | "JavaScript Object Notation\n") | |
718e3744 | 10656 | { |
db7c8528 | 10657 | u_char uj = use_json(argc, argv); |
718e3744 | 10658 | if (strncmp (argv[0], "m", 1) == 0) |
db7c8528 | 10659 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj); |
718e3744 | 10660 | |
db7c8528 | 10661 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10662 | } |
10663 | ||
95cbbd2a ML |
10664 | ALIAS (show_ip_bgp_ipv4_summary, |
10665 | show_bgp_ipv4_safi_summary_cmd, | |
b05a1c8b | 10666 | "show bgp ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10667 | SHOW_STR |
10668 | BGP_STR | |
10669 | "Address family\n" | |
10670 | "Address Family modifier\n" | |
10671 | "Address Family modifier\n" | |
10672 | "Summary of BGP neighbor status\n") | |
10673 | ||
718e3744 | 10674 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
10675 | show_ip_bgp_instance_ipv4_summary_cmd, | |
b05a1c8b | 10676 | "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}", |
718e3744 | 10677 | SHOW_STR |
10678 | IP_STR | |
10679 | BGP_STR | |
10680 | "BGP view\n" | |
10681 | "View name\n" | |
10682 | "Address family\n" | |
10683 | "Address Family modifier\n" | |
10684 | "Address Family modifier\n" | |
b05a1c8b DS |
10685 | "Summary of BGP neighbor status\n" |
10686 | "JavaScript Object Notation\n") | |
718e3744 | 10687 | { |
db7c8528 | 10688 | u_char uj = use_json(argc, argv); |
718e3744 | 10689 | if (strncmp (argv[1], "m", 1) == 0) |
db7c8528 | 10690 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, uj); |
718e3744 | 10691 | else |
db7c8528 | 10692 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10693 | } |
10694 | ||
95cbbd2a ML |
10695 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
10696 | show_bgp_instance_ipv4_safi_summary_cmd, | |
b05a1c8b | 10697 | "show bgp view WORD ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10698 | SHOW_STR |
10699 | BGP_STR | |
10700 | "BGP view\n" | |
10701 | "View name\n" | |
10702 | "Address family\n" | |
10703 | "Address Family modifier\n" | |
10704 | "Address Family modifier\n" | |
10705 | "Summary of BGP neighbor status\n") | |
10706 | ||
718e3744 | 10707 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
10708 | show_ip_bgp_vpnv4_all_summary_cmd, | |
b05a1c8b | 10709 | "show ip bgp vpnv4 all summary {json}", |
718e3744 | 10710 | SHOW_STR |
10711 | IP_STR | |
10712 | BGP_STR | |
10713 | "Display VPNv4 NLRI specific information\n" | |
10714 | "Display information about all VPNv4 NLRIs\n" | |
b05a1c8b DS |
10715 | "Summary of BGP neighbor status\n" |
10716 | "JavaScript Object Notation\n") | |
718e3744 | 10717 | { |
db7c8528 DS |
10718 | u_char uj = use_json(argc, argv); |
10719 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); | |
718e3744 | 10720 | } |
10721 | ||
10722 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
10723 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
b05a1c8b | 10724 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}", |
718e3744 | 10725 | SHOW_STR |
10726 | IP_STR | |
10727 | BGP_STR | |
10728 | "Display VPNv4 NLRI specific information\n" | |
10729 | "Display information for a route distinguisher\n" | |
10730 | "VPN Route Distinguisher\n" | |
b05a1c8b DS |
10731 | "Summary of BGP neighbor status\n" |
10732 | "JavaScript Object Notation\n") | |
718e3744 | 10733 | { |
10734 | int ret; | |
10735 | struct prefix_rd prd; | |
db7c8528 | 10736 | u_char uj = use_json(argc, argv); |
718e3744 | 10737 | |
10738 | ret = str2prefix_rd (argv[0], &prd); | |
10739 | if (! ret) | |
10740 | { | |
10741 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
10742 | return CMD_WARNING; | |
10743 | } | |
10744 | ||
db7c8528 | 10745 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); |
718e3744 | 10746 | } |
10747 | ||
10748 | #ifdef HAVE_IPV6 | |
47fc97cc | 10749 | DEFUN (show_bgp_summary, |
718e3744 | 10750 | show_bgp_summary_cmd, |
b05a1c8b | 10751 | "show bgp summary {json}", |
718e3744 | 10752 | SHOW_STR |
10753 | BGP_STR | |
b05a1c8b DS |
10754 | "Summary of BGP neighbor status\n" |
10755 | "JavaScript Object Notation\n") | |
718e3744 | 10756 | { |
db7c8528 | 10757 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); |
718e3744 | 10758 | } |
10759 | ||
10760 | DEFUN (show_bgp_instance_summary, | |
10761 | show_bgp_instance_summary_cmd, | |
8386ac43 | 10762 | "show bgp " BGP_INSTANCE_CMD " summary {json}", |
718e3744 | 10763 | SHOW_STR |
10764 | BGP_STR | |
8386ac43 | 10765 | BGP_INSTANCE_HELP_STR |
b05a1c8b DS |
10766 | "Summary of BGP neighbor status\n" |
10767 | "JavaScript Object Notation\n") | |
718e3744 | 10768 | { |
6aeb9e78 | 10769 | return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); |
718e3744 | 10770 | } |
10771 | ||
f186de26 | 10772 | DEFUN (show_bgp_instance_all_summary, |
10773 | show_bgp_instance_all_summary_cmd, | |
10774 | "show bgp " BGP_INSTANCE_ALL_CMD " summary {json}", | |
10775 | SHOW_STR | |
10776 | BGP_STR | |
10777 | BGP_INSTANCE_ALL_HELP_STR | |
10778 | "Summary of BGP neighbor status\n" | |
10779 | "JavaScript Object Notation\n") | |
10780 | { | |
10781 | u_char uj = use_json(argc, argv); | |
10782 | ||
10783 | bgp_show_all_instances_summary_vty (vty, AFI_IP6, SAFI_UNICAST, uj); | |
10784 | return CMD_SUCCESS; | |
10785 | } | |
10786 | ||
718e3744 | 10787 | ALIAS (show_bgp_summary, |
10788 | show_bgp_ipv6_summary_cmd, | |
b05a1c8b | 10789 | "show bgp ipv6 summary {json}", |
718e3744 | 10790 | SHOW_STR |
10791 | BGP_STR | |
10792 | "Address family\n" | |
10793 | "Summary of BGP neighbor status\n") | |
10794 | ||
10795 | ALIAS (show_bgp_instance_summary, | |
10796 | show_bgp_instance_ipv6_summary_cmd, | |
8386ac43 | 10797 | "show bgp " BGP_INSTANCE_CMD " ipv6 summary {json}", |
718e3744 | 10798 | SHOW_STR |
10799 | BGP_STR | |
8386ac43 | 10800 | BGP_INSTANCE_HELP_STR |
718e3744 | 10801 | "Address family\n" |
10802 | "Summary of BGP neighbor status\n") | |
10803 | ||
95cbbd2a ML |
10804 | DEFUN (show_bgp_ipv6_safi_summary, |
10805 | show_bgp_ipv6_safi_summary_cmd, | |
b05a1c8b | 10806 | "show bgp ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10807 | SHOW_STR |
10808 | BGP_STR | |
10809 | "Address family\n" | |
10810 | "Address Family modifier\n" | |
10811 | "Address Family modifier\n" | |
b05a1c8b DS |
10812 | "Summary of BGP neighbor status\n" |
10813 | "JavaScript Object Notation\n") | |
95cbbd2a | 10814 | { |
db7c8528 | 10815 | u_char uj = use_json(argc, argv); |
95cbbd2a | 10816 | if (strncmp (argv[0], "m", 1) == 0) |
db7c8528 | 10817 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); |
95cbbd2a | 10818 | |
db7c8528 | 10819 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); |
95cbbd2a ML |
10820 | } |
10821 | ||
10822 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
10823 | show_bgp_instance_ipv6_safi_summary_cmd, | |
8386ac43 | 10824 | "show bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10825 | SHOW_STR |
10826 | BGP_STR | |
8386ac43 | 10827 | BGP_INSTANCE_HELP_STR |
95cbbd2a ML |
10828 | "Address family\n" |
10829 | "Address Family modifier\n" | |
10830 | "Address Family modifier\n" | |
b05a1c8b DS |
10831 | "Summary of BGP neighbor status\n" |
10832 | "JavaScript Object Notation\n") | |
95cbbd2a | 10833 | { |
db7c8528 | 10834 | u_char uj = use_json(argc, argv); |
6aeb9e78 DS |
10835 | if (strncmp (argv[2], "m", 1) == 0) |
10836 | return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_MULTICAST, uj); | |
95cbbd2a | 10837 | |
6aeb9e78 | 10838 | return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, uj); |
95cbbd2a ML |
10839 | } |
10840 | ||
718e3744 | 10841 | /* old command */ |
10842 | DEFUN (show_ipv6_bgp_summary, | |
10843 | show_ipv6_bgp_summary_cmd, | |
b05a1c8b | 10844 | "show ipv6 bgp summary {json}", |
718e3744 | 10845 | SHOW_STR |
10846 | IPV6_STR | |
10847 | BGP_STR | |
b05a1c8b DS |
10848 | "Summary of BGP neighbor status\n" |
10849 | "JavaScript Object Notation\n") | |
718e3744 | 10850 | { |
db7c8528 DS |
10851 | u_char uj = use_json(argc, argv); |
10852 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); | |
718e3744 | 10853 | } |
10854 | ||
10855 | /* old command */ | |
10856 | DEFUN (show_ipv6_mbgp_summary, | |
10857 | show_ipv6_mbgp_summary_cmd, | |
b05a1c8b | 10858 | "show ipv6 mbgp summary {json}", |
718e3744 | 10859 | SHOW_STR |
10860 | IPV6_STR | |
10861 | MBGP_STR | |
b05a1c8b DS |
10862 | "Summary of BGP neighbor status\n" |
10863 | "JavaScript Object Notation\n") | |
718e3744 | 10864 | { |
db7c8528 DS |
10865 | u_char uj = use_json(argc, argv); |
10866 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); | |
718e3744 | 10867 | } |
10868 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 10869 | |
fd79ac91 | 10870 | const char * |
538621f2 | 10871 | afi_safi_print (afi_t afi, safi_t safi) |
10872 | { | |
10873 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
10874 | return "IPv4 Unicast"; | |
10875 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
10876 | return "IPv4 Multicast"; | |
10877 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
945c8fe9 | 10878 | return "VPN-IPv4 Unicast"; |
8b1fb8be LB |
10879 | else if (afi == AFI_IP && safi == SAFI_ENCAP) |
10880 | return "ENCAP-IPv4 Unicast"; | |
538621f2 | 10881 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
10882 | return "IPv6 Unicast"; | |
10883 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
10884 | return "IPv6 Multicast"; | |
945c8fe9 LB |
10885 | else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN) |
10886 | return "VPN-IPv6 Unicast"; | |
8b1fb8be LB |
10887 | else if (afi == AFI_IP6 && safi == SAFI_ENCAP) |
10888 | return "ENCAP-IPv6 Unicast"; | |
538621f2 | 10889 | else |
10890 | return "Unknown"; | |
10891 | } | |
10892 | ||
718e3744 | 10893 | /* Show BGP peer's information. */ |
10894 | enum show_type | |
10895 | { | |
10896 | show_all, | |
10897 | show_peer | |
10898 | }; | |
10899 | ||
94f2b392 | 10900 | static void |
856ca177 MS |
10901 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
10902 | u_int16_t adv_smcap, u_int16_t adv_rmcap, u_int16_t rcv_smcap, | |
10903 | u_int16_t rcv_rmcap, u_char use_json, json_object *json_pref) | |
718e3744 | 10904 | { |
10905 | /* Send-Mode */ | |
10906 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
10907 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10908 | { | |
856ca177 MS |
10909 | if (use_json) |
10910 | { | |
10911 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10912 | json_object_string_add(json_pref, "sendMode", "advertisedAndReceived"); | |
10913 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
10914 | json_object_string_add(json_pref, "sendMode", "advertised"); | |
10915 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10916 | json_object_string_add(json_pref, "sendMode", "received"); | |
10917 | } | |
10918 | else | |
10919 | { | |
10920 | vty_out (vty, " Send-mode: "); | |
10921 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
10922 | vty_out (vty, "advertised"); | |
10923 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10924 | vty_out (vty, "%sreceived", | |
10925 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
10926 | ", " : ""); | |
10927 | vty_out (vty, "%s", VTY_NEWLINE); | |
10928 | } | |
718e3744 | 10929 | } |
10930 | ||
10931 | /* Receive-Mode */ | |
10932 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
10933 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10934 | { | |
856ca177 MS |
10935 | if (use_json) |
10936 | { | |
10937 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10938 | json_object_string_add(json_pref, "recvMode", "advertisedAndReceived"); | |
10939 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
10940 | json_object_string_add(json_pref, "recvMode", "advertised"); | |
10941 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10942 | json_object_string_add(json_pref, "recvMode", "received"); | |
10943 | } | |
10944 | else | |
10945 | { | |
10946 | vty_out (vty, " Receive-mode: "); | |
10947 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
10948 | vty_out (vty, "advertised"); | |
10949 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10950 | vty_out (vty, "%sreceived", | |
10951 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
10952 | ", " : ""); | |
10953 | vty_out (vty, "%s", VTY_NEWLINE); | |
10954 | } | |
718e3744 | 10955 | } |
10956 | } | |
10957 | ||
94f2b392 | 10958 | static void |
856ca177 MS |
10959 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
10960 | u_char use_json, json_object *json_neigh) | |
718e3744 | 10961 | { |
10962 | struct bgp_filter *filter; | |
3f9c7369 | 10963 | struct peer_af *paf; |
718e3744 | 10964 | char orf_pfx_name[BUFSIZ]; |
10965 | int orf_pfx_count; | |
856ca177 MS |
10966 | json_object *json_af = NULL; |
10967 | json_object *json_prefA = NULL; | |
10968 | json_object *json_prefB = NULL; | |
10969 | json_object *json_addr = NULL; | |
718e3744 | 10970 | |
856ca177 MS |
10971 | if (use_json) |
10972 | { | |
10973 | json_addr = json_object_new_object(); | |
10974 | json_af = json_object_new_object(); | |
10975 | json_prefA = json_object_new_object(); | |
10976 | json_prefB = json_object_new_object(); | |
10977 | filter = &p->filter[afi][safi]; | |
718e3744 | 10978 | |
c8560b44 | 10979 | if (peer_group_active(p)) |
856ca177 | 10980 | json_object_string_add(json_addr, "peerGroupMember", p->group->name); |
538621f2 | 10981 | |
856ca177 MS |
10982 | paf = peer_af_find(p, afi, safi); |
10983 | if (paf && PAF_SUBGRP(paf)) | |
10984 | { | |
10985 | json_object_int_add(json_addr, "updateGroupId", PAF_UPDGRP(paf)->id); | |
10986 | json_object_int_add(json_addr, "subGroupId", PAF_SUBGRP(paf)->id); | |
10987 | json_object_int_add(json_addr, "packetQueueLength", bpacket_queue_virtual_length(paf)); | |
10988 | } | |
10989 | ||
10990 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
10991 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
10992 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
10993 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
10994 | { | |
10995 | json_object_int_add(json_af, "orfType", ORF_TYPE_PREFIX); | |
10996 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
10997 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
10998 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
10999 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
11000 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, json_prefA); | |
11001 | json_object_object_add(json_af, "orfPrefixList", json_prefA); | |
11002 | } | |
11003 | ||
11004 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11005 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11006 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11007 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11008 | { | |
11009 | json_object_int_add(json_af, "orfOldType", ORF_TYPE_PREFIX_OLD); | |
11010 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11011 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11012 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11013 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
11014 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, json_prefB); | |
11015 | json_object_object_add(json_af, "orfOldPrefixList", json_prefB); | |
11016 | } | |
11017 | ||
11018 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11019 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
11020 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11021 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11022 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
11023 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11024 | json_object_object_add(json_addr, "afDependentCap", json_af); | |
11025 | ||
11026 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
11027 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
11028 | ||
11029 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
11030 | || orf_pfx_count) | |
11031 | { | |
11032 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
11033 | json_object_boolean_true_add(json_neigh, "orfSent"); | |
11034 | if (orf_pfx_count) | |
11035 | json_object_int_add(json_addr, "orfRecvCounter", orf_pfx_count); | |
11036 | } | |
11037 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
11038 | json_object_string_add(json_addr, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd"); | |
11039 | ||
11040 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
11041 | json_object_boolean_true_add(json_addr, "routeReflectorClient"); | |
11042 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
11043 | json_object_boolean_true_add(json_addr, "routeServerClient"); | |
11044 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
11045 | json_object_boolean_true_add(json_addr, "inboundSoftConfigPermit"); | |
11046 | ||
88b8ed8d DW |
11047 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
11048 | json_object_boolean_true_add(json_addr, "privateAsNumsAllReplacedInUpdatesToNbr"); | |
11049 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 11050 | json_object_boolean_true_add(json_addr, "privateAsNumsReplacedInUpdatesToNbr"); |
88b8ed8d DW |
11051 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
11052 | json_object_boolean_true_add(json_addr, "privateAsNumsAllRemovedInUpdatesToNbr"); | |
856ca177 MS |
11053 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
11054 | json_object_boolean_true_add(json_addr, "privateAsNumsRemovedInUpdatesToNbr"); | |
11055 | ||
adbac85e DW |
11056 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) |
11057 | json_object_boolean_true_add(json_addr, "addpathTxAllPaths"); | |
11058 | ||
06370dac DW |
11059 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) |
11060 | json_object_boolean_true_add(json_addr, "addpathTxBestpathPerAS"); | |
11061 | ||
856ca177 MS |
11062 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
11063 | json_object_string_add(json_addr, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs"); | |
11064 | ||
11065 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
11066 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
11067 | json_object_boolean_true_add(json_addr, "routerAlwaysNextHop"); | |
11068 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
11069 | json_object_boolean_true_add(json_addr, "unchangedAsPathPropogatedToNbr"); | |
11070 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
11071 | json_object_boolean_true_add(json_addr, "unchangedNextHopPropogatedToNbr"); | |
11072 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
11073 | json_object_boolean_true_add(json_addr, "unchangedMedPropogatedToNbr"); | |
718e3744 | 11074 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
856ca177 MS |
11075 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
11076 | { | |
11077 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11078 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11079 | json_object_string_add(json_addr, "commAttriSentToNbr", "extendedAndStandard"); | |
11080 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11081 | json_object_string_add(json_addr, "commAttriSentToNbr", "extended"); | |
11082 | else | |
11083 | json_object_string_add(json_addr, "commAttriSentToNbr", "standard"); | |
11084 | } | |
11085 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
11086 | { | |
11087 | if (p->default_rmap[afi][safi].name) | |
11088 | json_object_string_add(json_addr, "defaultRouteMap", p->default_rmap[afi][safi].name); | |
11089 | ||
11090 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
11091 | json_object_boolean_true_add(json_addr, "defaultSent"); | |
11092 | else | |
11093 | json_object_boolean_true_add(json_addr, "defaultNotSent"); | |
11094 | } | |
11095 | ||
11096 | if (filter->plist[FILTER_IN].name | |
11097 | || filter->dlist[FILTER_IN].name | |
11098 | || filter->aslist[FILTER_IN].name | |
11099 | || filter->map[RMAP_IN].name) | |
11100 | json_object_boolean_true_add(json_addr, "inboundPathPolicyConfig"); | |
11101 | if (filter->plist[FILTER_OUT].name | |
11102 | || filter->dlist[FILTER_OUT].name | |
11103 | || filter->aslist[FILTER_OUT].name | |
11104 | || filter->map[RMAP_OUT].name | |
11105 | || filter->usmap.name) | |
11106 | json_object_boolean_true_add(json_addr, "outboundPathPolicyConfig"); | |
856ca177 MS |
11107 | |
11108 | /* prefix-list */ | |
11109 | if (filter->plist[FILTER_IN].name) | |
11110 | json_object_string_add(json_addr, "incomingUpdatePrefixFilterList", filter->plist[FILTER_IN].name); | |
11111 | if (filter->plist[FILTER_OUT].name) | |
11112 | json_object_string_add(json_addr, "outgoingUpdatePrefixFilterList", filter->plist[FILTER_OUT].name); | |
11113 | ||
11114 | /* distribute-list */ | |
11115 | if (filter->dlist[FILTER_IN].name) | |
11116 | json_object_string_add(json_addr, "incomingUpdateNetworkFilterList", filter->dlist[FILTER_IN].name); | |
11117 | if (filter->dlist[FILTER_OUT].name) | |
11118 | json_object_string_add(json_addr, "outgoingUpdateNetworkFilterList", filter->dlist[FILTER_OUT].name); | |
11119 | ||
11120 | /* filter-list. */ | |
11121 | if (filter->aslist[FILTER_IN].name) | |
11122 | json_object_string_add(json_addr, "incomingUpdateAsPathFilterList", filter->aslist[FILTER_IN].name); | |
11123 | if (filter->aslist[FILTER_OUT].name) | |
11124 | json_object_string_add(json_addr, "outgoingUpdateAsPathFilterList", filter->aslist[FILTER_OUT].name); | |
11125 | ||
11126 | /* route-map. */ | |
11127 | if (filter->map[RMAP_IN].name) | |
11128 | json_object_string_add(json_addr, "routeMapForIncomingAdvertisements", filter->map[RMAP_IN].name); | |
11129 | if (filter->map[RMAP_OUT].name) | |
11130 | json_object_string_add(json_addr, "routeMapForOutgoingAdvertisements", filter->map[RMAP_OUT].name); | |
856ca177 MS |
11131 | |
11132 | /* unsuppress-map */ | |
11133 | if (filter->usmap.name) | |
11134 | json_object_string_add(json_addr, "selectiveUnsuppressRouteMap", filter->usmap.name); | |
11135 | ||
11136 | /* Receive prefix count */ | |
11137 | json_object_int_add(json_addr, "acceptedPrefixCounter", p->pcount[afi][safi]); | |
11138 | ||
11139 | /* Maximum prefix */ | |
11140 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
11141 | { | |
11142 | json_object_int_add(json_addr, "prefixAllowedMax", p->pmax[afi][safi]); | |
11143 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) | |
11144 | json_object_boolean_true_add(json_addr, "prefixAllowedMaxWarning"); | |
11145 | json_object_int_add(json_addr, "prefixAllowedWarningThresh", p->pmax_threshold[afi][safi]); | |
11146 | if (p->pmax_restart[afi][safi]) | |
11147 | json_object_int_add(json_addr, "prefixAllowedRestartIntervalMsecs", p->pmax_restart[afi][safi] * 60000); | |
11148 | } | |
11149 | json_object_object_add(json_neigh, afi_safi_print (afi, safi), json_addr); | |
11150 | ||
11151 | } | |
11152 | else | |
11153 | { | |
11154 | filter = &p->filter[afi][safi]; | |
11155 | ||
11156 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), | |
11157 | VTY_NEWLINE); | |
11158 | ||
c8560b44 | 11159 | if (peer_group_active(p)) |
856ca177 MS |
11160 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
11161 | ||
11162 | paf = peer_af_find(p, afi, safi); | |
11163 | if (paf && PAF_SUBGRP(paf)) | |
11164 | { | |
11165 | vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s", | |
11166 | PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE); | |
11167 | vty_out (vty, " Packet Queue length %d%s", | |
11168 | bpacket_queue_virtual_length(paf), VTY_NEWLINE); | |
11169 | } | |
718e3744 | 11170 | else |
856ca177 MS |
11171 | { |
11172 | vty_out(vty, " Not part of any update group%s", VTY_NEWLINE); | |
11173 | } | |
11174 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11175 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
11176 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11177 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11178 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
11179 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11180 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
11181 | ||
11182 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11183 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
11184 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11185 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
11186 | { | |
11187 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
11188 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
11189 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11190 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11191 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11192 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
11193 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, NULL); | |
11194 | } | |
11195 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11196 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11197 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11198 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11199 | { | |
11200 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
11201 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
11202 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11203 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11204 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11205 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
11206 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, NULL); | |
11207 | } | |
718e3744 | 11208 | |
856ca177 MS |
11209 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
11210 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
718e3744 | 11211 | |
856ca177 MS |
11212 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
11213 | || orf_pfx_count) | |
11214 | { | |
11215 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
11216 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
11217 | vty_out (vty, " sent;"); | |
11218 | if (orf_pfx_count) | |
11219 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
11220 | vty_out (vty, "%s", VTY_NEWLINE); | |
11221 | } | |
11222 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
11223 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
11224 | ||
11225 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
11226 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
11227 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
11228 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
11229 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
11230 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
11231 | ||
88b8ed8d DW |
11232 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
11233 | vty_out (vty, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE); | |
11234 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 11235 | vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE); |
88b8ed8d DW |
11236 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
11237 | vty_out (vty, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE); | |
856ca177 MS |
11238 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
11239 | vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE); | |
11240 | ||
adbac85e DW |
11241 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) |
11242 | vty_out (vty, " Advertise all paths via addpath%s", VTY_NEWLINE); | |
11243 | ||
06370dac DW |
11244 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) |
11245 | vty_out (vty, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE); | |
11246 | ||
856ca177 MS |
11247 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
11248 | vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE); | |
11249 | ||
11250 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
11251 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
11252 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); | |
11253 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
11254 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11255 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
11256 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11257 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
11258 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11259 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11260 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11261 | { | |
11262 | vty_out (vty, " Community attribute sent to this neighbor"); | |
11263 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11264 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11265 | vty_out (vty, "(both)%s", VTY_NEWLINE); | |
11266 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11267 | vty_out (vty, "(extended)%s", VTY_NEWLINE); | |
11268 | else | |
11269 | vty_out (vty, "(standard)%s", VTY_NEWLINE); | |
11270 | } | |
11271 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
11272 | { | |
11273 | vty_out (vty, " Default information originate,"); | |
11274 | ||
11275 | if (p->default_rmap[afi][safi].name) | |
11276 | vty_out (vty, " default route-map %s%s,", | |
11277 | p->default_rmap[afi][safi].map ? "*" : "", | |
11278 | p->default_rmap[afi][safi].name); | |
11279 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
11280 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
11281 | else | |
11282 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
11283 | } | |
718e3744 | 11284 | |
856ca177 MS |
11285 | if (filter->plist[FILTER_IN].name |
11286 | || filter->dlist[FILTER_IN].name | |
11287 | || filter->aslist[FILTER_IN].name | |
11288 | || filter->map[RMAP_IN].name) | |
11289 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); | |
11290 | if (filter->plist[FILTER_OUT].name | |
11291 | || filter->dlist[FILTER_OUT].name | |
11292 | || filter->aslist[FILTER_OUT].name | |
11293 | || filter->map[RMAP_OUT].name | |
11294 | || filter->usmap.name) | |
11295 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
856ca177 MS |
11296 | |
11297 | /* prefix-list */ | |
11298 | if (filter->plist[FILTER_IN].name) | |
11299 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
11300 | filter->plist[FILTER_IN].plist ? "*" : "", | |
11301 | filter->plist[FILTER_IN].name, | |
11302 | VTY_NEWLINE); | |
11303 | if (filter->plist[FILTER_OUT].name) | |
11304 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
11305 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
11306 | filter->plist[FILTER_OUT].name, | |
11307 | VTY_NEWLINE); | |
11308 | ||
11309 | /* distribute-list */ | |
11310 | if (filter->dlist[FILTER_IN].name) | |
11311 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
11312 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
11313 | filter->dlist[FILTER_IN].name, | |
11314 | VTY_NEWLINE); | |
11315 | if (filter->dlist[FILTER_OUT].name) | |
11316 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
11317 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
11318 | filter->dlist[FILTER_OUT].name, | |
11319 | VTY_NEWLINE); | |
11320 | ||
11321 | /* filter-list. */ | |
11322 | if (filter->aslist[FILTER_IN].name) | |
11323 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
11324 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
11325 | filter->aslist[FILTER_IN].name, | |
11326 | VTY_NEWLINE); | |
11327 | if (filter->aslist[FILTER_OUT].name) | |
11328 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
11329 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
11330 | filter->aslist[FILTER_OUT].name, | |
11331 | VTY_NEWLINE); | |
11332 | ||
11333 | /* route-map. */ | |
11334 | if (filter->map[RMAP_IN].name) | |
11335 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", | |
11336 | filter->map[RMAP_IN].map ? "*" : "", | |
11337 | filter->map[RMAP_IN].name, | |
11338 | VTY_NEWLINE); | |
11339 | if (filter->map[RMAP_OUT].name) | |
11340 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", | |
11341 | filter->map[RMAP_OUT].map ? "*" : "", | |
11342 | filter->map[RMAP_OUT].name, | |
11343 | VTY_NEWLINE); | |
856ca177 MS |
11344 | |
11345 | /* unsuppress-map */ | |
11346 | if (filter->usmap.name) | |
11347 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
11348 | filter->usmap.map ? "*" : "", | |
11349 | filter->usmap.name, VTY_NEWLINE); | |
11350 | ||
11351 | /* Receive prefix count */ | |
11352 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); | |
11353 | ||
11354 | /* Maximum prefix */ | |
11355 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
11356 | { | |
11357 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], | |
11358 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) | |
11359 | ? " (warning-only)" : "", VTY_NEWLINE); | |
11360 | vty_out (vty, " Threshold for warning message %d%%", | |
11361 | p->pmax_threshold[afi][safi]); | |
11362 | if (p->pmax_restart[afi][safi]) | |
11363 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
11364 | vty_out (vty, "%s", VTY_NEWLINE); | |
11365 | } | |
718e3744 | 11366 | |
0a486e5f | 11367 | vty_out (vty, "%s", VTY_NEWLINE); |
718e3744 | 11368 | } |
718e3744 | 11369 | } |
11370 | ||
94f2b392 | 11371 | static void |
e8f7da3a | 11372 | bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *json) |
718e3744 | 11373 | { |
11374 | struct bgp *bgp; | |
4690c7d7 | 11375 | char buf1[PREFIX2STR_BUFFER], buf[SU_ADDRSTRLEN]; |
718e3744 | 11376 | char timebuf[BGP_UPTIME_LEN]; |
f14e6fdb | 11377 | char dn_flag[2]; |
3a8c7ba1 DW |
11378 | const char *subcode_str; |
11379 | const char *code_str; | |
538621f2 | 11380 | afi_t afi; |
11381 | safi_t safi; | |
d6661008 DS |
11382 | u_int16_t i; |
11383 | u_char *msg; | |
e8f7da3a | 11384 | json_object *json_neigh = NULL; |
718e3744 | 11385 | |
11386 | bgp = p->bgp; | |
11387 | ||
e8f7da3a DW |
11388 | if (use_json) |
11389 | json_neigh = json_object_new_object(); | |
11390 | ||
856ca177 | 11391 | if (!use_json) |
f14e6fdb | 11392 | { |
856ca177 MS |
11393 | if (p->conf_if) /* Configured interface name. */ |
11394 | vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if, | |
11395 | BGP_PEER_SU_UNSPEC(p) ? "None" : | |
11396 | sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
11397 | else /* Configured IP address. */ | |
11398 | { | |
11399 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
11400 | if (peer_dynamic_neighbor(p)) | |
11401 | dn_flag[0] = '*'; | |
f14e6fdb | 11402 | |
856ca177 MS |
11403 | vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host); |
11404 | } | |
f14e6fdb DS |
11405 | } |
11406 | ||
856ca177 MS |
11407 | if (use_json) |
11408 | { | |
11409 | if (p->conf_if && BGP_PEER_SU_UNSPEC(p)) | |
11410 | json_object_string_add(json_neigh, "bgpNeighborAddr", "none"); | |
11411 | else if (p->conf_if && !BGP_PEER_SU_UNSPEC(p)) | |
11412 | json_object_string_add(json_neigh, "bgpNeighborAddr", sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
11413 | ||
11414 | json_object_int_add(json_neigh, "remoteAs", p->as); | |
11415 | ||
11416 | if (p->change_local_as) | |
11417 | json_object_int_add(json_neigh, "localAs", p->change_local_as); | |
11418 | else | |
11419 | json_object_int_add(json_neigh, "localAs", p->local_as); | |
11420 | ||
11421 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND)) | |
11422 | json_object_boolean_true_add(json_neigh, "localAsNoPrepend"); | |
66b199b2 | 11423 | |
856ca177 MS |
11424 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS)) |
11425 | json_object_boolean_true_add(json_neigh, "localAsReplaceAs"); | |
11426 | } | |
11427 | else | |
11428 | { | |
f8cfafda DS |
11429 | if ((p->as_type == AS_SPECIFIED) || |
11430 | (p->as_type == AS_EXTERNAL) || | |
11431 | (p->as_type == AS_INTERNAL)) | |
11432 | vty_out (vty, "remote AS %u, ", p->as); | |
11433 | else | |
11434 | vty_out (vty, "remote AS Unspecified, "); | |
856ca177 MS |
11435 | vty_out (vty, "local AS %u%s%s, ", |
11436 | p->change_local_as ? p->change_local_as : p->local_as, | |
11437 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
11438 | " no-prepend" : "", | |
11439 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
11440 | " replace-as" : ""); | |
11441 | } | |
66b199b2 DS |
11442 | /* peer type internal, external, confed-internal or confed-external */ |
11443 | if (p->as == p->local_as) | |
11444 | { | |
856ca177 MS |
11445 | if (use_json) |
11446 | { | |
11447 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11448 | json_object_boolean_true_add(json_neigh, "nbrConfedInternalLink"); | |
11449 | else | |
11450 | json_object_boolean_true_add(json_neigh, "nbrInternalLink"); | |
11451 | } | |
66b199b2 | 11452 | else |
856ca177 MS |
11453 | { |
11454 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11455 | vty_out (vty, "confed-internal link%s", VTY_NEWLINE); | |
11456 | else | |
11457 | vty_out (vty, "internal link%s", VTY_NEWLINE); | |
11458 | } | |
66b199b2 DS |
11459 | } |
11460 | else | |
11461 | { | |
856ca177 MS |
11462 | if (use_json) |
11463 | { | |
11464 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11465 | json_object_boolean_true_add(json_neigh, "nbrConfedExternalLink"); | |
11466 | else | |
11467 | json_object_boolean_true_add(json_neigh, "nbrExternalLink"); | |
11468 | } | |
66b199b2 | 11469 | else |
856ca177 MS |
11470 | { |
11471 | if (bgp_confederation_peers_check(bgp, p->as)) | |
11472 | vty_out (vty, "confed-external link%s", VTY_NEWLINE); | |
11473 | else | |
11474 | vty_out (vty, "external link%s", VTY_NEWLINE); | |
11475 | } | |
66b199b2 | 11476 | } |
718e3744 | 11477 | |
11478 | /* Description. */ | |
11479 | if (p->desc) | |
856ca177 MS |
11480 | { |
11481 | if (use_json) | |
11482 | json_object_string_add(json_neigh, "nbrDesc", p->desc); | |
11483 | else | |
11484 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
11485 | } | |
6410e93a | 11486 | |
04b6bdc0 DW |
11487 | if (p->hostname) |
11488 | { | |
d1570739 DW |
11489 | if (use_json) |
11490 | { | |
11491 | if (p->hostname) | |
11492 | json_object_string_add(json_neigh, "hostname", p->hostname); | |
11493 | ||
11494 | if (p->domainname) | |
11495 | json_object_string_add(json_neigh, "domainname", p->domainname); | |
11496 | } | |
04b6bdc0 | 11497 | else |
d1570739 DW |
11498 | { |
11499 | if (p->domainname && (p->domainname[0] != '\0')) | |
11500 | vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname, | |
11501 | VTY_NEWLINE); | |
11502 | else | |
11503 | vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE); | |
11504 | } | |
11505 | ||
04b6bdc0 DW |
11506 | } |
11507 | ||
c744aa9f | 11508 | /* Peer-group */ |
718e3744 | 11509 | if (p->group) |
f14e6fdb | 11510 | { |
856ca177 MS |
11511 | if (use_json) |
11512 | { | |
11513 | json_object_string_add(json_neigh, "peerGroup", p->group->name); | |
11514 | ||
11515 | if (dn_flag[0]) | |
11516 | { | |
40ee54a7 | 11517 | struct prefix prefix, *range = NULL; |
f14e6fdb | 11518 | |
40ee54a7 TT |
11519 | sockunion2hostprefix(&(p->su), &prefix); |
11520 | range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix); | |
856ca177 MS |
11521 | |
11522 | if (range) | |
11523 | { | |
11524 | prefix2str(range, buf1, sizeof(buf1)); | |
11525 | json_object_string_add(json_neigh, "peerSubnetRangeGroup", buf1); | |
11526 | } | |
11527 | } | |
11528 | } | |
11529 | else | |
f14e6fdb | 11530 | { |
856ca177 MS |
11531 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
11532 | p->group->name, VTY_NEWLINE); | |
f14e6fdb | 11533 | |
856ca177 | 11534 | if (dn_flag[0]) |
f14e6fdb | 11535 | { |
40ee54a7 | 11536 | struct prefix prefix, *range = NULL; |
856ca177 | 11537 | |
40ee54a7 TT |
11538 | sockunion2hostprefix(&(p->su), &prefix); |
11539 | range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix); | |
856ca177 MS |
11540 | |
11541 | if (range) | |
11542 | { | |
11543 | prefix2str(range, buf1, sizeof(buf1)); | |
11544 | vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTY_NEWLINE); | |
11545 | } | |
f14e6fdb DS |
11546 | } |
11547 | } | |
11548 | } | |
718e3744 | 11549 | |
856ca177 MS |
11550 | if (use_json) |
11551 | { | |
11552 | /* Administrative shutdown. */ | |
11553 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
11554 | json_object_boolean_true_add(json_neigh, "adminShutDown"); | |
718e3744 | 11555 | |
856ca177 MS |
11556 | /* BGP Version. */ |
11557 | json_object_int_add(json_neigh, "bgpVersion", 4); | |
11558 | json_object_string_add(json_neigh, "remoteRouterId", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ)); | |
718e3744 | 11559 | |
856ca177 MS |
11560 | /* Confederation */ |
11561 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) && bgp_confederation_peers_check (bgp, p->as)) | |
11562 | json_object_boolean_true_add(json_neigh, "nbrCommonAdmin"); | |
11563 | ||
11564 | /* Status. */ | |
11565 | json_object_string_add(json_neigh, "bgpState", LOOKUP (bgp_status_msg, p->status)); | |
11566 | ||
11567 | if (p->status == Established) | |
11568 | { | |
11569 | time_t uptime; | |
11570 | struct tm *tm; | |
11571 | ||
11572 | uptime = bgp_clock(); | |
11573 | uptime -= p->uptime; | |
11574 | tm = gmtime(&uptime); | |
11575 | ||
11576 | json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
11577 | } | |
11578 | ||
11579 | else if (p->status == Active) | |
11580 | { | |
11581 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
11582 | json_object_string_add(json_neigh, "bgpStateIs", "passive"); | |
11583 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
11584 | json_object_string_add(json_neigh, "bgpStateIs", "passiveNSF"); | |
11585 | } | |
11586 | ||
11587 | /* read timer */ | |
11588 | time_t uptime; | |
11589 | struct tm *tm; | |
11590 | ||
11591 | uptime = bgp_clock(); | |
11592 | uptime -= p->readtime; | |
11593 | tm = gmtime(&uptime); | |
11594 | json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
11595 | ||
11596 | uptime = bgp_clock(); | |
11597 | uptime -= p->last_write; | |
11598 | tm = gmtime(&uptime); | |
39e871e6 ST |
11599 | json_object_int_add(json_neigh, "bgpTimerLastWrite", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); |
11600 | ||
11601 | uptime = bgp_clock(); | |
11602 | uptime -= p->update_time; | |
11603 | tm = gmtime(&uptime); | |
11604 | json_object_int_add(json_neigh, "bgpInUpdateElapsedTimeMsecs", | |
11605 | (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
856ca177 MS |
11606 | |
11607 | /* Configured timer values. */ | |
11608 | json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs", p->v_holdtime * 1000); | |
11609 | json_object_int_add(json_neigh, "bgpTimerKeepAliveIntervalMsecs", p->v_keepalive * 1000); | |
11610 | ||
11611 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
11612 | { | |
11613 | json_object_int_add(json_neigh, "bgpTimerConfiguredHoldTimeMsecs", p->holdtime * 1000); | |
11614 | json_object_int_add(json_neigh, "bgpTimerConfiguredKeepAliveIntervalMsecs", p->keepalive * 1000); | |
11615 | } | |
93406d87 | 11616 | } |
856ca177 MS |
11617 | else |
11618 | { | |
11619 | /* Administrative shutdown. */ | |
11620 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
11621 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
11622 | ||
11623 | /* BGP Version. */ | |
11624 | vty_out (vty, " BGP version 4"); | |
11625 | vty_out (vty, ", remote router ID %s%s", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
11626 | VTY_NEWLINE); | |
11627 | ||
11628 | /* Confederation */ | |
11629 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) | |
11630 | && bgp_confederation_peers_check (bgp, p->as)) | |
11631 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); | |
718e3744 | 11632 | |
856ca177 MS |
11633 | /* Status. */ |
11634 | vty_out (vty, " BGP state = %s", LOOKUP (bgp_status_msg, p->status)); | |
718e3744 | 11635 | |
856ca177 MS |
11636 | if (p->status == Established) |
11637 | vty_out (vty, ", up for %8s", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
11638 | ||
11639 | else if (p->status == Active) | |
11640 | { | |
11641 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
11642 | vty_out (vty, " (passive)"); | |
11643 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
11644 | vty_out (vty, " (NSF passive)"); | |
11645 | } | |
11646 | vty_out (vty, "%s", VTY_NEWLINE); | |
93406d87 | 11647 | |
856ca177 MS |
11648 | /* read timer */ |
11649 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
11650 | vty_out (vty, ", Last write %s%s", | |
11651 | peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTY_NEWLINE); | |
11652 | ||
11653 | /* Configured timer values. */ | |
11654 | vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s", | |
11655 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); | |
11656 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
11657 | { | |
11658 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
11659 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
11660 | p->keepalive, VTY_NEWLINE); | |
11661 | } | |
11662 | } | |
718e3744 | 11663 | /* Capability. */ |
11664 | if (p->status == Established) | |
11665 | { | |
538621f2 | 11666 | if (p->cap |
718e3744 | 11667 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
11668 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
11669 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
11670 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
11671 | #ifdef HAVE_IPV6 | |
11672 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
11673 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
11674 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
11675 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
945c8fe9 LB |
11676 | || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN] |
11677 | || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN] | |
8b1fb8be LB |
11678 | || p->afc_adv[AFI_IP6][SAFI_ENCAP] |
11679 | || p->afc_recv[AFI_IP6][SAFI_ENCAP] | |
718e3744 | 11680 | #endif /* HAVE_IPV6 */ |
8b1fb8be LB |
11681 | || p->afc_adv[AFI_IP][SAFI_ENCAP] |
11682 | || p->afc_recv[AFI_IP][SAFI_ENCAP] | |
718e3744 | 11683 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
11684 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
11685 | { | |
856ca177 MS |
11686 | if (use_json) |
11687 | { | |
11688 | json_object *json_cap = NULL; | |
11689 | ||
11690 | json_cap = json_object_new_object(); | |
11691 | ||
11692 | /* AS4 */ | |
11693 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
11694 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11695 | { | |
11696 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) && CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11697 | json_object_string_add(json_cap, "4byteAs", "advertisedAndReceived"); | |
11698 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11699 | json_object_string_add(json_cap, "4byteAs", "advertised"); | |
11700 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11701 | json_object_string_add(json_cap, "4byteAs", "received"); | |
11702 | } | |
11703 | ||
11704 | /* AddPath */ | |
11705 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
11706 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
11707 | { | |
11708 | json_object *json_add = NULL; | |
11709 | const char *print_store; | |
718e3744 | 11710 | |
856ca177 | 11711 | json_add = json_object_new_object(); |
a82478b9 | 11712 | |
856ca177 MS |
11713 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
11714 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11715 | { | |
11716 | json_object *json_sub = NULL; | |
11717 | json_sub = json_object_new_object(); | |
11718 | print_store = afi_safi_print (afi, safi); | |
11719 | ||
11720 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
11721 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11722 | { | |
11723 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) && CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11724 | json_object_boolean_true_add(json_sub, "txAdvertisedAndReceived"); | |
11725 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) | |
11726 | json_object_boolean_true_add(json_sub, "txAdvertised"); | |
11727 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11728 | json_object_boolean_true_add(json_sub, "txReceived"); | |
11729 | } | |
11730 | ||
11731 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
11732 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11733 | { | |
11734 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) && CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11735 | json_object_boolean_true_add(json_sub, "rxAdvertisedAndReceived"); | |
11736 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) | |
11737 | json_object_boolean_true_add(json_sub, "rxAdvertised"); | |
11738 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11739 | json_object_boolean_true_add(json_sub, "rxReceived"); | |
11740 | } | |
11741 | ||
11742 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
11743 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV) || | |
11744 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
11745 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11746 | json_object_object_add(json_add, print_store, json_sub); | |
11747 | } | |
a82478b9 | 11748 | |
856ca177 MS |
11749 | json_object_object_add(json_cap, "addPath", json_add); |
11750 | } | |
11751 | ||
11752 | /* Dynamic */ | |
11753 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
11754 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11755 | { | |
11756 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) && CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11757 | json_object_string_add(json_cap, "dynamic", "advertisedAndReceived"); | |
11758 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11759 | json_object_string_add(json_cap, "dynamic", "advertised"); | |
11760 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11761 | json_object_string_add(json_cap, "dynamic", "received"); | |
11762 | } | |
11763 | ||
11764 | /* Extended nexthop */ | |
11765 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
11766 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11767 | { | |
11768 | json_object *json_nxt = NULL; | |
11769 | const char *print_store; | |
11770 | ||
11771 | json_nxt = json_object_new_object(); | |
11772 | ||
11773 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) && CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11774 | json_object_string_add(json_cap, "extendedNexthop", "advertisedAndReceived"); | |
11775 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11776 | json_object_string_add(json_cap, "extendedNexthop", "advertised"); | |
11777 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11778 | json_object_string_add(json_cap, "extendedNexthop", "received"); | |
11779 | ||
11780 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11781 | { | |
11782 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11783 | { | |
11784 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
11785 | { | |
11786 | print_store = afi_safi_print (AFI_IP, safi); | |
11787 | json_object_string_add(json_nxt, print_store, "recieved"); | |
11788 | } | |
11789 | } | |
11790 | json_object_object_add(json_cap, "extendedNexthopFamililesByPeer", json_nxt); | |
11791 | } | |
11792 | } | |
11793 | ||
11794 | /* Route Refresh */ | |
11795 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
11796 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11797 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11798 | { | |
11799 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) && (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))) | |
11800 | { | |
11801 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) | |
11802 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOldNew"); | |
11803 | else | |
11804 | { | |
11805 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11806 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOld"); | |
11807 | else | |
11808 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedNew"); | |
11809 | } | |
11810 | } | |
11811 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
11812 | json_object_string_add(json_cap, "routeRefresh", "advertised"); | |
11813 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11814 | json_object_string_add(json_cap, "routeRefresh", "received"); | |
11815 | } | |
11816 | ||
11817 | /* Multiprotocol Extensions */ | |
11818 | json_object *json_multi = NULL; | |
11819 | json_multi = json_object_new_object(); | |
11820 | ||
11821 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11822 | { | |
11823 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11824 | { | |
11825 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
11826 | { | |
11827 | json_object *json_exten = NULL; | |
11828 | json_exten = json_object_new_object(); | |
11829 | ||
11830 | if (p->afc_adv[afi][safi] && p->afc_recv[afi][safi]) | |
11831 | json_object_boolean_true_add(json_exten, "advertisedAndReceived"); | |
11832 | else if (p->afc_adv[afi][safi]) | |
11833 | json_object_boolean_true_add(json_exten, "advertised"); | |
11834 | else if (p->afc_recv[afi][safi]) | |
11835 | json_object_boolean_true_add(json_exten, "received"); | |
11836 | ||
11837 | json_object_object_add(json_multi, afi_safi_print (afi, safi), json_exten); | |
11838 | } | |
11839 | } | |
11840 | } | |
11841 | json_object_object_add(json_cap, "multiprotocolExtensions", json_multi); | |
11842 | ||
11843 | /* Gracefull Restart */ | |
11844 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
11845 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
11846 | { | |
11847 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) && CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
11848 | json_object_string_add(json_cap, "gracefulRestart", "advertisedAndReceived"); | |
11849 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
11850 | json_object_string_add(json_cap, "gracefulRestartCapability", "advertised"); | |
11851 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
11852 | json_object_string_add(json_cap, "gracefulRestartCapability", "received"); | |
11853 | ||
11854 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
11855 | { | |
11856 | int restart_af_count = 0; | |
11857 | json_object *json_restart = NULL; | |
11858 | json_restart = json_object_new_object(); | |
11859 | ||
11860 | json_object_int_add(json_cap, "gracefulRestartRemoteTimerMsecs", p->v_gr_restart * 1000); | |
11861 | ||
11862 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11863 | { | |
11864 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11865 | { | |
11866 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
11867 | { | |
11868 | json_object *json_sub = NULL; | |
11869 | json_sub = json_object_new_object(); | |
11870 | ||
11871 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV)) | |
11872 | json_object_boolean_true_add(json_sub, "preserved"); | |
11873 | restart_af_count++; | |
11874 | json_object_object_add(json_restart, afi_safi_print (afi, safi), json_sub); | |
11875 | } | |
11876 | } | |
11877 | } | |
11878 | if (! restart_af_count) | |
11879 | json_object_string_add(json_cap, "addressFamiliesByPeer", "none"); | |
11880 | else | |
11881 | json_object_object_add(json_cap, "addressFamiliesByPeer", json_restart); | |
11882 | } | |
11883 | } | |
11884 | json_object_object_add(json_neigh, "neighborCapabilities", json_cap); | |
11885 | } | |
11886 | else | |
11887 | { | |
11888 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
11889 | ||
11890 | /* AS4 */ | |
11891 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
11892 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11893 | { | |
11894 | vty_out (vty, " 4 Byte AS:"); | |
11895 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11896 | vty_out (vty, " advertised"); | |
11897 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11898 | vty_out (vty, " %sreceived", | |
11899 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
11900 | vty_out (vty, "%s", VTY_NEWLINE); | |
11901 | } | |
11902 | ||
11903 | /* AddPath */ | |
11904 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
11905 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
11906 | { | |
11907 | vty_out (vty, " AddPath:%s", VTY_NEWLINE); | |
a82478b9 | 11908 | |
856ca177 MS |
11909 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
11910 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
a82478b9 | 11911 | { |
856ca177 MS |
11912 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || |
11913 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11914 | { | |
11915 | vty_out (vty, " %s: TX ", afi_safi_print (afi, safi)); | |
a82478b9 | 11916 | |
856ca177 MS |
11917 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) |
11918 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 11919 | |
856ca177 MS |
11920 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) |
11921 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" ); | |
a82478b9 | 11922 | |
856ca177 MS |
11923 | vty_out (vty, "%s", VTY_NEWLINE); |
11924 | } | |
a82478b9 | 11925 | |
856ca177 | 11926 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || |
a82478b9 | 11927 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
856ca177 MS |
11928 | { |
11929 | vty_out (vty, " %s: RX ", afi_safi_print (afi, safi)); | |
a82478b9 | 11930 | |
856ca177 MS |
11931 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) |
11932 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 11933 | |
856ca177 MS |
11934 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
11935 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" ); | |
a82478b9 | 11936 | |
856ca177 MS |
11937 | vty_out (vty, "%s", VTY_NEWLINE); |
11938 | } | |
a82478b9 | 11939 | } |
856ca177 | 11940 | } |
a82478b9 | 11941 | |
856ca177 MS |
11942 | /* Dynamic */ |
11943 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
11944 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11945 | { | |
11946 | vty_out (vty, " Dynamic:"); | |
11947 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11948 | vty_out (vty, " advertised"); | |
11949 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11950 | vty_out (vty, " %sreceived", | |
11951 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
11952 | vty_out (vty, "%s", VTY_NEWLINE); | |
11953 | } | |
11954 | ||
11955 | /* Extended nexthop */ | |
11956 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
11957 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11958 | { | |
11959 | vty_out (vty, " Extended nexthop:"); | |
11960 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11961 | vty_out (vty, " advertised"); | |
11962 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11963 | vty_out (vty, " %sreceived", | |
11964 | CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) ? "and " : ""); | |
11965 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 11966 | |
856ca177 MS |
11967 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) |
11968 | { | |
11969 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
11970 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11971 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
11972 | vty_out (vty, " %s%s", | |
11973 | afi_safi_print (AFI_IP, safi), VTY_NEWLINE); | |
11974 | } | |
11975 | } | |
8a92a8a0 | 11976 | |
856ca177 MS |
11977 | /* Route Refresh */ |
11978 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
11979 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11980 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11981 | { | |
11982 | vty_out (vty, " Route refresh:"); | |
11983 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
11984 | vty_out (vty, " advertised"); | |
11985 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11986 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11987 | vty_out (vty, " %sreceived(%s)", | |
11988 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
11989 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
11990 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
11991 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
8a92a8a0 | 11992 | |
856ca177 MS |
11993 | vty_out (vty, "%s", VTY_NEWLINE); |
11994 | } | |
718e3744 | 11995 | |
856ca177 MS |
11996 | /* Multiprotocol Extensions */ |
11997 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11998 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11999 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
12000 | { | |
12001 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); | |
12002 | if (p->afc_adv[afi][safi]) | |
12003 | vty_out (vty, " advertised"); | |
12004 | if (p->afc_recv[afi][safi]) | |
12005 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
12006 | vty_out (vty, "%s", VTY_NEWLINE); | |
12007 | } | |
538621f2 | 12008 | |
04b6bdc0 DW |
12009 | /* Hostname capability */ |
12010 | if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV) || | |
12011 | CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) | |
12012 | { | |
12013 | vty_out (vty, " Hostname Capability:"); | |
12014 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV)) | |
12015 | vty_out (vty, " advertised"); | |
12016 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_RCV)) | |
12017 | vty_out (vty, " %sreceived", | |
12018 | CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV) ? "and " : ""); | |
12019 | vty_out (vty, "%s", VTY_NEWLINE); | |
12020 | } | |
12021 | ||
856ca177 MS |
12022 | /* Gracefull Restart */ |
12023 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
12024 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
12025 | { | |
12026 | vty_out (vty, " Graceful Restart Capabilty:"); | |
12027 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
538621f2 | 12028 | vty_out (vty, " advertised"); |
856ca177 MS |
12029 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
12030 | vty_out (vty, " %sreceived", | |
12031 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
12032 | vty_out (vty, "%s", VTY_NEWLINE); | |
538621f2 | 12033 | |
856ca177 MS |
12034 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
12035 | { | |
12036 | int restart_af_count = 0; | |
12037 | ||
12038 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
12039 | p->v_gr_restart, VTY_NEWLINE); | |
12040 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
12041 | ||
12042 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12043 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12044 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
12045 | { | |
12046 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", | |
12047 | afi_safi_print (afi, safi), | |
12048 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
12049 | "preserved" : "not preserved"); | |
12050 | restart_af_count++; | |
12051 | } | |
12052 | if (! restart_af_count) | |
12053 | vty_out (vty, "none"); | |
12054 | vty_out (vty, "%s", VTY_NEWLINE); | |
12055 | } | |
12056 | } | |
12057 | } | |
718e3744 | 12058 | } |
12059 | } | |
12060 | ||
93406d87 | 12061 | /* graceful restart information */ |
12062 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
12063 | || p->t_gr_restart | |
12064 | || p->t_gr_stale) | |
12065 | { | |
856ca177 MS |
12066 | json_object *json_grace = NULL; |
12067 | json_object *json_grace_send = NULL; | |
12068 | json_object *json_grace_recv = NULL; | |
93406d87 | 12069 | int eor_send_af_count = 0; |
12070 | int eor_receive_af_count = 0; | |
12071 | ||
856ca177 MS |
12072 | if (use_json) |
12073 | { | |
12074 | json_grace = json_object_new_object(); | |
12075 | json_grace_send = json_object_new_object(); | |
12076 | json_grace_recv = json_object_new_object(); | |
12077 | ||
12078 | if (p->status == Established) | |
12079 | { | |
12080 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12081 | { | |
12082 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12083 | { | |
12084 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
12085 | { | |
12086 | json_object_boolean_true_add(json_grace_send, afi_safi_print (afi, safi)); | |
12087 | eor_send_af_count++; | |
12088 | } | |
12089 | } | |
12090 | } | |
12091 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12092 | { | |
12093 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12094 | { | |
12095 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
12096 | { | |
12097 | json_object_boolean_true_add(json_grace_recv, afi_safi_print (afi, safi)); | |
12098 | eor_receive_af_count++; | |
12099 | } | |
12100 | } | |
12101 | } | |
12102 | } | |
12103 | ||
12104 | json_object_object_add(json_grace, "endOfRibSend", json_grace_send); | |
12105 | json_object_object_add(json_grace, "endOfRibRecv", json_grace_recv); | |
12106 | ||
12107 | if (p->t_gr_restart) | |
12108 | json_object_int_add(json_grace, "gracefulRestartTimerMsecs", thread_timer_remain_second (p->t_gr_restart) * 1000); | |
12109 | ||
12110 | if (p->t_gr_stale) | |
12111 | json_object_int_add(json_grace, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p->t_gr_stale) * 1000); | |
12112 | ||
12113 | json_object_object_add(json_neigh, "gracefulRestartInfo", json_grace); | |
12114 | } | |
12115 | else | |
12116 | { | |
12117 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
12118 | if (p->status == Established) | |
12119 | { | |
12120 | vty_out (vty, " End-of-RIB send: "); | |
12121 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12122 | { | |
12123 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12124 | { | |
12125 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
12126 | { | |
12127 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
12128 | afi_safi_print (afi, safi)); | |
12129 | eor_send_af_count++; | |
12130 | } | |
12131 | } | |
12132 | } | |
12133 | vty_out (vty, "%s", VTY_NEWLINE); | |
12134 | vty_out (vty, " End-of-RIB received: "); | |
12135 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12136 | { | |
12137 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12138 | { | |
12139 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
12140 | { | |
12141 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
12142 | afi_safi_print (afi, safi)); | |
12143 | eor_receive_af_count++; | |
12144 | } | |
12145 | } | |
12146 | } | |
12147 | vty_out (vty, "%s", VTY_NEWLINE); | |
12148 | } | |
93406d87 | 12149 | |
856ca177 MS |
12150 | if (p->t_gr_restart) |
12151 | vty_out (vty, " The remaining time of restart timer is %ld%s", | |
12152 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
0b2aa3a0 | 12153 | |
856ca177 MS |
12154 | if (p->t_gr_stale) |
12155 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", | |
12156 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
12157 | } | |
12158 | } | |
12159 | if (use_json) | |
12160 | { | |
12161 | json_object *json_stat = NULL; | |
12162 | json_stat = json_object_new_object(); | |
12163 | /* Packet counts. */ | |
12164 | json_object_int_add(json_stat, "depthInq", 0); | |
12165 | json_object_int_add(json_stat, "depthOutq", (unsigned long) p->obuf->count); | |
12166 | json_object_int_add(json_stat, "opensSent", p->open_out); | |
12167 | json_object_int_add(json_stat, "opensRecv", p->open_in); | |
12168 | json_object_int_add(json_stat, "notificationsSent", p->notify_out); | |
12169 | json_object_int_add(json_stat, "notificationsRecv", p->notify_in); | |
12170 | json_object_int_add(json_stat, "updatesSent", p->update_out); | |
12171 | json_object_int_add(json_stat, "updatesRecv", p->update_in); | |
12172 | json_object_int_add(json_stat, "keepalivesSent", p->keepalive_out); | |
12173 | json_object_int_add(json_stat, "keepalivesRecv", p->keepalive_in); | |
12174 | json_object_int_add(json_stat, "routeRefreshSent", p->refresh_out); | |
12175 | json_object_int_add(json_stat, "routeRefreshRecv", p->refresh_in); | |
12176 | json_object_int_add(json_stat, "capabilitySent", p->dynamic_cap_out); | |
12177 | json_object_int_add(json_stat, "capabilityRecv", p->dynamic_cap_in); | |
12178 | json_object_int_add(json_stat, "totalSent", p->open_out + p->notify_out + p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out); | |
12179 | json_object_int_add(json_stat, "totalRecv", p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + p->dynamic_cap_in); | |
12180 | json_object_object_add(json_neigh, "messageStats", json_stat); | |
12181 | } | |
12182 | else | |
12183 | { | |
12184 | /* Packet counts. */ | |
12185 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); | |
12186 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
12187 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); | |
12188 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); | |
12189 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
12190 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
12191 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
12192 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
12193 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
12194 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
12195 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
12196 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
12197 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
12198 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 12199 | } |
12200 | ||
856ca177 MS |
12201 | if (use_json) |
12202 | { | |
12203 | /* advertisement-interval */ | |
12204 | json_object_int_add(json_neigh, "minBtwnAdvertisementRunsTimerMsecs", p->v_routeadv * 1000); | |
718e3744 | 12205 | |
856ca177 MS |
12206 | /* Update-source. */ |
12207 | if (p->update_if || p->update_source) | |
12208 | { | |
12209 | if (p->update_if) | |
12210 | json_object_string_add(json_neigh, "updateSource", p->update_if); | |
12211 | else if (p->update_source) | |
12212 | json_object_string_add(json_neigh, "updateSource", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
12213 | } | |
12214 | ||
12215 | /* Default weight */ | |
12216 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
12217 | json_object_int_add(json_neigh, "defaultWeight", p->weight); | |
12218 | ||
12219 | } | |
12220 | else | |
12221 | { | |
12222 | /* advertisement-interval */ | |
12223 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
12224 | p->v_routeadv, VTY_NEWLINE); | |
12225 | ||
12226 | /* Update-source. */ | |
12227 | if (p->update_if || p->update_source) | |
12228 | { | |
12229 | vty_out (vty, " Update source is "); | |
12230 | if (p->update_if) | |
12231 | vty_out (vty, "%s", p->update_if); | |
12232 | else if (p->update_source) | |
12233 | vty_out (vty, "%s", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
12234 | vty_out (vty, "%s", VTY_NEWLINE); | |
12235 | } | |
12236 | ||
12237 | /* Default weight */ | |
12238 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
12239 | vty_out (vty, " Default weight %d%s", p->weight, VTY_NEWLINE); | |
12240 | ||
12241 | vty_out (vty, "%s", VTY_NEWLINE); | |
12242 | } | |
718e3744 | 12243 | |
12244 | /* Address Family Information */ | |
856ca177 MS |
12245 | json_object *json_hold = NULL; |
12246 | ||
12247 | if (use_json) | |
12248 | json_hold = json_object_new_object(); | |
12249 | ||
538621f2 | 12250 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
12251 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12252 | if (p->afc[afi][safi]) | |
856ca177 | 12253 | bgp_show_peer_afi (vty, p, afi, safi, use_json, json_hold); |
718e3744 | 12254 | |
856ca177 MS |
12255 | if (use_json) |
12256 | { | |
12257 | json_object_int_add(json_hold, "connectionsEstablished", p->established); | |
12258 | json_object_int_add(json_hold, "connectionsDropped", p->dropped); | |
12259 | } | |
12260 | else | |
12261 | vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped, | |
12262 | VTY_NEWLINE); | |
718e3744 | 12263 | |
d6661008 | 12264 | if (! p->last_reset) |
856ca177 MS |
12265 | { |
12266 | if (use_json) | |
12267 | json_object_string_add(json_hold, "lastReset", "never"); | |
12268 | else | |
12269 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); | |
12270 | } | |
e0701b79 | 12271 | else |
d6661008 | 12272 | { |
856ca177 MS |
12273 | if (use_json) |
12274 | { | |
12275 | time_t uptime; | |
12276 | struct tm *tm; | |
12277 | ||
12278 | uptime = bgp_clock(); | |
12279 | uptime -= p->resettime; | |
12280 | tm = gmtime(&uptime); | |
12281 | json_object_int_add(json_hold, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
12282 | json_object_string_add(json_hold, "lastResetDueTo", peer_down_str[(int) p->last_reset]); | |
12283 | if (p->last_reset_cause_size) | |
12284 | { | |
39e871e6 ST |
12285 | char errorcodesubcode_hexstr[5]; |
12286 | sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode); | |
12287 | json_object_string_add(json_hold, "lastErrorCodeSubcode", errorcodesubcode_hexstr); | |
856ca177 MS |
12288 | } |
12289 | } | |
12290 | else | |
d6661008 | 12291 | { |
3a8c7ba1 DW |
12292 | vty_out (vty, " Last reset %s, ", |
12293 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
12294 | ||
12295 | if (p->last_reset == PEER_DOWN_NOTIFY_SEND || | |
12296 | p->last_reset == PEER_DOWN_NOTIFY_RECEIVED) | |
12297 | { | |
12298 | code_str = bgp_notify_code_str(p->notify.code); | |
12299 | subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode); | |
12300 | vty_out (vty, "due to NOTIFICATION %s (%s%s)%s", | |
12301 | p->last_reset == PEER_DOWN_NOTIFY_SEND ? "sent" : "received", | |
12302 | code_str, subcode_str, VTY_NEWLINE); | |
12303 | } | |
12304 | else | |
12305 | { | |
12306 | vty_out (vty, "due to %s%s", | |
12307 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
12308 | } | |
856ca177 MS |
12309 | |
12310 | if (p->last_reset_cause_size) | |
d6661008 | 12311 | { |
856ca177 MS |
12312 | msg = p->last_reset_cause; |
12313 | vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); | |
12314 | for (i = 1; i <= p->last_reset_cause_size; i++) | |
12315 | { | |
12316 | vty_out(vty, "%02X", *msg++); | |
d6661008 | 12317 | |
856ca177 MS |
12318 | if (i != p->last_reset_cause_size) |
12319 | { | |
12320 | if (i % 16 == 0) | |
12321 | { | |
12322 | vty_out(vty, "%s ", VTY_NEWLINE); | |
12323 | } | |
12324 | else if (i % 4 == 0) | |
12325 | { | |
12326 | vty_out(vty, " "); | |
12327 | } | |
12328 | } | |
12329 | } | |
12330 | vty_out(vty, "%s", VTY_NEWLINE); | |
d6661008 | 12331 | } |
d6661008 DS |
12332 | } |
12333 | } | |
848973c7 | 12334 | |
718e3744 | 12335 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
12336 | { | |
856ca177 MS |
12337 | if (use_json) |
12338 | json_object_boolean_true_add(json_hold, "prefixesConfigExceedMax"); | |
12339 | else | |
12340 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 12341 | |
12342 | if (p->t_pmax_restart) | |
856ca177 MS |
12343 | { |
12344 | if (use_json) | |
12345 | { | |
e8f7da3a | 12346 | json_object_boolean_true_add(json_hold, "reducePrefixNumFrom"); |
856ca177 MS |
12347 | json_object_int_add(json_hold, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); |
12348 | } | |
12349 | else | |
12350 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
12351 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
12352 | VTY_NEWLINE); | |
12353 | } | |
0a486e5f | 12354 | else |
856ca177 MS |
12355 | { |
12356 | if (use_json) | |
e8f7da3a | 12357 | json_object_boolean_true_add(json_hold, "reducePrefixNumAndClearIpBgp"); |
856ca177 MS |
12358 | else |
12359 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
12360 | p->host, VTY_NEWLINE); | |
12361 | } | |
718e3744 | 12362 | } |
12363 | ||
856ca177 MS |
12364 | if (use_json) |
12365 | json_object_object_add(json_neigh, "addressFamilyInfo", json_hold); | |
12366 | ||
f5a4827d | 12367 | /* EBGP Multihop and GTSM */ |
6d85b15b | 12368 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d | 12369 | { |
856ca177 MS |
12370 | if (use_json) |
12371 | { | |
12372 | if (p->gtsm_hops > 0) | |
12373 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->gtsm_hops); | |
12374 | else if (p->ttl > 1) | |
12375 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->ttl); | |
12376 | } | |
12377 | else | |
12378 | { | |
12379 | if (p->gtsm_hops > 0) | |
12380 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
12381 | p->gtsm_hops, VTY_NEWLINE); | |
12382 | else if (p->ttl > 1) | |
12383 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
12384 | p->ttl, VTY_NEWLINE); | |
12385 | } | |
f5a4827d | 12386 | } |
5d804b43 PM |
12387 | else |
12388 | { | |
12389 | if (p->gtsm_hops > 0) | |
856ca177 MS |
12390 | { |
12391 | if (use_json) | |
12392 | json_object_int_add(json_neigh, "internalBgpNbrMaxHopsAway", p->gtsm_hops); | |
12393 | else | |
12394 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
12395 | p->gtsm_hops, VTY_NEWLINE); | |
12396 | } | |
5d804b43 | 12397 | } |
718e3744 | 12398 | |
12399 | /* Local address. */ | |
12400 | if (p->su_local) | |
12401 | { | |
856ca177 MS |
12402 | if (use_json) |
12403 | { | |
12404 | json_object_string_add(json_neigh, "hostLocal", sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN)); | |
12405 | json_object_int_add(json_neigh, "portLocal", ntohs (p->su_local->sin.sin_port)); | |
12406 | } | |
12407 | else | |
12408 | vty_out (vty, "Local host: %s, Local port: %d%s", | |
12409 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), | |
12410 | ntohs (p->su_local->sin.sin_port), | |
12411 | VTY_NEWLINE); | |
718e3744 | 12412 | } |
12413 | ||
12414 | /* Remote address. */ | |
12415 | if (p->su_remote) | |
12416 | { | |
856ca177 MS |
12417 | if (use_json) |
12418 | { | |
12419 | json_object_string_add(json_neigh, "hostForeign", sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN)); | |
12420 | json_object_int_add(json_neigh, "portForeign", ntohs (p->su_remote->sin.sin_port)); | |
12421 | } | |
12422 | else | |
12423 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
718e3744 | 12424 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
12425 | ntohs (p->su_remote->sin.sin_port), | |
12426 | VTY_NEWLINE); | |
12427 | } | |
12428 | ||
12429 | /* Nexthop display. */ | |
12430 | if (p->su_local) | |
12431 | { | |
856ca177 MS |
12432 | if (use_json) |
12433 | { | |
12434 | json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ)); | |
718e3744 | 12435 | #ifdef HAVE_IPV6 |
856ca177 MS |
12436 | json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ)); |
12437 | json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ)); | |
12438 | if (p->shared_network) | |
12439 | json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork"); | |
12440 | else | |
12441 | json_object_string_add(json_neigh, "bgpConnection", "nonSharedNetwork"); | |
12442 | #endif /* HAVE_IPV6 */ | |
12443 | } | |
12444 | else | |
12445 | { | |
12446 | vty_out (vty, "Nexthop: %s%s", | |
12447 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
12448 | VTY_NEWLINE); | |
12449 | #ifdef HAVE_IPV6 | |
12450 | vty_out (vty, "Nexthop global: %s%s", | |
12451 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
12452 | VTY_NEWLINE); | |
12453 | vty_out (vty, "Nexthop local: %s%s", | |
12454 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
12455 | VTY_NEWLINE); | |
12456 | vty_out (vty, "BGP connection: %s%s", | |
12457 | p->shared_network ? "shared network" : "non shared network", | |
12458 | VTY_NEWLINE); | |
718e3744 | 12459 | #endif /* HAVE_IPV6 */ |
856ca177 | 12460 | } |
718e3744 | 12461 | } |
12462 | ||
12463 | /* Timer information. */ | |
856ca177 MS |
12464 | if (use_json) |
12465 | { | |
39e871e6 | 12466 | json_object_int_add(json_neigh, "connectRetryTimer", p->v_connect); |
dd9275d6 ST |
12467 | if (p->status == Established && p->rtt) |
12468 | json_object_int_add(json_neigh, "estimatedRttInMsecs", p->rtt); | |
856ca177 MS |
12469 | if (p->t_start) |
12470 | json_object_int_add(json_neigh, "nextStartTimerDueInMsecs", thread_timer_remain_second (p->t_start) * 1000); | |
12471 | if (p->t_connect) | |
12472 | json_object_int_add(json_neigh, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p->t_connect) * 1000); | |
12473 | if (p->t_routeadv) | |
12474 | { | |
12475 | json_object_int_add(json_neigh, "mraiInterval", p->v_routeadv); | |
12476 | json_object_int_add(json_neigh, "mraiTimerExpireInMsecs", thread_timer_remain_second (p->t_routeadv) * 1000); | |
12477 | } | |
cb1faec9 | 12478 | |
856ca177 MS |
12479 | if (p->t_read) |
12480 | json_object_string_add(json_neigh, "readThread", "on"); | |
12481 | else | |
12482 | json_object_string_add(json_neigh, "readThread", "off"); | |
12483 | if (p->t_write) | |
12484 | json_object_string_add(json_neigh, "writeThread", "on"); | |
12485 | else | |
12486 | json_object_string_add(json_neigh, "writeThread", "off"); | |
12487 | } | |
12488 | else | |
12489 | { | |
39e871e6 ST |
12490 | vty_out (vty, "BGP Connect Retry Timer in Seconds: %d%s", |
12491 | p->v_connect, VTY_NEWLINE); | |
dd9275d6 ST |
12492 | if (p->status == Established && p->rtt) |
12493 | vty_out (vty, "Estimated round trip time: %d ms%s", | |
12494 | p->rtt, VTY_NEWLINE); | |
856ca177 MS |
12495 | if (p->t_start) |
12496 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
12497 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
12498 | if (p->t_connect) | |
12499 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
12500 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
12501 | if (p->t_routeadv) | |
12502 | vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s", | |
12503 | p->v_routeadv, thread_timer_remain_second (p->t_routeadv), | |
12504 | VTY_NEWLINE); | |
12505 | ||
12506 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
12507 | p->t_read ? "on" : "off", | |
12508 | p->t_write ? "on" : "off", | |
12509 | VTY_NEWLINE); | |
12510 | } | |
718e3744 | 12511 | |
12512 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
12513 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
856ca177 MS |
12514 | bgp_capability_vty_out (vty, p, use_json, json_neigh); |
12515 | ||
12516 | if (!use_json) | |
12517 | vty_out (vty, "%s", VTY_NEWLINE); | |
c43ed2e4 DS |
12518 | |
12519 | /* BFD information. */ | |
856ca177 MS |
12520 | bgp_bfd_show_info(vty, p, use_json, json_neigh); |
12521 | ||
12522 | if (use_json) | |
12523 | { | |
12524 | if (p->conf_if) /* Configured interface name. */ | |
12525 | json_object_object_add(json, p->conf_if, json_neigh); | |
12526 | else /* Configured IP address. */ | |
12527 | json_object_object_add(json, p->host, json_neigh); | |
12528 | } | |
718e3744 | 12529 | } |
12530 | ||
94f2b392 | 12531 | static int |
856ca177 MS |
12532 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type, |
12533 | union sockunion *su, const char *conf_if, u_char use_json, json_object *json) | |
718e3744 | 12534 | { |
1eb8ef25 | 12535 | struct listnode *node, *nnode; |
718e3744 | 12536 | struct peer *peer; |
12537 | int find = 0; | |
12538 | ||
1eb8ef25 | 12539 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 12540 | { |
1ff9a340 DS |
12541 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
12542 | continue; | |
12543 | ||
718e3744 | 12544 | switch (type) |
856ca177 MS |
12545 | { |
12546 | case show_all: | |
e8f7da3a | 12547 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12548 | break; |
12549 | case show_peer: | |
12550 | if (conf_if) | |
12551 | { | |
4873b3b9 DW |
12552 | if ((peer->conf_if && !strcmp(peer->conf_if, conf_if)) || |
12553 | (peer->hostname && !strcmp(peer->hostname, conf_if))) | |
856ca177 MS |
12554 | { |
12555 | find = 1; | |
e8f7da3a | 12556 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12557 | } |
12558 | } | |
12559 | else | |
12560 | { | |
12561 | if (sockunion_same (&peer->su, su)) | |
12562 | { | |
12563 | find = 1; | |
e8f7da3a | 12564 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12565 | } |
12566 | } | |
12567 | break; | |
718e3744 | 12568 | } |
12569 | } | |
12570 | ||
12571 | if (type == show_peer && ! find) | |
856ca177 MS |
12572 | { |
12573 | if (use_json) | |
12574 | json_object_boolean_true_add(json, "bgpNoSuchNeighbor"); | |
12575 | else | |
12576 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
12577 | } | |
12578 | ||
12579 | if (use_json) | |
12580 | { | |
12581 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
12582 | json_object_free(json); | |
12583 | } | |
12584 | else | |
12585 | { | |
12586 | vty_out (vty, "%s", VTY_NEWLINE); | |
12587 | } | |
12588 | ||
718e3744 | 12589 | return CMD_SUCCESS; |
12590 | } | |
12591 | ||
94f2b392 | 12592 | static int |
fd79ac91 | 12593 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
9f689658 DD |
12594 | enum show_type type, const char *ip_str, u_char use_json, |
12595 | json_object *json) | |
718e3744 | 12596 | { |
12597 | int ret; | |
12598 | struct bgp *bgp; | |
12599 | union sockunion su; | |
856ca177 | 12600 | |
9f689658 | 12601 | if (use_json && (json == NULL)) |
856ca177 | 12602 | json = json_object_new_object(); |
718e3744 | 12603 | |
718e3744 | 12604 | if (name) |
12605 | { | |
12606 | bgp = bgp_lookup_by_name (name); | |
718e3744 | 12607 | if (! bgp) |
12608 | { | |
856ca177 MS |
12609 | if (use_json) |
12610 | { | |
12611 | json_object_boolean_true_add(json, "bgpNoSuchInstance"); | |
12612 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
12613 | json_object_free(json); | |
12614 | } | |
12615 | else | |
12616 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
12617 | ||
718e3744 | 12618 | return CMD_WARNING; |
12619 | } | |
718e3744 | 12620 | } |
a80beece DS |
12621 | else |
12622 | { | |
12623 | bgp = bgp_get_default (); | |
12624 | } | |
718e3744 | 12625 | |
12626 | if (bgp) | |
a80beece DS |
12627 | { |
12628 | if (ip_str) | |
12629 | { | |
12630 | ret = str2sockunion (ip_str, &su); | |
12631 | if (ret < 0) | |
856ca177 | 12632 | bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json); |
a80beece | 12633 | else |
856ca177 | 12634 | bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json); |
a80beece DS |
12635 | } |
12636 | else | |
12637 | { | |
856ca177 | 12638 | bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json); |
a80beece DS |
12639 | } |
12640 | } | |
718e3744 | 12641 | |
12642 | return CMD_SUCCESS; | |
12643 | } | |
12644 | ||
f186de26 | 12645 | static void |
12646 | bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) | |
12647 | { | |
12648 | struct listnode *node, *nnode; | |
12649 | struct bgp *bgp; | |
12650 | json_object *json = NULL; | |
9f689658 DD |
12651 | int is_first = 1; |
12652 | ||
12653 | if (use_json) | |
12654 | vty_out (vty, "{%s", VTY_NEWLINE); | |
f186de26 | 12655 | |
12656 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
12657 | { | |
f186de26 | 12658 | if (use_json) |
9f689658 DD |
12659 | { |
12660 | if (!(json = json_object_new_object())) | |
12661 | { | |
12662 | zlog_err("Unable to allocate memory for JSON object"); | |
12663 | vty_out (vty, | |
12664 | "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s", | |
12665 | VTY_NEWLINE); | |
12666 | return; | |
12667 | } | |
12668 | ||
12669 | json_object_int_add(json, "vrfId", | |
12670 | (bgp->vrf_id == VRF_UNKNOWN) | |
12671 | ? -1 : bgp->vrf_id); | |
12672 | json_object_string_add(json, "vrfName", | |
12673 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12674 | ? "Default" : bgp->name); | |
12675 | ||
12676 | if (! is_first) | |
12677 | vty_out (vty, ",%s", VTY_NEWLINE); | |
12678 | else | |
12679 | is_first = 0; | |
12680 | ||
12681 | vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12682 | ? "Default" : bgp->name); | |
12683 | } | |
12684 | else | |
12685 | { | |
12686 | vty_out (vty, "%sInstance %s:%s", | |
12687 | VTY_NEWLINE, | |
12688 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12689 | ? "Default" : bgp->name, | |
12690 | VTY_NEWLINE); | |
12691 | } | |
f186de26 | 12692 | bgp_show_neighbor (vty, bgp, show_all, NULL, NULL, use_json, json); |
12693 | } | |
9f689658 DD |
12694 | |
12695 | if (use_json) | |
12696 | vty_out (vty, "}%s", VTY_NEWLINE); | |
f186de26 | 12697 | } |
12698 | ||
718e3744 | 12699 | /* "show ip bgp neighbors" commands. */ |
12700 | DEFUN (show_ip_bgp_neighbors, | |
12701 | show_ip_bgp_neighbors_cmd, | |
856ca177 | 12702 | "show ip bgp neighbors {json}", |
718e3744 | 12703 | SHOW_STR |
12704 | IP_STR | |
12705 | BGP_STR | |
856ca177 MS |
12706 | "Detailed information on TCP and BGP neighbor connections\n" |
12707 | "JavaScript Object Notation\n") | |
718e3744 | 12708 | { |
db7c8528 | 12709 | u_char uj = use_json(argc, argv); |
856ca177 | 12710 | |
9f689658 | 12711 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, uj, NULL); |
718e3744 | 12712 | } |
12713 | ||
12714 | ALIAS (show_ip_bgp_neighbors, | |
12715 | show_ip_bgp_ipv4_neighbors_cmd, | |
856ca177 | 12716 | "show ip bgp ipv4 (unicast|multicast) neighbors {json}", |
718e3744 | 12717 | SHOW_STR |
12718 | IP_STR | |
12719 | BGP_STR | |
12720 | "Address family\n" | |
12721 | "Address Family modifier\n" | |
12722 | "Address Family modifier\n" | |
856ca177 MS |
12723 | "Detailed information on TCP and BGP neighbor connections\n" |
12724 | "JavaScript Object Notation\n") | |
718e3744 | 12725 | |
12726 | ALIAS (show_ip_bgp_neighbors, | |
12727 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
856ca177 | 12728 | "show ip bgp vpnv4 all neighbors {json}", |
718e3744 | 12729 | SHOW_STR |
12730 | IP_STR | |
12731 | BGP_STR | |
12732 | "Display VPNv4 NLRI specific information\n" | |
12733 | "Display information about all VPNv4 NLRIs\n" | |
856ca177 MS |
12734 | "Detailed information on TCP and BGP neighbor connections\n" |
12735 | "JavaScript Object Notation\n") | |
718e3744 | 12736 | |
12737 | ALIAS (show_ip_bgp_neighbors, | |
12738 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
856ca177 | 12739 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}", |
718e3744 | 12740 | SHOW_STR |
12741 | IP_STR | |
12742 | BGP_STR | |
12743 | "Display VPNv4 NLRI specific information\n" | |
12744 | "Display information for a route distinguisher\n" | |
12745 | "VPN Route Distinguisher\n" | |
856ca177 MS |
12746 | "Detailed information on TCP and BGP neighbor connections\n" |
12747 | "JavaScript Object Notation\n") | |
718e3744 | 12748 | |
12749 | ALIAS (show_ip_bgp_neighbors, | |
12750 | show_bgp_neighbors_cmd, | |
856ca177 | 12751 | "show bgp neighbors {json}", |
718e3744 | 12752 | SHOW_STR |
12753 | BGP_STR | |
856ca177 MS |
12754 | "Detailed information on TCP and BGP neighbor connections\n" |
12755 | "JavaScript Object Notation\n") | |
718e3744 | 12756 | |
12757 | ALIAS (show_ip_bgp_neighbors, | |
12758 | show_bgp_ipv6_neighbors_cmd, | |
856ca177 | 12759 | "show bgp ipv6 neighbors {json}", |
718e3744 | 12760 | SHOW_STR |
12761 | BGP_STR | |
12762 | "Address family\n" | |
856ca177 MS |
12763 | "Detailed information on TCP and BGP neighbor connections\n" |
12764 | "JavaScript Object Notation\n") | |
718e3744 | 12765 | |
12766 | DEFUN (show_ip_bgp_neighbors_peer, | |
12767 | show_ip_bgp_neighbors_peer_cmd, | |
856ca177 | 12768 | "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12769 | SHOW_STR |
12770 | IP_STR | |
12771 | BGP_STR | |
12772 | "Detailed information on TCP and BGP neighbor connections\n" | |
12773 | "Neighbor to display information about\n" | |
a80beece | 12774 | "Neighbor to display information about\n" |
856ca177 MS |
12775 | "Neighbor on bgp configured interface\n" |
12776 | "JavaScript Object Notation\n") | |
718e3744 | 12777 | { |
db7c8528 | 12778 | u_char uj = use_json(argc, argv); |
856ca177 | 12779 | |
9f689658 | 12780 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], uj, NULL); |
718e3744 | 12781 | } |
12782 | ||
12783 | ALIAS (show_ip_bgp_neighbors_peer, | |
12784 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
856ca177 | 12785 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12786 | SHOW_STR |
12787 | IP_STR | |
12788 | BGP_STR | |
12789 | "Address family\n" | |
12790 | "Address Family modifier\n" | |
12791 | "Address Family modifier\n" | |
12792 | "Detailed information on TCP and BGP neighbor connections\n" | |
12793 | "Neighbor to display information about\n" | |
a80beece | 12794 | "Neighbor to display information about\n" |
856ca177 MS |
12795 | "Neighbor on bgp configured interface\n" |
12796 | "JavaScript Object Notation\n") | |
718e3744 | 12797 | |
12798 | ALIAS (show_ip_bgp_neighbors_peer, | |
12799 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
856ca177 | 12800 | "show ip bgp vpnv4 all neighbors A.B.C.D {json}", |
718e3744 | 12801 | SHOW_STR |
12802 | IP_STR | |
12803 | BGP_STR | |
12804 | "Display VPNv4 NLRI specific information\n" | |
12805 | "Display information about all VPNv4 NLRIs\n" | |
12806 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
12807 | "Neighbor to display information about\n" |
12808 | "JavaScript Object Notation\n") | |
718e3744 | 12809 | |
12810 | ALIAS (show_ip_bgp_neighbors_peer, | |
12811 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
856ca177 | 12812 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}", |
718e3744 | 12813 | SHOW_STR |
12814 | IP_STR | |
12815 | BGP_STR | |
12816 | "Display VPNv4 NLRI specific information\n" | |
12817 | "Display information about all VPNv4 NLRIs\n" | |
12818 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
12819 | "Neighbor to display information about\n" |
12820 | "JavaScript Object Notation\n") | |
718e3744 | 12821 | |
12822 | ALIAS (show_ip_bgp_neighbors_peer, | |
12823 | show_bgp_neighbors_peer_cmd, | |
856ca177 | 12824 | "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12825 | SHOW_STR |
12826 | BGP_STR | |
12827 | "Detailed information on TCP and BGP neighbor connections\n" | |
12828 | "Neighbor to display information about\n" | |
a80beece | 12829 | "Neighbor to display information about\n" |
856ca177 MS |
12830 | "Neighbor on bgp configured interface\n" |
12831 | "JavaScript Object Notation\n") | |
718e3744 | 12832 | |
12833 | ALIAS (show_ip_bgp_neighbors_peer, | |
12834 | show_bgp_ipv6_neighbors_peer_cmd, | |
856ca177 | 12835 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12836 | SHOW_STR |
12837 | BGP_STR | |
12838 | "Address family\n" | |
12839 | "Detailed information on TCP and BGP neighbor connections\n" | |
12840 | "Neighbor to display information about\n" | |
a80beece | 12841 | "Neighbor to display information about\n" |
856ca177 MS |
12842 | "Neighbor on bgp configured interface\n" |
12843 | "JavaScript Object Notation\n") | |
718e3744 | 12844 | |
12845 | DEFUN (show_ip_bgp_instance_neighbors, | |
12846 | show_ip_bgp_instance_neighbors_cmd, | |
8386ac43 | 12847 | "show ip bgp " BGP_INSTANCE_CMD " neighbors {json}", |
718e3744 | 12848 | SHOW_STR |
12849 | IP_STR | |
12850 | BGP_STR | |
8386ac43 | 12851 | BGP_INSTANCE_HELP_STR |
856ca177 MS |
12852 | "Detailed information on TCP and BGP neighbor connections\n" |
12853 | "JavaScript Object Notation\n") | |
718e3744 | 12854 | { |
db7c8528 | 12855 | u_char uj = use_json(argc, argv); |
856ca177 | 12856 | |
9f689658 | 12857 | return bgp_show_neighbor_vty (vty, argv[1], show_all, NULL, uj, NULL); |
718e3744 | 12858 | } |
12859 | ||
f186de26 | 12860 | DEFUN (show_ip_bgp_instance_all_neighbors, |
12861 | show_ip_bgp_instance_all_neighbors_cmd, | |
12862 | "show ip bgp " BGP_INSTANCE_ALL_CMD " neighbors {json}", | |
12863 | SHOW_STR | |
12864 | IP_STR | |
12865 | BGP_STR | |
12866 | BGP_INSTANCE_ALL_HELP_STR | |
12867 | "Detailed information on TCP and BGP neighbor connections\n" | |
12868 | "JavaScript Object Notation\n") | |
12869 | { | |
12870 | u_char uj = use_json(argc, argv); | |
12871 | ||
12872 | bgp_show_all_instances_neighbors_vty (vty, uj); | |
12873 | return CMD_SUCCESS; | |
12874 | } | |
12875 | ||
bb46e94f | 12876 | ALIAS (show_ip_bgp_instance_neighbors, |
12877 | show_bgp_instance_neighbors_cmd, | |
8386ac43 | 12878 | "show bgp " BGP_INSTANCE_CMD " neighbors {json}", |
bb46e94f | 12879 | SHOW_STR |
12880 | BGP_STR | |
8386ac43 | 12881 | BGP_INSTANCE_HELP_STR |
856ca177 MS |
12882 | "Detailed information on TCP and BGP neighbor connections\n" |
12883 | "JavaScript Object Notation\n") | |
bb46e94f | 12884 | |
12885 | ALIAS (show_ip_bgp_instance_neighbors, | |
12886 | show_bgp_instance_ipv6_neighbors_cmd, | |
8386ac43 | 12887 | "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors {json}", |
bb46e94f | 12888 | SHOW_STR |
12889 | BGP_STR | |
8386ac43 | 12890 | BGP_INSTANCE_HELP_STR |
bb46e94f | 12891 | "Address family\n" |
856ca177 MS |
12892 | "Detailed information on TCP and BGP neighbor connections\n" |
12893 | "JavaScript Object Notation\n") | |
bb46e94f | 12894 | |
718e3744 | 12895 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
12896 | show_ip_bgp_instance_neighbors_peer_cmd, | |
8386ac43 | 12897 | "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12898 | SHOW_STR |
12899 | IP_STR | |
12900 | BGP_STR | |
8386ac43 | 12901 | BGP_INSTANCE_HELP_STR |
718e3744 | 12902 | "Detailed information on TCP and BGP neighbor connections\n" |
12903 | "Neighbor to display information about\n" | |
a80beece | 12904 | "Neighbor to display information about\n" |
856ca177 MS |
12905 | "Neighbor on bgp configured interface\n" |
12906 | "JavaScript Object Notation\n") | |
718e3744 | 12907 | { |
db7c8528 | 12908 | u_char uj = use_json(argc, argv); |
856ca177 | 12909 | |
9f689658 | 12910 | return bgp_show_neighbor_vty (vty, argv[1], show_peer, argv[2], uj, NULL); |
718e3744 | 12911 | } |
bb46e94f | 12912 | |
12913 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
12914 | show_bgp_instance_neighbors_peer_cmd, | |
8386ac43 | 12915 | "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 12916 | SHOW_STR |
12917 | BGP_STR | |
8386ac43 | 12918 | BGP_INSTANCE_HELP_STR |
bb46e94f | 12919 | "Detailed information on TCP and BGP neighbor connections\n" |
12920 | "Neighbor to display information about\n" | |
a80beece | 12921 | "Neighbor to display information about\n" |
856ca177 MS |
12922 | "Neighbor on bgp configured interface\n" |
12923 | "JavaScript Object Notation\n") | |
bb46e94f | 12924 | |
12925 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
12926 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
8386ac43 | 12927 | "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 12928 | SHOW_STR |
12929 | BGP_STR | |
8386ac43 | 12930 | BGP_INSTANCE_HELP_STR |
bb46e94f | 12931 | "Address family\n" |
12932 | "Detailed information on TCP and BGP neighbor connections\n" | |
12933 | "Neighbor to display information about\n" | |
a80beece | 12934 | "Neighbor to display information about\n" |
856ca177 MS |
12935 | "Neighbor on bgp configured interface\n" |
12936 | "JavaScript Object Notation\n") | |
6b0655a2 | 12937 | |
718e3744 | 12938 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
12939 | paths' and `show ip mbgp paths'. Those functions results are the | |
12940 | same.*/ | |
12941 | DEFUN (show_ip_bgp_paths, | |
12942 | show_ip_bgp_paths_cmd, | |
12943 | "show ip bgp paths", | |
12944 | SHOW_STR | |
12945 | IP_STR | |
12946 | BGP_STR | |
12947 | "Path information\n") | |
12948 | { | |
12949 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
12950 | aspath_print_all_vty (vty); | |
12951 | return CMD_SUCCESS; | |
12952 | } | |
12953 | ||
12954 | DEFUN (show_ip_bgp_ipv4_paths, | |
12955 | show_ip_bgp_ipv4_paths_cmd, | |
12956 | "show ip bgp ipv4 (unicast|multicast) paths", | |
12957 | SHOW_STR | |
12958 | IP_STR | |
12959 | BGP_STR | |
12960 | "Address family\n" | |
12961 | "Address Family modifier\n" | |
12962 | "Address Family modifier\n" | |
12963 | "Path information\n") | |
12964 | { | |
12965 | vty_out (vty, "Address Refcnt Path\r\n"); | |
12966 | aspath_print_all_vty (vty); | |
12967 | ||
12968 | return CMD_SUCCESS; | |
12969 | } | |
6b0655a2 | 12970 | |
718e3744 | 12971 | #include "hash.h" |
12972 | ||
94f2b392 | 12973 | static void |
718e3744 | 12974 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
12975 | { | |
12976 | struct community *com; | |
12977 | ||
12978 | com = (struct community *) backet->data; | |
6c4f4e6e | 12979 | vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt, |
718e3744 | 12980 | community_str (com), VTY_NEWLINE); |
12981 | } | |
12982 | ||
12983 | /* Show BGP's community internal data. */ | |
12984 | DEFUN (show_ip_bgp_community_info, | |
12985 | show_ip_bgp_community_info_cmd, | |
12986 | "show ip bgp community-info", | |
12987 | SHOW_STR | |
12988 | IP_STR | |
12989 | BGP_STR | |
12990 | "List all bgp community information\n") | |
12991 | { | |
12992 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
12993 | ||
12994 | hash_iterate (community_hash (), | |
12995 | (void (*) (struct hash_backet *, void *)) | |
12996 | community_show_all_iterator, | |
12997 | vty); | |
12998 | ||
12999 | return CMD_SUCCESS; | |
13000 | } | |
13001 | ||
13002 | DEFUN (show_ip_bgp_attr_info, | |
13003 | show_ip_bgp_attr_info_cmd, | |
13004 | "show ip bgp attribute-info", | |
13005 | SHOW_STR | |
13006 | IP_STR | |
13007 | BGP_STR | |
13008 | "List all bgp attribute information\n") | |
13009 | { | |
13010 | attr_show_all (vty); | |
13011 | return CMD_SUCCESS; | |
13012 | } | |
6b0655a2 | 13013 | |
8386ac43 | 13014 | static int bgp_show_update_groups(struct vty *vty, const char *name, |
13015 | int afi, int safi, | |
50ef26d4 | 13016 | u_int64_t subgrp_id) |
3f9c7369 DS |
13017 | { |
13018 | struct bgp *bgp; | |
13019 | ||
8386ac43 | 13020 | if (name) |
13021 | bgp = bgp_lookup_by_name (name); | |
13022 | else | |
13023 | bgp = bgp_get_default (); | |
13024 | ||
3f9c7369 | 13025 | if (bgp) |
8fe8a7f6 | 13026 | update_group_show(bgp, afi, safi, vty, subgrp_id); |
3f9c7369 DS |
13027 | return CMD_SUCCESS; |
13028 | } | |
13029 | ||
f186de26 | 13030 | static void |
13031 | bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi) | |
13032 | { | |
13033 | struct listnode *node, *nnode; | |
13034 | struct bgp *bgp; | |
13035 | ||
13036 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
13037 | { | |
13038 | vty_out (vty, "%sInstance %s:%s", | |
13039 | VTY_NEWLINE, | |
13040 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name, | |
13041 | VTY_NEWLINE); | |
13042 | update_group_show(bgp, afi, safi, vty, 0); | |
13043 | } | |
13044 | } | |
13045 | ||
8fe8a7f6 DS |
13046 | DEFUN (show_ip_bgp_updgrps, |
13047 | show_ip_bgp_updgrps_cmd, | |
13048 | "show ip bgp update-groups", | |
13049 | SHOW_STR | |
13050 | IP_STR | |
13051 | BGP_STR | |
13052 | "Detailed info about dynamic update groups\n") | |
13053 | { | |
8386ac43 | 13054 | return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, 0)); |
13055 | } | |
13056 | ||
13057 | DEFUN (show_ip_bgp_instance_updgrps, | |
13058 | show_ip_bgp_instance_updgrps_cmd, | |
13059 | "show ip bgp " BGP_INSTANCE_CMD " update-groups", | |
13060 | SHOW_STR | |
13061 | IP_STR | |
13062 | BGP_STR | |
13063 | BGP_INSTANCE_HELP_STR | |
13064 | "Detailed info about dynamic update groups\n") | |
13065 | { | |
13066 | return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, 0)); | |
8fe8a7f6 DS |
13067 | } |
13068 | ||
f186de26 | 13069 | DEFUN (show_ip_bgp_instance_all_updgrps, |
13070 | show_ip_bgp_instance_all_updgrps_cmd, | |
13071 | "show ip bgp " BGP_INSTANCE_ALL_CMD " update-groups", | |
13072 | SHOW_STR | |
13073 | IP_STR | |
13074 | BGP_STR | |
13075 | BGP_INSTANCE_ALL_HELP_STR | |
13076 | "Detailed info about dynamic update groups\n") | |
13077 | { | |
13078 | bgp_show_all_instances_updgrps_vty (vty, AFI_IP, SAFI_UNICAST); | |
13079 | return CMD_SUCCESS; | |
13080 | } | |
13081 | ||
3f9c7369 DS |
13082 | DEFUN (show_bgp_ipv6_updgrps, |
13083 | show_bgp_ipv6_updgrps_cmd, | |
8fe8a7f6 | 13084 | "show bgp update-groups", |
3f9c7369 DS |
13085 | SHOW_STR |
13086 | BGP_STR | |
8fe8a7f6 | 13087 | "Detailed info about v6 dynamic update groups\n") |
3f9c7369 | 13088 | { |
8386ac43 | 13089 | return (bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, 0)); |
13090 | } | |
13091 | ||
13092 | DEFUN (show_bgp_instance_ipv6_updgrps, | |
13093 | show_bgp_instance_ipv6_updgrps_cmd, | |
13094 | "show bgp " BGP_INSTANCE_CMD " update-groups", | |
13095 | SHOW_STR | |
13096 | BGP_STR | |
13097 | BGP_INSTANCE_HELP_STR | |
13098 | "Detailed info about v6 dynamic update groups\n") | |
13099 | { | |
13100 | return (bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, 0)); | |
3f9c7369 DS |
13101 | } |
13102 | ||
f186de26 | 13103 | DEFUN (show_bgp_instance_all_ipv6_updgrps, |
13104 | show_bgp_instance_all_ipv6_updgrps_cmd, | |
13105 | "show bgp " BGP_INSTANCE_ALL_CMD " update-groups", | |
13106 | SHOW_STR | |
13107 | BGP_STR | |
13108 | BGP_INSTANCE_ALL_HELP_STR | |
13109 | "Detailed info about v6 dynamic update groups\n") | |
13110 | { | |
13111 | bgp_show_all_instances_updgrps_vty (vty, AFI_IP6, SAFI_UNICAST); | |
13112 | return CMD_SUCCESS; | |
13113 | } | |
13114 | ||
3f9c7369 DS |
13115 | DEFUN (show_bgp_updgrps, |
13116 | show_bgp_updgrps_cmd, | |
8fe8a7f6 | 13117 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups", |
3f9c7369 DS |
13118 | SHOW_STR |
13119 | BGP_STR | |
13120 | "Address family\n" | |
13121 | "Address family\n" | |
13122 | "Address Family modifier\n" | |
13123 | "Address Family modifier\n" | |
8fe8a7f6 | 13124 | "Detailed info about dynamic update groups\n") |
3f9c7369 | 13125 | { |
3f9c7369 DS |
13126 | afi_t afi; |
13127 | safi_t safi; | |
13128 | ||
13129 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13130 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8386ac43 | 13131 | return (bgp_show_update_groups(vty, NULL, afi, safi, 0)); |
8fe8a7f6 DS |
13132 | } |
13133 | ||
13134 | DEFUN (show_ip_bgp_updgrps_s, | |
13135 | show_ip_bgp_updgrps_s_cmd, | |
13136 | "show ip bgp update-groups SUBGROUP-ID", | |
13137 | SHOW_STR | |
13138 | IP_STR | |
13139 | BGP_STR | |
13140 | "Detailed info about dynamic update groups\n" | |
13141 | "Specific subgroup to display detailed info for\n") | |
13142 | { | |
13143 | u_int64_t subgrp_id; | |
13144 | ||
13145 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
8386ac43 | 13146 | return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, subgrp_id)); |
13147 | } | |
13148 | ||
13149 | DEFUN (show_ip_bgp_instance_updgrps_s, | |
13150 | show_ip_bgp_instance_updgrps_s_cmd, | |
13151 | "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID", | |
13152 | SHOW_STR | |
13153 | IP_STR | |
13154 | BGP_STR | |
13155 | BGP_INSTANCE_HELP_STR | |
13156 | "Detailed info about dynamic update groups\n" | |
13157 | "Specific subgroup to display detailed info for\n") | |
13158 | { | |
13159 | u_int64_t subgrp_id; | |
13160 | ||
13161 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13162 | return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, subgrp_id)); | |
8fe8a7f6 DS |
13163 | } |
13164 | ||
13165 | DEFUN (show_bgp_ipv6_updgrps_s, | |
13166 | show_bgp_ipv6_updgrps_s_cmd, | |
13167 | "show bgp update-groups SUBGROUP-ID", | |
13168 | SHOW_STR | |
13169 | BGP_STR | |
13170 | "Detailed info about v6 dynamic update groups\n" | |
13171 | "Specific subgroup to display detailed info for\n") | |
13172 | { | |
13173 | u_int64_t subgrp_id; | |
13174 | ||
13175 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
8386ac43 | 13176 | return(bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, subgrp_id)); |
13177 | } | |
13178 | ||
13179 | DEFUN (show_bgp_instance_ipv6_updgrps_s, | |
13180 | show_bgp_instance_ipv6_updgrps_s_cmd, | |
13181 | "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID", | |
13182 | SHOW_STR | |
13183 | BGP_STR | |
13184 | "Detailed info about v6 dynamic update groups\n" | |
13185 | "Specific subgroup to display detailed info for\n") | |
13186 | { | |
13187 | u_int64_t subgrp_id; | |
13188 | ||
13189 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13190 | return(bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, subgrp_id)); | |
8fe8a7f6 DS |
13191 | } |
13192 | ||
13193 | DEFUN (show_bgp_updgrps_s, | |
13194 | show_bgp_updgrps_s_cmd, | |
13195 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID", | |
13196 | SHOW_STR | |
13197 | BGP_STR | |
13198 | "Address family\n" | |
13199 | "Address family\n" | |
13200 | "Address Family modifier\n" | |
13201 | "Address Family modifier\n" | |
13202 | "Detailed info about v6 dynamic update groups\n" | |
13203 | "Specific subgroup to display detailed info for") | |
13204 | { | |
13205 | afi_t afi; | |
13206 | safi_t safi; | |
13207 | u_int64_t subgrp_id; | |
13208 | ||
13209 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13210 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
13211 | ||
13212 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
8386ac43 | 13213 | return(bgp_show_update_groups(vty, NULL, afi, safi, subgrp_id)); |
3f9c7369 DS |
13214 | } |
13215 | ||
13216 | DEFUN (show_bgp_updgrps_stats, | |
13217 | show_bgp_updgrps_stats_cmd, | |
13218 | "show bgp update-groups statistics", | |
13219 | SHOW_STR | |
13220 | BGP_STR | |
13221 | "BGP update groups\n" | |
13222 | "Statistics\n") | |
13223 | { | |
13224 | struct bgp *bgp; | |
13225 | ||
13226 | bgp = bgp_get_default(); | |
13227 | if (bgp) | |
13228 | update_group_show_stats(bgp, vty); | |
13229 | ||
13230 | return CMD_SUCCESS; | |
13231 | } | |
13232 | ||
8386ac43 | 13233 | DEFUN (show_bgp_instance_updgrps_stats, |
13234 | show_bgp_instance_updgrps_stats_cmd, | |
13235 | "show bgp " BGP_INSTANCE_CMD " update-groups statistics", | |
13236 | SHOW_STR | |
13237 | BGP_STR | |
13238 | BGP_INSTANCE_HELP_STR | |
13239 | "BGP update groups\n" | |
13240 | "Statistics\n") | |
13241 | { | |
13242 | struct bgp *bgp; | |
13243 | ||
13244 | bgp = bgp_lookup_by_name (argv[1]); | |
13245 | if (bgp) | |
13246 | update_group_show_stats(bgp, vty); | |
13247 | ||
13248 | return CMD_SUCCESS; | |
13249 | } | |
13250 | ||
3f9c7369 | 13251 | static void |
8386ac43 | 13252 | show_bgp_updgrps_adj_info_aux (struct vty *vty, const char *name, |
13253 | afi_t afi, safi_t safi, | |
3f9c7369 DS |
13254 | const char *what, u_int64_t subgrp_id) |
13255 | { | |
13256 | struct bgp *bgp; | |
8386ac43 | 13257 | |
13258 | if (name) | |
13259 | bgp = bgp_lookup_by_name (name); | |
13260 | else | |
13261 | bgp = bgp_get_default (); | |
13262 | ||
3f9c7369 DS |
13263 | if (bgp) |
13264 | { | |
13265 | if (!strcmp(what, "advertise-queue")) | |
13266 | update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id); | |
13267 | else if (!strcmp(what, "advertised-routes")) | |
13268 | update_group_show_advertised(bgp, afi, safi, vty, subgrp_id); | |
13269 | else if (!strcmp(what, "packet-queue")) | |
13270 | update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id); | |
13271 | } | |
13272 | } | |
13273 | ||
13274 | DEFUN (show_ip_bgp_updgrps_adj, | |
13275 | show_ip_bgp_updgrps_adj_cmd, | |
13276 | "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13277 | SHOW_STR | |
13278 | IP_STR | |
13279 | BGP_STR | |
13280 | "BGP update groups\n" | |
13281 | "Advertisement queue\n" | |
13282 | "Announced routes\n" | |
13283 | "Packet queue\n") | |
8fe8a7f6 | 13284 | |
3f9c7369 | 13285 | { |
8386ac43 | 13286 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[0], 0); |
13287 | return CMD_SUCCESS; | |
13288 | } | |
13289 | ||
13290 | DEFUN (show_ip_bgp_instance_updgrps_adj, | |
13291 | show_ip_bgp_instance_updgrps_adj_cmd, | |
13292 | "show ip bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13293 | SHOW_STR | |
13294 | IP_STR | |
13295 | BGP_STR | |
13296 | BGP_INSTANCE_HELP_STR | |
13297 | "BGP update groups\n" | |
13298 | "Advertisement queue\n" | |
13299 | "Announced routes\n" | |
13300 | "Packet queue\n") | |
13301 | ||
13302 | { | |
13303 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[2], 0); | |
3f9c7369 DS |
13304 | return CMD_SUCCESS; |
13305 | } | |
13306 | ||
13307 | DEFUN (show_bgp_updgrps_afi_adj, | |
13308 | show_bgp_updgrps_afi_adj_cmd, | |
13309 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13310 | SHOW_STR | |
13311 | BGP_STR | |
13312 | "Address family\n" | |
13313 | "Address family\n" | |
13314 | "Address Family modifier\n" | |
13315 | "Address Family modifier\n" | |
13316 | "BGP update groups\n" | |
13317 | "Advertisement queue\n" | |
13318 | "Announced routes\n" | |
8fe8a7f6 DS |
13319 | "Packet queue\n" |
13320 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
13321 | { |
13322 | afi_t afi; | |
13323 | safi_t safi; | |
13324 | ||
13325 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13326 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8386ac43 | 13327 | show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[2], 0); |
8fe8a7f6 | 13328 | return CMD_SUCCESS; |
3f9c7369 DS |
13329 | } |
13330 | ||
13331 | DEFUN (show_bgp_updgrps_adj, | |
13332 | show_bgp_updgrps_adj_cmd, | |
13333 | "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13334 | SHOW_STR | |
13335 | BGP_STR | |
13336 | "BGP update groups\n" | |
13337 | "Advertisement queue\n" | |
13338 | "Announced routes\n" | |
13339 | "Packet queue\n") | |
13340 | { | |
8386ac43 | 13341 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[0], 0); |
13342 | return CMD_SUCCESS; | |
13343 | } | |
13344 | ||
13345 | DEFUN (show_bgp_instance_updgrps_adj, | |
13346 | show_bgp_instance_updgrps_adj_cmd, | |
13347 | "show bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13348 | SHOW_STR | |
13349 | BGP_STR | |
13350 | BGP_INSTANCE_HELP_STR | |
13351 | "BGP update groups\n" | |
13352 | "Advertisement queue\n" | |
13353 | "Announced routes\n" | |
13354 | "Packet queue\n") | |
13355 | { | |
13356 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[2], 0); | |
3f9c7369 DS |
13357 | return CMD_SUCCESS; |
13358 | } | |
13359 | ||
13360 | DEFUN (show_ip_bgp_updgrps_adj_s, | |
8fe8a7f6 | 13361 | show_ip_bgp_updgrps_adj_s_cmd, |
3f9c7369 DS |
13362 | "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
13363 | SHOW_STR | |
13364 | IP_STR | |
13365 | BGP_STR | |
13366 | "BGP update groups\n" | |
8fe8a7f6 | 13367 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
13368 | "Advertisement queue\n" |
13369 | "Announced routes\n" | |
13370 | "Packet queue\n") | |
3f9c7369 | 13371 | |
3f9c7369 | 13372 | { |
8fe8a7f6 DS |
13373 | u_int64_t subgrp_id; |
13374 | ||
13375 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
13376 | ||
8386ac43 | 13377 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id); |
13378 | return CMD_SUCCESS; | |
13379 | } | |
13380 | ||
13381 | DEFUN (show_ip_bgp_instance_updgrps_adj_s, | |
13382 | show_ip_bgp_instance_updgrps_adj_s_cmd, | |
13383 | "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13384 | SHOW_STR | |
13385 | IP_STR | |
13386 | BGP_STR | |
13387 | BGP_INSTANCE_HELP_STR | |
13388 | "BGP update groups\n" | |
13389 | "Specific subgroup to display info for\n" | |
13390 | "Advertisement queue\n" | |
13391 | "Announced routes\n" | |
13392 | "Packet queue\n") | |
13393 | ||
13394 | { | |
13395 | u_int64_t subgrp_id; | |
13396 | ||
13397 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13398 | ||
13399 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[3], subgrp_id); | |
3f9c7369 DS |
13400 | return CMD_SUCCESS; |
13401 | } | |
13402 | ||
8fe8a7f6 DS |
13403 | DEFUN (show_bgp_updgrps_afi_adj_s, |
13404 | show_bgp_updgrps_afi_adj_s_cmd, | |
3f9c7369 DS |
13405 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
13406 | SHOW_STR | |
13407 | BGP_STR | |
13408 | "Address family\n" | |
13409 | "Address family\n" | |
13410 | "Address Family modifier\n" | |
13411 | "Address Family modifier\n" | |
13412 | "BGP update groups\n" | |
8fe8a7f6 | 13413 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
13414 | "Advertisement queue\n" |
13415 | "Announced routes\n" | |
8fe8a7f6 DS |
13416 | "Packet queue\n" |
13417 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
13418 | { |
13419 | afi_t afi; | |
13420 | safi_t safi; | |
8fe8a7f6 | 13421 | u_int64_t subgrp_id; |
3f9c7369 DS |
13422 | |
13423 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13424 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8fe8a7f6 DS |
13425 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); |
13426 | ||
8386ac43 | 13427 | show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[3], subgrp_id); |
8fe8a7f6 | 13428 | return CMD_SUCCESS; |
3f9c7369 DS |
13429 | } |
13430 | ||
8fe8a7f6 DS |
13431 | DEFUN (show_bgp_updgrps_adj_s, |
13432 | show_bgp_updgrps_adj_s_cmd, | |
13433 | "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13434 | SHOW_STR | |
13435 | BGP_STR | |
13436 | "BGP update groups\n" | |
13437 | "Specific subgroup to display info for\n" | |
13438 | "Advertisement queue\n" | |
13439 | "Announced routes\n" | |
13440 | "Packet queue\n") | |
13441 | { | |
13442 | u_int64_t subgrp_id; | |
13443 | ||
13444 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
13445 | ||
8386ac43 | 13446 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id); |
8fe8a7f6 DS |
13447 | return CMD_SUCCESS; |
13448 | } | |
13449 | ||
8386ac43 | 13450 | DEFUN (show_bgp_instance_updgrps_adj_s, |
13451 | show_bgp_instance_updgrps_adj_s_cmd, | |
13452 | "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13453 | SHOW_STR | |
13454 | BGP_STR | |
13455 | BGP_INSTANCE_HELP_STR | |
13456 | "BGP update groups\n" | |
13457 | "Specific subgroup to display info for\n" | |
13458 | "Advertisement queue\n" | |
13459 | "Announced routes\n" | |
13460 | "Packet queue\n") | |
13461 | { | |
13462 | u_int64_t subgrp_id; | |
13463 | ||
13464 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13465 | ||
13466 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id); | |
13467 | return CMD_SUCCESS; | |
13468 | } | |
13469 | ||
13470 | ||
8fe8a7f6 | 13471 | |
f14e6fdb DS |
13472 | static int |
13473 | bgp_show_one_peer_group (struct vty *vty, struct peer_group *group) | |
13474 | { | |
13475 | struct listnode *node, *nnode; | |
13476 | struct prefix *range; | |
13477 | struct peer *conf; | |
13478 | struct peer *peer; | |
4690c7d7 | 13479 | char buf[PREFIX2STR_BUFFER]; |
f14e6fdb DS |
13480 | afi_t afi; |
13481 | safi_t safi; | |
ffd0c037 DS |
13482 | const char *peer_status; |
13483 | const char *af_str; | |
f14e6fdb DS |
13484 | int lr_count; |
13485 | int dynamic; | |
13486 | int af_cfgd; | |
13487 | ||
13488 | conf = group->conf; | |
13489 | ||
0299c004 DS |
13490 | if (conf->as_type == AS_SPECIFIED || |
13491 | conf->as_type == AS_EXTERNAL) { | |
66b199b2 | 13492 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
f14e6fdb | 13493 | VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE); |
0299c004 | 13494 | } else if (conf->as_type == AS_INTERNAL) { |
66b199b2 | 13495 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
0299c004 | 13496 | VTY_NEWLINE, group->name, group->bgp->as, VTY_NEWLINE); |
66b199b2 DS |
13497 | } else { |
13498 | vty_out (vty, "%sBGP peer-group %s%s", | |
13499 | VTY_NEWLINE, group->name, VTY_NEWLINE); | |
0299c004 | 13500 | } |
f14e6fdb | 13501 | |
0299c004 | 13502 | if ((group->bgp->as == conf->as) || (conf->as_type == AS_INTERNAL)) |
f14e6fdb DS |
13503 | vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE); |
13504 | else | |
13505 | vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE); | |
13506 | ||
13507 | /* Display AFs configured. */ | |
13508 | vty_out (vty, " Configured address-families:"); | |
13509 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
13510 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
13511 | { | |
13512 | if (conf->afc[afi][safi]) | |
13513 | { | |
13514 | af_cfgd = 1; | |
13515 | vty_out (vty, " %s;", afi_safi_print(afi, safi)); | |
13516 | } | |
13517 | } | |
13518 | if (!af_cfgd) | |
13519 | vty_out (vty, " none%s", VTY_NEWLINE); | |
13520 | else | |
13521 | vty_out (vty, "%s", VTY_NEWLINE); | |
13522 | ||
13523 | /* Display listen ranges (for dynamic neighbors), if any */ | |
13524 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
13525 | { | |
13526 | if (afi == AFI_IP) | |
13527 | af_str = "IPv4"; | |
13528 | else if (afi == AFI_IP6) | |
13529 | af_str = "IPv6"; | |
13530 | lr_count = listcount(group->listen_range[afi]); | |
13531 | if (lr_count) | |
13532 | { | |
13533 | vty_out(vty, | |
13534 | " %d %s listen range(s)%s", | |
13535 | lr_count, af_str, VTY_NEWLINE); | |
13536 | ||
13537 | ||
13538 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node, | |
13539 | nnode, range)) | |
13540 | { | |
13541 | prefix2str(range, buf, sizeof(buf)); | |
13542 | vty_out(vty, " %s%s", buf, VTY_NEWLINE); | |
13543 | } | |
13544 | } | |
13545 | } | |
13546 | ||
13547 | /* Display group members and their status */ | |
13548 | if (listcount(group->peer)) | |
13549 | { | |
13550 | vty_out (vty, " Peer-group members:%s", VTY_NEWLINE); | |
13551 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
13552 | { | |
13553 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
13554 | peer_status = "Idle (Admin)"; | |
13555 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
13556 | peer_status = "Idle (PfxCt)"; | |
13557 | else | |
13558 | peer_status = LOOKUP(bgp_status_msg, peer->status); | |
13559 | ||
13560 | dynamic = peer_dynamic_neighbor(peer); | |
13561 | vty_out (vty, " %s %s %s %s", | |
13562 | peer->host, dynamic ? "(dynamic)" : "", | |
13563 | peer_status, VTY_NEWLINE); | |
13564 | } | |
13565 | } | |
13566 | ||
13567 | return CMD_SUCCESS; | |
13568 | } | |
13569 | ||
13570 | /* Show BGP peer group's information. */ | |
13571 | enum show_group_type | |
13572 | { | |
13573 | show_all_groups, | |
13574 | show_peer_group | |
13575 | }; | |
13576 | ||
13577 | static int | |
13578 | bgp_show_peer_group (struct vty *vty, struct bgp *bgp, | |
13579 | enum show_group_type type, const char *group_name) | |
13580 | { | |
13581 | struct listnode *node, *nnode; | |
13582 | struct peer_group *group; | |
13583 | int find = 0; | |
13584 | ||
13585 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
13586 | { | |
13587 | switch (type) | |
13588 | { | |
13589 | case show_all_groups: | |
13590 | bgp_show_one_peer_group (vty, group); | |
13591 | break; | |
13592 | case show_peer_group: | |
13593 | if (group_name && (strcmp(group->name, group_name) == 0)) | |
13594 | { | |
13595 | find = 1; | |
13596 | bgp_show_one_peer_group (vty, group); | |
13597 | } | |
13598 | break; | |
13599 | } | |
13600 | } | |
13601 | ||
13602 | if (type == show_peer_group && ! find) | |
13603 | vty_out (vty, "%% No such peer-groupr%s", VTY_NEWLINE); | |
13604 | ||
13605 | return CMD_SUCCESS; | |
13606 | } | |
13607 | ||
13608 | static int | |
13609 | bgp_show_peer_group_vty (struct vty *vty, const char *name, | |
13610 | enum show_group_type type, const char *group_name) | |
13611 | { | |
13612 | struct bgp *bgp; | |
13613 | int ret = CMD_SUCCESS; | |
13614 | ||
13615 | if (name) | |
8386ac43 | 13616 | bgp = bgp_lookup_by_name (name); |
13617 | else | |
13618 | bgp = bgp_get_default (); | |
f14e6fdb | 13619 | |
8386ac43 | 13620 | if (! bgp) |
13621 | { | |
13622 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
13623 | return CMD_WARNING; | |
f14e6fdb DS |
13624 | } |
13625 | ||
8386ac43 | 13626 | ret = bgp_show_peer_group (vty, bgp, type, group_name); |
f14e6fdb DS |
13627 | |
13628 | return ret; | |
13629 | } | |
13630 | ||
13631 | DEFUN (show_ip_bgp_peer_groups, | |
13632 | show_ip_bgp_peer_groups_cmd, | |
13633 | "show ip bgp peer-group", | |
13634 | SHOW_STR | |
13635 | IP_STR | |
13636 | BGP_STR | |
13637 | "Detailed information on all BGP peer groups\n") | |
13638 | { | |
13639 | return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL); | |
13640 | } | |
13641 | ||
13642 | DEFUN (show_ip_bgp_instance_peer_groups, | |
13643 | show_ip_bgp_instance_peer_groups_cmd, | |
8386ac43 | 13644 | "show ip bgp " BGP_INSTANCE_CMD " peer-group", |
f14e6fdb DS |
13645 | SHOW_STR |
13646 | IP_STR | |
13647 | BGP_STR | |
8386ac43 | 13648 | BGP_INSTANCE_HELP_STR |
f14e6fdb DS |
13649 | "Detailed information on all BGP peer groups\n") |
13650 | { | |
8386ac43 | 13651 | return bgp_show_peer_group_vty (vty, argv[1], show_all_groups, NULL); |
f14e6fdb DS |
13652 | } |
13653 | ||
13654 | DEFUN (show_ip_bgp_peer_group, | |
13655 | show_ip_bgp_peer_group_cmd, | |
13656 | "show ip bgp peer-group WORD", | |
13657 | SHOW_STR | |
13658 | IP_STR | |
13659 | BGP_STR | |
13660 | "BGP peer-group name\n" | |
13661 | "Detailed information on a BGP peer group\n") | |
13662 | { | |
13663 | return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]); | |
13664 | } | |
13665 | ||
13666 | DEFUN (show_ip_bgp_instance_peer_group, | |
13667 | show_ip_bgp_instance_peer_group_cmd, | |
8386ac43 | 13668 | "show ip bgp " BGP_INSTANCE_CMD " peer-group WORD", |
f14e6fdb DS |
13669 | SHOW_STR |
13670 | IP_STR | |
13671 | BGP_STR | |
8386ac43 | 13672 | BGP_INSTANCE_HELP_STR |
f14e6fdb DS |
13673 | "BGP peer-group name\n" |
13674 | "Detailed information on a BGP peer group\n") | |
13675 | { | |
8386ac43 | 13676 | return bgp_show_peer_group_vty (vty, argv[1], show_peer_group, argv[2]); |
f14e6fdb | 13677 | } |
3f9c7369 | 13678 | |
718e3744 | 13679 | /* Redistribute VTY commands. */ |
13680 | ||
718e3744 | 13681 | DEFUN (bgp_redistribute_ipv4, |
13682 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 13683 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 13684 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13685 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 13686 | { |
13687 | int type; | |
13688 | ||
e0ca5fde DL |
13689 | type = proto_redistnum (AFI_IP, argv[0]); |
13690 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13691 | { |
13692 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13693 | return CMD_WARNING; | |
13694 | } | |
7c8ff89e | 13695 | bgp_redist_add(vty->index, AFI_IP, type, 0); |
6aeb9e78 | 13696 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13697 | } |
13698 | ||
13699 | DEFUN (bgp_redistribute_ipv4_rmap, | |
13700 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 13701 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 13702 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13703 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13704 | "Route map reference\n" |
13705 | "Pointer to route-map entries\n") | |
13706 | { | |
13707 | int type; | |
7c8ff89e | 13708 | struct bgp_redist *red; |
718e3744 | 13709 | |
e0ca5fde DL |
13710 | type = proto_redistnum (AFI_IP, argv[0]); |
13711 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13712 | { |
13713 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13714 | return CMD_WARNING; | |
13715 | } | |
13716 | ||
7c8ff89e DS |
13717 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
13718 | bgp_redistribute_rmap_set (red, argv[1]); | |
6aeb9e78 | 13719 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13720 | } |
13721 | ||
13722 | DEFUN (bgp_redistribute_ipv4_metric, | |
13723 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 13724 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 13725 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13726 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13727 | "Metric for redistributed routes\n" |
13728 | "Default metric\n") | |
13729 | { | |
13730 | int type; | |
13731 | u_int32_t metric; | |
7c8ff89e | 13732 | struct bgp_redist *red; |
718e3744 | 13733 | |
e0ca5fde DL |
13734 | type = proto_redistnum (AFI_IP, argv[0]); |
13735 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13736 | { |
13737 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13738 | return CMD_WARNING; | |
13739 | } | |
13740 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
13741 | ||
7c8ff89e | 13742 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 13743 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
6aeb9e78 | 13744 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13745 | } |
13746 | ||
13747 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
13748 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 13749 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 13750 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13751 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13752 | "Route map reference\n" |
13753 | "Pointer to route-map entries\n" | |
13754 | "Metric for redistributed routes\n" | |
13755 | "Default metric\n") | |
13756 | { | |
13757 | int type; | |
13758 | u_int32_t metric; | |
7c8ff89e | 13759 | struct bgp_redist *red; |
718e3744 | 13760 | |
e0ca5fde DL |
13761 | type = proto_redistnum (AFI_IP, argv[0]); |
13762 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13763 | { |
13764 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13765 | return CMD_WARNING; | |
13766 | } | |
13767 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13768 | ||
7c8ff89e DS |
13769 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
13770 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 13771 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
6aeb9e78 | 13772 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13773 | } |
13774 | ||
13775 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
13776 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 13777 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 13778 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13779 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13780 | "Metric for redistributed routes\n" |
13781 | "Default metric\n" | |
13782 | "Route map reference\n" | |
13783 | "Pointer to route-map entries\n") | |
13784 | { | |
13785 | int type; | |
13786 | u_int32_t metric; | |
7c8ff89e | 13787 | struct bgp_redist *red; |
718e3744 | 13788 | |
e0ca5fde DL |
13789 | type = proto_redistnum (AFI_IP, argv[0]); |
13790 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13791 | { |
13792 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13793 | return CMD_WARNING; | |
13794 | } | |
13795 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
13796 | ||
7c8ff89e | 13797 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 13798 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
7c8ff89e | 13799 | bgp_redistribute_rmap_set (red, argv[2]); |
6aeb9e78 | 13800 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13801 | } |
13802 | ||
7c8ff89e DS |
13803 | DEFUN (bgp_redistribute_ipv4_ospf, |
13804 | bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 13805 | "redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
13806 | "Redistribute information from another routing protocol\n" |
13807 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13808 | "Non-main Kernel Routing Table\n" |
13809 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
13810 | { |
13811 | u_short instance; | |
7a4bb9c5 | 13812 | u_short protocol; |
7c8ff89e | 13813 | |
7a4bb9c5 DS |
13814 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13815 | ||
13816 | if (strncmp(argv[0], "o", 1) == 0) | |
13817 | protocol = ZEBRA_ROUTE_OSPF; | |
13818 | else | |
13819 | protocol = ZEBRA_ROUTE_TABLE; | |
13820 | ||
13821 | bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
6aeb9e78 | 13822 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13823 | } |
13824 | ||
13825 | DEFUN (bgp_redistribute_ipv4_ospf_rmap, | |
13826 | bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 13827 | "redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
13828 | "Redistribute information from another routing protocol\n" |
13829 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13830 | "Non-main Kernel Routing Table\n" |
13831 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13832 | "Route map reference\n" |
13833 | "Pointer to route-map entries\n") | |
13834 | { | |
13835 | struct bgp_redist *red; | |
13836 | u_short instance; | |
7a4bb9c5 | 13837 | int protocol; |
7c8ff89e | 13838 | |
7a4bb9c5 DS |
13839 | if (strncmp(argv[0], "o", 1) == 0) |
13840 | protocol = ZEBRA_ROUTE_OSPF; | |
13841 | else | |
13842 | protocol = ZEBRA_ROUTE_TABLE; | |
13843 | ||
13844 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); | |
13845 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
13846 | bgp_redistribute_rmap_set (red, argv[2]); | |
6aeb9e78 | 13847 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13848 | } |
13849 | ||
13850 | DEFUN (bgp_redistribute_ipv4_ospf_metric, | |
13851 | bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 13852 | "redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
13853 | "Redistribute information from another routing protocol\n" |
13854 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13855 | "Non-main Kernel Routing Table\n" |
13856 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13857 | "Metric for redistributed routes\n" |
13858 | "Default metric\n") | |
13859 | { | |
13860 | u_int32_t metric; | |
13861 | struct bgp_redist *red; | |
13862 | u_short instance; | |
7a4bb9c5 | 13863 | int protocol; |
7c8ff89e | 13864 | |
7a4bb9c5 DS |
13865 | if (strncmp(argv[0], "o", 1) == 0) |
13866 | protocol = ZEBRA_ROUTE_OSPF; | |
13867 | else | |
13868 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13869 | |
7a4bb9c5 DS |
13870 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13871 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13872 | ||
13873 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 13874 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
6aeb9e78 | 13875 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13876 | } |
13877 | ||
13878 | DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, | |
13879 | bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 13880 | "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
13881 | "Redistribute information from another routing protocol\n" |
13882 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13883 | "Non-main Kernel Routing Table\n" |
13884 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13885 | "Route map reference\n" |
13886 | "Pointer to route-map entries\n" | |
13887 | "Metric for redistributed routes\n" | |
13888 | "Default metric\n") | |
13889 | { | |
13890 | u_int32_t metric; | |
13891 | struct bgp_redist *red; | |
13892 | u_short instance; | |
7a4bb9c5 | 13893 | int protocol; |
7c8ff89e | 13894 | |
7a4bb9c5 DS |
13895 | if (strncmp(argv[0], "o", 1) == 0) |
13896 | protocol = ZEBRA_ROUTE_OSPF; | |
13897 | else | |
13898 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13899 | |
7a4bb9c5 DS |
13900 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13901 | VTY_GET_INTEGER ("metric", metric, argv[3]); | |
13902 | ||
13903 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
13904 | bgp_redistribute_rmap_set (red, argv[2]); | |
caf958b4 | 13905 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
6aeb9e78 | 13906 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13907 | } |
13908 | ||
13909 | DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, | |
13910 | bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 13911 | "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
13912 | "Redistribute information from another routing protocol\n" |
13913 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13914 | "Non-main Kernel Routing Table\n" |
13915 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13916 | "Metric for redistributed routes\n" |
13917 | "Default metric\n" | |
13918 | "Route map reference\n" | |
13919 | "Pointer to route-map entries\n") | |
13920 | { | |
13921 | u_int32_t metric; | |
13922 | struct bgp_redist *red; | |
13923 | u_short instance; | |
7a4bb9c5 | 13924 | int protocol; |
7c8ff89e | 13925 | |
7a4bb9c5 DS |
13926 | if (strncmp(argv[0], "o", 1) == 0) |
13927 | protocol = ZEBRA_ROUTE_OSPF; | |
13928 | else | |
13929 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13930 | |
7a4bb9c5 DS |
13931 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13932 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13933 | ||
13934 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 13935 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
7a4bb9c5 | 13936 | bgp_redistribute_rmap_set (red, argv[3]); |
6aeb9e78 | 13937 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13938 | } |
13939 | ||
13940 | DEFUN (no_bgp_redistribute_ipv4_ospf, | |
13941 | no_bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 13942 | "no redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
13943 | NO_STR |
13944 | "Redistribute information from another routing protocol\n" | |
13945 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13946 | "Non-main Kernel Routing Table\n" |
13947 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
13948 | { |
13949 | u_short instance; | |
7a4bb9c5 DS |
13950 | int protocol; |
13951 | ||
13952 | if (strncmp(argv[0], "o", 1) == 0) | |
13953 | protocol = ZEBRA_ROUTE_OSPF; | |
13954 | else | |
13955 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13956 | |
7a4bb9c5 DS |
13957 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13958 | return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); | |
7c8ff89e DS |
13959 | } |
13960 | ||
13961 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13962 | no_bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 13963 | "no redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
13964 | NO_STR |
13965 | "Redistribute information from another routing protocol\n" | |
13966 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13967 | "Non-main Kernel Routing Table\n" |
13968 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13969 | "Route map reference\n" |
13970 | "Pointer to route-map entries\n") | |
13971 | ||
13972 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13973 | no_bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 13974 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
13975 | NO_STR |
13976 | "Redistribute information from another routing protocol\n" | |
13977 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13978 | "Non-main Kernel Routing Table\n" |
13979 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13980 | "Metric for redistributed routes\n" |
13981 | "Default metric\n") | |
13982 | ||
13983 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13984 | no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 13985 | "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
13986 | NO_STR |
13987 | "Redistribute information from another routing protocol\n" | |
13988 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13989 | "Non-main Kernel Routing Table\n" |
13990 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13991 | "Route map reference\n" |
13992 | "Pointer to route-map entries\n" | |
13993 | "Metric for redistributed routes\n" | |
13994 | "Default metric\n") | |
13995 | ||
13996 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13997 | no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 13998 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
13999 | NO_STR |
14000 | "Redistribute information from another routing protocol\n" | |
14001 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
14002 | "Non-main Kernel Routing Table\n" |
14003 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
14004 | "Metric for redistributed routes\n" |
14005 | "Default metric\n" | |
14006 | "Route map reference\n" | |
14007 | "Pointer to route-map entries\n") | |
14008 | ||
718e3744 | 14009 | DEFUN (no_bgp_redistribute_ipv4, |
14010 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 14011 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 14012 | NO_STR |
14013 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14014 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 14015 | { |
14016 | int type; | |
14017 | ||
e0ca5fde DL |
14018 | type = proto_redistnum (AFI_IP, argv[0]); |
14019 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14020 | { |
14021 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14022 | return CMD_WARNING; | |
14023 | } | |
7c8ff89e | 14024 | return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); |
718e3744 | 14025 | } |
14026 | ||
503006bc | 14027 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 14028 | no_bgp_redistribute_ipv4_rmap_cmd, |
e0ca5fde | 14029 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 14030 | NO_STR |
14031 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14032 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 14033 | "Route map reference\n" |
14034 | "Pointer to route-map entries\n") | |
718e3744 | 14035 | |
503006bc | 14036 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 14037 | no_bgp_redistribute_ipv4_metric_cmd, |
e0ca5fde | 14038 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 14039 | NO_STR |
14040 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14041 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 14042 | "Metric for redistributed routes\n" |
14043 | "Default metric\n") | |
718e3744 | 14044 | |
503006bc | 14045 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 14046 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
e0ca5fde | 14047 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 14048 | NO_STR |
14049 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14050 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 14051 | "Route map reference\n" |
14052 | "Pointer to route-map entries\n" | |
14053 | "Metric for redistributed routes\n" | |
14054 | "Default metric\n") | |
718e3744 | 14055 | |
503006bc | 14056 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 14057 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
e0ca5fde | 14058 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 14059 | NO_STR |
14060 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14061 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 14062 | "Metric for redistributed routes\n" |
14063 | "Default metric\n" | |
14064 | "Route map reference\n" | |
14065 | "Pointer to route-map entries\n") | |
6b0655a2 | 14066 | |
718e3744 | 14067 | #ifdef HAVE_IPV6 |
14068 | DEFUN (bgp_redistribute_ipv6, | |
14069 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 14070 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 14071 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14072 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 14073 | { |
14074 | int type; | |
14075 | ||
e0ca5fde DL |
14076 | type = proto_redistnum (AFI_IP6, argv[0]); |
14077 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14078 | { |
14079 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14080 | return CMD_WARNING; | |
14081 | } | |
14082 | ||
7c8ff89e | 14083 | bgp_redist_add(vty->index, AFI_IP6, type, 0); |
6aeb9e78 | 14084 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14085 | } |
14086 | ||
14087 | DEFUN (bgp_redistribute_ipv6_rmap, | |
14088 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 14089 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 14090 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14091 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14092 | "Route map reference\n" |
14093 | "Pointer to route-map entries\n") | |
14094 | { | |
14095 | int type; | |
7c8ff89e | 14096 | struct bgp_redist *red; |
718e3744 | 14097 | |
e0ca5fde DL |
14098 | type = proto_redistnum (AFI_IP6, argv[0]); |
14099 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14100 | { |
14101 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14102 | return CMD_WARNING; | |
14103 | } | |
14104 | ||
7c8ff89e DS |
14105 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
14106 | bgp_redistribute_rmap_set (red, argv[1]); | |
6aeb9e78 | 14107 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14108 | } |
14109 | ||
14110 | DEFUN (bgp_redistribute_ipv6_metric, | |
14111 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 14112 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 14113 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14114 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14115 | "Metric for redistributed routes\n" |
14116 | "Default metric\n") | |
14117 | { | |
14118 | int type; | |
14119 | u_int32_t metric; | |
7c8ff89e | 14120 | struct bgp_redist *red; |
718e3744 | 14121 | |
e0ca5fde DL |
14122 | type = proto_redistnum (AFI_IP6, argv[0]); |
14123 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14124 | { |
14125 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14126 | return CMD_WARNING; | |
14127 | } | |
14128 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
14129 | ||
7c8ff89e | 14130 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 14131 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
6aeb9e78 | 14132 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14133 | } |
14134 | ||
14135 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
14136 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 14137 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 14138 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14139 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14140 | "Route map reference\n" |
14141 | "Pointer to route-map entries\n" | |
14142 | "Metric for redistributed routes\n" | |
14143 | "Default metric\n") | |
14144 | { | |
14145 | int type; | |
14146 | u_int32_t metric; | |
7c8ff89e | 14147 | struct bgp_redist *red; |
718e3744 | 14148 | |
e0ca5fde DL |
14149 | type = proto_redistnum (AFI_IP6, argv[0]); |
14150 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14151 | { |
14152 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14153 | return CMD_WARNING; | |
14154 | } | |
14155 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
14156 | ||
7c8ff89e DS |
14157 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
14158 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 14159 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
6aeb9e78 | 14160 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14161 | } |
14162 | ||
14163 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
14164 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 14165 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 14166 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14167 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14168 | "Metric for redistributed routes\n" |
14169 | "Default metric\n" | |
14170 | "Route map reference\n" | |
14171 | "Pointer to route-map entries\n") | |
14172 | { | |
14173 | int type; | |
14174 | u_int32_t metric; | |
7c8ff89e | 14175 | struct bgp_redist *red; |
718e3744 | 14176 | |
e0ca5fde DL |
14177 | type = proto_redistnum (AFI_IP6, argv[0]); |
14178 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14179 | { |
14180 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14181 | return CMD_WARNING; | |
14182 | } | |
14183 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
14184 | ||
7c8ff89e | 14185 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 14186 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric); |
7c8ff89e | 14187 | bgp_redistribute_rmap_set (red, argv[2]); |
6aeb9e78 | 14188 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14189 | } |
14190 | ||
14191 | DEFUN (no_bgp_redistribute_ipv6, | |
14192 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 14193 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 14194 | NO_STR |
14195 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14196 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 14197 | { |
14198 | int type; | |
14199 | ||
e0ca5fde DL |
14200 | type = proto_redistnum (AFI_IP6, argv[0]); |
14201 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14202 | { |
14203 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14204 | return CMD_WARNING; | |
14205 | } | |
14206 | ||
7c8ff89e | 14207 | return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0); |
718e3744 | 14208 | } |
14209 | ||
503006bc | 14210 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14211 | no_bgp_redistribute_ipv6_rmap_cmd, |
e0ca5fde | 14212 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 14213 | NO_STR |
14214 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14215 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14216 | "Route map reference\n" |
14217 | "Pointer to route-map entries\n") | |
718e3744 | 14218 | |
503006bc | 14219 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14220 | no_bgp_redistribute_ipv6_metric_cmd, |
e0ca5fde | 14221 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 14222 | NO_STR |
14223 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14224 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14225 | "Metric for redistributed routes\n" |
14226 | "Default metric\n") | |
718e3744 | 14227 | |
503006bc | 14228 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14229 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
e0ca5fde | 14230 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 14231 | NO_STR |
14232 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14233 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14234 | "Route map reference\n" |
14235 | "Pointer to route-map entries\n" | |
14236 | "Metric for redistributed routes\n" | |
14237 | "Default metric\n") | |
718e3744 | 14238 | |
503006bc | 14239 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14240 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
e0ca5fde | 14241 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 14242 | NO_STR |
14243 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14244 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14245 | "Metric for redistributed routes\n" |
14246 | "Default metric\n" | |
14247 | "Route map reference\n" | |
14248 | "Pointer to route-map entries\n") | |
14249 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 14250 | |
718e3744 | 14251 | int |
14252 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
14253 | safi_t safi, int *write) | |
14254 | { | |
14255 | int i; | |
718e3744 | 14256 | |
14257 | /* Unicast redistribution only. */ | |
14258 | if (safi != SAFI_UNICAST) | |
14259 | return 0; | |
14260 | ||
14261 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
14262 | { | |
14263 | /* Redistribute BGP does not make sense. */ | |
7c8ff89e | 14264 | if (i != ZEBRA_ROUTE_BGP) |
718e3744 | 14265 | { |
7c8ff89e DS |
14266 | struct list *red_list; |
14267 | struct listnode *node; | |
14268 | struct bgp_redist *red; | |
718e3744 | 14269 | |
7c8ff89e DS |
14270 | red_list = bgp->redist[afi][i]; |
14271 | if (!red_list) | |
14272 | continue; | |
718e3744 | 14273 | |
7c8ff89e DS |
14274 | for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) |
14275 | { | |
14276 | /* Display "address-family" when it is not yet diplayed. */ | |
14277 | bgp_config_write_family_header (vty, afi, safi, write); | |
14278 | ||
14279 | /* "redistribute" configuration. */ | |
0b960b4d | 14280 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
7c8ff89e DS |
14281 | if (red->instance) |
14282 | vty_out (vty, " %d", red->instance); | |
14283 | if (red->redist_metric_flag) | |
14284 | vty_out (vty, " metric %u", red->redist_metric); | |
14285 | if (red->rmap.name) | |
14286 | vty_out (vty, " route-map %s", red->rmap.name); | |
14287 | vty_out (vty, "%s", VTY_NEWLINE); | |
14288 | } | |
718e3744 | 14289 | } |
14290 | } | |
14291 | return *write; | |
14292 | } | |
6b0655a2 | 14293 | |
718e3744 | 14294 | /* BGP node structure. */ |
7fc626de | 14295 | static struct cmd_node bgp_node = |
718e3744 | 14296 | { |
14297 | BGP_NODE, | |
14298 | "%s(config-router)# ", | |
14299 | 1, | |
14300 | }; | |
14301 | ||
7fc626de | 14302 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 14303 | { |
14304 | BGP_IPV4_NODE, | |
14305 | "%s(config-router-af)# ", | |
14306 | 1, | |
14307 | }; | |
14308 | ||
7fc626de | 14309 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 14310 | { |
14311 | BGP_IPV4M_NODE, | |
14312 | "%s(config-router-af)# ", | |
14313 | 1, | |
14314 | }; | |
14315 | ||
7fc626de | 14316 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 14317 | { |
14318 | BGP_IPV6_NODE, | |
14319 | "%s(config-router-af)# ", | |
14320 | 1, | |
14321 | }; | |
14322 | ||
7fc626de | 14323 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 14324 | { |
14325 | BGP_IPV6M_NODE, | |
14326 | "%s(config-router-af)# ", | |
14327 | 1, | |
14328 | }; | |
14329 | ||
7fc626de | 14330 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 14331 | { |
14332 | BGP_VPNV4_NODE, | |
14333 | "%s(config-router-af)# ", | |
14334 | 1 | |
14335 | }; | |
6b0655a2 | 14336 | |
8ecd3266 | 14337 | static struct cmd_node bgp_vpnv6_node = |
14338 | { | |
14339 | BGP_VPNV6_NODE, | |
14340 | "%s(config-router-af-vpnv6)# ", | |
14341 | 1 | |
14342 | }; | |
14343 | ||
8b1fb8be LB |
14344 | static struct cmd_node bgp_encap_node = |
14345 | { | |
14346 | BGP_ENCAP_NODE, | |
14347 | "%s(config-router-af-encap)# ", | |
14348 | 1 | |
14349 | }; | |
14350 | ||
14351 | static struct cmd_node bgp_encapv6_node = | |
14352 | { | |
14353 | BGP_ENCAPV6_NODE, | |
14354 | "%s(config-router-af-encapv6)# ", | |
14355 | 1 | |
14356 | }; | |
14357 | ||
1f8ae70b | 14358 | static void community_list_vty (void); |
14359 | ||
718e3744 | 14360 | void |
94f2b392 | 14361 | bgp_vty_init (void) |
718e3744 | 14362 | { |
718e3744 | 14363 | /* Install bgp top node. */ |
14364 | install_node (&bgp_node, bgp_config_write); | |
14365 | install_node (&bgp_ipv4_unicast_node, NULL); | |
14366 | install_node (&bgp_ipv4_multicast_node, NULL); | |
14367 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 14368 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 14369 | install_node (&bgp_vpnv4_node, NULL); |
8ecd3266 | 14370 | install_node (&bgp_vpnv6_node, NULL); |
8b1fb8be LB |
14371 | install_node (&bgp_encap_node, NULL); |
14372 | install_node (&bgp_encapv6_node, NULL); | |
718e3744 | 14373 | |
14374 | /* Install default VTY commands to new nodes. */ | |
14375 | install_default (BGP_NODE); | |
14376 | install_default (BGP_IPV4_NODE); | |
14377 | install_default (BGP_IPV4M_NODE); | |
14378 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 14379 | install_default (BGP_IPV6M_NODE); |
718e3744 | 14380 | install_default (BGP_VPNV4_NODE); |
8ecd3266 | 14381 | install_default (BGP_VPNV6_NODE); |
8b1fb8be LB |
14382 | install_default (BGP_ENCAP_NODE); |
14383 | install_default (BGP_ENCAPV6_NODE); | |
718e3744 | 14384 | |
14385 | /* "bgp multiple-instance" commands. */ | |
14386 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
14387 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
14388 | ||
14389 | /* "bgp config-type" commands. */ | |
14390 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
813d4307 | 14391 | install_element (CONFIG_NODE, &no_bgp_config_type_val_cmd); |
718e3744 | 14392 | |
5fe9f963 | 14393 | /* bgp route-map delay-timer commands. */ |
14394 | install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd); | |
14395 | install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
14396 | install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); | |
14397 | ||
718e3744 | 14398 | /* Dummy commands (Currently not supported) */ |
14399 | install_element (BGP_NODE, &no_synchronization_cmd); | |
14400 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
14401 | ||
14402 | /* "router bgp" commands. */ | |
14403 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
6aeb9e78 | 14404 | install_element (CONFIG_NODE, &router_bgp_instance_cmd); |
2385a876 | 14405 | install_element (CONFIG_NODE, &router_bgp_noasn_cmd); |
718e3744 | 14406 | |
14407 | /* "no router bgp" commands. */ | |
14408 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
6aeb9e78 | 14409 | install_element (CONFIG_NODE, &no_router_bgp_instance_cmd); |
7fb21a9f | 14410 | install_element (CONFIG_NODE, &no_router_bgp_noasn_cmd); |
718e3744 | 14411 | |
14412 | /* "bgp router-id" commands. */ | |
14413 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
14414 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
14415 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
14416 | ||
14417 | /* "bgp cluster-id" commands. */ | |
14418 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
14419 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
14420 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
813d4307 DW |
14421 | install_element (BGP_NODE, &no_bgp_cluster_id_ip_cmd); |
14422 | install_element (BGP_NODE, &no_bgp_cluster_id_decimal_cmd); | |
718e3744 | 14423 | |
14424 | /* "bgp confederation" commands. */ | |
14425 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
14426 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
14427 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
14428 | ||
14429 | /* "bgp confederation peers" commands. */ | |
14430 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
14431 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
14432 | ||
abc920f8 DS |
14433 | /* bgp max-med command */ |
14434 | install_element (BGP_NODE, &bgp_maxmed_admin_cmd); | |
14435 | install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd); | |
14436 | install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); | |
14437 | install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd); | |
14438 | install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); | |
14439 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); | |
14440 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd); | |
14441 | install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); | |
14442 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd); | |
14443 | ||
907f92c8 DS |
14444 | /* bgp disable-ebgp-connected-nh-check */ |
14445 | install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd); | |
14446 | install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd); | |
14447 | ||
f188f2c4 DS |
14448 | /* bgp update-delay command */ |
14449 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
14450 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
14451 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
14452 | install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); | |
14453 | ||
cb1faec9 DS |
14454 | install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); |
14455 | install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); | |
14456 | ||
3f9c7369 DS |
14457 | install_element (BGP_NODE, &bgp_coalesce_time_cmd); |
14458 | install_element (BGP_NODE, &no_bgp_coalesce_time_cmd); | |
14459 | ||
165b5fff JB |
14460 | /* "maximum-paths" commands. */ |
14461 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
14462 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
14463 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); | |
14464 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); | |
14465 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
14466 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); | |
431aa9f9 DS |
14467 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
14468 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
14469 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); | |
165b5fff | 14470 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14471 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff JB |
14472 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
14473 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 14474 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14475 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14476 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14477 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14478 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14479 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
431aa9f9 | 14480 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14481 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 DS |
14482 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
14483 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 14484 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14485 | |
718e3744 | 14486 | /* "timers bgp" commands. */ |
14487 | install_element (BGP_NODE, &bgp_timers_cmd); | |
14488 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
14489 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
14490 | ||
5fe9f963 | 14491 | /* route-map delay-timer commands - per instance for backwards compat. */ |
518f0eb1 DS |
14492 | install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd); |
14493 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
f414725f | 14494 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); |
518f0eb1 | 14495 | |
718e3744 | 14496 | /* "bgp client-to-client reflection" commands */ |
14497 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
14498 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
14499 | ||
14500 | /* "bgp always-compare-med" commands */ | |
14501 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
14502 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
14503 | ||
14504 | /* "bgp deterministic-med" commands */ | |
14505 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
14506 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 14507 | |
538621f2 | 14508 | /* "bgp graceful-restart" commands */ |
14509 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
14510 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 14511 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
14512 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
14513 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 14514 | |
14515 | /* "bgp fast-external-failover" commands */ | |
14516 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
14517 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
14518 | ||
14519 | /* "bgp enforce-first-as" commands */ | |
14520 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
14521 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
14522 | ||
14523 | /* "bgp bestpath compare-routerid" commands */ | |
14524 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
14525 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
14526 | ||
14527 | /* "bgp bestpath as-path ignore" commands */ | |
14528 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
14529 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
14530 | ||
6811845b | 14531 | /* "bgp bestpath as-path confed" commands */ |
14532 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
14533 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
14534 | ||
2fdd455c PM |
14535 | /* "bgp bestpath as-path multipath-relax" commands */ |
14536 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
14537 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
14538 | ||
848973c7 | 14539 | /* "bgp log-neighbor-changes" commands */ |
14540 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
14541 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
14542 | ||
718e3744 | 14543 | /* "bgp bestpath med" commands */ |
14544 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
14545 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
14546 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
14547 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
14548 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
14549 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
14550 | ||
14551 | /* "no bgp default ipv4-unicast" commands. */ | |
14552 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
14553 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
14554 | ||
14555 | /* "bgp network import-check" commands. */ | |
14556 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
8233ef81 | 14557 | install_element (BGP_NODE, &bgp_network_import_check_exact_cmd); |
718e3744 | 14558 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
14559 | ||
14560 | /* "bgp default local-preference" commands. */ | |
14561 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
14562 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
14563 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
14564 | ||
04b6bdc0 DW |
14565 | /* bgp default show-hostname */ |
14566 | install_element (BGP_NODE, &bgp_default_show_hostname_cmd); | |
14567 | install_element (BGP_NODE, &no_bgp_default_show_hostname_cmd); | |
14568 | ||
3f9c7369 DS |
14569 | /* "bgp default subgroup-pkt-queue-max" commands. */ |
14570 | install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd); | |
14571 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd); | |
813d4307 | 14572 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_val_cmd); |
3f9c7369 | 14573 | |
8bd9d948 DS |
14574 | /* bgp ibgp-allow-policy-mods command */ |
14575 | install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd); | |
14576 | install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd); | |
14577 | ||
f14e6fdb DS |
14578 | /* "bgp listen limit" commands. */ |
14579 | install_element (BGP_NODE, &bgp_listen_limit_cmd); | |
14580 | install_element (BGP_NODE, &no_bgp_listen_limit_cmd); | |
813d4307 | 14581 | install_element (BGP_NODE, &no_bgp_listen_limit_val_cmd); |
f14e6fdb DS |
14582 | |
14583 | /* "bgp listen range" commands. */ | |
14584 | install_element (BGP_NODE, &bgp_listen_range_cmd); | |
14585 | install_element (BGP_NODE, &no_bgp_listen_range_cmd); | |
14586 | ||
718e3744 | 14587 | /* "neighbor remote-as" commands. */ |
14588 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
a80beece | 14589 | install_element (BGP_NODE, &neighbor_interface_config_cmd); |
4c48cf63 DW |
14590 | install_element (BGP_NODE, &neighbor_interface_config_v6only_cmd); |
14591 | install_element (BGP_NODE, &neighbor_interface_config_peergroup_cmd); | |
14592 | install_element (BGP_NODE, &neighbor_interface_config_v6only_peergroup_cmd); | |
b3a39dc5 DD |
14593 | install_element (BGP_NODE, &neighbor_interface_config_remote_as_cmd); |
14594 | install_element (BGP_NODE, &neighbor_interface_v6only_config_remote_as_cmd); | |
718e3744 | 14595 | install_element (BGP_NODE, &no_neighbor_cmd); |
14596 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
a80beece | 14597 | install_element (BGP_NODE, &no_neighbor_interface_config_cmd); |
4c48cf63 DW |
14598 | install_element (BGP_NODE, &no_neighbor_interface_config_v6only_cmd); |
14599 | install_element (BGP_NODE, &no_neighbor_interface_config_peergroup_cmd); | |
14600 | install_element (BGP_NODE, &no_neighbor_interface_config_v6only_peergroup_cmd); | |
b3a39dc5 DD |
14601 | install_element (BGP_NODE, &no_neighbor_interface_config_remote_as_cmd); |
14602 | install_element (BGP_NODE, &no_neighbor_interface_config_v6only_remote_as_cmd); | |
718e3744 | 14603 | |
14604 | /* "neighbor peer-group" commands. */ | |
14605 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
14606 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
a80beece | 14607 | install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd); |
718e3744 | 14608 | |
14609 | /* "neighbor local-as" commands. */ | |
14610 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
14611 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 14612 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 14613 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
14614 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
14615 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
9d3f9705 | 14616 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
718e3744 | 14617 | |
3f9c7369 DS |
14618 | /* "neighbor solo" commands. */ |
14619 | install_element (BGP_NODE, &neighbor_solo_cmd); | |
14620 | install_element (BGP_NODE, &no_neighbor_solo_cmd); | |
14621 | ||
0df7c91f PJ |
14622 | /* "neighbor password" commands. */ |
14623 | install_element (BGP_NODE, &neighbor_password_cmd); | |
14624 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
813d4307 | 14625 | install_element (BGP_NODE, &no_neighbor_password_val_cmd); |
0df7c91f | 14626 | |
718e3744 | 14627 | /* "neighbor activate" commands. */ |
14628 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
14629 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
14630 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
14631 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 14632 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 14633 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
8ecd3266 | 14634 | install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd); |
8b1fb8be LB |
14635 | install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd); |
14636 | install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd); | |
718e3744 | 14637 | |
14638 | /* "no neighbor activate" commands. */ | |
14639 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
14640 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
14641 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
14642 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 14643 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 14644 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
8ecd3266 | 14645 | install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd); |
8b1fb8be LB |
14646 | install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd); |
14647 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd); | |
718e3744 | 14648 | |
c8560b44 DW |
14649 | /* "neighbor peer-group" set commands. |
14650 | * Long term we should only accept this command under BGP_NODE and not all of | |
14651 | * the afi/safi sub-contexts. For now though we need to accept it for backwards | |
14652 | * compatibility. This changed when we stopped requiring that peers be assigned | |
14653 | * to their peer-group under each address-family sub-context. | |
14654 | */ | |
718e3744 | 14655 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
14656 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
14657 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
14658 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 14659 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 14660 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
8ecd3266 | 14661 | install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd); |
8b1fb8be LB |
14662 | install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd); |
14663 | install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd); | |
c8560b44 | 14664 | |
718e3744 | 14665 | /* "no neighbor peer-group unset" commands. */ |
14666 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
14667 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
14668 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
14669 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 14670 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 14671 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
8ecd3266 | 14672 | install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd); |
8b1fb8be LB |
14673 | install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd); |
14674 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
a58545bb | 14675 | |
718e3744 | 14676 | /* "neighbor softreconfiguration inbound" commands.*/ |
14677 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
14678 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14679 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
14680 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14681 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
14682 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14683 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
14684 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 14685 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
14686 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 14687 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
14688 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8ecd3266 | 14689 | install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd); |
14690 | install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8b1fb8be LB |
14691 | install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd); |
14692 | install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14693 | install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
14694 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 14695 | |
14696 | /* "neighbor attribute-unchanged" commands. */ | |
14697 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
14698 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
14699 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
14700 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
14701 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
14702 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
14703 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
14704 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
14705 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
14706 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
14707 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
14708 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
14709 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14710 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14711 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14712 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14713 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14714 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14715 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14716 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14717 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14718 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14719 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
14720 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
14721 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
14722 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
14723 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
14724 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
14725 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
14726 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
14727 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
14728 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
14729 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
14730 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
14731 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14732 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14733 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14734 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14735 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14736 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14737 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14738 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14739 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14740 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14741 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
14742 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
14743 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
14744 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
14745 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
14746 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
14747 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
14748 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
14749 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
14750 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
14751 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
14752 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
14753 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14754 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14755 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14756 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14757 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14758 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14759 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14760 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14761 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14762 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14763 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
14764 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14765 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14766 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14767 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
14768 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
14769 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
14770 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
14771 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
14772 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
14773 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
14774 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
14775 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14776 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14777 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14778 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14779 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14780 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14781 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14782 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14783 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14784 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 14785 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
14786 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
14787 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
14788 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
14789 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
14790 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
14791 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
14792 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
14793 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
14794 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
14795 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
14796 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
14797 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14798 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14799 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14800 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14801 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14802 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14803 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14804 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14805 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14806 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 14807 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
14808 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
14809 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
14810 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
14811 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
14812 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
14813 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
14814 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
14815 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
14816 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
14817 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
14818 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
14819 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14820 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14821 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14822 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14823 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14824 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14825 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14826 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14827 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14828 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
8ecd3266 | 14829 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd); |
14830 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14831 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14832 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14833 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd); | |
14834 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd); | |
14835 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd); | |
14836 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd); | |
14837 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd); | |
14838 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd); | |
14839 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd); | |
14840 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
14841 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14842 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14843 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14844 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14845 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14846 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14847 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14848 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14849 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14850 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14851 | ||
8b1fb8be LB |
14852 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd); |
14853 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd); | |
14854 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd); | |
14855 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd); | |
14856 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd); | |
14857 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd); | |
14858 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd); | |
14859 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd); | |
14860 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd); | |
14861 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd); | |
14862 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd); | |
14863 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd); | |
14864 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14865 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14866 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14867 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14868 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14869 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14870 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14871 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14872 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14873 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14874 | ||
14875 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd); | |
14876 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14877 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14878 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14879 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
14880 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
14881 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
14882 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
14883 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
14884 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
14885 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
14886 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
14887 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14888 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14889 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14890 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14891 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14892 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14893 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14894 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14895 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14896 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 14897 | |
fee0f4c6 | 14898 | /* "nexthop-local unchanged" commands */ |
14899 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
14900 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
14901 | ||
718e3744 | 14902 | /* "neighbor next-hop-self" commands. */ |
14903 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
14904 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
14905 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
14906 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
14907 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
14908 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
14909 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
14910 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 14911 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
14912 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 14913 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
14914 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
8ecd3266 | 14915 | install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd); |
14916 | install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd); | |
8b1fb8be LB |
14917 | install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd); |
14918 | install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd); | |
14919 | install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd); | |
14920 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 14921 | |
a538debe DS |
14922 | /* "neighbor next-hop-self force" commands. */ |
14923 | install_element (BGP_NODE, &neighbor_nexthop_self_force_cmd); | |
14924 | install_element (BGP_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14925 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd); | |
14926 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14927 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd); | |
14928 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14929 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd); | |
14930 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14931 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd); | |
14932 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14933 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd); | |
14934 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
8ecd3266 | 14935 | install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_force_cmd); |
14936 | install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
a538debe | 14937 | |
c7122e14 DS |
14938 | /* "neighbor as-override" commands. */ |
14939 | install_element (BGP_NODE, &neighbor_as_override_cmd); | |
14940 | install_element (BGP_NODE, &no_neighbor_as_override_cmd); | |
14941 | install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd); | |
14942 | install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd); | |
14943 | install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd); | |
14944 | install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd); | |
14945 | install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd); | |
14946 | install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd); | |
14947 | install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd); | |
14948 | install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd); | |
14949 | install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd); | |
14950 | install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd); | |
8ecd3266 | 14951 | install_element (BGP_VPNV6_NODE, &neighbor_as_override_cmd); |
14952 | install_element (BGP_VPNV6_NODE, &no_neighbor_as_override_cmd); | |
c7122e14 | 14953 | |
718e3744 | 14954 | /* "neighbor remove-private-AS" commands. */ |
14955 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
14956 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14957 | install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd); |
14958 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14959 | install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14960 | install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14961 | install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14962 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14963 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
14964 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14965 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd); |
14966 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14967 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14968 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14969 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14970 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14971 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
14972 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14973 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd); |
14974 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14975 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14976 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14977 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14978 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14979 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
14980 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14981 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd); |
14982 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14983 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14984 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14985 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14986 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
25ffbdc1 | 14987 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
14988 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14989 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd); |
14990 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14991 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14992 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14993 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14994 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14995 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
14996 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14997 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd); |
14998 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14999 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
15000 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
15001 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
15002 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
8ecd3266 | 15003 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd); |
15004 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd); | |
15005 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_cmd); | |
15006 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
15007 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
15008 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
15009 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
15010 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
8b1fb8be LB |
15011 | install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd); |
15012 | install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd); | |
15013 | install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd); | |
15014 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
718e3744 | 15015 | |
15016 | /* "neighbor send-community" commands.*/ | |
15017 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
15018 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
15019 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
15020 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
15021 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
15022 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
15023 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
15024 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
15025 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
15026 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
15027 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
15028 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
15029 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
15030 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
15031 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
15032 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 15033 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
15034 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
15035 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
15036 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 15037 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
15038 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
15039 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
15040 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
8ecd3266 | 15041 | install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd); |
15042 | install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd); | |
15043 | install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd); | |
15044 | install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd); | |
8b1fb8be LB |
15045 | install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd); |
15046 | install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd); | |
15047 | install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd); | |
15048 | install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd); | |
15049 | install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd); | |
15050 | install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd); | |
15051 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd); | |
15052 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 15053 | |
15054 | /* "neighbor route-reflector" commands.*/ | |
15055 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
15056 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
15057 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
15058 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
15059 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
15060 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
15061 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
15062 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 15063 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
15064 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 15065 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
15066 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
8ecd3266 | 15067 | install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd); |
15068 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
8b1fb8be LB |
15069 | install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd); |
15070 | install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd); | |
15071 | install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd); | |
15072 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 15073 | |
15074 | /* "neighbor route-server" commands.*/ | |
15075 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
15076 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
15077 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
15078 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
15079 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
15080 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
15081 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
15082 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 15083 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
15084 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 15085 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
15086 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
8ecd3266 | 15087 | install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd); |
15088 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd); | |
8b1fb8be LB |
15089 | install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd); |
15090 | install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd); | |
15091 | install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd); | |
15092 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 15093 | |
adbac85e DW |
15094 | /* "neighbor addpath-tx-all-paths" commands.*/ |
15095 | install_element (BGP_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15096 | install_element (BGP_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15097 | install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15098 | install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15099 | install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15100 | install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15101 | install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15102 | install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15103 | install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15104 | install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15105 | install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15106 | install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
8ecd3266 | 15107 | install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_all_paths_cmd); |
15108 | install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
adbac85e | 15109 | |
06370dac DW |
15110 | /* "neighbor addpath-tx-bestpath-per-AS" commands.*/ |
15111 | install_element (BGP_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15112 | install_element (BGP_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15113 | install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15114 | install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15115 | install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15116 | install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15117 | install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15118 | install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15119 | install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15120 | install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15121 | install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15122 | install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
8ecd3266 | 15123 | install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); |
15124 | install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
06370dac | 15125 | |
718e3744 | 15126 | /* "neighbor passive" commands. */ |
15127 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
15128 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
15129 | ||
d5a5c8f0 | 15130 | |
718e3744 | 15131 | /* "neighbor shutdown" commands. */ |
15132 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
15133 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
15134 | ||
8a92a8a0 DS |
15135 | /* "neighbor capability extended-nexthop" commands.*/ |
15136 | install_element (BGP_NODE, &neighbor_capability_enhe_cmd); | |
15137 | install_element (BGP_NODE, &no_neighbor_capability_enhe_cmd); | |
15138 | ||
718e3744 | 15139 | /* "neighbor capability orf prefix-list" commands.*/ |
15140 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
15141 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
15142 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
15143 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
15144 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
15145 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
15146 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
15147 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 15148 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
15149 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 15150 | |
15151 | /* "neighbor capability dynamic" commands.*/ | |
15152 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
15153 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
15154 | ||
15155 | /* "neighbor dont-capability-negotiate" commands. */ | |
15156 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
15157 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
15158 | ||
15159 | /* "neighbor ebgp-multihop" commands. */ | |
15160 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
15161 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
15162 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
15163 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
15164 | ||
6ffd2079 | 15165 | /* "neighbor disable-connected-check" commands. */ |
15166 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
15167 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 15168 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
15169 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
15170 | ||
15171 | /* "neighbor description" commands. */ | |
15172 | install_element (BGP_NODE, &neighbor_description_cmd); | |
15173 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
15174 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
15175 | ||
15176 | /* "neighbor update-source" commands. "*/ | |
15177 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
15178 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
15179 | ||
15180 | /* "neighbor default-originate" commands. */ | |
15181 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
15182 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
15183 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
15184 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
15185 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
15186 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
15187 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
15188 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
15189 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
15190 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
15191 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
15192 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
15193 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
15194 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
15195 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
15196 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 15197 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
15198 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
15199 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
15200 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 15201 | |
15202 | /* "neighbor port" commands. */ | |
15203 | install_element (BGP_NODE, &neighbor_port_cmd); | |
15204 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
15205 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
15206 | ||
15207 | /* "neighbor weight" commands. */ | |
15208 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
15209 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
15210 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
15211 | ||
15212 | /* "neighbor override-capability" commands. */ | |
15213 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
15214 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
15215 | ||
15216 | /* "neighbor strict-capability-match" commands. */ | |
15217 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
15218 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
15219 | ||
15220 | /* "neighbor timers" commands. */ | |
15221 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
15222 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
813d4307 | 15223 | install_element (BGP_NODE, &no_neighbor_timers_val_cmd); |
718e3744 | 15224 | |
15225 | /* "neighbor timers connect" commands. */ | |
15226 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
15227 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
15228 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
15229 | ||
15230 | /* "neighbor advertisement-interval" commands. */ | |
15231 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
15232 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
15233 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
15234 | ||
718e3744 | 15235 | /* "neighbor interface" commands. */ |
15236 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
15237 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
15238 | ||
15239 | /* "neighbor distribute" commands. */ | |
15240 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
15241 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
15242 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
15243 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
15244 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
15245 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
15246 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
15247 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 15248 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
15249 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 15250 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
15251 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
8ecd3266 | 15252 | install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd); |
15253 | install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd); | |
8b1fb8be LB |
15254 | install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd); |
15255 | install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd); | |
15256 | install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd); | |
15257 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 15258 | |
15259 | /* "neighbor prefix-list" commands. */ | |
15260 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
15261 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
15262 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
15263 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
15264 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
15265 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
15266 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
15267 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 15268 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
15269 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 15270 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
15271 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
8ecd3266 | 15272 | install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd); |
15273 | install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd); | |
8b1fb8be LB |
15274 | install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd); |
15275 | install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd); | |
15276 | install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd); | |
15277 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 15278 | |
15279 | /* "neighbor filter-list" commands. */ | |
15280 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
15281 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
15282 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
15283 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
15284 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
15285 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
15286 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
15287 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 15288 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
15289 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 15290 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
15291 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
8ecd3266 | 15292 | install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd); |
15293 | install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd); | |
8b1fb8be LB |
15294 | install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd); |
15295 | install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd); | |
15296 | install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd); | |
15297 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 15298 | |
15299 | /* "neighbor route-map" commands. */ | |
15300 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
15301 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
15302 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
15303 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
15304 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
15305 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
15306 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
15307 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 15308 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
15309 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 15310 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
15311 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
8ecd3266 | 15312 | install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd); |
15313 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd); | |
8b1fb8be LB |
15314 | install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd); |
15315 | install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd); | |
15316 | install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd); | |
15317 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 15318 | |
15319 | /* "neighbor unsuppress-map" commands. */ | |
15320 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
15321 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
15322 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
15323 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
15324 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
15325 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
15326 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
15327 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 15328 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
15329 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 15330 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
bb86c601 | 15331 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
8ecd3266 | 15332 | install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd); |
bb86c601 | 15333 | install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd); |
8b1fb8be LB |
15334 | install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd); |
15335 | install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd); | |
15336 | install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd); | |
15337 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 15338 | |
15339 | /* "neighbor maximum-prefix" commands. */ | |
15340 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 15341 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15342 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15343 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15344 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
15345 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15346 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
15347 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15348 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15349 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15350 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15351 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15352 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15353 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15354 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15355 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15356 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15357 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
15358 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15359 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
15360 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15361 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15362 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15363 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15364 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15365 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15366 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15367 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15368 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15369 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15370 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
15371 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15372 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
15373 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15374 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15375 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15376 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15377 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15378 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15379 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15380 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15381 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15382 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15383 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
15384 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15385 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
15386 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15387 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15388 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15389 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15390 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15391 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 15392 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
15393 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15394 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15395 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15396 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15397 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15398 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
15399 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15400 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15401 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15402 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15403 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15404 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15405 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15406 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15407 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15408 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15409 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
15410 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15411 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
15412 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15413 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15414 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15415 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15416 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15417 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
8ecd3266 | 15418 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd); |
15419 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15420 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15421 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15422 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15423 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15424 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd); | |
15425 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15426 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15427 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15428 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15429 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15430 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15431 | |
8b1fb8be LB |
15432 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd); |
15433 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15434 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15435 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15436 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15437 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15438 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd); | |
15439 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15440 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15441 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15442 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15443 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15444 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
15445 | ||
15446 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd); | |
15447 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15448 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15449 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15450 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15451 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15452 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd); | |
15453 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15454 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15455 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15456 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15457 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15458 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
15459 | ||
718e3744 | 15460 | /* "neighbor allowas-in" */ |
15461 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
15462 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
15463 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15464 | install_element (BGP_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15465 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
15466 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
15467 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15468 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15469 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
15470 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
15471 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15472 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15473 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
15474 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
15475 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15476 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_val_cmd); |
25ffbdc1 | 15477 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
15478 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
15479 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15480 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15481 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
15482 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
15483 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15484 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_val_cmd); |
8ecd3266 | 15485 | install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd); |
15486 | install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd); | |
15487 | install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd); | |
15488 | install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_val_cmd); | |
8b1fb8be LB |
15489 | install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd); |
15490 | install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd); | |
15491 | install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd); | |
15492 | install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd); | |
15493 | install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
15494 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd); | |
718e3744 | 15495 | |
15496 | /* address-family commands. */ | |
15497 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
15498 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
15499 | #ifdef HAVE_IPV6 | |
15500 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 15501 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 15502 | #endif /* HAVE_IPV6 */ |
15503 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
15504 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
15505 | ||
8b1fb8be LB |
15506 | install_element (BGP_NODE, &address_family_vpnv6_cmd); |
15507 | install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd); | |
15508 | ||
15509 | install_element (BGP_NODE, &address_family_encap_cmd); | |
15510 | install_element (BGP_NODE, &address_family_encapv4_cmd); | |
15511 | #ifdef HAVE_IPV6 | |
15512 | install_element (BGP_NODE, &address_family_encapv6_cmd); | |
15513 | #endif | |
15514 | ||
718e3744 | 15515 | /* "exit-address-family" command. */ |
15516 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
15517 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
15518 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 15519 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 15520 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
8ecd3266 | 15521 | install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); |
8b1fb8be LB |
15522 | install_element (BGP_ENCAP_NODE, &exit_address_family_cmd); |
15523 | install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd); | |
718e3744 | 15524 | |
15525 | /* "clear ip bgp commands" */ | |
15526 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
15527 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
15528 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
01080f7c | 15529 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_cmd); |
718e3744 | 15530 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
01080f7c | 15531 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_cmd); |
718e3744 | 15532 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
01080f7c | 15533 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_cmd); |
718e3744 | 15534 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
01080f7c | 15535 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_cmd); |
15536 | ||
718e3744 | 15537 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
15538 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
15539 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
01080f7c | 15540 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_cmd); |
718e3744 | 15541 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
01080f7c | 15542 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_cmd); |
718e3744 | 15543 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
01080f7c | 15544 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_cmd); |
718e3744 | 15545 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
01080f7c | 15546 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_cmd); |
718e3744 | 15547 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
01080f7c | 15548 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_cmd); |
718e3744 | 15549 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
01080f7c | 15550 | install_element (ENABLE_NODE, &clear_bgp_instance_external_cmd); |
718e3744 | 15551 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
01080f7c | 15552 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_cmd); |
718e3744 | 15553 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
01080f7c | 15554 | install_element (ENABLE_NODE, &clear_bgp_instance_as_cmd); |
718e3744 | 15555 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
01080f7c | 15556 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_cmd); |
718e3744 | 15557 | |
15558 | /* "clear ip bgp neighbor soft in" */ | |
15559 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
15560 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
15561 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
01080f7c | 15562 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_cmd); |
718e3744 | 15563 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
718e3744 | 15564 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
01080f7c | 15565 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_in_cmd); |
718e3744 | 15566 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
01080f7c | 15567 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_in_cmd); |
718e3744 | 15568 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
15569 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
01080f7c | 15570 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_in_cmd); |
718e3744 | 15571 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
01080f7c | 15572 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_in_cmd); |
718e3744 | 15573 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
15574 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
01080f7c | 15575 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_in_cmd); |
718e3744 | 15576 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
01080f7c | 15577 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_in_cmd); |
718e3744 | 15578 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
15579 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
01080f7c | 15580 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_in_cmd); |
718e3744 | 15581 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
01080f7c | 15582 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_in_cmd); |
718e3744 | 15583 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
15584 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
15585 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
15586 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
01080f7c | 15587 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_cmd); |
718e3744 | 15588 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
718e3744 | 15589 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
01080f7c | 15590 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_in_cmd); |
718e3744 | 15591 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
01080f7c | 15592 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_in_cmd); |
718e3744 | 15593 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
15594 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
01080f7c | 15595 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd); |
718e3744 | 15596 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
01080f7c | 15597 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_in_cmd); |
718e3744 | 15598 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
15599 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
01080f7c | 15600 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_in_cmd); |
718e3744 | 15601 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
01080f7c | 15602 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_in_cmd); |
718e3744 | 15603 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
15604 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
01080f7c | 15605 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_in_cmd); |
718e3744 | 15606 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
01080f7c | 15607 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_in_cmd); |
718e3744 | 15608 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
15609 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
15610 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
15611 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
15612 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
15613 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
15614 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
587ff0fd LB |
15615 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd); |
15616 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd); | |
15617 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd); | |
15618 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd); | |
15619 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd); | |
15620 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd); | |
718e3744 | 15621 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
15622 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
15623 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
01080f7c | 15624 | install_element (ENABLE_NODE, &clear_bgp_instance_all_in_cmd); |
718e3744 | 15625 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
15626 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
01080f7c | 15627 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_in_cmd); |
718e3744 | 15628 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
01080f7c | 15629 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_in_cmd); |
718e3744 | 15630 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
15631 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
01080f7c | 15632 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_in_cmd); |
718e3744 | 15633 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
01080f7c | 15634 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_in_cmd); |
718e3744 | 15635 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
15636 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
01080f7c | 15637 | install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_in_cmd); |
718e3744 | 15638 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
01080f7c | 15639 | install_element (ENABLE_NODE, &clear_bgp_instance_external_in_cmd); |
718e3744 | 15640 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
15641 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
01080f7c | 15642 | install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_in_cmd); |
718e3744 | 15643 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
01080f7c | 15644 | install_element (ENABLE_NODE, &clear_bgp_instance_as_in_cmd); |
718e3744 | 15645 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
15646 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
01080f7c | 15647 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_in_cmd); |
718e3744 | 15648 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
01080f7c | 15649 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_in_cmd); |
718e3744 | 15650 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
15651 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
01080f7c | 15652 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_in_cmd); |
718e3744 | 15653 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
01080f7c | 15654 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_in_cmd); |
718e3744 | 15655 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
15656 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
01080f7c | 15657 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_in_cmd); |
718e3744 | 15658 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
01080f7c | 15659 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_in_cmd); |
718e3744 | 15660 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
15661 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
01080f7c | 15662 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_in_cmd); |
718e3744 | 15663 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
01080f7c | 15664 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_in_cmd); |
718e3744 | 15665 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
15666 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
01080f7c | 15667 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_in_cmd); |
718e3744 | 15668 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
01080f7c | 15669 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_in_cmd); |
718e3744 | 15670 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
718e3744 | 15671 | |
8ad7271d DS |
15672 | /* clear ip bgp prefix */ |
15673 | install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); | |
01080f7c | 15674 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_prefix_cmd); |
8ad7271d | 15675 | install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); |
01080f7c | 15676 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_safi_prefix_cmd); |
8ad7271d | 15677 | |
718e3744 | 15678 | /* "clear ip bgp neighbor soft out" */ |
15679 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
15680 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
15681 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
01080f7c | 15682 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_out_cmd); |
718e3744 | 15683 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
01080f7c | 15684 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_out_cmd); |
718e3744 | 15685 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
01080f7c | 15686 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_out_cmd); |
718e3744 | 15687 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
01080f7c | 15688 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_out_cmd); |
718e3744 | 15689 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
01080f7c | 15690 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_out_cmd); |
718e3744 | 15691 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
01080f7c | 15692 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_out_cmd); |
718e3744 | 15693 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
01080f7c | 15694 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_out_cmd); |
718e3744 | 15695 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
01080f7c | 15696 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_out_cmd); |
718e3744 | 15697 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
01080f7c | 15698 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_out_cmd); |
718e3744 | 15699 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
15700 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
15701 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
01080f7c | 15702 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_out_cmd); |
718e3744 | 15703 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
01080f7c | 15704 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_out_cmd); |
718e3744 | 15705 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
01080f7c | 15706 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_out_cmd); |
718e3744 | 15707 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
01080f7c | 15708 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd); |
718e3744 | 15709 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
01080f7c | 15710 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_out_cmd); |
718e3744 | 15711 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
01080f7c | 15712 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_out_cmd); |
718e3744 | 15713 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
01080f7c | 15714 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_out_cmd); |
718e3744 | 15715 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
01080f7c | 15716 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_out_cmd); |
718e3744 | 15717 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
01080f7c | 15718 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_out_cmd); |
718e3744 | 15719 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
15720 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
15721 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
15722 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
15723 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
15724 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
587ff0fd LB |
15725 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd); |
15726 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd); | |
15727 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd); | |
15728 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd); | |
15729 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd); | |
15730 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd); | |
718e3744 | 15731 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
15732 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
15733 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
01080f7c | 15734 | install_element (ENABLE_NODE, &clear_bgp_instance_all_out_cmd); |
718e3744 | 15735 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
01080f7c | 15736 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_out_cmd); |
718e3744 | 15737 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
01080f7c | 15738 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_out_cmd); |
718e3744 | 15739 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
01080f7c | 15740 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_out_cmd); |
718e3744 | 15741 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
01080f7c | 15742 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_out_cmd); |
718e3744 | 15743 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
01080f7c | 15744 | install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_out_cmd); |
718e3744 | 15745 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
01080f7c | 15746 | install_element (ENABLE_NODE, &clear_bgp_instance_external_out_cmd); |
718e3744 | 15747 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
01080f7c | 15748 | install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_out_cmd); |
718e3744 | 15749 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
01080f7c | 15750 | install_element (ENABLE_NODE, &clear_bgp_instance_as_out_cmd); |
718e3744 | 15751 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
01080f7c | 15752 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_out_cmd); |
718e3744 | 15753 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
01080f7c | 15754 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_out_cmd); |
718e3744 | 15755 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
01080f7c | 15756 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_out_cmd); |
718e3744 | 15757 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
01080f7c | 15758 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_out_cmd); |
718e3744 | 15759 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
01080f7c | 15760 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_out_cmd); |
718e3744 | 15761 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
01080f7c | 15762 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_out_cmd); |
718e3744 | 15763 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
01080f7c | 15764 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_out_cmd); |
718e3744 | 15765 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
01080f7c | 15766 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_out_cmd); |
718e3744 | 15767 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
01080f7c | 15768 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_out_cmd); |
718e3744 | 15769 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
01080f7c | 15770 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_out_cmd); |
718e3744 | 15771 | |
15772 | /* "clear ip bgp neighbor soft" */ | |
15773 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
15774 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
15775 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
01080f7c | 15776 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_cmd); |
718e3744 | 15777 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
01080f7c | 15778 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_cmd); |
718e3744 | 15779 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
01080f7c | 15780 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_cmd); |
718e3744 | 15781 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
01080f7c | 15782 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_cmd); |
718e3744 | 15783 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
15784 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
15785 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
01080f7c | 15786 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_cmd); |
718e3744 | 15787 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
01080f7c | 15788 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_cmd); |
718e3744 | 15789 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
01080f7c | 15790 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_cmd); |
718e3744 | 15791 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
01080f7c | 15792 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_cmd); |
718e3744 | 15793 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
15794 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
15795 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
587ff0fd LB |
15796 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd); |
15797 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd); | |
15798 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd); | |
718e3744 | 15799 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
15800 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
15801 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
01080f7c | 15802 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_cmd); |
718e3744 | 15803 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
01080f7c | 15804 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_cmd); |
718e3744 | 15805 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
01080f7c | 15806 | install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_cmd); |
718e3744 | 15807 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
01080f7c | 15808 | install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_cmd); |
718e3744 | 15809 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
01080f7c | 15810 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_cmd); |
718e3744 | 15811 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
01080f7c | 15812 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_cmd); |
718e3744 | 15813 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
01080f7c | 15814 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_cmd); |
718e3744 | 15815 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
01080f7c | 15816 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_cmd); |
718e3744 | 15817 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
01080f7c | 15818 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_cmd); |
718e3744 | 15819 | |
15820 | /* "show ip bgp summary" commands. */ | |
15821 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15822 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15823 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15824 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15825 | install_element (VIEW_NODE, &show_bgp_updgrps_cmd); |
15826 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15827 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15828 | install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15829 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15830 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15831 | install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd); |
15832 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15833 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15834 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15835 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15836 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15837 | install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15838 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15839 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15840 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15841 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15842 | install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15843 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
718e3744 | 15844 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15845 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd); |
718e3744 | 15846 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
95cbbd2a | 15847 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 15848 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 15849 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 15850 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
15851 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15852 | #ifdef HAVE_IPV6 | |
15853 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
15854 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15855 | install_element (VIEW_NODE, &show_bgp_instance_all_summary_cmd); |
718e3744 | 15856 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
95cbbd2a | 15857 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 15858 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 15859 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
15860 | #endif /* HAVE_IPV6 */ |
15861 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15862 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15863 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15864 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15865 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd); |
15866 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15867 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15868 | install_element (RESTRICTED_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15869 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15870 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15871 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd); |
15872 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15873 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15874 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15875 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15876 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15877 | install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15878 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15879 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15880 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15881 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15882 | install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15883 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
62687ff1 | 15884 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15885 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd); |
62687ff1 | 15886 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); |
95cbbd2a | 15887 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
62687ff1 | 15888 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 15889 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
62687ff1 PJ |
15890 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
15891 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15892 | #ifdef HAVE_IPV6 | |
15893 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
15894 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15895 | install_element (RESTRICTED_NODE, &show_bgp_instance_all_summary_cmd); |
62687ff1 | 15896 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); |
95cbbd2a | 15897 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
62687ff1 | 15898 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 15899 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 15900 | #endif /* HAVE_IPV6 */ |
15901 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15902 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15903 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15904 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15905 | install_element (ENABLE_NODE, &show_bgp_updgrps_cmd); |
15906 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15907 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15908 | install_element (ENABLE_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15909 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15910 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15911 | install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd); |
15912 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15913 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15914 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15915 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15916 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15917 | install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15918 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15919 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15920 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15921 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15922 | install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15923 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
718e3744 | 15924 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15925 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_summary_cmd); |
718e3744 | 15926 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
95cbbd2a | 15927 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 15928 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 15929 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 15930 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
15931 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15932 | #ifdef HAVE_IPV6 | |
15933 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
15934 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15935 | install_element (ENABLE_NODE, &show_bgp_instance_all_summary_cmd); |
718e3744 | 15936 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
95cbbd2a | 15937 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 15938 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 15939 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 15940 | #endif /* HAVE_IPV6 */ |
15941 | ||
15942 | /* "show ip bgp neighbors" commands. */ | |
15943 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
15944 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
15945 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
15946 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
15947 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
15948 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
15949 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
15950 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
15951 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
f186de26 | 15952 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd); |
718e3744 | 15953 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
62687ff1 PJ |
15954 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
15955 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
15956 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
15957 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
15958 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 15959 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
15960 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
15961 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
15962 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
15963 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
15964 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
15965 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
15966 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
15967 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
f186de26 | 15968 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd); |
718e3744 | 15969 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
15970 | ||
15971 | #ifdef HAVE_IPV6 | |
15972 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
15973 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
15974 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
15975 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 15976 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
15977 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
15978 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
15979 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
15980 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
15981 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
15982 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
15983 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 15984 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
15985 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
15986 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
15987 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 15988 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
15989 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
15990 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
15991 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 15992 | |
15993 | /* Old commands. */ | |
15994 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
15995 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
15996 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
15997 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
15998 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 15999 | |
f14e6fdb DS |
16000 | /* "show ip bgp peer-group" commands. */ |
16001 | install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); | |
16002 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
16003 | install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd); | |
16004 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
16005 | install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd); | |
16006 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
16007 | install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd); | |
16008 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
16009 | ||
718e3744 | 16010 | /* "show ip bgp paths" commands. */ |
16011 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
16012 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
16013 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
16014 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
16015 | ||
16016 | /* "show ip bgp community" commands. */ | |
16017 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
16018 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
16019 | ||
16020 | /* "show ip bgp attribute-info" commands. */ | |
16021 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
16022 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
16023 | ||
16024 | /* "redistribute" commands. */ | |
16025 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
16026 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
16027 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
16028 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
16029 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
16030 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
16031 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
16032 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
16033 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
16034 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
7c8ff89e DS |
16035 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd); |
16036 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
16037 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
16038 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
16039 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
16040 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
16041 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
16042 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
16043 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
16044 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
919e0666 DW |
16045 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_cmd); |
16046 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_cmd); | |
16047 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
16048 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
16049 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
16050 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
16051 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
16052 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
16053 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
16054 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
16055 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_cmd); | |
16056 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
16057 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
16058 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
16059 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
16060 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
16061 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
16062 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
16063 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
16064 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
718e3744 | 16065 | #ifdef HAVE_IPV6 |
16066 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
16067 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
16068 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
16069 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
16070 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
16071 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
16072 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
16073 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
16074 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
16075 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
16076 | #endif /* HAVE_IPV6 */ | |
16077 | ||
fa411a21 NH |
16078 | /* ttl_security commands */ |
16079 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
16080 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
16081 | ||
4bf6a362 PJ |
16082 | /* "show bgp memory" commands. */ |
16083 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 16084 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
16085 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
16086 | ||
e0081f70 ML |
16087 | /* "show bgp views" commands. */ |
16088 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
16089 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
16090 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
16091 | ||
8386ac43 | 16092 | /* "show bgp vrfs" commands. */ |
16093 | install_element (VIEW_NODE, &show_bgp_vrfs_cmd); | |
16094 | install_element (RESTRICTED_NODE, &show_bgp_vrfs_cmd); | |
16095 | install_element (ENABLE_NODE, &show_bgp_vrfs_cmd); | |
16096 | ||
718e3744 | 16097 | /* Community-list. */ |
16098 | community_list_vty (); | |
16099 | } | |
6b0655a2 | 16100 | |
718e3744 | 16101 | #include "memory.h" |
16102 | #include "bgp_regex.h" | |
16103 | #include "bgp_clist.h" | |
16104 | #include "bgp_ecommunity.h" | |
16105 | ||
16106 | /* VTY functions. */ | |
16107 | ||
16108 | /* Direction value to string conversion. */ | |
94f2b392 | 16109 | static const char * |
718e3744 | 16110 | community_direct_str (int direct) |
16111 | { | |
16112 | switch (direct) | |
16113 | { | |
16114 | case COMMUNITY_DENY: | |
16115 | return "deny"; | |
718e3744 | 16116 | case COMMUNITY_PERMIT: |
16117 | return "permit"; | |
718e3744 | 16118 | default: |
16119 | return "unknown"; | |
718e3744 | 16120 | } |
16121 | } | |
16122 | ||
16123 | /* Display error string. */ | |
94f2b392 | 16124 | static void |
718e3744 | 16125 | community_list_perror (struct vty *vty, int ret) |
16126 | { | |
16127 | switch (ret) | |
16128 | { | |
16129 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 16130 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 16131 | break; |
16132 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
16133 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
16134 | break; | |
16135 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
16136 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
16137 | break; | |
16138 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
16139 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
16140 | break; | |
16141 | } | |
16142 | } | |
16143 | ||
16144 | /* VTY interface for community_set() function. */ | |
94f2b392 | 16145 | static int |
fd79ac91 | 16146 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
16147 | int style, int reject_all_digit_name) | |
718e3744 | 16148 | { |
16149 | int ret; | |
16150 | int direct; | |
16151 | char *str; | |
16152 | ||
16153 | /* Check the list type. */ | |
16154 | if (strncmp (argv[1], "p", 1) == 0) | |
16155 | direct = COMMUNITY_PERMIT; | |
16156 | else if (strncmp (argv[1], "d", 1) == 0) | |
16157 | direct = COMMUNITY_DENY; | |
16158 | else | |
16159 | { | |
16160 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16161 | VTY_NEWLINE); | |
16162 | return CMD_WARNING; | |
16163 | } | |
16164 | ||
16165 | /* All digit name check. */ | |
16166 | if (reject_all_digit_name && all_digit (argv[0])) | |
16167 | { | |
16168 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
16169 | return CMD_WARNING; | |
16170 | } | |
16171 | ||
16172 | /* Concat community string argument. */ | |
16173 | if (argc > 1) | |
16174 | str = argv_concat (argv, argc, 2); | |
16175 | else | |
16176 | str = NULL; | |
16177 | ||
16178 | /* When community_list_set() return nevetive value, it means | |
16179 | malformed community string. */ | |
16180 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
16181 | ||
16182 | /* Free temporary community list string allocated by | |
16183 | argv_concat(). */ | |
16184 | if (str) | |
16185 | XFREE (MTYPE_TMP, str); | |
16186 | ||
16187 | if (ret < 0) | |
16188 | { | |
16189 | /* Display error string. */ | |
16190 | community_list_perror (vty, ret); | |
16191 | return CMD_WARNING; | |
16192 | } | |
16193 | ||
16194 | return CMD_SUCCESS; | |
16195 | } | |
16196 | ||
718e3744 | 16197 | /* Communiyt-list entry delete. */ |
94f2b392 | 16198 | static int |
fee6e4e4 | 16199 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
813d4307 | 16200 | int style, int delete_all) |
718e3744 | 16201 | { |
16202 | int ret; | |
fee6e4e4 | 16203 | int direct = 0; |
16204 | char *str = NULL; | |
718e3744 | 16205 | |
fee6e4e4 | 16206 | if (argc > 1) |
718e3744 | 16207 | { |
fee6e4e4 | 16208 | /* Check the list direct. */ |
16209 | if (strncmp (argv[1], "p", 1) == 0) | |
16210 | direct = COMMUNITY_PERMIT; | |
16211 | else if (strncmp (argv[1], "d", 1) == 0) | |
16212 | direct = COMMUNITY_DENY; | |
16213 | else | |
16214 | { | |
16215 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16216 | VTY_NEWLINE); | |
16217 | return CMD_WARNING; | |
16218 | } | |
718e3744 | 16219 | |
fee6e4e4 | 16220 | /* Concat community string argument. */ |
16221 | str = argv_concat (argv, argc, 2); | |
16222 | } | |
718e3744 | 16223 | |
16224 | /* Unset community list. */ | |
813d4307 | 16225 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); |
718e3744 | 16226 | |
16227 | /* Free temporary community list string allocated by | |
16228 | argv_concat(). */ | |
fee6e4e4 | 16229 | if (str) |
16230 | XFREE (MTYPE_TMP, str); | |
718e3744 | 16231 | |
16232 | if (ret < 0) | |
16233 | { | |
16234 | community_list_perror (vty, ret); | |
16235 | return CMD_WARNING; | |
16236 | } | |
16237 | ||
16238 | return CMD_SUCCESS; | |
16239 | } | |
16240 | ||
16241 | /* "community-list" keyword help string. */ | |
16242 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
718e3744 | 16243 | |
718e3744 | 16244 | DEFUN (ip_community_list_standard, |
16245 | ip_community_list_standard_cmd, | |
16246 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
16247 | IP_STR | |
16248 | COMMUNITY_LIST_STR | |
16249 | "Community list number (standard)\n" | |
16250 | "Specify community to reject\n" | |
16251 | "Specify community to accept\n" | |
16252 | COMMUNITY_VAL_STR) | |
16253 | { | |
16254 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
16255 | } | |
16256 | ||
16257 | ALIAS (ip_community_list_standard, | |
16258 | ip_community_list_standard2_cmd, | |
16259 | "ip community-list <1-99> (deny|permit)", | |
16260 | IP_STR | |
16261 | COMMUNITY_LIST_STR | |
16262 | "Community list number (standard)\n" | |
16263 | "Specify community to reject\n" | |
16264 | "Specify community to accept\n") | |
16265 | ||
16266 | DEFUN (ip_community_list_expanded, | |
16267 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 16268 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 16269 | IP_STR |
16270 | COMMUNITY_LIST_STR | |
16271 | "Community list number (expanded)\n" | |
16272 | "Specify community to reject\n" | |
16273 | "Specify community to accept\n" | |
16274 | "An ordered list as a regular-expression\n") | |
16275 | { | |
16276 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
16277 | } | |
16278 | ||
16279 | DEFUN (ip_community_list_name_standard, | |
16280 | ip_community_list_name_standard_cmd, | |
16281 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
16282 | IP_STR | |
16283 | COMMUNITY_LIST_STR | |
16284 | "Add a standard community-list entry\n" | |
16285 | "Community list name\n" | |
16286 | "Specify community to reject\n" | |
16287 | "Specify community to accept\n" | |
16288 | COMMUNITY_VAL_STR) | |
16289 | { | |
16290 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
16291 | } | |
16292 | ||
16293 | ALIAS (ip_community_list_name_standard, | |
16294 | ip_community_list_name_standard2_cmd, | |
16295 | "ip community-list standard WORD (deny|permit)", | |
16296 | IP_STR | |
16297 | COMMUNITY_LIST_STR | |
16298 | "Add a standard community-list entry\n" | |
16299 | "Community list name\n" | |
16300 | "Specify community to reject\n" | |
16301 | "Specify community to accept\n") | |
16302 | ||
16303 | DEFUN (ip_community_list_name_expanded, | |
16304 | ip_community_list_name_expanded_cmd, | |
16305 | "ip community-list expanded WORD (deny|permit) .LINE", | |
16306 | IP_STR | |
16307 | COMMUNITY_LIST_STR | |
16308 | "Add an expanded community-list entry\n" | |
16309 | "Community list name\n" | |
16310 | "Specify community to reject\n" | |
16311 | "Specify community to accept\n" | |
16312 | "An ordered list as a regular-expression\n") | |
16313 | { | |
16314 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
16315 | } | |
16316 | ||
fee6e4e4 | 16317 | DEFUN (no_ip_community_list_standard_all, |
16318 | no_ip_community_list_standard_all_cmd, | |
16319 | "no ip community-list <1-99>", | |
16320 | NO_STR | |
16321 | IP_STR | |
16322 | COMMUNITY_LIST_STR | |
16323 | "Community list number (standard)\n") | |
16324 | { | |
813d4307 DW |
16325 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
16326 | } | |
16327 | ||
16328 | DEFUN (no_ip_community_list_standard_direction, | |
16329 | no_ip_community_list_standard_direction_cmd, | |
16330 | "no ip community-list <1-99> (deny|permit)", | |
16331 | NO_STR | |
16332 | IP_STR | |
16333 | COMMUNITY_LIST_STR | |
16334 | "Community list number (standard)\n" | |
16335 | "Specify community to reject\n" | |
16336 | "Specify community to accept\n") | |
16337 | { | |
16338 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
fee6e4e4 | 16339 | } |
16340 | ||
813d4307 | 16341 | |
fee6e4e4 | 16342 | DEFUN (no_ip_community_list_expanded_all, |
16343 | no_ip_community_list_expanded_all_cmd, | |
16344 | "no ip community-list <100-500>", | |
718e3744 | 16345 | NO_STR |
16346 | IP_STR | |
16347 | COMMUNITY_LIST_STR | |
718e3744 | 16348 | "Community list number (expanded)\n") |
16349 | { | |
813d4307 | 16350 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16351 | } |
16352 | ||
fee6e4e4 | 16353 | DEFUN (no_ip_community_list_name_standard_all, |
16354 | no_ip_community_list_name_standard_all_cmd, | |
16355 | "no ip community-list standard WORD", | |
718e3744 | 16356 | NO_STR |
16357 | IP_STR | |
16358 | COMMUNITY_LIST_STR | |
16359 | "Add a standard community-list entry\n" | |
718e3744 | 16360 | "Community list name\n") |
16361 | { | |
813d4307 | 16362 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
718e3744 | 16363 | } |
16364 | ||
fee6e4e4 | 16365 | DEFUN (no_ip_community_list_name_expanded_all, |
16366 | no_ip_community_list_name_expanded_all_cmd, | |
16367 | "no ip community-list expanded WORD", | |
718e3744 | 16368 | NO_STR |
16369 | IP_STR | |
16370 | COMMUNITY_LIST_STR | |
fee6e4e4 | 16371 | "Add an expanded community-list entry\n" |
16372 | "Community list name\n") | |
718e3744 | 16373 | { |
813d4307 | 16374 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16375 | } |
16376 | ||
16377 | DEFUN (no_ip_community_list_standard, | |
16378 | no_ip_community_list_standard_cmd, | |
16379 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
16380 | NO_STR | |
16381 | IP_STR | |
16382 | COMMUNITY_LIST_STR | |
16383 | "Community list number (standard)\n" | |
16384 | "Specify community to reject\n" | |
16385 | "Specify community to accept\n" | |
16386 | COMMUNITY_VAL_STR) | |
16387 | { | |
813d4307 | 16388 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
718e3744 | 16389 | } |
16390 | ||
16391 | DEFUN (no_ip_community_list_expanded, | |
16392 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 16393 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 16394 | NO_STR |
16395 | IP_STR | |
16396 | COMMUNITY_LIST_STR | |
16397 | "Community list number (expanded)\n" | |
16398 | "Specify community to reject\n" | |
16399 | "Specify community to accept\n" | |
16400 | "An ordered list as a regular-expression\n") | |
16401 | { | |
813d4307 | 16402 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16403 | } |
16404 | ||
16405 | DEFUN (no_ip_community_list_name_standard, | |
16406 | no_ip_community_list_name_standard_cmd, | |
16407 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
16408 | NO_STR | |
16409 | IP_STR | |
16410 | COMMUNITY_LIST_STR | |
16411 | "Specify a standard community-list\n" | |
16412 | "Community list name\n" | |
16413 | "Specify community to reject\n" | |
16414 | "Specify community to accept\n" | |
16415 | COMMUNITY_VAL_STR) | |
16416 | { | |
813d4307 DW |
16417 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
16418 | } | |
16419 | ||
16420 | DEFUN (no_ip_community_list_name_standard_brief, | |
16421 | no_ip_community_list_name_standard_brief_cmd, | |
16422 | "no ip community-list standard WORD (deny|permit)", | |
16423 | NO_STR | |
16424 | IP_STR | |
16425 | COMMUNITY_LIST_STR | |
16426 | "Specify a standard community-list\n" | |
16427 | "Community list name\n" | |
16428 | "Specify community to reject\n" | |
16429 | "Specify community to accept\n") | |
16430 | { | |
16431 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
718e3744 | 16432 | } |
16433 | ||
16434 | DEFUN (no_ip_community_list_name_expanded, | |
16435 | no_ip_community_list_name_expanded_cmd, | |
16436 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
16437 | NO_STR | |
16438 | IP_STR | |
16439 | COMMUNITY_LIST_STR | |
16440 | "Specify an expanded community-list\n" | |
16441 | "Community list name\n" | |
16442 | "Specify community to reject\n" | |
16443 | "Specify community to accept\n" | |
16444 | "An ordered list as a regular-expression\n") | |
16445 | { | |
813d4307 | 16446 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16447 | } |
16448 | ||
94f2b392 | 16449 | static void |
718e3744 | 16450 | community_list_show (struct vty *vty, struct community_list *list) |
16451 | { | |
16452 | struct community_entry *entry; | |
16453 | ||
16454 | for (entry = list->head; entry; entry = entry->next) | |
16455 | { | |
16456 | if (entry == list->head) | |
16457 | { | |
16458 | if (all_digit (list->name)) | |
16459 | vty_out (vty, "Community %s list %s%s", | |
16460 | entry->style == COMMUNITY_LIST_STANDARD ? | |
16461 | "standard" : "(expanded) access", | |
16462 | list->name, VTY_NEWLINE); | |
16463 | else | |
16464 | vty_out (vty, "Named Community %s list %s%s", | |
16465 | entry->style == COMMUNITY_LIST_STANDARD ? | |
16466 | "standard" : "expanded", | |
16467 | list->name, VTY_NEWLINE); | |
16468 | } | |
16469 | if (entry->any) | |
16470 | vty_out (vty, " %s%s", | |
16471 | community_direct_str (entry->direct), VTY_NEWLINE); | |
16472 | else | |
16473 | vty_out (vty, " %s %s%s", | |
16474 | community_direct_str (entry->direct), | |
16475 | entry->style == COMMUNITY_LIST_STANDARD | |
16476 | ? community_str (entry->u.com) : entry->config, | |
16477 | VTY_NEWLINE); | |
16478 | } | |
16479 | } | |
16480 | ||
16481 | DEFUN (show_ip_community_list, | |
16482 | show_ip_community_list_cmd, | |
16483 | "show ip community-list", | |
16484 | SHOW_STR | |
16485 | IP_STR | |
16486 | "List community-list\n") | |
16487 | { | |
16488 | struct community_list *list; | |
16489 | struct community_list_master *cm; | |
16490 | ||
fee6e4e4 | 16491 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 16492 | if (! cm) |
16493 | return CMD_SUCCESS; | |
16494 | ||
16495 | for (list = cm->num.head; list; list = list->next) | |
16496 | community_list_show (vty, list); | |
16497 | ||
16498 | for (list = cm->str.head; list; list = list->next) | |
16499 | community_list_show (vty, list); | |
16500 | ||
16501 | return CMD_SUCCESS; | |
16502 | } | |
16503 | ||
16504 | DEFUN (show_ip_community_list_arg, | |
16505 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 16506 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 16507 | SHOW_STR |
16508 | IP_STR | |
16509 | "List community-list\n" | |
16510 | "Community-list number\n" | |
16511 | "Community-list name\n") | |
16512 | { | |
16513 | struct community_list *list; | |
16514 | ||
fee6e4e4 | 16515 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 16516 | if (! list) |
16517 | { | |
b729294c | 16518 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 16519 | return CMD_WARNING; |
16520 | } | |
16521 | ||
16522 | community_list_show (vty, list); | |
16523 | ||
16524 | return CMD_SUCCESS; | |
16525 | } | |
6b0655a2 | 16526 | |
94f2b392 | 16527 | static int |
fd79ac91 | 16528 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
16529 | int style, int reject_all_digit_name) | |
718e3744 | 16530 | { |
16531 | int ret; | |
16532 | int direct; | |
16533 | char *str; | |
16534 | ||
16535 | /* Check the list type. */ | |
16536 | if (strncmp (argv[1], "p", 1) == 0) | |
16537 | direct = COMMUNITY_PERMIT; | |
16538 | else if (strncmp (argv[1], "d", 1) == 0) | |
16539 | direct = COMMUNITY_DENY; | |
16540 | else | |
16541 | { | |
16542 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16543 | VTY_NEWLINE); | |
16544 | return CMD_WARNING; | |
16545 | } | |
16546 | ||
16547 | /* All digit name check. */ | |
16548 | if (reject_all_digit_name && all_digit (argv[0])) | |
16549 | { | |
16550 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
16551 | return CMD_WARNING; | |
16552 | } | |
16553 | ||
16554 | /* Concat community string argument. */ | |
16555 | if (argc > 1) | |
16556 | str = argv_concat (argv, argc, 2); | |
16557 | else | |
16558 | str = NULL; | |
16559 | ||
16560 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
16561 | ||
16562 | /* Free temporary community list string allocated by | |
16563 | argv_concat(). */ | |
16564 | if (str) | |
16565 | XFREE (MTYPE_TMP, str); | |
16566 | ||
16567 | if (ret < 0) | |
16568 | { | |
16569 | community_list_perror (vty, ret); | |
16570 | return CMD_WARNING; | |
16571 | } | |
16572 | return CMD_SUCCESS; | |
16573 | } | |
16574 | ||
94f2b392 | 16575 | static int |
fee6e4e4 | 16576 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
813d4307 | 16577 | int style, int delete_all) |
718e3744 | 16578 | { |
16579 | int ret; | |
fee6e4e4 | 16580 | int direct = 0; |
16581 | char *str = NULL; | |
718e3744 | 16582 | |
fee6e4e4 | 16583 | if (argc > 1) |
718e3744 | 16584 | { |
fee6e4e4 | 16585 | /* Check the list direct. */ |
16586 | if (strncmp (argv[1], "p", 1) == 0) | |
16587 | direct = COMMUNITY_PERMIT; | |
16588 | else if (strncmp (argv[1], "d", 1) == 0) | |
16589 | direct = COMMUNITY_DENY; | |
16590 | else | |
16591 | { | |
16592 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16593 | VTY_NEWLINE); | |
16594 | return CMD_WARNING; | |
16595 | } | |
718e3744 | 16596 | |
fee6e4e4 | 16597 | /* Concat community string argument. */ |
16598 | str = argv_concat (argv, argc, 2); | |
718e3744 | 16599 | } |
16600 | ||
718e3744 | 16601 | /* Unset community list. */ |
813d4307 | 16602 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); |
718e3744 | 16603 | |
16604 | /* Free temporary community list string allocated by | |
16605 | argv_concat(). */ | |
fee6e4e4 | 16606 | if (str) |
16607 | XFREE (MTYPE_TMP, str); | |
718e3744 | 16608 | |
16609 | if (ret < 0) | |
16610 | { | |
16611 | community_list_perror (vty, ret); | |
16612 | return CMD_WARNING; | |
16613 | } | |
16614 | ||
16615 | return CMD_SUCCESS; | |
16616 | } | |
16617 | ||
16618 | /* "extcommunity-list" keyword help string. */ | |
16619 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
16620 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
16621 | ||
16622 | DEFUN (ip_extcommunity_list_standard, | |
16623 | ip_extcommunity_list_standard_cmd, | |
16624 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
16625 | IP_STR | |
16626 | EXTCOMMUNITY_LIST_STR | |
16627 | "Extended Community list number (standard)\n" | |
16628 | "Specify community to reject\n" | |
16629 | "Specify community to accept\n" | |
16630 | EXTCOMMUNITY_VAL_STR) | |
16631 | { | |
16632 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
16633 | } | |
16634 | ||
16635 | ALIAS (ip_extcommunity_list_standard, | |
16636 | ip_extcommunity_list_standard2_cmd, | |
16637 | "ip extcommunity-list <1-99> (deny|permit)", | |
16638 | IP_STR | |
16639 | EXTCOMMUNITY_LIST_STR | |
16640 | "Extended Community list number (standard)\n" | |
16641 | "Specify community to reject\n" | |
16642 | "Specify community to accept\n") | |
16643 | ||
16644 | DEFUN (ip_extcommunity_list_expanded, | |
16645 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 16646 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 16647 | IP_STR |
16648 | EXTCOMMUNITY_LIST_STR | |
16649 | "Extended Community list number (expanded)\n" | |
16650 | "Specify community to reject\n" | |
16651 | "Specify community to accept\n" | |
16652 | "An ordered list as a regular-expression\n") | |
16653 | { | |
16654 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
16655 | } | |
16656 | ||
16657 | DEFUN (ip_extcommunity_list_name_standard, | |
16658 | ip_extcommunity_list_name_standard_cmd, | |
16659 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
16660 | IP_STR | |
16661 | EXTCOMMUNITY_LIST_STR | |
16662 | "Specify standard extcommunity-list\n" | |
16663 | "Extended Community list name\n" | |
16664 | "Specify community to reject\n" | |
16665 | "Specify community to accept\n" | |
16666 | EXTCOMMUNITY_VAL_STR) | |
16667 | { | |
16668 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
16669 | } | |
16670 | ||
16671 | ALIAS (ip_extcommunity_list_name_standard, | |
16672 | ip_extcommunity_list_name_standard2_cmd, | |
16673 | "ip extcommunity-list standard WORD (deny|permit)", | |
16674 | IP_STR | |
16675 | EXTCOMMUNITY_LIST_STR | |
16676 | "Specify standard extcommunity-list\n" | |
16677 | "Extended Community list name\n" | |
16678 | "Specify community to reject\n" | |
16679 | "Specify community to accept\n") | |
16680 | ||
16681 | DEFUN (ip_extcommunity_list_name_expanded, | |
16682 | ip_extcommunity_list_name_expanded_cmd, | |
16683 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
16684 | IP_STR | |
16685 | EXTCOMMUNITY_LIST_STR | |
16686 | "Specify expanded extcommunity-list\n" | |
16687 | "Extended Community list name\n" | |
16688 | "Specify community to reject\n" | |
16689 | "Specify community to accept\n" | |
16690 | "An ordered list as a regular-expression\n") | |
16691 | { | |
16692 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
16693 | } | |
16694 | ||
fee6e4e4 | 16695 | DEFUN (no_ip_extcommunity_list_standard_all, |
16696 | no_ip_extcommunity_list_standard_all_cmd, | |
16697 | "no ip extcommunity-list <1-99>", | |
16698 | NO_STR | |
16699 | IP_STR | |
16700 | EXTCOMMUNITY_LIST_STR | |
16701 | "Extended Community list number (standard)\n") | |
16702 | { | |
813d4307 DW |
16703 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
16704 | } | |
16705 | ||
16706 | DEFUN (no_ip_extcommunity_list_standard_direction, | |
16707 | no_ip_extcommunity_list_standard_direction_cmd, | |
16708 | "no ip extcommunity-list <1-99> (deny|permit)", | |
16709 | NO_STR | |
16710 | IP_STR | |
16711 | EXTCOMMUNITY_LIST_STR | |
16712 | "Extended Community list number (standard)\n" | |
16713 | "Specify community to reject\n" | |
16714 | "Specify community to accept\n") | |
16715 | { | |
16716 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
fee6e4e4 | 16717 | } |
16718 | ||
16719 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
16720 | no_ip_extcommunity_list_expanded_all_cmd, | |
16721 | "no ip extcommunity-list <100-500>", | |
718e3744 | 16722 | NO_STR |
16723 | IP_STR | |
16724 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 16725 | "Extended Community list number (expanded)\n") |
16726 | { | |
813d4307 | 16727 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16728 | } |
16729 | ||
fee6e4e4 | 16730 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
16731 | no_ip_extcommunity_list_name_standard_all_cmd, | |
16732 | "no ip extcommunity-list standard WORD", | |
718e3744 | 16733 | NO_STR |
16734 | IP_STR | |
16735 | EXTCOMMUNITY_LIST_STR | |
16736 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 16737 | "Extended Community list name\n") |
16738 | { | |
813d4307 | 16739 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
fee6e4e4 | 16740 | } |
16741 | ||
16742 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
16743 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
16744 | "no ip extcommunity-list expanded WORD", | |
16745 | NO_STR | |
16746 | IP_STR | |
16747 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 16748 | "Specify expanded extcommunity-list\n" |
16749 | "Extended Community list name\n") | |
16750 | { | |
813d4307 | 16751 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16752 | } |
16753 | ||
16754 | DEFUN (no_ip_extcommunity_list_standard, | |
16755 | no_ip_extcommunity_list_standard_cmd, | |
16756 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
16757 | NO_STR | |
16758 | IP_STR | |
16759 | EXTCOMMUNITY_LIST_STR | |
16760 | "Extended Community list number (standard)\n" | |
16761 | "Specify community to reject\n" | |
16762 | "Specify community to accept\n" | |
16763 | EXTCOMMUNITY_VAL_STR) | |
16764 | { | |
813d4307 | 16765 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
718e3744 | 16766 | } |
16767 | ||
16768 | DEFUN (no_ip_extcommunity_list_expanded, | |
16769 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 16770 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 16771 | NO_STR |
16772 | IP_STR | |
16773 | EXTCOMMUNITY_LIST_STR | |
16774 | "Extended Community list number (expanded)\n" | |
16775 | "Specify community to reject\n" | |
16776 | "Specify community to accept\n" | |
16777 | "An ordered list as a regular-expression\n") | |
16778 | { | |
813d4307 | 16779 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16780 | } |
16781 | ||
16782 | DEFUN (no_ip_extcommunity_list_name_standard, | |
16783 | no_ip_extcommunity_list_name_standard_cmd, | |
16784 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
16785 | NO_STR | |
16786 | IP_STR | |
16787 | EXTCOMMUNITY_LIST_STR | |
16788 | "Specify standard extcommunity-list\n" | |
16789 | "Extended Community list name\n" | |
16790 | "Specify community to reject\n" | |
16791 | "Specify community to accept\n" | |
16792 | EXTCOMMUNITY_VAL_STR) | |
16793 | { | |
813d4307 DW |
16794 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
16795 | } | |
16796 | ||
16797 | DEFUN (no_ip_extcommunity_list_name_standard_brief, | |
16798 | no_ip_extcommunity_list_name_standard_brief_cmd, | |
16799 | "no ip extcommunity-list standard WORD (deny|permit)", | |
16800 | NO_STR | |
16801 | IP_STR | |
16802 | EXTCOMMUNITY_LIST_STR | |
16803 | "Specify standard extcommunity-list\n" | |
16804 | "Extended Community list name\n" | |
16805 | "Specify community to reject\n" | |
16806 | "Specify community to accept\n") | |
16807 | { | |
16808 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
718e3744 | 16809 | } |
16810 | ||
16811 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
16812 | no_ip_extcommunity_list_name_expanded_cmd, | |
16813 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
16814 | NO_STR | |
16815 | IP_STR | |
16816 | EXTCOMMUNITY_LIST_STR | |
16817 | "Specify expanded extcommunity-list\n" | |
16818 | "Community list name\n" | |
16819 | "Specify community to reject\n" | |
16820 | "Specify community to accept\n" | |
16821 | "An ordered list as a regular-expression\n") | |
16822 | { | |
813d4307 | 16823 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16824 | } |
16825 | ||
94f2b392 | 16826 | static void |
718e3744 | 16827 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
16828 | { | |
16829 | struct community_entry *entry; | |
16830 | ||
16831 | for (entry = list->head; entry; entry = entry->next) | |
16832 | { | |
16833 | if (entry == list->head) | |
16834 | { | |
16835 | if (all_digit (list->name)) | |
16836 | vty_out (vty, "Extended community %s list %s%s", | |
16837 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16838 | "standard" : "(expanded) access", | |
16839 | list->name, VTY_NEWLINE); | |
16840 | else | |
16841 | vty_out (vty, "Named extended community %s list %s%s", | |
16842 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16843 | "standard" : "expanded", | |
16844 | list->name, VTY_NEWLINE); | |
16845 | } | |
16846 | if (entry->any) | |
16847 | vty_out (vty, " %s%s", | |
16848 | community_direct_str (entry->direct), VTY_NEWLINE); | |
16849 | else | |
16850 | vty_out (vty, " %s %s%s", | |
16851 | community_direct_str (entry->direct), | |
16852 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16853 | entry->u.ecom->str : entry->config, | |
16854 | VTY_NEWLINE); | |
16855 | } | |
16856 | } | |
16857 | ||
16858 | DEFUN (show_ip_extcommunity_list, | |
16859 | show_ip_extcommunity_list_cmd, | |
16860 | "show ip extcommunity-list", | |
16861 | SHOW_STR | |
16862 | IP_STR | |
16863 | "List extended-community list\n") | |
16864 | { | |
16865 | struct community_list *list; | |
16866 | struct community_list_master *cm; | |
16867 | ||
fee6e4e4 | 16868 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16869 | if (! cm) |
16870 | return CMD_SUCCESS; | |
16871 | ||
16872 | for (list = cm->num.head; list; list = list->next) | |
16873 | extcommunity_list_show (vty, list); | |
16874 | ||
16875 | for (list = cm->str.head; list; list = list->next) | |
16876 | extcommunity_list_show (vty, list); | |
16877 | ||
16878 | return CMD_SUCCESS; | |
16879 | } | |
16880 | ||
16881 | DEFUN (show_ip_extcommunity_list_arg, | |
16882 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 16883 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 16884 | SHOW_STR |
16885 | IP_STR | |
16886 | "List extended-community list\n" | |
16887 | "Extcommunity-list number\n" | |
16888 | "Extcommunity-list name\n") | |
16889 | { | |
16890 | struct community_list *list; | |
16891 | ||
fee6e4e4 | 16892 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16893 | if (! list) |
16894 | { | |
b729294c | 16895 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 16896 | return CMD_WARNING; |
16897 | } | |
16898 | ||
16899 | extcommunity_list_show (vty, list); | |
16900 | ||
16901 | return CMD_SUCCESS; | |
16902 | } | |
6b0655a2 | 16903 | |
718e3744 | 16904 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 16905 | static const char * |
718e3744 | 16906 | community_list_config_str (struct community_entry *entry) |
16907 | { | |
fd79ac91 | 16908 | const char *str; |
718e3744 | 16909 | |
16910 | if (entry->any) | |
16911 | str = ""; | |
16912 | else | |
16913 | { | |
16914 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
16915 | str = community_str (entry->u.com); | |
16916 | else | |
16917 | str = entry->config; | |
16918 | } | |
16919 | return str; | |
16920 | } | |
16921 | ||
16922 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 16923 | static int |
718e3744 | 16924 | community_list_config_write (struct vty *vty) |
16925 | { | |
16926 | struct community_list *list; | |
16927 | struct community_entry *entry; | |
16928 | struct community_list_master *cm; | |
16929 | int write = 0; | |
16930 | ||
16931 | /* Community-list. */ | |
fee6e4e4 | 16932 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 16933 | |
16934 | for (list = cm->num.head; list; list = list->next) | |
16935 | for (entry = list->head; entry; entry = entry->next) | |
16936 | { | |
fee6e4e4 | 16937 | vty_out (vty, "ip community-list %s %s %s%s", |
16938 | list->name, community_direct_str (entry->direct), | |
16939 | community_list_config_str (entry), | |
16940 | VTY_NEWLINE); | |
718e3744 | 16941 | write++; |
16942 | } | |
16943 | for (list = cm->str.head; list; list = list->next) | |
16944 | for (entry = list->head; entry; entry = entry->next) | |
16945 | { | |
16946 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
16947 | entry->style == COMMUNITY_LIST_STANDARD | |
16948 | ? "standard" : "expanded", | |
16949 | list->name, community_direct_str (entry->direct), | |
16950 | community_list_config_str (entry), | |
16951 | VTY_NEWLINE); | |
16952 | write++; | |
16953 | } | |
16954 | ||
16955 | /* Extcommunity-list. */ | |
fee6e4e4 | 16956 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16957 | |
16958 | for (list = cm->num.head; list; list = list->next) | |
16959 | for (entry = list->head; entry; entry = entry->next) | |
16960 | { | |
fee6e4e4 | 16961 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
16962 | list->name, community_direct_str (entry->direct), | |
16963 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 16964 | write++; |
16965 | } | |
16966 | for (list = cm->str.head; list; list = list->next) | |
16967 | for (entry = list->head; entry; entry = entry->next) | |
16968 | { | |
16969 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
16970 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
16971 | ? "standard" : "expanded", | |
16972 | list->name, community_direct_str (entry->direct), | |
16973 | community_list_config_str (entry), VTY_NEWLINE); | |
16974 | write++; | |
16975 | } | |
16976 | return write; | |
16977 | } | |
16978 | ||
7fc626de | 16979 | static struct cmd_node community_list_node = |
718e3744 | 16980 | { |
16981 | COMMUNITY_LIST_NODE, | |
16982 | "", | |
16983 | 1 /* Export to vtysh. */ | |
16984 | }; | |
16985 | ||
94f2b392 | 16986 | static void |
16987 | community_list_vty (void) | |
718e3744 | 16988 | { |
16989 | install_node (&community_list_node, community_list_config_write); | |
16990 | ||
16991 | /* Community-list. */ | |
718e3744 | 16992 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
16993 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
16994 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
16995 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
16996 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
16997 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 16998 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
813d4307 | 16999 | install_element (CONFIG_NODE, &no_ip_community_list_standard_direction_cmd); |
fee6e4e4 | 17000 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
17001 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
17002 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 17003 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
17004 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
17005 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
813d4307 | 17006 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_brief_cmd); |
718e3744 | 17007 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
17008 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
17009 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
17010 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
17011 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
17012 | ||
17013 | /* Extcommunity-list. */ | |
17014 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
17015 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
17016 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
17017 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
17018 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
17019 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 17020 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
813d4307 | 17021 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_direction_cmd); |
fee6e4e4 | 17022 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
17023 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
17024 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 17025 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
17026 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
17027 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
813d4307 | 17028 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_brief_cmd); |
718e3744 | 17029 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
17030 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
17031 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
17032 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
17033 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
17034 | } |