]>
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" |
718e3744 | 35 | |
36 | #include "bgpd/bgpd.h" | |
4bf6a362 | 37 | #include "bgpd/bgp_advertise.h" |
718e3744 | 38 | #include "bgpd/bgp_attr.h" |
39 | #include "bgpd/bgp_aspath.h" | |
40 | #include "bgpd/bgp_community.h" | |
4bf6a362 PJ |
41 | #include "bgpd/bgp_ecommunity.h" |
42 | #include "bgpd/bgp_damp.h" | |
718e3744 | 43 | #include "bgpd/bgp_debug.h" |
e0701b79 | 44 | #include "bgpd/bgp_fsm.h" |
718e3744 | 45 | #include "bgpd/bgp_mplsvpn.h" |
4bf6a362 | 46 | #include "bgpd/bgp_nexthop.h" |
718e3744 | 47 | #include "bgpd/bgp_open.h" |
4bf6a362 | 48 | #include "bgpd/bgp_regex.h" |
718e3744 | 49 | #include "bgpd/bgp_route.h" |
50 | #include "bgpd/bgp_zebra.h" | |
fee0f4c6 | 51 | #include "bgpd/bgp_table.h" |
94f2b392 | 52 | #include "bgpd/bgp_vty.h" |
165b5fff | 53 | #include "bgpd/bgp_mpath.h" |
cb1faec9 | 54 | #include "bgpd/bgp_packet.h" |
3f9c7369 | 55 | #include "bgpd/bgp_updgrp.h" |
c43ed2e4 | 56 | #include "bgpd/bgp_bfd.h" |
718e3744 | 57 | |
20eb8864 | 58 | static struct peer_group * |
59 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact); | |
60 | ||
718e3744 | 61 | /* Utility function to get address family from current node. */ |
62 | afi_t | |
63 | bgp_node_afi (struct vty *vty) | |
64 | { | |
8ecd3266 | 65 | if (vty->node == BGP_IPV6_NODE || |
66 | vty->node == BGP_IPV6M_NODE || | |
8b1fb8be LB |
67 | vty->node == BGP_VPNV6_NODE || |
68 | vty->node == BGP_ENCAPV6_NODE) | |
718e3744 | 69 | return AFI_IP6; |
70 | return AFI_IP; | |
71 | } | |
72 | ||
73 | /* Utility function to get subsequent address family from current | |
74 | node. */ | |
75 | safi_t | |
76 | bgp_node_safi (struct vty *vty) | |
77 | { | |
6407da5a | 78 | if (vty->node == BGP_VPNV4_NODE || vty->node == BGP_VPNV6_NODE) |
8ecd3266 | 79 | return SAFI_MPLS_VPN; |
8b1fb8be LB |
80 | if (vty->node == BGP_ENCAP_NODE || vty->node == BGP_ENCAPV6_NODE) |
81 | return SAFI_ENCAP; | |
25ffbdc1 | 82 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 83 | return SAFI_MULTICAST; |
84 | return SAFI_UNICAST; | |
85 | } | |
86 | ||
8b1fb8be LB |
87 | int |
88 | bgp_parse_afi(const char *str, afi_t *afi) | |
89 | { | |
90 | if (!strcmp(str, "ipv4")) { | |
91 | *afi = AFI_IP; | |
92 | return 0; | |
93 | } | |
94 | #ifdef HAVE_IPV6 | |
95 | if (!strcmp(str, "ipv6")) { | |
96 | *afi = AFI_IP6; | |
97 | return 0; | |
98 | } | |
99 | #endif /* HAVE_IPV6 */ | |
100 | return -1; | |
101 | } | |
102 | ||
103 | int | |
104 | bgp_parse_safi(const char *str, safi_t *safi) | |
105 | { | |
106 | if (!strcmp(str, "encap")) { | |
107 | *safi = SAFI_ENCAP; | |
108 | return 0; | |
109 | } | |
110 | if (!strcmp(str, "multicast")) { | |
111 | *safi = SAFI_MULTICAST; | |
112 | return 0; | |
113 | } | |
114 | if (!strcmp(str, "unicast")) { | |
115 | *safi = SAFI_UNICAST; | |
116 | return 0; | |
117 | } | |
118 | if (!strcmp(str, "vpn")) { | |
119 | *safi = SAFI_MPLS_VPN; | |
120 | return 0; | |
121 | } | |
122 | return -1; | |
123 | } | |
124 | ||
94f2b392 | 125 | static int |
6aeb9e78 | 126 | peer_address_self_check (struct bgp *bgp, union sockunion *su) |
718e3744 | 127 | { |
128 | struct interface *ifp = NULL; | |
129 | ||
130 | if (su->sa.sa_family == AF_INET) | |
6aeb9e78 | 131 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr, bgp->vrf_id); |
718e3744 | 132 | #ifdef HAVE_IPV6 |
133 | else if (su->sa.sa_family == AF_INET6) | |
f2345335 | 134 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr, |
6aeb9e78 | 135 | su->sin6.sin6_scope_id, bgp->vrf_id); |
718e3744 | 136 | #endif /* HAVE IPV6 */ |
137 | ||
138 | if (ifp) | |
139 | return 1; | |
140 | ||
141 | return 0; | |
142 | } | |
143 | ||
144 | /* Utility function for looking up peer from VTY. */ | |
f14e6fdb DS |
145 | /* This is used only for configuration, so disallow if attempted on |
146 | * a dynamic neighbor. | |
147 | */ | |
94f2b392 | 148 | static struct peer * |
fd79ac91 | 149 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 150 | { |
151 | int ret; | |
152 | struct bgp *bgp; | |
153 | union sockunion su; | |
154 | struct peer *peer; | |
155 | ||
156 | bgp = vty->index; | |
157 | ||
158 | ret = str2sockunion (ip_str, &su); | |
159 | if (ret < 0) | |
160 | { | |
a80beece DS |
161 | peer = peer_lookup_by_conf_if (bgp, ip_str); |
162 | if (!peer) | |
163 | { | |
04b6bdc0 DW |
164 | if ((peer = peer_lookup_by_hostname(bgp, ip_str)) == NULL) |
165 | { | |
166 | vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE); | |
167 | return NULL; | |
168 | } | |
a80beece | 169 | } |
718e3744 | 170 | } |
a80beece | 171 | else |
718e3744 | 172 | { |
a80beece DS |
173 | peer = peer_lookup (bgp, &su); |
174 | if (! peer) | |
175 | { | |
176 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
177 | VTY_NEWLINE); | |
178 | return NULL; | |
179 | } | |
f14e6fdb DS |
180 | if (peer_dynamic_neighbor (peer)) |
181 | { | |
182 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
183 | VTY_NEWLINE); | |
184 | return NULL; | |
185 | } | |
186 | ||
718e3744 | 187 | } |
188 | return peer; | |
189 | } | |
190 | ||
191 | /* Utility function for looking up peer or peer group. */ | |
f14e6fdb DS |
192 | /* This is used only for configuration, so disallow if attempted on |
193 | * a dynamic neighbor. | |
194 | */ | |
c43ed2e4 | 195 | struct peer * |
fd79ac91 | 196 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 197 | { |
198 | int ret; | |
199 | struct bgp *bgp; | |
200 | union sockunion su; | |
f14e6fdb DS |
201 | struct peer *peer = NULL; |
202 | struct peer_group *group = NULL; | |
718e3744 | 203 | |
204 | bgp = vty->index; | |
205 | ||
206 | ret = str2sockunion (peer_str, &su); | |
207 | if (ret == 0) | |
208 | { | |
f14e6fdb | 209 | /* IP address, locate peer. */ |
718e3744 | 210 | peer = peer_lookup (bgp, &su); |
718e3744 | 211 | } |
212 | else | |
213 | { | |
f14e6fdb | 214 | /* Not IP, could match either peer configured on interface or a group. */ |
a80beece | 215 | peer = peer_lookup_by_conf_if (bgp, peer_str); |
f14e6fdb DS |
216 | if (!peer) |
217 | group = peer_group_lookup (bgp, peer_str); | |
218 | } | |
a80beece | 219 | |
f14e6fdb DS |
220 | if (peer) |
221 | { | |
222 | if (peer_dynamic_neighbor (peer)) | |
223 | { | |
224 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
225 | VTY_NEWLINE); | |
226 | return NULL; | |
227 | } | |
228 | ||
229 | return peer; | |
718e3744 | 230 | } |
231 | ||
f14e6fdb DS |
232 | if (group) |
233 | return group->conf; | |
234 | ||
718e3744 | 235 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
236 | VTY_NEWLINE); | |
237 | ||
238 | return NULL; | |
239 | } | |
240 | ||
c43ed2e4 | 241 | int |
718e3744 | 242 | bgp_vty_return (struct vty *vty, int ret) |
243 | { | |
fd79ac91 | 244 | const char *str = NULL; |
718e3744 | 245 | |
246 | switch (ret) | |
247 | { | |
248 | case BGP_ERR_INVALID_VALUE: | |
249 | str = "Invalid value"; | |
250 | break; | |
251 | case BGP_ERR_INVALID_FLAG: | |
252 | str = "Invalid flag"; | |
253 | break; | |
718e3744 | 254 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
255 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
256 | break; | |
718e3744 | 257 | case BGP_ERR_PEER_FLAG_CONFLICT: |
258 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
259 | break; | |
718e3744 | 260 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
261 | str = "Specify remote-as or peer-group remote AS first"; | |
262 | break; | |
263 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
264 | str = "Cannot change the peer-group. Deconfigure first"; | |
265 | break; | |
266 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
4c48cf63 | 267 | str = "Peer is not a member of this peer-group"; |
718e3744 | 268 | break; |
269 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
270 | str = "Prefix/distribute list can not co-exist"; | |
271 | break; | |
272 | case BGP_ERR_NOT_INTERNAL_PEER: | |
273 | str = "Invalid command. Not an internal neighbor"; | |
274 | break; | |
275 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
5000f21c | 276 | str = "remove-private-AS cannot be configured for IBGP peers"; |
718e3744 | 277 | break; |
278 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
279 | str = "Local-AS allowed only for EBGP peers"; | |
280 | break; | |
281 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
282 | str = "Cannot have local-as same as BGP AS number"; | |
283 | break; | |
0df7c91f PJ |
284 | case BGP_ERR_TCPSIG_FAILED: |
285 | str = "Error while applying TCP-Sig to session(s)"; | |
286 | break; | |
fa411a21 NH |
287 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
288 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
289 | break; | |
f5a4827d SH |
290 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
291 | str = "ttl-security only allowed for EBGP peers"; | |
292 | break; | |
c7122e14 DS |
293 | case BGP_ERR_AS_OVERRIDE: |
294 | str = "as-override cannot be configured for IBGP peers"; | |
295 | break; | |
f14e6fdb DS |
296 | case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT: |
297 | str = "Invalid limit for number of dynamic neighbors"; | |
298 | break; | |
299 | case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS: | |
300 | str = "Dynamic neighbor listen range already exists"; | |
301 | break; | |
302 | case BGP_ERR_INVALID_FOR_DYNAMIC_PEER: | |
303 | str = "Operation not allowed on a dynamic neighbor"; | |
304 | break; | |
63fa10b5 QY |
305 | case BGP_ERR_INVALID_FOR_DIRECT_PEER: |
306 | str = "Operation not allowed on a directly connected neighbor"; | |
307 | break; | |
718e3744 | 308 | } |
309 | if (str) | |
310 | { | |
311 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
312 | return CMD_WARNING; | |
313 | } | |
314 | return CMD_SUCCESS; | |
315 | } | |
316 | ||
7aafcaca DS |
317 | /* BGP clear sort. */ |
318 | enum clear_sort | |
319 | { | |
320 | clear_all, | |
321 | clear_peer, | |
322 | clear_group, | |
323 | clear_external, | |
324 | clear_as | |
325 | }; | |
326 | ||
7aafcaca DS |
327 | static void |
328 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, | |
329 | safi_t safi, int error) | |
330 | { | |
331 | switch (error) | |
332 | { | |
333 | case BGP_ERR_AF_UNCONFIGURED: | |
334 | vty_out (vty, | |
335 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
336 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
337 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
338 | peer->host, VTY_NEWLINE); | |
339 | break; | |
340 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
341 | 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); | |
342 | break; | |
343 | default: | |
344 | break; | |
345 | } | |
346 | } | |
347 | ||
348 | /* `clear ip bgp' functions. */ | |
349 | static int | |
350 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, | |
351 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) | |
352 | { | |
353 | int ret; | |
354 | struct peer *peer; | |
355 | struct listnode *node, *nnode; | |
356 | ||
357 | /* Clear all neighbors. */ | |
358 | /* | |
359 | * Pass along pointer to next node to peer_clear() when walking all nodes | |
360 | * on the BGP instance as that may get freed if it is a doppelganger | |
361 | */ | |
362 | if (sort == clear_all) | |
363 | { | |
364 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
365 | { | |
366 | if (stype == BGP_CLEAR_SOFT_NONE) | |
367 | ret = peer_clear (peer, &nnode); | |
368 | else if (peer->afc[afi][safi]) | |
369 | ret = peer_clear_soft (peer, afi, safi, stype); | |
370 | else | |
371 | ret = 0; | |
372 | ||
373 | if (ret < 0) | |
374 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
375 | } | |
376 | ||
377 | /* This is to apply read-only mode on this clear. */ | |
378 | if (stype == BGP_CLEAR_SOFT_NONE) | |
379 | bgp->update_delay_over = 0; | |
380 | ||
381 | return CMD_SUCCESS; | |
382 | } | |
383 | ||
384 | /* Clear specified neighbors. */ | |
385 | if (sort == clear_peer) | |
386 | { | |
387 | union sockunion su; | |
388 | int ret; | |
389 | ||
390 | /* Make sockunion for lookup. */ | |
391 | ret = str2sockunion (arg, &su); | |
392 | if (ret < 0) | |
393 | { | |
394 | peer = peer_lookup_by_conf_if (bgp, arg); | |
395 | if (!peer) | |
396 | { | |
04b6bdc0 DW |
397 | peer = peer_lookup_by_hostname(bgp, arg); |
398 | if (!peer) | |
399 | { | |
400 | vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE); | |
401 | return CMD_WARNING; | |
402 | } | |
7aafcaca DS |
403 | } |
404 | } | |
405 | else | |
406 | { | |
407 | peer = peer_lookup (bgp, &su); | |
408 | if (! peer) | |
409 | { | |
410 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
411 | return CMD_WARNING; | |
412 | } | |
413 | } | |
414 | ||
415 | if (stype == BGP_CLEAR_SOFT_NONE) | |
416 | ret = peer_clear (peer, NULL); | |
417 | else | |
418 | ret = peer_clear_soft (peer, afi, safi, stype); | |
419 | ||
420 | if (ret < 0) | |
421 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
422 | ||
423 | return CMD_SUCCESS; | |
424 | } | |
425 | ||
426 | /* Clear all peer-group members. */ | |
427 | if (sort == clear_group) | |
428 | { | |
429 | struct peer_group *group; | |
430 | ||
431 | group = peer_group_lookup (bgp, arg); | |
432 | if (! group) | |
433 | { | |
434 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
435 | return CMD_WARNING; | |
436 | } | |
437 | ||
438 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
439 | { | |
440 | if (stype == BGP_CLEAR_SOFT_NONE) | |
441 | { | |
18f1dc06 | 442 | peer_clear (peer, NULL); |
7aafcaca DS |
443 | continue; |
444 | } | |
445 | ||
c8560b44 | 446 | if (! peer->afc[afi][safi]) |
7aafcaca DS |
447 | continue; |
448 | ||
449 | ret = peer_clear_soft (peer, afi, safi, stype); | |
450 | ||
451 | if (ret < 0) | |
452 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
453 | } | |
454 | return CMD_SUCCESS; | |
455 | } | |
456 | ||
457 | if (sort == clear_external) | |
458 | { | |
459 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
460 | { | |
461 | if (peer->sort == BGP_PEER_IBGP) | |
462 | continue; | |
463 | ||
464 | if (stype == BGP_CLEAR_SOFT_NONE) | |
465 | ret = peer_clear (peer, &nnode); | |
466 | else | |
467 | ret = peer_clear_soft (peer, afi, safi, stype); | |
468 | ||
469 | if (ret < 0) | |
470 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
471 | } | |
472 | return CMD_SUCCESS; | |
473 | } | |
474 | ||
475 | if (sort == clear_as) | |
476 | { | |
477 | as_t as; | |
478 | int find = 0; | |
479 | ||
480 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); | |
481 | ||
482 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
483 | { | |
484 | if (peer->as != as) | |
485 | continue; | |
486 | ||
487 | find = 1; | |
488 | if (stype == BGP_CLEAR_SOFT_NONE) | |
489 | ret = peer_clear (peer, &nnode); | |
490 | else | |
491 | ret = peer_clear_soft (peer, afi, safi, stype); | |
492 | ||
493 | if (ret < 0) | |
494 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
495 | } | |
496 | if (! find) | |
497 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
498 | VTY_NEWLINE); | |
499 | return CMD_SUCCESS; | |
500 | } | |
501 | ||
502 | return CMD_SUCCESS; | |
503 | } | |
504 | ||
505 | static int | |
506 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, | |
507 | enum clear_sort sort, enum bgp_clear_type stype, | |
508 | const char *arg) | |
509 | { | |
510 | struct bgp *bgp; | |
511 | ||
512 | /* BGP structure lookup. */ | |
513 | if (name) | |
514 | { | |
515 | bgp = bgp_lookup_by_name (name); | |
516 | if (bgp == NULL) | |
517 | { | |
6aeb9e78 | 518 | vty_out (vty, "Can't find BGP instance %s%s", name, VTY_NEWLINE); |
7aafcaca DS |
519 | return CMD_WARNING; |
520 | } | |
521 | } | |
522 | else | |
523 | { | |
f31fa004 | 524 | bgp = bgp_get_default (); |
7aafcaca DS |
525 | if (bgp == NULL) |
526 | { | |
527 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
528 | return CMD_WARNING; | |
529 | } | |
530 | } | |
531 | ||
532 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); | |
533 | } | |
534 | ||
535 | /* clear soft inbound */ | |
536 | static void | |
f31fa004 | 537 | bgp_clear_star_soft_in (struct vty *vty, const char *name) |
7aafcaca | 538 | { |
f31fa004 | 539 | bgp_clear_vty (vty,name, AFI_IP, SAFI_UNICAST, clear_all, |
7aafcaca | 540 | BGP_CLEAR_SOFT_IN, NULL); |
f31fa004 | 541 | bgp_clear_vty (vty, name, AFI_IP6, SAFI_UNICAST, clear_all, |
7aafcaca | 542 | BGP_CLEAR_SOFT_IN, NULL); |
7aafcaca DS |
543 | } |
544 | ||
545 | /* clear soft outbound */ | |
546 | static void | |
f31fa004 | 547 | bgp_clear_star_soft_out (struct vty *vty, const char *name) |
7aafcaca | 548 | { |
f31fa004 | 549 | bgp_clear_vty (vty, name, AFI_IP, SAFI_UNICAST, clear_all, |
7aafcaca | 550 | BGP_CLEAR_SOFT_OUT, NULL); |
f31fa004 | 551 | bgp_clear_vty (vty, name, AFI_IP6, SAFI_UNICAST, clear_all, |
7aafcaca | 552 | BGP_CLEAR_SOFT_OUT, NULL); |
7aafcaca DS |
553 | } |
554 | ||
555 | ||
718e3744 | 556 | /* BGP global configuration. */ |
557 | ||
558 | DEFUN (bgp_multiple_instance_func, | |
559 | bgp_multiple_instance_cmd, | |
560 | "bgp multiple-instance", | |
561 | BGP_STR | |
562 | "Enable bgp multiple instance\n") | |
563 | { | |
564 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
565 | return CMD_SUCCESS; | |
566 | } | |
567 | ||
568 | DEFUN (no_bgp_multiple_instance, | |
569 | no_bgp_multiple_instance_cmd, | |
570 | "no bgp multiple-instance", | |
571 | NO_STR | |
572 | BGP_STR | |
573 | "BGP multiple instance\n") | |
574 | { | |
575 | int ret; | |
576 | ||
577 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
578 | if (ret < 0) | |
579 | { | |
580 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
581 | return CMD_WARNING; | |
582 | } | |
583 | return CMD_SUCCESS; | |
584 | } | |
585 | ||
586 | DEFUN (bgp_config_type, | |
587 | bgp_config_type_cmd, | |
588 | "bgp config-type (cisco|zebra)", | |
589 | BGP_STR | |
590 | "Configuration type\n" | |
591 | "cisco\n" | |
592 | "zebra\n") | |
593 | { | |
594 | if (strncmp (argv[0], "c", 1) == 0) | |
595 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
596 | else | |
597 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
598 | ||
599 | return CMD_SUCCESS; | |
600 | } | |
601 | ||
602 | DEFUN (no_bgp_config_type, | |
603 | no_bgp_config_type_cmd, | |
604 | "no bgp config-type", | |
605 | NO_STR | |
606 | BGP_STR | |
607 | "Display configuration type\n") | |
608 | { | |
609 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
610 | return CMD_SUCCESS; | |
611 | } | |
612 | ||
813d4307 DW |
613 | ALIAS (no_bgp_config_type, |
614 | no_bgp_config_type_val_cmd, | |
615 | "no bgp config-type (cisco|zebra)", | |
616 | NO_STR | |
617 | BGP_STR | |
618 | "Configuration type\n" | |
619 | "cisco\n" | |
620 | "zebra\n") | |
621 | ||
718e3744 | 622 | DEFUN (no_synchronization, |
623 | no_synchronization_cmd, | |
624 | "no synchronization", | |
625 | NO_STR | |
626 | "Perform IGP synchronization\n") | |
627 | { | |
628 | return CMD_SUCCESS; | |
629 | } | |
630 | ||
631 | DEFUN (no_auto_summary, | |
632 | no_auto_summary_cmd, | |
633 | "no auto-summary", | |
634 | NO_STR | |
635 | "Enable automatic network number summarization\n") | |
636 | { | |
637 | return CMD_SUCCESS; | |
638 | } | |
3d515fd9 | 639 | |
718e3744 | 640 | /* "router bgp" commands. */ |
641 | DEFUN (router_bgp, | |
642 | router_bgp_cmd, | |
320da874 | 643 | "router bgp " CMD_AS_RANGE, |
718e3744 | 644 | ROUTER_STR |
645 | BGP_STR | |
646 | AS_STR) | |
647 | { | |
648 | int ret; | |
649 | as_t as; | |
650 | struct bgp *bgp; | |
fd79ac91 | 651 | const char *name = NULL; |
ad4cbda1 | 652 | enum bgp_instance_type inst_type; |
718e3744 | 653 | |
2385a876 DW |
654 | // "router bgp" without an ASN |
655 | if (argc < 1) | |
656 | { | |
6aeb9e78 | 657 | //Pending: Make VRF option available for ASN less config |
2385a876 | 658 | bgp = bgp_get_default(); |
718e3744 | 659 | |
2385a876 DW |
660 | if (bgp == NULL) |
661 | { | |
662 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
663 | return CMD_WARNING; | |
664 | } | |
718e3744 | 665 | |
2385a876 DW |
666 | if (listcount(bm->bgp) > 1) |
667 | { | |
668 | vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE); | |
669 | return CMD_WARNING; | |
670 | } | |
671 | } | |
672 | ||
673 | // "router bgp X" | |
674 | else | |
718e3744 | 675 | { |
2385a876 DW |
676 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
677 | ||
ad4cbda1 | 678 | inst_type = BGP_INSTANCE_TYPE_DEFAULT; |
6aeb9e78 | 679 | if (argc == 3) |
ad4cbda1 | 680 | { |
681 | name = argv[2]; | |
682 | if (!strcmp(argv[1], "vrf")) | |
683 | inst_type = BGP_INSTANCE_TYPE_VRF; | |
684 | else if (!strcmp(argv[1], "view")) | |
685 | inst_type = BGP_INSTANCE_TYPE_VIEW; | |
686 | } | |
2385a876 | 687 | |
ad4cbda1 | 688 | ret = bgp_get (&bgp, &as, name, inst_type); |
2385a876 DW |
689 | switch (ret) |
690 | { | |
691 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
692 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
693 | VTY_NEWLINE); | |
694 | return CMD_WARNING; | |
695 | case BGP_ERR_AS_MISMATCH: | |
696 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); | |
697 | return CMD_WARNING; | |
698 | case BGP_ERR_INSTANCE_MISMATCH: | |
6aeb9e78 | 699 | vty_out (vty, "BGP instance name and AS number mismatch%s", VTY_NEWLINE); |
2385a876 DW |
700 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
701 | as, VTY_NEWLINE); | |
702 | return CMD_WARNING; | |
703 | } | |
6aeb9e78 DS |
704 | |
705 | /* Pending: handle when user tries to change a view to vrf n vv. */ | |
718e3744 | 706 | } |
707 | ||
708 | vty->node = BGP_NODE; | |
709 | vty->index = bgp; | |
710 | ||
711 | return CMD_SUCCESS; | |
712 | } | |
713 | ||
714 | ALIAS (router_bgp, | |
6aeb9e78 DS |
715 | router_bgp_instance_cmd, |
716 | "router bgp " CMD_AS_RANGE " (view|vrf) WORD", | |
718e3744 | 717 | ROUTER_STR |
718 | BGP_STR | |
719 | AS_STR | |
6aeb9e78 | 720 | "BGP view\nBGP VRF\n" |
8386ac43 | 721 | "View/VRF name\n") |
6b0655a2 | 722 | |
2385a876 DW |
723 | ALIAS (router_bgp, |
724 | router_bgp_noasn_cmd, | |
725 | "router bgp", | |
726 | ROUTER_STR | |
727 | BGP_STR) | |
728 | ||
718e3744 | 729 | /* "no router bgp" commands. */ |
730 | DEFUN (no_router_bgp, | |
731 | no_router_bgp_cmd, | |
320da874 | 732 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 733 | NO_STR |
734 | ROUTER_STR | |
735 | BGP_STR | |
736 | AS_STR) | |
737 | { | |
738 | as_t as; | |
739 | struct bgp *bgp; | |
fd79ac91 | 740 | const char *name = NULL; |
718e3744 | 741 | |
718e3744 | 742 | |
7fb21a9f QY |
743 | // "no router bgp" without an ASN |
744 | if (argc < 1) | |
745 | { | |
746 | //Pending: Make VRF option available for ASN less config | |
747 | bgp = bgp_get_default(); | |
718e3744 | 748 | |
7fb21a9f QY |
749 | if (bgp == NULL) |
750 | { | |
751 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
752 | return CMD_WARNING; | |
753 | } | |
754 | ||
755 | if (listcount(bm->bgp) > 1) | |
756 | { | |
757 | vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE); | |
758 | return CMD_WARNING; | |
759 | } | |
760 | } | |
761 | else | |
718e3744 | 762 | { |
7fb21a9f QY |
763 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
764 | ||
765 | if (argc == 3) | |
766 | name = argv[2]; | |
767 | ||
768 | /* Lookup bgp structure. */ | |
769 | bgp = bgp_lookup (as, name); | |
770 | if (! bgp) | |
771 | { | |
772 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
773 | return CMD_WARNING; | |
774 | } | |
718e3744 | 775 | } |
776 | ||
777 | bgp_delete (bgp); | |
778 | ||
779 | return CMD_SUCCESS; | |
780 | } | |
781 | ||
782 | ALIAS (no_router_bgp, | |
6aeb9e78 DS |
783 | no_router_bgp_instance_cmd, |
784 | "no router bgp " CMD_AS_RANGE " (view|vrf) WORD", | |
718e3744 | 785 | NO_STR |
786 | ROUTER_STR | |
787 | BGP_STR | |
788 | AS_STR | |
6aeb9e78 | 789 | "BGP view\nBGP VRF\n" |
8386ac43 | 790 | "View/VRF name\n") |
6b0655a2 | 791 | |
7fb21a9f QY |
792 | ALIAS (no_router_bgp, |
793 | no_router_bgp_noasn_cmd, | |
794 | "no router bgp", | |
795 | NO_STR | |
796 | ROUTER_STR | |
797 | BGP_STR) | |
798 | ||
718e3744 | 799 | /* BGP router-id. */ |
800 | ||
801 | DEFUN (bgp_router_id, | |
802 | bgp_router_id_cmd, | |
803 | "bgp router-id A.B.C.D", | |
804 | BGP_STR | |
805 | "Override configured router identifier\n" | |
806 | "Manually configured router identifier\n") | |
807 | { | |
808 | int ret; | |
809 | struct in_addr id; | |
810 | struct bgp *bgp; | |
811 | ||
812 | bgp = vty->index; | |
813 | ||
814 | ret = inet_aton (argv[0], &id); | |
815 | if (! ret) | |
816 | { | |
817 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
818 | return CMD_WARNING; | |
819 | } | |
820 | ||
0e6cb743 | 821 | bgp_router_id_static_set (bgp, id); |
718e3744 | 822 | |
823 | return CMD_SUCCESS; | |
824 | } | |
825 | ||
826 | DEFUN (no_bgp_router_id, | |
827 | no_bgp_router_id_cmd, | |
828 | "no bgp router-id", | |
829 | NO_STR | |
830 | BGP_STR | |
831 | "Override configured router identifier\n") | |
832 | { | |
833 | int ret; | |
834 | struct in_addr id; | |
835 | struct bgp *bgp; | |
836 | ||
837 | bgp = vty->index; | |
838 | ||
839 | if (argc == 1) | |
840 | { | |
841 | ret = inet_aton (argv[0], &id); | |
842 | if (! ret) | |
e018c7cc SK |
843 | { |
844 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
845 | return CMD_WARNING; | |
846 | } | |
718e3744 | 847 | |
18a6dce6 | 848 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
e018c7cc SK |
849 | { |
850 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
851 | return CMD_WARNING; | |
852 | } | |
718e3744 | 853 | } |
854 | ||
0e6cb743 DL |
855 | id.s_addr = 0; |
856 | bgp_router_id_static_set (bgp, id); | |
718e3744 | 857 | |
858 | return CMD_SUCCESS; | |
859 | } | |
860 | ||
861 | ALIAS (no_bgp_router_id, | |
862 | no_bgp_router_id_val_cmd, | |
863 | "no bgp router-id A.B.C.D", | |
864 | NO_STR | |
865 | BGP_STR | |
866 | "Override configured router identifier\n" | |
867 | "Manually configured router identifier\n") | |
6b0655a2 | 868 | |
718e3744 | 869 | /* BGP Cluster ID. */ |
870 | ||
871 | DEFUN (bgp_cluster_id, | |
872 | bgp_cluster_id_cmd, | |
873 | "bgp cluster-id A.B.C.D", | |
874 | BGP_STR | |
875 | "Configure Route-Reflector Cluster-id\n" | |
876 | "Route-Reflector Cluster-id in IP address format\n") | |
877 | { | |
878 | int ret; | |
879 | struct bgp *bgp; | |
880 | struct in_addr cluster; | |
881 | ||
882 | bgp = vty->index; | |
883 | ||
884 | ret = inet_aton (argv[0], &cluster); | |
885 | if (! ret) | |
886 | { | |
887 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
888 | return CMD_WARNING; | |
889 | } | |
890 | ||
891 | bgp_cluster_id_set (bgp, &cluster); | |
f31fa004 | 892 | bgp_clear_star_soft_out (vty, bgp->name); |
718e3744 | 893 | |
894 | return CMD_SUCCESS; | |
895 | } | |
896 | ||
897 | ALIAS (bgp_cluster_id, | |
898 | bgp_cluster_id32_cmd, | |
899 | "bgp cluster-id <1-4294967295>", | |
900 | BGP_STR | |
901 | "Configure Route-Reflector Cluster-id\n" | |
902 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
903 | ||
904 | DEFUN (no_bgp_cluster_id, | |
905 | no_bgp_cluster_id_cmd, | |
906 | "no bgp cluster-id", | |
907 | NO_STR | |
908 | BGP_STR | |
909 | "Configure Route-Reflector Cluster-id\n") | |
910 | { | |
911 | int ret; | |
912 | struct bgp *bgp; | |
913 | struct in_addr cluster; | |
914 | ||
915 | bgp = vty->index; | |
916 | ||
917 | if (argc == 1) | |
918 | { | |
919 | ret = inet_aton (argv[0], &cluster); | |
920 | if (! ret) | |
921 | { | |
922 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
923 | return CMD_WARNING; | |
924 | } | |
925 | } | |
926 | ||
927 | bgp_cluster_id_unset (bgp); | |
f31fa004 | 928 | bgp_clear_star_soft_out (vty, bgp->name); |
718e3744 | 929 | |
930 | return CMD_SUCCESS; | |
931 | } | |
932 | ||
933 | ALIAS (no_bgp_cluster_id, | |
813d4307 | 934 | no_bgp_cluster_id_ip_cmd, |
718e3744 | 935 | "no bgp cluster-id A.B.C.D", |
936 | NO_STR | |
937 | BGP_STR | |
938 | "Configure Route-Reflector Cluster-id\n" | |
939 | "Route-Reflector Cluster-id in IP address format\n") | |
6b0655a2 | 940 | |
813d4307 DW |
941 | ALIAS (no_bgp_cluster_id, |
942 | no_bgp_cluster_id_decimal_cmd, | |
943 | "no bgp cluster-id <1-4294967295>", | |
944 | NO_STR | |
945 | BGP_STR | |
946 | "Configure Route-Reflector Cluster-id\n" | |
947 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
948 | ||
718e3744 | 949 | DEFUN (bgp_confederation_identifier, |
950 | bgp_confederation_identifier_cmd, | |
320da874 | 951 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 952 | "BGP specific commands\n" |
953 | "AS confederation parameters\n" | |
954 | "AS number\n" | |
955 | "Set routing domain confederation AS\n") | |
956 | { | |
957 | struct bgp *bgp; | |
958 | as_t as; | |
959 | ||
960 | bgp = vty->index; | |
961 | ||
0b2aa3a0 | 962 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 963 | |
964 | bgp_confederation_id_set (bgp, as); | |
965 | ||
966 | return CMD_SUCCESS; | |
967 | } | |
968 | ||
969 | DEFUN (no_bgp_confederation_identifier, | |
970 | no_bgp_confederation_identifier_cmd, | |
971 | "no bgp confederation identifier", | |
972 | NO_STR | |
973 | "BGP specific commands\n" | |
974 | "AS confederation parameters\n" | |
975 | "AS number\n") | |
976 | { | |
977 | struct bgp *bgp; | |
718e3744 | 978 | |
979 | bgp = vty->index; | |
980 | ||
718e3744 | 981 | bgp_confederation_id_unset (bgp); |
982 | ||
983 | return CMD_SUCCESS; | |
984 | } | |
985 | ||
986 | ALIAS (no_bgp_confederation_identifier, | |
987 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 988 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 989 | NO_STR |
990 | "BGP specific commands\n" | |
991 | "AS confederation parameters\n" | |
992 | "AS number\n" | |
993 | "Set routing domain confederation AS\n") | |
6b0655a2 | 994 | |
718e3744 | 995 | DEFUN (bgp_confederation_peers, |
996 | bgp_confederation_peers_cmd, | |
320da874 | 997 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 998 | "BGP specific commands\n" |
999 | "AS confederation parameters\n" | |
1000 | "Peer ASs in BGP confederation\n" | |
1001 | AS_STR) | |
1002 | { | |
1003 | struct bgp *bgp; | |
1004 | as_t as; | |
1005 | int i; | |
1006 | ||
1007 | bgp = vty->index; | |
1008 | ||
1009 | for (i = 0; i < argc; i++) | |
1010 | { | |
0b2aa3a0 | 1011 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 1012 | |
1013 | if (bgp->as == as) | |
1014 | { | |
1015 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
1016 | VTY_NEWLINE); | |
1017 | continue; | |
1018 | } | |
1019 | ||
1020 | bgp_confederation_peers_add (bgp, as); | |
1021 | } | |
1022 | return CMD_SUCCESS; | |
1023 | } | |
1024 | ||
1025 | DEFUN (no_bgp_confederation_peers, | |
1026 | no_bgp_confederation_peers_cmd, | |
320da874 | 1027 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 1028 | NO_STR |
1029 | "BGP specific commands\n" | |
1030 | "AS confederation parameters\n" | |
1031 | "Peer ASs in BGP confederation\n" | |
1032 | AS_STR) | |
1033 | { | |
1034 | struct bgp *bgp; | |
1035 | as_t as; | |
1036 | int i; | |
1037 | ||
1038 | bgp = vty->index; | |
1039 | ||
1040 | for (i = 0; i < argc; i++) | |
1041 | { | |
0b2aa3a0 PJ |
1042 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
1043 | ||
718e3744 | 1044 | bgp_confederation_peers_remove (bgp, as); |
1045 | } | |
1046 | return CMD_SUCCESS; | |
1047 | } | |
6b0655a2 | 1048 | |
5e242b0d DS |
1049 | /** |
1050 | * Central routine for maximum-paths configuration. | |
1051 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
1052 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
1053 | */ | |
ffd0c037 DS |
1054 | static int |
1055 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, | |
5e242b0d | 1056 | u_int16_t options, int set) |
165b5fff JB |
1057 | { |
1058 | struct bgp *bgp; | |
ffd0c037 | 1059 | u_int16_t maxpaths = 0; |
165b5fff | 1060 | int ret; |
5e242b0d DS |
1061 | afi_t afi; |
1062 | safi_t safi; | |
165b5fff JB |
1063 | |
1064 | bgp = vty->index; | |
5e242b0d DS |
1065 | afi = bgp_node_afi (vty); |
1066 | safi = bgp_node_safi (vty); | |
165b5fff | 1067 | |
5e242b0d DS |
1068 | if (set) |
1069 | { | |
73ac8160 | 1070 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
5b964da3 | 1071 | MULTIPATH_NUM); |
5e242b0d DS |
1072 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
1073 | options); | |
1074 | } | |
1075 | else | |
1076 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 1077 | |
165b5fff JB |
1078 | if (ret < 0) |
1079 | { | |
1080 | vty_out (vty, | |
5e242b0d DS |
1081 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
1082 | (set == 1) ? "" : "un", | |
1083 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
1084 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
1085 | return CMD_WARNING; |
1086 | } | |
1087 | ||
7aafcaca DS |
1088 | bgp_recalculate_all_bestpaths (bgp); |
1089 | ||
165b5fff JB |
1090 | return CMD_SUCCESS; |
1091 | } | |
1092 | ||
abc920f8 DS |
1093 | DEFUN (bgp_maxmed_admin, |
1094 | bgp_maxmed_admin_cmd, | |
1095 | "bgp max-med administrative ", | |
1096 | BGP_STR | |
1097 | "Advertise routes with max-med\n" | |
1098 | "Administratively applied, for an indefinite period\n") | |
1099 | { | |
1100 | struct bgp *bgp; | |
1101 | ||
1102 | bgp = vty->index; | |
1103 | ||
1104 | bgp->v_maxmed_admin = 1; | |
1105 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1106 | ||
1107 | bgp_maxmed_update(bgp); | |
1108 | ||
1109 | return CMD_SUCCESS; | |
1110 | } | |
1111 | ||
1112 | DEFUN (bgp_maxmed_admin_medv, | |
1113 | bgp_maxmed_admin_medv_cmd, | |
1114 | "bgp max-med administrative <0-4294967294>", | |
1115 | BGP_STR | |
1116 | "Advertise routes with max-med\n" | |
1117 | "Administratively applied, for an indefinite period\n" | |
1118 | "Max MED value to be used\n") | |
1119 | { | |
1120 | struct bgp *bgp; | |
1121 | ||
1122 | bgp = vty->index; | |
1123 | ||
1124 | bgp->v_maxmed_admin = 1; | |
1125 | VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]); | |
1126 | ||
1127 | bgp_maxmed_update(bgp); | |
1128 | ||
1129 | return CMD_SUCCESS; | |
1130 | } | |
1131 | ||
1132 | DEFUN (no_bgp_maxmed_admin, | |
1133 | no_bgp_maxmed_admin_cmd, | |
1134 | "no bgp max-med administrative", | |
1135 | NO_STR | |
1136 | BGP_STR | |
1137 | "Advertise routes with max-med\n" | |
1138 | "Administratively applied, for an indefinite period\n") | |
1139 | { | |
1140 | struct bgp *bgp; | |
1141 | ||
1142 | bgp = vty->index; | |
1143 | ||
1144 | bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED; | |
1145 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1146 | ||
1147 | bgp_maxmed_update(bgp); | |
1148 | ||
1149 | return CMD_SUCCESS; | |
1150 | } | |
1151 | ||
1152 | ALIAS (no_bgp_maxmed_admin, | |
1153 | no_bgp_maxmed_admin_medv_cmd, | |
1154 | "no bgp max-med administrative <0-4294967294>", | |
1155 | NO_STR | |
1156 | BGP_STR | |
1157 | "Advertise routes with max-med\n" | |
1158 | "Administratively applied, for an indefinite period\n" | |
1159 | "Max MED value to be used\n") | |
1160 | ||
1161 | ||
1162 | DEFUN (bgp_maxmed_onstartup, | |
1163 | bgp_maxmed_onstartup_cmd, | |
1164 | "bgp max-med on-startup <5-86400>", | |
1165 | BGP_STR | |
1166 | "Advertise routes with max-med\n" | |
1167 | "Effective on a startup\n" | |
1168 | "Time (seconds) period for max-med\n") | |
1169 | { | |
1170 | struct bgp *bgp; | |
1171 | ||
1172 | bgp = vty->index; | |
1173 | ||
1174 | if (argc != 1) | |
1175 | { | |
1176 | vty_out (vty, "%% Must supply max-med on-startup period"); | |
1177 | return CMD_WARNING; | |
1178 | } | |
1179 | ||
1180 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1181 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1182 | ||
1183 | bgp_maxmed_update(bgp); | |
1184 | ||
1185 | return CMD_SUCCESS; | |
1186 | } | |
1187 | ||
1188 | DEFUN (bgp_maxmed_onstartup_medv, | |
1189 | bgp_maxmed_onstartup_medv_cmd, | |
1190 | "bgp max-med on-startup <5-86400> <0-4294967294>", | |
1191 | BGP_STR | |
1192 | "Advertise routes with max-med\n" | |
1193 | "Effective on a startup\n" | |
1194 | "Time (seconds) period for max-med\n" | |
1195 | "Max MED value to be used\n") | |
1196 | { | |
1197 | struct bgp *bgp; | |
1198 | ||
1199 | bgp = vty->index; | |
1200 | ||
1201 | if (argc != 2) | |
1202 | { | |
1203 | vty_out (vty, "%% Must supply max-med on-startup period and med value"); | |
1204 | return CMD_WARNING; | |
1205 | } | |
1206 | ||
1207 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1208 | VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]); | |
1209 | ||
1210 | bgp_maxmed_update(bgp); | |
1211 | ||
1212 | return CMD_SUCCESS; | |
1213 | } | |
1214 | ||
1215 | DEFUN (no_bgp_maxmed_onstartup, | |
1216 | no_bgp_maxmed_onstartup_cmd, | |
1217 | "no bgp max-med on-startup", | |
1218 | NO_STR | |
1219 | BGP_STR | |
1220 | "Advertise routes with max-med\n" | |
1221 | "Effective on a startup\n") | |
1222 | { | |
1223 | struct bgp *bgp; | |
1224 | ||
1225 | bgp = vty->index; | |
1226 | ||
1227 | /* Cancel max-med onstartup if its on */ | |
1228 | if (bgp->t_maxmed_onstartup) | |
1229 | { | |
1230 | THREAD_TIMER_OFF (bgp->t_maxmed_onstartup); | |
1231 | bgp->maxmed_onstartup_over = 1; | |
1232 | } | |
1233 | ||
1234 | bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED; | |
1235 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1236 | ||
1237 | bgp_maxmed_update(bgp); | |
1238 | ||
1239 | return CMD_SUCCESS; | |
1240 | } | |
1241 | ||
1242 | ALIAS (no_bgp_maxmed_onstartup, | |
1243 | no_bgp_maxmed_onstartup_period_cmd, | |
1244 | "no bgp max-med on-startup <5-86400>", | |
1245 | NO_STR | |
1246 | BGP_STR | |
1247 | "Advertise routes with max-med\n" | |
1248 | "Effective on a startup\n" | |
1249 | "Time (seconds) period for max-med\n") | |
1250 | ||
1251 | ALIAS (no_bgp_maxmed_onstartup, | |
1252 | no_bgp_maxmed_onstartup_period_medv_cmd, | |
1253 | "no bgp max-med on-startup <5-86400> <0-4294967294>", | |
1254 | NO_STR | |
1255 | BGP_STR | |
1256 | "Advertise routes with max-med\n" | |
1257 | "Effective on a startup\n" | |
1258 | "Time (seconds) period for max-med\n" | |
1259 | "Max MED value to be used\n") | |
1260 | ||
f188f2c4 DS |
1261 | static int |
1262 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
1263 | const char *wait) | |
1264 | { | |
1265 | struct bgp *bgp; | |
1266 | u_int16_t update_delay; | |
1267 | u_int16_t establish_wait; | |
1268 | ||
1269 | ||
1270 | bgp = vty->index; | |
1271 | ||
1272 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
1273 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
1274 | ||
1275 | if (!wait) /* update-delay <delay> */ | |
1276 | { | |
1277 | bgp->v_update_delay = update_delay; | |
1278 | bgp->v_establish_wait = bgp->v_update_delay; | |
1279 | return CMD_SUCCESS; | |
1280 | } | |
1281 | ||
1282 | /* update-delay <delay> <establish-wait> */ | |
1283 | establish_wait = atoi (wait); | |
1284 | if (update_delay < establish_wait) | |
1285 | { | |
1286 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
1287 | VTY_NEWLINE); | |
1288 | return CMD_WARNING; | |
1289 | } | |
1290 | ||
1291 | bgp->v_update_delay = update_delay; | |
1292 | bgp->v_establish_wait = establish_wait; | |
1293 | ||
1294 | return CMD_SUCCESS; | |
1295 | } | |
1296 | ||
1297 | static int | |
1298 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
1299 | { | |
1300 | struct bgp *bgp; | |
1301 | ||
1302 | bgp = vty->index; | |
1303 | ||
1304 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
1305 | bgp->v_establish_wait = bgp->v_update_delay; | |
1306 | ||
1307 | return CMD_SUCCESS; | |
1308 | } | |
1309 | ||
1310 | int | |
1311 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
1312 | { | |
1313 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
1314 | { | |
1315 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
1316 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
1317 | vty_out (vty, " %d", bgp->v_establish_wait); | |
1318 | vty_out (vty, "%s", VTY_NEWLINE); | |
1319 | } | |
1320 | ||
1321 | return 0; | |
1322 | } | |
1323 | ||
1324 | ||
1325 | /* Update-delay configuration */ | |
1326 | DEFUN (bgp_update_delay, | |
1327 | bgp_update_delay_cmd, | |
1328 | "update-delay <0-3600>", | |
1329 | "Force initial delay for best-path and updates\n" | |
1330 | "Seconds\n") | |
1331 | { | |
1332 | return bgp_update_delay_config_vty(vty, argv[0], NULL); | |
1333 | } | |
1334 | ||
1335 | DEFUN (bgp_update_delay_establish_wait, | |
1336 | bgp_update_delay_establish_wait_cmd, | |
1337 | "update-delay <0-3600> <1-3600>", | |
1338 | "Force initial delay for best-path and updates\n" | |
1339 | "Seconds\n" | |
1340 | "Wait for peers to be established\n" | |
1341 | "Seconds\n") | |
1342 | { | |
1343 | return bgp_update_delay_config_vty(vty, argv[0], argv[1]); | |
1344 | } | |
1345 | ||
1346 | /* Update-delay deconfiguration */ | |
1347 | DEFUN (no_bgp_update_delay, | |
1348 | no_bgp_update_delay_cmd, | |
1349 | "no update-delay <0-3600>", | |
1350 | "Force initial delay for best-path and updates\n" | |
1351 | "Seconds\n") | |
1352 | { | |
1353 | return bgp_update_delay_deconfig_vty(vty); | |
1354 | } | |
1355 | ||
1356 | ALIAS (no_bgp_update_delay, | |
1357 | no_bgp_update_delay_establish_wait_cmd, | |
1358 | "no update-delay <0-3600> <1-3600>", | |
1359 | "Force initial delay for best-path and updates\n" | |
1360 | "Seconds\n" | |
1361 | "Wait for peers to be established\n" | |
1362 | "Seconds\n") | |
5e242b0d | 1363 | |
ffd0c037 DS |
1364 | static int |
1365 | bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set) | |
cb1faec9 DS |
1366 | { |
1367 | struct bgp *bgp; | |
cb1faec9 DS |
1368 | |
1369 | bgp = vty->index; | |
1370 | ||
1371 | if (set) | |
1372 | VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num, | |
4543bbb4 | 1373 | 1, 10000); |
cb1faec9 DS |
1374 | else |
1375 | bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX; | |
1376 | ||
1377 | return CMD_SUCCESS; | |
1378 | } | |
1379 | ||
1380 | int | |
1381 | bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) | |
1382 | { | |
1383 | if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX) | |
1384 | vty_out (vty, " write-quanta %d%s", | |
1385 | bgp->wpkt_quanta, VTY_NEWLINE); | |
1386 | ||
1387 | return 0; | |
1388 | } | |
1389 | ||
1390 | ||
1391 | /* Update-delay configuration */ | |
1392 | DEFUN (bgp_wpkt_quanta, | |
1393 | bgp_wpkt_quanta_cmd, | |
4543bbb4 | 1394 | "write-quanta <1-10000>", |
cb1faec9 DS |
1395 | "How many packets to write to peer socket per run\n" |
1396 | "Number of packets\n") | |
1397 | { | |
1398 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 1); | |
1399 | } | |
1400 | ||
1401 | /* Update-delay deconfiguration */ | |
1402 | DEFUN (no_bgp_wpkt_quanta, | |
1403 | no_bgp_wpkt_quanta_cmd, | |
4543bbb4 | 1404 | "no write-quanta <1-10000>", |
cb1faec9 DS |
1405 | "How many packets to write to peer socket per run\n" |
1406 | "Number of packets\n") | |
1407 | { | |
1408 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); | |
1409 | } | |
1410 | ||
ffd0c037 | 1411 | static int |
3f9c7369 DS |
1412 | bgp_coalesce_config_vty (struct vty *vty, const char *num, char set) |
1413 | { | |
1414 | struct bgp *bgp; | |
1415 | ||
1416 | bgp = vty->index; | |
1417 | ||
1418 | if (set) | |
1419 | VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num, | |
1420 | 0, 4294967295); | |
1421 | else | |
1422 | bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; | |
1423 | ||
1424 | return CMD_SUCCESS; | |
1425 | } | |
1426 | ||
1427 | int | |
1428 | bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp) | |
1429 | { | |
1430 | if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME) | |
1431 | vty_out (vty, " coalesce-time %d%s", | |
1432 | bgp->coalesce_time, VTY_NEWLINE); | |
1433 | ||
1434 | return 0; | |
1435 | } | |
1436 | ||
1437 | ||
1438 | DEFUN (bgp_coalesce_time, | |
1439 | bgp_coalesce_time_cmd, | |
1440 | "coalesce-time <0-4294967295>", | |
1441 | "Subgroup coalesce timer\n" | |
1442 | "Subgroup coalesce timer value (in ms)\n") | |
1443 | { | |
1444 | return bgp_coalesce_config_vty(vty, argv[0], 1); | |
1445 | } | |
1446 | ||
1447 | DEFUN (no_bgp_coalesce_time, | |
1448 | no_bgp_coalesce_time_cmd, | |
1449 | "no coalesce-time <0-4294967295>", | |
1450 | "Subgroup coalesce timer\n" | |
1451 | "Subgroup coalesce timer value (in ms)\n") | |
1452 | { | |
1453 | return bgp_coalesce_config_vty(vty, argv[0], 0); | |
1454 | } | |
1455 | ||
5e242b0d DS |
1456 | /* Maximum-paths configuration */ |
1457 | DEFUN (bgp_maxpaths, | |
1458 | bgp_maxpaths_cmd, | |
a565fbdd | 1459 | "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), |
5e242b0d DS |
1460 | "Forward packets over multiple paths\n" |
1461 | "Number of paths\n") | |
1462 | { | |
1463 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); | |
1464 | } | |
1465 | ||
165b5fff JB |
1466 | DEFUN (bgp_maxpaths_ibgp, |
1467 | bgp_maxpaths_ibgp_cmd, | |
a565fbdd | 1468 | "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1469 | "Forward packets over multiple paths\n" |
1470 | "iBGP-multipath\n" | |
1471 | "Number of paths\n") | |
1472 | { | |
5e242b0d DS |
1473 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); |
1474 | } | |
165b5fff | 1475 | |
5e242b0d DS |
1476 | DEFUN (bgp_maxpaths_ibgp_cluster, |
1477 | bgp_maxpaths_ibgp_cluster_cmd, | |
a565fbdd | 1478 | "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", |
5e242b0d DS |
1479 | "Forward packets over multiple paths\n" |
1480 | "iBGP-multipath\n" | |
1481 | "Number of paths\n" | |
1482 | "Match the cluster length\n") | |
1483 | { | |
1484 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], | |
1485 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); | |
165b5fff JB |
1486 | } |
1487 | ||
1488 | DEFUN (no_bgp_maxpaths, | |
1489 | no_bgp_maxpaths_cmd, | |
1490 | "no maximum-paths", | |
1491 | NO_STR | |
1492 | "Forward packets over multiple paths\n" | |
1493 | "Number of paths\n") | |
1494 | { | |
5e242b0d | 1495 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
1496 | } |
1497 | ||
1498 | ALIAS (no_bgp_maxpaths, | |
1499 | no_bgp_maxpaths_arg_cmd, | |
a565fbdd | 1500 | "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1501 | NO_STR |
1502 | "Forward packets over multiple paths\n" | |
1503 | "Number of paths\n") | |
1504 | ||
1505 | DEFUN (no_bgp_maxpaths_ibgp, | |
1506 | no_bgp_maxpaths_ibgp_cmd, | |
1507 | "no maximum-paths ibgp", | |
1508 | NO_STR | |
1509 | "Forward packets over multiple paths\n" | |
1510 | "iBGP-multipath\n" | |
1511 | "Number of paths\n") | |
1512 | { | |
5e242b0d | 1513 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
1514 | } |
1515 | ||
1516 | ALIAS (no_bgp_maxpaths_ibgp, | |
1517 | no_bgp_maxpaths_ibgp_arg_cmd, | |
a565fbdd | 1518 | "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1519 | NO_STR |
1520 | "Forward packets over multiple paths\n" | |
1521 | "iBGP-multipath\n" | |
1522 | "Number of paths\n") | |
1523 | ||
5e242b0d DS |
1524 | ALIAS (no_bgp_maxpaths_ibgp, |
1525 | no_bgp_maxpaths_ibgp_cluster_cmd, | |
a565fbdd | 1526 | "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", |
5e242b0d DS |
1527 | NO_STR |
1528 | "Forward packets over multiple paths\n" | |
1529 | "iBGP-multipath\n" | |
1530 | "Number of paths\n" | |
1531 | "Match the cluster length\n") | |
1532 | ||
165b5fff JB |
1533 | int |
1534 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
1535 | safi_t safi, int *write) | |
1536 | { | |
d5b77cc2 | 1537 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != MULTIPATH_NUM) |
165b5fff JB |
1538 | { |
1539 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1540 | vty_out (vty, " maximum-paths %d%s", |
165b5fff JB |
1541 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); |
1542 | } | |
1543 | ||
d5b77cc2 | 1544 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != MULTIPATH_NUM) |
165b5fff JB |
1545 | { |
1546 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1547 | vty_out (vty, " maximum-paths ibgp %d", |
5e242b0d DS |
1548 | bgp->maxpaths[afi][safi].maxpaths_ibgp); |
1549 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
1550 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
1551 | vty_out (vty, " equal-cluster-length"); | |
1552 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
1553 | } |
1554 | ||
1555 | return 0; | |
1556 | } | |
6b0655a2 | 1557 | |
718e3744 | 1558 | /* BGP timers. */ |
1559 | ||
1560 | DEFUN (bgp_timers, | |
1561 | bgp_timers_cmd, | |
1562 | "timers bgp <0-65535> <0-65535>", | |
1563 | "Adjust routing timers\n" | |
1564 | "BGP timers\n" | |
1565 | "Keepalive interval\n" | |
1566 | "Holdtime\n") | |
1567 | { | |
1568 | struct bgp *bgp; | |
1569 | unsigned long keepalive = 0; | |
1570 | unsigned long holdtime = 0; | |
1571 | ||
1572 | bgp = vty->index; | |
1573 | ||
1574 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
1575 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
1576 | ||
1577 | /* Holdtime value check. */ | |
1578 | if (holdtime < 3 && holdtime != 0) | |
1579 | { | |
1580 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
1581 | VTY_NEWLINE); | |
1582 | return CMD_WARNING; | |
1583 | } | |
1584 | ||
1585 | bgp_timers_set (bgp, keepalive, holdtime); | |
1586 | ||
1587 | return CMD_SUCCESS; | |
1588 | } | |
1589 | ||
1590 | DEFUN (no_bgp_timers, | |
1591 | no_bgp_timers_cmd, | |
1592 | "no timers bgp", | |
1593 | NO_STR | |
1594 | "Adjust routing timers\n" | |
1595 | "BGP timers\n") | |
1596 | { | |
1597 | struct bgp *bgp; | |
1598 | ||
1599 | bgp = vty->index; | |
1600 | bgp_timers_unset (bgp); | |
1601 | ||
1602 | return CMD_SUCCESS; | |
1603 | } | |
1604 | ||
1605 | ALIAS (no_bgp_timers, | |
1606 | no_bgp_timers_arg_cmd, | |
1607 | "no timers bgp <0-65535> <0-65535>", | |
1608 | NO_STR | |
1609 | "Adjust routing timers\n" | |
1610 | "BGP timers\n" | |
1611 | "Keepalive interval\n" | |
1612 | "Holdtime\n") | |
6b0655a2 | 1613 | |
718e3744 | 1614 | DEFUN (bgp_client_to_client_reflection, |
1615 | bgp_client_to_client_reflection_cmd, | |
1616 | "bgp client-to-client reflection", | |
1617 | "BGP specific commands\n" | |
1618 | "Configure client to client route reflection\n" | |
1619 | "reflection of routes allowed\n") | |
1620 | { | |
1621 | struct bgp *bgp; | |
1622 | ||
1623 | bgp = vty->index; | |
1624 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
f31fa004 | 1625 | bgp_clear_star_soft_out (vty, bgp->name); |
7aafcaca | 1626 | |
718e3744 | 1627 | return CMD_SUCCESS; |
1628 | } | |
1629 | ||
1630 | DEFUN (no_bgp_client_to_client_reflection, | |
1631 | no_bgp_client_to_client_reflection_cmd, | |
1632 | "no bgp client-to-client reflection", | |
1633 | NO_STR | |
1634 | "BGP specific commands\n" | |
1635 | "Configure client to client route reflection\n" | |
1636 | "reflection of routes allowed\n") | |
1637 | { | |
1638 | struct bgp *bgp; | |
1639 | ||
1640 | bgp = vty->index; | |
1641 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
f31fa004 | 1642 | bgp_clear_star_soft_out (vty, bgp->name); |
7aafcaca | 1643 | |
718e3744 | 1644 | return CMD_SUCCESS; |
1645 | } | |
1646 | ||
1647 | /* "bgp always-compare-med" configuration. */ | |
1648 | DEFUN (bgp_always_compare_med, | |
1649 | bgp_always_compare_med_cmd, | |
1650 | "bgp always-compare-med", | |
1651 | "BGP specific commands\n" | |
1652 | "Allow comparing MED from different neighbors\n") | |
1653 | { | |
1654 | struct bgp *bgp; | |
1655 | ||
1656 | bgp = vty->index; | |
1657 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1658 | bgp_recalculate_all_bestpaths (bgp); |
1659 | ||
718e3744 | 1660 | return CMD_SUCCESS; |
1661 | } | |
1662 | ||
1663 | DEFUN (no_bgp_always_compare_med, | |
1664 | no_bgp_always_compare_med_cmd, | |
1665 | "no bgp always-compare-med", | |
1666 | NO_STR | |
1667 | "BGP specific commands\n" | |
1668 | "Allow comparing MED from different neighbors\n") | |
1669 | { | |
1670 | struct bgp *bgp; | |
1671 | ||
1672 | bgp = vty->index; | |
1673 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1674 | bgp_recalculate_all_bestpaths (bgp); |
1675 | ||
718e3744 | 1676 | return CMD_SUCCESS; |
1677 | } | |
6b0655a2 | 1678 | |
718e3744 | 1679 | /* "bgp deterministic-med" configuration. */ |
1680 | DEFUN (bgp_deterministic_med, | |
1681 | bgp_deterministic_med_cmd, | |
1682 | "bgp deterministic-med", | |
1683 | "BGP specific commands\n" | |
1684 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1685 | { | |
1686 | struct bgp *bgp; | |
1687 | ||
1688 | bgp = vty->index; | |
1475ac87 DW |
1689 | |
1690 | if (!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1691 | { | |
1692 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1693 | bgp_recalculate_all_bestpaths (bgp); | |
1694 | } | |
7aafcaca | 1695 | |
718e3744 | 1696 | return CMD_SUCCESS; |
1697 | } | |
1698 | ||
1699 | DEFUN (no_bgp_deterministic_med, | |
1700 | no_bgp_deterministic_med_cmd, | |
1701 | "no bgp deterministic-med", | |
1702 | NO_STR | |
1703 | "BGP specific commands\n" | |
1704 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1705 | { | |
1706 | struct bgp *bgp; | |
06370dac DW |
1707 | int bestpath_per_as_used; |
1708 | afi_t afi; | |
1709 | safi_t safi; | |
1710 | struct peer *peer; | |
1711 | struct listnode *node, *nnode; | |
718e3744 | 1712 | |
1713 | bgp = vty->index; | |
1475ac87 DW |
1714 | |
1715 | if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1716 | { | |
06370dac DW |
1717 | bestpath_per_as_used = 0; |
1718 | ||
1719 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
1720 | { | |
1721 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
1722 | for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) | |
1723 | if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) | |
1724 | { | |
1725 | bestpath_per_as_used = 1; | |
1726 | break; | |
1727 | } | |
1728 | ||
1729 | if (bestpath_per_as_used) | |
1730 | break; | |
1731 | } | |
1732 | ||
1733 | if (bestpath_per_as_used) | |
1734 | { | |
1735 | vty_out (vty, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s", | |
1736 | VTY_NEWLINE); | |
1737 | return CMD_WARNING; | |
1738 | } | |
1739 | else | |
1740 | { | |
1741 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1742 | bgp_recalculate_all_bestpaths (bgp); | |
1743 | } | |
1475ac87 | 1744 | } |
7aafcaca | 1745 | |
718e3744 | 1746 | return CMD_SUCCESS; |
1747 | } | |
538621f2 | 1748 | |
1749 | /* "bgp graceful-restart" configuration. */ | |
1750 | DEFUN (bgp_graceful_restart, | |
1751 | bgp_graceful_restart_cmd, | |
1752 | "bgp graceful-restart", | |
1753 | "BGP specific commands\n" | |
1754 | "Graceful restart capability parameters\n") | |
1755 | { | |
1756 | struct bgp *bgp; | |
1757 | ||
1758 | bgp = vty->index; | |
1759 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1760 | return CMD_SUCCESS; | |
1761 | } | |
1762 | ||
1763 | DEFUN (no_bgp_graceful_restart, | |
1764 | no_bgp_graceful_restart_cmd, | |
1765 | "no bgp graceful-restart", | |
1766 | NO_STR | |
1767 | "BGP specific commands\n" | |
1768 | "Graceful restart capability parameters\n") | |
1769 | { | |
1770 | struct bgp *bgp; | |
1771 | ||
1772 | bgp = vty->index; | |
1773 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1774 | return CMD_SUCCESS; | |
1775 | } | |
1776 | ||
93406d87 | 1777 | DEFUN (bgp_graceful_restart_stalepath_time, |
1778 | bgp_graceful_restart_stalepath_time_cmd, | |
1779 | "bgp graceful-restart stalepath-time <1-3600>", | |
1780 | "BGP specific commands\n" | |
1781 | "Graceful restart capability parameters\n" | |
1782 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1783 | "Delay value (seconds)\n") | |
1784 | { | |
1785 | struct bgp *bgp; | |
1786 | u_int32_t stalepath; | |
1787 | ||
1788 | bgp = vty->index; | |
1789 | if (! bgp) | |
1790 | return CMD_WARNING; | |
1791 | ||
1792 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
1793 | bgp->stalepath_time = stalepath; | |
1794 | return CMD_SUCCESS; | |
1795 | } | |
1796 | ||
1797 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
1798 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1799 | "no bgp graceful-restart stalepath-time", | |
1800 | NO_STR | |
1801 | "BGP specific commands\n" | |
1802 | "Graceful restart capability parameters\n" | |
1803 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1804 | { | |
1805 | struct bgp *bgp; | |
1806 | ||
1807 | bgp = vty->index; | |
1808 | if (! bgp) | |
1809 | return CMD_WARNING; | |
1810 | ||
1811 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1812 | return CMD_SUCCESS; | |
1813 | } | |
1814 | ||
1815 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
1816 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
1817 | "no bgp graceful-restart stalepath-time <1-3600>", | |
1818 | NO_STR | |
1819 | "BGP specific commands\n" | |
1820 | "Graceful restart capability parameters\n" | |
1821 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1822 | "Delay value (seconds)\n") | |
1823 | ||
718e3744 | 1824 | /* "bgp fast-external-failover" configuration. */ |
1825 | DEFUN (bgp_fast_external_failover, | |
1826 | bgp_fast_external_failover_cmd, | |
1827 | "bgp fast-external-failover", | |
1828 | BGP_STR | |
1829 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1830 | { | |
1831 | struct bgp *bgp; | |
1832 | ||
1833 | bgp = vty->index; | |
1834 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1835 | return CMD_SUCCESS; | |
1836 | } | |
1837 | ||
1838 | DEFUN (no_bgp_fast_external_failover, | |
1839 | no_bgp_fast_external_failover_cmd, | |
1840 | "no bgp fast-external-failover", | |
1841 | NO_STR | |
1842 | BGP_STR | |
1843 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1844 | { | |
1845 | struct bgp *bgp; | |
1846 | ||
1847 | bgp = vty->index; | |
1848 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1849 | return CMD_SUCCESS; | |
1850 | } | |
6b0655a2 | 1851 | |
718e3744 | 1852 | /* "bgp enforce-first-as" configuration. */ |
1853 | DEFUN (bgp_enforce_first_as, | |
1854 | bgp_enforce_first_as_cmd, | |
1855 | "bgp enforce-first-as", | |
1856 | BGP_STR | |
1857 | "Enforce the first AS for EBGP routes\n") | |
1858 | { | |
1859 | struct bgp *bgp; | |
1860 | ||
1861 | bgp = vty->index; | |
1862 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
f31fa004 | 1863 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 1864 | |
718e3744 | 1865 | return CMD_SUCCESS; |
1866 | } | |
1867 | ||
1868 | DEFUN (no_bgp_enforce_first_as, | |
1869 | no_bgp_enforce_first_as_cmd, | |
1870 | "no bgp enforce-first-as", | |
1871 | NO_STR | |
1872 | BGP_STR | |
1873 | "Enforce the first AS for EBGP routes\n") | |
1874 | { | |
1875 | struct bgp *bgp; | |
1876 | ||
1877 | bgp = vty->index; | |
1878 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
f31fa004 | 1879 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 1880 | |
718e3744 | 1881 | return CMD_SUCCESS; |
1882 | } | |
6b0655a2 | 1883 | |
718e3744 | 1884 | /* "bgp bestpath compare-routerid" configuration. */ |
1885 | DEFUN (bgp_bestpath_compare_router_id, | |
1886 | bgp_bestpath_compare_router_id_cmd, | |
1887 | "bgp bestpath compare-routerid", | |
1888 | "BGP specific commands\n" | |
1889 | "Change the default bestpath selection\n" | |
1890 | "Compare router-id for identical EBGP paths\n") | |
1891 | { | |
1892 | struct bgp *bgp; | |
1893 | ||
1894 | bgp = vty->index; | |
1895 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1896 | bgp_recalculate_all_bestpaths (bgp); |
1897 | ||
718e3744 | 1898 | return CMD_SUCCESS; |
1899 | } | |
1900 | ||
1901 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1902 | no_bgp_bestpath_compare_router_id_cmd, | |
1903 | "no bgp bestpath compare-routerid", | |
1904 | NO_STR | |
1905 | "BGP specific commands\n" | |
1906 | "Change the default bestpath selection\n" | |
1907 | "Compare router-id for identical EBGP paths\n") | |
1908 | { | |
1909 | struct bgp *bgp; | |
1910 | ||
1911 | bgp = vty->index; | |
1912 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1913 | bgp_recalculate_all_bestpaths (bgp); |
1914 | ||
718e3744 | 1915 | return CMD_SUCCESS; |
1916 | } | |
6b0655a2 | 1917 | |
718e3744 | 1918 | /* "bgp bestpath as-path ignore" configuration. */ |
1919 | DEFUN (bgp_bestpath_aspath_ignore, | |
1920 | bgp_bestpath_aspath_ignore_cmd, | |
1921 | "bgp bestpath as-path ignore", | |
1922 | "BGP specific commands\n" | |
1923 | "Change the default bestpath selection\n" | |
1924 | "AS-path attribute\n" | |
1925 | "Ignore as-path length in selecting a route\n") | |
1926 | { | |
1927 | struct bgp *bgp; | |
1928 | ||
1929 | bgp = vty->index; | |
1930 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1931 | bgp_recalculate_all_bestpaths (bgp); |
1932 | ||
718e3744 | 1933 | return CMD_SUCCESS; |
1934 | } | |
1935 | ||
1936 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
1937 | no_bgp_bestpath_aspath_ignore_cmd, | |
1938 | "no bgp bestpath as-path ignore", | |
1939 | NO_STR | |
1940 | "BGP specific commands\n" | |
1941 | "Change the default bestpath selection\n" | |
1942 | "AS-path attribute\n" | |
1943 | "Ignore as-path length in selecting a route\n") | |
1944 | { | |
1945 | struct bgp *bgp; | |
1946 | ||
1947 | bgp = vty->index; | |
1948 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1949 | bgp_recalculate_all_bestpaths (bgp); |
1950 | ||
718e3744 | 1951 | return CMD_SUCCESS; |
1952 | } | |
6b0655a2 | 1953 | |
6811845b | 1954 | /* "bgp bestpath as-path confed" configuration. */ |
1955 | DEFUN (bgp_bestpath_aspath_confed, | |
1956 | bgp_bestpath_aspath_confed_cmd, | |
1957 | "bgp bestpath as-path confed", | |
1958 | "BGP specific commands\n" | |
1959 | "Change the default bestpath selection\n" | |
1960 | "AS-path attribute\n" | |
1961 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1962 | { | |
1963 | struct bgp *bgp; | |
1964 | ||
1965 | bgp = vty->index; | |
1966 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1967 | bgp_recalculate_all_bestpaths (bgp); |
1968 | ||
6811845b | 1969 | return CMD_SUCCESS; |
1970 | } | |
1971 | ||
1972 | DEFUN (no_bgp_bestpath_aspath_confed, | |
1973 | no_bgp_bestpath_aspath_confed_cmd, | |
1974 | "no bgp bestpath as-path confed", | |
1975 | NO_STR | |
1976 | "BGP specific commands\n" | |
1977 | "Change the default bestpath selection\n" | |
1978 | "AS-path attribute\n" | |
1979 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1980 | { | |
1981 | struct bgp *bgp; | |
1982 | ||
1983 | bgp = vty->index; | |
1984 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1985 | bgp_recalculate_all_bestpaths (bgp); |
1986 | ||
6811845b | 1987 | return CMD_SUCCESS; |
1988 | } | |
6b0655a2 | 1989 | |
2fdd455c PM |
1990 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
1991 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
1992 | bgp_bestpath_aspath_multipath_relax_cmd, | |
219178b6 | 1993 | "bgp bestpath as-path multipath-relax {as-set|no-as-set}", |
16fc1eec DS |
1994 | "BGP specific commands\n" |
1995 | "Change the default bestpath selection\n" | |
1996 | "AS-path attribute\n" | |
1997 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
219178b6 | 1998 | "Generate an AS_SET\n" |
16fc1eec DS |
1999 | "Do not generate an AS_SET\n") |
2000 | { | |
2001 | struct bgp *bgp; | |
2002 | ||
2003 | bgp = vty->index; | |
2004 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
219178b6 DW |
2005 | |
2006 | /* no-as-set is now the default behavior so we can silently | |
2007 | * ignore it */ | |
2008 | if (argv[0] != NULL && strncmp (argv[0], "a", 1) == 0) | |
2009 | bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); | |
2010 | else | |
2011 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ; | |
2012 | ||
7aafcaca DS |
2013 | bgp_recalculate_all_bestpaths (bgp); |
2014 | ||
16fc1eec DS |
2015 | return CMD_SUCCESS; |
2016 | } | |
2017 | ||
219178b6 DW |
2018 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, |
2019 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
2020 | "no bgp bestpath as-path multipath-relax {as-set|no-as-set}", | |
16fc1eec DS |
2021 | NO_STR |
2022 | "BGP specific commands\n" | |
2023 | "Change the default bestpath selection\n" | |
2024 | "AS-path attribute\n" | |
2025 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
219178b6 | 2026 | "Generate an AS_SET\n" |
16fc1eec DS |
2027 | "Do not generate an AS_SET\n") |
2028 | { | |
2029 | struct bgp *bgp; | |
2030 | ||
2031 | bgp = vty->index; | |
2032 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
219178b6 | 2033 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); |
7aafcaca DS |
2034 | bgp_recalculate_all_bestpaths (bgp); |
2035 | ||
2fdd455c PM |
2036 | return CMD_SUCCESS; |
2037 | } | |
6b0655a2 | 2038 | |
848973c7 | 2039 | /* "bgp log-neighbor-changes" configuration. */ |
2040 | DEFUN (bgp_log_neighbor_changes, | |
2041 | bgp_log_neighbor_changes_cmd, | |
2042 | "bgp log-neighbor-changes", | |
2043 | "BGP specific commands\n" | |
2044 | "Log neighbor up/down and reset reason\n") | |
2045 | { | |
2046 | struct bgp *bgp; | |
2047 | ||
2048 | bgp = vty->index; | |
2049 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
2050 | return CMD_SUCCESS; | |
2051 | } | |
2052 | ||
2053 | DEFUN (no_bgp_log_neighbor_changes, | |
2054 | no_bgp_log_neighbor_changes_cmd, | |
2055 | "no bgp log-neighbor-changes", | |
2056 | NO_STR | |
2057 | "BGP specific commands\n" | |
2058 | "Log neighbor up/down and reset reason\n") | |
2059 | { | |
2060 | struct bgp *bgp; | |
2061 | ||
2062 | bgp = vty->index; | |
2063 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
2064 | return CMD_SUCCESS; | |
2065 | } | |
6b0655a2 | 2066 | |
718e3744 | 2067 | /* "bgp bestpath med" configuration. */ |
2068 | DEFUN (bgp_bestpath_med, | |
2069 | bgp_bestpath_med_cmd, | |
2070 | "bgp bestpath med (confed|missing-as-worst)", | |
2071 | "BGP specific commands\n" | |
2072 | "Change the default bestpath selection\n" | |
2073 | "MED attribute\n" | |
2074 | "Compare MED among confederation paths\n" | |
2075 | "Treat missing MED as the least preferred one\n") | |
2076 | { | |
2077 | struct bgp *bgp; | |
2078 | ||
2079 | bgp = vty->index; | |
2080 | ||
2081 | if (strncmp (argv[0], "confed", 1) == 0) | |
2082 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2083 | else | |
2084 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2085 | ||
7aafcaca DS |
2086 | bgp_recalculate_all_bestpaths (bgp); |
2087 | ||
718e3744 | 2088 | return CMD_SUCCESS; |
2089 | } | |
2090 | ||
2091 | DEFUN (bgp_bestpath_med2, | |
2092 | bgp_bestpath_med2_cmd, | |
2093 | "bgp bestpath med confed missing-as-worst", | |
2094 | "BGP specific commands\n" | |
2095 | "Change the default bestpath selection\n" | |
2096 | "MED attribute\n" | |
2097 | "Compare MED among confederation paths\n" | |
2098 | "Treat missing MED as the least preferred one\n") | |
2099 | { | |
2100 | struct bgp *bgp; | |
2101 | ||
2102 | bgp = vty->index; | |
2103 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2104 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2105 | bgp_recalculate_all_bestpaths (bgp); |
2106 | ||
718e3744 | 2107 | return CMD_SUCCESS; |
2108 | } | |
2109 | ||
2110 | ALIAS (bgp_bestpath_med2, | |
2111 | bgp_bestpath_med3_cmd, | |
2112 | "bgp bestpath med missing-as-worst confed", | |
2113 | "BGP specific commands\n" | |
2114 | "Change the default bestpath selection\n" | |
2115 | "MED attribute\n" | |
2116 | "Treat missing MED as the least preferred one\n" | |
2117 | "Compare MED among confederation paths\n") | |
2118 | ||
2119 | DEFUN (no_bgp_bestpath_med, | |
2120 | no_bgp_bestpath_med_cmd, | |
2121 | "no bgp bestpath med (confed|missing-as-worst)", | |
2122 | NO_STR | |
2123 | "BGP specific commands\n" | |
2124 | "Change the default bestpath selection\n" | |
2125 | "MED attribute\n" | |
2126 | "Compare MED among confederation paths\n" | |
2127 | "Treat missing MED as the least preferred one\n") | |
2128 | { | |
2129 | struct bgp *bgp; | |
2130 | ||
2131 | bgp = vty->index; | |
2132 | ||
2133 | if (strncmp (argv[0], "confed", 1) == 0) | |
2134 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2135 | else | |
2136 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2137 | ||
7aafcaca DS |
2138 | bgp_recalculate_all_bestpaths (bgp); |
2139 | ||
718e3744 | 2140 | return CMD_SUCCESS; |
2141 | } | |
2142 | ||
2143 | DEFUN (no_bgp_bestpath_med2, | |
2144 | no_bgp_bestpath_med2_cmd, | |
2145 | "no bgp bestpath med confed missing-as-worst", | |
2146 | NO_STR | |
2147 | "BGP specific commands\n" | |
2148 | "Change the default bestpath selection\n" | |
2149 | "MED attribute\n" | |
2150 | "Compare MED among confederation paths\n" | |
2151 | "Treat missing MED as the least preferred one\n") | |
2152 | { | |
2153 | struct bgp *bgp; | |
2154 | ||
2155 | bgp = vty->index; | |
2156 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2157 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2158 | bgp_recalculate_all_bestpaths (bgp); |
2159 | ||
718e3744 | 2160 | return CMD_SUCCESS; |
2161 | } | |
2162 | ||
2163 | ALIAS (no_bgp_bestpath_med2, | |
2164 | no_bgp_bestpath_med3_cmd, | |
2165 | "no bgp bestpath med missing-as-worst confed", | |
2166 | NO_STR | |
2167 | "BGP specific commands\n" | |
2168 | "Change the default bestpath selection\n" | |
2169 | "MED attribute\n" | |
2170 | "Treat missing MED as the least preferred one\n" | |
2171 | "Compare MED among confederation paths\n") | |
6b0655a2 | 2172 | |
718e3744 | 2173 | /* "no bgp default ipv4-unicast". */ |
2174 | DEFUN (no_bgp_default_ipv4_unicast, | |
2175 | no_bgp_default_ipv4_unicast_cmd, | |
2176 | "no bgp default ipv4-unicast", | |
2177 | NO_STR | |
2178 | "BGP specific commands\n" | |
2179 | "Configure BGP defaults\n" | |
2180 | "Activate ipv4-unicast for a peer by default\n") | |
2181 | { | |
2182 | struct bgp *bgp; | |
2183 | ||
2184 | bgp = vty->index; | |
2185 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2186 | return CMD_SUCCESS; | |
2187 | } | |
2188 | ||
2189 | DEFUN (bgp_default_ipv4_unicast, | |
2190 | bgp_default_ipv4_unicast_cmd, | |
2191 | "bgp default ipv4-unicast", | |
2192 | "BGP specific commands\n" | |
2193 | "Configure BGP defaults\n" | |
2194 | "Activate ipv4-unicast for a peer by default\n") | |
2195 | { | |
2196 | struct bgp *bgp; | |
2197 | ||
2198 | bgp = vty->index; | |
2199 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2200 | return CMD_SUCCESS; | |
2201 | } | |
6b0655a2 | 2202 | |
04b6bdc0 DW |
2203 | /* Display hostname in certain command outputs */ |
2204 | DEFUN (bgp_default_show_hostname, | |
2205 | bgp_default_show_hostname_cmd, | |
2206 | "bgp default show-hostname", | |
2207 | "BGP specific commands\n" | |
2208 | "Configure BGP defaults\n" | |
2209 | "Show hostname in certain command ouputs\n") | |
2210 | { | |
2211 | struct bgp *bgp; | |
2212 | ||
2213 | bgp = vty->index; | |
2214 | bgp_flag_set (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2215 | return CMD_SUCCESS; | |
2216 | } | |
2217 | ||
2218 | DEFUN (no_bgp_default_show_hostname, | |
2219 | no_bgp_default_show_hostname_cmd, | |
2220 | "no bgp default show-hostname", | |
2221 | NO_STR | |
2222 | "BGP specific commands\n" | |
2223 | "Configure BGP defaults\n" | |
2224 | "Show hostname in certain command ouputs\n") | |
2225 | { | |
2226 | struct bgp *bgp; | |
2227 | ||
2228 | bgp = vty->index; | |
2229 | bgp_flag_unset (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2230 | return CMD_SUCCESS; | |
2231 | } | |
2232 | ||
8233ef81 | 2233 | /* "bgp network import-check" configuration. */ |
718e3744 | 2234 | DEFUN (bgp_network_import_check, |
2235 | bgp_network_import_check_cmd, | |
5623e905 | 2236 | "bgp network import-check", |
718e3744 | 2237 | "BGP specific commands\n" |
2238 | "BGP network command\n" | |
5623e905 | 2239 | "Check BGP network route exists in IGP\n") |
718e3744 | 2240 | { |
2241 | struct bgp *bgp; | |
2242 | ||
2243 | bgp = vty->index; | |
078430f6 DS |
2244 | if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2245 | { | |
2246 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
5623e905 | 2247 | bgp_static_redo_import_check(bgp); |
078430f6 DS |
2248 | } |
2249 | ||
718e3744 | 2250 | return CMD_SUCCESS; |
2251 | } | |
2252 | ||
8233ef81 DW |
2253 | ALIAS_HIDDEN (bgp_network_import_check, |
2254 | bgp_network_import_check_exact_cmd, | |
2255 | "bgp network import-check exact", | |
2256 | "BGP specific commands\n" | |
2257 | "BGP network command\n" | |
2258 | "Check BGP network route exists in IGP\n" | |
2259 | "Match route precisely\n") | |
2260 | ||
718e3744 | 2261 | DEFUN (no_bgp_network_import_check, |
2262 | no_bgp_network_import_check_cmd, | |
5623e905 | 2263 | "no bgp network import-check", |
718e3744 | 2264 | NO_STR |
2265 | "BGP specific commands\n" | |
2266 | "BGP network command\n" | |
2267 | "Check BGP network route exists in IGP\n") | |
2268 | { | |
2269 | struct bgp *bgp; | |
2270 | ||
2271 | bgp = vty->index; | |
078430f6 DS |
2272 | if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2273 | { | |
2274 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
078430f6 DS |
2275 | bgp_static_redo_import_check(bgp); |
2276 | } | |
5623e905 | 2277 | |
718e3744 | 2278 | return CMD_SUCCESS; |
2279 | } | |
6b0655a2 | 2280 | |
718e3744 | 2281 | DEFUN (bgp_default_local_preference, |
2282 | bgp_default_local_preference_cmd, | |
2283 | "bgp default local-preference <0-4294967295>", | |
2284 | "BGP specific commands\n" | |
2285 | "Configure BGP defaults\n" | |
2286 | "local preference (higher=more preferred)\n" | |
2287 | "Configure default local preference value\n") | |
2288 | { | |
2289 | struct bgp *bgp; | |
2290 | u_int32_t local_pref; | |
2291 | ||
2292 | bgp = vty->index; | |
2293 | ||
2294 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
2295 | ||
2296 | bgp_default_local_preference_set (bgp, local_pref); | |
f31fa004 | 2297 | bgp_clear_star_soft_in (vty, bgp->name); |
718e3744 | 2298 | |
2299 | return CMD_SUCCESS; | |
2300 | } | |
2301 | ||
2302 | DEFUN (no_bgp_default_local_preference, | |
2303 | no_bgp_default_local_preference_cmd, | |
2304 | "no bgp default local-preference", | |
2305 | NO_STR | |
2306 | "BGP specific commands\n" | |
2307 | "Configure BGP defaults\n" | |
2308 | "local preference (higher=more preferred)\n") | |
2309 | { | |
2310 | struct bgp *bgp; | |
2311 | ||
2312 | bgp = vty->index; | |
2313 | bgp_default_local_preference_unset (bgp); | |
f31fa004 | 2314 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 2315 | |
718e3744 | 2316 | return CMD_SUCCESS; |
2317 | } | |
2318 | ||
2319 | ALIAS (no_bgp_default_local_preference, | |
2320 | no_bgp_default_local_preference_val_cmd, | |
2321 | "no bgp default local-preference <0-4294967295>", | |
2322 | NO_STR | |
2323 | "BGP specific commands\n" | |
2324 | "Configure BGP defaults\n" | |
2325 | "local preference (higher=more preferred)\n" | |
2326 | "Configure default local preference value\n") | |
6b0655a2 | 2327 | |
3f9c7369 DS |
2328 | DEFUN (bgp_default_subgroup_pkt_queue_max, |
2329 | bgp_default_subgroup_pkt_queue_max_cmd, | |
2330 | "bgp default subgroup-pkt-queue-max <20-100>", | |
2331 | "BGP specific commands\n" | |
2332 | "Configure BGP defaults\n" | |
2333 | "subgroup-pkt-queue-max\n" | |
2334 | "Configure subgroup packet queue max\n") | |
8bd9d948 | 2335 | { |
3f9c7369 DS |
2336 | struct bgp *bgp; |
2337 | u_int32_t max_size; | |
8bd9d948 | 2338 | |
3f9c7369 DS |
2339 | bgp = vty->index; |
2340 | ||
2341 | VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]); | |
2342 | ||
2343 | bgp_default_subgroup_pkt_queue_max_set (bgp, max_size); | |
2344 | ||
2345 | return CMD_SUCCESS; | |
2346 | } | |
2347 | ||
2348 | DEFUN (no_bgp_default_subgroup_pkt_queue_max, | |
2349 | no_bgp_default_subgroup_pkt_queue_max_cmd, | |
2350 | "no bgp default subgroup-pkt-queue-max", | |
2351 | NO_STR | |
2352 | "BGP specific commands\n" | |
2353 | "Configure BGP defaults\n" | |
2354 | "subgroup-pkt-queue-max\n") | |
2355 | { | |
2356 | struct bgp *bgp; | |
2357 | ||
2358 | bgp = vty->index; | |
2359 | bgp_default_subgroup_pkt_queue_max_unset (bgp); | |
2360 | return CMD_SUCCESS; | |
8bd9d948 DS |
2361 | } |
2362 | ||
813d4307 DW |
2363 | ALIAS (no_bgp_default_subgroup_pkt_queue_max, |
2364 | no_bgp_default_subgroup_pkt_queue_max_val_cmd, | |
2365 | "no bgp default subgroup-pkt-queue-max <20-100>", | |
2366 | NO_STR | |
2367 | "BGP specific commands\n" | |
2368 | "Configure BGP defaults\n" | |
2369 | "subgroup-pkt-queue-max\n" | |
2370 | "Configure subgroup packet queue max\n") | |
2371 | ||
8bd9d948 DS |
2372 | DEFUN (bgp_rr_allow_outbound_policy, |
2373 | bgp_rr_allow_outbound_policy_cmd, | |
2374 | "bgp route-reflector allow-outbound-policy", | |
2375 | "BGP specific commands\n" | |
2376 | "Allow modifications made by out route-map\n" | |
2377 | "on ibgp neighbors\n") | |
2378 | { | |
2379 | struct bgp *bgp; | |
8bd9d948 DS |
2380 | |
2381 | bgp = vty->index; | |
2382 | ||
2383 | if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2384 | { | |
2385 | bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2386 | update_group_announce_rrclients(bgp); |
f31fa004 | 2387 | bgp_clear_star_soft_out (vty, bgp->name); |
8bd9d948 DS |
2388 | } |
2389 | ||
2390 | return CMD_SUCCESS; | |
2391 | } | |
2392 | ||
2393 | DEFUN (no_bgp_rr_allow_outbound_policy, | |
2394 | no_bgp_rr_allow_outbound_policy_cmd, | |
2395 | "no bgp route-reflector allow-outbound-policy", | |
2396 | NO_STR | |
2397 | "BGP specific commands\n" | |
2398 | "Allow modifications made by out route-map\n" | |
2399 | "on ibgp neighbors\n") | |
2400 | { | |
2401 | struct bgp *bgp; | |
8bd9d948 DS |
2402 | |
2403 | bgp = vty->index; | |
2404 | ||
2405 | if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2406 | { | |
2407 | bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2408 | update_group_announce_rrclients(bgp); |
f31fa004 | 2409 | bgp_clear_star_soft_out (vty, bgp->name); |
8bd9d948 DS |
2410 | } |
2411 | ||
2412 | return CMD_SUCCESS; | |
2413 | } | |
2414 | ||
f14e6fdb DS |
2415 | DEFUN (bgp_listen_limit, |
2416 | bgp_listen_limit_cmd, | |
2417 | "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2418 | "BGP specific commands\n" | |
2419 | "Configure BGP defaults\n" | |
2420 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2421 | "Configure Dynamic Neighbors listen limit value\n") | |
2422 | { | |
2423 | struct bgp *bgp; | |
2424 | int listen_limit; | |
2425 | ||
2426 | bgp = vty->index; | |
2427 | ||
2428 | VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0], | |
2429 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN, | |
2430 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX); | |
2431 | ||
2432 | bgp_listen_limit_set (bgp, listen_limit); | |
2433 | ||
2434 | return CMD_SUCCESS; | |
2435 | } | |
2436 | ||
2437 | DEFUN (no_bgp_listen_limit, | |
2438 | no_bgp_listen_limit_cmd, | |
2439 | "no bgp listen limit", | |
2440 | "BGP specific commands\n" | |
2441 | "Configure BGP defaults\n" | |
2442 | "unset maximum number of BGP Dynamic Neighbors that can be created\n" | |
2443 | "Configure Dynamic Neighbors listen limit value to default\n") | |
2444 | { | |
2445 | struct bgp *bgp; | |
2446 | ||
2447 | bgp = vty->index; | |
2448 | bgp_listen_limit_unset (bgp); | |
2449 | return CMD_SUCCESS; | |
2450 | } | |
2451 | ||
813d4307 DW |
2452 | ALIAS (no_bgp_listen_limit, |
2453 | no_bgp_listen_limit_val_cmd, | |
2454 | "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2455 | NO_STR | |
2456 | "BGP specific commands\n" | |
2457 | "Configure BGP defaults\n" | |
2458 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2459 | "Configure Dynamic Neighbors listen limit value\n") | |
f14e6fdb | 2460 | |
20eb8864 | 2461 | /* |
2462 | * Check if this listen range is already configured. Check for exact | |
2463 | * match or overlap based on input. | |
2464 | */ | |
2465 | static struct peer_group * | |
2466 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact) | |
2467 | { | |
2468 | struct listnode *node, *nnode; | |
2469 | struct listnode *node1, *nnode1; | |
2470 | struct peer_group *group; | |
2471 | struct prefix *lr; | |
2472 | afi_t afi; | |
2473 | int match; | |
2474 | ||
2475 | afi = family2afi(range->family); | |
2476 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2477 | { | |
2478 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node1, | |
2479 | nnode1, lr)) | |
2480 | { | |
2481 | if (exact) | |
2482 | match = prefix_same (range, lr); | |
2483 | else | |
2484 | match = (prefix_match (range, lr) || prefix_match (lr, range)); | |
2485 | if (match) | |
2486 | return group; | |
2487 | } | |
2488 | } | |
2489 | ||
2490 | return NULL; | |
2491 | } | |
2492 | ||
f14e6fdb DS |
2493 | DEFUN (bgp_listen_range, |
2494 | bgp_listen_range_cmd, | |
2495 | LISTEN_RANGE_CMD "peer-group WORD" , | |
2496 | "BGP specific commands\n" | |
2497 | "Configure BGP Dynamic Neighbors\n" | |
2498 | "add a listening range for Dynamic Neighbors\n" | |
2499 | LISTEN_RANGE_ADDR_STR) | |
2500 | { | |
2501 | struct bgp *bgp; | |
2502 | struct prefix range; | |
20eb8864 | 2503 | struct peer_group *group, *existing_group; |
f14e6fdb DS |
2504 | afi_t afi; |
2505 | int ret; | |
2506 | ||
2507 | bgp = vty->index; | |
2508 | ||
2509 | //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2510 | ||
2511 | /* Convert IP prefix string to struct prefix. */ | |
2512 | ret = str2prefix (argv[0], &range); | |
2513 | if (! ret) | |
2514 | { | |
2515 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2516 | return CMD_WARNING; | |
2517 | } | |
2518 | ||
2519 | afi = family2afi(range.family); | |
2520 | ||
2521 | #ifdef HAVE_IPV6 | |
2522 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2523 | { | |
2524 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2525 | VTY_NEWLINE); | |
2526 | return CMD_WARNING; | |
2527 | } | |
2528 | #endif /* HAVE_IPV6 */ | |
2529 | ||
2530 | apply_mask (&range); | |
2531 | ||
20eb8864 | 2532 | /* Check if same listen range is already configured. */ |
2533 | existing_group = listen_range_exists (bgp, &range, 1); | |
2534 | if (existing_group) | |
2535 | { | |
2536 | if (strcmp (existing_group->name, argv[1]) == 0) | |
2537 | return CMD_SUCCESS; | |
2538 | else | |
2539 | { | |
2540 | vty_out (vty, "%% Same listen range is attached to peer-group %s%s", | |
2541 | existing_group->name, VTY_NEWLINE); | |
2542 | return CMD_WARNING; | |
2543 | } | |
2544 | } | |
2545 | ||
2546 | /* Check if an overlapping listen range exists. */ | |
2547 | if (listen_range_exists (bgp, &range, 0)) | |
2548 | { | |
2549 | vty_out (vty, "%% Listen range overlaps with existing listen range%s", | |
2550 | VTY_NEWLINE); | |
2551 | return CMD_WARNING; | |
2552 | } | |
f14e6fdb DS |
2553 | |
2554 | group = peer_group_lookup (bgp, argv[1]); | |
2555 | if (! group) | |
2556 | { | |
2557 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2558 | return CMD_WARNING; | |
2559 | } | |
2560 | ||
2561 | ret = peer_group_listen_range_add(group, &range); | |
2562 | return bgp_vty_return (vty, ret); | |
2563 | } | |
2564 | ||
2565 | DEFUN (no_bgp_listen_range, | |
2566 | no_bgp_listen_range_cmd, | |
2567 | "no bgp listen range A.B.C.D/M peer-group WORD" , | |
2568 | "BGP specific commands\n" | |
2569 | "Configure BGP defaults\n" | |
2570 | "delete a listening range for Dynamic Neighbors\n" | |
2571 | "Remove Dynamic Neighbors listening range\n") | |
2572 | { | |
2573 | struct bgp *bgp; | |
2574 | struct prefix range; | |
2575 | struct peer_group *group; | |
2576 | afi_t afi; | |
2577 | int ret; | |
2578 | ||
2579 | bgp = vty->index; | |
2580 | ||
2581 | // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2582 | ||
2583 | /* Convert IP prefix string to struct prefix. */ | |
2584 | ret = str2prefix (argv[0], &range); | |
2585 | if (! ret) | |
2586 | { | |
2587 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2588 | return CMD_WARNING; | |
2589 | } | |
2590 | ||
2591 | afi = family2afi(range.family); | |
2592 | ||
2593 | #ifdef HAVE_IPV6 | |
2594 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2595 | { | |
2596 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2597 | VTY_NEWLINE); | |
2598 | return CMD_WARNING; | |
2599 | } | |
2600 | #endif /* HAVE_IPV6 */ | |
2601 | ||
2602 | apply_mask (&range); | |
2603 | ||
2604 | ||
2605 | group = peer_group_lookup (bgp, argv[1]); | |
2606 | if (! group) | |
2607 | { | |
2608 | vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); | |
2609 | return CMD_WARNING; | |
2610 | } | |
2611 | ||
2612 | ret = peer_group_listen_range_del(group, &range); | |
2613 | return bgp_vty_return (vty, ret); | |
2614 | } | |
2615 | ||
2616 | int | |
2617 | bgp_config_write_listen (struct vty *vty, struct bgp *bgp) | |
2618 | { | |
2619 | struct peer_group *group; | |
2620 | struct listnode *node, *nnode, *rnode, *nrnode; | |
2621 | struct prefix *range; | |
2622 | afi_t afi; | |
4690c7d7 | 2623 | char buf[PREFIX2STR_BUFFER]; |
f14e6fdb DS |
2624 | |
2625 | if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT) | |
2626 | vty_out (vty, " bgp listen limit %d%s", | |
2627 | bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
2628 | ||
2629 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2630 | { | |
2631 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
2632 | { | |
2633 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range)) | |
2634 | { | |
2635 | prefix2str(range, buf, sizeof(buf)); | |
2636 | vty_out(vty, " bgp listen range %s peer-group %s%s", | |
2637 | buf, group->name, VTY_NEWLINE); | |
2638 | } | |
2639 | } | |
2640 | } | |
2641 | ||
2642 | return 0; | |
2643 | } | |
2644 | ||
2645 | ||
907f92c8 DS |
2646 | DEFUN (bgp_disable_connected_route_check, |
2647 | bgp_disable_connected_route_check_cmd, | |
2648 | "bgp disable-ebgp-connected-route-check", | |
2649 | "BGP specific commands\n" | |
2650 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2651 | { | |
2652 | struct bgp *bgp; | |
2653 | ||
2654 | bgp = vty->index; | |
2655 | bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
f31fa004 | 2656 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 2657 | |
907f92c8 DS |
2658 | return CMD_SUCCESS; |
2659 | } | |
2660 | ||
2661 | DEFUN (no_bgp_disable_connected_route_check, | |
2662 | no_bgp_disable_connected_route_check_cmd, | |
2663 | "no bgp disable-ebgp-connected-route-check", | |
2664 | NO_STR | |
2665 | "BGP specific commands\n" | |
2666 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2667 | { | |
2668 | struct bgp *bgp; | |
2669 | ||
2670 | bgp = vty->index; | |
2671 | bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
f31fa004 | 2672 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 2673 | |
907f92c8 DS |
2674 | return CMD_SUCCESS; |
2675 | } | |
2676 | ||
2677 | ||
718e3744 | 2678 | static int |
fd79ac91 | 2679 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
2680 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 2681 | { |
2682 | int ret; | |
2683 | struct bgp *bgp; | |
2684 | as_t as; | |
0299c004 | 2685 | int as_type = AS_SPECIFIED; |
718e3744 | 2686 | union sockunion su; |
2687 | ||
2688 | bgp = vty->index; | |
2689 | ||
0299c004 DS |
2690 | if (strncmp(as_str, "internal", strlen("internal")) == 0) |
2691 | { | |
2692 | as = 0; | |
2693 | as_type = AS_INTERNAL; | |
2694 | } | |
2695 | else if (strncmp(as_str, "external", strlen("external")) == 0) | |
2696 | { | |
2697 | as = 0; | |
2698 | as_type = AS_EXTERNAL; | |
2699 | } | |
2700 | else | |
2701 | { | |
2702 | /* Get AS number. */ | |
2703 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); | |
2704 | } | |
718e3744 | 2705 | |
2706 | /* If peer is peer group, call proper function. */ | |
2707 | ret = str2sockunion (peer_str, &su); | |
2708 | if (ret < 0) | |
2709 | { | |
a80beece | 2710 | /* Check for peer by interface */ |
0299c004 | 2711 | ret = peer_remote_as (bgp, NULL, peer_str, &as, as_type, afi, safi); |
718e3744 | 2712 | if (ret < 0) |
a80beece | 2713 | { |
0299c004 | 2714 | ret = peer_group_remote_as (bgp, peer_str, &as, as_type); |
a80beece DS |
2715 | if (ret < 0) |
2716 | { | |
2717 | vty_out (vty, "%% Create the peer-group or interface first%s", | |
2718 | VTY_NEWLINE); | |
2719 | return CMD_WARNING; | |
2720 | } | |
2721 | return CMD_SUCCESS; | |
2722 | } | |
718e3744 | 2723 | } |
a80beece | 2724 | else |
718e3744 | 2725 | { |
6aeb9e78 | 2726 | if (peer_address_self_check (bgp, &su)) |
a80beece DS |
2727 | { |
2728 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2729 | VTY_NEWLINE); | |
2730 | return CMD_WARNING; | |
2731 | } | |
0299c004 | 2732 | ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi); |
718e3744 | 2733 | } |
2734 | ||
718e3744 | 2735 | /* This peer belongs to peer group. */ |
2736 | switch (ret) | |
2737 | { | |
2738 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 2739 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 2740 | return CMD_WARNING; |
718e3744 | 2741 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 2742 | 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 | 2743 | return CMD_WARNING; |
718e3744 | 2744 | } |
2745 | return bgp_vty_return (vty, ret); | |
2746 | } | |
2747 | ||
2748 | DEFUN (neighbor_remote_as, | |
2749 | neighbor_remote_as_cmd, | |
0299c004 | 2750 | NEIGHBOR_CMD2 "remote-as (" CMD_AS_RANGE "|external|internal)", |
718e3744 | 2751 | NEIGHBOR_STR |
2752 | NEIGHBOR_ADDR_STR2 | |
2753 | "Specify a BGP neighbor\n" | |
2754 | AS_STR) | |
2755 | { | |
2756 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
2757 | } | |
6b0655a2 | 2758 | |
4c48cf63 DW |
2759 | static int |
2760 | peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, | |
b3a39dc5 DD |
2761 | safi_t safi, int v6only, const char *peer_group_name, |
2762 | const char *as_str) | |
a80beece | 2763 | { |
b3a39dc5 DD |
2764 | as_t as = 0; |
2765 | int as_type = AS_UNSPECIFIED; | |
a80beece DS |
2766 | struct bgp *bgp; |
2767 | struct peer *peer; | |
2768 | struct peer_group *group; | |
4c48cf63 DW |
2769 | int ret = 0; |
2770 | union sockunion su; | |
a80beece DS |
2771 | |
2772 | bgp = vty->index; | |
4c48cf63 DW |
2773 | group = peer_group_lookup (bgp, conf_if); |
2774 | ||
a80beece DS |
2775 | if (group) |
2776 | { | |
2777 | vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE); | |
2778 | return CMD_WARNING; | |
2779 | } | |
2780 | ||
b3a39dc5 DD |
2781 | if (as_str) |
2782 | { | |
2783 | if (strncmp(as_str, "internal", strlen("internal")) == 0) | |
2784 | { | |
2785 | as_type = AS_INTERNAL; | |
2786 | } | |
2787 | else if (strncmp(as_str, "external", strlen("external")) == 0) | |
2788 | { | |
2789 | as_type = AS_EXTERNAL; | |
2790 | } | |
2791 | else | |
2792 | { | |
2793 | /* Get AS number. */ | |
2794 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); | |
2795 | as_type = AS_SPECIFIED; | |
2796 | } | |
2797 | } | |
2798 | ||
4c48cf63 DW |
2799 | peer = peer_lookup_by_conf_if (bgp, conf_if); |
2800 | if (!peer) | |
2801 | { | |
2802 | if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4) | |
2803 | && afi == AFI_IP && safi == SAFI_UNICAST) | |
b3a39dc5 DD |
2804 | peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, 0, 0, |
2805 | NULL); | |
4c48cf63 | 2806 | else |
b3a39dc5 DD |
2807 | peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, afi, safi, |
2808 | NULL); | |
4c48cf63 DW |
2809 | |
2810 | if (peer && v6only) | |
2811 | SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
4a04e5f7 | 2812 | |
2813 | /* Request zebra to initiate IPv6 RAs on this interface. We do this | |
2814 | * any unnumbered peer in order to not worry about run-time transitions | |
2815 | * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address | |
2816 | * gets deleted later etc.) | |
2817 | */ | |
2818 | if (peer->ifp) | |
b3a39dc5 DD |
2819 | { |
2820 | bgp_zebra_initiate_radv (bgp, peer); | |
2821 | } | |
2822 | peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE); | |
4c48cf63 DW |
2823 | } |
2824 | else if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) || | |
2825 | (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))) | |
2826 | { | |
2827 | if (v6only) | |
2828 | SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
2829 | else | |
2830 | UNSET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
2831 | ||
2832 | /* v6only flag changed. Reset bgp seesion */ | |
2833 | if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) | |
2834 | { | |
2835 | peer->last_reset = PEER_DOWN_V6ONLY_CHANGE; | |
2836 | bgp_notify_send (peer, BGP_NOTIFY_CEASE, | |
2837 | BGP_NOTIFY_CEASE_CONFIG_CHANGE); | |
2838 | } | |
2839 | else | |
2840 | bgp_session_reset(peer); | |
2841 | } | |
2842 | ||
a80beece DS |
2843 | if (!peer) |
2844 | return CMD_WARNING; | |
2845 | ||
4c48cf63 DW |
2846 | if (peer_group_name) |
2847 | { | |
2848 | group = peer_group_lookup (bgp, peer_group_name); | |
2849 | if (! group) | |
2850 | { | |
2851 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2852 | return CMD_WARNING; | |
2853 | } | |
2854 | ||
2855 | ret = peer_group_bind (bgp, &su, peer, group, &as); | |
2856 | } | |
2857 | ||
2858 | return bgp_vty_return (vty, ret); | |
a80beece DS |
2859 | } |
2860 | ||
4c48cf63 DW |
2861 | DEFUN (neighbor_interface_config, |
2862 | neighbor_interface_config_cmd, | |
2863 | "neighbor WORD interface", | |
2864 | NEIGHBOR_STR | |
2865 | "Interface name or neighbor tag\n" | |
2866 | "Enable BGP on interface\n") | |
2867 | { | |
2868 | if (argc == 2) | |
b3a39dc5 DD |
2869 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, |
2870 | argv[1], NULL); | |
4c48cf63 | 2871 | else |
b3a39dc5 DD |
2872 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, |
2873 | NULL, NULL); | |
4c48cf63 DW |
2874 | } |
2875 | ||
2876 | ALIAS (neighbor_interface_config, | |
2877 | neighbor_interface_config_peergroup_cmd, | |
2878 | "neighbor WORD interface peer-group WORD", | |
2879 | NEIGHBOR_STR | |
2880 | "Interface name or neighbor tag\n" | |
2881 | "Enable BGP on interface\n" | |
2882 | "Member of the peer-group\n" | |
2883 | "peer-group name\n") | |
2884 | ||
2885 | DEFUN (neighbor_interface_config_v6only, | |
2886 | neighbor_interface_config_v6only_cmd, | |
2887 | "neighbor WORD interface v6only", | |
2888 | NEIGHBOR_STR | |
2889 | "Interface name or neighbor tag\n" | |
2890 | "Enable BGP on interface\n" | |
2891 | "Enable BGP with v6 link-local only\n") | |
2892 | { | |
2893 | if (argc == 2) | |
b3a39dc5 DD |
2894 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, |
2895 | argv[1], NULL); | |
4c48cf63 | 2896 | else |
b3a39dc5 DD |
2897 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, |
2898 | NULL, NULL); | |
4c48cf63 DW |
2899 | } |
2900 | ||
2901 | ALIAS (neighbor_interface_config_v6only, | |
2902 | neighbor_interface_config_v6only_peergroup_cmd, | |
2903 | "neighbor WORD interface v6only peer-group WORD", | |
2904 | NEIGHBOR_STR | |
2905 | "Interface name or neighbor tag\n" | |
2906 | "Enable BGP on interface\n" | |
2907 | "Enable BGP with v6 link-local only\n" | |
2908 | "Member of the peer-group\n" | |
2909 | "peer-group name\n") | |
a80beece | 2910 | |
b3a39dc5 DD |
2911 | DEFUN (neighbor_interface_config_remote_as, |
2912 | neighbor_interface_config_remote_as_cmd, | |
2913 | "neighbor WORD interface remote-as (" CMD_AS_RANGE "|external|internal)", | |
2914 | NEIGHBOR_STR | |
2915 | "Interface name or neighbor tag\n" | |
2916 | "Enable BGP on interface\n" | |
2917 | AS_STR) | |
2918 | { | |
2919 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, | |
2920 | NULL, argv[1]); | |
2921 | } | |
2922 | ||
2923 | DEFUN (neighbor_interface_v6only_config_remote_as, | |
2924 | neighbor_interface_v6only_config_remote_as_cmd, | |
2925 | "neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|external|internal)", | |
2926 | NEIGHBOR_STR | |
2927 | "Interface name or neighbor tag\n" | |
2928 | "Enable BGP on interface\n" | |
2929 | AS_STR) | |
2930 | { | |
2931 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, | |
2932 | NULL, argv[1]); | |
2933 | } | |
2934 | ||
718e3744 | 2935 | DEFUN (neighbor_peer_group, |
2936 | neighbor_peer_group_cmd, | |
2937 | "neighbor WORD peer-group", | |
2938 | NEIGHBOR_STR | |
a80beece | 2939 | "Interface name or neighbor tag\n" |
718e3744 | 2940 | "Configure peer-group\n") |
2941 | { | |
2942 | struct bgp *bgp; | |
a80beece | 2943 | struct peer *peer; |
718e3744 | 2944 | struct peer_group *group; |
2945 | ||
2946 | bgp = vty->index; | |
a80beece DS |
2947 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2948 | if (peer) | |
2949 | { | |
2950 | vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); | |
2951 | return CMD_WARNING; | |
2952 | } | |
718e3744 | 2953 | |
2954 | group = peer_group_get (bgp, argv[0]); | |
2955 | if (! group) | |
2956 | return CMD_WARNING; | |
2957 | ||
2958 | return CMD_SUCCESS; | |
2959 | } | |
2960 | ||
2961 | DEFUN (no_neighbor, | |
2962 | no_neighbor_cmd, | |
2963 | NO_NEIGHBOR_CMD2, | |
2964 | NO_STR | |
2965 | NEIGHBOR_STR | |
2966 | NEIGHBOR_ADDR_STR2) | |
2967 | { | |
2968 | int ret; | |
2969 | union sockunion su; | |
2970 | struct peer_group *group; | |
2971 | struct peer *peer; | |
1ff9a340 | 2972 | struct peer *other; |
718e3744 | 2973 | |
2974 | ret = str2sockunion (argv[0], &su); | |
2975 | if (ret < 0) | |
2976 | { | |
a80beece DS |
2977 | /* look up for neighbor by interface name config. */ |
2978 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2979 | if (peer) | |
2980 | { | |
4a04e5f7 | 2981 | /* Request zebra to terminate IPv6 RAs on this interface. */ |
2982 | if (peer->ifp) | |
2983 | bgp_zebra_terminate_radv (peer->bgp, peer); | |
a80beece DS |
2984 | peer_delete (peer); |
2985 | return CMD_SUCCESS; | |
2986 | } | |
2987 | ||
718e3744 | 2988 | group = peer_group_lookup (vty->index, argv[0]); |
2989 | if (group) | |
2990 | peer_group_delete (group); | |
2991 | else | |
2992 | { | |
2993 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2994 | return CMD_WARNING; | |
2995 | } | |
2996 | } | |
2997 | else | |
2998 | { | |
2999 | peer = peer_lookup (vty->index, &su); | |
3000 | if (peer) | |
1ff9a340 | 3001 | { |
f14e6fdb DS |
3002 | if (peer_dynamic_neighbor (peer)) |
3003 | { | |
3004 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
3005 | VTY_NEWLINE); | |
3006 | return CMD_WARNING; | |
3007 | } | |
3008 | ||
1ff9a340 DS |
3009 | other = peer->doppelganger; |
3010 | peer_delete (peer); | |
3011 | if (other && other->status != Deleted) | |
3012 | peer_delete(other); | |
3013 | } | |
718e3744 | 3014 | } |
3015 | ||
3016 | return CMD_SUCCESS; | |
3017 | } | |
3018 | ||
3019 | ALIAS (no_neighbor, | |
3020 | no_neighbor_remote_as_cmd, | |
0299c004 | 3021 | NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 3022 | NO_STR |
3023 | NEIGHBOR_STR | |
3024 | NEIGHBOR_ADDR_STR | |
3025 | "Specify a BGP neighbor\n" | |
3026 | AS_STR) | |
3027 | ||
a80beece DS |
3028 | DEFUN (no_neighbor_interface_config, |
3029 | no_neighbor_interface_config_cmd, | |
4c48cf63 | 3030 | "no neighbor WORD interface", |
a80beece DS |
3031 | NO_STR |
3032 | NEIGHBOR_STR | |
3033 | "Interface name\n" | |
3034 | "Configure BGP on interface\n") | |
3035 | { | |
3036 | struct peer *peer; | |
3037 | ||
3038 | /* look up for neighbor by interface name config. */ | |
3039 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
3040 | if (peer) | |
3041 | { | |
4a04e5f7 | 3042 | /* Request zebra to terminate IPv6 RAs on this interface. */ |
3043 | if (peer->ifp) | |
3044 | bgp_zebra_terminate_radv (peer->bgp, peer); | |
a80beece DS |
3045 | peer_delete (peer); |
3046 | } | |
3047 | else | |
3048 | { | |
3049 | vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE); | |
3050 | return CMD_WARNING; | |
3051 | } | |
3052 | return CMD_SUCCESS; | |
3053 | } | |
3054 | ||
4c48cf63 DW |
3055 | ALIAS (no_neighbor_interface_config, |
3056 | no_neighbor_interface_config_peergroup_cmd, | |
3057 | "no neighbor WORD interface peer-group WORD", | |
3058 | NO_STR | |
3059 | NEIGHBOR_STR | |
3060 | "Interface name\n" | |
3061 | "Configure BGP on interface\n" | |
3062 | "Member of the peer-group\n" | |
3063 | "peer-group name\n") | |
3064 | ||
3065 | ALIAS (no_neighbor_interface_config, | |
3066 | no_neighbor_interface_config_v6only_cmd, | |
3067 | "no neighbor WORD interface v6only", | |
3068 | NO_STR | |
3069 | NEIGHBOR_STR | |
3070 | "Interface name\n" | |
3071 | "Configure BGP on interface\n" | |
3072 | "Enable BGP with v6 link-local only\n") | |
3073 | ||
3074 | ALIAS (no_neighbor_interface_config, | |
3075 | no_neighbor_interface_config_v6only_peergroup_cmd, | |
3076 | "no neighbor WORD interface v6only peer-group WORD", | |
3077 | NO_STR | |
3078 | NEIGHBOR_STR | |
3079 | "Interface name\n" | |
3080 | "Configure BGP on interface\n" | |
3081 | "Enable BGP with v6 link-local only\n" | |
3082 | "Member of the peer-group\n" | |
3083 | "peer-group name\n") | |
3084 | ||
b3a39dc5 DD |
3085 | ALIAS (no_neighbor_interface_config, |
3086 | no_neighbor_interface_config_remote_as_cmd, | |
3087 | "no neighbor WORD interface remote-as (" CMD_AS_RANGE "|internal|external)", | |
3088 | NO_STR | |
3089 | NEIGHBOR_STR | |
3090 | "Interface name\n" | |
3091 | "Configure BGP on interface\n" | |
3092 | AS_STR) | |
3093 | ||
3094 | ALIAS (no_neighbor_interface_config, | |
3095 | no_neighbor_interface_config_v6only_remote_as_cmd, | |
3096 | "no neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|internal|external)", | |
3097 | NO_STR | |
3098 | NEIGHBOR_STR | |
3099 | "Interface name\n" | |
3100 | "Configure BGP on interface\n" | |
3101 | "Enable BGP with v6 link-local only\n" | |
3102 | AS_STR) | |
4c48cf63 | 3103 | |
718e3744 | 3104 | DEFUN (no_neighbor_peer_group, |
3105 | no_neighbor_peer_group_cmd, | |
3106 | "no neighbor WORD peer-group", | |
3107 | NO_STR | |
3108 | NEIGHBOR_STR | |
3109 | "Neighbor tag\n" | |
3110 | "Configure peer-group\n") | |
3111 | { | |
3112 | struct peer_group *group; | |
3113 | ||
3114 | group = peer_group_lookup (vty->index, argv[0]); | |
3115 | if (group) | |
3116 | peer_group_delete (group); | |
3117 | else | |
3118 | { | |
3119 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
3120 | return CMD_WARNING; | |
3121 | } | |
3122 | return CMD_SUCCESS; | |
3123 | } | |
3124 | ||
a80beece DS |
3125 | DEFUN (no_neighbor_interface_peer_group_remote_as, |
3126 | no_neighbor_interface_peer_group_remote_as_cmd, | |
0299c004 | 3127 | "no neighbor WORD remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 3128 | NO_STR |
3129 | NEIGHBOR_STR | |
a80beece | 3130 | "Interface name or neighbor tag\n" |
718e3744 | 3131 | "Specify a BGP neighbor\n" |
3132 | AS_STR) | |
3133 | { | |
3134 | struct peer_group *group; | |
a80beece DS |
3135 | struct peer *peer; |
3136 | ||
3137 | /* look up for neighbor by interface name config. */ | |
3138 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
3139 | if (peer) | |
3140 | { | |
0299c004 | 3141 | peer_as_change (peer, 0, AS_SPECIFIED); |
a80beece DS |
3142 | return CMD_SUCCESS; |
3143 | } | |
718e3744 | 3144 | |
3145 | group = peer_group_lookup (vty->index, argv[0]); | |
3146 | if (group) | |
3147 | peer_group_remote_as_delete (group); | |
3148 | else | |
3149 | { | |
a80beece | 3150 | vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE); |
718e3744 | 3151 | return CMD_WARNING; |
3152 | } | |
3153 | return CMD_SUCCESS; | |
3154 | } | |
6b0655a2 | 3155 | |
718e3744 | 3156 | DEFUN (neighbor_local_as, |
3157 | neighbor_local_as_cmd, | |
320da874 | 3158 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 3159 | NEIGHBOR_STR |
3160 | NEIGHBOR_ADDR_STR2 | |
3161 | "Specify a local-as number\n" | |
3162 | "AS number used as local AS\n") | |
3163 | { | |
3164 | struct peer *peer; | |
3165 | int ret; | |
3166 | ||
3167 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3168 | if (! peer) | |
3169 | return CMD_WARNING; | |
3170 | ||
9d3f9705 | 3171 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
718e3744 | 3172 | return bgp_vty_return (vty, ret); |
3173 | } | |
3174 | ||
3175 | DEFUN (neighbor_local_as_no_prepend, | |
3176 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 3177 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 3178 | NEIGHBOR_STR |
3179 | NEIGHBOR_ADDR_STR2 | |
3180 | "Specify a local-as number\n" | |
3181 | "AS number used as local AS\n" | |
3182 | "Do not prepend local-as to updates from ebgp peers\n") | |
3183 | { | |
3184 | struct peer *peer; | |
3185 | int ret; | |
3186 | ||
3187 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3188 | if (! peer) | |
3189 | return CMD_WARNING; | |
3190 | ||
9d3f9705 | 3191 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
718e3744 | 3192 | return bgp_vty_return (vty, ret); |
3193 | } | |
3194 | ||
9d3f9705 AC |
3195 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
3196 | neighbor_local_as_no_prepend_replace_as_cmd, | |
3197 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
3198 | NEIGHBOR_STR | |
3199 | NEIGHBOR_ADDR_STR2 | |
3200 | "Specify a local-as number\n" | |
3201 | "AS number used as local AS\n" | |
3202 | "Do not prepend local-as to updates from ebgp peers\n" | |
3203 | "Do not prepend local-as to updates from ibgp peers\n") | |
3204 | { | |
3205 | struct peer *peer; | |
3206 | int ret; | |
3207 | ||
3208 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3209 | if (! peer) | |
3210 | return CMD_WARNING; | |
3211 | ||
3212 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); | |
3213 | return bgp_vty_return (vty, ret); | |
3214 | } | |
3215 | ||
3216 | ||
718e3744 | 3217 | DEFUN (no_neighbor_local_as, |
3218 | no_neighbor_local_as_cmd, | |
3219 | NO_NEIGHBOR_CMD2 "local-as", | |
3220 | NO_STR | |
3221 | NEIGHBOR_STR | |
3222 | NEIGHBOR_ADDR_STR2 | |
3223 | "Specify a local-as number\n") | |
3224 | { | |
3225 | struct peer *peer; | |
3226 | int ret; | |
3227 | ||
3228 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3229 | if (! peer) | |
3230 | return CMD_WARNING; | |
3231 | ||
3232 | ret = peer_local_as_unset (peer); | |
3233 | return bgp_vty_return (vty, ret); | |
3234 | } | |
3235 | ||
3236 | ALIAS (no_neighbor_local_as, | |
3237 | no_neighbor_local_as_val_cmd, | |
320da874 | 3238 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 3239 | NO_STR |
3240 | NEIGHBOR_STR | |
3241 | NEIGHBOR_ADDR_STR2 | |
3242 | "Specify a local-as number\n" | |
3243 | "AS number used as local AS\n") | |
3244 | ||
3245 | ALIAS (no_neighbor_local_as, | |
3246 | no_neighbor_local_as_val2_cmd, | |
320da874 | 3247 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 3248 | NO_STR |
3249 | NEIGHBOR_STR | |
3250 | NEIGHBOR_ADDR_STR2 | |
3251 | "Specify a local-as number\n" | |
3252 | "AS number used as local AS\n" | |
3253 | "Do not prepend local-as to updates from ebgp peers\n") | |
9d3f9705 AC |
3254 | |
3255 | ALIAS (no_neighbor_local_as, | |
3256 | no_neighbor_local_as_val3_cmd, | |
3257 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
3258 | NO_STR | |
3259 | NEIGHBOR_STR | |
3260 | NEIGHBOR_ADDR_STR2 | |
3261 | "Specify a local-as number\n" | |
3262 | "AS number used as local AS\n" | |
3263 | "Do not prepend local-as to updates from ebgp peers\n" | |
3264 | "Do not prepend local-as to updates from ibgp peers\n") | |
6b0655a2 | 3265 | |
3f9c7369 DS |
3266 | DEFUN (neighbor_solo, |
3267 | neighbor_solo_cmd, | |
3268 | NEIGHBOR_CMD2 "solo", | |
3269 | NEIGHBOR_STR | |
3270 | NEIGHBOR_ADDR_STR2 | |
3271 | "Solo peer - part of its own update group\n") | |
3272 | { | |
3273 | struct peer *peer; | |
3274 | int ret; | |
3275 | ||
3276 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3277 | if (! peer) | |
3278 | return CMD_WARNING; | |
3279 | ||
3280 | ret = update_group_adjust_soloness(peer, 1); | |
3281 | return bgp_vty_return (vty, ret); | |
3282 | } | |
3283 | ||
3284 | DEFUN (no_neighbor_solo, | |
3285 | no_neighbor_solo_cmd, | |
3286 | NO_NEIGHBOR_CMD2 "solo", | |
3287 | NO_STR | |
3288 | NEIGHBOR_STR | |
3289 | NEIGHBOR_ADDR_STR2 | |
3290 | "Solo peer - part of its own update group\n") | |
3291 | { | |
3292 | struct peer *peer; | |
3293 | int ret; | |
3294 | ||
3295 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3296 | if (! peer) | |
3297 | return CMD_WARNING; | |
3298 | ||
3299 | ret = update_group_adjust_soloness(peer, 0); | |
3300 | return bgp_vty_return (vty, ret); | |
3301 | } | |
3302 | ||
0df7c91f PJ |
3303 | DEFUN (neighbor_password, |
3304 | neighbor_password_cmd, | |
3305 | NEIGHBOR_CMD2 "password LINE", | |
3306 | NEIGHBOR_STR | |
3307 | NEIGHBOR_ADDR_STR2 | |
3308 | "Set a password\n" | |
3309 | "The password\n") | |
3310 | { | |
3311 | struct peer *peer; | |
3312 | int ret; | |
3313 | ||
3314 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3315 | if (! peer) | |
3316 | return CMD_WARNING; | |
3317 | ||
3318 | ret = peer_password_set (peer, argv[1]); | |
3319 | return bgp_vty_return (vty, ret); | |
3320 | } | |
3321 | ||
3322 | DEFUN (no_neighbor_password, | |
3323 | no_neighbor_password_cmd, | |
3324 | NO_NEIGHBOR_CMD2 "password", | |
3325 | NO_STR | |
3326 | NEIGHBOR_STR | |
3327 | NEIGHBOR_ADDR_STR2 | |
3328 | "Set a password\n") | |
3329 | { | |
3330 | struct peer *peer; | |
3331 | int ret; | |
3332 | ||
3333 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3334 | if (! peer) | |
3335 | return CMD_WARNING; | |
3336 | ||
3337 | ret = peer_password_unset (peer); | |
3338 | return bgp_vty_return (vty, ret); | |
3339 | } | |
6b0655a2 | 3340 | |
813d4307 DW |
3341 | ALIAS (no_neighbor_password, |
3342 | no_neighbor_password_val_cmd, | |
3343 | NO_NEIGHBOR_CMD2 "password LINE", | |
3344 | NO_STR | |
3345 | NEIGHBOR_STR | |
3346 | NEIGHBOR_ADDR_STR2 | |
3347 | "Set a password\n" | |
3348 | "The password\n") | |
3349 | ||
718e3744 | 3350 | DEFUN (neighbor_activate, |
3351 | neighbor_activate_cmd, | |
3352 | NEIGHBOR_CMD2 "activate", | |
3353 | NEIGHBOR_STR | |
3354 | NEIGHBOR_ADDR_STR2 | |
3355 | "Enable the Address Family for this Neighbor\n") | |
3356 | { | |
c8560b44 | 3357 | int ret; |
718e3744 | 3358 | struct peer *peer; |
3359 | ||
3360 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3361 | if (! peer) | |
3362 | return CMD_WARNING; | |
3363 | ||
c8560b44 | 3364 | ret = peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
718e3744 | 3365 | |
c8560b44 DW |
3366 | if (ret) |
3367 | return CMD_WARNING; | |
718e3744 | 3368 | return CMD_SUCCESS; |
3369 | } | |
3370 | ||
3371 | DEFUN (no_neighbor_activate, | |
3372 | no_neighbor_activate_cmd, | |
3373 | NO_NEIGHBOR_CMD2 "activate", | |
3374 | NO_STR | |
3375 | NEIGHBOR_STR | |
3376 | NEIGHBOR_ADDR_STR2 | |
3377 | "Enable the Address Family for this Neighbor\n") | |
3378 | { | |
3379 | int ret; | |
3380 | struct peer *peer; | |
3381 | ||
3382 | /* Lookup peer. */ | |
3383 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3384 | if (! peer) | |
3385 | return CMD_WARNING; | |
3386 | ||
3387 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
3388 | ||
c8560b44 DW |
3389 | if (ret) |
3390 | return CMD_WARNING; | |
3391 | return CMD_SUCCESS; | |
718e3744 | 3392 | } |
6b0655a2 | 3393 | |
718e3744 | 3394 | DEFUN (neighbor_set_peer_group, |
3395 | neighbor_set_peer_group_cmd, | |
a80beece | 3396 | NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3397 | NEIGHBOR_STR |
a80beece | 3398 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3399 | "Member of the peer-group\n" |
3400 | "peer-group name\n") | |
3401 | { | |
3402 | int ret; | |
3403 | as_t as; | |
3404 | union sockunion su; | |
3405 | struct bgp *bgp; | |
a80beece | 3406 | struct peer *peer; |
718e3744 | 3407 | struct peer_group *group; |
3408 | ||
3409 | bgp = vty->index; | |
a80beece | 3410 | peer = NULL; |
718e3744 | 3411 | |
3412 | ret = str2sockunion (argv[0], &su); | |
3413 | if (ret < 0) | |
3414 | { | |
a80beece DS |
3415 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
3416 | if (!peer) | |
3417 | { | |
3418 | vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); | |
3419 | return CMD_WARNING; | |
3420 | } | |
3421 | } | |
3422 | else | |
3423 | { | |
6aeb9e78 | 3424 | if (peer_address_self_check (bgp, &su)) |
a80beece DS |
3425 | { |
3426 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
3427 | VTY_NEWLINE); | |
3428 | return CMD_WARNING; | |
3429 | } | |
f14e6fdb DS |
3430 | |
3431 | /* Disallow for dynamic neighbor. */ | |
3432 | peer = peer_lookup (bgp, &su); | |
3433 | if (peer && peer_dynamic_neighbor (peer)) | |
3434 | { | |
3435 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
3436 | VTY_NEWLINE); | |
3437 | return CMD_WARNING; | |
3438 | } | |
718e3744 | 3439 | } |
3440 | ||
3441 | group = peer_group_lookup (bgp, argv[1]); | |
3442 | if (! group) | |
3443 | { | |
3444 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3445 | return CMD_WARNING; | |
3446 | } | |
3447 | ||
c8560b44 | 3448 | ret = peer_group_bind (bgp, &su, peer, group, &as); |
718e3744 | 3449 | |
3450 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
3451 | { | |
aea339f7 | 3452 | 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 | 3453 | return CMD_WARNING; |
3454 | } | |
3455 | ||
3456 | return bgp_vty_return (vty, ret); | |
3457 | } | |
3458 | ||
3459 | DEFUN (no_neighbor_set_peer_group, | |
3460 | no_neighbor_set_peer_group_cmd, | |
a80beece | 3461 | NO_NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3462 | NO_STR |
3463 | NEIGHBOR_STR | |
a80beece | 3464 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3465 | "Member of the peer-group\n" |
3466 | "peer-group name\n") | |
3467 | { | |
3468 | int ret; | |
3469 | struct bgp *bgp; | |
3470 | struct peer *peer; | |
3471 | struct peer_group *group; | |
3472 | ||
3473 | bgp = vty->index; | |
3474 | ||
3475 | peer = peer_lookup_vty (vty, argv[0]); | |
3476 | if (! peer) | |
3477 | return CMD_WARNING; | |
3478 | ||
3479 | group = peer_group_lookup (bgp, argv[1]); | |
3480 | if (! group) | |
3481 | { | |
3482 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3483 | return CMD_WARNING; | |
3484 | } | |
3485 | ||
c8560b44 | 3486 | ret = peer_group_unbind (bgp, peer, group); |
718e3744 | 3487 | |
3488 | return bgp_vty_return (vty, ret); | |
3489 | } | |
6b0655a2 | 3490 | |
94f2b392 | 3491 | static int |
fd79ac91 | 3492 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
3493 | u_int16_t flag, int set) | |
718e3744 | 3494 | { |
3495 | int ret; | |
3496 | struct peer *peer; | |
3497 | ||
3498 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3499 | if (! peer) | |
3500 | return CMD_WARNING; | |
3501 | ||
8cdabf90 SK |
3502 | /* |
3503 | * If 'neighbor <interface>', then this is for directly connected peers, | |
3504 | * we should not accept disable-connected-check. | |
3505 | */ | |
3506 | if (peer->conf_if && (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK)) { | |
3507 | vty_out (vty, "%s is directly connected peer, cannot accept disable-" | |
3508 | "connected-check%s", ip_str, VTY_NEWLINE); | |
3509 | return CMD_WARNING; | |
3510 | } | |
3511 | ||
718e3744 | 3512 | if (set) |
3513 | ret = peer_flag_set (peer, flag); | |
3514 | else | |
3515 | ret = peer_flag_unset (peer, flag); | |
3516 | ||
3517 | return bgp_vty_return (vty, ret); | |
3518 | } | |
3519 | ||
94f2b392 | 3520 | static int |
fd79ac91 | 3521 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3522 | { |
3523 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
3524 | } | |
3525 | ||
94f2b392 | 3526 | static int |
fd79ac91 | 3527 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3528 | { |
3529 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
3530 | } | |
3531 | ||
3532 | /* neighbor passive. */ | |
3533 | DEFUN (neighbor_passive, | |
3534 | neighbor_passive_cmd, | |
3535 | NEIGHBOR_CMD2 "passive", | |
3536 | NEIGHBOR_STR | |
3537 | NEIGHBOR_ADDR_STR2 | |
3538 | "Don't send open messages to this neighbor\n") | |
3539 | { | |
3540 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3541 | } | |
3542 | ||
3543 | DEFUN (no_neighbor_passive, | |
3544 | no_neighbor_passive_cmd, | |
3545 | NO_NEIGHBOR_CMD2 "passive", | |
3546 | NO_STR | |
3547 | NEIGHBOR_STR | |
3548 | NEIGHBOR_ADDR_STR2 | |
3549 | "Don't send open messages to this neighbor\n") | |
3550 | { | |
3551 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3552 | } | |
6b0655a2 | 3553 | |
718e3744 | 3554 | /* neighbor shutdown. */ |
3555 | DEFUN (neighbor_shutdown, | |
3556 | neighbor_shutdown_cmd, | |
3557 | NEIGHBOR_CMD2 "shutdown", | |
3558 | NEIGHBOR_STR | |
3559 | NEIGHBOR_ADDR_STR2 | |
3560 | "Administratively shut down this neighbor\n") | |
3561 | { | |
3562 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3563 | } | |
3564 | ||
3565 | DEFUN (no_neighbor_shutdown, | |
3566 | no_neighbor_shutdown_cmd, | |
3567 | NO_NEIGHBOR_CMD2 "shutdown", | |
3568 | NO_STR | |
3569 | NEIGHBOR_STR | |
3570 | NEIGHBOR_ADDR_STR2 | |
3571 | "Administratively shut down this neighbor\n") | |
3572 | { | |
3573 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3574 | } | |
6b0655a2 | 3575 | |
718e3744 | 3576 | /* neighbor capability dynamic. */ |
3577 | DEFUN (neighbor_capability_dynamic, | |
3578 | neighbor_capability_dynamic_cmd, | |
3579 | NEIGHBOR_CMD2 "capability dynamic", | |
3580 | NEIGHBOR_STR | |
3581 | NEIGHBOR_ADDR_STR2 | |
3582 | "Advertise capability to the peer\n" | |
3583 | "Advertise dynamic capability to this neighbor\n") | |
3584 | { | |
3585 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3586 | } | |
3587 | ||
3588 | DEFUN (no_neighbor_capability_dynamic, | |
3589 | no_neighbor_capability_dynamic_cmd, | |
3590 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
3591 | NO_STR | |
3592 | NEIGHBOR_STR | |
3593 | NEIGHBOR_ADDR_STR2 | |
3594 | "Advertise capability to the peer\n" | |
3595 | "Advertise dynamic capability to this neighbor\n") | |
3596 | { | |
3597 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3598 | } | |
6b0655a2 | 3599 | |
718e3744 | 3600 | /* neighbor dont-capability-negotiate */ |
3601 | DEFUN (neighbor_dont_capability_negotiate, | |
3602 | neighbor_dont_capability_negotiate_cmd, | |
3603 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3604 | NEIGHBOR_STR | |
3605 | NEIGHBOR_ADDR_STR2 | |
3606 | "Do not perform capability negotiation\n") | |
3607 | { | |
3608 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3609 | } | |
3610 | ||
3611 | DEFUN (no_neighbor_dont_capability_negotiate, | |
3612 | no_neighbor_dont_capability_negotiate_cmd, | |
3613 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3614 | NO_STR | |
3615 | NEIGHBOR_STR | |
3616 | NEIGHBOR_ADDR_STR2 | |
3617 | "Do not perform capability negotiation\n") | |
3618 | { | |
3619 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3620 | } | |
6b0655a2 | 3621 | |
8a92a8a0 DS |
3622 | /* neighbor capability extended next hop encoding */ |
3623 | DEFUN (neighbor_capability_enhe, | |
3624 | neighbor_capability_enhe_cmd, | |
3625 | NEIGHBOR_CMD2 "capability extended-nexthop", | |
3626 | NEIGHBOR_STR | |
3627 | NEIGHBOR_ADDR_STR2 | |
3628 | "Advertise capability to the peer\n" | |
3629 | "Advertise extended next-hop capability to the peer\n") | |
3630 | { | |
3631 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3632 | } | |
3633 | ||
3634 | DEFUN (no_neighbor_capability_enhe, | |
3635 | no_neighbor_capability_enhe_cmd, | |
3636 | NO_NEIGHBOR_CMD2 "capability extended-nexthop", | |
3637 | NO_STR | |
3638 | NEIGHBOR_STR | |
3639 | NEIGHBOR_ADDR_STR2 | |
3640 | "Advertise capability to the peer\n" | |
3641 | "Advertise extended next-hop capability to the peer\n") | |
3642 | { | |
3643 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3644 | } | |
3645 | ||
94f2b392 | 3646 | static int |
fd79ac91 | 3647 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3648 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 3649 | { |
3650 | int ret; | |
3651 | struct peer *peer; | |
3652 | ||
3653 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3654 | if (! peer) | |
3655 | return CMD_WARNING; | |
3656 | ||
3657 | if (set) | |
3658 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
3659 | else | |
3660 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
3661 | ||
3662 | return bgp_vty_return (vty, ret); | |
3663 | } | |
3664 | ||
94f2b392 | 3665 | static int |
fd79ac91 | 3666 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3667 | safi_t safi, u_int32_t flag) |
718e3744 | 3668 | { |
3669 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
3670 | } | |
3671 | ||
94f2b392 | 3672 | static int |
fd79ac91 | 3673 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3674 | safi_t safi, u_int32_t flag) |
718e3744 | 3675 | { |
3676 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
3677 | } | |
6b0655a2 | 3678 | |
718e3744 | 3679 | /* neighbor capability orf prefix-list. */ |
3680 | DEFUN (neighbor_capability_orf_prefix, | |
3681 | neighbor_capability_orf_prefix_cmd, | |
3682 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3683 | NEIGHBOR_STR | |
3684 | NEIGHBOR_ADDR_STR2 | |
3685 | "Advertise capability to the peer\n" | |
3686 | "Advertise ORF capability to the peer\n" | |
3687 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3688 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3689 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3690 | "Capability to SEND the ORF to this neighbor\n") | |
3691 | { | |
3692 | u_int16_t flag = 0; | |
3693 | ||
3694 | if (strncmp (argv[1], "s", 1) == 0) | |
3695 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3696 | else if (strncmp (argv[1], "r", 1) == 0) | |
3697 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3698 | else if (strncmp (argv[1], "b", 1) == 0) | |
3699 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3700 | else | |
3701 | return CMD_WARNING; | |
3702 | ||
3703 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3704 | bgp_node_safi (vty), flag); | |
3705 | } | |
3706 | ||
3707 | DEFUN (no_neighbor_capability_orf_prefix, | |
3708 | no_neighbor_capability_orf_prefix_cmd, | |
3709 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3710 | NO_STR | |
3711 | NEIGHBOR_STR | |
3712 | NEIGHBOR_ADDR_STR2 | |
3713 | "Advertise capability to the peer\n" | |
3714 | "Advertise ORF capability to the peer\n" | |
3715 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3716 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3717 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3718 | "Capability to SEND the ORF to this neighbor\n") | |
3719 | { | |
3720 | u_int16_t flag = 0; | |
3721 | ||
3722 | if (strncmp (argv[1], "s", 1) == 0) | |
3723 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3724 | else if (strncmp (argv[1], "r", 1) == 0) | |
3725 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3726 | else if (strncmp (argv[1], "b", 1) == 0) | |
3727 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3728 | else | |
3729 | return CMD_WARNING; | |
3730 | ||
3731 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3732 | bgp_node_safi (vty), flag); | |
3733 | } | |
6b0655a2 | 3734 | |
718e3744 | 3735 | /* neighbor next-hop-self. */ |
3736 | DEFUN (neighbor_nexthop_self, | |
3737 | neighbor_nexthop_self_cmd, | |
a538debe | 3738 | NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3739 | NEIGHBOR_STR |
3740 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3741 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3742 | { |
a538debe DS |
3743 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3744 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); | |
3745 | } | |
9e7a53c1 | 3746 | |
a538debe DS |
3747 | /* neighbor next-hop-self. */ |
3748 | DEFUN (neighbor_nexthop_self_force, | |
3749 | neighbor_nexthop_self_force_cmd, | |
3750 | NEIGHBOR_CMD2 "next-hop-self force", | |
3751 | NEIGHBOR_STR | |
3752 | NEIGHBOR_ADDR_STR2 | |
3753 | "Disable the next hop calculation for this neighbor\n" | |
3754 | "Set the next hop to self for reflected routes\n") | |
3755 | { | |
3756 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3757 | bgp_node_safi (vty), | |
88b8ed8d | 3758 | PEER_FLAG_FORCE_NEXTHOP_SELF); |
718e3744 | 3759 | } |
3760 | ||
3761 | DEFUN (no_neighbor_nexthop_self, | |
3762 | no_neighbor_nexthop_self_cmd, | |
a538debe | 3763 | NO_NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3764 | NO_STR |
3765 | NEIGHBOR_STR | |
3766 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3767 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3768 | { |
3769 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
9e7a53c1 | 3770 | bgp_node_safi (vty), |
88b8ed8d | 3771 | PEER_FLAG_NEXTHOP_SELF); |
718e3744 | 3772 | } |
6b0655a2 | 3773 | |
88b8ed8d | 3774 | DEFUN (no_neighbor_nexthop_self_force, |
a538debe DS |
3775 | no_neighbor_nexthop_self_force_cmd, |
3776 | NO_NEIGHBOR_CMD2 "next-hop-self force", | |
3777 | NO_STR | |
3778 | NEIGHBOR_STR | |
3779 | NEIGHBOR_ADDR_STR2 | |
3780 | "Disable the next hop calculation for this neighbor\n" | |
3781 | "Set the next hop to self for reflected routes\n") | |
88b8ed8d DW |
3782 | { |
3783 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3784 | bgp_node_safi (vty), | |
3785 | PEER_FLAG_FORCE_NEXTHOP_SELF); | |
3786 | } | |
a538debe | 3787 | |
c7122e14 DS |
3788 | /* neighbor as-override */ |
3789 | DEFUN (neighbor_as_override, | |
3790 | neighbor_as_override_cmd, | |
3791 | NEIGHBOR_CMD2 "as-override", | |
3792 | NEIGHBOR_STR | |
3793 | NEIGHBOR_ADDR_STR2 | |
3794 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3795 | { | |
3796 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3797 | bgp_node_safi (vty), | |
3798 | PEER_FLAG_AS_OVERRIDE); | |
3799 | } | |
3800 | ||
3801 | DEFUN (no_neighbor_as_override, | |
3802 | no_neighbor_as_override_cmd, | |
3803 | NO_NEIGHBOR_CMD2 "as-override", | |
3804 | NO_STR | |
3805 | NEIGHBOR_STR | |
3806 | NEIGHBOR_ADDR_STR2 | |
3807 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3808 | { | |
3809 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3810 | bgp_node_safi (vty), | |
3811 | PEER_FLAG_AS_OVERRIDE); | |
3812 | } | |
3813 | ||
718e3744 | 3814 | /* neighbor remove-private-AS. */ |
3815 | DEFUN (neighbor_remove_private_as, | |
3816 | neighbor_remove_private_as_cmd, | |
3817 | NEIGHBOR_CMD2 "remove-private-AS", | |
3818 | NEIGHBOR_STR | |
3819 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3820 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3821 | { |
3822 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3823 | bgp_node_safi (vty), | |
3824 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
3825 | } | |
3826 | ||
5000f21c DS |
3827 | DEFUN (neighbor_remove_private_as_all, |
3828 | neighbor_remove_private_as_all_cmd, | |
3829 | NEIGHBOR_CMD2 "remove-private-AS all", | |
3830 | NEIGHBOR_STR | |
3831 | NEIGHBOR_ADDR_STR2 | |
3832 | "Remove private ASNs in outbound updates\n" | |
3833 | "Apply to all AS numbers") | |
3834 | { | |
5000f21c DS |
3835 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3836 | bgp_node_safi (vty), | |
5000f21c DS |
3837 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); |
3838 | } | |
3839 | ||
3840 | DEFUN (neighbor_remove_private_as_replace_as, | |
3841 | neighbor_remove_private_as_replace_as_cmd, | |
3842 | NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3843 | NEIGHBOR_STR | |
3844 | NEIGHBOR_ADDR_STR2 | |
3845 | "Remove private ASNs in outbound updates\n" | |
3846 | "Replace private ASNs with our ASN in outbound updates\n") | |
3847 | { | |
5000f21c DS |
3848 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3849 | bgp_node_safi (vty), | |
5000f21c DS |
3850 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); |
3851 | } | |
3852 | ||
3853 | DEFUN (neighbor_remove_private_as_all_replace_as, | |
3854 | neighbor_remove_private_as_all_replace_as_cmd, | |
3855 | NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3856 | NEIGHBOR_STR | |
3857 | NEIGHBOR_ADDR_STR2 | |
3858 | "Remove private ASNs in outbound updates\n" | |
3859 | "Apply to all AS numbers" | |
3860 | "Replace private ASNs with our ASN in outbound updates\n") | |
3861 | { | |
3862 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3863 | bgp_node_safi (vty), | |
88b8ed8d | 3864 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); |
5000f21c DS |
3865 | } |
3866 | ||
718e3744 | 3867 | DEFUN (no_neighbor_remove_private_as, |
3868 | no_neighbor_remove_private_as_cmd, | |
3869 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
3870 | NO_STR | |
3871 | NEIGHBOR_STR | |
3872 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3873 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3874 | { |
3875 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3876 | bgp_node_safi (vty), | |
88b8ed8d | 3877 | PEER_FLAG_REMOVE_PRIVATE_AS); |
718e3744 | 3878 | } |
6b0655a2 | 3879 | |
88b8ed8d | 3880 | DEFUN (no_neighbor_remove_private_as_all, |
5000f21c DS |
3881 | no_neighbor_remove_private_as_all_cmd, |
3882 | NO_NEIGHBOR_CMD2 "remove-private-AS all", | |
3883 | NO_STR | |
3884 | NEIGHBOR_STR | |
3885 | NEIGHBOR_ADDR_STR2 | |
3886 | "Remove private ASNs in outbound updates\n" | |
3887 | "Apply to all AS numbers") | |
88b8ed8d DW |
3888 | { |
3889 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3890 | bgp_node_safi (vty), | |
3891 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3892 | } | |
5000f21c | 3893 | |
88b8ed8d | 3894 | DEFUN (no_neighbor_remove_private_as_replace_as, |
5000f21c DS |
3895 | no_neighbor_remove_private_as_replace_as_cmd, |
3896 | NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3897 | NO_STR | |
3898 | NEIGHBOR_STR | |
3899 | NEIGHBOR_ADDR_STR2 | |
3900 | "Remove private ASNs in outbound updates\n" | |
3901 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d DW |
3902 | { |
3903 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3904 | bgp_node_safi (vty), | |
3905 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3906 | } | |
5000f21c | 3907 | |
88b8ed8d | 3908 | DEFUN (no_neighbor_remove_private_as_all_replace_as, |
5000f21c DS |
3909 | no_neighbor_remove_private_as_all_replace_as_cmd, |
3910 | NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3911 | NO_STR | |
3912 | NEIGHBOR_STR | |
3913 | NEIGHBOR_ADDR_STR2 | |
3914 | "Remove private ASNs in outbound updates\n" | |
3915 | "Apply to all AS numbers" | |
3916 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d DW |
3917 | { |
3918 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3919 | bgp_node_safi (vty), | |
3920 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); | |
3921 | } | |
5000f21c DS |
3922 | |
3923 | ||
718e3744 | 3924 | /* neighbor send-community. */ |
3925 | DEFUN (neighbor_send_community, | |
3926 | neighbor_send_community_cmd, | |
3927 | NEIGHBOR_CMD2 "send-community", | |
3928 | NEIGHBOR_STR | |
3929 | NEIGHBOR_ADDR_STR2 | |
3930 | "Send Community attribute to this neighbor\n") | |
3931 | { | |
3932 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3933 | bgp_node_safi (vty), | |
3934 | PEER_FLAG_SEND_COMMUNITY); | |
3935 | } | |
3936 | ||
3937 | DEFUN (no_neighbor_send_community, | |
3938 | no_neighbor_send_community_cmd, | |
3939 | NO_NEIGHBOR_CMD2 "send-community", | |
3940 | NO_STR | |
3941 | NEIGHBOR_STR | |
3942 | NEIGHBOR_ADDR_STR2 | |
3943 | "Send Community attribute to this neighbor\n") | |
3944 | { | |
3945 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3946 | bgp_node_safi (vty), | |
3947 | PEER_FLAG_SEND_COMMUNITY); | |
3948 | } | |
6b0655a2 | 3949 | |
718e3744 | 3950 | /* neighbor send-community extended. */ |
3951 | DEFUN (neighbor_send_community_type, | |
3952 | neighbor_send_community_type_cmd, | |
3953 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3954 | NEIGHBOR_STR | |
3955 | NEIGHBOR_ADDR_STR2 | |
3956 | "Send Community attribute to this neighbor\n" | |
3957 | "Send Standard and Extended Community attributes\n" | |
3958 | "Send Extended Community attributes\n" | |
3959 | "Send Standard Community attributes\n") | |
3960 | { | |
3961 | if (strncmp (argv[1], "s", 1) == 0) | |
3962 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3963 | bgp_node_safi (vty), | |
3964 | PEER_FLAG_SEND_COMMUNITY); | |
3965 | if (strncmp (argv[1], "e", 1) == 0) | |
3966 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3967 | bgp_node_safi (vty), | |
3968 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3969 | ||
3970 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3971 | bgp_node_safi (vty), | |
3972 | (PEER_FLAG_SEND_COMMUNITY| | |
3973 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3974 | } | |
3975 | ||
3976 | DEFUN (no_neighbor_send_community_type, | |
3977 | no_neighbor_send_community_type_cmd, | |
3978 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3979 | NO_STR | |
3980 | NEIGHBOR_STR | |
3981 | NEIGHBOR_ADDR_STR2 | |
3982 | "Send Community attribute to this neighbor\n" | |
3983 | "Send Standard and Extended Community attributes\n" | |
3984 | "Send Extended Community attributes\n" | |
3985 | "Send Standard Community attributes\n") | |
3986 | { | |
3987 | if (strncmp (argv[1], "s", 1) == 0) | |
3988 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3989 | bgp_node_safi (vty), | |
3990 | PEER_FLAG_SEND_COMMUNITY); | |
3991 | if (strncmp (argv[1], "e", 1) == 0) | |
3992 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3993 | bgp_node_safi (vty), | |
3994 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3995 | ||
3996 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3997 | bgp_node_safi (vty), | |
3998 | (PEER_FLAG_SEND_COMMUNITY | | |
3999 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
4000 | } | |
6b0655a2 | 4001 | |
718e3744 | 4002 | /* neighbor soft-reconfig. */ |
4003 | DEFUN (neighbor_soft_reconfiguration, | |
4004 | neighbor_soft_reconfiguration_cmd, | |
4005 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
4006 | NEIGHBOR_STR | |
4007 | NEIGHBOR_ADDR_STR2 | |
4008 | "Per neighbor soft reconfiguration\n" | |
4009 | "Allow inbound soft reconfiguration for this neighbor\n") | |
4010 | { | |
4011 | return peer_af_flag_set_vty (vty, argv[0], | |
4012 | bgp_node_afi (vty), bgp_node_safi (vty), | |
4013 | PEER_FLAG_SOFT_RECONFIG); | |
4014 | } | |
4015 | ||
4016 | DEFUN (no_neighbor_soft_reconfiguration, | |
4017 | no_neighbor_soft_reconfiguration_cmd, | |
4018 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
4019 | NO_STR | |
4020 | NEIGHBOR_STR | |
4021 | NEIGHBOR_ADDR_STR2 | |
4022 | "Per neighbor soft reconfiguration\n" | |
4023 | "Allow inbound soft reconfiguration for this neighbor\n") | |
4024 | { | |
4025 | return peer_af_flag_unset_vty (vty, argv[0], | |
4026 | bgp_node_afi (vty), bgp_node_safi (vty), | |
4027 | PEER_FLAG_SOFT_RECONFIG); | |
4028 | } | |
6b0655a2 | 4029 | |
718e3744 | 4030 | DEFUN (neighbor_route_reflector_client, |
4031 | neighbor_route_reflector_client_cmd, | |
4032 | NEIGHBOR_CMD2 "route-reflector-client", | |
4033 | NEIGHBOR_STR | |
4034 | NEIGHBOR_ADDR_STR2 | |
4035 | "Configure a neighbor as Route Reflector client\n") | |
4036 | { | |
4037 | struct peer *peer; | |
4038 | ||
4039 | ||
4040 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4041 | if (! peer) | |
4042 | return CMD_WARNING; | |
4043 | ||
4044 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4045 | bgp_node_safi (vty), | |
4046 | PEER_FLAG_REFLECTOR_CLIENT); | |
4047 | } | |
4048 | ||
4049 | DEFUN (no_neighbor_route_reflector_client, | |
4050 | no_neighbor_route_reflector_client_cmd, | |
4051 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
4052 | NO_STR | |
4053 | NEIGHBOR_STR | |
4054 | NEIGHBOR_ADDR_STR2 | |
4055 | "Configure a neighbor as Route Reflector client\n") | |
4056 | { | |
4057 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4058 | bgp_node_safi (vty), | |
4059 | PEER_FLAG_REFLECTOR_CLIENT); | |
4060 | } | |
6b0655a2 | 4061 | |
718e3744 | 4062 | /* neighbor route-server-client. */ |
4063 | DEFUN (neighbor_route_server_client, | |
4064 | neighbor_route_server_client_cmd, | |
4065 | NEIGHBOR_CMD2 "route-server-client", | |
4066 | NEIGHBOR_STR | |
4067 | NEIGHBOR_ADDR_STR2 | |
4068 | "Configure a neighbor as Route Server client\n") | |
4069 | { | |
2a3d5731 DW |
4070 | struct peer *peer; |
4071 | ||
4072 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4073 | if (! peer) | |
4074 | return CMD_WARNING; | |
4075 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4076 | bgp_node_safi (vty), | |
4077 | PEER_FLAG_RSERVER_CLIENT); | |
718e3744 | 4078 | } |
4079 | ||
4080 | DEFUN (no_neighbor_route_server_client, | |
4081 | no_neighbor_route_server_client_cmd, | |
4082 | NO_NEIGHBOR_CMD2 "route-server-client", | |
4083 | NO_STR | |
4084 | NEIGHBOR_STR | |
4085 | NEIGHBOR_ADDR_STR2 | |
4086 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 4087 | { |
2a3d5731 DW |
4088 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
4089 | bgp_node_safi (vty), | |
4090 | PEER_FLAG_RSERVER_CLIENT); | |
fee0f4c6 | 4091 | } |
6b0655a2 | 4092 | |
fee0f4c6 | 4093 | DEFUN (neighbor_nexthop_local_unchanged, |
4094 | neighbor_nexthop_local_unchanged_cmd, | |
4095 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
4096 | NEIGHBOR_STR | |
4097 | NEIGHBOR_ADDR_STR2 | |
4098 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
4099 | "Leave link-local nexthop unchanged for this peer\n") | |
4100 | { | |
4101 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4102 | bgp_node_safi (vty), | |
4103 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
4104 | } | |
6b0655a2 | 4105 | |
fee0f4c6 | 4106 | DEFUN (no_neighbor_nexthop_local_unchanged, |
4107 | no_neighbor_nexthop_local_unchanged_cmd, | |
4108 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
4109 | NO_STR | |
4110 | NEIGHBOR_STR | |
4111 | NEIGHBOR_ADDR_STR2 | |
4112 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
4113 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 4114 | { |
4115 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4116 | bgp_node_safi (vty), | |
fee0f4c6 | 4117 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 4118 | } |
6b0655a2 | 4119 | |
718e3744 | 4120 | DEFUN (neighbor_attr_unchanged, |
4121 | neighbor_attr_unchanged_cmd, | |
4122 | NEIGHBOR_CMD2 "attribute-unchanged", | |
4123 | NEIGHBOR_STR | |
4124 | NEIGHBOR_ADDR_STR2 | |
4125 | "BGP attribute is propagated unchanged to this neighbor\n") | |
4126 | { | |
4127 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4128 | bgp_node_safi (vty), | |
4129 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4130 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4131 | PEER_FLAG_MED_UNCHANGED)); | |
4132 | } | |
4133 | ||
4134 | DEFUN (neighbor_attr_unchanged1, | |
4135 | neighbor_attr_unchanged1_cmd, | |
4136 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4137 | NEIGHBOR_STR | |
4138 | NEIGHBOR_ADDR_STR2 | |
4139 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4140 | "As-path attribute\n" | |
4141 | "Nexthop attribute\n" | |
4142 | "Med attribute\n") | |
4143 | { | |
4144 | u_int16_t flags = 0; | |
4145 | ||
4146 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4147 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4148 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4149 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4150 | else if (strncmp (argv[1], "med", 1) == 0) | |
4151 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4152 | ||
4153 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4154 | bgp_node_safi (vty), flags); | |
4155 | } | |
4156 | ||
4157 | DEFUN (neighbor_attr_unchanged2, | |
4158 | neighbor_attr_unchanged2_cmd, | |
4159 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4160 | NEIGHBOR_STR | |
4161 | NEIGHBOR_ADDR_STR2 | |
4162 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4163 | "As-path attribute\n" | |
4164 | "Nexthop attribute\n" | |
4165 | "Med attribute\n") | |
4166 | { | |
4167 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4168 | ||
4169 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4170 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4171 | else if (strncmp (argv[1], "med", 1) == 0) | |
4172 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4173 | ||
4174 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4175 | bgp_node_safi (vty), flags); | |
4176 | ||
4177 | } | |
4178 | ||
4179 | DEFUN (neighbor_attr_unchanged3, | |
4180 | neighbor_attr_unchanged3_cmd, | |
4181 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4182 | NEIGHBOR_STR | |
4183 | NEIGHBOR_ADDR_STR2 | |
4184 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4185 | "Nexthop attribute\n" | |
4186 | "As-path attribute\n" | |
4187 | "Med attribute\n") | |
4188 | { | |
4189 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4190 | ||
4191 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4192 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4193 | else if (strncmp (argv[1], "med", 1) == 0) | |
4194 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4195 | ||
4196 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4197 | bgp_node_safi (vty), flags); | |
4198 | } | |
4199 | ||
4200 | DEFUN (neighbor_attr_unchanged4, | |
4201 | neighbor_attr_unchanged4_cmd, | |
4202 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4203 | NEIGHBOR_STR | |
4204 | NEIGHBOR_ADDR_STR2 | |
4205 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4206 | "Med attribute\n" | |
4207 | "As-path attribute\n" | |
4208 | "Nexthop attribute\n") | |
4209 | { | |
4210 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4211 | ||
4212 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4213 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4214 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4215 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4216 | ||
4217 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4218 | bgp_node_safi (vty), flags); | |
4219 | } | |
4220 | ||
4221 | ALIAS (neighbor_attr_unchanged, | |
4222 | neighbor_attr_unchanged5_cmd, | |
4223 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4224 | NEIGHBOR_STR | |
4225 | NEIGHBOR_ADDR_STR2 | |
4226 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4227 | "As-path attribute\n" | |
4228 | "Nexthop attribute\n" | |
4229 | "Med attribute\n") | |
4230 | ||
4231 | ALIAS (neighbor_attr_unchanged, | |
4232 | neighbor_attr_unchanged6_cmd, | |
4233 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4234 | NEIGHBOR_STR | |
4235 | NEIGHBOR_ADDR_STR2 | |
4236 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4237 | "As-path attribute\n" | |
4238 | "Med attribute\n" | |
4239 | "Nexthop attribute\n") | |
4240 | ||
4241 | ALIAS (neighbor_attr_unchanged, | |
4242 | neighbor_attr_unchanged7_cmd, | |
4243 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4244 | NEIGHBOR_STR | |
4245 | NEIGHBOR_ADDR_STR2 | |
4246 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4247 | "Nexthop attribute\n" | |
4248 | "Med attribute\n" | |
4249 | "As-path attribute\n") | |
4250 | ||
4251 | ALIAS (neighbor_attr_unchanged, | |
4252 | neighbor_attr_unchanged8_cmd, | |
4253 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4254 | NEIGHBOR_STR | |
4255 | NEIGHBOR_ADDR_STR2 | |
4256 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4257 | "Nexthop attribute\n" | |
4258 | "As-path attribute\n" | |
4259 | "Med attribute\n") | |
4260 | ||
4261 | ALIAS (neighbor_attr_unchanged, | |
4262 | neighbor_attr_unchanged9_cmd, | |
4263 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4264 | NEIGHBOR_STR | |
4265 | NEIGHBOR_ADDR_STR2 | |
4266 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4267 | "Med attribute\n" | |
4268 | "Nexthop attribute\n" | |
4269 | "As-path attribute\n") | |
4270 | ||
4271 | ALIAS (neighbor_attr_unchanged, | |
4272 | neighbor_attr_unchanged10_cmd, | |
4273 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4274 | NEIGHBOR_STR | |
4275 | NEIGHBOR_ADDR_STR2 | |
4276 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4277 | "Med attribute\n" | |
4278 | "As-path attribute\n" | |
4279 | "Nexthop attribute\n") | |
4280 | ||
4281 | DEFUN (no_neighbor_attr_unchanged, | |
4282 | no_neighbor_attr_unchanged_cmd, | |
4283 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
4284 | NO_STR | |
4285 | NEIGHBOR_STR | |
4286 | NEIGHBOR_ADDR_STR2 | |
4287 | "BGP attribute is propagated unchanged to this neighbor\n") | |
4288 | { | |
4289 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4290 | bgp_node_safi (vty), | |
4291 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4292 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4293 | PEER_FLAG_MED_UNCHANGED)); | |
4294 | } | |
4295 | ||
4296 | DEFUN (no_neighbor_attr_unchanged1, | |
4297 | no_neighbor_attr_unchanged1_cmd, | |
4298 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4299 | NO_STR | |
4300 | NEIGHBOR_STR | |
4301 | NEIGHBOR_ADDR_STR2 | |
4302 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4303 | "As-path attribute\n" | |
4304 | "Nexthop attribute\n" | |
4305 | "Med attribute\n") | |
4306 | { | |
4307 | u_int16_t flags = 0; | |
4308 | ||
4309 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4310 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4311 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4312 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4313 | else if (strncmp (argv[1], "med", 1) == 0) | |
4314 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4315 | ||
4316 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4317 | bgp_node_safi (vty), flags); | |
4318 | } | |
4319 | ||
4320 | DEFUN (no_neighbor_attr_unchanged2, | |
4321 | no_neighbor_attr_unchanged2_cmd, | |
4322 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4323 | NO_STR | |
4324 | NEIGHBOR_STR | |
4325 | NEIGHBOR_ADDR_STR2 | |
4326 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4327 | "As-path attribute\n" | |
4328 | "Nexthop attribute\n" | |
4329 | "Med attribute\n") | |
4330 | { | |
4331 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4332 | ||
4333 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4334 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4335 | else if (strncmp (argv[1], "med", 1) == 0) | |
4336 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4337 | ||
4338 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4339 | bgp_node_safi (vty), flags); | |
4340 | } | |
4341 | ||
4342 | DEFUN (no_neighbor_attr_unchanged3, | |
4343 | no_neighbor_attr_unchanged3_cmd, | |
4344 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4345 | NO_STR | |
4346 | NEIGHBOR_STR | |
4347 | NEIGHBOR_ADDR_STR2 | |
4348 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4349 | "Nexthop attribute\n" | |
4350 | "As-path attribute\n" | |
4351 | "Med attribute\n") | |
4352 | { | |
4353 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4354 | ||
4355 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4356 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4357 | else if (strncmp (argv[1], "med", 1) == 0) | |
4358 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4359 | ||
4360 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4361 | bgp_node_safi (vty), flags); | |
4362 | } | |
4363 | ||
4364 | DEFUN (no_neighbor_attr_unchanged4, | |
4365 | no_neighbor_attr_unchanged4_cmd, | |
4366 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4367 | NO_STR | |
4368 | NEIGHBOR_STR | |
4369 | NEIGHBOR_ADDR_STR2 | |
4370 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4371 | "Med attribute\n" | |
4372 | "As-path attribute\n" | |
4373 | "Nexthop attribute\n") | |
4374 | { | |
4375 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4376 | ||
4377 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4378 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4379 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4380 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4381 | ||
4382 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4383 | bgp_node_safi (vty), flags); | |
4384 | } | |
4385 | ||
4386 | ALIAS (no_neighbor_attr_unchanged, | |
4387 | no_neighbor_attr_unchanged5_cmd, | |
4388 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4389 | NO_STR | |
4390 | NEIGHBOR_STR | |
4391 | NEIGHBOR_ADDR_STR2 | |
4392 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4393 | "As-path attribute\n" | |
4394 | "Nexthop attribute\n" | |
4395 | "Med attribute\n") | |
4396 | ||
4397 | ALIAS (no_neighbor_attr_unchanged, | |
4398 | no_neighbor_attr_unchanged6_cmd, | |
4399 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4400 | NO_STR | |
4401 | NEIGHBOR_STR | |
4402 | NEIGHBOR_ADDR_STR2 | |
4403 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4404 | "As-path attribute\n" | |
4405 | "Med attribute\n" | |
4406 | "Nexthop attribute\n") | |
4407 | ||
4408 | ALIAS (no_neighbor_attr_unchanged, | |
4409 | no_neighbor_attr_unchanged7_cmd, | |
4410 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4411 | NO_STR | |
4412 | NEIGHBOR_STR | |
4413 | NEIGHBOR_ADDR_STR2 | |
4414 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4415 | "Nexthop attribute\n" | |
4416 | "Med attribute\n" | |
4417 | "As-path attribute\n") | |
4418 | ||
4419 | ALIAS (no_neighbor_attr_unchanged, | |
4420 | no_neighbor_attr_unchanged8_cmd, | |
4421 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4422 | NO_STR | |
4423 | NEIGHBOR_STR | |
4424 | NEIGHBOR_ADDR_STR2 | |
4425 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4426 | "Nexthop attribute\n" | |
4427 | "As-path attribute\n" | |
4428 | "Med attribute\n") | |
4429 | ||
4430 | ALIAS (no_neighbor_attr_unchanged, | |
4431 | no_neighbor_attr_unchanged9_cmd, | |
4432 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4433 | NO_STR | |
4434 | NEIGHBOR_STR | |
4435 | NEIGHBOR_ADDR_STR2 | |
4436 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4437 | "Med attribute\n" | |
4438 | "Nexthop attribute\n" | |
4439 | "As-path attribute\n") | |
4440 | ||
4441 | ALIAS (no_neighbor_attr_unchanged, | |
4442 | no_neighbor_attr_unchanged10_cmd, | |
4443 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4444 | NO_STR | |
4445 | NEIGHBOR_STR | |
4446 | NEIGHBOR_ADDR_STR2 | |
4447 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4448 | "Med attribute\n" | |
4449 | "As-path attribute\n" | |
4450 | "Nexthop attribute\n") | |
4451 | ||
718e3744 | 4452 | /* EBGP multihop configuration. */ |
94f2b392 | 4453 | static int |
fd79ac91 | 4454 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
4455 | const char *ttl_str) | |
718e3744 | 4456 | { |
4457 | struct peer *peer; | |
fd79ac91 | 4458 | unsigned int ttl; |
718e3744 | 4459 | |
4460 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4461 | if (! peer) | |
4462 | return CMD_WARNING; | |
4463 | ||
63fa10b5 QY |
4464 | if (peer->conf_if) |
4465 | return bgp_vty_return (vty, BGP_ERR_INVALID_FOR_DIRECT_PEER); | |
4466 | ||
718e3744 | 4467 | if (! ttl_str) |
9b1be336 | 4468 | ttl = MAXTTL; |
718e3744 | 4469 | else |
9b1be336 | 4470 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, MAXTTL); |
718e3744 | 4471 | |
89b6d1f8 | 4472 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 4473 | } |
4474 | ||
94f2b392 | 4475 | static int |
fd79ac91 | 4476 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4477 | { |
4478 | struct peer *peer; | |
4479 | ||
4480 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4481 | if (! peer) | |
4482 | return CMD_WARNING; | |
4483 | ||
89b6d1f8 | 4484 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 4485 | } |
4486 | ||
4487 | /* neighbor ebgp-multihop. */ | |
4488 | DEFUN (neighbor_ebgp_multihop, | |
4489 | neighbor_ebgp_multihop_cmd, | |
4490 | NEIGHBOR_CMD2 "ebgp-multihop", | |
4491 | NEIGHBOR_STR | |
4492 | NEIGHBOR_ADDR_STR2 | |
4493 | "Allow EBGP neighbors not on directly connected networks\n") | |
4494 | { | |
4495 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
4496 | } | |
4497 | ||
4498 | DEFUN (neighbor_ebgp_multihop_ttl, | |
4499 | neighbor_ebgp_multihop_ttl_cmd, | |
9b1be336 | 4500 | NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), |
718e3744 | 4501 | NEIGHBOR_STR |
4502 | NEIGHBOR_ADDR_STR2 | |
4503 | "Allow EBGP neighbors not on directly connected networks\n" | |
4504 | "maximum hop count\n") | |
4505 | { | |
4506 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
4507 | } | |
4508 | ||
4509 | DEFUN (no_neighbor_ebgp_multihop, | |
4510 | no_neighbor_ebgp_multihop_cmd, | |
4511 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
4512 | NO_STR | |
4513 | NEIGHBOR_STR | |
4514 | NEIGHBOR_ADDR_STR2 | |
4515 | "Allow EBGP neighbors not on directly connected networks\n") | |
4516 | { | |
4517 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
4518 | } | |
4519 | ||
4520 | ALIAS (no_neighbor_ebgp_multihop, | |
4521 | no_neighbor_ebgp_multihop_ttl_cmd, | |
9b1be336 | 4522 | NO_NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), |
718e3744 | 4523 | NO_STR |
4524 | NEIGHBOR_STR | |
4525 | NEIGHBOR_ADDR_STR2 | |
4526 | "Allow EBGP neighbors not on directly connected networks\n" | |
4527 | "maximum hop count\n") | |
6b0655a2 | 4528 | |
6ffd2079 | 4529 | /* disable-connected-check */ |
4530 | DEFUN (neighbor_disable_connected_check, | |
4531 | neighbor_disable_connected_check_cmd, | |
4532 | NEIGHBOR_CMD2 "disable-connected-check", | |
4533 | NEIGHBOR_STR | |
4534 | NEIGHBOR_ADDR_STR2 | |
4535 | "one-hop away EBGP peer using loopback address\n") | |
4536 | { | |
4537 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4538 | } | |
4539 | ||
4540 | DEFUN (no_neighbor_disable_connected_check, | |
4541 | no_neighbor_disable_connected_check_cmd, | |
4542 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
4543 | NO_STR | |
4544 | NEIGHBOR_STR | |
4545 | NEIGHBOR_ADDR_STR2 | |
4546 | "one-hop away EBGP peer using loopback address\n") | |
4547 | { | |
4548 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4549 | } | |
4550 | ||
718e3744 | 4551 | /* Enforce multihop. */ |
6ffd2079 | 4552 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 4553 | neighbor_enforce_multihop_cmd, |
4554 | NEIGHBOR_CMD2 "enforce-multihop", | |
4555 | NEIGHBOR_STR | |
4556 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4557 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 4558 | |
6ffd2079 | 4559 | /* Enforce multihop. */ |
4560 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 4561 | no_neighbor_enforce_multihop_cmd, |
4562 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
4563 | NO_STR | |
4564 | NEIGHBOR_STR | |
4565 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4566 | "Enforce EBGP neighbors perform multihop\n") |
6b0655a2 | 4567 | |
718e3744 | 4568 | DEFUN (neighbor_description, |
4569 | neighbor_description_cmd, | |
4570 | NEIGHBOR_CMD2 "description .LINE", | |
4571 | NEIGHBOR_STR | |
4572 | NEIGHBOR_ADDR_STR2 | |
4573 | "Neighbor specific description\n" | |
4574 | "Up to 80 characters describing this neighbor\n") | |
4575 | { | |
4576 | struct peer *peer; | |
718e3744 | 4577 | char *str; |
718e3744 | 4578 | |
4579 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4580 | if (! peer) | |
4581 | return CMD_WARNING; | |
4582 | ||
4583 | if (argc == 1) | |
4584 | return CMD_SUCCESS; | |
4585 | ||
3b8b1855 | 4586 | str = argv_concat(argv, argc, 1); |
718e3744 | 4587 | |
4588 | peer_description_set (peer, str); | |
4589 | ||
3b8b1855 | 4590 | XFREE (MTYPE_TMP, str); |
718e3744 | 4591 | |
4592 | return CMD_SUCCESS; | |
4593 | } | |
4594 | ||
4595 | DEFUN (no_neighbor_description, | |
4596 | no_neighbor_description_cmd, | |
4597 | NO_NEIGHBOR_CMD2 "description", | |
4598 | NO_STR | |
4599 | NEIGHBOR_STR | |
4600 | NEIGHBOR_ADDR_STR2 | |
4601 | "Neighbor specific description\n") | |
4602 | { | |
4603 | struct peer *peer; | |
4604 | ||
4605 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4606 | if (! peer) | |
4607 | return CMD_WARNING; | |
4608 | ||
4609 | peer_description_unset (peer); | |
4610 | ||
4611 | return CMD_SUCCESS; | |
4612 | } | |
4613 | ||
4614 | ALIAS (no_neighbor_description, | |
4615 | no_neighbor_description_val_cmd, | |
4616 | NO_NEIGHBOR_CMD2 "description .LINE", | |
4617 | NO_STR | |
4618 | NEIGHBOR_STR | |
4619 | NEIGHBOR_ADDR_STR2 | |
4620 | "Neighbor specific description\n" | |
4621 | "Up to 80 characters describing this neighbor\n") | |
6b0655a2 | 4622 | |
718e3744 | 4623 | /* Neighbor update-source. */ |
94f2b392 | 4624 | static int |
fd79ac91 | 4625 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
4626 | const char *source_str) | |
718e3744 | 4627 | { |
4628 | struct peer *peer; | |
718e3744 | 4629 | |
4630 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4631 | if (! peer) | |
4632 | return CMD_WARNING; | |
4633 | ||
a80beece DS |
4634 | if (peer->conf_if) |
4635 | return CMD_WARNING; | |
4636 | ||
718e3744 | 4637 | if (source_str) |
4638 | { | |
c63b83fe JBD |
4639 | union sockunion su; |
4640 | int ret = str2sockunion (source_str, &su); | |
4641 | ||
4642 | if (ret == 0) | |
4643 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 4644 | else |
4645 | peer_update_source_if_set (peer, source_str); | |
4646 | } | |
4647 | else | |
4648 | peer_update_source_unset (peer); | |
4649 | ||
4650 | return CMD_SUCCESS; | |
4651 | } | |
4652 | ||
dcb52bd5 DS |
4653 | #define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD" |
4654 | #define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")" | |
4655 | #define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}" | |
369688c0 PJ |
4656 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
4657 | "IPv4 address\n" \ | |
9a1a331d PJ |
4658 | "IPv6 address\n" \ |
4659 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 4660 | |
718e3744 | 4661 | DEFUN (neighbor_update_source, |
4662 | neighbor_update_source_cmd, | |
dcb52bd5 | 4663 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_REQ_STR, |
718e3744 | 4664 | NEIGHBOR_STR |
4665 | NEIGHBOR_ADDR_STR2 | |
4666 | "Source of routing updates\n" | |
369688c0 | 4667 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 4668 | { |
4669 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
4670 | } | |
4671 | ||
4672 | DEFUN (no_neighbor_update_source, | |
4673 | no_neighbor_update_source_cmd, | |
dcb52bd5 | 4674 | NO_NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_OPT_STR, |
718e3744 | 4675 | NO_STR |
4676 | NEIGHBOR_STR | |
4677 | NEIGHBOR_ADDR_STR2 | |
dcb52bd5 DS |
4678 | "Source of routing updates\n" |
4679 | BGP_UPDATE_SOURCE_HELP_STR) | |
718e3744 | 4680 | { |
4681 | return peer_update_source_vty (vty, argv[0], NULL); | |
4682 | } | |
6b0655a2 | 4683 | |
94f2b392 | 4684 | static int |
fd79ac91 | 4685 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
4686 | afi_t afi, safi_t safi, | |
4687 | const char *rmap, int set) | |
718e3744 | 4688 | { |
4689 | int ret; | |
4690 | struct peer *peer; | |
4691 | ||
4692 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4693 | if (! peer) | |
4694 | return CMD_WARNING; | |
4695 | ||
4696 | if (set) | |
4697 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
4698 | else | |
4699 | ret = peer_default_originate_unset (peer, afi, safi); | |
4700 | ||
4701 | return bgp_vty_return (vty, ret); | |
4702 | } | |
4703 | ||
4704 | /* neighbor default-originate. */ | |
4705 | DEFUN (neighbor_default_originate, | |
4706 | neighbor_default_originate_cmd, | |
4707 | NEIGHBOR_CMD2 "default-originate", | |
4708 | NEIGHBOR_STR | |
4709 | NEIGHBOR_ADDR_STR2 | |
4710 | "Originate default route to this neighbor\n") | |
4711 | { | |
4712 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4713 | bgp_node_safi (vty), NULL, 1); | |
4714 | } | |
4715 | ||
4716 | DEFUN (neighbor_default_originate_rmap, | |
4717 | neighbor_default_originate_rmap_cmd, | |
4718 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4719 | NEIGHBOR_STR | |
4720 | NEIGHBOR_ADDR_STR2 | |
4721 | "Originate default route to this neighbor\n" | |
4722 | "Route-map to specify criteria to originate default\n" | |
4723 | "route-map name\n") | |
4724 | { | |
4725 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4726 | bgp_node_safi (vty), argv[1], 1); | |
4727 | } | |
4728 | ||
4729 | DEFUN (no_neighbor_default_originate, | |
4730 | no_neighbor_default_originate_cmd, | |
4731 | NO_NEIGHBOR_CMD2 "default-originate", | |
4732 | NO_STR | |
4733 | NEIGHBOR_STR | |
4734 | NEIGHBOR_ADDR_STR2 | |
4735 | "Originate default route to this neighbor\n") | |
4736 | { | |
4737 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4738 | bgp_node_safi (vty), NULL, 0); | |
4739 | } | |
4740 | ||
4741 | ALIAS (no_neighbor_default_originate, | |
4742 | no_neighbor_default_originate_rmap_cmd, | |
4743 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4744 | NO_STR | |
4745 | NEIGHBOR_STR | |
4746 | NEIGHBOR_ADDR_STR2 | |
4747 | "Originate default route to this neighbor\n" | |
4748 | "Route-map to specify criteria to originate default\n" | |
4749 | "route-map name\n") | |
6b0655a2 | 4750 | |
718e3744 | 4751 | /* Set neighbor's BGP port. */ |
94f2b392 | 4752 | static int |
fd79ac91 | 4753 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
4754 | const char *port_str) | |
718e3744 | 4755 | { |
4756 | struct peer *peer; | |
4757 | u_int16_t port; | |
4758 | struct servent *sp; | |
4759 | ||
4760 | peer = peer_lookup_vty (vty, ip_str); | |
4761 | if (! peer) | |
4762 | return CMD_WARNING; | |
4763 | ||
4764 | if (! port_str) | |
4765 | { | |
4766 | sp = getservbyname ("bgp", "tcp"); | |
4767 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
4768 | } | |
4769 | else | |
4770 | { | |
4771 | VTY_GET_INTEGER("port", port, port_str); | |
4772 | } | |
4773 | ||
4774 | peer_port_set (peer, port); | |
4775 | ||
4776 | return CMD_SUCCESS; | |
4777 | } | |
4778 | ||
f418446b | 4779 | /* Set specified peer's BGP port. */ |
718e3744 | 4780 | DEFUN (neighbor_port, |
4781 | neighbor_port_cmd, | |
4782 | NEIGHBOR_CMD "port <0-65535>", | |
4783 | NEIGHBOR_STR | |
4784 | NEIGHBOR_ADDR_STR | |
4785 | "Neighbor's BGP port\n" | |
4786 | "TCP port number\n") | |
4787 | { | |
4788 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
4789 | } | |
4790 | ||
4791 | DEFUN (no_neighbor_port, | |
4792 | no_neighbor_port_cmd, | |
4793 | NO_NEIGHBOR_CMD "port", | |
4794 | NO_STR | |
4795 | NEIGHBOR_STR | |
4796 | NEIGHBOR_ADDR_STR | |
4797 | "Neighbor's BGP port\n") | |
4798 | { | |
4799 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
4800 | } | |
4801 | ||
4802 | ALIAS (no_neighbor_port, | |
4803 | no_neighbor_port_val_cmd, | |
4804 | NO_NEIGHBOR_CMD "port <0-65535>", | |
4805 | NO_STR | |
4806 | NEIGHBOR_STR | |
4807 | NEIGHBOR_ADDR_STR | |
4808 | "Neighbor's BGP port\n" | |
4809 | "TCP port number\n") | |
6b0655a2 | 4810 | |
718e3744 | 4811 | /* neighbor weight. */ |
94f2b392 | 4812 | static int |
fd79ac91 | 4813 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
4814 | const char *weight_str) | |
718e3744 | 4815 | { |
1f9a9fff | 4816 | int ret; |
718e3744 | 4817 | struct peer *peer; |
4818 | unsigned long weight; | |
4819 | ||
4820 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4821 | if (! peer) | |
4822 | return CMD_WARNING; | |
4823 | ||
4824 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
4825 | ||
1f9a9fff PJ |
4826 | ret = peer_weight_set (peer, weight); |
4827 | return bgp_vty_return (vty, ret); | |
718e3744 | 4828 | } |
4829 | ||
94f2b392 | 4830 | static int |
fd79ac91 | 4831 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4832 | { |
1f9a9fff | 4833 | int ret; |
718e3744 | 4834 | struct peer *peer; |
4835 | ||
4836 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4837 | if (! peer) | |
4838 | return CMD_WARNING; | |
4839 | ||
1f9a9fff PJ |
4840 | ret = peer_weight_unset (peer); |
4841 | return bgp_vty_return (vty, ret); | |
718e3744 | 4842 | } |
4843 | ||
4844 | DEFUN (neighbor_weight, | |
4845 | neighbor_weight_cmd, | |
4846 | NEIGHBOR_CMD2 "weight <0-65535>", | |
4847 | NEIGHBOR_STR | |
4848 | NEIGHBOR_ADDR_STR2 | |
4849 | "Set default weight for routes from this neighbor\n" | |
4850 | "default weight\n") | |
4851 | { | |
4852 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
4853 | } | |
4854 | ||
4855 | DEFUN (no_neighbor_weight, | |
4856 | no_neighbor_weight_cmd, | |
4857 | NO_NEIGHBOR_CMD2 "weight", | |
4858 | NO_STR | |
4859 | NEIGHBOR_STR | |
4860 | NEIGHBOR_ADDR_STR2 | |
4861 | "Set default weight for routes from this neighbor\n") | |
4862 | { | |
4863 | return peer_weight_unset_vty (vty, argv[0]); | |
4864 | } | |
4865 | ||
4866 | ALIAS (no_neighbor_weight, | |
4867 | no_neighbor_weight_val_cmd, | |
4868 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
4869 | NO_STR | |
4870 | NEIGHBOR_STR | |
4871 | NEIGHBOR_ADDR_STR2 | |
4872 | "Set default weight for routes from this neighbor\n" | |
4873 | "default weight\n") | |
6b0655a2 | 4874 | |
718e3744 | 4875 | /* Override capability negotiation. */ |
4876 | DEFUN (neighbor_override_capability, | |
4877 | neighbor_override_capability_cmd, | |
4878 | NEIGHBOR_CMD2 "override-capability", | |
4879 | NEIGHBOR_STR | |
4880 | NEIGHBOR_ADDR_STR2 | |
4881 | "Override capability negotiation result\n") | |
4882 | { | |
4883 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4884 | } | |
4885 | ||
4886 | DEFUN (no_neighbor_override_capability, | |
4887 | no_neighbor_override_capability_cmd, | |
4888 | NO_NEIGHBOR_CMD2 "override-capability", | |
4889 | NO_STR | |
4890 | NEIGHBOR_STR | |
4891 | NEIGHBOR_ADDR_STR2 | |
4892 | "Override capability negotiation result\n") | |
4893 | { | |
4894 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4895 | } | |
6b0655a2 | 4896 | |
718e3744 | 4897 | DEFUN (neighbor_strict_capability, |
4898 | neighbor_strict_capability_cmd, | |
4899 | NEIGHBOR_CMD "strict-capability-match", | |
4900 | NEIGHBOR_STR | |
4901 | NEIGHBOR_ADDR_STR | |
4902 | "Strict capability negotiation match\n") | |
4903 | { | |
4904 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4905 | } | |
4906 | ||
4907 | DEFUN (no_neighbor_strict_capability, | |
4908 | no_neighbor_strict_capability_cmd, | |
4909 | NO_NEIGHBOR_CMD "strict-capability-match", | |
4910 | NO_STR | |
4911 | NEIGHBOR_STR | |
4912 | NEIGHBOR_ADDR_STR | |
4913 | "Strict capability negotiation match\n") | |
4914 | { | |
4915 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4916 | } | |
6b0655a2 | 4917 | |
94f2b392 | 4918 | static int |
fd79ac91 | 4919 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
4920 | const char *keep_str, const char *hold_str) | |
718e3744 | 4921 | { |
4922 | int ret; | |
4923 | struct peer *peer; | |
4924 | u_int32_t keepalive; | |
4925 | u_int32_t holdtime; | |
4926 | ||
4927 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4928 | if (! peer) | |
4929 | return CMD_WARNING; | |
4930 | ||
4931 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
4932 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
4933 | ||
4934 | ret = peer_timers_set (peer, keepalive, holdtime); | |
4935 | ||
4936 | return bgp_vty_return (vty, ret); | |
4937 | } | |
6b0655a2 | 4938 | |
94f2b392 | 4939 | static int |
fd79ac91 | 4940 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4941 | { |
4942 | int ret; | |
4943 | struct peer *peer; | |
4944 | ||
0c412461 | 4945 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4946 | if (! peer) |
4947 | return CMD_WARNING; | |
4948 | ||
4949 | ret = peer_timers_unset (peer); | |
4950 | ||
4951 | return bgp_vty_return (vty, ret); | |
4952 | } | |
4953 | ||
4954 | DEFUN (neighbor_timers, | |
4955 | neighbor_timers_cmd, | |
4956 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4957 | NEIGHBOR_STR | |
4958 | NEIGHBOR_ADDR_STR2 | |
4959 | "BGP per neighbor timers\n" | |
4960 | "Keepalive interval\n" | |
4961 | "Holdtime\n") | |
4962 | { | |
4963 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
4964 | } | |
4965 | ||
4966 | DEFUN (no_neighbor_timers, | |
4967 | no_neighbor_timers_cmd, | |
4968 | NO_NEIGHBOR_CMD2 "timers", | |
4969 | NO_STR | |
4970 | NEIGHBOR_STR | |
4971 | NEIGHBOR_ADDR_STR2 | |
4972 | "BGP per neighbor timers\n") | |
4973 | { | |
4974 | return peer_timers_unset_vty (vty, argv[0]); | |
4975 | } | |
6b0655a2 | 4976 | |
813d4307 DW |
4977 | ALIAS (no_neighbor_timers, |
4978 | no_neighbor_timers_val_cmd, | |
4979 | NO_NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4980 | NO_STR | |
4981 | NEIGHBOR_STR | |
4982 | NEIGHBOR_ADDR_STR2 | |
4983 | "BGP per neighbor timers\n" | |
4984 | "Keepalive interval\n" | |
4985 | "Holdtime\n") | |
4986 | ||
94f2b392 | 4987 | static int |
fd79ac91 | 4988 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
4989 | const char *time_str) | |
718e3744 | 4990 | { |
4991 | int ret; | |
4992 | struct peer *peer; | |
4993 | u_int32_t connect; | |
4994 | ||
966f821c | 4995 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4996 | if (! peer) |
4997 | return CMD_WARNING; | |
4998 | ||
4999 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
5000 | ||
5001 | ret = peer_timers_connect_set (peer, connect); | |
5002 | ||
966f821c | 5003 | return bgp_vty_return (vty, ret); |
718e3744 | 5004 | } |
5005 | ||
94f2b392 | 5006 | static int |
fd79ac91 | 5007 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 5008 | { |
5009 | int ret; | |
5010 | struct peer *peer; | |
5011 | ||
5012 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5013 | if (! peer) | |
5014 | return CMD_WARNING; | |
5015 | ||
5016 | ret = peer_timers_connect_unset (peer); | |
5017 | ||
966f821c | 5018 | return bgp_vty_return (vty, ret); |
718e3744 | 5019 | } |
5020 | ||
5021 | DEFUN (neighbor_timers_connect, | |
5022 | neighbor_timers_connect_cmd, | |
8e0d0089 | 5023 | NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 5024 | NEIGHBOR_STR |
966f821c | 5025 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5026 | "BGP per neighbor timers\n" |
5027 | "BGP connect timer\n" | |
5028 | "Connect timer\n") | |
5029 | { | |
5030 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
5031 | } | |
5032 | ||
5033 | DEFUN (no_neighbor_timers_connect, | |
5034 | no_neighbor_timers_connect_cmd, | |
966f821c | 5035 | NO_NEIGHBOR_CMD2 "timers connect", |
718e3744 | 5036 | NO_STR |
5037 | NEIGHBOR_STR | |
966f821c | 5038 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5039 | "BGP per neighbor timers\n" |
5040 | "BGP connect timer\n") | |
5041 | { | |
5042 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
5043 | } | |
5044 | ||
5045 | ALIAS (no_neighbor_timers_connect, | |
5046 | no_neighbor_timers_connect_val_cmd, | |
8e0d0089 | 5047 | NO_NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 5048 | NO_STR |
5049 | NEIGHBOR_STR | |
966f821c | 5050 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5051 | "BGP per neighbor timers\n" |
5052 | "BGP connect timer\n" | |
5053 | "Connect timer\n") | |
6b0655a2 | 5054 | |
94f2b392 | 5055 | static int |
fd79ac91 | 5056 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
5057 | const char *time_str, int set) | |
718e3744 | 5058 | { |
5059 | int ret; | |
5060 | struct peer *peer; | |
5061 | u_int32_t routeadv = 0; | |
5062 | ||
966f821c | 5063 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 5064 | if (! peer) |
5065 | return CMD_WARNING; | |
5066 | ||
5067 | if (time_str) | |
5068 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
5069 | ||
5070 | if (set) | |
5071 | ret = peer_advertise_interval_set (peer, routeadv); | |
5072 | else | |
5073 | ret = peer_advertise_interval_unset (peer); | |
5074 | ||
966f821c | 5075 | return bgp_vty_return (vty, ret); |
718e3744 | 5076 | } |
5077 | ||
5078 | DEFUN (neighbor_advertise_interval, | |
5079 | neighbor_advertise_interval_cmd, | |
966f821c | 5080 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 5081 | NEIGHBOR_STR |
966f821c | 5082 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5083 | "Minimum interval between sending BGP routing updates\n" |
5084 | "time in seconds\n") | |
5085 | { | |
5086 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
5087 | } | |
5088 | ||
5089 | DEFUN (no_neighbor_advertise_interval, | |
5090 | no_neighbor_advertise_interval_cmd, | |
966f821c | 5091 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
718e3744 | 5092 | NO_STR |
5093 | NEIGHBOR_STR | |
966f821c | 5094 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5095 | "Minimum interval between sending BGP routing updates\n") |
5096 | { | |
5097 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
5098 | } | |
5099 | ||
5100 | ALIAS (no_neighbor_advertise_interval, | |
5101 | no_neighbor_advertise_interval_val_cmd, | |
966f821c | 5102 | NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 5103 | NO_STR |
5104 | NEIGHBOR_STR | |
966f821c | 5105 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5106 | "Minimum interval between sending BGP routing updates\n" |
5107 | "time in seconds\n") | |
6b0655a2 | 5108 | |
518f0eb1 DS |
5109 | /* Time to wait before processing route-map updates */ |
5110 | DEFUN (bgp_set_route_map_delay_timer, | |
5111 | bgp_set_route_map_delay_timer_cmd, | |
5112 | "bgp route-map delay-timer <0-600>", | |
5113 | SET_STR | |
5114 | "BGP route-map delay timer\n" | |
5115 | "Time in secs to wait before processing route-map changes\n" | |
f414725f | 5116 | "0 disables the timer, no route updates happen when route-maps change\n") |
518f0eb1 DS |
5117 | { |
5118 | u_int32_t rmap_delay_timer; | |
518f0eb1 | 5119 | |
518f0eb1 DS |
5120 | if (argv[0]) |
5121 | { | |
5122 | VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); | |
5fe9f963 | 5123 | bm->rmap_update_timer = rmap_delay_timer; |
518f0eb1 DS |
5124 | |
5125 | /* if the dynamic update handling is being disabled, and a timer is | |
5126 | * running, stop the timer and act as if the timer has already fired. | |
5127 | */ | |
5fe9f963 | 5128 | if (!rmap_delay_timer && bm->t_rmap_update ) |
518f0eb1 | 5129 | { |
5fe9f963 | 5130 | BGP_TIMER_OFF(bm->t_rmap_update); |
5131 | thread_execute (bm->master, bgp_route_map_update_timer, NULL, 0); | |
518f0eb1 DS |
5132 | } |
5133 | return CMD_SUCCESS; | |
5134 | } | |
5135 | else | |
ffd0c037 | 5136 | return CMD_WARNING; |
518f0eb1 DS |
5137 | } |
5138 | ||
5139 | DEFUN (no_bgp_set_route_map_delay_timer, | |
5140 | no_bgp_set_route_map_delay_timer_cmd, | |
5141 | "no bgp route-map delay-timer", | |
5142 | NO_STR | |
5143 | "Default BGP route-map delay timer\n" | |
f414725f | 5144 | "Reset to default time to wait for processing route-map changes\n") |
518f0eb1 | 5145 | { |
518f0eb1 | 5146 | |
5fe9f963 | 5147 | bm->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER; |
518f0eb1 DS |
5148 | |
5149 | return CMD_SUCCESS; | |
5150 | } | |
5151 | ||
f414725f DS |
5152 | ALIAS (no_bgp_set_route_map_delay_timer, |
5153 | no_bgp_set_route_map_delay_timer_val_cmd, | |
5154 | "no bgp route-map delay-timer <0-600>", | |
5155 | NO_STR | |
5156 | "Default BGP route-map delay timer\n" | |
5157 | "Reset to default time to wait for processing route-map changes\n" | |
5158 | "0 disables the timer, no route updates happen when route-maps change\n") | |
5159 | ||
718e3744 | 5160 | /* neighbor interface */ |
94f2b392 | 5161 | static int |
fd79ac91 | 5162 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 5163 | { |
718e3744 | 5164 | struct peer *peer; |
5165 | ||
5166 | peer = peer_lookup_vty (vty, ip_str); | |
a80beece | 5167 | if (! peer || peer->conf_if) |
718e3744 | 5168 | return CMD_WARNING; |
5169 | ||
5170 | if (str) | |
ffd0c037 | 5171 | peer_interface_set (peer, str); |
718e3744 | 5172 | else |
ffd0c037 | 5173 | peer_interface_unset (peer); |
718e3744 | 5174 | |
5175 | return CMD_SUCCESS; | |
5176 | } | |
5177 | ||
5178 | DEFUN (neighbor_interface, | |
5179 | neighbor_interface_cmd, | |
5180 | NEIGHBOR_CMD "interface WORD", | |
5181 | NEIGHBOR_STR | |
5182 | NEIGHBOR_ADDR_STR | |
5183 | "Interface\n" | |
5184 | "Interface name\n") | |
5185 | { | |
8ffedcea DS |
5186 | if (argc == 3) |
5187 | return peer_interface_vty (vty, argv[0], argv[1]); | |
5188 | else | |
5189 | return peer_interface_vty (vty, argv[0], argv[1]); | |
718e3744 | 5190 | } |
5191 | ||
5192 | DEFUN (no_neighbor_interface, | |
5193 | no_neighbor_interface_cmd, | |
8ffedcea | 5194 | NO_NEIGHBOR_CMD2 "interface WORD", |
718e3744 | 5195 | NO_STR |
5196 | NEIGHBOR_STR | |
5197 | NEIGHBOR_ADDR_STR | |
5198 | "Interface\n" | |
5199 | "Interface name\n") | |
5200 | { | |
5201 | return peer_interface_vty (vty, argv[0], NULL); | |
5202 | } | |
6b0655a2 | 5203 | |
718e3744 | 5204 | /* Set distribute list to the peer. */ |
94f2b392 | 5205 | static int |
fd79ac91 | 5206 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
5207 | afi_t afi, safi_t safi, | |
5208 | const char *name_str, const char *direct_str) | |
718e3744 | 5209 | { |
5210 | int ret; | |
5211 | struct peer *peer; | |
5212 | int direct = FILTER_IN; | |
5213 | ||
5214 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5215 | if (! peer) | |
5216 | return CMD_WARNING; | |
5217 | ||
5218 | /* Check filter direction. */ | |
5219 | if (strncmp (direct_str, "i", 1) == 0) | |
5220 | direct = FILTER_IN; | |
5221 | else if (strncmp (direct_str, "o", 1) == 0) | |
5222 | direct = FILTER_OUT; | |
5223 | ||
5224 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
5225 | ||
5226 | return bgp_vty_return (vty, ret); | |
5227 | } | |
5228 | ||
94f2b392 | 5229 | static int |
fd79ac91 | 5230 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5231 | safi_t safi, const char *direct_str) | |
718e3744 | 5232 | { |
5233 | int ret; | |
5234 | struct peer *peer; | |
5235 | int direct = FILTER_IN; | |
5236 | ||
5237 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5238 | if (! peer) | |
5239 | return CMD_WARNING; | |
5240 | ||
5241 | /* Check filter direction. */ | |
5242 | if (strncmp (direct_str, "i", 1) == 0) | |
5243 | direct = FILTER_IN; | |
5244 | else if (strncmp (direct_str, "o", 1) == 0) | |
5245 | direct = FILTER_OUT; | |
5246 | ||
5247 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
5248 | ||
5249 | return bgp_vty_return (vty, ret); | |
5250 | } | |
5251 | ||
5252 | DEFUN (neighbor_distribute_list, | |
5253 | neighbor_distribute_list_cmd, | |
5254 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5255 | NEIGHBOR_STR | |
5256 | NEIGHBOR_ADDR_STR2 | |
5257 | "Filter updates to/from this neighbor\n" | |
5258 | "IP access-list number\n" | |
5259 | "IP access-list number (expanded range)\n" | |
5260 | "IP Access-list name\n" | |
5261 | "Filter incoming updates\n" | |
5262 | "Filter outgoing updates\n") | |
5263 | { | |
5264 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5265 | bgp_node_safi (vty), argv[1], argv[2]); | |
5266 | } | |
5267 | ||
5268 | DEFUN (no_neighbor_distribute_list, | |
5269 | no_neighbor_distribute_list_cmd, | |
5270 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5271 | NO_STR | |
5272 | NEIGHBOR_STR | |
5273 | NEIGHBOR_ADDR_STR2 | |
5274 | "Filter updates to/from this neighbor\n" | |
5275 | "IP access-list number\n" | |
5276 | "IP access-list number (expanded range)\n" | |
5277 | "IP Access-list name\n" | |
5278 | "Filter incoming updates\n" | |
5279 | "Filter outgoing updates\n") | |
5280 | { | |
5281 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5282 | bgp_node_safi (vty), argv[2]); | |
5283 | } | |
6b0655a2 | 5284 | |
718e3744 | 5285 | /* Set prefix list to the peer. */ |
94f2b392 | 5286 | static int |
fd79ac91 | 5287 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5288 | safi_t safi, const char *name_str, | |
5289 | const char *direct_str) | |
718e3744 | 5290 | { |
5291 | int ret; | |
5292 | struct peer *peer; | |
5293 | int direct = FILTER_IN; | |
5294 | ||
5295 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5296 | if (! peer) | |
5297 | return CMD_WARNING; | |
5298 | ||
5299 | /* Check filter direction. */ | |
5300 | if (strncmp (direct_str, "i", 1) == 0) | |
5301 | direct = FILTER_IN; | |
5302 | else if (strncmp (direct_str, "o", 1) == 0) | |
5303 | direct = FILTER_OUT; | |
5304 | ||
5305 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
5306 | ||
5307 | return bgp_vty_return (vty, ret); | |
5308 | } | |
5309 | ||
94f2b392 | 5310 | static int |
fd79ac91 | 5311 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5312 | safi_t safi, const char *direct_str) | |
718e3744 | 5313 | { |
5314 | int ret; | |
5315 | struct peer *peer; | |
5316 | int direct = FILTER_IN; | |
5317 | ||
5318 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5319 | if (! peer) | |
5320 | return CMD_WARNING; | |
5321 | ||
5322 | /* Check filter direction. */ | |
5323 | if (strncmp (direct_str, "i", 1) == 0) | |
5324 | direct = FILTER_IN; | |
5325 | else if (strncmp (direct_str, "o", 1) == 0) | |
5326 | direct = FILTER_OUT; | |
5327 | ||
5328 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
5329 | ||
5330 | return bgp_vty_return (vty, ret); | |
5331 | } | |
5332 | ||
5333 | DEFUN (neighbor_prefix_list, | |
5334 | neighbor_prefix_list_cmd, | |
5335 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5336 | NEIGHBOR_STR | |
5337 | NEIGHBOR_ADDR_STR2 | |
5338 | "Filter updates to/from this neighbor\n" | |
5339 | "Name of a prefix list\n" | |
5340 | "Filter incoming updates\n" | |
5341 | "Filter outgoing updates\n") | |
5342 | { | |
5343 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5344 | bgp_node_safi (vty), argv[1], argv[2]); | |
5345 | } | |
5346 | ||
5347 | DEFUN (no_neighbor_prefix_list, | |
5348 | no_neighbor_prefix_list_cmd, | |
5349 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5350 | NO_STR | |
5351 | NEIGHBOR_STR | |
5352 | NEIGHBOR_ADDR_STR2 | |
5353 | "Filter updates to/from this neighbor\n" | |
5354 | "Name of a prefix list\n" | |
5355 | "Filter incoming updates\n" | |
5356 | "Filter outgoing updates\n") | |
5357 | { | |
5358 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5359 | bgp_node_safi (vty), argv[2]); | |
5360 | } | |
6b0655a2 | 5361 | |
94f2b392 | 5362 | static int |
fd79ac91 | 5363 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
5364 | afi_t afi, safi_t safi, | |
5365 | const char *name_str, const char *direct_str) | |
718e3744 | 5366 | { |
5367 | int ret; | |
5368 | struct peer *peer; | |
5369 | int direct = FILTER_IN; | |
5370 | ||
5371 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5372 | if (! peer) | |
5373 | return CMD_WARNING; | |
5374 | ||
5375 | /* Check filter direction. */ | |
5376 | if (strncmp (direct_str, "i", 1) == 0) | |
5377 | direct = FILTER_IN; | |
5378 | else if (strncmp (direct_str, "o", 1) == 0) | |
5379 | direct = FILTER_OUT; | |
5380 | ||
5381 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
5382 | ||
5383 | return bgp_vty_return (vty, ret); | |
5384 | } | |
5385 | ||
94f2b392 | 5386 | static int |
fd79ac91 | 5387 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
5388 | afi_t afi, safi_t safi, | |
5389 | const char *direct_str) | |
718e3744 | 5390 | { |
5391 | int ret; | |
5392 | struct peer *peer; | |
5393 | int direct = FILTER_IN; | |
5394 | ||
5395 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5396 | if (! peer) | |
5397 | return CMD_WARNING; | |
5398 | ||
5399 | /* Check filter direction. */ | |
5400 | if (strncmp (direct_str, "i", 1) == 0) | |
5401 | direct = FILTER_IN; | |
5402 | else if (strncmp (direct_str, "o", 1) == 0) | |
5403 | direct = FILTER_OUT; | |
5404 | ||
5405 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
5406 | ||
5407 | return bgp_vty_return (vty, ret); | |
5408 | } | |
5409 | ||
5410 | DEFUN (neighbor_filter_list, | |
5411 | neighbor_filter_list_cmd, | |
5412 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5413 | NEIGHBOR_STR | |
5414 | NEIGHBOR_ADDR_STR2 | |
5415 | "Establish BGP filters\n" | |
5416 | "AS path access-list name\n" | |
5417 | "Filter incoming routes\n" | |
5418 | "Filter outgoing routes\n") | |
5419 | { | |
5420 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5421 | bgp_node_safi (vty), argv[1], argv[2]); | |
5422 | } | |
5423 | ||
5424 | DEFUN (no_neighbor_filter_list, | |
5425 | no_neighbor_filter_list_cmd, | |
5426 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5427 | NO_STR | |
5428 | NEIGHBOR_STR | |
5429 | NEIGHBOR_ADDR_STR2 | |
5430 | "Establish BGP filters\n" | |
5431 | "AS path access-list name\n" | |
5432 | "Filter incoming routes\n" | |
5433 | "Filter outgoing routes\n") | |
5434 | { | |
5435 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5436 | bgp_node_safi (vty), argv[2]); | |
5437 | } | |
6b0655a2 | 5438 | |
718e3744 | 5439 | /* Set route-map to the peer. */ |
94f2b392 | 5440 | static int |
fd79ac91 | 5441 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
5442 | afi_t afi, safi_t safi, | |
5443 | const char *name_str, const char *direct_str) | |
718e3744 | 5444 | { |
5445 | int ret; | |
5446 | struct peer *peer; | |
fee0f4c6 | 5447 | int direct = RMAP_IN; |
718e3744 | 5448 | |
5449 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5450 | if (! peer) | |
5451 | return CMD_WARNING; | |
5452 | ||
5453 | /* Check filter direction. */ | |
fee0f4c6 | 5454 | if (strncmp (direct_str, "in", 2) == 0) |
5455 | direct = RMAP_IN; | |
718e3744 | 5456 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5457 | direct = RMAP_OUT; |
718e3744 | 5458 | |
5459 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
5460 | ||
5461 | return bgp_vty_return (vty, ret); | |
5462 | } | |
5463 | ||
94f2b392 | 5464 | static int |
fd79ac91 | 5465 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5466 | safi_t safi, const char *direct_str) | |
718e3744 | 5467 | { |
5468 | int ret; | |
5469 | struct peer *peer; | |
fee0f4c6 | 5470 | int direct = RMAP_IN; |
718e3744 | 5471 | |
5472 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5473 | if (! peer) | |
5474 | return CMD_WARNING; | |
5475 | ||
5476 | /* Check filter direction. */ | |
fee0f4c6 | 5477 | if (strncmp (direct_str, "in", 2) == 0) |
5478 | direct = RMAP_IN; | |
718e3744 | 5479 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5480 | direct = RMAP_OUT; |
718e3744 | 5481 | |
5482 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
5483 | ||
5484 | return bgp_vty_return (vty, ret); | |
5485 | } | |
5486 | ||
5487 | DEFUN (neighbor_route_map, | |
5488 | neighbor_route_map_cmd, | |
2a3d5731 | 5489 | NEIGHBOR_CMD2 "route-map WORD (in|out)", |
718e3744 | 5490 | NEIGHBOR_STR |
5491 | NEIGHBOR_ADDR_STR2 | |
5492 | "Apply route map to neighbor\n" | |
5493 | "Name of route map\n" | |
5494 | "Apply map to incoming routes\n" | |
2a3d5731 | 5495 | "Apply map to outbound routes\n") |
718e3744 | 5496 | { |
5497 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5498 | bgp_node_safi (vty), argv[1], argv[2]); | |
5499 | } | |
5500 | ||
5501 | DEFUN (no_neighbor_route_map, | |
5502 | no_neighbor_route_map_cmd, | |
2a3d5731 | 5503 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out)", |
718e3744 | 5504 | NO_STR |
5505 | NEIGHBOR_STR | |
5506 | NEIGHBOR_ADDR_STR2 | |
5507 | "Apply route map to neighbor\n" | |
5508 | "Name of route map\n" | |
5509 | "Apply map to incoming routes\n" | |
2a3d5731 | 5510 | "Apply map to outbound routes\n") |
718e3744 | 5511 | { |
5512 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5513 | bgp_node_safi (vty), argv[2]); | |
5514 | } | |
6b0655a2 | 5515 | |
718e3744 | 5516 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 5517 | static int |
fd79ac91 | 5518 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5519 | safi_t safi, const char *name_str) | |
718e3744 | 5520 | { |
5521 | int ret; | |
5522 | struct peer *peer; | |
5523 | ||
5524 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5525 | if (! peer) | |
5526 | return CMD_WARNING; | |
5527 | ||
5528 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
5529 | ||
5530 | return bgp_vty_return (vty, ret); | |
5531 | } | |
5532 | ||
5533 | /* Unset route-map from the peer. */ | |
94f2b392 | 5534 | static int |
fd79ac91 | 5535 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5536 | safi_t safi) |
5537 | { | |
5538 | int ret; | |
5539 | struct peer *peer; | |
5540 | ||
5541 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5542 | if (! peer) | |
5543 | return CMD_WARNING; | |
5544 | ||
5545 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
5546 | ||
5547 | return bgp_vty_return (vty, ret); | |
5548 | } | |
5549 | ||
5550 | DEFUN (neighbor_unsuppress_map, | |
5551 | neighbor_unsuppress_map_cmd, | |
5552 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5553 | NEIGHBOR_STR | |
5554 | NEIGHBOR_ADDR_STR2 | |
5555 | "Route-map to selectively unsuppress suppressed routes\n" | |
5556 | "Name of route map\n") | |
5557 | { | |
5558 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5559 | bgp_node_safi (vty), argv[1]); | |
5560 | } | |
5561 | ||
5562 | DEFUN (no_neighbor_unsuppress_map, | |
5563 | no_neighbor_unsuppress_map_cmd, | |
5564 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5565 | NO_STR | |
5566 | NEIGHBOR_STR | |
5567 | NEIGHBOR_ADDR_STR2 | |
5568 | "Route-map to selectively unsuppress suppressed routes\n" | |
5569 | "Name of route map\n") | |
5570 | { | |
5571 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5572 | bgp_node_safi (vty)); | |
5573 | } | |
6b0655a2 | 5574 | |
94f2b392 | 5575 | static int |
fd79ac91 | 5576 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5577 | safi_t safi, const char *num_str, | |
0a486e5f | 5578 | const char *threshold_str, int warning, |
5579 | const char *restart_str) | |
718e3744 | 5580 | { |
5581 | int ret; | |
5582 | struct peer *peer; | |
5583 | u_int32_t max; | |
e0701b79 | 5584 | u_char threshold; |
0a486e5f | 5585 | u_int16_t restart; |
718e3744 | 5586 | |
5587 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5588 | if (! peer) | |
5589 | return CMD_WARNING; | |
5590 | ||
e6ec1c36 | 5591 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 5592 | if (threshold_str) |
5593 | threshold = atoi (threshold_str); | |
5594 | else | |
5595 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 5596 | |
0a486e5f | 5597 | if (restart_str) |
5598 | restart = atoi (restart_str); | |
5599 | else | |
5600 | restart = 0; | |
5601 | ||
5602 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 5603 | |
5604 | return bgp_vty_return (vty, ret); | |
5605 | } | |
5606 | ||
94f2b392 | 5607 | static int |
fd79ac91 | 5608 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5609 | safi_t safi) |
5610 | { | |
5611 | int ret; | |
5612 | struct peer *peer; | |
5613 | ||
5614 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5615 | if (! peer) | |
5616 | return CMD_WARNING; | |
5617 | ||
5618 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
5619 | ||
5620 | return bgp_vty_return (vty, ret); | |
5621 | } | |
5622 | ||
5623 | /* Maximum number of prefix configuration. prefix count is different | |
5624 | for each peer configuration. So this configuration can be set for | |
5625 | each peer configuration. */ | |
5626 | DEFUN (neighbor_maximum_prefix, | |
5627 | neighbor_maximum_prefix_cmd, | |
5628 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5629 | NEIGHBOR_STR | |
5630 | NEIGHBOR_ADDR_STR2 | |
5631 | "Maximum number of prefix accept from this peer\n" | |
5632 | "maximum no. of prefix limit\n") | |
5633 | { | |
5634 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5635 | bgp_node_safi (vty), argv[1], NULL, 0, |
5636 | NULL); | |
718e3744 | 5637 | } |
5638 | ||
e0701b79 | 5639 | DEFUN (neighbor_maximum_prefix_threshold, |
5640 | neighbor_maximum_prefix_threshold_cmd, | |
5641 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
5642 | NEIGHBOR_STR | |
5643 | NEIGHBOR_ADDR_STR2 | |
5644 | "Maximum number of prefix accept from this peer\n" | |
5645 | "maximum no. of prefix limit\n" | |
5646 | "Threshold value (%) at which to generate a warning msg\n") | |
5647 | { | |
5648 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5649 | bgp_node_safi (vty), argv[1], argv[2], 0, |
5650 | NULL); | |
5651 | } | |
e0701b79 | 5652 | |
718e3744 | 5653 | DEFUN (neighbor_maximum_prefix_warning, |
5654 | neighbor_maximum_prefix_warning_cmd, | |
5655 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5656 | NEIGHBOR_STR | |
5657 | NEIGHBOR_ADDR_STR2 | |
5658 | "Maximum number of prefix accept from this peer\n" | |
5659 | "maximum no. of prefix limit\n" | |
5660 | "Only give warning message when limit is exceeded\n") | |
5661 | { | |
5662 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5663 | bgp_node_safi (vty), argv[1], NULL, 1, |
5664 | NULL); | |
718e3744 | 5665 | } |
5666 | ||
e0701b79 | 5667 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
5668 | neighbor_maximum_prefix_threshold_warning_cmd, | |
5669 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
5670 | NEIGHBOR_STR | |
5671 | NEIGHBOR_ADDR_STR2 | |
5672 | "Maximum number of prefix accept from this peer\n" | |
5673 | "maximum no. of prefix limit\n" | |
5674 | "Threshold value (%) at which to generate a warning msg\n" | |
5675 | "Only give warning message when limit is exceeded\n") | |
5676 | { | |
5677 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5678 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
5679 | } | |
5680 | ||
5681 | DEFUN (neighbor_maximum_prefix_restart, | |
5682 | neighbor_maximum_prefix_restart_cmd, | |
5683 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
5684 | NEIGHBOR_STR | |
5685 | NEIGHBOR_ADDR_STR2 | |
5686 | "Maximum number of prefix accept from this peer\n" | |
5687 | "maximum no. of prefix limit\n" | |
5688 | "Restart bgp connection after limit is exceeded\n" | |
5689 | "Restart interval in minutes") | |
5690 | { | |
5691 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5692 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
5693 | } | |
5694 | ||
5695 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
5696 | neighbor_maximum_prefix_threshold_restart_cmd, | |
5697 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5698 | NEIGHBOR_STR | |
5699 | NEIGHBOR_ADDR_STR2 | |
5700 | "Maximum number of prefix accept from this peer\n" | |
5701 | "maximum no. of prefix limit\n" | |
5702 | "Threshold value (%) at which to generate a warning msg\n" | |
5703 | "Restart bgp connection after limit is exceeded\n" | |
5704 | "Restart interval in minutes") | |
5705 | { | |
5706 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5707 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
5708 | } | |
e0701b79 | 5709 | |
718e3744 | 5710 | DEFUN (no_neighbor_maximum_prefix, |
5711 | no_neighbor_maximum_prefix_cmd, | |
5712 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
5713 | NO_STR | |
5714 | NEIGHBOR_STR | |
5715 | NEIGHBOR_ADDR_STR2 | |
5716 | "Maximum number of prefix accept from this peer\n") | |
5717 | { | |
5718 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5719 | bgp_node_safi (vty)); | |
5720 | } | |
5721 | ||
5722 | ALIAS (no_neighbor_maximum_prefix, | |
5723 | no_neighbor_maximum_prefix_val_cmd, | |
5724 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5725 | NO_STR | |
5726 | NEIGHBOR_STR | |
5727 | NEIGHBOR_ADDR_STR2 | |
5728 | "Maximum number of prefix accept from this peer\n" | |
5729 | "maximum no. of prefix limit\n") | |
5730 | ||
5731 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5732 | no_neighbor_maximum_prefix_threshold_cmd, |
813d4307 | 5733 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
0a486e5f | 5734 | NO_STR |
5735 | NEIGHBOR_STR | |
5736 | NEIGHBOR_ADDR_STR2 | |
5737 | "Maximum number of prefix accept from this peer\n" | |
5738 | "maximum no. of prefix limit\n" | |
5739 | "Threshold value (%) at which to generate a warning msg\n") | |
5740 | ||
5741 | ALIAS (no_neighbor_maximum_prefix, | |
5742 | no_neighbor_maximum_prefix_warning_cmd, | |
5743 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5744 | NO_STR | |
5745 | NEIGHBOR_STR | |
5746 | NEIGHBOR_ADDR_STR2 | |
5747 | "Maximum number of prefix accept from this peer\n" | |
5748 | "maximum no. of prefix limit\n" | |
e8e1946e | 5749 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 5750 | |
5751 | ALIAS (no_neighbor_maximum_prefix, | |
5752 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 5753 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
5754 | NO_STR | |
5755 | NEIGHBOR_STR | |
5756 | NEIGHBOR_ADDR_STR2 | |
5757 | "Maximum number of prefix accept from this peer\n" | |
5758 | "maximum no. of prefix limit\n" | |
5759 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 5760 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 5761 | |
5762 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5763 | no_neighbor_maximum_prefix_restart_cmd, |
5764 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 5765 | NO_STR |
5766 | NEIGHBOR_STR | |
5767 | NEIGHBOR_ADDR_STR2 | |
5768 | "Maximum number of prefix accept from this peer\n" | |
5769 | "maximum no. of prefix limit\n" | |
0a486e5f | 5770 | "Restart bgp connection after limit is exceeded\n" |
5771 | "Restart interval in minutes") | |
5772 | ||
5773 | ALIAS (no_neighbor_maximum_prefix, | |
5774 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
5775 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5776 | NO_STR | |
5777 | NEIGHBOR_STR | |
5778 | NEIGHBOR_ADDR_STR2 | |
5779 | "Maximum number of prefix accept from this peer\n" | |
5780 | "maximum no. of prefix limit\n" | |
5781 | "Threshold value (%) at which to generate a warning msg\n" | |
5782 | "Restart bgp connection after limit is exceeded\n" | |
5783 | "Restart interval in minutes") | |
6b0655a2 | 5784 | |
718e3744 | 5785 | /* "neighbor allowas-in" */ |
5786 | DEFUN (neighbor_allowas_in, | |
5787 | neighbor_allowas_in_cmd, | |
5788 | NEIGHBOR_CMD2 "allowas-in", | |
5789 | NEIGHBOR_STR | |
5790 | NEIGHBOR_ADDR_STR2 | |
5791 | "Accept as-path with my AS present in it\n") | |
5792 | { | |
5793 | int ret; | |
5794 | struct peer *peer; | |
fd79ac91 | 5795 | unsigned int allow_num; |
718e3744 | 5796 | |
5797 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5798 | if (! peer) | |
5799 | return CMD_WARNING; | |
5800 | ||
5801 | if (argc == 1) | |
5802 | allow_num = 3; | |
5803 | else | |
5804 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
5805 | ||
5806 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
5807 | allow_num); | |
5808 | ||
5809 | return bgp_vty_return (vty, ret); | |
5810 | } | |
5811 | ||
5812 | ALIAS (neighbor_allowas_in, | |
5813 | neighbor_allowas_in_arg_cmd, | |
5814 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5815 | NEIGHBOR_STR | |
5816 | NEIGHBOR_ADDR_STR2 | |
5817 | "Accept as-path with my AS present in it\n" | |
5818 | "Number of occurances of AS number\n") | |
5819 | ||
5820 | DEFUN (no_neighbor_allowas_in, | |
5821 | no_neighbor_allowas_in_cmd, | |
5822 | NO_NEIGHBOR_CMD2 "allowas-in", | |
5823 | NO_STR | |
5824 | NEIGHBOR_STR | |
5825 | NEIGHBOR_ADDR_STR2 | |
5826 | "allow local ASN appears in aspath attribute\n") | |
5827 | { | |
5828 | int ret; | |
5829 | struct peer *peer; | |
5830 | ||
5831 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5832 | if (! peer) | |
5833 | return CMD_WARNING; | |
5834 | ||
5835 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
5836 | ||
5837 | return bgp_vty_return (vty, ret); | |
5838 | } | |
6b0655a2 | 5839 | |
813d4307 DW |
5840 | ALIAS (no_neighbor_allowas_in, |
5841 | no_neighbor_allowas_in_val_cmd, | |
5842 | NO_NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5843 | NO_STR | |
5844 | NEIGHBOR_STR | |
5845 | NEIGHBOR_ADDR_STR2 | |
5846 | "allow local ASN appears in aspath attribute\n" | |
5847 | "Number of occurances of AS number\n") | |
5848 | ||
fa411a21 NH |
5849 | DEFUN (neighbor_ttl_security, |
5850 | neighbor_ttl_security_cmd, | |
5851 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5852 | NEIGHBOR_STR | |
5853 | NEIGHBOR_ADDR_STR2 | |
5854 | "Specify the maximum number of hops to the BGP peer\n") | |
5855 | { | |
5856 | struct peer *peer; | |
89b6d1f8 | 5857 | int gtsm_hops; |
fa411a21 NH |
5858 | |
5859 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5860 | if (! peer) | |
5861 | return CMD_WARNING; | |
5862 | ||
5863 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); | |
5864 | ||
8cdabf90 SK |
5865 | /* |
5866 | * If 'neighbor swpX', then this is for directly connected peers, | |
5867 | * we should not accept a ttl-security hops value greater than 1. | |
5868 | */ | |
5869 | if (peer->conf_if && (gtsm_hops > 1)) { | |
5870 | vty_out (vty, "%s is directly connected peer, hops cannot exceed 1%s", | |
5871 | argv[0], VTY_NEWLINE); | |
5872 | return CMD_WARNING; | |
5873 | } | |
5874 | ||
89b6d1f8 | 5875 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
5876 | } |
5877 | ||
5878 | DEFUN (no_neighbor_ttl_security, | |
5879 | no_neighbor_ttl_security_cmd, | |
5880 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5881 | NO_STR | |
5882 | NEIGHBOR_STR | |
5883 | NEIGHBOR_ADDR_STR2 | |
5884 | "Specify the maximum number of hops to the BGP peer\n") | |
5885 | { | |
5886 | struct peer *peer; | |
fa411a21 NH |
5887 | |
5888 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5889 | if (! peer) | |
5890 | return CMD_WARNING; | |
5891 | ||
89b6d1f8 | 5892 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 5893 | } |
6b0655a2 | 5894 | |
adbac85e DW |
5895 | DEFUN (neighbor_addpath_tx_all_paths, |
5896 | neighbor_addpath_tx_all_paths_cmd, | |
5897 | NEIGHBOR_CMD2 "addpath-tx-all-paths", | |
5898 | NEIGHBOR_STR | |
5899 | NEIGHBOR_ADDR_STR2 | |
5900 | "Use addpath to advertise all paths to a neighbor\n") | |
5901 | { | |
5902 | struct peer *peer; | |
5903 | ||
adbac85e DW |
5904 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
5905 | if (! peer) | |
5906 | return CMD_WARNING; | |
5907 | ||
5908 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5909 | bgp_node_safi (vty), | |
5910 | PEER_FLAG_ADDPATH_TX_ALL_PATHS); | |
5911 | } | |
5912 | ||
5913 | DEFUN (no_neighbor_addpath_tx_all_paths, | |
5914 | no_neighbor_addpath_tx_all_paths_cmd, | |
5915 | NO_NEIGHBOR_CMD2 "addpath-tx-all-paths", | |
5916 | NO_STR | |
5917 | NEIGHBOR_STR | |
5918 | NEIGHBOR_ADDR_STR2 | |
5919 | "Use addpath to advertise all paths to a neighbor\n") | |
5920 | { | |
5921 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5922 | bgp_node_safi (vty), | |
5923 | PEER_FLAG_ADDPATH_TX_ALL_PATHS); | |
5924 | } | |
5925 | ||
06370dac DW |
5926 | DEFUN (neighbor_addpath_tx_bestpath_per_as, |
5927 | neighbor_addpath_tx_bestpath_per_as_cmd, | |
5928 | NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", | |
5929 | NEIGHBOR_STR | |
5930 | NEIGHBOR_ADDR_STR2 | |
5931 | "Use addpath to advertise the bestpath per each neighboring AS\n") | |
5932 | { | |
5933 | struct peer *peer; | |
5934 | ||
5935 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5936 | if (! peer) | |
5937 | return CMD_WARNING; | |
5938 | ||
5939 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5940 | bgp_node_safi (vty), | |
5941 | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); | |
5942 | } | |
5943 | ||
5944 | DEFUN (no_neighbor_addpath_tx_bestpath_per_as, | |
5945 | no_neighbor_addpath_tx_bestpath_per_as_cmd, | |
5946 | NO_NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", | |
5947 | NO_STR | |
5948 | NEIGHBOR_STR | |
5949 | NEIGHBOR_ADDR_STR2 | |
5950 | "Use addpath to advertise the bestpath per each neighboring AS\n") | |
5951 | { | |
5952 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5953 | bgp_node_safi (vty), | |
5954 | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); | |
5955 | } | |
5956 | ||
5957 | ||
718e3744 | 5958 | /* Address family configuration. */ |
5959 | DEFUN (address_family_ipv4, | |
5960 | address_family_ipv4_cmd, | |
5961 | "address-family ipv4", | |
5962 | "Enter Address Family command mode\n" | |
5963 | "Address family\n") | |
5964 | { | |
5965 | vty->node = BGP_IPV4_NODE; | |
5966 | return CMD_SUCCESS; | |
5967 | } | |
5968 | ||
5969 | DEFUN (address_family_ipv4_safi, | |
5970 | address_family_ipv4_safi_cmd, | |
5971 | "address-family ipv4 (unicast|multicast)", | |
5972 | "Enter Address Family command mode\n" | |
5973 | "Address family\n" | |
5974 | "Address Family modifier\n" | |
5975 | "Address Family modifier\n") | |
5976 | { | |
5977 | if (strncmp (argv[0], "m", 1) == 0) | |
5978 | vty->node = BGP_IPV4M_NODE; | |
5979 | else | |
5980 | vty->node = BGP_IPV4_NODE; | |
5981 | ||
5982 | return CMD_SUCCESS; | |
5983 | } | |
5984 | ||
25ffbdc1 | 5985 | DEFUN (address_family_ipv6, |
5986 | address_family_ipv6_cmd, | |
5987 | "address-family ipv6", | |
718e3744 | 5988 | "Enter Address Family command mode\n" |
25ffbdc1 | 5989 | "Address family\n") |
718e3744 | 5990 | { |
5991 | vty->node = BGP_IPV6_NODE; | |
5992 | return CMD_SUCCESS; | |
5993 | } | |
5994 | ||
25ffbdc1 | 5995 | DEFUN (address_family_ipv6_safi, |
5996 | address_family_ipv6_safi_cmd, | |
5997 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 5998 | "Enter Address Family command mode\n" |
25ffbdc1 | 5999 | "Address family\n" |
6000 | "Address Family modifier\n" | |
6001 | "Address Family modifier\n") | |
6002 | { | |
6003 | if (strncmp (argv[0], "m", 1) == 0) | |
6004 | vty->node = BGP_IPV6M_NODE; | |
6005 | else | |
6006 | vty->node = BGP_IPV6_NODE; | |
6007 | ||
6008 | return CMD_SUCCESS; | |
6009 | } | |
718e3744 | 6010 | |
6011 | DEFUN (address_family_vpnv4, | |
6012 | address_family_vpnv4_cmd, | |
6013 | "address-family vpnv4", | |
6014 | "Enter Address Family command mode\n" | |
6015 | "Address family\n") | |
6016 | { | |
6017 | vty->node = BGP_VPNV4_NODE; | |
6018 | return CMD_SUCCESS; | |
6019 | } | |
6020 | ||
6021 | ALIAS (address_family_vpnv4, | |
6022 | address_family_vpnv4_unicast_cmd, | |
6023 | "address-family vpnv4 unicast", | |
6024 | "Enter Address Family command mode\n" | |
6025 | "Address family\n" | |
6026 | "Address Family Modifier\n") | |
6027 | ||
8ecd3266 | 6028 | DEFUN (address_family_vpnv6, |
6029 | address_family_vpnv6_cmd, | |
6030 | "address-family vpnv6", | |
6031 | "Enter Address Family command mode\n" | |
6032 | "Address family\n") | |
6033 | { | |
6034 | vty->node = BGP_VPNV6_NODE; | |
6035 | return CMD_SUCCESS; | |
6036 | } | |
6037 | ||
6038 | ALIAS (address_family_vpnv6, | |
6039 | address_family_vpnv6_unicast_cmd, | |
6040 | "address-family vpnv6 unicast", | |
6041 | "Enter Address Family command mode\n" | |
6042 | "Address family\n" | |
6043 | "Address Family Modifier\n") | |
6044 | ||
8b1fb8be LB |
6045 | DEFUN (address_family_encap, |
6046 | address_family_encap_cmd, | |
6047 | "address-family encap", | |
6048 | "Enter Address Family command mode\n" | |
6049 | "Address family\n") | |
6050 | { | |
6051 | vty->node = BGP_ENCAP_NODE; | |
6052 | return CMD_SUCCESS; | |
6053 | } | |
6054 | ||
6055 | ALIAS (address_family_encap, | |
6056 | address_family_encapv4_cmd, | |
6057 | "address-family encapv4", | |
6058 | "Enter Address Family command mode\n" | |
6059 | "Address family\n") | |
6060 | ||
6061 | DEFUN (address_family_encapv6, | |
6062 | address_family_encapv6_cmd, | |
6063 | "address-family encapv6", | |
6064 | "Enter Address Family command mode\n" | |
6065 | "Address family\n") | |
6066 | { | |
6067 | vty->node = BGP_ENCAPV6_NODE; | |
6068 | return CMD_SUCCESS; | |
6069 | } | |
6070 | ||
718e3744 | 6071 | DEFUN (exit_address_family, |
6072 | exit_address_family_cmd, | |
6073 | "exit-address-family", | |
6074 | "Exit from Address Family configuration mode\n") | |
6075 | { | |
a8a80d53 | 6076 | if (vty->node == BGP_IPV4_NODE |
6077 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 6078 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 6079 | || vty->node == BGP_IPV6_NODE |
8ecd3266 | 6080 | || vty->node == BGP_IPV6M_NODE |
8b1fb8be LB |
6081 | || vty->node == BGP_VPNV6_NODE |
6082 | || vty->node == BGP_ENCAP_NODE | |
6083 | || vty->node == BGP_ENCAPV6_NODE) | |
718e3744 | 6084 | vty->node = BGP_NODE; |
6085 | return CMD_SUCCESS; | |
6086 | } | |
6b0655a2 | 6087 | |
8ad7271d DS |
6088 | /* Recalculate bestpath and re-advertise a prefix */ |
6089 | static int | |
01080f7c | 6090 | bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, |
8ad7271d DS |
6091 | afi_t afi, safi_t safi, struct prefix_rd *prd) |
6092 | { | |
6093 | int ret; | |
6094 | struct prefix match; | |
6095 | struct bgp_node *rn; | |
6096 | struct bgp_node *rm; | |
8ad7271d DS |
6097 | struct bgp *bgp; |
6098 | struct bgp_table *table; | |
6099 | struct bgp_table *rib; | |
6100 | ||
6101 | /* BGP structure lookup. */ | |
6102 | if (view_name) | |
6103 | { | |
6104 | bgp = bgp_lookup_by_name (view_name); | |
6105 | if (bgp == NULL) | |
6106 | { | |
6aeb9e78 | 6107 | vty_out (vty, "%% Can't find BGP instance %s%s", view_name, VTY_NEWLINE); |
8ad7271d DS |
6108 | return CMD_WARNING; |
6109 | } | |
6110 | } | |
6111 | else | |
6112 | { | |
6113 | bgp = bgp_get_default (); | |
6114 | if (bgp == NULL) | |
6115 | { | |
6116 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
6117 | return CMD_WARNING; | |
6118 | } | |
6119 | } | |
6120 | ||
6121 | /* Check IP address argument. */ | |
6122 | ret = str2prefix (ip_str, &match); | |
6123 | if (! ret) | |
6124 | { | |
6125 | vty_out (vty, "%% address is malformed%s", VTY_NEWLINE); | |
6126 | return CMD_WARNING; | |
6127 | } | |
6128 | ||
6129 | match.family = afi2family (afi); | |
6130 | rib = bgp->rib[afi][safi]; | |
6131 | ||
6132 | if (safi == SAFI_MPLS_VPN) | |
6133 | { | |
6134 | for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn)) | |
6135 | { | |
6136 | if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) | |
6137 | continue; | |
6138 | ||
6139 | if ((table = rn->info) != NULL) | |
6140 | { | |
6141 | if ((rm = bgp_node_match (table, &match)) != NULL) | |
6142 | { | |
6143 | if (rm->p.prefixlen == match.prefixlen) | |
6144 | { | |
6145 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
6146 | bgp_process (bgp, rm, afi, safi); | |
6147 | } | |
6148 | bgp_unlock_node (rm); | |
6149 | } | |
6150 | } | |
6151 | } | |
6152 | } | |
6153 | else | |
6154 | { | |
6155 | if ((rn = bgp_node_match (rib, &match)) != NULL) | |
6156 | { | |
6157 | if (rn->p.prefixlen == match.prefixlen) | |
6158 | { | |
6159 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
6160 | bgp_process (bgp, rn, afi, safi); | |
6161 | } | |
6162 | bgp_unlock_node (rn); | |
6163 | } | |
6164 | } | |
6165 | ||
6166 | return CMD_SUCCESS; | |
6167 | } | |
6168 | ||
718e3744 | 6169 | DEFUN (clear_ip_bgp_all, |
6170 | clear_ip_bgp_all_cmd, | |
6171 | "clear ip bgp *", | |
6172 | CLEAR_STR | |
6173 | IP_STR | |
6174 | BGP_STR | |
6175 | "Clear all peers\n") | |
6176 | { | |
6aeb9e78 DS |
6177 | if (argc == 2) |
6178 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
718e3744 | 6179 | |
6180 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
6181 | } | |
6182 | ||
01080f7c | 6183 | ALIAS (clear_ip_bgp_all, |
6184 | clear_ip_bgp_instance_all_cmd, | |
6185 | "clear ip bgp " BGP_INSTANCE_CMD " *", | |
6186 | CLEAR_STR | |
6187 | IP_STR | |
6188 | BGP_STR | |
6189 | BGP_INSTANCE_HELP_STR | |
6190 | "Clear all peers\n") | |
6191 | ||
718e3744 | 6192 | ALIAS (clear_ip_bgp_all, |
6193 | clear_bgp_all_cmd, | |
6194 | "clear bgp *", | |
6195 | CLEAR_STR | |
6196 | BGP_STR | |
6197 | "Clear all peers\n") | |
6198 | ||
6199 | ALIAS (clear_ip_bgp_all, | |
01080f7c | 6200 | clear_bgp_instance_all_cmd, |
6201 | "clear bgp " BGP_INSTANCE_CMD " *", | |
718e3744 | 6202 | CLEAR_STR |
6203 | BGP_STR | |
01080f7c | 6204 | BGP_INSTANCE_HELP_STR |
718e3744 | 6205 | "Clear all peers\n") |
6206 | ||
6207 | ALIAS (clear_ip_bgp_all, | |
01080f7c | 6208 | clear_bgp_ipv6_all_cmd, |
6209 | "clear bgp ipv6 *", | |
718e3744 | 6210 | CLEAR_STR |
718e3744 | 6211 | BGP_STR |
01080f7c | 6212 | "Address family\n" |
718e3744 | 6213 | "Clear all peers\n") |
6214 | ||
6215 | ALIAS (clear_ip_bgp_all, | |
01080f7c | 6216 | clear_bgp_instance_ipv6_all_cmd, |
6217 | "clear bgp " BGP_INSTANCE_CMD " ipv6 *", | |
718e3744 | 6218 | CLEAR_STR |
6219 | BGP_STR | |
8386ac43 | 6220 | BGP_INSTANCE_HELP_STR |
01080f7c | 6221 | "Address family\n" |
718e3744 | 6222 | "Clear all peers\n") |
6223 | ||
6224 | DEFUN (clear_ip_bgp_peer, | |
6225 | clear_ip_bgp_peer_cmd, | |
a80beece | 6226 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6227 | CLEAR_STR |
6228 | IP_STR | |
6229 | BGP_STR | |
6230 | "BGP neighbor IP address to clear\n" | |
a80beece DS |
6231 | "BGP IPv6 neighbor to clear\n" |
6232 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6233 | { |
01080f7c | 6234 | if (argc == 3) |
6235 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6236 | ||
718e3744 | 6237 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
6238 | } | |
6239 | ||
01080f7c | 6240 | ALIAS (clear_ip_bgp_peer, |
6241 | clear_ip_bgp_instance_peer_cmd, | |
6242 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", | |
6243 | CLEAR_STR | |
6244 | IP_STR | |
6245 | BGP_STR | |
6246 | BGP_INSTANCE_HELP_STR | |
6247 | "BGP neighbor IP address to clear\n" | |
6248 | "BGP IPv6 neighbor to clear\n" | |
6249 | "BGP neighbor on interface to clear\n") | |
6250 | ||
718e3744 | 6251 | ALIAS (clear_ip_bgp_peer, |
6252 | clear_bgp_peer_cmd, | |
a80beece | 6253 | "clear bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6254 | CLEAR_STR |
6255 | BGP_STR | |
6256 | "BGP neighbor address to clear\n" | |
a80beece DS |
6257 | "BGP IPv6 neighbor to clear\n" |
6258 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6259 | |
01080f7c | 6260 | ALIAS (clear_ip_bgp_peer, |
6261 | clear_bgp_instance_peer_cmd, | |
6262 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", | |
6263 | CLEAR_STR | |
6264 | BGP_STR | |
6265 | BGP_INSTANCE_HELP_STR | |
6266 | "BGP neighbor IP address to clear\n" | |
6267 | "BGP IPv6 neighbor to clear\n" | |
6268 | "BGP neighbor on interface to clear\n") | |
6269 | ||
718e3744 | 6270 | ALIAS (clear_ip_bgp_peer, |
6271 | clear_bgp_ipv6_peer_cmd, | |
a80beece | 6272 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6273 | CLEAR_STR |
6274 | BGP_STR | |
6275 | "Address family\n" | |
6276 | "BGP neighbor address to clear\n" | |
a80beece DS |
6277 | "BGP IPv6 neighbor to clear\n" |
6278 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6279 | |
01080f7c | 6280 | ALIAS (clear_ip_bgp_peer, |
6281 | clear_bgp_instance_ipv6_peer_cmd, | |
6282 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD)", | |
6283 | CLEAR_STR | |
6284 | BGP_STR | |
6285 | BGP_INSTANCE_HELP_STR | |
6286 | "Address family\n" | |
6287 | "BGP neighbor IP address to clear\n" | |
6288 | "BGP IPv6 neighbor to clear\n" | |
6289 | "BGP neighbor on interface to clear\n") | |
6290 | ||
718e3744 | 6291 | DEFUN (clear_ip_bgp_peer_group, |
6292 | clear_ip_bgp_peer_group_cmd, | |
6293 | "clear ip bgp peer-group WORD", | |
6294 | CLEAR_STR | |
6295 | IP_STR | |
6296 | BGP_STR | |
6297 | "Clear all members of peer-group\n" | |
6298 | "BGP peer-group name\n") | |
6299 | { | |
01080f7c | 6300 | if (argc == 3) |
6301 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6302 | ||
718e3744 | 6303 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
6304 | } | |
6305 | ||
01080f7c | 6306 | ALIAS (clear_ip_bgp_peer_group, |
6307 | clear_ip_bgp_instance_peer_group_cmd, | |
6308 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD", | |
6309 | CLEAR_STR | |
6310 | IP_STR | |
6311 | BGP_STR | |
6312 | BGP_INSTANCE_HELP_STR | |
6313 | "Clear all members of peer-group\n" | |
6314 | "BGP peer-group name\n") | |
6315 | ||
718e3744 | 6316 | ALIAS (clear_ip_bgp_peer_group, |
6317 | clear_bgp_peer_group_cmd, | |
6318 | "clear bgp peer-group WORD", | |
6319 | CLEAR_STR | |
6320 | BGP_STR | |
6321 | "Clear all members of peer-group\n" | |
6322 | "BGP peer-group name\n") | |
6323 | ||
01080f7c | 6324 | ALIAS (clear_ip_bgp_peer_group, |
6325 | clear_bgp_instance_peer_group_cmd, | |
6326 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD", | |
6327 | CLEAR_STR | |
6328 | BGP_STR | |
6329 | BGP_INSTANCE_HELP_STR | |
6330 | "Clear all members of peer-group\n" | |
6331 | "BGP peer-group name\n") | |
6332 | ||
718e3744 | 6333 | ALIAS (clear_ip_bgp_peer_group, |
6334 | clear_bgp_ipv6_peer_group_cmd, | |
6335 | "clear bgp ipv6 peer-group WORD", | |
6336 | CLEAR_STR | |
6337 | BGP_STR | |
6338 | "Address family\n" | |
6339 | "Clear all members of peer-group\n" | |
6340 | "BGP peer-group name\n") | |
6341 | ||
01080f7c | 6342 | ALIAS (clear_ip_bgp_peer_group, |
6343 | clear_bgp_instance_ipv6_peer_group_cmd, | |
6344 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD", | |
6345 | CLEAR_STR | |
6346 | BGP_STR | |
6347 | BGP_INSTANCE_HELP_STR | |
6348 | "Address family\n" | |
6349 | "Clear all members of peer-group\n" | |
6350 | "BGP peer-group name\n") | |
6351 | ||
718e3744 | 6352 | DEFUN (clear_ip_bgp_external, |
6353 | clear_ip_bgp_external_cmd, | |
6354 | "clear ip bgp external", | |
6355 | CLEAR_STR | |
6356 | IP_STR | |
6357 | BGP_STR | |
6358 | "Clear all external peers\n") | |
6359 | { | |
01080f7c | 6360 | if (argc == 2) |
6361 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
6362 | ||
718e3744 | 6363 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
6364 | } | |
6365 | ||
01080f7c | 6366 | ALIAS (clear_ip_bgp_external, |
6367 | clear_ip_bgp_instance_external_cmd, | |
6368 | "clear ip bgp " BGP_INSTANCE_CMD " external", | |
6369 | CLEAR_STR | |
6370 | IP_STR | |
6371 | BGP_STR | |
6372 | BGP_INSTANCE_HELP_STR | |
6373 | "Clear all external peers\n") | |
6374 | ||
718e3744 | 6375 | ALIAS (clear_ip_bgp_external, |
6376 | clear_bgp_external_cmd, | |
6377 | "clear bgp external", | |
6378 | CLEAR_STR | |
6379 | BGP_STR | |
6380 | "Clear all external peers\n") | |
6381 | ||
01080f7c | 6382 | ALIAS (clear_ip_bgp_external, |
6383 | clear_bgp_instance_external_cmd, | |
6384 | "clear bgp " BGP_INSTANCE_CMD " external", | |
6385 | CLEAR_STR | |
6386 | BGP_STR | |
6387 | BGP_INSTANCE_HELP_STR | |
6388 | "Clear all external peers\n") | |
6389 | ||
718e3744 | 6390 | ALIAS (clear_ip_bgp_external, |
6391 | clear_bgp_ipv6_external_cmd, | |
6392 | "clear bgp ipv6 external", | |
6393 | CLEAR_STR | |
6394 | BGP_STR | |
6395 | "Address family\n" | |
6396 | "Clear all external peers\n") | |
6397 | ||
01080f7c | 6398 | ALIAS (clear_ip_bgp_external, |
6399 | clear_bgp_instance_ipv6_external_cmd, | |
6400 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external", | |
6401 | CLEAR_STR | |
6402 | BGP_STR | |
6403 | BGP_INSTANCE_HELP_STR | |
6404 | "Address family\n" | |
6405 | "Clear all external peers\n") | |
6406 | ||
8ad7271d DS |
6407 | DEFUN (clear_ip_bgp_prefix, |
6408 | clear_ip_bgp_prefix_cmd, | |
6409 | "clear ip bgp prefix A.B.C.D/M", | |
6410 | CLEAR_STR | |
6411 | IP_STR | |
6412 | BGP_STR | |
6413 | "Clear bestpath and re-advertise\n" | |
6414 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6415 | { | |
01080f7c | 6416 | if (argc == 3) |
6417 | return bgp_clear_prefix (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL); | |
6418 | ||
8ad7271d DS |
6419 | return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL); |
6420 | } | |
6421 | ||
01080f7c | 6422 | ALIAS (clear_ip_bgp_prefix, |
6423 | clear_ip_bgp_instance_prefix_cmd, | |
6424 | "clear ip bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", | |
6425 | CLEAR_STR | |
6426 | IP_STR | |
6427 | BGP_STR | |
6428 | BGP_INSTANCE_HELP_STR | |
6429 | "Clear bestpath and re-advertise\n" | |
6430 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6431 | ||
8ad7271d DS |
6432 | ALIAS (clear_ip_bgp_prefix, |
6433 | clear_bgp_prefix_cmd, | |
6434 | "clear bgp prefix A.B.C.D/M", | |
6435 | CLEAR_STR | |
6436 | BGP_STR | |
6437 | "Clear bestpath and re-advertise\n" | |
6438 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6439 | ||
01080f7c | 6440 | ALIAS (clear_ip_bgp_prefix, |
6441 | clear_bgp_instance_prefix_cmd, | |
6442 | "clear bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", | |
6443 | CLEAR_STR | |
6444 | BGP_STR | |
6445 | BGP_INSTANCE_HELP_STR | |
6446 | "Clear bestpath and re-advertise\n" | |
6447 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
8ad7271d | 6448 | |
718e3744 | 6449 | DEFUN (clear_ip_bgp_as, |
6450 | clear_ip_bgp_as_cmd, | |
320da874 | 6451 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 6452 | CLEAR_STR |
6453 | IP_STR | |
6454 | BGP_STR | |
6455 | "Clear peers with the AS number\n") | |
6456 | { | |
01080f7c | 6457 | if (argc == 3) |
6458 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6459 | ||
718e3744 | 6460 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
6461 | } | |
6462 | ||
01080f7c | 6463 | ALIAS (clear_ip_bgp_as, |
6464 | clear_ip_bgp_instance_as_cmd, | |
6465 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, | |
6466 | CLEAR_STR | |
6467 | IP_STR | |
6468 | BGP_STR | |
6469 | BGP_INSTANCE_HELP_STR | |
6470 | "Clear peers with the AS number\n") | |
6471 | ||
718e3744 | 6472 | ALIAS (clear_ip_bgp_as, |
6473 | clear_bgp_as_cmd, | |
320da874 | 6474 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 6475 | CLEAR_STR |
6476 | BGP_STR | |
6477 | "Clear peers with the AS number\n") | |
6478 | ||
01080f7c | 6479 | ALIAS (clear_ip_bgp_as, |
6480 | clear_bgp_instance_as_cmd, | |
6481 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, | |
6482 | CLEAR_STR | |
6483 | BGP_STR | |
6484 | BGP_INSTANCE_HELP_STR | |
6485 | "Clear peers with the AS number\n") | |
6486 | ||
718e3744 | 6487 | ALIAS (clear_ip_bgp_as, |
6488 | clear_bgp_ipv6_as_cmd, | |
320da874 | 6489 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 6490 | CLEAR_STR |
6491 | BGP_STR | |
6492 | "Address family\n" | |
6493 | "Clear peers with the AS number\n") | |
6b0655a2 | 6494 | |
01080f7c | 6495 | ALIAS (clear_ip_bgp_as, |
6496 | clear_bgp_instance_ipv6_as_cmd, | |
6497 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE, | |
6498 | CLEAR_STR | |
6499 | BGP_STR | |
6500 | BGP_INSTANCE_HELP_STR | |
6501 | "Address family\n" | |
6502 | "Clear peers with the AS number\n") | |
6503 | ||
718e3744 | 6504 | /* Outbound soft-reconfiguration */ |
6505 | DEFUN (clear_ip_bgp_all_soft_out, | |
6506 | clear_ip_bgp_all_soft_out_cmd, | |
6507 | "clear ip bgp * soft out", | |
6508 | CLEAR_STR | |
6509 | IP_STR | |
6510 | BGP_STR | |
6511 | "Clear all peers\n" | |
e0bce756 DS |
6512 | BGP_SOFT_STR |
6513 | BGP_SOFT_OUT_STR) | |
718e3744 | 6514 | { |
6aeb9e78 DS |
6515 | if (argc == 2) |
6516 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 6517 | BGP_CLEAR_SOFT_OUT, NULL); |
6518 | ||
6519 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6520 | BGP_CLEAR_SOFT_OUT, NULL); | |
6521 | } | |
6522 | ||
01080f7c | 6523 | ALIAS (clear_ip_bgp_all_soft_out, |
6524 | clear_ip_bgp_instance_all_soft_out_cmd, | |
6525 | "clear ip bgp " BGP_INSTANCE_CMD " * soft out", | |
6526 | CLEAR_STR | |
6527 | IP_STR | |
6528 | BGP_STR | |
6529 | BGP_INSTANCE_HELP_STR | |
6530 | "Clear all peers\n" | |
6531 | BGP_SOFT_STR | |
6532 | BGP_SOFT_OUT_STR) | |
6533 | ||
718e3744 | 6534 | ALIAS (clear_ip_bgp_all_soft_out, |
6535 | clear_ip_bgp_all_out_cmd, | |
6536 | "clear ip bgp * out", | |
6537 | CLEAR_STR | |
6538 | IP_STR | |
6539 | BGP_STR | |
6540 | "Clear all peers\n" | |
e0bce756 | 6541 | BGP_SOFT_OUT_STR) |
718e3744 | 6542 | |
6543 | ALIAS (clear_ip_bgp_all_soft_out, | |
01080f7c | 6544 | clear_ip_bgp_instance_all_out_cmd, |
6545 | "clear ip bgp " BGP_INSTANCE_CMD " * out", | |
718e3744 | 6546 | CLEAR_STR |
6547 | IP_STR | |
6548 | BGP_STR | |
8386ac43 | 6549 | BGP_INSTANCE_HELP_STR |
718e3744 | 6550 | "Clear all peers\n" |
e0bce756 | 6551 | BGP_SOFT_OUT_STR) |
718e3744 | 6552 | |
6553 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
6554 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
6555 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
6556 | CLEAR_STR | |
6557 | IP_STR | |
6558 | BGP_STR | |
6559 | "Clear all peers\n" | |
6560 | "Address family\n" | |
6561 | "Address Family modifier\n" | |
6562 | "Address Family modifier\n" | |
e0bce756 DS |
6563 | BGP_SOFT_STR |
6564 | BGP_SOFT_OUT_STR) | |
718e3744 | 6565 | { |
6566 | if (strncmp (argv[0], "m", 1) == 0) | |
6567 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6568 | BGP_CLEAR_SOFT_OUT, NULL); | |
6569 | ||
6570 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6571 | BGP_CLEAR_SOFT_OUT, NULL); | |
6572 | } | |
6573 | ||
01080f7c | 6574 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
6575 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
6576 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft out", | |
6577 | CLEAR_STR | |
6578 | IP_STR | |
6579 | BGP_STR | |
6580 | BGP_INSTANCE_HELP_STR | |
6581 | "Clear all peers\n" | |
6582 | "Address family\n" | |
6583 | "Address Family modifier\n" | |
6584 | "Address Family modifier\n" | |
6585 | BGP_SOFT_OUT_STR) | |
6586 | { | |
6587 | if (strncmp (argv[2], "m", 1) == 0) | |
6588 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, | |
6589 | BGP_CLEAR_SOFT_OUT, NULL); | |
6590 | ||
6591 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6592 | BGP_CLEAR_SOFT_OUT, NULL); | |
6593 | } | |
6594 | ||
718e3744 | 6595 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
6596 | clear_ip_bgp_all_ipv4_out_cmd, | |
6597 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
6598 | CLEAR_STR | |
6599 | IP_STR | |
6600 | BGP_STR | |
6601 | "Clear all peers\n" | |
6602 | "Address family\n" | |
6603 | "Address Family modifier\n" | |
6604 | "Address Family modifier\n" | |
e0bce756 | 6605 | BGP_SOFT_OUT_STR) |
718e3744 | 6606 | |
01080f7c | 6607 | ALIAS (clear_ip_bgp_instance_all_ipv4_soft_out, |
6608 | clear_ip_bgp_instance_all_ipv4_out_cmd, | |
6609 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) out", | |
718e3744 | 6610 | CLEAR_STR |
6611 | IP_STR | |
6612 | BGP_STR | |
8386ac43 | 6613 | BGP_INSTANCE_HELP_STR |
718e3744 | 6614 | "Clear all peers\n" |
6615 | "Address family\n" | |
6616 | "Address Family modifier\n" | |
6617 | "Address Family modifier\n" | |
e0bce756 | 6618 | BGP_SOFT_OUT_STR) |
718e3744 | 6619 | |
6620 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
6621 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
6622 | "clear ip bgp * vpnv4 unicast soft out", | |
6623 | CLEAR_STR | |
6624 | IP_STR | |
6625 | BGP_STR | |
6626 | "Clear all peers\n" | |
6627 | "Address family\n" | |
6628 | "Address Family Modifier\n" | |
e0bce756 DS |
6629 | BGP_SOFT_STR |
6630 | BGP_SOFT_OUT_STR) | |
718e3744 | 6631 | { |
6632 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6633 | BGP_CLEAR_SOFT_OUT, NULL); | |
6634 | } | |
6635 | ||
6636 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
6637 | clear_ip_bgp_all_vpnv4_out_cmd, | |
6638 | "clear ip bgp * vpnv4 unicast out", | |
6639 | CLEAR_STR | |
6640 | IP_STR | |
6641 | BGP_STR | |
6642 | "Clear all peers\n" | |
6643 | "Address family\n" | |
6644 | "Address Family Modifier\n" | |
e0bce756 | 6645 | BGP_SOFT_OUT_STR) |
718e3744 | 6646 | |
587ff0fd LB |
6647 | DEFUN (clear_ip_bgp_all_encap_soft_out, |
6648 | clear_ip_bgp_all_encap_soft_out_cmd, | |
6649 | "clear ip bgp * encap unicast soft out", | |
6650 | CLEAR_STR | |
6651 | IP_STR | |
6652 | BGP_STR | |
6653 | "Clear all peers\n" | |
6654 | "Address family\n" | |
6655 | "Address Family Modifier\n" | |
6656 | "Soft reconfig\n" | |
6657 | "Soft reconfig outbound update\n") | |
6658 | { | |
6659 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
6660 | BGP_CLEAR_SOFT_OUT, NULL); | |
6661 | } | |
6662 | ||
6663 | ALIAS (clear_ip_bgp_all_encap_soft_out, | |
6664 | clear_ip_bgp_all_encap_out_cmd, | |
6665 | "clear ip bgp * encap unicast out", | |
6666 | CLEAR_STR | |
6667 | IP_STR | |
6668 | BGP_STR | |
6669 | "Clear all peers\n" | |
6670 | "Address family\n" | |
6671 | "Address Family Modifier\n" | |
6672 | "Soft reconfig outbound update\n") | |
6673 | ||
718e3744 | 6674 | DEFUN (clear_bgp_all_soft_out, |
6675 | clear_bgp_all_soft_out_cmd, | |
6676 | "clear bgp * soft out", | |
6677 | CLEAR_STR | |
6678 | BGP_STR | |
6679 | "Clear all peers\n" | |
e0bce756 DS |
6680 | BGP_SOFT_STR |
6681 | BGP_SOFT_OUT_STR) | |
718e3744 | 6682 | { |
6aeb9e78 DS |
6683 | if (argc == 2) |
6684 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
718e3744 | 6685 | BGP_CLEAR_SOFT_OUT, NULL); |
6686 | ||
6687 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6688 | BGP_CLEAR_SOFT_OUT, NULL); | |
6689 | } | |
6690 | ||
6691 | ALIAS (clear_bgp_all_soft_out, | |
6692 | clear_bgp_instance_all_soft_out_cmd, | |
8386ac43 | 6693 | "clear bgp " BGP_INSTANCE_CMD " * soft out", |
718e3744 | 6694 | CLEAR_STR |
6695 | BGP_STR | |
8386ac43 | 6696 | BGP_INSTANCE_HELP_STR |
718e3744 | 6697 | "Clear all peers\n" |
e0bce756 DS |
6698 | BGP_SOFT_STR |
6699 | BGP_SOFT_OUT_STR) | |
718e3744 | 6700 | |
6701 | ALIAS (clear_bgp_all_soft_out, | |
6702 | clear_bgp_all_out_cmd, | |
6703 | "clear bgp * out", | |
6704 | CLEAR_STR | |
6705 | BGP_STR | |
6706 | "Clear all peers\n" | |
e0bce756 | 6707 | BGP_SOFT_OUT_STR) |
718e3744 | 6708 | |
01080f7c | 6709 | ALIAS (clear_bgp_all_soft_out, |
6710 | clear_bgp_instance_all_out_cmd, | |
6711 | "clear bgp " BGP_INSTANCE_CMD " * out", | |
6712 | CLEAR_STR | |
6713 | BGP_STR | |
6714 | BGP_INSTANCE_HELP_STR | |
6715 | "Clear all peers\n" | |
6716 | BGP_SOFT_OUT_STR) | |
6717 | ||
718e3744 | 6718 | ALIAS (clear_bgp_all_soft_out, |
6719 | clear_bgp_ipv6_all_soft_out_cmd, | |
6720 | "clear bgp ipv6 * soft out", | |
6721 | CLEAR_STR | |
6722 | BGP_STR | |
6723 | "Address family\n" | |
6724 | "Clear all peers\n" | |
e0bce756 DS |
6725 | BGP_SOFT_STR |
6726 | BGP_SOFT_OUT_STR) | |
718e3744 | 6727 | |
01080f7c | 6728 | ALIAS (clear_bgp_all_soft_out, |
6729 | clear_bgp_instance_ipv6_all_soft_out_cmd, | |
6730 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft out", | |
6731 | CLEAR_STR | |
6732 | BGP_STR | |
6733 | BGP_INSTANCE_HELP_STR | |
6734 | "Address family\n" | |
6735 | "Clear all peers\n" | |
6736 | BGP_SOFT_STR | |
6737 | BGP_SOFT_OUT_STR) | |
6738 | ||
718e3744 | 6739 | ALIAS (clear_bgp_all_soft_out, |
6740 | clear_bgp_ipv6_all_out_cmd, | |
6741 | "clear bgp ipv6 * out", | |
6742 | CLEAR_STR | |
6743 | BGP_STR | |
6744 | "Address family\n" | |
6745 | "Clear all peers\n" | |
e0bce756 | 6746 | BGP_SOFT_OUT_STR) |
718e3744 | 6747 | |
01080f7c | 6748 | ALIAS (clear_bgp_all_soft_out, |
6749 | clear_bgp_instance_ipv6_all_out_cmd, | |
6750 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * out", | |
6751 | CLEAR_STR | |
6752 | BGP_STR | |
6753 | BGP_INSTANCE_HELP_STR | |
6754 | "Address family\n" | |
6755 | "Clear all peers\n" | |
6756 | BGP_SOFT_OUT_STR) | |
6757 | ||
8ad7271d DS |
6758 | DEFUN (clear_bgp_ipv6_safi_prefix, |
6759 | clear_bgp_ipv6_safi_prefix_cmd, | |
6760 | "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6761 | CLEAR_STR | |
6762 | BGP_STR | |
6763 | "Address family\n" | |
6764 | "Address Family Modifier\n" | |
6765 | "Clear bestpath and re-advertise\n" | |
6766 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6767 | { | |
6768 | if (strncmp (argv[0], "m", 1) == 0) | |
6769 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL); | |
6770 | else | |
6771 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL); | |
6772 | } | |
6773 | ||
01080f7c | 6774 | DEFUN (clear_bgp_instance_ipv6_safi_prefix, |
6775 | clear_bgp_instance_ipv6_safi_prefix_cmd, | |
6776 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6777 | CLEAR_STR | |
6778 | BGP_STR | |
6779 | BGP_INSTANCE_HELP_STR | |
6780 | "Address family\n" | |
6781 | "Address Family Modifier\n" | |
6782 | "Clear bestpath and re-advertise\n" | |
6783 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6784 | { | |
6785 | if (strncmp (argv[2], "m", 1) == 0) | |
6786 | return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_MULTICAST, NULL); | |
6787 | else | |
6788 | return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_UNICAST, NULL); | |
6789 | } | |
6790 | ||
718e3744 | 6791 | DEFUN (clear_ip_bgp_peer_soft_out, |
6792 | clear_ip_bgp_peer_soft_out_cmd, | |
db64ea86 | 6793 | "clear ip bgp (A.B.C.D|WORD) soft out", |
718e3744 | 6794 | CLEAR_STR |
6795 | IP_STR | |
6796 | BGP_STR | |
6797 | "BGP neighbor address to clear\n" | |
db64ea86 | 6798 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6799 | BGP_SOFT_STR |
6800 | BGP_SOFT_OUT_STR) | |
718e3744 | 6801 | { |
01080f7c | 6802 | if (argc == 3) |
6803 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
6804 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6805 | ||
718e3744 | 6806 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
6807 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6808 | } | |
6809 | ||
01080f7c | 6810 | ALIAS (clear_ip_bgp_peer_soft_out, |
6811 | clear_ip_bgp_instance_peer_soft_out_cmd, | |
6812 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft out", | |
6813 | CLEAR_STR | |
6814 | IP_STR | |
6815 | BGP_STR | |
6816 | BGP_INSTANCE_HELP_STR | |
6817 | "BGP neighbor address to clear\n" | |
6818 | "BGP neighbor on interface to clear\n" | |
6819 | BGP_SOFT_STR | |
6820 | BGP_SOFT_OUT_STR) | |
6821 | ||
718e3744 | 6822 | ALIAS (clear_ip_bgp_peer_soft_out, |
6823 | clear_ip_bgp_peer_out_cmd, | |
db64ea86 | 6824 | "clear ip bgp (A.B.C.D|WORD) out", |
718e3744 | 6825 | CLEAR_STR |
6826 | IP_STR | |
6827 | BGP_STR | |
6828 | "BGP neighbor address to clear\n" | |
db64ea86 | 6829 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6830 | BGP_SOFT_OUT_STR) |
718e3744 | 6831 | |
01080f7c | 6832 | ALIAS (clear_ip_bgp_peer_soft_out, |
6833 | clear_ip_bgp_instance_peer_out_cmd, | |
6834 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) out", | |
6835 | CLEAR_STR | |
6836 | IP_STR | |
6837 | BGP_STR | |
6838 | BGP_INSTANCE_HELP_STR | |
6839 | "BGP neighbor address to clear\n" | |
6840 | "BGP neighbor on interface to clear\n" | |
6841 | BGP_SOFT_OUT_STR) | |
6842 | ||
718e3744 | 6843 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
6844 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
db64ea86 | 6845 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", |
718e3744 | 6846 | CLEAR_STR |
6847 | IP_STR | |
6848 | BGP_STR | |
6849 | "BGP neighbor address to clear\n" | |
db64ea86 | 6850 | "BGP neighbor on interface to clear\n" |
718e3744 | 6851 | "Address family\n" |
6852 | "Address Family modifier\n" | |
6853 | "Address Family modifier\n" | |
e0bce756 DS |
6854 | BGP_SOFT_STR |
6855 | BGP_SOFT_OUT_STR) | |
718e3744 | 6856 | { |
6857 | if (strncmp (argv[1], "m", 1) == 0) | |
6858 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6859 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6860 | ||
6861 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6862 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6863 | } | |
6864 | ||
01080f7c | 6865 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, |
6866 | clear_ip_bgp_instance_peer_ipv4_soft_out_cmd, | |
6867 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", | |
6868 | CLEAR_STR | |
6869 | IP_STR | |
6870 | BGP_STR | |
6871 | BGP_INSTANCE_HELP_STR | |
6872 | "BGP neighbor address to clear\n" | |
6873 | "BGP neighbor on interface to clear\n" | |
6874 | "Address family\n" | |
6875 | "Address Family modifier\n" | |
6876 | "Address Family modifier\n" | |
6877 | BGP_SOFT_STR | |
6878 | BGP_SOFT_OUT_STR) | |
6879 | { | |
6880 | if (strncmp (argv[3], "m", 1) == 0) | |
6881 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, | |
6882 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6883 | ||
6884 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
6885 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6886 | } | |
6887 | ||
718e3744 | 6888 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
6889 | clear_ip_bgp_peer_ipv4_out_cmd, | |
db64ea86 | 6890 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out", |
718e3744 | 6891 | CLEAR_STR |
6892 | IP_STR | |
6893 | BGP_STR | |
6894 | "BGP neighbor address to clear\n" | |
db64ea86 | 6895 | "BGP neighbor on interface to clear\n" |
718e3744 | 6896 | "Address family\n" |
6897 | "Address Family modifier\n" | |
6898 | "Address Family modifier\n" | |
e0bce756 | 6899 | BGP_SOFT_OUT_STR) |
718e3744 | 6900 | |
01080f7c | 6901 | ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_out, |
6902 | clear_ip_bgp_instance_peer_ipv4_out_cmd, | |
6903 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) out", | |
6904 | CLEAR_STR | |
6905 | IP_STR | |
6906 | BGP_STR | |
6907 | BGP_INSTANCE_HELP_STR | |
6908 | "BGP neighbor address to clear\n" | |
6909 | "BGP neighbor on interface to clear\n" | |
6910 | "Address family\n" | |
6911 | "Address Family modifier\n" | |
6912 | "Address Family modifier\n" | |
6913 | BGP_SOFT_OUT_STR) | |
6914 | ||
db64ea86 | 6915 | /* NOTE: WORD peers have not been tested for vpnv4 */ |
718e3744 | 6916 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
6917 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
db64ea86 | 6918 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out", |
718e3744 | 6919 | CLEAR_STR |
6920 | IP_STR | |
6921 | BGP_STR | |
6922 | "BGP neighbor address to clear\n" | |
db64ea86 | 6923 | "BGP neighbor on interface to clear\n" |
718e3744 | 6924 | "Address family\n" |
6925 | "Address Family Modifier\n" | |
e0bce756 DS |
6926 | BGP_SOFT_STR |
6927 | BGP_SOFT_OUT_STR) | |
718e3744 | 6928 | { |
6929 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6930 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6931 | } | |
6932 | ||
6933 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
6934 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
db64ea86 | 6935 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out", |
718e3744 | 6936 | CLEAR_STR |
6937 | IP_STR | |
6938 | BGP_STR | |
6939 | "BGP neighbor address to clear\n" | |
db64ea86 | 6940 | "BGP neighbor on interface to clear\n" |
718e3744 | 6941 | "Address family\n" |
6942 | "Address Family Modifier\n" | |
e0bce756 | 6943 | BGP_SOFT_OUT_STR) |
718e3744 | 6944 | |
587ff0fd LB |
6945 | DEFUN (clear_ip_bgp_peer_encap_soft_out, |
6946 | clear_ip_bgp_peer_encap_soft_out_cmd, | |
6947 | "clear ip bgp A.B.C.D encap unicast soft out", | |
6948 | CLEAR_STR | |
6949 | IP_STR | |
6950 | BGP_STR | |
6951 | "BGP neighbor address to clear\n" | |
6952 | "Address family\n" | |
6953 | "Address Family Modifier\n" | |
6954 | "Soft reconfig\n" | |
6955 | "Soft reconfig outbound update\n") | |
6956 | { | |
6957 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
6958 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6959 | } | |
6960 | ||
6961 | ALIAS (clear_ip_bgp_peer_encap_soft_out, | |
6962 | clear_ip_bgp_peer_encap_out_cmd, | |
6963 | "clear ip bgp A.B.C.D encap unicast out", | |
6964 | CLEAR_STR | |
6965 | IP_STR | |
6966 | BGP_STR | |
6967 | "BGP neighbor address to clear\n" | |
6968 | "Address family\n" | |
6969 | "Address Family Modifier\n" | |
6970 | "Soft reconfig outbound update\n") | |
6971 | ||
718e3744 | 6972 | DEFUN (clear_bgp_peer_soft_out, |
6973 | clear_bgp_peer_soft_out_cmd, | |
a80beece | 6974 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6975 | CLEAR_STR |
6976 | BGP_STR | |
6977 | "BGP neighbor address to clear\n" | |
6978 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6979 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6980 | BGP_SOFT_STR |
6981 | BGP_SOFT_OUT_STR) | |
718e3744 | 6982 | { |
01080f7c | 6983 | if (argc == 3) |
6984 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
6985 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6986 | ||
718e3744 | 6987 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
6988 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6989 | } | |
6990 | ||
01080f7c | 6991 | ALIAS (clear_bgp_peer_soft_out, |
6992 | clear_bgp_instance_peer_soft_out_cmd, | |
6993 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft out", | |
6994 | CLEAR_STR | |
6995 | BGP_STR | |
6996 | BGP_INSTANCE_HELP_STR | |
6997 | "BGP neighbor address to clear\n" | |
6998 | "BGP IPv6 neighbor to clear\n" | |
6999 | "BGP neighbor on interface to clear\n" | |
7000 | BGP_SOFT_STR | |
7001 | BGP_SOFT_OUT_STR) | |
7002 | ||
718e3744 | 7003 | ALIAS (clear_bgp_peer_soft_out, |
7004 | clear_bgp_ipv6_peer_soft_out_cmd, | |
a80beece | 7005 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 7006 | CLEAR_STR |
7007 | BGP_STR | |
7008 | "Address family\n" | |
7009 | "BGP neighbor address to clear\n" | |
7010 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7011 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
7012 | BGP_SOFT_STR |
7013 | BGP_SOFT_OUT_STR) | |
718e3744 | 7014 | |
01080f7c | 7015 | ALIAS (clear_bgp_peer_soft_out, |
7016 | clear_bgp_instance_ipv6_peer_soft_out_cmd, | |
7017 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", | |
7018 | CLEAR_STR | |
7019 | BGP_STR | |
7020 | BGP_INSTANCE_HELP_STR | |
7021 | "Address family\n" | |
7022 | "BGP neighbor address to clear\n" | |
7023 | "BGP IPv6 neighbor to clear\n" | |
7024 | "BGP neighbor on interface to clear\n" | |
7025 | BGP_SOFT_STR | |
7026 | BGP_SOFT_OUT_STR) | |
7027 | ||
718e3744 | 7028 | ALIAS (clear_bgp_peer_soft_out, |
7029 | clear_bgp_peer_out_cmd, | |
a80beece | 7030 | "clear bgp (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 7031 | CLEAR_STR |
7032 | BGP_STR | |
7033 | "BGP neighbor address to clear\n" | |
7034 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7035 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7036 | BGP_SOFT_OUT_STR) |
718e3744 | 7037 | |
01080f7c | 7038 | ALIAS (clear_bgp_peer_soft_out, |
7039 | clear_bgp_instance_peer_out_cmd, | |
7040 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) out", | |
7041 | CLEAR_STR | |
7042 | BGP_STR | |
7043 | BGP_INSTANCE_HELP_STR | |
7044 | "BGP neighbor address to clear\n" | |
7045 | "BGP IPv6 neighbor to clear\n" | |
7046 | "BGP neighbor on interface to clear\n" | |
7047 | BGP_SOFT_OUT_STR) | |
7048 | ||
718e3744 | 7049 | ALIAS (clear_bgp_peer_soft_out, |
7050 | clear_bgp_ipv6_peer_out_cmd, | |
a80beece | 7051 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 7052 | CLEAR_STR |
7053 | BGP_STR | |
7054 | "Address family\n" | |
7055 | "BGP neighbor address to clear\n" | |
7056 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7057 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7058 | BGP_SOFT_OUT_STR) |
718e3744 | 7059 | |
01080f7c | 7060 | ALIAS (clear_bgp_peer_soft_out, |
7061 | clear_bgp_instance_ipv6_peer_out_cmd, | |
7062 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) out", | |
7063 | CLEAR_STR | |
7064 | BGP_STR | |
7065 | BGP_INSTANCE_HELP_STR | |
7066 | "Address family\n" | |
7067 | "BGP neighbor address to clear\n" | |
7068 | "BGP IPv6 neighbor to clear\n" | |
7069 | "BGP neighbor on interface to clear\n" | |
7070 | BGP_SOFT_OUT_STR) | |
7071 | ||
718e3744 | 7072 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
7073 | clear_ip_bgp_peer_group_soft_out_cmd, | |
7074 | "clear ip bgp peer-group WORD soft out", | |
7075 | CLEAR_STR | |
7076 | IP_STR | |
7077 | BGP_STR | |
7078 | "Clear all members of peer-group\n" | |
7079 | "BGP peer-group name\n" | |
e0bce756 DS |
7080 | BGP_SOFT_STR |
7081 | BGP_SOFT_OUT_STR) | |
718e3744 | 7082 | { |
01080f7c | 7083 | if (argc == 3) |
7084 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
7085 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7086 | ||
718e3744 | 7087 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
7088 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7089 | } | |
7090 | ||
01080f7c | 7091 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
7092 | clear_ip_bgp_instance_peer_group_soft_out_cmd, | |
7093 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", | |
7094 | CLEAR_STR | |
7095 | IP_STR | |
7096 | BGP_STR | |
7097 | BGP_INSTANCE_HELP_STR | |
7098 | "Clear all members of peer-group\n" | |
7099 | "BGP peer-group name\n" | |
7100 | BGP_SOFT_STR | |
7101 | BGP_SOFT_OUT_STR) | |
7102 | ||
718e3744 | 7103 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
7104 | clear_ip_bgp_peer_group_out_cmd, | |
7105 | "clear ip bgp peer-group WORD out", | |
7106 | CLEAR_STR | |
7107 | IP_STR | |
7108 | BGP_STR | |
7109 | "Clear all members of peer-group\n" | |
7110 | "BGP peer-group name\n" | |
e0bce756 | 7111 | BGP_SOFT_OUT_STR) |
718e3744 | 7112 | |
01080f7c | 7113 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
7114 | clear_ip_bgp_instance_peer_group_out_cmd, | |
7115 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD out", | |
7116 | CLEAR_STR | |
7117 | IP_STR | |
7118 | BGP_STR | |
7119 | BGP_INSTANCE_HELP_STR | |
7120 | "Clear all members of peer-group\n" | |
7121 | "BGP peer-group name\n" | |
7122 | BGP_SOFT_OUT_STR) | |
7123 | ||
718e3744 | 7124 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
7125 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
7126 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
7127 | CLEAR_STR | |
7128 | IP_STR | |
7129 | BGP_STR | |
7130 | "Clear all members of peer-group\n" | |
7131 | "BGP peer-group name\n" | |
7132 | "Address family\n" | |
7133 | "Address Family modifier\n" | |
7134 | "Address Family modifier\n" | |
e0bce756 DS |
7135 | BGP_SOFT_STR |
7136 | BGP_SOFT_OUT_STR) | |
718e3744 | 7137 | { |
7138 | if (strncmp (argv[1], "m", 1) == 0) | |
7139 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7140 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7141 | ||
7142 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7143 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7144 | } | |
7145 | ||
01080f7c | 7146 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, |
7147 | clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd, | |
7148 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft out", | |
7149 | CLEAR_STR | |
7150 | IP_STR | |
7151 | BGP_STR | |
7152 | BGP_INSTANCE_HELP_STR | |
7153 | "Clear all members of peer-group\n" | |
7154 | "BGP peer-group name\n" | |
7155 | "Address family\n" | |
7156 | "Address Family modifier\n" | |
7157 | "Address Family modifier\n" | |
7158 | BGP_SOFT_STR | |
7159 | BGP_SOFT_OUT_STR) | |
7160 | { | |
7161 | if (strncmp (argv[3], "m", 1) == 0) | |
7162 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, | |
7163 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7164 | ||
7165 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
7166 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7167 | } | |
7168 | ||
718e3744 | 7169 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
7170 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
7171 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
7172 | CLEAR_STR | |
7173 | IP_STR | |
7174 | BGP_STR | |
7175 | "Clear all members of peer-group\n" | |
7176 | "BGP peer-group name\n" | |
7177 | "Address family\n" | |
7178 | "Address Family modifier\n" | |
7179 | "Address Family modifier\n" | |
e0bce756 | 7180 | BGP_SOFT_OUT_STR) |
718e3744 | 7181 | |
01080f7c | 7182 | ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_out, |
7183 | clear_ip_bgp_instance_peer_group_ipv4_out_cmd, | |
7184 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) out", | |
7185 | CLEAR_STR | |
7186 | IP_STR | |
7187 | BGP_STR | |
7188 | BGP_INSTANCE_HELP_STR | |
7189 | "Clear all members of peer-group\n" | |
7190 | "BGP peer-group name\n" | |
7191 | "Address family\n" | |
7192 | "Address Family modifier\n" | |
7193 | "Address Family modifier\n" | |
7194 | BGP_SOFT_OUT_STR) | |
7195 | ||
718e3744 | 7196 | DEFUN (clear_bgp_peer_group_soft_out, |
7197 | clear_bgp_peer_group_soft_out_cmd, | |
7198 | "clear bgp peer-group WORD soft out", | |
7199 | CLEAR_STR | |
7200 | BGP_STR | |
7201 | "Clear all members of peer-group\n" | |
7202 | "BGP peer-group name\n" | |
e0bce756 DS |
7203 | BGP_SOFT_STR |
7204 | BGP_SOFT_OUT_STR) | |
718e3744 | 7205 | { |
01080f7c | 7206 | if (argc == 3) |
7207 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
7208 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7209 | ||
718e3744 | 7210 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
7211 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7212 | } | |
7213 | ||
01080f7c | 7214 | ALIAS (clear_bgp_peer_group_soft_out, |
7215 | clear_bgp_instance_peer_group_soft_out_cmd, | |
7216 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", | |
7217 | CLEAR_STR | |
7218 | BGP_STR | |
7219 | BGP_INSTANCE_HELP_STR | |
7220 | "Clear all members of peer-group\n" | |
7221 | "BGP peer-group name\n" | |
7222 | BGP_SOFT_STR | |
7223 | BGP_SOFT_OUT_STR) | |
7224 | ||
718e3744 | 7225 | ALIAS (clear_bgp_peer_group_soft_out, |
7226 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
7227 | "clear bgp ipv6 peer-group WORD soft out", | |
7228 | CLEAR_STR | |
7229 | BGP_STR | |
7230 | "Address family\n" | |
7231 | "Clear all members of peer-group\n" | |
7232 | "BGP peer-group name\n" | |
e0bce756 DS |
7233 | BGP_SOFT_STR |
7234 | BGP_SOFT_OUT_STR) | |
718e3744 | 7235 | |
01080f7c | 7236 | ALIAS (clear_bgp_peer_group_soft_out, |
7237 | clear_bgp_instance_ipv6_peer_group_soft_out_cmd, | |
7238 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft out", | |
7239 | CLEAR_STR | |
7240 | BGP_STR | |
7241 | BGP_INSTANCE_HELP_STR | |
7242 | "Address family\n" | |
7243 | "Clear all members of peer-group\n" | |
7244 | "BGP peer-group name\n" | |
7245 | BGP_SOFT_STR | |
7246 | BGP_SOFT_OUT_STR) | |
7247 | ||
718e3744 | 7248 | ALIAS (clear_bgp_peer_group_soft_out, |
7249 | clear_bgp_peer_group_out_cmd, | |
7250 | "clear bgp peer-group WORD out", | |
7251 | CLEAR_STR | |
7252 | BGP_STR | |
7253 | "Clear all members of peer-group\n" | |
7254 | "BGP peer-group name\n" | |
e0bce756 | 7255 | BGP_SOFT_OUT_STR) |
718e3744 | 7256 | |
01080f7c | 7257 | ALIAS (clear_bgp_peer_group_soft_out, |
7258 | clear_bgp_instance_peer_group_out_cmd, | |
7259 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD out", | |
7260 | CLEAR_STR | |
7261 | BGP_STR | |
7262 | BGP_INSTANCE_HELP_STR | |
7263 | "Clear all members of peer-group\n" | |
7264 | "BGP peer-group name\n" | |
7265 | BGP_SOFT_OUT_STR) | |
7266 | ||
718e3744 | 7267 | ALIAS (clear_bgp_peer_group_soft_out, |
7268 | clear_bgp_ipv6_peer_group_out_cmd, | |
7269 | "clear bgp ipv6 peer-group WORD out", | |
7270 | CLEAR_STR | |
7271 | BGP_STR | |
7272 | "Address family\n" | |
7273 | "Clear all members of peer-group\n" | |
7274 | "BGP peer-group name\n" | |
e0bce756 | 7275 | BGP_SOFT_OUT_STR) |
718e3744 | 7276 | |
01080f7c | 7277 | ALIAS (clear_bgp_peer_group_soft_out, |
7278 | clear_bgp_instance_ipv6_peer_group_out_cmd, | |
7279 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD out", | |
7280 | CLEAR_STR | |
7281 | BGP_STR | |
7282 | BGP_INSTANCE_HELP_STR | |
7283 | "Address family\n" | |
7284 | "Clear all members of peer-group\n" | |
7285 | "BGP peer-group name\n" | |
7286 | BGP_SOFT_OUT_STR) | |
7287 | ||
718e3744 | 7288 | DEFUN (clear_ip_bgp_external_soft_out, |
7289 | clear_ip_bgp_external_soft_out_cmd, | |
7290 | "clear ip bgp external soft out", | |
7291 | CLEAR_STR | |
7292 | IP_STR | |
7293 | BGP_STR | |
7294 | "Clear all external peers\n" | |
e0bce756 DS |
7295 | BGP_SOFT_STR |
7296 | BGP_SOFT_OUT_STR) | |
01080f7c | 7297 | { |
7298 | if (argc == 2) | |
7299 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
7300 | BGP_CLEAR_SOFT_OUT, NULL); | |
7301 | ||
7302 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7303 | BGP_CLEAR_SOFT_OUT, NULL); | |
7304 | } | |
7305 | ||
7306 | ALIAS (clear_ip_bgp_external_soft_out, | |
7307 | clear_ip_bgp_instance_external_soft_out_cmd, | |
7308 | "clear ip bgp " BGP_INSTANCE_CMD " external soft out", | |
7309 | CLEAR_STR | |
7310 | IP_STR | |
7311 | BGP_STR | |
7312 | BGP_INSTANCE_HELP_STR | |
7313 | "Clear all external peers\n" | |
7314 | BGP_SOFT_STR | |
7315 | BGP_SOFT_OUT_STR) | |
7316 | ||
7317 | ALIAS (clear_ip_bgp_external_soft_out, | |
7318 | clear_ip_bgp_external_out_cmd, | |
7319 | "clear ip bgp external out", | |
7320 | CLEAR_STR | |
7321 | IP_STR | |
7322 | BGP_STR | |
7323 | "Clear all external peers\n" | |
7324 | BGP_SOFT_OUT_STR) | |
718e3744 | 7325 | |
7326 | ALIAS (clear_ip_bgp_external_soft_out, | |
01080f7c | 7327 | clear_ip_bgp_instance_external_out_cmd, |
7328 | "clear ip bgp " BGP_INSTANCE_CMD " external out", | |
718e3744 | 7329 | CLEAR_STR |
7330 | IP_STR | |
7331 | BGP_STR | |
01080f7c | 7332 | BGP_INSTANCE_HELP_STR |
718e3744 | 7333 | "Clear all external peers\n" |
e0bce756 | 7334 | BGP_SOFT_OUT_STR) |
718e3744 | 7335 | |
7336 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
7337 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
7338 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
7339 | CLEAR_STR | |
7340 | IP_STR | |
7341 | BGP_STR | |
7342 | "Clear all external peers\n" | |
7343 | "Address family\n" | |
7344 | "Address Family modifier\n" | |
7345 | "Address Family modifier\n" | |
e0bce756 DS |
7346 | BGP_SOFT_STR |
7347 | BGP_SOFT_OUT_STR) | |
718e3744 | 7348 | { |
7349 | if (strncmp (argv[0], "m", 1) == 0) | |
7350 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7351 | BGP_CLEAR_SOFT_OUT, NULL); | |
7352 | ||
7353 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7354 | BGP_CLEAR_SOFT_OUT, NULL); | |
7355 | } | |
7356 | ||
01080f7c | 7357 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, |
7358 | clear_ip_bgp_instance_external_ipv4_soft_out_cmd, | |
7359 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft out", | |
7360 | CLEAR_STR | |
7361 | IP_STR | |
7362 | BGP_STR | |
7363 | BGP_INSTANCE_HELP_STR | |
7364 | "Clear all external peers\n" | |
7365 | "Address family\n" | |
7366 | "Address Family modifier\n" | |
7367 | "Address Family modifier\n" | |
7368 | BGP_SOFT_STR | |
7369 | BGP_SOFT_OUT_STR) | |
7370 | { | |
7371 | if (strncmp (argv[2], "m", 1) == 0) | |
7372 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, | |
7373 | BGP_CLEAR_SOFT_OUT, NULL); | |
7374 | ||
7375 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
7376 | BGP_CLEAR_SOFT_OUT, NULL); | |
7377 | } | |
7378 | ||
718e3744 | 7379 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
7380 | clear_ip_bgp_external_ipv4_out_cmd, | |
7381 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
7382 | CLEAR_STR | |
7383 | IP_STR | |
7384 | BGP_STR | |
7385 | "Clear all external peers\n" | |
7386 | "Address family\n" | |
7387 | "Address Family modifier\n" | |
7388 | "Address Family modifier\n" | |
e0bce756 | 7389 | BGP_SOFT_OUT_STR) |
718e3744 | 7390 | |
01080f7c | 7391 | ALIAS (clear_ip_bgp_instance_external_ipv4_soft_out, |
7392 | clear_ip_bgp_instance_external_ipv4_out_cmd, | |
7393 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) out", | |
7394 | CLEAR_STR | |
7395 | IP_STR | |
7396 | BGP_STR | |
7397 | BGP_INSTANCE_HELP_STR | |
7398 | "Clear all external peers\n" | |
7399 | "Address family\n" | |
7400 | "Address Family modifier\n" | |
7401 | "Address Family modifier\n" | |
7402 | BGP_SOFT_OUT_STR) | |
7403 | ||
718e3744 | 7404 | DEFUN (clear_bgp_external_soft_out, |
7405 | clear_bgp_external_soft_out_cmd, | |
7406 | "clear bgp external soft out", | |
7407 | CLEAR_STR | |
7408 | BGP_STR | |
7409 | "Clear all external peers\n" | |
e0bce756 DS |
7410 | BGP_SOFT_STR |
7411 | BGP_SOFT_OUT_STR) | |
718e3744 | 7412 | { |
01080f7c | 7413 | if (argc == 2) |
7414 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
7415 | BGP_CLEAR_SOFT_OUT, NULL); | |
7416 | ||
718e3744 | 7417 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
7418 | BGP_CLEAR_SOFT_OUT, NULL); | |
7419 | } | |
7420 | ||
01080f7c | 7421 | ALIAS (clear_bgp_external_soft_out, |
7422 | clear_bgp_instance_external_soft_out_cmd, | |
7423 | "clear bgp " BGP_INSTANCE_CMD " external soft out", | |
7424 | CLEAR_STR | |
7425 | BGP_STR | |
7426 | BGP_INSTANCE_HELP_STR | |
7427 | "Clear all external peers\n" | |
7428 | BGP_SOFT_STR | |
7429 | BGP_SOFT_OUT_STR) | |
7430 | ||
718e3744 | 7431 | ALIAS (clear_bgp_external_soft_out, |
7432 | clear_bgp_ipv6_external_soft_out_cmd, | |
7433 | "clear bgp ipv6 external soft out", | |
7434 | CLEAR_STR | |
7435 | BGP_STR | |
7436 | "Address family\n" | |
7437 | "Clear all external peers\n" | |
e0bce756 DS |
7438 | BGP_SOFT_STR |
7439 | BGP_SOFT_OUT_STR) | |
718e3744 | 7440 | |
01080f7c | 7441 | ALIAS (clear_bgp_external_soft_out, |
7442 | clear_bgp_instance_ipv6_external_soft_out_cmd, | |
7443 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft out", | |
7444 | CLEAR_STR | |
7445 | BGP_STR | |
7446 | BGP_INSTANCE_HELP_STR | |
7447 | "Address family\n" | |
7448 | "Clear all external peers\n" | |
7449 | BGP_SOFT_STR | |
7450 | BGP_SOFT_OUT_STR) | |
7451 | ||
718e3744 | 7452 | ALIAS (clear_bgp_external_soft_out, |
7453 | clear_bgp_external_out_cmd, | |
7454 | "clear bgp external out", | |
7455 | CLEAR_STR | |
7456 | BGP_STR | |
7457 | "Clear all external peers\n" | |
e0bce756 | 7458 | BGP_SOFT_OUT_STR) |
718e3744 | 7459 | |
01080f7c | 7460 | ALIAS (clear_bgp_external_soft_out, |
7461 | clear_bgp_instance_external_out_cmd, | |
7462 | "clear bgp " BGP_INSTANCE_CMD " external out", | |
7463 | CLEAR_STR | |
7464 | BGP_STR | |
7465 | BGP_INSTANCE_HELP_STR | |
7466 | "Clear all external peers\n" | |
7467 | BGP_SOFT_OUT_STR) | |
7468 | ||
718e3744 | 7469 | ALIAS (clear_bgp_external_soft_out, |
7470 | clear_bgp_ipv6_external_out_cmd, | |
7471 | "clear bgp ipv6 external WORD out", | |
7472 | CLEAR_STR | |
7473 | BGP_STR | |
7474 | "Address family\n" | |
7475 | "Clear all external peers\n" | |
e0bce756 | 7476 | BGP_SOFT_OUT_STR) |
718e3744 | 7477 | |
01080f7c | 7478 | ALIAS (clear_bgp_external_soft_out, |
7479 | clear_bgp_instance_ipv6_external_out_cmd, | |
7480 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD out", | |
7481 | CLEAR_STR | |
7482 | BGP_STR | |
7483 | BGP_INSTANCE_HELP_STR | |
7484 | "Address family\n" | |
7485 | "Clear all external peers\n" | |
7486 | BGP_SOFT_OUT_STR) | |
7487 | ||
718e3744 | 7488 | DEFUN (clear_ip_bgp_as_soft_out, |
7489 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 7490 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 7491 | CLEAR_STR |
7492 | IP_STR | |
7493 | BGP_STR | |
7494 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7495 | BGP_SOFT_STR |
7496 | BGP_SOFT_OUT_STR) | |
718e3744 | 7497 | { |
01080f7c | 7498 | if (argc == 3) |
7499 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
7500 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7501 | ||
718e3744 | 7502 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
7503 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7504 | } | |
7505 | ||
01080f7c | 7506 | ALIAS (clear_ip_bgp_as_soft_out, |
7507 | clear_ip_bgp_instance_as_soft_out_cmd, | |
7508 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", | |
7509 | CLEAR_STR | |
7510 | IP_STR | |
7511 | BGP_STR | |
7512 | BGP_INSTANCE_HELP_STR | |
7513 | "Clear peers with the AS number\n" | |
7514 | BGP_SOFT_STR | |
7515 | BGP_SOFT_OUT_STR) | |
7516 | ||
718e3744 | 7517 | ALIAS (clear_ip_bgp_as_soft_out, |
7518 | clear_ip_bgp_as_out_cmd, | |
320da874 | 7519 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 7520 | CLEAR_STR |
7521 | IP_STR | |
7522 | BGP_STR | |
7523 | "Clear peers with the AS number\n" | |
e0bce756 | 7524 | BGP_SOFT_OUT_STR) |
718e3744 | 7525 | |
01080f7c | 7526 | ALIAS (clear_ip_bgp_as_soft_out, |
7527 | clear_ip_bgp_instance_as_out_cmd, | |
7528 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", | |
7529 | CLEAR_STR | |
7530 | IP_STR | |
7531 | BGP_STR | |
7532 | BGP_INSTANCE_HELP_STR | |
7533 | "Clear peers with the AS number\n" | |
7534 | BGP_SOFT_OUT_STR) | |
7535 | ||
718e3744 | 7536 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
7537 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 7538 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 7539 | CLEAR_STR |
7540 | IP_STR | |
7541 | BGP_STR | |
7542 | "Clear peers with the AS number\n" | |
7543 | "Address family\n" | |
7544 | "Address Family modifier\n" | |
7545 | "Address Family modifier\n" | |
e0bce756 DS |
7546 | BGP_SOFT_STR |
7547 | BGP_SOFT_OUT_STR) | |
718e3744 | 7548 | { |
7549 | if (strncmp (argv[1], "m", 1) == 0) | |
7550 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7551 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7552 | ||
7553 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7554 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7555 | } | |
7556 | ||
01080f7c | 7557 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, |
7558 | clear_ip_bgp_instance_as_ipv4_soft_out_cmd, | |
7559 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", | |
7560 | CLEAR_STR | |
7561 | IP_STR | |
7562 | BGP_STR | |
7563 | BGP_INSTANCE_HELP_STR | |
7564 | "Clear peers with the AS number\n" | |
7565 | "Address family\n" | |
7566 | "Address Family modifier\n" | |
7567 | "Address Family modifier\n" | |
7568 | BGP_SOFT_STR | |
7569 | BGP_SOFT_OUT_STR) | |
7570 | { | |
7571 | if (strncmp (argv[3], "m", 1) == 0) | |
7572 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, | |
7573 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7574 | ||
7575 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
7576 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7577 | } | |
7578 | ||
718e3744 | 7579 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
7580 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 7581 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 7582 | CLEAR_STR |
7583 | IP_STR | |
7584 | BGP_STR | |
7585 | "Clear peers with the AS number\n" | |
7586 | "Address family\n" | |
7587 | "Address Family modifier\n" | |
7588 | "Address Family modifier\n" | |
e0bce756 | 7589 | BGP_SOFT_OUT_STR) |
718e3744 | 7590 | |
01080f7c | 7591 | ALIAS (clear_ip_bgp_instance_as_ipv4_soft_out, |
7592 | clear_ip_bgp_instance_as_ipv4_out_cmd, | |
7593 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) out", | |
7594 | CLEAR_STR | |
7595 | IP_STR | |
7596 | BGP_STR | |
7597 | BGP_INSTANCE_HELP_STR | |
7598 | "Clear peers with the AS number\n" | |
7599 | "Address family\n" | |
7600 | "Address Family modifier\n" | |
7601 | "Address Family modifier\n" | |
7602 | BGP_SOFT_OUT_STR) | |
7603 | ||
718e3744 | 7604 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
7605 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 7606 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 7607 | CLEAR_STR |
7608 | IP_STR | |
7609 | BGP_STR | |
7610 | "Clear peers with the AS number\n" | |
7611 | "Address family\n" | |
7612 | "Address Family modifier\n" | |
e0bce756 DS |
7613 | BGP_SOFT_STR |
7614 | BGP_SOFT_OUT_STR) | |
718e3744 | 7615 | { |
7616 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7617 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7618 | } | |
7619 | ||
7620 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
7621 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 7622 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 7623 | CLEAR_STR |
7624 | IP_STR | |
7625 | BGP_STR | |
7626 | "Clear peers with the AS number\n" | |
7627 | "Address family\n" | |
7628 | "Address Family modifier\n" | |
e0bce756 | 7629 | BGP_SOFT_OUT_STR) |
718e3744 | 7630 | |
587ff0fd LB |
7631 | DEFUN (clear_ip_bgp_as_encap_soft_out, |
7632 | clear_ip_bgp_as_encap_soft_out_cmd, | |
7633 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft out", | |
7634 | CLEAR_STR | |
7635 | IP_STR | |
7636 | BGP_STR | |
7637 | "Clear peers with the AS number\n" | |
7638 | "Address family\n" | |
7639 | "Address Family modifier\n" | |
7640 | "Soft reconfig\n" | |
7641 | "Soft reconfig outbound update\n") | |
7642 | { | |
7643 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
7644 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7645 | } | |
7646 | ||
7647 | ALIAS (clear_ip_bgp_as_encap_soft_out, | |
7648 | clear_ip_bgp_as_encap_out_cmd, | |
7649 | "clear ip bgp " CMD_AS_RANGE " encap unicast out", | |
7650 | CLEAR_STR | |
7651 | IP_STR | |
7652 | BGP_STR | |
7653 | "Clear peers with the AS number\n" | |
7654 | "Address family\n" | |
7655 | "Address Family modifier\n" | |
7656 | "Soft reconfig outbound update\n") | |
7657 | ||
718e3744 | 7658 | DEFUN (clear_bgp_as_soft_out, |
7659 | clear_bgp_as_soft_out_cmd, | |
320da874 | 7660 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 7661 | CLEAR_STR |
7662 | BGP_STR | |
7663 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7664 | BGP_SOFT_STR |
7665 | BGP_SOFT_OUT_STR) | |
718e3744 | 7666 | { |
01080f7c | 7667 | if (argc == 3) |
7668 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
7669 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7670 | ||
718e3744 | 7671 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
7672 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7673 | } | |
7674 | ||
01080f7c | 7675 | ALIAS (clear_bgp_as_soft_out, |
7676 | clear_bgp_instance_as_soft_out_cmd, | |
7677 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", | |
7678 | CLEAR_STR | |
7679 | BGP_STR | |
7680 | BGP_INSTANCE_HELP_STR | |
7681 | "Clear peers with the AS number\n" | |
7682 | BGP_SOFT_STR | |
7683 | BGP_SOFT_OUT_STR) | |
7684 | ||
718e3744 | 7685 | ALIAS (clear_bgp_as_soft_out, |
7686 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 7687 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 7688 | CLEAR_STR |
7689 | BGP_STR | |
7690 | "Address family\n" | |
7691 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7692 | BGP_SOFT_STR |
7693 | BGP_SOFT_OUT_STR) | |
718e3744 | 7694 | |
01080f7c | 7695 | ALIAS (clear_bgp_as_soft_out, |
7696 | clear_bgp_instance_ipv6_as_soft_out_cmd, | |
7697 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft out", | |
7698 | CLEAR_STR | |
7699 | BGP_STR | |
7700 | BGP_INSTANCE_HELP_STR | |
7701 | "Address family\n" | |
7702 | "Clear peers with the AS number\n" | |
7703 | BGP_SOFT_STR | |
7704 | BGP_SOFT_OUT_STR) | |
7705 | ||
718e3744 | 7706 | ALIAS (clear_bgp_as_soft_out, |
7707 | clear_bgp_as_out_cmd, | |
320da874 | 7708 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 7709 | CLEAR_STR |
7710 | BGP_STR | |
7711 | "Clear peers with the AS number\n" | |
e0bce756 | 7712 | BGP_SOFT_OUT_STR) |
718e3744 | 7713 | |
01080f7c | 7714 | ALIAS (clear_bgp_as_soft_out, |
7715 | clear_bgp_instance_as_out_cmd, | |
7716 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", | |
7717 | CLEAR_STR | |
7718 | BGP_STR | |
7719 | BGP_INSTANCE_HELP_STR | |
7720 | "Clear peers with the AS number\n" | |
7721 | BGP_SOFT_OUT_STR) | |
7722 | ||
718e3744 | 7723 | ALIAS (clear_bgp_as_soft_out, |
7724 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 7725 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 7726 | CLEAR_STR |
7727 | BGP_STR | |
7728 | "Address family\n" | |
7729 | "Clear peers with the AS number\n" | |
e0bce756 | 7730 | BGP_SOFT_OUT_STR) |
6b0655a2 | 7731 | |
01080f7c | 7732 | ALIAS (clear_bgp_as_soft_out, |
7733 | clear_bgp_instance_ipv6_as_out_cmd, | |
7734 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " out", | |
7735 | CLEAR_STR | |
7736 | BGP_STR | |
7737 | BGP_INSTANCE_HELP_STR | |
7738 | "Address family\n" | |
7739 | "Clear peers with the AS number\n" | |
7740 | BGP_SOFT_OUT_STR) | |
7741 | ||
718e3744 | 7742 | /* Inbound soft-reconfiguration */ |
7743 | DEFUN (clear_ip_bgp_all_soft_in, | |
7744 | clear_ip_bgp_all_soft_in_cmd, | |
7745 | "clear ip bgp * soft in", | |
7746 | CLEAR_STR | |
7747 | IP_STR | |
7748 | BGP_STR | |
7749 | "Clear all peers\n" | |
e0bce756 DS |
7750 | BGP_SOFT_STR |
7751 | BGP_SOFT_IN_STR) | |
718e3744 | 7752 | { |
6aeb9e78 DS |
7753 | if (argc == 2) |
7754 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 7755 | BGP_CLEAR_SOFT_IN, NULL); |
7756 | ||
7757 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7758 | BGP_CLEAR_SOFT_IN, NULL); | |
7759 | } | |
7760 | ||
7761 | ALIAS (clear_ip_bgp_all_soft_in, | |
7762 | clear_ip_bgp_instance_all_soft_in_cmd, | |
8386ac43 | 7763 | "clear ip bgp " BGP_INSTANCE_CMD " * soft in", |
718e3744 | 7764 | CLEAR_STR |
7765 | IP_STR | |
7766 | BGP_STR | |
8386ac43 | 7767 | BGP_INSTANCE_HELP_STR |
718e3744 | 7768 | "Clear all peers\n" |
e0bce756 DS |
7769 | BGP_SOFT_STR |
7770 | BGP_SOFT_IN_STR) | |
718e3744 | 7771 | |
7772 | ALIAS (clear_ip_bgp_all_soft_in, | |
7773 | clear_ip_bgp_all_in_cmd, | |
7774 | "clear ip bgp * in", | |
7775 | CLEAR_STR | |
7776 | IP_STR | |
7777 | BGP_STR | |
7778 | "Clear all peers\n" | |
e0bce756 | 7779 | BGP_SOFT_IN_STR) |
718e3744 | 7780 | |
01080f7c | 7781 | ALIAS (clear_ip_bgp_all_soft_in, |
7782 | clear_ip_bgp_instance_all_in_cmd, | |
7783 | "clear ip bgp " BGP_INSTANCE_CMD " * in", | |
7784 | CLEAR_STR | |
7785 | IP_STR | |
7786 | BGP_STR | |
7787 | BGP_INSTANCE_HELP_STR | |
7788 | "Clear all peers\n" | |
7789 | BGP_SOFT_IN_STR) | |
7790 | ||
718e3744 | 7791 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
7792 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
7793 | "clear ip bgp * in prefix-filter", | |
7794 | CLEAR_STR | |
7795 | IP_STR | |
7796 | BGP_STR | |
7797 | "Clear all peers\n" | |
e0bce756 | 7798 | BGP_SOFT_IN_STR |
718e3744 | 7799 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7800 | { | |
6aeb9e78 DS |
7801 | if (argc== 2) |
7802 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 7803 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
7804 | ||
7805 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7806 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7807 | } | |
7808 | ||
718e3744 | 7809 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
7810 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
7811 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
7812 | CLEAR_STR | |
7813 | IP_STR | |
7814 | BGP_STR | |
7815 | "Clear all peers\n" | |
7816 | "Address family\n" | |
7817 | "Address Family modifier\n" | |
7818 | "Address Family modifier\n" | |
e0bce756 DS |
7819 | BGP_SOFT_STR |
7820 | BGP_SOFT_IN_STR) | |
718e3744 | 7821 | { |
7822 | if (strncmp (argv[0], "m", 1) == 0) | |
7823 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7824 | BGP_CLEAR_SOFT_IN, NULL); | |
7825 | ||
7826 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7827 | BGP_CLEAR_SOFT_IN, NULL); | |
7828 | } | |
7829 | ||
718e3744 | 7830 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
7831 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
8386ac43 | 7832 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft in", |
718e3744 | 7833 | CLEAR_STR |
7834 | IP_STR | |
7835 | BGP_STR | |
8386ac43 | 7836 | BGP_INSTANCE_HELP_STR |
718e3744 | 7837 | "Clear all peers\n" |
7838 | "Address family\n" | |
7839 | "Address Family modifier\n" | |
7840 | "Address Family modifier\n" | |
e0bce756 DS |
7841 | BGP_SOFT_STR |
7842 | BGP_SOFT_IN_STR) | |
718e3744 | 7843 | { |
6aeb9e78 DS |
7844 | if (strncmp (argv[2], "m", 1) == 0) |
7845 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, | |
718e3744 | 7846 | BGP_CLEAR_SOFT_IN, NULL); |
7847 | ||
6aeb9e78 | 7848 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, |
718e3744 | 7849 | BGP_CLEAR_SOFT_IN, NULL); |
7850 | } | |
7851 | ||
01080f7c | 7852 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
7853 | clear_ip_bgp_all_ipv4_in_cmd, | |
7854 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
718e3744 | 7855 | CLEAR_STR |
7856 | IP_STR | |
7857 | BGP_STR | |
7858 | "Clear all peers\n" | |
7859 | "Address family\n" | |
7860 | "Address Family modifier\n" | |
7861 | "Address Family modifier\n" | |
01080f7c | 7862 | BGP_SOFT_IN_STR) |
718e3744 | 7863 | |
01080f7c | 7864 | ALIAS (clear_ip_bgp_instance_all_ipv4_soft_in, |
7865 | clear_ip_bgp_instance_all_ipv4_in_cmd, | |
7866 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) in", | |
7867 | CLEAR_STR | |
7868 | IP_STR | |
7869 | BGP_STR | |
7870 | BGP_INSTANCE_HELP_STR | |
7871 | "Clear all peers\n" | |
7872 | "Address family\n" | |
7873 | "Address Family modifier\n" | |
7874 | "Address Family modifier\n" | |
7875 | BGP_SOFT_IN_STR) | |
718e3744 | 7876 | |
01080f7c | 7877 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
7878 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
7879 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
718e3744 | 7880 | CLEAR_STR |
7881 | IP_STR | |
7882 | BGP_STR | |
7883 | "Clear all peers\n" | |
7884 | "Address family\n" | |
7885 | "Address Family modifier\n" | |
7886 | "Address Family modifier\n" | |
e0bce756 | 7887 | BGP_SOFT_IN_STR |
718e3744 | 7888 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7889 | { | |
01080f7c | 7890 | if (strncmp (argv[0], "m", 1) == 0) |
7891 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7892 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
718e3744 | 7893 | |
01080f7c | 7894 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
7895 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
718e3744 | 7896 | } |
7897 | ||
7898 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
7899 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
7900 | "clear ip bgp * vpnv4 unicast soft in", | |
7901 | CLEAR_STR | |
7902 | IP_STR | |
7903 | BGP_STR | |
7904 | "Clear all peers\n" | |
7905 | "Address family\n" | |
7906 | "Address Family Modifier\n" | |
e0bce756 DS |
7907 | BGP_SOFT_STR |
7908 | BGP_SOFT_IN_STR) | |
718e3744 | 7909 | { |
7910 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
7911 | BGP_CLEAR_SOFT_IN, NULL); | |
7912 | } | |
7913 | ||
7914 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
7915 | clear_ip_bgp_all_vpnv4_in_cmd, | |
7916 | "clear ip bgp * vpnv4 unicast in", | |
7917 | CLEAR_STR | |
7918 | IP_STR | |
7919 | BGP_STR | |
7920 | "Clear all peers\n" | |
7921 | "Address family\n" | |
7922 | "Address Family Modifier\n" | |
e0bce756 | 7923 | BGP_SOFT_IN_STR) |
718e3744 | 7924 | |
587ff0fd LB |
7925 | DEFUN (clear_ip_bgp_all_encap_soft_in, |
7926 | clear_ip_bgp_all_encap_soft_in_cmd, | |
7927 | "clear ip bgp * encap unicast soft in", | |
7928 | CLEAR_STR | |
7929 | IP_STR | |
7930 | BGP_STR | |
7931 | "Clear all peers\n" | |
7932 | "Address family\n" | |
7933 | "Address Family Modifier\n" | |
7934 | "Soft reconfig\n" | |
7935 | "Soft reconfig inbound update\n") | |
7936 | { | |
7937 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
7938 | BGP_CLEAR_SOFT_IN, NULL); | |
7939 | } | |
7940 | ||
7941 | ALIAS (clear_ip_bgp_all_encap_soft_in, | |
7942 | clear_ip_bgp_all_encap_in_cmd, | |
7943 | "clear ip bgp * encap unicast in", | |
7944 | CLEAR_STR | |
7945 | IP_STR | |
7946 | BGP_STR | |
7947 | "Clear all peers\n" | |
7948 | "Address family\n" | |
7949 | "Address Family Modifier\n" | |
7950 | "Soft reconfig inbound update\n") | |
7951 | ||
718e3744 | 7952 | DEFUN (clear_bgp_all_soft_in, |
7953 | clear_bgp_all_soft_in_cmd, | |
7954 | "clear bgp * soft in", | |
7955 | CLEAR_STR | |
7956 | BGP_STR | |
7957 | "Clear all peers\n" | |
e0bce756 DS |
7958 | BGP_SOFT_STR |
7959 | BGP_SOFT_IN_STR) | |
718e3744 | 7960 | { |
6aeb9e78 DS |
7961 | if (argc == 2) |
7962 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
718e3744 | 7963 | BGP_CLEAR_SOFT_IN, NULL); |
7964 | ||
7965 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7966 | BGP_CLEAR_SOFT_IN, NULL); | |
7967 | } | |
7968 | ||
7969 | ALIAS (clear_bgp_all_soft_in, | |
7970 | clear_bgp_instance_all_soft_in_cmd, | |
8386ac43 | 7971 | "clear bgp " BGP_INSTANCE_CMD " * soft in", |
718e3744 | 7972 | CLEAR_STR |
7973 | BGP_STR | |
8386ac43 | 7974 | BGP_INSTANCE_HELP_STR |
718e3744 | 7975 | "Clear all peers\n" |
e0bce756 DS |
7976 | BGP_SOFT_STR |
7977 | BGP_SOFT_IN_STR) | |
718e3744 | 7978 | |
7979 | ALIAS (clear_bgp_all_soft_in, | |
7980 | clear_bgp_ipv6_all_soft_in_cmd, | |
7981 | "clear bgp ipv6 * soft in", | |
7982 | CLEAR_STR | |
7983 | BGP_STR | |
7984 | "Address family\n" | |
7985 | "Clear all peers\n" | |
e0bce756 DS |
7986 | BGP_SOFT_STR |
7987 | BGP_SOFT_IN_STR) | |
718e3744 | 7988 | |
01080f7c | 7989 | ALIAS (clear_bgp_all_soft_in, |
7990 | clear_bgp_instance_ipv6_all_soft_in_cmd, | |
7991 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft in", | |
7992 | CLEAR_STR | |
7993 | BGP_STR | |
7994 | BGP_INSTANCE_HELP_STR | |
7995 | "Address family\n" | |
7996 | "Clear all peers\n" | |
7997 | BGP_SOFT_STR | |
7998 | BGP_SOFT_IN_STR) | |
7999 | ||
718e3744 | 8000 | ALIAS (clear_bgp_all_soft_in, |
8001 | clear_bgp_all_in_cmd, | |
8002 | "clear bgp * in", | |
8003 | CLEAR_STR | |
8004 | BGP_STR | |
8005 | "Clear all peers\n" | |
e0bce756 | 8006 | BGP_SOFT_IN_STR) |
718e3744 | 8007 | |
01080f7c | 8008 | ALIAS (clear_bgp_all_soft_in, |
8009 | clear_bgp_instance_all_in_cmd, | |
8010 | "clear bgp " BGP_INSTANCE_CMD " * in", | |
8011 | CLEAR_STR | |
8012 | BGP_STR | |
8013 | BGP_INSTANCE_HELP_STR | |
8014 | "Clear all peers\n" | |
8015 | BGP_SOFT_IN_STR) | |
8016 | ||
718e3744 | 8017 | ALIAS (clear_bgp_all_soft_in, |
8018 | clear_bgp_ipv6_all_in_cmd, | |
8019 | "clear bgp ipv6 * in", | |
8020 | CLEAR_STR | |
8021 | BGP_STR | |
8022 | "Address family\n" | |
8023 | "Clear all peers\n" | |
e0bce756 | 8024 | BGP_SOFT_IN_STR) |
718e3744 | 8025 | |
01080f7c | 8026 | ALIAS (clear_bgp_all_soft_in, |
8027 | clear_bgp_instance_ipv6_all_in_cmd, | |
8028 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * in", | |
8029 | CLEAR_STR | |
8030 | BGP_STR | |
8031 | BGP_INSTANCE_HELP_STR | |
8032 | "Address family\n" | |
8033 | "Clear all peers\n" | |
8034 | BGP_SOFT_IN_STR) | |
8035 | ||
718e3744 | 8036 | DEFUN (clear_bgp_all_in_prefix_filter, |
8037 | clear_bgp_all_in_prefix_filter_cmd, | |
8038 | "clear bgp * in prefix-filter", | |
8039 | CLEAR_STR | |
8040 | BGP_STR | |
8041 | "Clear all peers\n" | |
e0bce756 | 8042 | BGP_SOFT_IN_STR |
718e3744 | 8043 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8044 | { | |
8045 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
8046 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8047 | } | |
8048 | ||
8049 | ALIAS (clear_bgp_all_in_prefix_filter, | |
8050 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
8051 | "clear bgp ipv6 * in prefix-filter", | |
8052 | CLEAR_STR | |
8053 | BGP_STR | |
8054 | "Address family\n" | |
8055 | "Clear all peers\n" | |
e0bce756 | 8056 | BGP_SOFT_IN_STR |
718e3744 | 8057 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8058 | ||
8059 | DEFUN (clear_ip_bgp_peer_soft_in, | |
8060 | clear_ip_bgp_peer_soft_in_cmd, | |
db64ea86 | 8061 | "clear ip bgp (A.B.C.D|WORD) soft in", |
718e3744 | 8062 | CLEAR_STR |
8063 | IP_STR | |
8064 | BGP_STR | |
8065 | "BGP neighbor address to clear\n" | |
db64ea86 | 8066 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
8067 | BGP_SOFT_STR |
8068 | BGP_SOFT_IN_STR) | |
718e3744 | 8069 | { |
01080f7c | 8070 | if (argc == 3) |
8071 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
8072 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8073 | ||
718e3744 | 8074 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
8075 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8076 | } | |
8077 | ||
01080f7c | 8078 | ALIAS (clear_ip_bgp_peer_soft_in, |
8079 | clear_ip_bgp_instance_peer_soft_in_cmd, | |
8080 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft in", | |
8081 | CLEAR_STR | |
8082 | IP_STR | |
8083 | BGP_STR | |
8084 | BGP_INSTANCE_HELP_STR | |
8085 | "BGP neighbor address to clear\n" | |
8086 | "BGP neighbor on interface to clear\n" | |
8087 | BGP_SOFT_STR | |
8088 | BGP_SOFT_IN_STR) | |
8089 | ||
718e3744 | 8090 | ALIAS (clear_ip_bgp_peer_soft_in, |
8091 | clear_ip_bgp_peer_in_cmd, | |
db64ea86 | 8092 | "clear ip bgp (A.B.C.D|WORD) in", |
718e3744 | 8093 | CLEAR_STR |
8094 | IP_STR | |
8095 | BGP_STR | |
8096 | "BGP neighbor address to clear\n" | |
db64ea86 | 8097 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8098 | BGP_SOFT_IN_STR) |
01080f7c | 8099 | |
8100 | ALIAS (clear_ip_bgp_peer_soft_in, | |
8101 | clear_ip_bgp_instance_peer_in_cmd, | |
8102 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) in", | |
8103 | CLEAR_STR | |
8104 | IP_STR | |
8105 | BGP_STR | |
8106 | BGP_INSTANCE_HELP_STR | |
8107 | "BGP neighbor address to clear\n" | |
8108 | "BGP neighbor on interface to clear\n" | |
8109 | BGP_SOFT_IN_STR) | |
8110 | ||
718e3744 | 8111 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
8112 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
db64ea86 | 8113 | "clear ip bgp (A.B.C.D|WORD) in prefix-filter", |
718e3744 | 8114 | CLEAR_STR |
8115 | IP_STR | |
8116 | BGP_STR | |
8117 | "BGP neighbor address to clear\n" | |
db64ea86 | 8118 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8119 | BGP_SOFT_IN_STR |
718e3744 | 8120 | "Push out the existing ORF prefix-list\n") |
8121 | { | |
8122 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8123 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8124 | } | |
8125 | ||
8126 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
8127 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
db64ea86 | 8128 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", |
718e3744 | 8129 | CLEAR_STR |
8130 | IP_STR | |
8131 | BGP_STR | |
8132 | "BGP neighbor address to clear\n" | |
db64ea86 | 8133 | "BGP neighbor on interface to clear\n" |
718e3744 | 8134 | "Address family\n" |
8135 | "Address Family modifier\n" | |
8136 | "Address Family modifier\n" | |
e0bce756 DS |
8137 | BGP_SOFT_STR |
8138 | BGP_SOFT_IN_STR) | |
718e3744 | 8139 | { |
8140 | if (strncmp (argv[1], "m", 1) == 0) | |
8141 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
8142 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8143 | ||
8144 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8145 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8146 | } | |
8147 | ||
01080f7c | 8148 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, |
8149 | clear_ip_bgp_instance_peer_ipv4_soft_in_cmd, | |
8150 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", | |
8151 | CLEAR_STR | |
8152 | IP_STR | |
8153 | BGP_STR | |
8154 | BGP_INSTANCE_HELP_STR | |
8155 | "BGP neighbor address to clear\n" | |
8156 | "BGP neighbor on interface to clear\n" | |
8157 | "Address family\n" | |
8158 | "Address Family modifier\n" | |
8159 | "Address Family modifier\n" | |
8160 | BGP_SOFT_STR | |
8161 | BGP_SOFT_IN_STR) | |
8162 | { | |
8163 | if (strncmp (argv[3], "m", 1) == 0) | |
8164 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, | |
8165 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8166 | ||
8167 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
8168 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8169 | } | |
8170 | ||
718e3744 | 8171 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
8172 | clear_ip_bgp_peer_ipv4_in_cmd, | |
db64ea86 | 8173 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in", |
718e3744 | 8174 | CLEAR_STR |
8175 | IP_STR | |
8176 | BGP_STR | |
8177 | "BGP neighbor address to clear\n" | |
db64ea86 | 8178 | "BGP neighbor on interface to clear\n" |
718e3744 | 8179 | "Address family\n" |
8180 | "Address Family modifier\n" | |
8181 | "Address Family modifier\n" | |
e0bce756 | 8182 | BGP_SOFT_IN_STR) |
718e3744 | 8183 | |
01080f7c | 8184 | ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_in, |
8185 | clear_ip_bgp_instance_peer_ipv4_in_cmd, | |
8186 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) in", | |
8187 | CLEAR_STR | |
8188 | IP_STR | |
8189 | BGP_STR | |
8190 | BGP_INSTANCE_HELP_STR | |
8191 | "BGP neighbor address to clear\n" | |
8192 | "BGP neighbor on interface to clear\n" | |
8193 | "Address family\n" | |
8194 | "Address Family modifier\n" | |
8195 | "Address Family modifier\n" | |
8196 | BGP_SOFT_IN_STR) | |
8197 | ||
718e3744 | 8198 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
8199 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
db64ea86 | 8200 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 8201 | CLEAR_STR |
8202 | IP_STR | |
8203 | BGP_STR | |
8204 | "BGP neighbor address to clear\n" | |
db64ea86 | 8205 | "BGP neighbor on interface to clear\n" |
718e3744 | 8206 | "Address family\n" |
8207 | "Address Family modifier\n" | |
8208 | "Address Family modifier\n" | |
e0bce756 | 8209 | BGP_SOFT_IN_STR |
718e3744 | 8210 | "Push out the existing ORF prefix-list\n") |
8211 | { | |
8212 | if (strncmp (argv[1], "m", 1) == 0) | |
8213 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
8214 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8215 | ||
8216 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8217 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8218 | } | |
8219 | ||
8220 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
8221 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
db64ea86 | 8222 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in", |
718e3744 | 8223 | CLEAR_STR |
8224 | IP_STR | |
8225 | BGP_STR | |
8226 | "BGP neighbor address to clear\n" | |
db64ea86 | 8227 | "BGP neighbor on interface to clear\n" |
718e3744 | 8228 | "Address family\n" |
8229 | "Address Family Modifier\n" | |
e0bce756 DS |
8230 | BGP_SOFT_STR |
8231 | BGP_SOFT_IN_STR) | |
718e3744 | 8232 | { |
8233 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
8234 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8235 | } | |
8236 | ||
8237 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
8238 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
db64ea86 | 8239 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in", |
718e3744 | 8240 | CLEAR_STR |
8241 | IP_STR | |
8242 | BGP_STR | |
8243 | "BGP neighbor address to clear\n" | |
db64ea86 | 8244 | "BGP neighbor on interface to clear\n" |
718e3744 | 8245 | "Address family\n" |
8246 | "Address Family Modifier\n" | |
e0bce756 | 8247 | BGP_SOFT_IN_STR) |
718e3744 | 8248 | |
587ff0fd LB |
8249 | DEFUN (clear_ip_bgp_peer_encap_soft_in, |
8250 | clear_ip_bgp_peer_encap_soft_in_cmd, | |
8251 | "clear ip bgp A.B.C.D encap unicast soft in", | |
8252 | CLEAR_STR | |
8253 | IP_STR | |
8254 | BGP_STR | |
8255 | "BGP neighbor address to clear\n" | |
8256 | "Address family\n" | |
8257 | "Address Family Modifier\n" | |
8258 | "Soft reconfig\n" | |
8259 | "Soft reconfig inbound update\n") | |
8260 | { | |
8261 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
8262 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8263 | } | |
8264 | ||
8265 | ALIAS (clear_ip_bgp_peer_encap_soft_in, | |
8266 | clear_ip_bgp_peer_encap_in_cmd, | |
8267 | "clear ip bgp A.B.C.D encap unicast in", | |
8268 | CLEAR_STR | |
8269 | IP_STR | |
8270 | BGP_STR | |
8271 | "BGP neighbor address to clear\n" | |
8272 | "Address family\n" | |
8273 | "Address Family Modifier\n" | |
8274 | "Soft reconfig inbound update\n") | |
8275 | ||
718e3744 | 8276 | DEFUN (clear_bgp_peer_soft_in, |
8277 | clear_bgp_peer_soft_in_cmd, | |
a80beece | 8278 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 8279 | CLEAR_STR |
8280 | BGP_STR | |
8281 | "BGP neighbor address to clear\n" | |
8282 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8283 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
8284 | BGP_SOFT_STR |
8285 | BGP_SOFT_IN_STR) | |
718e3744 | 8286 | { |
01080f7c | 8287 | if (argc == 3) |
8288 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
8289 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8290 | ||
718e3744 | 8291 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
8292 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8293 | } | |
8294 | ||
01080f7c | 8295 | ALIAS (clear_bgp_peer_soft_in, |
8296 | clear_bgp_instance_peer_soft_in_cmd, | |
8297 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft in", | |
8298 | CLEAR_STR | |
8299 | BGP_STR | |
8300 | BGP_INSTANCE_HELP_STR | |
8301 | "BGP neighbor address to clear\n" | |
8302 | "BGP IPv6 neighbor to clear\n" | |
8303 | "BGP neighbor on interface to clear\n" | |
8304 | BGP_SOFT_STR | |
8305 | BGP_SOFT_IN_STR) | |
8306 | ||
718e3744 | 8307 | ALIAS (clear_bgp_peer_soft_in, |
8308 | clear_bgp_ipv6_peer_soft_in_cmd, | |
a80beece | 8309 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 8310 | CLEAR_STR |
8311 | BGP_STR | |
8312 | "Address family\n" | |
8313 | "BGP neighbor address to clear\n" | |
8314 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8315 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
8316 | BGP_SOFT_STR |
8317 | BGP_SOFT_IN_STR) | |
718e3744 | 8318 | |
01080f7c | 8319 | ALIAS (clear_bgp_peer_soft_in, |
8320 | clear_bgp_instance_ipv6_peer_soft_in_cmd, | |
8321 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", | |
8322 | CLEAR_STR | |
8323 | BGP_STR | |
8324 | BGP_INSTANCE_HELP_STR | |
8325 | "Address family\n" | |
8326 | "BGP neighbor address to clear\n" | |
8327 | "BGP IPv6 neighbor to clear\n" | |
8328 | "BGP neighbor on interface to clear\n" | |
8329 | BGP_SOFT_STR | |
8330 | BGP_SOFT_IN_STR) | |
8331 | ||
718e3744 | 8332 | ALIAS (clear_bgp_peer_soft_in, |
8333 | clear_bgp_peer_in_cmd, | |
a80beece | 8334 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 8335 | CLEAR_STR |
8336 | BGP_STR | |
8337 | "BGP neighbor address to clear\n" | |
8338 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8339 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8340 | BGP_SOFT_IN_STR) |
718e3744 | 8341 | |
01080f7c | 8342 | ALIAS (clear_bgp_peer_soft_in, |
8343 | clear_bgp_instance_peer_in_cmd, | |
8344 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) in", | |
8345 | CLEAR_STR | |
8346 | BGP_STR | |
8347 | BGP_INSTANCE_HELP_STR | |
8348 | "BGP neighbor address to clear\n" | |
8349 | "BGP IPv6 neighbor to clear\n" | |
8350 | "BGP neighbor on interface to clear\n" | |
8351 | BGP_SOFT_IN_STR) | |
8352 | ||
718e3744 | 8353 | ALIAS (clear_bgp_peer_soft_in, |
8354 | clear_bgp_ipv6_peer_in_cmd, | |
a80beece | 8355 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 8356 | CLEAR_STR |
8357 | BGP_STR | |
8358 | "Address family\n" | |
8359 | "BGP neighbor address to clear\n" | |
8360 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8361 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8362 | BGP_SOFT_IN_STR) |
718e3744 | 8363 | |
01080f7c | 8364 | ALIAS (clear_bgp_peer_soft_in, |
8365 | clear_bgp_instance_ipv6_peer_in_cmd, | |
8366 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) in", | |
8367 | CLEAR_STR | |
8368 | BGP_STR | |
8369 | BGP_INSTANCE_HELP_STR | |
8370 | "Address family\n" | |
8371 | "BGP neighbor address to clear\n" | |
8372 | "BGP IPv6 neighbor to clear\n" | |
8373 | "BGP neighbor on interface to clear\n" | |
8374 | BGP_SOFT_IN_STR) | |
8375 | ||
718e3744 | 8376 | DEFUN (clear_bgp_peer_in_prefix_filter, |
8377 | clear_bgp_peer_in_prefix_filter_cmd, | |
a80beece | 8378 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 8379 | CLEAR_STR |
8380 | BGP_STR | |
8381 | "BGP neighbor address to clear\n" | |
8382 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8383 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8384 | BGP_SOFT_IN_STR |
718e3744 | 8385 | "Push out the existing ORF prefix-list\n") |
8386 | { | |
8387 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
8388 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8389 | } | |
8390 | ||
8391 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
8392 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
a80beece | 8393 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 8394 | CLEAR_STR |
8395 | BGP_STR | |
8396 | "Address family\n" | |
8397 | "BGP neighbor address to clear\n" | |
8398 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8399 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8400 | BGP_SOFT_IN_STR |
718e3744 | 8401 | "Push out the existing ORF prefix-list\n") |
8402 | ||
8403 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
8404 | clear_ip_bgp_peer_group_soft_in_cmd, | |
8405 | "clear ip bgp peer-group WORD soft in", | |
8406 | CLEAR_STR | |
8407 | IP_STR | |
8408 | BGP_STR | |
8409 | "Clear all members of peer-group\n" | |
8410 | "BGP peer-group name\n" | |
e0bce756 DS |
8411 | BGP_SOFT_STR |
8412 | BGP_SOFT_IN_STR) | |
718e3744 | 8413 | { |
01080f7c | 8414 | if (argc == 3) |
8415 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
8416 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8417 | ||
718e3744 | 8418 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
8419 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8420 | } | |
8421 | ||
01080f7c | 8422 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
8423 | clear_ip_bgp_instance_peer_group_soft_in_cmd, | |
8424 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", | |
8425 | CLEAR_STR | |
8426 | IP_STR | |
8427 | BGP_STR | |
8428 | BGP_INSTANCE_HELP_STR | |
8429 | "Clear all members of peer-group\n" | |
8430 | "BGP peer-group name\n" | |
8431 | BGP_SOFT_STR | |
8432 | BGP_SOFT_IN_STR) | |
8433 | ||
718e3744 | 8434 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
8435 | clear_ip_bgp_peer_group_in_cmd, | |
8436 | "clear ip bgp peer-group WORD in", | |
8437 | CLEAR_STR | |
8438 | IP_STR | |
8439 | BGP_STR | |
8440 | "Clear all members of peer-group\n" | |
8441 | "BGP peer-group name\n" | |
e0bce756 | 8442 | BGP_SOFT_IN_STR) |
718e3744 | 8443 | |
01080f7c | 8444 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
8445 | clear_ip_bgp_instance_peer_group_in_cmd, | |
8446 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD in", | |
8447 | CLEAR_STR | |
8448 | IP_STR | |
8449 | BGP_STR | |
8450 | BGP_INSTANCE_HELP_STR | |
8451 | "Clear all members of peer-group\n" | |
8452 | "BGP peer-group name\n" | |
8453 | BGP_SOFT_IN_STR) | |
8454 | ||
718e3744 | 8455 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
8456 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
8457 | "clear ip bgp peer-group WORD in prefix-filter", | |
8458 | CLEAR_STR | |
8459 | IP_STR | |
8460 | BGP_STR | |
8461 | "Clear all members of peer-group\n" | |
8462 | "BGP peer-group name\n" | |
e0bce756 | 8463 | BGP_SOFT_IN_STR |
718e3744 | 8464 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8465 | { | |
8466 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
8467 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8468 | } | |
8469 | ||
8470 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
8471 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
8472 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
8473 | CLEAR_STR | |
8474 | IP_STR | |
8475 | BGP_STR | |
8476 | "Clear all members of peer-group\n" | |
8477 | "BGP peer-group name\n" | |
8478 | "Address family\n" | |
8479 | "Address Family modifier\n" | |
8480 | "Address Family modifier\n" | |
e0bce756 DS |
8481 | BGP_SOFT_STR |
8482 | BGP_SOFT_IN_STR) | |
718e3744 | 8483 | { |
8484 | if (strncmp (argv[1], "m", 1) == 0) | |
8485 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
8486 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8487 | ||
8488 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
8489 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8490 | } | |
8491 | ||
01080f7c | 8492 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, |
8493 | clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd, | |
8494 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft in", | |
8495 | CLEAR_STR | |
8496 | IP_STR | |
8497 | BGP_STR | |
8498 | BGP_INSTANCE_HELP_STR | |
8499 | "Clear all members of peer-group\n" | |
8500 | "BGP peer-group name\n" | |
8501 | "Address family\n" | |
8502 | "Address Family modifier\n" | |
8503 | "Address Family modifier\n" | |
8504 | BGP_SOFT_STR | |
8505 | BGP_SOFT_IN_STR) | |
8506 | { | |
8507 | if (strncmp (argv[3], "m", 1) == 0) | |
8508 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, | |
8509 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8510 | ||
8511 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
8512 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8513 | } | |
8514 | ||
718e3744 | 8515 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
8516 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
8517 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
8518 | CLEAR_STR | |
8519 | IP_STR | |
8520 | BGP_STR | |
8521 | "Clear all members of peer-group\n" | |
8522 | "BGP peer-group name\n" | |
8523 | "Address family\n" | |
8524 | "Address Family modifier\n" | |
8525 | "Address Family modifier\n" | |
e0bce756 | 8526 | BGP_SOFT_IN_STR) |
718e3744 | 8527 | |
01080f7c | 8528 | ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_in, |
8529 | clear_ip_bgp_instance_peer_group_ipv4_in_cmd, | |
8530 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) in", | |
8531 | CLEAR_STR | |
8532 | IP_STR | |
8533 | BGP_STR | |
8534 | BGP_INSTANCE_HELP_STR | |
8535 | "Clear all members of peer-group\n" | |
8536 | "BGP peer-group name\n" | |
8537 | "Address family\n" | |
8538 | "Address Family modifier\n" | |
8539 | "Address Family modifier\n" | |
8540 | BGP_SOFT_IN_STR) | |
8541 | ||
718e3744 | 8542 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
8543 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
8544 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
8545 | CLEAR_STR | |
8546 | IP_STR | |
8547 | BGP_STR | |
8548 | "Clear all members of peer-group\n" | |
8549 | "BGP peer-group name\n" | |
8550 | "Address family\n" | |
8551 | "Address Family modifier\n" | |
8552 | "Address Family modifier\n" | |
e0bce756 | 8553 | BGP_SOFT_IN_STR |
718e3744 | 8554 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8555 | { | |
8556 | if (strncmp (argv[1], "m", 1) == 0) | |
8557 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
8558 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8559 | ||
8560 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
8561 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8562 | } | |
8563 | ||
8564 | DEFUN (clear_bgp_peer_group_soft_in, | |
8565 | clear_bgp_peer_group_soft_in_cmd, | |
8566 | "clear bgp peer-group WORD soft in", | |
8567 | CLEAR_STR | |
8568 | BGP_STR | |
8569 | "Clear all members of peer-group\n" | |
8570 | "BGP peer-group name\n" | |
e0bce756 DS |
8571 | BGP_SOFT_STR |
8572 | BGP_SOFT_IN_STR) | |
718e3744 | 8573 | { |
01080f7c | 8574 | if (argc == 3) |
8575 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
8576 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8577 | ||
718e3744 | 8578 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
8579 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8580 | } | |
8581 | ||
01080f7c | 8582 | ALIAS (clear_bgp_peer_group_soft_in, |
8583 | clear_bgp_instance_peer_group_soft_in_cmd, | |
8584 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", | |
8585 | CLEAR_STR | |
8586 | BGP_STR | |
8587 | BGP_INSTANCE_HELP_STR | |
8588 | "Clear all members of peer-group\n" | |
8589 | "BGP peer-group name\n" | |
8590 | BGP_SOFT_STR | |
8591 | BGP_SOFT_IN_STR) | |
8592 | ||
718e3744 | 8593 | ALIAS (clear_bgp_peer_group_soft_in, |
8594 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
8595 | "clear bgp ipv6 peer-group WORD soft in", | |
8596 | CLEAR_STR | |
8597 | BGP_STR | |
8598 | "Address family\n" | |
8599 | "Clear all members of peer-group\n" | |
8600 | "BGP peer-group name\n" | |
e0bce756 DS |
8601 | BGP_SOFT_STR |
8602 | BGP_SOFT_IN_STR) | |
718e3744 | 8603 | |
01080f7c | 8604 | ALIAS (clear_bgp_peer_group_soft_in, |
8605 | clear_bgp_instance_ipv6_peer_group_soft_in_cmd, | |
8606 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft in", | |
8607 | CLEAR_STR | |
8608 | BGP_STR | |
8609 | BGP_INSTANCE_HELP_STR | |
8610 | "Address family\n" | |
8611 | "Clear all members of peer-group\n" | |
8612 | "BGP peer-group name\n" | |
8613 | BGP_SOFT_STR | |
8614 | BGP_SOFT_IN_STR) | |
8615 | ||
718e3744 | 8616 | ALIAS (clear_bgp_peer_group_soft_in, |
8617 | clear_bgp_peer_group_in_cmd, | |
8618 | "clear bgp peer-group WORD in", | |
8619 | CLEAR_STR | |
8620 | BGP_STR | |
8621 | "Clear all members of peer-group\n" | |
8622 | "BGP peer-group name\n" | |
e0bce756 | 8623 | BGP_SOFT_IN_STR) |
718e3744 | 8624 | |
01080f7c | 8625 | ALIAS (clear_bgp_peer_group_soft_in, |
8626 | clear_bgp_instance_peer_group_in_cmd, | |
8627 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD in", | |
8628 | CLEAR_STR | |
8629 | BGP_STR | |
8630 | BGP_INSTANCE_HELP_STR | |
8631 | "Clear all members of peer-group\n" | |
8632 | "BGP peer-group name\n" | |
8633 | BGP_SOFT_IN_STR) | |
8634 | ||
718e3744 | 8635 | ALIAS (clear_bgp_peer_group_soft_in, |
8636 | clear_bgp_ipv6_peer_group_in_cmd, | |
8637 | "clear bgp ipv6 peer-group WORD in", | |
8638 | CLEAR_STR | |
8639 | BGP_STR | |
8640 | "Address family\n" | |
8641 | "Clear all members of peer-group\n" | |
8642 | "BGP peer-group name\n" | |
e0bce756 | 8643 | BGP_SOFT_IN_STR) |
718e3744 | 8644 | |
01080f7c | 8645 | ALIAS (clear_bgp_peer_group_soft_in, |
8646 | clear_bgp_instance_ipv6_peer_group_in_cmd, | |
8647 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD in", | |
8648 | CLEAR_STR | |
8649 | BGP_STR | |
8650 | BGP_INSTANCE_HELP_STR | |
8651 | "Address family\n" | |
8652 | "Clear all members of peer-group\n" | |
8653 | "BGP peer-group name\n" | |
8654 | BGP_SOFT_IN_STR) | |
8655 | ||
718e3744 | 8656 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
8657 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
8658 | "clear bgp peer-group WORD in prefix-filter", | |
8659 | CLEAR_STR | |
8660 | BGP_STR | |
8661 | "Clear all members of peer-group\n" | |
8662 | "BGP peer-group name\n" | |
e0bce756 | 8663 | BGP_SOFT_IN_STR |
718e3744 | 8664 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8665 | { | |
8666 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
8667 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8668 | } | |
8669 | ||
8670 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
8671 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
8672 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
8673 | CLEAR_STR | |
8674 | BGP_STR | |
8675 | "Address family\n" | |
8676 | "Clear all members of peer-group\n" | |
8677 | "BGP peer-group name\n" | |
e0bce756 | 8678 | BGP_SOFT_IN_STR |
718e3744 | 8679 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8680 | ||
8681 | DEFUN (clear_ip_bgp_external_soft_in, | |
8682 | clear_ip_bgp_external_soft_in_cmd, | |
8683 | "clear ip bgp external soft in", | |
8684 | CLEAR_STR | |
8685 | IP_STR | |
8686 | BGP_STR | |
8687 | "Clear all external peers\n" | |
e0bce756 DS |
8688 | BGP_SOFT_STR |
8689 | BGP_SOFT_IN_STR) | |
718e3744 | 8690 | { |
01080f7c | 8691 | if (argc == 2) |
8692 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
8693 | BGP_CLEAR_SOFT_IN, NULL); | |
8694 | ||
718e3744 | 8695 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
8696 | BGP_CLEAR_SOFT_IN, NULL); | |
8697 | } | |
8698 | ||
01080f7c | 8699 | ALIAS (clear_ip_bgp_external_soft_in, |
8700 | clear_ip_bgp_instance_external_soft_in_cmd, | |
8701 | "clear ip bgp " BGP_INSTANCE_CMD " external soft in", | |
8702 | CLEAR_STR | |
8703 | IP_STR | |
8704 | BGP_STR | |
8705 | BGP_INSTANCE_HELP_STR | |
8706 | "Clear all external peers\n" | |
8707 | BGP_SOFT_STR | |
8708 | BGP_SOFT_IN_STR) | |
8709 | ||
718e3744 | 8710 | ALIAS (clear_ip_bgp_external_soft_in, |
8711 | clear_ip_bgp_external_in_cmd, | |
8712 | "clear ip bgp external in", | |
8713 | CLEAR_STR | |
8714 | IP_STR | |
8715 | BGP_STR | |
8716 | "Clear all external peers\n" | |
e0bce756 | 8717 | BGP_SOFT_IN_STR) |
718e3744 | 8718 | |
01080f7c | 8719 | ALIAS (clear_ip_bgp_external_soft_in, |
8720 | clear_ip_bgp_instance_external_in_cmd, | |
8721 | "clear ip bgp " BGP_INSTANCE_CMD " external in", | |
8722 | CLEAR_STR | |
8723 | IP_STR | |
8724 | BGP_STR | |
8725 | BGP_INSTANCE_HELP_STR | |
8726 | "Clear all external peers\n" | |
8727 | BGP_SOFT_IN_STR) | |
8728 | ||
718e3744 | 8729 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
8730 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
8731 | "clear ip bgp external in prefix-filter", | |
8732 | CLEAR_STR | |
8733 | IP_STR | |
8734 | BGP_STR | |
8735 | "Clear all external peers\n" | |
e0bce756 | 8736 | BGP_SOFT_IN_STR |
718e3744 | 8737 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8738 | { | |
8739 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8740 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8741 | } | |
8742 | ||
8743 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
8744 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
8745 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
8746 | CLEAR_STR | |
8747 | IP_STR | |
8748 | BGP_STR | |
8749 | "Clear all external peers\n" | |
8750 | "Address family\n" | |
8751 | "Address Family modifier\n" | |
8752 | "Address Family modifier\n" | |
e0bce756 DS |
8753 | BGP_SOFT_STR |
8754 | BGP_SOFT_IN_STR) | |
718e3744 | 8755 | { |
8756 | if (strncmp (argv[0], "m", 1) == 0) | |
8757 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
8758 | BGP_CLEAR_SOFT_IN, NULL); | |
8759 | ||
8760 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8761 | BGP_CLEAR_SOFT_IN, NULL); | |
8762 | } | |
8763 | ||
01080f7c | 8764 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, |
8765 | clear_ip_bgp_instance_external_ipv4_soft_in_cmd, | |
8766 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft in", | |
8767 | CLEAR_STR | |
8768 | IP_STR | |
8769 | BGP_STR | |
8770 | BGP_INSTANCE_HELP_STR | |
8771 | "Clear all external peers\n" | |
8772 | "Address family\n" | |
8773 | "Address Family modifier\n" | |
8774 | "Address Family modifier\n" | |
8775 | BGP_SOFT_STR | |
8776 | BGP_SOFT_IN_STR) | |
8777 | { | |
8778 | if (strncmp (argv[2], "m", 1) == 0) | |
8779 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, | |
8780 | BGP_CLEAR_SOFT_IN, NULL); | |
8781 | ||
8782 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
8783 | BGP_CLEAR_SOFT_IN, NULL); | |
8784 | } | |
8785 | ||
718e3744 | 8786 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
8787 | clear_ip_bgp_external_ipv4_in_cmd, | |
8788 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
8789 | CLEAR_STR | |
8790 | IP_STR | |
8791 | BGP_STR | |
8792 | "Clear all external peers\n" | |
8793 | "Address family\n" | |
8794 | "Address Family modifier\n" | |
8795 | "Address Family modifier\n" | |
e0bce756 | 8796 | BGP_SOFT_IN_STR) |
718e3744 | 8797 | |
01080f7c | 8798 | ALIAS (clear_ip_bgp_instance_external_ipv4_soft_in, |
8799 | clear_ip_bgp_instance_external_ipv4_in_cmd, | |
8800 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) in", | |
8801 | CLEAR_STR | |
8802 | IP_STR | |
8803 | BGP_STR | |
8804 | BGP_INSTANCE_HELP_STR | |
8805 | "Clear all external peers\n" | |
8806 | "Address family\n" | |
8807 | "Address Family modifier\n" | |
8808 | "Address Family modifier\n" | |
8809 | BGP_SOFT_IN_STR) | |
8810 | ||
718e3744 | 8811 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
8812 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
8813 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
8814 | CLEAR_STR | |
8815 | IP_STR | |
8816 | BGP_STR | |
8817 | "Clear all external peers\n" | |
8818 | "Address family\n" | |
8819 | "Address Family modifier\n" | |
8820 | "Address Family modifier\n" | |
e0bce756 | 8821 | BGP_SOFT_IN_STR |
718e3744 | 8822 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8823 | { | |
8824 | if (strncmp (argv[0], "m", 1) == 0) | |
8825 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
8826 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8827 | ||
8828 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8829 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8830 | } | |
8831 | ||
8832 | DEFUN (clear_bgp_external_soft_in, | |
8833 | clear_bgp_external_soft_in_cmd, | |
8834 | "clear bgp external soft in", | |
8835 | CLEAR_STR | |
8836 | BGP_STR | |
8837 | "Clear all external peers\n" | |
e0bce756 DS |
8838 | BGP_SOFT_STR |
8839 | BGP_SOFT_IN_STR) | |
718e3744 | 8840 | { |
01080f7c | 8841 | if (argc == 2) |
8842 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
8843 | BGP_CLEAR_SOFT_IN, NULL); | |
8844 | ||
718e3744 | 8845 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
8846 | BGP_CLEAR_SOFT_IN, NULL); | |
8847 | } | |
8848 | ||
01080f7c | 8849 | ALIAS (clear_bgp_external_soft_in, |
8850 | clear_bgp_instance_external_soft_in_cmd, | |
8851 | "clear bgp " BGP_INSTANCE_CMD " external soft in", | |
8852 | CLEAR_STR | |
8853 | BGP_STR | |
8854 | BGP_INSTANCE_HELP_STR | |
8855 | "Clear all external peers\n" | |
8856 | BGP_SOFT_STR | |
8857 | BGP_SOFT_IN_STR) | |
8858 | ||
718e3744 | 8859 | ALIAS (clear_bgp_external_soft_in, |
8860 | clear_bgp_ipv6_external_soft_in_cmd, | |
8861 | "clear bgp ipv6 external soft in", | |
8862 | CLEAR_STR | |
8863 | BGP_STR | |
8864 | "Address family\n" | |
8865 | "Clear all external peers\n" | |
e0bce756 DS |
8866 | BGP_SOFT_STR |
8867 | BGP_SOFT_IN_STR) | |
718e3744 | 8868 | |
01080f7c | 8869 | ALIAS (clear_bgp_external_soft_in, |
8870 | clear_bgp_instance_ipv6_external_soft_in_cmd, | |
8871 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft in", | |
8872 | CLEAR_STR | |
8873 | BGP_STR | |
8874 | BGP_INSTANCE_HELP_STR | |
8875 | "Address family\n" | |
8876 | "Clear all external peers\n" | |
8877 | BGP_SOFT_STR | |
8878 | BGP_SOFT_IN_STR) | |
8879 | ||
718e3744 | 8880 | ALIAS (clear_bgp_external_soft_in, |
8881 | clear_bgp_external_in_cmd, | |
8882 | "clear bgp external in", | |
8883 | CLEAR_STR | |
8884 | BGP_STR | |
8885 | "Clear all external peers\n" | |
e0bce756 | 8886 | BGP_SOFT_IN_STR) |
718e3744 | 8887 | |
01080f7c | 8888 | ALIAS (clear_bgp_external_soft_in, |
8889 | clear_bgp_instance_external_in_cmd, | |
8890 | "clear bgp " BGP_INSTANCE_CMD " external in", | |
8891 | CLEAR_STR | |
8892 | BGP_STR | |
8893 | BGP_INSTANCE_HELP_STR | |
8894 | "Clear all external peers\n" | |
8895 | BGP_SOFT_IN_STR) | |
8896 | ||
718e3744 | 8897 | ALIAS (clear_bgp_external_soft_in, |
8898 | clear_bgp_ipv6_external_in_cmd, | |
8899 | "clear bgp ipv6 external WORD in", | |
8900 | CLEAR_STR | |
8901 | BGP_STR | |
8902 | "Address family\n" | |
8903 | "Clear all external peers\n" | |
e0bce756 | 8904 | BGP_SOFT_IN_STR) |
718e3744 | 8905 | |
01080f7c | 8906 | ALIAS (clear_bgp_external_soft_in, |
8907 | clear_bgp_instance_ipv6_external_in_cmd, | |
8908 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD in", | |
8909 | CLEAR_STR | |
8910 | BGP_STR | |
8911 | BGP_INSTANCE_HELP_STR | |
8912 | "Address family\n" | |
8913 | "Clear all external peers\n" | |
8914 | BGP_SOFT_IN_STR) | |
8915 | ||
718e3744 | 8916 | DEFUN (clear_bgp_external_in_prefix_filter, |
8917 | clear_bgp_external_in_prefix_filter_cmd, | |
8918 | "clear bgp external in prefix-filter", | |
8919 | CLEAR_STR | |
8920 | BGP_STR | |
8921 | "Clear all external peers\n" | |
e0bce756 | 8922 | BGP_SOFT_IN_STR |
718e3744 | 8923 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8924 | { | |
8925 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
8926 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8927 | } | |
8928 | ||
8929 | ALIAS (clear_bgp_external_in_prefix_filter, | |
8930 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
8931 | "clear bgp ipv6 external in prefix-filter", | |
8932 | CLEAR_STR | |
8933 | BGP_STR | |
8934 | "Address family\n" | |
8935 | "Clear all external peers\n" | |
e0bce756 | 8936 | BGP_SOFT_IN_STR |
718e3744 | 8937 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8938 | ||
8939 | DEFUN (clear_ip_bgp_as_soft_in, | |
8940 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 8941 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 8942 | CLEAR_STR |
8943 | IP_STR | |
8944 | BGP_STR | |
8945 | "Clear peers with the AS number\n" | |
e0bce756 DS |
8946 | BGP_SOFT_STR |
8947 | BGP_SOFT_IN_STR) | |
718e3744 | 8948 | { |
01080f7c | 8949 | if (argc == 3) |
8950 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
8951 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8952 | ||
718e3744 | 8953 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
8954 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8955 | } | |
8956 | ||
8957 | ALIAS (clear_ip_bgp_as_soft_in, | |
01080f7c | 8958 | clear_ip_bgp_instance_as_soft_in_cmd, |
8959 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", | |
8960 | CLEAR_STR | |
8961 | IP_STR | |
8962 | BGP_STR | |
8963 | BGP_INSTANCE_HELP_STR | |
8964 | "Clear peers with the AS number\n" | |
8965 | BGP_SOFT_STR | |
8966 | BGP_SOFT_IN_STR) | |
8967 | ||
8968 | ALIAS (clear_ip_bgp_as_soft_in, | |
8969 | clear_ip_bgp_as_in_cmd, | |
8970 | "clear ip bgp " CMD_AS_RANGE " in", | |
8971 | CLEAR_STR | |
8972 | IP_STR | |
8973 | BGP_STR | |
8974 | "Clear peers with the AS number\n" | |
8975 | BGP_SOFT_IN_STR) | |
8976 | ||
8977 | ALIAS (clear_ip_bgp_as_soft_in, | |
8978 | clear_ip_bgp_instance_as_in_cmd, | |
8979 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", | |
718e3744 | 8980 | CLEAR_STR |
8981 | IP_STR | |
8982 | BGP_STR | |
01080f7c | 8983 | BGP_INSTANCE_HELP_STR |
718e3744 | 8984 | "Clear peers with the AS number\n" |
e0bce756 | 8985 | BGP_SOFT_IN_STR) |
718e3744 | 8986 | |
8987 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
8988 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 8989 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 8990 | CLEAR_STR |
8991 | IP_STR | |
8992 | BGP_STR | |
8993 | "Clear peers with the AS number\n" | |
e0bce756 | 8994 | BGP_SOFT_IN_STR |
718e3744 | 8995 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8996 | { | |
8997 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
8998 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8999 | } | |
9000 | ||
9001 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
9002 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 9003 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 9004 | CLEAR_STR |
9005 | IP_STR | |
9006 | BGP_STR | |
9007 | "Clear peers with the AS number\n" | |
9008 | "Address family\n" | |
9009 | "Address Family modifier\n" | |
9010 | "Address Family modifier\n" | |
e0bce756 DS |
9011 | BGP_SOFT_STR |
9012 | BGP_SOFT_IN_STR) | |
718e3744 | 9013 | { |
9014 | if (strncmp (argv[1], "m", 1) == 0) | |
9015 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
9016 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9017 | ||
9018 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
9019 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9020 | } | |
9021 | ||
01080f7c | 9022 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, |
9023 | clear_ip_bgp_instance_as_ipv4_soft_in_cmd, | |
9024 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", | |
9025 | CLEAR_STR | |
9026 | IP_STR | |
9027 | BGP_STR | |
9028 | BGP_INSTANCE_HELP_STR | |
9029 | "Clear peers with the AS number\n" | |
9030 | "Address family\n" | |
9031 | "Address Family modifier\n" | |
9032 | "Address Family modifier\n" | |
9033 | BGP_SOFT_STR | |
9034 | BGP_SOFT_IN_STR) | |
9035 | { | |
9036 | if (strncmp (argv[3], "m", 1) == 0) | |
9037 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, | |
9038 | BGP_CLEAR_SOFT_IN, argv[2]); | |
9039 | ||
9040 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
9041 | BGP_CLEAR_SOFT_IN, argv[2]); | |
9042 | } | |
9043 | ||
718e3744 | 9044 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
9045 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 9046 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 9047 | CLEAR_STR |
9048 | IP_STR | |
9049 | BGP_STR | |
9050 | "Clear peers with the AS number\n" | |
9051 | "Address family\n" | |
9052 | "Address Family modifier\n" | |
9053 | "Address Family modifier\n" | |
e0bce756 | 9054 | BGP_SOFT_IN_STR) |
718e3744 | 9055 | |
01080f7c | 9056 | ALIAS (clear_ip_bgp_instance_as_ipv4_soft_in, |
9057 | clear_ip_bgp_instance_as_ipv4_in_cmd, | |
9058 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) in", | |
9059 | CLEAR_STR | |
9060 | IP_STR | |
9061 | BGP_STR | |
9062 | BGP_INSTANCE_HELP_STR | |
9063 | "Clear peers with the AS number\n" | |
9064 | "Address family\n" | |
9065 | "Address Family modifier\n" | |
9066 | "Address Family modifier\n" | |
9067 | BGP_SOFT_IN_STR) | |
9068 | ||
718e3744 | 9069 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
9070 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 9071 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 9072 | CLEAR_STR |
9073 | IP_STR | |
9074 | BGP_STR | |
9075 | "Clear peers with the AS number\n" | |
9076 | "Address family\n" | |
9077 | "Address Family modifier\n" | |
9078 | "Address Family modifier\n" | |
e0bce756 | 9079 | BGP_SOFT_IN_STR |
718e3744 | 9080 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
9081 | { | |
9082 | if (strncmp (argv[1], "m", 1) == 0) | |
9083 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
9084 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
9085 | ||
9086 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
9087 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
9088 | } | |
9089 | ||
9090 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
9091 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 9092 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 9093 | CLEAR_STR |
9094 | IP_STR | |
9095 | BGP_STR | |
9096 | "Clear peers with the AS number\n" | |
9097 | "Address family\n" | |
9098 | "Address Family modifier\n" | |
e0bce756 DS |
9099 | BGP_SOFT_STR |
9100 | BGP_SOFT_IN_STR) | |
718e3744 | 9101 | { |
9102 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
9103 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9104 | } | |
9105 | ||
9106 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
9107 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 9108 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 9109 | CLEAR_STR |
9110 | IP_STR | |
9111 | BGP_STR | |
9112 | "Clear peers with the AS number\n" | |
9113 | "Address family\n" | |
9114 | "Address Family modifier\n" | |
e0bce756 | 9115 | BGP_SOFT_IN_STR) |
718e3744 | 9116 | |
587ff0fd LB |
9117 | DEFUN (clear_ip_bgp_as_encap_soft_in, |
9118 | clear_ip_bgp_as_encap_soft_in_cmd, | |
9119 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft in", | |
9120 | CLEAR_STR | |
9121 | IP_STR | |
9122 | BGP_STR | |
9123 | "Clear peers with the AS number\n" | |
9124 | "Address family\n" | |
9125 | "Address Family modifier\n" | |
9126 | "Soft reconfig\n" | |
9127 | "Soft reconfig inbound update\n") | |
9128 | { | |
9129 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
9130 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9131 | } | |
9132 | ||
9133 | ALIAS (clear_ip_bgp_as_encap_soft_in, | |
9134 | clear_ip_bgp_as_encap_in_cmd, | |
9135 | "clear ip bgp " CMD_AS_RANGE " encap unicast in", | |
9136 | CLEAR_STR | |
9137 | IP_STR | |
9138 | BGP_STR | |
9139 | "Clear peers with the AS number\n" | |
9140 | "Address family\n" | |
9141 | "Address Family modifier\n" | |
9142 | "Soft reconfig inbound update\n") | |
9143 | ||
718e3744 | 9144 | DEFUN (clear_bgp_as_soft_in, |
9145 | clear_bgp_as_soft_in_cmd, | |
320da874 | 9146 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 9147 | CLEAR_STR |
9148 | BGP_STR | |
9149 | "Clear peers with the AS number\n" | |
e0bce756 DS |
9150 | BGP_SOFT_STR |
9151 | BGP_SOFT_IN_STR) | |
718e3744 | 9152 | { |
01080f7c | 9153 | if (argc == 3) |
9154 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
9155 | BGP_CLEAR_SOFT_IN, argv[2]); | |
9156 | ||
718e3744 | 9157 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
9158 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9159 | } | |
9160 | ||
01080f7c | 9161 | ALIAS (clear_bgp_as_soft_in, |
9162 | clear_bgp_instance_as_soft_in_cmd, | |
9163 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", | |
9164 | CLEAR_STR | |
9165 | BGP_STR | |
9166 | BGP_INSTANCE_HELP_STR | |
9167 | "Clear peers with the AS number\n" | |
9168 | BGP_SOFT_STR | |
9169 | BGP_SOFT_IN_STR) | |
9170 | ||
718e3744 | 9171 | ALIAS (clear_bgp_as_soft_in, |
9172 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 9173 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 9174 | CLEAR_STR |
9175 | BGP_STR | |
9176 | "Address family\n" | |
9177 | "Clear peers with the AS number\n" | |
e0bce756 DS |
9178 | BGP_SOFT_STR |
9179 | BGP_SOFT_IN_STR) | |
718e3744 | 9180 | |
01080f7c | 9181 | ALIAS (clear_bgp_as_soft_in, |
9182 | clear_bgp_instance_ipv6_as_soft_in_cmd, | |
9183 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft in", | |
9184 | CLEAR_STR | |
9185 | BGP_STR | |
9186 | BGP_INSTANCE_HELP_STR | |
9187 | "Address family\n" | |
9188 | "Clear peers with the AS number\n" | |
9189 | BGP_SOFT_STR | |
9190 | BGP_SOFT_IN_STR) | |
9191 | ||
718e3744 | 9192 | ALIAS (clear_bgp_as_soft_in, |
9193 | clear_bgp_as_in_cmd, | |
320da874 | 9194 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 9195 | CLEAR_STR |
9196 | BGP_STR | |
9197 | "Clear peers with the AS number\n" | |
e0bce756 | 9198 | BGP_SOFT_IN_STR) |
718e3744 | 9199 | |
01080f7c | 9200 | ALIAS (clear_bgp_as_soft_in, |
9201 | clear_bgp_instance_as_in_cmd, | |
9202 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", | |
9203 | CLEAR_STR | |
9204 | BGP_STR | |
9205 | BGP_INSTANCE_HELP_STR | |
9206 | "Clear peers with the AS number\n" | |
9207 | BGP_SOFT_IN_STR) | |
9208 | ||
718e3744 | 9209 | ALIAS (clear_bgp_as_soft_in, |
9210 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 9211 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 9212 | CLEAR_STR |
9213 | BGP_STR | |
9214 | "Address family\n" | |
9215 | "Clear peers with the AS number\n" | |
e0bce756 | 9216 | BGP_SOFT_IN_STR) |
718e3744 | 9217 | |
01080f7c | 9218 | ALIAS (clear_bgp_as_soft_in, |
9219 | clear_bgp_instance_ipv6_as_in_cmd, | |
9220 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " in", | |
9221 | CLEAR_STR | |
9222 | BGP_STR | |
9223 | BGP_INSTANCE_HELP_STR | |
9224 | "Address family\n" | |
9225 | "Clear peers with the AS number\n" | |
9226 | BGP_SOFT_IN_STR) | |
9227 | ||
718e3744 | 9228 | DEFUN (clear_bgp_as_in_prefix_filter, |
9229 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 9230 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 9231 | CLEAR_STR |
9232 | BGP_STR | |
9233 | "Clear peers with the AS number\n" | |
e0bce756 | 9234 | BGP_SOFT_IN_STR |
718e3744 | 9235 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
9236 | { | |
9237 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
9238 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
9239 | } | |
9240 | ||
9241 | ALIAS (clear_bgp_as_in_prefix_filter, | |
9242 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 9243 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 9244 | CLEAR_STR |
9245 | BGP_STR | |
9246 | "Address family\n" | |
9247 | "Clear peers with the AS number\n" | |
e0bce756 | 9248 | BGP_SOFT_IN_STR |
718e3744 | 9249 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6b0655a2 | 9250 | |
718e3744 | 9251 | /* Both soft-reconfiguration */ |
9252 | DEFUN (clear_ip_bgp_all_soft, | |
9253 | clear_ip_bgp_all_soft_cmd, | |
9254 | "clear ip bgp * soft", | |
9255 | CLEAR_STR | |
9256 | IP_STR | |
9257 | BGP_STR | |
9258 | "Clear all peers\n" | |
e0bce756 | 9259 | BGP_SOFT_STR) |
718e3744 | 9260 | { |
6aeb9e78 DS |
9261 | if (argc == 2) |
9262 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 9263 | BGP_CLEAR_SOFT_BOTH, NULL); |
9264 | ||
9265 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9266 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9267 | } | |
9268 | ||
9269 | ALIAS (clear_ip_bgp_all_soft, | |
9270 | clear_ip_bgp_instance_all_soft_cmd, | |
8386ac43 | 9271 | "clear ip bgp " BGP_INSTANCE_CMD " * soft", |
718e3744 | 9272 | CLEAR_STR |
9273 | IP_STR | |
9274 | BGP_STR | |
8386ac43 | 9275 | BGP_INSTANCE_HELP_STR |
718e3744 | 9276 | "Clear all peers\n" |
e0bce756 | 9277 | BGP_SOFT_STR) |
718e3744 | 9278 | |
9279 | ||
9280 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
9281 | clear_ip_bgp_all_ipv4_soft_cmd, | |
9282 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
9283 | CLEAR_STR | |
9284 | IP_STR | |
9285 | BGP_STR | |
9286 | "Clear all peers\n" | |
9287 | "Address family\n" | |
9288 | "Address Family Modifier\n" | |
9289 | "Address Family Modifier\n" | |
e0bce756 | 9290 | BGP_SOFT_STR) |
718e3744 | 9291 | { |
9292 | if (strncmp (argv[0], "m", 1) == 0) | |
9293 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
9294 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9295 | ||
9296 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9297 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9298 | } | |
9299 | ||
9300 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
9301 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
8386ac43 | 9302 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft", |
718e3744 | 9303 | CLEAR_STR |
9304 | IP_STR | |
9305 | BGP_STR | |
8386ac43 | 9306 | BGP_INSTANCE_HELP_STR |
718e3744 | 9307 | "Clear all peers\n" |
9308 | "Address family\n" | |
9309 | "Address Family Modifier\n" | |
9310 | "Address Family Modifier\n" | |
e0bce756 | 9311 | BGP_SOFT_STR) |
718e3744 | 9312 | { |
6aeb9e78 DS |
9313 | if (strncmp (argv[2], "m", 1) == 0) |
9314 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, | |
718e3744 | 9315 | BGP_CLEAR_SOFT_BOTH, NULL); |
9316 | ||
9317 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9318 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9319 | } | |
9320 | ||
9321 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
9322 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
9323 | "clear ip bgp * vpnv4 unicast soft", | |
9324 | CLEAR_STR | |
9325 | IP_STR | |
9326 | BGP_STR | |
9327 | "Clear all peers\n" | |
9328 | "Address family\n" | |
9329 | "Address Family Modifier\n" | |
e0bce756 | 9330 | BGP_SOFT_STR) |
718e3744 | 9331 | { |
9332 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
9333 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9334 | } | |
9335 | ||
587ff0fd LB |
9336 | DEFUN (clear_ip_bgp_all_encap_soft, |
9337 | clear_ip_bgp_all_encap_soft_cmd, | |
9338 | "clear ip bgp * encap unicast soft", | |
9339 | CLEAR_STR | |
9340 | IP_STR | |
9341 | BGP_STR | |
9342 | "Clear all peers\n" | |
9343 | "Address family\n" | |
9344 | "Address Family Modifier\n" | |
9345 | "Soft reconfig\n") | |
9346 | { | |
9347 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
9348 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9349 | } | |
9350 | ||
718e3744 | 9351 | DEFUN (clear_bgp_all_soft, |
9352 | clear_bgp_all_soft_cmd, | |
9353 | "clear bgp * soft", | |
9354 | CLEAR_STR | |
9355 | BGP_STR | |
9356 | "Clear all peers\n" | |
e0bce756 | 9357 | BGP_SOFT_STR) |
718e3744 | 9358 | { |
6aeb9e78 DS |
9359 | if (argc == 2) |
9360 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
01080f7c | 9361 | BGP_CLEAR_SOFT_BOTH, NULL); |
718e3744 | 9362 | |
9363 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
01080f7c | 9364 | BGP_CLEAR_SOFT_BOTH, NULL); |
718e3744 | 9365 | } |
9366 | ||
9367 | ALIAS (clear_bgp_all_soft, | |
9368 | clear_bgp_instance_all_soft_cmd, | |
8386ac43 | 9369 | "clear bgp " BGP_INSTANCE_CMD " * soft", |
718e3744 | 9370 | CLEAR_STR |
9371 | BGP_STR | |
8386ac43 | 9372 | BGP_INSTANCE_HELP_STR |
718e3744 | 9373 | "Clear all peers\n" |
e0bce756 | 9374 | BGP_SOFT_STR) |
718e3744 | 9375 | |
9376 | ALIAS (clear_bgp_all_soft, | |
9377 | clear_bgp_ipv6_all_soft_cmd, | |
9378 | "clear bgp ipv6 * soft", | |
9379 | CLEAR_STR | |
9380 | BGP_STR | |
9381 | "Address family\n" | |
9382 | "Clear all peers\n" | |
e0bce756 | 9383 | BGP_SOFT_STR) |
718e3744 | 9384 | |
01080f7c | 9385 | ALIAS (clear_bgp_all_soft, |
9386 | clear_bgp_instance_ipv6_all_soft_cmd, | |
9387 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft", | |
9388 | CLEAR_STR | |
9389 | BGP_STR | |
9390 | BGP_INSTANCE_HELP_STR | |
9391 | "Address family\n" | |
9392 | "Clear all peers\n" | |
9393 | BGP_SOFT_STR) | |
9394 | ||
718e3744 | 9395 | DEFUN (clear_ip_bgp_peer_soft, |
9396 | clear_ip_bgp_peer_soft_cmd, | |
db64ea86 | 9397 | "clear ip bgp (A.B.C.D|WORD) soft", |
718e3744 | 9398 | CLEAR_STR |
9399 | IP_STR | |
9400 | BGP_STR | |
9401 | "BGP neighbor address to clear\n" | |
db64ea86 | 9402 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9403 | BGP_SOFT_STR) |
718e3744 | 9404 | { |
01080f7c | 9405 | if (argc == 3) |
9406 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
9407 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9408 | ||
718e3744 | 9409 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
9410 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9411 | } | |
9412 | ||
01080f7c | 9413 | ALIAS (clear_ip_bgp_peer_soft, |
9414 | clear_ip_bgp_instance_peer_soft_cmd, | |
9415 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft", | |
9416 | CLEAR_STR | |
9417 | IP_STR | |
9418 | BGP_STR | |
9419 | BGP_INSTANCE_HELP_STR | |
9420 | "BGP neighbor address to clear\n" | |
9421 | "BGP neighbor on interface to clear\n" | |
9422 | BGP_SOFT_STR) | |
9423 | ||
718e3744 | 9424 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
9425 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
db64ea86 | 9426 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", |
718e3744 | 9427 | CLEAR_STR |
9428 | IP_STR | |
9429 | BGP_STR | |
9430 | "BGP neighbor address to clear\n" | |
db64ea86 | 9431 | "BGP neighbor on interface to clear\n" |
718e3744 | 9432 | "Address family\n" |
9433 | "Address Family Modifier\n" | |
9434 | "Address Family Modifier\n" | |
e0bce756 | 9435 | BGP_SOFT_STR) |
718e3744 | 9436 | { |
9437 | if (strncmp (argv[1], "m", 1) == 0) | |
9438 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
9439 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9440 | ||
9441 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
9442 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9443 | } | |
9444 | ||
01080f7c | 9445 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, |
9446 | clear_ip_bgp_instance_peer_ipv4_soft_cmd, | |
9447 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", | |
9448 | CLEAR_STR | |
9449 | IP_STR | |
9450 | BGP_STR | |
9451 | BGP_INSTANCE_HELP_STR | |
9452 | "BGP neighbor address to clear\n" | |
9453 | "BGP neighbor on interface to clear\n" | |
9454 | "Address family\n" | |
9455 | "Address Family Modifier\n" | |
9456 | "Address Family Modifier\n" | |
9457 | BGP_SOFT_STR) | |
9458 | { | |
9459 | if (strncmp (argv[3], "m", 1) == 0) | |
9460 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, | |
9461 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9462 | ||
9463 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
9464 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9465 | } | |
9466 | ||
718e3744 | 9467 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
9468 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
db64ea86 | 9469 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft", |
718e3744 | 9470 | CLEAR_STR |
9471 | IP_STR | |
9472 | BGP_STR | |
9473 | "BGP neighbor address to clear\n" | |
db64ea86 | 9474 | "BGP neighbor on interface to clear\n" |
718e3744 | 9475 | "Address family\n" |
9476 | "Address Family Modifier\n" | |
e0bce756 | 9477 | BGP_SOFT_STR) |
718e3744 | 9478 | { |
9479 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
9480 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9481 | } | |
9482 | ||
587ff0fd LB |
9483 | DEFUN (clear_ip_bgp_peer_encap_soft, |
9484 | clear_ip_bgp_peer_encap_soft_cmd, | |
9485 | "clear ip bgp A.B.C.D encap unicast soft", | |
9486 | CLEAR_STR | |
9487 | IP_STR | |
9488 | BGP_STR | |
9489 | "BGP neighbor address to clear\n" | |
9490 | "Address family\n" | |
9491 | "Address Family Modifier\n" | |
9492 | "Soft reconfig\n") | |
9493 | { | |
9494 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
9495 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9496 | } | |
9497 | ||
718e3744 | 9498 | DEFUN (clear_bgp_peer_soft, |
9499 | clear_bgp_peer_soft_cmd, | |
a80beece | 9500 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 9501 | CLEAR_STR |
9502 | BGP_STR | |
9503 | "BGP neighbor address to clear\n" | |
9504 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 9505 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9506 | BGP_SOFT_STR) |
718e3744 | 9507 | { |
01080f7c | 9508 | if (argc == 3) |
9509 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
9510 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9511 | ||
718e3744 | 9512 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
9513 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9514 | } | |
9515 | ||
01080f7c | 9516 | ALIAS (clear_bgp_peer_soft, |
9517 | clear_bgp_instance_peer_soft_cmd, | |
9518 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft", | |
9519 | CLEAR_STR | |
9520 | BGP_STR | |
9521 | BGP_INSTANCE_HELP_STR | |
9522 | "BGP neighbor address to clear\n" | |
9523 | "BGP IPv6 neighbor to clear\n" | |
9524 | "BGP neighbor on interface to clear\n" | |
9525 | BGP_SOFT_STR) | |
9526 | ||
718e3744 | 9527 | ALIAS (clear_bgp_peer_soft, |
9528 | clear_bgp_ipv6_peer_soft_cmd, | |
a80beece | 9529 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 9530 | CLEAR_STR |
9531 | BGP_STR | |
9532 | "Address family\n" | |
9533 | "BGP neighbor address to clear\n" | |
9534 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 9535 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9536 | BGP_SOFT_STR) |
718e3744 | 9537 | |
01080f7c | 9538 | ALIAS (clear_bgp_peer_soft, |
9539 | clear_bgp_instance_ipv6_peer_soft_cmd, | |
9540 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft", | |
9541 | CLEAR_STR | |
9542 | BGP_STR | |
9543 | BGP_INSTANCE_HELP_STR | |
9544 | "Address family\n" | |
9545 | "BGP neighbor address to clear\n" | |
9546 | "BGP IPv6 neighbor to clear\n" | |
9547 | "BGP neighbor on interface to clear\n" | |
9548 | BGP_SOFT_STR) | |
9549 | ||
718e3744 | 9550 | DEFUN (clear_ip_bgp_peer_group_soft, |
9551 | clear_ip_bgp_peer_group_soft_cmd, | |
9552 | "clear ip bgp peer-group WORD soft", | |
9553 | CLEAR_STR | |
9554 | IP_STR | |
9555 | BGP_STR | |
9556 | "Clear all members of peer-group\n" | |
9557 | "BGP peer-group name\n" | |
e0bce756 | 9558 | BGP_SOFT_STR) |
718e3744 | 9559 | { |
01080f7c | 9560 | if (argc == 3) |
9561 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
9562 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9563 | ||
718e3744 | 9564 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
9565 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9566 | } | |
9567 | ||
01080f7c | 9568 | ALIAS (clear_ip_bgp_peer_group_soft, |
9569 | clear_ip_bgp_instance_peer_group_soft_cmd, | |
9570 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft", | |
9571 | CLEAR_STR | |
9572 | IP_STR | |
9573 | BGP_STR | |
9574 | BGP_INSTANCE_HELP_STR | |
9575 | "Clear all members of peer-group\n" | |
9576 | "BGP peer-group name\n" | |
9577 | BGP_SOFT_STR) | |
9578 | ||
718e3744 | 9579 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
9580 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
9581 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
9582 | CLEAR_STR | |
9583 | IP_STR | |
9584 | BGP_STR | |
9585 | "Clear all members of peer-group\n" | |
9586 | "BGP peer-group name\n" | |
9587 | "Address family\n" | |
9588 | "Address Family modifier\n" | |
9589 | "Address Family modifier\n" | |
e0bce756 | 9590 | BGP_SOFT_STR) |
718e3744 | 9591 | { |
9592 | if (strncmp (argv[1], "m", 1) == 0) | |
9593 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
9594 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9595 | ||
9596 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
9597 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9598 | } | |
9599 | ||
01080f7c | 9600 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, |
9601 | clear_ip_bgp_instance_peer_group_ipv4_soft_cmd, | |
9602 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft", | |
9603 | CLEAR_STR | |
9604 | IP_STR | |
9605 | BGP_STR | |
9606 | BGP_INSTANCE_HELP_STR | |
9607 | "Clear all members of peer-group\n" | |
9608 | "BGP peer-group name\n" | |
9609 | "Address family\n" | |
9610 | "Address Family modifier\n" | |
9611 | "Address Family modifier\n" | |
9612 | BGP_SOFT_STR) | |
9613 | { | |
9614 | if (strncmp (argv[3], "m", 1) == 0) | |
9615 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, | |
9616 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9617 | ||
9618 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
9619 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9620 | } | |
9621 | ||
718e3744 | 9622 | DEFUN (clear_bgp_peer_group_soft, |
9623 | clear_bgp_peer_group_soft_cmd, | |
9624 | "clear bgp peer-group WORD soft", | |
9625 | CLEAR_STR | |
9626 | BGP_STR | |
9627 | "Clear all members of peer-group\n" | |
9628 | "BGP peer-group name\n" | |
e0bce756 | 9629 | BGP_SOFT_STR) |
718e3744 | 9630 | { |
01080f7c | 9631 | if (argc == 3) |
9632 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
9633 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9634 | ||
718e3744 | 9635 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
9636 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9637 | } | |
9638 | ||
01080f7c | 9639 | ALIAS (clear_bgp_peer_group_soft, |
9640 | clear_bgp_instance_peer_group_soft_cmd, | |
9641 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft", | |
9642 | CLEAR_STR | |
9643 | BGP_STR | |
9644 | BGP_INSTANCE_HELP_STR | |
9645 | "Clear all members of peer-group\n" | |
9646 | "BGP peer-group name\n" | |
9647 | BGP_SOFT_STR) | |
9648 | ||
718e3744 | 9649 | ALIAS (clear_bgp_peer_group_soft, |
9650 | clear_bgp_ipv6_peer_group_soft_cmd, | |
9651 | "clear bgp ipv6 peer-group WORD soft", | |
9652 | CLEAR_STR | |
9653 | BGP_STR | |
9654 | "Address family\n" | |
9655 | "Clear all members of peer-group\n" | |
9656 | "BGP peer-group name\n" | |
e0bce756 | 9657 | BGP_SOFT_STR) |
718e3744 | 9658 | |
01080f7c | 9659 | ALIAS (clear_bgp_peer_group_soft, |
9660 | clear_bgp_instance_ipv6_peer_group_soft_cmd, | |
9661 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft", | |
9662 | CLEAR_STR | |
9663 | BGP_STR | |
9664 | BGP_INSTANCE_HELP_STR | |
9665 | "Address family\n" | |
9666 | "Clear all members of peer-group\n" | |
9667 | "BGP peer-group name\n" | |
9668 | BGP_SOFT_STR) | |
9669 | ||
718e3744 | 9670 | DEFUN (clear_ip_bgp_external_soft, |
9671 | clear_ip_bgp_external_soft_cmd, | |
9672 | "clear ip bgp external soft", | |
9673 | CLEAR_STR | |
9674 | IP_STR | |
9675 | BGP_STR | |
9676 | "Clear all external peers\n" | |
e0bce756 | 9677 | BGP_SOFT_STR) |
718e3744 | 9678 | { |
01080f7c | 9679 | if (argc == 2) |
9680 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
9681 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9682 | ||
718e3744 | 9683 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
9684 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9685 | } | |
9686 | ||
01080f7c | 9687 | ALIAS (clear_ip_bgp_external_soft, |
9688 | clear_ip_bgp_instance_external_soft_cmd, | |
9689 | "clear ip bgp " BGP_INSTANCE_CMD " external soft", | |
9690 | CLEAR_STR | |
9691 | IP_STR | |
9692 | BGP_STR | |
9693 | BGP_INSTANCE_HELP_STR | |
9694 | "Clear all external peers\n" | |
9695 | BGP_SOFT_STR) | |
9696 | ||
718e3744 | 9697 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
9698 | clear_ip_bgp_external_ipv4_soft_cmd, | |
9699 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
9700 | CLEAR_STR | |
9701 | IP_STR | |
9702 | BGP_STR | |
9703 | "Clear all external peers\n" | |
9704 | "Address family\n" | |
9705 | "Address Family modifier\n" | |
9706 | "Address Family modifier\n" | |
e0bce756 | 9707 | BGP_SOFT_STR) |
718e3744 | 9708 | { |
9709 | if (strncmp (argv[0], "m", 1) == 0) | |
9710 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
9711 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9712 | ||
9713 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
9714 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9715 | } | |
9716 | ||
01080f7c | 9717 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft, |
9718 | clear_ip_bgp_instance_external_ipv4_soft_cmd, | |
9719 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft", | |
9720 | CLEAR_STR | |
9721 | IP_STR | |
9722 | BGP_STR | |
9723 | BGP_INSTANCE_HELP_STR | |
9724 | "Clear all external peers\n" | |
9725 | "Address family\n" | |
9726 | "Address Family modifier\n" | |
9727 | "Address Family modifier\n" | |
9728 | BGP_SOFT_STR) | |
9729 | { | |
9730 | if (strncmp (argv[2], "m", 1) == 0) | |
9731 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, | |
9732 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9733 | ||
9734 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
9735 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9736 | } | |
9737 | ||
718e3744 | 9738 | DEFUN (clear_bgp_external_soft, |
9739 | clear_bgp_external_soft_cmd, | |
9740 | "clear bgp external soft", | |
9741 | CLEAR_STR | |
9742 | BGP_STR | |
9743 | "Clear all external peers\n" | |
e0bce756 | 9744 | BGP_SOFT_STR) |
718e3744 | 9745 | { |
01080f7c | 9746 | if (argc == 2) |
9747 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
9748 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9749 | ||
718e3744 | 9750 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
9751 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9752 | } | |
9753 | ||
01080f7c | 9754 | ALIAS (clear_bgp_external_soft, |
9755 | clear_bgp_instance_external_soft_cmd, | |
9756 | "clear bgp " BGP_INSTANCE_CMD " external soft", | |
9757 | CLEAR_STR | |
9758 | BGP_STR | |
9759 | BGP_INSTANCE_HELP_STR | |
9760 | "Clear all external peers\n" | |
9761 | BGP_SOFT_STR) | |
9762 | ||
718e3744 | 9763 | ALIAS (clear_bgp_external_soft, |
9764 | clear_bgp_ipv6_external_soft_cmd, | |
9765 | "clear bgp ipv6 external soft", | |
9766 | CLEAR_STR | |
9767 | BGP_STR | |
9768 | "Address family\n" | |
9769 | "Clear all external peers\n" | |
e0bce756 | 9770 | BGP_SOFT_STR) |
718e3744 | 9771 | |
01080f7c | 9772 | ALIAS (clear_bgp_external_soft, |
9773 | clear_bgp_instance_ipv6_external_soft_cmd, | |
9774 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft", | |
9775 | CLEAR_STR | |
9776 | BGP_STR | |
9777 | BGP_INSTANCE_HELP_STR | |
9778 | "Address family\n" | |
9779 | "Clear all external peers\n" | |
9780 | BGP_SOFT_STR) | |
9781 | ||
718e3744 | 9782 | DEFUN (clear_ip_bgp_as_soft, |
9783 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 9784 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 9785 | CLEAR_STR |
9786 | IP_STR | |
9787 | BGP_STR | |
9788 | "Clear peers with the AS number\n" | |
e0bce756 | 9789 | BGP_SOFT_STR) |
718e3744 | 9790 | { |
01080f7c | 9791 | if (argc == 3) |
9792 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
9793 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9794 | ||
718e3744 | 9795 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
9796 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9797 | } | |
9798 | ||
01080f7c | 9799 | ALIAS (clear_ip_bgp_as_soft, |
9800 | clear_ip_bgp_instance_as_soft_cmd, | |
9801 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", | |
9802 | CLEAR_STR | |
9803 | IP_STR | |
9804 | BGP_STR | |
9805 | BGP_INSTANCE_HELP_STR | |
9806 | "Clear peers with the AS number\n" | |
9807 | BGP_SOFT_STR) | |
9808 | ||
718e3744 | 9809 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
9810 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 9811 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 9812 | CLEAR_STR |
9813 | IP_STR | |
9814 | BGP_STR | |
9815 | "Clear peers with the AS number\n" | |
9816 | "Address family\n" | |
9817 | "Address Family Modifier\n" | |
9818 | "Address Family Modifier\n" | |
e0bce756 | 9819 | BGP_SOFT_STR) |
718e3744 | 9820 | { |
9821 | if (strncmp (argv[1], "m", 1) == 0) | |
9822 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
9823 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9824 | ||
9825 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
9826 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9827 | } | |
9828 | ||
01080f7c | 9829 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft, |
9830 | clear_ip_bgp_instance_as_ipv4_soft_cmd, | |
9831 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", | |
9832 | CLEAR_STR | |
9833 | IP_STR | |
9834 | BGP_STR | |
9835 | BGP_INSTANCE_HELP_STR | |
9836 | "Clear peers with the AS number\n" | |
9837 | "Address family\n" | |
9838 | "Address Family Modifier\n" | |
9839 | "Address Family Modifier\n" | |
9840 | BGP_SOFT_STR) | |
9841 | { | |
9842 | if (strncmp (argv[3], "m", 1) == 0) | |
9843 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, | |
9844 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9845 | ||
9846 | return bgp_clear_vty (vty, argv[1],AFI_IP, SAFI_UNICAST, clear_as, | |
9847 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9848 | } | |
9849 | ||
718e3744 | 9850 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
9851 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 9852 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 9853 | CLEAR_STR |
9854 | IP_STR | |
9855 | BGP_STR | |
9856 | "Clear peers with the AS number\n" | |
9857 | "Address family\n" | |
9858 | "Address Family Modifier\n" | |
e0bce756 | 9859 | BGP_SOFT_STR) |
718e3744 | 9860 | { |
9861 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
9862 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9863 | } | |
9864 | ||
587ff0fd LB |
9865 | DEFUN (clear_ip_bgp_as_encap_soft, |
9866 | clear_ip_bgp_as_encap_soft_cmd, | |
9867 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft", | |
9868 | CLEAR_STR | |
9869 | IP_STR | |
9870 | BGP_STR | |
9871 | "Clear peers with the AS number\n" | |
9872 | "Address family\n" | |
9873 | "Address Family Modifier\n" | |
9874 | "Soft reconfig\n") | |
9875 | { | |
9876 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
9877 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9878 | } | |
9879 | ||
718e3744 | 9880 | DEFUN (clear_bgp_as_soft, |
9881 | clear_bgp_as_soft_cmd, | |
320da874 | 9882 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 9883 | CLEAR_STR |
9884 | BGP_STR | |
9885 | "Clear peers with the AS number\n" | |
e0bce756 | 9886 | BGP_SOFT_STR) |
718e3744 | 9887 | { |
01080f7c | 9888 | if (argc == 3) |
9889 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
9890 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9891 | ||
718e3744 | 9892 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
9893 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9894 | } | |
9895 | ||
01080f7c | 9896 | ALIAS (clear_bgp_as_soft, |
9897 | clear_bgp_instance_as_soft_cmd, | |
9898 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", | |
9899 | CLEAR_STR | |
9900 | BGP_STR | |
9901 | BGP_INSTANCE_HELP_STR | |
9902 | "Clear peers with the AS number\n" | |
9903 | BGP_SOFT_STR) | |
9904 | ||
718e3744 | 9905 | ALIAS (clear_bgp_as_soft, |
9906 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 9907 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 9908 | CLEAR_STR |
9909 | BGP_STR | |
9910 | "Address family\n" | |
9911 | "Clear peers with the AS number\n" | |
e0bce756 | 9912 | BGP_SOFT_STR) |
6b0655a2 | 9913 | |
01080f7c | 9914 | ALIAS (clear_bgp_as_soft, |
9915 | clear_bgp_instance_ipv6_as_soft_cmd, | |
9916 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft", | |
9917 | CLEAR_STR | |
9918 | BGP_STR | |
9919 | BGP_INSTANCE_HELP_STR | |
9920 | "Address family\n" | |
9921 | "Clear peers with the AS number\n" | |
9922 | BGP_SOFT_STR) | |
9923 | ||
e0081f70 ML |
9924 | DEFUN (show_bgp_views, |
9925 | show_bgp_views_cmd, | |
9926 | "show bgp views", | |
9927 | SHOW_STR | |
9928 | BGP_STR | |
9929 | "Show the defined BGP views\n") | |
9930 | { | |
9931 | struct list *inst = bm->bgp; | |
9932 | struct listnode *node; | |
9933 | struct bgp *bgp; | |
9934 | ||
9935 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
9936 | { | |
8386ac43 | 9937 | vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE); |
e0081f70 ML |
9938 | return CMD_WARNING; |
9939 | } | |
9940 | ||
9941 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
9942 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
8386ac43 | 9943 | { |
9944 | /* Skip VRFs. */ | |
9945 | if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) | |
9946 | continue; | |
9947 | vty_out (vty, "\t%s (AS%u)%s", | |
9948 | bgp->name ? bgp->name : "(null)", | |
9949 | bgp->as, VTY_NEWLINE); | |
9950 | } | |
e0081f70 ML |
9951 | |
9952 | return CMD_SUCCESS; | |
9953 | } | |
9954 | ||
8386ac43 | 9955 | DEFUN (show_bgp_vrfs, |
9956 | show_bgp_vrfs_cmd, | |
9957 | "show bgp vrfs {json}", | |
9958 | SHOW_STR | |
9959 | BGP_STR | |
9960 | "Show BGP VRFs\n" | |
9961 | "JavaScript Object Notation\n") | |
9962 | { | |
9963 | struct list *inst = bm->bgp; | |
9964 | struct listnode *node; | |
9965 | struct bgp *bgp; | |
9966 | u_char uj = use_json(argc, argv); | |
9967 | json_object *json = NULL; | |
9968 | json_object *json_vrfs = NULL; | |
9969 | int count = 0; | |
9970 | static char header[] = "Type Id RouterId #PeersCfg #PeersEstb Name"; | |
9971 | ||
9972 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
9973 | { | |
9974 | vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE); | |
9975 | return CMD_WARNING; | |
9976 | } | |
9977 | ||
9978 | if (uj) | |
9979 | { | |
9980 | json = json_object_new_object(); | |
9981 | json_vrfs = json_object_new_object(); | |
9982 | } | |
9983 | ||
9984 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
9985 | { | |
9986 | const char *name, *type; | |
9987 | struct peer *peer; | |
9988 | struct listnode *node, *nnode; | |
9989 | int peers_cfg, peers_estb; | |
9990 | json_object *json_vrf = NULL; | |
5c81a5f3 | 9991 | int vrf_id_ui; |
8386ac43 | 9992 | |
9993 | /* Skip Views. */ | |
9994 | if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) | |
9995 | continue; | |
9996 | ||
9997 | count++; | |
9998 | if (!uj && count == 1) | |
9999 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
10000 | ||
10001 | peers_cfg = peers_estb = 0; | |
10002 | if (uj) | |
10003 | json_vrf = json_object_new_object(); | |
10004 | ||
10005 | ||
10006 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
10007 | { | |
10008 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) | |
10009 | continue; | |
10010 | peers_cfg++; | |
10011 | if (peer->status == Established) | |
10012 | peers_estb++; | |
10013 | } | |
10014 | ||
10015 | if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10016 | { | |
10017 | name = "Default"; | |
10018 | type = "DFLT"; | |
10019 | } | |
10020 | else | |
10021 | { | |
10022 | name = bgp->name; | |
10023 | type = "VRF"; | |
10024 | } | |
10025 | ||
5c81a5f3 | 10026 | vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id; |
8386ac43 | 10027 | if (uj) |
10028 | { | |
10029 | json_object_string_add(json_vrf, "type", type); | |
5c81a5f3 | 10030 | json_object_int_add(json_vrf, "vrfId", vrf_id_ui); |
8386ac43 | 10031 | json_object_string_add(json_vrf, "routerId", inet_ntoa (bgp->router_id)); |
10032 | json_object_int_add(json_vrf, "numConfiguredPeers", peers_cfg); | |
10033 | json_object_int_add(json_vrf, "numEstablishedPeers", peers_estb); | |
10034 | ||
10035 | json_object_object_add(json_vrfs, name, json_vrf); | |
10036 | } | |
10037 | else | |
5c81a5f3 | 10038 | vty_out (vty, "%4s %-5d %-16s %9u %10u %s%s", |
10039 | type, vrf_id_ui, inet_ntoa (bgp->router_id), | |
8386ac43 | 10040 | peers_cfg, peers_estb, name, |
10041 | VTY_NEWLINE); | |
10042 | } | |
10043 | ||
10044 | if (uj) | |
10045 | { | |
10046 | json_object_object_add(json, "vrfs", json_vrfs); | |
10047 | ||
10048 | json_object_int_add(json, "totalVrfs", count); | |
10049 | ||
10050 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
10051 | json_object_free(json); | |
10052 | } | |
10053 | else | |
10054 | { | |
10055 | if (count) | |
10056 | vty_out (vty, "%sTotal number of VRFs (including default): %d%s", | |
10057 | VTY_NEWLINE, count, VTY_NEWLINE); | |
10058 | } | |
10059 | ||
10060 | return CMD_SUCCESS; | |
10061 | } | |
10062 | ||
4bf6a362 PJ |
10063 | DEFUN (show_bgp_memory, |
10064 | show_bgp_memory_cmd, | |
10065 | "show bgp memory", | |
10066 | SHOW_STR | |
10067 | BGP_STR | |
10068 | "Global BGP memory statistics\n") | |
10069 | { | |
10070 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
10071 | unsigned long count; | |
10072 | ||
10073 | /* RIB related usage stats */ | |
10074 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
10075 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
10076 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10077 | count * sizeof (struct bgp_node)), | |
10078 | VTY_NEWLINE); | |
10079 | ||
10080 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
10081 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
10082 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10083 | count * sizeof (struct bgp_info)), | |
10084 | VTY_NEWLINE); | |
fb982c25 PJ |
10085 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
10086 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
10087 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10088 | count * sizeof (struct bgp_info_extra)), | |
10089 | VTY_NEWLINE); | |
4bf6a362 PJ |
10090 | |
10091 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
10092 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
10093 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10094 | count * sizeof (struct bgp_static)), | |
10095 | VTY_NEWLINE); | |
3f9c7369 DS |
10096 | |
10097 | if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET))) | |
10098 | vty_out (vty, "%ld Packets, using %s of memory%s", count, | |
10099 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10100 | count * sizeof (struct bpacket)), | |
10101 | VTY_NEWLINE); | |
4bf6a362 PJ |
10102 | |
10103 | /* Adj-In/Out */ | |
10104 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
10105 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
10106 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10107 | count * sizeof (struct bgp_adj_in)), | |
10108 | VTY_NEWLINE); | |
10109 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
10110 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
10111 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10112 | count * sizeof (struct bgp_adj_out)), | |
10113 | VTY_NEWLINE); | |
10114 | ||
10115 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
10116 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
10117 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10118 | count * sizeof (struct bgp_nexthop_cache)), | |
10119 | VTY_NEWLINE); | |
10120 | ||
10121 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
10122 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
10123 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10124 | count * sizeof (struct bgp_damp_info)), | |
10125 | VTY_NEWLINE); | |
10126 | ||
10127 | /* Attributes */ | |
10128 | count = attr_count(); | |
10129 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
10130 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10131 | count * sizeof(struct attr)), | |
10132 | VTY_NEWLINE); | |
fb982c25 PJ |
10133 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
10134 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
10135 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10136 | count * sizeof(struct attr_extra)), | |
10137 | VTY_NEWLINE); | |
4bf6a362 PJ |
10138 | |
10139 | if ((count = attr_unknown_count())) | |
10140 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
10141 | ||
10142 | /* AS_PATH attributes */ | |
10143 | count = aspath_count (); | |
10144 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
10145 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10146 | count * sizeof (struct aspath)), | |
10147 | VTY_NEWLINE); | |
10148 | ||
10149 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
10150 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
10151 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10152 | count * sizeof (struct assegment)), | |
10153 | VTY_NEWLINE); | |
10154 | ||
10155 | /* Other attributes */ | |
10156 | if ((count = community_count ())) | |
10157 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
10158 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10159 | count * sizeof (struct community)), | |
10160 | VTY_NEWLINE); | |
10161 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
10162 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
10163 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10164 | count * sizeof (struct ecommunity)), | |
10165 | VTY_NEWLINE); | |
10166 | ||
10167 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
10168 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
10169 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10170 | count * sizeof (struct cluster_list)), | |
10171 | VTY_NEWLINE); | |
10172 | ||
10173 | /* Peer related usage */ | |
10174 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
10175 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
10176 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10177 | count * sizeof (struct peer)), | |
10178 | VTY_NEWLINE); | |
10179 | ||
6e919709 | 10180 | if ((count = mtype_stats_alloc (MTYPE_BGP_PEER_GROUP))) |
4bf6a362 PJ |
10181 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
10182 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10183 | count * sizeof (struct peer_group)), | |
10184 | VTY_NEWLINE); | |
10185 | ||
10186 | /* Other */ | |
10187 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
10188 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
10189 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10190 | count * sizeof (struct hash)), | |
10191 | VTY_NEWLINE); | |
10192 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
10193 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
10194 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10195 | count * sizeof (struct hash_backet)), | |
10196 | VTY_NEWLINE); | |
10197 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
10198 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
10199 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10200 | count * sizeof (regex_t)), | |
10201 | VTY_NEWLINE); | |
10202 | return CMD_SUCCESS; | |
10203 | } | |
fee0f4c6 | 10204 | |
718e3744 | 10205 | /* Show BGP peer's summary information. */ |
94f2b392 | 10206 | static int |
b05a1c8b | 10207 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, |
9f689658 | 10208 | u_char use_json, json_object *json) |
718e3744 | 10209 | { |
10210 | struct peer *peer; | |
1eb8ef25 | 10211 | struct listnode *node, *nnode; |
f14e6fdb DS |
10212 | unsigned int count = 0, dn_count = 0; |
10213 | char timebuf[BGP_UPTIME_LEN], dn_flag[2]; | |
718e3744 | 10214 | int len; |
ffd0c037 DS |
10215 | json_object *json_peer = NULL; |
10216 | json_object *json_peers = NULL; | |
718e3744 | 10217 | |
10218 | /* Header string for each address family. */ | |
4a7ac06c | 10219 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; |
47fc97cc | 10220 | |
b05a1c8b DS |
10221 | if (use_json) |
10222 | { | |
9f689658 DD |
10223 | if (json == NULL) |
10224 | json = json_object_new_object(); | |
10225 | ||
f1aa5d8a | 10226 | json_peers = json_object_new_object(); |
b05a1c8b DS |
10227 | } |
10228 | ||
1eb8ef25 | 10229 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 10230 | { |
1ff9a340 DS |
10231 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
10232 | continue; | |
10233 | ||
718e3744 | 10234 | if (peer->afc[afi][safi]) |
10235 | { | |
b05a1c8b | 10236 | if (!count) |
4bf6a362 PJ |
10237 | { |
10238 | unsigned long ents; | |
10239 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
5c81a5f3 | 10240 | int vrf_id_ui; |
10241 | ||
10242 | vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id; | |
b05a1c8b | 10243 | |
4bf6a362 | 10244 | /* Usage summary and header */ |
b05a1c8b DS |
10245 | if (use_json) |
10246 | { | |
62d6dca0 | 10247 | json_object_string_add(json, "routerId", inet_ntoa (bgp->router_id)); |
f1aa5d8a | 10248 | json_object_int_add(json, "as", bgp->as); |
9f689658 DD |
10249 | json_object_int_add(json, "vrfId", vrf_id_ui); |
10250 | json_object_string_add(json, "vrfName", | |
10251 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10252 | ? "Default" : bgp->name); | |
b05a1c8b DS |
10253 | } |
10254 | else | |
10255 | { | |
10256 | vty_out (vty, | |
5c81a5f3 | 10257 | "BGP router identifier %s, local AS number %u vrf-id %d", |
10258 | inet_ntoa (bgp->router_id), bgp->as, vrf_id_ui); | |
6aeb9e78 | 10259 | vty_out (vty, "%s", VTY_NEWLINE); |
b05a1c8b DS |
10260 | } |
10261 | ||
f188f2c4 DS |
10262 | if (bgp_update_delay_configured(bgp)) |
10263 | { | |
b05a1c8b | 10264 | if (use_json) |
f188f2c4 | 10265 | { |
62d6dca0 | 10266 | json_object_int_add(json, "updateDelayLimit", bgp->v_update_delay); |
b05a1c8b DS |
10267 | |
10268 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
62d6dca0 | 10269 | json_object_int_add(json, "updateDelayEstablishWait", bgp->v_establish_wait); |
b05a1c8b DS |
10270 | |
10271 | if (bgp_update_delay_active(bgp)) | |
10272 | { | |
62d6dca0 DS |
10273 | json_object_string_add(json, "updateDelayFirstNeighbor", bgp->update_delay_begin_time); |
10274 | json_object_boolean_true_add(json, "updateDelayInProgress"); | |
b05a1c8b DS |
10275 | } |
10276 | else | |
10277 | { | |
10278 | if (bgp->update_delay_over) | |
10279 | { | |
62d6dca0 | 10280 | json_object_string_add(json, "updateDelayFirstNeighbor", |
f1aa5d8a | 10281 | bgp->update_delay_begin_time); |
62d6dca0 | 10282 | json_object_string_add(json, "updateDelayBestpathResumed", |
f1aa5d8a | 10283 | bgp->update_delay_end_time); |
62d6dca0 | 10284 | json_object_string_add(json, "updateDelayZebraUpdateResume", |
f1aa5d8a | 10285 | bgp->update_delay_zebra_resume_time); |
62d6dca0 | 10286 | json_object_string_add(json, "updateDelayPeerUpdateResume", |
f1aa5d8a | 10287 | bgp->update_delay_peers_resume_time); |
b05a1c8b DS |
10288 | } |
10289 | } | |
f188f2c4 DS |
10290 | } |
10291 | else | |
10292 | { | |
b05a1c8b DS |
10293 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", |
10294 | bgp->v_update_delay, VTY_NEWLINE); | |
10295 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
10296 | vty_out (vty, " Establish wait: %d seconds%s", | |
10297 | bgp->v_establish_wait, VTY_NEWLINE); | |
10298 | ||
10299 | if (bgp_update_delay_active(bgp)) | |
f188f2c4 DS |
10300 | { |
10301 | vty_out (vty, " First neighbor established: %s%s", | |
10302 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
b05a1c8b DS |
10303 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); |
10304 | } | |
10305 | else | |
10306 | { | |
10307 | if (bgp->update_delay_over) | |
10308 | { | |
10309 | vty_out (vty, " First neighbor established: %s%s", | |
10310 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
10311 | vty_out (vty, " Best-paths resumed: %s%s", | |
10312 | bgp->update_delay_end_time, VTY_NEWLINE); | |
10313 | vty_out (vty, " zebra update resumed: %s%s", | |
10314 | bgp->update_delay_zebra_resume_time, VTY_NEWLINE); | |
10315 | vty_out (vty, " peers update resumed: %s%s", | |
10316 | bgp->update_delay_peers_resume_time, VTY_NEWLINE); | |
10317 | } | |
f188f2c4 DS |
10318 | } |
10319 | } | |
10320 | } | |
4bf6a362 | 10321 | |
b05a1c8b DS |
10322 | if (use_json) |
10323 | { | |
10324 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
62d6dca0 | 10325 | json_object_boolean_true_add(json, "maxMedOnStartup"); |
b05a1c8b | 10326 | if (bgp->v_maxmed_admin) |
62d6dca0 | 10327 | json_object_boolean_true_add(json, "maxMedAdministrative"); |
b05a1c8b | 10328 | |
62d6dca0 | 10329 | json_object_int_add(json, "tableVersion", bgp_table_version(bgp->rib[afi][safi])); |
b05a1c8b DS |
10330 | |
10331 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
62d6dca0 DS |
10332 | json_object_int_add(json, "ribCount", ents); |
10333 | json_object_int_add(json, "ribMemory", ents * sizeof (struct bgp_node)); | |
b05a1c8b DS |
10334 | |
10335 | ents = listcount (bgp->peer); | |
62d6dca0 DS |
10336 | json_object_int_add(json, "peerCount", ents); |
10337 | json_object_int_add(json, "peerMemory", ents * sizeof (struct peer)); | |
b05a1c8b | 10338 | |
b05a1c8b DS |
10339 | if ((ents = listcount (bgp->group))) |
10340 | { | |
62d6dca0 DS |
10341 | json_object_int_add(json, "peerGroupCount", ents); |
10342 | json_object_int_add(json, "peerGroupMemory", ents * sizeof (struct peer_group)); | |
b05a1c8b | 10343 | } |
3f9c7369 | 10344 | |
b05a1c8b | 10345 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
62d6dca0 | 10346 | json_object_boolean_true_add(json, "dampeningEnabled"); |
b05a1c8b DS |
10347 | } |
10348 | else | |
10349 | { | |
10350 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
10351 | vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE); | |
10352 | if (bgp->v_maxmed_admin) | |
10353 | vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE); | |
10354 | ||
ffd0c037 | 10355 | vty_out(vty, "BGP table version %" PRIu64 "%s", |
b05a1c8b DS |
10356 | bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE); |
10357 | ||
10358 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
10359 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
10360 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10361 | ents * sizeof (struct bgp_node)), | |
10362 | VTY_NEWLINE); | |
10363 | ||
10364 | /* Peer related usage */ | |
10365 | ents = listcount (bgp->peer); | |
10366 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
10367 | ents, | |
10368 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10369 | ents * sizeof (struct peer)), | |
10370 | VTY_NEWLINE); | |
10371 | ||
b05a1c8b DS |
10372 | if ((ents = listcount (bgp->group))) |
10373 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
10374 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10375 | ents * sizeof (struct peer_group)), | |
10376 | VTY_NEWLINE); | |
10377 | ||
10378 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
10379 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
10380 | vty_out (vty, "%s", VTY_NEWLINE); | |
10381 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
10382 | } | |
4bf6a362 PJ |
10383 | } |
10384 | ||
b05a1c8b | 10385 | count++; |
718e3744 | 10386 | |
b05a1c8b DS |
10387 | if (use_json) |
10388 | { | |
10389 | json_peer = json_object_new_object(); | |
f14e6fdb | 10390 | |
b05a1c8b | 10391 | if (peer_dynamic_neighbor(peer)) |
62d6dca0 | 10392 | json_object_boolean_true_add(json_peer, "dynamicPeer"); |
b05a1c8b | 10393 | |
04b6bdc0 DW |
10394 | if (peer->hostname) |
10395 | json_object_string_add(json_peer, "hostname", peer->hostname); | |
10396 | ||
10397 | if (peer->domainname) | |
10398 | json_object_string_add(json_peer, "domainname", peer->domainname); | |
10399 | ||
62d6dca0 | 10400 | json_object_int_add(json_peer, "remoteAs", peer->as); |
f1aa5d8a | 10401 | json_object_int_add(json_peer, "version", 4); |
62d6dca0 | 10402 | json_object_int_add(json_peer, "msgRcvd", |
f1aa5d8a DS |
10403 | peer->open_in + peer->update_in + peer->keepalive_in |
10404 | + peer->notify_in + peer->refresh_in | |
10405 | + peer->dynamic_cap_in); | |
62d6dca0 | 10406 | json_object_int_add(json_peer, "msgSent", |
f1aa5d8a DS |
10407 | peer->open_out + peer->update_out + peer->keepalive_out |
10408 | + peer->notify_out + peer->refresh_out | |
10409 | + peer->dynamic_cap_out); | |
10410 | ||
62d6dca0 | 10411 | json_object_int_add(json_peer, "tableVersion", peer->version[afi][safi]); |
f1aa5d8a DS |
10412 | json_object_int_add(json_peer, "outq", peer->obuf->count); |
10413 | json_object_int_add(json_peer, "inq", 0); | |
856ca177 | 10414 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, use_json, json_peer); |
62d6dca0 | 10415 | json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][safi]); |
b05a1c8b DS |
10416 | |
10417 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
f1aa5d8a | 10418 | json_object_string_add(json_peer, "state", "Idle (Admin)"); |
b05a1c8b | 10419 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
f1aa5d8a | 10420 | json_object_string_add(json_peer, "state", "Idle (PfxCt)"); |
b05a1c8b | 10421 | else |
f1aa5d8a | 10422 | json_object_string_add(json_peer, "state", LOOKUP(bgp_status_msg, peer->status)); |
b05a1c8b | 10423 | |
f1aa5d8a | 10424 | if (peer->conf_if) |
62d6dca0 | 10425 | json_object_string_add(json_peer, "idType", "interface"); |
f1aa5d8a | 10426 | else if (peer->su.sa.sa_family == AF_INET) |
62d6dca0 | 10427 | json_object_string_add(json_peer, "idType", "ipv4"); |
f1aa5d8a | 10428 | else if (peer->su.sa.sa_family == AF_INET6) |
62d6dca0 | 10429 | json_object_string_add(json_peer, "idType", "ipv6"); |
b05a1c8b | 10430 | |
f1aa5d8a | 10431 | json_object_object_add(json_peers, peer->host, json_peer); |
b05a1c8b DS |
10432 | } |
10433 | else | |
10434 | { | |
10435 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
10436 | if (peer_dynamic_neighbor(peer)) | |
10437 | { | |
10438 | dn_count++; | |
10439 | dn_flag[0] = '*'; | |
10440 | } | |
10441 | ||
04b6bdc0 DW |
10442 | if (peer->hostname && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME)) |
10443 | len = vty_out (vty, "%s%s(%s)", dn_flag, peer->hostname, | |
10444 | peer->host); | |
10445 | else | |
10446 | len = vty_out (vty, "%s%s", dn_flag, peer->host); | |
b05a1c8b DS |
10447 | len = 16 - len; |
10448 | ||
10449 | if (len < 1) | |
10450 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
10451 | else | |
10452 | vty_out (vty, "%*s", len, " "); | |
10453 | ||
10454 | vty_out (vty, "4 "); | |
10455 | ||
ee046671 | 10456 | vty_out (vty, "%5u %7d %7d %8" PRIu64 " %4d %4zd ", |
b05a1c8b DS |
10457 | peer->as, |
10458 | peer->open_in + peer->update_in + peer->keepalive_in | |
10459 | + peer->notify_in + peer->refresh_in | |
10460 | + peer->dynamic_cap_in, | |
10461 | peer->open_out + peer->update_out + peer->keepalive_out | |
10462 | + peer->notify_out + peer->refresh_out | |
10463 | + peer->dynamic_cap_out, | |
10464 | peer->version[afi][safi], | |
10465 | 0, | |
ffd0c037 | 10466 | peer->obuf->count); |
b05a1c8b | 10467 | |
f1aa5d8a | 10468 | vty_out (vty, "%-8s", |
856ca177 | 10469 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); |
b05a1c8b DS |
10470 | |
10471 | if (peer->status == Established) | |
10472 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); | |
10473 | else | |
10474 | { | |
10475 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
10476 | vty_out (vty, " Idle (Admin)"); | |
10477 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
10478 | vty_out (vty, " Idle (PfxCt)"); | |
10479 | else | |
10480 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
10481 | } | |
10482 | vty_out (vty, "%s", VTY_NEWLINE); | |
10483 | } | |
718e3744 | 10484 | } |
10485 | } | |
10486 | ||
b05a1c8b DS |
10487 | if (use_json) |
10488 | { | |
10489 | json_object_object_add(json, "peers", json_peers); | |
14151a32 | 10490 | |
62d6dca0 DS |
10491 | json_object_int_add(json, "totalPeers", count); |
10492 | json_object_int_add(json, "dynamicPeers", dn_count); | |
14151a32 | 10493 | |
b05a1c8b | 10494 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); |
f1aa5d8a | 10495 | json_object_free(json); |
b05a1c8b DS |
10496 | } |
10497 | else | |
f14e6fdb | 10498 | { |
b05a1c8b DS |
10499 | if (count) |
10500 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
10501 | count, VTY_NEWLINE); | |
10502 | else | |
9f689658 DD |
10503 | { |
10504 | if (use_json) | |
10505 | vty_out(vty, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s", | |
10506 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
10507 | else | |
10508 | vty_out (vty, "No %s neighbor is configured%s", | |
10509 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
10510 | } | |
b05a1c8b | 10511 | |
9f689658 | 10512 | if (dn_count && ! use_json) |
b05a1c8b DS |
10513 | { |
10514 | vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE); | |
10515 | vty_out(vty, | |
10516 | "%d dynamic neighbor(s), limit %d%s", | |
10517 | dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
10518 | } | |
f14e6fdb DS |
10519 | } |
10520 | ||
718e3744 | 10521 | return CMD_SUCCESS; |
10522 | } | |
10523 | ||
47fc97cc DS |
10524 | static int |
10525 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
b05a1c8b | 10526 | afi_t afi, safi_t safi, u_char use_json) |
718e3744 | 10527 | { |
10528 | struct bgp *bgp; | |
10529 | ||
10530 | if (name) | |
10531 | { | |
10532 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 10533 | |
718e3744 | 10534 | if (! bgp) |
10535 | { | |
47fc97cc | 10536 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 10537 | return CMD_WARNING; |
10538 | } | |
10539 | ||
9f689658 | 10540 | bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); |
718e3744 | 10541 | return CMD_SUCCESS; |
10542 | } | |
47fc97cc | 10543 | |
718e3744 | 10544 | bgp = bgp_get_default (); |
10545 | ||
10546 | if (bgp) | |
9f689658 | 10547 | bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); |
47fc97cc | 10548 | |
718e3744 | 10549 | return CMD_SUCCESS; |
10550 | } | |
10551 | ||
f186de26 | 10552 | static void |
10553 | bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi, | |
10554 | u_char use_json) | |
10555 | { | |
10556 | struct listnode *node, *nnode; | |
10557 | struct bgp *bgp; | |
9f689658 DD |
10558 | json_object *json = NULL; |
10559 | int is_first = 1; | |
10560 | ||
10561 | if (use_json) | |
10562 | vty_out (vty, "{%s", VTY_NEWLINE); | |
f186de26 | 10563 | |
10564 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
10565 | { | |
9f689658 DD |
10566 | if (use_json) |
10567 | { | |
10568 | if (!(json = json_object_new_object())) | |
10569 | { | |
10570 | zlog_err("Unable to allocate memory for JSON object"); | |
10571 | vty_out (vty, | |
10572 | "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s", | |
10573 | VTY_NEWLINE); | |
10574 | return; | |
10575 | } | |
10576 | ||
10577 | if (! is_first) | |
10578 | vty_out (vty, ",%s", VTY_NEWLINE); | |
10579 | else | |
10580 | is_first = 0; | |
10581 | ||
10582 | vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10583 | ? "Default" : bgp->name); | |
10584 | } | |
10585 | else | |
10586 | { | |
10587 | vty_out (vty, "%sInstance %s:%s", | |
10588 | VTY_NEWLINE, | |
10589 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10590 | ? "Default" : bgp->name, VTY_NEWLINE); | |
10591 | } | |
10592 | bgp_show_summary (vty, bgp, afi, safi, use_json, json); | |
f186de26 | 10593 | } |
9f689658 DD |
10594 | |
10595 | if (use_json) | |
10596 | vty_out (vty, "}%s", VTY_NEWLINE); | |
10597 | ||
f186de26 | 10598 | } |
10599 | ||
718e3744 | 10600 | /* `show ip bgp summary' commands. */ |
47fc97cc | 10601 | DEFUN (show_ip_bgp_summary, |
718e3744 | 10602 | show_ip_bgp_summary_cmd, |
b05a1c8b | 10603 | "show ip bgp summary {json}", |
47fc97cc DS |
10604 | SHOW_STR |
10605 | IP_STR | |
10606 | BGP_STR | |
b05a1c8b DS |
10607 | "Summary of BGP neighbor status\n" |
10608 | "JavaScript Object Notation\n") | |
47fc97cc | 10609 | { |
db7c8528 DS |
10610 | u_char uj = use_json(argc, argv); |
10611 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); | |
718e3744 | 10612 | } |
10613 | ||
10614 | DEFUN (show_ip_bgp_instance_summary, | |
10615 | show_ip_bgp_instance_summary_cmd, | |
8386ac43 | 10616 | "show ip bgp " BGP_INSTANCE_CMD " summary {json}", |
718e3744 | 10617 | SHOW_STR |
10618 | IP_STR | |
10619 | BGP_STR | |
8386ac43 | 10620 | BGP_INSTANCE_HELP_STR |
b05a1c8b DS |
10621 | "Summary of BGP neighbor status\n" |
10622 | "JavaScript Object Notation\n") | |
718e3744 | 10623 | { |
db7c8528 | 10624 | u_char uj = use_json(argc, argv); |
6aeb9e78 | 10625 | return bgp_show_summary_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10626 | } |
10627 | ||
f186de26 | 10628 | DEFUN (show_ip_bgp_instance_all_summary, |
10629 | show_ip_bgp_instance_all_summary_cmd, | |
10630 | "show ip bgp " BGP_INSTANCE_ALL_CMD " summary {json}", | |
10631 | SHOW_STR | |
10632 | IP_STR | |
10633 | BGP_STR | |
10634 | BGP_INSTANCE_ALL_HELP_STR | |
10635 | "Summary of BGP neighbor status\n" | |
10636 | "JavaScript Object Notation\n") | |
10637 | { | |
10638 | u_char uj = use_json(argc, argv); | |
10639 | ||
10640 | bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj); | |
10641 | return CMD_SUCCESS; | |
10642 | } | |
10643 | ||
718e3744 | 10644 | DEFUN (show_ip_bgp_ipv4_summary, |
10645 | show_ip_bgp_ipv4_summary_cmd, | |
b05a1c8b | 10646 | "show ip bgp ipv4 (unicast|multicast) summary {json}", |
718e3744 | 10647 | SHOW_STR |
10648 | IP_STR | |
10649 | BGP_STR | |
10650 | "Address family\n" | |
10651 | "Address Family modifier\n" | |
10652 | "Address Family modifier\n" | |
b05a1c8b DS |
10653 | "Summary of BGP neighbor status\n" |
10654 | "JavaScript Object Notation\n") | |
718e3744 | 10655 | { |
db7c8528 | 10656 | u_char uj = use_json(argc, argv); |
718e3744 | 10657 | if (strncmp (argv[0], "m", 1) == 0) |
db7c8528 | 10658 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj); |
718e3744 | 10659 | |
db7c8528 | 10660 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10661 | } |
10662 | ||
95cbbd2a ML |
10663 | ALIAS (show_ip_bgp_ipv4_summary, |
10664 | show_bgp_ipv4_safi_summary_cmd, | |
b05a1c8b | 10665 | "show bgp ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10666 | SHOW_STR |
10667 | BGP_STR | |
10668 | "Address family\n" | |
10669 | "Address Family modifier\n" | |
10670 | "Address Family modifier\n" | |
10671 | "Summary of BGP neighbor status\n") | |
10672 | ||
718e3744 | 10673 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
10674 | show_ip_bgp_instance_ipv4_summary_cmd, | |
b05a1c8b | 10675 | "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}", |
718e3744 | 10676 | SHOW_STR |
10677 | IP_STR | |
10678 | BGP_STR | |
10679 | "BGP view\n" | |
10680 | "View name\n" | |
10681 | "Address family\n" | |
10682 | "Address Family modifier\n" | |
10683 | "Address Family modifier\n" | |
b05a1c8b DS |
10684 | "Summary of BGP neighbor status\n" |
10685 | "JavaScript Object Notation\n") | |
718e3744 | 10686 | { |
db7c8528 | 10687 | u_char uj = use_json(argc, argv); |
718e3744 | 10688 | if (strncmp (argv[1], "m", 1) == 0) |
db7c8528 | 10689 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, uj); |
718e3744 | 10690 | else |
db7c8528 | 10691 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10692 | } |
10693 | ||
95cbbd2a ML |
10694 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
10695 | show_bgp_instance_ipv4_safi_summary_cmd, | |
b05a1c8b | 10696 | "show bgp view WORD ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10697 | SHOW_STR |
10698 | BGP_STR | |
10699 | "BGP view\n" | |
10700 | "View name\n" | |
10701 | "Address family\n" | |
10702 | "Address Family modifier\n" | |
10703 | "Address Family modifier\n" | |
10704 | "Summary of BGP neighbor status\n") | |
10705 | ||
718e3744 | 10706 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
10707 | show_ip_bgp_vpnv4_all_summary_cmd, | |
b05a1c8b | 10708 | "show ip bgp vpnv4 all summary {json}", |
718e3744 | 10709 | SHOW_STR |
10710 | IP_STR | |
10711 | BGP_STR | |
10712 | "Display VPNv4 NLRI specific information\n" | |
10713 | "Display information about all VPNv4 NLRIs\n" | |
b05a1c8b DS |
10714 | "Summary of BGP neighbor status\n" |
10715 | "JavaScript Object Notation\n") | |
718e3744 | 10716 | { |
db7c8528 DS |
10717 | u_char uj = use_json(argc, argv); |
10718 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); | |
718e3744 | 10719 | } |
10720 | ||
10721 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
10722 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
b05a1c8b | 10723 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}", |
718e3744 | 10724 | SHOW_STR |
10725 | IP_STR | |
10726 | BGP_STR | |
10727 | "Display VPNv4 NLRI specific information\n" | |
10728 | "Display information for a route distinguisher\n" | |
10729 | "VPN Route Distinguisher\n" | |
b05a1c8b DS |
10730 | "Summary of BGP neighbor status\n" |
10731 | "JavaScript Object Notation\n") | |
718e3744 | 10732 | { |
10733 | int ret; | |
10734 | struct prefix_rd prd; | |
db7c8528 | 10735 | u_char uj = use_json(argc, argv); |
718e3744 | 10736 | |
10737 | ret = str2prefix_rd (argv[0], &prd); | |
10738 | if (! ret) | |
10739 | { | |
10740 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
10741 | return CMD_WARNING; | |
10742 | } | |
10743 | ||
db7c8528 | 10744 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); |
718e3744 | 10745 | } |
10746 | ||
10747 | #ifdef HAVE_IPV6 | |
47fc97cc | 10748 | DEFUN (show_bgp_summary, |
718e3744 | 10749 | show_bgp_summary_cmd, |
b05a1c8b | 10750 | "show bgp summary {json}", |
718e3744 | 10751 | SHOW_STR |
10752 | BGP_STR | |
b05a1c8b DS |
10753 | "Summary of BGP neighbor status\n" |
10754 | "JavaScript Object Notation\n") | |
718e3744 | 10755 | { |
db7c8528 | 10756 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); |
718e3744 | 10757 | } |
10758 | ||
10759 | DEFUN (show_bgp_instance_summary, | |
10760 | show_bgp_instance_summary_cmd, | |
8386ac43 | 10761 | "show bgp " BGP_INSTANCE_CMD " summary {json}", |
718e3744 | 10762 | SHOW_STR |
10763 | BGP_STR | |
8386ac43 | 10764 | BGP_INSTANCE_HELP_STR |
b05a1c8b DS |
10765 | "Summary of BGP neighbor status\n" |
10766 | "JavaScript Object Notation\n") | |
718e3744 | 10767 | { |
6aeb9e78 | 10768 | return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); |
718e3744 | 10769 | } |
10770 | ||
f186de26 | 10771 | DEFUN (show_bgp_instance_all_summary, |
10772 | show_bgp_instance_all_summary_cmd, | |
10773 | "show bgp " BGP_INSTANCE_ALL_CMD " summary {json}", | |
10774 | SHOW_STR | |
10775 | BGP_STR | |
10776 | BGP_INSTANCE_ALL_HELP_STR | |
10777 | "Summary of BGP neighbor status\n" | |
10778 | "JavaScript Object Notation\n") | |
10779 | { | |
10780 | u_char uj = use_json(argc, argv); | |
10781 | ||
10782 | bgp_show_all_instances_summary_vty (vty, AFI_IP6, SAFI_UNICAST, uj); | |
10783 | return CMD_SUCCESS; | |
10784 | } | |
10785 | ||
718e3744 | 10786 | ALIAS (show_bgp_summary, |
10787 | show_bgp_ipv6_summary_cmd, | |
b05a1c8b | 10788 | "show bgp ipv6 summary {json}", |
718e3744 | 10789 | SHOW_STR |
10790 | BGP_STR | |
10791 | "Address family\n" | |
10792 | "Summary of BGP neighbor status\n") | |
10793 | ||
10794 | ALIAS (show_bgp_instance_summary, | |
10795 | show_bgp_instance_ipv6_summary_cmd, | |
8386ac43 | 10796 | "show bgp " BGP_INSTANCE_CMD " ipv6 summary {json}", |
718e3744 | 10797 | SHOW_STR |
10798 | BGP_STR | |
8386ac43 | 10799 | BGP_INSTANCE_HELP_STR |
718e3744 | 10800 | "Address family\n" |
10801 | "Summary of BGP neighbor status\n") | |
10802 | ||
95cbbd2a ML |
10803 | DEFUN (show_bgp_ipv6_safi_summary, |
10804 | show_bgp_ipv6_safi_summary_cmd, | |
b05a1c8b | 10805 | "show bgp ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10806 | SHOW_STR |
10807 | BGP_STR | |
10808 | "Address family\n" | |
10809 | "Address Family modifier\n" | |
10810 | "Address Family modifier\n" | |
b05a1c8b DS |
10811 | "Summary of BGP neighbor status\n" |
10812 | "JavaScript Object Notation\n") | |
95cbbd2a | 10813 | { |
db7c8528 | 10814 | u_char uj = use_json(argc, argv); |
95cbbd2a | 10815 | if (strncmp (argv[0], "m", 1) == 0) |
db7c8528 | 10816 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); |
95cbbd2a | 10817 | |
db7c8528 | 10818 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); |
95cbbd2a ML |
10819 | } |
10820 | ||
10821 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
10822 | show_bgp_instance_ipv6_safi_summary_cmd, | |
8386ac43 | 10823 | "show bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10824 | SHOW_STR |
10825 | BGP_STR | |
8386ac43 | 10826 | BGP_INSTANCE_HELP_STR |
95cbbd2a ML |
10827 | "Address family\n" |
10828 | "Address Family modifier\n" | |
10829 | "Address Family modifier\n" | |
b05a1c8b DS |
10830 | "Summary of BGP neighbor status\n" |
10831 | "JavaScript Object Notation\n") | |
95cbbd2a | 10832 | { |
db7c8528 | 10833 | u_char uj = use_json(argc, argv); |
6aeb9e78 DS |
10834 | if (strncmp (argv[2], "m", 1) == 0) |
10835 | return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_MULTICAST, uj); | |
95cbbd2a | 10836 | |
6aeb9e78 | 10837 | return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, uj); |
95cbbd2a ML |
10838 | } |
10839 | ||
718e3744 | 10840 | /* old command */ |
10841 | DEFUN (show_ipv6_bgp_summary, | |
10842 | show_ipv6_bgp_summary_cmd, | |
b05a1c8b | 10843 | "show ipv6 bgp summary {json}", |
718e3744 | 10844 | SHOW_STR |
10845 | IPV6_STR | |
10846 | BGP_STR | |
b05a1c8b DS |
10847 | "Summary of BGP neighbor status\n" |
10848 | "JavaScript Object Notation\n") | |
718e3744 | 10849 | { |
db7c8528 DS |
10850 | u_char uj = use_json(argc, argv); |
10851 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); | |
718e3744 | 10852 | } |
10853 | ||
10854 | /* old command */ | |
10855 | DEFUN (show_ipv6_mbgp_summary, | |
10856 | show_ipv6_mbgp_summary_cmd, | |
b05a1c8b | 10857 | "show ipv6 mbgp summary {json}", |
718e3744 | 10858 | SHOW_STR |
10859 | IPV6_STR | |
10860 | MBGP_STR | |
b05a1c8b DS |
10861 | "Summary of BGP neighbor status\n" |
10862 | "JavaScript Object Notation\n") | |
718e3744 | 10863 | { |
db7c8528 DS |
10864 | u_char uj = use_json(argc, argv); |
10865 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); | |
718e3744 | 10866 | } |
10867 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 10868 | |
fd79ac91 | 10869 | const char * |
538621f2 | 10870 | afi_safi_print (afi_t afi, safi_t safi) |
10871 | { | |
10872 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
10873 | return "IPv4 Unicast"; | |
10874 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
10875 | return "IPv4 Multicast"; | |
10876 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
945c8fe9 | 10877 | return "VPN-IPv4 Unicast"; |
8b1fb8be LB |
10878 | else if (afi == AFI_IP && safi == SAFI_ENCAP) |
10879 | return "ENCAP-IPv4 Unicast"; | |
538621f2 | 10880 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
10881 | return "IPv6 Unicast"; | |
10882 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
10883 | return "IPv6 Multicast"; | |
945c8fe9 LB |
10884 | else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN) |
10885 | return "VPN-IPv6 Unicast"; | |
8b1fb8be LB |
10886 | else if (afi == AFI_IP6 && safi == SAFI_ENCAP) |
10887 | return "ENCAP-IPv6 Unicast"; | |
538621f2 | 10888 | else |
10889 | return "Unknown"; | |
10890 | } | |
10891 | ||
718e3744 | 10892 | /* Show BGP peer's information. */ |
10893 | enum show_type | |
10894 | { | |
10895 | show_all, | |
10896 | show_peer | |
10897 | }; | |
10898 | ||
94f2b392 | 10899 | static void |
856ca177 MS |
10900 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
10901 | u_int16_t adv_smcap, u_int16_t adv_rmcap, u_int16_t rcv_smcap, | |
10902 | u_int16_t rcv_rmcap, u_char use_json, json_object *json_pref) | |
718e3744 | 10903 | { |
10904 | /* Send-Mode */ | |
10905 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
10906 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10907 | { | |
856ca177 MS |
10908 | if (use_json) |
10909 | { | |
10910 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10911 | json_object_string_add(json_pref, "sendMode", "advertisedAndReceived"); | |
10912 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
10913 | json_object_string_add(json_pref, "sendMode", "advertised"); | |
10914 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10915 | json_object_string_add(json_pref, "sendMode", "received"); | |
10916 | } | |
10917 | else | |
10918 | { | |
10919 | vty_out (vty, " Send-mode: "); | |
10920 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
10921 | vty_out (vty, "advertised"); | |
10922 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10923 | vty_out (vty, "%sreceived", | |
10924 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
10925 | ", " : ""); | |
10926 | vty_out (vty, "%s", VTY_NEWLINE); | |
10927 | } | |
718e3744 | 10928 | } |
10929 | ||
10930 | /* Receive-Mode */ | |
10931 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
10932 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10933 | { | |
856ca177 MS |
10934 | if (use_json) |
10935 | { | |
10936 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10937 | json_object_string_add(json_pref, "recvMode", "advertisedAndReceived"); | |
10938 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
10939 | json_object_string_add(json_pref, "recvMode", "advertised"); | |
10940 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10941 | json_object_string_add(json_pref, "recvMode", "received"); | |
10942 | } | |
10943 | else | |
10944 | { | |
10945 | vty_out (vty, " Receive-mode: "); | |
10946 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
10947 | vty_out (vty, "advertised"); | |
10948 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10949 | vty_out (vty, "%sreceived", | |
10950 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
10951 | ", " : ""); | |
10952 | vty_out (vty, "%s", VTY_NEWLINE); | |
10953 | } | |
718e3744 | 10954 | } |
10955 | } | |
10956 | ||
94f2b392 | 10957 | static void |
856ca177 MS |
10958 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
10959 | u_char use_json, json_object *json_neigh) | |
718e3744 | 10960 | { |
10961 | struct bgp_filter *filter; | |
3f9c7369 | 10962 | struct peer_af *paf; |
718e3744 | 10963 | char orf_pfx_name[BUFSIZ]; |
10964 | int orf_pfx_count; | |
856ca177 MS |
10965 | json_object *json_af = NULL; |
10966 | json_object *json_prefA = NULL; | |
10967 | json_object *json_prefB = NULL; | |
10968 | json_object *json_addr = NULL; | |
718e3744 | 10969 | |
856ca177 MS |
10970 | if (use_json) |
10971 | { | |
10972 | json_addr = json_object_new_object(); | |
10973 | json_af = json_object_new_object(); | |
10974 | json_prefA = json_object_new_object(); | |
10975 | json_prefB = json_object_new_object(); | |
10976 | filter = &p->filter[afi][safi]; | |
718e3744 | 10977 | |
c8560b44 | 10978 | if (peer_group_active(p)) |
856ca177 | 10979 | json_object_string_add(json_addr, "peerGroupMember", p->group->name); |
538621f2 | 10980 | |
856ca177 MS |
10981 | paf = peer_af_find(p, afi, safi); |
10982 | if (paf && PAF_SUBGRP(paf)) | |
10983 | { | |
10984 | json_object_int_add(json_addr, "updateGroupId", PAF_UPDGRP(paf)->id); | |
10985 | json_object_int_add(json_addr, "subGroupId", PAF_SUBGRP(paf)->id); | |
10986 | json_object_int_add(json_addr, "packetQueueLength", bpacket_queue_virtual_length(paf)); | |
10987 | } | |
10988 | ||
10989 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
10990 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
10991 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
10992 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
10993 | { | |
10994 | json_object_int_add(json_af, "orfType", ORF_TYPE_PREFIX); | |
10995 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
10996 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
10997 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
10998 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
10999 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, json_prefA); | |
11000 | json_object_object_add(json_af, "orfPrefixList", json_prefA); | |
11001 | } | |
11002 | ||
11003 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11004 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11005 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11006 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11007 | { | |
11008 | json_object_int_add(json_af, "orfOldType", ORF_TYPE_PREFIX_OLD); | |
11009 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11010 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11011 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11012 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
11013 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, json_prefB); | |
11014 | json_object_object_add(json_af, "orfOldPrefixList", json_prefB); | |
11015 | } | |
11016 | ||
11017 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11018 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
11019 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11020 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11021 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
11022 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11023 | json_object_object_add(json_addr, "afDependentCap", json_af); | |
11024 | ||
11025 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
11026 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
11027 | ||
11028 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
11029 | || orf_pfx_count) | |
11030 | { | |
11031 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
11032 | json_object_boolean_true_add(json_neigh, "orfSent"); | |
11033 | if (orf_pfx_count) | |
11034 | json_object_int_add(json_addr, "orfRecvCounter", orf_pfx_count); | |
11035 | } | |
11036 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
11037 | json_object_string_add(json_addr, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd"); | |
11038 | ||
11039 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
11040 | json_object_boolean_true_add(json_addr, "routeReflectorClient"); | |
11041 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
11042 | json_object_boolean_true_add(json_addr, "routeServerClient"); | |
11043 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
11044 | json_object_boolean_true_add(json_addr, "inboundSoftConfigPermit"); | |
11045 | ||
88b8ed8d DW |
11046 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
11047 | json_object_boolean_true_add(json_addr, "privateAsNumsAllReplacedInUpdatesToNbr"); | |
11048 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 11049 | json_object_boolean_true_add(json_addr, "privateAsNumsReplacedInUpdatesToNbr"); |
88b8ed8d DW |
11050 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
11051 | json_object_boolean_true_add(json_addr, "privateAsNumsAllRemovedInUpdatesToNbr"); | |
856ca177 MS |
11052 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
11053 | json_object_boolean_true_add(json_addr, "privateAsNumsRemovedInUpdatesToNbr"); | |
11054 | ||
adbac85e DW |
11055 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) |
11056 | json_object_boolean_true_add(json_addr, "addpathTxAllPaths"); | |
11057 | ||
06370dac DW |
11058 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) |
11059 | json_object_boolean_true_add(json_addr, "addpathTxBestpathPerAS"); | |
11060 | ||
856ca177 MS |
11061 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
11062 | json_object_string_add(json_addr, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs"); | |
11063 | ||
11064 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
11065 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
11066 | json_object_boolean_true_add(json_addr, "routerAlwaysNextHop"); | |
11067 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
11068 | json_object_boolean_true_add(json_addr, "unchangedAsPathPropogatedToNbr"); | |
11069 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
11070 | json_object_boolean_true_add(json_addr, "unchangedNextHopPropogatedToNbr"); | |
11071 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
11072 | json_object_boolean_true_add(json_addr, "unchangedMedPropogatedToNbr"); | |
718e3744 | 11073 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
856ca177 MS |
11074 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
11075 | { | |
11076 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11077 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11078 | json_object_string_add(json_addr, "commAttriSentToNbr", "extendedAndStandard"); | |
11079 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11080 | json_object_string_add(json_addr, "commAttriSentToNbr", "extended"); | |
11081 | else | |
11082 | json_object_string_add(json_addr, "commAttriSentToNbr", "standard"); | |
11083 | } | |
11084 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
11085 | { | |
11086 | if (p->default_rmap[afi][safi].name) | |
11087 | json_object_string_add(json_addr, "defaultRouteMap", p->default_rmap[afi][safi].name); | |
11088 | ||
11089 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
11090 | json_object_boolean_true_add(json_addr, "defaultSent"); | |
11091 | else | |
11092 | json_object_boolean_true_add(json_addr, "defaultNotSent"); | |
11093 | } | |
11094 | ||
11095 | if (filter->plist[FILTER_IN].name | |
11096 | || filter->dlist[FILTER_IN].name | |
11097 | || filter->aslist[FILTER_IN].name | |
11098 | || filter->map[RMAP_IN].name) | |
11099 | json_object_boolean_true_add(json_addr, "inboundPathPolicyConfig"); | |
11100 | if (filter->plist[FILTER_OUT].name | |
11101 | || filter->dlist[FILTER_OUT].name | |
11102 | || filter->aslist[FILTER_OUT].name | |
11103 | || filter->map[RMAP_OUT].name | |
11104 | || filter->usmap.name) | |
11105 | json_object_boolean_true_add(json_addr, "outboundPathPolicyConfig"); | |
856ca177 MS |
11106 | |
11107 | /* prefix-list */ | |
11108 | if (filter->plist[FILTER_IN].name) | |
11109 | json_object_string_add(json_addr, "incomingUpdatePrefixFilterList", filter->plist[FILTER_IN].name); | |
11110 | if (filter->plist[FILTER_OUT].name) | |
11111 | json_object_string_add(json_addr, "outgoingUpdatePrefixFilterList", filter->plist[FILTER_OUT].name); | |
11112 | ||
11113 | /* distribute-list */ | |
11114 | if (filter->dlist[FILTER_IN].name) | |
11115 | json_object_string_add(json_addr, "incomingUpdateNetworkFilterList", filter->dlist[FILTER_IN].name); | |
11116 | if (filter->dlist[FILTER_OUT].name) | |
11117 | json_object_string_add(json_addr, "outgoingUpdateNetworkFilterList", filter->dlist[FILTER_OUT].name); | |
11118 | ||
11119 | /* filter-list. */ | |
11120 | if (filter->aslist[FILTER_IN].name) | |
11121 | json_object_string_add(json_addr, "incomingUpdateAsPathFilterList", filter->aslist[FILTER_IN].name); | |
11122 | if (filter->aslist[FILTER_OUT].name) | |
11123 | json_object_string_add(json_addr, "outgoingUpdateAsPathFilterList", filter->aslist[FILTER_OUT].name); | |
11124 | ||
11125 | /* route-map. */ | |
11126 | if (filter->map[RMAP_IN].name) | |
11127 | json_object_string_add(json_addr, "routeMapForIncomingAdvertisements", filter->map[RMAP_IN].name); | |
11128 | if (filter->map[RMAP_OUT].name) | |
11129 | json_object_string_add(json_addr, "routeMapForOutgoingAdvertisements", filter->map[RMAP_OUT].name); | |
856ca177 MS |
11130 | |
11131 | /* unsuppress-map */ | |
11132 | if (filter->usmap.name) | |
11133 | json_object_string_add(json_addr, "selectiveUnsuppressRouteMap", filter->usmap.name); | |
11134 | ||
11135 | /* Receive prefix count */ | |
11136 | json_object_int_add(json_addr, "acceptedPrefixCounter", p->pcount[afi][safi]); | |
11137 | ||
11138 | /* Maximum prefix */ | |
11139 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
11140 | { | |
11141 | json_object_int_add(json_addr, "prefixAllowedMax", p->pmax[afi][safi]); | |
11142 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) | |
11143 | json_object_boolean_true_add(json_addr, "prefixAllowedMaxWarning"); | |
11144 | json_object_int_add(json_addr, "prefixAllowedWarningThresh", p->pmax_threshold[afi][safi]); | |
11145 | if (p->pmax_restart[afi][safi]) | |
11146 | json_object_int_add(json_addr, "prefixAllowedRestartIntervalMsecs", p->pmax_restart[afi][safi] * 60000); | |
11147 | } | |
11148 | json_object_object_add(json_neigh, afi_safi_print (afi, safi), json_addr); | |
11149 | ||
11150 | } | |
11151 | else | |
11152 | { | |
11153 | filter = &p->filter[afi][safi]; | |
11154 | ||
11155 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), | |
11156 | VTY_NEWLINE); | |
11157 | ||
c8560b44 | 11158 | if (peer_group_active(p)) |
856ca177 MS |
11159 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
11160 | ||
11161 | paf = peer_af_find(p, afi, safi); | |
11162 | if (paf && PAF_SUBGRP(paf)) | |
11163 | { | |
11164 | vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s", | |
11165 | PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE); | |
11166 | vty_out (vty, " Packet Queue length %d%s", | |
11167 | bpacket_queue_virtual_length(paf), VTY_NEWLINE); | |
11168 | } | |
718e3744 | 11169 | else |
856ca177 MS |
11170 | { |
11171 | vty_out(vty, " Not part of any update group%s", VTY_NEWLINE); | |
11172 | } | |
11173 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11174 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
11175 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11176 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11177 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
11178 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11179 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
11180 | ||
11181 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11182 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
11183 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11184 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
11185 | { | |
11186 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
11187 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
11188 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11189 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11190 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11191 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
11192 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, NULL); | |
11193 | } | |
11194 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11195 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11196 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11197 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11198 | { | |
11199 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
11200 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
11201 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11202 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11203 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11204 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
11205 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, NULL); | |
11206 | } | |
718e3744 | 11207 | |
856ca177 MS |
11208 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
11209 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
718e3744 | 11210 | |
856ca177 MS |
11211 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
11212 | || orf_pfx_count) | |
11213 | { | |
11214 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
11215 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
11216 | vty_out (vty, " sent;"); | |
11217 | if (orf_pfx_count) | |
11218 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
11219 | vty_out (vty, "%s", VTY_NEWLINE); | |
11220 | } | |
11221 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
11222 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
11223 | ||
11224 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
11225 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
11226 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
11227 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
11228 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
11229 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
11230 | ||
88b8ed8d DW |
11231 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
11232 | vty_out (vty, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE); | |
11233 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 11234 | vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE); |
88b8ed8d DW |
11235 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
11236 | vty_out (vty, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE); | |
856ca177 MS |
11237 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
11238 | vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE); | |
11239 | ||
adbac85e DW |
11240 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) |
11241 | vty_out (vty, " Advertise all paths via addpath%s", VTY_NEWLINE); | |
11242 | ||
06370dac DW |
11243 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) |
11244 | vty_out (vty, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE); | |
11245 | ||
856ca177 MS |
11246 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
11247 | vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE); | |
11248 | ||
11249 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
11250 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
11251 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); | |
11252 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
11253 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11254 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
11255 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11256 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
11257 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11258 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11259 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11260 | { | |
11261 | vty_out (vty, " Community attribute sent to this neighbor"); | |
11262 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11263 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11264 | vty_out (vty, "(both)%s", VTY_NEWLINE); | |
11265 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11266 | vty_out (vty, "(extended)%s", VTY_NEWLINE); | |
11267 | else | |
11268 | vty_out (vty, "(standard)%s", VTY_NEWLINE); | |
11269 | } | |
11270 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
11271 | { | |
11272 | vty_out (vty, " Default information originate,"); | |
11273 | ||
11274 | if (p->default_rmap[afi][safi].name) | |
11275 | vty_out (vty, " default route-map %s%s,", | |
11276 | p->default_rmap[afi][safi].map ? "*" : "", | |
11277 | p->default_rmap[afi][safi].name); | |
11278 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
11279 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
11280 | else | |
11281 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
11282 | } | |
718e3744 | 11283 | |
856ca177 MS |
11284 | if (filter->plist[FILTER_IN].name |
11285 | || filter->dlist[FILTER_IN].name | |
11286 | || filter->aslist[FILTER_IN].name | |
11287 | || filter->map[RMAP_IN].name) | |
11288 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); | |
11289 | if (filter->plist[FILTER_OUT].name | |
11290 | || filter->dlist[FILTER_OUT].name | |
11291 | || filter->aslist[FILTER_OUT].name | |
11292 | || filter->map[RMAP_OUT].name | |
11293 | || filter->usmap.name) | |
11294 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
856ca177 MS |
11295 | |
11296 | /* prefix-list */ | |
11297 | if (filter->plist[FILTER_IN].name) | |
11298 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
11299 | filter->plist[FILTER_IN].plist ? "*" : "", | |
11300 | filter->plist[FILTER_IN].name, | |
11301 | VTY_NEWLINE); | |
11302 | if (filter->plist[FILTER_OUT].name) | |
11303 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
11304 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
11305 | filter->plist[FILTER_OUT].name, | |
11306 | VTY_NEWLINE); | |
11307 | ||
11308 | /* distribute-list */ | |
11309 | if (filter->dlist[FILTER_IN].name) | |
11310 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
11311 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
11312 | filter->dlist[FILTER_IN].name, | |
11313 | VTY_NEWLINE); | |
11314 | if (filter->dlist[FILTER_OUT].name) | |
11315 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
11316 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
11317 | filter->dlist[FILTER_OUT].name, | |
11318 | VTY_NEWLINE); | |
11319 | ||
11320 | /* filter-list. */ | |
11321 | if (filter->aslist[FILTER_IN].name) | |
11322 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
11323 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
11324 | filter->aslist[FILTER_IN].name, | |
11325 | VTY_NEWLINE); | |
11326 | if (filter->aslist[FILTER_OUT].name) | |
11327 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
11328 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
11329 | filter->aslist[FILTER_OUT].name, | |
11330 | VTY_NEWLINE); | |
11331 | ||
11332 | /* route-map. */ | |
11333 | if (filter->map[RMAP_IN].name) | |
11334 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", | |
11335 | filter->map[RMAP_IN].map ? "*" : "", | |
11336 | filter->map[RMAP_IN].name, | |
11337 | VTY_NEWLINE); | |
11338 | if (filter->map[RMAP_OUT].name) | |
11339 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", | |
11340 | filter->map[RMAP_OUT].map ? "*" : "", | |
11341 | filter->map[RMAP_OUT].name, | |
11342 | VTY_NEWLINE); | |
856ca177 MS |
11343 | |
11344 | /* unsuppress-map */ | |
11345 | if (filter->usmap.name) | |
11346 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
11347 | filter->usmap.map ? "*" : "", | |
11348 | filter->usmap.name, VTY_NEWLINE); | |
11349 | ||
11350 | /* Receive prefix count */ | |
11351 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); | |
11352 | ||
11353 | /* Maximum prefix */ | |
11354 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
11355 | { | |
11356 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], | |
11357 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) | |
11358 | ? " (warning-only)" : "", VTY_NEWLINE); | |
11359 | vty_out (vty, " Threshold for warning message %d%%", | |
11360 | p->pmax_threshold[afi][safi]); | |
11361 | if (p->pmax_restart[afi][safi]) | |
11362 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
11363 | vty_out (vty, "%s", VTY_NEWLINE); | |
11364 | } | |
718e3744 | 11365 | |
0a486e5f | 11366 | vty_out (vty, "%s", VTY_NEWLINE); |
718e3744 | 11367 | } |
718e3744 | 11368 | } |
11369 | ||
94f2b392 | 11370 | static void |
e8f7da3a | 11371 | bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *json) |
718e3744 | 11372 | { |
11373 | struct bgp *bgp; | |
4690c7d7 | 11374 | char buf1[PREFIX2STR_BUFFER], buf[SU_ADDRSTRLEN]; |
718e3744 | 11375 | char timebuf[BGP_UPTIME_LEN]; |
f14e6fdb | 11376 | char dn_flag[2]; |
3a8c7ba1 DW |
11377 | const char *subcode_str; |
11378 | const char *code_str; | |
538621f2 | 11379 | afi_t afi; |
11380 | safi_t safi; | |
d6661008 DS |
11381 | u_int16_t i; |
11382 | u_char *msg; | |
e8f7da3a | 11383 | json_object *json_neigh = NULL; |
718e3744 | 11384 | |
11385 | bgp = p->bgp; | |
11386 | ||
e8f7da3a DW |
11387 | if (use_json) |
11388 | json_neigh = json_object_new_object(); | |
11389 | ||
856ca177 | 11390 | if (!use_json) |
f14e6fdb | 11391 | { |
856ca177 MS |
11392 | if (p->conf_if) /* Configured interface name. */ |
11393 | vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if, | |
11394 | BGP_PEER_SU_UNSPEC(p) ? "None" : | |
11395 | sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
11396 | else /* Configured IP address. */ | |
11397 | { | |
11398 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
11399 | if (peer_dynamic_neighbor(p)) | |
11400 | dn_flag[0] = '*'; | |
f14e6fdb | 11401 | |
856ca177 MS |
11402 | vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host); |
11403 | } | |
f14e6fdb DS |
11404 | } |
11405 | ||
856ca177 MS |
11406 | if (use_json) |
11407 | { | |
11408 | if (p->conf_if && BGP_PEER_SU_UNSPEC(p)) | |
11409 | json_object_string_add(json_neigh, "bgpNeighborAddr", "none"); | |
11410 | else if (p->conf_if && !BGP_PEER_SU_UNSPEC(p)) | |
11411 | json_object_string_add(json_neigh, "bgpNeighborAddr", sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
11412 | ||
11413 | json_object_int_add(json_neigh, "remoteAs", p->as); | |
11414 | ||
11415 | if (p->change_local_as) | |
11416 | json_object_int_add(json_neigh, "localAs", p->change_local_as); | |
11417 | else | |
11418 | json_object_int_add(json_neigh, "localAs", p->local_as); | |
11419 | ||
11420 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND)) | |
11421 | json_object_boolean_true_add(json_neigh, "localAsNoPrepend"); | |
66b199b2 | 11422 | |
856ca177 MS |
11423 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS)) |
11424 | json_object_boolean_true_add(json_neigh, "localAsReplaceAs"); | |
11425 | } | |
11426 | else | |
11427 | { | |
f8cfafda DS |
11428 | if ((p->as_type == AS_SPECIFIED) || |
11429 | (p->as_type == AS_EXTERNAL) || | |
11430 | (p->as_type == AS_INTERNAL)) | |
11431 | vty_out (vty, "remote AS %u, ", p->as); | |
11432 | else | |
11433 | vty_out (vty, "remote AS Unspecified, "); | |
856ca177 MS |
11434 | vty_out (vty, "local AS %u%s%s, ", |
11435 | p->change_local_as ? p->change_local_as : p->local_as, | |
11436 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
11437 | " no-prepend" : "", | |
11438 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
11439 | " replace-as" : ""); | |
11440 | } | |
66b199b2 DS |
11441 | /* peer type internal, external, confed-internal or confed-external */ |
11442 | if (p->as == p->local_as) | |
11443 | { | |
856ca177 MS |
11444 | if (use_json) |
11445 | { | |
11446 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11447 | json_object_boolean_true_add(json_neigh, "nbrConfedInternalLink"); | |
11448 | else | |
11449 | json_object_boolean_true_add(json_neigh, "nbrInternalLink"); | |
11450 | } | |
66b199b2 | 11451 | else |
856ca177 MS |
11452 | { |
11453 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11454 | vty_out (vty, "confed-internal link%s", VTY_NEWLINE); | |
11455 | else | |
11456 | vty_out (vty, "internal link%s", VTY_NEWLINE); | |
11457 | } | |
66b199b2 DS |
11458 | } |
11459 | else | |
11460 | { | |
856ca177 MS |
11461 | if (use_json) |
11462 | { | |
11463 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11464 | json_object_boolean_true_add(json_neigh, "nbrConfedExternalLink"); | |
11465 | else | |
11466 | json_object_boolean_true_add(json_neigh, "nbrExternalLink"); | |
11467 | } | |
66b199b2 | 11468 | else |
856ca177 MS |
11469 | { |
11470 | if (bgp_confederation_peers_check(bgp, p->as)) | |
11471 | vty_out (vty, "confed-external link%s", VTY_NEWLINE); | |
11472 | else | |
11473 | vty_out (vty, "external link%s", VTY_NEWLINE); | |
11474 | } | |
66b199b2 | 11475 | } |
718e3744 | 11476 | |
11477 | /* Description. */ | |
11478 | if (p->desc) | |
856ca177 MS |
11479 | { |
11480 | if (use_json) | |
11481 | json_object_string_add(json_neigh, "nbrDesc", p->desc); | |
11482 | else | |
11483 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
11484 | } | |
6410e93a | 11485 | |
04b6bdc0 DW |
11486 | if (p->hostname) |
11487 | { | |
d1570739 DW |
11488 | if (use_json) |
11489 | { | |
11490 | if (p->hostname) | |
11491 | json_object_string_add(json_neigh, "hostname", p->hostname); | |
11492 | ||
11493 | if (p->domainname) | |
11494 | json_object_string_add(json_neigh, "domainname", p->domainname); | |
11495 | } | |
04b6bdc0 | 11496 | else |
d1570739 DW |
11497 | { |
11498 | if (p->domainname && (p->domainname[0] != '\0')) | |
11499 | vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname, | |
11500 | VTY_NEWLINE); | |
11501 | else | |
11502 | vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE); | |
11503 | } | |
11504 | ||
04b6bdc0 DW |
11505 | } |
11506 | ||
c744aa9f | 11507 | /* Peer-group */ |
718e3744 | 11508 | if (p->group) |
f14e6fdb | 11509 | { |
856ca177 MS |
11510 | if (use_json) |
11511 | { | |
11512 | json_object_string_add(json_neigh, "peerGroup", p->group->name); | |
11513 | ||
11514 | if (dn_flag[0]) | |
11515 | { | |
40ee54a7 | 11516 | struct prefix prefix, *range = NULL; |
f14e6fdb | 11517 | |
40ee54a7 TT |
11518 | sockunion2hostprefix(&(p->su), &prefix); |
11519 | range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix); | |
856ca177 MS |
11520 | |
11521 | if (range) | |
11522 | { | |
11523 | prefix2str(range, buf1, sizeof(buf1)); | |
11524 | json_object_string_add(json_neigh, "peerSubnetRangeGroup", buf1); | |
11525 | } | |
11526 | } | |
11527 | } | |
11528 | else | |
f14e6fdb | 11529 | { |
856ca177 MS |
11530 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
11531 | p->group->name, VTY_NEWLINE); | |
f14e6fdb | 11532 | |
856ca177 | 11533 | if (dn_flag[0]) |
f14e6fdb | 11534 | { |
40ee54a7 | 11535 | struct prefix prefix, *range = NULL; |
856ca177 | 11536 | |
40ee54a7 TT |
11537 | sockunion2hostprefix(&(p->su), &prefix); |
11538 | range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix); | |
856ca177 MS |
11539 | |
11540 | if (range) | |
11541 | { | |
11542 | prefix2str(range, buf1, sizeof(buf1)); | |
11543 | vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTY_NEWLINE); | |
11544 | } | |
f14e6fdb DS |
11545 | } |
11546 | } | |
11547 | } | |
718e3744 | 11548 | |
856ca177 MS |
11549 | if (use_json) |
11550 | { | |
11551 | /* Administrative shutdown. */ | |
11552 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
11553 | json_object_boolean_true_add(json_neigh, "adminShutDown"); | |
718e3744 | 11554 | |
856ca177 MS |
11555 | /* BGP Version. */ |
11556 | json_object_int_add(json_neigh, "bgpVersion", 4); | |
11557 | json_object_string_add(json_neigh, "remoteRouterId", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ)); | |
718e3744 | 11558 | |
856ca177 MS |
11559 | /* Confederation */ |
11560 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) && bgp_confederation_peers_check (bgp, p->as)) | |
11561 | json_object_boolean_true_add(json_neigh, "nbrCommonAdmin"); | |
11562 | ||
11563 | /* Status. */ | |
11564 | json_object_string_add(json_neigh, "bgpState", LOOKUP (bgp_status_msg, p->status)); | |
11565 | ||
11566 | if (p->status == Established) | |
11567 | { | |
11568 | time_t uptime; | |
11569 | struct tm *tm; | |
11570 | ||
11571 | uptime = bgp_clock(); | |
11572 | uptime -= p->uptime; | |
11573 | tm = gmtime(&uptime); | |
11574 | ||
11575 | json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
11576 | } | |
11577 | ||
11578 | else if (p->status == Active) | |
11579 | { | |
11580 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
11581 | json_object_string_add(json_neigh, "bgpStateIs", "passive"); | |
11582 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
11583 | json_object_string_add(json_neigh, "bgpStateIs", "passiveNSF"); | |
11584 | } | |
11585 | ||
11586 | /* read timer */ | |
11587 | time_t uptime; | |
11588 | struct tm *tm; | |
11589 | ||
11590 | uptime = bgp_clock(); | |
11591 | uptime -= p->readtime; | |
11592 | tm = gmtime(&uptime); | |
11593 | json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
11594 | ||
11595 | uptime = bgp_clock(); | |
11596 | uptime -= p->last_write; | |
11597 | tm = gmtime(&uptime); | |
39e871e6 ST |
11598 | json_object_int_add(json_neigh, "bgpTimerLastWrite", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); |
11599 | ||
11600 | uptime = bgp_clock(); | |
11601 | uptime -= p->update_time; | |
11602 | tm = gmtime(&uptime); | |
11603 | json_object_int_add(json_neigh, "bgpInUpdateElapsedTimeMsecs", | |
11604 | (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
856ca177 MS |
11605 | |
11606 | /* Configured timer values. */ | |
11607 | json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs", p->v_holdtime * 1000); | |
11608 | json_object_int_add(json_neigh, "bgpTimerKeepAliveIntervalMsecs", p->v_keepalive * 1000); | |
11609 | ||
11610 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
11611 | { | |
11612 | json_object_int_add(json_neigh, "bgpTimerConfiguredHoldTimeMsecs", p->holdtime * 1000); | |
11613 | json_object_int_add(json_neigh, "bgpTimerConfiguredKeepAliveIntervalMsecs", p->keepalive * 1000); | |
11614 | } | |
93406d87 | 11615 | } |
856ca177 MS |
11616 | else |
11617 | { | |
11618 | /* Administrative shutdown. */ | |
11619 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
11620 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
11621 | ||
11622 | /* BGP Version. */ | |
11623 | vty_out (vty, " BGP version 4"); | |
11624 | vty_out (vty, ", remote router ID %s%s", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
11625 | VTY_NEWLINE); | |
11626 | ||
11627 | /* Confederation */ | |
11628 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) | |
11629 | && bgp_confederation_peers_check (bgp, p->as)) | |
11630 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); | |
718e3744 | 11631 | |
856ca177 MS |
11632 | /* Status. */ |
11633 | vty_out (vty, " BGP state = %s", LOOKUP (bgp_status_msg, p->status)); | |
718e3744 | 11634 | |
856ca177 MS |
11635 | if (p->status == Established) |
11636 | vty_out (vty, ", up for %8s", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
11637 | ||
11638 | else if (p->status == Active) | |
11639 | { | |
11640 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
11641 | vty_out (vty, " (passive)"); | |
11642 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
11643 | vty_out (vty, " (NSF passive)"); | |
11644 | } | |
11645 | vty_out (vty, "%s", VTY_NEWLINE); | |
93406d87 | 11646 | |
856ca177 MS |
11647 | /* read timer */ |
11648 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
11649 | vty_out (vty, ", Last write %s%s", | |
11650 | peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTY_NEWLINE); | |
11651 | ||
11652 | /* Configured timer values. */ | |
11653 | vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s", | |
11654 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); | |
11655 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
11656 | { | |
11657 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
11658 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
11659 | p->keepalive, VTY_NEWLINE); | |
11660 | } | |
11661 | } | |
718e3744 | 11662 | /* Capability. */ |
11663 | if (p->status == Established) | |
11664 | { | |
538621f2 | 11665 | if (p->cap |
718e3744 | 11666 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
11667 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
11668 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
11669 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
11670 | #ifdef HAVE_IPV6 | |
11671 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
11672 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
11673 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
11674 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
945c8fe9 LB |
11675 | || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN] |
11676 | || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN] | |
8b1fb8be LB |
11677 | || p->afc_adv[AFI_IP6][SAFI_ENCAP] |
11678 | || p->afc_recv[AFI_IP6][SAFI_ENCAP] | |
718e3744 | 11679 | #endif /* HAVE_IPV6 */ |
8b1fb8be LB |
11680 | || p->afc_adv[AFI_IP][SAFI_ENCAP] |
11681 | || p->afc_recv[AFI_IP][SAFI_ENCAP] | |
718e3744 | 11682 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
11683 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
11684 | { | |
856ca177 MS |
11685 | if (use_json) |
11686 | { | |
11687 | json_object *json_cap = NULL; | |
11688 | ||
11689 | json_cap = json_object_new_object(); | |
11690 | ||
11691 | /* AS4 */ | |
11692 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
11693 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11694 | { | |
11695 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) && CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11696 | json_object_string_add(json_cap, "4byteAs", "advertisedAndReceived"); | |
11697 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11698 | json_object_string_add(json_cap, "4byteAs", "advertised"); | |
11699 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11700 | json_object_string_add(json_cap, "4byteAs", "received"); | |
11701 | } | |
11702 | ||
11703 | /* AddPath */ | |
11704 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
11705 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
11706 | { | |
11707 | json_object *json_add = NULL; | |
11708 | const char *print_store; | |
718e3744 | 11709 | |
856ca177 | 11710 | json_add = json_object_new_object(); |
a82478b9 | 11711 | |
856ca177 MS |
11712 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
11713 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11714 | { | |
11715 | json_object *json_sub = NULL; | |
11716 | json_sub = json_object_new_object(); | |
11717 | print_store = afi_safi_print (afi, safi); | |
11718 | ||
11719 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
11720 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11721 | { | |
11722 | 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)) | |
11723 | json_object_boolean_true_add(json_sub, "txAdvertisedAndReceived"); | |
11724 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) | |
11725 | json_object_boolean_true_add(json_sub, "txAdvertised"); | |
11726 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11727 | json_object_boolean_true_add(json_sub, "txReceived"); | |
11728 | } | |
11729 | ||
11730 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
11731 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11732 | { | |
11733 | 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)) | |
11734 | json_object_boolean_true_add(json_sub, "rxAdvertisedAndReceived"); | |
11735 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) | |
11736 | json_object_boolean_true_add(json_sub, "rxAdvertised"); | |
11737 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11738 | json_object_boolean_true_add(json_sub, "rxReceived"); | |
11739 | } | |
11740 | ||
11741 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
11742 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV) || | |
11743 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
11744 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11745 | json_object_object_add(json_add, print_store, json_sub); | |
11746 | } | |
a82478b9 | 11747 | |
856ca177 MS |
11748 | json_object_object_add(json_cap, "addPath", json_add); |
11749 | } | |
11750 | ||
11751 | /* Dynamic */ | |
11752 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
11753 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11754 | { | |
11755 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) && CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11756 | json_object_string_add(json_cap, "dynamic", "advertisedAndReceived"); | |
11757 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11758 | json_object_string_add(json_cap, "dynamic", "advertised"); | |
11759 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11760 | json_object_string_add(json_cap, "dynamic", "received"); | |
11761 | } | |
11762 | ||
11763 | /* Extended nexthop */ | |
11764 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
11765 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11766 | { | |
11767 | json_object *json_nxt = NULL; | |
11768 | const char *print_store; | |
11769 | ||
11770 | json_nxt = json_object_new_object(); | |
11771 | ||
11772 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) && CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11773 | json_object_string_add(json_cap, "extendedNexthop", "advertisedAndReceived"); | |
11774 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11775 | json_object_string_add(json_cap, "extendedNexthop", "advertised"); | |
11776 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11777 | json_object_string_add(json_cap, "extendedNexthop", "received"); | |
11778 | ||
11779 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11780 | { | |
11781 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11782 | { | |
11783 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
11784 | { | |
11785 | print_store = afi_safi_print (AFI_IP, safi); | |
11786 | json_object_string_add(json_nxt, print_store, "recieved"); | |
11787 | } | |
11788 | } | |
11789 | json_object_object_add(json_cap, "extendedNexthopFamililesByPeer", json_nxt); | |
11790 | } | |
11791 | } | |
11792 | ||
11793 | /* Route Refresh */ | |
11794 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
11795 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11796 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11797 | { | |
11798 | 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))) | |
11799 | { | |
11800 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) | |
11801 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOldNew"); | |
11802 | else | |
11803 | { | |
11804 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11805 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOld"); | |
11806 | else | |
11807 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedNew"); | |
11808 | } | |
11809 | } | |
11810 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
11811 | json_object_string_add(json_cap, "routeRefresh", "advertised"); | |
11812 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11813 | json_object_string_add(json_cap, "routeRefresh", "received"); | |
11814 | } | |
11815 | ||
11816 | /* Multiprotocol Extensions */ | |
11817 | json_object *json_multi = NULL; | |
11818 | json_multi = json_object_new_object(); | |
11819 | ||
11820 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11821 | { | |
11822 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11823 | { | |
11824 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
11825 | { | |
11826 | json_object *json_exten = NULL; | |
11827 | json_exten = json_object_new_object(); | |
11828 | ||
11829 | if (p->afc_adv[afi][safi] && p->afc_recv[afi][safi]) | |
11830 | json_object_boolean_true_add(json_exten, "advertisedAndReceived"); | |
11831 | else if (p->afc_adv[afi][safi]) | |
11832 | json_object_boolean_true_add(json_exten, "advertised"); | |
11833 | else if (p->afc_recv[afi][safi]) | |
11834 | json_object_boolean_true_add(json_exten, "received"); | |
11835 | ||
11836 | json_object_object_add(json_multi, afi_safi_print (afi, safi), json_exten); | |
11837 | } | |
11838 | } | |
11839 | } | |
11840 | json_object_object_add(json_cap, "multiprotocolExtensions", json_multi); | |
11841 | ||
11842 | /* Gracefull Restart */ | |
11843 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
11844 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
11845 | { | |
11846 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) && CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
11847 | json_object_string_add(json_cap, "gracefulRestart", "advertisedAndReceived"); | |
11848 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
11849 | json_object_string_add(json_cap, "gracefulRestartCapability", "advertised"); | |
11850 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
11851 | json_object_string_add(json_cap, "gracefulRestartCapability", "received"); | |
11852 | ||
11853 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
11854 | { | |
11855 | int restart_af_count = 0; | |
11856 | json_object *json_restart = NULL; | |
11857 | json_restart = json_object_new_object(); | |
11858 | ||
11859 | json_object_int_add(json_cap, "gracefulRestartRemoteTimerMsecs", p->v_gr_restart * 1000); | |
11860 | ||
11861 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11862 | { | |
11863 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11864 | { | |
11865 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
11866 | { | |
11867 | json_object *json_sub = NULL; | |
11868 | json_sub = json_object_new_object(); | |
11869 | ||
11870 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV)) | |
11871 | json_object_boolean_true_add(json_sub, "preserved"); | |
11872 | restart_af_count++; | |
11873 | json_object_object_add(json_restart, afi_safi_print (afi, safi), json_sub); | |
11874 | } | |
11875 | } | |
11876 | } | |
11877 | if (! restart_af_count) | |
11878 | json_object_string_add(json_cap, "addressFamiliesByPeer", "none"); | |
11879 | else | |
11880 | json_object_object_add(json_cap, "addressFamiliesByPeer", json_restart); | |
11881 | } | |
11882 | } | |
11883 | json_object_object_add(json_neigh, "neighborCapabilities", json_cap); | |
11884 | } | |
11885 | else | |
11886 | { | |
11887 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
11888 | ||
11889 | /* AS4 */ | |
11890 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
11891 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11892 | { | |
11893 | vty_out (vty, " 4 Byte AS:"); | |
11894 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11895 | vty_out (vty, " advertised"); | |
11896 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11897 | vty_out (vty, " %sreceived", | |
11898 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
11899 | vty_out (vty, "%s", VTY_NEWLINE); | |
11900 | } | |
11901 | ||
11902 | /* AddPath */ | |
11903 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
11904 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
11905 | { | |
11906 | vty_out (vty, " AddPath:%s", VTY_NEWLINE); | |
a82478b9 | 11907 | |
856ca177 MS |
11908 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
11909 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
a82478b9 | 11910 | { |
856ca177 MS |
11911 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || |
11912 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11913 | { | |
11914 | vty_out (vty, " %s: TX ", afi_safi_print (afi, safi)); | |
a82478b9 | 11915 | |
856ca177 MS |
11916 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) |
11917 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 11918 | |
856ca177 MS |
11919 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) |
11920 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" ); | |
a82478b9 | 11921 | |
856ca177 MS |
11922 | vty_out (vty, "%s", VTY_NEWLINE); |
11923 | } | |
a82478b9 | 11924 | |
856ca177 | 11925 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || |
a82478b9 | 11926 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
856ca177 MS |
11927 | { |
11928 | vty_out (vty, " %s: RX ", afi_safi_print (afi, safi)); | |
a82478b9 | 11929 | |
856ca177 MS |
11930 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) |
11931 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 11932 | |
856ca177 MS |
11933 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
11934 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" ); | |
a82478b9 | 11935 | |
856ca177 MS |
11936 | vty_out (vty, "%s", VTY_NEWLINE); |
11937 | } | |
a82478b9 | 11938 | } |
856ca177 | 11939 | } |
a82478b9 | 11940 | |
856ca177 MS |
11941 | /* Dynamic */ |
11942 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
11943 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11944 | { | |
11945 | vty_out (vty, " Dynamic:"); | |
11946 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11947 | vty_out (vty, " advertised"); | |
11948 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11949 | vty_out (vty, " %sreceived", | |
11950 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
11951 | vty_out (vty, "%s", VTY_NEWLINE); | |
11952 | } | |
11953 | ||
11954 | /* Extended nexthop */ | |
11955 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
11956 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11957 | { | |
11958 | vty_out (vty, " Extended nexthop:"); | |
11959 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11960 | vty_out (vty, " advertised"); | |
11961 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11962 | vty_out (vty, " %sreceived", | |
11963 | CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) ? "and " : ""); | |
11964 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 11965 | |
856ca177 MS |
11966 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) |
11967 | { | |
11968 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
11969 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11970 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
11971 | vty_out (vty, " %s%s", | |
11972 | afi_safi_print (AFI_IP, safi), VTY_NEWLINE); | |
11973 | } | |
11974 | } | |
8a92a8a0 | 11975 | |
856ca177 MS |
11976 | /* Route Refresh */ |
11977 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
11978 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11979 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11980 | { | |
11981 | vty_out (vty, " Route refresh:"); | |
11982 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
11983 | vty_out (vty, " advertised"); | |
11984 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11985 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11986 | vty_out (vty, " %sreceived(%s)", | |
11987 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
11988 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
11989 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
11990 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
8a92a8a0 | 11991 | |
856ca177 MS |
11992 | vty_out (vty, "%s", VTY_NEWLINE); |
11993 | } | |
718e3744 | 11994 | |
856ca177 MS |
11995 | /* Multiprotocol Extensions */ |
11996 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11997 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11998 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
11999 | { | |
12000 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); | |
12001 | if (p->afc_adv[afi][safi]) | |
12002 | vty_out (vty, " advertised"); | |
12003 | if (p->afc_recv[afi][safi]) | |
12004 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
12005 | vty_out (vty, "%s", VTY_NEWLINE); | |
12006 | } | |
538621f2 | 12007 | |
04b6bdc0 DW |
12008 | /* Hostname capability */ |
12009 | if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV) || | |
12010 | CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) | |
12011 | { | |
12012 | vty_out (vty, " Hostname Capability:"); | |
12013 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV)) | |
12014 | vty_out (vty, " advertised"); | |
12015 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_RCV)) | |
12016 | vty_out (vty, " %sreceived", | |
12017 | CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV) ? "and " : ""); | |
12018 | vty_out (vty, "%s", VTY_NEWLINE); | |
12019 | } | |
12020 | ||
856ca177 MS |
12021 | /* Gracefull Restart */ |
12022 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
12023 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
12024 | { | |
12025 | vty_out (vty, " Graceful Restart Capabilty:"); | |
12026 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
538621f2 | 12027 | vty_out (vty, " advertised"); |
856ca177 MS |
12028 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
12029 | vty_out (vty, " %sreceived", | |
12030 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
12031 | vty_out (vty, "%s", VTY_NEWLINE); | |
538621f2 | 12032 | |
856ca177 MS |
12033 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
12034 | { | |
12035 | int restart_af_count = 0; | |
12036 | ||
12037 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
12038 | p->v_gr_restart, VTY_NEWLINE); | |
12039 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
12040 | ||
12041 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12042 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12043 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
12044 | { | |
12045 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", | |
12046 | afi_safi_print (afi, safi), | |
12047 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
12048 | "preserved" : "not preserved"); | |
12049 | restart_af_count++; | |
12050 | } | |
12051 | if (! restart_af_count) | |
12052 | vty_out (vty, "none"); | |
12053 | vty_out (vty, "%s", VTY_NEWLINE); | |
12054 | } | |
12055 | } | |
12056 | } | |
718e3744 | 12057 | } |
12058 | } | |
12059 | ||
93406d87 | 12060 | /* graceful restart information */ |
12061 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
12062 | || p->t_gr_restart | |
12063 | || p->t_gr_stale) | |
12064 | { | |
856ca177 MS |
12065 | json_object *json_grace = NULL; |
12066 | json_object *json_grace_send = NULL; | |
12067 | json_object *json_grace_recv = NULL; | |
93406d87 | 12068 | int eor_send_af_count = 0; |
12069 | int eor_receive_af_count = 0; | |
12070 | ||
856ca177 MS |
12071 | if (use_json) |
12072 | { | |
12073 | json_grace = json_object_new_object(); | |
12074 | json_grace_send = json_object_new_object(); | |
12075 | json_grace_recv = json_object_new_object(); | |
12076 | ||
12077 | if (p->status == Established) | |
12078 | { | |
12079 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12080 | { | |
12081 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12082 | { | |
12083 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
12084 | { | |
12085 | json_object_boolean_true_add(json_grace_send, afi_safi_print (afi, safi)); | |
12086 | eor_send_af_count++; | |
12087 | } | |
12088 | } | |
12089 | } | |
12090 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12091 | { | |
12092 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12093 | { | |
12094 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
12095 | { | |
12096 | json_object_boolean_true_add(json_grace_recv, afi_safi_print (afi, safi)); | |
12097 | eor_receive_af_count++; | |
12098 | } | |
12099 | } | |
12100 | } | |
12101 | } | |
12102 | ||
12103 | json_object_object_add(json_grace, "endOfRibSend", json_grace_send); | |
12104 | json_object_object_add(json_grace, "endOfRibRecv", json_grace_recv); | |
12105 | ||
12106 | if (p->t_gr_restart) | |
12107 | json_object_int_add(json_grace, "gracefulRestartTimerMsecs", thread_timer_remain_second (p->t_gr_restart) * 1000); | |
12108 | ||
12109 | if (p->t_gr_stale) | |
12110 | json_object_int_add(json_grace, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p->t_gr_stale) * 1000); | |
12111 | ||
12112 | json_object_object_add(json_neigh, "gracefulRestartInfo", json_grace); | |
12113 | } | |
12114 | else | |
12115 | { | |
12116 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
12117 | if (p->status == Established) | |
12118 | { | |
12119 | vty_out (vty, " End-of-RIB send: "); | |
12120 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12121 | { | |
12122 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12123 | { | |
12124 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
12125 | { | |
12126 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
12127 | afi_safi_print (afi, safi)); | |
12128 | eor_send_af_count++; | |
12129 | } | |
12130 | } | |
12131 | } | |
12132 | vty_out (vty, "%s", VTY_NEWLINE); | |
12133 | vty_out (vty, " End-of-RIB received: "); | |
12134 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12135 | { | |
12136 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12137 | { | |
12138 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
12139 | { | |
12140 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
12141 | afi_safi_print (afi, safi)); | |
12142 | eor_receive_af_count++; | |
12143 | } | |
12144 | } | |
12145 | } | |
12146 | vty_out (vty, "%s", VTY_NEWLINE); | |
12147 | } | |
93406d87 | 12148 | |
856ca177 MS |
12149 | if (p->t_gr_restart) |
12150 | vty_out (vty, " The remaining time of restart timer is %ld%s", | |
12151 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
0b2aa3a0 | 12152 | |
856ca177 MS |
12153 | if (p->t_gr_stale) |
12154 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", | |
12155 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
12156 | } | |
12157 | } | |
12158 | if (use_json) | |
12159 | { | |
12160 | json_object *json_stat = NULL; | |
12161 | json_stat = json_object_new_object(); | |
12162 | /* Packet counts. */ | |
12163 | json_object_int_add(json_stat, "depthInq", 0); | |
12164 | json_object_int_add(json_stat, "depthOutq", (unsigned long) p->obuf->count); | |
12165 | json_object_int_add(json_stat, "opensSent", p->open_out); | |
12166 | json_object_int_add(json_stat, "opensRecv", p->open_in); | |
12167 | json_object_int_add(json_stat, "notificationsSent", p->notify_out); | |
12168 | json_object_int_add(json_stat, "notificationsRecv", p->notify_in); | |
12169 | json_object_int_add(json_stat, "updatesSent", p->update_out); | |
12170 | json_object_int_add(json_stat, "updatesRecv", p->update_in); | |
12171 | json_object_int_add(json_stat, "keepalivesSent", p->keepalive_out); | |
12172 | json_object_int_add(json_stat, "keepalivesRecv", p->keepalive_in); | |
12173 | json_object_int_add(json_stat, "routeRefreshSent", p->refresh_out); | |
12174 | json_object_int_add(json_stat, "routeRefreshRecv", p->refresh_in); | |
12175 | json_object_int_add(json_stat, "capabilitySent", p->dynamic_cap_out); | |
12176 | json_object_int_add(json_stat, "capabilityRecv", p->dynamic_cap_in); | |
12177 | 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); | |
12178 | 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); | |
12179 | json_object_object_add(json_neigh, "messageStats", json_stat); | |
12180 | } | |
12181 | else | |
12182 | { | |
12183 | /* Packet counts. */ | |
12184 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); | |
12185 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
12186 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); | |
12187 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); | |
12188 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
12189 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
12190 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
12191 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
12192 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
12193 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
12194 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
12195 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
12196 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
12197 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 12198 | } |
12199 | ||
856ca177 MS |
12200 | if (use_json) |
12201 | { | |
12202 | /* advertisement-interval */ | |
12203 | json_object_int_add(json_neigh, "minBtwnAdvertisementRunsTimerMsecs", p->v_routeadv * 1000); | |
718e3744 | 12204 | |
856ca177 MS |
12205 | /* Update-source. */ |
12206 | if (p->update_if || p->update_source) | |
12207 | { | |
12208 | if (p->update_if) | |
12209 | json_object_string_add(json_neigh, "updateSource", p->update_if); | |
12210 | else if (p->update_source) | |
12211 | json_object_string_add(json_neigh, "updateSource", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
12212 | } | |
12213 | ||
12214 | /* Default weight */ | |
12215 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
12216 | json_object_int_add(json_neigh, "defaultWeight", p->weight); | |
12217 | ||
12218 | } | |
12219 | else | |
12220 | { | |
12221 | /* advertisement-interval */ | |
12222 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
12223 | p->v_routeadv, VTY_NEWLINE); | |
12224 | ||
12225 | /* Update-source. */ | |
12226 | if (p->update_if || p->update_source) | |
12227 | { | |
12228 | vty_out (vty, " Update source is "); | |
12229 | if (p->update_if) | |
12230 | vty_out (vty, "%s", p->update_if); | |
12231 | else if (p->update_source) | |
12232 | vty_out (vty, "%s", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
12233 | vty_out (vty, "%s", VTY_NEWLINE); | |
12234 | } | |
12235 | ||
12236 | /* Default weight */ | |
12237 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
12238 | vty_out (vty, " Default weight %d%s", p->weight, VTY_NEWLINE); | |
12239 | ||
12240 | vty_out (vty, "%s", VTY_NEWLINE); | |
12241 | } | |
718e3744 | 12242 | |
12243 | /* Address Family Information */ | |
856ca177 MS |
12244 | json_object *json_hold = NULL; |
12245 | ||
12246 | if (use_json) | |
12247 | json_hold = json_object_new_object(); | |
12248 | ||
538621f2 | 12249 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
12250 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12251 | if (p->afc[afi][safi]) | |
856ca177 | 12252 | bgp_show_peer_afi (vty, p, afi, safi, use_json, json_hold); |
718e3744 | 12253 | |
856ca177 MS |
12254 | if (use_json) |
12255 | { | |
12256 | json_object_int_add(json_hold, "connectionsEstablished", p->established); | |
12257 | json_object_int_add(json_hold, "connectionsDropped", p->dropped); | |
12258 | } | |
12259 | else | |
12260 | vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped, | |
12261 | VTY_NEWLINE); | |
718e3744 | 12262 | |
d6661008 | 12263 | if (! p->last_reset) |
856ca177 MS |
12264 | { |
12265 | if (use_json) | |
12266 | json_object_string_add(json_hold, "lastReset", "never"); | |
12267 | else | |
12268 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); | |
12269 | } | |
e0701b79 | 12270 | else |
d6661008 | 12271 | { |
856ca177 MS |
12272 | if (use_json) |
12273 | { | |
12274 | time_t uptime; | |
12275 | struct tm *tm; | |
12276 | ||
12277 | uptime = bgp_clock(); | |
12278 | uptime -= p->resettime; | |
12279 | tm = gmtime(&uptime); | |
12280 | json_object_int_add(json_hold, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
12281 | json_object_string_add(json_hold, "lastResetDueTo", peer_down_str[(int) p->last_reset]); | |
12282 | if (p->last_reset_cause_size) | |
12283 | { | |
39e871e6 ST |
12284 | char errorcodesubcode_hexstr[5]; |
12285 | sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode); | |
12286 | json_object_string_add(json_hold, "lastErrorCodeSubcode", errorcodesubcode_hexstr); | |
856ca177 MS |
12287 | } |
12288 | } | |
12289 | else | |
d6661008 | 12290 | { |
3a8c7ba1 DW |
12291 | vty_out (vty, " Last reset %s, ", |
12292 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
12293 | ||
12294 | if (p->last_reset == PEER_DOWN_NOTIFY_SEND || | |
12295 | p->last_reset == PEER_DOWN_NOTIFY_RECEIVED) | |
12296 | { | |
12297 | code_str = bgp_notify_code_str(p->notify.code); | |
12298 | subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode); | |
12299 | vty_out (vty, "due to NOTIFICATION %s (%s%s)%s", | |
12300 | p->last_reset == PEER_DOWN_NOTIFY_SEND ? "sent" : "received", | |
12301 | code_str, subcode_str, VTY_NEWLINE); | |
12302 | } | |
12303 | else | |
12304 | { | |
12305 | vty_out (vty, "due to %s%s", | |
12306 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
12307 | } | |
856ca177 MS |
12308 | |
12309 | if (p->last_reset_cause_size) | |
d6661008 | 12310 | { |
856ca177 MS |
12311 | msg = p->last_reset_cause; |
12312 | vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); | |
12313 | for (i = 1; i <= p->last_reset_cause_size; i++) | |
12314 | { | |
12315 | vty_out(vty, "%02X", *msg++); | |
d6661008 | 12316 | |
856ca177 MS |
12317 | if (i != p->last_reset_cause_size) |
12318 | { | |
12319 | if (i % 16 == 0) | |
12320 | { | |
12321 | vty_out(vty, "%s ", VTY_NEWLINE); | |
12322 | } | |
12323 | else if (i % 4 == 0) | |
12324 | { | |
12325 | vty_out(vty, " "); | |
12326 | } | |
12327 | } | |
12328 | } | |
12329 | vty_out(vty, "%s", VTY_NEWLINE); | |
d6661008 | 12330 | } |
d6661008 DS |
12331 | } |
12332 | } | |
848973c7 | 12333 | |
718e3744 | 12334 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
12335 | { | |
856ca177 MS |
12336 | if (use_json) |
12337 | json_object_boolean_true_add(json_hold, "prefixesConfigExceedMax"); | |
12338 | else | |
12339 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 12340 | |
12341 | if (p->t_pmax_restart) | |
856ca177 MS |
12342 | { |
12343 | if (use_json) | |
12344 | { | |
e8f7da3a | 12345 | json_object_boolean_true_add(json_hold, "reducePrefixNumFrom"); |
856ca177 MS |
12346 | json_object_int_add(json_hold, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); |
12347 | } | |
12348 | else | |
12349 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
12350 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
12351 | VTY_NEWLINE); | |
12352 | } | |
0a486e5f | 12353 | else |
856ca177 MS |
12354 | { |
12355 | if (use_json) | |
e8f7da3a | 12356 | json_object_boolean_true_add(json_hold, "reducePrefixNumAndClearIpBgp"); |
856ca177 MS |
12357 | else |
12358 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
12359 | p->host, VTY_NEWLINE); | |
12360 | } | |
718e3744 | 12361 | } |
12362 | ||
856ca177 MS |
12363 | if (use_json) |
12364 | json_object_object_add(json_neigh, "addressFamilyInfo", json_hold); | |
12365 | ||
f5a4827d | 12366 | /* EBGP Multihop and GTSM */ |
6d85b15b | 12367 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d | 12368 | { |
856ca177 MS |
12369 | if (use_json) |
12370 | { | |
12371 | if (p->gtsm_hops > 0) | |
12372 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->gtsm_hops); | |
12373 | else if (p->ttl > 1) | |
12374 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->ttl); | |
12375 | } | |
12376 | else | |
12377 | { | |
12378 | if (p->gtsm_hops > 0) | |
12379 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
12380 | p->gtsm_hops, VTY_NEWLINE); | |
12381 | else if (p->ttl > 1) | |
12382 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
12383 | p->ttl, VTY_NEWLINE); | |
12384 | } | |
f5a4827d | 12385 | } |
5d804b43 PM |
12386 | else |
12387 | { | |
12388 | if (p->gtsm_hops > 0) | |
856ca177 MS |
12389 | { |
12390 | if (use_json) | |
12391 | json_object_int_add(json_neigh, "internalBgpNbrMaxHopsAway", p->gtsm_hops); | |
12392 | else | |
12393 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
12394 | p->gtsm_hops, VTY_NEWLINE); | |
12395 | } | |
5d804b43 | 12396 | } |
718e3744 | 12397 | |
12398 | /* Local address. */ | |
12399 | if (p->su_local) | |
12400 | { | |
856ca177 MS |
12401 | if (use_json) |
12402 | { | |
12403 | json_object_string_add(json_neigh, "hostLocal", sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN)); | |
12404 | json_object_int_add(json_neigh, "portLocal", ntohs (p->su_local->sin.sin_port)); | |
12405 | } | |
12406 | else | |
12407 | vty_out (vty, "Local host: %s, Local port: %d%s", | |
12408 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), | |
12409 | ntohs (p->su_local->sin.sin_port), | |
12410 | VTY_NEWLINE); | |
718e3744 | 12411 | } |
12412 | ||
12413 | /* Remote address. */ | |
12414 | if (p->su_remote) | |
12415 | { | |
856ca177 MS |
12416 | if (use_json) |
12417 | { | |
12418 | json_object_string_add(json_neigh, "hostForeign", sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN)); | |
12419 | json_object_int_add(json_neigh, "portForeign", ntohs (p->su_remote->sin.sin_port)); | |
12420 | } | |
12421 | else | |
12422 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
718e3744 | 12423 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
12424 | ntohs (p->su_remote->sin.sin_port), | |
12425 | VTY_NEWLINE); | |
12426 | } | |
12427 | ||
12428 | /* Nexthop display. */ | |
12429 | if (p->su_local) | |
12430 | { | |
856ca177 MS |
12431 | if (use_json) |
12432 | { | |
12433 | json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ)); | |
718e3744 | 12434 | #ifdef HAVE_IPV6 |
856ca177 MS |
12435 | json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ)); |
12436 | json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ)); | |
12437 | if (p->shared_network) | |
12438 | json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork"); | |
12439 | else | |
12440 | json_object_string_add(json_neigh, "bgpConnection", "nonSharedNetwork"); | |
12441 | #endif /* HAVE_IPV6 */ | |
12442 | } | |
12443 | else | |
12444 | { | |
12445 | vty_out (vty, "Nexthop: %s%s", | |
12446 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
12447 | VTY_NEWLINE); | |
12448 | #ifdef HAVE_IPV6 | |
12449 | vty_out (vty, "Nexthop global: %s%s", | |
12450 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
12451 | VTY_NEWLINE); | |
12452 | vty_out (vty, "Nexthop local: %s%s", | |
12453 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
12454 | VTY_NEWLINE); | |
12455 | vty_out (vty, "BGP connection: %s%s", | |
12456 | p->shared_network ? "shared network" : "non shared network", | |
12457 | VTY_NEWLINE); | |
718e3744 | 12458 | #endif /* HAVE_IPV6 */ |
856ca177 | 12459 | } |
718e3744 | 12460 | } |
12461 | ||
12462 | /* Timer information. */ | |
856ca177 MS |
12463 | if (use_json) |
12464 | { | |
39e871e6 | 12465 | json_object_int_add(json_neigh, "connectRetryTimer", p->v_connect); |
dd9275d6 ST |
12466 | if (p->status == Established && p->rtt) |
12467 | json_object_int_add(json_neigh, "estimatedRttInMsecs", p->rtt); | |
856ca177 MS |
12468 | if (p->t_start) |
12469 | json_object_int_add(json_neigh, "nextStartTimerDueInMsecs", thread_timer_remain_second (p->t_start) * 1000); | |
12470 | if (p->t_connect) | |
12471 | json_object_int_add(json_neigh, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p->t_connect) * 1000); | |
12472 | if (p->t_routeadv) | |
12473 | { | |
12474 | json_object_int_add(json_neigh, "mraiInterval", p->v_routeadv); | |
12475 | json_object_int_add(json_neigh, "mraiTimerExpireInMsecs", thread_timer_remain_second (p->t_routeadv) * 1000); | |
12476 | } | |
cb1faec9 | 12477 | |
856ca177 MS |
12478 | if (p->t_read) |
12479 | json_object_string_add(json_neigh, "readThread", "on"); | |
12480 | else | |
12481 | json_object_string_add(json_neigh, "readThread", "off"); | |
12482 | if (p->t_write) | |
12483 | json_object_string_add(json_neigh, "writeThread", "on"); | |
12484 | else | |
12485 | json_object_string_add(json_neigh, "writeThread", "off"); | |
12486 | } | |
12487 | else | |
12488 | { | |
39e871e6 ST |
12489 | vty_out (vty, "BGP Connect Retry Timer in Seconds: %d%s", |
12490 | p->v_connect, VTY_NEWLINE); | |
dd9275d6 ST |
12491 | if (p->status == Established && p->rtt) |
12492 | vty_out (vty, "Estimated round trip time: %d ms%s", | |
12493 | p->rtt, VTY_NEWLINE); | |
856ca177 MS |
12494 | if (p->t_start) |
12495 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
12496 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
12497 | if (p->t_connect) | |
12498 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
12499 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
12500 | if (p->t_routeadv) | |
12501 | vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s", | |
12502 | p->v_routeadv, thread_timer_remain_second (p->t_routeadv), | |
12503 | VTY_NEWLINE); | |
12504 | ||
12505 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
12506 | p->t_read ? "on" : "off", | |
12507 | p->t_write ? "on" : "off", | |
12508 | VTY_NEWLINE); | |
12509 | } | |
718e3744 | 12510 | |
12511 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
12512 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
856ca177 MS |
12513 | bgp_capability_vty_out (vty, p, use_json, json_neigh); |
12514 | ||
12515 | if (!use_json) | |
12516 | vty_out (vty, "%s", VTY_NEWLINE); | |
c43ed2e4 DS |
12517 | |
12518 | /* BFD information. */ | |
856ca177 MS |
12519 | bgp_bfd_show_info(vty, p, use_json, json_neigh); |
12520 | ||
12521 | if (use_json) | |
12522 | { | |
12523 | if (p->conf_if) /* Configured interface name. */ | |
12524 | json_object_object_add(json, p->conf_if, json_neigh); | |
12525 | else /* Configured IP address. */ | |
12526 | json_object_object_add(json, p->host, json_neigh); | |
12527 | } | |
718e3744 | 12528 | } |
12529 | ||
94f2b392 | 12530 | static int |
856ca177 MS |
12531 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type, |
12532 | union sockunion *su, const char *conf_if, u_char use_json, json_object *json) | |
718e3744 | 12533 | { |
1eb8ef25 | 12534 | struct listnode *node, *nnode; |
718e3744 | 12535 | struct peer *peer; |
12536 | int find = 0; | |
12537 | ||
1eb8ef25 | 12538 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 12539 | { |
1ff9a340 DS |
12540 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
12541 | continue; | |
12542 | ||
718e3744 | 12543 | switch (type) |
856ca177 MS |
12544 | { |
12545 | case show_all: | |
e8f7da3a | 12546 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12547 | break; |
12548 | case show_peer: | |
12549 | if (conf_if) | |
12550 | { | |
4873b3b9 DW |
12551 | if ((peer->conf_if && !strcmp(peer->conf_if, conf_if)) || |
12552 | (peer->hostname && !strcmp(peer->hostname, conf_if))) | |
856ca177 MS |
12553 | { |
12554 | find = 1; | |
e8f7da3a | 12555 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12556 | } |
12557 | } | |
12558 | else | |
12559 | { | |
12560 | if (sockunion_same (&peer->su, su)) | |
12561 | { | |
12562 | find = 1; | |
e8f7da3a | 12563 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12564 | } |
12565 | } | |
12566 | break; | |
718e3744 | 12567 | } |
12568 | } | |
12569 | ||
12570 | if (type == show_peer && ! find) | |
856ca177 MS |
12571 | { |
12572 | if (use_json) | |
12573 | json_object_boolean_true_add(json, "bgpNoSuchNeighbor"); | |
12574 | else | |
12575 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
12576 | } | |
12577 | ||
12578 | if (use_json) | |
12579 | { | |
12580 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
12581 | json_object_free(json); | |
12582 | } | |
12583 | else | |
12584 | { | |
12585 | vty_out (vty, "%s", VTY_NEWLINE); | |
12586 | } | |
12587 | ||
718e3744 | 12588 | return CMD_SUCCESS; |
12589 | } | |
12590 | ||
94f2b392 | 12591 | static int |
fd79ac91 | 12592 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
9f689658 DD |
12593 | enum show_type type, const char *ip_str, u_char use_json, |
12594 | json_object *json) | |
718e3744 | 12595 | { |
12596 | int ret; | |
12597 | struct bgp *bgp; | |
12598 | union sockunion su; | |
856ca177 | 12599 | |
9f689658 | 12600 | if (use_json && (json == NULL)) |
856ca177 | 12601 | json = json_object_new_object(); |
718e3744 | 12602 | |
718e3744 | 12603 | if (name) |
12604 | { | |
12605 | bgp = bgp_lookup_by_name (name); | |
718e3744 | 12606 | if (! bgp) |
12607 | { | |
856ca177 MS |
12608 | if (use_json) |
12609 | { | |
12610 | json_object_boolean_true_add(json, "bgpNoSuchInstance"); | |
12611 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
12612 | json_object_free(json); | |
12613 | } | |
12614 | else | |
12615 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
12616 | ||
718e3744 | 12617 | return CMD_WARNING; |
12618 | } | |
718e3744 | 12619 | } |
a80beece DS |
12620 | else |
12621 | { | |
12622 | bgp = bgp_get_default (); | |
12623 | } | |
718e3744 | 12624 | |
12625 | if (bgp) | |
a80beece DS |
12626 | { |
12627 | if (ip_str) | |
12628 | { | |
12629 | ret = str2sockunion (ip_str, &su); | |
12630 | if (ret < 0) | |
856ca177 | 12631 | bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json); |
a80beece | 12632 | else |
856ca177 | 12633 | bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json); |
a80beece DS |
12634 | } |
12635 | else | |
12636 | { | |
856ca177 | 12637 | bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json); |
a80beece DS |
12638 | } |
12639 | } | |
718e3744 | 12640 | |
12641 | return CMD_SUCCESS; | |
12642 | } | |
12643 | ||
f186de26 | 12644 | static void |
12645 | bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) | |
12646 | { | |
12647 | struct listnode *node, *nnode; | |
12648 | struct bgp *bgp; | |
12649 | json_object *json = NULL; | |
9f689658 DD |
12650 | int is_first = 1; |
12651 | ||
12652 | if (use_json) | |
12653 | vty_out (vty, "{%s", VTY_NEWLINE); | |
f186de26 | 12654 | |
12655 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
12656 | { | |
f186de26 | 12657 | if (use_json) |
9f689658 DD |
12658 | { |
12659 | if (!(json = json_object_new_object())) | |
12660 | { | |
12661 | zlog_err("Unable to allocate memory for JSON object"); | |
12662 | vty_out (vty, | |
12663 | "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s", | |
12664 | VTY_NEWLINE); | |
12665 | return; | |
12666 | } | |
12667 | ||
12668 | json_object_int_add(json, "vrfId", | |
12669 | (bgp->vrf_id == VRF_UNKNOWN) | |
12670 | ? -1 : bgp->vrf_id); | |
12671 | json_object_string_add(json, "vrfName", | |
12672 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12673 | ? "Default" : bgp->name); | |
12674 | ||
12675 | if (! is_first) | |
12676 | vty_out (vty, ",%s", VTY_NEWLINE); | |
12677 | else | |
12678 | is_first = 0; | |
12679 | ||
12680 | vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12681 | ? "Default" : bgp->name); | |
12682 | } | |
12683 | else | |
12684 | { | |
12685 | vty_out (vty, "%sInstance %s:%s", | |
12686 | VTY_NEWLINE, | |
12687 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12688 | ? "Default" : bgp->name, | |
12689 | VTY_NEWLINE); | |
12690 | } | |
f186de26 | 12691 | bgp_show_neighbor (vty, bgp, show_all, NULL, NULL, use_json, json); |
12692 | } | |
9f689658 DD |
12693 | |
12694 | if (use_json) | |
12695 | vty_out (vty, "}%s", VTY_NEWLINE); | |
f186de26 | 12696 | } |
12697 | ||
718e3744 | 12698 | /* "show ip bgp neighbors" commands. */ |
12699 | DEFUN (show_ip_bgp_neighbors, | |
12700 | show_ip_bgp_neighbors_cmd, | |
856ca177 | 12701 | "show ip bgp neighbors {json}", |
718e3744 | 12702 | SHOW_STR |
12703 | IP_STR | |
12704 | BGP_STR | |
856ca177 MS |
12705 | "Detailed information on TCP and BGP neighbor connections\n" |
12706 | "JavaScript Object Notation\n") | |
718e3744 | 12707 | { |
db7c8528 | 12708 | u_char uj = use_json(argc, argv); |
856ca177 | 12709 | |
9f689658 | 12710 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, uj, NULL); |
718e3744 | 12711 | } |
12712 | ||
12713 | ALIAS (show_ip_bgp_neighbors, | |
12714 | show_ip_bgp_ipv4_neighbors_cmd, | |
856ca177 | 12715 | "show ip bgp ipv4 (unicast|multicast) neighbors {json}", |
718e3744 | 12716 | SHOW_STR |
12717 | IP_STR | |
12718 | BGP_STR | |
12719 | "Address family\n" | |
12720 | "Address Family modifier\n" | |
12721 | "Address Family modifier\n" | |
856ca177 MS |
12722 | "Detailed information on TCP and BGP neighbor connections\n" |
12723 | "JavaScript Object Notation\n") | |
718e3744 | 12724 | |
12725 | ALIAS (show_ip_bgp_neighbors, | |
12726 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
856ca177 | 12727 | "show ip bgp vpnv4 all neighbors {json}", |
718e3744 | 12728 | SHOW_STR |
12729 | IP_STR | |
12730 | BGP_STR | |
12731 | "Display VPNv4 NLRI specific information\n" | |
12732 | "Display information about all VPNv4 NLRIs\n" | |
856ca177 MS |
12733 | "Detailed information on TCP and BGP neighbor connections\n" |
12734 | "JavaScript Object Notation\n") | |
718e3744 | 12735 | |
12736 | ALIAS (show_ip_bgp_neighbors, | |
12737 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
856ca177 | 12738 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}", |
718e3744 | 12739 | SHOW_STR |
12740 | IP_STR | |
12741 | BGP_STR | |
12742 | "Display VPNv4 NLRI specific information\n" | |
12743 | "Display information for a route distinguisher\n" | |
12744 | "VPN Route Distinguisher\n" | |
856ca177 MS |
12745 | "Detailed information on TCP and BGP neighbor connections\n" |
12746 | "JavaScript Object Notation\n") | |
718e3744 | 12747 | |
12748 | ALIAS (show_ip_bgp_neighbors, | |
12749 | show_bgp_neighbors_cmd, | |
856ca177 | 12750 | "show bgp neighbors {json}", |
718e3744 | 12751 | SHOW_STR |
12752 | BGP_STR | |
856ca177 MS |
12753 | "Detailed information on TCP and BGP neighbor connections\n" |
12754 | "JavaScript Object Notation\n") | |
718e3744 | 12755 | |
12756 | ALIAS (show_ip_bgp_neighbors, | |
12757 | show_bgp_ipv6_neighbors_cmd, | |
856ca177 | 12758 | "show bgp ipv6 neighbors {json}", |
718e3744 | 12759 | SHOW_STR |
12760 | BGP_STR | |
12761 | "Address family\n" | |
856ca177 MS |
12762 | "Detailed information on TCP and BGP neighbor connections\n" |
12763 | "JavaScript Object Notation\n") | |
718e3744 | 12764 | |
12765 | DEFUN (show_ip_bgp_neighbors_peer, | |
12766 | show_ip_bgp_neighbors_peer_cmd, | |
856ca177 | 12767 | "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12768 | SHOW_STR |
12769 | IP_STR | |
12770 | BGP_STR | |
12771 | "Detailed information on TCP and BGP neighbor connections\n" | |
12772 | "Neighbor to display information about\n" | |
a80beece | 12773 | "Neighbor to display information about\n" |
856ca177 MS |
12774 | "Neighbor on bgp configured interface\n" |
12775 | "JavaScript Object Notation\n") | |
718e3744 | 12776 | { |
db7c8528 | 12777 | u_char uj = use_json(argc, argv); |
856ca177 | 12778 | |
9f689658 | 12779 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], uj, NULL); |
718e3744 | 12780 | } |
12781 | ||
12782 | ALIAS (show_ip_bgp_neighbors_peer, | |
12783 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
856ca177 | 12784 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12785 | SHOW_STR |
12786 | IP_STR | |
12787 | BGP_STR | |
12788 | "Address family\n" | |
12789 | "Address Family modifier\n" | |
12790 | "Address Family modifier\n" | |
12791 | "Detailed information on TCP and BGP neighbor connections\n" | |
12792 | "Neighbor to display information about\n" | |
a80beece | 12793 | "Neighbor to display information about\n" |
856ca177 MS |
12794 | "Neighbor on bgp configured interface\n" |
12795 | "JavaScript Object Notation\n") | |
718e3744 | 12796 | |
12797 | ALIAS (show_ip_bgp_neighbors_peer, | |
12798 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
856ca177 | 12799 | "show ip bgp vpnv4 all neighbors A.B.C.D {json}", |
718e3744 | 12800 | SHOW_STR |
12801 | IP_STR | |
12802 | BGP_STR | |
12803 | "Display VPNv4 NLRI specific information\n" | |
12804 | "Display information about all VPNv4 NLRIs\n" | |
12805 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
12806 | "Neighbor to display information about\n" |
12807 | "JavaScript Object Notation\n") | |
718e3744 | 12808 | |
12809 | ALIAS (show_ip_bgp_neighbors_peer, | |
12810 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
856ca177 | 12811 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}", |
718e3744 | 12812 | SHOW_STR |
12813 | IP_STR | |
12814 | BGP_STR | |
12815 | "Display VPNv4 NLRI specific information\n" | |
12816 | "Display information about all VPNv4 NLRIs\n" | |
12817 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
12818 | "Neighbor to display information about\n" |
12819 | "JavaScript Object Notation\n") | |
718e3744 | 12820 | |
12821 | ALIAS (show_ip_bgp_neighbors_peer, | |
12822 | show_bgp_neighbors_peer_cmd, | |
856ca177 | 12823 | "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12824 | SHOW_STR |
12825 | BGP_STR | |
12826 | "Detailed information on TCP and BGP neighbor connections\n" | |
12827 | "Neighbor to display information about\n" | |
a80beece | 12828 | "Neighbor to display information about\n" |
856ca177 MS |
12829 | "Neighbor on bgp configured interface\n" |
12830 | "JavaScript Object Notation\n") | |
718e3744 | 12831 | |
12832 | ALIAS (show_ip_bgp_neighbors_peer, | |
12833 | show_bgp_ipv6_neighbors_peer_cmd, | |
856ca177 | 12834 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12835 | SHOW_STR |
12836 | BGP_STR | |
12837 | "Address family\n" | |
12838 | "Detailed information on TCP and BGP neighbor connections\n" | |
12839 | "Neighbor to display information about\n" | |
a80beece | 12840 | "Neighbor to display information about\n" |
856ca177 MS |
12841 | "Neighbor on bgp configured interface\n" |
12842 | "JavaScript Object Notation\n") | |
718e3744 | 12843 | |
12844 | DEFUN (show_ip_bgp_instance_neighbors, | |
12845 | show_ip_bgp_instance_neighbors_cmd, | |
8386ac43 | 12846 | "show ip bgp " BGP_INSTANCE_CMD " neighbors {json}", |
718e3744 | 12847 | SHOW_STR |
12848 | IP_STR | |
12849 | BGP_STR | |
8386ac43 | 12850 | BGP_INSTANCE_HELP_STR |
856ca177 MS |
12851 | "Detailed information on TCP and BGP neighbor connections\n" |
12852 | "JavaScript Object Notation\n") | |
718e3744 | 12853 | { |
db7c8528 | 12854 | u_char uj = use_json(argc, argv); |
856ca177 | 12855 | |
9f689658 | 12856 | return bgp_show_neighbor_vty (vty, argv[1], show_all, NULL, uj, NULL); |
718e3744 | 12857 | } |
12858 | ||
f186de26 | 12859 | DEFUN (show_ip_bgp_instance_all_neighbors, |
12860 | show_ip_bgp_instance_all_neighbors_cmd, | |
12861 | "show ip bgp " BGP_INSTANCE_ALL_CMD " neighbors {json}", | |
12862 | SHOW_STR | |
12863 | IP_STR | |
12864 | BGP_STR | |
12865 | BGP_INSTANCE_ALL_HELP_STR | |
12866 | "Detailed information on TCP and BGP neighbor connections\n" | |
12867 | "JavaScript Object Notation\n") | |
12868 | { | |
12869 | u_char uj = use_json(argc, argv); | |
12870 | ||
12871 | bgp_show_all_instances_neighbors_vty (vty, uj); | |
12872 | return CMD_SUCCESS; | |
12873 | } | |
12874 | ||
bb46e94f | 12875 | ALIAS (show_ip_bgp_instance_neighbors, |
12876 | show_bgp_instance_neighbors_cmd, | |
8386ac43 | 12877 | "show bgp " BGP_INSTANCE_CMD " neighbors {json}", |
bb46e94f | 12878 | SHOW_STR |
12879 | BGP_STR | |
8386ac43 | 12880 | BGP_INSTANCE_HELP_STR |
856ca177 MS |
12881 | "Detailed information on TCP and BGP neighbor connections\n" |
12882 | "JavaScript Object Notation\n") | |
bb46e94f | 12883 | |
12884 | ALIAS (show_ip_bgp_instance_neighbors, | |
12885 | show_bgp_instance_ipv6_neighbors_cmd, | |
8386ac43 | 12886 | "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors {json}", |
bb46e94f | 12887 | SHOW_STR |
12888 | BGP_STR | |
8386ac43 | 12889 | BGP_INSTANCE_HELP_STR |
bb46e94f | 12890 | "Address family\n" |
856ca177 MS |
12891 | "Detailed information on TCP and BGP neighbor connections\n" |
12892 | "JavaScript Object Notation\n") | |
bb46e94f | 12893 | |
718e3744 | 12894 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
12895 | show_ip_bgp_instance_neighbors_peer_cmd, | |
8386ac43 | 12896 | "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12897 | SHOW_STR |
12898 | IP_STR | |
12899 | BGP_STR | |
8386ac43 | 12900 | BGP_INSTANCE_HELP_STR |
718e3744 | 12901 | "Detailed information on TCP and BGP neighbor connections\n" |
12902 | "Neighbor to display information about\n" | |
a80beece | 12903 | "Neighbor to display information about\n" |
856ca177 MS |
12904 | "Neighbor on bgp configured interface\n" |
12905 | "JavaScript Object Notation\n") | |
718e3744 | 12906 | { |
db7c8528 | 12907 | u_char uj = use_json(argc, argv); |
856ca177 | 12908 | |
9f689658 | 12909 | return bgp_show_neighbor_vty (vty, argv[1], show_peer, argv[2], uj, NULL); |
718e3744 | 12910 | } |
bb46e94f | 12911 | |
12912 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
12913 | show_bgp_instance_neighbors_peer_cmd, | |
8386ac43 | 12914 | "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 12915 | SHOW_STR |
12916 | BGP_STR | |
8386ac43 | 12917 | BGP_INSTANCE_HELP_STR |
bb46e94f | 12918 | "Detailed information on TCP and BGP neighbor connections\n" |
12919 | "Neighbor to display information about\n" | |
a80beece | 12920 | "Neighbor to display information about\n" |
856ca177 MS |
12921 | "Neighbor on bgp configured interface\n" |
12922 | "JavaScript Object Notation\n") | |
bb46e94f | 12923 | |
12924 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
12925 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
8386ac43 | 12926 | "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 12927 | SHOW_STR |
12928 | BGP_STR | |
8386ac43 | 12929 | BGP_INSTANCE_HELP_STR |
bb46e94f | 12930 | "Address family\n" |
12931 | "Detailed information on TCP and BGP neighbor connections\n" | |
12932 | "Neighbor to display information about\n" | |
a80beece | 12933 | "Neighbor to display information about\n" |
856ca177 MS |
12934 | "Neighbor on bgp configured interface\n" |
12935 | "JavaScript Object Notation\n") | |
6b0655a2 | 12936 | |
718e3744 | 12937 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
12938 | paths' and `show ip mbgp paths'. Those functions results are the | |
12939 | same.*/ | |
12940 | DEFUN (show_ip_bgp_paths, | |
12941 | show_ip_bgp_paths_cmd, | |
12942 | "show ip bgp paths", | |
12943 | SHOW_STR | |
12944 | IP_STR | |
12945 | BGP_STR | |
12946 | "Path information\n") | |
12947 | { | |
12948 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
12949 | aspath_print_all_vty (vty); | |
12950 | return CMD_SUCCESS; | |
12951 | } | |
12952 | ||
12953 | DEFUN (show_ip_bgp_ipv4_paths, | |
12954 | show_ip_bgp_ipv4_paths_cmd, | |
12955 | "show ip bgp ipv4 (unicast|multicast) paths", | |
12956 | SHOW_STR | |
12957 | IP_STR | |
12958 | BGP_STR | |
12959 | "Address family\n" | |
12960 | "Address Family modifier\n" | |
12961 | "Address Family modifier\n" | |
12962 | "Path information\n") | |
12963 | { | |
12964 | vty_out (vty, "Address Refcnt Path\r\n"); | |
12965 | aspath_print_all_vty (vty); | |
12966 | ||
12967 | return CMD_SUCCESS; | |
12968 | } | |
6b0655a2 | 12969 | |
718e3744 | 12970 | #include "hash.h" |
12971 | ||
94f2b392 | 12972 | static void |
718e3744 | 12973 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
12974 | { | |
12975 | struct community *com; | |
12976 | ||
12977 | com = (struct community *) backet->data; | |
6c4f4e6e | 12978 | vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt, |
718e3744 | 12979 | community_str (com), VTY_NEWLINE); |
12980 | } | |
12981 | ||
12982 | /* Show BGP's community internal data. */ | |
12983 | DEFUN (show_ip_bgp_community_info, | |
12984 | show_ip_bgp_community_info_cmd, | |
12985 | "show ip bgp community-info", | |
12986 | SHOW_STR | |
12987 | IP_STR | |
12988 | BGP_STR | |
12989 | "List all bgp community information\n") | |
12990 | { | |
12991 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
12992 | ||
12993 | hash_iterate (community_hash (), | |
12994 | (void (*) (struct hash_backet *, void *)) | |
12995 | community_show_all_iterator, | |
12996 | vty); | |
12997 | ||
12998 | return CMD_SUCCESS; | |
12999 | } | |
13000 | ||
13001 | DEFUN (show_ip_bgp_attr_info, | |
13002 | show_ip_bgp_attr_info_cmd, | |
13003 | "show ip bgp attribute-info", | |
13004 | SHOW_STR | |
13005 | IP_STR | |
13006 | BGP_STR | |
13007 | "List all bgp attribute information\n") | |
13008 | { | |
13009 | attr_show_all (vty); | |
13010 | return CMD_SUCCESS; | |
13011 | } | |
6b0655a2 | 13012 | |
8386ac43 | 13013 | static int bgp_show_update_groups(struct vty *vty, const char *name, |
13014 | int afi, int safi, | |
50ef26d4 | 13015 | u_int64_t subgrp_id) |
3f9c7369 DS |
13016 | { |
13017 | struct bgp *bgp; | |
13018 | ||
8386ac43 | 13019 | if (name) |
13020 | bgp = bgp_lookup_by_name (name); | |
13021 | else | |
13022 | bgp = bgp_get_default (); | |
13023 | ||
3f9c7369 | 13024 | if (bgp) |
8fe8a7f6 | 13025 | update_group_show(bgp, afi, safi, vty, subgrp_id); |
3f9c7369 DS |
13026 | return CMD_SUCCESS; |
13027 | } | |
13028 | ||
f186de26 | 13029 | static void |
13030 | bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi) | |
13031 | { | |
13032 | struct listnode *node, *nnode; | |
13033 | struct bgp *bgp; | |
13034 | ||
13035 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
13036 | { | |
13037 | vty_out (vty, "%sInstance %s:%s", | |
13038 | VTY_NEWLINE, | |
13039 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name, | |
13040 | VTY_NEWLINE); | |
13041 | update_group_show(bgp, afi, safi, vty, 0); | |
13042 | } | |
13043 | } | |
13044 | ||
8fe8a7f6 DS |
13045 | DEFUN (show_ip_bgp_updgrps, |
13046 | show_ip_bgp_updgrps_cmd, | |
13047 | "show ip bgp update-groups", | |
13048 | SHOW_STR | |
13049 | IP_STR | |
13050 | BGP_STR | |
13051 | "Detailed info about dynamic update groups\n") | |
13052 | { | |
8386ac43 | 13053 | return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, 0)); |
13054 | } | |
13055 | ||
13056 | DEFUN (show_ip_bgp_instance_updgrps, | |
13057 | show_ip_bgp_instance_updgrps_cmd, | |
13058 | "show ip bgp " BGP_INSTANCE_CMD " update-groups", | |
13059 | SHOW_STR | |
13060 | IP_STR | |
13061 | BGP_STR | |
13062 | BGP_INSTANCE_HELP_STR | |
13063 | "Detailed info about dynamic update groups\n") | |
13064 | { | |
13065 | return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, 0)); | |
8fe8a7f6 DS |
13066 | } |
13067 | ||
f186de26 | 13068 | DEFUN (show_ip_bgp_instance_all_updgrps, |
13069 | show_ip_bgp_instance_all_updgrps_cmd, | |
13070 | "show ip bgp " BGP_INSTANCE_ALL_CMD " update-groups", | |
13071 | SHOW_STR | |
13072 | IP_STR | |
13073 | BGP_STR | |
13074 | BGP_INSTANCE_ALL_HELP_STR | |
13075 | "Detailed info about dynamic update groups\n") | |
13076 | { | |
13077 | bgp_show_all_instances_updgrps_vty (vty, AFI_IP, SAFI_UNICAST); | |
13078 | return CMD_SUCCESS; | |
13079 | } | |
13080 | ||
3f9c7369 DS |
13081 | DEFUN (show_bgp_ipv6_updgrps, |
13082 | show_bgp_ipv6_updgrps_cmd, | |
8fe8a7f6 | 13083 | "show bgp update-groups", |
3f9c7369 DS |
13084 | SHOW_STR |
13085 | BGP_STR | |
8fe8a7f6 | 13086 | "Detailed info about v6 dynamic update groups\n") |
3f9c7369 | 13087 | { |
8386ac43 | 13088 | return (bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, 0)); |
13089 | } | |
13090 | ||
13091 | DEFUN (show_bgp_instance_ipv6_updgrps, | |
13092 | show_bgp_instance_ipv6_updgrps_cmd, | |
13093 | "show bgp " BGP_INSTANCE_CMD " update-groups", | |
13094 | SHOW_STR | |
13095 | BGP_STR | |
13096 | BGP_INSTANCE_HELP_STR | |
13097 | "Detailed info about v6 dynamic update groups\n") | |
13098 | { | |
13099 | return (bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, 0)); | |
3f9c7369 DS |
13100 | } |
13101 | ||
f186de26 | 13102 | DEFUN (show_bgp_instance_all_ipv6_updgrps, |
13103 | show_bgp_instance_all_ipv6_updgrps_cmd, | |
13104 | "show bgp " BGP_INSTANCE_ALL_CMD " update-groups", | |
13105 | SHOW_STR | |
13106 | BGP_STR | |
13107 | BGP_INSTANCE_ALL_HELP_STR | |
13108 | "Detailed info about v6 dynamic update groups\n") | |
13109 | { | |
13110 | bgp_show_all_instances_updgrps_vty (vty, AFI_IP6, SAFI_UNICAST); | |
13111 | return CMD_SUCCESS; | |
13112 | } | |
13113 | ||
3f9c7369 DS |
13114 | DEFUN (show_bgp_updgrps, |
13115 | show_bgp_updgrps_cmd, | |
8fe8a7f6 | 13116 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups", |
3f9c7369 DS |
13117 | SHOW_STR |
13118 | BGP_STR | |
13119 | "Address family\n" | |
13120 | "Address family\n" | |
13121 | "Address Family modifier\n" | |
13122 | "Address Family modifier\n" | |
8fe8a7f6 | 13123 | "Detailed info about dynamic update groups\n") |
3f9c7369 | 13124 | { |
3f9c7369 DS |
13125 | afi_t afi; |
13126 | safi_t safi; | |
13127 | ||
13128 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13129 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8386ac43 | 13130 | return (bgp_show_update_groups(vty, NULL, afi, safi, 0)); |
8fe8a7f6 DS |
13131 | } |
13132 | ||
13133 | DEFUN (show_ip_bgp_updgrps_s, | |
13134 | show_ip_bgp_updgrps_s_cmd, | |
13135 | "show ip bgp update-groups SUBGROUP-ID", | |
13136 | SHOW_STR | |
13137 | IP_STR | |
13138 | BGP_STR | |
13139 | "Detailed info about dynamic update groups\n" | |
13140 | "Specific subgroup to display detailed info for\n") | |
13141 | { | |
13142 | u_int64_t subgrp_id; | |
13143 | ||
13144 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
8386ac43 | 13145 | return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, subgrp_id)); |
13146 | } | |
13147 | ||
13148 | DEFUN (show_ip_bgp_instance_updgrps_s, | |
13149 | show_ip_bgp_instance_updgrps_s_cmd, | |
13150 | "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID", | |
13151 | SHOW_STR | |
13152 | IP_STR | |
13153 | BGP_STR | |
13154 | BGP_INSTANCE_HELP_STR | |
13155 | "Detailed info about dynamic update groups\n" | |
13156 | "Specific subgroup to display detailed info for\n") | |
13157 | { | |
13158 | u_int64_t subgrp_id; | |
13159 | ||
13160 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13161 | return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, subgrp_id)); | |
8fe8a7f6 DS |
13162 | } |
13163 | ||
13164 | DEFUN (show_bgp_ipv6_updgrps_s, | |
13165 | show_bgp_ipv6_updgrps_s_cmd, | |
13166 | "show bgp update-groups SUBGROUP-ID", | |
13167 | SHOW_STR | |
13168 | BGP_STR | |
13169 | "Detailed info about v6 dynamic update groups\n" | |
13170 | "Specific subgroup to display detailed info for\n") | |
13171 | { | |
13172 | u_int64_t subgrp_id; | |
13173 | ||
13174 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
8386ac43 | 13175 | return(bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, subgrp_id)); |
13176 | } | |
13177 | ||
13178 | DEFUN (show_bgp_instance_ipv6_updgrps_s, | |
13179 | show_bgp_instance_ipv6_updgrps_s_cmd, | |
13180 | "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID", | |
13181 | SHOW_STR | |
13182 | BGP_STR | |
13183 | "Detailed info about v6 dynamic update groups\n" | |
13184 | "Specific subgroup to display detailed info for\n") | |
13185 | { | |
13186 | u_int64_t subgrp_id; | |
13187 | ||
13188 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13189 | return(bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, subgrp_id)); | |
8fe8a7f6 DS |
13190 | } |
13191 | ||
13192 | DEFUN (show_bgp_updgrps_s, | |
13193 | show_bgp_updgrps_s_cmd, | |
13194 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID", | |
13195 | SHOW_STR | |
13196 | BGP_STR | |
13197 | "Address family\n" | |
13198 | "Address family\n" | |
13199 | "Address Family modifier\n" | |
13200 | "Address Family modifier\n" | |
13201 | "Detailed info about v6 dynamic update groups\n" | |
13202 | "Specific subgroup to display detailed info for") | |
13203 | { | |
13204 | afi_t afi; | |
13205 | safi_t safi; | |
13206 | u_int64_t subgrp_id; | |
13207 | ||
13208 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13209 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
13210 | ||
13211 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
8386ac43 | 13212 | return(bgp_show_update_groups(vty, NULL, afi, safi, subgrp_id)); |
3f9c7369 DS |
13213 | } |
13214 | ||
13215 | DEFUN (show_bgp_updgrps_stats, | |
13216 | show_bgp_updgrps_stats_cmd, | |
13217 | "show bgp update-groups statistics", | |
13218 | SHOW_STR | |
13219 | BGP_STR | |
13220 | "BGP update groups\n" | |
13221 | "Statistics\n") | |
13222 | { | |
13223 | struct bgp *bgp; | |
13224 | ||
13225 | bgp = bgp_get_default(); | |
13226 | if (bgp) | |
13227 | update_group_show_stats(bgp, vty); | |
13228 | ||
13229 | return CMD_SUCCESS; | |
13230 | } | |
13231 | ||
8386ac43 | 13232 | DEFUN (show_bgp_instance_updgrps_stats, |
13233 | show_bgp_instance_updgrps_stats_cmd, | |
13234 | "show bgp " BGP_INSTANCE_CMD " update-groups statistics", | |
13235 | SHOW_STR | |
13236 | BGP_STR | |
13237 | BGP_INSTANCE_HELP_STR | |
13238 | "BGP update groups\n" | |
13239 | "Statistics\n") | |
13240 | { | |
13241 | struct bgp *bgp; | |
13242 | ||
13243 | bgp = bgp_lookup_by_name (argv[1]); | |
13244 | if (bgp) | |
13245 | update_group_show_stats(bgp, vty); | |
13246 | ||
13247 | return CMD_SUCCESS; | |
13248 | } | |
13249 | ||
3f9c7369 | 13250 | static void |
8386ac43 | 13251 | show_bgp_updgrps_adj_info_aux (struct vty *vty, const char *name, |
13252 | afi_t afi, safi_t safi, | |
3f9c7369 DS |
13253 | const char *what, u_int64_t subgrp_id) |
13254 | { | |
13255 | struct bgp *bgp; | |
8386ac43 | 13256 | |
13257 | if (name) | |
13258 | bgp = bgp_lookup_by_name (name); | |
13259 | else | |
13260 | bgp = bgp_get_default (); | |
13261 | ||
3f9c7369 DS |
13262 | if (bgp) |
13263 | { | |
13264 | if (!strcmp(what, "advertise-queue")) | |
13265 | update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id); | |
13266 | else if (!strcmp(what, "advertised-routes")) | |
13267 | update_group_show_advertised(bgp, afi, safi, vty, subgrp_id); | |
13268 | else if (!strcmp(what, "packet-queue")) | |
13269 | update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id); | |
13270 | } | |
13271 | } | |
13272 | ||
13273 | DEFUN (show_ip_bgp_updgrps_adj, | |
13274 | show_ip_bgp_updgrps_adj_cmd, | |
13275 | "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13276 | SHOW_STR | |
13277 | IP_STR | |
13278 | BGP_STR | |
13279 | "BGP update groups\n" | |
13280 | "Advertisement queue\n" | |
13281 | "Announced routes\n" | |
13282 | "Packet queue\n") | |
8fe8a7f6 | 13283 | |
3f9c7369 | 13284 | { |
8386ac43 | 13285 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[0], 0); |
13286 | return CMD_SUCCESS; | |
13287 | } | |
13288 | ||
13289 | DEFUN (show_ip_bgp_instance_updgrps_adj, | |
13290 | show_ip_bgp_instance_updgrps_adj_cmd, | |
13291 | "show ip bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13292 | SHOW_STR | |
13293 | IP_STR | |
13294 | BGP_STR | |
13295 | BGP_INSTANCE_HELP_STR | |
13296 | "BGP update groups\n" | |
13297 | "Advertisement queue\n" | |
13298 | "Announced routes\n" | |
13299 | "Packet queue\n") | |
13300 | ||
13301 | { | |
13302 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[2], 0); | |
3f9c7369 DS |
13303 | return CMD_SUCCESS; |
13304 | } | |
13305 | ||
13306 | DEFUN (show_bgp_updgrps_afi_adj, | |
13307 | show_bgp_updgrps_afi_adj_cmd, | |
13308 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13309 | SHOW_STR | |
13310 | BGP_STR | |
13311 | "Address family\n" | |
13312 | "Address family\n" | |
13313 | "Address Family modifier\n" | |
13314 | "Address Family modifier\n" | |
13315 | "BGP update groups\n" | |
13316 | "Advertisement queue\n" | |
13317 | "Announced routes\n" | |
8fe8a7f6 DS |
13318 | "Packet queue\n" |
13319 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
13320 | { |
13321 | afi_t afi; | |
13322 | safi_t safi; | |
13323 | ||
13324 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13325 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8386ac43 | 13326 | show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[2], 0); |
8fe8a7f6 | 13327 | return CMD_SUCCESS; |
3f9c7369 DS |
13328 | } |
13329 | ||
13330 | DEFUN (show_bgp_updgrps_adj, | |
13331 | show_bgp_updgrps_adj_cmd, | |
13332 | "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13333 | SHOW_STR | |
13334 | BGP_STR | |
13335 | "BGP update groups\n" | |
13336 | "Advertisement queue\n" | |
13337 | "Announced routes\n" | |
13338 | "Packet queue\n") | |
13339 | { | |
8386ac43 | 13340 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[0], 0); |
13341 | return CMD_SUCCESS; | |
13342 | } | |
13343 | ||
13344 | DEFUN (show_bgp_instance_updgrps_adj, | |
13345 | show_bgp_instance_updgrps_adj_cmd, | |
13346 | "show bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13347 | SHOW_STR | |
13348 | BGP_STR | |
13349 | BGP_INSTANCE_HELP_STR | |
13350 | "BGP update groups\n" | |
13351 | "Advertisement queue\n" | |
13352 | "Announced routes\n" | |
13353 | "Packet queue\n") | |
13354 | { | |
13355 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[2], 0); | |
3f9c7369 DS |
13356 | return CMD_SUCCESS; |
13357 | } | |
13358 | ||
13359 | DEFUN (show_ip_bgp_updgrps_adj_s, | |
8fe8a7f6 | 13360 | show_ip_bgp_updgrps_adj_s_cmd, |
3f9c7369 DS |
13361 | "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
13362 | SHOW_STR | |
13363 | IP_STR | |
13364 | BGP_STR | |
13365 | "BGP update groups\n" | |
8fe8a7f6 | 13366 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
13367 | "Advertisement queue\n" |
13368 | "Announced routes\n" | |
13369 | "Packet queue\n") | |
3f9c7369 | 13370 | |
3f9c7369 | 13371 | { |
8fe8a7f6 DS |
13372 | u_int64_t subgrp_id; |
13373 | ||
13374 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
13375 | ||
8386ac43 | 13376 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id); |
13377 | return CMD_SUCCESS; | |
13378 | } | |
13379 | ||
13380 | DEFUN (show_ip_bgp_instance_updgrps_adj_s, | |
13381 | show_ip_bgp_instance_updgrps_adj_s_cmd, | |
13382 | "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13383 | SHOW_STR | |
13384 | IP_STR | |
13385 | BGP_STR | |
13386 | BGP_INSTANCE_HELP_STR | |
13387 | "BGP update groups\n" | |
13388 | "Specific subgroup to display info for\n" | |
13389 | "Advertisement queue\n" | |
13390 | "Announced routes\n" | |
13391 | "Packet queue\n") | |
13392 | ||
13393 | { | |
13394 | u_int64_t subgrp_id; | |
13395 | ||
13396 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13397 | ||
13398 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[3], subgrp_id); | |
3f9c7369 DS |
13399 | return CMD_SUCCESS; |
13400 | } | |
13401 | ||
8fe8a7f6 DS |
13402 | DEFUN (show_bgp_updgrps_afi_adj_s, |
13403 | show_bgp_updgrps_afi_adj_s_cmd, | |
3f9c7369 DS |
13404 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
13405 | SHOW_STR | |
13406 | BGP_STR | |
13407 | "Address family\n" | |
13408 | "Address family\n" | |
13409 | "Address Family modifier\n" | |
13410 | "Address Family modifier\n" | |
13411 | "BGP update groups\n" | |
8fe8a7f6 | 13412 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
13413 | "Advertisement queue\n" |
13414 | "Announced routes\n" | |
8fe8a7f6 DS |
13415 | "Packet queue\n" |
13416 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
13417 | { |
13418 | afi_t afi; | |
13419 | safi_t safi; | |
8fe8a7f6 | 13420 | u_int64_t subgrp_id; |
3f9c7369 DS |
13421 | |
13422 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13423 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8fe8a7f6 DS |
13424 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); |
13425 | ||
8386ac43 | 13426 | show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[3], subgrp_id); |
8fe8a7f6 | 13427 | return CMD_SUCCESS; |
3f9c7369 DS |
13428 | } |
13429 | ||
8fe8a7f6 DS |
13430 | DEFUN (show_bgp_updgrps_adj_s, |
13431 | show_bgp_updgrps_adj_s_cmd, | |
13432 | "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13433 | SHOW_STR | |
13434 | BGP_STR | |
13435 | "BGP update groups\n" | |
13436 | "Specific subgroup to display info for\n" | |
13437 | "Advertisement queue\n" | |
13438 | "Announced routes\n" | |
13439 | "Packet queue\n") | |
13440 | { | |
13441 | u_int64_t subgrp_id; | |
13442 | ||
13443 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
13444 | ||
8386ac43 | 13445 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id); |
8fe8a7f6 DS |
13446 | return CMD_SUCCESS; |
13447 | } | |
13448 | ||
8386ac43 | 13449 | DEFUN (show_bgp_instance_updgrps_adj_s, |
13450 | show_bgp_instance_updgrps_adj_s_cmd, | |
13451 | "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13452 | SHOW_STR | |
13453 | BGP_STR | |
13454 | BGP_INSTANCE_HELP_STR | |
13455 | "BGP update groups\n" | |
13456 | "Specific subgroup to display info for\n" | |
13457 | "Advertisement queue\n" | |
13458 | "Announced routes\n" | |
13459 | "Packet queue\n") | |
13460 | { | |
13461 | u_int64_t subgrp_id; | |
13462 | ||
13463 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13464 | ||
13465 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id); | |
13466 | return CMD_SUCCESS; | |
13467 | } | |
13468 | ||
13469 | ||
8fe8a7f6 | 13470 | |
f14e6fdb DS |
13471 | static int |
13472 | bgp_show_one_peer_group (struct vty *vty, struct peer_group *group) | |
13473 | { | |
13474 | struct listnode *node, *nnode; | |
13475 | struct prefix *range; | |
13476 | struct peer *conf; | |
13477 | struct peer *peer; | |
4690c7d7 | 13478 | char buf[PREFIX2STR_BUFFER]; |
f14e6fdb DS |
13479 | afi_t afi; |
13480 | safi_t safi; | |
ffd0c037 DS |
13481 | const char *peer_status; |
13482 | const char *af_str; | |
f14e6fdb DS |
13483 | int lr_count; |
13484 | int dynamic; | |
13485 | int af_cfgd; | |
13486 | ||
13487 | conf = group->conf; | |
13488 | ||
0299c004 DS |
13489 | if (conf->as_type == AS_SPECIFIED || |
13490 | conf->as_type == AS_EXTERNAL) { | |
66b199b2 | 13491 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
f14e6fdb | 13492 | VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE); |
0299c004 | 13493 | } else if (conf->as_type == AS_INTERNAL) { |
66b199b2 | 13494 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
0299c004 | 13495 | VTY_NEWLINE, group->name, group->bgp->as, VTY_NEWLINE); |
66b199b2 DS |
13496 | } else { |
13497 | vty_out (vty, "%sBGP peer-group %s%s", | |
13498 | VTY_NEWLINE, group->name, VTY_NEWLINE); | |
0299c004 | 13499 | } |
f14e6fdb | 13500 | |
0299c004 | 13501 | if ((group->bgp->as == conf->as) || (conf->as_type == AS_INTERNAL)) |
f14e6fdb DS |
13502 | vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE); |
13503 | else | |
13504 | vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE); | |
13505 | ||
13506 | /* Display AFs configured. */ | |
13507 | vty_out (vty, " Configured address-families:"); | |
13508 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
13509 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
13510 | { | |
13511 | if (conf->afc[afi][safi]) | |
13512 | { | |
13513 | af_cfgd = 1; | |
13514 | vty_out (vty, " %s;", afi_safi_print(afi, safi)); | |
13515 | } | |
13516 | } | |
13517 | if (!af_cfgd) | |
13518 | vty_out (vty, " none%s", VTY_NEWLINE); | |
13519 | else | |
13520 | vty_out (vty, "%s", VTY_NEWLINE); | |
13521 | ||
13522 | /* Display listen ranges (for dynamic neighbors), if any */ | |
13523 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
13524 | { | |
13525 | if (afi == AFI_IP) | |
13526 | af_str = "IPv4"; | |
13527 | else if (afi == AFI_IP6) | |
13528 | af_str = "IPv6"; | |
13529 | lr_count = listcount(group->listen_range[afi]); | |
13530 | if (lr_count) | |
13531 | { | |
13532 | vty_out(vty, | |
13533 | " %d %s listen range(s)%s", | |
13534 | lr_count, af_str, VTY_NEWLINE); | |
13535 | ||
13536 | ||
13537 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node, | |
13538 | nnode, range)) | |
13539 | { | |
13540 | prefix2str(range, buf, sizeof(buf)); | |
13541 | vty_out(vty, " %s%s", buf, VTY_NEWLINE); | |
13542 | } | |
13543 | } | |
13544 | } | |
13545 | ||
13546 | /* Display group members and their status */ | |
13547 | if (listcount(group->peer)) | |
13548 | { | |
13549 | vty_out (vty, " Peer-group members:%s", VTY_NEWLINE); | |
13550 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
13551 | { | |
13552 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
13553 | peer_status = "Idle (Admin)"; | |
13554 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
13555 | peer_status = "Idle (PfxCt)"; | |
13556 | else | |
13557 | peer_status = LOOKUP(bgp_status_msg, peer->status); | |
13558 | ||
13559 | dynamic = peer_dynamic_neighbor(peer); | |
13560 | vty_out (vty, " %s %s %s %s", | |
13561 | peer->host, dynamic ? "(dynamic)" : "", | |
13562 | peer_status, VTY_NEWLINE); | |
13563 | } | |
13564 | } | |
13565 | ||
13566 | return CMD_SUCCESS; | |
13567 | } | |
13568 | ||
13569 | /* Show BGP peer group's information. */ | |
13570 | enum show_group_type | |
13571 | { | |
13572 | show_all_groups, | |
13573 | show_peer_group | |
13574 | }; | |
13575 | ||
13576 | static int | |
13577 | bgp_show_peer_group (struct vty *vty, struct bgp *bgp, | |
13578 | enum show_group_type type, const char *group_name) | |
13579 | { | |
13580 | struct listnode *node, *nnode; | |
13581 | struct peer_group *group; | |
13582 | int find = 0; | |
13583 | ||
13584 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
13585 | { | |
13586 | switch (type) | |
13587 | { | |
13588 | case show_all_groups: | |
13589 | bgp_show_one_peer_group (vty, group); | |
13590 | break; | |
13591 | case show_peer_group: | |
13592 | if (group_name && (strcmp(group->name, group_name) == 0)) | |
13593 | { | |
13594 | find = 1; | |
13595 | bgp_show_one_peer_group (vty, group); | |
13596 | } | |
13597 | break; | |
13598 | } | |
13599 | } | |
13600 | ||
13601 | if (type == show_peer_group && ! find) | |
13602 | vty_out (vty, "%% No such peer-groupr%s", VTY_NEWLINE); | |
13603 | ||
13604 | return CMD_SUCCESS; | |
13605 | } | |
13606 | ||
13607 | static int | |
13608 | bgp_show_peer_group_vty (struct vty *vty, const char *name, | |
13609 | enum show_group_type type, const char *group_name) | |
13610 | { | |
13611 | struct bgp *bgp; | |
13612 | int ret = CMD_SUCCESS; | |
13613 | ||
13614 | if (name) | |
8386ac43 | 13615 | bgp = bgp_lookup_by_name (name); |
13616 | else | |
13617 | bgp = bgp_get_default (); | |
f14e6fdb | 13618 | |
8386ac43 | 13619 | if (! bgp) |
13620 | { | |
13621 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
13622 | return CMD_WARNING; | |
f14e6fdb DS |
13623 | } |
13624 | ||
8386ac43 | 13625 | ret = bgp_show_peer_group (vty, bgp, type, group_name); |
f14e6fdb DS |
13626 | |
13627 | return ret; | |
13628 | } | |
13629 | ||
13630 | DEFUN (show_ip_bgp_peer_groups, | |
13631 | show_ip_bgp_peer_groups_cmd, | |
13632 | "show ip bgp peer-group", | |
13633 | SHOW_STR | |
13634 | IP_STR | |
13635 | BGP_STR | |
13636 | "Detailed information on all BGP peer groups\n") | |
13637 | { | |
13638 | return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL); | |
13639 | } | |
13640 | ||
13641 | DEFUN (show_ip_bgp_instance_peer_groups, | |
13642 | show_ip_bgp_instance_peer_groups_cmd, | |
8386ac43 | 13643 | "show ip bgp " BGP_INSTANCE_CMD " peer-group", |
f14e6fdb DS |
13644 | SHOW_STR |
13645 | IP_STR | |
13646 | BGP_STR | |
8386ac43 | 13647 | BGP_INSTANCE_HELP_STR |
f14e6fdb DS |
13648 | "Detailed information on all BGP peer groups\n") |
13649 | { | |
8386ac43 | 13650 | return bgp_show_peer_group_vty (vty, argv[1], show_all_groups, NULL); |
f14e6fdb DS |
13651 | } |
13652 | ||
13653 | DEFUN (show_ip_bgp_peer_group, | |
13654 | show_ip_bgp_peer_group_cmd, | |
13655 | "show ip bgp peer-group WORD", | |
13656 | SHOW_STR | |
13657 | IP_STR | |
13658 | BGP_STR | |
13659 | "BGP peer-group name\n" | |
13660 | "Detailed information on a BGP peer group\n") | |
13661 | { | |
13662 | return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]); | |
13663 | } | |
13664 | ||
13665 | DEFUN (show_ip_bgp_instance_peer_group, | |
13666 | show_ip_bgp_instance_peer_group_cmd, | |
8386ac43 | 13667 | "show ip bgp " BGP_INSTANCE_CMD " peer-group WORD", |
f14e6fdb DS |
13668 | SHOW_STR |
13669 | IP_STR | |
13670 | BGP_STR | |
8386ac43 | 13671 | BGP_INSTANCE_HELP_STR |
f14e6fdb DS |
13672 | "BGP peer-group name\n" |
13673 | "Detailed information on a BGP peer group\n") | |
13674 | { | |
8386ac43 | 13675 | return bgp_show_peer_group_vty (vty, argv[1], show_peer_group, argv[2]); |
f14e6fdb | 13676 | } |
3f9c7369 | 13677 | |
718e3744 | 13678 | /* Redistribute VTY commands. */ |
13679 | ||
718e3744 | 13680 | DEFUN (bgp_redistribute_ipv4, |
13681 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 13682 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 13683 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13684 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 13685 | { |
13686 | int type; | |
13687 | ||
e0ca5fde DL |
13688 | type = proto_redistnum (AFI_IP, argv[0]); |
13689 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13690 | { |
13691 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13692 | return CMD_WARNING; | |
13693 | } | |
7c8ff89e | 13694 | bgp_redist_add(vty->index, AFI_IP, type, 0); |
6aeb9e78 | 13695 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13696 | } |
13697 | ||
13698 | DEFUN (bgp_redistribute_ipv4_rmap, | |
13699 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 13700 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 13701 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13702 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13703 | "Route map reference\n" |
13704 | "Pointer to route-map entries\n") | |
13705 | { | |
13706 | int type; | |
7c8ff89e | 13707 | struct bgp_redist *red; |
718e3744 | 13708 | |
e0ca5fde DL |
13709 | type = proto_redistnum (AFI_IP, argv[0]); |
13710 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13711 | { |
13712 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13713 | return CMD_WARNING; | |
13714 | } | |
13715 | ||
7c8ff89e DS |
13716 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
13717 | bgp_redistribute_rmap_set (red, argv[1]); | |
6aeb9e78 | 13718 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13719 | } |
13720 | ||
13721 | DEFUN (bgp_redistribute_ipv4_metric, | |
13722 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 13723 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 13724 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13725 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13726 | "Metric for redistributed routes\n" |
13727 | "Default metric\n") | |
13728 | { | |
13729 | int type; | |
13730 | u_int32_t metric; | |
7c8ff89e | 13731 | struct bgp_redist *red; |
718e3744 | 13732 | |
e0ca5fde DL |
13733 | type = proto_redistnum (AFI_IP, argv[0]); |
13734 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13735 | { |
13736 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13737 | return CMD_WARNING; | |
13738 | } | |
13739 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
13740 | ||
7c8ff89e | 13741 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 13742 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
6aeb9e78 | 13743 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13744 | } |
13745 | ||
13746 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
13747 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 13748 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 13749 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13750 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13751 | "Route map reference\n" |
13752 | "Pointer to route-map entries\n" | |
13753 | "Metric for redistributed routes\n" | |
13754 | "Default metric\n") | |
13755 | { | |
13756 | int type; | |
13757 | u_int32_t metric; | |
7c8ff89e | 13758 | struct bgp_redist *red; |
718e3744 | 13759 | |
e0ca5fde DL |
13760 | type = proto_redistnum (AFI_IP, argv[0]); |
13761 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13762 | { |
13763 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13764 | return CMD_WARNING; | |
13765 | } | |
13766 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13767 | ||
7c8ff89e DS |
13768 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
13769 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 13770 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
6aeb9e78 | 13771 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13772 | } |
13773 | ||
13774 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
13775 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 13776 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 13777 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13778 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13779 | "Metric for redistributed routes\n" |
13780 | "Default metric\n" | |
13781 | "Route map reference\n" | |
13782 | "Pointer to route-map entries\n") | |
13783 | { | |
13784 | int type; | |
13785 | u_int32_t metric; | |
7c8ff89e | 13786 | struct bgp_redist *red; |
718e3744 | 13787 | |
e0ca5fde DL |
13788 | type = proto_redistnum (AFI_IP, argv[0]); |
13789 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13790 | { |
13791 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13792 | return CMD_WARNING; | |
13793 | } | |
13794 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
13795 | ||
7c8ff89e | 13796 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 13797 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
7c8ff89e | 13798 | bgp_redistribute_rmap_set (red, argv[2]); |
6aeb9e78 | 13799 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13800 | } |
13801 | ||
7c8ff89e DS |
13802 | DEFUN (bgp_redistribute_ipv4_ospf, |
13803 | bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 13804 | "redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
13805 | "Redistribute information from another routing protocol\n" |
13806 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13807 | "Non-main Kernel Routing Table\n" |
13808 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
13809 | { |
13810 | u_short instance; | |
7a4bb9c5 | 13811 | u_short protocol; |
7c8ff89e | 13812 | |
7a4bb9c5 DS |
13813 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13814 | ||
13815 | if (strncmp(argv[0], "o", 1) == 0) | |
13816 | protocol = ZEBRA_ROUTE_OSPF; | |
13817 | else | |
13818 | protocol = ZEBRA_ROUTE_TABLE; | |
13819 | ||
13820 | bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
6aeb9e78 | 13821 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13822 | } |
13823 | ||
13824 | DEFUN (bgp_redistribute_ipv4_ospf_rmap, | |
13825 | bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 13826 | "redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
13827 | "Redistribute information from another routing protocol\n" |
13828 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13829 | "Non-main Kernel Routing Table\n" |
13830 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13831 | "Route map reference\n" |
13832 | "Pointer to route-map entries\n") | |
13833 | { | |
13834 | struct bgp_redist *red; | |
13835 | u_short instance; | |
7a4bb9c5 | 13836 | int protocol; |
7c8ff89e | 13837 | |
7a4bb9c5 DS |
13838 | if (strncmp(argv[0], "o", 1) == 0) |
13839 | protocol = ZEBRA_ROUTE_OSPF; | |
13840 | else | |
13841 | protocol = ZEBRA_ROUTE_TABLE; | |
13842 | ||
13843 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); | |
13844 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
13845 | bgp_redistribute_rmap_set (red, argv[2]); | |
6aeb9e78 | 13846 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13847 | } |
13848 | ||
13849 | DEFUN (bgp_redistribute_ipv4_ospf_metric, | |
13850 | bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 13851 | "redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
13852 | "Redistribute information from another routing protocol\n" |
13853 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13854 | "Non-main Kernel Routing Table\n" |
13855 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13856 | "Metric for redistributed routes\n" |
13857 | "Default metric\n") | |
13858 | { | |
13859 | u_int32_t metric; | |
13860 | struct bgp_redist *red; | |
13861 | u_short instance; | |
7a4bb9c5 | 13862 | int protocol; |
7c8ff89e | 13863 | |
7a4bb9c5 DS |
13864 | if (strncmp(argv[0], "o", 1) == 0) |
13865 | protocol = ZEBRA_ROUTE_OSPF; | |
13866 | else | |
13867 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13868 | |
7a4bb9c5 DS |
13869 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13870 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13871 | ||
13872 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 13873 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
6aeb9e78 | 13874 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13875 | } |
13876 | ||
13877 | DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, | |
13878 | bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 13879 | "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
13880 | "Redistribute information from another routing protocol\n" |
13881 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13882 | "Non-main Kernel Routing Table\n" |
13883 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13884 | "Route map reference\n" |
13885 | "Pointer to route-map entries\n" | |
13886 | "Metric for redistributed routes\n" | |
13887 | "Default metric\n") | |
13888 | { | |
13889 | u_int32_t metric; | |
13890 | struct bgp_redist *red; | |
13891 | u_short instance; | |
7a4bb9c5 | 13892 | int protocol; |
7c8ff89e | 13893 | |
7a4bb9c5 DS |
13894 | if (strncmp(argv[0], "o", 1) == 0) |
13895 | protocol = ZEBRA_ROUTE_OSPF; | |
13896 | else | |
13897 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13898 | |
7a4bb9c5 DS |
13899 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13900 | VTY_GET_INTEGER ("metric", metric, argv[3]); | |
13901 | ||
13902 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
13903 | bgp_redistribute_rmap_set (red, argv[2]); | |
caf958b4 | 13904 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
6aeb9e78 | 13905 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13906 | } |
13907 | ||
13908 | DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, | |
13909 | bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 13910 | "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
13911 | "Redistribute information from another routing protocol\n" |
13912 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13913 | "Non-main Kernel Routing Table\n" |
13914 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13915 | "Metric for redistributed routes\n" |
13916 | "Default metric\n" | |
13917 | "Route map reference\n" | |
13918 | "Pointer to route-map entries\n") | |
13919 | { | |
13920 | u_int32_t metric; | |
13921 | struct bgp_redist *red; | |
13922 | u_short instance; | |
7a4bb9c5 | 13923 | int protocol; |
7c8ff89e | 13924 | |
7a4bb9c5 DS |
13925 | if (strncmp(argv[0], "o", 1) == 0) |
13926 | protocol = ZEBRA_ROUTE_OSPF; | |
13927 | else | |
13928 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13929 | |
7a4bb9c5 DS |
13930 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13931 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13932 | ||
13933 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 13934 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
7a4bb9c5 | 13935 | bgp_redistribute_rmap_set (red, argv[3]); |
6aeb9e78 | 13936 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13937 | } |
13938 | ||
13939 | DEFUN (no_bgp_redistribute_ipv4_ospf, | |
13940 | no_bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 13941 | "no redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
13942 | NO_STR |
13943 | "Redistribute information from another routing protocol\n" | |
13944 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13945 | "Non-main Kernel Routing Table\n" |
13946 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
13947 | { |
13948 | u_short instance; | |
7a4bb9c5 DS |
13949 | int protocol; |
13950 | ||
13951 | if (strncmp(argv[0], "o", 1) == 0) | |
13952 | protocol = ZEBRA_ROUTE_OSPF; | |
13953 | else | |
13954 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13955 | |
7a4bb9c5 DS |
13956 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13957 | return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); | |
7c8ff89e DS |
13958 | } |
13959 | ||
13960 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13961 | no_bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 13962 | "no redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
13963 | NO_STR |
13964 | "Redistribute information from another routing protocol\n" | |
13965 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13966 | "Non-main Kernel Routing Table\n" |
13967 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13968 | "Route map reference\n" |
13969 | "Pointer to route-map entries\n") | |
13970 | ||
13971 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13972 | no_bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 13973 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
13974 | NO_STR |
13975 | "Redistribute information from another routing protocol\n" | |
13976 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13977 | "Non-main Kernel Routing Table\n" |
13978 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13979 | "Metric for redistributed routes\n" |
13980 | "Default metric\n") | |
13981 | ||
13982 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13983 | no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 13984 | "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
13985 | NO_STR |
13986 | "Redistribute information from another routing protocol\n" | |
13987 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13988 | "Non-main Kernel Routing Table\n" |
13989 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13990 | "Route map reference\n" |
13991 | "Pointer to route-map entries\n" | |
13992 | "Metric for redistributed routes\n" | |
13993 | "Default metric\n") | |
13994 | ||
13995 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13996 | no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 13997 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
13998 | NO_STR |
13999 | "Redistribute information from another routing protocol\n" | |
14000 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
14001 | "Non-main Kernel Routing Table\n" |
14002 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
14003 | "Metric for redistributed routes\n" |
14004 | "Default metric\n" | |
14005 | "Route map reference\n" | |
14006 | "Pointer to route-map entries\n") | |
14007 | ||
718e3744 | 14008 | DEFUN (no_bgp_redistribute_ipv4, |
14009 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 14010 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 14011 | NO_STR |
14012 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14013 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 14014 | { |
14015 | int type; | |
14016 | ||
e0ca5fde DL |
14017 | type = proto_redistnum (AFI_IP, argv[0]); |
14018 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14019 | { |
14020 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14021 | return CMD_WARNING; | |
14022 | } | |
7c8ff89e | 14023 | return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); |
718e3744 | 14024 | } |
14025 | ||
503006bc | 14026 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 14027 | no_bgp_redistribute_ipv4_rmap_cmd, |
e0ca5fde | 14028 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 14029 | NO_STR |
14030 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14031 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 14032 | "Route map reference\n" |
14033 | "Pointer to route-map entries\n") | |
718e3744 | 14034 | |
503006bc | 14035 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 14036 | no_bgp_redistribute_ipv4_metric_cmd, |
e0ca5fde | 14037 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 14038 | NO_STR |
14039 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14040 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 14041 | "Metric for redistributed routes\n" |
14042 | "Default metric\n") | |
718e3744 | 14043 | |
503006bc | 14044 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 14045 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
e0ca5fde | 14046 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 14047 | NO_STR |
14048 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14049 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 14050 | "Route map reference\n" |
14051 | "Pointer to route-map entries\n" | |
14052 | "Metric for redistributed routes\n" | |
14053 | "Default metric\n") | |
718e3744 | 14054 | |
503006bc | 14055 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 14056 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
e0ca5fde | 14057 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 14058 | NO_STR |
14059 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14060 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 14061 | "Metric for redistributed routes\n" |
14062 | "Default metric\n" | |
14063 | "Route map reference\n" | |
14064 | "Pointer to route-map entries\n") | |
6b0655a2 | 14065 | |
718e3744 | 14066 | #ifdef HAVE_IPV6 |
14067 | DEFUN (bgp_redistribute_ipv6, | |
14068 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 14069 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 14070 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14071 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 14072 | { |
14073 | int type; | |
14074 | ||
e0ca5fde DL |
14075 | type = proto_redistnum (AFI_IP6, argv[0]); |
14076 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14077 | { |
14078 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14079 | return CMD_WARNING; | |
14080 | } | |
14081 | ||
7c8ff89e | 14082 | bgp_redist_add(vty->index, AFI_IP6, type, 0); |
6aeb9e78 | 14083 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14084 | } |
14085 | ||
14086 | DEFUN (bgp_redistribute_ipv6_rmap, | |
14087 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 14088 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 14089 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14090 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14091 | "Route map reference\n" |
14092 | "Pointer to route-map entries\n") | |
14093 | { | |
14094 | int type; | |
7c8ff89e | 14095 | struct bgp_redist *red; |
718e3744 | 14096 | |
e0ca5fde DL |
14097 | type = proto_redistnum (AFI_IP6, argv[0]); |
14098 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14099 | { |
14100 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14101 | return CMD_WARNING; | |
14102 | } | |
14103 | ||
7c8ff89e DS |
14104 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
14105 | bgp_redistribute_rmap_set (red, argv[1]); | |
6aeb9e78 | 14106 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14107 | } |
14108 | ||
14109 | DEFUN (bgp_redistribute_ipv6_metric, | |
14110 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 14111 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 14112 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14113 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14114 | "Metric for redistributed routes\n" |
14115 | "Default metric\n") | |
14116 | { | |
14117 | int type; | |
14118 | u_int32_t metric; | |
7c8ff89e | 14119 | struct bgp_redist *red; |
718e3744 | 14120 | |
e0ca5fde DL |
14121 | type = proto_redistnum (AFI_IP6, argv[0]); |
14122 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14123 | { |
14124 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14125 | return CMD_WARNING; | |
14126 | } | |
14127 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
14128 | ||
7c8ff89e | 14129 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 14130 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
6aeb9e78 | 14131 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14132 | } |
14133 | ||
14134 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
14135 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 14136 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 14137 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14138 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14139 | "Route map reference\n" |
14140 | "Pointer to route-map entries\n" | |
14141 | "Metric for redistributed routes\n" | |
14142 | "Default metric\n") | |
14143 | { | |
14144 | int type; | |
14145 | u_int32_t metric; | |
7c8ff89e | 14146 | struct bgp_redist *red; |
718e3744 | 14147 | |
e0ca5fde DL |
14148 | type = proto_redistnum (AFI_IP6, argv[0]); |
14149 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14150 | { |
14151 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14152 | return CMD_WARNING; | |
14153 | } | |
14154 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
14155 | ||
7c8ff89e DS |
14156 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
14157 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 14158 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
6aeb9e78 | 14159 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14160 | } |
14161 | ||
14162 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
14163 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 14164 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 14165 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14166 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14167 | "Metric for redistributed routes\n" |
14168 | "Default metric\n" | |
14169 | "Route map reference\n" | |
14170 | "Pointer to route-map entries\n") | |
14171 | { | |
14172 | int type; | |
14173 | u_int32_t metric; | |
7c8ff89e | 14174 | struct bgp_redist *red; |
718e3744 | 14175 | |
e0ca5fde DL |
14176 | type = proto_redistnum (AFI_IP6, argv[0]); |
14177 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14178 | { |
14179 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14180 | return CMD_WARNING; | |
14181 | } | |
14182 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
14183 | ||
7c8ff89e | 14184 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 14185 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric); |
7c8ff89e | 14186 | bgp_redistribute_rmap_set (red, argv[2]); |
6aeb9e78 | 14187 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14188 | } |
14189 | ||
14190 | DEFUN (no_bgp_redistribute_ipv6, | |
14191 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 14192 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 14193 | NO_STR |
14194 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14195 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 14196 | { |
14197 | int type; | |
14198 | ||
e0ca5fde DL |
14199 | type = proto_redistnum (AFI_IP6, argv[0]); |
14200 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14201 | { |
14202 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14203 | return CMD_WARNING; | |
14204 | } | |
14205 | ||
7c8ff89e | 14206 | return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0); |
718e3744 | 14207 | } |
14208 | ||
503006bc | 14209 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14210 | no_bgp_redistribute_ipv6_rmap_cmd, |
e0ca5fde | 14211 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 14212 | NO_STR |
14213 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14214 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14215 | "Route map reference\n" |
14216 | "Pointer to route-map entries\n") | |
718e3744 | 14217 | |
503006bc | 14218 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14219 | no_bgp_redistribute_ipv6_metric_cmd, |
e0ca5fde | 14220 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 14221 | NO_STR |
14222 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14223 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14224 | "Metric for redistributed routes\n" |
14225 | "Default metric\n") | |
718e3744 | 14226 | |
503006bc | 14227 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14228 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
e0ca5fde | 14229 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 14230 | NO_STR |
14231 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14232 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14233 | "Route map reference\n" |
14234 | "Pointer to route-map entries\n" | |
14235 | "Metric for redistributed routes\n" | |
14236 | "Default metric\n") | |
718e3744 | 14237 | |
503006bc | 14238 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14239 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
e0ca5fde | 14240 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 14241 | NO_STR |
14242 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14243 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14244 | "Metric for redistributed routes\n" |
14245 | "Default metric\n" | |
14246 | "Route map reference\n" | |
14247 | "Pointer to route-map entries\n") | |
14248 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 14249 | |
718e3744 | 14250 | int |
14251 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
14252 | safi_t safi, int *write) | |
14253 | { | |
14254 | int i; | |
718e3744 | 14255 | |
14256 | /* Unicast redistribution only. */ | |
14257 | if (safi != SAFI_UNICAST) | |
14258 | return 0; | |
14259 | ||
14260 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
14261 | { | |
14262 | /* Redistribute BGP does not make sense. */ | |
7c8ff89e | 14263 | if (i != ZEBRA_ROUTE_BGP) |
718e3744 | 14264 | { |
7c8ff89e DS |
14265 | struct list *red_list; |
14266 | struct listnode *node; | |
14267 | struct bgp_redist *red; | |
718e3744 | 14268 | |
7c8ff89e DS |
14269 | red_list = bgp->redist[afi][i]; |
14270 | if (!red_list) | |
14271 | continue; | |
718e3744 | 14272 | |
7c8ff89e DS |
14273 | for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) |
14274 | { | |
14275 | /* Display "address-family" when it is not yet diplayed. */ | |
14276 | bgp_config_write_family_header (vty, afi, safi, write); | |
14277 | ||
14278 | /* "redistribute" configuration. */ | |
0b960b4d | 14279 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
7c8ff89e DS |
14280 | if (red->instance) |
14281 | vty_out (vty, " %d", red->instance); | |
14282 | if (red->redist_metric_flag) | |
14283 | vty_out (vty, " metric %u", red->redist_metric); | |
14284 | if (red->rmap.name) | |
14285 | vty_out (vty, " route-map %s", red->rmap.name); | |
14286 | vty_out (vty, "%s", VTY_NEWLINE); | |
14287 | } | |
718e3744 | 14288 | } |
14289 | } | |
14290 | return *write; | |
14291 | } | |
6b0655a2 | 14292 | |
718e3744 | 14293 | /* BGP node structure. */ |
7fc626de | 14294 | static struct cmd_node bgp_node = |
718e3744 | 14295 | { |
14296 | BGP_NODE, | |
14297 | "%s(config-router)# ", | |
14298 | 1, | |
14299 | }; | |
14300 | ||
7fc626de | 14301 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 14302 | { |
14303 | BGP_IPV4_NODE, | |
14304 | "%s(config-router-af)# ", | |
14305 | 1, | |
14306 | }; | |
14307 | ||
7fc626de | 14308 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 14309 | { |
14310 | BGP_IPV4M_NODE, | |
14311 | "%s(config-router-af)# ", | |
14312 | 1, | |
14313 | }; | |
14314 | ||
7fc626de | 14315 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 14316 | { |
14317 | BGP_IPV6_NODE, | |
14318 | "%s(config-router-af)# ", | |
14319 | 1, | |
14320 | }; | |
14321 | ||
7fc626de | 14322 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 14323 | { |
14324 | BGP_IPV6M_NODE, | |
14325 | "%s(config-router-af)# ", | |
14326 | 1, | |
14327 | }; | |
14328 | ||
7fc626de | 14329 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 14330 | { |
14331 | BGP_VPNV4_NODE, | |
14332 | "%s(config-router-af)# ", | |
14333 | 1 | |
14334 | }; | |
6b0655a2 | 14335 | |
8ecd3266 | 14336 | static struct cmd_node bgp_vpnv6_node = |
14337 | { | |
14338 | BGP_VPNV6_NODE, | |
14339 | "%s(config-router-af-vpnv6)# ", | |
14340 | 1 | |
14341 | }; | |
14342 | ||
8b1fb8be LB |
14343 | static struct cmd_node bgp_encap_node = |
14344 | { | |
14345 | BGP_ENCAP_NODE, | |
14346 | "%s(config-router-af-encap)# ", | |
14347 | 1 | |
14348 | }; | |
14349 | ||
14350 | static struct cmd_node bgp_encapv6_node = | |
14351 | { | |
14352 | BGP_ENCAPV6_NODE, | |
14353 | "%s(config-router-af-encapv6)# ", | |
14354 | 1 | |
14355 | }; | |
14356 | ||
1f8ae70b | 14357 | static void community_list_vty (void); |
14358 | ||
718e3744 | 14359 | void |
94f2b392 | 14360 | bgp_vty_init (void) |
718e3744 | 14361 | { |
718e3744 | 14362 | /* Install bgp top node. */ |
14363 | install_node (&bgp_node, bgp_config_write); | |
14364 | install_node (&bgp_ipv4_unicast_node, NULL); | |
14365 | install_node (&bgp_ipv4_multicast_node, NULL); | |
14366 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 14367 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 14368 | install_node (&bgp_vpnv4_node, NULL); |
8ecd3266 | 14369 | install_node (&bgp_vpnv6_node, NULL); |
8b1fb8be LB |
14370 | install_node (&bgp_encap_node, NULL); |
14371 | install_node (&bgp_encapv6_node, NULL); | |
718e3744 | 14372 | |
14373 | /* Install default VTY commands to new nodes. */ | |
14374 | install_default (BGP_NODE); | |
14375 | install_default (BGP_IPV4_NODE); | |
14376 | install_default (BGP_IPV4M_NODE); | |
14377 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 14378 | install_default (BGP_IPV6M_NODE); |
718e3744 | 14379 | install_default (BGP_VPNV4_NODE); |
8ecd3266 | 14380 | install_default (BGP_VPNV6_NODE); |
8b1fb8be LB |
14381 | install_default (BGP_ENCAP_NODE); |
14382 | install_default (BGP_ENCAPV6_NODE); | |
718e3744 | 14383 | |
14384 | /* "bgp multiple-instance" commands. */ | |
14385 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
14386 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
14387 | ||
14388 | /* "bgp config-type" commands. */ | |
14389 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
813d4307 | 14390 | install_element (CONFIG_NODE, &no_bgp_config_type_val_cmd); |
718e3744 | 14391 | |
5fe9f963 | 14392 | /* bgp route-map delay-timer commands. */ |
14393 | install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd); | |
14394 | install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
14395 | install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); | |
14396 | ||
718e3744 | 14397 | /* Dummy commands (Currently not supported) */ |
14398 | install_element (BGP_NODE, &no_synchronization_cmd); | |
14399 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
14400 | ||
14401 | /* "router bgp" commands. */ | |
14402 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
6aeb9e78 | 14403 | install_element (CONFIG_NODE, &router_bgp_instance_cmd); |
2385a876 | 14404 | install_element (CONFIG_NODE, &router_bgp_noasn_cmd); |
718e3744 | 14405 | |
14406 | /* "no router bgp" commands. */ | |
14407 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
6aeb9e78 | 14408 | install_element (CONFIG_NODE, &no_router_bgp_instance_cmd); |
7fb21a9f | 14409 | install_element (CONFIG_NODE, &no_router_bgp_noasn_cmd); |
718e3744 | 14410 | |
14411 | /* "bgp router-id" commands. */ | |
14412 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
14413 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
14414 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
14415 | ||
14416 | /* "bgp cluster-id" commands. */ | |
14417 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
14418 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
14419 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
813d4307 DW |
14420 | install_element (BGP_NODE, &no_bgp_cluster_id_ip_cmd); |
14421 | install_element (BGP_NODE, &no_bgp_cluster_id_decimal_cmd); | |
718e3744 | 14422 | |
14423 | /* "bgp confederation" commands. */ | |
14424 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
14425 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
14426 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
14427 | ||
14428 | /* "bgp confederation peers" commands. */ | |
14429 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
14430 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
14431 | ||
abc920f8 DS |
14432 | /* bgp max-med command */ |
14433 | install_element (BGP_NODE, &bgp_maxmed_admin_cmd); | |
14434 | install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd); | |
14435 | install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); | |
14436 | install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd); | |
14437 | install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); | |
14438 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); | |
14439 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd); | |
14440 | install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); | |
14441 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd); | |
14442 | ||
907f92c8 DS |
14443 | /* bgp disable-ebgp-connected-nh-check */ |
14444 | install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd); | |
14445 | install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd); | |
14446 | ||
f188f2c4 DS |
14447 | /* bgp update-delay command */ |
14448 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
14449 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
14450 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
14451 | install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); | |
14452 | ||
cb1faec9 DS |
14453 | install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); |
14454 | install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); | |
14455 | ||
3f9c7369 DS |
14456 | install_element (BGP_NODE, &bgp_coalesce_time_cmd); |
14457 | install_element (BGP_NODE, &no_bgp_coalesce_time_cmd); | |
14458 | ||
165b5fff JB |
14459 | /* "maximum-paths" commands. */ |
14460 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
14461 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
14462 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); | |
14463 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); | |
14464 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
14465 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); | |
431aa9f9 DS |
14466 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
14467 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
14468 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); | |
165b5fff | 14469 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14470 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff JB |
14471 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
14472 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 14473 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14474 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14475 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14476 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14477 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14478 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
431aa9f9 | 14479 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14480 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 DS |
14481 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
14482 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 14483 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14484 | |
718e3744 | 14485 | /* "timers bgp" commands. */ |
14486 | install_element (BGP_NODE, &bgp_timers_cmd); | |
14487 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
14488 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
14489 | ||
5fe9f963 | 14490 | /* route-map delay-timer commands - per instance for backwards compat. */ |
518f0eb1 DS |
14491 | install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd); |
14492 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
f414725f | 14493 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); |
518f0eb1 | 14494 | |
718e3744 | 14495 | /* "bgp client-to-client reflection" commands */ |
14496 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
14497 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
14498 | ||
14499 | /* "bgp always-compare-med" commands */ | |
14500 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
14501 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
14502 | ||
14503 | /* "bgp deterministic-med" commands */ | |
14504 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
14505 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 14506 | |
538621f2 | 14507 | /* "bgp graceful-restart" commands */ |
14508 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
14509 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 14510 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
14511 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
14512 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 14513 | |
14514 | /* "bgp fast-external-failover" commands */ | |
14515 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
14516 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
14517 | ||
14518 | /* "bgp enforce-first-as" commands */ | |
14519 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
14520 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
14521 | ||
14522 | /* "bgp bestpath compare-routerid" commands */ | |
14523 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
14524 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
14525 | ||
14526 | /* "bgp bestpath as-path ignore" commands */ | |
14527 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
14528 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
14529 | ||
6811845b | 14530 | /* "bgp bestpath as-path confed" commands */ |
14531 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
14532 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
14533 | ||
2fdd455c PM |
14534 | /* "bgp bestpath as-path multipath-relax" commands */ |
14535 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
14536 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
14537 | ||
848973c7 | 14538 | /* "bgp log-neighbor-changes" commands */ |
14539 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
14540 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
14541 | ||
718e3744 | 14542 | /* "bgp bestpath med" commands */ |
14543 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
14544 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
14545 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
14546 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
14547 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
14548 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
14549 | ||
14550 | /* "no bgp default ipv4-unicast" commands. */ | |
14551 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
14552 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
14553 | ||
14554 | /* "bgp network import-check" commands. */ | |
14555 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
8233ef81 | 14556 | install_element (BGP_NODE, &bgp_network_import_check_exact_cmd); |
718e3744 | 14557 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
14558 | ||
14559 | /* "bgp default local-preference" commands. */ | |
14560 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
14561 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
14562 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
14563 | ||
04b6bdc0 DW |
14564 | /* bgp default show-hostname */ |
14565 | install_element (BGP_NODE, &bgp_default_show_hostname_cmd); | |
14566 | install_element (BGP_NODE, &no_bgp_default_show_hostname_cmd); | |
14567 | ||
3f9c7369 DS |
14568 | /* "bgp default subgroup-pkt-queue-max" commands. */ |
14569 | install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd); | |
14570 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd); | |
813d4307 | 14571 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_val_cmd); |
3f9c7369 | 14572 | |
8bd9d948 DS |
14573 | /* bgp ibgp-allow-policy-mods command */ |
14574 | install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd); | |
14575 | install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd); | |
14576 | ||
f14e6fdb DS |
14577 | /* "bgp listen limit" commands. */ |
14578 | install_element (BGP_NODE, &bgp_listen_limit_cmd); | |
14579 | install_element (BGP_NODE, &no_bgp_listen_limit_cmd); | |
813d4307 | 14580 | install_element (BGP_NODE, &no_bgp_listen_limit_val_cmd); |
f14e6fdb DS |
14581 | |
14582 | /* "bgp listen range" commands. */ | |
14583 | install_element (BGP_NODE, &bgp_listen_range_cmd); | |
14584 | install_element (BGP_NODE, &no_bgp_listen_range_cmd); | |
14585 | ||
718e3744 | 14586 | /* "neighbor remote-as" commands. */ |
14587 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
a80beece | 14588 | install_element (BGP_NODE, &neighbor_interface_config_cmd); |
4c48cf63 DW |
14589 | install_element (BGP_NODE, &neighbor_interface_config_v6only_cmd); |
14590 | install_element (BGP_NODE, &neighbor_interface_config_peergroup_cmd); | |
14591 | install_element (BGP_NODE, &neighbor_interface_config_v6only_peergroup_cmd); | |
b3a39dc5 DD |
14592 | install_element (BGP_NODE, &neighbor_interface_config_remote_as_cmd); |
14593 | install_element (BGP_NODE, &neighbor_interface_v6only_config_remote_as_cmd); | |
718e3744 | 14594 | install_element (BGP_NODE, &no_neighbor_cmd); |
14595 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
a80beece | 14596 | install_element (BGP_NODE, &no_neighbor_interface_config_cmd); |
4c48cf63 DW |
14597 | install_element (BGP_NODE, &no_neighbor_interface_config_v6only_cmd); |
14598 | install_element (BGP_NODE, &no_neighbor_interface_config_peergroup_cmd); | |
14599 | install_element (BGP_NODE, &no_neighbor_interface_config_v6only_peergroup_cmd); | |
b3a39dc5 DD |
14600 | install_element (BGP_NODE, &no_neighbor_interface_config_remote_as_cmd); |
14601 | install_element (BGP_NODE, &no_neighbor_interface_config_v6only_remote_as_cmd); | |
718e3744 | 14602 | |
14603 | /* "neighbor peer-group" commands. */ | |
14604 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
14605 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
a80beece | 14606 | install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd); |
718e3744 | 14607 | |
14608 | /* "neighbor local-as" commands. */ | |
14609 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
14610 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 14611 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 14612 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
14613 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
14614 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
9d3f9705 | 14615 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
718e3744 | 14616 | |
3f9c7369 DS |
14617 | /* "neighbor solo" commands. */ |
14618 | install_element (BGP_NODE, &neighbor_solo_cmd); | |
14619 | install_element (BGP_NODE, &no_neighbor_solo_cmd); | |
14620 | ||
0df7c91f PJ |
14621 | /* "neighbor password" commands. */ |
14622 | install_element (BGP_NODE, &neighbor_password_cmd); | |
14623 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
813d4307 | 14624 | install_element (BGP_NODE, &no_neighbor_password_val_cmd); |
0df7c91f | 14625 | |
718e3744 | 14626 | /* "neighbor activate" commands. */ |
14627 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
14628 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
14629 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
14630 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 14631 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 14632 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
8ecd3266 | 14633 | install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd); |
8b1fb8be LB |
14634 | install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd); |
14635 | install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd); | |
718e3744 | 14636 | |
14637 | /* "no neighbor activate" commands. */ | |
14638 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
14639 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
14640 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
14641 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 14642 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 14643 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
8ecd3266 | 14644 | install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd); |
8b1fb8be LB |
14645 | install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd); |
14646 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd); | |
718e3744 | 14647 | |
c8560b44 DW |
14648 | /* "neighbor peer-group" set commands. |
14649 | * Long term we should only accept this command under BGP_NODE and not all of | |
14650 | * the afi/safi sub-contexts. For now though we need to accept it for backwards | |
14651 | * compatibility. This changed when we stopped requiring that peers be assigned | |
14652 | * to their peer-group under each address-family sub-context. | |
14653 | */ | |
718e3744 | 14654 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
14655 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
14656 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
14657 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 14658 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 14659 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
8ecd3266 | 14660 | install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd); |
8b1fb8be LB |
14661 | install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd); |
14662 | install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd); | |
c8560b44 | 14663 | |
718e3744 | 14664 | /* "no neighbor peer-group unset" commands. */ |
14665 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
14666 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
14667 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
14668 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 14669 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 14670 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
8ecd3266 | 14671 | install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd); |
8b1fb8be LB |
14672 | install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd); |
14673 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
a58545bb | 14674 | |
718e3744 | 14675 | /* "neighbor softreconfiguration inbound" commands.*/ |
14676 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
14677 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14678 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
14679 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14680 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
14681 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14682 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
14683 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 14684 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
14685 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 14686 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
14687 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8ecd3266 | 14688 | install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd); |
14689 | install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8b1fb8be LB |
14690 | install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd); |
14691 | install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14692 | install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
14693 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 14694 | |
14695 | /* "neighbor attribute-unchanged" commands. */ | |
14696 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
14697 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
14698 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
14699 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
14700 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
14701 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
14702 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
14703 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
14704 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
14705 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
14706 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
14707 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
14708 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14709 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14710 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14711 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14712 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14713 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14714 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14715 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14716 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14717 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14718 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
14719 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
14720 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
14721 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
14722 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
14723 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
14724 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
14725 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
14726 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
14727 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
14728 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
14729 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
14730 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14731 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14732 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14733 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14734 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14735 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14736 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14737 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14738 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14739 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14740 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
14741 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
14742 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
14743 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
14744 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
14745 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
14746 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
14747 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
14748 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
14749 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
14750 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
14751 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
14752 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14753 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14754 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14755 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14756 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14757 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14758 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14759 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14760 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14761 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14762 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
14763 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14764 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14765 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14766 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
14767 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
14768 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
14769 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
14770 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
14771 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
14772 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
14773 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
14774 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14775 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14776 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14777 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14778 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14779 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14780 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14781 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14782 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14783 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 14784 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
14785 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
14786 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
14787 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
14788 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
14789 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
14790 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
14791 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
14792 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
14793 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
14794 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
14795 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
14796 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14797 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14798 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14799 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14800 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14801 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14802 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14803 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14804 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14805 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 14806 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
14807 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
14808 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
14809 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
14810 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
14811 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
14812 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
14813 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
14814 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
14815 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
14816 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
14817 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
14818 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14819 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14820 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14821 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14822 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14823 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14824 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14825 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14826 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14827 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
8ecd3266 | 14828 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd); |
14829 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14830 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14831 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14832 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd); | |
14833 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd); | |
14834 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd); | |
14835 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd); | |
14836 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd); | |
14837 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd); | |
14838 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd); | |
14839 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
14840 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14841 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14842 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14843 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14844 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14845 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14846 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14847 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14848 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14849 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14850 | ||
8b1fb8be LB |
14851 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd); |
14852 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd); | |
14853 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd); | |
14854 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd); | |
14855 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd); | |
14856 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd); | |
14857 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd); | |
14858 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd); | |
14859 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd); | |
14860 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd); | |
14861 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd); | |
14862 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd); | |
14863 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14864 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14865 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14866 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14867 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14868 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14869 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14870 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14871 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14872 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14873 | ||
14874 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd); | |
14875 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14876 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14877 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14878 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
14879 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
14880 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
14881 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
14882 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
14883 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
14884 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
14885 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
14886 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14887 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14888 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14889 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14890 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14891 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14892 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14893 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14894 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14895 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 14896 | |
fee0f4c6 | 14897 | /* "nexthop-local unchanged" commands */ |
14898 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
14899 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
14900 | ||
718e3744 | 14901 | /* "neighbor next-hop-self" commands. */ |
14902 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
14903 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
14904 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
14905 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
14906 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
14907 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
14908 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
14909 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 14910 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
14911 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 14912 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
14913 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
8ecd3266 | 14914 | install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd); |
14915 | install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd); | |
8b1fb8be LB |
14916 | install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd); |
14917 | install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd); | |
14918 | install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd); | |
14919 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 14920 | |
a538debe DS |
14921 | /* "neighbor next-hop-self force" commands. */ |
14922 | install_element (BGP_NODE, &neighbor_nexthop_self_force_cmd); | |
14923 | install_element (BGP_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14924 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd); | |
14925 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14926 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd); | |
14927 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14928 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd); | |
14929 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14930 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd); | |
14931 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14932 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd); | |
14933 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
8ecd3266 | 14934 | install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_force_cmd); |
14935 | install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
a538debe | 14936 | |
c7122e14 DS |
14937 | /* "neighbor as-override" commands. */ |
14938 | install_element (BGP_NODE, &neighbor_as_override_cmd); | |
14939 | install_element (BGP_NODE, &no_neighbor_as_override_cmd); | |
14940 | install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd); | |
14941 | install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd); | |
14942 | install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd); | |
14943 | install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd); | |
14944 | install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd); | |
14945 | install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd); | |
14946 | install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd); | |
14947 | install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd); | |
14948 | install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd); | |
14949 | install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd); | |
8ecd3266 | 14950 | install_element (BGP_VPNV6_NODE, &neighbor_as_override_cmd); |
14951 | install_element (BGP_VPNV6_NODE, &no_neighbor_as_override_cmd); | |
c7122e14 | 14952 | |
718e3744 | 14953 | /* "neighbor remove-private-AS" commands. */ |
14954 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
14955 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14956 | install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd); |
14957 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14958 | install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14959 | install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14960 | install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14961 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14962 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
14963 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14964 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd); |
14965 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14966 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14967 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14968 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14969 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14970 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
14971 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14972 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd); |
14973 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14974 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14975 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14976 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14977 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14978 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
14979 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14980 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd); |
14981 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14982 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14983 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14984 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14985 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
25ffbdc1 | 14986 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
14987 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14988 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd); |
14989 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14990 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14991 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14992 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14993 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14994 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
14995 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14996 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd); |
14997 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14998 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14999 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
15000 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
15001 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
8ecd3266 | 15002 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd); |
15003 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd); | |
15004 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_cmd); | |
15005 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
15006 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
15007 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
15008 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
15009 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
8b1fb8be LB |
15010 | install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd); |
15011 | install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd); | |
15012 | install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd); | |
15013 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
718e3744 | 15014 | |
15015 | /* "neighbor send-community" commands.*/ | |
15016 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
15017 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
15018 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
15019 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
15020 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
15021 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
15022 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
15023 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
15024 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
15025 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
15026 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
15027 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
15028 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
15029 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
15030 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
15031 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 15032 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
15033 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
15034 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
15035 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 15036 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
15037 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
15038 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
15039 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
8ecd3266 | 15040 | install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd); |
15041 | install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd); | |
15042 | install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd); | |
15043 | install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd); | |
8b1fb8be LB |
15044 | install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd); |
15045 | install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd); | |
15046 | install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd); | |
15047 | install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd); | |
15048 | install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd); | |
15049 | install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd); | |
15050 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd); | |
15051 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 15052 | |
15053 | /* "neighbor route-reflector" commands.*/ | |
15054 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
15055 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
15056 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
15057 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
15058 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
15059 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
15060 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
15061 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 15062 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
15063 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 15064 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
15065 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
8ecd3266 | 15066 | install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd); |
15067 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
8b1fb8be LB |
15068 | install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd); |
15069 | install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd); | |
15070 | install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd); | |
15071 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 15072 | |
15073 | /* "neighbor route-server" commands.*/ | |
15074 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
15075 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
15076 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
15077 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
15078 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
15079 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
15080 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
15081 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 15082 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
15083 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 15084 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
15085 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
8ecd3266 | 15086 | install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd); |
15087 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd); | |
8b1fb8be LB |
15088 | install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd); |
15089 | install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd); | |
15090 | install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd); | |
15091 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 15092 | |
adbac85e DW |
15093 | /* "neighbor addpath-tx-all-paths" commands.*/ |
15094 | install_element (BGP_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15095 | install_element (BGP_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15096 | install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15097 | install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15098 | install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15099 | install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15100 | install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15101 | install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15102 | install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15103 | install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15104 | install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15105 | install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
8ecd3266 | 15106 | install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_all_paths_cmd); |
15107 | install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
adbac85e | 15108 | |
06370dac DW |
15109 | /* "neighbor addpath-tx-bestpath-per-AS" commands.*/ |
15110 | install_element (BGP_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15111 | install_element (BGP_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15112 | install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15113 | install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15114 | install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15115 | install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15116 | install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15117 | install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15118 | install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15119 | install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15120 | install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15121 | install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
8ecd3266 | 15122 | install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); |
15123 | install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
06370dac | 15124 | |
718e3744 | 15125 | /* "neighbor passive" commands. */ |
15126 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
15127 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
15128 | ||
d5a5c8f0 | 15129 | |
718e3744 | 15130 | /* "neighbor shutdown" commands. */ |
15131 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
15132 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
15133 | ||
8a92a8a0 DS |
15134 | /* "neighbor capability extended-nexthop" commands.*/ |
15135 | install_element (BGP_NODE, &neighbor_capability_enhe_cmd); | |
15136 | install_element (BGP_NODE, &no_neighbor_capability_enhe_cmd); | |
15137 | ||
718e3744 | 15138 | /* "neighbor capability orf prefix-list" commands.*/ |
15139 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
15140 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
15141 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
15142 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
15143 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
15144 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
15145 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
15146 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 15147 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
15148 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 15149 | |
15150 | /* "neighbor capability dynamic" commands.*/ | |
15151 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
15152 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
15153 | ||
15154 | /* "neighbor dont-capability-negotiate" commands. */ | |
15155 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
15156 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
15157 | ||
15158 | /* "neighbor ebgp-multihop" commands. */ | |
15159 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
15160 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
15161 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
15162 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
15163 | ||
6ffd2079 | 15164 | /* "neighbor disable-connected-check" commands. */ |
15165 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
15166 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 15167 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
15168 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
15169 | ||
15170 | /* "neighbor description" commands. */ | |
15171 | install_element (BGP_NODE, &neighbor_description_cmd); | |
15172 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
15173 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
15174 | ||
15175 | /* "neighbor update-source" commands. "*/ | |
15176 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
15177 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
15178 | ||
15179 | /* "neighbor default-originate" commands. */ | |
15180 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
15181 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
15182 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
15183 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
15184 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
15185 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
15186 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
15187 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
15188 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
15189 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
15190 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
15191 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
15192 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
15193 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
15194 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
15195 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 15196 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
15197 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
15198 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
15199 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 15200 | |
15201 | /* "neighbor port" commands. */ | |
15202 | install_element (BGP_NODE, &neighbor_port_cmd); | |
15203 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
15204 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
15205 | ||
15206 | /* "neighbor weight" commands. */ | |
15207 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
15208 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
15209 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
15210 | ||
15211 | /* "neighbor override-capability" commands. */ | |
15212 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
15213 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
15214 | ||
15215 | /* "neighbor strict-capability-match" commands. */ | |
15216 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
15217 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
15218 | ||
15219 | /* "neighbor timers" commands. */ | |
15220 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
15221 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
813d4307 | 15222 | install_element (BGP_NODE, &no_neighbor_timers_val_cmd); |
718e3744 | 15223 | |
15224 | /* "neighbor timers connect" commands. */ | |
15225 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
15226 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
15227 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
15228 | ||
15229 | /* "neighbor advertisement-interval" commands. */ | |
15230 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
15231 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
15232 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
15233 | ||
718e3744 | 15234 | /* "neighbor interface" commands. */ |
15235 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
15236 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
15237 | ||
15238 | /* "neighbor distribute" commands. */ | |
15239 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
15240 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
15241 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
15242 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
15243 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
15244 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
15245 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
15246 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 15247 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
15248 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 15249 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
15250 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
8ecd3266 | 15251 | install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd); |
15252 | install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd); | |
8b1fb8be LB |
15253 | install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd); |
15254 | install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd); | |
15255 | install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd); | |
15256 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 15257 | |
15258 | /* "neighbor prefix-list" commands. */ | |
15259 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
15260 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
15261 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
15262 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
15263 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
15264 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
15265 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
15266 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 15267 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
15268 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 15269 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
15270 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
8ecd3266 | 15271 | install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd); |
15272 | install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd); | |
8b1fb8be LB |
15273 | install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd); |
15274 | install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd); | |
15275 | install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd); | |
15276 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 15277 | |
15278 | /* "neighbor filter-list" commands. */ | |
15279 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
15280 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
15281 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
15282 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
15283 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
15284 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
15285 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
15286 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 15287 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
15288 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 15289 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
15290 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
8ecd3266 | 15291 | install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd); |
15292 | install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd); | |
8b1fb8be LB |
15293 | install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd); |
15294 | install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd); | |
15295 | install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd); | |
15296 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 15297 | |
15298 | /* "neighbor route-map" commands. */ | |
15299 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
15300 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
15301 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
15302 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
15303 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
15304 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
15305 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
15306 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 15307 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
15308 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 15309 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
15310 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
8ecd3266 | 15311 | install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd); |
15312 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd); | |
8b1fb8be LB |
15313 | install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd); |
15314 | install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd); | |
15315 | install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd); | |
15316 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 15317 | |
15318 | /* "neighbor unsuppress-map" commands. */ | |
15319 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
15320 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
15321 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
15322 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
15323 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
15324 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
15325 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
15326 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 15327 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
15328 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 15329 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
bb86c601 | 15330 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
8ecd3266 | 15331 | install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd); |
bb86c601 | 15332 | install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd); |
8b1fb8be LB |
15333 | install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd); |
15334 | install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd); | |
15335 | install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd); | |
15336 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 15337 | |
15338 | /* "neighbor maximum-prefix" commands. */ | |
15339 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 15340 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15341 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15342 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15343 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
15344 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15345 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
15346 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15347 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15348 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15349 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15350 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15351 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15352 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15353 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15354 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15355 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15356 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
15357 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15358 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
15359 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15360 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15361 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15362 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15363 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15364 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15365 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15366 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15367 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15368 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15369 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
15370 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15371 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
15372 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15373 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15374 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15375 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15376 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15377 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15378 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15379 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15380 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15381 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15382 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
15383 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15384 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
15385 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15386 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15387 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15388 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15389 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15390 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 15391 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
15392 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15393 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15394 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15395 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15396 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15397 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
15398 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15399 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15400 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15401 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15402 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15403 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15404 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15405 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15406 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15407 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15408 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
15409 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15410 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
15411 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15412 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15413 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15414 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15415 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15416 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
8ecd3266 | 15417 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd); |
15418 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15419 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15420 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15421 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15422 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15423 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd); | |
15424 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15425 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15426 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15427 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15428 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15429 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15430 | |
8b1fb8be LB |
15431 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd); |
15432 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15433 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15434 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15435 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15436 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15437 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd); | |
15438 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15439 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15440 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15441 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15442 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15443 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
15444 | ||
15445 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd); | |
15446 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15447 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15448 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15449 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15450 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15451 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd); | |
15452 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15453 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15454 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15455 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15456 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15457 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
15458 | ||
718e3744 | 15459 | /* "neighbor allowas-in" */ |
15460 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
15461 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
15462 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15463 | install_element (BGP_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15464 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
15465 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
15466 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15467 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15468 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
15469 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
15470 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15471 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15472 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
15473 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
15474 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15475 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_val_cmd); |
25ffbdc1 | 15476 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
15477 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
15478 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15479 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15480 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
15481 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
15482 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15483 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_val_cmd); |
8ecd3266 | 15484 | install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd); |
15485 | install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd); | |
15486 | install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd); | |
15487 | install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_val_cmd); | |
8b1fb8be LB |
15488 | install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd); |
15489 | install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd); | |
15490 | install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd); | |
15491 | install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd); | |
15492 | install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
15493 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd); | |
718e3744 | 15494 | |
15495 | /* address-family commands. */ | |
15496 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
15497 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
15498 | #ifdef HAVE_IPV6 | |
15499 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 15500 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 15501 | #endif /* HAVE_IPV6 */ |
15502 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
15503 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
15504 | ||
8b1fb8be LB |
15505 | install_element (BGP_NODE, &address_family_vpnv6_cmd); |
15506 | install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd); | |
15507 | ||
15508 | install_element (BGP_NODE, &address_family_encap_cmd); | |
15509 | install_element (BGP_NODE, &address_family_encapv4_cmd); | |
15510 | #ifdef HAVE_IPV6 | |
15511 | install_element (BGP_NODE, &address_family_encapv6_cmd); | |
15512 | #endif | |
15513 | ||
718e3744 | 15514 | /* "exit-address-family" command. */ |
15515 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
15516 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
15517 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 15518 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 15519 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
8ecd3266 | 15520 | install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); |
8b1fb8be LB |
15521 | install_element (BGP_ENCAP_NODE, &exit_address_family_cmd); |
15522 | install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd); | |
718e3744 | 15523 | |
15524 | /* "clear ip bgp commands" */ | |
15525 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
15526 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
15527 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
01080f7c | 15528 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_cmd); |
718e3744 | 15529 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
01080f7c | 15530 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_cmd); |
718e3744 | 15531 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
01080f7c | 15532 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_cmd); |
718e3744 | 15533 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
01080f7c | 15534 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_cmd); |
15535 | ||
718e3744 | 15536 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
15537 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
15538 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
01080f7c | 15539 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_cmd); |
718e3744 | 15540 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
01080f7c | 15541 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_cmd); |
718e3744 | 15542 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
01080f7c | 15543 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_cmd); |
718e3744 | 15544 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
01080f7c | 15545 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_cmd); |
718e3744 | 15546 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
01080f7c | 15547 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_cmd); |
718e3744 | 15548 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
01080f7c | 15549 | install_element (ENABLE_NODE, &clear_bgp_instance_external_cmd); |
718e3744 | 15550 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
01080f7c | 15551 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_cmd); |
718e3744 | 15552 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
01080f7c | 15553 | install_element (ENABLE_NODE, &clear_bgp_instance_as_cmd); |
718e3744 | 15554 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
01080f7c | 15555 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_cmd); |
718e3744 | 15556 | |
15557 | /* "clear ip bgp neighbor soft in" */ | |
15558 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
15559 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
15560 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
01080f7c | 15561 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_cmd); |
718e3744 | 15562 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
718e3744 | 15563 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
01080f7c | 15564 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_in_cmd); |
718e3744 | 15565 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
01080f7c | 15566 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_in_cmd); |
718e3744 | 15567 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
15568 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
01080f7c | 15569 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_in_cmd); |
718e3744 | 15570 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
01080f7c | 15571 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_in_cmd); |
718e3744 | 15572 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
15573 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
01080f7c | 15574 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_in_cmd); |
718e3744 | 15575 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
01080f7c | 15576 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_in_cmd); |
718e3744 | 15577 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
15578 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
01080f7c | 15579 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_in_cmd); |
718e3744 | 15580 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
01080f7c | 15581 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_in_cmd); |
718e3744 | 15582 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
15583 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
15584 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
15585 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
01080f7c | 15586 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_cmd); |
718e3744 | 15587 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
718e3744 | 15588 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
01080f7c | 15589 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_in_cmd); |
718e3744 | 15590 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
01080f7c | 15591 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_in_cmd); |
718e3744 | 15592 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
15593 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
01080f7c | 15594 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd); |
718e3744 | 15595 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
01080f7c | 15596 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_in_cmd); |
718e3744 | 15597 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
15598 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
01080f7c | 15599 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_in_cmd); |
718e3744 | 15600 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
01080f7c | 15601 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_in_cmd); |
718e3744 | 15602 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
15603 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
01080f7c | 15604 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_in_cmd); |
718e3744 | 15605 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
01080f7c | 15606 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_in_cmd); |
718e3744 | 15607 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
15608 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
15609 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
15610 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
15611 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
15612 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
15613 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
587ff0fd LB |
15614 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd); |
15615 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd); | |
15616 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd); | |
15617 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd); | |
15618 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd); | |
15619 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd); | |
718e3744 | 15620 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
15621 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
15622 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
01080f7c | 15623 | install_element (ENABLE_NODE, &clear_bgp_instance_all_in_cmd); |
718e3744 | 15624 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
15625 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
01080f7c | 15626 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_in_cmd); |
718e3744 | 15627 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
01080f7c | 15628 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_in_cmd); |
718e3744 | 15629 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
15630 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
01080f7c | 15631 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_in_cmd); |
718e3744 | 15632 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
01080f7c | 15633 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_in_cmd); |
718e3744 | 15634 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
15635 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
01080f7c | 15636 | install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_in_cmd); |
718e3744 | 15637 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
01080f7c | 15638 | install_element (ENABLE_NODE, &clear_bgp_instance_external_in_cmd); |
718e3744 | 15639 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
15640 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
01080f7c | 15641 | install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_in_cmd); |
718e3744 | 15642 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
01080f7c | 15643 | install_element (ENABLE_NODE, &clear_bgp_instance_as_in_cmd); |
718e3744 | 15644 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
15645 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
01080f7c | 15646 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_in_cmd); |
718e3744 | 15647 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
01080f7c | 15648 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_in_cmd); |
718e3744 | 15649 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
15650 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
01080f7c | 15651 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_in_cmd); |
718e3744 | 15652 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
01080f7c | 15653 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_in_cmd); |
718e3744 | 15654 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
15655 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
01080f7c | 15656 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_in_cmd); |
718e3744 | 15657 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
01080f7c | 15658 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_in_cmd); |
718e3744 | 15659 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
15660 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
01080f7c | 15661 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_in_cmd); |
718e3744 | 15662 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
01080f7c | 15663 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_in_cmd); |
718e3744 | 15664 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
15665 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
01080f7c | 15666 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_in_cmd); |
718e3744 | 15667 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
01080f7c | 15668 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_in_cmd); |
718e3744 | 15669 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
718e3744 | 15670 | |
8ad7271d DS |
15671 | /* clear ip bgp prefix */ |
15672 | install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); | |
01080f7c | 15673 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_prefix_cmd); |
8ad7271d | 15674 | install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); |
01080f7c | 15675 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_safi_prefix_cmd); |
8ad7271d | 15676 | |
718e3744 | 15677 | /* "clear ip bgp neighbor soft out" */ |
15678 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
15679 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
15680 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
01080f7c | 15681 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_out_cmd); |
718e3744 | 15682 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
01080f7c | 15683 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_out_cmd); |
718e3744 | 15684 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
01080f7c | 15685 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_out_cmd); |
718e3744 | 15686 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
01080f7c | 15687 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_out_cmd); |
718e3744 | 15688 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
01080f7c | 15689 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_out_cmd); |
718e3744 | 15690 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
01080f7c | 15691 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_out_cmd); |
718e3744 | 15692 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
01080f7c | 15693 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_out_cmd); |
718e3744 | 15694 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
01080f7c | 15695 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_out_cmd); |
718e3744 | 15696 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
01080f7c | 15697 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_out_cmd); |
718e3744 | 15698 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
15699 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
15700 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
01080f7c | 15701 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_out_cmd); |
718e3744 | 15702 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
01080f7c | 15703 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_out_cmd); |
718e3744 | 15704 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
01080f7c | 15705 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_out_cmd); |
718e3744 | 15706 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
01080f7c | 15707 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd); |
718e3744 | 15708 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
01080f7c | 15709 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_out_cmd); |
718e3744 | 15710 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
01080f7c | 15711 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_out_cmd); |
718e3744 | 15712 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
01080f7c | 15713 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_out_cmd); |
718e3744 | 15714 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
01080f7c | 15715 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_out_cmd); |
718e3744 | 15716 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
01080f7c | 15717 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_out_cmd); |
718e3744 | 15718 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
15719 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
15720 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
15721 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
15722 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
15723 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
587ff0fd LB |
15724 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd); |
15725 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd); | |
15726 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd); | |
15727 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd); | |
15728 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd); | |
15729 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd); | |
718e3744 | 15730 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
15731 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
15732 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
01080f7c | 15733 | install_element (ENABLE_NODE, &clear_bgp_instance_all_out_cmd); |
718e3744 | 15734 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
01080f7c | 15735 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_out_cmd); |
718e3744 | 15736 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
01080f7c | 15737 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_out_cmd); |
718e3744 | 15738 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
01080f7c | 15739 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_out_cmd); |
718e3744 | 15740 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
01080f7c | 15741 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_out_cmd); |
718e3744 | 15742 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
01080f7c | 15743 | install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_out_cmd); |
718e3744 | 15744 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
01080f7c | 15745 | install_element (ENABLE_NODE, &clear_bgp_instance_external_out_cmd); |
718e3744 | 15746 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
01080f7c | 15747 | install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_out_cmd); |
718e3744 | 15748 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
01080f7c | 15749 | install_element (ENABLE_NODE, &clear_bgp_instance_as_out_cmd); |
718e3744 | 15750 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
01080f7c | 15751 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_out_cmd); |
718e3744 | 15752 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
01080f7c | 15753 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_out_cmd); |
718e3744 | 15754 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
01080f7c | 15755 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_out_cmd); |
718e3744 | 15756 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
01080f7c | 15757 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_out_cmd); |
718e3744 | 15758 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
01080f7c | 15759 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_out_cmd); |
718e3744 | 15760 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
01080f7c | 15761 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_out_cmd); |
718e3744 | 15762 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
01080f7c | 15763 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_out_cmd); |
718e3744 | 15764 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
01080f7c | 15765 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_out_cmd); |
718e3744 | 15766 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
01080f7c | 15767 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_out_cmd); |
718e3744 | 15768 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
01080f7c | 15769 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_out_cmd); |
718e3744 | 15770 | |
15771 | /* "clear ip bgp neighbor soft" */ | |
15772 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
15773 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
15774 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
01080f7c | 15775 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_cmd); |
718e3744 | 15776 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
01080f7c | 15777 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_cmd); |
718e3744 | 15778 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
01080f7c | 15779 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_cmd); |
718e3744 | 15780 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
01080f7c | 15781 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_cmd); |
718e3744 | 15782 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
15783 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
15784 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
01080f7c | 15785 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_cmd); |
718e3744 | 15786 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
01080f7c | 15787 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_cmd); |
718e3744 | 15788 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
01080f7c | 15789 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_cmd); |
718e3744 | 15790 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
01080f7c | 15791 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_cmd); |
718e3744 | 15792 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
15793 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
15794 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
587ff0fd LB |
15795 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd); |
15796 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd); | |
15797 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd); | |
718e3744 | 15798 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
15799 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
15800 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
01080f7c | 15801 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_cmd); |
718e3744 | 15802 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
01080f7c | 15803 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_cmd); |
718e3744 | 15804 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
01080f7c | 15805 | install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_cmd); |
718e3744 | 15806 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
01080f7c | 15807 | install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_cmd); |
718e3744 | 15808 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
01080f7c | 15809 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_cmd); |
718e3744 | 15810 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
01080f7c | 15811 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_cmd); |
718e3744 | 15812 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
01080f7c | 15813 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_cmd); |
718e3744 | 15814 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
01080f7c | 15815 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_cmd); |
718e3744 | 15816 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
01080f7c | 15817 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_cmd); |
718e3744 | 15818 | |
15819 | /* "show ip bgp summary" commands. */ | |
15820 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15821 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15822 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15823 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15824 | install_element (VIEW_NODE, &show_bgp_updgrps_cmd); |
15825 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15826 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15827 | install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15828 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15829 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15830 | install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd); |
15831 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15832 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15833 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15834 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15835 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15836 | install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15837 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15838 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15839 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15840 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15841 | install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15842 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
718e3744 | 15843 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15844 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd); |
718e3744 | 15845 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
95cbbd2a | 15846 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 15847 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 15848 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 15849 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
15850 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15851 | #ifdef HAVE_IPV6 | |
15852 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
15853 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15854 | install_element (VIEW_NODE, &show_bgp_instance_all_summary_cmd); |
718e3744 | 15855 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
95cbbd2a | 15856 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 15857 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 15858 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
15859 | #endif /* HAVE_IPV6 */ |
15860 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15861 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15862 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15863 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15864 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd); |
15865 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15866 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15867 | install_element (RESTRICTED_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15868 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15869 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15870 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd); |
15871 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15872 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15873 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15874 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15875 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15876 | install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15877 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15878 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15879 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15880 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15881 | install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15882 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
62687ff1 | 15883 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15884 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd); |
62687ff1 | 15885 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); |
95cbbd2a | 15886 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
62687ff1 | 15887 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 15888 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
62687ff1 PJ |
15889 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
15890 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15891 | #ifdef HAVE_IPV6 | |
15892 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
15893 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15894 | install_element (RESTRICTED_NODE, &show_bgp_instance_all_summary_cmd); |
62687ff1 | 15895 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); |
95cbbd2a | 15896 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
62687ff1 | 15897 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 15898 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 15899 | #endif /* HAVE_IPV6 */ |
15900 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15901 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15902 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15903 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15904 | install_element (ENABLE_NODE, &show_bgp_updgrps_cmd); |
15905 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15906 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15907 | install_element (ENABLE_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15908 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15909 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15910 | install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd); |
15911 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15912 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15913 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15914 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15915 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15916 | install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15917 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15918 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15919 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15920 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15921 | install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15922 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
718e3744 | 15923 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15924 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_summary_cmd); |
718e3744 | 15925 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
95cbbd2a | 15926 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 15927 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 15928 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 15929 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
15930 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15931 | #ifdef HAVE_IPV6 | |
15932 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
15933 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15934 | install_element (ENABLE_NODE, &show_bgp_instance_all_summary_cmd); |
718e3744 | 15935 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
95cbbd2a | 15936 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 15937 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 15938 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 15939 | #endif /* HAVE_IPV6 */ |
15940 | ||
15941 | /* "show ip bgp neighbors" commands. */ | |
15942 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
15943 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
15944 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
15945 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
15946 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
15947 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
15948 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
15949 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
15950 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
f186de26 | 15951 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd); |
718e3744 | 15952 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
62687ff1 PJ |
15953 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
15954 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
15955 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
15956 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
15957 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 15958 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
15959 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
15960 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
15961 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
15962 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
15963 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
15964 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
15965 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
15966 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
f186de26 | 15967 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd); |
718e3744 | 15968 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
15969 | ||
15970 | #ifdef HAVE_IPV6 | |
15971 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
15972 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
15973 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
15974 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 15975 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
15976 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
15977 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
15978 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
15979 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
15980 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
15981 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
15982 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 15983 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
15984 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
15985 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
15986 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 15987 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
15988 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
15989 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
15990 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 15991 | |
15992 | /* Old commands. */ | |
15993 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
15994 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
15995 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
15996 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
15997 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 15998 | |
f14e6fdb DS |
15999 | /* "show ip bgp peer-group" commands. */ |
16000 | install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); | |
16001 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
16002 | install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd); | |
16003 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
16004 | install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd); | |
16005 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
16006 | install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd); | |
16007 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
16008 | ||
718e3744 | 16009 | /* "show ip bgp paths" commands. */ |
16010 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
16011 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
16012 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
16013 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
16014 | ||
16015 | /* "show ip bgp community" commands. */ | |
16016 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
16017 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
16018 | ||
16019 | /* "show ip bgp attribute-info" commands. */ | |
16020 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
16021 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
16022 | ||
16023 | /* "redistribute" commands. */ | |
16024 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
16025 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
16026 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
16027 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
16028 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
16029 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
16030 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
16031 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
16032 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
16033 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
7c8ff89e DS |
16034 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd); |
16035 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
16036 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
16037 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
16038 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
16039 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
16040 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
16041 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
16042 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
16043 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
919e0666 DW |
16044 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_cmd); |
16045 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_cmd); | |
16046 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
16047 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
16048 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
16049 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
16050 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
16051 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
16052 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
16053 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
16054 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_cmd); | |
16055 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
16056 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
16057 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
16058 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
16059 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
16060 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
16061 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
16062 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
16063 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
718e3744 | 16064 | #ifdef HAVE_IPV6 |
16065 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
16066 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
16067 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
16068 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
16069 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
16070 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
16071 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
16072 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
16073 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
16074 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
16075 | #endif /* HAVE_IPV6 */ | |
16076 | ||
fa411a21 NH |
16077 | /* ttl_security commands */ |
16078 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
16079 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
16080 | ||
4bf6a362 PJ |
16081 | /* "show bgp memory" commands. */ |
16082 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 16083 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
16084 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
16085 | ||
e0081f70 ML |
16086 | /* "show bgp views" commands. */ |
16087 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
16088 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
16089 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
16090 | ||
8386ac43 | 16091 | /* "show bgp vrfs" commands. */ |
16092 | install_element (VIEW_NODE, &show_bgp_vrfs_cmd); | |
16093 | install_element (RESTRICTED_NODE, &show_bgp_vrfs_cmd); | |
16094 | install_element (ENABLE_NODE, &show_bgp_vrfs_cmd); | |
16095 | ||
718e3744 | 16096 | /* Community-list. */ |
16097 | community_list_vty (); | |
16098 | } | |
6b0655a2 | 16099 | |
718e3744 | 16100 | #include "memory.h" |
16101 | #include "bgp_regex.h" | |
16102 | #include "bgp_clist.h" | |
16103 | #include "bgp_ecommunity.h" | |
16104 | ||
16105 | /* VTY functions. */ | |
16106 | ||
16107 | /* Direction value to string conversion. */ | |
94f2b392 | 16108 | static const char * |
718e3744 | 16109 | community_direct_str (int direct) |
16110 | { | |
16111 | switch (direct) | |
16112 | { | |
16113 | case COMMUNITY_DENY: | |
16114 | return "deny"; | |
718e3744 | 16115 | case COMMUNITY_PERMIT: |
16116 | return "permit"; | |
718e3744 | 16117 | default: |
16118 | return "unknown"; | |
718e3744 | 16119 | } |
16120 | } | |
16121 | ||
16122 | /* Display error string. */ | |
94f2b392 | 16123 | static void |
718e3744 | 16124 | community_list_perror (struct vty *vty, int ret) |
16125 | { | |
16126 | switch (ret) | |
16127 | { | |
16128 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 16129 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 16130 | break; |
16131 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
16132 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
16133 | break; | |
16134 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
16135 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
16136 | break; | |
16137 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
16138 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
16139 | break; | |
16140 | } | |
16141 | } | |
16142 | ||
16143 | /* VTY interface for community_set() function. */ | |
94f2b392 | 16144 | static int |
fd79ac91 | 16145 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
16146 | int style, int reject_all_digit_name) | |
718e3744 | 16147 | { |
16148 | int ret; | |
16149 | int direct; | |
16150 | char *str; | |
16151 | ||
16152 | /* Check the list type. */ | |
16153 | if (strncmp (argv[1], "p", 1) == 0) | |
16154 | direct = COMMUNITY_PERMIT; | |
16155 | else if (strncmp (argv[1], "d", 1) == 0) | |
16156 | direct = COMMUNITY_DENY; | |
16157 | else | |
16158 | { | |
16159 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16160 | VTY_NEWLINE); | |
16161 | return CMD_WARNING; | |
16162 | } | |
16163 | ||
16164 | /* All digit name check. */ | |
16165 | if (reject_all_digit_name && all_digit (argv[0])) | |
16166 | { | |
16167 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
16168 | return CMD_WARNING; | |
16169 | } | |
16170 | ||
16171 | /* Concat community string argument. */ | |
16172 | if (argc > 1) | |
16173 | str = argv_concat (argv, argc, 2); | |
16174 | else | |
16175 | str = NULL; | |
16176 | ||
16177 | /* When community_list_set() return nevetive value, it means | |
16178 | malformed community string. */ | |
16179 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
16180 | ||
16181 | /* Free temporary community list string allocated by | |
16182 | argv_concat(). */ | |
16183 | if (str) | |
16184 | XFREE (MTYPE_TMP, str); | |
16185 | ||
16186 | if (ret < 0) | |
16187 | { | |
16188 | /* Display error string. */ | |
16189 | community_list_perror (vty, ret); | |
16190 | return CMD_WARNING; | |
16191 | } | |
16192 | ||
16193 | return CMD_SUCCESS; | |
16194 | } | |
16195 | ||
718e3744 | 16196 | /* Communiyt-list entry delete. */ |
94f2b392 | 16197 | static int |
fee6e4e4 | 16198 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
813d4307 | 16199 | int style, int delete_all) |
718e3744 | 16200 | { |
16201 | int ret; | |
fee6e4e4 | 16202 | int direct = 0; |
16203 | char *str = NULL; | |
718e3744 | 16204 | |
fee6e4e4 | 16205 | if (argc > 1) |
718e3744 | 16206 | { |
fee6e4e4 | 16207 | /* Check the list direct. */ |
16208 | if (strncmp (argv[1], "p", 1) == 0) | |
16209 | direct = COMMUNITY_PERMIT; | |
16210 | else if (strncmp (argv[1], "d", 1) == 0) | |
16211 | direct = COMMUNITY_DENY; | |
16212 | else | |
16213 | { | |
16214 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16215 | VTY_NEWLINE); | |
16216 | return CMD_WARNING; | |
16217 | } | |
718e3744 | 16218 | |
fee6e4e4 | 16219 | /* Concat community string argument. */ |
16220 | str = argv_concat (argv, argc, 2); | |
16221 | } | |
718e3744 | 16222 | |
16223 | /* Unset community list. */ | |
813d4307 | 16224 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); |
718e3744 | 16225 | |
16226 | /* Free temporary community list string allocated by | |
16227 | argv_concat(). */ | |
fee6e4e4 | 16228 | if (str) |
16229 | XFREE (MTYPE_TMP, str); | |
718e3744 | 16230 | |
16231 | if (ret < 0) | |
16232 | { | |
16233 | community_list_perror (vty, ret); | |
16234 | return CMD_WARNING; | |
16235 | } | |
16236 | ||
16237 | return CMD_SUCCESS; | |
16238 | } | |
16239 | ||
16240 | /* "community-list" keyword help string. */ | |
16241 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
718e3744 | 16242 | |
718e3744 | 16243 | DEFUN (ip_community_list_standard, |
16244 | ip_community_list_standard_cmd, | |
16245 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
16246 | IP_STR | |
16247 | COMMUNITY_LIST_STR | |
16248 | "Community list number (standard)\n" | |
16249 | "Specify community to reject\n" | |
16250 | "Specify community to accept\n" | |
16251 | COMMUNITY_VAL_STR) | |
16252 | { | |
16253 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
16254 | } | |
16255 | ||
16256 | ALIAS (ip_community_list_standard, | |
16257 | ip_community_list_standard2_cmd, | |
16258 | "ip community-list <1-99> (deny|permit)", | |
16259 | IP_STR | |
16260 | COMMUNITY_LIST_STR | |
16261 | "Community list number (standard)\n" | |
16262 | "Specify community to reject\n" | |
16263 | "Specify community to accept\n") | |
16264 | ||
16265 | DEFUN (ip_community_list_expanded, | |
16266 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 16267 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 16268 | IP_STR |
16269 | COMMUNITY_LIST_STR | |
16270 | "Community list number (expanded)\n" | |
16271 | "Specify community to reject\n" | |
16272 | "Specify community to accept\n" | |
16273 | "An ordered list as a regular-expression\n") | |
16274 | { | |
16275 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
16276 | } | |
16277 | ||
16278 | DEFUN (ip_community_list_name_standard, | |
16279 | ip_community_list_name_standard_cmd, | |
16280 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
16281 | IP_STR | |
16282 | COMMUNITY_LIST_STR | |
16283 | "Add a standard community-list entry\n" | |
16284 | "Community list name\n" | |
16285 | "Specify community to reject\n" | |
16286 | "Specify community to accept\n" | |
16287 | COMMUNITY_VAL_STR) | |
16288 | { | |
16289 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
16290 | } | |
16291 | ||
16292 | ALIAS (ip_community_list_name_standard, | |
16293 | ip_community_list_name_standard2_cmd, | |
16294 | "ip community-list standard WORD (deny|permit)", | |
16295 | IP_STR | |
16296 | COMMUNITY_LIST_STR | |
16297 | "Add a standard community-list entry\n" | |
16298 | "Community list name\n" | |
16299 | "Specify community to reject\n" | |
16300 | "Specify community to accept\n") | |
16301 | ||
16302 | DEFUN (ip_community_list_name_expanded, | |
16303 | ip_community_list_name_expanded_cmd, | |
16304 | "ip community-list expanded WORD (deny|permit) .LINE", | |
16305 | IP_STR | |
16306 | COMMUNITY_LIST_STR | |
16307 | "Add an expanded community-list entry\n" | |
16308 | "Community list name\n" | |
16309 | "Specify community to reject\n" | |
16310 | "Specify community to accept\n" | |
16311 | "An ordered list as a regular-expression\n") | |
16312 | { | |
16313 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
16314 | } | |
16315 | ||
fee6e4e4 | 16316 | DEFUN (no_ip_community_list_standard_all, |
16317 | no_ip_community_list_standard_all_cmd, | |
16318 | "no ip community-list <1-99>", | |
16319 | NO_STR | |
16320 | IP_STR | |
16321 | COMMUNITY_LIST_STR | |
16322 | "Community list number (standard)\n") | |
16323 | { | |
813d4307 DW |
16324 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
16325 | } | |
16326 | ||
16327 | DEFUN (no_ip_community_list_standard_direction, | |
16328 | no_ip_community_list_standard_direction_cmd, | |
16329 | "no ip community-list <1-99> (deny|permit)", | |
16330 | NO_STR | |
16331 | IP_STR | |
16332 | COMMUNITY_LIST_STR | |
16333 | "Community list number (standard)\n" | |
16334 | "Specify community to reject\n" | |
16335 | "Specify community to accept\n") | |
16336 | { | |
16337 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
fee6e4e4 | 16338 | } |
16339 | ||
813d4307 | 16340 | |
fee6e4e4 | 16341 | DEFUN (no_ip_community_list_expanded_all, |
16342 | no_ip_community_list_expanded_all_cmd, | |
16343 | "no ip community-list <100-500>", | |
718e3744 | 16344 | NO_STR |
16345 | IP_STR | |
16346 | COMMUNITY_LIST_STR | |
718e3744 | 16347 | "Community list number (expanded)\n") |
16348 | { | |
813d4307 | 16349 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16350 | } |
16351 | ||
fee6e4e4 | 16352 | DEFUN (no_ip_community_list_name_standard_all, |
16353 | no_ip_community_list_name_standard_all_cmd, | |
16354 | "no ip community-list standard WORD", | |
718e3744 | 16355 | NO_STR |
16356 | IP_STR | |
16357 | COMMUNITY_LIST_STR | |
16358 | "Add a standard community-list entry\n" | |
718e3744 | 16359 | "Community list name\n") |
16360 | { | |
813d4307 | 16361 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
718e3744 | 16362 | } |
16363 | ||
fee6e4e4 | 16364 | DEFUN (no_ip_community_list_name_expanded_all, |
16365 | no_ip_community_list_name_expanded_all_cmd, | |
16366 | "no ip community-list expanded WORD", | |
718e3744 | 16367 | NO_STR |
16368 | IP_STR | |
16369 | COMMUNITY_LIST_STR | |
fee6e4e4 | 16370 | "Add an expanded community-list entry\n" |
16371 | "Community list name\n") | |
718e3744 | 16372 | { |
813d4307 | 16373 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16374 | } |
16375 | ||
16376 | DEFUN (no_ip_community_list_standard, | |
16377 | no_ip_community_list_standard_cmd, | |
16378 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
16379 | NO_STR | |
16380 | IP_STR | |
16381 | COMMUNITY_LIST_STR | |
16382 | "Community list number (standard)\n" | |
16383 | "Specify community to reject\n" | |
16384 | "Specify community to accept\n" | |
16385 | COMMUNITY_VAL_STR) | |
16386 | { | |
813d4307 | 16387 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
718e3744 | 16388 | } |
16389 | ||
16390 | DEFUN (no_ip_community_list_expanded, | |
16391 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 16392 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 16393 | NO_STR |
16394 | IP_STR | |
16395 | COMMUNITY_LIST_STR | |
16396 | "Community list number (expanded)\n" | |
16397 | "Specify community to reject\n" | |
16398 | "Specify community to accept\n" | |
16399 | "An ordered list as a regular-expression\n") | |
16400 | { | |
813d4307 | 16401 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16402 | } |
16403 | ||
16404 | DEFUN (no_ip_community_list_name_standard, | |
16405 | no_ip_community_list_name_standard_cmd, | |
16406 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
16407 | NO_STR | |
16408 | IP_STR | |
16409 | COMMUNITY_LIST_STR | |
16410 | "Specify a standard community-list\n" | |
16411 | "Community list name\n" | |
16412 | "Specify community to reject\n" | |
16413 | "Specify community to accept\n" | |
16414 | COMMUNITY_VAL_STR) | |
16415 | { | |
813d4307 DW |
16416 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
16417 | } | |
16418 | ||
16419 | DEFUN (no_ip_community_list_name_standard_brief, | |
16420 | no_ip_community_list_name_standard_brief_cmd, | |
16421 | "no ip community-list standard WORD (deny|permit)", | |
16422 | NO_STR | |
16423 | IP_STR | |
16424 | COMMUNITY_LIST_STR | |
16425 | "Specify a standard community-list\n" | |
16426 | "Community list name\n" | |
16427 | "Specify community to reject\n" | |
16428 | "Specify community to accept\n") | |
16429 | { | |
16430 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
718e3744 | 16431 | } |
16432 | ||
16433 | DEFUN (no_ip_community_list_name_expanded, | |
16434 | no_ip_community_list_name_expanded_cmd, | |
16435 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
16436 | NO_STR | |
16437 | IP_STR | |
16438 | COMMUNITY_LIST_STR | |
16439 | "Specify an expanded community-list\n" | |
16440 | "Community list name\n" | |
16441 | "Specify community to reject\n" | |
16442 | "Specify community to accept\n" | |
16443 | "An ordered list as a regular-expression\n") | |
16444 | { | |
813d4307 | 16445 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16446 | } |
16447 | ||
94f2b392 | 16448 | static void |
718e3744 | 16449 | community_list_show (struct vty *vty, struct community_list *list) |
16450 | { | |
16451 | struct community_entry *entry; | |
16452 | ||
16453 | for (entry = list->head; entry; entry = entry->next) | |
16454 | { | |
16455 | if (entry == list->head) | |
16456 | { | |
16457 | if (all_digit (list->name)) | |
16458 | vty_out (vty, "Community %s list %s%s", | |
16459 | entry->style == COMMUNITY_LIST_STANDARD ? | |
16460 | "standard" : "(expanded) access", | |
16461 | list->name, VTY_NEWLINE); | |
16462 | else | |
16463 | vty_out (vty, "Named Community %s list %s%s", | |
16464 | entry->style == COMMUNITY_LIST_STANDARD ? | |
16465 | "standard" : "expanded", | |
16466 | list->name, VTY_NEWLINE); | |
16467 | } | |
16468 | if (entry->any) | |
16469 | vty_out (vty, " %s%s", | |
16470 | community_direct_str (entry->direct), VTY_NEWLINE); | |
16471 | else | |
16472 | vty_out (vty, " %s %s%s", | |
16473 | community_direct_str (entry->direct), | |
16474 | entry->style == COMMUNITY_LIST_STANDARD | |
16475 | ? community_str (entry->u.com) : entry->config, | |
16476 | VTY_NEWLINE); | |
16477 | } | |
16478 | } | |
16479 | ||
16480 | DEFUN (show_ip_community_list, | |
16481 | show_ip_community_list_cmd, | |
16482 | "show ip community-list", | |
16483 | SHOW_STR | |
16484 | IP_STR | |
16485 | "List community-list\n") | |
16486 | { | |
16487 | struct community_list *list; | |
16488 | struct community_list_master *cm; | |
16489 | ||
fee6e4e4 | 16490 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 16491 | if (! cm) |
16492 | return CMD_SUCCESS; | |
16493 | ||
16494 | for (list = cm->num.head; list; list = list->next) | |
16495 | community_list_show (vty, list); | |
16496 | ||
16497 | for (list = cm->str.head; list; list = list->next) | |
16498 | community_list_show (vty, list); | |
16499 | ||
16500 | return CMD_SUCCESS; | |
16501 | } | |
16502 | ||
16503 | DEFUN (show_ip_community_list_arg, | |
16504 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 16505 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 16506 | SHOW_STR |
16507 | IP_STR | |
16508 | "List community-list\n" | |
16509 | "Community-list number\n" | |
16510 | "Community-list name\n") | |
16511 | { | |
16512 | struct community_list *list; | |
16513 | ||
fee6e4e4 | 16514 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 16515 | if (! list) |
16516 | { | |
b729294c | 16517 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 16518 | return CMD_WARNING; |
16519 | } | |
16520 | ||
16521 | community_list_show (vty, list); | |
16522 | ||
16523 | return CMD_SUCCESS; | |
16524 | } | |
6b0655a2 | 16525 | |
94f2b392 | 16526 | static int |
fd79ac91 | 16527 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
16528 | int style, int reject_all_digit_name) | |
718e3744 | 16529 | { |
16530 | int ret; | |
16531 | int direct; | |
16532 | char *str; | |
16533 | ||
16534 | /* Check the list type. */ | |
16535 | if (strncmp (argv[1], "p", 1) == 0) | |
16536 | direct = COMMUNITY_PERMIT; | |
16537 | else if (strncmp (argv[1], "d", 1) == 0) | |
16538 | direct = COMMUNITY_DENY; | |
16539 | else | |
16540 | { | |
16541 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16542 | VTY_NEWLINE); | |
16543 | return CMD_WARNING; | |
16544 | } | |
16545 | ||
16546 | /* All digit name check. */ | |
16547 | if (reject_all_digit_name && all_digit (argv[0])) | |
16548 | { | |
16549 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
16550 | return CMD_WARNING; | |
16551 | } | |
16552 | ||
16553 | /* Concat community string argument. */ | |
16554 | if (argc > 1) | |
16555 | str = argv_concat (argv, argc, 2); | |
16556 | else | |
16557 | str = NULL; | |
16558 | ||
16559 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
16560 | ||
16561 | /* Free temporary community list string allocated by | |
16562 | argv_concat(). */ | |
16563 | if (str) | |
16564 | XFREE (MTYPE_TMP, str); | |
16565 | ||
16566 | if (ret < 0) | |
16567 | { | |
16568 | community_list_perror (vty, ret); | |
16569 | return CMD_WARNING; | |
16570 | } | |
16571 | return CMD_SUCCESS; | |
16572 | } | |
16573 | ||
94f2b392 | 16574 | static int |
fee6e4e4 | 16575 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
813d4307 | 16576 | int style, int delete_all) |
718e3744 | 16577 | { |
16578 | int ret; | |
fee6e4e4 | 16579 | int direct = 0; |
16580 | char *str = NULL; | |
718e3744 | 16581 | |
fee6e4e4 | 16582 | if (argc > 1) |
718e3744 | 16583 | { |
fee6e4e4 | 16584 | /* Check the list direct. */ |
16585 | if (strncmp (argv[1], "p", 1) == 0) | |
16586 | direct = COMMUNITY_PERMIT; | |
16587 | else if (strncmp (argv[1], "d", 1) == 0) | |
16588 | direct = COMMUNITY_DENY; | |
16589 | else | |
16590 | { | |
16591 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16592 | VTY_NEWLINE); | |
16593 | return CMD_WARNING; | |
16594 | } | |
718e3744 | 16595 | |
fee6e4e4 | 16596 | /* Concat community string argument. */ |
16597 | str = argv_concat (argv, argc, 2); | |
718e3744 | 16598 | } |
16599 | ||
718e3744 | 16600 | /* Unset community list. */ |
813d4307 | 16601 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); |
718e3744 | 16602 | |
16603 | /* Free temporary community list string allocated by | |
16604 | argv_concat(). */ | |
fee6e4e4 | 16605 | if (str) |
16606 | XFREE (MTYPE_TMP, str); | |
718e3744 | 16607 | |
16608 | if (ret < 0) | |
16609 | { | |
16610 | community_list_perror (vty, ret); | |
16611 | return CMD_WARNING; | |
16612 | } | |
16613 | ||
16614 | return CMD_SUCCESS; | |
16615 | } | |
16616 | ||
16617 | /* "extcommunity-list" keyword help string. */ | |
16618 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
16619 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
16620 | ||
16621 | DEFUN (ip_extcommunity_list_standard, | |
16622 | ip_extcommunity_list_standard_cmd, | |
16623 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
16624 | IP_STR | |
16625 | EXTCOMMUNITY_LIST_STR | |
16626 | "Extended Community list number (standard)\n" | |
16627 | "Specify community to reject\n" | |
16628 | "Specify community to accept\n" | |
16629 | EXTCOMMUNITY_VAL_STR) | |
16630 | { | |
16631 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
16632 | } | |
16633 | ||
16634 | ALIAS (ip_extcommunity_list_standard, | |
16635 | ip_extcommunity_list_standard2_cmd, | |
16636 | "ip extcommunity-list <1-99> (deny|permit)", | |
16637 | IP_STR | |
16638 | EXTCOMMUNITY_LIST_STR | |
16639 | "Extended Community list number (standard)\n" | |
16640 | "Specify community to reject\n" | |
16641 | "Specify community to accept\n") | |
16642 | ||
16643 | DEFUN (ip_extcommunity_list_expanded, | |
16644 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 16645 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 16646 | IP_STR |
16647 | EXTCOMMUNITY_LIST_STR | |
16648 | "Extended Community list number (expanded)\n" | |
16649 | "Specify community to reject\n" | |
16650 | "Specify community to accept\n" | |
16651 | "An ordered list as a regular-expression\n") | |
16652 | { | |
16653 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
16654 | } | |
16655 | ||
16656 | DEFUN (ip_extcommunity_list_name_standard, | |
16657 | ip_extcommunity_list_name_standard_cmd, | |
16658 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
16659 | IP_STR | |
16660 | EXTCOMMUNITY_LIST_STR | |
16661 | "Specify standard extcommunity-list\n" | |
16662 | "Extended Community list name\n" | |
16663 | "Specify community to reject\n" | |
16664 | "Specify community to accept\n" | |
16665 | EXTCOMMUNITY_VAL_STR) | |
16666 | { | |
16667 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
16668 | } | |
16669 | ||
16670 | ALIAS (ip_extcommunity_list_name_standard, | |
16671 | ip_extcommunity_list_name_standard2_cmd, | |
16672 | "ip extcommunity-list standard WORD (deny|permit)", | |
16673 | IP_STR | |
16674 | EXTCOMMUNITY_LIST_STR | |
16675 | "Specify standard extcommunity-list\n" | |
16676 | "Extended Community list name\n" | |
16677 | "Specify community to reject\n" | |
16678 | "Specify community to accept\n") | |
16679 | ||
16680 | DEFUN (ip_extcommunity_list_name_expanded, | |
16681 | ip_extcommunity_list_name_expanded_cmd, | |
16682 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
16683 | IP_STR | |
16684 | EXTCOMMUNITY_LIST_STR | |
16685 | "Specify expanded extcommunity-list\n" | |
16686 | "Extended Community list name\n" | |
16687 | "Specify community to reject\n" | |
16688 | "Specify community to accept\n" | |
16689 | "An ordered list as a regular-expression\n") | |
16690 | { | |
16691 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
16692 | } | |
16693 | ||
fee6e4e4 | 16694 | DEFUN (no_ip_extcommunity_list_standard_all, |
16695 | no_ip_extcommunity_list_standard_all_cmd, | |
16696 | "no ip extcommunity-list <1-99>", | |
16697 | NO_STR | |
16698 | IP_STR | |
16699 | EXTCOMMUNITY_LIST_STR | |
16700 | "Extended Community list number (standard)\n") | |
16701 | { | |
813d4307 DW |
16702 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
16703 | } | |
16704 | ||
16705 | DEFUN (no_ip_extcommunity_list_standard_direction, | |
16706 | no_ip_extcommunity_list_standard_direction_cmd, | |
16707 | "no ip extcommunity-list <1-99> (deny|permit)", | |
16708 | NO_STR | |
16709 | IP_STR | |
16710 | EXTCOMMUNITY_LIST_STR | |
16711 | "Extended Community list number (standard)\n" | |
16712 | "Specify community to reject\n" | |
16713 | "Specify community to accept\n") | |
16714 | { | |
16715 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
fee6e4e4 | 16716 | } |
16717 | ||
16718 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
16719 | no_ip_extcommunity_list_expanded_all_cmd, | |
16720 | "no ip extcommunity-list <100-500>", | |
718e3744 | 16721 | NO_STR |
16722 | IP_STR | |
16723 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 16724 | "Extended Community list number (expanded)\n") |
16725 | { | |
813d4307 | 16726 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16727 | } |
16728 | ||
fee6e4e4 | 16729 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
16730 | no_ip_extcommunity_list_name_standard_all_cmd, | |
16731 | "no ip extcommunity-list standard WORD", | |
718e3744 | 16732 | NO_STR |
16733 | IP_STR | |
16734 | EXTCOMMUNITY_LIST_STR | |
16735 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 16736 | "Extended Community list name\n") |
16737 | { | |
813d4307 | 16738 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
fee6e4e4 | 16739 | } |
16740 | ||
16741 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
16742 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
16743 | "no ip extcommunity-list expanded WORD", | |
16744 | NO_STR | |
16745 | IP_STR | |
16746 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 16747 | "Specify expanded extcommunity-list\n" |
16748 | "Extended Community list name\n") | |
16749 | { | |
813d4307 | 16750 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16751 | } |
16752 | ||
16753 | DEFUN (no_ip_extcommunity_list_standard, | |
16754 | no_ip_extcommunity_list_standard_cmd, | |
16755 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
16756 | NO_STR | |
16757 | IP_STR | |
16758 | EXTCOMMUNITY_LIST_STR | |
16759 | "Extended Community list number (standard)\n" | |
16760 | "Specify community to reject\n" | |
16761 | "Specify community to accept\n" | |
16762 | EXTCOMMUNITY_VAL_STR) | |
16763 | { | |
813d4307 | 16764 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
718e3744 | 16765 | } |
16766 | ||
16767 | DEFUN (no_ip_extcommunity_list_expanded, | |
16768 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 16769 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 16770 | NO_STR |
16771 | IP_STR | |
16772 | EXTCOMMUNITY_LIST_STR | |
16773 | "Extended Community list number (expanded)\n" | |
16774 | "Specify community to reject\n" | |
16775 | "Specify community to accept\n" | |
16776 | "An ordered list as a regular-expression\n") | |
16777 | { | |
813d4307 | 16778 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16779 | } |
16780 | ||
16781 | DEFUN (no_ip_extcommunity_list_name_standard, | |
16782 | no_ip_extcommunity_list_name_standard_cmd, | |
16783 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
16784 | NO_STR | |
16785 | IP_STR | |
16786 | EXTCOMMUNITY_LIST_STR | |
16787 | "Specify standard extcommunity-list\n" | |
16788 | "Extended Community list name\n" | |
16789 | "Specify community to reject\n" | |
16790 | "Specify community to accept\n" | |
16791 | EXTCOMMUNITY_VAL_STR) | |
16792 | { | |
813d4307 DW |
16793 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
16794 | } | |
16795 | ||
16796 | DEFUN (no_ip_extcommunity_list_name_standard_brief, | |
16797 | no_ip_extcommunity_list_name_standard_brief_cmd, | |
16798 | "no ip extcommunity-list standard WORD (deny|permit)", | |
16799 | NO_STR | |
16800 | IP_STR | |
16801 | EXTCOMMUNITY_LIST_STR | |
16802 | "Specify standard extcommunity-list\n" | |
16803 | "Extended Community list name\n" | |
16804 | "Specify community to reject\n" | |
16805 | "Specify community to accept\n") | |
16806 | { | |
16807 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
718e3744 | 16808 | } |
16809 | ||
16810 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
16811 | no_ip_extcommunity_list_name_expanded_cmd, | |
16812 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
16813 | NO_STR | |
16814 | IP_STR | |
16815 | EXTCOMMUNITY_LIST_STR | |
16816 | "Specify expanded extcommunity-list\n" | |
16817 | "Community list name\n" | |
16818 | "Specify community to reject\n" | |
16819 | "Specify community to accept\n" | |
16820 | "An ordered list as a regular-expression\n") | |
16821 | { | |
813d4307 | 16822 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16823 | } |
16824 | ||
94f2b392 | 16825 | static void |
718e3744 | 16826 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
16827 | { | |
16828 | struct community_entry *entry; | |
16829 | ||
16830 | for (entry = list->head; entry; entry = entry->next) | |
16831 | { | |
16832 | if (entry == list->head) | |
16833 | { | |
16834 | if (all_digit (list->name)) | |
16835 | vty_out (vty, "Extended community %s list %s%s", | |
16836 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16837 | "standard" : "(expanded) access", | |
16838 | list->name, VTY_NEWLINE); | |
16839 | else | |
16840 | vty_out (vty, "Named extended community %s list %s%s", | |
16841 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16842 | "standard" : "expanded", | |
16843 | list->name, VTY_NEWLINE); | |
16844 | } | |
16845 | if (entry->any) | |
16846 | vty_out (vty, " %s%s", | |
16847 | community_direct_str (entry->direct), VTY_NEWLINE); | |
16848 | else | |
16849 | vty_out (vty, " %s %s%s", | |
16850 | community_direct_str (entry->direct), | |
16851 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16852 | entry->u.ecom->str : entry->config, | |
16853 | VTY_NEWLINE); | |
16854 | } | |
16855 | } | |
16856 | ||
16857 | DEFUN (show_ip_extcommunity_list, | |
16858 | show_ip_extcommunity_list_cmd, | |
16859 | "show ip extcommunity-list", | |
16860 | SHOW_STR | |
16861 | IP_STR | |
16862 | "List extended-community list\n") | |
16863 | { | |
16864 | struct community_list *list; | |
16865 | struct community_list_master *cm; | |
16866 | ||
fee6e4e4 | 16867 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16868 | if (! cm) |
16869 | return CMD_SUCCESS; | |
16870 | ||
16871 | for (list = cm->num.head; list; list = list->next) | |
16872 | extcommunity_list_show (vty, list); | |
16873 | ||
16874 | for (list = cm->str.head; list; list = list->next) | |
16875 | extcommunity_list_show (vty, list); | |
16876 | ||
16877 | return CMD_SUCCESS; | |
16878 | } | |
16879 | ||
16880 | DEFUN (show_ip_extcommunity_list_arg, | |
16881 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 16882 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 16883 | SHOW_STR |
16884 | IP_STR | |
16885 | "List extended-community list\n" | |
16886 | "Extcommunity-list number\n" | |
16887 | "Extcommunity-list name\n") | |
16888 | { | |
16889 | struct community_list *list; | |
16890 | ||
fee6e4e4 | 16891 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16892 | if (! list) |
16893 | { | |
b729294c | 16894 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 16895 | return CMD_WARNING; |
16896 | } | |
16897 | ||
16898 | extcommunity_list_show (vty, list); | |
16899 | ||
16900 | return CMD_SUCCESS; | |
16901 | } | |
6b0655a2 | 16902 | |
718e3744 | 16903 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 16904 | static const char * |
718e3744 | 16905 | community_list_config_str (struct community_entry *entry) |
16906 | { | |
fd79ac91 | 16907 | const char *str; |
718e3744 | 16908 | |
16909 | if (entry->any) | |
16910 | str = ""; | |
16911 | else | |
16912 | { | |
16913 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
16914 | str = community_str (entry->u.com); | |
16915 | else | |
16916 | str = entry->config; | |
16917 | } | |
16918 | return str; | |
16919 | } | |
16920 | ||
16921 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 16922 | static int |
718e3744 | 16923 | community_list_config_write (struct vty *vty) |
16924 | { | |
16925 | struct community_list *list; | |
16926 | struct community_entry *entry; | |
16927 | struct community_list_master *cm; | |
16928 | int write = 0; | |
16929 | ||
16930 | /* Community-list. */ | |
fee6e4e4 | 16931 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 16932 | |
16933 | for (list = cm->num.head; list; list = list->next) | |
16934 | for (entry = list->head; entry; entry = entry->next) | |
16935 | { | |
fee6e4e4 | 16936 | vty_out (vty, "ip community-list %s %s %s%s", |
16937 | list->name, community_direct_str (entry->direct), | |
16938 | community_list_config_str (entry), | |
16939 | VTY_NEWLINE); | |
718e3744 | 16940 | write++; |
16941 | } | |
16942 | for (list = cm->str.head; list; list = list->next) | |
16943 | for (entry = list->head; entry; entry = entry->next) | |
16944 | { | |
16945 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
16946 | entry->style == COMMUNITY_LIST_STANDARD | |
16947 | ? "standard" : "expanded", | |
16948 | list->name, community_direct_str (entry->direct), | |
16949 | community_list_config_str (entry), | |
16950 | VTY_NEWLINE); | |
16951 | write++; | |
16952 | } | |
16953 | ||
16954 | /* Extcommunity-list. */ | |
fee6e4e4 | 16955 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16956 | |
16957 | for (list = cm->num.head; list; list = list->next) | |
16958 | for (entry = list->head; entry; entry = entry->next) | |
16959 | { | |
fee6e4e4 | 16960 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
16961 | list->name, community_direct_str (entry->direct), | |
16962 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 16963 | write++; |
16964 | } | |
16965 | for (list = cm->str.head; list; list = list->next) | |
16966 | for (entry = list->head; entry; entry = entry->next) | |
16967 | { | |
16968 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
16969 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
16970 | ? "standard" : "expanded", | |
16971 | list->name, community_direct_str (entry->direct), | |
16972 | community_list_config_str (entry), VTY_NEWLINE); | |
16973 | write++; | |
16974 | } | |
16975 | return write; | |
16976 | } | |
16977 | ||
7fc626de | 16978 | static struct cmd_node community_list_node = |
718e3744 | 16979 | { |
16980 | COMMUNITY_LIST_NODE, | |
16981 | "", | |
16982 | 1 /* Export to vtysh. */ | |
16983 | }; | |
16984 | ||
94f2b392 | 16985 | static void |
16986 | community_list_vty (void) | |
718e3744 | 16987 | { |
16988 | install_node (&community_list_node, community_list_config_write); | |
16989 | ||
16990 | /* Community-list. */ | |
718e3744 | 16991 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
16992 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
16993 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
16994 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
16995 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
16996 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 16997 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
813d4307 | 16998 | install_element (CONFIG_NODE, &no_ip_community_list_standard_direction_cmd); |
fee6e4e4 | 16999 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
17000 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
17001 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 17002 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
17003 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
17004 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
813d4307 | 17005 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_brief_cmd); |
718e3744 | 17006 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
17007 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
17008 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
17009 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
17010 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
17011 | ||
17012 | /* Extcommunity-list. */ | |
17013 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
17014 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
17015 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
17016 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
17017 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
17018 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 17019 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
813d4307 | 17020 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_direction_cmd); |
fee6e4e4 | 17021 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
17022 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
17023 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 17024 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
17025 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
17026 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
813d4307 | 17027 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_brief_cmd); |
718e3744 | 17028 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
17029 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
17030 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
17031 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
17032 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
17033 | } |