]>
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" |
cdb805bc SK |
35 | #include "if.h" |
36 | #include "vrf.h" | |
718e3744 | 37 | |
38 | #include "bgpd/bgpd.h" | |
4bf6a362 | 39 | #include "bgpd/bgp_advertise.h" |
718e3744 | 40 | #include "bgpd/bgp_attr.h" |
41 | #include "bgpd/bgp_aspath.h" | |
42 | #include "bgpd/bgp_community.h" | |
4bf6a362 PJ |
43 | #include "bgpd/bgp_ecommunity.h" |
44 | #include "bgpd/bgp_damp.h" | |
718e3744 | 45 | #include "bgpd/bgp_debug.h" |
e0701b79 | 46 | #include "bgpd/bgp_fsm.h" |
718e3744 | 47 | #include "bgpd/bgp_mplsvpn.h" |
4bf6a362 | 48 | #include "bgpd/bgp_nexthop.h" |
718e3744 | 49 | #include "bgpd/bgp_open.h" |
4bf6a362 | 50 | #include "bgpd/bgp_regex.h" |
718e3744 | 51 | #include "bgpd/bgp_route.h" |
52 | #include "bgpd/bgp_zebra.h" | |
fee0f4c6 | 53 | #include "bgpd/bgp_table.h" |
94f2b392 | 54 | #include "bgpd/bgp_vty.h" |
165b5fff | 55 | #include "bgpd/bgp_mpath.h" |
cb1faec9 | 56 | #include "bgpd/bgp_packet.h" |
3f9c7369 | 57 | #include "bgpd/bgp_updgrp.h" |
c43ed2e4 | 58 | #include "bgpd/bgp_bfd.h" |
718e3744 | 59 | |
20eb8864 | 60 | static struct peer_group * |
61 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact); | |
62 | ||
718e3744 | 63 | /* Utility function to get address family from current node. */ |
64 | afi_t | |
65 | bgp_node_afi (struct vty *vty) | |
66 | { | |
8ecd3266 | 67 | if (vty->node == BGP_IPV6_NODE || |
68 | vty->node == BGP_IPV6M_NODE || | |
8b1fb8be LB |
69 | vty->node == BGP_VPNV6_NODE || |
70 | vty->node == BGP_ENCAPV6_NODE) | |
718e3744 | 71 | return AFI_IP6; |
72 | return AFI_IP; | |
73 | } | |
74 | ||
75 | /* Utility function to get subsequent address family from current | |
76 | node. */ | |
77 | safi_t | |
78 | bgp_node_safi (struct vty *vty) | |
79 | { | |
6407da5a | 80 | if (vty->node == BGP_VPNV4_NODE || vty->node == BGP_VPNV6_NODE) |
8ecd3266 | 81 | return SAFI_MPLS_VPN; |
8b1fb8be LB |
82 | if (vty->node == BGP_ENCAP_NODE || vty->node == BGP_ENCAPV6_NODE) |
83 | return SAFI_ENCAP; | |
25ffbdc1 | 84 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 85 | return SAFI_MULTICAST; |
86 | return SAFI_UNICAST; | |
87 | } | |
88 | ||
8b1fb8be LB |
89 | int |
90 | bgp_parse_afi(const char *str, afi_t *afi) | |
91 | { | |
92 | if (!strcmp(str, "ipv4")) { | |
93 | *afi = AFI_IP; | |
94 | return 0; | |
95 | } | |
96 | #ifdef HAVE_IPV6 | |
97 | if (!strcmp(str, "ipv6")) { | |
98 | *afi = AFI_IP6; | |
99 | return 0; | |
100 | } | |
101 | #endif /* HAVE_IPV6 */ | |
102 | return -1; | |
103 | } | |
104 | ||
105 | int | |
106 | bgp_parse_safi(const char *str, safi_t *safi) | |
107 | { | |
108 | if (!strcmp(str, "encap")) { | |
109 | *safi = SAFI_ENCAP; | |
110 | return 0; | |
111 | } | |
112 | if (!strcmp(str, "multicast")) { | |
113 | *safi = SAFI_MULTICAST; | |
114 | return 0; | |
115 | } | |
116 | if (!strcmp(str, "unicast")) { | |
117 | *safi = SAFI_UNICAST; | |
118 | return 0; | |
119 | } | |
120 | if (!strcmp(str, "vpn")) { | |
121 | *safi = SAFI_MPLS_VPN; | |
122 | return 0; | |
123 | } | |
124 | return -1; | |
125 | } | |
126 | ||
94f2b392 | 127 | static int |
6aeb9e78 | 128 | peer_address_self_check (struct bgp *bgp, union sockunion *su) |
718e3744 | 129 | { |
130 | struct interface *ifp = NULL; | |
131 | ||
132 | if (su->sa.sa_family == AF_INET) | |
6aeb9e78 | 133 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr, bgp->vrf_id); |
718e3744 | 134 | #ifdef HAVE_IPV6 |
135 | else if (su->sa.sa_family == AF_INET6) | |
f2345335 | 136 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr, |
6aeb9e78 | 137 | su->sin6.sin6_scope_id, bgp->vrf_id); |
718e3744 | 138 | #endif /* HAVE IPV6 */ |
139 | ||
140 | if (ifp) | |
141 | return 1; | |
142 | ||
143 | return 0; | |
144 | } | |
145 | ||
146 | /* Utility function for looking up peer from VTY. */ | |
f14e6fdb DS |
147 | /* This is used only for configuration, so disallow if attempted on |
148 | * a dynamic neighbor. | |
149 | */ | |
94f2b392 | 150 | static struct peer * |
fd79ac91 | 151 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 152 | { |
153 | int ret; | |
154 | struct bgp *bgp; | |
155 | union sockunion su; | |
156 | struct peer *peer; | |
157 | ||
158 | bgp = vty->index; | |
159 | ||
160 | ret = str2sockunion (ip_str, &su); | |
161 | if (ret < 0) | |
162 | { | |
a80beece DS |
163 | peer = peer_lookup_by_conf_if (bgp, ip_str); |
164 | if (!peer) | |
165 | { | |
04b6bdc0 DW |
166 | if ((peer = peer_lookup_by_hostname(bgp, ip_str)) == NULL) |
167 | { | |
168 | vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE); | |
169 | return NULL; | |
170 | } | |
a80beece | 171 | } |
718e3744 | 172 | } |
a80beece | 173 | else |
718e3744 | 174 | { |
a80beece DS |
175 | peer = peer_lookup (bgp, &su); |
176 | if (! peer) | |
177 | { | |
178 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
179 | VTY_NEWLINE); | |
180 | return NULL; | |
181 | } | |
f14e6fdb DS |
182 | if (peer_dynamic_neighbor (peer)) |
183 | { | |
184 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
185 | VTY_NEWLINE); | |
186 | return NULL; | |
187 | } | |
188 | ||
718e3744 | 189 | } |
190 | return peer; | |
191 | } | |
192 | ||
193 | /* Utility function for looking up peer or peer group. */ | |
f14e6fdb DS |
194 | /* This is used only for configuration, so disallow if attempted on |
195 | * a dynamic neighbor. | |
196 | */ | |
c43ed2e4 | 197 | struct peer * |
fd79ac91 | 198 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 199 | { |
200 | int ret; | |
201 | struct bgp *bgp; | |
202 | union sockunion su; | |
f14e6fdb DS |
203 | struct peer *peer = NULL; |
204 | struct peer_group *group = NULL; | |
718e3744 | 205 | |
206 | bgp = vty->index; | |
207 | ||
208 | ret = str2sockunion (peer_str, &su); | |
209 | if (ret == 0) | |
210 | { | |
f14e6fdb | 211 | /* IP address, locate peer. */ |
718e3744 | 212 | peer = peer_lookup (bgp, &su); |
718e3744 | 213 | } |
214 | else | |
215 | { | |
f14e6fdb | 216 | /* Not IP, could match either peer configured on interface or a group. */ |
a80beece | 217 | peer = peer_lookup_by_conf_if (bgp, peer_str); |
f14e6fdb DS |
218 | if (!peer) |
219 | group = peer_group_lookup (bgp, peer_str); | |
220 | } | |
a80beece | 221 | |
f14e6fdb DS |
222 | if (peer) |
223 | { | |
224 | if (peer_dynamic_neighbor (peer)) | |
225 | { | |
226 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
227 | VTY_NEWLINE); | |
228 | return NULL; | |
229 | } | |
230 | ||
231 | return peer; | |
718e3744 | 232 | } |
233 | ||
f14e6fdb DS |
234 | if (group) |
235 | return group->conf; | |
236 | ||
718e3744 | 237 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
238 | VTY_NEWLINE); | |
239 | ||
240 | return NULL; | |
241 | } | |
242 | ||
c43ed2e4 | 243 | int |
718e3744 | 244 | bgp_vty_return (struct vty *vty, int ret) |
245 | { | |
fd79ac91 | 246 | const char *str = NULL; |
718e3744 | 247 | |
248 | switch (ret) | |
249 | { | |
250 | case BGP_ERR_INVALID_VALUE: | |
251 | str = "Invalid value"; | |
252 | break; | |
253 | case BGP_ERR_INVALID_FLAG: | |
254 | str = "Invalid flag"; | |
255 | break; | |
718e3744 | 256 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
257 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
258 | break; | |
718e3744 | 259 | case BGP_ERR_PEER_FLAG_CONFLICT: |
260 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
261 | break; | |
718e3744 | 262 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
263 | str = "Specify remote-as or peer-group remote AS first"; | |
264 | break; | |
265 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
266 | str = "Cannot change the peer-group. Deconfigure first"; | |
267 | break; | |
268 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
4c48cf63 | 269 | str = "Peer is not a member of this peer-group"; |
718e3744 | 270 | break; |
271 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
272 | str = "Prefix/distribute list can not co-exist"; | |
273 | break; | |
274 | case BGP_ERR_NOT_INTERNAL_PEER: | |
275 | str = "Invalid command. Not an internal neighbor"; | |
276 | break; | |
277 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
5000f21c | 278 | str = "remove-private-AS cannot be configured for IBGP peers"; |
718e3744 | 279 | break; |
280 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
281 | str = "Local-AS allowed only for EBGP peers"; | |
282 | break; | |
283 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
284 | str = "Cannot have local-as same as BGP AS number"; | |
285 | break; | |
0df7c91f PJ |
286 | case BGP_ERR_TCPSIG_FAILED: |
287 | str = "Error while applying TCP-Sig to session(s)"; | |
288 | break; | |
fa411a21 NH |
289 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
290 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
291 | break; | |
f5a4827d SH |
292 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
293 | str = "ttl-security only allowed for EBGP peers"; | |
294 | break; | |
c7122e14 DS |
295 | case BGP_ERR_AS_OVERRIDE: |
296 | str = "as-override cannot be configured for IBGP peers"; | |
297 | break; | |
f14e6fdb DS |
298 | case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT: |
299 | str = "Invalid limit for number of dynamic neighbors"; | |
300 | break; | |
301 | case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS: | |
302 | str = "Dynamic neighbor listen range already exists"; | |
303 | break; | |
304 | case BGP_ERR_INVALID_FOR_DYNAMIC_PEER: | |
305 | str = "Operation not allowed on a dynamic neighbor"; | |
306 | break; | |
718e3744 | 307 | } |
308 | if (str) | |
309 | { | |
310 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
311 | return CMD_WARNING; | |
312 | } | |
313 | return CMD_SUCCESS; | |
314 | } | |
315 | ||
7aafcaca DS |
316 | /* BGP clear sort. */ |
317 | enum clear_sort | |
318 | { | |
319 | clear_all, | |
320 | clear_peer, | |
321 | clear_group, | |
322 | clear_external, | |
323 | clear_as | |
324 | }; | |
325 | ||
7aafcaca DS |
326 | static void |
327 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, | |
328 | safi_t safi, int error) | |
329 | { | |
330 | switch (error) | |
331 | { | |
332 | case BGP_ERR_AF_UNCONFIGURED: | |
333 | vty_out (vty, | |
334 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
335 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
336 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
337 | peer->host, VTY_NEWLINE); | |
338 | break; | |
339 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
340 | 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); | |
341 | break; | |
342 | default: | |
343 | break; | |
344 | } | |
345 | } | |
346 | ||
347 | /* `clear ip bgp' functions. */ | |
348 | static int | |
349 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, | |
350 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) | |
351 | { | |
352 | int ret; | |
353 | struct peer *peer; | |
354 | struct listnode *node, *nnode; | |
355 | ||
356 | /* Clear all neighbors. */ | |
357 | /* | |
358 | * Pass along pointer to next node to peer_clear() when walking all nodes | |
359 | * on the BGP instance as that may get freed if it is a doppelganger | |
360 | */ | |
361 | if (sort == clear_all) | |
362 | { | |
363 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
364 | { | |
365 | if (stype == BGP_CLEAR_SOFT_NONE) | |
366 | ret = peer_clear (peer, &nnode); | |
367 | else if (peer->afc[afi][safi]) | |
368 | ret = peer_clear_soft (peer, afi, safi, stype); | |
369 | else | |
370 | ret = 0; | |
371 | ||
372 | if (ret < 0) | |
373 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
374 | } | |
375 | ||
376 | /* This is to apply read-only mode on this clear. */ | |
377 | if (stype == BGP_CLEAR_SOFT_NONE) | |
378 | bgp->update_delay_over = 0; | |
379 | ||
380 | return CMD_SUCCESS; | |
381 | } | |
382 | ||
383 | /* Clear specified neighbors. */ | |
384 | if (sort == clear_peer) | |
385 | { | |
386 | union sockunion su; | |
387 | int ret; | |
388 | ||
389 | /* Make sockunion for lookup. */ | |
390 | ret = str2sockunion (arg, &su); | |
391 | if (ret < 0) | |
392 | { | |
393 | peer = peer_lookup_by_conf_if (bgp, arg); | |
394 | if (!peer) | |
395 | { | |
04b6bdc0 DW |
396 | peer = peer_lookup_by_hostname(bgp, arg); |
397 | if (!peer) | |
398 | { | |
399 | vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE); | |
400 | return CMD_WARNING; | |
401 | } | |
7aafcaca DS |
402 | } |
403 | } | |
404 | else | |
405 | { | |
406 | peer = peer_lookup (bgp, &su); | |
407 | if (! peer) | |
408 | { | |
409 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
410 | return CMD_WARNING; | |
411 | } | |
412 | } | |
413 | ||
414 | if (stype == BGP_CLEAR_SOFT_NONE) | |
415 | ret = peer_clear (peer, NULL); | |
416 | else | |
417 | ret = peer_clear_soft (peer, afi, safi, stype); | |
418 | ||
419 | if (ret < 0) | |
420 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
421 | ||
422 | return CMD_SUCCESS; | |
423 | } | |
424 | ||
425 | /* Clear all peer-group members. */ | |
426 | if (sort == clear_group) | |
427 | { | |
428 | struct peer_group *group; | |
429 | ||
430 | group = peer_group_lookup (bgp, arg); | |
431 | if (! group) | |
432 | { | |
433 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
434 | return CMD_WARNING; | |
435 | } | |
436 | ||
437 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
438 | { | |
439 | if (stype == BGP_CLEAR_SOFT_NONE) | |
440 | { | |
18f1dc06 | 441 | peer_clear (peer, NULL); |
7aafcaca DS |
442 | continue; |
443 | } | |
444 | ||
c8560b44 | 445 | if (! peer->afc[afi][safi]) |
7aafcaca DS |
446 | continue; |
447 | ||
448 | ret = peer_clear_soft (peer, afi, safi, stype); | |
449 | ||
450 | if (ret < 0) | |
451 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
452 | } | |
453 | return CMD_SUCCESS; | |
454 | } | |
455 | ||
456 | if (sort == clear_external) | |
457 | { | |
458 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
459 | { | |
460 | if (peer->sort == BGP_PEER_IBGP) | |
461 | continue; | |
462 | ||
463 | if (stype == BGP_CLEAR_SOFT_NONE) | |
464 | ret = peer_clear (peer, &nnode); | |
465 | else | |
466 | ret = peer_clear_soft (peer, afi, safi, stype); | |
467 | ||
468 | if (ret < 0) | |
469 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
470 | } | |
471 | return CMD_SUCCESS; | |
472 | } | |
473 | ||
474 | if (sort == clear_as) | |
475 | { | |
476 | as_t as; | |
477 | int find = 0; | |
478 | ||
479 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); | |
480 | ||
481 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
482 | { | |
483 | if (peer->as != as) | |
484 | continue; | |
485 | ||
486 | find = 1; | |
487 | if (stype == BGP_CLEAR_SOFT_NONE) | |
488 | ret = peer_clear (peer, &nnode); | |
489 | else | |
490 | ret = peer_clear_soft (peer, afi, safi, stype); | |
491 | ||
492 | if (ret < 0) | |
493 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
494 | } | |
495 | if (! find) | |
496 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
497 | VTY_NEWLINE); | |
498 | return CMD_SUCCESS; | |
499 | } | |
500 | ||
501 | return CMD_SUCCESS; | |
502 | } | |
503 | ||
504 | static int | |
505 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, | |
506 | enum clear_sort sort, enum bgp_clear_type stype, | |
507 | const char *arg) | |
508 | { | |
509 | struct bgp *bgp; | |
510 | ||
511 | /* BGP structure lookup. */ | |
512 | if (name) | |
513 | { | |
514 | bgp = bgp_lookup_by_name (name); | |
515 | if (bgp == NULL) | |
516 | { | |
6aeb9e78 | 517 | vty_out (vty, "Can't find BGP instance %s%s", name, VTY_NEWLINE); |
7aafcaca DS |
518 | return CMD_WARNING; |
519 | } | |
520 | } | |
521 | else | |
522 | { | |
523 | bgp = bgp_get_default (); | |
524 | if (bgp == NULL) | |
525 | { | |
526 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
527 | return CMD_WARNING; | |
528 | } | |
529 | } | |
530 | ||
531 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); | |
532 | } | |
533 | ||
534 | /* clear soft inbound */ | |
535 | static void | |
536 | bgp_clear_star_soft_in (struct vty *vty) | |
537 | { | |
538 | bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
539 | BGP_CLEAR_SOFT_IN, NULL); | |
540 | #ifdef HAVE_IPV6 | |
541 | bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
542 | BGP_CLEAR_SOFT_IN, NULL); | |
543 | #endif /* HAVE_IPV6 */ | |
544 | } | |
545 | ||
546 | /* clear soft outbound */ | |
547 | static void | |
548 | bgp_clear_star_soft_out (struct vty *vty) | |
549 | { | |
550 | bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
551 | BGP_CLEAR_SOFT_OUT, NULL); | |
552 | #ifdef HAVE_IPV6 | |
553 | bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
554 | BGP_CLEAR_SOFT_OUT, NULL); | |
555 | #endif /* HAVE_IPV6 */ | |
556 | } | |
557 | ||
558 | ||
718e3744 | 559 | /* BGP global configuration. */ |
560 | ||
561 | DEFUN (bgp_multiple_instance_func, | |
562 | bgp_multiple_instance_cmd, | |
563 | "bgp multiple-instance", | |
564 | BGP_STR | |
565 | "Enable bgp multiple instance\n") | |
566 | { | |
567 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
568 | return CMD_SUCCESS; | |
569 | } | |
570 | ||
571 | DEFUN (no_bgp_multiple_instance, | |
572 | no_bgp_multiple_instance_cmd, | |
573 | "no bgp multiple-instance", | |
574 | NO_STR | |
575 | BGP_STR | |
576 | "BGP multiple instance\n") | |
577 | { | |
578 | int ret; | |
579 | ||
580 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
581 | if (ret < 0) | |
582 | { | |
583 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
584 | return CMD_WARNING; | |
585 | } | |
586 | return CMD_SUCCESS; | |
587 | } | |
588 | ||
589 | DEFUN (bgp_config_type, | |
590 | bgp_config_type_cmd, | |
591 | "bgp config-type (cisco|zebra)", | |
592 | BGP_STR | |
593 | "Configuration type\n" | |
594 | "cisco\n" | |
595 | "zebra\n") | |
596 | { | |
597 | if (strncmp (argv[0], "c", 1) == 0) | |
598 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
599 | else | |
600 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
601 | ||
602 | return CMD_SUCCESS; | |
603 | } | |
604 | ||
605 | DEFUN (no_bgp_config_type, | |
606 | no_bgp_config_type_cmd, | |
607 | "no bgp config-type", | |
608 | NO_STR | |
609 | BGP_STR | |
610 | "Display configuration type\n") | |
611 | { | |
612 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
613 | return CMD_SUCCESS; | |
614 | } | |
615 | ||
813d4307 DW |
616 | ALIAS (no_bgp_config_type, |
617 | no_bgp_config_type_val_cmd, | |
618 | "no bgp config-type (cisco|zebra)", | |
619 | NO_STR | |
620 | BGP_STR | |
621 | "Configuration type\n" | |
622 | "cisco\n" | |
623 | "zebra\n") | |
624 | ||
718e3744 | 625 | DEFUN (no_synchronization, |
626 | no_synchronization_cmd, | |
627 | "no synchronization", | |
628 | NO_STR | |
629 | "Perform IGP synchronization\n") | |
630 | { | |
631 | return CMD_SUCCESS; | |
632 | } | |
633 | ||
634 | DEFUN (no_auto_summary, | |
635 | no_auto_summary_cmd, | |
636 | "no auto-summary", | |
637 | NO_STR | |
638 | "Enable automatic network number summarization\n") | |
639 | { | |
640 | return CMD_SUCCESS; | |
641 | } | |
3d515fd9 | 642 | |
718e3744 | 643 | /* "router bgp" commands. */ |
644 | DEFUN (router_bgp, | |
645 | router_bgp_cmd, | |
320da874 | 646 | "router bgp " CMD_AS_RANGE, |
718e3744 | 647 | ROUTER_STR |
648 | BGP_STR | |
649 | AS_STR) | |
650 | { | |
651 | int ret; | |
652 | as_t as; | |
653 | struct bgp *bgp; | |
fd79ac91 | 654 | const char *name = NULL; |
ad4cbda1 | 655 | enum bgp_instance_type inst_type; |
718e3744 | 656 | |
2385a876 DW |
657 | // "router bgp" without an ASN |
658 | if (argc < 1) | |
659 | { | |
6aeb9e78 | 660 | //Pending: Make VRF option available for ASN less config |
2385a876 | 661 | bgp = bgp_get_default(); |
718e3744 | 662 | |
2385a876 DW |
663 | if (bgp == NULL) |
664 | { | |
665 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
666 | return CMD_WARNING; | |
667 | } | |
718e3744 | 668 | |
2385a876 DW |
669 | if (listcount(bm->bgp) > 1) |
670 | { | |
671 | vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE); | |
672 | return CMD_WARNING; | |
673 | } | |
674 | } | |
675 | ||
676 | // "router bgp X" | |
677 | else | |
718e3744 | 678 | { |
2385a876 DW |
679 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
680 | ||
ad4cbda1 | 681 | inst_type = BGP_INSTANCE_TYPE_DEFAULT; |
6aeb9e78 | 682 | if (argc == 3) |
ad4cbda1 | 683 | { |
684 | name = argv[2]; | |
685 | if (!strcmp(argv[1], "vrf")) | |
686 | inst_type = BGP_INSTANCE_TYPE_VRF; | |
687 | else if (!strcmp(argv[1], "view")) | |
688 | inst_type = BGP_INSTANCE_TYPE_VIEW; | |
689 | } | |
2385a876 | 690 | |
ad4cbda1 | 691 | ret = bgp_get (&bgp, &as, name, inst_type); |
2385a876 DW |
692 | switch (ret) |
693 | { | |
694 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
695 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
696 | VTY_NEWLINE); | |
697 | return CMD_WARNING; | |
698 | case BGP_ERR_AS_MISMATCH: | |
699 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); | |
700 | return CMD_WARNING; | |
701 | case BGP_ERR_INSTANCE_MISMATCH: | |
6aeb9e78 | 702 | vty_out (vty, "BGP instance name and AS number mismatch%s", VTY_NEWLINE); |
2385a876 DW |
703 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
704 | as, VTY_NEWLINE); | |
705 | return CMD_WARNING; | |
706 | } | |
6aeb9e78 DS |
707 | |
708 | /* Pending: handle when user tries to change a view to vrf n vv. */ | |
718e3744 | 709 | } |
710 | ||
711 | vty->node = BGP_NODE; | |
712 | vty->index = bgp; | |
713 | ||
714 | return CMD_SUCCESS; | |
715 | } | |
716 | ||
717 | ALIAS (router_bgp, | |
6aeb9e78 DS |
718 | router_bgp_instance_cmd, |
719 | "router bgp " CMD_AS_RANGE " (view|vrf) WORD", | |
718e3744 | 720 | ROUTER_STR |
721 | BGP_STR | |
722 | AS_STR | |
6aeb9e78 | 723 | "BGP view\nBGP VRF\n" |
8386ac43 | 724 | "View/VRF name\n") |
6b0655a2 | 725 | |
2385a876 DW |
726 | ALIAS (router_bgp, |
727 | router_bgp_noasn_cmd, | |
728 | "router bgp", | |
729 | ROUTER_STR | |
730 | BGP_STR) | |
731 | ||
718e3744 | 732 | /* "no router bgp" commands. */ |
733 | DEFUN (no_router_bgp, | |
734 | no_router_bgp_cmd, | |
320da874 | 735 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 736 | NO_STR |
737 | ROUTER_STR | |
738 | BGP_STR | |
739 | AS_STR) | |
740 | { | |
741 | as_t as; | |
742 | struct bgp *bgp; | |
fd79ac91 | 743 | const char *name = NULL; |
718e3744 | 744 | |
0b2aa3a0 | 745 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 746 | |
6aeb9e78 DS |
747 | if (argc == 3) |
748 | name = argv[2]; | |
718e3744 | 749 | |
750 | /* Lookup bgp structure. */ | |
751 | bgp = bgp_lookup (as, name); | |
752 | if (! bgp) | |
753 | { | |
754 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
755 | return CMD_WARNING; | |
756 | } | |
757 | ||
758 | bgp_delete (bgp); | |
759 | ||
760 | return CMD_SUCCESS; | |
761 | } | |
762 | ||
763 | ALIAS (no_router_bgp, | |
6aeb9e78 DS |
764 | no_router_bgp_instance_cmd, |
765 | "no router bgp " CMD_AS_RANGE " (view|vrf) WORD", | |
718e3744 | 766 | NO_STR |
767 | ROUTER_STR | |
768 | BGP_STR | |
769 | AS_STR | |
6aeb9e78 | 770 | "BGP view\nBGP VRF\n" |
8386ac43 | 771 | "View/VRF name\n") |
6b0655a2 | 772 | |
718e3744 | 773 | /* BGP router-id. */ |
774 | ||
775 | DEFUN (bgp_router_id, | |
776 | bgp_router_id_cmd, | |
777 | "bgp router-id A.B.C.D", | |
778 | BGP_STR | |
779 | "Override configured router identifier\n" | |
780 | "Manually configured router identifier\n") | |
781 | { | |
782 | int ret; | |
783 | struct in_addr id; | |
784 | struct bgp *bgp; | |
785 | ||
786 | bgp = vty->index; | |
787 | ||
788 | ret = inet_aton (argv[0], &id); | |
789 | if (! ret) | |
790 | { | |
791 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
792 | return CMD_WARNING; | |
793 | } | |
794 | ||
c2d58d6d | 795 | if (IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
796 | return CMD_SUCCESS; | |
797 | ||
18a6dce6 | 798 | bgp->router_id_static = id; |
718e3744 | 799 | bgp_router_id_set (bgp, &id); |
800 | ||
801 | return CMD_SUCCESS; | |
802 | } | |
803 | ||
804 | DEFUN (no_bgp_router_id, | |
805 | no_bgp_router_id_cmd, | |
806 | "no bgp router-id", | |
807 | NO_STR | |
808 | BGP_STR | |
809 | "Override configured router identifier\n") | |
810 | { | |
811 | int ret; | |
812 | struct in_addr id; | |
813 | struct bgp *bgp; | |
cdb805bc SK |
814 | struct interface *ifp; |
815 | struct listnode *node; | |
816 | struct connected *ifc; | |
817 | struct prefix *p; | |
718e3744 | 818 | |
819 | bgp = vty->index; | |
820 | ||
821 | if (argc == 1) | |
822 | { | |
823 | ret = inet_aton (argv[0], &id); | |
824 | if (! ret) | |
cdb805bc SK |
825 | { |
826 | ifp = if_lookup_by_name_vrf(argv[0], bgp->vrf_id); | |
827 | if (!ifp) { | |
828 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
829 | return CMD_WARNING; | |
830 | } | |
831 | for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) | |
832 | { | |
833 | p = ifc->address; | |
834 | if (p && (p->family == AF_INET)) | |
835 | { | |
836 | id = p->u.prefix4; | |
837 | break; | |
838 | } | |
839 | } | |
840 | } | |
718e3744 | 841 | |
18a6dce6 | 842 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
cdb805bc SK |
843 | { |
844 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
845 | return CMD_WARNING; | |
846 | } | |
718e3744 | 847 | } |
848 | ||
18a6dce6 | 849 | bgp->router_id_static.s_addr = 0; |
6aeb9e78 | 850 | bgp_router_id_set (bgp, &bgp->router_id_zebra); |
718e3744 | 851 | |
852 | return CMD_SUCCESS; | |
853 | } | |
854 | ||
855 | ALIAS (no_bgp_router_id, | |
856 | no_bgp_router_id_val_cmd, | |
857 | "no bgp router-id A.B.C.D", | |
858 | NO_STR | |
859 | BGP_STR | |
860 | "Override configured router identifier\n" | |
861 | "Manually configured router identifier\n") | |
6b0655a2 | 862 | |
cdb805bc SK |
863 | DEFUN (bgp_router_id_interface, |
864 | bgp_router_id_interface_cmd, | |
865 | "bgp router-id IFNAME", | |
866 | BGP_STR | |
867 | "Override configured router identifier\n" | |
868 | "Interface name\n") | |
869 | { | |
870 | struct bgp *bgp; | |
871 | struct interface *ifp; | |
872 | struct connected *ifc; | |
873 | struct listnode *node; | |
874 | struct prefix *p; | |
875 | struct vrf *vrf; | |
876 | ||
877 | bgp = vty->index; | |
878 | p = NULL; | |
879 | ||
880 | ifp = if_lookup_by_name_vrf(argv[0], bgp->vrf_id); | |
881 | if (!ifp) | |
882 | { | |
883 | vrf = vrf_lookup(bgp->vrf_id); | |
884 | vty_out (vty, "%% Couldnt find interface %s in VRF %s%s", argv[0], vrf? vrf->name:"", VTY_NEWLINE); | |
885 | return CMD_WARNING; | |
886 | } | |
887 | ||
888 | for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) | |
889 | { | |
890 | p = ifc->address; | |
891 | ||
892 | if (p && (p->family == AF_INET)) | |
893 | { | |
894 | if (IPV4_ADDR_SAME (&bgp->router_id_static, &p->u.prefix4)) | |
895 | return CMD_SUCCESS; | |
896 | bgp->router_id_static = p->u.prefix4; | |
897 | bgp_router_id_set (bgp, &p->u.prefix4); | |
898 | return CMD_SUCCESS; | |
899 | } | |
900 | } | |
901 | vty_out (vty, "%% Couldnt assign the router-id%s", VTY_NEWLINE); | |
902 | return CMD_WARNING; | |
903 | } | |
904 | ||
905 | ALIAS (no_bgp_router_id, | |
906 | no_bgp_router_id_interface_cmd, | |
907 | "no bgp router-id IFNAME", | |
908 | NO_STR | |
909 | BGP_STR | |
910 | "Override configured router identifier\n" | |
911 | "Interface name\n") | |
912 | ||
718e3744 | 913 | /* BGP Cluster ID. */ |
914 | ||
915 | DEFUN (bgp_cluster_id, | |
916 | bgp_cluster_id_cmd, | |
917 | "bgp cluster-id A.B.C.D", | |
918 | BGP_STR | |
919 | "Configure Route-Reflector Cluster-id\n" | |
920 | "Route-Reflector Cluster-id in IP address format\n") | |
921 | { | |
922 | int ret; | |
923 | struct bgp *bgp; | |
924 | struct in_addr cluster; | |
925 | ||
926 | bgp = vty->index; | |
927 | ||
928 | ret = inet_aton (argv[0], &cluster); | |
929 | if (! ret) | |
930 | { | |
931 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
932 | return CMD_WARNING; | |
933 | } | |
934 | ||
935 | bgp_cluster_id_set (bgp, &cluster); | |
7aafcaca | 936 | bgp_clear_star_soft_out (vty); |
718e3744 | 937 | |
938 | return CMD_SUCCESS; | |
939 | } | |
940 | ||
941 | ALIAS (bgp_cluster_id, | |
942 | bgp_cluster_id32_cmd, | |
943 | "bgp cluster-id <1-4294967295>", | |
944 | BGP_STR | |
945 | "Configure Route-Reflector Cluster-id\n" | |
946 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
947 | ||
948 | DEFUN (no_bgp_cluster_id, | |
949 | no_bgp_cluster_id_cmd, | |
950 | "no bgp cluster-id", | |
951 | NO_STR | |
952 | BGP_STR | |
953 | "Configure Route-Reflector Cluster-id\n") | |
954 | { | |
955 | int ret; | |
956 | struct bgp *bgp; | |
957 | struct in_addr cluster; | |
958 | ||
959 | bgp = vty->index; | |
960 | ||
961 | if (argc == 1) | |
962 | { | |
963 | ret = inet_aton (argv[0], &cluster); | |
964 | if (! ret) | |
965 | { | |
966 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
967 | return CMD_WARNING; | |
968 | } | |
969 | } | |
970 | ||
971 | bgp_cluster_id_unset (bgp); | |
7aafcaca | 972 | bgp_clear_star_soft_out (vty); |
718e3744 | 973 | |
974 | return CMD_SUCCESS; | |
975 | } | |
976 | ||
977 | ALIAS (no_bgp_cluster_id, | |
813d4307 | 978 | no_bgp_cluster_id_ip_cmd, |
718e3744 | 979 | "no bgp cluster-id A.B.C.D", |
980 | NO_STR | |
981 | BGP_STR | |
982 | "Configure Route-Reflector Cluster-id\n" | |
983 | "Route-Reflector Cluster-id in IP address format\n") | |
6b0655a2 | 984 | |
813d4307 DW |
985 | ALIAS (no_bgp_cluster_id, |
986 | no_bgp_cluster_id_decimal_cmd, | |
987 | "no bgp cluster-id <1-4294967295>", | |
988 | NO_STR | |
989 | BGP_STR | |
990 | "Configure Route-Reflector Cluster-id\n" | |
991 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
992 | ||
718e3744 | 993 | DEFUN (bgp_confederation_identifier, |
994 | bgp_confederation_identifier_cmd, | |
320da874 | 995 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 996 | "BGP specific commands\n" |
997 | "AS confederation parameters\n" | |
998 | "AS number\n" | |
999 | "Set routing domain confederation AS\n") | |
1000 | { | |
1001 | struct bgp *bgp; | |
1002 | as_t as; | |
1003 | ||
1004 | bgp = vty->index; | |
1005 | ||
0b2aa3a0 | 1006 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 1007 | |
1008 | bgp_confederation_id_set (bgp, as); | |
1009 | ||
1010 | return CMD_SUCCESS; | |
1011 | } | |
1012 | ||
1013 | DEFUN (no_bgp_confederation_identifier, | |
1014 | no_bgp_confederation_identifier_cmd, | |
1015 | "no bgp confederation identifier", | |
1016 | NO_STR | |
1017 | "BGP specific commands\n" | |
1018 | "AS confederation parameters\n" | |
1019 | "AS number\n") | |
1020 | { | |
1021 | struct bgp *bgp; | |
718e3744 | 1022 | |
1023 | bgp = vty->index; | |
1024 | ||
718e3744 | 1025 | bgp_confederation_id_unset (bgp); |
1026 | ||
1027 | return CMD_SUCCESS; | |
1028 | } | |
1029 | ||
1030 | ALIAS (no_bgp_confederation_identifier, | |
1031 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 1032 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 1033 | NO_STR |
1034 | "BGP specific commands\n" | |
1035 | "AS confederation parameters\n" | |
1036 | "AS number\n" | |
1037 | "Set routing domain confederation AS\n") | |
6b0655a2 | 1038 | |
718e3744 | 1039 | DEFUN (bgp_confederation_peers, |
1040 | bgp_confederation_peers_cmd, | |
320da874 | 1041 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 1042 | "BGP specific commands\n" |
1043 | "AS confederation parameters\n" | |
1044 | "Peer ASs in BGP confederation\n" | |
1045 | AS_STR) | |
1046 | { | |
1047 | struct bgp *bgp; | |
1048 | as_t as; | |
1049 | int i; | |
1050 | ||
1051 | bgp = vty->index; | |
1052 | ||
1053 | for (i = 0; i < argc; i++) | |
1054 | { | |
0b2aa3a0 | 1055 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 1056 | |
1057 | if (bgp->as == as) | |
1058 | { | |
1059 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
1060 | VTY_NEWLINE); | |
1061 | continue; | |
1062 | } | |
1063 | ||
1064 | bgp_confederation_peers_add (bgp, as); | |
1065 | } | |
1066 | return CMD_SUCCESS; | |
1067 | } | |
1068 | ||
1069 | DEFUN (no_bgp_confederation_peers, | |
1070 | no_bgp_confederation_peers_cmd, | |
320da874 | 1071 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 1072 | NO_STR |
1073 | "BGP specific commands\n" | |
1074 | "AS confederation parameters\n" | |
1075 | "Peer ASs in BGP confederation\n" | |
1076 | AS_STR) | |
1077 | { | |
1078 | struct bgp *bgp; | |
1079 | as_t as; | |
1080 | int i; | |
1081 | ||
1082 | bgp = vty->index; | |
1083 | ||
1084 | for (i = 0; i < argc; i++) | |
1085 | { | |
0b2aa3a0 PJ |
1086 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
1087 | ||
718e3744 | 1088 | bgp_confederation_peers_remove (bgp, as); |
1089 | } | |
1090 | return CMD_SUCCESS; | |
1091 | } | |
6b0655a2 | 1092 | |
5e242b0d DS |
1093 | /** |
1094 | * Central routine for maximum-paths configuration. | |
1095 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
1096 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
1097 | */ | |
ffd0c037 DS |
1098 | static int |
1099 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, | |
5e242b0d | 1100 | u_int16_t options, int set) |
165b5fff JB |
1101 | { |
1102 | struct bgp *bgp; | |
ffd0c037 | 1103 | u_int16_t maxpaths = 0; |
165b5fff | 1104 | int ret; |
5e242b0d DS |
1105 | afi_t afi; |
1106 | safi_t safi; | |
165b5fff JB |
1107 | |
1108 | bgp = vty->index; | |
5e242b0d DS |
1109 | afi = bgp_node_afi (vty); |
1110 | safi = bgp_node_safi (vty); | |
165b5fff | 1111 | |
5e242b0d DS |
1112 | if (set) |
1113 | { | |
73ac8160 | 1114 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
5b964da3 | 1115 | MULTIPATH_NUM); |
5e242b0d DS |
1116 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
1117 | options); | |
1118 | } | |
1119 | else | |
1120 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 1121 | |
165b5fff JB |
1122 | if (ret < 0) |
1123 | { | |
1124 | vty_out (vty, | |
5e242b0d DS |
1125 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
1126 | (set == 1) ? "" : "un", | |
1127 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
1128 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
1129 | return CMD_WARNING; |
1130 | } | |
1131 | ||
7aafcaca DS |
1132 | bgp_recalculate_all_bestpaths (bgp); |
1133 | ||
165b5fff JB |
1134 | return CMD_SUCCESS; |
1135 | } | |
1136 | ||
abc920f8 DS |
1137 | DEFUN (bgp_maxmed_admin, |
1138 | bgp_maxmed_admin_cmd, | |
1139 | "bgp max-med administrative ", | |
1140 | BGP_STR | |
1141 | "Advertise routes with max-med\n" | |
1142 | "Administratively applied, for an indefinite period\n") | |
1143 | { | |
1144 | struct bgp *bgp; | |
1145 | ||
1146 | bgp = vty->index; | |
1147 | ||
1148 | bgp->v_maxmed_admin = 1; | |
1149 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1150 | ||
1151 | bgp_maxmed_update(bgp); | |
1152 | ||
1153 | return CMD_SUCCESS; | |
1154 | } | |
1155 | ||
1156 | DEFUN (bgp_maxmed_admin_medv, | |
1157 | bgp_maxmed_admin_medv_cmd, | |
1158 | "bgp max-med administrative <0-4294967294>", | |
1159 | BGP_STR | |
1160 | "Advertise routes with max-med\n" | |
1161 | "Administratively applied, for an indefinite period\n" | |
1162 | "Max MED value to be used\n") | |
1163 | { | |
1164 | struct bgp *bgp; | |
1165 | ||
1166 | bgp = vty->index; | |
1167 | ||
1168 | bgp->v_maxmed_admin = 1; | |
1169 | VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]); | |
1170 | ||
1171 | bgp_maxmed_update(bgp); | |
1172 | ||
1173 | return CMD_SUCCESS; | |
1174 | } | |
1175 | ||
1176 | DEFUN (no_bgp_maxmed_admin, | |
1177 | no_bgp_maxmed_admin_cmd, | |
1178 | "no bgp max-med administrative", | |
1179 | NO_STR | |
1180 | BGP_STR | |
1181 | "Advertise routes with max-med\n" | |
1182 | "Administratively applied, for an indefinite period\n") | |
1183 | { | |
1184 | struct bgp *bgp; | |
1185 | ||
1186 | bgp = vty->index; | |
1187 | ||
1188 | bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED; | |
1189 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1190 | ||
1191 | bgp_maxmed_update(bgp); | |
1192 | ||
1193 | return CMD_SUCCESS; | |
1194 | } | |
1195 | ||
1196 | ALIAS (no_bgp_maxmed_admin, | |
1197 | no_bgp_maxmed_admin_medv_cmd, | |
1198 | "no bgp max-med administrative <0-4294967294>", | |
1199 | NO_STR | |
1200 | BGP_STR | |
1201 | "Advertise routes with max-med\n" | |
1202 | "Administratively applied, for an indefinite period\n" | |
1203 | "Max MED value to be used\n") | |
1204 | ||
1205 | ||
1206 | DEFUN (bgp_maxmed_onstartup, | |
1207 | bgp_maxmed_onstartup_cmd, | |
1208 | "bgp max-med on-startup <5-86400>", | |
1209 | BGP_STR | |
1210 | "Advertise routes with max-med\n" | |
1211 | "Effective on a startup\n" | |
1212 | "Time (seconds) period for max-med\n") | |
1213 | { | |
1214 | struct bgp *bgp; | |
1215 | ||
1216 | bgp = vty->index; | |
1217 | ||
1218 | if (argc != 1) | |
1219 | { | |
1220 | vty_out (vty, "%% Must supply max-med on-startup period"); | |
1221 | return CMD_WARNING; | |
1222 | } | |
1223 | ||
1224 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1225 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1226 | ||
1227 | bgp_maxmed_update(bgp); | |
1228 | ||
1229 | return CMD_SUCCESS; | |
1230 | } | |
1231 | ||
1232 | DEFUN (bgp_maxmed_onstartup_medv, | |
1233 | bgp_maxmed_onstartup_medv_cmd, | |
1234 | "bgp max-med on-startup <5-86400> <0-4294967294>", | |
1235 | BGP_STR | |
1236 | "Advertise routes with max-med\n" | |
1237 | "Effective on a startup\n" | |
1238 | "Time (seconds) period for max-med\n" | |
1239 | "Max MED value to be used\n") | |
1240 | { | |
1241 | struct bgp *bgp; | |
1242 | ||
1243 | bgp = vty->index; | |
1244 | ||
1245 | if (argc != 2) | |
1246 | { | |
1247 | vty_out (vty, "%% Must supply max-med on-startup period and med value"); | |
1248 | return CMD_WARNING; | |
1249 | } | |
1250 | ||
1251 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1252 | VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]); | |
1253 | ||
1254 | bgp_maxmed_update(bgp); | |
1255 | ||
1256 | return CMD_SUCCESS; | |
1257 | } | |
1258 | ||
1259 | DEFUN (no_bgp_maxmed_onstartup, | |
1260 | no_bgp_maxmed_onstartup_cmd, | |
1261 | "no bgp max-med on-startup", | |
1262 | NO_STR | |
1263 | BGP_STR | |
1264 | "Advertise routes with max-med\n" | |
1265 | "Effective on a startup\n") | |
1266 | { | |
1267 | struct bgp *bgp; | |
1268 | ||
1269 | bgp = vty->index; | |
1270 | ||
1271 | /* Cancel max-med onstartup if its on */ | |
1272 | if (bgp->t_maxmed_onstartup) | |
1273 | { | |
1274 | THREAD_TIMER_OFF (bgp->t_maxmed_onstartup); | |
1275 | bgp->maxmed_onstartup_over = 1; | |
1276 | } | |
1277 | ||
1278 | bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED; | |
1279 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1280 | ||
1281 | bgp_maxmed_update(bgp); | |
1282 | ||
1283 | return CMD_SUCCESS; | |
1284 | } | |
1285 | ||
1286 | ALIAS (no_bgp_maxmed_onstartup, | |
1287 | no_bgp_maxmed_onstartup_period_cmd, | |
1288 | "no bgp max-med on-startup <5-86400>", | |
1289 | NO_STR | |
1290 | BGP_STR | |
1291 | "Advertise routes with max-med\n" | |
1292 | "Effective on a startup\n" | |
1293 | "Time (seconds) period for max-med\n") | |
1294 | ||
1295 | ALIAS (no_bgp_maxmed_onstartup, | |
1296 | no_bgp_maxmed_onstartup_period_medv_cmd, | |
1297 | "no bgp max-med on-startup <5-86400> <0-4294967294>", | |
1298 | NO_STR | |
1299 | BGP_STR | |
1300 | "Advertise routes with max-med\n" | |
1301 | "Effective on a startup\n" | |
1302 | "Time (seconds) period for max-med\n" | |
1303 | "Max MED value to be used\n") | |
1304 | ||
f188f2c4 DS |
1305 | static int |
1306 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
1307 | const char *wait) | |
1308 | { | |
1309 | struct bgp *bgp; | |
1310 | u_int16_t update_delay; | |
1311 | u_int16_t establish_wait; | |
1312 | ||
1313 | ||
1314 | bgp = vty->index; | |
1315 | ||
1316 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
1317 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
1318 | ||
1319 | if (!wait) /* update-delay <delay> */ | |
1320 | { | |
1321 | bgp->v_update_delay = update_delay; | |
1322 | bgp->v_establish_wait = bgp->v_update_delay; | |
1323 | return CMD_SUCCESS; | |
1324 | } | |
1325 | ||
1326 | /* update-delay <delay> <establish-wait> */ | |
1327 | establish_wait = atoi (wait); | |
1328 | if (update_delay < establish_wait) | |
1329 | { | |
1330 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
1331 | VTY_NEWLINE); | |
1332 | return CMD_WARNING; | |
1333 | } | |
1334 | ||
1335 | bgp->v_update_delay = update_delay; | |
1336 | bgp->v_establish_wait = establish_wait; | |
1337 | ||
1338 | return CMD_SUCCESS; | |
1339 | } | |
1340 | ||
1341 | static int | |
1342 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
1343 | { | |
1344 | struct bgp *bgp; | |
1345 | ||
1346 | bgp = vty->index; | |
1347 | ||
1348 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
1349 | bgp->v_establish_wait = bgp->v_update_delay; | |
1350 | ||
1351 | return CMD_SUCCESS; | |
1352 | } | |
1353 | ||
1354 | int | |
1355 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
1356 | { | |
1357 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
1358 | { | |
1359 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
1360 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
1361 | vty_out (vty, " %d", bgp->v_establish_wait); | |
1362 | vty_out (vty, "%s", VTY_NEWLINE); | |
1363 | } | |
1364 | ||
1365 | return 0; | |
1366 | } | |
1367 | ||
1368 | ||
1369 | /* Update-delay configuration */ | |
1370 | DEFUN (bgp_update_delay, | |
1371 | bgp_update_delay_cmd, | |
1372 | "update-delay <0-3600>", | |
1373 | "Force initial delay for best-path and updates\n" | |
1374 | "Seconds\n") | |
1375 | { | |
1376 | return bgp_update_delay_config_vty(vty, argv[0], NULL); | |
1377 | } | |
1378 | ||
1379 | DEFUN (bgp_update_delay_establish_wait, | |
1380 | bgp_update_delay_establish_wait_cmd, | |
1381 | "update-delay <0-3600> <1-3600>", | |
1382 | "Force initial delay for best-path and updates\n" | |
1383 | "Seconds\n" | |
1384 | "Wait for peers to be established\n" | |
1385 | "Seconds\n") | |
1386 | { | |
1387 | return bgp_update_delay_config_vty(vty, argv[0], argv[1]); | |
1388 | } | |
1389 | ||
1390 | /* Update-delay deconfiguration */ | |
1391 | DEFUN (no_bgp_update_delay, | |
1392 | no_bgp_update_delay_cmd, | |
1393 | "no update-delay <0-3600>", | |
1394 | "Force initial delay for best-path and updates\n" | |
1395 | "Seconds\n") | |
1396 | { | |
1397 | return bgp_update_delay_deconfig_vty(vty); | |
1398 | } | |
1399 | ||
1400 | ALIAS (no_bgp_update_delay, | |
1401 | no_bgp_update_delay_establish_wait_cmd, | |
1402 | "no update-delay <0-3600> <1-3600>", | |
1403 | "Force initial delay for best-path and updates\n" | |
1404 | "Seconds\n" | |
1405 | "Wait for peers to be established\n" | |
1406 | "Seconds\n") | |
5e242b0d | 1407 | |
ffd0c037 DS |
1408 | static int |
1409 | bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set) | |
cb1faec9 DS |
1410 | { |
1411 | struct bgp *bgp; | |
cb1faec9 DS |
1412 | |
1413 | bgp = vty->index; | |
1414 | ||
1415 | if (set) | |
1416 | VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num, | |
4543bbb4 | 1417 | 1, 10000); |
cb1faec9 DS |
1418 | else |
1419 | bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX; | |
1420 | ||
1421 | return CMD_SUCCESS; | |
1422 | } | |
1423 | ||
1424 | int | |
1425 | bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) | |
1426 | { | |
1427 | if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX) | |
1428 | vty_out (vty, " write-quanta %d%s", | |
1429 | bgp->wpkt_quanta, VTY_NEWLINE); | |
1430 | ||
1431 | return 0; | |
1432 | } | |
1433 | ||
1434 | ||
1435 | /* Update-delay configuration */ | |
1436 | DEFUN (bgp_wpkt_quanta, | |
1437 | bgp_wpkt_quanta_cmd, | |
4543bbb4 | 1438 | "write-quanta <1-10000>", |
cb1faec9 DS |
1439 | "How many packets to write to peer socket per run\n" |
1440 | "Number of packets\n") | |
1441 | { | |
1442 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 1); | |
1443 | } | |
1444 | ||
1445 | /* Update-delay deconfiguration */ | |
1446 | DEFUN (no_bgp_wpkt_quanta, | |
1447 | no_bgp_wpkt_quanta_cmd, | |
4543bbb4 | 1448 | "no write-quanta <1-10000>", |
cb1faec9 DS |
1449 | "How many packets to write to peer socket per run\n" |
1450 | "Number of packets\n") | |
1451 | { | |
1452 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); | |
1453 | } | |
1454 | ||
ffd0c037 | 1455 | static int |
3f9c7369 DS |
1456 | bgp_coalesce_config_vty (struct vty *vty, const char *num, char set) |
1457 | { | |
1458 | struct bgp *bgp; | |
1459 | ||
1460 | bgp = vty->index; | |
1461 | ||
1462 | if (set) | |
1463 | VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num, | |
1464 | 0, 4294967295); | |
1465 | else | |
1466 | bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; | |
1467 | ||
1468 | return CMD_SUCCESS; | |
1469 | } | |
1470 | ||
1471 | int | |
1472 | bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp) | |
1473 | { | |
1474 | if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME) | |
1475 | vty_out (vty, " coalesce-time %d%s", | |
1476 | bgp->coalesce_time, VTY_NEWLINE); | |
1477 | ||
1478 | return 0; | |
1479 | } | |
1480 | ||
1481 | ||
1482 | DEFUN (bgp_coalesce_time, | |
1483 | bgp_coalesce_time_cmd, | |
1484 | "coalesce-time <0-4294967295>", | |
1485 | "Subgroup coalesce timer\n" | |
1486 | "Subgroup coalesce timer value (in ms)\n") | |
1487 | { | |
1488 | return bgp_coalesce_config_vty(vty, argv[0], 1); | |
1489 | } | |
1490 | ||
1491 | DEFUN (no_bgp_coalesce_time, | |
1492 | no_bgp_coalesce_time_cmd, | |
1493 | "no coalesce-time <0-4294967295>", | |
1494 | "Subgroup coalesce timer\n" | |
1495 | "Subgroup coalesce timer value (in ms)\n") | |
1496 | { | |
1497 | return bgp_coalesce_config_vty(vty, argv[0], 0); | |
1498 | } | |
1499 | ||
5e242b0d DS |
1500 | /* Maximum-paths configuration */ |
1501 | DEFUN (bgp_maxpaths, | |
1502 | bgp_maxpaths_cmd, | |
a565fbdd | 1503 | "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), |
5e242b0d DS |
1504 | "Forward packets over multiple paths\n" |
1505 | "Number of paths\n") | |
1506 | { | |
1507 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); | |
1508 | } | |
1509 | ||
165b5fff JB |
1510 | DEFUN (bgp_maxpaths_ibgp, |
1511 | bgp_maxpaths_ibgp_cmd, | |
a565fbdd | 1512 | "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1513 | "Forward packets over multiple paths\n" |
1514 | "iBGP-multipath\n" | |
1515 | "Number of paths\n") | |
1516 | { | |
5e242b0d DS |
1517 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); |
1518 | } | |
165b5fff | 1519 | |
5e242b0d DS |
1520 | DEFUN (bgp_maxpaths_ibgp_cluster, |
1521 | bgp_maxpaths_ibgp_cluster_cmd, | |
a565fbdd | 1522 | "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", |
5e242b0d DS |
1523 | "Forward packets over multiple paths\n" |
1524 | "iBGP-multipath\n" | |
1525 | "Number of paths\n" | |
1526 | "Match the cluster length\n") | |
1527 | { | |
1528 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], | |
1529 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); | |
165b5fff JB |
1530 | } |
1531 | ||
1532 | DEFUN (no_bgp_maxpaths, | |
1533 | no_bgp_maxpaths_cmd, | |
1534 | "no maximum-paths", | |
1535 | NO_STR | |
1536 | "Forward packets over multiple paths\n" | |
1537 | "Number of paths\n") | |
1538 | { | |
5e242b0d | 1539 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
1540 | } |
1541 | ||
1542 | ALIAS (no_bgp_maxpaths, | |
1543 | no_bgp_maxpaths_arg_cmd, | |
a565fbdd | 1544 | "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1545 | NO_STR |
1546 | "Forward packets over multiple paths\n" | |
1547 | "Number of paths\n") | |
1548 | ||
1549 | DEFUN (no_bgp_maxpaths_ibgp, | |
1550 | no_bgp_maxpaths_ibgp_cmd, | |
1551 | "no maximum-paths ibgp", | |
1552 | NO_STR | |
1553 | "Forward packets over multiple paths\n" | |
1554 | "iBGP-multipath\n" | |
1555 | "Number of paths\n") | |
1556 | { | |
5e242b0d | 1557 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
1558 | } |
1559 | ||
1560 | ALIAS (no_bgp_maxpaths_ibgp, | |
1561 | no_bgp_maxpaths_ibgp_arg_cmd, | |
a565fbdd | 1562 | "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1563 | NO_STR |
1564 | "Forward packets over multiple paths\n" | |
1565 | "iBGP-multipath\n" | |
1566 | "Number of paths\n") | |
1567 | ||
5e242b0d DS |
1568 | ALIAS (no_bgp_maxpaths_ibgp, |
1569 | no_bgp_maxpaths_ibgp_cluster_cmd, | |
a565fbdd | 1570 | "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", |
5e242b0d DS |
1571 | NO_STR |
1572 | "Forward packets over multiple paths\n" | |
1573 | "iBGP-multipath\n" | |
1574 | "Number of paths\n" | |
1575 | "Match the cluster length\n") | |
1576 | ||
165b5fff JB |
1577 | int |
1578 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
1579 | safi_t safi, int *write) | |
1580 | { | |
d5b77cc2 | 1581 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != MULTIPATH_NUM) |
165b5fff JB |
1582 | { |
1583 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1584 | vty_out (vty, " maximum-paths %d%s", |
165b5fff JB |
1585 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); |
1586 | } | |
1587 | ||
d5b77cc2 | 1588 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != MULTIPATH_NUM) |
165b5fff JB |
1589 | { |
1590 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1591 | vty_out (vty, " maximum-paths ibgp %d", |
5e242b0d DS |
1592 | bgp->maxpaths[afi][safi].maxpaths_ibgp); |
1593 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
1594 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
1595 | vty_out (vty, " equal-cluster-length"); | |
1596 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
1597 | } |
1598 | ||
1599 | return 0; | |
1600 | } | |
6b0655a2 | 1601 | |
718e3744 | 1602 | /* BGP timers. */ |
1603 | ||
1604 | DEFUN (bgp_timers, | |
1605 | bgp_timers_cmd, | |
1606 | "timers bgp <0-65535> <0-65535>", | |
1607 | "Adjust routing timers\n" | |
1608 | "BGP timers\n" | |
1609 | "Keepalive interval\n" | |
1610 | "Holdtime\n") | |
1611 | { | |
1612 | struct bgp *bgp; | |
1613 | unsigned long keepalive = 0; | |
1614 | unsigned long holdtime = 0; | |
1615 | ||
1616 | bgp = vty->index; | |
1617 | ||
1618 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
1619 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
1620 | ||
1621 | /* Holdtime value check. */ | |
1622 | if (holdtime < 3 && holdtime != 0) | |
1623 | { | |
1624 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
1625 | VTY_NEWLINE); | |
1626 | return CMD_WARNING; | |
1627 | } | |
1628 | ||
1629 | bgp_timers_set (bgp, keepalive, holdtime); | |
1630 | ||
1631 | return CMD_SUCCESS; | |
1632 | } | |
1633 | ||
1634 | DEFUN (no_bgp_timers, | |
1635 | no_bgp_timers_cmd, | |
1636 | "no timers bgp", | |
1637 | NO_STR | |
1638 | "Adjust routing timers\n" | |
1639 | "BGP timers\n") | |
1640 | { | |
1641 | struct bgp *bgp; | |
1642 | ||
1643 | bgp = vty->index; | |
1644 | bgp_timers_unset (bgp); | |
1645 | ||
1646 | return CMD_SUCCESS; | |
1647 | } | |
1648 | ||
1649 | ALIAS (no_bgp_timers, | |
1650 | no_bgp_timers_arg_cmd, | |
1651 | "no timers bgp <0-65535> <0-65535>", | |
1652 | NO_STR | |
1653 | "Adjust routing timers\n" | |
1654 | "BGP timers\n" | |
1655 | "Keepalive interval\n" | |
1656 | "Holdtime\n") | |
6b0655a2 | 1657 | |
718e3744 | 1658 | DEFUN (bgp_client_to_client_reflection, |
1659 | bgp_client_to_client_reflection_cmd, | |
1660 | "bgp client-to-client reflection", | |
1661 | "BGP specific commands\n" | |
1662 | "Configure client to client route reflection\n" | |
1663 | "reflection of routes allowed\n") | |
1664 | { | |
1665 | struct bgp *bgp; | |
1666 | ||
1667 | bgp = vty->index; | |
1668 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
7aafcaca DS |
1669 | bgp_clear_star_soft_out (vty); |
1670 | ||
718e3744 | 1671 | return CMD_SUCCESS; |
1672 | } | |
1673 | ||
1674 | DEFUN (no_bgp_client_to_client_reflection, | |
1675 | no_bgp_client_to_client_reflection_cmd, | |
1676 | "no bgp client-to-client reflection", | |
1677 | NO_STR | |
1678 | "BGP specific commands\n" | |
1679 | "Configure client to client route reflection\n" | |
1680 | "reflection of routes allowed\n") | |
1681 | { | |
1682 | struct bgp *bgp; | |
1683 | ||
1684 | bgp = vty->index; | |
1685 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
7aafcaca DS |
1686 | bgp_clear_star_soft_out (vty); |
1687 | ||
718e3744 | 1688 | return CMD_SUCCESS; |
1689 | } | |
1690 | ||
1691 | /* "bgp always-compare-med" configuration. */ | |
1692 | DEFUN (bgp_always_compare_med, | |
1693 | bgp_always_compare_med_cmd, | |
1694 | "bgp always-compare-med", | |
1695 | "BGP specific commands\n" | |
1696 | "Allow comparing MED from different neighbors\n") | |
1697 | { | |
1698 | struct bgp *bgp; | |
1699 | ||
1700 | bgp = vty->index; | |
1701 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1702 | bgp_recalculate_all_bestpaths (bgp); |
1703 | ||
718e3744 | 1704 | return CMD_SUCCESS; |
1705 | } | |
1706 | ||
1707 | DEFUN (no_bgp_always_compare_med, | |
1708 | no_bgp_always_compare_med_cmd, | |
1709 | "no bgp always-compare-med", | |
1710 | NO_STR | |
1711 | "BGP specific commands\n" | |
1712 | "Allow comparing MED from different neighbors\n") | |
1713 | { | |
1714 | struct bgp *bgp; | |
1715 | ||
1716 | bgp = vty->index; | |
1717 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1718 | bgp_recalculate_all_bestpaths (bgp); |
1719 | ||
718e3744 | 1720 | return CMD_SUCCESS; |
1721 | } | |
6b0655a2 | 1722 | |
718e3744 | 1723 | /* "bgp deterministic-med" configuration. */ |
1724 | DEFUN (bgp_deterministic_med, | |
1725 | bgp_deterministic_med_cmd, | |
1726 | "bgp deterministic-med", | |
1727 | "BGP specific commands\n" | |
1728 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1729 | { | |
1730 | struct bgp *bgp; | |
1731 | ||
1732 | bgp = vty->index; | |
1475ac87 DW |
1733 | |
1734 | if (!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1735 | { | |
1736 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1737 | bgp_recalculate_all_bestpaths (bgp); | |
1738 | } | |
7aafcaca | 1739 | |
718e3744 | 1740 | return CMD_SUCCESS; |
1741 | } | |
1742 | ||
1743 | DEFUN (no_bgp_deterministic_med, | |
1744 | no_bgp_deterministic_med_cmd, | |
1745 | "no bgp deterministic-med", | |
1746 | NO_STR | |
1747 | "BGP specific commands\n" | |
1748 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1749 | { | |
1750 | struct bgp *bgp; | |
06370dac DW |
1751 | int bestpath_per_as_used; |
1752 | afi_t afi; | |
1753 | safi_t safi; | |
1754 | struct peer *peer; | |
1755 | struct listnode *node, *nnode; | |
718e3744 | 1756 | |
1757 | bgp = vty->index; | |
1475ac87 DW |
1758 | |
1759 | if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1760 | { | |
06370dac DW |
1761 | bestpath_per_as_used = 0; |
1762 | ||
1763 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
1764 | { | |
1765 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
1766 | for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) | |
1767 | if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) | |
1768 | { | |
1769 | bestpath_per_as_used = 1; | |
1770 | break; | |
1771 | } | |
1772 | ||
1773 | if (bestpath_per_as_used) | |
1774 | break; | |
1775 | } | |
1776 | ||
1777 | if (bestpath_per_as_used) | |
1778 | { | |
1779 | vty_out (vty, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s", | |
1780 | VTY_NEWLINE); | |
1781 | return CMD_WARNING; | |
1782 | } | |
1783 | else | |
1784 | { | |
1785 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1786 | bgp_recalculate_all_bestpaths (bgp); | |
1787 | } | |
1475ac87 | 1788 | } |
7aafcaca | 1789 | |
718e3744 | 1790 | return CMD_SUCCESS; |
1791 | } | |
538621f2 | 1792 | |
1793 | /* "bgp graceful-restart" configuration. */ | |
1794 | DEFUN (bgp_graceful_restart, | |
1795 | bgp_graceful_restart_cmd, | |
1796 | "bgp graceful-restart", | |
1797 | "BGP specific commands\n" | |
1798 | "Graceful restart capability parameters\n") | |
1799 | { | |
1800 | struct bgp *bgp; | |
1801 | ||
1802 | bgp = vty->index; | |
1803 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1804 | return CMD_SUCCESS; | |
1805 | } | |
1806 | ||
1807 | DEFUN (no_bgp_graceful_restart, | |
1808 | no_bgp_graceful_restart_cmd, | |
1809 | "no bgp graceful-restart", | |
1810 | NO_STR | |
1811 | "BGP specific commands\n" | |
1812 | "Graceful restart capability parameters\n") | |
1813 | { | |
1814 | struct bgp *bgp; | |
1815 | ||
1816 | bgp = vty->index; | |
1817 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1818 | return CMD_SUCCESS; | |
1819 | } | |
1820 | ||
93406d87 | 1821 | DEFUN (bgp_graceful_restart_stalepath_time, |
1822 | bgp_graceful_restart_stalepath_time_cmd, | |
1823 | "bgp graceful-restart stalepath-time <1-3600>", | |
1824 | "BGP specific commands\n" | |
1825 | "Graceful restart capability parameters\n" | |
1826 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1827 | "Delay value (seconds)\n") | |
1828 | { | |
1829 | struct bgp *bgp; | |
1830 | u_int32_t stalepath; | |
1831 | ||
1832 | bgp = vty->index; | |
1833 | if (! bgp) | |
1834 | return CMD_WARNING; | |
1835 | ||
1836 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
1837 | bgp->stalepath_time = stalepath; | |
1838 | return CMD_SUCCESS; | |
1839 | } | |
1840 | ||
1841 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
1842 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1843 | "no bgp graceful-restart stalepath-time", | |
1844 | NO_STR | |
1845 | "BGP specific commands\n" | |
1846 | "Graceful restart capability parameters\n" | |
1847 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1848 | { | |
1849 | struct bgp *bgp; | |
1850 | ||
1851 | bgp = vty->index; | |
1852 | if (! bgp) | |
1853 | return CMD_WARNING; | |
1854 | ||
1855 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1856 | return CMD_SUCCESS; | |
1857 | } | |
1858 | ||
1859 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
1860 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
1861 | "no bgp graceful-restart stalepath-time <1-3600>", | |
1862 | NO_STR | |
1863 | "BGP specific commands\n" | |
1864 | "Graceful restart capability parameters\n" | |
1865 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1866 | "Delay value (seconds)\n") | |
1867 | ||
718e3744 | 1868 | /* "bgp fast-external-failover" configuration. */ |
1869 | DEFUN (bgp_fast_external_failover, | |
1870 | bgp_fast_external_failover_cmd, | |
1871 | "bgp fast-external-failover", | |
1872 | BGP_STR | |
1873 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1874 | { | |
1875 | struct bgp *bgp; | |
1876 | ||
1877 | bgp = vty->index; | |
1878 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1879 | return CMD_SUCCESS; | |
1880 | } | |
1881 | ||
1882 | DEFUN (no_bgp_fast_external_failover, | |
1883 | no_bgp_fast_external_failover_cmd, | |
1884 | "no bgp fast-external-failover", | |
1885 | NO_STR | |
1886 | BGP_STR | |
1887 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1888 | { | |
1889 | struct bgp *bgp; | |
1890 | ||
1891 | bgp = vty->index; | |
1892 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1893 | return CMD_SUCCESS; | |
1894 | } | |
6b0655a2 | 1895 | |
718e3744 | 1896 | /* "bgp enforce-first-as" configuration. */ |
1897 | DEFUN (bgp_enforce_first_as, | |
1898 | bgp_enforce_first_as_cmd, | |
1899 | "bgp enforce-first-as", | |
1900 | BGP_STR | |
1901 | "Enforce the first AS for EBGP routes\n") | |
1902 | { | |
1903 | struct bgp *bgp; | |
1904 | ||
1905 | bgp = vty->index; | |
1906 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
7aafcaca DS |
1907 | bgp_clear_star_soft_in (vty); |
1908 | ||
718e3744 | 1909 | return CMD_SUCCESS; |
1910 | } | |
1911 | ||
1912 | DEFUN (no_bgp_enforce_first_as, | |
1913 | no_bgp_enforce_first_as_cmd, | |
1914 | "no bgp enforce-first-as", | |
1915 | NO_STR | |
1916 | BGP_STR | |
1917 | "Enforce the first AS for EBGP routes\n") | |
1918 | { | |
1919 | struct bgp *bgp; | |
1920 | ||
1921 | bgp = vty->index; | |
1922 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
7aafcaca DS |
1923 | bgp_clear_star_soft_in (vty); |
1924 | ||
718e3744 | 1925 | return CMD_SUCCESS; |
1926 | } | |
6b0655a2 | 1927 | |
718e3744 | 1928 | /* "bgp bestpath compare-routerid" configuration. */ |
1929 | DEFUN (bgp_bestpath_compare_router_id, | |
1930 | bgp_bestpath_compare_router_id_cmd, | |
1931 | "bgp bestpath compare-routerid", | |
1932 | "BGP specific commands\n" | |
1933 | "Change the default bestpath selection\n" | |
1934 | "Compare router-id for identical EBGP paths\n") | |
1935 | { | |
1936 | struct bgp *bgp; | |
1937 | ||
1938 | bgp = vty->index; | |
1939 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1940 | bgp_recalculate_all_bestpaths (bgp); |
1941 | ||
718e3744 | 1942 | return CMD_SUCCESS; |
1943 | } | |
1944 | ||
1945 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1946 | no_bgp_bestpath_compare_router_id_cmd, | |
1947 | "no bgp bestpath compare-routerid", | |
1948 | NO_STR | |
1949 | "BGP specific commands\n" | |
1950 | "Change the default bestpath selection\n" | |
1951 | "Compare router-id for identical EBGP paths\n") | |
1952 | { | |
1953 | struct bgp *bgp; | |
1954 | ||
1955 | bgp = vty->index; | |
1956 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1957 | bgp_recalculate_all_bestpaths (bgp); |
1958 | ||
718e3744 | 1959 | return CMD_SUCCESS; |
1960 | } | |
6b0655a2 | 1961 | |
718e3744 | 1962 | /* "bgp bestpath as-path ignore" configuration. */ |
1963 | DEFUN (bgp_bestpath_aspath_ignore, | |
1964 | bgp_bestpath_aspath_ignore_cmd, | |
1965 | "bgp bestpath as-path ignore", | |
1966 | "BGP specific commands\n" | |
1967 | "Change the default bestpath selection\n" | |
1968 | "AS-path attribute\n" | |
1969 | "Ignore as-path length in selecting a route\n") | |
1970 | { | |
1971 | struct bgp *bgp; | |
1972 | ||
1973 | bgp = vty->index; | |
1974 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1975 | bgp_recalculate_all_bestpaths (bgp); |
1976 | ||
718e3744 | 1977 | return CMD_SUCCESS; |
1978 | } | |
1979 | ||
1980 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
1981 | no_bgp_bestpath_aspath_ignore_cmd, | |
1982 | "no bgp bestpath as-path ignore", | |
1983 | NO_STR | |
1984 | "BGP specific commands\n" | |
1985 | "Change the default bestpath selection\n" | |
1986 | "AS-path attribute\n" | |
1987 | "Ignore as-path length in selecting a route\n") | |
1988 | { | |
1989 | struct bgp *bgp; | |
1990 | ||
1991 | bgp = vty->index; | |
1992 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1993 | bgp_recalculate_all_bestpaths (bgp); |
1994 | ||
718e3744 | 1995 | return CMD_SUCCESS; |
1996 | } | |
6b0655a2 | 1997 | |
6811845b | 1998 | /* "bgp bestpath as-path confed" configuration. */ |
1999 | DEFUN (bgp_bestpath_aspath_confed, | |
2000 | bgp_bestpath_aspath_confed_cmd, | |
2001 | "bgp bestpath as-path confed", | |
2002 | "BGP specific commands\n" | |
2003 | "Change the default bestpath selection\n" | |
2004 | "AS-path attribute\n" | |
2005 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
2006 | { | |
2007 | struct bgp *bgp; | |
2008 | ||
2009 | bgp = vty->index; | |
2010 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
2011 | bgp_recalculate_all_bestpaths (bgp); |
2012 | ||
6811845b | 2013 | return CMD_SUCCESS; |
2014 | } | |
2015 | ||
2016 | DEFUN (no_bgp_bestpath_aspath_confed, | |
2017 | no_bgp_bestpath_aspath_confed_cmd, | |
2018 | "no bgp bestpath as-path confed", | |
2019 | NO_STR | |
2020 | "BGP specific commands\n" | |
2021 | "Change the default bestpath selection\n" | |
2022 | "AS-path attribute\n" | |
2023 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
2024 | { | |
2025 | struct bgp *bgp; | |
2026 | ||
2027 | bgp = vty->index; | |
2028 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
2029 | bgp_recalculate_all_bestpaths (bgp); |
2030 | ||
6811845b | 2031 | return CMD_SUCCESS; |
2032 | } | |
6b0655a2 | 2033 | |
2fdd455c PM |
2034 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
2035 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
2036 | bgp_bestpath_aspath_multipath_relax_cmd, | |
219178b6 | 2037 | "bgp bestpath as-path multipath-relax {as-set|no-as-set}", |
16fc1eec DS |
2038 | "BGP specific commands\n" |
2039 | "Change the default bestpath selection\n" | |
2040 | "AS-path attribute\n" | |
2041 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
219178b6 | 2042 | "Generate an AS_SET\n" |
16fc1eec DS |
2043 | "Do not generate an AS_SET\n") |
2044 | { | |
2045 | struct bgp *bgp; | |
2046 | ||
2047 | bgp = vty->index; | |
2048 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
219178b6 DW |
2049 | |
2050 | /* no-as-set is now the default behavior so we can silently | |
2051 | * ignore it */ | |
2052 | if (argv[0] != NULL && strncmp (argv[0], "a", 1) == 0) | |
2053 | bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); | |
2054 | else | |
2055 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ; | |
2056 | ||
7aafcaca DS |
2057 | bgp_recalculate_all_bestpaths (bgp); |
2058 | ||
16fc1eec DS |
2059 | return CMD_SUCCESS; |
2060 | } | |
2061 | ||
219178b6 DW |
2062 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, |
2063 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
2064 | "no bgp bestpath as-path multipath-relax {as-set|no-as-set}", | |
16fc1eec DS |
2065 | NO_STR |
2066 | "BGP specific commands\n" | |
2067 | "Change the default bestpath selection\n" | |
2068 | "AS-path attribute\n" | |
2069 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
219178b6 | 2070 | "Generate an AS_SET\n" |
16fc1eec DS |
2071 | "Do not generate an AS_SET\n") |
2072 | { | |
2073 | struct bgp *bgp; | |
2074 | ||
2075 | bgp = vty->index; | |
2076 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
219178b6 | 2077 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); |
7aafcaca DS |
2078 | bgp_recalculate_all_bestpaths (bgp); |
2079 | ||
2fdd455c PM |
2080 | return CMD_SUCCESS; |
2081 | } | |
6b0655a2 | 2082 | |
848973c7 | 2083 | /* "bgp log-neighbor-changes" configuration. */ |
2084 | DEFUN (bgp_log_neighbor_changes, | |
2085 | bgp_log_neighbor_changes_cmd, | |
2086 | "bgp log-neighbor-changes", | |
2087 | "BGP specific commands\n" | |
2088 | "Log neighbor up/down and reset reason\n") | |
2089 | { | |
2090 | struct bgp *bgp; | |
2091 | ||
2092 | bgp = vty->index; | |
2093 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
2094 | return CMD_SUCCESS; | |
2095 | } | |
2096 | ||
2097 | DEFUN (no_bgp_log_neighbor_changes, | |
2098 | no_bgp_log_neighbor_changes_cmd, | |
2099 | "no bgp log-neighbor-changes", | |
2100 | NO_STR | |
2101 | "BGP specific commands\n" | |
2102 | "Log neighbor up/down and reset reason\n") | |
2103 | { | |
2104 | struct bgp *bgp; | |
2105 | ||
2106 | bgp = vty->index; | |
2107 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
2108 | return CMD_SUCCESS; | |
2109 | } | |
6b0655a2 | 2110 | |
718e3744 | 2111 | /* "bgp bestpath med" configuration. */ |
2112 | DEFUN (bgp_bestpath_med, | |
2113 | bgp_bestpath_med_cmd, | |
2114 | "bgp bestpath med (confed|missing-as-worst)", | |
2115 | "BGP specific commands\n" | |
2116 | "Change the default bestpath selection\n" | |
2117 | "MED attribute\n" | |
2118 | "Compare MED among confederation paths\n" | |
2119 | "Treat missing MED as the least preferred one\n") | |
2120 | { | |
2121 | struct bgp *bgp; | |
2122 | ||
2123 | bgp = vty->index; | |
2124 | ||
2125 | if (strncmp (argv[0], "confed", 1) == 0) | |
2126 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2127 | else | |
2128 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2129 | ||
7aafcaca DS |
2130 | bgp_recalculate_all_bestpaths (bgp); |
2131 | ||
718e3744 | 2132 | return CMD_SUCCESS; |
2133 | } | |
2134 | ||
2135 | DEFUN (bgp_bestpath_med2, | |
2136 | bgp_bestpath_med2_cmd, | |
2137 | "bgp bestpath med confed missing-as-worst", | |
2138 | "BGP specific commands\n" | |
2139 | "Change the default bestpath selection\n" | |
2140 | "MED attribute\n" | |
2141 | "Compare MED among confederation paths\n" | |
2142 | "Treat missing MED as the least preferred one\n") | |
2143 | { | |
2144 | struct bgp *bgp; | |
2145 | ||
2146 | bgp = vty->index; | |
2147 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2148 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2149 | bgp_recalculate_all_bestpaths (bgp); |
2150 | ||
718e3744 | 2151 | return CMD_SUCCESS; |
2152 | } | |
2153 | ||
2154 | ALIAS (bgp_bestpath_med2, | |
2155 | bgp_bestpath_med3_cmd, | |
2156 | "bgp bestpath med missing-as-worst confed", | |
2157 | "BGP specific commands\n" | |
2158 | "Change the default bestpath selection\n" | |
2159 | "MED attribute\n" | |
2160 | "Treat missing MED as the least preferred one\n" | |
2161 | "Compare MED among confederation paths\n") | |
2162 | ||
2163 | DEFUN (no_bgp_bestpath_med, | |
2164 | no_bgp_bestpath_med_cmd, | |
2165 | "no bgp bestpath med (confed|missing-as-worst)", | |
2166 | NO_STR | |
2167 | "BGP specific commands\n" | |
2168 | "Change the default bestpath selection\n" | |
2169 | "MED attribute\n" | |
2170 | "Compare MED among confederation paths\n" | |
2171 | "Treat missing MED as the least preferred one\n") | |
2172 | { | |
2173 | struct bgp *bgp; | |
2174 | ||
2175 | bgp = vty->index; | |
2176 | ||
2177 | if (strncmp (argv[0], "confed", 1) == 0) | |
2178 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2179 | else | |
2180 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2181 | ||
7aafcaca DS |
2182 | bgp_recalculate_all_bestpaths (bgp); |
2183 | ||
718e3744 | 2184 | return CMD_SUCCESS; |
2185 | } | |
2186 | ||
2187 | DEFUN (no_bgp_bestpath_med2, | |
2188 | no_bgp_bestpath_med2_cmd, | |
2189 | "no bgp bestpath med confed missing-as-worst", | |
2190 | NO_STR | |
2191 | "BGP specific commands\n" | |
2192 | "Change the default bestpath selection\n" | |
2193 | "MED attribute\n" | |
2194 | "Compare MED among confederation paths\n" | |
2195 | "Treat missing MED as the least preferred one\n") | |
2196 | { | |
2197 | struct bgp *bgp; | |
2198 | ||
2199 | bgp = vty->index; | |
2200 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2201 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2202 | bgp_recalculate_all_bestpaths (bgp); |
2203 | ||
718e3744 | 2204 | return CMD_SUCCESS; |
2205 | } | |
2206 | ||
2207 | ALIAS (no_bgp_bestpath_med2, | |
2208 | no_bgp_bestpath_med3_cmd, | |
2209 | "no bgp bestpath med missing-as-worst confed", | |
2210 | NO_STR | |
2211 | "BGP specific commands\n" | |
2212 | "Change the default bestpath selection\n" | |
2213 | "MED attribute\n" | |
2214 | "Treat missing MED as the least preferred one\n" | |
2215 | "Compare MED among confederation paths\n") | |
6b0655a2 | 2216 | |
718e3744 | 2217 | /* "no bgp default ipv4-unicast". */ |
2218 | DEFUN (no_bgp_default_ipv4_unicast, | |
2219 | no_bgp_default_ipv4_unicast_cmd, | |
2220 | "no bgp default ipv4-unicast", | |
2221 | NO_STR | |
2222 | "BGP specific commands\n" | |
2223 | "Configure BGP defaults\n" | |
2224 | "Activate ipv4-unicast for a peer by default\n") | |
2225 | { | |
2226 | struct bgp *bgp; | |
2227 | ||
2228 | bgp = vty->index; | |
2229 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2230 | return CMD_SUCCESS; | |
2231 | } | |
2232 | ||
2233 | DEFUN (bgp_default_ipv4_unicast, | |
2234 | bgp_default_ipv4_unicast_cmd, | |
2235 | "bgp default ipv4-unicast", | |
2236 | "BGP specific commands\n" | |
2237 | "Configure BGP defaults\n" | |
2238 | "Activate ipv4-unicast for a peer by default\n") | |
2239 | { | |
2240 | struct bgp *bgp; | |
2241 | ||
2242 | bgp = vty->index; | |
2243 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2244 | return CMD_SUCCESS; | |
2245 | } | |
6b0655a2 | 2246 | |
04b6bdc0 DW |
2247 | /* Display hostname in certain command outputs */ |
2248 | DEFUN (bgp_default_show_hostname, | |
2249 | bgp_default_show_hostname_cmd, | |
2250 | "bgp default show-hostname", | |
2251 | "BGP specific commands\n" | |
2252 | "Configure BGP defaults\n" | |
2253 | "Show hostname in certain command ouputs\n") | |
2254 | { | |
2255 | struct bgp *bgp; | |
2256 | ||
2257 | bgp = vty->index; | |
2258 | bgp_flag_set (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2259 | return CMD_SUCCESS; | |
2260 | } | |
2261 | ||
2262 | DEFUN (no_bgp_default_show_hostname, | |
2263 | no_bgp_default_show_hostname_cmd, | |
2264 | "no bgp default show-hostname", | |
2265 | NO_STR | |
2266 | "BGP specific commands\n" | |
2267 | "Configure BGP defaults\n" | |
2268 | "Show hostname in certain command ouputs\n") | |
2269 | { | |
2270 | struct bgp *bgp; | |
2271 | ||
2272 | bgp = vty->index; | |
2273 | bgp_flag_unset (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2274 | return CMD_SUCCESS; | |
2275 | } | |
2276 | ||
8233ef81 | 2277 | /* "bgp network import-check" configuration. */ |
718e3744 | 2278 | DEFUN (bgp_network_import_check, |
2279 | bgp_network_import_check_cmd, | |
5623e905 | 2280 | "bgp network import-check", |
718e3744 | 2281 | "BGP specific commands\n" |
2282 | "BGP network command\n" | |
5623e905 | 2283 | "Check BGP network route exists in IGP\n") |
718e3744 | 2284 | { |
2285 | struct bgp *bgp; | |
2286 | ||
2287 | bgp = vty->index; | |
078430f6 DS |
2288 | if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2289 | { | |
2290 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
5623e905 | 2291 | bgp_static_redo_import_check(bgp); |
078430f6 DS |
2292 | } |
2293 | ||
718e3744 | 2294 | return CMD_SUCCESS; |
2295 | } | |
2296 | ||
8233ef81 DW |
2297 | ALIAS_HIDDEN (bgp_network_import_check, |
2298 | bgp_network_import_check_exact_cmd, | |
2299 | "bgp network import-check exact", | |
2300 | "BGP specific commands\n" | |
2301 | "BGP network command\n" | |
2302 | "Check BGP network route exists in IGP\n" | |
2303 | "Match route precisely\n") | |
2304 | ||
718e3744 | 2305 | DEFUN (no_bgp_network_import_check, |
2306 | no_bgp_network_import_check_cmd, | |
5623e905 | 2307 | "no bgp network import-check", |
718e3744 | 2308 | NO_STR |
2309 | "BGP specific commands\n" | |
2310 | "BGP network command\n" | |
2311 | "Check BGP network route exists in IGP\n") | |
2312 | { | |
2313 | struct bgp *bgp; | |
2314 | ||
2315 | bgp = vty->index; | |
078430f6 DS |
2316 | if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2317 | { | |
2318 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
078430f6 DS |
2319 | bgp_static_redo_import_check(bgp); |
2320 | } | |
5623e905 | 2321 | |
718e3744 | 2322 | return CMD_SUCCESS; |
2323 | } | |
6b0655a2 | 2324 | |
718e3744 | 2325 | DEFUN (bgp_default_local_preference, |
2326 | bgp_default_local_preference_cmd, | |
2327 | "bgp default local-preference <0-4294967295>", | |
2328 | "BGP specific commands\n" | |
2329 | "Configure BGP defaults\n" | |
2330 | "local preference (higher=more preferred)\n" | |
2331 | "Configure default local preference value\n") | |
2332 | { | |
2333 | struct bgp *bgp; | |
2334 | u_int32_t local_pref; | |
2335 | ||
2336 | bgp = vty->index; | |
2337 | ||
2338 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
2339 | ||
2340 | bgp_default_local_preference_set (bgp, local_pref); | |
7aafcaca | 2341 | bgp_clear_star_soft_in (vty); |
718e3744 | 2342 | |
2343 | return CMD_SUCCESS; | |
2344 | } | |
2345 | ||
2346 | DEFUN (no_bgp_default_local_preference, | |
2347 | no_bgp_default_local_preference_cmd, | |
2348 | "no bgp default local-preference", | |
2349 | NO_STR | |
2350 | "BGP specific commands\n" | |
2351 | "Configure BGP defaults\n" | |
2352 | "local preference (higher=more preferred)\n") | |
2353 | { | |
2354 | struct bgp *bgp; | |
2355 | ||
2356 | bgp = vty->index; | |
2357 | bgp_default_local_preference_unset (bgp); | |
7aafcaca DS |
2358 | bgp_clear_star_soft_in (vty); |
2359 | ||
718e3744 | 2360 | return CMD_SUCCESS; |
2361 | } | |
2362 | ||
2363 | ALIAS (no_bgp_default_local_preference, | |
2364 | no_bgp_default_local_preference_val_cmd, | |
2365 | "no bgp default local-preference <0-4294967295>", | |
2366 | NO_STR | |
2367 | "BGP specific commands\n" | |
2368 | "Configure BGP defaults\n" | |
2369 | "local preference (higher=more preferred)\n" | |
2370 | "Configure default local preference value\n") | |
6b0655a2 | 2371 | |
3f9c7369 DS |
2372 | DEFUN (bgp_default_subgroup_pkt_queue_max, |
2373 | bgp_default_subgroup_pkt_queue_max_cmd, | |
2374 | "bgp default subgroup-pkt-queue-max <20-100>", | |
2375 | "BGP specific commands\n" | |
2376 | "Configure BGP defaults\n" | |
2377 | "subgroup-pkt-queue-max\n" | |
2378 | "Configure subgroup packet queue max\n") | |
8bd9d948 | 2379 | { |
3f9c7369 DS |
2380 | struct bgp *bgp; |
2381 | u_int32_t max_size; | |
8bd9d948 | 2382 | |
3f9c7369 DS |
2383 | bgp = vty->index; |
2384 | ||
2385 | VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]); | |
2386 | ||
2387 | bgp_default_subgroup_pkt_queue_max_set (bgp, max_size); | |
2388 | ||
2389 | return CMD_SUCCESS; | |
2390 | } | |
2391 | ||
2392 | DEFUN (no_bgp_default_subgroup_pkt_queue_max, | |
2393 | no_bgp_default_subgroup_pkt_queue_max_cmd, | |
2394 | "no bgp default subgroup-pkt-queue-max", | |
2395 | NO_STR | |
2396 | "BGP specific commands\n" | |
2397 | "Configure BGP defaults\n" | |
2398 | "subgroup-pkt-queue-max\n") | |
2399 | { | |
2400 | struct bgp *bgp; | |
2401 | ||
2402 | bgp = vty->index; | |
2403 | bgp_default_subgroup_pkt_queue_max_unset (bgp); | |
2404 | return CMD_SUCCESS; | |
8bd9d948 DS |
2405 | } |
2406 | ||
813d4307 DW |
2407 | ALIAS (no_bgp_default_subgroup_pkt_queue_max, |
2408 | no_bgp_default_subgroup_pkt_queue_max_val_cmd, | |
2409 | "no bgp default subgroup-pkt-queue-max <20-100>", | |
2410 | NO_STR | |
2411 | "BGP specific commands\n" | |
2412 | "Configure BGP defaults\n" | |
2413 | "subgroup-pkt-queue-max\n" | |
2414 | "Configure subgroup packet queue max\n") | |
2415 | ||
8bd9d948 DS |
2416 | DEFUN (bgp_rr_allow_outbound_policy, |
2417 | bgp_rr_allow_outbound_policy_cmd, | |
2418 | "bgp route-reflector allow-outbound-policy", | |
2419 | "BGP specific commands\n" | |
2420 | "Allow modifications made by out route-map\n" | |
2421 | "on ibgp neighbors\n") | |
2422 | { | |
2423 | struct bgp *bgp; | |
8bd9d948 DS |
2424 | |
2425 | bgp = vty->index; | |
2426 | ||
2427 | if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2428 | { | |
2429 | bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2430 | update_group_announce_rrclients(bgp); |
7aafcaca | 2431 | bgp_clear_star_soft_out (vty); |
8bd9d948 DS |
2432 | } |
2433 | ||
2434 | return CMD_SUCCESS; | |
2435 | } | |
2436 | ||
2437 | DEFUN (no_bgp_rr_allow_outbound_policy, | |
2438 | no_bgp_rr_allow_outbound_policy_cmd, | |
2439 | "no bgp route-reflector allow-outbound-policy", | |
2440 | NO_STR | |
2441 | "BGP specific commands\n" | |
2442 | "Allow modifications made by out route-map\n" | |
2443 | "on ibgp neighbors\n") | |
2444 | { | |
2445 | struct bgp *bgp; | |
8bd9d948 DS |
2446 | |
2447 | bgp = vty->index; | |
2448 | ||
2449 | if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2450 | { | |
2451 | bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2452 | update_group_announce_rrclients(bgp); |
7aafcaca | 2453 | bgp_clear_star_soft_out (vty); |
8bd9d948 DS |
2454 | } |
2455 | ||
2456 | return CMD_SUCCESS; | |
2457 | } | |
2458 | ||
f14e6fdb DS |
2459 | DEFUN (bgp_listen_limit, |
2460 | bgp_listen_limit_cmd, | |
2461 | "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2462 | "BGP specific commands\n" | |
2463 | "Configure BGP defaults\n" | |
2464 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2465 | "Configure Dynamic Neighbors listen limit value\n") | |
2466 | { | |
2467 | struct bgp *bgp; | |
2468 | int listen_limit; | |
2469 | ||
2470 | bgp = vty->index; | |
2471 | ||
2472 | VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0], | |
2473 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN, | |
2474 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX); | |
2475 | ||
2476 | bgp_listen_limit_set (bgp, listen_limit); | |
2477 | ||
2478 | return CMD_SUCCESS; | |
2479 | } | |
2480 | ||
2481 | DEFUN (no_bgp_listen_limit, | |
2482 | no_bgp_listen_limit_cmd, | |
2483 | "no bgp listen limit", | |
2484 | "BGP specific commands\n" | |
2485 | "Configure BGP defaults\n" | |
2486 | "unset maximum number of BGP Dynamic Neighbors that can be created\n" | |
2487 | "Configure Dynamic Neighbors listen limit value to default\n") | |
2488 | { | |
2489 | struct bgp *bgp; | |
2490 | ||
2491 | bgp = vty->index; | |
2492 | bgp_listen_limit_unset (bgp); | |
2493 | return CMD_SUCCESS; | |
2494 | } | |
2495 | ||
813d4307 DW |
2496 | ALIAS (no_bgp_listen_limit, |
2497 | no_bgp_listen_limit_val_cmd, | |
2498 | "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2499 | NO_STR | |
2500 | "BGP specific commands\n" | |
2501 | "Configure BGP defaults\n" | |
2502 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2503 | "Configure Dynamic Neighbors listen limit value\n") | |
f14e6fdb | 2504 | |
20eb8864 | 2505 | /* |
2506 | * Check if this listen range is already configured. Check for exact | |
2507 | * match or overlap based on input. | |
2508 | */ | |
2509 | static struct peer_group * | |
2510 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact) | |
2511 | { | |
2512 | struct listnode *node, *nnode; | |
2513 | struct listnode *node1, *nnode1; | |
2514 | struct peer_group *group; | |
2515 | struct prefix *lr; | |
2516 | afi_t afi; | |
2517 | int match; | |
2518 | ||
2519 | afi = family2afi(range->family); | |
2520 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2521 | { | |
2522 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node1, | |
2523 | nnode1, lr)) | |
2524 | { | |
2525 | if (exact) | |
2526 | match = prefix_same (range, lr); | |
2527 | else | |
2528 | match = (prefix_match (range, lr) || prefix_match (lr, range)); | |
2529 | if (match) | |
2530 | return group; | |
2531 | } | |
2532 | } | |
2533 | ||
2534 | return NULL; | |
2535 | } | |
2536 | ||
f14e6fdb DS |
2537 | DEFUN (bgp_listen_range, |
2538 | bgp_listen_range_cmd, | |
2539 | LISTEN_RANGE_CMD "peer-group WORD" , | |
2540 | "BGP specific commands\n" | |
2541 | "Configure BGP Dynamic Neighbors\n" | |
2542 | "add a listening range for Dynamic Neighbors\n" | |
2543 | LISTEN_RANGE_ADDR_STR) | |
2544 | { | |
2545 | struct bgp *bgp; | |
2546 | struct prefix range; | |
20eb8864 | 2547 | struct peer_group *group, *existing_group; |
f14e6fdb DS |
2548 | afi_t afi; |
2549 | int ret; | |
2550 | ||
2551 | bgp = vty->index; | |
2552 | ||
2553 | //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2554 | ||
2555 | /* Convert IP prefix string to struct prefix. */ | |
2556 | ret = str2prefix (argv[0], &range); | |
2557 | if (! ret) | |
2558 | { | |
2559 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2560 | return CMD_WARNING; | |
2561 | } | |
2562 | ||
2563 | afi = family2afi(range.family); | |
2564 | ||
2565 | #ifdef HAVE_IPV6 | |
2566 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2567 | { | |
2568 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2569 | VTY_NEWLINE); | |
2570 | return CMD_WARNING; | |
2571 | } | |
2572 | #endif /* HAVE_IPV6 */ | |
2573 | ||
2574 | apply_mask (&range); | |
2575 | ||
20eb8864 | 2576 | /* Check if same listen range is already configured. */ |
2577 | existing_group = listen_range_exists (bgp, &range, 1); | |
2578 | if (existing_group) | |
2579 | { | |
2580 | if (strcmp (existing_group->name, argv[1]) == 0) | |
2581 | return CMD_SUCCESS; | |
2582 | else | |
2583 | { | |
2584 | vty_out (vty, "%% Same listen range is attached to peer-group %s%s", | |
2585 | existing_group->name, VTY_NEWLINE); | |
2586 | return CMD_WARNING; | |
2587 | } | |
2588 | } | |
2589 | ||
2590 | /* Check if an overlapping listen range exists. */ | |
2591 | if (listen_range_exists (bgp, &range, 0)) | |
2592 | { | |
2593 | vty_out (vty, "%% Listen range overlaps with existing listen range%s", | |
2594 | VTY_NEWLINE); | |
2595 | return CMD_WARNING; | |
2596 | } | |
f14e6fdb DS |
2597 | |
2598 | group = peer_group_lookup (bgp, argv[1]); | |
2599 | if (! group) | |
2600 | { | |
2601 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2602 | return CMD_WARNING; | |
2603 | } | |
2604 | ||
2605 | ret = peer_group_listen_range_add(group, &range); | |
2606 | return bgp_vty_return (vty, ret); | |
2607 | } | |
2608 | ||
2609 | DEFUN (no_bgp_listen_range, | |
2610 | no_bgp_listen_range_cmd, | |
2611 | "no bgp listen range A.B.C.D/M peer-group WORD" , | |
2612 | "BGP specific commands\n" | |
2613 | "Configure BGP defaults\n" | |
2614 | "delete a listening range for Dynamic Neighbors\n" | |
2615 | "Remove Dynamic Neighbors listening range\n") | |
2616 | { | |
2617 | struct bgp *bgp; | |
2618 | struct prefix range; | |
2619 | struct peer_group *group; | |
2620 | afi_t afi; | |
2621 | int ret; | |
2622 | ||
2623 | bgp = vty->index; | |
2624 | ||
2625 | // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2626 | ||
2627 | /* Convert IP prefix string to struct prefix. */ | |
2628 | ret = str2prefix (argv[0], &range); | |
2629 | if (! ret) | |
2630 | { | |
2631 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2632 | return CMD_WARNING; | |
2633 | } | |
2634 | ||
2635 | afi = family2afi(range.family); | |
2636 | ||
2637 | #ifdef HAVE_IPV6 | |
2638 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2639 | { | |
2640 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2641 | VTY_NEWLINE); | |
2642 | return CMD_WARNING; | |
2643 | } | |
2644 | #endif /* HAVE_IPV6 */ | |
2645 | ||
2646 | apply_mask (&range); | |
2647 | ||
2648 | ||
2649 | group = peer_group_lookup (bgp, argv[1]); | |
2650 | if (! group) | |
2651 | { | |
2652 | vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); | |
2653 | return CMD_WARNING; | |
2654 | } | |
2655 | ||
2656 | ret = peer_group_listen_range_del(group, &range); | |
2657 | return bgp_vty_return (vty, ret); | |
2658 | } | |
2659 | ||
2660 | int | |
2661 | bgp_config_write_listen (struct vty *vty, struct bgp *bgp) | |
2662 | { | |
2663 | struct peer_group *group; | |
2664 | struct listnode *node, *nnode, *rnode, *nrnode; | |
2665 | struct prefix *range; | |
2666 | afi_t afi; | |
4690c7d7 | 2667 | char buf[PREFIX2STR_BUFFER]; |
f14e6fdb DS |
2668 | |
2669 | if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT) | |
2670 | vty_out (vty, " bgp listen limit %d%s", | |
2671 | bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
2672 | ||
2673 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2674 | { | |
2675 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
2676 | { | |
2677 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range)) | |
2678 | { | |
2679 | prefix2str(range, buf, sizeof(buf)); | |
2680 | vty_out(vty, " bgp listen range %s peer-group %s%s", | |
2681 | buf, group->name, VTY_NEWLINE); | |
2682 | } | |
2683 | } | |
2684 | } | |
2685 | ||
2686 | return 0; | |
2687 | } | |
2688 | ||
2689 | ||
907f92c8 DS |
2690 | DEFUN (bgp_disable_connected_route_check, |
2691 | bgp_disable_connected_route_check_cmd, | |
2692 | "bgp disable-ebgp-connected-route-check", | |
2693 | "BGP specific commands\n" | |
2694 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2695 | { | |
2696 | struct bgp *bgp; | |
2697 | ||
2698 | bgp = vty->index; | |
2699 | bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
7aafcaca DS |
2700 | bgp_clear_star_soft_in (vty); |
2701 | ||
907f92c8 DS |
2702 | return CMD_SUCCESS; |
2703 | } | |
2704 | ||
2705 | DEFUN (no_bgp_disable_connected_route_check, | |
2706 | no_bgp_disable_connected_route_check_cmd, | |
2707 | "no bgp disable-ebgp-connected-route-check", | |
2708 | NO_STR | |
2709 | "BGP specific commands\n" | |
2710 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2711 | { | |
2712 | struct bgp *bgp; | |
2713 | ||
2714 | bgp = vty->index; | |
2715 | bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
7aafcaca DS |
2716 | bgp_clear_star_soft_in (vty); |
2717 | ||
907f92c8 DS |
2718 | return CMD_SUCCESS; |
2719 | } | |
2720 | ||
2721 | ||
718e3744 | 2722 | static int |
fd79ac91 | 2723 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
2724 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 2725 | { |
2726 | int ret; | |
2727 | struct bgp *bgp; | |
2728 | as_t as; | |
0299c004 | 2729 | int as_type = AS_SPECIFIED; |
718e3744 | 2730 | union sockunion su; |
2731 | ||
2732 | bgp = vty->index; | |
2733 | ||
0299c004 DS |
2734 | if (strncmp(as_str, "internal", strlen("internal")) == 0) |
2735 | { | |
2736 | as = 0; | |
2737 | as_type = AS_INTERNAL; | |
2738 | } | |
2739 | else if (strncmp(as_str, "external", strlen("external")) == 0) | |
2740 | { | |
2741 | as = 0; | |
2742 | as_type = AS_EXTERNAL; | |
2743 | } | |
2744 | else | |
2745 | { | |
2746 | /* Get AS number. */ | |
2747 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); | |
2748 | } | |
718e3744 | 2749 | |
2750 | /* If peer is peer group, call proper function. */ | |
2751 | ret = str2sockunion (peer_str, &su); | |
2752 | if (ret < 0) | |
2753 | { | |
a80beece | 2754 | /* Check for peer by interface */ |
0299c004 | 2755 | ret = peer_remote_as (bgp, NULL, peer_str, &as, as_type, afi, safi); |
718e3744 | 2756 | if (ret < 0) |
a80beece | 2757 | { |
0299c004 | 2758 | ret = peer_group_remote_as (bgp, peer_str, &as, as_type); |
a80beece DS |
2759 | if (ret < 0) |
2760 | { | |
2761 | vty_out (vty, "%% Create the peer-group or interface first%s", | |
2762 | VTY_NEWLINE); | |
2763 | return CMD_WARNING; | |
2764 | } | |
2765 | return CMD_SUCCESS; | |
2766 | } | |
718e3744 | 2767 | } |
a80beece | 2768 | else |
718e3744 | 2769 | { |
6aeb9e78 | 2770 | if (peer_address_self_check (bgp, &su)) |
a80beece DS |
2771 | { |
2772 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2773 | VTY_NEWLINE); | |
2774 | return CMD_WARNING; | |
2775 | } | |
0299c004 | 2776 | ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi); |
718e3744 | 2777 | } |
2778 | ||
718e3744 | 2779 | /* This peer belongs to peer group. */ |
2780 | switch (ret) | |
2781 | { | |
2782 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 2783 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 2784 | return CMD_WARNING; |
718e3744 | 2785 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 2786 | 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 | 2787 | return CMD_WARNING; |
718e3744 | 2788 | } |
2789 | return bgp_vty_return (vty, ret); | |
2790 | } | |
2791 | ||
2792 | DEFUN (neighbor_remote_as, | |
2793 | neighbor_remote_as_cmd, | |
0299c004 | 2794 | NEIGHBOR_CMD2 "remote-as (" CMD_AS_RANGE "|external|internal)", |
718e3744 | 2795 | NEIGHBOR_STR |
2796 | NEIGHBOR_ADDR_STR2 | |
2797 | "Specify a BGP neighbor\n" | |
2798 | AS_STR) | |
2799 | { | |
2800 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
2801 | } | |
6b0655a2 | 2802 | |
4c48cf63 DW |
2803 | static int |
2804 | peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, | |
2805 | safi_t safi, int v6only, const char *peer_group_name) | |
a80beece | 2806 | { |
4c48cf63 | 2807 | as_t as; |
a80beece DS |
2808 | struct bgp *bgp; |
2809 | struct peer *peer; | |
2810 | struct peer_group *group; | |
4c48cf63 DW |
2811 | int ret = 0; |
2812 | union sockunion su; | |
a80beece DS |
2813 | |
2814 | bgp = vty->index; | |
4c48cf63 DW |
2815 | group = peer_group_lookup (bgp, conf_if); |
2816 | ||
a80beece DS |
2817 | if (group) |
2818 | { | |
2819 | vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE); | |
2820 | return CMD_WARNING; | |
2821 | } | |
2822 | ||
4c48cf63 DW |
2823 | peer = peer_lookup_by_conf_if (bgp, conf_if); |
2824 | if (!peer) | |
2825 | { | |
2826 | if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4) | |
2827 | && afi == AFI_IP && safi == SAFI_UNICAST) | |
f813b13b | 2828 | peer = peer_create (NULL, conf_if, bgp, bgp->as, 0, AS_UNSPECIFIED, 0, 0, NULL); |
4c48cf63 | 2829 | else |
f813b13b | 2830 | peer = peer_create (NULL, conf_if, bgp, bgp->as, 0, AS_UNSPECIFIED, afi, safi, NULL); |
4c48cf63 DW |
2831 | |
2832 | if (peer && v6only) | |
2833 | SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
4a04e5f7 | 2834 | |
2835 | /* Request zebra to initiate IPv6 RAs on this interface. We do this | |
2836 | * any unnumbered peer in order to not worry about run-time transitions | |
2837 | * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address | |
2838 | * gets deleted later etc.) | |
2839 | */ | |
2840 | if (peer->ifp) | |
2841 | bgp_zebra_initiate_radv (bgp, peer); | |
4c48cf63 DW |
2842 | } |
2843 | else if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) || | |
2844 | (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))) | |
2845 | { | |
2846 | if (v6only) | |
2847 | SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
2848 | else | |
2849 | UNSET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
2850 | ||
2851 | /* v6only flag changed. Reset bgp seesion */ | |
2852 | if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) | |
2853 | { | |
2854 | peer->last_reset = PEER_DOWN_V6ONLY_CHANGE; | |
2855 | bgp_notify_send (peer, BGP_NOTIFY_CEASE, | |
2856 | BGP_NOTIFY_CEASE_CONFIG_CHANGE); | |
2857 | } | |
2858 | else | |
2859 | bgp_session_reset(peer); | |
2860 | } | |
2861 | ||
a80beece DS |
2862 | if (!peer) |
2863 | return CMD_WARNING; | |
2864 | ||
4c48cf63 DW |
2865 | if (peer_group_name) |
2866 | { | |
2867 | group = peer_group_lookup (bgp, peer_group_name); | |
2868 | if (! group) | |
2869 | { | |
2870 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2871 | return CMD_WARNING; | |
2872 | } | |
2873 | ||
2874 | ret = peer_group_bind (bgp, &su, peer, group, &as); | |
2875 | } | |
2876 | ||
2877 | return bgp_vty_return (vty, ret); | |
a80beece DS |
2878 | } |
2879 | ||
4c48cf63 DW |
2880 | DEFUN (neighbor_interface_config, |
2881 | neighbor_interface_config_cmd, | |
2882 | "neighbor WORD interface", | |
2883 | NEIGHBOR_STR | |
2884 | "Interface name or neighbor tag\n" | |
2885 | "Enable BGP on interface\n") | |
2886 | { | |
2887 | if (argc == 2) | |
2888 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, argv[1]); | |
2889 | else | |
2890 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, NULL); | |
2891 | } | |
2892 | ||
2893 | ALIAS (neighbor_interface_config, | |
2894 | neighbor_interface_config_peergroup_cmd, | |
2895 | "neighbor WORD interface peer-group WORD", | |
2896 | NEIGHBOR_STR | |
2897 | "Interface name or neighbor tag\n" | |
2898 | "Enable BGP on interface\n" | |
2899 | "Member of the peer-group\n" | |
2900 | "peer-group name\n") | |
2901 | ||
2902 | DEFUN (neighbor_interface_config_v6only, | |
2903 | neighbor_interface_config_v6only_cmd, | |
2904 | "neighbor WORD interface v6only", | |
2905 | NEIGHBOR_STR | |
2906 | "Interface name or neighbor tag\n" | |
2907 | "Enable BGP on interface\n" | |
2908 | "Enable BGP with v6 link-local only\n") | |
2909 | { | |
2910 | if (argc == 2) | |
2911 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, argv[1]); | |
2912 | else | |
2913 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, NULL); | |
2914 | } | |
2915 | ||
2916 | ALIAS (neighbor_interface_config_v6only, | |
2917 | neighbor_interface_config_v6only_peergroup_cmd, | |
2918 | "neighbor WORD interface v6only peer-group WORD", | |
2919 | NEIGHBOR_STR | |
2920 | "Interface name or neighbor tag\n" | |
2921 | "Enable BGP on interface\n" | |
2922 | "Enable BGP with v6 link-local only\n" | |
2923 | "Member of the peer-group\n" | |
2924 | "peer-group name\n") | |
a80beece | 2925 | |
718e3744 | 2926 | DEFUN (neighbor_peer_group, |
2927 | neighbor_peer_group_cmd, | |
2928 | "neighbor WORD peer-group", | |
2929 | NEIGHBOR_STR | |
a80beece | 2930 | "Interface name or neighbor tag\n" |
718e3744 | 2931 | "Configure peer-group\n") |
2932 | { | |
2933 | struct bgp *bgp; | |
a80beece | 2934 | struct peer *peer; |
718e3744 | 2935 | struct peer_group *group; |
2936 | ||
2937 | bgp = vty->index; | |
a80beece DS |
2938 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2939 | if (peer) | |
2940 | { | |
2941 | vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); | |
2942 | return CMD_WARNING; | |
2943 | } | |
718e3744 | 2944 | |
2945 | group = peer_group_get (bgp, argv[0]); | |
2946 | if (! group) | |
2947 | return CMD_WARNING; | |
2948 | ||
2949 | return CMD_SUCCESS; | |
2950 | } | |
2951 | ||
2952 | DEFUN (no_neighbor, | |
2953 | no_neighbor_cmd, | |
2954 | NO_NEIGHBOR_CMD2, | |
2955 | NO_STR | |
2956 | NEIGHBOR_STR | |
2957 | NEIGHBOR_ADDR_STR2) | |
2958 | { | |
2959 | int ret; | |
2960 | union sockunion su; | |
2961 | struct peer_group *group; | |
2962 | struct peer *peer; | |
1ff9a340 | 2963 | struct peer *other; |
718e3744 | 2964 | |
2965 | ret = str2sockunion (argv[0], &su); | |
2966 | if (ret < 0) | |
2967 | { | |
a80beece DS |
2968 | /* look up for neighbor by interface name config. */ |
2969 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2970 | if (peer) | |
2971 | { | |
4a04e5f7 | 2972 | /* Request zebra to terminate IPv6 RAs on this interface. */ |
2973 | if (peer->ifp) | |
2974 | bgp_zebra_terminate_radv (peer->bgp, peer); | |
a80beece DS |
2975 | peer_delete (peer); |
2976 | return CMD_SUCCESS; | |
2977 | } | |
2978 | ||
718e3744 | 2979 | group = peer_group_lookup (vty->index, argv[0]); |
2980 | if (group) | |
2981 | peer_group_delete (group); | |
2982 | else | |
2983 | { | |
2984 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2985 | return CMD_WARNING; | |
2986 | } | |
2987 | } | |
2988 | else | |
2989 | { | |
2990 | peer = peer_lookup (vty->index, &su); | |
2991 | if (peer) | |
1ff9a340 | 2992 | { |
f14e6fdb DS |
2993 | if (peer_dynamic_neighbor (peer)) |
2994 | { | |
2995 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
2996 | VTY_NEWLINE); | |
2997 | return CMD_WARNING; | |
2998 | } | |
2999 | ||
1ff9a340 DS |
3000 | other = peer->doppelganger; |
3001 | peer_delete (peer); | |
3002 | if (other && other->status != Deleted) | |
3003 | peer_delete(other); | |
3004 | } | |
718e3744 | 3005 | } |
3006 | ||
3007 | return CMD_SUCCESS; | |
3008 | } | |
3009 | ||
3010 | ALIAS (no_neighbor, | |
3011 | no_neighbor_remote_as_cmd, | |
0299c004 | 3012 | NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 3013 | NO_STR |
3014 | NEIGHBOR_STR | |
3015 | NEIGHBOR_ADDR_STR | |
3016 | "Specify a BGP neighbor\n" | |
3017 | AS_STR) | |
3018 | ||
a80beece DS |
3019 | DEFUN (no_neighbor_interface_config, |
3020 | no_neighbor_interface_config_cmd, | |
4c48cf63 | 3021 | "no neighbor WORD interface", |
a80beece DS |
3022 | NO_STR |
3023 | NEIGHBOR_STR | |
3024 | "Interface name\n" | |
3025 | "Configure BGP on interface\n") | |
3026 | { | |
3027 | struct peer *peer; | |
3028 | ||
3029 | /* look up for neighbor by interface name config. */ | |
3030 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
3031 | if (peer) | |
3032 | { | |
4a04e5f7 | 3033 | /* Request zebra to terminate IPv6 RAs on this interface. */ |
3034 | if (peer->ifp) | |
3035 | bgp_zebra_terminate_radv (peer->bgp, peer); | |
a80beece DS |
3036 | peer_delete (peer); |
3037 | } | |
3038 | else | |
3039 | { | |
3040 | vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE); | |
3041 | return CMD_WARNING; | |
3042 | } | |
3043 | return CMD_SUCCESS; | |
3044 | } | |
3045 | ||
4c48cf63 DW |
3046 | ALIAS (no_neighbor_interface_config, |
3047 | no_neighbor_interface_config_peergroup_cmd, | |
3048 | "no neighbor WORD interface peer-group WORD", | |
3049 | NO_STR | |
3050 | NEIGHBOR_STR | |
3051 | "Interface name\n" | |
3052 | "Configure BGP on interface\n" | |
3053 | "Member of the peer-group\n" | |
3054 | "peer-group name\n") | |
3055 | ||
3056 | ALIAS (no_neighbor_interface_config, | |
3057 | no_neighbor_interface_config_v6only_cmd, | |
3058 | "no neighbor WORD interface v6only", | |
3059 | NO_STR | |
3060 | NEIGHBOR_STR | |
3061 | "Interface name\n" | |
3062 | "Configure BGP on interface\n" | |
3063 | "Enable BGP with v6 link-local only\n") | |
3064 | ||
3065 | ALIAS (no_neighbor_interface_config, | |
3066 | no_neighbor_interface_config_v6only_peergroup_cmd, | |
3067 | "no neighbor WORD interface v6only peer-group WORD", | |
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 | "Member of the peer-group\n" | |
3074 | "peer-group name\n") | |
3075 | ||
3076 | ||
718e3744 | 3077 | DEFUN (no_neighbor_peer_group, |
3078 | no_neighbor_peer_group_cmd, | |
3079 | "no neighbor WORD peer-group", | |
3080 | NO_STR | |
3081 | NEIGHBOR_STR | |
3082 | "Neighbor tag\n" | |
3083 | "Configure peer-group\n") | |
3084 | { | |
3085 | struct peer_group *group; | |
3086 | ||
3087 | group = peer_group_lookup (vty->index, argv[0]); | |
3088 | if (group) | |
3089 | peer_group_delete (group); | |
3090 | else | |
3091 | { | |
3092 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
3093 | return CMD_WARNING; | |
3094 | } | |
3095 | return CMD_SUCCESS; | |
3096 | } | |
3097 | ||
a80beece DS |
3098 | DEFUN (no_neighbor_interface_peer_group_remote_as, |
3099 | no_neighbor_interface_peer_group_remote_as_cmd, | |
0299c004 | 3100 | "no neighbor WORD remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 3101 | NO_STR |
3102 | NEIGHBOR_STR | |
a80beece | 3103 | "Interface name or neighbor tag\n" |
718e3744 | 3104 | "Specify a BGP neighbor\n" |
3105 | AS_STR) | |
3106 | { | |
3107 | struct peer_group *group; | |
a80beece DS |
3108 | struct peer *peer; |
3109 | ||
3110 | /* look up for neighbor by interface name config. */ | |
3111 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
3112 | if (peer) | |
3113 | { | |
0299c004 | 3114 | peer_as_change (peer, 0, AS_SPECIFIED); |
a80beece DS |
3115 | return CMD_SUCCESS; |
3116 | } | |
718e3744 | 3117 | |
3118 | group = peer_group_lookup (vty->index, argv[0]); | |
3119 | if (group) | |
3120 | peer_group_remote_as_delete (group); | |
3121 | else | |
3122 | { | |
a80beece | 3123 | vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE); |
718e3744 | 3124 | return CMD_WARNING; |
3125 | } | |
3126 | return CMD_SUCCESS; | |
3127 | } | |
6b0655a2 | 3128 | |
718e3744 | 3129 | DEFUN (neighbor_local_as, |
3130 | neighbor_local_as_cmd, | |
320da874 | 3131 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 3132 | NEIGHBOR_STR |
3133 | NEIGHBOR_ADDR_STR2 | |
3134 | "Specify a local-as number\n" | |
3135 | "AS number used as local AS\n") | |
3136 | { | |
3137 | struct peer *peer; | |
3138 | int ret; | |
3139 | ||
3140 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3141 | if (! peer) | |
3142 | return CMD_WARNING; | |
3143 | ||
9d3f9705 | 3144 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
718e3744 | 3145 | return bgp_vty_return (vty, ret); |
3146 | } | |
3147 | ||
3148 | DEFUN (neighbor_local_as_no_prepend, | |
3149 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 3150 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 3151 | NEIGHBOR_STR |
3152 | NEIGHBOR_ADDR_STR2 | |
3153 | "Specify a local-as number\n" | |
3154 | "AS number used as local AS\n" | |
3155 | "Do not prepend local-as to updates from ebgp peers\n") | |
3156 | { | |
3157 | struct peer *peer; | |
3158 | int ret; | |
3159 | ||
3160 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3161 | if (! peer) | |
3162 | return CMD_WARNING; | |
3163 | ||
9d3f9705 | 3164 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
718e3744 | 3165 | return bgp_vty_return (vty, ret); |
3166 | } | |
3167 | ||
9d3f9705 AC |
3168 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
3169 | neighbor_local_as_no_prepend_replace_as_cmd, | |
3170 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
3171 | NEIGHBOR_STR | |
3172 | NEIGHBOR_ADDR_STR2 | |
3173 | "Specify a local-as number\n" | |
3174 | "AS number used as local AS\n" | |
3175 | "Do not prepend local-as to updates from ebgp peers\n" | |
3176 | "Do not prepend local-as to updates from ibgp peers\n") | |
3177 | { | |
3178 | struct peer *peer; | |
3179 | int ret; | |
3180 | ||
3181 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3182 | if (! peer) | |
3183 | return CMD_WARNING; | |
3184 | ||
3185 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); | |
3186 | return bgp_vty_return (vty, ret); | |
3187 | } | |
3188 | ||
3189 | ||
718e3744 | 3190 | DEFUN (no_neighbor_local_as, |
3191 | no_neighbor_local_as_cmd, | |
3192 | NO_NEIGHBOR_CMD2 "local-as", | |
3193 | NO_STR | |
3194 | NEIGHBOR_STR | |
3195 | NEIGHBOR_ADDR_STR2 | |
3196 | "Specify a local-as number\n") | |
3197 | { | |
3198 | struct peer *peer; | |
3199 | int ret; | |
3200 | ||
3201 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3202 | if (! peer) | |
3203 | return CMD_WARNING; | |
3204 | ||
3205 | ret = peer_local_as_unset (peer); | |
3206 | return bgp_vty_return (vty, ret); | |
3207 | } | |
3208 | ||
3209 | ALIAS (no_neighbor_local_as, | |
3210 | no_neighbor_local_as_val_cmd, | |
320da874 | 3211 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 3212 | NO_STR |
3213 | NEIGHBOR_STR | |
3214 | NEIGHBOR_ADDR_STR2 | |
3215 | "Specify a local-as number\n" | |
3216 | "AS number used as local AS\n") | |
3217 | ||
3218 | ALIAS (no_neighbor_local_as, | |
3219 | no_neighbor_local_as_val2_cmd, | |
320da874 | 3220 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 3221 | NO_STR |
3222 | NEIGHBOR_STR | |
3223 | NEIGHBOR_ADDR_STR2 | |
3224 | "Specify a local-as number\n" | |
3225 | "AS number used as local AS\n" | |
3226 | "Do not prepend local-as to updates from ebgp peers\n") | |
9d3f9705 AC |
3227 | |
3228 | ALIAS (no_neighbor_local_as, | |
3229 | no_neighbor_local_as_val3_cmd, | |
3230 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
3231 | NO_STR | |
3232 | NEIGHBOR_STR | |
3233 | NEIGHBOR_ADDR_STR2 | |
3234 | "Specify a local-as number\n" | |
3235 | "AS number used as local AS\n" | |
3236 | "Do not prepend local-as to updates from ebgp peers\n" | |
3237 | "Do not prepend local-as to updates from ibgp peers\n") | |
6b0655a2 | 3238 | |
3f9c7369 DS |
3239 | DEFUN (neighbor_solo, |
3240 | neighbor_solo_cmd, | |
3241 | NEIGHBOR_CMD2 "solo", | |
3242 | NEIGHBOR_STR | |
3243 | NEIGHBOR_ADDR_STR2 | |
3244 | "Solo peer - part of its own update group\n") | |
3245 | { | |
3246 | struct peer *peer; | |
3247 | int ret; | |
3248 | ||
3249 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3250 | if (! peer) | |
3251 | return CMD_WARNING; | |
3252 | ||
3253 | ret = update_group_adjust_soloness(peer, 1); | |
3254 | return bgp_vty_return (vty, ret); | |
3255 | } | |
3256 | ||
3257 | DEFUN (no_neighbor_solo, | |
3258 | no_neighbor_solo_cmd, | |
3259 | NO_NEIGHBOR_CMD2 "solo", | |
3260 | NO_STR | |
3261 | NEIGHBOR_STR | |
3262 | NEIGHBOR_ADDR_STR2 | |
3263 | "Solo peer - part of its own update group\n") | |
3264 | { | |
3265 | struct peer *peer; | |
3266 | int ret; | |
3267 | ||
3268 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3269 | if (! peer) | |
3270 | return CMD_WARNING; | |
3271 | ||
3272 | ret = update_group_adjust_soloness(peer, 0); | |
3273 | return bgp_vty_return (vty, ret); | |
3274 | } | |
3275 | ||
0df7c91f PJ |
3276 | DEFUN (neighbor_password, |
3277 | neighbor_password_cmd, | |
3278 | NEIGHBOR_CMD2 "password LINE", | |
3279 | NEIGHBOR_STR | |
3280 | NEIGHBOR_ADDR_STR2 | |
3281 | "Set a password\n" | |
3282 | "The password\n") | |
3283 | { | |
3284 | struct peer *peer; | |
3285 | int ret; | |
3286 | ||
3287 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3288 | if (! peer) | |
3289 | return CMD_WARNING; | |
3290 | ||
3291 | ret = peer_password_set (peer, argv[1]); | |
3292 | return bgp_vty_return (vty, ret); | |
3293 | } | |
3294 | ||
3295 | DEFUN (no_neighbor_password, | |
3296 | no_neighbor_password_cmd, | |
3297 | NO_NEIGHBOR_CMD2 "password", | |
3298 | NO_STR | |
3299 | NEIGHBOR_STR | |
3300 | NEIGHBOR_ADDR_STR2 | |
3301 | "Set a password\n") | |
3302 | { | |
3303 | struct peer *peer; | |
3304 | int ret; | |
3305 | ||
3306 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3307 | if (! peer) | |
3308 | return CMD_WARNING; | |
3309 | ||
3310 | ret = peer_password_unset (peer); | |
3311 | return bgp_vty_return (vty, ret); | |
3312 | } | |
6b0655a2 | 3313 | |
813d4307 DW |
3314 | ALIAS (no_neighbor_password, |
3315 | no_neighbor_password_val_cmd, | |
3316 | NO_NEIGHBOR_CMD2 "password LINE", | |
3317 | NO_STR | |
3318 | NEIGHBOR_STR | |
3319 | NEIGHBOR_ADDR_STR2 | |
3320 | "Set a password\n" | |
3321 | "The password\n") | |
3322 | ||
718e3744 | 3323 | DEFUN (neighbor_activate, |
3324 | neighbor_activate_cmd, | |
3325 | NEIGHBOR_CMD2 "activate", | |
3326 | NEIGHBOR_STR | |
3327 | NEIGHBOR_ADDR_STR2 | |
3328 | "Enable the Address Family for this Neighbor\n") | |
3329 | { | |
c8560b44 | 3330 | int ret; |
718e3744 | 3331 | struct peer *peer; |
3332 | ||
3333 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3334 | if (! peer) | |
3335 | return CMD_WARNING; | |
3336 | ||
c8560b44 | 3337 | ret = peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
718e3744 | 3338 | |
c8560b44 DW |
3339 | if (ret) |
3340 | return CMD_WARNING; | |
718e3744 | 3341 | return CMD_SUCCESS; |
3342 | } | |
3343 | ||
3344 | DEFUN (no_neighbor_activate, | |
3345 | no_neighbor_activate_cmd, | |
3346 | NO_NEIGHBOR_CMD2 "activate", | |
3347 | NO_STR | |
3348 | NEIGHBOR_STR | |
3349 | NEIGHBOR_ADDR_STR2 | |
3350 | "Enable the Address Family for this Neighbor\n") | |
3351 | { | |
3352 | int ret; | |
3353 | struct peer *peer; | |
3354 | ||
3355 | /* Lookup peer. */ | |
3356 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3357 | if (! peer) | |
3358 | return CMD_WARNING; | |
3359 | ||
3360 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
3361 | ||
c8560b44 DW |
3362 | if (ret) |
3363 | return CMD_WARNING; | |
3364 | return CMD_SUCCESS; | |
718e3744 | 3365 | } |
6b0655a2 | 3366 | |
718e3744 | 3367 | DEFUN (neighbor_set_peer_group, |
3368 | neighbor_set_peer_group_cmd, | |
a80beece | 3369 | NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3370 | NEIGHBOR_STR |
a80beece | 3371 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3372 | "Member of the peer-group\n" |
3373 | "peer-group name\n") | |
3374 | { | |
3375 | int ret; | |
3376 | as_t as; | |
3377 | union sockunion su; | |
3378 | struct bgp *bgp; | |
a80beece | 3379 | struct peer *peer; |
718e3744 | 3380 | struct peer_group *group; |
3381 | ||
3382 | bgp = vty->index; | |
a80beece | 3383 | peer = NULL; |
718e3744 | 3384 | |
3385 | ret = str2sockunion (argv[0], &su); | |
3386 | if (ret < 0) | |
3387 | { | |
a80beece DS |
3388 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
3389 | if (!peer) | |
3390 | { | |
3391 | vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); | |
3392 | return CMD_WARNING; | |
3393 | } | |
3394 | } | |
3395 | else | |
3396 | { | |
6aeb9e78 | 3397 | if (peer_address_self_check (bgp, &su)) |
a80beece DS |
3398 | { |
3399 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
3400 | VTY_NEWLINE); | |
3401 | return CMD_WARNING; | |
3402 | } | |
f14e6fdb DS |
3403 | |
3404 | /* Disallow for dynamic neighbor. */ | |
3405 | peer = peer_lookup (bgp, &su); | |
3406 | if (peer && peer_dynamic_neighbor (peer)) | |
3407 | { | |
3408 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
3409 | VTY_NEWLINE); | |
3410 | return CMD_WARNING; | |
3411 | } | |
718e3744 | 3412 | } |
3413 | ||
3414 | group = peer_group_lookup (bgp, argv[1]); | |
3415 | if (! group) | |
3416 | { | |
3417 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3418 | return CMD_WARNING; | |
3419 | } | |
3420 | ||
c8560b44 | 3421 | ret = peer_group_bind (bgp, &su, peer, group, &as); |
718e3744 | 3422 | |
3423 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
3424 | { | |
aea339f7 | 3425 | 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 | 3426 | return CMD_WARNING; |
3427 | } | |
3428 | ||
3429 | return bgp_vty_return (vty, ret); | |
3430 | } | |
3431 | ||
3432 | DEFUN (no_neighbor_set_peer_group, | |
3433 | no_neighbor_set_peer_group_cmd, | |
a80beece | 3434 | NO_NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3435 | NO_STR |
3436 | NEIGHBOR_STR | |
a80beece | 3437 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3438 | "Member of the peer-group\n" |
3439 | "peer-group name\n") | |
3440 | { | |
3441 | int ret; | |
3442 | struct bgp *bgp; | |
3443 | struct peer *peer; | |
3444 | struct peer_group *group; | |
3445 | ||
3446 | bgp = vty->index; | |
3447 | ||
3448 | peer = peer_lookup_vty (vty, argv[0]); | |
3449 | if (! peer) | |
3450 | return CMD_WARNING; | |
3451 | ||
3452 | group = peer_group_lookup (bgp, argv[1]); | |
3453 | if (! group) | |
3454 | { | |
3455 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3456 | return CMD_WARNING; | |
3457 | } | |
3458 | ||
c8560b44 | 3459 | ret = peer_group_unbind (bgp, peer, group); |
718e3744 | 3460 | |
3461 | return bgp_vty_return (vty, ret); | |
3462 | } | |
6b0655a2 | 3463 | |
94f2b392 | 3464 | static int |
fd79ac91 | 3465 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
3466 | u_int16_t flag, int set) | |
718e3744 | 3467 | { |
3468 | int ret; | |
3469 | struct peer *peer; | |
3470 | ||
3471 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3472 | if (! peer) | |
3473 | return CMD_WARNING; | |
3474 | ||
8cdabf90 SK |
3475 | /* |
3476 | * If 'neighbor <interface>', then this is for directly connected peers, | |
3477 | * we should not accept disable-connected-check. | |
3478 | */ | |
3479 | if (peer->conf_if && (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK)) { | |
3480 | vty_out (vty, "%s is directly connected peer, cannot accept disable-" | |
3481 | "connected-check%s", ip_str, VTY_NEWLINE); | |
3482 | return CMD_WARNING; | |
3483 | } | |
3484 | ||
718e3744 | 3485 | if (set) |
3486 | ret = peer_flag_set (peer, flag); | |
3487 | else | |
3488 | ret = peer_flag_unset (peer, flag); | |
3489 | ||
3490 | return bgp_vty_return (vty, ret); | |
3491 | } | |
3492 | ||
94f2b392 | 3493 | static int |
fd79ac91 | 3494 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3495 | { |
3496 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
3497 | } | |
3498 | ||
94f2b392 | 3499 | static int |
fd79ac91 | 3500 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3501 | { |
3502 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
3503 | } | |
3504 | ||
3505 | /* neighbor passive. */ | |
3506 | DEFUN (neighbor_passive, | |
3507 | neighbor_passive_cmd, | |
3508 | NEIGHBOR_CMD2 "passive", | |
3509 | NEIGHBOR_STR | |
3510 | NEIGHBOR_ADDR_STR2 | |
3511 | "Don't send open messages to this neighbor\n") | |
3512 | { | |
3513 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3514 | } | |
3515 | ||
3516 | DEFUN (no_neighbor_passive, | |
3517 | no_neighbor_passive_cmd, | |
3518 | NO_NEIGHBOR_CMD2 "passive", | |
3519 | NO_STR | |
3520 | NEIGHBOR_STR | |
3521 | NEIGHBOR_ADDR_STR2 | |
3522 | "Don't send open messages to this neighbor\n") | |
3523 | { | |
3524 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3525 | } | |
6b0655a2 | 3526 | |
718e3744 | 3527 | /* neighbor shutdown. */ |
3528 | DEFUN (neighbor_shutdown, | |
3529 | neighbor_shutdown_cmd, | |
3530 | NEIGHBOR_CMD2 "shutdown", | |
3531 | NEIGHBOR_STR | |
3532 | NEIGHBOR_ADDR_STR2 | |
3533 | "Administratively shut down this neighbor\n") | |
3534 | { | |
3535 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3536 | } | |
3537 | ||
3538 | DEFUN (no_neighbor_shutdown, | |
3539 | no_neighbor_shutdown_cmd, | |
3540 | NO_NEIGHBOR_CMD2 "shutdown", | |
3541 | NO_STR | |
3542 | NEIGHBOR_STR | |
3543 | NEIGHBOR_ADDR_STR2 | |
3544 | "Administratively shut down this neighbor\n") | |
3545 | { | |
3546 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3547 | } | |
6b0655a2 | 3548 | |
718e3744 | 3549 | /* neighbor capability dynamic. */ |
3550 | DEFUN (neighbor_capability_dynamic, | |
3551 | neighbor_capability_dynamic_cmd, | |
3552 | NEIGHBOR_CMD2 "capability dynamic", | |
3553 | NEIGHBOR_STR | |
3554 | NEIGHBOR_ADDR_STR2 | |
3555 | "Advertise capability to the peer\n" | |
3556 | "Advertise dynamic capability to this neighbor\n") | |
3557 | { | |
3558 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3559 | } | |
3560 | ||
3561 | DEFUN (no_neighbor_capability_dynamic, | |
3562 | no_neighbor_capability_dynamic_cmd, | |
3563 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
3564 | NO_STR | |
3565 | NEIGHBOR_STR | |
3566 | NEIGHBOR_ADDR_STR2 | |
3567 | "Advertise capability to the peer\n" | |
3568 | "Advertise dynamic capability to this neighbor\n") | |
3569 | { | |
3570 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3571 | } | |
6b0655a2 | 3572 | |
718e3744 | 3573 | /* neighbor dont-capability-negotiate */ |
3574 | DEFUN (neighbor_dont_capability_negotiate, | |
3575 | neighbor_dont_capability_negotiate_cmd, | |
3576 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3577 | NEIGHBOR_STR | |
3578 | NEIGHBOR_ADDR_STR2 | |
3579 | "Do not perform capability negotiation\n") | |
3580 | { | |
3581 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3582 | } | |
3583 | ||
3584 | DEFUN (no_neighbor_dont_capability_negotiate, | |
3585 | no_neighbor_dont_capability_negotiate_cmd, | |
3586 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3587 | NO_STR | |
3588 | NEIGHBOR_STR | |
3589 | NEIGHBOR_ADDR_STR2 | |
3590 | "Do not perform capability negotiation\n") | |
3591 | { | |
3592 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3593 | } | |
6b0655a2 | 3594 | |
8a92a8a0 DS |
3595 | /* neighbor capability extended next hop encoding */ |
3596 | DEFUN (neighbor_capability_enhe, | |
3597 | neighbor_capability_enhe_cmd, | |
3598 | NEIGHBOR_CMD2 "capability extended-nexthop", | |
3599 | NEIGHBOR_STR | |
3600 | NEIGHBOR_ADDR_STR2 | |
3601 | "Advertise capability to the peer\n" | |
3602 | "Advertise extended next-hop capability to the peer\n") | |
3603 | { | |
3604 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3605 | } | |
3606 | ||
3607 | DEFUN (no_neighbor_capability_enhe, | |
3608 | no_neighbor_capability_enhe_cmd, | |
3609 | NO_NEIGHBOR_CMD2 "capability extended-nexthop", | |
3610 | NO_STR | |
3611 | NEIGHBOR_STR | |
3612 | NEIGHBOR_ADDR_STR2 | |
3613 | "Advertise capability to the peer\n" | |
3614 | "Advertise extended next-hop capability to the peer\n") | |
3615 | { | |
3616 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3617 | } | |
3618 | ||
94f2b392 | 3619 | static int |
fd79ac91 | 3620 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3621 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 3622 | { |
3623 | int ret; | |
3624 | struct peer *peer; | |
3625 | ||
3626 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3627 | if (! peer) | |
3628 | return CMD_WARNING; | |
3629 | ||
3630 | if (set) | |
3631 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
3632 | else | |
3633 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
3634 | ||
3635 | return bgp_vty_return (vty, ret); | |
3636 | } | |
3637 | ||
94f2b392 | 3638 | static int |
fd79ac91 | 3639 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3640 | safi_t safi, u_int32_t flag) |
718e3744 | 3641 | { |
3642 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
3643 | } | |
3644 | ||
94f2b392 | 3645 | static int |
fd79ac91 | 3646 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3647 | safi_t safi, u_int32_t flag) |
718e3744 | 3648 | { |
3649 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
3650 | } | |
6b0655a2 | 3651 | |
718e3744 | 3652 | /* neighbor capability orf prefix-list. */ |
3653 | DEFUN (neighbor_capability_orf_prefix, | |
3654 | neighbor_capability_orf_prefix_cmd, | |
3655 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3656 | NEIGHBOR_STR | |
3657 | NEIGHBOR_ADDR_STR2 | |
3658 | "Advertise capability to the peer\n" | |
3659 | "Advertise ORF capability to the peer\n" | |
3660 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3661 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3662 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3663 | "Capability to SEND the ORF to this neighbor\n") | |
3664 | { | |
3665 | u_int16_t flag = 0; | |
3666 | ||
3667 | if (strncmp (argv[1], "s", 1) == 0) | |
3668 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3669 | else if (strncmp (argv[1], "r", 1) == 0) | |
3670 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3671 | else if (strncmp (argv[1], "b", 1) == 0) | |
3672 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3673 | else | |
3674 | return CMD_WARNING; | |
3675 | ||
3676 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3677 | bgp_node_safi (vty), flag); | |
3678 | } | |
3679 | ||
3680 | DEFUN (no_neighbor_capability_orf_prefix, | |
3681 | no_neighbor_capability_orf_prefix_cmd, | |
3682 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3683 | NO_STR | |
3684 | NEIGHBOR_STR | |
3685 | NEIGHBOR_ADDR_STR2 | |
3686 | "Advertise capability to the peer\n" | |
3687 | "Advertise ORF capability to the peer\n" | |
3688 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3689 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3690 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3691 | "Capability to SEND the ORF to this neighbor\n") | |
3692 | { | |
3693 | u_int16_t flag = 0; | |
3694 | ||
3695 | if (strncmp (argv[1], "s", 1) == 0) | |
3696 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3697 | else if (strncmp (argv[1], "r", 1) == 0) | |
3698 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3699 | else if (strncmp (argv[1], "b", 1) == 0) | |
3700 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3701 | else | |
3702 | return CMD_WARNING; | |
3703 | ||
3704 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3705 | bgp_node_safi (vty), flag); | |
3706 | } | |
6b0655a2 | 3707 | |
718e3744 | 3708 | /* neighbor next-hop-self. */ |
3709 | DEFUN (neighbor_nexthop_self, | |
3710 | neighbor_nexthop_self_cmd, | |
a538debe | 3711 | NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3712 | NEIGHBOR_STR |
3713 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3714 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3715 | { |
a538debe DS |
3716 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3717 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); | |
3718 | } | |
9e7a53c1 | 3719 | |
a538debe DS |
3720 | /* neighbor next-hop-self. */ |
3721 | DEFUN (neighbor_nexthop_self_force, | |
3722 | neighbor_nexthop_self_force_cmd, | |
3723 | NEIGHBOR_CMD2 "next-hop-self force", | |
3724 | NEIGHBOR_STR | |
3725 | NEIGHBOR_ADDR_STR2 | |
3726 | "Disable the next hop calculation for this neighbor\n" | |
3727 | "Set the next hop to self for reflected routes\n") | |
3728 | { | |
3729 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3730 | bgp_node_safi (vty), | |
88b8ed8d | 3731 | PEER_FLAG_FORCE_NEXTHOP_SELF); |
718e3744 | 3732 | } |
3733 | ||
3734 | DEFUN (no_neighbor_nexthop_self, | |
3735 | no_neighbor_nexthop_self_cmd, | |
a538debe | 3736 | NO_NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3737 | NO_STR |
3738 | NEIGHBOR_STR | |
3739 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3740 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3741 | { |
3742 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
9e7a53c1 | 3743 | bgp_node_safi (vty), |
88b8ed8d | 3744 | PEER_FLAG_NEXTHOP_SELF); |
718e3744 | 3745 | } |
6b0655a2 | 3746 | |
88b8ed8d | 3747 | DEFUN (no_neighbor_nexthop_self_force, |
a538debe DS |
3748 | no_neighbor_nexthop_self_force_cmd, |
3749 | NO_NEIGHBOR_CMD2 "next-hop-self force", | |
3750 | NO_STR | |
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") | |
88b8ed8d DW |
3755 | { |
3756 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3757 | bgp_node_safi (vty), | |
3758 | PEER_FLAG_FORCE_NEXTHOP_SELF); | |
3759 | } | |
a538debe | 3760 | |
c7122e14 DS |
3761 | /* neighbor as-override */ |
3762 | DEFUN (neighbor_as_override, | |
3763 | neighbor_as_override_cmd, | |
3764 | NEIGHBOR_CMD2 "as-override", | |
3765 | NEIGHBOR_STR | |
3766 | NEIGHBOR_ADDR_STR2 | |
3767 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3768 | { | |
3769 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3770 | bgp_node_safi (vty), | |
3771 | PEER_FLAG_AS_OVERRIDE); | |
3772 | } | |
3773 | ||
3774 | DEFUN (no_neighbor_as_override, | |
3775 | no_neighbor_as_override_cmd, | |
3776 | NO_NEIGHBOR_CMD2 "as-override", | |
3777 | NO_STR | |
3778 | NEIGHBOR_STR | |
3779 | NEIGHBOR_ADDR_STR2 | |
3780 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3781 | { | |
3782 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3783 | bgp_node_safi (vty), | |
3784 | PEER_FLAG_AS_OVERRIDE); | |
3785 | } | |
3786 | ||
718e3744 | 3787 | /* neighbor remove-private-AS. */ |
3788 | DEFUN (neighbor_remove_private_as, | |
3789 | neighbor_remove_private_as_cmd, | |
3790 | NEIGHBOR_CMD2 "remove-private-AS", | |
3791 | NEIGHBOR_STR | |
3792 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3793 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3794 | { |
3795 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3796 | bgp_node_safi (vty), | |
3797 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
3798 | } | |
3799 | ||
5000f21c DS |
3800 | DEFUN (neighbor_remove_private_as_all, |
3801 | neighbor_remove_private_as_all_cmd, | |
3802 | NEIGHBOR_CMD2 "remove-private-AS all", | |
3803 | NEIGHBOR_STR | |
3804 | NEIGHBOR_ADDR_STR2 | |
3805 | "Remove private ASNs in outbound updates\n" | |
3806 | "Apply to all AS numbers") | |
3807 | { | |
5000f21c DS |
3808 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3809 | bgp_node_safi (vty), | |
5000f21c DS |
3810 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); |
3811 | } | |
3812 | ||
3813 | DEFUN (neighbor_remove_private_as_replace_as, | |
3814 | neighbor_remove_private_as_replace_as_cmd, | |
3815 | NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3816 | NEIGHBOR_STR | |
3817 | NEIGHBOR_ADDR_STR2 | |
3818 | "Remove private ASNs in outbound updates\n" | |
3819 | "Replace private ASNs with our ASN in outbound updates\n") | |
3820 | { | |
5000f21c DS |
3821 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3822 | bgp_node_safi (vty), | |
5000f21c DS |
3823 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); |
3824 | } | |
3825 | ||
3826 | DEFUN (neighbor_remove_private_as_all_replace_as, | |
3827 | neighbor_remove_private_as_all_replace_as_cmd, | |
3828 | NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3829 | NEIGHBOR_STR | |
3830 | NEIGHBOR_ADDR_STR2 | |
3831 | "Remove private ASNs in outbound updates\n" | |
3832 | "Apply to all AS numbers" | |
3833 | "Replace private ASNs with our ASN in outbound updates\n") | |
3834 | { | |
3835 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3836 | bgp_node_safi (vty), | |
88b8ed8d | 3837 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); |
5000f21c DS |
3838 | } |
3839 | ||
718e3744 | 3840 | DEFUN (no_neighbor_remove_private_as, |
3841 | no_neighbor_remove_private_as_cmd, | |
3842 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
3843 | NO_STR | |
3844 | NEIGHBOR_STR | |
3845 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3846 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3847 | { |
3848 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3849 | bgp_node_safi (vty), | |
88b8ed8d | 3850 | PEER_FLAG_REMOVE_PRIVATE_AS); |
718e3744 | 3851 | } |
6b0655a2 | 3852 | |
88b8ed8d | 3853 | DEFUN (no_neighbor_remove_private_as_all, |
5000f21c DS |
3854 | no_neighbor_remove_private_as_all_cmd, |
3855 | NO_NEIGHBOR_CMD2 "remove-private-AS all", | |
3856 | NO_STR | |
3857 | NEIGHBOR_STR | |
3858 | NEIGHBOR_ADDR_STR2 | |
3859 | "Remove private ASNs in outbound updates\n" | |
3860 | "Apply to all AS numbers") | |
88b8ed8d DW |
3861 | { |
3862 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3863 | bgp_node_safi (vty), | |
3864 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3865 | } | |
5000f21c | 3866 | |
88b8ed8d | 3867 | DEFUN (no_neighbor_remove_private_as_replace_as, |
5000f21c DS |
3868 | no_neighbor_remove_private_as_replace_as_cmd, |
3869 | NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3870 | NO_STR | |
3871 | NEIGHBOR_STR | |
3872 | NEIGHBOR_ADDR_STR2 | |
3873 | "Remove private ASNs in outbound updates\n" | |
3874 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d DW |
3875 | { |
3876 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3877 | bgp_node_safi (vty), | |
3878 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3879 | } | |
5000f21c | 3880 | |
88b8ed8d | 3881 | DEFUN (no_neighbor_remove_private_as_all_replace_as, |
5000f21c DS |
3882 | no_neighbor_remove_private_as_all_replace_as_cmd, |
3883 | NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3884 | NO_STR | |
3885 | NEIGHBOR_STR | |
3886 | NEIGHBOR_ADDR_STR2 | |
3887 | "Remove private ASNs in outbound updates\n" | |
3888 | "Apply to all AS numbers" | |
3889 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d DW |
3890 | { |
3891 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3892 | bgp_node_safi (vty), | |
3893 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); | |
3894 | } | |
5000f21c DS |
3895 | |
3896 | ||
718e3744 | 3897 | /* neighbor send-community. */ |
3898 | DEFUN (neighbor_send_community, | |
3899 | neighbor_send_community_cmd, | |
3900 | NEIGHBOR_CMD2 "send-community", | |
3901 | NEIGHBOR_STR | |
3902 | NEIGHBOR_ADDR_STR2 | |
3903 | "Send Community attribute to this neighbor\n") | |
3904 | { | |
3905 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3906 | bgp_node_safi (vty), | |
3907 | PEER_FLAG_SEND_COMMUNITY); | |
3908 | } | |
3909 | ||
3910 | DEFUN (no_neighbor_send_community, | |
3911 | no_neighbor_send_community_cmd, | |
3912 | NO_NEIGHBOR_CMD2 "send-community", | |
3913 | NO_STR | |
3914 | NEIGHBOR_STR | |
3915 | NEIGHBOR_ADDR_STR2 | |
3916 | "Send Community attribute to this neighbor\n") | |
3917 | { | |
3918 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3919 | bgp_node_safi (vty), | |
3920 | PEER_FLAG_SEND_COMMUNITY); | |
3921 | } | |
6b0655a2 | 3922 | |
718e3744 | 3923 | /* neighbor send-community extended. */ |
3924 | DEFUN (neighbor_send_community_type, | |
3925 | neighbor_send_community_type_cmd, | |
3926 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3927 | NEIGHBOR_STR | |
3928 | NEIGHBOR_ADDR_STR2 | |
3929 | "Send Community attribute to this neighbor\n" | |
3930 | "Send Standard and Extended Community attributes\n" | |
3931 | "Send Extended Community attributes\n" | |
3932 | "Send Standard Community attributes\n") | |
3933 | { | |
3934 | if (strncmp (argv[1], "s", 1) == 0) | |
3935 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3936 | bgp_node_safi (vty), | |
3937 | PEER_FLAG_SEND_COMMUNITY); | |
3938 | if (strncmp (argv[1], "e", 1) == 0) | |
3939 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3940 | bgp_node_safi (vty), | |
3941 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3942 | ||
3943 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3944 | bgp_node_safi (vty), | |
3945 | (PEER_FLAG_SEND_COMMUNITY| | |
3946 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3947 | } | |
3948 | ||
3949 | DEFUN (no_neighbor_send_community_type, | |
3950 | no_neighbor_send_community_type_cmd, | |
3951 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3952 | NO_STR | |
3953 | NEIGHBOR_STR | |
3954 | NEIGHBOR_ADDR_STR2 | |
3955 | "Send Community attribute to this neighbor\n" | |
3956 | "Send Standard and Extended Community attributes\n" | |
3957 | "Send Extended Community attributes\n" | |
3958 | "Send Standard Community attributes\n") | |
3959 | { | |
3960 | if (strncmp (argv[1], "s", 1) == 0) | |
3961 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3962 | bgp_node_safi (vty), | |
3963 | PEER_FLAG_SEND_COMMUNITY); | |
3964 | if (strncmp (argv[1], "e", 1) == 0) | |
3965 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3966 | bgp_node_safi (vty), | |
3967 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3968 | ||
3969 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3970 | bgp_node_safi (vty), | |
3971 | (PEER_FLAG_SEND_COMMUNITY | | |
3972 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3973 | } | |
6b0655a2 | 3974 | |
718e3744 | 3975 | /* neighbor soft-reconfig. */ |
3976 | DEFUN (neighbor_soft_reconfiguration, | |
3977 | neighbor_soft_reconfiguration_cmd, | |
3978 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3979 | NEIGHBOR_STR | |
3980 | NEIGHBOR_ADDR_STR2 | |
3981 | "Per neighbor soft reconfiguration\n" | |
3982 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3983 | { | |
3984 | return peer_af_flag_set_vty (vty, argv[0], | |
3985 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3986 | PEER_FLAG_SOFT_RECONFIG); | |
3987 | } | |
3988 | ||
3989 | DEFUN (no_neighbor_soft_reconfiguration, | |
3990 | no_neighbor_soft_reconfiguration_cmd, | |
3991 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3992 | NO_STR | |
3993 | NEIGHBOR_STR | |
3994 | NEIGHBOR_ADDR_STR2 | |
3995 | "Per neighbor soft reconfiguration\n" | |
3996 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3997 | { | |
3998 | return peer_af_flag_unset_vty (vty, argv[0], | |
3999 | bgp_node_afi (vty), bgp_node_safi (vty), | |
4000 | PEER_FLAG_SOFT_RECONFIG); | |
4001 | } | |
6b0655a2 | 4002 | |
718e3744 | 4003 | DEFUN (neighbor_route_reflector_client, |
4004 | neighbor_route_reflector_client_cmd, | |
4005 | NEIGHBOR_CMD2 "route-reflector-client", | |
4006 | NEIGHBOR_STR | |
4007 | NEIGHBOR_ADDR_STR2 | |
4008 | "Configure a neighbor as Route Reflector client\n") | |
4009 | { | |
4010 | struct peer *peer; | |
4011 | ||
4012 | ||
4013 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4014 | if (! peer) | |
4015 | return CMD_WARNING; | |
4016 | ||
4017 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4018 | bgp_node_safi (vty), | |
4019 | PEER_FLAG_REFLECTOR_CLIENT); | |
4020 | } | |
4021 | ||
4022 | DEFUN (no_neighbor_route_reflector_client, | |
4023 | no_neighbor_route_reflector_client_cmd, | |
4024 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
4025 | NO_STR | |
4026 | NEIGHBOR_STR | |
4027 | NEIGHBOR_ADDR_STR2 | |
4028 | "Configure a neighbor as Route Reflector client\n") | |
4029 | { | |
4030 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4031 | bgp_node_safi (vty), | |
4032 | PEER_FLAG_REFLECTOR_CLIENT); | |
4033 | } | |
6b0655a2 | 4034 | |
718e3744 | 4035 | /* neighbor route-server-client. */ |
4036 | DEFUN (neighbor_route_server_client, | |
4037 | neighbor_route_server_client_cmd, | |
4038 | NEIGHBOR_CMD2 "route-server-client", | |
4039 | NEIGHBOR_STR | |
4040 | NEIGHBOR_ADDR_STR2 | |
4041 | "Configure a neighbor as Route Server client\n") | |
4042 | { | |
2a3d5731 DW |
4043 | struct peer *peer; |
4044 | ||
4045 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4046 | if (! peer) | |
4047 | return CMD_WARNING; | |
4048 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4049 | bgp_node_safi (vty), | |
4050 | PEER_FLAG_RSERVER_CLIENT); | |
718e3744 | 4051 | } |
4052 | ||
4053 | DEFUN (no_neighbor_route_server_client, | |
4054 | no_neighbor_route_server_client_cmd, | |
4055 | NO_NEIGHBOR_CMD2 "route-server-client", | |
4056 | NO_STR | |
4057 | NEIGHBOR_STR | |
4058 | NEIGHBOR_ADDR_STR2 | |
4059 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 4060 | { |
2a3d5731 DW |
4061 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
4062 | bgp_node_safi (vty), | |
4063 | PEER_FLAG_RSERVER_CLIENT); | |
fee0f4c6 | 4064 | } |
6b0655a2 | 4065 | |
fee0f4c6 | 4066 | DEFUN (neighbor_nexthop_local_unchanged, |
4067 | neighbor_nexthop_local_unchanged_cmd, | |
4068 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
4069 | NEIGHBOR_STR | |
4070 | NEIGHBOR_ADDR_STR2 | |
4071 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
4072 | "Leave link-local nexthop unchanged for this peer\n") | |
4073 | { | |
4074 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4075 | bgp_node_safi (vty), | |
4076 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
4077 | } | |
6b0655a2 | 4078 | |
fee0f4c6 | 4079 | DEFUN (no_neighbor_nexthop_local_unchanged, |
4080 | no_neighbor_nexthop_local_unchanged_cmd, | |
4081 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
4082 | NO_STR | |
4083 | NEIGHBOR_STR | |
4084 | NEIGHBOR_ADDR_STR2 | |
4085 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
4086 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 4087 | { |
4088 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4089 | bgp_node_safi (vty), | |
fee0f4c6 | 4090 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 4091 | } |
6b0655a2 | 4092 | |
718e3744 | 4093 | DEFUN (neighbor_attr_unchanged, |
4094 | neighbor_attr_unchanged_cmd, | |
4095 | NEIGHBOR_CMD2 "attribute-unchanged", | |
4096 | NEIGHBOR_STR | |
4097 | NEIGHBOR_ADDR_STR2 | |
4098 | "BGP attribute is propagated unchanged to this neighbor\n") | |
4099 | { | |
4100 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4101 | bgp_node_safi (vty), | |
4102 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4103 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4104 | PEER_FLAG_MED_UNCHANGED)); | |
4105 | } | |
4106 | ||
4107 | DEFUN (neighbor_attr_unchanged1, | |
4108 | neighbor_attr_unchanged1_cmd, | |
4109 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4110 | NEIGHBOR_STR | |
4111 | NEIGHBOR_ADDR_STR2 | |
4112 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4113 | "As-path attribute\n" | |
4114 | "Nexthop attribute\n" | |
4115 | "Med attribute\n") | |
4116 | { | |
4117 | u_int16_t flags = 0; | |
4118 | ||
4119 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4120 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4121 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4122 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4123 | else if (strncmp (argv[1], "med", 1) == 0) | |
4124 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4125 | ||
4126 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4127 | bgp_node_safi (vty), flags); | |
4128 | } | |
4129 | ||
4130 | DEFUN (neighbor_attr_unchanged2, | |
4131 | neighbor_attr_unchanged2_cmd, | |
4132 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4133 | NEIGHBOR_STR | |
4134 | NEIGHBOR_ADDR_STR2 | |
4135 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4136 | "As-path attribute\n" | |
4137 | "Nexthop attribute\n" | |
4138 | "Med attribute\n") | |
4139 | { | |
4140 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4141 | ||
4142 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4143 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4144 | else if (strncmp (argv[1], "med", 1) == 0) | |
4145 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4146 | ||
4147 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4148 | bgp_node_safi (vty), flags); | |
4149 | ||
4150 | } | |
4151 | ||
4152 | DEFUN (neighbor_attr_unchanged3, | |
4153 | neighbor_attr_unchanged3_cmd, | |
4154 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4155 | NEIGHBOR_STR | |
4156 | NEIGHBOR_ADDR_STR2 | |
4157 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4158 | "Nexthop attribute\n" | |
4159 | "As-path attribute\n" | |
4160 | "Med attribute\n") | |
4161 | { | |
4162 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4163 | ||
4164 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4165 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4166 | else if (strncmp (argv[1], "med", 1) == 0) | |
4167 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4168 | ||
4169 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4170 | bgp_node_safi (vty), flags); | |
4171 | } | |
4172 | ||
4173 | DEFUN (neighbor_attr_unchanged4, | |
4174 | neighbor_attr_unchanged4_cmd, | |
4175 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4176 | NEIGHBOR_STR | |
4177 | NEIGHBOR_ADDR_STR2 | |
4178 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4179 | "Med attribute\n" | |
4180 | "As-path attribute\n" | |
4181 | "Nexthop attribute\n") | |
4182 | { | |
4183 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4184 | ||
4185 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4186 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4187 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4188 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4189 | ||
4190 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4191 | bgp_node_safi (vty), flags); | |
4192 | } | |
4193 | ||
4194 | ALIAS (neighbor_attr_unchanged, | |
4195 | neighbor_attr_unchanged5_cmd, | |
4196 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4197 | NEIGHBOR_STR | |
4198 | NEIGHBOR_ADDR_STR2 | |
4199 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4200 | "As-path attribute\n" | |
4201 | "Nexthop attribute\n" | |
4202 | "Med attribute\n") | |
4203 | ||
4204 | ALIAS (neighbor_attr_unchanged, | |
4205 | neighbor_attr_unchanged6_cmd, | |
4206 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4207 | NEIGHBOR_STR | |
4208 | NEIGHBOR_ADDR_STR2 | |
4209 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4210 | "As-path attribute\n" | |
4211 | "Med attribute\n" | |
4212 | "Nexthop attribute\n") | |
4213 | ||
4214 | ALIAS (neighbor_attr_unchanged, | |
4215 | neighbor_attr_unchanged7_cmd, | |
4216 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4217 | NEIGHBOR_STR | |
4218 | NEIGHBOR_ADDR_STR2 | |
4219 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4220 | "Nexthop attribute\n" | |
4221 | "Med attribute\n" | |
4222 | "As-path attribute\n") | |
4223 | ||
4224 | ALIAS (neighbor_attr_unchanged, | |
4225 | neighbor_attr_unchanged8_cmd, | |
4226 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4227 | NEIGHBOR_STR | |
4228 | NEIGHBOR_ADDR_STR2 | |
4229 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4230 | "Nexthop attribute\n" | |
4231 | "As-path attribute\n" | |
4232 | "Med attribute\n") | |
4233 | ||
4234 | ALIAS (neighbor_attr_unchanged, | |
4235 | neighbor_attr_unchanged9_cmd, | |
4236 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4237 | NEIGHBOR_STR | |
4238 | NEIGHBOR_ADDR_STR2 | |
4239 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4240 | "Med attribute\n" | |
4241 | "Nexthop attribute\n" | |
4242 | "As-path attribute\n") | |
4243 | ||
4244 | ALIAS (neighbor_attr_unchanged, | |
4245 | neighbor_attr_unchanged10_cmd, | |
4246 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4247 | NEIGHBOR_STR | |
4248 | NEIGHBOR_ADDR_STR2 | |
4249 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4250 | "Med attribute\n" | |
4251 | "As-path attribute\n" | |
4252 | "Nexthop attribute\n") | |
4253 | ||
4254 | DEFUN (no_neighbor_attr_unchanged, | |
4255 | no_neighbor_attr_unchanged_cmd, | |
4256 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
4257 | NO_STR | |
4258 | NEIGHBOR_STR | |
4259 | NEIGHBOR_ADDR_STR2 | |
4260 | "BGP attribute is propagated unchanged to this neighbor\n") | |
4261 | { | |
4262 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4263 | bgp_node_safi (vty), | |
4264 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4265 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4266 | PEER_FLAG_MED_UNCHANGED)); | |
4267 | } | |
4268 | ||
4269 | DEFUN (no_neighbor_attr_unchanged1, | |
4270 | no_neighbor_attr_unchanged1_cmd, | |
4271 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4272 | NO_STR | |
4273 | NEIGHBOR_STR | |
4274 | NEIGHBOR_ADDR_STR2 | |
4275 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4276 | "As-path attribute\n" | |
4277 | "Nexthop attribute\n" | |
4278 | "Med attribute\n") | |
4279 | { | |
4280 | u_int16_t flags = 0; | |
4281 | ||
4282 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4283 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4284 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4285 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4286 | else if (strncmp (argv[1], "med", 1) == 0) | |
4287 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4288 | ||
4289 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4290 | bgp_node_safi (vty), flags); | |
4291 | } | |
4292 | ||
4293 | DEFUN (no_neighbor_attr_unchanged2, | |
4294 | no_neighbor_attr_unchanged2_cmd, | |
4295 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4296 | NO_STR | |
4297 | NEIGHBOR_STR | |
4298 | NEIGHBOR_ADDR_STR2 | |
4299 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4300 | "As-path attribute\n" | |
4301 | "Nexthop attribute\n" | |
4302 | "Med attribute\n") | |
4303 | { | |
4304 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4305 | ||
4306 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4307 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4308 | else if (strncmp (argv[1], "med", 1) == 0) | |
4309 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4310 | ||
4311 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4312 | bgp_node_safi (vty), flags); | |
4313 | } | |
4314 | ||
4315 | DEFUN (no_neighbor_attr_unchanged3, | |
4316 | no_neighbor_attr_unchanged3_cmd, | |
4317 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4318 | NO_STR | |
4319 | NEIGHBOR_STR | |
4320 | NEIGHBOR_ADDR_STR2 | |
4321 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4322 | "Nexthop attribute\n" | |
4323 | "As-path attribute\n" | |
4324 | "Med attribute\n") | |
4325 | { | |
4326 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4327 | ||
4328 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4329 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4330 | else if (strncmp (argv[1], "med", 1) == 0) | |
4331 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4332 | ||
4333 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4334 | bgp_node_safi (vty), flags); | |
4335 | } | |
4336 | ||
4337 | DEFUN (no_neighbor_attr_unchanged4, | |
4338 | no_neighbor_attr_unchanged4_cmd, | |
4339 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4340 | NO_STR | |
4341 | NEIGHBOR_STR | |
4342 | NEIGHBOR_ADDR_STR2 | |
4343 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4344 | "Med attribute\n" | |
4345 | "As-path attribute\n" | |
4346 | "Nexthop attribute\n") | |
4347 | { | |
4348 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4349 | ||
4350 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4351 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4352 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4353 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4354 | ||
4355 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4356 | bgp_node_safi (vty), flags); | |
4357 | } | |
4358 | ||
4359 | ALIAS (no_neighbor_attr_unchanged, | |
4360 | no_neighbor_attr_unchanged5_cmd, | |
4361 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4362 | NO_STR | |
4363 | NEIGHBOR_STR | |
4364 | NEIGHBOR_ADDR_STR2 | |
4365 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4366 | "As-path attribute\n" | |
4367 | "Nexthop attribute\n" | |
4368 | "Med attribute\n") | |
4369 | ||
4370 | ALIAS (no_neighbor_attr_unchanged, | |
4371 | no_neighbor_attr_unchanged6_cmd, | |
4372 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4373 | NO_STR | |
4374 | NEIGHBOR_STR | |
4375 | NEIGHBOR_ADDR_STR2 | |
4376 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4377 | "As-path attribute\n" | |
4378 | "Med attribute\n" | |
4379 | "Nexthop attribute\n") | |
4380 | ||
4381 | ALIAS (no_neighbor_attr_unchanged, | |
4382 | no_neighbor_attr_unchanged7_cmd, | |
4383 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4384 | NO_STR | |
4385 | NEIGHBOR_STR | |
4386 | NEIGHBOR_ADDR_STR2 | |
4387 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4388 | "Nexthop attribute\n" | |
4389 | "Med attribute\n" | |
4390 | "As-path attribute\n") | |
4391 | ||
4392 | ALIAS (no_neighbor_attr_unchanged, | |
4393 | no_neighbor_attr_unchanged8_cmd, | |
4394 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4395 | NO_STR | |
4396 | NEIGHBOR_STR | |
4397 | NEIGHBOR_ADDR_STR2 | |
4398 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4399 | "Nexthop attribute\n" | |
4400 | "As-path attribute\n" | |
4401 | "Med attribute\n") | |
4402 | ||
4403 | ALIAS (no_neighbor_attr_unchanged, | |
4404 | no_neighbor_attr_unchanged9_cmd, | |
4405 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4406 | NO_STR | |
4407 | NEIGHBOR_STR | |
4408 | NEIGHBOR_ADDR_STR2 | |
4409 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4410 | "Med attribute\n" | |
4411 | "Nexthop attribute\n" | |
4412 | "As-path attribute\n") | |
4413 | ||
4414 | ALIAS (no_neighbor_attr_unchanged, | |
4415 | no_neighbor_attr_unchanged10_cmd, | |
4416 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4417 | NO_STR | |
4418 | NEIGHBOR_STR | |
4419 | NEIGHBOR_ADDR_STR2 | |
4420 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4421 | "Med attribute\n" | |
4422 | "As-path attribute\n" | |
4423 | "Nexthop attribute\n") | |
4424 | ||
718e3744 | 4425 | /* EBGP multihop configuration. */ |
94f2b392 | 4426 | static int |
fd79ac91 | 4427 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
4428 | const char *ttl_str) | |
718e3744 | 4429 | { |
4430 | struct peer *peer; | |
fd79ac91 | 4431 | unsigned int ttl; |
718e3744 | 4432 | |
4433 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4434 | if (! peer) | |
4435 | return CMD_WARNING; | |
4436 | ||
4437 | if (! ttl_str) | |
9b1be336 | 4438 | ttl = MAXTTL; |
718e3744 | 4439 | else |
9b1be336 | 4440 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, MAXTTL); |
718e3744 | 4441 | |
89b6d1f8 | 4442 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 4443 | } |
4444 | ||
94f2b392 | 4445 | static int |
fd79ac91 | 4446 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4447 | { |
4448 | struct peer *peer; | |
4449 | ||
4450 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4451 | if (! peer) | |
4452 | return CMD_WARNING; | |
4453 | ||
89b6d1f8 | 4454 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 4455 | } |
4456 | ||
4457 | /* neighbor ebgp-multihop. */ | |
4458 | DEFUN (neighbor_ebgp_multihop, | |
4459 | neighbor_ebgp_multihop_cmd, | |
4460 | NEIGHBOR_CMD2 "ebgp-multihop", | |
4461 | NEIGHBOR_STR | |
4462 | NEIGHBOR_ADDR_STR2 | |
4463 | "Allow EBGP neighbors not on directly connected networks\n") | |
4464 | { | |
4465 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
4466 | } | |
4467 | ||
4468 | DEFUN (neighbor_ebgp_multihop_ttl, | |
4469 | neighbor_ebgp_multihop_ttl_cmd, | |
9b1be336 | 4470 | NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), |
718e3744 | 4471 | NEIGHBOR_STR |
4472 | NEIGHBOR_ADDR_STR2 | |
4473 | "Allow EBGP neighbors not on directly connected networks\n" | |
4474 | "maximum hop count\n") | |
4475 | { | |
4476 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
4477 | } | |
4478 | ||
4479 | DEFUN (no_neighbor_ebgp_multihop, | |
4480 | no_neighbor_ebgp_multihop_cmd, | |
4481 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
4482 | NO_STR | |
4483 | NEIGHBOR_STR | |
4484 | NEIGHBOR_ADDR_STR2 | |
4485 | "Allow EBGP neighbors not on directly connected networks\n") | |
4486 | { | |
4487 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
4488 | } | |
4489 | ||
4490 | ALIAS (no_neighbor_ebgp_multihop, | |
4491 | no_neighbor_ebgp_multihop_ttl_cmd, | |
9b1be336 | 4492 | NO_NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), |
718e3744 | 4493 | NO_STR |
4494 | NEIGHBOR_STR | |
4495 | NEIGHBOR_ADDR_STR2 | |
4496 | "Allow EBGP neighbors not on directly connected networks\n" | |
4497 | "maximum hop count\n") | |
6b0655a2 | 4498 | |
6ffd2079 | 4499 | /* disable-connected-check */ |
4500 | DEFUN (neighbor_disable_connected_check, | |
4501 | neighbor_disable_connected_check_cmd, | |
4502 | NEIGHBOR_CMD2 "disable-connected-check", | |
4503 | NEIGHBOR_STR | |
4504 | NEIGHBOR_ADDR_STR2 | |
4505 | "one-hop away EBGP peer using loopback address\n") | |
4506 | { | |
4507 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4508 | } | |
4509 | ||
4510 | DEFUN (no_neighbor_disable_connected_check, | |
4511 | no_neighbor_disable_connected_check_cmd, | |
4512 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
4513 | NO_STR | |
4514 | NEIGHBOR_STR | |
4515 | NEIGHBOR_ADDR_STR2 | |
4516 | "one-hop away EBGP peer using loopback address\n") | |
4517 | { | |
4518 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4519 | } | |
4520 | ||
718e3744 | 4521 | /* Enforce multihop. */ |
6ffd2079 | 4522 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 4523 | neighbor_enforce_multihop_cmd, |
4524 | NEIGHBOR_CMD2 "enforce-multihop", | |
4525 | NEIGHBOR_STR | |
4526 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4527 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 4528 | |
6ffd2079 | 4529 | /* Enforce multihop. */ |
4530 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 4531 | no_neighbor_enforce_multihop_cmd, |
4532 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
4533 | NO_STR | |
4534 | NEIGHBOR_STR | |
4535 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4536 | "Enforce EBGP neighbors perform multihop\n") |
6b0655a2 | 4537 | |
718e3744 | 4538 | DEFUN (neighbor_description, |
4539 | neighbor_description_cmd, | |
4540 | NEIGHBOR_CMD2 "description .LINE", | |
4541 | NEIGHBOR_STR | |
4542 | NEIGHBOR_ADDR_STR2 | |
4543 | "Neighbor specific description\n" | |
4544 | "Up to 80 characters describing this neighbor\n") | |
4545 | { | |
4546 | struct peer *peer; | |
718e3744 | 4547 | char *str; |
718e3744 | 4548 | |
4549 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4550 | if (! peer) | |
4551 | return CMD_WARNING; | |
4552 | ||
4553 | if (argc == 1) | |
4554 | return CMD_SUCCESS; | |
4555 | ||
3b8b1855 | 4556 | str = argv_concat(argv, argc, 1); |
718e3744 | 4557 | |
4558 | peer_description_set (peer, str); | |
4559 | ||
3b8b1855 | 4560 | XFREE (MTYPE_TMP, str); |
718e3744 | 4561 | |
4562 | return CMD_SUCCESS; | |
4563 | } | |
4564 | ||
4565 | DEFUN (no_neighbor_description, | |
4566 | no_neighbor_description_cmd, | |
4567 | NO_NEIGHBOR_CMD2 "description", | |
4568 | NO_STR | |
4569 | NEIGHBOR_STR | |
4570 | NEIGHBOR_ADDR_STR2 | |
4571 | "Neighbor specific description\n") | |
4572 | { | |
4573 | struct peer *peer; | |
4574 | ||
4575 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4576 | if (! peer) | |
4577 | return CMD_WARNING; | |
4578 | ||
4579 | peer_description_unset (peer); | |
4580 | ||
4581 | return CMD_SUCCESS; | |
4582 | } | |
4583 | ||
4584 | ALIAS (no_neighbor_description, | |
4585 | no_neighbor_description_val_cmd, | |
4586 | NO_NEIGHBOR_CMD2 "description .LINE", | |
4587 | NO_STR | |
4588 | NEIGHBOR_STR | |
4589 | NEIGHBOR_ADDR_STR2 | |
4590 | "Neighbor specific description\n" | |
4591 | "Up to 80 characters describing this neighbor\n") | |
6b0655a2 | 4592 | |
718e3744 | 4593 | /* Neighbor update-source. */ |
94f2b392 | 4594 | static int |
fd79ac91 | 4595 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
4596 | const char *source_str) | |
718e3744 | 4597 | { |
4598 | struct peer *peer; | |
718e3744 | 4599 | |
4600 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4601 | if (! peer) | |
4602 | return CMD_WARNING; | |
4603 | ||
a80beece DS |
4604 | if (peer->conf_if) |
4605 | return CMD_WARNING; | |
4606 | ||
718e3744 | 4607 | if (source_str) |
4608 | { | |
c63b83fe JBD |
4609 | union sockunion su; |
4610 | int ret = str2sockunion (source_str, &su); | |
4611 | ||
4612 | if (ret == 0) | |
4613 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 4614 | else |
4615 | peer_update_source_if_set (peer, source_str); | |
4616 | } | |
4617 | else | |
4618 | peer_update_source_unset (peer); | |
4619 | ||
4620 | return CMD_SUCCESS; | |
4621 | } | |
4622 | ||
dcb52bd5 DS |
4623 | #define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD" |
4624 | #define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")" | |
4625 | #define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}" | |
369688c0 PJ |
4626 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
4627 | "IPv4 address\n" \ | |
9a1a331d PJ |
4628 | "IPv6 address\n" \ |
4629 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 4630 | |
718e3744 | 4631 | DEFUN (neighbor_update_source, |
4632 | neighbor_update_source_cmd, | |
dcb52bd5 | 4633 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_REQ_STR, |
718e3744 | 4634 | NEIGHBOR_STR |
4635 | NEIGHBOR_ADDR_STR2 | |
4636 | "Source of routing updates\n" | |
369688c0 | 4637 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 4638 | { |
4639 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
4640 | } | |
4641 | ||
4642 | DEFUN (no_neighbor_update_source, | |
4643 | no_neighbor_update_source_cmd, | |
dcb52bd5 | 4644 | NO_NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_OPT_STR, |
718e3744 | 4645 | NO_STR |
4646 | NEIGHBOR_STR | |
4647 | NEIGHBOR_ADDR_STR2 | |
dcb52bd5 DS |
4648 | "Source of routing updates\n" |
4649 | BGP_UPDATE_SOURCE_HELP_STR) | |
718e3744 | 4650 | { |
4651 | return peer_update_source_vty (vty, argv[0], NULL); | |
4652 | } | |
6b0655a2 | 4653 | |
94f2b392 | 4654 | static int |
fd79ac91 | 4655 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
4656 | afi_t afi, safi_t safi, | |
4657 | const char *rmap, int set) | |
718e3744 | 4658 | { |
4659 | int ret; | |
4660 | struct peer *peer; | |
4661 | ||
4662 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4663 | if (! peer) | |
4664 | return CMD_WARNING; | |
4665 | ||
4666 | if (set) | |
4667 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
4668 | else | |
4669 | ret = peer_default_originate_unset (peer, afi, safi); | |
4670 | ||
4671 | return bgp_vty_return (vty, ret); | |
4672 | } | |
4673 | ||
4674 | /* neighbor default-originate. */ | |
4675 | DEFUN (neighbor_default_originate, | |
4676 | neighbor_default_originate_cmd, | |
4677 | NEIGHBOR_CMD2 "default-originate", | |
4678 | NEIGHBOR_STR | |
4679 | NEIGHBOR_ADDR_STR2 | |
4680 | "Originate default route to this neighbor\n") | |
4681 | { | |
4682 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4683 | bgp_node_safi (vty), NULL, 1); | |
4684 | } | |
4685 | ||
4686 | DEFUN (neighbor_default_originate_rmap, | |
4687 | neighbor_default_originate_rmap_cmd, | |
4688 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4689 | NEIGHBOR_STR | |
4690 | NEIGHBOR_ADDR_STR2 | |
4691 | "Originate default route to this neighbor\n" | |
4692 | "Route-map to specify criteria to originate default\n" | |
4693 | "route-map name\n") | |
4694 | { | |
4695 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4696 | bgp_node_safi (vty), argv[1], 1); | |
4697 | } | |
4698 | ||
4699 | DEFUN (no_neighbor_default_originate, | |
4700 | no_neighbor_default_originate_cmd, | |
4701 | NO_NEIGHBOR_CMD2 "default-originate", | |
4702 | NO_STR | |
4703 | NEIGHBOR_STR | |
4704 | NEIGHBOR_ADDR_STR2 | |
4705 | "Originate default route to this neighbor\n") | |
4706 | { | |
4707 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4708 | bgp_node_safi (vty), NULL, 0); | |
4709 | } | |
4710 | ||
4711 | ALIAS (no_neighbor_default_originate, | |
4712 | no_neighbor_default_originate_rmap_cmd, | |
4713 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4714 | NO_STR | |
4715 | NEIGHBOR_STR | |
4716 | NEIGHBOR_ADDR_STR2 | |
4717 | "Originate default route to this neighbor\n" | |
4718 | "Route-map to specify criteria to originate default\n" | |
4719 | "route-map name\n") | |
6b0655a2 | 4720 | |
718e3744 | 4721 | /* Set neighbor's BGP port. */ |
94f2b392 | 4722 | static int |
fd79ac91 | 4723 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
4724 | const char *port_str) | |
718e3744 | 4725 | { |
4726 | struct peer *peer; | |
4727 | u_int16_t port; | |
4728 | struct servent *sp; | |
4729 | ||
4730 | peer = peer_lookup_vty (vty, ip_str); | |
4731 | if (! peer) | |
4732 | return CMD_WARNING; | |
4733 | ||
4734 | if (! port_str) | |
4735 | { | |
4736 | sp = getservbyname ("bgp", "tcp"); | |
4737 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
4738 | } | |
4739 | else | |
4740 | { | |
4741 | VTY_GET_INTEGER("port", port, port_str); | |
4742 | } | |
4743 | ||
4744 | peer_port_set (peer, port); | |
4745 | ||
4746 | return CMD_SUCCESS; | |
4747 | } | |
4748 | ||
f418446b | 4749 | /* Set specified peer's BGP port. */ |
718e3744 | 4750 | DEFUN (neighbor_port, |
4751 | neighbor_port_cmd, | |
4752 | NEIGHBOR_CMD "port <0-65535>", | |
4753 | NEIGHBOR_STR | |
4754 | NEIGHBOR_ADDR_STR | |
4755 | "Neighbor's BGP port\n" | |
4756 | "TCP port number\n") | |
4757 | { | |
4758 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
4759 | } | |
4760 | ||
4761 | DEFUN (no_neighbor_port, | |
4762 | no_neighbor_port_cmd, | |
4763 | NO_NEIGHBOR_CMD "port", | |
4764 | NO_STR | |
4765 | NEIGHBOR_STR | |
4766 | NEIGHBOR_ADDR_STR | |
4767 | "Neighbor's BGP port\n") | |
4768 | { | |
4769 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
4770 | } | |
4771 | ||
4772 | ALIAS (no_neighbor_port, | |
4773 | no_neighbor_port_val_cmd, | |
4774 | NO_NEIGHBOR_CMD "port <0-65535>", | |
4775 | NO_STR | |
4776 | NEIGHBOR_STR | |
4777 | NEIGHBOR_ADDR_STR | |
4778 | "Neighbor's BGP port\n" | |
4779 | "TCP port number\n") | |
6b0655a2 | 4780 | |
718e3744 | 4781 | /* neighbor weight. */ |
94f2b392 | 4782 | static int |
fd79ac91 | 4783 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
4784 | const char *weight_str) | |
718e3744 | 4785 | { |
1f9a9fff | 4786 | int ret; |
718e3744 | 4787 | struct peer *peer; |
4788 | unsigned long weight; | |
4789 | ||
4790 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4791 | if (! peer) | |
4792 | return CMD_WARNING; | |
4793 | ||
4794 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
4795 | ||
1f9a9fff PJ |
4796 | ret = peer_weight_set (peer, weight); |
4797 | return bgp_vty_return (vty, ret); | |
718e3744 | 4798 | } |
4799 | ||
94f2b392 | 4800 | static int |
fd79ac91 | 4801 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4802 | { |
1f9a9fff | 4803 | int ret; |
718e3744 | 4804 | struct peer *peer; |
4805 | ||
4806 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4807 | if (! peer) | |
4808 | return CMD_WARNING; | |
4809 | ||
1f9a9fff PJ |
4810 | ret = peer_weight_unset (peer); |
4811 | return bgp_vty_return (vty, ret); | |
718e3744 | 4812 | } |
4813 | ||
4814 | DEFUN (neighbor_weight, | |
4815 | neighbor_weight_cmd, | |
4816 | NEIGHBOR_CMD2 "weight <0-65535>", | |
4817 | NEIGHBOR_STR | |
4818 | NEIGHBOR_ADDR_STR2 | |
4819 | "Set default weight for routes from this neighbor\n" | |
4820 | "default weight\n") | |
4821 | { | |
4822 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
4823 | } | |
4824 | ||
4825 | DEFUN (no_neighbor_weight, | |
4826 | no_neighbor_weight_cmd, | |
4827 | NO_NEIGHBOR_CMD2 "weight", | |
4828 | NO_STR | |
4829 | NEIGHBOR_STR | |
4830 | NEIGHBOR_ADDR_STR2 | |
4831 | "Set default weight for routes from this neighbor\n") | |
4832 | { | |
4833 | return peer_weight_unset_vty (vty, argv[0]); | |
4834 | } | |
4835 | ||
4836 | ALIAS (no_neighbor_weight, | |
4837 | no_neighbor_weight_val_cmd, | |
4838 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
4839 | NO_STR | |
4840 | NEIGHBOR_STR | |
4841 | NEIGHBOR_ADDR_STR2 | |
4842 | "Set default weight for routes from this neighbor\n" | |
4843 | "default weight\n") | |
6b0655a2 | 4844 | |
718e3744 | 4845 | /* Override capability negotiation. */ |
4846 | DEFUN (neighbor_override_capability, | |
4847 | neighbor_override_capability_cmd, | |
4848 | NEIGHBOR_CMD2 "override-capability", | |
4849 | NEIGHBOR_STR | |
4850 | NEIGHBOR_ADDR_STR2 | |
4851 | "Override capability negotiation result\n") | |
4852 | { | |
4853 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4854 | } | |
4855 | ||
4856 | DEFUN (no_neighbor_override_capability, | |
4857 | no_neighbor_override_capability_cmd, | |
4858 | NO_NEIGHBOR_CMD2 "override-capability", | |
4859 | NO_STR | |
4860 | NEIGHBOR_STR | |
4861 | NEIGHBOR_ADDR_STR2 | |
4862 | "Override capability negotiation result\n") | |
4863 | { | |
4864 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4865 | } | |
6b0655a2 | 4866 | |
718e3744 | 4867 | DEFUN (neighbor_strict_capability, |
4868 | neighbor_strict_capability_cmd, | |
4869 | NEIGHBOR_CMD "strict-capability-match", | |
4870 | NEIGHBOR_STR | |
4871 | NEIGHBOR_ADDR_STR | |
4872 | "Strict capability negotiation match\n") | |
4873 | { | |
4874 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4875 | } | |
4876 | ||
4877 | DEFUN (no_neighbor_strict_capability, | |
4878 | no_neighbor_strict_capability_cmd, | |
4879 | NO_NEIGHBOR_CMD "strict-capability-match", | |
4880 | NO_STR | |
4881 | NEIGHBOR_STR | |
4882 | NEIGHBOR_ADDR_STR | |
4883 | "Strict capability negotiation match\n") | |
4884 | { | |
4885 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4886 | } | |
6b0655a2 | 4887 | |
94f2b392 | 4888 | static int |
fd79ac91 | 4889 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
4890 | const char *keep_str, const char *hold_str) | |
718e3744 | 4891 | { |
4892 | int ret; | |
4893 | struct peer *peer; | |
4894 | u_int32_t keepalive; | |
4895 | u_int32_t holdtime; | |
4896 | ||
4897 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4898 | if (! peer) | |
4899 | return CMD_WARNING; | |
4900 | ||
4901 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
4902 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
4903 | ||
4904 | ret = peer_timers_set (peer, keepalive, holdtime); | |
4905 | ||
4906 | return bgp_vty_return (vty, ret); | |
4907 | } | |
6b0655a2 | 4908 | |
94f2b392 | 4909 | static int |
fd79ac91 | 4910 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4911 | { |
4912 | int ret; | |
4913 | struct peer *peer; | |
4914 | ||
0c412461 | 4915 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4916 | if (! peer) |
4917 | return CMD_WARNING; | |
4918 | ||
4919 | ret = peer_timers_unset (peer); | |
4920 | ||
4921 | return bgp_vty_return (vty, ret); | |
4922 | } | |
4923 | ||
4924 | DEFUN (neighbor_timers, | |
4925 | neighbor_timers_cmd, | |
4926 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4927 | NEIGHBOR_STR | |
4928 | NEIGHBOR_ADDR_STR2 | |
4929 | "BGP per neighbor timers\n" | |
4930 | "Keepalive interval\n" | |
4931 | "Holdtime\n") | |
4932 | { | |
4933 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
4934 | } | |
4935 | ||
4936 | DEFUN (no_neighbor_timers, | |
4937 | no_neighbor_timers_cmd, | |
4938 | NO_NEIGHBOR_CMD2 "timers", | |
4939 | NO_STR | |
4940 | NEIGHBOR_STR | |
4941 | NEIGHBOR_ADDR_STR2 | |
4942 | "BGP per neighbor timers\n") | |
4943 | { | |
4944 | return peer_timers_unset_vty (vty, argv[0]); | |
4945 | } | |
6b0655a2 | 4946 | |
813d4307 DW |
4947 | ALIAS (no_neighbor_timers, |
4948 | no_neighbor_timers_val_cmd, | |
4949 | NO_NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4950 | NO_STR | |
4951 | NEIGHBOR_STR | |
4952 | NEIGHBOR_ADDR_STR2 | |
4953 | "BGP per neighbor timers\n" | |
4954 | "Keepalive interval\n" | |
4955 | "Holdtime\n") | |
4956 | ||
94f2b392 | 4957 | static int |
fd79ac91 | 4958 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
4959 | const char *time_str) | |
718e3744 | 4960 | { |
4961 | int ret; | |
4962 | struct peer *peer; | |
4963 | u_int32_t connect; | |
4964 | ||
966f821c | 4965 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4966 | if (! peer) |
4967 | return CMD_WARNING; | |
4968 | ||
4969 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
4970 | ||
4971 | ret = peer_timers_connect_set (peer, connect); | |
4972 | ||
966f821c | 4973 | return bgp_vty_return (vty, ret); |
718e3744 | 4974 | } |
4975 | ||
94f2b392 | 4976 | static int |
fd79ac91 | 4977 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4978 | { |
4979 | int ret; | |
4980 | struct peer *peer; | |
4981 | ||
4982 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4983 | if (! peer) | |
4984 | return CMD_WARNING; | |
4985 | ||
4986 | ret = peer_timers_connect_unset (peer); | |
4987 | ||
966f821c | 4988 | return bgp_vty_return (vty, ret); |
718e3744 | 4989 | } |
4990 | ||
4991 | DEFUN (neighbor_timers_connect, | |
4992 | neighbor_timers_connect_cmd, | |
8e0d0089 | 4993 | NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 4994 | NEIGHBOR_STR |
966f821c | 4995 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4996 | "BGP per neighbor timers\n" |
4997 | "BGP connect timer\n" | |
4998 | "Connect timer\n") | |
4999 | { | |
5000 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
5001 | } | |
5002 | ||
5003 | DEFUN (no_neighbor_timers_connect, | |
5004 | no_neighbor_timers_connect_cmd, | |
966f821c | 5005 | NO_NEIGHBOR_CMD2 "timers connect", |
718e3744 | 5006 | NO_STR |
5007 | NEIGHBOR_STR | |
966f821c | 5008 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5009 | "BGP per neighbor timers\n" |
5010 | "BGP connect timer\n") | |
5011 | { | |
5012 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
5013 | } | |
5014 | ||
5015 | ALIAS (no_neighbor_timers_connect, | |
5016 | no_neighbor_timers_connect_val_cmd, | |
8e0d0089 | 5017 | NO_NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 5018 | NO_STR |
5019 | NEIGHBOR_STR | |
966f821c | 5020 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5021 | "BGP per neighbor timers\n" |
5022 | "BGP connect timer\n" | |
5023 | "Connect timer\n") | |
6b0655a2 | 5024 | |
94f2b392 | 5025 | static int |
fd79ac91 | 5026 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
5027 | const char *time_str, int set) | |
718e3744 | 5028 | { |
5029 | int ret; | |
5030 | struct peer *peer; | |
5031 | u_int32_t routeadv = 0; | |
5032 | ||
966f821c | 5033 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 5034 | if (! peer) |
5035 | return CMD_WARNING; | |
5036 | ||
5037 | if (time_str) | |
5038 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
5039 | ||
5040 | if (set) | |
5041 | ret = peer_advertise_interval_set (peer, routeadv); | |
5042 | else | |
5043 | ret = peer_advertise_interval_unset (peer); | |
5044 | ||
966f821c | 5045 | return bgp_vty_return (vty, ret); |
718e3744 | 5046 | } |
5047 | ||
5048 | DEFUN (neighbor_advertise_interval, | |
5049 | neighbor_advertise_interval_cmd, | |
966f821c | 5050 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 5051 | NEIGHBOR_STR |
966f821c | 5052 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5053 | "Minimum interval between sending BGP routing updates\n" |
5054 | "time in seconds\n") | |
5055 | { | |
5056 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
5057 | } | |
5058 | ||
5059 | DEFUN (no_neighbor_advertise_interval, | |
5060 | no_neighbor_advertise_interval_cmd, | |
966f821c | 5061 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
718e3744 | 5062 | NO_STR |
5063 | NEIGHBOR_STR | |
966f821c | 5064 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5065 | "Minimum interval between sending BGP routing updates\n") |
5066 | { | |
5067 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
5068 | } | |
5069 | ||
5070 | ALIAS (no_neighbor_advertise_interval, | |
5071 | no_neighbor_advertise_interval_val_cmd, | |
966f821c | 5072 | NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 5073 | NO_STR |
5074 | NEIGHBOR_STR | |
966f821c | 5075 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5076 | "Minimum interval between sending BGP routing updates\n" |
5077 | "time in seconds\n") | |
6b0655a2 | 5078 | |
518f0eb1 DS |
5079 | /* Time to wait before processing route-map updates */ |
5080 | DEFUN (bgp_set_route_map_delay_timer, | |
5081 | bgp_set_route_map_delay_timer_cmd, | |
5082 | "bgp route-map delay-timer <0-600>", | |
5083 | SET_STR | |
5084 | "BGP route-map delay timer\n" | |
5085 | "Time in secs to wait before processing route-map changes\n" | |
f414725f | 5086 | "0 disables the timer, no route updates happen when route-maps change\n") |
518f0eb1 DS |
5087 | { |
5088 | u_int32_t rmap_delay_timer; | |
518f0eb1 | 5089 | |
518f0eb1 DS |
5090 | if (argv[0]) |
5091 | { | |
5092 | VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); | |
5fe9f963 | 5093 | bm->rmap_update_timer = rmap_delay_timer; |
518f0eb1 DS |
5094 | |
5095 | /* if the dynamic update handling is being disabled, and a timer is | |
5096 | * running, stop the timer and act as if the timer has already fired. | |
5097 | */ | |
5fe9f963 | 5098 | if (!rmap_delay_timer && bm->t_rmap_update ) |
518f0eb1 | 5099 | { |
5fe9f963 | 5100 | BGP_TIMER_OFF(bm->t_rmap_update); |
5101 | thread_execute (bm->master, bgp_route_map_update_timer, NULL, 0); | |
518f0eb1 DS |
5102 | } |
5103 | return CMD_SUCCESS; | |
5104 | } | |
5105 | else | |
ffd0c037 | 5106 | return CMD_WARNING; |
518f0eb1 DS |
5107 | } |
5108 | ||
5109 | DEFUN (no_bgp_set_route_map_delay_timer, | |
5110 | no_bgp_set_route_map_delay_timer_cmd, | |
5111 | "no bgp route-map delay-timer", | |
5112 | NO_STR | |
5113 | "Default BGP route-map delay timer\n" | |
f414725f | 5114 | "Reset to default time to wait for processing route-map changes\n") |
518f0eb1 | 5115 | { |
518f0eb1 | 5116 | |
5fe9f963 | 5117 | bm->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER; |
518f0eb1 DS |
5118 | |
5119 | return CMD_SUCCESS; | |
5120 | } | |
5121 | ||
f414725f DS |
5122 | ALIAS (no_bgp_set_route_map_delay_timer, |
5123 | no_bgp_set_route_map_delay_timer_val_cmd, | |
5124 | "no bgp route-map delay-timer <0-600>", | |
5125 | NO_STR | |
5126 | "Default BGP route-map delay timer\n" | |
5127 | "Reset to default time to wait for processing route-map changes\n" | |
5128 | "0 disables the timer, no route updates happen when route-maps change\n") | |
5129 | ||
718e3744 | 5130 | /* neighbor interface */ |
94f2b392 | 5131 | static int |
fd79ac91 | 5132 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 5133 | { |
718e3744 | 5134 | struct peer *peer; |
5135 | ||
5136 | peer = peer_lookup_vty (vty, ip_str); | |
a80beece | 5137 | if (! peer || peer->conf_if) |
718e3744 | 5138 | return CMD_WARNING; |
5139 | ||
5140 | if (str) | |
ffd0c037 | 5141 | peer_interface_set (peer, str); |
718e3744 | 5142 | else |
ffd0c037 | 5143 | peer_interface_unset (peer); |
718e3744 | 5144 | |
5145 | return CMD_SUCCESS; | |
5146 | } | |
5147 | ||
5148 | DEFUN (neighbor_interface, | |
5149 | neighbor_interface_cmd, | |
5150 | NEIGHBOR_CMD "interface WORD", | |
5151 | NEIGHBOR_STR | |
5152 | NEIGHBOR_ADDR_STR | |
5153 | "Interface\n" | |
5154 | "Interface name\n") | |
5155 | { | |
8ffedcea DS |
5156 | if (argc == 3) |
5157 | return peer_interface_vty (vty, argv[0], argv[1]); | |
5158 | else | |
5159 | return peer_interface_vty (vty, argv[0], argv[1]); | |
718e3744 | 5160 | } |
5161 | ||
5162 | DEFUN (no_neighbor_interface, | |
5163 | no_neighbor_interface_cmd, | |
8ffedcea | 5164 | NO_NEIGHBOR_CMD2 "interface WORD", |
718e3744 | 5165 | NO_STR |
5166 | NEIGHBOR_STR | |
5167 | NEIGHBOR_ADDR_STR | |
5168 | "Interface\n" | |
5169 | "Interface name\n") | |
5170 | { | |
5171 | return peer_interface_vty (vty, argv[0], NULL); | |
5172 | } | |
6b0655a2 | 5173 | |
718e3744 | 5174 | /* Set distribute list to the peer. */ |
94f2b392 | 5175 | static int |
fd79ac91 | 5176 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
5177 | afi_t afi, safi_t safi, | |
5178 | const char *name_str, const char *direct_str) | |
718e3744 | 5179 | { |
5180 | int ret; | |
5181 | struct peer *peer; | |
5182 | int direct = FILTER_IN; | |
5183 | ||
5184 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5185 | if (! peer) | |
5186 | return CMD_WARNING; | |
5187 | ||
5188 | /* Check filter direction. */ | |
5189 | if (strncmp (direct_str, "i", 1) == 0) | |
5190 | direct = FILTER_IN; | |
5191 | else if (strncmp (direct_str, "o", 1) == 0) | |
5192 | direct = FILTER_OUT; | |
5193 | ||
5194 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
5195 | ||
5196 | return bgp_vty_return (vty, ret); | |
5197 | } | |
5198 | ||
94f2b392 | 5199 | static int |
fd79ac91 | 5200 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5201 | safi_t safi, const char *direct_str) | |
718e3744 | 5202 | { |
5203 | int ret; | |
5204 | struct peer *peer; | |
5205 | int direct = FILTER_IN; | |
5206 | ||
5207 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5208 | if (! peer) | |
5209 | return CMD_WARNING; | |
5210 | ||
5211 | /* Check filter direction. */ | |
5212 | if (strncmp (direct_str, "i", 1) == 0) | |
5213 | direct = FILTER_IN; | |
5214 | else if (strncmp (direct_str, "o", 1) == 0) | |
5215 | direct = FILTER_OUT; | |
5216 | ||
5217 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
5218 | ||
5219 | return bgp_vty_return (vty, ret); | |
5220 | } | |
5221 | ||
5222 | DEFUN (neighbor_distribute_list, | |
5223 | neighbor_distribute_list_cmd, | |
5224 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5225 | NEIGHBOR_STR | |
5226 | NEIGHBOR_ADDR_STR2 | |
5227 | "Filter updates to/from this neighbor\n" | |
5228 | "IP access-list number\n" | |
5229 | "IP access-list number (expanded range)\n" | |
5230 | "IP Access-list name\n" | |
5231 | "Filter incoming updates\n" | |
5232 | "Filter outgoing updates\n") | |
5233 | { | |
5234 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5235 | bgp_node_safi (vty), argv[1], argv[2]); | |
5236 | } | |
5237 | ||
5238 | DEFUN (no_neighbor_distribute_list, | |
5239 | no_neighbor_distribute_list_cmd, | |
5240 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5241 | NO_STR | |
5242 | NEIGHBOR_STR | |
5243 | NEIGHBOR_ADDR_STR2 | |
5244 | "Filter updates to/from this neighbor\n" | |
5245 | "IP access-list number\n" | |
5246 | "IP access-list number (expanded range)\n" | |
5247 | "IP Access-list name\n" | |
5248 | "Filter incoming updates\n" | |
5249 | "Filter outgoing updates\n") | |
5250 | { | |
5251 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5252 | bgp_node_safi (vty), argv[2]); | |
5253 | } | |
6b0655a2 | 5254 | |
718e3744 | 5255 | /* Set prefix list to the peer. */ |
94f2b392 | 5256 | static int |
fd79ac91 | 5257 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5258 | safi_t safi, const char *name_str, | |
5259 | const char *direct_str) | |
718e3744 | 5260 | { |
5261 | int ret; | |
5262 | struct peer *peer; | |
5263 | int direct = FILTER_IN; | |
5264 | ||
5265 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5266 | if (! peer) | |
5267 | return CMD_WARNING; | |
5268 | ||
5269 | /* Check filter direction. */ | |
5270 | if (strncmp (direct_str, "i", 1) == 0) | |
5271 | direct = FILTER_IN; | |
5272 | else if (strncmp (direct_str, "o", 1) == 0) | |
5273 | direct = FILTER_OUT; | |
5274 | ||
5275 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
5276 | ||
5277 | return bgp_vty_return (vty, ret); | |
5278 | } | |
5279 | ||
94f2b392 | 5280 | static int |
fd79ac91 | 5281 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5282 | safi_t safi, const char *direct_str) | |
718e3744 | 5283 | { |
5284 | int ret; | |
5285 | struct peer *peer; | |
5286 | int direct = FILTER_IN; | |
5287 | ||
5288 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5289 | if (! peer) | |
5290 | return CMD_WARNING; | |
5291 | ||
5292 | /* Check filter direction. */ | |
5293 | if (strncmp (direct_str, "i", 1) == 0) | |
5294 | direct = FILTER_IN; | |
5295 | else if (strncmp (direct_str, "o", 1) == 0) | |
5296 | direct = FILTER_OUT; | |
5297 | ||
5298 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
5299 | ||
5300 | return bgp_vty_return (vty, ret); | |
5301 | } | |
5302 | ||
5303 | DEFUN (neighbor_prefix_list, | |
5304 | neighbor_prefix_list_cmd, | |
5305 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5306 | NEIGHBOR_STR | |
5307 | NEIGHBOR_ADDR_STR2 | |
5308 | "Filter updates to/from this neighbor\n" | |
5309 | "Name of a prefix list\n" | |
5310 | "Filter incoming updates\n" | |
5311 | "Filter outgoing updates\n") | |
5312 | { | |
5313 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5314 | bgp_node_safi (vty), argv[1], argv[2]); | |
5315 | } | |
5316 | ||
5317 | DEFUN (no_neighbor_prefix_list, | |
5318 | no_neighbor_prefix_list_cmd, | |
5319 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5320 | NO_STR | |
5321 | NEIGHBOR_STR | |
5322 | NEIGHBOR_ADDR_STR2 | |
5323 | "Filter updates to/from this neighbor\n" | |
5324 | "Name of a prefix list\n" | |
5325 | "Filter incoming updates\n" | |
5326 | "Filter outgoing updates\n") | |
5327 | { | |
5328 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5329 | bgp_node_safi (vty), argv[2]); | |
5330 | } | |
6b0655a2 | 5331 | |
94f2b392 | 5332 | static int |
fd79ac91 | 5333 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
5334 | afi_t afi, safi_t safi, | |
5335 | const char *name_str, const char *direct_str) | |
718e3744 | 5336 | { |
5337 | int ret; | |
5338 | struct peer *peer; | |
5339 | int direct = FILTER_IN; | |
5340 | ||
5341 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5342 | if (! peer) | |
5343 | return CMD_WARNING; | |
5344 | ||
5345 | /* Check filter direction. */ | |
5346 | if (strncmp (direct_str, "i", 1) == 0) | |
5347 | direct = FILTER_IN; | |
5348 | else if (strncmp (direct_str, "o", 1) == 0) | |
5349 | direct = FILTER_OUT; | |
5350 | ||
5351 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
5352 | ||
5353 | return bgp_vty_return (vty, ret); | |
5354 | } | |
5355 | ||
94f2b392 | 5356 | static int |
fd79ac91 | 5357 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
5358 | afi_t afi, safi_t safi, | |
5359 | const char *direct_str) | |
718e3744 | 5360 | { |
5361 | int ret; | |
5362 | struct peer *peer; | |
5363 | int direct = FILTER_IN; | |
5364 | ||
5365 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5366 | if (! peer) | |
5367 | return CMD_WARNING; | |
5368 | ||
5369 | /* Check filter direction. */ | |
5370 | if (strncmp (direct_str, "i", 1) == 0) | |
5371 | direct = FILTER_IN; | |
5372 | else if (strncmp (direct_str, "o", 1) == 0) | |
5373 | direct = FILTER_OUT; | |
5374 | ||
5375 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
5376 | ||
5377 | return bgp_vty_return (vty, ret); | |
5378 | } | |
5379 | ||
5380 | DEFUN (neighbor_filter_list, | |
5381 | neighbor_filter_list_cmd, | |
5382 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5383 | NEIGHBOR_STR | |
5384 | NEIGHBOR_ADDR_STR2 | |
5385 | "Establish BGP filters\n" | |
5386 | "AS path access-list name\n" | |
5387 | "Filter incoming routes\n" | |
5388 | "Filter outgoing routes\n") | |
5389 | { | |
5390 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5391 | bgp_node_safi (vty), argv[1], argv[2]); | |
5392 | } | |
5393 | ||
5394 | DEFUN (no_neighbor_filter_list, | |
5395 | no_neighbor_filter_list_cmd, | |
5396 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5397 | NO_STR | |
5398 | NEIGHBOR_STR | |
5399 | NEIGHBOR_ADDR_STR2 | |
5400 | "Establish BGP filters\n" | |
5401 | "AS path access-list name\n" | |
5402 | "Filter incoming routes\n" | |
5403 | "Filter outgoing routes\n") | |
5404 | { | |
5405 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5406 | bgp_node_safi (vty), argv[2]); | |
5407 | } | |
6b0655a2 | 5408 | |
718e3744 | 5409 | /* Set route-map to the peer. */ |
94f2b392 | 5410 | static int |
fd79ac91 | 5411 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
5412 | afi_t afi, safi_t safi, | |
5413 | const char *name_str, const char *direct_str) | |
718e3744 | 5414 | { |
5415 | int ret; | |
5416 | struct peer *peer; | |
fee0f4c6 | 5417 | int direct = RMAP_IN; |
718e3744 | 5418 | |
5419 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5420 | if (! peer) | |
5421 | return CMD_WARNING; | |
5422 | ||
5423 | /* Check filter direction. */ | |
fee0f4c6 | 5424 | if (strncmp (direct_str, "in", 2) == 0) |
5425 | direct = RMAP_IN; | |
718e3744 | 5426 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5427 | direct = RMAP_OUT; |
718e3744 | 5428 | |
5429 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
5430 | ||
5431 | return bgp_vty_return (vty, ret); | |
5432 | } | |
5433 | ||
94f2b392 | 5434 | static int |
fd79ac91 | 5435 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5436 | safi_t safi, const char *direct_str) | |
718e3744 | 5437 | { |
5438 | int ret; | |
5439 | struct peer *peer; | |
fee0f4c6 | 5440 | int direct = RMAP_IN; |
718e3744 | 5441 | |
5442 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5443 | if (! peer) | |
5444 | return CMD_WARNING; | |
5445 | ||
5446 | /* Check filter direction. */ | |
fee0f4c6 | 5447 | if (strncmp (direct_str, "in", 2) == 0) |
5448 | direct = RMAP_IN; | |
718e3744 | 5449 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5450 | direct = RMAP_OUT; |
718e3744 | 5451 | |
5452 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
5453 | ||
5454 | return bgp_vty_return (vty, ret); | |
5455 | } | |
5456 | ||
5457 | DEFUN (neighbor_route_map, | |
5458 | neighbor_route_map_cmd, | |
2a3d5731 | 5459 | NEIGHBOR_CMD2 "route-map WORD (in|out)", |
718e3744 | 5460 | NEIGHBOR_STR |
5461 | NEIGHBOR_ADDR_STR2 | |
5462 | "Apply route map to neighbor\n" | |
5463 | "Name of route map\n" | |
5464 | "Apply map to incoming routes\n" | |
2a3d5731 | 5465 | "Apply map to outbound routes\n") |
718e3744 | 5466 | { |
5467 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5468 | bgp_node_safi (vty), argv[1], argv[2]); | |
5469 | } | |
5470 | ||
5471 | DEFUN (no_neighbor_route_map, | |
5472 | no_neighbor_route_map_cmd, | |
2a3d5731 | 5473 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out)", |
718e3744 | 5474 | NO_STR |
5475 | NEIGHBOR_STR | |
5476 | NEIGHBOR_ADDR_STR2 | |
5477 | "Apply route map to neighbor\n" | |
5478 | "Name of route map\n" | |
5479 | "Apply map to incoming routes\n" | |
2a3d5731 | 5480 | "Apply map to outbound routes\n") |
718e3744 | 5481 | { |
5482 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5483 | bgp_node_safi (vty), argv[2]); | |
5484 | } | |
6b0655a2 | 5485 | |
718e3744 | 5486 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 5487 | static int |
fd79ac91 | 5488 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5489 | safi_t safi, const char *name_str) | |
718e3744 | 5490 | { |
5491 | int ret; | |
5492 | struct peer *peer; | |
5493 | ||
5494 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5495 | if (! peer) | |
5496 | return CMD_WARNING; | |
5497 | ||
5498 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
5499 | ||
5500 | return bgp_vty_return (vty, ret); | |
5501 | } | |
5502 | ||
5503 | /* Unset route-map from the peer. */ | |
94f2b392 | 5504 | static int |
fd79ac91 | 5505 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5506 | safi_t safi) |
5507 | { | |
5508 | int ret; | |
5509 | struct peer *peer; | |
5510 | ||
5511 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5512 | if (! peer) | |
5513 | return CMD_WARNING; | |
5514 | ||
5515 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
5516 | ||
5517 | return bgp_vty_return (vty, ret); | |
5518 | } | |
5519 | ||
5520 | DEFUN (neighbor_unsuppress_map, | |
5521 | neighbor_unsuppress_map_cmd, | |
5522 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5523 | NEIGHBOR_STR | |
5524 | NEIGHBOR_ADDR_STR2 | |
5525 | "Route-map to selectively unsuppress suppressed routes\n" | |
5526 | "Name of route map\n") | |
5527 | { | |
5528 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5529 | bgp_node_safi (vty), argv[1]); | |
5530 | } | |
5531 | ||
5532 | DEFUN (no_neighbor_unsuppress_map, | |
5533 | no_neighbor_unsuppress_map_cmd, | |
5534 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5535 | NO_STR | |
5536 | NEIGHBOR_STR | |
5537 | NEIGHBOR_ADDR_STR2 | |
5538 | "Route-map to selectively unsuppress suppressed routes\n" | |
5539 | "Name of route map\n") | |
5540 | { | |
5541 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5542 | bgp_node_safi (vty)); | |
5543 | } | |
6b0655a2 | 5544 | |
94f2b392 | 5545 | static int |
fd79ac91 | 5546 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5547 | safi_t safi, const char *num_str, | |
0a486e5f | 5548 | const char *threshold_str, int warning, |
5549 | const char *restart_str) | |
718e3744 | 5550 | { |
5551 | int ret; | |
5552 | struct peer *peer; | |
5553 | u_int32_t max; | |
e0701b79 | 5554 | u_char threshold; |
0a486e5f | 5555 | u_int16_t restart; |
718e3744 | 5556 | |
5557 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5558 | if (! peer) | |
5559 | return CMD_WARNING; | |
5560 | ||
e6ec1c36 | 5561 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 5562 | if (threshold_str) |
5563 | threshold = atoi (threshold_str); | |
5564 | else | |
5565 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 5566 | |
0a486e5f | 5567 | if (restart_str) |
5568 | restart = atoi (restart_str); | |
5569 | else | |
5570 | restart = 0; | |
5571 | ||
5572 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 5573 | |
5574 | return bgp_vty_return (vty, ret); | |
5575 | } | |
5576 | ||
94f2b392 | 5577 | static int |
fd79ac91 | 5578 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5579 | safi_t safi) |
5580 | { | |
5581 | int ret; | |
5582 | struct peer *peer; | |
5583 | ||
5584 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5585 | if (! peer) | |
5586 | return CMD_WARNING; | |
5587 | ||
5588 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
5589 | ||
5590 | return bgp_vty_return (vty, ret); | |
5591 | } | |
5592 | ||
5593 | /* Maximum number of prefix configuration. prefix count is different | |
5594 | for each peer configuration. So this configuration can be set for | |
5595 | each peer configuration. */ | |
5596 | DEFUN (neighbor_maximum_prefix, | |
5597 | neighbor_maximum_prefix_cmd, | |
5598 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5599 | NEIGHBOR_STR | |
5600 | NEIGHBOR_ADDR_STR2 | |
5601 | "Maximum number of prefix accept from this peer\n" | |
5602 | "maximum no. of prefix limit\n") | |
5603 | { | |
5604 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5605 | bgp_node_safi (vty), argv[1], NULL, 0, |
5606 | NULL); | |
718e3744 | 5607 | } |
5608 | ||
e0701b79 | 5609 | DEFUN (neighbor_maximum_prefix_threshold, |
5610 | neighbor_maximum_prefix_threshold_cmd, | |
5611 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
5612 | NEIGHBOR_STR | |
5613 | NEIGHBOR_ADDR_STR2 | |
5614 | "Maximum number of prefix accept from this peer\n" | |
5615 | "maximum no. of prefix limit\n" | |
5616 | "Threshold value (%) at which to generate a warning msg\n") | |
5617 | { | |
5618 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5619 | bgp_node_safi (vty), argv[1], argv[2], 0, |
5620 | NULL); | |
5621 | } | |
e0701b79 | 5622 | |
718e3744 | 5623 | DEFUN (neighbor_maximum_prefix_warning, |
5624 | neighbor_maximum_prefix_warning_cmd, | |
5625 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5626 | NEIGHBOR_STR | |
5627 | NEIGHBOR_ADDR_STR2 | |
5628 | "Maximum number of prefix accept from this peer\n" | |
5629 | "maximum no. of prefix limit\n" | |
5630 | "Only give warning message when limit is exceeded\n") | |
5631 | { | |
5632 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5633 | bgp_node_safi (vty), argv[1], NULL, 1, |
5634 | NULL); | |
718e3744 | 5635 | } |
5636 | ||
e0701b79 | 5637 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
5638 | neighbor_maximum_prefix_threshold_warning_cmd, | |
5639 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
5640 | NEIGHBOR_STR | |
5641 | NEIGHBOR_ADDR_STR2 | |
5642 | "Maximum number of prefix accept from this peer\n" | |
5643 | "maximum no. of prefix limit\n" | |
5644 | "Threshold value (%) at which to generate a warning msg\n" | |
5645 | "Only give warning message when limit is exceeded\n") | |
5646 | { | |
5647 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5648 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
5649 | } | |
5650 | ||
5651 | DEFUN (neighbor_maximum_prefix_restart, | |
5652 | neighbor_maximum_prefix_restart_cmd, | |
5653 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
5654 | NEIGHBOR_STR | |
5655 | NEIGHBOR_ADDR_STR2 | |
5656 | "Maximum number of prefix accept from this peer\n" | |
5657 | "maximum no. of prefix limit\n" | |
5658 | "Restart bgp connection after limit is exceeded\n" | |
5659 | "Restart interval in minutes") | |
5660 | { | |
5661 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5662 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
5663 | } | |
5664 | ||
5665 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
5666 | neighbor_maximum_prefix_threshold_restart_cmd, | |
5667 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5668 | NEIGHBOR_STR | |
5669 | NEIGHBOR_ADDR_STR2 | |
5670 | "Maximum number of prefix accept from this peer\n" | |
5671 | "maximum no. of prefix limit\n" | |
5672 | "Threshold value (%) at which to generate a warning msg\n" | |
5673 | "Restart bgp connection after limit is exceeded\n" | |
5674 | "Restart interval in minutes") | |
5675 | { | |
5676 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5677 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
5678 | } | |
e0701b79 | 5679 | |
718e3744 | 5680 | DEFUN (no_neighbor_maximum_prefix, |
5681 | no_neighbor_maximum_prefix_cmd, | |
5682 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
5683 | NO_STR | |
5684 | NEIGHBOR_STR | |
5685 | NEIGHBOR_ADDR_STR2 | |
5686 | "Maximum number of prefix accept from this peer\n") | |
5687 | { | |
5688 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5689 | bgp_node_safi (vty)); | |
5690 | } | |
5691 | ||
5692 | ALIAS (no_neighbor_maximum_prefix, | |
5693 | no_neighbor_maximum_prefix_val_cmd, | |
5694 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5695 | NO_STR | |
5696 | NEIGHBOR_STR | |
5697 | NEIGHBOR_ADDR_STR2 | |
5698 | "Maximum number of prefix accept from this peer\n" | |
5699 | "maximum no. of prefix limit\n") | |
5700 | ||
5701 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5702 | no_neighbor_maximum_prefix_threshold_cmd, |
813d4307 | 5703 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
0a486e5f | 5704 | NO_STR |
5705 | NEIGHBOR_STR | |
5706 | NEIGHBOR_ADDR_STR2 | |
5707 | "Maximum number of prefix accept from this peer\n" | |
5708 | "maximum no. of prefix limit\n" | |
5709 | "Threshold value (%) at which to generate a warning msg\n") | |
5710 | ||
5711 | ALIAS (no_neighbor_maximum_prefix, | |
5712 | no_neighbor_maximum_prefix_warning_cmd, | |
5713 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5714 | NO_STR | |
5715 | NEIGHBOR_STR | |
5716 | NEIGHBOR_ADDR_STR2 | |
5717 | "Maximum number of prefix accept from this peer\n" | |
5718 | "maximum no. of prefix limit\n" | |
e8e1946e | 5719 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 5720 | |
5721 | ALIAS (no_neighbor_maximum_prefix, | |
5722 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 5723 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
5724 | NO_STR | |
5725 | NEIGHBOR_STR | |
5726 | NEIGHBOR_ADDR_STR2 | |
5727 | "Maximum number of prefix accept from this peer\n" | |
5728 | "maximum no. of prefix limit\n" | |
5729 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 5730 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 5731 | |
5732 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5733 | no_neighbor_maximum_prefix_restart_cmd, |
5734 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 5735 | NO_STR |
5736 | NEIGHBOR_STR | |
5737 | NEIGHBOR_ADDR_STR2 | |
5738 | "Maximum number of prefix accept from this peer\n" | |
5739 | "maximum no. of prefix limit\n" | |
0a486e5f | 5740 | "Restart bgp connection after limit is exceeded\n" |
5741 | "Restart interval in minutes") | |
5742 | ||
5743 | ALIAS (no_neighbor_maximum_prefix, | |
5744 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
5745 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5746 | NO_STR | |
5747 | NEIGHBOR_STR | |
5748 | NEIGHBOR_ADDR_STR2 | |
5749 | "Maximum number of prefix accept from this peer\n" | |
5750 | "maximum no. of prefix limit\n" | |
5751 | "Threshold value (%) at which to generate a warning msg\n" | |
5752 | "Restart bgp connection after limit is exceeded\n" | |
5753 | "Restart interval in minutes") | |
6b0655a2 | 5754 | |
718e3744 | 5755 | /* "neighbor allowas-in" */ |
5756 | DEFUN (neighbor_allowas_in, | |
5757 | neighbor_allowas_in_cmd, | |
5758 | NEIGHBOR_CMD2 "allowas-in", | |
5759 | NEIGHBOR_STR | |
5760 | NEIGHBOR_ADDR_STR2 | |
5761 | "Accept as-path with my AS present in it\n") | |
5762 | { | |
5763 | int ret; | |
5764 | struct peer *peer; | |
fd79ac91 | 5765 | unsigned int allow_num; |
718e3744 | 5766 | |
5767 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5768 | if (! peer) | |
5769 | return CMD_WARNING; | |
5770 | ||
5771 | if (argc == 1) | |
5772 | allow_num = 3; | |
5773 | else | |
5774 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
5775 | ||
5776 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
5777 | allow_num); | |
5778 | ||
5779 | return bgp_vty_return (vty, ret); | |
5780 | } | |
5781 | ||
5782 | ALIAS (neighbor_allowas_in, | |
5783 | neighbor_allowas_in_arg_cmd, | |
5784 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5785 | NEIGHBOR_STR | |
5786 | NEIGHBOR_ADDR_STR2 | |
5787 | "Accept as-path with my AS present in it\n" | |
5788 | "Number of occurances of AS number\n") | |
5789 | ||
5790 | DEFUN (no_neighbor_allowas_in, | |
5791 | no_neighbor_allowas_in_cmd, | |
5792 | NO_NEIGHBOR_CMD2 "allowas-in", | |
5793 | NO_STR | |
5794 | NEIGHBOR_STR | |
5795 | NEIGHBOR_ADDR_STR2 | |
5796 | "allow local ASN appears in aspath attribute\n") | |
5797 | { | |
5798 | int ret; | |
5799 | struct peer *peer; | |
5800 | ||
5801 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5802 | if (! peer) | |
5803 | return CMD_WARNING; | |
5804 | ||
5805 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
5806 | ||
5807 | return bgp_vty_return (vty, ret); | |
5808 | } | |
6b0655a2 | 5809 | |
813d4307 DW |
5810 | ALIAS (no_neighbor_allowas_in, |
5811 | no_neighbor_allowas_in_val_cmd, | |
5812 | NO_NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5813 | NO_STR | |
5814 | NEIGHBOR_STR | |
5815 | NEIGHBOR_ADDR_STR2 | |
5816 | "allow local ASN appears in aspath attribute\n" | |
5817 | "Number of occurances of AS number\n") | |
5818 | ||
fa411a21 NH |
5819 | DEFUN (neighbor_ttl_security, |
5820 | neighbor_ttl_security_cmd, | |
5821 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5822 | NEIGHBOR_STR | |
5823 | NEIGHBOR_ADDR_STR2 | |
5824 | "Specify the maximum number of hops to the BGP peer\n") | |
5825 | { | |
5826 | struct peer *peer; | |
89b6d1f8 | 5827 | int gtsm_hops; |
fa411a21 NH |
5828 | |
5829 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5830 | if (! peer) | |
5831 | return CMD_WARNING; | |
5832 | ||
5833 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); | |
5834 | ||
8cdabf90 SK |
5835 | /* |
5836 | * If 'neighbor swpX', then this is for directly connected peers, | |
5837 | * we should not accept a ttl-security hops value greater than 1. | |
5838 | */ | |
5839 | if (peer->conf_if && (gtsm_hops > 1)) { | |
5840 | vty_out (vty, "%s is directly connected peer, hops cannot exceed 1%s", | |
5841 | argv[0], VTY_NEWLINE); | |
5842 | return CMD_WARNING; | |
5843 | } | |
5844 | ||
89b6d1f8 | 5845 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
5846 | } |
5847 | ||
5848 | DEFUN (no_neighbor_ttl_security, | |
5849 | no_neighbor_ttl_security_cmd, | |
5850 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5851 | NO_STR | |
5852 | NEIGHBOR_STR | |
5853 | NEIGHBOR_ADDR_STR2 | |
5854 | "Specify the maximum number of hops to the BGP peer\n") | |
5855 | { | |
5856 | struct peer *peer; | |
fa411a21 NH |
5857 | |
5858 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5859 | if (! peer) | |
5860 | return CMD_WARNING; | |
5861 | ||
89b6d1f8 | 5862 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 5863 | } |
6b0655a2 | 5864 | |
adbac85e DW |
5865 | DEFUN (neighbor_addpath_tx_all_paths, |
5866 | neighbor_addpath_tx_all_paths_cmd, | |
5867 | NEIGHBOR_CMD2 "addpath-tx-all-paths", | |
5868 | NEIGHBOR_STR | |
5869 | NEIGHBOR_ADDR_STR2 | |
5870 | "Use addpath to advertise all paths to a neighbor\n") | |
5871 | { | |
5872 | struct peer *peer; | |
5873 | ||
adbac85e DW |
5874 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
5875 | if (! peer) | |
5876 | return CMD_WARNING; | |
5877 | ||
5878 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5879 | bgp_node_safi (vty), | |
5880 | PEER_FLAG_ADDPATH_TX_ALL_PATHS); | |
5881 | } | |
5882 | ||
5883 | DEFUN (no_neighbor_addpath_tx_all_paths, | |
5884 | no_neighbor_addpath_tx_all_paths_cmd, | |
5885 | NO_NEIGHBOR_CMD2 "addpath-tx-all-paths", | |
5886 | NO_STR | |
5887 | NEIGHBOR_STR | |
5888 | NEIGHBOR_ADDR_STR2 | |
5889 | "Use addpath to advertise all paths to a neighbor\n") | |
5890 | { | |
5891 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5892 | bgp_node_safi (vty), | |
5893 | PEER_FLAG_ADDPATH_TX_ALL_PATHS); | |
5894 | } | |
5895 | ||
06370dac DW |
5896 | DEFUN (neighbor_addpath_tx_bestpath_per_as, |
5897 | neighbor_addpath_tx_bestpath_per_as_cmd, | |
5898 | NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", | |
5899 | NEIGHBOR_STR | |
5900 | NEIGHBOR_ADDR_STR2 | |
5901 | "Use addpath to advertise the bestpath per each neighboring AS\n") | |
5902 | { | |
5903 | struct peer *peer; | |
5904 | ||
5905 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5906 | if (! peer) | |
5907 | return CMD_WARNING; | |
5908 | ||
5909 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5910 | bgp_node_safi (vty), | |
5911 | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); | |
5912 | } | |
5913 | ||
5914 | DEFUN (no_neighbor_addpath_tx_bestpath_per_as, | |
5915 | no_neighbor_addpath_tx_bestpath_per_as_cmd, | |
5916 | NO_NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", | |
5917 | NO_STR | |
5918 | NEIGHBOR_STR | |
5919 | NEIGHBOR_ADDR_STR2 | |
5920 | "Use addpath to advertise the bestpath per each neighboring AS\n") | |
5921 | { | |
5922 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5923 | bgp_node_safi (vty), | |
5924 | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); | |
5925 | } | |
5926 | ||
5927 | ||
718e3744 | 5928 | /* Address family configuration. */ |
5929 | DEFUN (address_family_ipv4, | |
5930 | address_family_ipv4_cmd, | |
5931 | "address-family ipv4", | |
5932 | "Enter Address Family command mode\n" | |
5933 | "Address family\n") | |
5934 | { | |
5935 | vty->node = BGP_IPV4_NODE; | |
5936 | return CMD_SUCCESS; | |
5937 | } | |
5938 | ||
5939 | DEFUN (address_family_ipv4_safi, | |
5940 | address_family_ipv4_safi_cmd, | |
5941 | "address-family ipv4 (unicast|multicast)", | |
5942 | "Enter Address Family command mode\n" | |
5943 | "Address family\n" | |
5944 | "Address Family modifier\n" | |
5945 | "Address Family modifier\n") | |
5946 | { | |
5947 | if (strncmp (argv[0], "m", 1) == 0) | |
5948 | vty->node = BGP_IPV4M_NODE; | |
5949 | else | |
5950 | vty->node = BGP_IPV4_NODE; | |
5951 | ||
5952 | return CMD_SUCCESS; | |
5953 | } | |
5954 | ||
25ffbdc1 | 5955 | DEFUN (address_family_ipv6, |
5956 | address_family_ipv6_cmd, | |
5957 | "address-family ipv6", | |
718e3744 | 5958 | "Enter Address Family command mode\n" |
25ffbdc1 | 5959 | "Address family\n") |
718e3744 | 5960 | { |
5961 | vty->node = BGP_IPV6_NODE; | |
5962 | return CMD_SUCCESS; | |
5963 | } | |
5964 | ||
25ffbdc1 | 5965 | DEFUN (address_family_ipv6_safi, |
5966 | address_family_ipv6_safi_cmd, | |
5967 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 5968 | "Enter Address Family command mode\n" |
25ffbdc1 | 5969 | "Address family\n" |
5970 | "Address Family modifier\n" | |
5971 | "Address Family modifier\n") | |
5972 | { | |
5973 | if (strncmp (argv[0], "m", 1) == 0) | |
5974 | vty->node = BGP_IPV6M_NODE; | |
5975 | else | |
5976 | vty->node = BGP_IPV6_NODE; | |
5977 | ||
5978 | return CMD_SUCCESS; | |
5979 | } | |
718e3744 | 5980 | |
5981 | DEFUN (address_family_vpnv4, | |
5982 | address_family_vpnv4_cmd, | |
5983 | "address-family vpnv4", | |
5984 | "Enter Address Family command mode\n" | |
5985 | "Address family\n") | |
5986 | { | |
5987 | vty->node = BGP_VPNV4_NODE; | |
5988 | return CMD_SUCCESS; | |
5989 | } | |
5990 | ||
5991 | ALIAS (address_family_vpnv4, | |
5992 | address_family_vpnv4_unicast_cmd, | |
5993 | "address-family vpnv4 unicast", | |
5994 | "Enter Address Family command mode\n" | |
5995 | "Address family\n" | |
5996 | "Address Family Modifier\n") | |
5997 | ||
8ecd3266 | 5998 | DEFUN (address_family_vpnv6, |
5999 | address_family_vpnv6_cmd, | |
6000 | "address-family vpnv6", | |
6001 | "Enter Address Family command mode\n" | |
6002 | "Address family\n") | |
6003 | { | |
6004 | vty->node = BGP_VPNV6_NODE; | |
6005 | return CMD_SUCCESS; | |
6006 | } | |
6007 | ||
6008 | ALIAS (address_family_vpnv6, | |
6009 | address_family_vpnv6_unicast_cmd, | |
6010 | "address-family vpnv6 unicast", | |
6011 | "Enter Address Family command mode\n" | |
6012 | "Address family\n" | |
6013 | "Address Family Modifier\n") | |
6014 | ||
8b1fb8be LB |
6015 | DEFUN (address_family_encap, |
6016 | address_family_encap_cmd, | |
6017 | "address-family encap", | |
6018 | "Enter Address Family command mode\n" | |
6019 | "Address family\n") | |
6020 | { | |
6021 | vty->node = BGP_ENCAP_NODE; | |
6022 | return CMD_SUCCESS; | |
6023 | } | |
6024 | ||
6025 | ALIAS (address_family_encap, | |
6026 | address_family_encapv4_cmd, | |
6027 | "address-family encapv4", | |
6028 | "Enter Address Family command mode\n" | |
6029 | "Address family\n") | |
6030 | ||
6031 | DEFUN (address_family_encapv6, | |
6032 | address_family_encapv6_cmd, | |
6033 | "address-family encapv6", | |
6034 | "Enter Address Family command mode\n" | |
6035 | "Address family\n") | |
6036 | { | |
6037 | vty->node = BGP_ENCAPV6_NODE; | |
6038 | return CMD_SUCCESS; | |
6039 | } | |
6040 | ||
718e3744 | 6041 | DEFUN (exit_address_family, |
6042 | exit_address_family_cmd, | |
6043 | "exit-address-family", | |
6044 | "Exit from Address Family configuration mode\n") | |
6045 | { | |
a8a80d53 | 6046 | if (vty->node == BGP_IPV4_NODE |
6047 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 6048 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 6049 | || vty->node == BGP_IPV6_NODE |
8ecd3266 | 6050 | || vty->node == BGP_IPV6M_NODE |
8b1fb8be LB |
6051 | || vty->node == BGP_VPNV6_NODE |
6052 | || vty->node == BGP_ENCAP_NODE | |
6053 | || vty->node == BGP_ENCAPV6_NODE) | |
718e3744 | 6054 | vty->node = BGP_NODE; |
6055 | return CMD_SUCCESS; | |
6056 | } | |
6b0655a2 | 6057 | |
8ad7271d DS |
6058 | /* Recalculate bestpath and re-advertise a prefix */ |
6059 | static int | |
01080f7c | 6060 | bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, |
8ad7271d DS |
6061 | afi_t afi, safi_t safi, struct prefix_rd *prd) |
6062 | { | |
6063 | int ret; | |
6064 | struct prefix match; | |
6065 | struct bgp_node *rn; | |
6066 | struct bgp_node *rm; | |
8ad7271d DS |
6067 | struct bgp *bgp; |
6068 | struct bgp_table *table; | |
6069 | struct bgp_table *rib; | |
6070 | ||
6071 | /* BGP structure lookup. */ | |
6072 | if (view_name) | |
6073 | { | |
6074 | bgp = bgp_lookup_by_name (view_name); | |
6075 | if (bgp == NULL) | |
6076 | { | |
6aeb9e78 | 6077 | vty_out (vty, "%% Can't find BGP instance %s%s", view_name, VTY_NEWLINE); |
8ad7271d DS |
6078 | return CMD_WARNING; |
6079 | } | |
6080 | } | |
6081 | else | |
6082 | { | |
6083 | bgp = bgp_get_default (); | |
6084 | if (bgp == NULL) | |
6085 | { | |
6086 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
6087 | return CMD_WARNING; | |
6088 | } | |
6089 | } | |
6090 | ||
6091 | /* Check IP address argument. */ | |
6092 | ret = str2prefix (ip_str, &match); | |
6093 | if (! ret) | |
6094 | { | |
6095 | vty_out (vty, "%% address is malformed%s", VTY_NEWLINE); | |
6096 | return CMD_WARNING; | |
6097 | } | |
6098 | ||
6099 | match.family = afi2family (afi); | |
6100 | rib = bgp->rib[afi][safi]; | |
6101 | ||
6102 | if (safi == SAFI_MPLS_VPN) | |
6103 | { | |
6104 | for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn)) | |
6105 | { | |
6106 | if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) | |
6107 | continue; | |
6108 | ||
6109 | if ((table = rn->info) != NULL) | |
6110 | { | |
6111 | if ((rm = bgp_node_match (table, &match)) != NULL) | |
6112 | { | |
6113 | if (rm->p.prefixlen == match.prefixlen) | |
6114 | { | |
6115 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
6116 | bgp_process (bgp, rm, afi, safi); | |
6117 | } | |
6118 | bgp_unlock_node (rm); | |
6119 | } | |
6120 | } | |
6121 | } | |
6122 | } | |
6123 | else | |
6124 | { | |
6125 | if ((rn = bgp_node_match (rib, &match)) != NULL) | |
6126 | { | |
6127 | if (rn->p.prefixlen == match.prefixlen) | |
6128 | { | |
6129 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
6130 | bgp_process (bgp, rn, afi, safi); | |
6131 | } | |
6132 | bgp_unlock_node (rn); | |
6133 | } | |
6134 | } | |
6135 | ||
6136 | return CMD_SUCCESS; | |
6137 | } | |
6138 | ||
718e3744 | 6139 | DEFUN (clear_ip_bgp_all, |
6140 | clear_ip_bgp_all_cmd, | |
6141 | "clear ip bgp *", | |
6142 | CLEAR_STR | |
6143 | IP_STR | |
6144 | BGP_STR | |
6145 | "Clear all peers\n") | |
6146 | { | |
6aeb9e78 DS |
6147 | if (argc == 2) |
6148 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
718e3744 | 6149 | |
6150 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
6151 | } | |
6152 | ||
01080f7c | 6153 | ALIAS (clear_ip_bgp_all, |
6154 | clear_ip_bgp_instance_all_cmd, | |
6155 | "clear ip bgp " BGP_INSTANCE_CMD " *", | |
6156 | CLEAR_STR | |
6157 | IP_STR | |
6158 | BGP_STR | |
6159 | BGP_INSTANCE_HELP_STR | |
6160 | "Clear all peers\n") | |
6161 | ||
718e3744 | 6162 | ALIAS (clear_ip_bgp_all, |
6163 | clear_bgp_all_cmd, | |
6164 | "clear bgp *", | |
6165 | CLEAR_STR | |
6166 | BGP_STR | |
6167 | "Clear all peers\n") | |
6168 | ||
6169 | ALIAS (clear_ip_bgp_all, | |
01080f7c | 6170 | clear_bgp_instance_all_cmd, |
6171 | "clear bgp " BGP_INSTANCE_CMD " *", | |
718e3744 | 6172 | CLEAR_STR |
6173 | BGP_STR | |
01080f7c | 6174 | BGP_INSTANCE_HELP_STR |
718e3744 | 6175 | "Clear all peers\n") |
6176 | ||
6177 | ALIAS (clear_ip_bgp_all, | |
01080f7c | 6178 | clear_bgp_ipv6_all_cmd, |
6179 | "clear bgp ipv6 *", | |
718e3744 | 6180 | CLEAR_STR |
718e3744 | 6181 | BGP_STR |
01080f7c | 6182 | "Address family\n" |
718e3744 | 6183 | "Clear all peers\n") |
6184 | ||
6185 | ALIAS (clear_ip_bgp_all, | |
01080f7c | 6186 | clear_bgp_instance_ipv6_all_cmd, |
6187 | "clear bgp " BGP_INSTANCE_CMD " ipv6 *", | |
718e3744 | 6188 | CLEAR_STR |
6189 | BGP_STR | |
8386ac43 | 6190 | BGP_INSTANCE_HELP_STR |
01080f7c | 6191 | "Address family\n" |
718e3744 | 6192 | "Clear all peers\n") |
6193 | ||
6194 | DEFUN (clear_ip_bgp_peer, | |
6195 | clear_ip_bgp_peer_cmd, | |
a80beece | 6196 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6197 | CLEAR_STR |
6198 | IP_STR | |
6199 | BGP_STR | |
6200 | "BGP neighbor IP address to clear\n" | |
a80beece DS |
6201 | "BGP IPv6 neighbor to clear\n" |
6202 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6203 | { |
01080f7c | 6204 | if (argc == 3) |
6205 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6206 | ||
718e3744 | 6207 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
6208 | } | |
6209 | ||
01080f7c | 6210 | ALIAS (clear_ip_bgp_peer, |
6211 | clear_ip_bgp_instance_peer_cmd, | |
6212 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", | |
6213 | CLEAR_STR | |
6214 | IP_STR | |
6215 | BGP_STR | |
6216 | BGP_INSTANCE_HELP_STR | |
6217 | "BGP neighbor IP address to clear\n" | |
6218 | "BGP IPv6 neighbor to clear\n" | |
6219 | "BGP neighbor on interface to clear\n") | |
6220 | ||
718e3744 | 6221 | ALIAS (clear_ip_bgp_peer, |
6222 | clear_bgp_peer_cmd, | |
a80beece | 6223 | "clear bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6224 | CLEAR_STR |
6225 | BGP_STR | |
6226 | "BGP neighbor address to clear\n" | |
a80beece DS |
6227 | "BGP IPv6 neighbor to clear\n" |
6228 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6229 | |
01080f7c | 6230 | ALIAS (clear_ip_bgp_peer, |
6231 | clear_bgp_instance_peer_cmd, | |
6232 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", | |
6233 | CLEAR_STR | |
6234 | BGP_STR | |
6235 | BGP_INSTANCE_HELP_STR | |
6236 | "BGP neighbor IP address to clear\n" | |
6237 | "BGP IPv6 neighbor to clear\n" | |
6238 | "BGP neighbor on interface to clear\n") | |
6239 | ||
718e3744 | 6240 | ALIAS (clear_ip_bgp_peer, |
6241 | clear_bgp_ipv6_peer_cmd, | |
a80beece | 6242 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6243 | CLEAR_STR |
6244 | BGP_STR | |
6245 | "Address family\n" | |
6246 | "BGP neighbor address to clear\n" | |
a80beece DS |
6247 | "BGP IPv6 neighbor to clear\n" |
6248 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6249 | |
01080f7c | 6250 | ALIAS (clear_ip_bgp_peer, |
6251 | clear_bgp_instance_ipv6_peer_cmd, | |
6252 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD)", | |
6253 | CLEAR_STR | |
6254 | BGP_STR | |
6255 | BGP_INSTANCE_HELP_STR | |
6256 | "Address family\n" | |
6257 | "BGP neighbor IP address to clear\n" | |
6258 | "BGP IPv6 neighbor to clear\n" | |
6259 | "BGP neighbor on interface to clear\n") | |
6260 | ||
718e3744 | 6261 | DEFUN (clear_ip_bgp_peer_group, |
6262 | clear_ip_bgp_peer_group_cmd, | |
6263 | "clear ip bgp peer-group WORD", | |
6264 | CLEAR_STR | |
6265 | IP_STR | |
6266 | BGP_STR | |
6267 | "Clear all members of peer-group\n" | |
6268 | "BGP peer-group name\n") | |
6269 | { | |
01080f7c | 6270 | if (argc == 3) |
6271 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6272 | ||
718e3744 | 6273 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
6274 | } | |
6275 | ||
01080f7c | 6276 | ALIAS (clear_ip_bgp_peer_group, |
6277 | clear_ip_bgp_instance_peer_group_cmd, | |
6278 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD", | |
6279 | CLEAR_STR | |
6280 | IP_STR | |
6281 | BGP_STR | |
6282 | BGP_INSTANCE_HELP_STR | |
6283 | "Clear all members of peer-group\n" | |
6284 | "BGP peer-group name\n") | |
6285 | ||
718e3744 | 6286 | ALIAS (clear_ip_bgp_peer_group, |
6287 | clear_bgp_peer_group_cmd, | |
6288 | "clear bgp peer-group WORD", | |
6289 | CLEAR_STR | |
6290 | BGP_STR | |
6291 | "Clear all members of peer-group\n" | |
6292 | "BGP peer-group name\n") | |
6293 | ||
01080f7c | 6294 | ALIAS (clear_ip_bgp_peer_group, |
6295 | clear_bgp_instance_peer_group_cmd, | |
6296 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD", | |
6297 | CLEAR_STR | |
6298 | BGP_STR | |
6299 | BGP_INSTANCE_HELP_STR | |
6300 | "Clear all members of peer-group\n" | |
6301 | "BGP peer-group name\n") | |
6302 | ||
718e3744 | 6303 | ALIAS (clear_ip_bgp_peer_group, |
6304 | clear_bgp_ipv6_peer_group_cmd, | |
6305 | "clear bgp ipv6 peer-group WORD", | |
6306 | CLEAR_STR | |
6307 | BGP_STR | |
6308 | "Address family\n" | |
6309 | "Clear all members of peer-group\n" | |
6310 | "BGP peer-group name\n") | |
6311 | ||
01080f7c | 6312 | ALIAS (clear_ip_bgp_peer_group, |
6313 | clear_bgp_instance_ipv6_peer_group_cmd, | |
6314 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD", | |
6315 | CLEAR_STR | |
6316 | BGP_STR | |
6317 | BGP_INSTANCE_HELP_STR | |
6318 | "Address family\n" | |
6319 | "Clear all members of peer-group\n" | |
6320 | "BGP peer-group name\n") | |
6321 | ||
718e3744 | 6322 | DEFUN (clear_ip_bgp_external, |
6323 | clear_ip_bgp_external_cmd, | |
6324 | "clear ip bgp external", | |
6325 | CLEAR_STR | |
6326 | IP_STR | |
6327 | BGP_STR | |
6328 | "Clear all external peers\n") | |
6329 | { | |
01080f7c | 6330 | if (argc == 2) |
6331 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
6332 | ||
718e3744 | 6333 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
6334 | } | |
6335 | ||
01080f7c | 6336 | ALIAS (clear_ip_bgp_external, |
6337 | clear_ip_bgp_instance_external_cmd, | |
6338 | "clear ip bgp " BGP_INSTANCE_CMD " external", | |
6339 | CLEAR_STR | |
6340 | IP_STR | |
6341 | BGP_STR | |
6342 | BGP_INSTANCE_HELP_STR | |
6343 | "Clear all external peers\n") | |
6344 | ||
718e3744 | 6345 | ALIAS (clear_ip_bgp_external, |
6346 | clear_bgp_external_cmd, | |
6347 | "clear bgp external", | |
6348 | CLEAR_STR | |
6349 | BGP_STR | |
6350 | "Clear all external peers\n") | |
6351 | ||
01080f7c | 6352 | ALIAS (clear_ip_bgp_external, |
6353 | clear_bgp_instance_external_cmd, | |
6354 | "clear bgp " BGP_INSTANCE_CMD " external", | |
6355 | CLEAR_STR | |
6356 | BGP_STR | |
6357 | BGP_INSTANCE_HELP_STR | |
6358 | "Clear all external peers\n") | |
6359 | ||
718e3744 | 6360 | ALIAS (clear_ip_bgp_external, |
6361 | clear_bgp_ipv6_external_cmd, | |
6362 | "clear bgp ipv6 external", | |
6363 | CLEAR_STR | |
6364 | BGP_STR | |
6365 | "Address family\n" | |
6366 | "Clear all external peers\n") | |
6367 | ||
01080f7c | 6368 | ALIAS (clear_ip_bgp_external, |
6369 | clear_bgp_instance_ipv6_external_cmd, | |
6370 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external", | |
6371 | CLEAR_STR | |
6372 | BGP_STR | |
6373 | BGP_INSTANCE_HELP_STR | |
6374 | "Address family\n" | |
6375 | "Clear all external peers\n") | |
6376 | ||
8ad7271d DS |
6377 | DEFUN (clear_ip_bgp_prefix, |
6378 | clear_ip_bgp_prefix_cmd, | |
6379 | "clear ip bgp prefix A.B.C.D/M", | |
6380 | CLEAR_STR | |
6381 | IP_STR | |
6382 | BGP_STR | |
6383 | "Clear bestpath and re-advertise\n" | |
6384 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6385 | { | |
01080f7c | 6386 | if (argc == 3) |
6387 | return bgp_clear_prefix (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL); | |
6388 | ||
8ad7271d DS |
6389 | return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL); |
6390 | } | |
6391 | ||
01080f7c | 6392 | ALIAS (clear_ip_bgp_prefix, |
6393 | clear_ip_bgp_instance_prefix_cmd, | |
6394 | "clear ip bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", | |
6395 | CLEAR_STR | |
6396 | IP_STR | |
6397 | BGP_STR | |
6398 | BGP_INSTANCE_HELP_STR | |
6399 | "Clear bestpath and re-advertise\n" | |
6400 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6401 | ||
8ad7271d DS |
6402 | ALIAS (clear_ip_bgp_prefix, |
6403 | clear_bgp_prefix_cmd, | |
6404 | "clear bgp prefix A.B.C.D/M", | |
6405 | CLEAR_STR | |
6406 | BGP_STR | |
6407 | "Clear bestpath and re-advertise\n" | |
6408 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6409 | ||
01080f7c | 6410 | ALIAS (clear_ip_bgp_prefix, |
6411 | clear_bgp_instance_prefix_cmd, | |
6412 | "clear bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", | |
6413 | CLEAR_STR | |
6414 | BGP_STR | |
6415 | BGP_INSTANCE_HELP_STR | |
6416 | "Clear bestpath and re-advertise\n" | |
6417 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
8ad7271d | 6418 | |
718e3744 | 6419 | DEFUN (clear_ip_bgp_as, |
6420 | clear_ip_bgp_as_cmd, | |
320da874 | 6421 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 6422 | CLEAR_STR |
6423 | IP_STR | |
6424 | BGP_STR | |
6425 | "Clear peers with the AS number\n") | |
6426 | { | |
01080f7c | 6427 | if (argc == 3) |
6428 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6429 | ||
718e3744 | 6430 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
6431 | } | |
6432 | ||
01080f7c | 6433 | ALIAS (clear_ip_bgp_as, |
6434 | clear_ip_bgp_instance_as_cmd, | |
6435 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, | |
6436 | CLEAR_STR | |
6437 | IP_STR | |
6438 | BGP_STR | |
6439 | BGP_INSTANCE_HELP_STR | |
6440 | "Clear peers with the AS number\n") | |
6441 | ||
718e3744 | 6442 | ALIAS (clear_ip_bgp_as, |
6443 | clear_bgp_as_cmd, | |
320da874 | 6444 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 6445 | CLEAR_STR |
6446 | BGP_STR | |
6447 | "Clear peers with the AS number\n") | |
6448 | ||
01080f7c | 6449 | ALIAS (clear_ip_bgp_as, |
6450 | clear_bgp_instance_as_cmd, | |
6451 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, | |
6452 | CLEAR_STR | |
6453 | BGP_STR | |
6454 | BGP_INSTANCE_HELP_STR | |
6455 | "Clear peers with the AS number\n") | |
6456 | ||
718e3744 | 6457 | ALIAS (clear_ip_bgp_as, |
6458 | clear_bgp_ipv6_as_cmd, | |
320da874 | 6459 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 6460 | CLEAR_STR |
6461 | BGP_STR | |
6462 | "Address family\n" | |
6463 | "Clear peers with the AS number\n") | |
6b0655a2 | 6464 | |
01080f7c | 6465 | ALIAS (clear_ip_bgp_as, |
6466 | clear_bgp_instance_ipv6_as_cmd, | |
6467 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE, | |
6468 | CLEAR_STR | |
6469 | BGP_STR | |
6470 | BGP_INSTANCE_HELP_STR | |
6471 | "Address family\n" | |
6472 | "Clear peers with the AS number\n") | |
6473 | ||
718e3744 | 6474 | /* Outbound soft-reconfiguration */ |
6475 | DEFUN (clear_ip_bgp_all_soft_out, | |
6476 | clear_ip_bgp_all_soft_out_cmd, | |
6477 | "clear ip bgp * soft out", | |
6478 | CLEAR_STR | |
6479 | IP_STR | |
6480 | BGP_STR | |
6481 | "Clear all peers\n" | |
e0bce756 DS |
6482 | BGP_SOFT_STR |
6483 | BGP_SOFT_OUT_STR) | |
718e3744 | 6484 | { |
6aeb9e78 DS |
6485 | if (argc == 2) |
6486 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 6487 | BGP_CLEAR_SOFT_OUT, NULL); |
6488 | ||
6489 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6490 | BGP_CLEAR_SOFT_OUT, NULL); | |
6491 | } | |
6492 | ||
01080f7c | 6493 | ALIAS (clear_ip_bgp_all_soft_out, |
6494 | clear_ip_bgp_instance_all_soft_out_cmd, | |
6495 | "clear ip bgp " BGP_INSTANCE_CMD " * soft out", | |
6496 | CLEAR_STR | |
6497 | IP_STR | |
6498 | BGP_STR | |
6499 | BGP_INSTANCE_HELP_STR | |
6500 | "Clear all peers\n" | |
6501 | BGP_SOFT_STR | |
6502 | BGP_SOFT_OUT_STR) | |
6503 | ||
718e3744 | 6504 | ALIAS (clear_ip_bgp_all_soft_out, |
6505 | clear_ip_bgp_all_out_cmd, | |
6506 | "clear ip bgp * out", | |
6507 | CLEAR_STR | |
6508 | IP_STR | |
6509 | BGP_STR | |
6510 | "Clear all peers\n" | |
e0bce756 | 6511 | BGP_SOFT_OUT_STR) |
718e3744 | 6512 | |
6513 | ALIAS (clear_ip_bgp_all_soft_out, | |
01080f7c | 6514 | clear_ip_bgp_instance_all_out_cmd, |
6515 | "clear ip bgp " BGP_INSTANCE_CMD " * out", | |
718e3744 | 6516 | CLEAR_STR |
6517 | IP_STR | |
6518 | BGP_STR | |
8386ac43 | 6519 | BGP_INSTANCE_HELP_STR |
718e3744 | 6520 | "Clear all peers\n" |
e0bce756 | 6521 | BGP_SOFT_OUT_STR) |
718e3744 | 6522 | |
6523 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
6524 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
6525 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
6526 | CLEAR_STR | |
6527 | IP_STR | |
6528 | BGP_STR | |
6529 | "Clear all peers\n" | |
6530 | "Address family\n" | |
6531 | "Address Family modifier\n" | |
6532 | "Address Family modifier\n" | |
e0bce756 DS |
6533 | BGP_SOFT_STR |
6534 | BGP_SOFT_OUT_STR) | |
718e3744 | 6535 | { |
6536 | if (strncmp (argv[0], "m", 1) == 0) | |
6537 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6538 | BGP_CLEAR_SOFT_OUT, NULL); | |
6539 | ||
6540 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6541 | BGP_CLEAR_SOFT_OUT, NULL); | |
6542 | } | |
6543 | ||
01080f7c | 6544 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
6545 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
6546 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft out", | |
6547 | CLEAR_STR | |
6548 | IP_STR | |
6549 | BGP_STR | |
6550 | BGP_INSTANCE_HELP_STR | |
6551 | "Clear all peers\n" | |
6552 | "Address family\n" | |
6553 | "Address Family modifier\n" | |
6554 | "Address Family modifier\n" | |
6555 | BGP_SOFT_OUT_STR) | |
6556 | { | |
6557 | if (strncmp (argv[2], "m", 1) == 0) | |
6558 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, | |
6559 | BGP_CLEAR_SOFT_OUT, NULL); | |
6560 | ||
6561 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6562 | BGP_CLEAR_SOFT_OUT, NULL); | |
6563 | } | |
6564 | ||
718e3744 | 6565 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
6566 | clear_ip_bgp_all_ipv4_out_cmd, | |
6567 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
6568 | CLEAR_STR | |
6569 | IP_STR | |
6570 | BGP_STR | |
6571 | "Clear all peers\n" | |
6572 | "Address family\n" | |
6573 | "Address Family modifier\n" | |
6574 | "Address Family modifier\n" | |
e0bce756 | 6575 | BGP_SOFT_OUT_STR) |
718e3744 | 6576 | |
01080f7c | 6577 | ALIAS (clear_ip_bgp_instance_all_ipv4_soft_out, |
6578 | clear_ip_bgp_instance_all_ipv4_out_cmd, | |
6579 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) out", | |
718e3744 | 6580 | CLEAR_STR |
6581 | IP_STR | |
6582 | BGP_STR | |
8386ac43 | 6583 | BGP_INSTANCE_HELP_STR |
718e3744 | 6584 | "Clear all peers\n" |
6585 | "Address family\n" | |
6586 | "Address Family modifier\n" | |
6587 | "Address Family modifier\n" | |
e0bce756 | 6588 | BGP_SOFT_OUT_STR) |
718e3744 | 6589 | |
6590 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
6591 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
6592 | "clear ip bgp * vpnv4 unicast soft out", | |
6593 | CLEAR_STR | |
6594 | IP_STR | |
6595 | BGP_STR | |
6596 | "Clear all peers\n" | |
6597 | "Address family\n" | |
6598 | "Address Family Modifier\n" | |
e0bce756 DS |
6599 | BGP_SOFT_STR |
6600 | BGP_SOFT_OUT_STR) | |
718e3744 | 6601 | { |
6602 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6603 | BGP_CLEAR_SOFT_OUT, NULL); | |
6604 | } | |
6605 | ||
6606 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
6607 | clear_ip_bgp_all_vpnv4_out_cmd, | |
6608 | "clear ip bgp * vpnv4 unicast out", | |
6609 | CLEAR_STR | |
6610 | IP_STR | |
6611 | BGP_STR | |
6612 | "Clear all peers\n" | |
6613 | "Address family\n" | |
6614 | "Address Family Modifier\n" | |
e0bce756 | 6615 | BGP_SOFT_OUT_STR) |
718e3744 | 6616 | |
587ff0fd LB |
6617 | DEFUN (clear_ip_bgp_all_encap_soft_out, |
6618 | clear_ip_bgp_all_encap_soft_out_cmd, | |
6619 | "clear ip bgp * encap unicast soft out", | |
6620 | CLEAR_STR | |
6621 | IP_STR | |
6622 | BGP_STR | |
6623 | "Clear all peers\n" | |
6624 | "Address family\n" | |
6625 | "Address Family Modifier\n" | |
6626 | "Soft reconfig\n" | |
6627 | "Soft reconfig outbound update\n") | |
6628 | { | |
6629 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
6630 | BGP_CLEAR_SOFT_OUT, NULL); | |
6631 | } | |
6632 | ||
6633 | ALIAS (clear_ip_bgp_all_encap_soft_out, | |
6634 | clear_ip_bgp_all_encap_out_cmd, | |
6635 | "clear ip bgp * encap unicast out", | |
6636 | CLEAR_STR | |
6637 | IP_STR | |
6638 | BGP_STR | |
6639 | "Clear all peers\n" | |
6640 | "Address family\n" | |
6641 | "Address Family Modifier\n" | |
6642 | "Soft reconfig outbound update\n") | |
6643 | ||
718e3744 | 6644 | DEFUN (clear_bgp_all_soft_out, |
6645 | clear_bgp_all_soft_out_cmd, | |
6646 | "clear bgp * soft out", | |
6647 | CLEAR_STR | |
6648 | BGP_STR | |
6649 | "Clear all peers\n" | |
e0bce756 DS |
6650 | BGP_SOFT_STR |
6651 | BGP_SOFT_OUT_STR) | |
718e3744 | 6652 | { |
6aeb9e78 DS |
6653 | if (argc == 2) |
6654 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
718e3744 | 6655 | BGP_CLEAR_SOFT_OUT, NULL); |
6656 | ||
6657 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6658 | BGP_CLEAR_SOFT_OUT, NULL); | |
6659 | } | |
6660 | ||
6661 | ALIAS (clear_bgp_all_soft_out, | |
6662 | clear_bgp_instance_all_soft_out_cmd, | |
8386ac43 | 6663 | "clear bgp " BGP_INSTANCE_CMD " * soft out", |
718e3744 | 6664 | CLEAR_STR |
6665 | BGP_STR | |
8386ac43 | 6666 | BGP_INSTANCE_HELP_STR |
718e3744 | 6667 | "Clear all peers\n" |
e0bce756 DS |
6668 | BGP_SOFT_STR |
6669 | BGP_SOFT_OUT_STR) | |
718e3744 | 6670 | |
6671 | ALIAS (clear_bgp_all_soft_out, | |
6672 | clear_bgp_all_out_cmd, | |
6673 | "clear bgp * out", | |
6674 | CLEAR_STR | |
6675 | BGP_STR | |
6676 | "Clear all peers\n" | |
e0bce756 | 6677 | BGP_SOFT_OUT_STR) |
718e3744 | 6678 | |
01080f7c | 6679 | ALIAS (clear_bgp_all_soft_out, |
6680 | clear_bgp_instance_all_out_cmd, | |
6681 | "clear bgp " BGP_INSTANCE_CMD " * out", | |
6682 | CLEAR_STR | |
6683 | BGP_STR | |
6684 | BGP_INSTANCE_HELP_STR | |
6685 | "Clear all peers\n" | |
6686 | BGP_SOFT_OUT_STR) | |
6687 | ||
718e3744 | 6688 | ALIAS (clear_bgp_all_soft_out, |
6689 | clear_bgp_ipv6_all_soft_out_cmd, | |
6690 | "clear bgp ipv6 * soft out", | |
6691 | CLEAR_STR | |
6692 | BGP_STR | |
6693 | "Address family\n" | |
6694 | "Clear all peers\n" | |
e0bce756 DS |
6695 | BGP_SOFT_STR |
6696 | BGP_SOFT_OUT_STR) | |
718e3744 | 6697 | |
01080f7c | 6698 | ALIAS (clear_bgp_all_soft_out, |
6699 | clear_bgp_instance_ipv6_all_soft_out_cmd, | |
6700 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft out", | |
6701 | CLEAR_STR | |
6702 | BGP_STR | |
6703 | BGP_INSTANCE_HELP_STR | |
6704 | "Address family\n" | |
6705 | "Clear all peers\n" | |
6706 | BGP_SOFT_STR | |
6707 | BGP_SOFT_OUT_STR) | |
6708 | ||
718e3744 | 6709 | ALIAS (clear_bgp_all_soft_out, |
6710 | clear_bgp_ipv6_all_out_cmd, | |
6711 | "clear bgp ipv6 * out", | |
6712 | CLEAR_STR | |
6713 | BGP_STR | |
6714 | "Address family\n" | |
6715 | "Clear all peers\n" | |
e0bce756 | 6716 | BGP_SOFT_OUT_STR) |
718e3744 | 6717 | |
01080f7c | 6718 | ALIAS (clear_bgp_all_soft_out, |
6719 | clear_bgp_instance_ipv6_all_out_cmd, | |
6720 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * out", | |
6721 | CLEAR_STR | |
6722 | BGP_STR | |
6723 | BGP_INSTANCE_HELP_STR | |
6724 | "Address family\n" | |
6725 | "Clear all peers\n" | |
6726 | BGP_SOFT_OUT_STR) | |
6727 | ||
8ad7271d DS |
6728 | DEFUN (clear_bgp_ipv6_safi_prefix, |
6729 | clear_bgp_ipv6_safi_prefix_cmd, | |
6730 | "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6731 | CLEAR_STR | |
6732 | BGP_STR | |
6733 | "Address family\n" | |
6734 | "Address Family Modifier\n" | |
6735 | "Clear bestpath and re-advertise\n" | |
6736 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6737 | { | |
6738 | if (strncmp (argv[0], "m", 1) == 0) | |
6739 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL); | |
6740 | else | |
6741 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL); | |
6742 | } | |
6743 | ||
01080f7c | 6744 | DEFUN (clear_bgp_instance_ipv6_safi_prefix, |
6745 | clear_bgp_instance_ipv6_safi_prefix_cmd, | |
6746 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6747 | CLEAR_STR | |
6748 | BGP_STR | |
6749 | BGP_INSTANCE_HELP_STR | |
6750 | "Address family\n" | |
6751 | "Address Family Modifier\n" | |
6752 | "Clear bestpath and re-advertise\n" | |
6753 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6754 | { | |
6755 | if (strncmp (argv[2], "m", 1) == 0) | |
6756 | return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_MULTICAST, NULL); | |
6757 | else | |
6758 | return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_UNICAST, NULL); | |
6759 | } | |
6760 | ||
718e3744 | 6761 | DEFUN (clear_ip_bgp_peer_soft_out, |
6762 | clear_ip_bgp_peer_soft_out_cmd, | |
db64ea86 | 6763 | "clear ip bgp (A.B.C.D|WORD) soft out", |
718e3744 | 6764 | CLEAR_STR |
6765 | IP_STR | |
6766 | BGP_STR | |
6767 | "BGP neighbor address to clear\n" | |
db64ea86 | 6768 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6769 | BGP_SOFT_STR |
6770 | BGP_SOFT_OUT_STR) | |
718e3744 | 6771 | { |
01080f7c | 6772 | if (argc == 3) |
6773 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
6774 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6775 | ||
718e3744 | 6776 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
6777 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6778 | } | |
6779 | ||
01080f7c | 6780 | ALIAS (clear_ip_bgp_peer_soft_out, |
6781 | clear_ip_bgp_instance_peer_soft_out_cmd, | |
6782 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft out", | |
6783 | CLEAR_STR | |
6784 | IP_STR | |
6785 | BGP_STR | |
6786 | BGP_INSTANCE_HELP_STR | |
6787 | "BGP neighbor address to clear\n" | |
6788 | "BGP neighbor on interface to clear\n" | |
6789 | BGP_SOFT_STR | |
6790 | BGP_SOFT_OUT_STR) | |
6791 | ||
718e3744 | 6792 | ALIAS (clear_ip_bgp_peer_soft_out, |
6793 | clear_ip_bgp_peer_out_cmd, | |
db64ea86 | 6794 | "clear ip bgp (A.B.C.D|WORD) out", |
718e3744 | 6795 | CLEAR_STR |
6796 | IP_STR | |
6797 | BGP_STR | |
6798 | "BGP neighbor address to clear\n" | |
db64ea86 | 6799 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6800 | BGP_SOFT_OUT_STR) |
718e3744 | 6801 | |
01080f7c | 6802 | ALIAS (clear_ip_bgp_peer_soft_out, |
6803 | clear_ip_bgp_instance_peer_out_cmd, | |
6804 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) out", | |
6805 | CLEAR_STR | |
6806 | IP_STR | |
6807 | BGP_STR | |
6808 | BGP_INSTANCE_HELP_STR | |
6809 | "BGP neighbor address to clear\n" | |
6810 | "BGP neighbor on interface to clear\n" | |
6811 | BGP_SOFT_OUT_STR) | |
6812 | ||
718e3744 | 6813 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
6814 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
db64ea86 | 6815 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", |
718e3744 | 6816 | CLEAR_STR |
6817 | IP_STR | |
6818 | BGP_STR | |
6819 | "BGP neighbor address to clear\n" | |
db64ea86 | 6820 | "BGP neighbor on interface to clear\n" |
718e3744 | 6821 | "Address family\n" |
6822 | "Address Family modifier\n" | |
6823 | "Address Family modifier\n" | |
e0bce756 DS |
6824 | BGP_SOFT_STR |
6825 | BGP_SOFT_OUT_STR) | |
718e3744 | 6826 | { |
6827 | if (strncmp (argv[1], "m", 1) == 0) | |
6828 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6829 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6830 | ||
6831 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6832 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6833 | } | |
6834 | ||
01080f7c | 6835 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, |
6836 | clear_ip_bgp_instance_peer_ipv4_soft_out_cmd, | |
6837 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", | |
6838 | CLEAR_STR | |
6839 | IP_STR | |
6840 | BGP_STR | |
6841 | BGP_INSTANCE_HELP_STR | |
6842 | "BGP neighbor address to clear\n" | |
6843 | "BGP neighbor on interface to clear\n" | |
6844 | "Address family\n" | |
6845 | "Address Family modifier\n" | |
6846 | "Address Family modifier\n" | |
6847 | BGP_SOFT_STR | |
6848 | BGP_SOFT_OUT_STR) | |
6849 | { | |
6850 | if (strncmp (argv[3], "m", 1) == 0) | |
6851 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, | |
6852 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6853 | ||
6854 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
6855 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6856 | } | |
6857 | ||
718e3744 | 6858 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
6859 | clear_ip_bgp_peer_ipv4_out_cmd, | |
db64ea86 | 6860 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out", |
718e3744 | 6861 | CLEAR_STR |
6862 | IP_STR | |
6863 | BGP_STR | |
6864 | "BGP neighbor address to clear\n" | |
db64ea86 | 6865 | "BGP neighbor on interface to clear\n" |
718e3744 | 6866 | "Address family\n" |
6867 | "Address Family modifier\n" | |
6868 | "Address Family modifier\n" | |
e0bce756 | 6869 | BGP_SOFT_OUT_STR) |
718e3744 | 6870 | |
01080f7c | 6871 | ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_out, |
6872 | clear_ip_bgp_instance_peer_ipv4_out_cmd, | |
6873 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) out", | |
6874 | CLEAR_STR | |
6875 | IP_STR | |
6876 | BGP_STR | |
6877 | BGP_INSTANCE_HELP_STR | |
6878 | "BGP neighbor address to clear\n" | |
6879 | "BGP neighbor on interface to clear\n" | |
6880 | "Address family\n" | |
6881 | "Address Family modifier\n" | |
6882 | "Address Family modifier\n" | |
6883 | BGP_SOFT_OUT_STR) | |
6884 | ||
db64ea86 | 6885 | /* NOTE: WORD peers have not been tested for vpnv4 */ |
718e3744 | 6886 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
6887 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
db64ea86 | 6888 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out", |
718e3744 | 6889 | CLEAR_STR |
6890 | IP_STR | |
6891 | BGP_STR | |
6892 | "BGP neighbor address to clear\n" | |
db64ea86 | 6893 | "BGP neighbor on interface to clear\n" |
718e3744 | 6894 | "Address family\n" |
6895 | "Address Family Modifier\n" | |
e0bce756 DS |
6896 | BGP_SOFT_STR |
6897 | BGP_SOFT_OUT_STR) | |
718e3744 | 6898 | { |
6899 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6900 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6901 | } | |
6902 | ||
6903 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
6904 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
db64ea86 | 6905 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out", |
718e3744 | 6906 | CLEAR_STR |
6907 | IP_STR | |
6908 | BGP_STR | |
6909 | "BGP neighbor address to clear\n" | |
db64ea86 | 6910 | "BGP neighbor on interface to clear\n" |
718e3744 | 6911 | "Address family\n" |
6912 | "Address Family Modifier\n" | |
e0bce756 | 6913 | BGP_SOFT_OUT_STR) |
718e3744 | 6914 | |
587ff0fd LB |
6915 | DEFUN (clear_ip_bgp_peer_encap_soft_out, |
6916 | clear_ip_bgp_peer_encap_soft_out_cmd, | |
6917 | "clear ip bgp A.B.C.D encap unicast soft out", | |
6918 | CLEAR_STR | |
6919 | IP_STR | |
6920 | BGP_STR | |
6921 | "BGP neighbor address to clear\n" | |
6922 | "Address family\n" | |
6923 | "Address Family Modifier\n" | |
6924 | "Soft reconfig\n" | |
6925 | "Soft reconfig outbound update\n") | |
6926 | { | |
6927 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
6928 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6929 | } | |
6930 | ||
6931 | ALIAS (clear_ip_bgp_peer_encap_soft_out, | |
6932 | clear_ip_bgp_peer_encap_out_cmd, | |
6933 | "clear ip bgp A.B.C.D encap unicast out", | |
6934 | CLEAR_STR | |
6935 | IP_STR | |
6936 | BGP_STR | |
6937 | "BGP neighbor address to clear\n" | |
6938 | "Address family\n" | |
6939 | "Address Family Modifier\n" | |
6940 | "Soft reconfig outbound update\n") | |
6941 | ||
718e3744 | 6942 | DEFUN (clear_bgp_peer_soft_out, |
6943 | clear_bgp_peer_soft_out_cmd, | |
a80beece | 6944 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6945 | CLEAR_STR |
6946 | BGP_STR | |
6947 | "BGP neighbor address to clear\n" | |
6948 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6949 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6950 | BGP_SOFT_STR |
6951 | BGP_SOFT_OUT_STR) | |
718e3744 | 6952 | { |
01080f7c | 6953 | if (argc == 3) |
6954 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
6955 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6956 | ||
718e3744 | 6957 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
6958 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6959 | } | |
6960 | ||
01080f7c | 6961 | ALIAS (clear_bgp_peer_soft_out, |
6962 | clear_bgp_instance_peer_soft_out_cmd, | |
6963 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft out", | |
6964 | CLEAR_STR | |
6965 | BGP_STR | |
6966 | BGP_INSTANCE_HELP_STR | |
6967 | "BGP neighbor address to clear\n" | |
6968 | "BGP IPv6 neighbor to clear\n" | |
6969 | "BGP neighbor on interface to clear\n" | |
6970 | BGP_SOFT_STR | |
6971 | BGP_SOFT_OUT_STR) | |
6972 | ||
718e3744 | 6973 | ALIAS (clear_bgp_peer_soft_out, |
6974 | clear_bgp_ipv6_peer_soft_out_cmd, | |
a80beece | 6975 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6976 | CLEAR_STR |
6977 | BGP_STR | |
6978 | "Address family\n" | |
6979 | "BGP neighbor address to clear\n" | |
6980 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6981 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6982 | BGP_SOFT_STR |
6983 | BGP_SOFT_OUT_STR) | |
718e3744 | 6984 | |
01080f7c | 6985 | ALIAS (clear_bgp_peer_soft_out, |
6986 | clear_bgp_instance_ipv6_peer_soft_out_cmd, | |
6987 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", | |
6988 | CLEAR_STR | |
6989 | BGP_STR | |
6990 | BGP_INSTANCE_HELP_STR | |
6991 | "Address family\n" | |
6992 | "BGP neighbor address to clear\n" | |
6993 | "BGP IPv6 neighbor to clear\n" | |
6994 | "BGP neighbor on interface to clear\n" | |
6995 | BGP_SOFT_STR | |
6996 | BGP_SOFT_OUT_STR) | |
6997 | ||
718e3744 | 6998 | ALIAS (clear_bgp_peer_soft_out, |
6999 | clear_bgp_peer_out_cmd, | |
a80beece | 7000 | "clear bgp (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 7001 | CLEAR_STR |
7002 | BGP_STR | |
7003 | "BGP neighbor address to clear\n" | |
7004 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7005 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7006 | BGP_SOFT_OUT_STR) |
718e3744 | 7007 | |
01080f7c | 7008 | ALIAS (clear_bgp_peer_soft_out, |
7009 | clear_bgp_instance_peer_out_cmd, | |
7010 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) out", | |
7011 | CLEAR_STR | |
7012 | BGP_STR | |
7013 | BGP_INSTANCE_HELP_STR | |
7014 | "BGP neighbor address to clear\n" | |
7015 | "BGP IPv6 neighbor to clear\n" | |
7016 | "BGP neighbor on interface to clear\n" | |
7017 | BGP_SOFT_OUT_STR) | |
7018 | ||
718e3744 | 7019 | ALIAS (clear_bgp_peer_soft_out, |
7020 | clear_bgp_ipv6_peer_out_cmd, | |
a80beece | 7021 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 7022 | CLEAR_STR |
7023 | BGP_STR | |
7024 | "Address family\n" | |
7025 | "BGP neighbor address to clear\n" | |
7026 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7027 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7028 | BGP_SOFT_OUT_STR) |
718e3744 | 7029 | |
01080f7c | 7030 | ALIAS (clear_bgp_peer_soft_out, |
7031 | clear_bgp_instance_ipv6_peer_out_cmd, | |
7032 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) out", | |
7033 | CLEAR_STR | |
7034 | BGP_STR | |
7035 | BGP_INSTANCE_HELP_STR | |
7036 | "Address family\n" | |
7037 | "BGP neighbor address to clear\n" | |
7038 | "BGP IPv6 neighbor to clear\n" | |
7039 | "BGP neighbor on interface to clear\n" | |
7040 | BGP_SOFT_OUT_STR) | |
7041 | ||
718e3744 | 7042 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
7043 | clear_ip_bgp_peer_group_soft_out_cmd, | |
7044 | "clear ip bgp peer-group WORD soft out", | |
7045 | CLEAR_STR | |
7046 | IP_STR | |
7047 | BGP_STR | |
7048 | "Clear all members of peer-group\n" | |
7049 | "BGP peer-group name\n" | |
e0bce756 DS |
7050 | BGP_SOFT_STR |
7051 | BGP_SOFT_OUT_STR) | |
718e3744 | 7052 | { |
01080f7c | 7053 | if (argc == 3) |
7054 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
7055 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7056 | ||
718e3744 | 7057 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
7058 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7059 | } | |
7060 | ||
01080f7c | 7061 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
7062 | clear_ip_bgp_instance_peer_group_soft_out_cmd, | |
7063 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", | |
7064 | CLEAR_STR | |
7065 | IP_STR | |
7066 | BGP_STR | |
7067 | BGP_INSTANCE_HELP_STR | |
7068 | "Clear all members of peer-group\n" | |
7069 | "BGP peer-group name\n" | |
7070 | BGP_SOFT_STR | |
7071 | BGP_SOFT_OUT_STR) | |
7072 | ||
718e3744 | 7073 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
7074 | clear_ip_bgp_peer_group_out_cmd, | |
7075 | "clear ip bgp peer-group WORD out", | |
7076 | CLEAR_STR | |
7077 | IP_STR | |
7078 | BGP_STR | |
7079 | "Clear all members of peer-group\n" | |
7080 | "BGP peer-group name\n" | |
e0bce756 | 7081 | BGP_SOFT_OUT_STR) |
718e3744 | 7082 | |
01080f7c | 7083 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
7084 | clear_ip_bgp_instance_peer_group_out_cmd, | |
7085 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD out", | |
7086 | CLEAR_STR | |
7087 | IP_STR | |
7088 | BGP_STR | |
7089 | BGP_INSTANCE_HELP_STR | |
7090 | "Clear all members of peer-group\n" | |
7091 | "BGP peer-group name\n" | |
7092 | BGP_SOFT_OUT_STR) | |
7093 | ||
718e3744 | 7094 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
7095 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
7096 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
7097 | CLEAR_STR | |
7098 | IP_STR | |
7099 | BGP_STR | |
7100 | "Clear all members of peer-group\n" | |
7101 | "BGP peer-group name\n" | |
7102 | "Address family\n" | |
7103 | "Address Family modifier\n" | |
7104 | "Address Family modifier\n" | |
e0bce756 DS |
7105 | BGP_SOFT_STR |
7106 | BGP_SOFT_OUT_STR) | |
718e3744 | 7107 | { |
7108 | if (strncmp (argv[1], "m", 1) == 0) | |
7109 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7110 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7111 | ||
7112 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7113 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7114 | } | |
7115 | ||
01080f7c | 7116 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, |
7117 | clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd, | |
7118 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft out", | |
7119 | CLEAR_STR | |
7120 | IP_STR | |
7121 | BGP_STR | |
7122 | BGP_INSTANCE_HELP_STR | |
7123 | "Clear all members of peer-group\n" | |
7124 | "BGP peer-group name\n" | |
7125 | "Address family\n" | |
7126 | "Address Family modifier\n" | |
7127 | "Address Family modifier\n" | |
7128 | BGP_SOFT_STR | |
7129 | BGP_SOFT_OUT_STR) | |
7130 | { | |
7131 | if (strncmp (argv[3], "m", 1) == 0) | |
7132 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, | |
7133 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7134 | ||
7135 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
7136 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7137 | } | |
7138 | ||
718e3744 | 7139 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
7140 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
7141 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
7142 | CLEAR_STR | |
7143 | IP_STR | |
7144 | BGP_STR | |
7145 | "Clear all members of peer-group\n" | |
7146 | "BGP peer-group name\n" | |
7147 | "Address family\n" | |
7148 | "Address Family modifier\n" | |
7149 | "Address Family modifier\n" | |
e0bce756 | 7150 | BGP_SOFT_OUT_STR) |
718e3744 | 7151 | |
01080f7c | 7152 | ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_out, |
7153 | clear_ip_bgp_instance_peer_group_ipv4_out_cmd, | |
7154 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) out", | |
7155 | CLEAR_STR | |
7156 | IP_STR | |
7157 | BGP_STR | |
7158 | BGP_INSTANCE_HELP_STR | |
7159 | "Clear all members of peer-group\n" | |
7160 | "BGP peer-group name\n" | |
7161 | "Address family\n" | |
7162 | "Address Family modifier\n" | |
7163 | "Address Family modifier\n" | |
7164 | BGP_SOFT_OUT_STR) | |
7165 | ||
718e3744 | 7166 | DEFUN (clear_bgp_peer_group_soft_out, |
7167 | clear_bgp_peer_group_soft_out_cmd, | |
7168 | "clear bgp peer-group WORD soft out", | |
7169 | CLEAR_STR | |
7170 | BGP_STR | |
7171 | "Clear all members of peer-group\n" | |
7172 | "BGP peer-group name\n" | |
e0bce756 DS |
7173 | BGP_SOFT_STR |
7174 | BGP_SOFT_OUT_STR) | |
718e3744 | 7175 | { |
01080f7c | 7176 | if (argc == 3) |
7177 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
7178 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7179 | ||
718e3744 | 7180 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
7181 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7182 | } | |
7183 | ||
01080f7c | 7184 | ALIAS (clear_bgp_peer_group_soft_out, |
7185 | clear_bgp_instance_peer_group_soft_out_cmd, | |
7186 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", | |
7187 | CLEAR_STR | |
7188 | BGP_STR | |
7189 | BGP_INSTANCE_HELP_STR | |
7190 | "Clear all members of peer-group\n" | |
7191 | "BGP peer-group name\n" | |
7192 | BGP_SOFT_STR | |
7193 | BGP_SOFT_OUT_STR) | |
7194 | ||
718e3744 | 7195 | ALIAS (clear_bgp_peer_group_soft_out, |
7196 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
7197 | "clear bgp ipv6 peer-group WORD soft out", | |
7198 | CLEAR_STR | |
7199 | BGP_STR | |
7200 | "Address family\n" | |
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 | ALIAS (clear_bgp_peer_group_soft_out, |
7207 | clear_bgp_instance_ipv6_peer_group_soft_out_cmd, | |
7208 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft out", | |
7209 | CLEAR_STR | |
7210 | BGP_STR | |
7211 | BGP_INSTANCE_HELP_STR | |
7212 | "Address family\n" | |
7213 | "Clear all members of peer-group\n" | |
7214 | "BGP peer-group name\n" | |
7215 | BGP_SOFT_STR | |
7216 | BGP_SOFT_OUT_STR) | |
7217 | ||
718e3744 | 7218 | ALIAS (clear_bgp_peer_group_soft_out, |
7219 | clear_bgp_peer_group_out_cmd, | |
7220 | "clear bgp peer-group WORD out", | |
7221 | CLEAR_STR | |
7222 | BGP_STR | |
7223 | "Clear all members of peer-group\n" | |
7224 | "BGP peer-group name\n" | |
e0bce756 | 7225 | BGP_SOFT_OUT_STR) |
718e3744 | 7226 | |
01080f7c | 7227 | ALIAS (clear_bgp_peer_group_soft_out, |
7228 | clear_bgp_instance_peer_group_out_cmd, | |
7229 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD out", | |
7230 | CLEAR_STR | |
7231 | BGP_STR | |
7232 | BGP_INSTANCE_HELP_STR | |
7233 | "Clear all members of peer-group\n" | |
7234 | "BGP peer-group name\n" | |
7235 | BGP_SOFT_OUT_STR) | |
7236 | ||
718e3744 | 7237 | ALIAS (clear_bgp_peer_group_soft_out, |
7238 | clear_bgp_ipv6_peer_group_out_cmd, | |
7239 | "clear bgp ipv6 peer-group WORD out", | |
7240 | CLEAR_STR | |
7241 | BGP_STR | |
7242 | "Address family\n" | |
7243 | "Clear all members of peer-group\n" | |
7244 | "BGP peer-group name\n" | |
e0bce756 | 7245 | BGP_SOFT_OUT_STR) |
718e3744 | 7246 | |
01080f7c | 7247 | ALIAS (clear_bgp_peer_group_soft_out, |
7248 | clear_bgp_instance_ipv6_peer_group_out_cmd, | |
7249 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD out", | |
7250 | CLEAR_STR | |
7251 | BGP_STR | |
7252 | BGP_INSTANCE_HELP_STR | |
7253 | "Address family\n" | |
7254 | "Clear all members of peer-group\n" | |
7255 | "BGP peer-group name\n" | |
7256 | BGP_SOFT_OUT_STR) | |
7257 | ||
718e3744 | 7258 | DEFUN (clear_ip_bgp_external_soft_out, |
7259 | clear_ip_bgp_external_soft_out_cmd, | |
7260 | "clear ip bgp external soft out", | |
7261 | CLEAR_STR | |
7262 | IP_STR | |
7263 | BGP_STR | |
7264 | "Clear all external peers\n" | |
e0bce756 DS |
7265 | BGP_SOFT_STR |
7266 | BGP_SOFT_OUT_STR) | |
01080f7c | 7267 | { |
7268 | if (argc == 2) | |
7269 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
7270 | BGP_CLEAR_SOFT_OUT, NULL); | |
7271 | ||
7272 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7273 | BGP_CLEAR_SOFT_OUT, NULL); | |
7274 | } | |
7275 | ||
7276 | ALIAS (clear_ip_bgp_external_soft_out, | |
7277 | clear_ip_bgp_instance_external_soft_out_cmd, | |
7278 | "clear ip bgp " BGP_INSTANCE_CMD " external soft out", | |
7279 | CLEAR_STR | |
7280 | IP_STR | |
7281 | BGP_STR | |
7282 | BGP_INSTANCE_HELP_STR | |
7283 | "Clear all external peers\n" | |
7284 | BGP_SOFT_STR | |
7285 | BGP_SOFT_OUT_STR) | |
7286 | ||
7287 | ALIAS (clear_ip_bgp_external_soft_out, | |
7288 | clear_ip_bgp_external_out_cmd, | |
7289 | "clear ip bgp external out", | |
7290 | CLEAR_STR | |
7291 | IP_STR | |
7292 | BGP_STR | |
7293 | "Clear all external peers\n" | |
7294 | BGP_SOFT_OUT_STR) | |
718e3744 | 7295 | |
7296 | ALIAS (clear_ip_bgp_external_soft_out, | |
01080f7c | 7297 | clear_ip_bgp_instance_external_out_cmd, |
7298 | "clear ip bgp " BGP_INSTANCE_CMD " external out", | |
718e3744 | 7299 | CLEAR_STR |
7300 | IP_STR | |
7301 | BGP_STR | |
01080f7c | 7302 | BGP_INSTANCE_HELP_STR |
718e3744 | 7303 | "Clear all external peers\n" |
e0bce756 | 7304 | BGP_SOFT_OUT_STR) |
718e3744 | 7305 | |
7306 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
7307 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
7308 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
7309 | CLEAR_STR | |
7310 | IP_STR | |
7311 | BGP_STR | |
7312 | "Clear all external peers\n" | |
7313 | "Address family\n" | |
7314 | "Address Family modifier\n" | |
7315 | "Address Family modifier\n" | |
e0bce756 DS |
7316 | BGP_SOFT_STR |
7317 | BGP_SOFT_OUT_STR) | |
718e3744 | 7318 | { |
7319 | if (strncmp (argv[0], "m", 1) == 0) | |
7320 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7321 | BGP_CLEAR_SOFT_OUT, NULL); | |
7322 | ||
7323 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7324 | BGP_CLEAR_SOFT_OUT, NULL); | |
7325 | } | |
7326 | ||
01080f7c | 7327 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, |
7328 | clear_ip_bgp_instance_external_ipv4_soft_out_cmd, | |
7329 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft out", | |
7330 | CLEAR_STR | |
7331 | IP_STR | |
7332 | BGP_STR | |
7333 | BGP_INSTANCE_HELP_STR | |
7334 | "Clear all external peers\n" | |
7335 | "Address family\n" | |
7336 | "Address Family modifier\n" | |
7337 | "Address Family modifier\n" | |
7338 | BGP_SOFT_STR | |
7339 | BGP_SOFT_OUT_STR) | |
7340 | { | |
7341 | if (strncmp (argv[2], "m", 1) == 0) | |
7342 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, | |
7343 | BGP_CLEAR_SOFT_OUT, NULL); | |
7344 | ||
7345 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
7346 | BGP_CLEAR_SOFT_OUT, NULL); | |
7347 | } | |
7348 | ||
718e3744 | 7349 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
7350 | clear_ip_bgp_external_ipv4_out_cmd, | |
7351 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
7352 | CLEAR_STR | |
7353 | IP_STR | |
7354 | BGP_STR | |
7355 | "Clear all external peers\n" | |
7356 | "Address family\n" | |
7357 | "Address Family modifier\n" | |
7358 | "Address Family modifier\n" | |
e0bce756 | 7359 | BGP_SOFT_OUT_STR) |
718e3744 | 7360 | |
01080f7c | 7361 | ALIAS (clear_ip_bgp_instance_external_ipv4_soft_out, |
7362 | clear_ip_bgp_instance_external_ipv4_out_cmd, | |
7363 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) out", | |
7364 | CLEAR_STR | |
7365 | IP_STR | |
7366 | BGP_STR | |
7367 | BGP_INSTANCE_HELP_STR | |
7368 | "Clear all external peers\n" | |
7369 | "Address family\n" | |
7370 | "Address Family modifier\n" | |
7371 | "Address Family modifier\n" | |
7372 | BGP_SOFT_OUT_STR) | |
7373 | ||
718e3744 | 7374 | DEFUN (clear_bgp_external_soft_out, |
7375 | clear_bgp_external_soft_out_cmd, | |
7376 | "clear bgp external soft out", | |
7377 | CLEAR_STR | |
7378 | BGP_STR | |
7379 | "Clear all external peers\n" | |
e0bce756 DS |
7380 | BGP_SOFT_STR |
7381 | BGP_SOFT_OUT_STR) | |
718e3744 | 7382 | { |
01080f7c | 7383 | if (argc == 2) |
7384 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
7385 | BGP_CLEAR_SOFT_OUT, NULL); | |
7386 | ||
718e3744 | 7387 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
7388 | BGP_CLEAR_SOFT_OUT, NULL); | |
7389 | } | |
7390 | ||
01080f7c | 7391 | ALIAS (clear_bgp_external_soft_out, |
7392 | clear_bgp_instance_external_soft_out_cmd, | |
7393 | "clear bgp " BGP_INSTANCE_CMD " external soft out", | |
7394 | CLEAR_STR | |
7395 | BGP_STR | |
7396 | BGP_INSTANCE_HELP_STR | |
7397 | "Clear all external peers\n" | |
7398 | BGP_SOFT_STR | |
7399 | BGP_SOFT_OUT_STR) | |
7400 | ||
718e3744 | 7401 | ALIAS (clear_bgp_external_soft_out, |
7402 | clear_bgp_ipv6_external_soft_out_cmd, | |
7403 | "clear bgp ipv6 external soft out", | |
7404 | CLEAR_STR | |
7405 | BGP_STR | |
7406 | "Address family\n" | |
7407 | "Clear all external peers\n" | |
e0bce756 DS |
7408 | BGP_SOFT_STR |
7409 | BGP_SOFT_OUT_STR) | |
718e3744 | 7410 | |
01080f7c | 7411 | ALIAS (clear_bgp_external_soft_out, |
7412 | clear_bgp_instance_ipv6_external_soft_out_cmd, | |
7413 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft out", | |
7414 | CLEAR_STR | |
7415 | BGP_STR | |
7416 | BGP_INSTANCE_HELP_STR | |
7417 | "Address family\n" | |
7418 | "Clear all external peers\n" | |
7419 | BGP_SOFT_STR | |
7420 | BGP_SOFT_OUT_STR) | |
7421 | ||
718e3744 | 7422 | ALIAS (clear_bgp_external_soft_out, |
7423 | clear_bgp_external_out_cmd, | |
7424 | "clear bgp external out", | |
7425 | CLEAR_STR | |
7426 | BGP_STR | |
7427 | "Clear all external peers\n" | |
e0bce756 | 7428 | BGP_SOFT_OUT_STR) |
718e3744 | 7429 | |
01080f7c | 7430 | ALIAS (clear_bgp_external_soft_out, |
7431 | clear_bgp_instance_external_out_cmd, | |
7432 | "clear bgp " BGP_INSTANCE_CMD " external out", | |
7433 | CLEAR_STR | |
7434 | BGP_STR | |
7435 | BGP_INSTANCE_HELP_STR | |
7436 | "Clear all external peers\n" | |
7437 | BGP_SOFT_OUT_STR) | |
7438 | ||
718e3744 | 7439 | ALIAS (clear_bgp_external_soft_out, |
7440 | clear_bgp_ipv6_external_out_cmd, | |
7441 | "clear bgp ipv6 external WORD out", | |
7442 | CLEAR_STR | |
7443 | BGP_STR | |
7444 | "Address family\n" | |
7445 | "Clear all external peers\n" | |
e0bce756 | 7446 | BGP_SOFT_OUT_STR) |
718e3744 | 7447 | |
01080f7c | 7448 | ALIAS (clear_bgp_external_soft_out, |
7449 | clear_bgp_instance_ipv6_external_out_cmd, | |
7450 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD out", | |
7451 | CLEAR_STR | |
7452 | BGP_STR | |
7453 | BGP_INSTANCE_HELP_STR | |
7454 | "Address family\n" | |
7455 | "Clear all external peers\n" | |
7456 | BGP_SOFT_OUT_STR) | |
7457 | ||
718e3744 | 7458 | DEFUN (clear_ip_bgp_as_soft_out, |
7459 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 7460 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 7461 | CLEAR_STR |
7462 | IP_STR | |
7463 | BGP_STR | |
7464 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7465 | BGP_SOFT_STR |
7466 | BGP_SOFT_OUT_STR) | |
718e3744 | 7467 | { |
01080f7c | 7468 | if (argc == 3) |
7469 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
7470 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7471 | ||
718e3744 | 7472 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
7473 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7474 | } | |
7475 | ||
01080f7c | 7476 | ALIAS (clear_ip_bgp_as_soft_out, |
7477 | clear_ip_bgp_instance_as_soft_out_cmd, | |
7478 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", | |
7479 | CLEAR_STR | |
7480 | IP_STR | |
7481 | BGP_STR | |
7482 | BGP_INSTANCE_HELP_STR | |
7483 | "Clear peers with the AS number\n" | |
7484 | BGP_SOFT_STR | |
7485 | BGP_SOFT_OUT_STR) | |
7486 | ||
718e3744 | 7487 | ALIAS (clear_ip_bgp_as_soft_out, |
7488 | clear_ip_bgp_as_out_cmd, | |
320da874 | 7489 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 7490 | CLEAR_STR |
7491 | IP_STR | |
7492 | BGP_STR | |
7493 | "Clear peers with the AS number\n" | |
e0bce756 | 7494 | BGP_SOFT_OUT_STR) |
718e3744 | 7495 | |
01080f7c | 7496 | ALIAS (clear_ip_bgp_as_soft_out, |
7497 | clear_ip_bgp_instance_as_out_cmd, | |
7498 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", | |
7499 | CLEAR_STR | |
7500 | IP_STR | |
7501 | BGP_STR | |
7502 | BGP_INSTANCE_HELP_STR | |
7503 | "Clear peers with the AS number\n" | |
7504 | BGP_SOFT_OUT_STR) | |
7505 | ||
718e3744 | 7506 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
7507 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 7508 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 7509 | CLEAR_STR |
7510 | IP_STR | |
7511 | BGP_STR | |
7512 | "Clear peers with the AS number\n" | |
7513 | "Address family\n" | |
7514 | "Address Family modifier\n" | |
7515 | "Address Family modifier\n" | |
e0bce756 DS |
7516 | BGP_SOFT_STR |
7517 | BGP_SOFT_OUT_STR) | |
718e3744 | 7518 | { |
7519 | if (strncmp (argv[1], "m", 1) == 0) | |
7520 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7521 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7522 | ||
7523 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7524 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7525 | } | |
7526 | ||
01080f7c | 7527 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, |
7528 | clear_ip_bgp_instance_as_ipv4_soft_out_cmd, | |
7529 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", | |
7530 | CLEAR_STR | |
7531 | IP_STR | |
7532 | BGP_STR | |
7533 | BGP_INSTANCE_HELP_STR | |
7534 | "Clear peers with the AS number\n" | |
7535 | "Address family\n" | |
7536 | "Address Family modifier\n" | |
7537 | "Address Family modifier\n" | |
7538 | BGP_SOFT_STR | |
7539 | BGP_SOFT_OUT_STR) | |
7540 | { | |
7541 | if (strncmp (argv[3], "m", 1) == 0) | |
7542 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, | |
7543 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7544 | ||
7545 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
7546 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7547 | } | |
7548 | ||
718e3744 | 7549 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
7550 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 7551 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 7552 | CLEAR_STR |
7553 | IP_STR | |
7554 | BGP_STR | |
7555 | "Clear peers with the AS number\n" | |
7556 | "Address family\n" | |
7557 | "Address Family modifier\n" | |
7558 | "Address Family modifier\n" | |
e0bce756 | 7559 | BGP_SOFT_OUT_STR) |
718e3744 | 7560 | |
01080f7c | 7561 | ALIAS (clear_ip_bgp_instance_as_ipv4_soft_out, |
7562 | clear_ip_bgp_instance_as_ipv4_out_cmd, | |
7563 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) out", | |
7564 | CLEAR_STR | |
7565 | IP_STR | |
7566 | BGP_STR | |
7567 | BGP_INSTANCE_HELP_STR | |
7568 | "Clear peers with the AS number\n" | |
7569 | "Address family\n" | |
7570 | "Address Family modifier\n" | |
7571 | "Address Family modifier\n" | |
7572 | BGP_SOFT_OUT_STR) | |
7573 | ||
718e3744 | 7574 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
7575 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 7576 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 7577 | CLEAR_STR |
7578 | IP_STR | |
7579 | BGP_STR | |
7580 | "Clear peers with the AS number\n" | |
7581 | "Address family\n" | |
7582 | "Address Family modifier\n" | |
e0bce756 DS |
7583 | BGP_SOFT_STR |
7584 | BGP_SOFT_OUT_STR) | |
718e3744 | 7585 | { |
7586 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7587 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7588 | } | |
7589 | ||
7590 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
7591 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 7592 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 7593 | CLEAR_STR |
7594 | IP_STR | |
7595 | BGP_STR | |
7596 | "Clear peers with the AS number\n" | |
7597 | "Address family\n" | |
7598 | "Address Family modifier\n" | |
e0bce756 | 7599 | BGP_SOFT_OUT_STR) |
718e3744 | 7600 | |
587ff0fd LB |
7601 | DEFUN (clear_ip_bgp_as_encap_soft_out, |
7602 | clear_ip_bgp_as_encap_soft_out_cmd, | |
7603 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft out", | |
7604 | CLEAR_STR | |
7605 | IP_STR | |
7606 | BGP_STR | |
7607 | "Clear peers with the AS number\n" | |
7608 | "Address family\n" | |
7609 | "Address Family modifier\n" | |
7610 | "Soft reconfig\n" | |
7611 | "Soft reconfig outbound update\n") | |
7612 | { | |
7613 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
7614 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7615 | } | |
7616 | ||
7617 | ALIAS (clear_ip_bgp_as_encap_soft_out, | |
7618 | clear_ip_bgp_as_encap_out_cmd, | |
7619 | "clear ip bgp " CMD_AS_RANGE " encap unicast out", | |
7620 | CLEAR_STR | |
7621 | IP_STR | |
7622 | BGP_STR | |
7623 | "Clear peers with the AS number\n" | |
7624 | "Address family\n" | |
7625 | "Address Family modifier\n" | |
7626 | "Soft reconfig outbound update\n") | |
7627 | ||
718e3744 | 7628 | DEFUN (clear_bgp_as_soft_out, |
7629 | clear_bgp_as_soft_out_cmd, | |
320da874 | 7630 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 7631 | CLEAR_STR |
7632 | BGP_STR | |
7633 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7634 | BGP_SOFT_STR |
7635 | BGP_SOFT_OUT_STR) | |
718e3744 | 7636 | { |
01080f7c | 7637 | if (argc == 3) |
7638 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
7639 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7640 | ||
718e3744 | 7641 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
7642 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7643 | } | |
7644 | ||
01080f7c | 7645 | ALIAS (clear_bgp_as_soft_out, |
7646 | clear_bgp_instance_as_soft_out_cmd, | |
7647 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", | |
7648 | CLEAR_STR | |
7649 | BGP_STR | |
7650 | BGP_INSTANCE_HELP_STR | |
7651 | "Clear peers with the AS number\n" | |
7652 | BGP_SOFT_STR | |
7653 | BGP_SOFT_OUT_STR) | |
7654 | ||
718e3744 | 7655 | ALIAS (clear_bgp_as_soft_out, |
7656 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 7657 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 7658 | CLEAR_STR |
7659 | BGP_STR | |
7660 | "Address family\n" | |
7661 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7662 | BGP_SOFT_STR |
7663 | BGP_SOFT_OUT_STR) | |
718e3744 | 7664 | |
01080f7c | 7665 | ALIAS (clear_bgp_as_soft_out, |
7666 | clear_bgp_instance_ipv6_as_soft_out_cmd, | |
7667 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft out", | |
7668 | CLEAR_STR | |
7669 | BGP_STR | |
7670 | BGP_INSTANCE_HELP_STR | |
7671 | "Address family\n" | |
7672 | "Clear peers with the AS number\n" | |
7673 | BGP_SOFT_STR | |
7674 | BGP_SOFT_OUT_STR) | |
7675 | ||
718e3744 | 7676 | ALIAS (clear_bgp_as_soft_out, |
7677 | clear_bgp_as_out_cmd, | |
320da874 | 7678 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 7679 | CLEAR_STR |
7680 | BGP_STR | |
7681 | "Clear peers with the AS number\n" | |
e0bce756 | 7682 | BGP_SOFT_OUT_STR) |
718e3744 | 7683 | |
01080f7c | 7684 | ALIAS (clear_bgp_as_soft_out, |
7685 | clear_bgp_instance_as_out_cmd, | |
7686 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", | |
7687 | CLEAR_STR | |
7688 | BGP_STR | |
7689 | BGP_INSTANCE_HELP_STR | |
7690 | "Clear peers with the AS number\n" | |
7691 | BGP_SOFT_OUT_STR) | |
7692 | ||
718e3744 | 7693 | ALIAS (clear_bgp_as_soft_out, |
7694 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 7695 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 7696 | CLEAR_STR |
7697 | BGP_STR | |
7698 | "Address family\n" | |
7699 | "Clear peers with the AS number\n" | |
e0bce756 | 7700 | BGP_SOFT_OUT_STR) |
6b0655a2 | 7701 | |
01080f7c | 7702 | ALIAS (clear_bgp_as_soft_out, |
7703 | clear_bgp_instance_ipv6_as_out_cmd, | |
7704 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " out", | |
7705 | CLEAR_STR | |
7706 | BGP_STR | |
7707 | BGP_INSTANCE_HELP_STR | |
7708 | "Address family\n" | |
7709 | "Clear peers with the AS number\n" | |
7710 | BGP_SOFT_OUT_STR) | |
7711 | ||
718e3744 | 7712 | /* Inbound soft-reconfiguration */ |
7713 | DEFUN (clear_ip_bgp_all_soft_in, | |
7714 | clear_ip_bgp_all_soft_in_cmd, | |
7715 | "clear ip bgp * soft in", | |
7716 | CLEAR_STR | |
7717 | IP_STR | |
7718 | BGP_STR | |
7719 | "Clear all peers\n" | |
e0bce756 DS |
7720 | BGP_SOFT_STR |
7721 | BGP_SOFT_IN_STR) | |
718e3744 | 7722 | { |
6aeb9e78 DS |
7723 | if (argc == 2) |
7724 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 7725 | BGP_CLEAR_SOFT_IN, NULL); |
7726 | ||
7727 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7728 | BGP_CLEAR_SOFT_IN, NULL); | |
7729 | } | |
7730 | ||
7731 | ALIAS (clear_ip_bgp_all_soft_in, | |
7732 | clear_ip_bgp_instance_all_soft_in_cmd, | |
8386ac43 | 7733 | "clear ip bgp " BGP_INSTANCE_CMD " * soft in", |
718e3744 | 7734 | CLEAR_STR |
7735 | IP_STR | |
7736 | BGP_STR | |
8386ac43 | 7737 | BGP_INSTANCE_HELP_STR |
718e3744 | 7738 | "Clear all peers\n" |
e0bce756 DS |
7739 | BGP_SOFT_STR |
7740 | BGP_SOFT_IN_STR) | |
718e3744 | 7741 | |
7742 | ALIAS (clear_ip_bgp_all_soft_in, | |
7743 | clear_ip_bgp_all_in_cmd, | |
7744 | "clear ip bgp * in", | |
7745 | CLEAR_STR | |
7746 | IP_STR | |
7747 | BGP_STR | |
7748 | "Clear all peers\n" | |
e0bce756 | 7749 | BGP_SOFT_IN_STR) |
718e3744 | 7750 | |
01080f7c | 7751 | ALIAS (clear_ip_bgp_all_soft_in, |
7752 | clear_ip_bgp_instance_all_in_cmd, | |
7753 | "clear ip bgp " BGP_INSTANCE_CMD " * in", | |
7754 | CLEAR_STR | |
7755 | IP_STR | |
7756 | BGP_STR | |
7757 | BGP_INSTANCE_HELP_STR | |
7758 | "Clear all peers\n" | |
7759 | BGP_SOFT_IN_STR) | |
7760 | ||
718e3744 | 7761 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
7762 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
7763 | "clear ip bgp * in prefix-filter", | |
7764 | CLEAR_STR | |
7765 | IP_STR | |
7766 | BGP_STR | |
7767 | "Clear all peers\n" | |
e0bce756 | 7768 | BGP_SOFT_IN_STR |
718e3744 | 7769 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7770 | { | |
6aeb9e78 DS |
7771 | if (argc== 2) |
7772 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 7773 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
7774 | ||
7775 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7776 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7777 | } | |
7778 | ||
718e3744 | 7779 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
7780 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
7781 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
7782 | CLEAR_STR | |
7783 | IP_STR | |
7784 | BGP_STR | |
7785 | "Clear all peers\n" | |
7786 | "Address family\n" | |
7787 | "Address Family modifier\n" | |
7788 | "Address Family modifier\n" | |
e0bce756 DS |
7789 | BGP_SOFT_STR |
7790 | BGP_SOFT_IN_STR) | |
718e3744 | 7791 | { |
7792 | if (strncmp (argv[0], "m", 1) == 0) | |
7793 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7794 | BGP_CLEAR_SOFT_IN, NULL); | |
7795 | ||
7796 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7797 | BGP_CLEAR_SOFT_IN, NULL); | |
7798 | } | |
7799 | ||
718e3744 | 7800 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
7801 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
8386ac43 | 7802 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft in", |
718e3744 | 7803 | CLEAR_STR |
7804 | IP_STR | |
7805 | BGP_STR | |
8386ac43 | 7806 | BGP_INSTANCE_HELP_STR |
718e3744 | 7807 | "Clear all peers\n" |
7808 | "Address family\n" | |
7809 | "Address Family modifier\n" | |
7810 | "Address Family modifier\n" | |
e0bce756 DS |
7811 | BGP_SOFT_STR |
7812 | BGP_SOFT_IN_STR) | |
718e3744 | 7813 | { |
6aeb9e78 DS |
7814 | if (strncmp (argv[2], "m", 1) == 0) |
7815 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, | |
718e3744 | 7816 | BGP_CLEAR_SOFT_IN, NULL); |
7817 | ||
6aeb9e78 | 7818 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, |
718e3744 | 7819 | BGP_CLEAR_SOFT_IN, NULL); |
7820 | } | |
7821 | ||
01080f7c | 7822 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
7823 | clear_ip_bgp_all_ipv4_in_cmd, | |
7824 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
718e3744 | 7825 | CLEAR_STR |
7826 | IP_STR | |
7827 | BGP_STR | |
7828 | "Clear all peers\n" | |
7829 | "Address family\n" | |
7830 | "Address Family modifier\n" | |
7831 | "Address Family modifier\n" | |
01080f7c | 7832 | BGP_SOFT_IN_STR) |
718e3744 | 7833 | |
01080f7c | 7834 | ALIAS (clear_ip_bgp_instance_all_ipv4_soft_in, |
7835 | clear_ip_bgp_instance_all_ipv4_in_cmd, | |
7836 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) in", | |
7837 | CLEAR_STR | |
7838 | IP_STR | |
7839 | BGP_STR | |
7840 | BGP_INSTANCE_HELP_STR | |
7841 | "Clear all peers\n" | |
7842 | "Address family\n" | |
7843 | "Address Family modifier\n" | |
7844 | "Address Family modifier\n" | |
7845 | BGP_SOFT_IN_STR) | |
718e3744 | 7846 | |
01080f7c | 7847 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
7848 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
7849 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
718e3744 | 7850 | CLEAR_STR |
7851 | IP_STR | |
7852 | BGP_STR | |
7853 | "Clear all peers\n" | |
7854 | "Address family\n" | |
7855 | "Address Family modifier\n" | |
7856 | "Address Family modifier\n" | |
e0bce756 | 7857 | BGP_SOFT_IN_STR |
718e3744 | 7858 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7859 | { | |
01080f7c | 7860 | if (strncmp (argv[0], "m", 1) == 0) |
7861 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7862 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
718e3744 | 7863 | |
01080f7c | 7864 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
7865 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
718e3744 | 7866 | } |
7867 | ||
7868 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
7869 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
7870 | "clear ip bgp * vpnv4 unicast soft in", | |
7871 | CLEAR_STR | |
7872 | IP_STR | |
7873 | BGP_STR | |
7874 | "Clear all peers\n" | |
7875 | "Address family\n" | |
7876 | "Address Family Modifier\n" | |
e0bce756 DS |
7877 | BGP_SOFT_STR |
7878 | BGP_SOFT_IN_STR) | |
718e3744 | 7879 | { |
7880 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
7881 | BGP_CLEAR_SOFT_IN, NULL); | |
7882 | } | |
7883 | ||
7884 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
7885 | clear_ip_bgp_all_vpnv4_in_cmd, | |
7886 | "clear ip bgp * vpnv4 unicast in", | |
7887 | CLEAR_STR | |
7888 | IP_STR | |
7889 | BGP_STR | |
7890 | "Clear all peers\n" | |
7891 | "Address family\n" | |
7892 | "Address Family Modifier\n" | |
e0bce756 | 7893 | BGP_SOFT_IN_STR) |
718e3744 | 7894 | |
587ff0fd LB |
7895 | DEFUN (clear_ip_bgp_all_encap_soft_in, |
7896 | clear_ip_bgp_all_encap_soft_in_cmd, | |
7897 | "clear ip bgp * encap unicast soft in", | |
7898 | CLEAR_STR | |
7899 | IP_STR | |
7900 | BGP_STR | |
7901 | "Clear all peers\n" | |
7902 | "Address family\n" | |
7903 | "Address Family Modifier\n" | |
7904 | "Soft reconfig\n" | |
7905 | "Soft reconfig inbound update\n") | |
7906 | { | |
7907 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
7908 | BGP_CLEAR_SOFT_IN, NULL); | |
7909 | } | |
7910 | ||
7911 | ALIAS (clear_ip_bgp_all_encap_soft_in, | |
7912 | clear_ip_bgp_all_encap_in_cmd, | |
7913 | "clear ip bgp * encap unicast in", | |
7914 | CLEAR_STR | |
7915 | IP_STR | |
7916 | BGP_STR | |
7917 | "Clear all peers\n" | |
7918 | "Address family\n" | |
7919 | "Address Family Modifier\n" | |
7920 | "Soft reconfig inbound update\n") | |
7921 | ||
718e3744 | 7922 | DEFUN (clear_bgp_all_soft_in, |
7923 | clear_bgp_all_soft_in_cmd, | |
7924 | "clear bgp * soft in", | |
7925 | CLEAR_STR | |
7926 | BGP_STR | |
7927 | "Clear all peers\n" | |
e0bce756 DS |
7928 | BGP_SOFT_STR |
7929 | BGP_SOFT_IN_STR) | |
718e3744 | 7930 | { |
6aeb9e78 DS |
7931 | if (argc == 2) |
7932 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
718e3744 | 7933 | BGP_CLEAR_SOFT_IN, NULL); |
7934 | ||
7935 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7936 | BGP_CLEAR_SOFT_IN, NULL); | |
7937 | } | |
7938 | ||
7939 | ALIAS (clear_bgp_all_soft_in, | |
7940 | clear_bgp_instance_all_soft_in_cmd, | |
8386ac43 | 7941 | "clear bgp " BGP_INSTANCE_CMD " * soft in", |
718e3744 | 7942 | CLEAR_STR |
7943 | BGP_STR | |
8386ac43 | 7944 | BGP_INSTANCE_HELP_STR |
718e3744 | 7945 | "Clear all peers\n" |
e0bce756 DS |
7946 | BGP_SOFT_STR |
7947 | BGP_SOFT_IN_STR) | |
718e3744 | 7948 | |
7949 | ALIAS (clear_bgp_all_soft_in, | |
7950 | clear_bgp_ipv6_all_soft_in_cmd, | |
7951 | "clear bgp ipv6 * soft in", | |
7952 | CLEAR_STR | |
7953 | BGP_STR | |
7954 | "Address family\n" | |
7955 | "Clear all peers\n" | |
e0bce756 DS |
7956 | BGP_SOFT_STR |
7957 | BGP_SOFT_IN_STR) | |
718e3744 | 7958 | |
01080f7c | 7959 | ALIAS (clear_bgp_all_soft_in, |
7960 | clear_bgp_instance_ipv6_all_soft_in_cmd, | |
7961 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft in", | |
7962 | CLEAR_STR | |
7963 | BGP_STR | |
7964 | BGP_INSTANCE_HELP_STR | |
7965 | "Address family\n" | |
7966 | "Clear all peers\n" | |
7967 | BGP_SOFT_STR | |
7968 | BGP_SOFT_IN_STR) | |
7969 | ||
718e3744 | 7970 | ALIAS (clear_bgp_all_soft_in, |
7971 | clear_bgp_all_in_cmd, | |
7972 | "clear bgp * in", | |
7973 | CLEAR_STR | |
7974 | BGP_STR | |
7975 | "Clear all peers\n" | |
e0bce756 | 7976 | BGP_SOFT_IN_STR) |
718e3744 | 7977 | |
01080f7c | 7978 | ALIAS (clear_bgp_all_soft_in, |
7979 | clear_bgp_instance_all_in_cmd, | |
7980 | "clear bgp " BGP_INSTANCE_CMD " * in", | |
7981 | CLEAR_STR | |
7982 | BGP_STR | |
7983 | BGP_INSTANCE_HELP_STR | |
7984 | "Clear all peers\n" | |
7985 | BGP_SOFT_IN_STR) | |
7986 | ||
718e3744 | 7987 | ALIAS (clear_bgp_all_soft_in, |
7988 | clear_bgp_ipv6_all_in_cmd, | |
7989 | "clear bgp ipv6 * in", | |
7990 | CLEAR_STR | |
7991 | BGP_STR | |
7992 | "Address family\n" | |
7993 | "Clear all peers\n" | |
e0bce756 | 7994 | BGP_SOFT_IN_STR) |
718e3744 | 7995 | |
01080f7c | 7996 | ALIAS (clear_bgp_all_soft_in, |
7997 | clear_bgp_instance_ipv6_all_in_cmd, | |
7998 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * in", | |
7999 | CLEAR_STR | |
8000 | BGP_STR | |
8001 | BGP_INSTANCE_HELP_STR | |
8002 | "Address family\n" | |
8003 | "Clear all peers\n" | |
8004 | BGP_SOFT_IN_STR) | |
8005 | ||
718e3744 | 8006 | DEFUN (clear_bgp_all_in_prefix_filter, |
8007 | clear_bgp_all_in_prefix_filter_cmd, | |
8008 | "clear bgp * in prefix-filter", | |
8009 | CLEAR_STR | |
8010 | BGP_STR | |
8011 | "Clear all peers\n" | |
e0bce756 | 8012 | BGP_SOFT_IN_STR |
718e3744 | 8013 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8014 | { | |
8015 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
8016 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8017 | } | |
8018 | ||
8019 | ALIAS (clear_bgp_all_in_prefix_filter, | |
8020 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
8021 | "clear bgp ipv6 * in prefix-filter", | |
8022 | CLEAR_STR | |
8023 | BGP_STR | |
8024 | "Address family\n" | |
8025 | "Clear all peers\n" | |
e0bce756 | 8026 | BGP_SOFT_IN_STR |
718e3744 | 8027 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8028 | ||
8029 | DEFUN (clear_ip_bgp_peer_soft_in, | |
8030 | clear_ip_bgp_peer_soft_in_cmd, | |
db64ea86 | 8031 | "clear ip bgp (A.B.C.D|WORD) soft in", |
718e3744 | 8032 | CLEAR_STR |
8033 | IP_STR | |
8034 | BGP_STR | |
8035 | "BGP neighbor address to clear\n" | |
db64ea86 | 8036 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
8037 | BGP_SOFT_STR |
8038 | BGP_SOFT_IN_STR) | |
718e3744 | 8039 | { |
01080f7c | 8040 | if (argc == 3) |
8041 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
8042 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8043 | ||
718e3744 | 8044 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
8045 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8046 | } | |
8047 | ||
01080f7c | 8048 | ALIAS (clear_ip_bgp_peer_soft_in, |
8049 | clear_ip_bgp_instance_peer_soft_in_cmd, | |
8050 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft in", | |
8051 | CLEAR_STR | |
8052 | IP_STR | |
8053 | BGP_STR | |
8054 | BGP_INSTANCE_HELP_STR | |
8055 | "BGP neighbor address to clear\n" | |
8056 | "BGP neighbor on interface to clear\n" | |
8057 | BGP_SOFT_STR | |
8058 | BGP_SOFT_IN_STR) | |
8059 | ||
718e3744 | 8060 | ALIAS (clear_ip_bgp_peer_soft_in, |
8061 | clear_ip_bgp_peer_in_cmd, | |
db64ea86 | 8062 | "clear ip bgp (A.B.C.D|WORD) in", |
718e3744 | 8063 | CLEAR_STR |
8064 | IP_STR | |
8065 | BGP_STR | |
8066 | "BGP neighbor address to clear\n" | |
db64ea86 | 8067 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8068 | BGP_SOFT_IN_STR) |
01080f7c | 8069 | |
8070 | ALIAS (clear_ip_bgp_peer_soft_in, | |
8071 | clear_ip_bgp_instance_peer_in_cmd, | |
8072 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) in", | |
8073 | CLEAR_STR | |
8074 | IP_STR | |
8075 | BGP_STR | |
8076 | BGP_INSTANCE_HELP_STR | |
8077 | "BGP neighbor address to clear\n" | |
8078 | "BGP neighbor on interface to clear\n" | |
8079 | BGP_SOFT_IN_STR) | |
8080 | ||
718e3744 | 8081 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
8082 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
db64ea86 | 8083 | "clear ip bgp (A.B.C.D|WORD) in prefix-filter", |
718e3744 | 8084 | CLEAR_STR |
8085 | IP_STR | |
8086 | BGP_STR | |
8087 | "BGP neighbor address to clear\n" | |
db64ea86 | 8088 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8089 | BGP_SOFT_IN_STR |
718e3744 | 8090 | "Push out the existing ORF prefix-list\n") |
8091 | { | |
8092 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8093 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8094 | } | |
8095 | ||
8096 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
8097 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
db64ea86 | 8098 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", |
718e3744 | 8099 | CLEAR_STR |
8100 | IP_STR | |
8101 | BGP_STR | |
8102 | "BGP neighbor address to clear\n" | |
db64ea86 | 8103 | "BGP neighbor on interface to clear\n" |
718e3744 | 8104 | "Address family\n" |
8105 | "Address Family modifier\n" | |
8106 | "Address Family modifier\n" | |
e0bce756 DS |
8107 | BGP_SOFT_STR |
8108 | BGP_SOFT_IN_STR) | |
718e3744 | 8109 | { |
8110 | if (strncmp (argv[1], "m", 1) == 0) | |
8111 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
8112 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8113 | ||
8114 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8115 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8116 | } | |
8117 | ||
01080f7c | 8118 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, |
8119 | clear_ip_bgp_instance_peer_ipv4_soft_in_cmd, | |
8120 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", | |
8121 | CLEAR_STR | |
8122 | IP_STR | |
8123 | BGP_STR | |
8124 | BGP_INSTANCE_HELP_STR | |
8125 | "BGP neighbor address to clear\n" | |
8126 | "BGP neighbor on interface to clear\n" | |
8127 | "Address family\n" | |
8128 | "Address Family modifier\n" | |
8129 | "Address Family modifier\n" | |
8130 | BGP_SOFT_STR | |
8131 | BGP_SOFT_IN_STR) | |
8132 | { | |
8133 | if (strncmp (argv[3], "m", 1) == 0) | |
8134 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, | |
8135 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8136 | ||
8137 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
8138 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8139 | } | |
8140 | ||
718e3744 | 8141 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
8142 | clear_ip_bgp_peer_ipv4_in_cmd, | |
db64ea86 | 8143 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in", |
718e3744 | 8144 | CLEAR_STR |
8145 | IP_STR | |
8146 | BGP_STR | |
8147 | "BGP neighbor address to clear\n" | |
db64ea86 | 8148 | "BGP neighbor on interface to clear\n" |
718e3744 | 8149 | "Address family\n" |
8150 | "Address Family modifier\n" | |
8151 | "Address Family modifier\n" | |
e0bce756 | 8152 | BGP_SOFT_IN_STR) |
718e3744 | 8153 | |
01080f7c | 8154 | ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_in, |
8155 | clear_ip_bgp_instance_peer_ipv4_in_cmd, | |
8156 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) in", | |
8157 | CLEAR_STR | |
8158 | IP_STR | |
8159 | BGP_STR | |
8160 | BGP_INSTANCE_HELP_STR | |
8161 | "BGP neighbor address to clear\n" | |
8162 | "BGP neighbor on interface to clear\n" | |
8163 | "Address family\n" | |
8164 | "Address Family modifier\n" | |
8165 | "Address Family modifier\n" | |
8166 | BGP_SOFT_IN_STR) | |
8167 | ||
718e3744 | 8168 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
8169 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
db64ea86 | 8170 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 8171 | CLEAR_STR |
8172 | IP_STR | |
8173 | BGP_STR | |
8174 | "BGP neighbor address to clear\n" | |
db64ea86 | 8175 | "BGP neighbor on interface to clear\n" |
718e3744 | 8176 | "Address family\n" |
8177 | "Address Family modifier\n" | |
8178 | "Address Family modifier\n" | |
e0bce756 | 8179 | BGP_SOFT_IN_STR |
718e3744 | 8180 | "Push out the existing ORF prefix-list\n") |
8181 | { | |
8182 | if (strncmp (argv[1], "m", 1) == 0) | |
8183 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
8184 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8185 | ||
8186 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8187 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8188 | } | |
8189 | ||
8190 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
8191 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
db64ea86 | 8192 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in", |
718e3744 | 8193 | CLEAR_STR |
8194 | IP_STR | |
8195 | BGP_STR | |
8196 | "BGP neighbor address to clear\n" | |
db64ea86 | 8197 | "BGP neighbor on interface to clear\n" |
718e3744 | 8198 | "Address family\n" |
8199 | "Address Family Modifier\n" | |
e0bce756 DS |
8200 | BGP_SOFT_STR |
8201 | BGP_SOFT_IN_STR) | |
718e3744 | 8202 | { |
8203 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
8204 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8205 | } | |
8206 | ||
8207 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
8208 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
db64ea86 | 8209 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in", |
718e3744 | 8210 | CLEAR_STR |
8211 | IP_STR | |
8212 | BGP_STR | |
8213 | "BGP neighbor address to clear\n" | |
db64ea86 | 8214 | "BGP neighbor on interface to clear\n" |
718e3744 | 8215 | "Address family\n" |
8216 | "Address Family Modifier\n" | |
e0bce756 | 8217 | BGP_SOFT_IN_STR) |
718e3744 | 8218 | |
587ff0fd LB |
8219 | DEFUN (clear_ip_bgp_peer_encap_soft_in, |
8220 | clear_ip_bgp_peer_encap_soft_in_cmd, | |
8221 | "clear ip bgp A.B.C.D encap unicast soft in", | |
8222 | CLEAR_STR | |
8223 | IP_STR | |
8224 | BGP_STR | |
8225 | "BGP neighbor address to clear\n" | |
8226 | "Address family\n" | |
8227 | "Address Family Modifier\n" | |
8228 | "Soft reconfig\n" | |
8229 | "Soft reconfig inbound update\n") | |
8230 | { | |
8231 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
8232 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8233 | } | |
8234 | ||
8235 | ALIAS (clear_ip_bgp_peer_encap_soft_in, | |
8236 | clear_ip_bgp_peer_encap_in_cmd, | |
8237 | "clear ip bgp A.B.C.D encap unicast in", | |
8238 | CLEAR_STR | |
8239 | IP_STR | |
8240 | BGP_STR | |
8241 | "BGP neighbor address to clear\n" | |
8242 | "Address family\n" | |
8243 | "Address Family Modifier\n" | |
8244 | "Soft reconfig inbound update\n") | |
8245 | ||
718e3744 | 8246 | DEFUN (clear_bgp_peer_soft_in, |
8247 | clear_bgp_peer_soft_in_cmd, | |
a80beece | 8248 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 8249 | CLEAR_STR |
8250 | BGP_STR | |
8251 | "BGP neighbor address to clear\n" | |
8252 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8253 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
8254 | BGP_SOFT_STR |
8255 | BGP_SOFT_IN_STR) | |
718e3744 | 8256 | { |
01080f7c | 8257 | if (argc == 3) |
8258 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
8259 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8260 | ||
718e3744 | 8261 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
8262 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8263 | } | |
8264 | ||
01080f7c | 8265 | ALIAS (clear_bgp_peer_soft_in, |
8266 | clear_bgp_instance_peer_soft_in_cmd, | |
8267 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft in", | |
8268 | CLEAR_STR | |
8269 | BGP_STR | |
8270 | BGP_INSTANCE_HELP_STR | |
8271 | "BGP neighbor address to clear\n" | |
8272 | "BGP IPv6 neighbor to clear\n" | |
8273 | "BGP neighbor on interface to clear\n" | |
8274 | BGP_SOFT_STR | |
8275 | BGP_SOFT_IN_STR) | |
8276 | ||
718e3744 | 8277 | ALIAS (clear_bgp_peer_soft_in, |
8278 | clear_bgp_ipv6_peer_soft_in_cmd, | |
a80beece | 8279 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 8280 | CLEAR_STR |
8281 | BGP_STR | |
8282 | "Address family\n" | |
8283 | "BGP neighbor address to clear\n" | |
8284 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8285 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
8286 | BGP_SOFT_STR |
8287 | BGP_SOFT_IN_STR) | |
718e3744 | 8288 | |
01080f7c | 8289 | ALIAS (clear_bgp_peer_soft_in, |
8290 | clear_bgp_instance_ipv6_peer_soft_in_cmd, | |
8291 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", | |
8292 | CLEAR_STR | |
8293 | BGP_STR | |
8294 | BGP_INSTANCE_HELP_STR | |
8295 | "Address family\n" | |
8296 | "BGP neighbor address to clear\n" | |
8297 | "BGP IPv6 neighbor to clear\n" | |
8298 | "BGP neighbor on interface to clear\n" | |
8299 | BGP_SOFT_STR | |
8300 | BGP_SOFT_IN_STR) | |
8301 | ||
718e3744 | 8302 | ALIAS (clear_bgp_peer_soft_in, |
8303 | clear_bgp_peer_in_cmd, | |
a80beece | 8304 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 8305 | CLEAR_STR |
8306 | BGP_STR | |
8307 | "BGP neighbor address to clear\n" | |
8308 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8309 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8310 | BGP_SOFT_IN_STR) |
718e3744 | 8311 | |
01080f7c | 8312 | ALIAS (clear_bgp_peer_soft_in, |
8313 | clear_bgp_instance_peer_in_cmd, | |
8314 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) in", | |
8315 | CLEAR_STR | |
8316 | BGP_STR | |
8317 | BGP_INSTANCE_HELP_STR | |
8318 | "BGP neighbor address to clear\n" | |
8319 | "BGP IPv6 neighbor to clear\n" | |
8320 | "BGP neighbor on interface to clear\n" | |
8321 | BGP_SOFT_IN_STR) | |
8322 | ||
718e3744 | 8323 | ALIAS (clear_bgp_peer_soft_in, |
8324 | clear_bgp_ipv6_peer_in_cmd, | |
a80beece | 8325 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 8326 | CLEAR_STR |
8327 | BGP_STR | |
8328 | "Address family\n" | |
8329 | "BGP neighbor address to clear\n" | |
8330 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8331 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8332 | BGP_SOFT_IN_STR) |
718e3744 | 8333 | |
01080f7c | 8334 | ALIAS (clear_bgp_peer_soft_in, |
8335 | clear_bgp_instance_ipv6_peer_in_cmd, | |
8336 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) in", | |
8337 | CLEAR_STR | |
8338 | BGP_STR | |
8339 | BGP_INSTANCE_HELP_STR | |
8340 | "Address family\n" | |
8341 | "BGP neighbor address to clear\n" | |
8342 | "BGP IPv6 neighbor to clear\n" | |
8343 | "BGP neighbor on interface to clear\n" | |
8344 | BGP_SOFT_IN_STR) | |
8345 | ||
718e3744 | 8346 | DEFUN (clear_bgp_peer_in_prefix_filter, |
8347 | clear_bgp_peer_in_prefix_filter_cmd, | |
a80beece | 8348 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 8349 | CLEAR_STR |
8350 | BGP_STR | |
8351 | "BGP neighbor address to clear\n" | |
8352 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8353 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8354 | BGP_SOFT_IN_STR |
718e3744 | 8355 | "Push out the existing ORF prefix-list\n") |
8356 | { | |
8357 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
8358 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8359 | } | |
8360 | ||
8361 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
8362 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
a80beece | 8363 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 8364 | CLEAR_STR |
8365 | BGP_STR | |
8366 | "Address family\n" | |
8367 | "BGP neighbor address to clear\n" | |
8368 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8369 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8370 | BGP_SOFT_IN_STR |
718e3744 | 8371 | "Push out the existing ORF prefix-list\n") |
8372 | ||
8373 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
8374 | clear_ip_bgp_peer_group_soft_in_cmd, | |
8375 | "clear ip bgp peer-group WORD soft in", | |
8376 | CLEAR_STR | |
8377 | IP_STR | |
8378 | BGP_STR | |
8379 | "Clear all members of peer-group\n" | |
8380 | "BGP peer-group name\n" | |
e0bce756 DS |
8381 | BGP_SOFT_STR |
8382 | BGP_SOFT_IN_STR) | |
718e3744 | 8383 | { |
01080f7c | 8384 | if (argc == 3) |
8385 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
8386 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8387 | ||
718e3744 | 8388 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
8389 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8390 | } | |
8391 | ||
01080f7c | 8392 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
8393 | clear_ip_bgp_instance_peer_group_soft_in_cmd, | |
8394 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", | |
8395 | CLEAR_STR | |
8396 | IP_STR | |
8397 | BGP_STR | |
8398 | BGP_INSTANCE_HELP_STR | |
8399 | "Clear all members of peer-group\n" | |
8400 | "BGP peer-group name\n" | |
8401 | BGP_SOFT_STR | |
8402 | BGP_SOFT_IN_STR) | |
8403 | ||
718e3744 | 8404 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
8405 | clear_ip_bgp_peer_group_in_cmd, | |
8406 | "clear ip bgp peer-group WORD in", | |
8407 | CLEAR_STR | |
8408 | IP_STR | |
8409 | BGP_STR | |
8410 | "Clear all members of peer-group\n" | |
8411 | "BGP peer-group name\n" | |
e0bce756 | 8412 | BGP_SOFT_IN_STR) |
718e3744 | 8413 | |
01080f7c | 8414 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
8415 | clear_ip_bgp_instance_peer_group_in_cmd, | |
8416 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD in", | |
8417 | CLEAR_STR | |
8418 | IP_STR | |
8419 | BGP_STR | |
8420 | BGP_INSTANCE_HELP_STR | |
8421 | "Clear all members of peer-group\n" | |
8422 | "BGP peer-group name\n" | |
8423 | BGP_SOFT_IN_STR) | |
8424 | ||
718e3744 | 8425 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
8426 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
8427 | "clear ip bgp peer-group WORD in prefix-filter", | |
8428 | CLEAR_STR | |
8429 | IP_STR | |
8430 | BGP_STR | |
8431 | "Clear all members of peer-group\n" | |
8432 | "BGP peer-group name\n" | |
e0bce756 | 8433 | BGP_SOFT_IN_STR |
718e3744 | 8434 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8435 | { | |
8436 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
8437 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8438 | } | |
8439 | ||
8440 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
8441 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
8442 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
8443 | CLEAR_STR | |
8444 | IP_STR | |
8445 | BGP_STR | |
8446 | "Clear all members of peer-group\n" | |
8447 | "BGP peer-group name\n" | |
8448 | "Address family\n" | |
8449 | "Address Family modifier\n" | |
8450 | "Address Family modifier\n" | |
e0bce756 DS |
8451 | BGP_SOFT_STR |
8452 | BGP_SOFT_IN_STR) | |
718e3744 | 8453 | { |
8454 | if (strncmp (argv[1], "m", 1) == 0) | |
8455 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
8456 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8457 | ||
8458 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
8459 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8460 | } | |
8461 | ||
01080f7c | 8462 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, |
8463 | clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd, | |
8464 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft in", | |
8465 | CLEAR_STR | |
8466 | IP_STR | |
8467 | BGP_STR | |
8468 | BGP_INSTANCE_HELP_STR | |
8469 | "Clear all members of peer-group\n" | |
8470 | "BGP peer-group name\n" | |
8471 | "Address family\n" | |
8472 | "Address Family modifier\n" | |
8473 | "Address Family modifier\n" | |
8474 | BGP_SOFT_STR | |
8475 | BGP_SOFT_IN_STR) | |
8476 | { | |
8477 | if (strncmp (argv[3], "m", 1) == 0) | |
8478 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, | |
8479 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8480 | ||
8481 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
8482 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8483 | } | |
8484 | ||
718e3744 | 8485 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
8486 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
8487 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
8488 | CLEAR_STR | |
8489 | IP_STR | |
8490 | BGP_STR | |
8491 | "Clear all members of peer-group\n" | |
8492 | "BGP peer-group name\n" | |
8493 | "Address family\n" | |
8494 | "Address Family modifier\n" | |
8495 | "Address Family modifier\n" | |
e0bce756 | 8496 | BGP_SOFT_IN_STR) |
718e3744 | 8497 | |
01080f7c | 8498 | ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_in, |
8499 | clear_ip_bgp_instance_peer_group_ipv4_in_cmd, | |
8500 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) in", | |
8501 | CLEAR_STR | |
8502 | IP_STR | |
8503 | BGP_STR | |
8504 | BGP_INSTANCE_HELP_STR | |
8505 | "Clear all members of peer-group\n" | |
8506 | "BGP peer-group name\n" | |
8507 | "Address family\n" | |
8508 | "Address Family modifier\n" | |
8509 | "Address Family modifier\n" | |
8510 | BGP_SOFT_IN_STR) | |
8511 | ||
718e3744 | 8512 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
8513 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
8514 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
8515 | CLEAR_STR | |
8516 | IP_STR | |
8517 | BGP_STR | |
8518 | "Clear all members of peer-group\n" | |
8519 | "BGP peer-group name\n" | |
8520 | "Address family\n" | |
8521 | "Address Family modifier\n" | |
8522 | "Address Family modifier\n" | |
e0bce756 | 8523 | BGP_SOFT_IN_STR |
718e3744 | 8524 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8525 | { | |
8526 | if (strncmp (argv[1], "m", 1) == 0) | |
8527 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
8528 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8529 | ||
8530 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
8531 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8532 | } | |
8533 | ||
8534 | DEFUN (clear_bgp_peer_group_soft_in, | |
8535 | clear_bgp_peer_group_soft_in_cmd, | |
8536 | "clear bgp peer-group WORD soft in", | |
8537 | CLEAR_STR | |
8538 | BGP_STR | |
8539 | "Clear all members of peer-group\n" | |
8540 | "BGP peer-group name\n" | |
e0bce756 DS |
8541 | BGP_SOFT_STR |
8542 | BGP_SOFT_IN_STR) | |
718e3744 | 8543 | { |
01080f7c | 8544 | if (argc == 3) |
8545 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
8546 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8547 | ||
718e3744 | 8548 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
8549 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8550 | } | |
8551 | ||
01080f7c | 8552 | ALIAS (clear_bgp_peer_group_soft_in, |
8553 | clear_bgp_instance_peer_group_soft_in_cmd, | |
8554 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", | |
8555 | CLEAR_STR | |
8556 | BGP_STR | |
8557 | BGP_INSTANCE_HELP_STR | |
8558 | "Clear all members of peer-group\n" | |
8559 | "BGP peer-group name\n" | |
8560 | BGP_SOFT_STR | |
8561 | BGP_SOFT_IN_STR) | |
8562 | ||
718e3744 | 8563 | ALIAS (clear_bgp_peer_group_soft_in, |
8564 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
8565 | "clear bgp ipv6 peer-group WORD soft in", | |
8566 | CLEAR_STR | |
8567 | BGP_STR | |
8568 | "Address family\n" | |
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 | ALIAS (clear_bgp_peer_group_soft_in, |
8575 | clear_bgp_instance_ipv6_peer_group_soft_in_cmd, | |
8576 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft in", | |
8577 | CLEAR_STR | |
8578 | BGP_STR | |
8579 | BGP_INSTANCE_HELP_STR | |
8580 | "Address family\n" | |
8581 | "Clear all members of peer-group\n" | |
8582 | "BGP peer-group name\n" | |
8583 | BGP_SOFT_STR | |
8584 | BGP_SOFT_IN_STR) | |
8585 | ||
718e3744 | 8586 | ALIAS (clear_bgp_peer_group_soft_in, |
8587 | clear_bgp_peer_group_in_cmd, | |
8588 | "clear bgp peer-group WORD in", | |
8589 | CLEAR_STR | |
8590 | BGP_STR | |
8591 | "Clear all members of peer-group\n" | |
8592 | "BGP peer-group name\n" | |
e0bce756 | 8593 | BGP_SOFT_IN_STR) |
718e3744 | 8594 | |
01080f7c | 8595 | ALIAS (clear_bgp_peer_group_soft_in, |
8596 | clear_bgp_instance_peer_group_in_cmd, | |
8597 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD in", | |
8598 | CLEAR_STR | |
8599 | BGP_STR | |
8600 | BGP_INSTANCE_HELP_STR | |
8601 | "Clear all members of peer-group\n" | |
8602 | "BGP peer-group name\n" | |
8603 | BGP_SOFT_IN_STR) | |
8604 | ||
718e3744 | 8605 | ALIAS (clear_bgp_peer_group_soft_in, |
8606 | clear_bgp_ipv6_peer_group_in_cmd, | |
8607 | "clear bgp ipv6 peer-group WORD in", | |
8608 | CLEAR_STR | |
8609 | BGP_STR | |
8610 | "Address family\n" | |
8611 | "Clear all members of peer-group\n" | |
8612 | "BGP peer-group name\n" | |
e0bce756 | 8613 | BGP_SOFT_IN_STR) |
718e3744 | 8614 | |
01080f7c | 8615 | ALIAS (clear_bgp_peer_group_soft_in, |
8616 | clear_bgp_instance_ipv6_peer_group_in_cmd, | |
8617 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD in", | |
8618 | CLEAR_STR | |
8619 | BGP_STR | |
8620 | BGP_INSTANCE_HELP_STR | |
8621 | "Address family\n" | |
8622 | "Clear all members of peer-group\n" | |
8623 | "BGP peer-group name\n" | |
8624 | BGP_SOFT_IN_STR) | |
8625 | ||
718e3744 | 8626 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
8627 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
8628 | "clear bgp peer-group WORD in prefix-filter", | |
8629 | CLEAR_STR | |
8630 | BGP_STR | |
8631 | "Clear all members of peer-group\n" | |
8632 | "BGP peer-group name\n" | |
e0bce756 | 8633 | BGP_SOFT_IN_STR |
718e3744 | 8634 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8635 | { | |
8636 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
8637 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8638 | } | |
8639 | ||
8640 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
8641 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
8642 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
8643 | CLEAR_STR | |
8644 | BGP_STR | |
8645 | "Address family\n" | |
8646 | "Clear all members of peer-group\n" | |
8647 | "BGP peer-group name\n" | |
e0bce756 | 8648 | BGP_SOFT_IN_STR |
718e3744 | 8649 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8650 | ||
8651 | DEFUN (clear_ip_bgp_external_soft_in, | |
8652 | clear_ip_bgp_external_soft_in_cmd, | |
8653 | "clear ip bgp external soft in", | |
8654 | CLEAR_STR | |
8655 | IP_STR | |
8656 | BGP_STR | |
8657 | "Clear all external peers\n" | |
e0bce756 DS |
8658 | BGP_SOFT_STR |
8659 | BGP_SOFT_IN_STR) | |
718e3744 | 8660 | { |
01080f7c | 8661 | if (argc == 2) |
8662 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
8663 | BGP_CLEAR_SOFT_IN, NULL); | |
8664 | ||
718e3744 | 8665 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
8666 | BGP_CLEAR_SOFT_IN, NULL); | |
8667 | } | |
8668 | ||
01080f7c | 8669 | ALIAS (clear_ip_bgp_external_soft_in, |
8670 | clear_ip_bgp_instance_external_soft_in_cmd, | |
8671 | "clear ip bgp " BGP_INSTANCE_CMD " external soft in", | |
8672 | CLEAR_STR | |
8673 | IP_STR | |
8674 | BGP_STR | |
8675 | BGP_INSTANCE_HELP_STR | |
8676 | "Clear all external peers\n" | |
8677 | BGP_SOFT_STR | |
8678 | BGP_SOFT_IN_STR) | |
8679 | ||
718e3744 | 8680 | ALIAS (clear_ip_bgp_external_soft_in, |
8681 | clear_ip_bgp_external_in_cmd, | |
8682 | "clear ip bgp external in", | |
8683 | CLEAR_STR | |
8684 | IP_STR | |
8685 | BGP_STR | |
8686 | "Clear all external peers\n" | |
e0bce756 | 8687 | BGP_SOFT_IN_STR) |
718e3744 | 8688 | |
01080f7c | 8689 | ALIAS (clear_ip_bgp_external_soft_in, |
8690 | clear_ip_bgp_instance_external_in_cmd, | |
8691 | "clear ip bgp " BGP_INSTANCE_CMD " external in", | |
8692 | CLEAR_STR | |
8693 | IP_STR | |
8694 | BGP_STR | |
8695 | BGP_INSTANCE_HELP_STR | |
8696 | "Clear all external peers\n" | |
8697 | BGP_SOFT_IN_STR) | |
8698 | ||
718e3744 | 8699 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
8700 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
8701 | "clear ip bgp external in prefix-filter", | |
8702 | CLEAR_STR | |
8703 | IP_STR | |
8704 | BGP_STR | |
8705 | "Clear all external peers\n" | |
e0bce756 | 8706 | BGP_SOFT_IN_STR |
718e3744 | 8707 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8708 | { | |
8709 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8710 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8711 | } | |
8712 | ||
8713 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
8714 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
8715 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
8716 | CLEAR_STR | |
8717 | IP_STR | |
8718 | BGP_STR | |
8719 | "Clear all external peers\n" | |
8720 | "Address family\n" | |
8721 | "Address Family modifier\n" | |
8722 | "Address Family modifier\n" | |
e0bce756 DS |
8723 | BGP_SOFT_STR |
8724 | BGP_SOFT_IN_STR) | |
718e3744 | 8725 | { |
8726 | if (strncmp (argv[0], "m", 1) == 0) | |
8727 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
8728 | BGP_CLEAR_SOFT_IN, NULL); | |
8729 | ||
8730 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8731 | BGP_CLEAR_SOFT_IN, NULL); | |
8732 | } | |
8733 | ||
01080f7c | 8734 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, |
8735 | clear_ip_bgp_instance_external_ipv4_soft_in_cmd, | |
8736 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft in", | |
8737 | CLEAR_STR | |
8738 | IP_STR | |
8739 | BGP_STR | |
8740 | BGP_INSTANCE_HELP_STR | |
8741 | "Clear all external peers\n" | |
8742 | "Address family\n" | |
8743 | "Address Family modifier\n" | |
8744 | "Address Family modifier\n" | |
8745 | BGP_SOFT_STR | |
8746 | BGP_SOFT_IN_STR) | |
8747 | { | |
8748 | if (strncmp (argv[2], "m", 1) == 0) | |
8749 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, | |
8750 | BGP_CLEAR_SOFT_IN, NULL); | |
8751 | ||
8752 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
8753 | BGP_CLEAR_SOFT_IN, NULL); | |
8754 | } | |
8755 | ||
718e3744 | 8756 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
8757 | clear_ip_bgp_external_ipv4_in_cmd, | |
8758 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
8759 | CLEAR_STR | |
8760 | IP_STR | |
8761 | BGP_STR | |
8762 | "Clear all external peers\n" | |
8763 | "Address family\n" | |
8764 | "Address Family modifier\n" | |
8765 | "Address Family modifier\n" | |
e0bce756 | 8766 | BGP_SOFT_IN_STR) |
718e3744 | 8767 | |
01080f7c | 8768 | ALIAS (clear_ip_bgp_instance_external_ipv4_soft_in, |
8769 | clear_ip_bgp_instance_external_ipv4_in_cmd, | |
8770 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) in", | |
8771 | CLEAR_STR | |
8772 | IP_STR | |
8773 | BGP_STR | |
8774 | BGP_INSTANCE_HELP_STR | |
8775 | "Clear all external peers\n" | |
8776 | "Address family\n" | |
8777 | "Address Family modifier\n" | |
8778 | "Address Family modifier\n" | |
8779 | BGP_SOFT_IN_STR) | |
8780 | ||
718e3744 | 8781 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
8782 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
8783 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
8784 | CLEAR_STR | |
8785 | IP_STR | |
8786 | BGP_STR | |
8787 | "Clear all external peers\n" | |
8788 | "Address family\n" | |
8789 | "Address Family modifier\n" | |
8790 | "Address Family modifier\n" | |
e0bce756 | 8791 | BGP_SOFT_IN_STR |
718e3744 | 8792 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8793 | { | |
8794 | if (strncmp (argv[0], "m", 1) == 0) | |
8795 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
8796 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8797 | ||
8798 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8799 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8800 | } | |
8801 | ||
8802 | DEFUN (clear_bgp_external_soft_in, | |
8803 | clear_bgp_external_soft_in_cmd, | |
8804 | "clear bgp external soft in", | |
8805 | CLEAR_STR | |
8806 | BGP_STR | |
8807 | "Clear all external peers\n" | |
e0bce756 DS |
8808 | BGP_SOFT_STR |
8809 | BGP_SOFT_IN_STR) | |
718e3744 | 8810 | { |
01080f7c | 8811 | if (argc == 2) |
8812 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
8813 | BGP_CLEAR_SOFT_IN, NULL); | |
8814 | ||
718e3744 | 8815 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
8816 | BGP_CLEAR_SOFT_IN, NULL); | |
8817 | } | |
8818 | ||
01080f7c | 8819 | ALIAS (clear_bgp_external_soft_in, |
8820 | clear_bgp_instance_external_soft_in_cmd, | |
8821 | "clear bgp " BGP_INSTANCE_CMD " external soft in", | |
8822 | CLEAR_STR | |
8823 | BGP_STR | |
8824 | BGP_INSTANCE_HELP_STR | |
8825 | "Clear all external peers\n" | |
8826 | BGP_SOFT_STR | |
8827 | BGP_SOFT_IN_STR) | |
8828 | ||
718e3744 | 8829 | ALIAS (clear_bgp_external_soft_in, |
8830 | clear_bgp_ipv6_external_soft_in_cmd, | |
8831 | "clear bgp ipv6 external soft in", | |
8832 | CLEAR_STR | |
8833 | BGP_STR | |
8834 | "Address family\n" | |
8835 | "Clear all external peers\n" | |
e0bce756 DS |
8836 | BGP_SOFT_STR |
8837 | BGP_SOFT_IN_STR) | |
718e3744 | 8838 | |
01080f7c | 8839 | ALIAS (clear_bgp_external_soft_in, |
8840 | clear_bgp_instance_ipv6_external_soft_in_cmd, | |
8841 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft in", | |
8842 | CLEAR_STR | |
8843 | BGP_STR | |
8844 | BGP_INSTANCE_HELP_STR | |
8845 | "Address family\n" | |
8846 | "Clear all external peers\n" | |
8847 | BGP_SOFT_STR | |
8848 | BGP_SOFT_IN_STR) | |
8849 | ||
718e3744 | 8850 | ALIAS (clear_bgp_external_soft_in, |
8851 | clear_bgp_external_in_cmd, | |
8852 | "clear bgp external in", | |
8853 | CLEAR_STR | |
8854 | BGP_STR | |
8855 | "Clear all external peers\n" | |
e0bce756 | 8856 | BGP_SOFT_IN_STR) |
718e3744 | 8857 | |
01080f7c | 8858 | ALIAS (clear_bgp_external_soft_in, |
8859 | clear_bgp_instance_external_in_cmd, | |
8860 | "clear bgp " BGP_INSTANCE_CMD " external in", | |
8861 | CLEAR_STR | |
8862 | BGP_STR | |
8863 | BGP_INSTANCE_HELP_STR | |
8864 | "Clear all external peers\n" | |
8865 | BGP_SOFT_IN_STR) | |
8866 | ||
718e3744 | 8867 | ALIAS (clear_bgp_external_soft_in, |
8868 | clear_bgp_ipv6_external_in_cmd, | |
8869 | "clear bgp ipv6 external WORD in", | |
8870 | CLEAR_STR | |
8871 | BGP_STR | |
8872 | "Address family\n" | |
8873 | "Clear all external peers\n" | |
e0bce756 | 8874 | BGP_SOFT_IN_STR) |
718e3744 | 8875 | |
01080f7c | 8876 | ALIAS (clear_bgp_external_soft_in, |
8877 | clear_bgp_instance_ipv6_external_in_cmd, | |
8878 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD in", | |
8879 | CLEAR_STR | |
8880 | BGP_STR | |
8881 | BGP_INSTANCE_HELP_STR | |
8882 | "Address family\n" | |
8883 | "Clear all external peers\n" | |
8884 | BGP_SOFT_IN_STR) | |
8885 | ||
718e3744 | 8886 | DEFUN (clear_bgp_external_in_prefix_filter, |
8887 | clear_bgp_external_in_prefix_filter_cmd, | |
8888 | "clear bgp external in prefix-filter", | |
8889 | CLEAR_STR | |
8890 | BGP_STR | |
8891 | "Clear all external peers\n" | |
e0bce756 | 8892 | BGP_SOFT_IN_STR |
718e3744 | 8893 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8894 | { | |
8895 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
8896 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8897 | } | |
8898 | ||
8899 | ALIAS (clear_bgp_external_in_prefix_filter, | |
8900 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
8901 | "clear bgp ipv6 external in prefix-filter", | |
8902 | CLEAR_STR | |
8903 | BGP_STR | |
8904 | "Address family\n" | |
8905 | "Clear all external peers\n" | |
e0bce756 | 8906 | BGP_SOFT_IN_STR |
718e3744 | 8907 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8908 | ||
8909 | DEFUN (clear_ip_bgp_as_soft_in, | |
8910 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 8911 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 8912 | CLEAR_STR |
8913 | IP_STR | |
8914 | BGP_STR | |
8915 | "Clear peers with the AS number\n" | |
e0bce756 DS |
8916 | BGP_SOFT_STR |
8917 | BGP_SOFT_IN_STR) | |
718e3744 | 8918 | { |
01080f7c | 8919 | if (argc == 3) |
8920 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
8921 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8922 | ||
718e3744 | 8923 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
8924 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8925 | } | |
8926 | ||
8927 | ALIAS (clear_ip_bgp_as_soft_in, | |
01080f7c | 8928 | clear_ip_bgp_instance_as_soft_in_cmd, |
8929 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", | |
8930 | CLEAR_STR | |
8931 | IP_STR | |
8932 | BGP_STR | |
8933 | BGP_INSTANCE_HELP_STR | |
8934 | "Clear peers with the AS number\n" | |
8935 | BGP_SOFT_STR | |
8936 | BGP_SOFT_IN_STR) | |
8937 | ||
8938 | ALIAS (clear_ip_bgp_as_soft_in, | |
8939 | clear_ip_bgp_as_in_cmd, | |
8940 | "clear ip bgp " CMD_AS_RANGE " in", | |
8941 | CLEAR_STR | |
8942 | IP_STR | |
8943 | BGP_STR | |
8944 | "Clear peers with the AS number\n" | |
8945 | BGP_SOFT_IN_STR) | |
8946 | ||
8947 | ALIAS (clear_ip_bgp_as_soft_in, | |
8948 | clear_ip_bgp_instance_as_in_cmd, | |
8949 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", | |
718e3744 | 8950 | CLEAR_STR |
8951 | IP_STR | |
8952 | BGP_STR | |
01080f7c | 8953 | BGP_INSTANCE_HELP_STR |
718e3744 | 8954 | "Clear peers with the AS number\n" |
e0bce756 | 8955 | BGP_SOFT_IN_STR) |
718e3744 | 8956 | |
8957 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
8958 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 8959 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 8960 | CLEAR_STR |
8961 | IP_STR | |
8962 | BGP_STR | |
8963 | "Clear peers with the AS number\n" | |
e0bce756 | 8964 | BGP_SOFT_IN_STR |
718e3744 | 8965 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8966 | { | |
8967 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
8968 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8969 | } | |
8970 | ||
8971 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
8972 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 8973 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 8974 | CLEAR_STR |
8975 | IP_STR | |
8976 | BGP_STR | |
8977 | "Clear peers with the AS number\n" | |
8978 | "Address family\n" | |
8979 | "Address Family modifier\n" | |
8980 | "Address Family modifier\n" | |
e0bce756 DS |
8981 | BGP_SOFT_STR |
8982 | BGP_SOFT_IN_STR) | |
718e3744 | 8983 | { |
8984 | if (strncmp (argv[1], "m", 1) == 0) | |
8985 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
8986 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8987 | ||
8988 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
8989 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8990 | } | |
8991 | ||
01080f7c | 8992 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, |
8993 | clear_ip_bgp_instance_as_ipv4_soft_in_cmd, | |
8994 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", | |
8995 | CLEAR_STR | |
8996 | IP_STR | |
8997 | BGP_STR | |
8998 | BGP_INSTANCE_HELP_STR | |
8999 | "Clear peers with the AS number\n" | |
9000 | "Address family\n" | |
9001 | "Address Family modifier\n" | |
9002 | "Address Family modifier\n" | |
9003 | BGP_SOFT_STR | |
9004 | BGP_SOFT_IN_STR) | |
9005 | { | |
9006 | if (strncmp (argv[3], "m", 1) == 0) | |
9007 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, | |
9008 | BGP_CLEAR_SOFT_IN, argv[2]); | |
9009 | ||
9010 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
9011 | BGP_CLEAR_SOFT_IN, argv[2]); | |
9012 | } | |
9013 | ||
718e3744 | 9014 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
9015 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 9016 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 9017 | CLEAR_STR |
9018 | IP_STR | |
9019 | BGP_STR | |
9020 | "Clear peers with the AS number\n" | |
9021 | "Address family\n" | |
9022 | "Address Family modifier\n" | |
9023 | "Address Family modifier\n" | |
e0bce756 | 9024 | BGP_SOFT_IN_STR) |
718e3744 | 9025 | |
01080f7c | 9026 | ALIAS (clear_ip_bgp_instance_as_ipv4_soft_in, |
9027 | clear_ip_bgp_instance_as_ipv4_in_cmd, | |
9028 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) in", | |
9029 | CLEAR_STR | |
9030 | IP_STR | |
9031 | BGP_STR | |
9032 | BGP_INSTANCE_HELP_STR | |
9033 | "Clear peers with the AS number\n" | |
9034 | "Address family\n" | |
9035 | "Address Family modifier\n" | |
9036 | "Address Family modifier\n" | |
9037 | BGP_SOFT_IN_STR) | |
9038 | ||
718e3744 | 9039 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
9040 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 9041 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 9042 | CLEAR_STR |
9043 | IP_STR | |
9044 | BGP_STR | |
9045 | "Clear peers with the AS number\n" | |
9046 | "Address family\n" | |
9047 | "Address Family modifier\n" | |
9048 | "Address Family modifier\n" | |
e0bce756 | 9049 | BGP_SOFT_IN_STR |
718e3744 | 9050 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
9051 | { | |
9052 | if (strncmp (argv[1], "m", 1) == 0) | |
9053 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
9054 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
9055 | ||
9056 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
9057 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
9058 | } | |
9059 | ||
9060 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
9061 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 9062 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 9063 | CLEAR_STR |
9064 | IP_STR | |
9065 | BGP_STR | |
9066 | "Clear peers with the AS number\n" | |
9067 | "Address family\n" | |
9068 | "Address Family modifier\n" | |
e0bce756 DS |
9069 | BGP_SOFT_STR |
9070 | BGP_SOFT_IN_STR) | |
718e3744 | 9071 | { |
9072 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
9073 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9074 | } | |
9075 | ||
9076 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
9077 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 9078 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 9079 | CLEAR_STR |
9080 | IP_STR | |
9081 | BGP_STR | |
9082 | "Clear peers with the AS number\n" | |
9083 | "Address family\n" | |
9084 | "Address Family modifier\n" | |
e0bce756 | 9085 | BGP_SOFT_IN_STR) |
718e3744 | 9086 | |
587ff0fd LB |
9087 | DEFUN (clear_ip_bgp_as_encap_soft_in, |
9088 | clear_ip_bgp_as_encap_soft_in_cmd, | |
9089 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft in", | |
9090 | CLEAR_STR | |
9091 | IP_STR | |
9092 | BGP_STR | |
9093 | "Clear peers with the AS number\n" | |
9094 | "Address family\n" | |
9095 | "Address Family modifier\n" | |
9096 | "Soft reconfig\n" | |
9097 | "Soft reconfig inbound update\n") | |
9098 | { | |
9099 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
9100 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9101 | } | |
9102 | ||
9103 | ALIAS (clear_ip_bgp_as_encap_soft_in, | |
9104 | clear_ip_bgp_as_encap_in_cmd, | |
9105 | "clear ip bgp " CMD_AS_RANGE " encap unicast in", | |
9106 | CLEAR_STR | |
9107 | IP_STR | |
9108 | BGP_STR | |
9109 | "Clear peers with the AS number\n" | |
9110 | "Address family\n" | |
9111 | "Address Family modifier\n" | |
9112 | "Soft reconfig inbound update\n") | |
9113 | ||
718e3744 | 9114 | DEFUN (clear_bgp_as_soft_in, |
9115 | clear_bgp_as_soft_in_cmd, | |
320da874 | 9116 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 9117 | CLEAR_STR |
9118 | BGP_STR | |
9119 | "Clear peers with the AS number\n" | |
e0bce756 DS |
9120 | BGP_SOFT_STR |
9121 | BGP_SOFT_IN_STR) | |
718e3744 | 9122 | { |
01080f7c | 9123 | if (argc == 3) |
9124 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
9125 | BGP_CLEAR_SOFT_IN, argv[2]); | |
9126 | ||
718e3744 | 9127 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
9128 | BGP_CLEAR_SOFT_IN, argv[0]); | |
9129 | } | |
9130 | ||
01080f7c | 9131 | ALIAS (clear_bgp_as_soft_in, |
9132 | clear_bgp_instance_as_soft_in_cmd, | |
9133 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", | |
9134 | CLEAR_STR | |
9135 | BGP_STR | |
9136 | BGP_INSTANCE_HELP_STR | |
9137 | "Clear peers with the AS number\n" | |
9138 | BGP_SOFT_STR | |
9139 | BGP_SOFT_IN_STR) | |
9140 | ||
718e3744 | 9141 | ALIAS (clear_bgp_as_soft_in, |
9142 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 9143 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 9144 | CLEAR_STR |
9145 | BGP_STR | |
9146 | "Address family\n" | |
9147 | "Clear peers with the AS number\n" | |
e0bce756 DS |
9148 | BGP_SOFT_STR |
9149 | BGP_SOFT_IN_STR) | |
718e3744 | 9150 | |
01080f7c | 9151 | ALIAS (clear_bgp_as_soft_in, |
9152 | clear_bgp_instance_ipv6_as_soft_in_cmd, | |
9153 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft in", | |
9154 | CLEAR_STR | |
9155 | BGP_STR | |
9156 | BGP_INSTANCE_HELP_STR | |
9157 | "Address family\n" | |
9158 | "Clear peers with the AS number\n" | |
9159 | BGP_SOFT_STR | |
9160 | BGP_SOFT_IN_STR) | |
9161 | ||
718e3744 | 9162 | ALIAS (clear_bgp_as_soft_in, |
9163 | clear_bgp_as_in_cmd, | |
320da874 | 9164 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 9165 | CLEAR_STR |
9166 | BGP_STR | |
9167 | "Clear peers with the AS number\n" | |
e0bce756 | 9168 | BGP_SOFT_IN_STR) |
718e3744 | 9169 | |
01080f7c | 9170 | ALIAS (clear_bgp_as_soft_in, |
9171 | clear_bgp_instance_as_in_cmd, | |
9172 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", | |
9173 | CLEAR_STR | |
9174 | BGP_STR | |
9175 | BGP_INSTANCE_HELP_STR | |
9176 | "Clear peers with the AS number\n" | |
9177 | BGP_SOFT_IN_STR) | |
9178 | ||
718e3744 | 9179 | ALIAS (clear_bgp_as_soft_in, |
9180 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 9181 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 9182 | CLEAR_STR |
9183 | BGP_STR | |
9184 | "Address family\n" | |
9185 | "Clear peers with the AS number\n" | |
e0bce756 | 9186 | BGP_SOFT_IN_STR) |
718e3744 | 9187 | |
01080f7c | 9188 | ALIAS (clear_bgp_as_soft_in, |
9189 | clear_bgp_instance_ipv6_as_in_cmd, | |
9190 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " in", | |
9191 | CLEAR_STR | |
9192 | BGP_STR | |
9193 | BGP_INSTANCE_HELP_STR | |
9194 | "Address family\n" | |
9195 | "Clear peers with the AS number\n" | |
9196 | BGP_SOFT_IN_STR) | |
9197 | ||
718e3744 | 9198 | DEFUN (clear_bgp_as_in_prefix_filter, |
9199 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 9200 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 9201 | CLEAR_STR |
9202 | BGP_STR | |
9203 | "Clear peers with the AS number\n" | |
e0bce756 | 9204 | BGP_SOFT_IN_STR |
718e3744 | 9205 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
9206 | { | |
9207 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
9208 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
9209 | } | |
9210 | ||
9211 | ALIAS (clear_bgp_as_in_prefix_filter, | |
9212 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 9213 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 9214 | CLEAR_STR |
9215 | BGP_STR | |
9216 | "Address family\n" | |
9217 | "Clear peers with the AS number\n" | |
e0bce756 | 9218 | BGP_SOFT_IN_STR |
718e3744 | 9219 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6b0655a2 | 9220 | |
718e3744 | 9221 | /* Both soft-reconfiguration */ |
9222 | DEFUN (clear_ip_bgp_all_soft, | |
9223 | clear_ip_bgp_all_soft_cmd, | |
9224 | "clear ip bgp * soft", | |
9225 | CLEAR_STR | |
9226 | IP_STR | |
9227 | BGP_STR | |
9228 | "Clear all peers\n" | |
e0bce756 | 9229 | BGP_SOFT_STR) |
718e3744 | 9230 | { |
6aeb9e78 DS |
9231 | if (argc == 2) |
9232 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 9233 | BGP_CLEAR_SOFT_BOTH, NULL); |
9234 | ||
9235 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9236 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9237 | } | |
9238 | ||
9239 | ALIAS (clear_ip_bgp_all_soft, | |
9240 | clear_ip_bgp_instance_all_soft_cmd, | |
8386ac43 | 9241 | "clear ip bgp " BGP_INSTANCE_CMD " * soft", |
718e3744 | 9242 | CLEAR_STR |
9243 | IP_STR | |
9244 | BGP_STR | |
8386ac43 | 9245 | BGP_INSTANCE_HELP_STR |
718e3744 | 9246 | "Clear all peers\n" |
e0bce756 | 9247 | BGP_SOFT_STR) |
718e3744 | 9248 | |
9249 | ||
9250 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
9251 | clear_ip_bgp_all_ipv4_soft_cmd, | |
9252 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
9253 | CLEAR_STR | |
9254 | IP_STR | |
9255 | BGP_STR | |
9256 | "Clear all peers\n" | |
9257 | "Address family\n" | |
9258 | "Address Family Modifier\n" | |
9259 | "Address Family Modifier\n" | |
e0bce756 | 9260 | BGP_SOFT_STR) |
718e3744 | 9261 | { |
9262 | if (strncmp (argv[0], "m", 1) == 0) | |
9263 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
9264 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9265 | ||
9266 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9267 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9268 | } | |
9269 | ||
9270 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
9271 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
8386ac43 | 9272 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft", |
718e3744 | 9273 | CLEAR_STR |
9274 | IP_STR | |
9275 | BGP_STR | |
8386ac43 | 9276 | BGP_INSTANCE_HELP_STR |
718e3744 | 9277 | "Clear all peers\n" |
9278 | "Address family\n" | |
9279 | "Address Family Modifier\n" | |
9280 | "Address Family Modifier\n" | |
e0bce756 | 9281 | BGP_SOFT_STR) |
718e3744 | 9282 | { |
6aeb9e78 DS |
9283 | if (strncmp (argv[2], "m", 1) == 0) |
9284 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, | |
718e3744 | 9285 | BGP_CLEAR_SOFT_BOTH, NULL); |
9286 | ||
9287 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9288 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9289 | } | |
9290 | ||
9291 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
9292 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
9293 | "clear ip bgp * vpnv4 unicast soft", | |
9294 | CLEAR_STR | |
9295 | IP_STR | |
9296 | BGP_STR | |
9297 | "Clear all peers\n" | |
9298 | "Address family\n" | |
9299 | "Address Family Modifier\n" | |
e0bce756 | 9300 | BGP_SOFT_STR) |
718e3744 | 9301 | { |
9302 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
9303 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9304 | } | |
9305 | ||
587ff0fd LB |
9306 | DEFUN (clear_ip_bgp_all_encap_soft, |
9307 | clear_ip_bgp_all_encap_soft_cmd, | |
9308 | "clear ip bgp * encap unicast soft", | |
9309 | CLEAR_STR | |
9310 | IP_STR | |
9311 | BGP_STR | |
9312 | "Clear all peers\n" | |
9313 | "Address family\n" | |
9314 | "Address Family Modifier\n" | |
9315 | "Soft reconfig\n") | |
9316 | { | |
9317 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
9318 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9319 | } | |
9320 | ||
718e3744 | 9321 | DEFUN (clear_bgp_all_soft, |
9322 | clear_bgp_all_soft_cmd, | |
9323 | "clear bgp * soft", | |
9324 | CLEAR_STR | |
9325 | BGP_STR | |
9326 | "Clear all peers\n" | |
e0bce756 | 9327 | BGP_SOFT_STR) |
718e3744 | 9328 | { |
6aeb9e78 DS |
9329 | if (argc == 2) |
9330 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
01080f7c | 9331 | BGP_CLEAR_SOFT_BOTH, NULL); |
718e3744 | 9332 | |
9333 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
01080f7c | 9334 | BGP_CLEAR_SOFT_BOTH, NULL); |
718e3744 | 9335 | } |
9336 | ||
9337 | ALIAS (clear_bgp_all_soft, | |
9338 | clear_bgp_instance_all_soft_cmd, | |
8386ac43 | 9339 | "clear bgp " BGP_INSTANCE_CMD " * soft", |
718e3744 | 9340 | CLEAR_STR |
9341 | BGP_STR | |
8386ac43 | 9342 | BGP_INSTANCE_HELP_STR |
718e3744 | 9343 | "Clear all peers\n" |
e0bce756 | 9344 | BGP_SOFT_STR) |
718e3744 | 9345 | |
9346 | ALIAS (clear_bgp_all_soft, | |
9347 | clear_bgp_ipv6_all_soft_cmd, | |
9348 | "clear bgp ipv6 * soft", | |
9349 | CLEAR_STR | |
9350 | BGP_STR | |
9351 | "Address family\n" | |
9352 | "Clear all peers\n" | |
e0bce756 | 9353 | BGP_SOFT_STR) |
718e3744 | 9354 | |
01080f7c | 9355 | ALIAS (clear_bgp_all_soft, |
9356 | clear_bgp_instance_ipv6_all_soft_cmd, | |
9357 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft", | |
9358 | CLEAR_STR | |
9359 | BGP_STR | |
9360 | BGP_INSTANCE_HELP_STR | |
9361 | "Address family\n" | |
9362 | "Clear all peers\n" | |
9363 | BGP_SOFT_STR) | |
9364 | ||
718e3744 | 9365 | DEFUN (clear_ip_bgp_peer_soft, |
9366 | clear_ip_bgp_peer_soft_cmd, | |
db64ea86 | 9367 | "clear ip bgp (A.B.C.D|WORD) soft", |
718e3744 | 9368 | CLEAR_STR |
9369 | IP_STR | |
9370 | BGP_STR | |
9371 | "BGP neighbor address to clear\n" | |
db64ea86 | 9372 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9373 | BGP_SOFT_STR) |
718e3744 | 9374 | { |
01080f7c | 9375 | if (argc == 3) |
9376 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
9377 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9378 | ||
718e3744 | 9379 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
9380 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9381 | } | |
9382 | ||
01080f7c | 9383 | ALIAS (clear_ip_bgp_peer_soft, |
9384 | clear_ip_bgp_instance_peer_soft_cmd, | |
9385 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft", | |
9386 | CLEAR_STR | |
9387 | IP_STR | |
9388 | BGP_STR | |
9389 | BGP_INSTANCE_HELP_STR | |
9390 | "BGP neighbor address to clear\n" | |
9391 | "BGP neighbor on interface to clear\n" | |
9392 | BGP_SOFT_STR) | |
9393 | ||
718e3744 | 9394 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
9395 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
db64ea86 | 9396 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", |
718e3744 | 9397 | CLEAR_STR |
9398 | IP_STR | |
9399 | BGP_STR | |
9400 | "BGP neighbor address to clear\n" | |
db64ea86 | 9401 | "BGP neighbor on interface to clear\n" |
718e3744 | 9402 | "Address family\n" |
9403 | "Address Family Modifier\n" | |
9404 | "Address Family Modifier\n" | |
e0bce756 | 9405 | BGP_SOFT_STR) |
718e3744 | 9406 | { |
9407 | if (strncmp (argv[1], "m", 1) == 0) | |
9408 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
9409 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9410 | ||
9411 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
9412 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9413 | } | |
9414 | ||
01080f7c | 9415 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, |
9416 | clear_ip_bgp_instance_peer_ipv4_soft_cmd, | |
9417 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", | |
9418 | CLEAR_STR | |
9419 | IP_STR | |
9420 | BGP_STR | |
9421 | BGP_INSTANCE_HELP_STR | |
9422 | "BGP neighbor address to clear\n" | |
9423 | "BGP neighbor on interface to clear\n" | |
9424 | "Address family\n" | |
9425 | "Address Family Modifier\n" | |
9426 | "Address Family Modifier\n" | |
9427 | BGP_SOFT_STR) | |
9428 | { | |
9429 | if (strncmp (argv[3], "m", 1) == 0) | |
9430 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, | |
9431 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9432 | ||
9433 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
9434 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9435 | } | |
9436 | ||
718e3744 | 9437 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
9438 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
db64ea86 | 9439 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft", |
718e3744 | 9440 | CLEAR_STR |
9441 | IP_STR | |
9442 | BGP_STR | |
9443 | "BGP neighbor address to clear\n" | |
db64ea86 | 9444 | "BGP neighbor on interface to clear\n" |
718e3744 | 9445 | "Address family\n" |
9446 | "Address Family Modifier\n" | |
e0bce756 | 9447 | BGP_SOFT_STR) |
718e3744 | 9448 | { |
9449 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
9450 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9451 | } | |
9452 | ||
587ff0fd LB |
9453 | DEFUN (clear_ip_bgp_peer_encap_soft, |
9454 | clear_ip_bgp_peer_encap_soft_cmd, | |
9455 | "clear ip bgp A.B.C.D encap unicast soft", | |
9456 | CLEAR_STR | |
9457 | IP_STR | |
9458 | BGP_STR | |
9459 | "BGP neighbor address to clear\n" | |
9460 | "Address family\n" | |
9461 | "Address Family Modifier\n" | |
9462 | "Soft reconfig\n") | |
9463 | { | |
9464 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
9465 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9466 | } | |
9467 | ||
718e3744 | 9468 | DEFUN (clear_bgp_peer_soft, |
9469 | clear_bgp_peer_soft_cmd, | |
a80beece | 9470 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 9471 | CLEAR_STR |
9472 | BGP_STR | |
9473 | "BGP neighbor address to clear\n" | |
9474 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 9475 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9476 | BGP_SOFT_STR) |
718e3744 | 9477 | { |
01080f7c | 9478 | if (argc == 3) |
9479 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
9480 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9481 | ||
718e3744 | 9482 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
9483 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9484 | } | |
9485 | ||
01080f7c | 9486 | ALIAS (clear_bgp_peer_soft, |
9487 | clear_bgp_instance_peer_soft_cmd, | |
9488 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft", | |
9489 | CLEAR_STR | |
9490 | BGP_STR | |
9491 | BGP_INSTANCE_HELP_STR | |
9492 | "BGP neighbor address to clear\n" | |
9493 | "BGP IPv6 neighbor to clear\n" | |
9494 | "BGP neighbor on interface to clear\n" | |
9495 | BGP_SOFT_STR) | |
9496 | ||
718e3744 | 9497 | ALIAS (clear_bgp_peer_soft, |
9498 | clear_bgp_ipv6_peer_soft_cmd, | |
a80beece | 9499 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 9500 | CLEAR_STR |
9501 | BGP_STR | |
9502 | "Address family\n" | |
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 | ALIAS (clear_bgp_peer_soft, |
9509 | clear_bgp_instance_ipv6_peer_soft_cmd, | |
9510 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft", | |
9511 | CLEAR_STR | |
9512 | BGP_STR | |
9513 | BGP_INSTANCE_HELP_STR | |
9514 | "Address family\n" | |
9515 | "BGP neighbor address to clear\n" | |
9516 | "BGP IPv6 neighbor to clear\n" | |
9517 | "BGP neighbor on interface to clear\n" | |
9518 | BGP_SOFT_STR) | |
9519 | ||
718e3744 | 9520 | DEFUN (clear_ip_bgp_peer_group_soft, |
9521 | clear_ip_bgp_peer_group_soft_cmd, | |
9522 | "clear ip bgp peer-group WORD soft", | |
9523 | CLEAR_STR | |
9524 | IP_STR | |
9525 | BGP_STR | |
9526 | "Clear all members of peer-group\n" | |
9527 | "BGP peer-group name\n" | |
e0bce756 | 9528 | BGP_SOFT_STR) |
718e3744 | 9529 | { |
01080f7c | 9530 | if (argc == 3) |
9531 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
9532 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9533 | ||
718e3744 | 9534 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
9535 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9536 | } | |
9537 | ||
01080f7c | 9538 | ALIAS (clear_ip_bgp_peer_group_soft, |
9539 | clear_ip_bgp_instance_peer_group_soft_cmd, | |
9540 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft", | |
9541 | CLEAR_STR | |
9542 | IP_STR | |
9543 | BGP_STR | |
9544 | BGP_INSTANCE_HELP_STR | |
9545 | "Clear all members of peer-group\n" | |
9546 | "BGP peer-group name\n" | |
9547 | BGP_SOFT_STR) | |
9548 | ||
718e3744 | 9549 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
9550 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
9551 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
9552 | CLEAR_STR | |
9553 | IP_STR | |
9554 | BGP_STR | |
9555 | "Clear all members of peer-group\n" | |
9556 | "BGP peer-group name\n" | |
9557 | "Address family\n" | |
9558 | "Address Family modifier\n" | |
9559 | "Address Family modifier\n" | |
e0bce756 | 9560 | BGP_SOFT_STR) |
718e3744 | 9561 | { |
9562 | if (strncmp (argv[1], "m", 1) == 0) | |
9563 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
9564 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9565 | ||
9566 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
9567 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9568 | } | |
9569 | ||
01080f7c | 9570 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, |
9571 | clear_ip_bgp_instance_peer_group_ipv4_soft_cmd, | |
9572 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft", | |
9573 | CLEAR_STR | |
9574 | IP_STR | |
9575 | BGP_STR | |
9576 | BGP_INSTANCE_HELP_STR | |
9577 | "Clear all members of peer-group\n" | |
9578 | "BGP peer-group name\n" | |
9579 | "Address family\n" | |
9580 | "Address Family modifier\n" | |
9581 | "Address Family modifier\n" | |
9582 | BGP_SOFT_STR) | |
9583 | { | |
9584 | if (strncmp (argv[3], "m", 1) == 0) | |
9585 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, | |
9586 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9587 | ||
9588 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
9589 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9590 | } | |
9591 | ||
718e3744 | 9592 | DEFUN (clear_bgp_peer_group_soft, |
9593 | clear_bgp_peer_group_soft_cmd, | |
9594 | "clear bgp peer-group WORD soft", | |
9595 | CLEAR_STR | |
9596 | BGP_STR | |
9597 | "Clear all members of peer-group\n" | |
9598 | "BGP peer-group name\n" | |
e0bce756 | 9599 | BGP_SOFT_STR) |
718e3744 | 9600 | { |
01080f7c | 9601 | if (argc == 3) |
9602 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
9603 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9604 | ||
718e3744 | 9605 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
9606 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9607 | } | |
9608 | ||
01080f7c | 9609 | ALIAS (clear_bgp_peer_group_soft, |
9610 | clear_bgp_instance_peer_group_soft_cmd, | |
9611 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft", | |
9612 | CLEAR_STR | |
9613 | BGP_STR | |
9614 | BGP_INSTANCE_HELP_STR | |
9615 | "Clear all members of peer-group\n" | |
9616 | "BGP peer-group name\n" | |
9617 | BGP_SOFT_STR) | |
9618 | ||
718e3744 | 9619 | ALIAS (clear_bgp_peer_group_soft, |
9620 | clear_bgp_ipv6_peer_group_soft_cmd, | |
9621 | "clear bgp ipv6 peer-group WORD soft", | |
9622 | CLEAR_STR | |
9623 | BGP_STR | |
9624 | "Address family\n" | |
9625 | "Clear all members of peer-group\n" | |
9626 | "BGP peer-group name\n" | |
e0bce756 | 9627 | BGP_SOFT_STR) |
718e3744 | 9628 | |
01080f7c | 9629 | ALIAS (clear_bgp_peer_group_soft, |
9630 | clear_bgp_instance_ipv6_peer_group_soft_cmd, | |
9631 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft", | |
9632 | CLEAR_STR | |
9633 | BGP_STR | |
9634 | BGP_INSTANCE_HELP_STR | |
9635 | "Address family\n" | |
9636 | "Clear all members of peer-group\n" | |
9637 | "BGP peer-group name\n" | |
9638 | BGP_SOFT_STR) | |
9639 | ||
718e3744 | 9640 | DEFUN (clear_ip_bgp_external_soft, |
9641 | clear_ip_bgp_external_soft_cmd, | |
9642 | "clear ip bgp external soft", | |
9643 | CLEAR_STR | |
9644 | IP_STR | |
9645 | BGP_STR | |
9646 | "Clear all external peers\n" | |
e0bce756 | 9647 | BGP_SOFT_STR) |
718e3744 | 9648 | { |
01080f7c | 9649 | if (argc == 2) |
9650 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
9651 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9652 | ||
718e3744 | 9653 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
9654 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9655 | } | |
9656 | ||
01080f7c | 9657 | ALIAS (clear_ip_bgp_external_soft, |
9658 | clear_ip_bgp_instance_external_soft_cmd, | |
9659 | "clear ip bgp " BGP_INSTANCE_CMD " external soft", | |
9660 | CLEAR_STR | |
9661 | IP_STR | |
9662 | BGP_STR | |
9663 | BGP_INSTANCE_HELP_STR | |
9664 | "Clear all external peers\n" | |
9665 | BGP_SOFT_STR) | |
9666 | ||
718e3744 | 9667 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
9668 | clear_ip_bgp_external_ipv4_soft_cmd, | |
9669 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
9670 | CLEAR_STR | |
9671 | IP_STR | |
9672 | BGP_STR | |
9673 | "Clear all external peers\n" | |
9674 | "Address family\n" | |
9675 | "Address Family modifier\n" | |
9676 | "Address Family modifier\n" | |
e0bce756 | 9677 | BGP_SOFT_STR) |
718e3744 | 9678 | { |
9679 | if (strncmp (argv[0], "m", 1) == 0) | |
9680 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
9681 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9682 | ||
9683 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
9684 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9685 | } | |
9686 | ||
01080f7c | 9687 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft, |
9688 | clear_ip_bgp_instance_external_ipv4_soft_cmd, | |
9689 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft", | |
9690 | CLEAR_STR | |
9691 | IP_STR | |
9692 | BGP_STR | |
9693 | BGP_INSTANCE_HELP_STR | |
9694 | "Clear all external peers\n" | |
9695 | "Address family\n" | |
9696 | "Address Family modifier\n" | |
9697 | "Address Family modifier\n" | |
9698 | BGP_SOFT_STR) | |
9699 | { | |
9700 | if (strncmp (argv[2], "m", 1) == 0) | |
9701 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, | |
9702 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9703 | ||
9704 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
9705 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9706 | } | |
9707 | ||
718e3744 | 9708 | DEFUN (clear_bgp_external_soft, |
9709 | clear_bgp_external_soft_cmd, | |
9710 | "clear bgp external soft", | |
9711 | CLEAR_STR | |
9712 | BGP_STR | |
9713 | "Clear all external peers\n" | |
e0bce756 | 9714 | BGP_SOFT_STR) |
718e3744 | 9715 | { |
01080f7c | 9716 | if (argc == 2) |
9717 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
9718 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9719 | ||
718e3744 | 9720 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
9721 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9722 | } | |
9723 | ||
01080f7c | 9724 | ALIAS (clear_bgp_external_soft, |
9725 | clear_bgp_instance_external_soft_cmd, | |
9726 | "clear bgp " BGP_INSTANCE_CMD " external soft", | |
9727 | CLEAR_STR | |
9728 | BGP_STR | |
9729 | BGP_INSTANCE_HELP_STR | |
9730 | "Clear all external peers\n" | |
9731 | BGP_SOFT_STR) | |
9732 | ||
718e3744 | 9733 | ALIAS (clear_bgp_external_soft, |
9734 | clear_bgp_ipv6_external_soft_cmd, | |
9735 | "clear bgp ipv6 external soft", | |
9736 | CLEAR_STR | |
9737 | BGP_STR | |
9738 | "Address family\n" | |
9739 | "Clear all external peers\n" | |
e0bce756 | 9740 | BGP_SOFT_STR) |
718e3744 | 9741 | |
01080f7c | 9742 | ALIAS (clear_bgp_external_soft, |
9743 | clear_bgp_instance_ipv6_external_soft_cmd, | |
9744 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft", | |
9745 | CLEAR_STR | |
9746 | BGP_STR | |
9747 | BGP_INSTANCE_HELP_STR | |
9748 | "Address family\n" | |
9749 | "Clear all external peers\n" | |
9750 | BGP_SOFT_STR) | |
9751 | ||
718e3744 | 9752 | DEFUN (clear_ip_bgp_as_soft, |
9753 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 9754 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 9755 | CLEAR_STR |
9756 | IP_STR | |
9757 | BGP_STR | |
9758 | "Clear peers with the AS number\n" | |
e0bce756 | 9759 | BGP_SOFT_STR) |
718e3744 | 9760 | { |
01080f7c | 9761 | if (argc == 3) |
9762 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
9763 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9764 | ||
718e3744 | 9765 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
9766 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9767 | } | |
9768 | ||
01080f7c | 9769 | ALIAS (clear_ip_bgp_as_soft, |
9770 | clear_ip_bgp_instance_as_soft_cmd, | |
9771 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", | |
9772 | CLEAR_STR | |
9773 | IP_STR | |
9774 | BGP_STR | |
9775 | BGP_INSTANCE_HELP_STR | |
9776 | "Clear peers with the AS number\n" | |
9777 | BGP_SOFT_STR) | |
9778 | ||
718e3744 | 9779 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
9780 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 9781 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 9782 | CLEAR_STR |
9783 | IP_STR | |
9784 | BGP_STR | |
9785 | "Clear peers with the AS number\n" | |
9786 | "Address family\n" | |
9787 | "Address Family Modifier\n" | |
9788 | "Address Family Modifier\n" | |
e0bce756 | 9789 | BGP_SOFT_STR) |
718e3744 | 9790 | { |
9791 | if (strncmp (argv[1], "m", 1) == 0) | |
9792 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
9793 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9794 | ||
9795 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
9796 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9797 | } | |
9798 | ||
01080f7c | 9799 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft, |
9800 | clear_ip_bgp_instance_as_ipv4_soft_cmd, | |
9801 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", | |
9802 | CLEAR_STR | |
9803 | IP_STR | |
9804 | BGP_STR | |
9805 | BGP_INSTANCE_HELP_STR | |
9806 | "Clear peers with the AS number\n" | |
9807 | "Address family\n" | |
9808 | "Address Family Modifier\n" | |
9809 | "Address Family Modifier\n" | |
9810 | BGP_SOFT_STR) | |
9811 | { | |
9812 | if (strncmp (argv[3], "m", 1) == 0) | |
9813 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, | |
9814 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9815 | ||
9816 | return bgp_clear_vty (vty, argv[1],AFI_IP, SAFI_UNICAST, clear_as, | |
9817 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9818 | } | |
9819 | ||
718e3744 | 9820 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
9821 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 9822 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 9823 | CLEAR_STR |
9824 | IP_STR | |
9825 | BGP_STR | |
9826 | "Clear peers with the AS number\n" | |
9827 | "Address family\n" | |
9828 | "Address Family Modifier\n" | |
e0bce756 | 9829 | BGP_SOFT_STR) |
718e3744 | 9830 | { |
9831 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
9832 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9833 | } | |
9834 | ||
587ff0fd LB |
9835 | DEFUN (clear_ip_bgp_as_encap_soft, |
9836 | clear_ip_bgp_as_encap_soft_cmd, | |
9837 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft", | |
9838 | CLEAR_STR | |
9839 | IP_STR | |
9840 | BGP_STR | |
9841 | "Clear peers with the AS number\n" | |
9842 | "Address family\n" | |
9843 | "Address Family Modifier\n" | |
9844 | "Soft reconfig\n") | |
9845 | { | |
9846 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
9847 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9848 | } | |
9849 | ||
718e3744 | 9850 | DEFUN (clear_bgp_as_soft, |
9851 | clear_bgp_as_soft_cmd, | |
320da874 | 9852 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 9853 | CLEAR_STR |
9854 | BGP_STR | |
9855 | "Clear peers with the AS number\n" | |
e0bce756 | 9856 | BGP_SOFT_STR) |
718e3744 | 9857 | { |
01080f7c | 9858 | if (argc == 3) |
9859 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
9860 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9861 | ||
718e3744 | 9862 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
9863 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9864 | } | |
9865 | ||
01080f7c | 9866 | ALIAS (clear_bgp_as_soft, |
9867 | clear_bgp_instance_as_soft_cmd, | |
9868 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", | |
9869 | CLEAR_STR | |
9870 | BGP_STR | |
9871 | BGP_INSTANCE_HELP_STR | |
9872 | "Clear peers with the AS number\n" | |
9873 | BGP_SOFT_STR) | |
9874 | ||
718e3744 | 9875 | ALIAS (clear_bgp_as_soft, |
9876 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 9877 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 9878 | CLEAR_STR |
9879 | BGP_STR | |
9880 | "Address family\n" | |
9881 | "Clear peers with the AS number\n" | |
e0bce756 | 9882 | BGP_SOFT_STR) |
6b0655a2 | 9883 | |
01080f7c | 9884 | ALIAS (clear_bgp_as_soft, |
9885 | clear_bgp_instance_ipv6_as_soft_cmd, | |
9886 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft", | |
9887 | CLEAR_STR | |
9888 | BGP_STR | |
9889 | BGP_INSTANCE_HELP_STR | |
9890 | "Address family\n" | |
9891 | "Clear peers with the AS number\n" | |
9892 | BGP_SOFT_STR) | |
9893 | ||
e0081f70 ML |
9894 | DEFUN (show_bgp_views, |
9895 | show_bgp_views_cmd, | |
9896 | "show bgp views", | |
9897 | SHOW_STR | |
9898 | BGP_STR | |
9899 | "Show the defined BGP views\n") | |
9900 | { | |
9901 | struct list *inst = bm->bgp; | |
9902 | struct listnode *node; | |
9903 | struct bgp *bgp; | |
9904 | ||
9905 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
9906 | { | |
8386ac43 | 9907 | vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE); |
e0081f70 ML |
9908 | return CMD_WARNING; |
9909 | } | |
9910 | ||
9911 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
9912 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
8386ac43 | 9913 | { |
9914 | /* Skip VRFs. */ | |
9915 | if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) | |
9916 | continue; | |
9917 | vty_out (vty, "\t%s (AS%u)%s", | |
9918 | bgp->name ? bgp->name : "(null)", | |
9919 | bgp->as, VTY_NEWLINE); | |
9920 | } | |
e0081f70 ML |
9921 | |
9922 | return CMD_SUCCESS; | |
9923 | } | |
9924 | ||
8386ac43 | 9925 | DEFUN (show_bgp_vrfs, |
9926 | show_bgp_vrfs_cmd, | |
9927 | "show bgp vrfs {json}", | |
9928 | SHOW_STR | |
9929 | BGP_STR | |
9930 | "Show BGP VRFs\n" | |
9931 | "JavaScript Object Notation\n") | |
9932 | { | |
9933 | struct list *inst = bm->bgp; | |
9934 | struct listnode *node; | |
9935 | struct bgp *bgp; | |
9936 | u_char uj = use_json(argc, argv); | |
9937 | json_object *json = NULL; | |
9938 | json_object *json_vrfs = NULL; | |
9939 | int count = 0; | |
9940 | static char header[] = "Type Id RouterId #PeersCfg #PeersEstb Name"; | |
9941 | ||
9942 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
9943 | { | |
9944 | vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE); | |
9945 | return CMD_WARNING; | |
9946 | } | |
9947 | ||
9948 | if (uj) | |
9949 | { | |
9950 | json = json_object_new_object(); | |
9951 | json_vrfs = json_object_new_object(); | |
9952 | } | |
9953 | ||
9954 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
9955 | { | |
9956 | const char *name, *type; | |
9957 | struct peer *peer; | |
9958 | struct listnode *node, *nnode; | |
9959 | int peers_cfg, peers_estb; | |
9960 | json_object *json_vrf = NULL; | |
5c81a5f3 | 9961 | int vrf_id_ui; |
8386ac43 | 9962 | |
9963 | /* Skip Views. */ | |
9964 | if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) | |
9965 | continue; | |
9966 | ||
9967 | count++; | |
9968 | if (!uj && count == 1) | |
9969 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
9970 | ||
9971 | peers_cfg = peers_estb = 0; | |
9972 | if (uj) | |
9973 | json_vrf = json_object_new_object(); | |
9974 | ||
9975 | ||
9976 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
9977 | { | |
9978 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) | |
9979 | continue; | |
9980 | peers_cfg++; | |
9981 | if (peer->status == Established) | |
9982 | peers_estb++; | |
9983 | } | |
9984 | ||
9985 | if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
9986 | { | |
9987 | name = "Default"; | |
9988 | type = "DFLT"; | |
9989 | } | |
9990 | else | |
9991 | { | |
9992 | name = bgp->name; | |
9993 | type = "VRF"; | |
9994 | } | |
9995 | ||
5c81a5f3 | 9996 | vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id; |
8386ac43 | 9997 | if (uj) |
9998 | { | |
9999 | json_object_string_add(json_vrf, "type", type); | |
5c81a5f3 | 10000 | json_object_int_add(json_vrf, "vrfId", vrf_id_ui); |
8386ac43 | 10001 | json_object_string_add(json_vrf, "routerId", inet_ntoa (bgp->router_id)); |
10002 | json_object_int_add(json_vrf, "numConfiguredPeers", peers_cfg); | |
10003 | json_object_int_add(json_vrf, "numEstablishedPeers", peers_estb); | |
10004 | ||
10005 | json_object_object_add(json_vrfs, name, json_vrf); | |
10006 | } | |
10007 | else | |
5c81a5f3 | 10008 | vty_out (vty, "%4s %-5d %-16s %9u %10u %s%s", |
10009 | type, vrf_id_ui, inet_ntoa (bgp->router_id), | |
8386ac43 | 10010 | peers_cfg, peers_estb, name, |
10011 | VTY_NEWLINE); | |
10012 | } | |
10013 | ||
10014 | if (uj) | |
10015 | { | |
10016 | json_object_object_add(json, "vrfs", json_vrfs); | |
10017 | ||
10018 | json_object_int_add(json, "totalVrfs", count); | |
10019 | ||
10020 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
10021 | json_object_free(json); | |
10022 | } | |
10023 | else | |
10024 | { | |
10025 | if (count) | |
10026 | vty_out (vty, "%sTotal number of VRFs (including default): %d%s", | |
10027 | VTY_NEWLINE, count, VTY_NEWLINE); | |
10028 | } | |
10029 | ||
10030 | return CMD_SUCCESS; | |
10031 | } | |
10032 | ||
4bf6a362 PJ |
10033 | DEFUN (show_bgp_memory, |
10034 | show_bgp_memory_cmd, | |
10035 | "show bgp memory", | |
10036 | SHOW_STR | |
10037 | BGP_STR | |
10038 | "Global BGP memory statistics\n") | |
10039 | { | |
10040 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
10041 | unsigned long count; | |
10042 | ||
10043 | /* RIB related usage stats */ | |
10044 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
10045 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
10046 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10047 | count * sizeof (struct bgp_node)), | |
10048 | VTY_NEWLINE); | |
10049 | ||
10050 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
10051 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
10052 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10053 | count * sizeof (struct bgp_info)), | |
10054 | VTY_NEWLINE); | |
fb982c25 PJ |
10055 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
10056 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
10057 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10058 | count * sizeof (struct bgp_info_extra)), | |
10059 | VTY_NEWLINE); | |
4bf6a362 PJ |
10060 | |
10061 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
10062 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
10063 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10064 | count * sizeof (struct bgp_static)), | |
10065 | VTY_NEWLINE); | |
3f9c7369 DS |
10066 | |
10067 | if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET))) | |
10068 | vty_out (vty, "%ld Packets, using %s of memory%s", count, | |
10069 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10070 | count * sizeof (struct bpacket)), | |
10071 | VTY_NEWLINE); | |
4bf6a362 PJ |
10072 | |
10073 | /* Adj-In/Out */ | |
10074 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
10075 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
10076 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10077 | count * sizeof (struct bgp_adj_in)), | |
10078 | VTY_NEWLINE); | |
10079 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
10080 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
10081 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10082 | count * sizeof (struct bgp_adj_out)), | |
10083 | VTY_NEWLINE); | |
10084 | ||
10085 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
10086 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
10087 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10088 | count * sizeof (struct bgp_nexthop_cache)), | |
10089 | VTY_NEWLINE); | |
10090 | ||
10091 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
10092 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
10093 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10094 | count * sizeof (struct bgp_damp_info)), | |
10095 | VTY_NEWLINE); | |
10096 | ||
10097 | /* Attributes */ | |
10098 | count = attr_count(); | |
10099 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
10100 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10101 | count * sizeof(struct attr)), | |
10102 | VTY_NEWLINE); | |
fb982c25 PJ |
10103 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
10104 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
10105 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10106 | count * sizeof(struct attr_extra)), | |
10107 | VTY_NEWLINE); | |
4bf6a362 PJ |
10108 | |
10109 | if ((count = attr_unknown_count())) | |
10110 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
10111 | ||
10112 | /* AS_PATH attributes */ | |
10113 | count = aspath_count (); | |
10114 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
10115 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10116 | count * sizeof (struct aspath)), | |
10117 | VTY_NEWLINE); | |
10118 | ||
10119 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
10120 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
10121 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10122 | count * sizeof (struct assegment)), | |
10123 | VTY_NEWLINE); | |
10124 | ||
10125 | /* Other attributes */ | |
10126 | if ((count = community_count ())) | |
10127 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
10128 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10129 | count * sizeof (struct community)), | |
10130 | VTY_NEWLINE); | |
10131 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
10132 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
10133 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10134 | count * sizeof (struct ecommunity)), | |
10135 | VTY_NEWLINE); | |
10136 | ||
10137 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
10138 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
10139 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10140 | count * sizeof (struct cluster_list)), | |
10141 | VTY_NEWLINE); | |
10142 | ||
10143 | /* Peer related usage */ | |
10144 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
10145 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
10146 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10147 | count * sizeof (struct peer)), | |
10148 | VTY_NEWLINE); | |
10149 | ||
6e919709 | 10150 | if ((count = mtype_stats_alloc (MTYPE_BGP_PEER_GROUP))) |
4bf6a362 PJ |
10151 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
10152 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10153 | count * sizeof (struct peer_group)), | |
10154 | VTY_NEWLINE); | |
10155 | ||
10156 | /* Other */ | |
10157 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
10158 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
10159 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10160 | count * sizeof (struct hash)), | |
10161 | VTY_NEWLINE); | |
10162 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
10163 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
10164 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10165 | count * sizeof (struct hash_backet)), | |
10166 | VTY_NEWLINE); | |
10167 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
10168 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
10169 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10170 | count * sizeof (regex_t)), | |
10171 | VTY_NEWLINE); | |
10172 | return CMD_SUCCESS; | |
10173 | } | |
fee0f4c6 | 10174 | |
718e3744 | 10175 | /* Show BGP peer's summary information. */ |
94f2b392 | 10176 | static int |
b05a1c8b | 10177 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, |
9f689658 | 10178 | u_char use_json, json_object *json) |
718e3744 | 10179 | { |
10180 | struct peer *peer; | |
1eb8ef25 | 10181 | struct listnode *node, *nnode; |
f14e6fdb DS |
10182 | unsigned int count = 0, dn_count = 0; |
10183 | char timebuf[BGP_UPTIME_LEN], dn_flag[2]; | |
718e3744 | 10184 | int len; |
ffd0c037 DS |
10185 | json_object *json_peer = NULL; |
10186 | json_object *json_peers = NULL; | |
718e3744 | 10187 | |
10188 | /* Header string for each address family. */ | |
4a7ac06c | 10189 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; |
47fc97cc | 10190 | |
b05a1c8b DS |
10191 | if (use_json) |
10192 | { | |
9f689658 DD |
10193 | if (json == NULL) |
10194 | json = json_object_new_object(); | |
10195 | ||
f1aa5d8a | 10196 | json_peers = json_object_new_object(); |
b05a1c8b DS |
10197 | } |
10198 | ||
1eb8ef25 | 10199 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 10200 | { |
1ff9a340 DS |
10201 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
10202 | continue; | |
10203 | ||
718e3744 | 10204 | if (peer->afc[afi][safi]) |
10205 | { | |
b05a1c8b | 10206 | if (!count) |
4bf6a362 PJ |
10207 | { |
10208 | unsigned long ents; | |
10209 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
5c81a5f3 | 10210 | int vrf_id_ui; |
10211 | ||
10212 | vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id; | |
b05a1c8b | 10213 | |
4bf6a362 | 10214 | /* Usage summary and header */ |
b05a1c8b DS |
10215 | if (use_json) |
10216 | { | |
62d6dca0 | 10217 | json_object_string_add(json, "routerId", inet_ntoa (bgp->router_id)); |
f1aa5d8a | 10218 | json_object_int_add(json, "as", bgp->as); |
9f689658 DD |
10219 | json_object_int_add(json, "vrfId", vrf_id_ui); |
10220 | json_object_string_add(json, "vrfName", | |
10221 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10222 | ? "Default" : bgp->name); | |
b05a1c8b DS |
10223 | } |
10224 | else | |
10225 | { | |
10226 | vty_out (vty, | |
5c81a5f3 | 10227 | "BGP router identifier %s, local AS number %u vrf-id %d", |
10228 | inet_ntoa (bgp->router_id), bgp->as, vrf_id_ui); | |
6aeb9e78 | 10229 | vty_out (vty, "%s", VTY_NEWLINE); |
b05a1c8b DS |
10230 | } |
10231 | ||
f188f2c4 DS |
10232 | if (bgp_update_delay_configured(bgp)) |
10233 | { | |
b05a1c8b | 10234 | if (use_json) |
f188f2c4 | 10235 | { |
62d6dca0 | 10236 | json_object_int_add(json, "updateDelayLimit", bgp->v_update_delay); |
b05a1c8b DS |
10237 | |
10238 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
62d6dca0 | 10239 | json_object_int_add(json, "updateDelayEstablishWait", bgp->v_establish_wait); |
b05a1c8b DS |
10240 | |
10241 | if (bgp_update_delay_active(bgp)) | |
10242 | { | |
62d6dca0 DS |
10243 | json_object_string_add(json, "updateDelayFirstNeighbor", bgp->update_delay_begin_time); |
10244 | json_object_boolean_true_add(json, "updateDelayInProgress"); | |
b05a1c8b DS |
10245 | } |
10246 | else | |
10247 | { | |
10248 | if (bgp->update_delay_over) | |
10249 | { | |
62d6dca0 | 10250 | json_object_string_add(json, "updateDelayFirstNeighbor", |
f1aa5d8a | 10251 | bgp->update_delay_begin_time); |
62d6dca0 | 10252 | json_object_string_add(json, "updateDelayBestpathResumed", |
f1aa5d8a | 10253 | bgp->update_delay_end_time); |
62d6dca0 | 10254 | json_object_string_add(json, "updateDelayZebraUpdateResume", |
f1aa5d8a | 10255 | bgp->update_delay_zebra_resume_time); |
62d6dca0 | 10256 | json_object_string_add(json, "updateDelayPeerUpdateResume", |
f1aa5d8a | 10257 | bgp->update_delay_peers_resume_time); |
b05a1c8b DS |
10258 | } |
10259 | } | |
f188f2c4 DS |
10260 | } |
10261 | else | |
10262 | { | |
b05a1c8b DS |
10263 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", |
10264 | bgp->v_update_delay, VTY_NEWLINE); | |
10265 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
10266 | vty_out (vty, " Establish wait: %d seconds%s", | |
10267 | bgp->v_establish_wait, VTY_NEWLINE); | |
10268 | ||
10269 | if (bgp_update_delay_active(bgp)) | |
f188f2c4 DS |
10270 | { |
10271 | vty_out (vty, " First neighbor established: %s%s", | |
10272 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
b05a1c8b DS |
10273 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); |
10274 | } | |
10275 | else | |
10276 | { | |
10277 | if (bgp->update_delay_over) | |
10278 | { | |
10279 | vty_out (vty, " First neighbor established: %s%s", | |
10280 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
10281 | vty_out (vty, " Best-paths resumed: %s%s", | |
10282 | bgp->update_delay_end_time, VTY_NEWLINE); | |
10283 | vty_out (vty, " zebra update resumed: %s%s", | |
10284 | bgp->update_delay_zebra_resume_time, VTY_NEWLINE); | |
10285 | vty_out (vty, " peers update resumed: %s%s", | |
10286 | bgp->update_delay_peers_resume_time, VTY_NEWLINE); | |
10287 | } | |
f188f2c4 DS |
10288 | } |
10289 | } | |
10290 | } | |
4bf6a362 | 10291 | |
b05a1c8b DS |
10292 | if (use_json) |
10293 | { | |
10294 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
62d6dca0 | 10295 | json_object_boolean_true_add(json, "maxMedOnStartup"); |
b05a1c8b | 10296 | if (bgp->v_maxmed_admin) |
62d6dca0 | 10297 | json_object_boolean_true_add(json, "maxMedAdministrative"); |
b05a1c8b | 10298 | |
62d6dca0 | 10299 | json_object_int_add(json, "tableVersion", bgp_table_version(bgp->rib[afi][safi])); |
b05a1c8b DS |
10300 | |
10301 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
62d6dca0 DS |
10302 | json_object_int_add(json, "ribCount", ents); |
10303 | json_object_int_add(json, "ribMemory", ents * sizeof (struct bgp_node)); | |
b05a1c8b DS |
10304 | |
10305 | ents = listcount (bgp->peer); | |
62d6dca0 DS |
10306 | json_object_int_add(json, "peerCount", ents); |
10307 | json_object_int_add(json, "peerMemory", ents * sizeof (struct peer)); | |
b05a1c8b | 10308 | |
b05a1c8b DS |
10309 | if ((ents = listcount (bgp->group))) |
10310 | { | |
62d6dca0 DS |
10311 | json_object_int_add(json, "peerGroupCount", ents); |
10312 | json_object_int_add(json, "peerGroupMemory", ents * sizeof (struct peer_group)); | |
b05a1c8b | 10313 | } |
3f9c7369 | 10314 | |
b05a1c8b | 10315 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
62d6dca0 | 10316 | json_object_boolean_true_add(json, "dampeningEnabled"); |
b05a1c8b DS |
10317 | } |
10318 | else | |
10319 | { | |
10320 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
10321 | vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE); | |
10322 | if (bgp->v_maxmed_admin) | |
10323 | vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE); | |
10324 | ||
ffd0c037 | 10325 | vty_out(vty, "BGP table version %" PRIu64 "%s", |
b05a1c8b DS |
10326 | bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE); |
10327 | ||
10328 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
10329 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
10330 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10331 | ents * sizeof (struct bgp_node)), | |
10332 | VTY_NEWLINE); | |
10333 | ||
10334 | /* Peer related usage */ | |
10335 | ents = listcount (bgp->peer); | |
10336 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
10337 | ents, | |
10338 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10339 | ents * sizeof (struct peer)), | |
10340 | VTY_NEWLINE); | |
10341 | ||
b05a1c8b DS |
10342 | if ((ents = listcount (bgp->group))) |
10343 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
10344 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10345 | ents * sizeof (struct peer_group)), | |
10346 | VTY_NEWLINE); | |
10347 | ||
10348 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
10349 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
10350 | vty_out (vty, "%s", VTY_NEWLINE); | |
10351 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
10352 | } | |
4bf6a362 PJ |
10353 | } |
10354 | ||
b05a1c8b | 10355 | count++; |
718e3744 | 10356 | |
b05a1c8b DS |
10357 | if (use_json) |
10358 | { | |
10359 | json_peer = json_object_new_object(); | |
f14e6fdb | 10360 | |
b05a1c8b | 10361 | if (peer_dynamic_neighbor(peer)) |
62d6dca0 | 10362 | json_object_boolean_true_add(json_peer, "dynamicPeer"); |
b05a1c8b | 10363 | |
04b6bdc0 DW |
10364 | if (peer->hostname) |
10365 | json_object_string_add(json_peer, "hostname", peer->hostname); | |
10366 | ||
10367 | if (peer->domainname) | |
10368 | json_object_string_add(json_peer, "domainname", peer->domainname); | |
10369 | ||
62d6dca0 | 10370 | json_object_int_add(json_peer, "remoteAs", peer->as); |
f1aa5d8a | 10371 | json_object_int_add(json_peer, "version", 4); |
62d6dca0 | 10372 | json_object_int_add(json_peer, "msgRcvd", |
f1aa5d8a DS |
10373 | peer->open_in + peer->update_in + peer->keepalive_in |
10374 | + peer->notify_in + peer->refresh_in | |
10375 | + peer->dynamic_cap_in); | |
62d6dca0 | 10376 | json_object_int_add(json_peer, "msgSent", |
f1aa5d8a DS |
10377 | peer->open_out + peer->update_out + peer->keepalive_out |
10378 | + peer->notify_out + peer->refresh_out | |
10379 | + peer->dynamic_cap_out); | |
10380 | ||
62d6dca0 | 10381 | json_object_int_add(json_peer, "tableVersion", peer->version[afi][safi]); |
f1aa5d8a DS |
10382 | json_object_int_add(json_peer, "outq", peer->obuf->count); |
10383 | json_object_int_add(json_peer, "inq", 0); | |
856ca177 | 10384 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, use_json, json_peer); |
62d6dca0 | 10385 | json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][safi]); |
b05a1c8b DS |
10386 | |
10387 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
f1aa5d8a | 10388 | json_object_string_add(json_peer, "state", "Idle (Admin)"); |
b05a1c8b | 10389 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
f1aa5d8a | 10390 | json_object_string_add(json_peer, "state", "Idle (PfxCt)"); |
b05a1c8b | 10391 | else |
f1aa5d8a | 10392 | json_object_string_add(json_peer, "state", LOOKUP(bgp_status_msg, peer->status)); |
b05a1c8b | 10393 | |
f1aa5d8a | 10394 | if (peer->conf_if) |
62d6dca0 | 10395 | json_object_string_add(json_peer, "idType", "interface"); |
f1aa5d8a | 10396 | else if (peer->su.sa.sa_family == AF_INET) |
62d6dca0 | 10397 | json_object_string_add(json_peer, "idType", "ipv4"); |
f1aa5d8a | 10398 | else if (peer->su.sa.sa_family == AF_INET6) |
62d6dca0 | 10399 | json_object_string_add(json_peer, "idType", "ipv6"); |
b05a1c8b | 10400 | |
f1aa5d8a | 10401 | json_object_object_add(json_peers, peer->host, json_peer); |
b05a1c8b DS |
10402 | } |
10403 | else | |
10404 | { | |
10405 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
10406 | if (peer_dynamic_neighbor(peer)) | |
10407 | { | |
10408 | dn_count++; | |
10409 | dn_flag[0] = '*'; | |
10410 | } | |
10411 | ||
04b6bdc0 DW |
10412 | if (peer->hostname && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME)) |
10413 | len = vty_out (vty, "%s%s(%s)", dn_flag, peer->hostname, | |
10414 | peer->host); | |
10415 | else | |
10416 | len = vty_out (vty, "%s%s", dn_flag, peer->host); | |
b05a1c8b DS |
10417 | len = 16 - len; |
10418 | ||
10419 | if (len < 1) | |
10420 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
10421 | else | |
10422 | vty_out (vty, "%*s", len, " "); | |
10423 | ||
10424 | vty_out (vty, "4 "); | |
10425 | ||
ee046671 | 10426 | vty_out (vty, "%5u %7d %7d %8" PRIu64 " %4d %4zd ", |
b05a1c8b DS |
10427 | peer->as, |
10428 | peer->open_in + peer->update_in + peer->keepalive_in | |
10429 | + peer->notify_in + peer->refresh_in | |
10430 | + peer->dynamic_cap_in, | |
10431 | peer->open_out + peer->update_out + peer->keepalive_out | |
10432 | + peer->notify_out + peer->refresh_out | |
10433 | + peer->dynamic_cap_out, | |
10434 | peer->version[afi][safi], | |
10435 | 0, | |
ffd0c037 | 10436 | peer->obuf->count); |
b05a1c8b | 10437 | |
f1aa5d8a | 10438 | vty_out (vty, "%-8s", |
856ca177 | 10439 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); |
b05a1c8b DS |
10440 | |
10441 | if (peer->status == Established) | |
10442 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); | |
10443 | else | |
10444 | { | |
10445 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
10446 | vty_out (vty, " Idle (Admin)"); | |
10447 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
10448 | vty_out (vty, " Idle (PfxCt)"); | |
10449 | else | |
10450 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
10451 | } | |
10452 | vty_out (vty, "%s", VTY_NEWLINE); | |
10453 | } | |
718e3744 | 10454 | } |
10455 | } | |
10456 | ||
b05a1c8b DS |
10457 | if (use_json) |
10458 | { | |
10459 | json_object_object_add(json, "peers", json_peers); | |
14151a32 | 10460 | |
62d6dca0 DS |
10461 | json_object_int_add(json, "totalPeers", count); |
10462 | json_object_int_add(json, "dynamicPeers", dn_count); | |
14151a32 | 10463 | |
b05a1c8b | 10464 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); |
f1aa5d8a | 10465 | json_object_free(json); |
b05a1c8b DS |
10466 | } |
10467 | else | |
f14e6fdb | 10468 | { |
b05a1c8b DS |
10469 | if (count) |
10470 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
10471 | count, VTY_NEWLINE); | |
10472 | else | |
9f689658 DD |
10473 | { |
10474 | if (use_json) | |
10475 | vty_out(vty, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s", | |
10476 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
10477 | else | |
10478 | vty_out (vty, "No %s neighbor is configured%s", | |
10479 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
10480 | } | |
b05a1c8b | 10481 | |
9f689658 | 10482 | if (dn_count && ! use_json) |
b05a1c8b DS |
10483 | { |
10484 | vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE); | |
10485 | vty_out(vty, | |
10486 | "%d dynamic neighbor(s), limit %d%s", | |
10487 | dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
10488 | } | |
f14e6fdb DS |
10489 | } |
10490 | ||
718e3744 | 10491 | return CMD_SUCCESS; |
10492 | } | |
10493 | ||
47fc97cc DS |
10494 | static int |
10495 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
b05a1c8b | 10496 | afi_t afi, safi_t safi, u_char use_json) |
718e3744 | 10497 | { |
10498 | struct bgp *bgp; | |
10499 | ||
10500 | if (name) | |
10501 | { | |
10502 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 10503 | |
718e3744 | 10504 | if (! bgp) |
10505 | { | |
47fc97cc | 10506 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 10507 | return CMD_WARNING; |
10508 | } | |
10509 | ||
9f689658 | 10510 | bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); |
718e3744 | 10511 | return CMD_SUCCESS; |
10512 | } | |
47fc97cc | 10513 | |
718e3744 | 10514 | bgp = bgp_get_default (); |
10515 | ||
10516 | if (bgp) | |
9f689658 | 10517 | bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); |
47fc97cc | 10518 | |
718e3744 | 10519 | return CMD_SUCCESS; |
10520 | } | |
10521 | ||
f186de26 | 10522 | static void |
10523 | bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi, | |
10524 | u_char use_json) | |
10525 | { | |
10526 | struct listnode *node, *nnode; | |
10527 | struct bgp *bgp; | |
9f689658 DD |
10528 | json_object *json = NULL; |
10529 | int is_first = 1; | |
10530 | ||
10531 | if (use_json) | |
10532 | vty_out (vty, "{%s", VTY_NEWLINE); | |
f186de26 | 10533 | |
10534 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
10535 | { | |
9f689658 DD |
10536 | if (use_json) |
10537 | { | |
10538 | if (!(json = json_object_new_object())) | |
10539 | { | |
10540 | zlog_err("Unable to allocate memory for JSON object"); | |
10541 | vty_out (vty, | |
10542 | "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s", | |
10543 | VTY_NEWLINE); | |
10544 | return; | |
10545 | } | |
10546 | ||
10547 | if (! is_first) | |
10548 | vty_out (vty, ",%s", VTY_NEWLINE); | |
10549 | else | |
10550 | is_first = 0; | |
10551 | ||
10552 | vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10553 | ? "Default" : bgp->name); | |
10554 | } | |
10555 | else | |
10556 | { | |
10557 | vty_out (vty, "%sInstance %s:%s", | |
10558 | VTY_NEWLINE, | |
10559 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10560 | ? "Default" : bgp->name, VTY_NEWLINE); | |
10561 | } | |
10562 | bgp_show_summary (vty, bgp, afi, safi, use_json, json); | |
f186de26 | 10563 | } |
9f689658 DD |
10564 | |
10565 | if (use_json) | |
10566 | vty_out (vty, "}%s", VTY_NEWLINE); | |
10567 | ||
f186de26 | 10568 | } |
10569 | ||
718e3744 | 10570 | /* `show ip bgp summary' commands. */ |
47fc97cc | 10571 | DEFUN (show_ip_bgp_summary, |
718e3744 | 10572 | show_ip_bgp_summary_cmd, |
b05a1c8b | 10573 | "show ip bgp summary {json}", |
47fc97cc DS |
10574 | SHOW_STR |
10575 | IP_STR | |
10576 | BGP_STR | |
b05a1c8b DS |
10577 | "Summary of BGP neighbor status\n" |
10578 | "JavaScript Object Notation\n") | |
47fc97cc | 10579 | { |
db7c8528 DS |
10580 | u_char uj = use_json(argc, argv); |
10581 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); | |
718e3744 | 10582 | } |
10583 | ||
10584 | DEFUN (show_ip_bgp_instance_summary, | |
10585 | show_ip_bgp_instance_summary_cmd, | |
8386ac43 | 10586 | "show ip bgp " BGP_INSTANCE_CMD " summary {json}", |
718e3744 | 10587 | SHOW_STR |
10588 | IP_STR | |
10589 | BGP_STR | |
8386ac43 | 10590 | BGP_INSTANCE_HELP_STR |
b05a1c8b DS |
10591 | "Summary of BGP neighbor status\n" |
10592 | "JavaScript Object Notation\n") | |
718e3744 | 10593 | { |
db7c8528 | 10594 | u_char uj = use_json(argc, argv); |
6aeb9e78 | 10595 | return bgp_show_summary_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10596 | } |
10597 | ||
f186de26 | 10598 | DEFUN (show_ip_bgp_instance_all_summary, |
10599 | show_ip_bgp_instance_all_summary_cmd, | |
10600 | "show ip bgp " BGP_INSTANCE_ALL_CMD " summary {json}", | |
10601 | SHOW_STR | |
10602 | IP_STR | |
10603 | BGP_STR | |
10604 | BGP_INSTANCE_ALL_HELP_STR | |
10605 | "Summary of BGP neighbor status\n" | |
10606 | "JavaScript Object Notation\n") | |
10607 | { | |
10608 | u_char uj = use_json(argc, argv); | |
10609 | ||
10610 | bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj); | |
10611 | return CMD_SUCCESS; | |
10612 | } | |
10613 | ||
718e3744 | 10614 | DEFUN (show_ip_bgp_ipv4_summary, |
10615 | show_ip_bgp_ipv4_summary_cmd, | |
b05a1c8b | 10616 | "show ip bgp ipv4 (unicast|multicast) summary {json}", |
718e3744 | 10617 | SHOW_STR |
10618 | IP_STR | |
10619 | BGP_STR | |
10620 | "Address family\n" | |
10621 | "Address Family modifier\n" | |
10622 | "Address Family modifier\n" | |
b05a1c8b DS |
10623 | "Summary of BGP neighbor status\n" |
10624 | "JavaScript Object Notation\n") | |
718e3744 | 10625 | { |
db7c8528 | 10626 | u_char uj = use_json(argc, argv); |
718e3744 | 10627 | if (strncmp (argv[0], "m", 1) == 0) |
db7c8528 | 10628 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj); |
718e3744 | 10629 | |
db7c8528 | 10630 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10631 | } |
10632 | ||
95cbbd2a ML |
10633 | ALIAS (show_ip_bgp_ipv4_summary, |
10634 | show_bgp_ipv4_safi_summary_cmd, | |
b05a1c8b | 10635 | "show bgp ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10636 | SHOW_STR |
10637 | BGP_STR | |
10638 | "Address family\n" | |
10639 | "Address Family modifier\n" | |
10640 | "Address Family modifier\n" | |
10641 | "Summary of BGP neighbor status\n") | |
10642 | ||
718e3744 | 10643 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
10644 | show_ip_bgp_instance_ipv4_summary_cmd, | |
b05a1c8b | 10645 | "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}", |
718e3744 | 10646 | SHOW_STR |
10647 | IP_STR | |
10648 | BGP_STR | |
10649 | "BGP view\n" | |
10650 | "View name\n" | |
10651 | "Address family\n" | |
10652 | "Address Family modifier\n" | |
10653 | "Address Family modifier\n" | |
b05a1c8b DS |
10654 | "Summary of BGP neighbor status\n" |
10655 | "JavaScript Object Notation\n") | |
718e3744 | 10656 | { |
db7c8528 | 10657 | u_char uj = use_json(argc, argv); |
718e3744 | 10658 | if (strncmp (argv[1], "m", 1) == 0) |
db7c8528 | 10659 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, uj); |
718e3744 | 10660 | else |
db7c8528 | 10661 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10662 | } |
10663 | ||
95cbbd2a ML |
10664 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
10665 | show_bgp_instance_ipv4_safi_summary_cmd, | |
b05a1c8b | 10666 | "show bgp view WORD ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10667 | SHOW_STR |
10668 | BGP_STR | |
10669 | "BGP view\n" | |
10670 | "View name\n" | |
10671 | "Address family\n" | |
10672 | "Address Family modifier\n" | |
10673 | "Address Family modifier\n" | |
10674 | "Summary of BGP neighbor status\n") | |
10675 | ||
718e3744 | 10676 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
10677 | show_ip_bgp_vpnv4_all_summary_cmd, | |
b05a1c8b | 10678 | "show ip bgp vpnv4 all summary {json}", |
718e3744 | 10679 | SHOW_STR |
10680 | IP_STR | |
10681 | BGP_STR | |
10682 | "Display VPNv4 NLRI specific information\n" | |
10683 | "Display information about all VPNv4 NLRIs\n" | |
b05a1c8b DS |
10684 | "Summary of BGP neighbor status\n" |
10685 | "JavaScript Object Notation\n") | |
718e3744 | 10686 | { |
db7c8528 DS |
10687 | u_char uj = use_json(argc, argv); |
10688 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); | |
718e3744 | 10689 | } |
10690 | ||
10691 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
10692 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
b05a1c8b | 10693 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}", |
718e3744 | 10694 | SHOW_STR |
10695 | IP_STR | |
10696 | BGP_STR | |
10697 | "Display VPNv4 NLRI specific information\n" | |
10698 | "Display information for a route distinguisher\n" | |
10699 | "VPN Route Distinguisher\n" | |
b05a1c8b DS |
10700 | "Summary of BGP neighbor status\n" |
10701 | "JavaScript Object Notation\n") | |
718e3744 | 10702 | { |
10703 | int ret; | |
10704 | struct prefix_rd prd; | |
db7c8528 | 10705 | u_char uj = use_json(argc, argv); |
718e3744 | 10706 | |
10707 | ret = str2prefix_rd (argv[0], &prd); | |
10708 | if (! ret) | |
10709 | { | |
10710 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
10711 | return CMD_WARNING; | |
10712 | } | |
10713 | ||
db7c8528 | 10714 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); |
718e3744 | 10715 | } |
10716 | ||
10717 | #ifdef HAVE_IPV6 | |
47fc97cc | 10718 | DEFUN (show_bgp_summary, |
718e3744 | 10719 | show_bgp_summary_cmd, |
b05a1c8b | 10720 | "show bgp summary {json}", |
718e3744 | 10721 | SHOW_STR |
10722 | BGP_STR | |
b05a1c8b DS |
10723 | "Summary of BGP neighbor status\n" |
10724 | "JavaScript Object Notation\n") | |
718e3744 | 10725 | { |
db7c8528 | 10726 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); |
718e3744 | 10727 | } |
10728 | ||
10729 | DEFUN (show_bgp_instance_summary, | |
10730 | show_bgp_instance_summary_cmd, | |
8386ac43 | 10731 | "show bgp " BGP_INSTANCE_CMD " summary {json}", |
718e3744 | 10732 | SHOW_STR |
10733 | BGP_STR | |
8386ac43 | 10734 | BGP_INSTANCE_HELP_STR |
b05a1c8b DS |
10735 | "Summary of BGP neighbor status\n" |
10736 | "JavaScript Object Notation\n") | |
718e3744 | 10737 | { |
6aeb9e78 | 10738 | return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); |
718e3744 | 10739 | } |
10740 | ||
f186de26 | 10741 | DEFUN (show_bgp_instance_all_summary, |
10742 | show_bgp_instance_all_summary_cmd, | |
10743 | "show bgp " BGP_INSTANCE_ALL_CMD " summary {json}", | |
10744 | SHOW_STR | |
10745 | BGP_STR | |
10746 | BGP_INSTANCE_ALL_HELP_STR | |
10747 | "Summary of BGP neighbor status\n" | |
10748 | "JavaScript Object Notation\n") | |
10749 | { | |
10750 | u_char uj = use_json(argc, argv); | |
10751 | ||
10752 | bgp_show_all_instances_summary_vty (vty, AFI_IP6, SAFI_UNICAST, uj); | |
10753 | return CMD_SUCCESS; | |
10754 | } | |
10755 | ||
718e3744 | 10756 | ALIAS (show_bgp_summary, |
10757 | show_bgp_ipv6_summary_cmd, | |
b05a1c8b | 10758 | "show bgp ipv6 summary {json}", |
718e3744 | 10759 | SHOW_STR |
10760 | BGP_STR | |
10761 | "Address family\n" | |
10762 | "Summary of BGP neighbor status\n") | |
10763 | ||
10764 | ALIAS (show_bgp_instance_summary, | |
10765 | show_bgp_instance_ipv6_summary_cmd, | |
8386ac43 | 10766 | "show bgp " BGP_INSTANCE_CMD " ipv6 summary {json}", |
718e3744 | 10767 | SHOW_STR |
10768 | BGP_STR | |
8386ac43 | 10769 | BGP_INSTANCE_HELP_STR |
718e3744 | 10770 | "Address family\n" |
10771 | "Summary of BGP neighbor status\n") | |
10772 | ||
95cbbd2a ML |
10773 | DEFUN (show_bgp_ipv6_safi_summary, |
10774 | show_bgp_ipv6_safi_summary_cmd, | |
b05a1c8b | 10775 | "show bgp ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10776 | SHOW_STR |
10777 | BGP_STR | |
10778 | "Address family\n" | |
10779 | "Address Family modifier\n" | |
10780 | "Address Family modifier\n" | |
b05a1c8b DS |
10781 | "Summary of BGP neighbor status\n" |
10782 | "JavaScript Object Notation\n") | |
95cbbd2a | 10783 | { |
db7c8528 | 10784 | u_char uj = use_json(argc, argv); |
95cbbd2a | 10785 | if (strncmp (argv[0], "m", 1) == 0) |
db7c8528 | 10786 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); |
95cbbd2a | 10787 | |
db7c8528 | 10788 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); |
95cbbd2a ML |
10789 | } |
10790 | ||
10791 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
10792 | show_bgp_instance_ipv6_safi_summary_cmd, | |
8386ac43 | 10793 | "show bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10794 | SHOW_STR |
10795 | BGP_STR | |
8386ac43 | 10796 | BGP_INSTANCE_HELP_STR |
95cbbd2a ML |
10797 | "Address family\n" |
10798 | "Address Family modifier\n" | |
10799 | "Address Family modifier\n" | |
b05a1c8b DS |
10800 | "Summary of BGP neighbor status\n" |
10801 | "JavaScript Object Notation\n") | |
95cbbd2a | 10802 | { |
db7c8528 | 10803 | u_char uj = use_json(argc, argv); |
6aeb9e78 DS |
10804 | if (strncmp (argv[2], "m", 1) == 0) |
10805 | return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_MULTICAST, uj); | |
95cbbd2a | 10806 | |
6aeb9e78 | 10807 | return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, uj); |
95cbbd2a ML |
10808 | } |
10809 | ||
718e3744 | 10810 | /* old command */ |
10811 | DEFUN (show_ipv6_bgp_summary, | |
10812 | show_ipv6_bgp_summary_cmd, | |
b05a1c8b | 10813 | "show ipv6 bgp summary {json}", |
718e3744 | 10814 | SHOW_STR |
10815 | IPV6_STR | |
10816 | BGP_STR | |
b05a1c8b DS |
10817 | "Summary of BGP neighbor status\n" |
10818 | "JavaScript Object Notation\n") | |
718e3744 | 10819 | { |
db7c8528 DS |
10820 | u_char uj = use_json(argc, argv); |
10821 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); | |
718e3744 | 10822 | } |
10823 | ||
10824 | /* old command */ | |
10825 | DEFUN (show_ipv6_mbgp_summary, | |
10826 | show_ipv6_mbgp_summary_cmd, | |
b05a1c8b | 10827 | "show ipv6 mbgp summary {json}", |
718e3744 | 10828 | SHOW_STR |
10829 | IPV6_STR | |
10830 | MBGP_STR | |
b05a1c8b DS |
10831 | "Summary of BGP neighbor status\n" |
10832 | "JavaScript Object Notation\n") | |
718e3744 | 10833 | { |
db7c8528 DS |
10834 | u_char uj = use_json(argc, argv); |
10835 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); | |
718e3744 | 10836 | } |
10837 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 10838 | |
fd79ac91 | 10839 | const char * |
538621f2 | 10840 | afi_safi_print (afi_t afi, safi_t safi) |
10841 | { | |
10842 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
10843 | return "IPv4 Unicast"; | |
10844 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
10845 | return "IPv4 Multicast"; | |
10846 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
945c8fe9 | 10847 | return "VPN-IPv4 Unicast"; |
8b1fb8be LB |
10848 | else if (afi == AFI_IP && safi == SAFI_ENCAP) |
10849 | return "ENCAP-IPv4 Unicast"; | |
538621f2 | 10850 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
10851 | return "IPv6 Unicast"; | |
10852 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
10853 | return "IPv6 Multicast"; | |
945c8fe9 LB |
10854 | else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN) |
10855 | return "VPN-IPv6 Unicast"; | |
8b1fb8be LB |
10856 | else if (afi == AFI_IP6 && safi == SAFI_ENCAP) |
10857 | return "ENCAP-IPv6 Unicast"; | |
538621f2 | 10858 | else |
10859 | return "Unknown"; | |
10860 | } | |
10861 | ||
718e3744 | 10862 | /* Show BGP peer's information. */ |
10863 | enum show_type | |
10864 | { | |
10865 | show_all, | |
10866 | show_peer | |
10867 | }; | |
10868 | ||
94f2b392 | 10869 | static void |
856ca177 MS |
10870 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
10871 | u_int16_t adv_smcap, u_int16_t adv_rmcap, u_int16_t rcv_smcap, | |
10872 | u_int16_t rcv_rmcap, u_char use_json, json_object *json_pref) | |
718e3744 | 10873 | { |
10874 | /* Send-Mode */ | |
10875 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
10876 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10877 | { | |
856ca177 MS |
10878 | if (use_json) |
10879 | { | |
10880 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10881 | json_object_string_add(json_pref, "sendMode", "advertisedAndReceived"); | |
10882 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
10883 | json_object_string_add(json_pref, "sendMode", "advertised"); | |
10884 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10885 | json_object_string_add(json_pref, "sendMode", "received"); | |
10886 | } | |
10887 | else | |
10888 | { | |
10889 | vty_out (vty, " Send-mode: "); | |
10890 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
10891 | vty_out (vty, "advertised"); | |
10892 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10893 | vty_out (vty, "%sreceived", | |
10894 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
10895 | ", " : ""); | |
10896 | vty_out (vty, "%s", VTY_NEWLINE); | |
10897 | } | |
718e3744 | 10898 | } |
10899 | ||
10900 | /* Receive-Mode */ | |
10901 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
10902 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10903 | { | |
856ca177 MS |
10904 | if (use_json) |
10905 | { | |
10906 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10907 | json_object_string_add(json_pref, "recvMode", "advertisedAndReceived"); | |
10908 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
10909 | json_object_string_add(json_pref, "recvMode", "advertised"); | |
10910 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10911 | json_object_string_add(json_pref, "recvMode", "received"); | |
10912 | } | |
10913 | else | |
10914 | { | |
10915 | vty_out (vty, " Receive-mode: "); | |
10916 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
10917 | vty_out (vty, "advertised"); | |
10918 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10919 | vty_out (vty, "%sreceived", | |
10920 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
10921 | ", " : ""); | |
10922 | vty_out (vty, "%s", VTY_NEWLINE); | |
10923 | } | |
718e3744 | 10924 | } |
10925 | } | |
10926 | ||
94f2b392 | 10927 | static void |
856ca177 MS |
10928 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
10929 | u_char use_json, json_object *json_neigh) | |
718e3744 | 10930 | { |
10931 | struct bgp_filter *filter; | |
3f9c7369 | 10932 | struct peer_af *paf; |
718e3744 | 10933 | char orf_pfx_name[BUFSIZ]; |
10934 | int orf_pfx_count; | |
856ca177 MS |
10935 | json_object *json_af = NULL; |
10936 | json_object *json_prefA = NULL; | |
10937 | json_object *json_prefB = NULL; | |
10938 | json_object *json_addr = NULL; | |
718e3744 | 10939 | |
856ca177 MS |
10940 | if (use_json) |
10941 | { | |
10942 | json_addr = json_object_new_object(); | |
10943 | json_af = json_object_new_object(); | |
10944 | json_prefA = json_object_new_object(); | |
10945 | json_prefB = json_object_new_object(); | |
10946 | filter = &p->filter[afi][safi]; | |
718e3744 | 10947 | |
c8560b44 | 10948 | if (peer_group_active(p)) |
856ca177 | 10949 | json_object_string_add(json_addr, "peerGroupMember", p->group->name); |
538621f2 | 10950 | |
856ca177 MS |
10951 | paf = peer_af_find(p, afi, safi); |
10952 | if (paf && PAF_SUBGRP(paf)) | |
10953 | { | |
10954 | json_object_int_add(json_addr, "updateGroupId", PAF_UPDGRP(paf)->id); | |
10955 | json_object_int_add(json_addr, "subGroupId", PAF_SUBGRP(paf)->id); | |
10956 | json_object_int_add(json_addr, "packetQueueLength", bpacket_queue_virtual_length(paf)); | |
10957 | } | |
10958 | ||
10959 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
10960 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
10961 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
10962 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
10963 | { | |
10964 | json_object_int_add(json_af, "orfType", ORF_TYPE_PREFIX); | |
10965 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
10966 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
10967 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
10968 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
10969 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, json_prefA); | |
10970 | json_object_object_add(json_af, "orfPrefixList", json_prefA); | |
10971 | } | |
10972 | ||
10973 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
10974 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
10975 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
10976 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
10977 | { | |
10978 | json_object_int_add(json_af, "orfOldType", ORF_TYPE_PREFIX_OLD); | |
10979 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
10980 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
10981 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
10982 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
10983 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, json_prefB); | |
10984 | json_object_object_add(json_af, "orfOldPrefixList", json_prefB); | |
10985 | } | |
10986 | ||
10987 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
10988 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
10989 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
10990 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
10991 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
10992 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
10993 | json_object_object_add(json_addr, "afDependentCap", json_af); | |
10994 | ||
10995 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
10996 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
10997 | ||
10998 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
10999 | || orf_pfx_count) | |
11000 | { | |
11001 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
11002 | json_object_boolean_true_add(json_neigh, "orfSent"); | |
11003 | if (orf_pfx_count) | |
11004 | json_object_int_add(json_addr, "orfRecvCounter", orf_pfx_count); | |
11005 | } | |
11006 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
11007 | json_object_string_add(json_addr, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd"); | |
11008 | ||
11009 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
11010 | json_object_boolean_true_add(json_addr, "routeReflectorClient"); | |
11011 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
11012 | json_object_boolean_true_add(json_addr, "routeServerClient"); | |
11013 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
11014 | json_object_boolean_true_add(json_addr, "inboundSoftConfigPermit"); | |
11015 | ||
88b8ed8d DW |
11016 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
11017 | json_object_boolean_true_add(json_addr, "privateAsNumsAllReplacedInUpdatesToNbr"); | |
11018 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 11019 | json_object_boolean_true_add(json_addr, "privateAsNumsReplacedInUpdatesToNbr"); |
88b8ed8d DW |
11020 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
11021 | json_object_boolean_true_add(json_addr, "privateAsNumsAllRemovedInUpdatesToNbr"); | |
856ca177 MS |
11022 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
11023 | json_object_boolean_true_add(json_addr, "privateAsNumsRemovedInUpdatesToNbr"); | |
11024 | ||
adbac85e DW |
11025 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) |
11026 | json_object_boolean_true_add(json_addr, "addpathTxAllPaths"); | |
11027 | ||
06370dac DW |
11028 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) |
11029 | json_object_boolean_true_add(json_addr, "addpathTxBestpathPerAS"); | |
11030 | ||
856ca177 MS |
11031 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
11032 | json_object_string_add(json_addr, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs"); | |
11033 | ||
11034 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
11035 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
11036 | json_object_boolean_true_add(json_addr, "routerAlwaysNextHop"); | |
11037 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
11038 | json_object_boolean_true_add(json_addr, "unchangedAsPathPropogatedToNbr"); | |
11039 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
11040 | json_object_boolean_true_add(json_addr, "unchangedNextHopPropogatedToNbr"); | |
11041 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
11042 | json_object_boolean_true_add(json_addr, "unchangedMedPropogatedToNbr"); | |
718e3744 | 11043 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
856ca177 MS |
11044 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
11045 | { | |
11046 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11047 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11048 | json_object_string_add(json_addr, "commAttriSentToNbr", "extendedAndStandard"); | |
11049 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11050 | json_object_string_add(json_addr, "commAttriSentToNbr", "extended"); | |
11051 | else | |
11052 | json_object_string_add(json_addr, "commAttriSentToNbr", "standard"); | |
11053 | } | |
11054 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
11055 | { | |
11056 | if (p->default_rmap[afi][safi].name) | |
11057 | json_object_string_add(json_addr, "defaultRouteMap", p->default_rmap[afi][safi].name); | |
11058 | ||
11059 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
11060 | json_object_boolean_true_add(json_addr, "defaultSent"); | |
11061 | else | |
11062 | json_object_boolean_true_add(json_addr, "defaultNotSent"); | |
11063 | } | |
11064 | ||
11065 | if (filter->plist[FILTER_IN].name | |
11066 | || filter->dlist[FILTER_IN].name | |
11067 | || filter->aslist[FILTER_IN].name | |
11068 | || filter->map[RMAP_IN].name) | |
11069 | json_object_boolean_true_add(json_addr, "inboundPathPolicyConfig"); | |
11070 | if (filter->plist[FILTER_OUT].name | |
11071 | || filter->dlist[FILTER_OUT].name | |
11072 | || filter->aslist[FILTER_OUT].name | |
11073 | || filter->map[RMAP_OUT].name | |
11074 | || filter->usmap.name) | |
11075 | json_object_boolean_true_add(json_addr, "outboundPathPolicyConfig"); | |
856ca177 MS |
11076 | |
11077 | /* prefix-list */ | |
11078 | if (filter->plist[FILTER_IN].name) | |
11079 | json_object_string_add(json_addr, "incomingUpdatePrefixFilterList", filter->plist[FILTER_IN].name); | |
11080 | if (filter->plist[FILTER_OUT].name) | |
11081 | json_object_string_add(json_addr, "outgoingUpdatePrefixFilterList", filter->plist[FILTER_OUT].name); | |
11082 | ||
11083 | /* distribute-list */ | |
11084 | if (filter->dlist[FILTER_IN].name) | |
11085 | json_object_string_add(json_addr, "incomingUpdateNetworkFilterList", filter->dlist[FILTER_IN].name); | |
11086 | if (filter->dlist[FILTER_OUT].name) | |
11087 | json_object_string_add(json_addr, "outgoingUpdateNetworkFilterList", filter->dlist[FILTER_OUT].name); | |
11088 | ||
11089 | /* filter-list. */ | |
11090 | if (filter->aslist[FILTER_IN].name) | |
11091 | json_object_string_add(json_addr, "incomingUpdateAsPathFilterList", filter->aslist[FILTER_IN].name); | |
11092 | if (filter->aslist[FILTER_OUT].name) | |
11093 | json_object_string_add(json_addr, "outgoingUpdateAsPathFilterList", filter->aslist[FILTER_OUT].name); | |
11094 | ||
11095 | /* route-map. */ | |
11096 | if (filter->map[RMAP_IN].name) | |
11097 | json_object_string_add(json_addr, "routeMapForIncomingAdvertisements", filter->map[RMAP_IN].name); | |
11098 | if (filter->map[RMAP_OUT].name) | |
11099 | json_object_string_add(json_addr, "routeMapForOutgoingAdvertisements", filter->map[RMAP_OUT].name); | |
856ca177 MS |
11100 | |
11101 | /* unsuppress-map */ | |
11102 | if (filter->usmap.name) | |
11103 | json_object_string_add(json_addr, "selectiveUnsuppressRouteMap", filter->usmap.name); | |
11104 | ||
11105 | /* Receive prefix count */ | |
11106 | json_object_int_add(json_addr, "acceptedPrefixCounter", p->pcount[afi][safi]); | |
11107 | ||
11108 | /* Maximum prefix */ | |
11109 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
11110 | { | |
11111 | json_object_int_add(json_addr, "prefixAllowedMax", p->pmax[afi][safi]); | |
11112 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) | |
11113 | json_object_boolean_true_add(json_addr, "prefixAllowedMaxWarning"); | |
11114 | json_object_int_add(json_addr, "prefixAllowedWarningThresh", p->pmax_threshold[afi][safi]); | |
11115 | if (p->pmax_restart[afi][safi]) | |
11116 | json_object_int_add(json_addr, "prefixAllowedRestartIntervalMsecs", p->pmax_restart[afi][safi] * 60000); | |
11117 | } | |
11118 | json_object_object_add(json_neigh, afi_safi_print (afi, safi), json_addr); | |
11119 | ||
11120 | } | |
11121 | else | |
11122 | { | |
11123 | filter = &p->filter[afi][safi]; | |
11124 | ||
11125 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), | |
11126 | VTY_NEWLINE); | |
11127 | ||
c8560b44 | 11128 | if (peer_group_active(p)) |
856ca177 MS |
11129 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
11130 | ||
11131 | paf = peer_af_find(p, afi, safi); | |
11132 | if (paf && PAF_SUBGRP(paf)) | |
11133 | { | |
11134 | vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s", | |
11135 | PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE); | |
11136 | vty_out (vty, " Packet Queue length %d%s", | |
11137 | bpacket_queue_virtual_length(paf), VTY_NEWLINE); | |
11138 | } | |
718e3744 | 11139 | else |
856ca177 MS |
11140 | { |
11141 | vty_out(vty, " Not part of any update group%s", VTY_NEWLINE); | |
11142 | } | |
11143 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11144 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
11145 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11146 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11147 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
11148 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11149 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
11150 | ||
11151 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11152 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
11153 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11154 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
11155 | { | |
11156 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
11157 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
11158 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11159 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11160 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11161 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
11162 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, NULL); | |
11163 | } | |
11164 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11165 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11166 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11167 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11168 | { | |
11169 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
11170 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
11171 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11172 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11173 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11174 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
11175 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, NULL); | |
11176 | } | |
718e3744 | 11177 | |
856ca177 MS |
11178 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
11179 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
718e3744 | 11180 | |
856ca177 MS |
11181 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
11182 | || orf_pfx_count) | |
11183 | { | |
11184 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
11185 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
11186 | vty_out (vty, " sent;"); | |
11187 | if (orf_pfx_count) | |
11188 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
11189 | vty_out (vty, "%s", VTY_NEWLINE); | |
11190 | } | |
11191 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
11192 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
11193 | ||
11194 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
11195 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
11196 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
11197 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
11198 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
11199 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
11200 | ||
88b8ed8d DW |
11201 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
11202 | vty_out (vty, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE); | |
11203 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 11204 | vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE); |
88b8ed8d DW |
11205 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
11206 | vty_out (vty, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE); | |
856ca177 MS |
11207 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
11208 | vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE); | |
11209 | ||
adbac85e DW |
11210 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) |
11211 | vty_out (vty, " Advertise all paths via addpath%s", VTY_NEWLINE); | |
11212 | ||
06370dac DW |
11213 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) |
11214 | vty_out (vty, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE); | |
11215 | ||
856ca177 MS |
11216 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
11217 | vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE); | |
11218 | ||
11219 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
11220 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
11221 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); | |
11222 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
11223 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11224 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
11225 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11226 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
11227 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11228 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11229 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11230 | { | |
11231 | vty_out (vty, " Community attribute sent to this neighbor"); | |
11232 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11233 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11234 | vty_out (vty, "(both)%s", VTY_NEWLINE); | |
11235 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11236 | vty_out (vty, "(extended)%s", VTY_NEWLINE); | |
11237 | else | |
11238 | vty_out (vty, "(standard)%s", VTY_NEWLINE); | |
11239 | } | |
11240 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
11241 | { | |
11242 | vty_out (vty, " Default information originate,"); | |
11243 | ||
11244 | if (p->default_rmap[afi][safi].name) | |
11245 | vty_out (vty, " default route-map %s%s,", | |
11246 | p->default_rmap[afi][safi].map ? "*" : "", | |
11247 | p->default_rmap[afi][safi].name); | |
11248 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
11249 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
11250 | else | |
11251 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
11252 | } | |
718e3744 | 11253 | |
856ca177 MS |
11254 | if (filter->plist[FILTER_IN].name |
11255 | || filter->dlist[FILTER_IN].name | |
11256 | || filter->aslist[FILTER_IN].name | |
11257 | || filter->map[RMAP_IN].name) | |
11258 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); | |
11259 | if (filter->plist[FILTER_OUT].name | |
11260 | || filter->dlist[FILTER_OUT].name | |
11261 | || filter->aslist[FILTER_OUT].name | |
11262 | || filter->map[RMAP_OUT].name | |
11263 | || filter->usmap.name) | |
11264 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
856ca177 MS |
11265 | |
11266 | /* prefix-list */ | |
11267 | if (filter->plist[FILTER_IN].name) | |
11268 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
11269 | filter->plist[FILTER_IN].plist ? "*" : "", | |
11270 | filter->plist[FILTER_IN].name, | |
11271 | VTY_NEWLINE); | |
11272 | if (filter->plist[FILTER_OUT].name) | |
11273 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
11274 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
11275 | filter->plist[FILTER_OUT].name, | |
11276 | VTY_NEWLINE); | |
11277 | ||
11278 | /* distribute-list */ | |
11279 | if (filter->dlist[FILTER_IN].name) | |
11280 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
11281 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
11282 | filter->dlist[FILTER_IN].name, | |
11283 | VTY_NEWLINE); | |
11284 | if (filter->dlist[FILTER_OUT].name) | |
11285 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
11286 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
11287 | filter->dlist[FILTER_OUT].name, | |
11288 | VTY_NEWLINE); | |
11289 | ||
11290 | /* filter-list. */ | |
11291 | if (filter->aslist[FILTER_IN].name) | |
11292 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
11293 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
11294 | filter->aslist[FILTER_IN].name, | |
11295 | VTY_NEWLINE); | |
11296 | if (filter->aslist[FILTER_OUT].name) | |
11297 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
11298 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
11299 | filter->aslist[FILTER_OUT].name, | |
11300 | VTY_NEWLINE); | |
11301 | ||
11302 | /* route-map. */ | |
11303 | if (filter->map[RMAP_IN].name) | |
11304 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", | |
11305 | filter->map[RMAP_IN].map ? "*" : "", | |
11306 | filter->map[RMAP_IN].name, | |
11307 | VTY_NEWLINE); | |
11308 | if (filter->map[RMAP_OUT].name) | |
11309 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", | |
11310 | filter->map[RMAP_OUT].map ? "*" : "", | |
11311 | filter->map[RMAP_OUT].name, | |
11312 | VTY_NEWLINE); | |
856ca177 MS |
11313 | |
11314 | /* unsuppress-map */ | |
11315 | if (filter->usmap.name) | |
11316 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
11317 | filter->usmap.map ? "*" : "", | |
11318 | filter->usmap.name, VTY_NEWLINE); | |
11319 | ||
11320 | /* Receive prefix count */ | |
11321 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); | |
11322 | ||
11323 | /* Maximum prefix */ | |
11324 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
11325 | { | |
11326 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], | |
11327 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) | |
11328 | ? " (warning-only)" : "", VTY_NEWLINE); | |
11329 | vty_out (vty, " Threshold for warning message %d%%", | |
11330 | p->pmax_threshold[afi][safi]); | |
11331 | if (p->pmax_restart[afi][safi]) | |
11332 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
11333 | vty_out (vty, "%s", VTY_NEWLINE); | |
11334 | } | |
718e3744 | 11335 | |
0a486e5f | 11336 | vty_out (vty, "%s", VTY_NEWLINE); |
718e3744 | 11337 | } |
718e3744 | 11338 | } |
11339 | ||
94f2b392 | 11340 | static void |
e8f7da3a | 11341 | bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *json) |
718e3744 | 11342 | { |
11343 | struct bgp *bgp; | |
4690c7d7 | 11344 | char buf1[PREFIX2STR_BUFFER], buf[SU_ADDRSTRLEN]; |
718e3744 | 11345 | char timebuf[BGP_UPTIME_LEN]; |
f14e6fdb | 11346 | char dn_flag[2]; |
3a8c7ba1 DW |
11347 | const char *subcode_str; |
11348 | const char *code_str; | |
538621f2 | 11349 | afi_t afi; |
11350 | safi_t safi; | |
d6661008 DS |
11351 | u_int16_t i; |
11352 | u_char *msg; | |
e8f7da3a | 11353 | json_object *json_neigh = NULL; |
718e3744 | 11354 | |
11355 | bgp = p->bgp; | |
11356 | ||
e8f7da3a DW |
11357 | if (use_json) |
11358 | json_neigh = json_object_new_object(); | |
11359 | ||
856ca177 | 11360 | if (!use_json) |
f14e6fdb | 11361 | { |
856ca177 MS |
11362 | if (p->conf_if) /* Configured interface name. */ |
11363 | vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if, | |
11364 | BGP_PEER_SU_UNSPEC(p) ? "None" : | |
11365 | sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
11366 | else /* Configured IP address. */ | |
11367 | { | |
11368 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
11369 | if (peer_dynamic_neighbor(p)) | |
11370 | dn_flag[0] = '*'; | |
f14e6fdb | 11371 | |
856ca177 MS |
11372 | vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host); |
11373 | } | |
f14e6fdb DS |
11374 | } |
11375 | ||
856ca177 MS |
11376 | if (use_json) |
11377 | { | |
11378 | if (p->conf_if && BGP_PEER_SU_UNSPEC(p)) | |
11379 | json_object_string_add(json_neigh, "bgpNeighborAddr", "none"); | |
11380 | else if (p->conf_if && !BGP_PEER_SU_UNSPEC(p)) | |
11381 | json_object_string_add(json_neigh, "bgpNeighborAddr", sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
11382 | ||
11383 | json_object_int_add(json_neigh, "remoteAs", p->as); | |
11384 | ||
11385 | if (p->change_local_as) | |
11386 | json_object_int_add(json_neigh, "localAs", p->change_local_as); | |
11387 | else | |
11388 | json_object_int_add(json_neigh, "localAs", p->local_as); | |
11389 | ||
11390 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND)) | |
11391 | json_object_boolean_true_add(json_neigh, "localAsNoPrepend"); | |
66b199b2 | 11392 | |
856ca177 MS |
11393 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS)) |
11394 | json_object_boolean_true_add(json_neigh, "localAsReplaceAs"); | |
11395 | } | |
11396 | else | |
11397 | { | |
f8cfafda DS |
11398 | if ((p->as_type == AS_SPECIFIED) || |
11399 | (p->as_type == AS_EXTERNAL) || | |
11400 | (p->as_type == AS_INTERNAL)) | |
11401 | vty_out (vty, "remote AS %u, ", p->as); | |
11402 | else | |
11403 | vty_out (vty, "remote AS Unspecified, "); | |
856ca177 MS |
11404 | vty_out (vty, "local AS %u%s%s, ", |
11405 | p->change_local_as ? p->change_local_as : p->local_as, | |
11406 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
11407 | " no-prepend" : "", | |
11408 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
11409 | " replace-as" : ""); | |
11410 | } | |
66b199b2 DS |
11411 | /* peer type internal, external, confed-internal or confed-external */ |
11412 | if (p->as == p->local_as) | |
11413 | { | |
856ca177 MS |
11414 | if (use_json) |
11415 | { | |
11416 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11417 | json_object_boolean_true_add(json_neigh, "nbrConfedInternalLink"); | |
11418 | else | |
11419 | json_object_boolean_true_add(json_neigh, "nbrInternalLink"); | |
11420 | } | |
66b199b2 | 11421 | else |
856ca177 MS |
11422 | { |
11423 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11424 | vty_out (vty, "confed-internal link%s", VTY_NEWLINE); | |
11425 | else | |
11426 | vty_out (vty, "internal link%s", VTY_NEWLINE); | |
11427 | } | |
66b199b2 DS |
11428 | } |
11429 | else | |
11430 | { | |
856ca177 MS |
11431 | if (use_json) |
11432 | { | |
11433 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11434 | json_object_boolean_true_add(json_neigh, "nbrConfedExternalLink"); | |
11435 | else | |
11436 | json_object_boolean_true_add(json_neigh, "nbrExternalLink"); | |
11437 | } | |
66b199b2 | 11438 | else |
856ca177 MS |
11439 | { |
11440 | if (bgp_confederation_peers_check(bgp, p->as)) | |
11441 | vty_out (vty, "confed-external link%s", VTY_NEWLINE); | |
11442 | else | |
11443 | vty_out (vty, "external link%s", VTY_NEWLINE); | |
11444 | } | |
66b199b2 | 11445 | } |
718e3744 | 11446 | |
11447 | /* Description. */ | |
11448 | if (p->desc) | |
856ca177 MS |
11449 | { |
11450 | if (use_json) | |
11451 | json_object_string_add(json_neigh, "nbrDesc", p->desc); | |
11452 | else | |
11453 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
11454 | } | |
6410e93a | 11455 | |
04b6bdc0 DW |
11456 | if (p->hostname) |
11457 | { | |
d1570739 DW |
11458 | if (use_json) |
11459 | { | |
11460 | if (p->hostname) | |
11461 | json_object_string_add(json_neigh, "hostname", p->hostname); | |
11462 | ||
11463 | if (p->domainname) | |
11464 | json_object_string_add(json_neigh, "domainname", p->domainname); | |
11465 | } | |
04b6bdc0 | 11466 | else |
d1570739 DW |
11467 | { |
11468 | if (p->domainname && (p->domainname[0] != '\0')) | |
11469 | vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname, | |
11470 | VTY_NEWLINE); | |
11471 | else | |
11472 | vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE); | |
11473 | } | |
11474 | ||
04b6bdc0 DW |
11475 | } |
11476 | ||
c744aa9f | 11477 | /* Peer-group */ |
718e3744 | 11478 | if (p->group) |
f14e6fdb | 11479 | { |
856ca177 MS |
11480 | if (use_json) |
11481 | { | |
11482 | json_object_string_add(json_neigh, "peerGroup", p->group->name); | |
11483 | ||
11484 | if (dn_flag[0]) | |
11485 | { | |
40ee54a7 | 11486 | struct prefix prefix, *range = NULL; |
f14e6fdb | 11487 | |
40ee54a7 TT |
11488 | sockunion2hostprefix(&(p->su), &prefix); |
11489 | range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix); | |
856ca177 MS |
11490 | |
11491 | if (range) | |
11492 | { | |
11493 | prefix2str(range, buf1, sizeof(buf1)); | |
11494 | json_object_string_add(json_neigh, "peerSubnetRangeGroup", buf1); | |
11495 | } | |
11496 | } | |
11497 | } | |
11498 | else | |
f14e6fdb | 11499 | { |
856ca177 MS |
11500 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
11501 | p->group->name, VTY_NEWLINE); | |
f14e6fdb | 11502 | |
856ca177 | 11503 | if (dn_flag[0]) |
f14e6fdb | 11504 | { |
40ee54a7 | 11505 | struct prefix prefix, *range = NULL; |
856ca177 | 11506 | |
40ee54a7 TT |
11507 | sockunion2hostprefix(&(p->su), &prefix); |
11508 | range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix); | |
856ca177 MS |
11509 | |
11510 | if (range) | |
11511 | { | |
11512 | prefix2str(range, buf1, sizeof(buf1)); | |
11513 | vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTY_NEWLINE); | |
11514 | } | |
f14e6fdb DS |
11515 | } |
11516 | } | |
11517 | } | |
718e3744 | 11518 | |
856ca177 MS |
11519 | if (use_json) |
11520 | { | |
11521 | /* Administrative shutdown. */ | |
11522 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
11523 | json_object_boolean_true_add(json_neigh, "adminShutDown"); | |
718e3744 | 11524 | |
856ca177 MS |
11525 | /* BGP Version. */ |
11526 | json_object_int_add(json_neigh, "bgpVersion", 4); | |
11527 | json_object_string_add(json_neigh, "remoteRouterId", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ)); | |
718e3744 | 11528 | |
856ca177 MS |
11529 | /* Confederation */ |
11530 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) && bgp_confederation_peers_check (bgp, p->as)) | |
11531 | json_object_boolean_true_add(json_neigh, "nbrCommonAdmin"); | |
11532 | ||
11533 | /* Status. */ | |
11534 | json_object_string_add(json_neigh, "bgpState", LOOKUP (bgp_status_msg, p->status)); | |
11535 | ||
11536 | if (p->status == Established) | |
11537 | { | |
11538 | time_t uptime; | |
11539 | struct tm *tm; | |
11540 | ||
11541 | uptime = bgp_clock(); | |
11542 | uptime -= p->uptime; | |
11543 | tm = gmtime(&uptime); | |
11544 | ||
11545 | json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
11546 | } | |
11547 | ||
11548 | else if (p->status == Active) | |
11549 | { | |
11550 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
11551 | json_object_string_add(json_neigh, "bgpStateIs", "passive"); | |
11552 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
11553 | json_object_string_add(json_neigh, "bgpStateIs", "passiveNSF"); | |
11554 | } | |
11555 | ||
11556 | /* read timer */ | |
11557 | time_t uptime; | |
11558 | struct tm *tm; | |
11559 | ||
11560 | uptime = bgp_clock(); | |
11561 | uptime -= p->readtime; | |
11562 | tm = gmtime(&uptime); | |
11563 | json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
11564 | ||
11565 | uptime = bgp_clock(); | |
11566 | uptime -= p->last_write; | |
11567 | tm = gmtime(&uptime); | |
39e871e6 ST |
11568 | json_object_int_add(json_neigh, "bgpTimerLastWrite", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); |
11569 | ||
11570 | uptime = bgp_clock(); | |
11571 | uptime -= p->update_time; | |
11572 | tm = gmtime(&uptime); | |
11573 | json_object_int_add(json_neigh, "bgpInUpdateElapsedTimeMsecs", | |
11574 | (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
856ca177 MS |
11575 | |
11576 | /* Configured timer values. */ | |
11577 | json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs", p->v_holdtime * 1000); | |
11578 | json_object_int_add(json_neigh, "bgpTimerKeepAliveIntervalMsecs", p->v_keepalive * 1000); | |
11579 | ||
11580 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
11581 | { | |
11582 | json_object_int_add(json_neigh, "bgpTimerConfiguredHoldTimeMsecs", p->holdtime * 1000); | |
11583 | json_object_int_add(json_neigh, "bgpTimerConfiguredKeepAliveIntervalMsecs", p->keepalive * 1000); | |
11584 | } | |
93406d87 | 11585 | } |
856ca177 MS |
11586 | else |
11587 | { | |
11588 | /* Administrative shutdown. */ | |
11589 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
11590 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
11591 | ||
11592 | /* BGP Version. */ | |
11593 | vty_out (vty, " BGP version 4"); | |
11594 | vty_out (vty, ", remote router ID %s%s", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
11595 | VTY_NEWLINE); | |
11596 | ||
11597 | /* Confederation */ | |
11598 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) | |
11599 | && bgp_confederation_peers_check (bgp, p->as)) | |
11600 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); | |
718e3744 | 11601 | |
856ca177 MS |
11602 | /* Status. */ |
11603 | vty_out (vty, " BGP state = %s", LOOKUP (bgp_status_msg, p->status)); | |
718e3744 | 11604 | |
856ca177 MS |
11605 | if (p->status == Established) |
11606 | vty_out (vty, ", up for %8s", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
11607 | ||
11608 | else if (p->status == Active) | |
11609 | { | |
11610 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
11611 | vty_out (vty, " (passive)"); | |
11612 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
11613 | vty_out (vty, " (NSF passive)"); | |
11614 | } | |
11615 | vty_out (vty, "%s", VTY_NEWLINE); | |
93406d87 | 11616 | |
856ca177 MS |
11617 | /* read timer */ |
11618 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
11619 | vty_out (vty, ", Last write %s%s", | |
11620 | peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTY_NEWLINE); | |
11621 | ||
11622 | /* Configured timer values. */ | |
11623 | vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s", | |
11624 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); | |
11625 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
11626 | { | |
11627 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
11628 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
11629 | p->keepalive, VTY_NEWLINE); | |
11630 | } | |
11631 | } | |
718e3744 | 11632 | /* Capability. */ |
11633 | if (p->status == Established) | |
11634 | { | |
538621f2 | 11635 | if (p->cap |
718e3744 | 11636 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
11637 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
11638 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
11639 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
11640 | #ifdef HAVE_IPV6 | |
11641 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
11642 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
11643 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
11644 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
945c8fe9 LB |
11645 | || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN] |
11646 | || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN] | |
8b1fb8be LB |
11647 | || p->afc_adv[AFI_IP6][SAFI_ENCAP] |
11648 | || p->afc_recv[AFI_IP6][SAFI_ENCAP] | |
718e3744 | 11649 | #endif /* HAVE_IPV6 */ |
8b1fb8be LB |
11650 | || p->afc_adv[AFI_IP][SAFI_ENCAP] |
11651 | || p->afc_recv[AFI_IP][SAFI_ENCAP] | |
718e3744 | 11652 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
11653 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
11654 | { | |
856ca177 MS |
11655 | if (use_json) |
11656 | { | |
11657 | json_object *json_cap = NULL; | |
11658 | ||
11659 | json_cap = json_object_new_object(); | |
11660 | ||
11661 | /* AS4 */ | |
11662 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
11663 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11664 | { | |
11665 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) && CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11666 | json_object_string_add(json_cap, "4byteAs", "advertisedAndReceived"); | |
11667 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11668 | json_object_string_add(json_cap, "4byteAs", "advertised"); | |
11669 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11670 | json_object_string_add(json_cap, "4byteAs", "received"); | |
11671 | } | |
11672 | ||
11673 | /* AddPath */ | |
11674 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
11675 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
11676 | { | |
11677 | json_object *json_add = NULL; | |
11678 | const char *print_store; | |
718e3744 | 11679 | |
856ca177 | 11680 | json_add = json_object_new_object(); |
a82478b9 | 11681 | |
856ca177 MS |
11682 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
11683 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11684 | { | |
11685 | json_object *json_sub = NULL; | |
11686 | json_sub = json_object_new_object(); | |
11687 | print_store = afi_safi_print (afi, safi); | |
11688 | ||
11689 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
11690 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11691 | { | |
11692 | 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)) | |
11693 | json_object_boolean_true_add(json_sub, "txAdvertisedAndReceived"); | |
11694 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) | |
11695 | json_object_boolean_true_add(json_sub, "txAdvertised"); | |
11696 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11697 | json_object_boolean_true_add(json_sub, "txReceived"); | |
11698 | } | |
11699 | ||
11700 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
11701 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11702 | { | |
11703 | 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)) | |
11704 | json_object_boolean_true_add(json_sub, "rxAdvertisedAndReceived"); | |
11705 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) | |
11706 | json_object_boolean_true_add(json_sub, "rxAdvertised"); | |
11707 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11708 | json_object_boolean_true_add(json_sub, "rxReceived"); | |
11709 | } | |
11710 | ||
11711 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
11712 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV) || | |
11713 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
11714 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11715 | json_object_object_add(json_add, print_store, json_sub); | |
11716 | } | |
a82478b9 | 11717 | |
856ca177 MS |
11718 | json_object_object_add(json_cap, "addPath", json_add); |
11719 | } | |
11720 | ||
11721 | /* Dynamic */ | |
11722 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
11723 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11724 | { | |
11725 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) && CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11726 | json_object_string_add(json_cap, "dynamic", "advertisedAndReceived"); | |
11727 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11728 | json_object_string_add(json_cap, "dynamic", "advertised"); | |
11729 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11730 | json_object_string_add(json_cap, "dynamic", "received"); | |
11731 | } | |
11732 | ||
11733 | /* Extended nexthop */ | |
11734 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
11735 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11736 | { | |
11737 | json_object *json_nxt = NULL; | |
11738 | const char *print_store; | |
11739 | ||
11740 | json_nxt = json_object_new_object(); | |
11741 | ||
11742 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) && CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11743 | json_object_string_add(json_cap, "extendedNexthop", "advertisedAndReceived"); | |
11744 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11745 | json_object_string_add(json_cap, "extendedNexthop", "advertised"); | |
11746 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11747 | json_object_string_add(json_cap, "extendedNexthop", "received"); | |
11748 | ||
11749 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11750 | { | |
11751 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11752 | { | |
11753 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
11754 | { | |
11755 | print_store = afi_safi_print (AFI_IP, safi); | |
11756 | json_object_string_add(json_nxt, print_store, "recieved"); | |
11757 | } | |
11758 | } | |
11759 | json_object_object_add(json_cap, "extendedNexthopFamililesByPeer", json_nxt); | |
11760 | } | |
11761 | } | |
11762 | ||
11763 | /* Route Refresh */ | |
11764 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
11765 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11766 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11767 | { | |
11768 | 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))) | |
11769 | { | |
11770 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) | |
11771 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOldNew"); | |
11772 | else | |
11773 | { | |
11774 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11775 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOld"); | |
11776 | else | |
11777 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedNew"); | |
11778 | } | |
11779 | } | |
11780 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
11781 | json_object_string_add(json_cap, "routeRefresh", "advertised"); | |
11782 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11783 | json_object_string_add(json_cap, "routeRefresh", "received"); | |
11784 | } | |
11785 | ||
11786 | /* Multiprotocol Extensions */ | |
11787 | json_object *json_multi = NULL; | |
11788 | json_multi = json_object_new_object(); | |
11789 | ||
11790 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11791 | { | |
11792 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11793 | { | |
11794 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
11795 | { | |
11796 | json_object *json_exten = NULL; | |
11797 | json_exten = json_object_new_object(); | |
11798 | ||
11799 | if (p->afc_adv[afi][safi] && p->afc_recv[afi][safi]) | |
11800 | json_object_boolean_true_add(json_exten, "advertisedAndReceived"); | |
11801 | else if (p->afc_adv[afi][safi]) | |
11802 | json_object_boolean_true_add(json_exten, "advertised"); | |
11803 | else if (p->afc_recv[afi][safi]) | |
11804 | json_object_boolean_true_add(json_exten, "received"); | |
11805 | ||
11806 | json_object_object_add(json_multi, afi_safi_print (afi, safi), json_exten); | |
11807 | } | |
11808 | } | |
11809 | } | |
11810 | json_object_object_add(json_cap, "multiprotocolExtensions", json_multi); | |
11811 | ||
11812 | /* Gracefull Restart */ | |
11813 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
11814 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
11815 | { | |
11816 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) && CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
11817 | json_object_string_add(json_cap, "gracefulRestart", "advertisedAndReceived"); | |
11818 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
11819 | json_object_string_add(json_cap, "gracefulRestartCapability", "advertised"); | |
11820 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
11821 | json_object_string_add(json_cap, "gracefulRestartCapability", "received"); | |
11822 | ||
11823 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
11824 | { | |
11825 | int restart_af_count = 0; | |
11826 | json_object *json_restart = NULL; | |
11827 | json_restart = json_object_new_object(); | |
11828 | ||
11829 | json_object_int_add(json_cap, "gracefulRestartRemoteTimerMsecs", p->v_gr_restart * 1000); | |
11830 | ||
11831 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11832 | { | |
11833 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11834 | { | |
11835 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
11836 | { | |
11837 | json_object *json_sub = NULL; | |
11838 | json_sub = json_object_new_object(); | |
11839 | ||
11840 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV)) | |
11841 | json_object_boolean_true_add(json_sub, "preserved"); | |
11842 | restart_af_count++; | |
11843 | json_object_object_add(json_restart, afi_safi_print (afi, safi), json_sub); | |
11844 | } | |
11845 | } | |
11846 | } | |
11847 | if (! restart_af_count) | |
11848 | json_object_string_add(json_cap, "addressFamiliesByPeer", "none"); | |
11849 | else | |
11850 | json_object_object_add(json_cap, "addressFamiliesByPeer", json_restart); | |
11851 | } | |
11852 | } | |
11853 | json_object_object_add(json_neigh, "neighborCapabilities", json_cap); | |
11854 | } | |
11855 | else | |
11856 | { | |
11857 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
11858 | ||
11859 | /* AS4 */ | |
11860 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
11861 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11862 | { | |
11863 | vty_out (vty, " 4 Byte AS:"); | |
11864 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11865 | vty_out (vty, " advertised"); | |
11866 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11867 | vty_out (vty, " %sreceived", | |
11868 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
11869 | vty_out (vty, "%s", VTY_NEWLINE); | |
11870 | } | |
11871 | ||
11872 | /* AddPath */ | |
11873 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
11874 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
11875 | { | |
11876 | vty_out (vty, " AddPath:%s", VTY_NEWLINE); | |
a82478b9 | 11877 | |
856ca177 MS |
11878 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
11879 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
a82478b9 | 11880 | { |
856ca177 MS |
11881 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || |
11882 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11883 | { | |
11884 | vty_out (vty, " %s: TX ", afi_safi_print (afi, safi)); | |
a82478b9 | 11885 | |
856ca177 MS |
11886 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) |
11887 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 11888 | |
856ca177 MS |
11889 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) |
11890 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" ); | |
a82478b9 | 11891 | |
856ca177 MS |
11892 | vty_out (vty, "%s", VTY_NEWLINE); |
11893 | } | |
a82478b9 | 11894 | |
856ca177 | 11895 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || |
a82478b9 | 11896 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
856ca177 MS |
11897 | { |
11898 | vty_out (vty, " %s: RX ", afi_safi_print (afi, safi)); | |
a82478b9 | 11899 | |
856ca177 MS |
11900 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) |
11901 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 11902 | |
856ca177 MS |
11903 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
11904 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" ); | |
a82478b9 | 11905 | |
856ca177 MS |
11906 | vty_out (vty, "%s", VTY_NEWLINE); |
11907 | } | |
a82478b9 | 11908 | } |
856ca177 | 11909 | } |
a82478b9 | 11910 | |
856ca177 MS |
11911 | /* Dynamic */ |
11912 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
11913 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11914 | { | |
11915 | vty_out (vty, " Dynamic:"); | |
11916 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11917 | vty_out (vty, " advertised"); | |
11918 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11919 | vty_out (vty, " %sreceived", | |
11920 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
11921 | vty_out (vty, "%s", VTY_NEWLINE); | |
11922 | } | |
11923 | ||
11924 | /* Extended nexthop */ | |
11925 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
11926 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11927 | { | |
11928 | vty_out (vty, " Extended nexthop:"); | |
11929 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11930 | vty_out (vty, " advertised"); | |
11931 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11932 | vty_out (vty, " %sreceived", | |
11933 | CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) ? "and " : ""); | |
11934 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 11935 | |
856ca177 MS |
11936 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) |
11937 | { | |
11938 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
11939 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11940 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
11941 | vty_out (vty, " %s%s", | |
11942 | afi_safi_print (AFI_IP, safi), VTY_NEWLINE); | |
11943 | } | |
11944 | } | |
8a92a8a0 | 11945 | |
856ca177 MS |
11946 | /* Route Refresh */ |
11947 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
11948 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11949 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11950 | { | |
11951 | vty_out (vty, " Route refresh:"); | |
11952 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
11953 | vty_out (vty, " advertised"); | |
11954 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11955 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11956 | vty_out (vty, " %sreceived(%s)", | |
11957 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
11958 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
11959 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
11960 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
8a92a8a0 | 11961 | |
856ca177 MS |
11962 | vty_out (vty, "%s", VTY_NEWLINE); |
11963 | } | |
718e3744 | 11964 | |
856ca177 MS |
11965 | /* Multiprotocol Extensions */ |
11966 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11967 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11968 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
11969 | { | |
11970 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); | |
11971 | if (p->afc_adv[afi][safi]) | |
11972 | vty_out (vty, " advertised"); | |
11973 | if (p->afc_recv[afi][safi]) | |
11974 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
11975 | vty_out (vty, "%s", VTY_NEWLINE); | |
11976 | } | |
538621f2 | 11977 | |
04b6bdc0 DW |
11978 | /* Hostname capability */ |
11979 | if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV) || | |
11980 | CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) | |
11981 | { | |
11982 | vty_out (vty, " Hostname Capability:"); | |
11983 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV)) | |
11984 | vty_out (vty, " advertised"); | |
11985 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_RCV)) | |
11986 | vty_out (vty, " %sreceived", | |
11987 | CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV) ? "and " : ""); | |
11988 | vty_out (vty, "%s", VTY_NEWLINE); | |
11989 | } | |
11990 | ||
856ca177 MS |
11991 | /* Gracefull Restart */ |
11992 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
11993 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
11994 | { | |
11995 | vty_out (vty, " Graceful Restart Capabilty:"); | |
11996 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
538621f2 | 11997 | vty_out (vty, " advertised"); |
856ca177 MS |
11998 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
11999 | vty_out (vty, " %sreceived", | |
12000 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
12001 | vty_out (vty, "%s", VTY_NEWLINE); | |
538621f2 | 12002 | |
856ca177 MS |
12003 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
12004 | { | |
12005 | int restart_af_count = 0; | |
12006 | ||
12007 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
12008 | p->v_gr_restart, VTY_NEWLINE); | |
12009 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
12010 | ||
12011 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12012 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12013 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
12014 | { | |
12015 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", | |
12016 | afi_safi_print (afi, safi), | |
12017 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
12018 | "preserved" : "not preserved"); | |
12019 | restart_af_count++; | |
12020 | } | |
12021 | if (! restart_af_count) | |
12022 | vty_out (vty, "none"); | |
12023 | vty_out (vty, "%s", VTY_NEWLINE); | |
12024 | } | |
12025 | } | |
12026 | } | |
718e3744 | 12027 | } |
12028 | } | |
12029 | ||
93406d87 | 12030 | /* graceful restart information */ |
12031 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
12032 | || p->t_gr_restart | |
12033 | || p->t_gr_stale) | |
12034 | { | |
856ca177 MS |
12035 | json_object *json_grace = NULL; |
12036 | json_object *json_grace_send = NULL; | |
12037 | json_object *json_grace_recv = NULL; | |
93406d87 | 12038 | int eor_send_af_count = 0; |
12039 | int eor_receive_af_count = 0; | |
12040 | ||
856ca177 MS |
12041 | if (use_json) |
12042 | { | |
12043 | json_grace = json_object_new_object(); | |
12044 | json_grace_send = json_object_new_object(); | |
12045 | json_grace_recv = json_object_new_object(); | |
12046 | ||
12047 | if (p->status == Established) | |
12048 | { | |
12049 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12050 | { | |
12051 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12052 | { | |
12053 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
12054 | { | |
12055 | json_object_boolean_true_add(json_grace_send, afi_safi_print (afi, safi)); | |
12056 | eor_send_af_count++; | |
12057 | } | |
12058 | } | |
12059 | } | |
12060 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12061 | { | |
12062 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12063 | { | |
12064 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
12065 | { | |
12066 | json_object_boolean_true_add(json_grace_recv, afi_safi_print (afi, safi)); | |
12067 | eor_receive_af_count++; | |
12068 | } | |
12069 | } | |
12070 | } | |
12071 | } | |
12072 | ||
12073 | json_object_object_add(json_grace, "endOfRibSend", json_grace_send); | |
12074 | json_object_object_add(json_grace, "endOfRibRecv", json_grace_recv); | |
12075 | ||
12076 | if (p->t_gr_restart) | |
12077 | json_object_int_add(json_grace, "gracefulRestartTimerMsecs", thread_timer_remain_second (p->t_gr_restart) * 1000); | |
12078 | ||
12079 | if (p->t_gr_stale) | |
12080 | json_object_int_add(json_grace, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p->t_gr_stale) * 1000); | |
12081 | ||
12082 | json_object_object_add(json_neigh, "gracefulRestartInfo", json_grace); | |
12083 | } | |
12084 | else | |
12085 | { | |
12086 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
12087 | if (p->status == Established) | |
12088 | { | |
12089 | vty_out (vty, " End-of-RIB send: "); | |
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_SEND)) | |
12095 | { | |
12096 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
12097 | afi_safi_print (afi, safi)); | |
12098 | eor_send_af_count++; | |
12099 | } | |
12100 | } | |
12101 | } | |
12102 | vty_out (vty, "%s", VTY_NEWLINE); | |
12103 | vty_out (vty, " End-of-RIB received: "); | |
12104 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12105 | { | |
12106 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12107 | { | |
12108 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
12109 | { | |
12110 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
12111 | afi_safi_print (afi, safi)); | |
12112 | eor_receive_af_count++; | |
12113 | } | |
12114 | } | |
12115 | } | |
12116 | vty_out (vty, "%s", VTY_NEWLINE); | |
12117 | } | |
93406d87 | 12118 | |
856ca177 MS |
12119 | if (p->t_gr_restart) |
12120 | vty_out (vty, " The remaining time of restart timer is %ld%s", | |
12121 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
0b2aa3a0 | 12122 | |
856ca177 MS |
12123 | if (p->t_gr_stale) |
12124 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", | |
12125 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
12126 | } | |
12127 | } | |
12128 | if (use_json) | |
12129 | { | |
12130 | json_object *json_stat = NULL; | |
12131 | json_stat = json_object_new_object(); | |
12132 | /* Packet counts. */ | |
12133 | json_object_int_add(json_stat, "depthInq", 0); | |
12134 | json_object_int_add(json_stat, "depthOutq", (unsigned long) p->obuf->count); | |
12135 | json_object_int_add(json_stat, "opensSent", p->open_out); | |
12136 | json_object_int_add(json_stat, "opensRecv", p->open_in); | |
12137 | json_object_int_add(json_stat, "notificationsSent", p->notify_out); | |
12138 | json_object_int_add(json_stat, "notificationsRecv", p->notify_in); | |
12139 | json_object_int_add(json_stat, "updatesSent", p->update_out); | |
12140 | json_object_int_add(json_stat, "updatesRecv", p->update_in); | |
12141 | json_object_int_add(json_stat, "keepalivesSent", p->keepalive_out); | |
12142 | json_object_int_add(json_stat, "keepalivesRecv", p->keepalive_in); | |
12143 | json_object_int_add(json_stat, "routeRefreshSent", p->refresh_out); | |
12144 | json_object_int_add(json_stat, "routeRefreshRecv", p->refresh_in); | |
12145 | json_object_int_add(json_stat, "capabilitySent", p->dynamic_cap_out); | |
12146 | json_object_int_add(json_stat, "capabilityRecv", p->dynamic_cap_in); | |
12147 | 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); | |
12148 | 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); | |
12149 | json_object_object_add(json_neigh, "messageStats", json_stat); | |
12150 | } | |
12151 | else | |
12152 | { | |
12153 | /* Packet counts. */ | |
12154 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); | |
12155 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
12156 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); | |
12157 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); | |
12158 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
12159 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
12160 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
12161 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
12162 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
12163 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
12164 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
12165 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
12166 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
12167 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 12168 | } |
12169 | ||
856ca177 MS |
12170 | if (use_json) |
12171 | { | |
12172 | /* advertisement-interval */ | |
12173 | json_object_int_add(json_neigh, "minBtwnAdvertisementRunsTimerMsecs", p->v_routeadv * 1000); | |
718e3744 | 12174 | |
856ca177 MS |
12175 | /* Update-source. */ |
12176 | if (p->update_if || p->update_source) | |
12177 | { | |
12178 | if (p->update_if) | |
12179 | json_object_string_add(json_neigh, "updateSource", p->update_if); | |
12180 | else if (p->update_source) | |
12181 | json_object_string_add(json_neigh, "updateSource", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
12182 | } | |
12183 | ||
12184 | /* Default weight */ | |
12185 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
12186 | json_object_int_add(json_neigh, "defaultWeight", p->weight); | |
12187 | ||
12188 | } | |
12189 | else | |
12190 | { | |
12191 | /* advertisement-interval */ | |
12192 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
12193 | p->v_routeadv, VTY_NEWLINE); | |
12194 | ||
12195 | /* Update-source. */ | |
12196 | if (p->update_if || p->update_source) | |
12197 | { | |
12198 | vty_out (vty, " Update source is "); | |
12199 | if (p->update_if) | |
12200 | vty_out (vty, "%s", p->update_if); | |
12201 | else if (p->update_source) | |
12202 | vty_out (vty, "%s", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
12203 | vty_out (vty, "%s", VTY_NEWLINE); | |
12204 | } | |
12205 | ||
12206 | /* Default weight */ | |
12207 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
12208 | vty_out (vty, " Default weight %d%s", p->weight, VTY_NEWLINE); | |
12209 | ||
12210 | vty_out (vty, "%s", VTY_NEWLINE); | |
12211 | } | |
718e3744 | 12212 | |
12213 | /* Address Family Information */ | |
856ca177 MS |
12214 | json_object *json_hold = NULL; |
12215 | ||
12216 | if (use_json) | |
12217 | json_hold = json_object_new_object(); | |
12218 | ||
538621f2 | 12219 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
12220 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12221 | if (p->afc[afi][safi]) | |
856ca177 | 12222 | bgp_show_peer_afi (vty, p, afi, safi, use_json, json_hold); |
718e3744 | 12223 | |
856ca177 MS |
12224 | if (use_json) |
12225 | { | |
12226 | json_object_int_add(json_hold, "connectionsEstablished", p->established); | |
12227 | json_object_int_add(json_hold, "connectionsDropped", p->dropped); | |
12228 | } | |
12229 | else | |
12230 | vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped, | |
12231 | VTY_NEWLINE); | |
718e3744 | 12232 | |
d6661008 | 12233 | if (! p->last_reset) |
856ca177 MS |
12234 | { |
12235 | if (use_json) | |
12236 | json_object_string_add(json_hold, "lastReset", "never"); | |
12237 | else | |
12238 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); | |
12239 | } | |
e0701b79 | 12240 | else |
d6661008 | 12241 | { |
856ca177 MS |
12242 | if (use_json) |
12243 | { | |
12244 | time_t uptime; | |
12245 | struct tm *tm; | |
12246 | ||
12247 | uptime = bgp_clock(); | |
12248 | uptime -= p->resettime; | |
12249 | tm = gmtime(&uptime); | |
12250 | json_object_int_add(json_hold, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
12251 | json_object_string_add(json_hold, "lastResetDueTo", peer_down_str[(int) p->last_reset]); | |
12252 | if (p->last_reset_cause_size) | |
12253 | { | |
39e871e6 ST |
12254 | char errorcodesubcode_hexstr[5]; |
12255 | sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode); | |
12256 | json_object_string_add(json_hold, "lastErrorCodeSubcode", errorcodesubcode_hexstr); | |
856ca177 MS |
12257 | } |
12258 | } | |
12259 | else | |
d6661008 | 12260 | { |
3a8c7ba1 DW |
12261 | vty_out (vty, " Last reset %s, ", |
12262 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
12263 | ||
12264 | if (p->last_reset == PEER_DOWN_NOTIFY_SEND || | |
12265 | p->last_reset == PEER_DOWN_NOTIFY_RECEIVED) | |
12266 | { | |
12267 | code_str = bgp_notify_code_str(p->notify.code); | |
12268 | subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode); | |
12269 | vty_out (vty, "due to NOTIFICATION %s (%s%s)%s", | |
12270 | p->last_reset == PEER_DOWN_NOTIFY_SEND ? "sent" : "received", | |
12271 | code_str, subcode_str, VTY_NEWLINE); | |
12272 | } | |
12273 | else | |
12274 | { | |
12275 | vty_out (vty, "due to %s%s", | |
12276 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
12277 | } | |
856ca177 MS |
12278 | |
12279 | if (p->last_reset_cause_size) | |
d6661008 | 12280 | { |
856ca177 MS |
12281 | msg = p->last_reset_cause; |
12282 | vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); | |
12283 | for (i = 1; i <= p->last_reset_cause_size; i++) | |
12284 | { | |
12285 | vty_out(vty, "%02X", *msg++); | |
d6661008 | 12286 | |
856ca177 MS |
12287 | if (i != p->last_reset_cause_size) |
12288 | { | |
12289 | if (i % 16 == 0) | |
12290 | { | |
12291 | vty_out(vty, "%s ", VTY_NEWLINE); | |
12292 | } | |
12293 | else if (i % 4 == 0) | |
12294 | { | |
12295 | vty_out(vty, " "); | |
12296 | } | |
12297 | } | |
12298 | } | |
12299 | vty_out(vty, "%s", VTY_NEWLINE); | |
d6661008 | 12300 | } |
d6661008 DS |
12301 | } |
12302 | } | |
848973c7 | 12303 | |
718e3744 | 12304 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
12305 | { | |
856ca177 MS |
12306 | if (use_json) |
12307 | json_object_boolean_true_add(json_hold, "prefixesConfigExceedMax"); | |
12308 | else | |
12309 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 12310 | |
12311 | if (p->t_pmax_restart) | |
856ca177 MS |
12312 | { |
12313 | if (use_json) | |
12314 | { | |
e8f7da3a | 12315 | json_object_boolean_true_add(json_hold, "reducePrefixNumFrom"); |
856ca177 MS |
12316 | json_object_int_add(json_hold, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); |
12317 | } | |
12318 | else | |
12319 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
12320 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
12321 | VTY_NEWLINE); | |
12322 | } | |
0a486e5f | 12323 | else |
856ca177 MS |
12324 | { |
12325 | if (use_json) | |
e8f7da3a | 12326 | json_object_boolean_true_add(json_hold, "reducePrefixNumAndClearIpBgp"); |
856ca177 MS |
12327 | else |
12328 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
12329 | p->host, VTY_NEWLINE); | |
12330 | } | |
718e3744 | 12331 | } |
12332 | ||
856ca177 MS |
12333 | if (use_json) |
12334 | json_object_object_add(json_neigh, "addressFamilyInfo", json_hold); | |
12335 | ||
f5a4827d | 12336 | /* EBGP Multihop and GTSM */ |
6d85b15b | 12337 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d | 12338 | { |
856ca177 MS |
12339 | if (use_json) |
12340 | { | |
12341 | if (p->gtsm_hops > 0) | |
12342 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->gtsm_hops); | |
12343 | else if (p->ttl > 1) | |
12344 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->ttl); | |
12345 | } | |
12346 | else | |
12347 | { | |
12348 | if (p->gtsm_hops > 0) | |
12349 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
12350 | p->gtsm_hops, VTY_NEWLINE); | |
12351 | else if (p->ttl > 1) | |
12352 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
12353 | p->ttl, VTY_NEWLINE); | |
12354 | } | |
f5a4827d | 12355 | } |
5d804b43 PM |
12356 | else |
12357 | { | |
12358 | if (p->gtsm_hops > 0) | |
856ca177 MS |
12359 | { |
12360 | if (use_json) | |
12361 | json_object_int_add(json_neigh, "internalBgpNbrMaxHopsAway", p->gtsm_hops); | |
12362 | else | |
12363 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
12364 | p->gtsm_hops, VTY_NEWLINE); | |
12365 | } | |
5d804b43 | 12366 | } |
718e3744 | 12367 | |
12368 | /* Local address. */ | |
12369 | if (p->su_local) | |
12370 | { | |
856ca177 MS |
12371 | if (use_json) |
12372 | { | |
12373 | json_object_string_add(json_neigh, "hostLocal", sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN)); | |
12374 | json_object_int_add(json_neigh, "portLocal", ntohs (p->su_local->sin.sin_port)); | |
12375 | } | |
12376 | else | |
12377 | vty_out (vty, "Local host: %s, Local port: %d%s", | |
12378 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), | |
12379 | ntohs (p->su_local->sin.sin_port), | |
12380 | VTY_NEWLINE); | |
718e3744 | 12381 | } |
12382 | ||
12383 | /* Remote address. */ | |
12384 | if (p->su_remote) | |
12385 | { | |
856ca177 MS |
12386 | if (use_json) |
12387 | { | |
12388 | json_object_string_add(json_neigh, "hostForeign", sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN)); | |
12389 | json_object_int_add(json_neigh, "portForeign", ntohs (p->su_remote->sin.sin_port)); | |
12390 | } | |
12391 | else | |
12392 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
718e3744 | 12393 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
12394 | ntohs (p->su_remote->sin.sin_port), | |
12395 | VTY_NEWLINE); | |
12396 | } | |
12397 | ||
12398 | /* Nexthop display. */ | |
12399 | if (p->su_local) | |
12400 | { | |
856ca177 MS |
12401 | if (use_json) |
12402 | { | |
12403 | json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ)); | |
718e3744 | 12404 | #ifdef HAVE_IPV6 |
856ca177 MS |
12405 | json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ)); |
12406 | json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ)); | |
12407 | if (p->shared_network) | |
12408 | json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork"); | |
12409 | else | |
12410 | json_object_string_add(json_neigh, "bgpConnection", "nonSharedNetwork"); | |
12411 | #endif /* HAVE_IPV6 */ | |
12412 | } | |
12413 | else | |
12414 | { | |
12415 | vty_out (vty, "Nexthop: %s%s", | |
12416 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
12417 | VTY_NEWLINE); | |
12418 | #ifdef HAVE_IPV6 | |
12419 | vty_out (vty, "Nexthop global: %s%s", | |
12420 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
12421 | VTY_NEWLINE); | |
12422 | vty_out (vty, "Nexthop local: %s%s", | |
12423 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
12424 | VTY_NEWLINE); | |
12425 | vty_out (vty, "BGP connection: %s%s", | |
12426 | p->shared_network ? "shared network" : "non shared network", | |
12427 | VTY_NEWLINE); | |
718e3744 | 12428 | #endif /* HAVE_IPV6 */ |
856ca177 | 12429 | } |
718e3744 | 12430 | } |
12431 | ||
12432 | /* Timer information. */ | |
856ca177 MS |
12433 | if (use_json) |
12434 | { | |
39e871e6 | 12435 | json_object_int_add(json_neigh, "connectRetryTimer", p->v_connect); |
dd9275d6 ST |
12436 | if (p->status == Established && p->rtt) |
12437 | json_object_int_add(json_neigh, "estimatedRttInMsecs", p->rtt); | |
856ca177 MS |
12438 | if (p->t_start) |
12439 | json_object_int_add(json_neigh, "nextStartTimerDueInMsecs", thread_timer_remain_second (p->t_start) * 1000); | |
12440 | if (p->t_connect) | |
12441 | json_object_int_add(json_neigh, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p->t_connect) * 1000); | |
12442 | if (p->t_routeadv) | |
12443 | { | |
12444 | json_object_int_add(json_neigh, "mraiInterval", p->v_routeadv); | |
12445 | json_object_int_add(json_neigh, "mraiTimerExpireInMsecs", thread_timer_remain_second (p->t_routeadv) * 1000); | |
12446 | } | |
cb1faec9 | 12447 | |
856ca177 MS |
12448 | if (p->t_read) |
12449 | json_object_string_add(json_neigh, "readThread", "on"); | |
12450 | else | |
12451 | json_object_string_add(json_neigh, "readThread", "off"); | |
12452 | if (p->t_write) | |
12453 | json_object_string_add(json_neigh, "writeThread", "on"); | |
12454 | else | |
12455 | json_object_string_add(json_neigh, "writeThread", "off"); | |
12456 | } | |
12457 | else | |
12458 | { | |
39e871e6 ST |
12459 | vty_out (vty, "BGP Connect Retry Timer in Seconds: %d%s", |
12460 | p->v_connect, VTY_NEWLINE); | |
dd9275d6 ST |
12461 | if (p->status == Established && p->rtt) |
12462 | vty_out (vty, "Estimated round trip time: %d ms%s", | |
12463 | p->rtt, VTY_NEWLINE); | |
856ca177 MS |
12464 | if (p->t_start) |
12465 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
12466 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
12467 | if (p->t_connect) | |
12468 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
12469 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
12470 | if (p->t_routeadv) | |
12471 | vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s", | |
12472 | p->v_routeadv, thread_timer_remain_second (p->t_routeadv), | |
12473 | VTY_NEWLINE); | |
12474 | ||
12475 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
12476 | p->t_read ? "on" : "off", | |
12477 | p->t_write ? "on" : "off", | |
12478 | VTY_NEWLINE); | |
12479 | } | |
718e3744 | 12480 | |
12481 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
12482 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
856ca177 MS |
12483 | bgp_capability_vty_out (vty, p, use_json, json_neigh); |
12484 | ||
12485 | if (!use_json) | |
12486 | vty_out (vty, "%s", VTY_NEWLINE); | |
c43ed2e4 DS |
12487 | |
12488 | /* BFD information. */ | |
856ca177 MS |
12489 | bgp_bfd_show_info(vty, p, use_json, json_neigh); |
12490 | ||
12491 | if (use_json) | |
12492 | { | |
12493 | if (p->conf_if) /* Configured interface name. */ | |
12494 | json_object_object_add(json, p->conf_if, json_neigh); | |
12495 | else /* Configured IP address. */ | |
12496 | json_object_object_add(json, p->host, json_neigh); | |
12497 | } | |
718e3744 | 12498 | } |
12499 | ||
94f2b392 | 12500 | static int |
856ca177 MS |
12501 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type, |
12502 | union sockunion *su, const char *conf_if, u_char use_json, json_object *json) | |
718e3744 | 12503 | { |
1eb8ef25 | 12504 | struct listnode *node, *nnode; |
718e3744 | 12505 | struct peer *peer; |
12506 | int find = 0; | |
12507 | ||
1eb8ef25 | 12508 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 12509 | { |
1ff9a340 DS |
12510 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
12511 | continue; | |
12512 | ||
718e3744 | 12513 | switch (type) |
856ca177 MS |
12514 | { |
12515 | case show_all: | |
e8f7da3a | 12516 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12517 | break; |
12518 | case show_peer: | |
12519 | if (conf_if) | |
12520 | { | |
4873b3b9 DW |
12521 | if ((peer->conf_if && !strcmp(peer->conf_if, conf_if)) || |
12522 | (peer->hostname && !strcmp(peer->hostname, conf_if))) | |
856ca177 MS |
12523 | { |
12524 | find = 1; | |
e8f7da3a | 12525 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12526 | } |
12527 | } | |
12528 | else | |
12529 | { | |
12530 | if (sockunion_same (&peer->su, su)) | |
12531 | { | |
12532 | find = 1; | |
e8f7da3a | 12533 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12534 | } |
12535 | } | |
12536 | break; | |
718e3744 | 12537 | } |
12538 | } | |
12539 | ||
12540 | if (type == show_peer && ! find) | |
856ca177 MS |
12541 | { |
12542 | if (use_json) | |
12543 | json_object_boolean_true_add(json, "bgpNoSuchNeighbor"); | |
12544 | else | |
12545 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
12546 | } | |
12547 | ||
12548 | if (use_json) | |
12549 | { | |
12550 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
12551 | json_object_free(json); | |
12552 | } | |
12553 | else | |
12554 | { | |
12555 | vty_out (vty, "%s", VTY_NEWLINE); | |
12556 | } | |
12557 | ||
718e3744 | 12558 | return CMD_SUCCESS; |
12559 | } | |
12560 | ||
94f2b392 | 12561 | static int |
fd79ac91 | 12562 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
9f689658 DD |
12563 | enum show_type type, const char *ip_str, u_char use_json, |
12564 | json_object *json) | |
718e3744 | 12565 | { |
12566 | int ret; | |
12567 | struct bgp *bgp; | |
12568 | union sockunion su; | |
856ca177 | 12569 | |
9f689658 | 12570 | if (use_json && (json == NULL)) |
856ca177 | 12571 | json = json_object_new_object(); |
718e3744 | 12572 | |
718e3744 | 12573 | if (name) |
12574 | { | |
12575 | bgp = bgp_lookup_by_name (name); | |
718e3744 | 12576 | if (! bgp) |
12577 | { | |
856ca177 MS |
12578 | if (use_json) |
12579 | { | |
12580 | json_object_boolean_true_add(json, "bgpNoSuchInstance"); | |
12581 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
12582 | json_object_free(json); | |
12583 | } | |
12584 | else | |
12585 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
12586 | ||
718e3744 | 12587 | return CMD_WARNING; |
12588 | } | |
718e3744 | 12589 | } |
a80beece DS |
12590 | else |
12591 | { | |
12592 | bgp = bgp_get_default (); | |
12593 | } | |
718e3744 | 12594 | |
12595 | if (bgp) | |
a80beece DS |
12596 | { |
12597 | if (ip_str) | |
12598 | { | |
12599 | ret = str2sockunion (ip_str, &su); | |
12600 | if (ret < 0) | |
856ca177 | 12601 | bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json); |
a80beece | 12602 | else |
856ca177 | 12603 | bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json); |
a80beece DS |
12604 | } |
12605 | else | |
12606 | { | |
856ca177 | 12607 | bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json); |
a80beece DS |
12608 | } |
12609 | } | |
718e3744 | 12610 | |
12611 | return CMD_SUCCESS; | |
12612 | } | |
12613 | ||
f186de26 | 12614 | static void |
12615 | bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) | |
12616 | { | |
12617 | struct listnode *node, *nnode; | |
12618 | struct bgp *bgp; | |
12619 | json_object *json = NULL; | |
9f689658 DD |
12620 | int is_first = 1; |
12621 | ||
12622 | if (use_json) | |
12623 | vty_out (vty, "{%s", VTY_NEWLINE); | |
f186de26 | 12624 | |
12625 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
12626 | { | |
f186de26 | 12627 | if (use_json) |
9f689658 DD |
12628 | { |
12629 | if (!(json = json_object_new_object())) | |
12630 | { | |
12631 | zlog_err("Unable to allocate memory for JSON object"); | |
12632 | vty_out (vty, | |
12633 | "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s", | |
12634 | VTY_NEWLINE); | |
12635 | return; | |
12636 | } | |
12637 | ||
12638 | json_object_int_add(json, "vrfId", | |
12639 | (bgp->vrf_id == VRF_UNKNOWN) | |
12640 | ? -1 : bgp->vrf_id); | |
12641 | json_object_string_add(json, "vrfName", | |
12642 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12643 | ? "Default" : bgp->name); | |
12644 | ||
12645 | if (! is_first) | |
12646 | vty_out (vty, ",%s", VTY_NEWLINE); | |
12647 | else | |
12648 | is_first = 0; | |
12649 | ||
12650 | vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12651 | ? "Default" : bgp->name); | |
12652 | } | |
12653 | else | |
12654 | { | |
12655 | vty_out (vty, "%sInstance %s:%s", | |
12656 | VTY_NEWLINE, | |
12657 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12658 | ? "Default" : bgp->name, | |
12659 | VTY_NEWLINE); | |
12660 | } | |
f186de26 | 12661 | bgp_show_neighbor (vty, bgp, show_all, NULL, NULL, use_json, json); |
12662 | } | |
9f689658 DD |
12663 | |
12664 | if (use_json) | |
12665 | vty_out (vty, "}%s", VTY_NEWLINE); | |
f186de26 | 12666 | } |
12667 | ||
718e3744 | 12668 | /* "show ip bgp neighbors" commands. */ |
12669 | DEFUN (show_ip_bgp_neighbors, | |
12670 | show_ip_bgp_neighbors_cmd, | |
856ca177 | 12671 | "show ip bgp neighbors {json}", |
718e3744 | 12672 | SHOW_STR |
12673 | IP_STR | |
12674 | BGP_STR | |
856ca177 MS |
12675 | "Detailed information on TCP and BGP neighbor connections\n" |
12676 | "JavaScript Object Notation\n") | |
718e3744 | 12677 | { |
db7c8528 | 12678 | u_char uj = use_json(argc, argv); |
856ca177 | 12679 | |
9f689658 | 12680 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, uj, NULL); |
718e3744 | 12681 | } |
12682 | ||
12683 | ALIAS (show_ip_bgp_neighbors, | |
12684 | show_ip_bgp_ipv4_neighbors_cmd, | |
856ca177 | 12685 | "show ip bgp ipv4 (unicast|multicast) neighbors {json}", |
718e3744 | 12686 | SHOW_STR |
12687 | IP_STR | |
12688 | BGP_STR | |
12689 | "Address family\n" | |
12690 | "Address Family modifier\n" | |
12691 | "Address Family modifier\n" | |
856ca177 MS |
12692 | "Detailed information on TCP and BGP neighbor connections\n" |
12693 | "JavaScript Object Notation\n") | |
718e3744 | 12694 | |
12695 | ALIAS (show_ip_bgp_neighbors, | |
12696 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
856ca177 | 12697 | "show ip bgp vpnv4 all neighbors {json}", |
718e3744 | 12698 | SHOW_STR |
12699 | IP_STR | |
12700 | BGP_STR | |
12701 | "Display VPNv4 NLRI specific information\n" | |
12702 | "Display information about all VPNv4 NLRIs\n" | |
856ca177 MS |
12703 | "Detailed information on TCP and BGP neighbor connections\n" |
12704 | "JavaScript Object Notation\n") | |
718e3744 | 12705 | |
12706 | ALIAS (show_ip_bgp_neighbors, | |
12707 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
856ca177 | 12708 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}", |
718e3744 | 12709 | SHOW_STR |
12710 | IP_STR | |
12711 | BGP_STR | |
12712 | "Display VPNv4 NLRI specific information\n" | |
12713 | "Display information for a route distinguisher\n" | |
12714 | "VPN Route Distinguisher\n" | |
856ca177 MS |
12715 | "Detailed information on TCP and BGP neighbor connections\n" |
12716 | "JavaScript Object Notation\n") | |
718e3744 | 12717 | |
12718 | ALIAS (show_ip_bgp_neighbors, | |
12719 | show_bgp_neighbors_cmd, | |
856ca177 | 12720 | "show bgp neighbors {json}", |
718e3744 | 12721 | SHOW_STR |
12722 | BGP_STR | |
856ca177 MS |
12723 | "Detailed information on TCP and BGP neighbor connections\n" |
12724 | "JavaScript Object Notation\n") | |
718e3744 | 12725 | |
12726 | ALIAS (show_ip_bgp_neighbors, | |
12727 | show_bgp_ipv6_neighbors_cmd, | |
856ca177 | 12728 | "show bgp ipv6 neighbors {json}", |
718e3744 | 12729 | SHOW_STR |
12730 | BGP_STR | |
12731 | "Address family\n" | |
856ca177 MS |
12732 | "Detailed information on TCP and BGP neighbor connections\n" |
12733 | "JavaScript Object Notation\n") | |
718e3744 | 12734 | |
12735 | DEFUN (show_ip_bgp_neighbors_peer, | |
12736 | show_ip_bgp_neighbors_peer_cmd, | |
856ca177 | 12737 | "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12738 | SHOW_STR |
12739 | IP_STR | |
12740 | BGP_STR | |
12741 | "Detailed information on TCP and BGP neighbor connections\n" | |
12742 | "Neighbor to display information about\n" | |
a80beece | 12743 | "Neighbor to display information about\n" |
856ca177 MS |
12744 | "Neighbor on bgp configured interface\n" |
12745 | "JavaScript Object Notation\n") | |
718e3744 | 12746 | { |
db7c8528 | 12747 | u_char uj = use_json(argc, argv); |
856ca177 | 12748 | |
9f689658 | 12749 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], uj, NULL); |
718e3744 | 12750 | } |
12751 | ||
12752 | ALIAS (show_ip_bgp_neighbors_peer, | |
12753 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
856ca177 | 12754 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12755 | SHOW_STR |
12756 | IP_STR | |
12757 | BGP_STR | |
12758 | "Address family\n" | |
12759 | "Address Family modifier\n" | |
12760 | "Address Family modifier\n" | |
12761 | "Detailed information on TCP and BGP neighbor connections\n" | |
12762 | "Neighbor to display information about\n" | |
a80beece | 12763 | "Neighbor to display information about\n" |
856ca177 MS |
12764 | "Neighbor on bgp configured interface\n" |
12765 | "JavaScript Object Notation\n") | |
718e3744 | 12766 | |
12767 | ALIAS (show_ip_bgp_neighbors_peer, | |
12768 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
856ca177 | 12769 | "show ip bgp vpnv4 all neighbors A.B.C.D {json}", |
718e3744 | 12770 | SHOW_STR |
12771 | IP_STR | |
12772 | BGP_STR | |
12773 | "Display VPNv4 NLRI specific information\n" | |
12774 | "Display information about all VPNv4 NLRIs\n" | |
12775 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
12776 | "Neighbor to display information about\n" |
12777 | "JavaScript Object Notation\n") | |
718e3744 | 12778 | |
12779 | ALIAS (show_ip_bgp_neighbors_peer, | |
12780 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
856ca177 | 12781 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}", |
718e3744 | 12782 | SHOW_STR |
12783 | IP_STR | |
12784 | BGP_STR | |
12785 | "Display VPNv4 NLRI specific information\n" | |
12786 | "Display information about all VPNv4 NLRIs\n" | |
12787 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
12788 | "Neighbor to display information about\n" |
12789 | "JavaScript Object Notation\n") | |
718e3744 | 12790 | |
12791 | ALIAS (show_ip_bgp_neighbors_peer, | |
12792 | show_bgp_neighbors_peer_cmd, | |
856ca177 | 12793 | "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12794 | SHOW_STR |
12795 | BGP_STR | |
12796 | "Detailed information on TCP and BGP neighbor connections\n" | |
12797 | "Neighbor to display information about\n" | |
a80beece | 12798 | "Neighbor to display information about\n" |
856ca177 MS |
12799 | "Neighbor on bgp configured interface\n" |
12800 | "JavaScript Object Notation\n") | |
718e3744 | 12801 | |
12802 | ALIAS (show_ip_bgp_neighbors_peer, | |
12803 | show_bgp_ipv6_neighbors_peer_cmd, | |
856ca177 | 12804 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12805 | SHOW_STR |
12806 | BGP_STR | |
12807 | "Address family\n" | |
12808 | "Detailed information on TCP and BGP neighbor connections\n" | |
12809 | "Neighbor to display information about\n" | |
a80beece | 12810 | "Neighbor to display information about\n" |
856ca177 MS |
12811 | "Neighbor on bgp configured interface\n" |
12812 | "JavaScript Object Notation\n") | |
718e3744 | 12813 | |
12814 | DEFUN (show_ip_bgp_instance_neighbors, | |
12815 | show_ip_bgp_instance_neighbors_cmd, | |
8386ac43 | 12816 | "show ip bgp " BGP_INSTANCE_CMD " neighbors {json}", |
718e3744 | 12817 | SHOW_STR |
12818 | IP_STR | |
12819 | BGP_STR | |
8386ac43 | 12820 | BGP_INSTANCE_HELP_STR |
856ca177 MS |
12821 | "Detailed information on TCP and BGP neighbor connections\n" |
12822 | "JavaScript Object Notation\n") | |
718e3744 | 12823 | { |
db7c8528 | 12824 | u_char uj = use_json(argc, argv); |
856ca177 | 12825 | |
9f689658 | 12826 | return bgp_show_neighbor_vty (vty, argv[1], show_all, NULL, uj, NULL); |
718e3744 | 12827 | } |
12828 | ||
f186de26 | 12829 | DEFUN (show_ip_bgp_instance_all_neighbors, |
12830 | show_ip_bgp_instance_all_neighbors_cmd, | |
12831 | "show ip bgp " BGP_INSTANCE_ALL_CMD " neighbors {json}", | |
12832 | SHOW_STR | |
12833 | IP_STR | |
12834 | BGP_STR | |
12835 | BGP_INSTANCE_ALL_HELP_STR | |
12836 | "Detailed information on TCP and BGP neighbor connections\n" | |
12837 | "JavaScript Object Notation\n") | |
12838 | { | |
12839 | u_char uj = use_json(argc, argv); | |
12840 | ||
12841 | bgp_show_all_instances_neighbors_vty (vty, uj); | |
12842 | return CMD_SUCCESS; | |
12843 | } | |
12844 | ||
bb46e94f | 12845 | ALIAS (show_ip_bgp_instance_neighbors, |
12846 | show_bgp_instance_neighbors_cmd, | |
8386ac43 | 12847 | "show bgp " BGP_INSTANCE_CMD " neighbors {json}", |
bb46e94f | 12848 | SHOW_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") | |
bb46e94f | 12853 | |
12854 | ALIAS (show_ip_bgp_instance_neighbors, | |
12855 | show_bgp_instance_ipv6_neighbors_cmd, | |
8386ac43 | 12856 | "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors {json}", |
bb46e94f | 12857 | SHOW_STR |
12858 | BGP_STR | |
8386ac43 | 12859 | BGP_INSTANCE_HELP_STR |
bb46e94f | 12860 | "Address family\n" |
856ca177 MS |
12861 | "Detailed information on TCP and BGP neighbor connections\n" |
12862 | "JavaScript Object Notation\n") | |
bb46e94f | 12863 | |
718e3744 | 12864 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
12865 | show_ip_bgp_instance_neighbors_peer_cmd, | |
8386ac43 | 12866 | "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12867 | SHOW_STR |
12868 | IP_STR | |
12869 | BGP_STR | |
8386ac43 | 12870 | BGP_INSTANCE_HELP_STR |
718e3744 | 12871 | "Detailed information on TCP and BGP neighbor connections\n" |
12872 | "Neighbor to display information about\n" | |
a80beece | 12873 | "Neighbor to display information about\n" |
856ca177 MS |
12874 | "Neighbor on bgp configured interface\n" |
12875 | "JavaScript Object Notation\n") | |
718e3744 | 12876 | { |
db7c8528 | 12877 | u_char uj = use_json(argc, argv); |
856ca177 | 12878 | |
9f689658 | 12879 | return bgp_show_neighbor_vty (vty, argv[1], show_peer, argv[2], uj, NULL); |
718e3744 | 12880 | } |
bb46e94f | 12881 | |
12882 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
12883 | show_bgp_instance_neighbors_peer_cmd, | |
8386ac43 | 12884 | "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 12885 | SHOW_STR |
12886 | BGP_STR | |
8386ac43 | 12887 | BGP_INSTANCE_HELP_STR |
bb46e94f | 12888 | "Detailed information on TCP and BGP neighbor connections\n" |
12889 | "Neighbor to display information about\n" | |
a80beece | 12890 | "Neighbor to display information about\n" |
856ca177 MS |
12891 | "Neighbor on bgp configured interface\n" |
12892 | "JavaScript Object Notation\n") | |
bb46e94f | 12893 | |
12894 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
12895 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
8386ac43 | 12896 | "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 12897 | SHOW_STR |
12898 | BGP_STR | |
8386ac43 | 12899 | BGP_INSTANCE_HELP_STR |
bb46e94f | 12900 | "Address family\n" |
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") | |
6b0655a2 | 12906 | |
718e3744 | 12907 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
12908 | paths' and `show ip mbgp paths'. Those functions results are the | |
12909 | same.*/ | |
12910 | DEFUN (show_ip_bgp_paths, | |
12911 | show_ip_bgp_paths_cmd, | |
12912 | "show ip bgp paths", | |
12913 | SHOW_STR | |
12914 | IP_STR | |
12915 | BGP_STR | |
12916 | "Path information\n") | |
12917 | { | |
12918 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
12919 | aspath_print_all_vty (vty); | |
12920 | return CMD_SUCCESS; | |
12921 | } | |
12922 | ||
12923 | DEFUN (show_ip_bgp_ipv4_paths, | |
12924 | show_ip_bgp_ipv4_paths_cmd, | |
12925 | "show ip bgp ipv4 (unicast|multicast) paths", | |
12926 | SHOW_STR | |
12927 | IP_STR | |
12928 | BGP_STR | |
12929 | "Address family\n" | |
12930 | "Address Family modifier\n" | |
12931 | "Address Family modifier\n" | |
12932 | "Path information\n") | |
12933 | { | |
12934 | vty_out (vty, "Address Refcnt Path\r\n"); | |
12935 | aspath_print_all_vty (vty); | |
12936 | ||
12937 | return CMD_SUCCESS; | |
12938 | } | |
6b0655a2 | 12939 | |
718e3744 | 12940 | #include "hash.h" |
12941 | ||
94f2b392 | 12942 | static void |
718e3744 | 12943 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
12944 | { | |
12945 | struct community *com; | |
12946 | ||
12947 | com = (struct community *) backet->data; | |
6c4f4e6e | 12948 | vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt, |
718e3744 | 12949 | community_str (com), VTY_NEWLINE); |
12950 | } | |
12951 | ||
12952 | /* Show BGP's community internal data. */ | |
12953 | DEFUN (show_ip_bgp_community_info, | |
12954 | show_ip_bgp_community_info_cmd, | |
12955 | "show ip bgp community-info", | |
12956 | SHOW_STR | |
12957 | IP_STR | |
12958 | BGP_STR | |
12959 | "List all bgp community information\n") | |
12960 | { | |
12961 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
12962 | ||
12963 | hash_iterate (community_hash (), | |
12964 | (void (*) (struct hash_backet *, void *)) | |
12965 | community_show_all_iterator, | |
12966 | vty); | |
12967 | ||
12968 | return CMD_SUCCESS; | |
12969 | } | |
12970 | ||
12971 | DEFUN (show_ip_bgp_attr_info, | |
12972 | show_ip_bgp_attr_info_cmd, | |
12973 | "show ip bgp attribute-info", | |
12974 | SHOW_STR | |
12975 | IP_STR | |
12976 | BGP_STR | |
12977 | "List all bgp attribute information\n") | |
12978 | { | |
12979 | attr_show_all (vty); | |
12980 | return CMD_SUCCESS; | |
12981 | } | |
6b0655a2 | 12982 | |
8386ac43 | 12983 | static int bgp_show_update_groups(struct vty *vty, const char *name, |
12984 | int afi, int safi, | |
50ef26d4 | 12985 | u_int64_t subgrp_id) |
3f9c7369 DS |
12986 | { |
12987 | struct bgp *bgp; | |
12988 | ||
8386ac43 | 12989 | if (name) |
12990 | bgp = bgp_lookup_by_name (name); | |
12991 | else | |
12992 | bgp = bgp_get_default (); | |
12993 | ||
3f9c7369 | 12994 | if (bgp) |
8fe8a7f6 | 12995 | update_group_show(bgp, afi, safi, vty, subgrp_id); |
3f9c7369 DS |
12996 | return CMD_SUCCESS; |
12997 | } | |
12998 | ||
f186de26 | 12999 | static void |
13000 | bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi) | |
13001 | { | |
13002 | struct listnode *node, *nnode; | |
13003 | struct bgp *bgp; | |
13004 | ||
13005 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
13006 | { | |
13007 | vty_out (vty, "%sInstance %s:%s", | |
13008 | VTY_NEWLINE, | |
13009 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name, | |
13010 | VTY_NEWLINE); | |
13011 | update_group_show(bgp, afi, safi, vty, 0); | |
13012 | } | |
13013 | } | |
13014 | ||
8fe8a7f6 DS |
13015 | DEFUN (show_ip_bgp_updgrps, |
13016 | show_ip_bgp_updgrps_cmd, | |
13017 | "show ip bgp update-groups", | |
13018 | SHOW_STR | |
13019 | IP_STR | |
13020 | BGP_STR | |
13021 | "Detailed info about dynamic update groups\n") | |
13022 | { | |
8386ac43 | 13023 | return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, 0)); |
13024 | } | |
13025 | ||
13026 | DEFUN (show_ip_bgp_instance_updgrps, | |
13027 | show_ip_bgp_instance_updgrps_cmd, | |
13028 | "show ip bgp " BGP_INSTANCE_CMD " update-groups", | |
13029 | SHOW_STR | |
13030 | IP_STR | |
13031 | BGP_STR | |
13032 | BGP_INSTANCE_HELP_STR | |
13033 | "Detailed info about dynamic update groups\n") | |
13034 | { | |
13035 | return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, 0)); | |
8fe8a7f6 DS |
13036 | } |
13037 | ||
f186de26 | 13038 | DEFUN (show_ip_bgp_instance_all_updgrps, |
13039 | show_ip_bgp_instance_all_updgrps_cmd, | |
13040 | "show ip bgp " BGP_INSTANCE_ALL_CMD " update-groups", | |
13041 | SHOW_STR | |
13042 | IP_STR | |
13043 | BGP_STR | |
13044 | BGP_INSTANCE_ALL_HELP_STR | |
13045 | "Detailed info about dynamic update groups\n") | |
13046 | { | |
13047 | bgp_show_all_instances_updgrps_vty (vty, AFI_IP, SAFI_UNICAST); | |
13048 | return CMD_SUCCESS; | |
13049 | } | |
13050 | ||
3f9c7369 DS |
13051 | DEFUN (show_bgp_ipv6_updgrps, |
13052 | show_bgp_ipv6_updgrps_cmd, | |
8fe8a7f6 | 13053 | "show bgp update-groups", |
3f9c7369 DS |
13054 | SHOW_STR |
13055 | BGP_STR | |
8fe8a7f6 | 13056 | "Detailed info about v6 dynamic update groups\n") |
3f9c7369 | 13057 | { |
8386ac43 | 13058 | return (bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, 0)); |
13059 | } | |
13060 | ||
13061 | DEFUN (show_bgp_instance_ipv6_updgrps, | |
13062 | show_bgp_instance_ipv6_updgrps_cmd, | |
13063 | "show bgp " BGP_INSTANCE_CMD " update-groups", | |
13064 | SHOW_STR | |
13065 | BGP_STR | |
13066 | BGP_INSTANCE_HELP_STR | |
13067 | "Detailed info about v6 dynamic update groups\n") | |
13068 | { | |
13069 | return (bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, 0)); | |
3f9c7369 DS |
13070 | } |
13071 | ||
f186de26 | 13072 | DEFUN (show_bgp_instance_all_ipv6_updgrps, |
13073 | show_bgp_instance_all_ipv6_updgrps_cmd, | |
13074 | "show bgp " BGP_INSTANCE_ALL_CMD " update-groups", | |
13075 | SHOW_STR | |
13076 | BGP_STR | |
13077 | BGP_INSTANCE_ALL_HELP_STR | |
13078 | "Detailed info about v6 dynamic update groups\n") | |
13079 | { | |
13080 | bgp_show_all_instances_updgrps_vty (vty, AFI_IP6, SAFI_UNICAST); | |
13081 | return CMD_SUCCESS; | |
13082 | } | |
13083 | ||
3f9c7369 DS |
13084 | DEFUN (show_bgp_updgrps, |
13085 | show_bgp_updgrps_cmd, | |
8fe8a7f6 | 13086 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups", |
3f9c7369 DS |
13087 | SHOW_STR |
13088 | BGP_STR | |
13089 | "Address family\n" | |
13090 | "Address family\n" | |
13091 | "Address Family modifier\n" | |
13092 | "Address Family modifier\n" | |
8fe8a7f6 | 13093 | "Detailed info about dynamic update groups\n") |
3f9c7369 | 13094 | { |
3f9c7369 DS |
13095 | afi_t afi; |
13096 | safi_t safi; | |
13097 | ||
13098 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13099 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8386ac43 | 13100 | return (bgp_show_update_groups(vty, NULL, afi, safi, 0)); |
8fe8a7f6 DS |
13101 | } |
13102 | ||
13103 | DEFUN (show_ip_bgp_updgrps_s, | |
13104 | show_ip_bgp_updgrps_s_cmd, | |
13105 | "show ip bgp update-groups SUBGROUP-ID", | |
13106 | SHOW_STR | |
13107 | IP_STR | |
13108 | BGP_STR | |
13109 | "Detailed info about dynamic update groups\n" | |
13110 | "Specific subgroup to display detailed info for\n") | |
13111 | { | |
13112 | u_int64_t subgrp_id; | |
13113 | ||
13114 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
8386ac43 | 13115 | return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, subgrp_id)); |
13116 | } | |
13117 | ||
13118 | DEFUN (show_ip_bgp_instance_updgrps_s, | |
13119 | show_ip_bgp_instance_updgrps_s_cmd, | |
13120 | "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID", | |
13121 | SHOW_STR | |
13122 | IP_STR | |
13123 | BGP_STR | |
13124 | BGP_INSTANCE_HELP_STR | |
13125 | "Detailed info about dynamic update groups\n" | |
13126 | "Specific subgroup to display detailed info for\n") | |
13127 | { | |
13128 | u_int64_t subgrp_id; | |
13129 | ||
13130 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13131 | return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, subgrp_id)); | |
8fe8a7f6 DS |
13132 | } |
13133 | ||
13134 | DEFUN (show_bgp_ipv6_updgrps_s, | |
13135 | show_bgp_ipv6_updgrps_s_cmd, | |
13136 | "show bgp update-groups SUBGROUP-ID", | |
13137 | SHOW_STR | |
13138 | BGP_STR | |
13139 | "Detailed info about v6 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_IP6, SAFI_UNICAST, subgrp_id)); |
13146 | } | |
13147 | ||
13148 | DEFUN (show_bgp_instance_ipv6_updgrps_s, | |
13149 | show_bgp_instance_ipv6_updgrps_s_cmd, | |
13150 | "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID", | |
13151 | SHOW_STR | |
13152 | BGP_STR | |
13153 | "Detailed info about v6 dynamic update groups\n" | |
13154 | "Specific subgroup to display detailed info for\n") | |
13155 | { | |
13156 | u_int64_t subgrp_id; | |
13157 | ||
13158 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13159 | return(bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, subgrp_id)); | |
8fe8a7f6 DS |
13160 | } |
13161 | ||
13162 | DEFUN (show_bgp_updgrps_s, | |
13163 | show_bgp_updgrps_s_cmd, | |
13164 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID", | |
13165 | SHOW_STR | |
13166 | BGP_STR | |
13167 | "Address family\n" | |
13168 | "Address family\n" | |
13169 | "Address Family modifier\n" | |
13170 | "Address Family modifier\n" | |
13171 | "Detailed info about v6 dynamic update groups\n" | |
13172 | "Specific subgroup to display detailed info for") | |
13173 | { | |
13174 | afi_t afi; | |
13175 | safi_t safi; | |
13176 | u_int64_t subgrp_id; | |
13177 | ||
13178 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13179 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
13180 | ||
13181 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
8386ac43 | 13182 | return(bgp_show_update_groups(vty, NULL, afi, safi, subgrp_id)); |
3f9c7369 DS |
13183 | } |
13184 | ||
13185 | DEFUN (show_bgp_updgrps_stats, | |
13186 | show_bgp_updgrps_stats_cmd, | |
13187 | "show bgp update-groups statistics", | |
13188 | SHOW_STR | |
13189 | BGP_STR | |
13190 | "BGP update groups\n" | |
13191 | "Statistics\n") | |
13192 | { | |
13193 | struct bgp *bgp; | |
13194 | ||
13195 | bgp = bgp_get_default(); | |
13196 | if (bgp) | |
13197 | update_group_show_stats(bgp, vty); | |
13198 | ||
13199 | return CMD_SUCCESS; | |
13200 | } | |
13201 | ||
8386ac43 | 13202 | DEFUN (show_bgp_instance_updgrps_stats, |
13203 | show_bgp_instance_updgrps_stats_cmd, | |
13204 | "show bgp " BGP_INSTANCE_CMD " update-groups statistics", | |
13205 | SHOW_STR | |
13206 | BGP_STR | |
13207 | BGP_INSTANCE_HELP_STR | |
13208 | "BGP update groups\n" | |
13209 | "Statistics\n") | |
13210 | { | |
13211 | struct bgp *bgp; | |
13212 | ||
13213 | bgp = bgp_lookup_by_name (argv[1]); | |
13214 | if (bgp) | |
13215 | update_group_show_stats(bgp, vty); | |
13216 | ||
13217 | return CMD_SUCCESS; | |
13218 | } | |
13219 | ||
3f9c7369 | 13220 | static void |
8386ac43 | 13221 | show_bgp_updgrps_adj_info_aux (struct vty *vty, const char *name, |
13222 | afi_t afi, safi_t safi, | |
3f9c7369 DS |
13223 | const char *what, u_int64_t subgrp_id) |
13224 | { | |
13225 | struct bgp *bgp; | |
8386ac43 | 13226 | |
13227 | if (name) | |
13228 | bgp = bgp_lookup_by_name (name); | |
13229 | else | |
13230 | bgp = bgp_get_default (); | |
13231 | ||
3f9c7369 DS |
13232 | if (bgp) |
13233 | { | |
13234 | if (!strcmp(what, "advertise-queue")) | |
13235 | update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id); | |
13236 | else if (!strcmp(what, "advertised-routes")) | |
13237 | update_group_show_advertised(bgp, afi, safi, vty, subgrp_id); | |
13238 | else if (!strcmp(what, "packet-queue")) | |
13239 | update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id); | |
13240 | } | |
13241 | } | |
13242 | ||
13243 | DEFUN (show_ip_bgp_updgrps_adj, | |
13244 | show_ip_bgp_updgrps_adj_cmd, | |
13245 | "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13246 | SHOW_STR | |
13247 | IP_STR | |
13248 | BGP_STR | |
13249 | "BGP update groups\n" | |
13250 | "Advertisement queue\n" | |
13251 | "Announced routes\n" | |
13252 | "Packet queue\n") | |
8fe8a7f6 | 13253 | |
3f9c7369 | 13254 | { |
8386ac43 | 13255 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[0], 0); |
13256 | return CMD_SUCCESS; | |
13257 | } | |
13258 | ||
13259 | DEFUN (show_ip_bgp_instance_updgrps_adj, | |
13260 | show_ip_bgp_instance_updgrps_adj_cmd, | |
13261 | "show ip bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13262 | SHOW_STR | |
13263 | IP_STR | |
13264 | BGP_STR | |
13265 | BGP_INSTANCE_HELP_STR | |
13266 | "BGP update groups\n" | |
13267 | "Advertisement queue\n" | |
13268 | "Announced routes\n" | |
13269 | "Packet queue\n") | |
13270 | ||
13271 | { | |
13272 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[2], 0); | |
3f9c7369 DS |
13273 | return CMD_SUCCESS; |
13274 | } | |
13275 | ||
13276 | DEFUN (show_bgp_updgrps_afi_adj, | |
13277 | show_bgp_updgrps_afi_adj_cmd, | |
13278 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13279 | SHOW_STR | |
13280 | BGP_STR | |
13281 | "Address family\n" | |
13282 | "Address family\n" | |
13283 | "Address Family modifier\n" | |
13284 | "Address Family modifier\n" | |
13285 | "BGP update groups\n" | |
13286 | "Advertisement queue\n" | |
13287 | "Announced routes\n" | |
8fe8a7f6 DS |
13288 | "Packet queue\n" |
13289 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
13290 | { |
13291 | afi_t afi; | |
13292 | safi_t safi; | |
13293 | ||
13294 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13295 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8386ac43 | 13296 | show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[2], 0); |
8fe8a7f6 | 13297 | return CMD_SUCCESS; |
3f9c7369 DS |
13298 | } |
13299 | ||
13300 | DEFUN (show_bgp_updgrps_adj, | |
13301 | show_bgp_updgrps_adj_cmd, | |
13302 | "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13303 | SHOW_STR | |
13304 | BGP_STR | |
13305 | "BGP update groups\n" | |
13306 | "Advertisement queue\n" | |
13307 | "Announced routes\n" | |
13308 | "Packet queue\n") | |
13309 | { | |
8386ac43 | 13310 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[0], 0); |
13311 | return CMD_SUCCESS; | |
13312 | } | |
13313 | ||
13314 | DEFUN (show_bgp_instance_updgrps_adj, | |
13315 | show_bgp_instance_updgrps_adj_cmd, | |
13316 | "show bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13317 | SHOW_STR | |
13318 | BGP_STR | |
13319 | BGP_INSTANCE_HELP_STR | |
13320 | "BGP update groups\n" | |
13321 | "Advertisement queue\n" | |
13322 | "Announced routes\n" | |
13323 | "Packet queue\n") | |
13324 | { | |
13325 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[2], 0); | |
3f9c7369 DS |
13326 | return CMD_SUCCESS; |
13327 | } | |
13328 | ||
13329 | DEFUN (show_ip_bgp_updgrps_adj_s, | |
8fe8a7f6 | 13330 | show_ip_bgp_updgrps_adj_s_cmd, |
3f9c7369 DS |
13331 | "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
13332 | SHOW_STR | |
13333 | IP_STR | |
13334 | BGP_STR | |
13335 | "BGP update groups\n" | |
8fe8a7f6 | 13336 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
13337 | "Advertisement queue\n" |
13338 | "Announced routes\n" | |
13339 | "Packet queue\n") | |
3f9c7369 | 13340 | |
3f9c7369 | 13341 | { |
8fe8a7f6 DS |
13342 | u_int64_t subgrp_id; |
13343 | ||
13344 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
13345 | ||
8386ac43 | 13346 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id); |
13347 | return CMD_SUCCESS; | |
13348 | } | |
13349 | ||
13350 | DEFUN (show_ip_bgp_instance_updgrps_adj_s, | |
13351 | show_ip_bgp_instance_updgrps_adj_s_cmd, | |
13352 | "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13353 | SHOW_STR | |
13354 | IP_STR | |
13355 | BGP_STR | |
13356 | BGP_INSTANCE_HELP_STR | |
13357 | "BGP update groups\n" | |
13358 | "Specific subgroup to display info for\n" | |
13359 | "Advertisement queue\n" | |
13360 | "Announced routes\n" | |
13361 | "Packet queue\n") | |
13362 | ||
13363 | { | |
13364 | u_int64_t subgrp_id; | |
13365 | ||
13366 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13367 | ||
13368 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[3], subgrp_id); | |
3f9c7369 DS |
13369 | return CMD_SUCCESS; |
13370 | } | |
13371 | ||
8fe8a7f6 DS |
13372 | DEFUN (show_bgp_updgrps_afi_adj_s, |
13373 | show_bgp_updgrps_afi_adj_s_cmd, | |
3f9c7369 DS |
13374 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
13375 | SHOW_STR | |
13376 | BGP_STR | |
13377 | "Address family\n" | |
13378 | "Address family\n" | |
13379 | "Address Family modifier\n" | |
13380 | "Address Family modifier\n" | |
13381 | "BGP update groups\n" | |
8fe8a7f6 | 13382 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
13383 | "Advertisement queue\n" |
13384 | "Announced routes\n" | |
8fe8a7f6 DS |
13385 | "Packet queue\n" |
13386 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
13387 | { |
13388 | afi_t afi; | |
13389 | safi_t safi; | |
8fe8a7f6 | 13390 | u_int64_t subgrp_id; |
3f9c7369 DS |
13391 | |
13392 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13393 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8fe8a7f6 DS |
13394 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); |
13395 | ||
8386ac43 | 13396 | show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[3], subgrp_id); |
8fe8a7f6 | 13397 | return CMD_SUCCESS; |
3f9c7369 DS |
13398 | } |
13399 | ||
8fe8a7f6 DS |
13400 | DEFUN (show_bgp_updgrps_adj_s, |
13401 | show_bgp_updgrps_adj_s_cmd, | |
13402 | "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13403 | SHOW_STR | |
13404 | BGP_STR | |
13405 | "BGP update groups\n" | |
13406 | "Specific subgroup to display info for\n" | |
13407 | "Advertisement queue\n" | |
13408 | "Announced routes\n" | |
13409 | "Packet queue\n") | |
13410 | { | |
13411 | u_int64_t subgrp_id; | |
13412 | ||
13413 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
13414 | ||
8386ac43 | 13415 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id); |
8fe8a7f6 DS |
13416 | return CMD_SUCCESS; |
13417 | } | |
13418 | ||
8386ac43 | 13419 | DEFUN (show_bgp_instance_updgrps_adj_s, |
13420 | show_bgp_instance_updgrps_adj_s_cmd, | |
13421 | "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13422 | SHOW_STR | |
13423 | BGP_STR | |
13424 | BGP_INSTANCE_HELP_STR | |
13425 | "BGP update groups\n" | |
13426 | "Specific subgroup to display info for\n" | |
13427 | "Advertisement queue\n" | |
13428 | "Announced routes\n" | |
13429 | "Packet queue\n") | |
13430 | { | |
13431 | u_int64_t subgrp_id; | |
13432 | ||
13433 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13434 | ||
13435 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id); | |
13436 | return CMD_SUCCESS; | |
13437 | } | |
13438 | ||
13439 | ||
8fe8a7f6 | 13440 | |
f14e6fdb DS |
13441 | static int |
13442 | bgp_show_one_peer_group (struct vty *vty, struct peer_group *group) | |
13443 | { | |
13444 | struct listnode *node, *nnode; | |
13445 | struct prefix *range; | |
13446 | struct peer *conf; | |
13447 | struct peer *peer; | |
4690c7d7 | 13448 | char buf[PREFIX2STR_BUFFER]; |
f14e6fdb DS |
13449 | afi_t afi; |
13450 | safi_t safi; | |
ffd0c037 DS |
13451 | const char *peer_status; |
13452 | const char *af_str; | |
f14e6fdb DS |
13453 | int lr_count; |
13454 | int dynamic; | |
13455 | int af_cfgd; | |
13456 | ||
13457 | conf = group->conf; | |
13458 | ||
0299c004 DS |
13459 | if (conf->as_type == AS_SPECIFIED || |
13460 | conf->as_type == AS_EXTERNAL) { | |
66b199b2 | 13461 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
f14e6fdb | 13462 | VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE); |
0299c004 | 13463 | } else if (conf->as_type == AS_INTERNAL) { |
66b199b2 | 13464 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
0299c004 | 13465 | VTY_NEWLINE, group->name, group->bgp->as, VTY_NEWLINE); |
66b199b2 DS |
13466 | } else { |
13467 | vty_out (vty, "%sBGP peer-group %s%s", | |
13468 | VTY_NEWLINE, group->name, VTY_NEWLINE); | |
0299c004 | 13469 | } |
f14e6fdb | 13470 | |
0299c004 | 13471 | if ((group->bgp->as == conf->as) || (conf->as_type == AS_INTERNAL)) |
f14e6fdb DS |
13472 | vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE); |
13473 | else | |
13474 | vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE); | |
13475 | ||
13476 | /* Display AFs configured. */ | |
13477 | vty_out (vty, " Configured address-families:"); | |
13478 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
13479 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
13480 | { | |
13481 | if (conf->afc[afi][safi]) | |
13482 | { | |
13483 | af_cfgd = 1; | |
13484 | vty_out (vty, " %s;", afi_safi_print(afi, safi)); | |
13485 | } | |
13486 | } | |
13487 | if (!af_cfgd) | |
13488 | vty_out (vty, " none%s", VTY_NEWLINE); | |
13489 | else | |
13490 | vty_out (vty, "%s", VTY_NEWLINE); | |
13491 | ||
13492 | /* Display listen ranges (for dynamic neighbors), if any */ | |
13493 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
13494 | { | |
13495 | if (afi == AFI_IP) | |
13496 | af_str = "IPv4"; | |
13497 | else if (afi == AFI_IP6) | |
13498 | af_str = "IPv6"; | |
13499 | lr_count = listcount(group->listen_range[afi]); | |
13500 | if (lr_count) | |
13501 | { | |
13502 | vty_out(vty, | |
13503 | " %d %s listen range(s)%s", | |
13504 | lr_count, af_str, VTY_NEWLINE); | |
13505 | ||
13506 | ||
13507 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node, | |
13508 | nnode, range)) | |
13509 | { | |
13510 | prefix2str(range, buf, sizeof(buf)); | |
13511 | vty_out(vty, " %s%s", buf, VTY_NEWLINE); | |
13512 | } | |
13513 | } | |
13514 | } | |
13515 | ||
13516 | /* Display group members and their status */ | |
13517 | if (listcount(group->peer)) | |
13518 | { | |
13519 | vty_out (vty, " Peer-group members:%s", VTY_NEWLINE); | |
13520 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
13521 | { | |
13522 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
13523 | peer_status = "Idle (Admin)"; | |
13524 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
13525 | peer_status = "Idle (PfxCt)"; | |
13526 | else | |
13527 | peer_status = LOOKUP(bgp_status_msg, peer->status); | |
13528 | ||
13529 | dynamic = peer_dynamic_neighbor(peer); | |
13530 | vty_out (vty, " %s %s %s %s", | |
13531 | peer->host, dynamic ? "(dynamic)" : "", | |
13532 | peer_status, VTY_NEWLINE); | |
13533 | } | |
13534 | } | |
13535 | ||
13536 | return CMD_SUCCESS; | |
13537 | } | |
13538 | ||
13539 | /* Show BGP peer group's information. */ | |
13540 | enum show_group_type | |
13541 | { | |
13542 | show_all_groups, | |
13543 | show_peer_group | |
13544 | }; | |
13545 | ||
13546 | static int | |
13547 | bgp_show_peer_group (struct vty *vty, struct bgp *bgp, | |
13548 | enum show_group_type type, const char *group_name) | |
13549 | { | |
13550 | struct listnode *node, *nnode; | |
13551 | struct peer_group *group; | |
13552 | int find = 0; | |
13553 | ||
13554 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
13555 | { | |
13556 | switch (type) | |
13557 | { | |
13558 | case show_all_groups: | |
13559 | bgp_show_one_peer_group (vty, group); | |
13560 | break; | |
13561 | case show_peer_group: | |
13562 | if (group_name && (strcmp(group->name, group_name) == 0)) | |
13563 | { | |
13564 | find = 1; | |
13565 | bgp_show_one_peer_group (vty, group); | |
13566 | } | |
13567 | break; | |
13568 | } | |
13569 | } | |
13570 | ||
13571 | if (type == show_peer_group && ! find) | |
13572 | vty_out (vty, "%% No such peer-groupr%s", VTY_NEWLINE); | |
13573 | ||
13574 | return CMD_SUCCESS; | |
13575 | } | |
13576 | ||
13577 | static int | |
13578 | bgp_show_peer_group_vty (struct vty *vty, const char *name, | |
13579 | enum show_group_type type, const char *group_name) | |
13580 | { | |
13581 | struct bgp *bgp; | |
13582 | int ret = CMD_SUCCESS; | |
13583 | ||
13584 | if (name) | |
8386ac43 | 13585 | bgp = bgp_lookup_by_name (name); |
13586 | else | |
13587 | bgp = bgp_get_default (); | |
f14e6fdb | 13588 | |
8386ac43 | 13589 | if (! bgp) |
13590 | { | |
13591 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
13592 | return CMD_WARNING; | |
f14e6fdb DS |
13593 | } |
13594 | ||
8386ac43 | 13595 | ret = bgp_show_peer_group (vty, bgp, type, group_name); |
f14e6fdb DS |
13596 | |
13597 | return ret; | |
13598 | } | |
13599 | ||
13600 | DEFUN (show_ip_bgp_peer_groups, | |
13601 | show_ip_bgp_peer_groups_cmd, | |
13602 | "show ip bgp peer-group", | |
13603 | SHOW_STR | |
13604 | IP_STR | |
13605 | BGP_STR | |
13606 | "Detailed information on all BGP peer groups\n") | |
13607 | { | |
13608 | return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL); | |
13609 | } | |
13610 | ||
13611 | DEFUN (show_ip_bgp_instance_peer_groups, | |
13612 | show_ip_bgp_instance_peer_groups_cmd, | |
8386ac43 | 13613 | "show ip bgp " BGP_INSTANCE_CMD " peer-group", |
f14e6fdb DS |
13614 | SHOW_STR |
13615 | IP_STR | |
13616 | BGP_STR | |
8386ac43 | 13617 | BGP_INSTANCE_HELP_STR |
f14e6fdb DS |
13618 | "Detailed information on all BGP peer groups\n") |
13619 | { | |
8386ac43 | 13620 | return bgp_show_peer_group_vty (vty, argv[1], show_all_groups, NULL); |
f14e6fdb DS |
13621 | } |
13622 | ||
13623 | DEFUN (show_ip_bgp_peer_group, | |
13624 | show_ip_bgp_peer_group_cmd, | |
13625 | "show ip bgp peer-group WORD", | |
13626 | SHOW_STR | |
13627 | IP_STR | |
13628 | BGP_STR | |
13629 | "BGP peer-group name\n" | |
13630 | "Detailed information on a BGP peer group\n") | |
13631 | { | |
13632 | return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]); | |
13633 | } | |
13634 | ||
13635 | DEFUN (show_ip_bgp_instance_peer_group, | |
13636 | show_ip_bgp_instance_peer_group_cmd, | |
8386ac43 | 13637 | "show ip bgp " BGP_INSTANCE_CMD " peer-group WORD", |
f14e6fdb DS |
13638 | SHOW_STR |
13639 | IP_STR | |
13640 | BGP_STR | |
8386ac43 | 13641 | BGP_INSTANCE_HELP_STR |
f14e6fdb DS |
13642 | "BGP peer-group name\n" |
13643 | "Detailed information on a BGP peer group\n") | |
13644 | { | |
8386ac43 | 13645 | return bgp_show_peer_group_vty (vty, argv[1], show_peer_group, argv[2]); |
f14e6fdb | 13646 | } |
3f9c7369 | 13647 | |
718e3744 | 13648 | /* Redistribute VTY commands. */ |
13649 | ||
718e3744 | 13650 | DEFUN (bgp_redistribute_ipv4, |
13651 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 13652 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 13653 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13654 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 13655 | { |
13656 | int type; | |
13657 | ||
e0ca5fde DL |
13658 | type = proto_redistnum (AFI_IP, argv[0]); |
13659 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13660 | { |
13661 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13662 | return CMD_WARNING; | |
13663 | } | |
7c8ff89e | 13664 | bgp_redist_add(vty->index, AFI_IP, type, 0); |
6aeb9e78 | 13665 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13666 | } |
13667 | ||
13668 | DEFUN (bgp_redistribute_ipv4_rmap, | |
13669 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 13670 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 13671 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13672 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13673 | "Route map reference\n" |
13674 | "Pointer to route-map entries\n") | |
13675 | { | |
13676 | int type; | |
7c8ff89e | 13677 | struct bgp_redist *red; |
718e3744 | 13678 | |
e0ca5fde DL |
13679 | type = proto_redistnum (AFI_IP, argv[0]); |
13680 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13681 | { |
13682 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13683 | return CMD_WARNING; | |
13684 | } | |
13685 | ||
7c8ff89e DS |
13686 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
13687 | bgp_redistribute_rmap_set (red, argv[1]); | |
6aeb9e78 | 13688 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13689 | } |
13690 | ||
13691 | DEFUN (bgp_redistribute_ipv4_metric, | |
13692 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 13693 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 13694 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13695 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13696 | "Metric for redistributed routes\n" |
13697 | "Default metric\n") | |
13698 | { | |
13699 | int type; | |
13700 | u_int32_t metric; | |
7c8ff89e | 13701 | struct bgp_redist *red; |
718e3744 | 13702 | |
e0ca5fde DL |
13703 | type = proto_redistnum (AFI_IP, argv[0]); |
13704 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13705 | { |
13706 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13707 | return CMD_WARNING; | |
13708 | } | |
13709 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
13710 | ||
7c8ff89e | 13711 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 13712 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
6aeb9e78 | 13713 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13714 | } |
13715 | ||
13716 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
13717 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 13718 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 13719 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13720 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13721 | "Route map reference\n" |
13722 | "Pointer to route-map entries\n" | |
13723 | "Metric for redistributed routes\n" | |
13724 | "Default metric\n") | |
13725 | { | |
13726 | int type; | |
13727 | u_int32_t metric; | |
7c8ff89e | 13728 | struct bgp_redist *red; |
718e3744 | 13729 | |
e0ca5fde DL |
13730 | type = proto_redistnum (AFI_IP, argv[0]); |
13731 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13732 | { |
13733 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13734 | return CMD_WARNING; | |
13735 | } | |
13736 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13737 | ||
7c8ff89e DS |
13738 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
13739 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 13740 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
6aeb9e78 | 13741 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13742 | } |
13743 | ||
13744 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
13745 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 13746 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 13747 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13748 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13749 | "Metric for redistributed routes\n" |
13750 | "Default metric\n" | |
13751 | "Route map reference\n" | |
13752 | "Pointer to route-map entries\n") | |
13753 | { | |
13754 | int type; | |
13755 | u_int32_t metric; | |
7c8ff89e | 13756 | struct bgp_redist *red; |
718e3744 | 13757 | |
e0ca5fde DL |
13758 | type = proto_redistnum (AFI_IP, argv[0]); |
13759 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13760 | { |
13761 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13762 | return CMD_WARNING; | |
13763 | } | |
13764 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
13765 | ||
7c8ff89e | 13766 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 13767 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
7c8ff89e | 13768 | bgp_redistribute_rmap_set (red, argv[2]); |
6aeb9e78 | 13769 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13770 | } |
13771 | ||
7c8ff89e DS |
13772 | DEFUN (bgp_redistribute_ipv4_ospf, |
13773 | bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 13774 | "redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
13775 | "Redistribute information from another routing protocol\n" |
13776 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13777 | "Non-main Kernel Routing Table\n" |
13778 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
13779 | { |
13780 | u_short instance; | |
7a4bb9c5 | 13781 | u_short protocol; |
7c8ff89e | 13782 | |
7a4bb9c5 DS |
13783 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13784 | ||
13785 | if (strncmp(argv[0], "o", 1) == 0) | |
13786 | protocol = ZEBRA_ROUTE_OSPF; | |
13787 | else | |
13788 | protocol = ZEBRA_ROUTE_TABLE; | |
13789 | ||
13790 | bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
6aeb9e78 | 13791 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13792 | } |
13793 | ||
13794 | DEFUN (bgp_redistribute_ipv4_ospf_rmap, | |
13795 | bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 13796 | "redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
13797 | "Redistribute information from another routing protocol\n" |
13798 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13799 | "Non-main Kernel Routing Table\n" |
13800 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13801 | "Route map reference\n" |
13802 | "Pointer to route-map entries\n") | |
13803 | { | |
13804 | struct bgp_redist *red; | |
13805 | u_short instance; | |
7a4bb9c5 | 13806 | int protocol; |
7c8ff89e | 13807 | |
7a4bb9c5 DS |
13808 | if (strncmp(argv[0], "o", 1) == 0) |
13809 | protocol = ZEBRA_ROUTE_OSPF; | |
13810 | else | |
13811 | protocol = ZEBRA_ROUTE_TABLE; | |
13812 | ||
13813 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); | |
13814 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
13815 | bgp_redistribute_rmap_set (red, argv[2]); | |
6aeb9e78 | 13816 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13817 | } |
13818 | ||
13819 | DEFUN (bgp_redistribute_ipv4_ospf_metric, | |
13820 | bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 13821 | "redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
13822 | "Redistribute information from another routing protocol\n" |
13823 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13824 | "Non-main Kernel Routing Table\n" |
13825 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13826 | "Metric for redistributed routes\n" |
13827 | "Default metric\n") | |
13828 | { | |
13829 | u_int32_t metric; | |
13830 | struct bgp_redist *red; | |
13831 | u_short instance; | |
7a4bb9c5 | 13832 | int protocol; |
7c8ff89e | 13833 | |
7a4bb9c5 DS |
13834 | if (strncmp(argv[0], "o", 1) == 0) |
13835 | protocol = ZEBRA_ROUTE_OSPF; | |
13836 | else | |
13837 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13838 | |
7a4bb9c5 DS |
13839 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13840 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13841 | ||
13842 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 13843 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
6aeb9e78 | 13844 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13845 | } |
13846 | ||
13847 | DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, | |
13848 | bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 13849 | "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
13850 | "Redistribute information from another routing protocol\n" |
13851 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13852 | "Non-main Kernel Routing Table\n" |
13853 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13854 | "Route map reference\n" |
13855 | "Pointer to route-map entries\n" | |
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[3]); | |
13871 | ||
13872 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
13873 | bgp_redistribute_rmap_set (red, argv[2]); | |
caf958b4 | 13874 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
6aeb9e78 | 13875 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13876 | } |
13877 | ||
13878 | DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, | |
13879 | bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 13880 | "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
13881 | "Redistribute information from another routing protocol\n" |
13882 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13883 | "Non-main Kernel Routing Table\n" |
13884 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13885 | "Metric for redistributed routes\n" |
13886 | "Default metric\n" | |
13887 | "Route map reference\n" | |
13888 | "Pointer to route-map entries\n") | |
13889 | { | |
13890 | u_int32_t metric; | |
13891 | struct bgp_redist *red; | |
13892 | u_short instance; | |
7a4bb9c5 | 13893 | int protocol; |
7c8ff89e | 13894 | |
7a4bb9c5 DS |
13895 | if (strncmp(argv[0], "o", 1) == 0) |
13896 | protocol = ZEBRA_ROUTE_OSPF; | |
13897 | else | |
13898 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13899 | |
7a4bb9c5 DS |
13900 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13901 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13902 | ||
13903 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 13904 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
7a4bb9c5 | 13905 | bgp_redistribute_rmap_set (red, argv[3]); |
6aeb9e78 | 13906 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13907 | } |
13908 | ||
13909 | DEFUN (no_bgp_redistribute_ipv4_ospf, | |
13910 | no_bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 13911 | "no redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
13912 | NO_STR |
13913 | "Redistribute information from another routing protocol\n" | |
13914 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13915 | "Non-main Kernel Routing Table\n" |
13916 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
13917 | { |
13918 | u_short instance; | |
7a4bb9c5 DS |
13919 | int protocol; |
13920 | ||
13921 | if (strncmp(argv[0], "o", 1) == 0) | |
13922 | protocol = ZEBRA_ROUTE_OSPF; | |
13923 | else | |
13924 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13925 | |
7a4bb9c5 DS |
13926 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13927 | return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); | |
7c8ff89e DS |
13928 | } |
13929 | ||
13930 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13931 | no_bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 13932 | "no redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
13933 | NO_STR |
13934 | "Redistribute information from another routing protocol\n" | |
13935 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13936 | "Non-main Kernel Routing Table\n" |
13937 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13938 | "Route map reference\n" |
13939 | "Pointer to route-map entries\n") | |
13940 | ||
13941 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13942 | no_bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 13943 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
13944 | NO_STR |
13945 | "Redistribute information from another routing protocol\n" | |
13946 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13947 | "Non-main Kernel Routing Table\n" |
13948 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13949 | "Metric for redistributed routes\n" |
13950 | "Default metric\n") | |
13951 | ||
13952 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13953 | no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 13954 | "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
13955 | NO_STR |
13956 | "Redistribute information from another routing protocol\n" | |
13957 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13958 | "Non-main Kernel Routing Table\n" |
13959 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13960 | "Route map reference\n" |
13961 | "Pointer to route-map entries\n" | |
13962 | "Metric for redistributed routes\n" | |
13963 | "Default metric\n") | |
13964 | ||
13965 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13966 | no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 13967 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
13968 | NO_STR |
13969 | "Redistribute information from another routing protocol\n" | |
13970 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13971 | "Non-main Kernel Routing Table\n" |
13972 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13973 | "Metric for redistributed routes\n" |
13974 | "Default metric\n" | |
13975 | "Route map reference\n" | |
13976 | "Pointer to route-map entries\n") | |
13977 | ||
718e3744 | 13978 | DEFUN (no_bgp_redistribute_ipv4, |
13979 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 13980 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 13981 | NO_STR |
13982 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 13983 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 13984 | { |
13985 | int type; | |
13986 | ||
e0ca5fde DL |
13987 | type = proto_redistnum (AFI_IP, argv[0]); |
13988 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13989 | { |
13990 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13991 | return CMD_WARNING; | |
13992 | } | |
7c8ff89e | 13993 | return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); |
718e3744 | 13994 | } |
13995 | ||
503006bc | 13996 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 13997 | no_bgp_redistribute_ipv4_rmap_cmd, |
e0ca5fde | 13998 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 13999 | NO_STR |
14000 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14001 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 14002 | "Route map reference\n" |
14003 | "Pointer to route-map entries\n") | |
718e3744 | 14004 | |
503006bc | 14005 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 14006 | no_bgp_redistribute_ipv4_metric_cmd, |
e0ca5fde | 14007 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 14008 | NO_STR |
14009 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14010 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 14011 | "Metric for redistributed routes\n" |
14012 | "Default metric\n") | |
718e3744 | 14013 | |
503006bc | 14014 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 14015 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
e0ca5fde | 14016 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 14017 | NO_STR |
14018 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14019 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 14020 | "Route map reference\n" |
14021 | "Pointer to route-map entries\n" | |
14022 | "Metric for redistributed routes\n" | |
14023 | "Default metric\n") | |
718e3744 | 14024 | |
503006bc | 14025 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 14026 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
e0ca5fde | 14027 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 14028 | NO_STR |
14029 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14030 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 14031 | "Metric for redistributed routes\n" |
14032 | "Default metric\n" | |
14033 | "Route map reference\n" | |
14034 | "Pointer to route-map entries\n") | |
6b0655a2 | 14035 | |
718e3744 | 14036 | #ifdef HAVE_IPV6 |
14037 | DEFUN (bgp_redistribute_ipv6, | |
14038 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 14039 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 14040 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14041 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 14042 | { |
14043 | int type; | |
14044 | ||
e0ca5fde DL |
14045 | type = proto_redistnum (AFI_IP6, argv[0]); |
14046 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14047 | { |
14048 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14049 | return CMD_WARNING; | |
14050 | } | |
14051 | ||
7c8ff89e | 14052 | bgp_redist_add(vty->index, AFI_IP6, type, 0); |
6aeb9e78 | 14053 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14054 | } |
14055 | ||
14056 | DEFUN (bgp_redistribute_ipv6_rmap, | |
14057 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 14058 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 14059 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14060 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14061 | "Route map reference\n" |
14062 | "Pointer to route-map entries\n") | |
14063 | { | |
14064 | int type; | |
7c8ff89e | 14065 | struct bgp_redist *red; |
718e3744 | 14066 | |
e0ca5fde DL |
14067 | type = proto_redistnum (AFI_IP6, argv[0]); |
14068 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14069 | { |
14070 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14071 | return CMD_WARNING; | |
14072 | } | |
14073 | ||
7c8ff89e DS |
14074 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
14075 | bgp_redistribute_rmap_set (red, argv[1]); | |
6aeb9e78 | 14076 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14077 | } |
14078 | ||
14079 | DEFUN (bgp_redistribute_ipv6_metric, | |
14080 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 14081 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 14082 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14083 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14084 | "Metric for redistributed routes\n" |
14085 | "Default metric\n") | |
14086 | { | |
14087 | int type; | |
14088 | u_int32_t metric; | |
7c8ff89e | 14089 | struct bgp_redist *red; |
718e3744 | 14090 | |
e0ca5fde DL |
14091 | type = proto_redistnum (AFI_IP6, argv[0]); |
14092 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14093 | { |
14094 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14095 | return CMD_WARNING; | |
14096 | } | |
14097 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
14098 | ||
7c8ff89e | 14099 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 14100 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
6aeb9e78 | 14101 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14102 | } |
14103 | ||
14104 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
14105 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 14106 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 14107 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14108 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14109 | "Route map reference\n" |
14110 | "Pointer to route-map entries\n" | |
14111 | "Metric for redistributed routes\n" | |
14112 | "Default metric\n") | |
14113 | { | |
14114 | int type; | |
14115 | u_int32_t metric; | |
7c8ff89e | 14116 | struct bgp_redist *red; |
718e3744 | 14117 | |
e0ca5fde DL |
14118 | type = proto_redistnum (AFI_IP6, argv[0]); |
14119 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14120 | { |
14121 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14122 | return CMD_WARNING; | |
14123 | } | |
14124 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
14125 | ||
7c8ff89e DS |
14126 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
14127 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 14128 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
6aeb9e78 | 14129 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14130 | } |
14131 | ||
14132 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
14133 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 14134 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 14135 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14136 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14137 | "Metric for redistributed routes\n" |
14138 | "Default metric\n" | |
14139 | "Route map reference\n" | |
14140 | "Pointer to route-map entries\n") | |
14141 | { | |
14142 | int type; | |
14143 | u_int32_t metric; | |
7c8ff89e | 14144 | struct bgp_redist *red; |
718e3744 | 14145 | |
e0ca5fde DL |
14146 | type = proto_redistnum (AFI_IP6, argv[0]); |
14147 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14148 | { |
14149 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14150 | return CMD_WARNING; | |
14151 | } | |
14152 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
14153 | ||
7c8ff89e | 14154 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 14155 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric); |
7c8ff89e | 14156 | bgp_redistribute_rmap_set (red, argv[2]); |
6aeb9e78 | 14157 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14158 | } |
14159 | ||
14160 | DEFUN (no_bgp_redistribute_ipv6, | |
14161 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 14162 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 14163 | NO_STR |
14164 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14165 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 14166 | { |
14167 | int type; | |
14168 | ||
e0ca5fde DL |
14169 | type = proto_redistnum (AFI_IP6, argv[0]); |
14170 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 14171 | { |
14172 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14173 | return CMD_WARNING; | |
14174 | } | |
14175 | ||
7c8ff89e | 14176 | return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0); |
718e3744 | 14177 | } |
14178 | ||
503006bc | 14179 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14180 | no_bgp_redistribute_ipv6_rmap_cmd, |
e0ca5fde | 14181 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 14182 | NO_STR |
14183 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14184 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14185 | "Route map reference\n" |
14186 | "Pointer to route-map entries\n") | |
718e3744 | 14187 | |
503006bc | 14188 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14189 | no_bgp_redistribute_ipv6_metric_cmd, |
e0ca5fde | 14190 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 14191 | NO_STR |
14192 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14193 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14194 | "Metric for redistributed routes\n" |
14195 | "Default metric\n") | |
718e3744 | 14196 | |
503006bc | 14197 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14198 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
e0ca5fde | 14199 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 14200 | NO_STR |
14201 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14202 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14203 | "Route map reference\n" |
14204 | "Pointer to route-map entries\n" | |
14205 | "Metric for redistributed routes\n" | |
14206 | "Default metric\n") | |
718e3744 | 14207 | |
503006bc | 14208 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14209 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
e0ca5fde | 14210 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 14211 | NO_STR |
14212 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14213 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14214 | "Metric for redistributed routes\n" |
14215 | "Default metric\n" | |
14216 | "Route map reference\n" | |
14217 | "Pointer to route-map entries\n") | |
14218 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 14219 | |
718e3744 | 14220 | int |
14221 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
14222 | safi_t safi, int *write) | |
14223 | { | |
14224 | int i; | |
718e3744 | 14225 | |
14226 | /* Unicast redistribution only. */ | |
14227 | if (safi != SAFI_UNICAST) | |
14228 | return 0; | |
14229 | ||
14230 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
14231 | { | |
14232 | /* Redistribute BGP does not make sense. */ | |
7c8ff89e | 14233 | if (i != ZEBRA_ROUTE_BGP) |
718e3744 | 14234 | { |
7c8ff89e DS |
14235 | struct list *red_list; |
14236 | struct listnode *node; | |
14237 | struct bgp_redist *red; | |
718e3744 | 14238 | |
7c8ff89e DS |
14239 | red_list = bgp->redist[afi][i]; |
14240 | if (!red_list) | |
14241 | continue; | |
718e3744 | 14242 | |
7c8ff89e DS |
14243 | for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) |
14244 | { | |
14245 | /* Display "address-family" when it is not yet diplayed. */ | |
14246 | bgp_config_write_family_header (vty, afi, safi, write); | |
14247 | ||
14248 | /* "redistribute" configuration. */ | |
0b960b4d | 14249 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
7c8ff89e DS |
14250 | if (red->instance) |
14251 | vty_out (vty, " %d", red->instance); | |
14252 | if (red->redist_metric_flag) | |
14253 | vty_out (vty, " metric %u", red->redist_metric); | |
14254 | if (red->rmap.name) | |
14255 | vty_out (vty, " route-map %s", red->rmap.name); | |
14256 | vty_out (vty, "%s", VTY_NEWLINE); | |
14257 | } | |
718e3744 | 14258 | } |
14259 | } | |
14260 | return *write; | |
14261 | } | |
6b0655a2 | 14262 | |
718e3744 | 14263 | /* BGP node structure. */ |
7fc626de | 14264 | static struct cmd_node bgp_node = |
718e3744 | 14265 | { |
14266 | BGP_NODE, | |
14267 | "%s(config-router)# ", | |
14268 | 1, | |
14269 | }; | |
14270 | ||
7fc626de | 14271 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 14272 | { |
14273 | BGP_IPV4_NODE, | |
14274 | "%s(config-router-af)# ", | |
14275 | 1, | |
14276 | }; | |
14277 | ||
7fc626de | 14278 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 14279 | { |
14280 | BGP_IPV4M_NODE, | |
14281 | "%s(config-router-af)# ", | |
14282 | 1, | |
14283 | }; | |
14284 | ||
7fc626de | 14285 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 14286 | { |
14287 | BGP_IPV6_NODE, | |
14288 | "%s(config-router-af)# ", | |
14289 | 1, | |
14290 | }; | |
14291 | ||
7fc626de | 14292 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 14293 | { |
14294 | BGP_IPV6M_NODE, | |
14295 | "%s(config-router-af)# ", | |
14296 | 1, | |
14297 | }; | |
14298 | ||
7fc626de | 14299 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 14300 | { |
14301 | BGP_VPNV4_NODE, | |
14302 | "%s(config-router-af)# ", | |
14303 | 1 | |
14304 | }; | |
6b0655a2 | 14305 | |
8ecd3266 | 14306 | static struct cmd_node bgp_vpnv6_node = |
14307 | { | |
14308 | BGP_VPNV6_NODE, | |
14309 | "%s(config-router-af-vpnv6)# ", | |
14310 | 1 | |
14311 | }; | |
14312 | ||
8b1fb8be LB |
14313 | static struct cmd_node bgp_encap_node = |
14314 | { | |
14315 | BGP_ENCAP_NODE, | |
14316 | "%s(config-router-af-encap)# ", | |
14317 | 1 | |
14318 | }; | |
14319 | ||
14320 | static struct cmd_node bgp_encapv6_node = | |
14321 | { | |
14322 | BGP_ENCAPV6_NODE, | |
14323 | "%s(config-router-af-encapv6)# ", | |
14324 | 1 | |
14325 | }; | |
14326 | ||
1f8ae70b | 14327 | static void community_list_vty (void); |
14328 | ||
718e3744 | 14329 | void |
94f2b392 | 14330 | bgp_vty_init (void) |
718e3744 | 14331 | { |
718e3744 | 14332 | /* Install bgp top node. */ |
14333 | install_node (&bgp_node, bgp_config_write); | |
14334 | install_node (&bgp_ipv4_unicast_node, NULL); | |
14335 | install_node (&bgp_ipv4_multicast_node, NULL); | |
14336 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 14337 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 14338 | install_node (&bgp_vpnv4_node, NULL); |
8ecd3266 | 14339 | install_node (&bgp_vpnv6_node, NULL); |
8b1fb8be LB |
14340 | install_node (&bgp_encap_node, NULL); |
14341 | install_node (&bgp_encapv6_node, NULL); | |
718e3744 | 14342 | |
14343 | /* Install default VTY commands to new nodes. */ | |
14344 | install_default (BGP_NODE); | |
14345 | install_default (BGP_IPV4_NODE); | |
14346 | install_default (BGP_IPV4M_NODE); | |
14347 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 14348 | install_default (BGP_IPV6M_NODE); |
718e3744 | 14349 | install_default (BGP_VPNV4_NODE); |
8ecd3266 | 14350 | install_default (BGP_VPNV6_NODE); |
8b1fb8be LB |
14351 | install_default (BGP_ENCAP_NODE); |
14352 | install_default (BGP_ENCAPV6_NODE); | |
718e3744 | 14353 | |
14354 | /* "bgp multiple-instance" commands. */ | |
14355 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
14356 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
14357 | ||
14358 | /* "bgp config-type" commands. */ | |
14359 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
813d4307 | 14360 | install_element (CONFIG_NODE, &no_bgp_config_type_val_cmd); |
718e3744 | 14361 | |
5fe9f963 | 14362 | /* bgp route-map delay-timer commands. */ |
14363 | install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd); | |
14364 | install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
14365 | install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); | |
14366 | ||
718e3744 | 14367 | /* Dummy commands (Currently not supported) */ |
14368 | install_element (BGP_NODE, &no_synchronization_cmd); | |
14369 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
14370 | ||
14371 | /* "router bgp" commands. */ | |
14372 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
6aeb9e78 | 14373 | install_element (CONFIG_NODE, &router_bgp_instance_cmd); |
2385a876 | 14374 | install_element (CONFIG_NODE, &router_bgp_noasn_cmd); |
718e3744 | 14375 | |
14376 | /* "no router bgp" commands. */ | |
14377 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
6aeb9e78 | 14378 | install_element (CONFIG_NODE, &no_router_bgp_instance_cmd); |
718e3744 | 14379 | |
14380 | /* "bgp router-id" commands. */ | |
14381 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
14382 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
14383 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
cdb805bc SK |
14384 | install_element (BGP_NODE, &bgp_router_id_interface_cmd); |
14385 | install_element (BGP_NODE, &no_bgp_router_id_interface_cmd); | |
718e3744 | 14386 | |
14387 | /* "bgp cluster-id" commands. */ | |
14388 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
14389 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
14390 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
813d4307 DW |
14391 | install_element (BGP_NODE, &no_bgp_cluster_id_ip_cmd); |
14392 | install_element (BGP_NODE, &no_bgp_cluster_id_decimal_cmd); | |
718e3744 | 14393 | |
14394 | /* "bgp confederation" commands. */ | |
14395 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
14396 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
14397 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
14398 | ||
14399 | /* "bgp confederation peers" commands. */ | |
14400 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
14401 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
14402 | ||
abc920f8 DS |
14403 | /* bgp max-med command */ |
14404 | install_element (BGP_NODE, &bgp_maxmed_admin_cmd); | |
14405 | install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd); | |
14406 | install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); | |
14407 | install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd); | |
14408 | install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); | |
14409 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); | |
14410 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd); | |
14411 | install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); | |
14412 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd); | |
14413 | ||
907f92c8 DS |
14414 | /* bgp disable-ebgp-connected-nh-check */ |
14415 | install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd); | |
14416 | install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd); | |
14417 | ||
f188f2c4 DS |
14418 | /* bgp update-delay command */ |
14419 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
14420 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
14421 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
14422 | install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); | |
14423 | ||
cb1faec9 DS |
14424 | install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); |
14425 | install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); | |
14426 | ||
3f9c7369 DS |
14427 | install_element (BGP_NODE, &bgp_coalesce_time_cmd); |
14428 | install_element (BGP_NODE, &no_bgp_coalesce_time_cmd); | |
14429 | ||
165b5fff JB |
14430 | /* "maximum-paths" commands. */ |
14431 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
14432 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
14433 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); | |
14434 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); | |
14435 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
14436 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); | |
431aa9f9 DS |
14437 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
14438 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
14439 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); | |
165b5fff | 14440 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14441 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff JB |
14442 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
14443 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 14444 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14445 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14446 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14447 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14448 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14449 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
431aa9f9 | 14450 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14451 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 DS |
14452 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
14453 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 14454 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14455 | |
718e3744 | 14456 | /* "timers bgp" commands. */ |
14457 | install_element (BGP_NODE, &bgp_timers_cmd); | |
14458 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
14459 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
14460 | ||
5fe9f963 | 14461 | /* route-map delay-timer commands - per instance for backwards compat. */ |
518f0eb1 DS |
14462 | install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd); |
14463 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
f414725f | 14464 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); |
518f0eb1 | 14465 | |
718e3744 | 14466 | /* "bgp client-to-client reflection" commands */ |
14467 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
14468 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
14469 | ||
14470 | /* "bgp always-compare-med" commands */ | |
14471 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
14472 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
14473 | ||
14474 | /* "bgp deterministic-med" commands */ | |
14475 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
14476 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 14477 | |
538621f2 | 14478 | /* "bgp graceful-restart" commands */ |
14479 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
14480 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 14481 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
14482 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
14483 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 14484 | |
14485 | /* "bgp fast-external-failover" commands */ | |
14486 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
14487 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
14488 | ||
14489 | /* "bgp enforce-first-as" commands */ | |
14490 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
14491 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
14492 | ||
14493 | /* "bgp bestpath compare-routerid" commands */ | |
14494 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
14495 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
14496 | ||
14497 | /* "bgp bestpath as-path ignore" commands */ | |
14498 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
14499 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
14500 | ||
6811845b | 14501 | /* "bgp bestpath as-path confed" commands */ |
14502 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
14503 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
14504 | ||
2fdd455c PM |
14505 | /* "bgp bestpath as-path multipath-relax" commands */ |
14506 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
14507 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
14508 | ||
848973c7 | 14509 | /* "bgp log-neighbor-changes" commands */ |
14510 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
14511 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
14512 | ||
718e3744 | 14513 | /* "bgp bestpath med" commands */ |
14514 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
14515 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
14516 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
14517 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
14518 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
14519 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
14520 | ||
14521 | /* "no bgp default ipv4-unicast" commands. */ | |
14522 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
14523 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
14524 | ||
14525 | /* "bgp network import-check" commands. */ | |
14526 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
8233ef81 | 14527 | install_element (BGP_NODE, &bgp_network_import_check_exact_cmd); |
718e3744 | 14528 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
14529 | ||
14530 | /* "bgp default local-preference" commands. */ | |
14531 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
14532 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
14533 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
14534 | ||
04b6bdc0 DW |
14535 | /* bgp default show-hostname */ |
14536 | install_element (BGP_NODE, &bgp_default_show_hostname_cmd); | |
14537 | install_element (BGP_NODE, &no_bgp_default_show_hostname_cmd); | |
14538 | ||
3f9c7369 DS |
14539 | /* "bgp default subgroup-pkt-queue-max" commands. */ |
14540 | install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd); | |
14541 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd); | |
813d4307 | 14542 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_val_cmd); |
3f9c7369 | 14543 | |
8bd9d948 DS |
14544 | /* bgp ibgp-allow-policy-mods command */ |
14545 | install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd); | |
14546 | install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd); | |
14547 | ||
f14e6fdb DS |
14548 | /* "bgp listen limit" commands. */ |
14549 | install_element (BGP_NODE, &bgp_listen_limit_cmd); | |
14550 | install_element (BGP_NODE, &no_bgp_listen_limit_cmd); | |
813d4307 | 14551 | install_element (BGP_NODE, &no_bgp_listen_limit_val_cmd); |
f14e6fdb DS |
14552 | |
14553 | /* "bgp listen range" commands. */ | |
14554 | install_element (BGP_NODE, &bgp_listen_range_cmd); | |
14555 | install_element (BGP_NODE, &no_bgp_listen_range_cmd); | |
14556 | ||
718e3744 | 14557 | /* "neighbor remote-as" commands. */ |
14558 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
a80beece | 14559 | install_element (BGP_NODE, &neighbor_interface_config_cmd); |
4c48cf63 DW |
14560 | install_element (BGP_NODE, &neighbor_interface_config_v6only_cmd); |
14561 | install_element (BGP_NODE, &neighbor_interface_config_peergroup_cmd); | |
14562 | install_element (BGP_NODE, &neighbor_interface_config_v6only_peergroup_cmd); | |
718e3744 | 14563 | install_element (BGP_NODE, &no_neighbor_cmd); |
14564 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
a80beece | 14565 | install_element (BGP_NODE, &no_neighbor_interface_config_cmd); |
4c48cf63 DW |
14566 | install_element (BGP_NODE, &no_neighbor_interface_config_v6only_cmd); |
14567 | install_element (BGP_NODE, &no_neighbor_interface_config_peergroup_cmd); | |
14568 | install_element (BGP_NODE, &no_neighbor_interface_config_v6only_peergroup_cmd); | |
718e3744 | 14569 | |
14570 | /* "neighbor peer-group" commands. */ | |
14571 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
14572 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
a80beece | 14573 | install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd); |
718e3744 | 14574 | |
14575 | /* "neighbor local-as" commands. */ | |
14576 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
14577 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 14578 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 14579 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
14580 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
14581 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
9d3f9705 | 14582 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
718e3744 | 14583 | |
3f9c7369 DS |
14584 | /* "neighbor solo" commands. */ |
14585 | install_element (BGP_NODE, &neighbor_solo_cmd); | |
14586 | install_element (BGP_NODE, &no_neighbor_solo_cmd); | |
14587 | ||
0df7c91f PJ |
14588 | /* "neighbor password" commands. */ |
14589 | install_element (BGP_NODE, &neighbor_password_cmd); | |
14590 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
813d4307 | 14591 | install_element (BGP_NODE, &no_neighbor_password_val_cmd); |
0df7c91f | 14592 | |
718e3744 | 14593 | /* "neighbor activate" commands. */ |
14594 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
14595 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
14596 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
14597 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 14598 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 14599 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
8ecd3266 | 14600 | install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd); |
8b1fb8be LB |
14601 | install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd); |
14602 | install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd); | |
718e3744 | 14603 | |
14604 | /* "no neighbor activate" commands. */ | |
14605 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
14606 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
14607 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
14608 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 14609 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 14610 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
8ecd3266 | 14611 | install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd); |
8b1fb8be LB |
14612 | install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd); |
14613 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd); | |
718e3744 | 14614 | |
c8560b44 DW |
14615 | /* "neighbor peer-group" set commands. |
14616 | * Long term we should only accept this command under BGP_NODE and not all of | |
14617 | * the afi/safi sub-contexts. For now though we need to accept it for backwards | |
14618 | * compatibility. This changed when we stopped requiring that peers be assigned | |
14619 | * to their peer-group under each address-family sub-context. | |
14620 | */ | |
718e3744 | 14621 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
14622 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
14623 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
14624 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 14625 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 14626 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
8ecd3266 | 14627 | install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd); |
8b1fb8be LB |
14628 | install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd); |
14629 | install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd); | |
c8560b44 | 14630 | |
718e3744 | 14631 | /* "no neighbor peer-group unset" commands. */ |
14632 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
14633 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
14634 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
14635 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 14636 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 14637 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
8ecd3266 | 14638 | install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd); |
8b1fb8be LB |
14639 | install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd); |
14640 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
a58545bb | 14641 | |
718e3744 | 14642 | /* "neighbor softreconfiguration inbound" commands.*/ |
14643 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
14644 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14645 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
14646 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14647 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
14648 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14649 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
14650 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 14651 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
14652 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 14653 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
14654 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8ecd3266 | 14655 | install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd); |
14656 | install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8b1fb8be LB |
14657 | install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd); |
14658 | install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14659 | install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
14660 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 14661 | |
14662 | /* "neighbor attribute-unchanged" commands. */ | |
14663 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
14664 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
14665 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
14666 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
14667 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
14668 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
14669 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
14670 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
14671 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
14672 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
14673 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
14674 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
14675 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14676 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14677 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14678 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14679 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14680 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14681 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14682 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14683 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14684 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14685 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
14686 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
14687 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
14688 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
14689 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
14690 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
14691 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
14692 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
14693 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
14694 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
14695 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
14696 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
14697 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14698 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14699 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14700 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14701 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14702 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14703 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14704 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14705 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14706 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14707 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
14708 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
14709 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
14710 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
14711 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
14712 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
14713 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
14714 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
14715 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
14716 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
14717 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
14718 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
14719 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14720 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14721 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14722 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14723 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14724 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14725 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14726 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14727 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14728 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14729 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
14730 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14731 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14732 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14733 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
14734 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
14735 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
14736 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
14737 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
14738 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
14739 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
14740 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
14741 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14742 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14743 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14744 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14745 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14746 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14747 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14748 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14749 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14750 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 14751 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
14752 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
14753 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
14754 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
14755 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
14756 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
14757 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
14758 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
14759 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
14760 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
14761 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
14762 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
14763 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14764 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14765 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14766 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14767 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14768 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14769 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14770 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14771 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14772 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 14773 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
14774 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
14775 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
14776 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
14777 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
14778 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
14779 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
14780 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
14781 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
14782 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
14783 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
14784 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
14785 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14786 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14787 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14788 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14789 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14790 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14791 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14792 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14793 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14794 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
8ecd3266 | 14795 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd); |
14796 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14797 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14798 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14799 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd); | |
14800 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd); | |
14801 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd); | |
14802 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd); | |
14803 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd); | |
14804 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd); | |
14805 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd); | |
14806 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
14807 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14808 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14809 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14810 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14811 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14812 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14813 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14814 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14815 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14816 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14817 | ||
8b1fb8be LB |
14818 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd); |
14819 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd); | |
14820 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd); | |
14821 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd); | |
14822 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd); | |
14823 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd); | |
14824 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd); | |
14825 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd); | |
14826 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd); | |
14827 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd); | |
14828 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd); | |
14829 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd); | |
14830 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14831 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14832 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14833 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14834 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14835 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14836 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14837 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14838 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14839 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14840 | ||
14841 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd); | |
14842 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14843 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14844 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14845 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
14846 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
14847 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
14848 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
14849 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
14850 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
14851 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
14852 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
14853 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14854 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14855 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14856 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14857 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14858 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14859 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14860 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14861 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14862 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 14863 | |
fee0f4c6 | 14864 | /* "nexthop-local unchanged" commands */ |
14865 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
14866 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
14867 | ||
718e3744 | 14868 | /* "neighbor next-hop-self" commands. */ |
14869 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
14870 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
14871 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
14872 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
14873 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
14874 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
14875 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
14876 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 14877 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
14878 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 14879 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
14880 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
8ecd3266 | 14881 | install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd); |
14882 | install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd); | |
8b1fb8be LB |
14883 | install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd); |
14884 | install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd); | |
14885 | install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd); | |
14886 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 14887 | |
a538debe DS |
14888 | /* "neighbor next-hop-self force" commands. */ |
14889 | install_element (BGP_NODE, &neighbor_nexthop_self_force_cmd); | |
14890 | install_element (BGP_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14891 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd); | |
14892 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14893 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd); | |
14894 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14895 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd); | |
14896 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14897 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd); | |
14898 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14899 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd); | |
14900 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
8ecd3266 | 14901 | install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_force_cmd); |
14902 | install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
a538debe | 14903 | |
c7122e14 DS |
14904 | /* "neighbor as-override" commands. */ |
14905 | install_element (BGP_NODE, &neighbor_as_override_cmd); | |
14906 | install_element (BGP_NODE, &no_neighbor_as_override_cmd); | |
14907 | install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd); | |
14908 | install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd); | |
14909 | install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd); | |
14910 | install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd); | |
14911 | install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd); | |
14912 | install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd); | |
14913 | install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd); | |
14914 | install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd); | |
14915 | install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd); | |
14916 | install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd); | |
8ecd3266 | 14917 | install_element (BGP_VPNV6_NODE, &neighbor_as_override_cmd); |
14918 | install_element (BGP_VPNV6_NODE, &no_neighbor_as_override_cmd); | |
c7122e14 | 14919 | |
718e3744 | 14920 | /* "neighbor remove-private-AS" commands. */ |
14921 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
14922 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14923 | install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd); |
14924 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14925 | install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14926 | install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14927 | install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14928 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14929 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
14930 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14931 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd); |
14932 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14933 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14934 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14935 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14936 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14937 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
14938 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14939 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd); |
14940 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14941 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14942 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14943 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14944 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14945 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
14946 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14947 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd); |
14948 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14949 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14950 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14951 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14952 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
25ffbdc1 | 14953 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
14954 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14955 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd); |
14956 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14957 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14958 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14959 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14960 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14961 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
14962 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14963 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd); |
14964 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14965 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14966 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14967 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14968 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
8ecd3266 | 14969 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd); |
14970 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd); | |
14971 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_cmd); | |
14972 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14973 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14974 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14975 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14976 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
8b1fb8be LB |
14977 | install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd); |
14978 | install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd); | |
14979 | install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd); | |
14980 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
718e3744 | 14981 | |
14982 | /* "neighbor send-community" commands.*/ | |
14983 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
14984 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
14985 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
14986 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
14987 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
14988 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
14989 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
14990 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
14991 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
14992 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
14993 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
14994 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
14995 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
14996 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
14997 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
14998 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 14999 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
15000 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
15001 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
15002 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 15003 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
15004 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
15005 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
15006 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
8ecd3266 | 15007 | install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd); |
15008 | install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd); | |
15009 | install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd); | |
15010 | install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd); | |
8b1fb8be LB |
15011 | install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd); |
15012 | install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd); | |
15013 | install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd); | |
15014 | install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd); | |
15015 | install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd); | |
15016 | install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd); | |
15017 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd); | |
15018 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 15019 | |
15020 | /* "neighbor route-reflector" commands.*/ | |
15021 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
15022 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
15023 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
15024 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
15025 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
15026 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
15027 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
15028 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 15029 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
15030 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 15031 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
15032 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
8ecd3266 | 15033 | install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd); |
15034 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
8b1fb8be LB |
15035 | install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd); |
15036 | install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd); | |
15037 | install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd); | |
15038 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 15039 | |
15040 | /* "neighbor route-server" commands.*/ | |
15041 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
15042 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
15043 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
15044 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
15045 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
15046 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
15047 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
15048 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 15049 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
15050 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 15051 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
15052 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
8ecd3266 | 15053 | install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd); |
15054 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd); | |
8b1fb8be LB |
15055 | install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd); |
15056 | install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd); | |
15057 | install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd); | |
15058 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 15059 | |
adbac85e DW |
15060 | /* "neighbor addpath-tx-all-paths" commands.*/ |
15061 | install_element (BGP_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15062 | install_element (BGP_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15063 | install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15064 | install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15065 | install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15066 | install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15067 | install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15068 | install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15069 | install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15070 | install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15071 | install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15072 | install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
8ecd3266 | 15073 | install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_all_paths_cmd); |
15074 | install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
adbac85e | 15075 | |
06370dac DW |
15076 | /* "neighbor addpath-tx-bestpath-per-AS" commands.*/ |
15077 | install_element (BGP_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15078 | install_element (BGP_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15079 | install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15080 | install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15081 | install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15082 | install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15083 | install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15084 | install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15085 | install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15086 | install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15087 | install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15088 | install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
8ecd3266 | 15089 | install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); |
15090 | install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
06370dac | 15091 | |
718e3744 | 15092 | /* "neighbor passive" commands. */ |
15093 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
15094 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
15095 | ||
d5a5c8f0 | 15096 | |
718e3744 | 15097 | /* "neighbor shutdown" commands. */ |
15098 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
15099 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
15100 | ||
8a92a8a0 DS |
15101 | /* "neighbor capability extended-nexthop" commands.*/ |
15102 | install_element (BGP_NODE, &neighbor_capability_enhe_cmd); | |
15103 | install_element (BGP_NODE, &no_neighbor_capability_enhe_cmd); | |
15104 | ||
718e3744 | 15105 | /* "neighbor capability orf prefix-list" commands.*/ |
15106 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
15107 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
15108 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
15109 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
15110 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
15111 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
15112 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
15113 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 15114 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
15115 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 15116 | |
15117 | /* "neighbor capability dynamic" commands.*/ | |
15118 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
15119 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
15120 | ||
15121 | /* "neighbor dont-capability-negotiate" commands. */ | |
15122 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
15123 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
15124 | ||
15125 | /* "neighbor ebgp-multihop" commands. */ | |
15126 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
15127 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
15128 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
15129 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
15130 | ||
6ffd2079 | 15131 | /* "neighbor disable-connected-check" commands. */ |
15132 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
15133 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 15134 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
15135 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
15136 | ||
15137 | /* "neighbor description" commands. */ | |
15138 | install_element (BGP_NODE, &neighbor_description_cmd); | |
15139 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
15140 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
15141 | ||
15142 | /* "neighbor update-source" commands. "*/ | |
15143 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
15144 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
15145 | ||
15146 | /* "neighbor default-originate" commands. */ | |
15147 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
15148 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
15149 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
15150 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
15151 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
15152 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
15153 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
15154 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
15155 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
15156 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
15157 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
15158 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
15159 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
15160 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
15161 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
15162 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 15163 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
15164 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
15165 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
15166 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 15167 | |
15168 | /* "neighbor port" commands. */ | |
15169 | install_element (BGP_NODE, &neighbor_port_cmd); | |
15170 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
15171 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
15172 | ||
15173 | /* "neighbor weight" commands. */ | |
15174 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
15175 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
15176 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
15177 | ||
15178 | /* "neighbor override-capability" commands. */ | |
15179 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
15180 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
15181 | ||
15182 | /* "neighbor strict-capability-match" commands. */ | |
15183 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
15184 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
15185 | ||
15186 | /* "neighbor timers" commands. */ | |
15187 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
15188 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
813d4307 | 15189 | install_element (BGP_NODE, &no_neighbor_timers_val_cmd); |
718e3744 | 15190 | |
15191 | /* "neighbor timers connect" commands. */ | |
15192 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
15193 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
15194 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
15195 | ||
15196 | /* "neighbor advertisement-interval" commands. */ | |
15197 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
15198 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
15199 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
15200 | ||
718e3744 | 15201 | /* "neighbor interface" commands. */ |
15202 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
15203 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
15204 | ||
15205 | /* "neighbor distribute" commands. */ | |
15206 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
15207 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
15208 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
15209 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
15210 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
15211 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
15212 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
15213 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 15214 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
15215 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 15216 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
15217 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
8ecd3266 | 15218 | install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd); |
15219 | install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd); | |
8b1fb8be LB |
15220 | install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd); |
15221 | install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd); | |
15222 | install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd); | |
15223 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 15224 | |
15225 | /* "neighbor prefix-list" commands. */ | |
15226 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
15227 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
15228 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
15229 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
15230 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
15231 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
15232 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
15233 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 15234 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
15235 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 15236 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
15237 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
8ecd3266 | 15238 | install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd); |
15239 | install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd); | |
8b1fb8be LB |
15240 | install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd); |
15241 | install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd); | |
15242 | install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd); | |
15243 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 15244 | |
15245 | /* "neighbor filter-list" commands. */ | |
15246 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
15247 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
15248 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
15249 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
15250 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
15251 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
15252 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
15253 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 15254 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
15255 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 15256 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
15257 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
8ecd3266 | 15258 | install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd); |
15259 | install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd); | |
8b1fb8be LB |
15260 | install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd); |
15261 | install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd); | |
15262 | install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd); | |
15263 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 15264 | |
15265 | /* "neighbor route-map" commands. */ | |
15266 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
15267 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
15268 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
15269 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
15270 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
15271 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
15272 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
15273 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 15274 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
15275 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 15276 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
15277 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
8ecd3266 | 15278 | install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd); |
15279 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd); | |
8b1fb8be LB |
15280 | install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd); |
15281 | install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd); | |
15282 | install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd); | |
15283 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 15284 | |
15285 | /* "neighbor unsuppress-map" commands. */ | |
15286 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
15287 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
15288 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
15289 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
15290 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
15291 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
15292 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
15293 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 15294 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
15295 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 15296 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
bb86c601 | 15297 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
8ecd3266 | 15298 | install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd); |
bb86c601 | 15299 | install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd); |
8b1fb8be LB |
15300 | install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd); |
15301 | install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd); | |
15302 | install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd); | |
15303 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 15304 | |
15305 | /* "neighbor maximum-prefix" commands. */ | |
15306 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 15307 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15308 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15309 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15310 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
15311 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15312 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
15313 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15314 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15315 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15316 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15317 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15318 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15319 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15320 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15321 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15322 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15323 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
15324 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15325 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
15326 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15327 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15328 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15329 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15330 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15331 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15332 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15333 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15334 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15335 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15336 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
15337 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15338 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
15339 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15340 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15341 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15342 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15343 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15344 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15345 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15346 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15347 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15348 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15349 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
15350 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15351 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
15352 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15353 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15354 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15355 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15356 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15357 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 15358 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
15359 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15360 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15361 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15362 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15363 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15364 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
15365 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15366 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15367 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15368 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15369 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15370 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15371 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15372 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15373 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15374 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15375 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
15376 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15377 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
15378 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15379 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15380 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15381 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15382 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15383 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
8ecd3266 | 15384 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd); |
15385 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15386 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15387 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15388 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15389 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15390 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd); | |
15391 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15392 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15393 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15394 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15395 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15396 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15397 | |
8b1fb8be LB |
15398 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd); |
15399 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15400 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15401 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15402 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15403 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15404 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd); | |
15405 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15406 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15407 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15408 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15409 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15410 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
15411 | ||
15412 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd); | |
15413 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15414 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15415 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15416 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15417 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15418 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd); | |
15419 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15420 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15421 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15422 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15423 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15424 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
15425 | ||
718e3744 | 15426 | /* "neighbor allowas-in" */ |
15427 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
15428 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
15429 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15430 | install_element (BGP_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15431 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
15432 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
15433 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15434 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15435 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
15436 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
15437 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15438 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15439 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
15440 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
15441 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15442 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_val_cmd); |
25ffbdc1 | 15443 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
15444 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
15445 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15446 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15447 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
15448 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
15449 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15450 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_val_cmd); |
8ecd3266 | 15451 | install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd); |
15452 | install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd); | |
15453 | install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd); | |
15454 | install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_val_cmd); | |
8b1fb8be LB |
15455 | install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd); |
15456 | install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd); | |
15457 | install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd); | |
15458 | install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd); | |
15459 | install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
15460 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd); | |
718e3744 | 15461 | |
15462 | /* address-family commands. */ | |
15463 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
15464 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
15465 | #ifdef HAVE_IPV6 | |
15466 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 15467 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 15468 | #endif /* HAVE_IPV6 */ |
15469 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
15470 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
15471 | ||
8b1fb8be LB |
15472 | install_element (BGP_NODE, &address_family_vpnv6_cmd); |
15473 | install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd); | |
15474 | ||
15475 | install_element (BGP_NODE, &address_family_encap_cmd); | |
15476 | install_element (BGP_NODE, &address_family_encapv4_cmd); | |
15477 | #ifdef HAVE_IPV6 | |
15478 | install_element (BGP_NODE, &address_family_encapv6_cmd); | |
15479 | #endif | |
15480 | ||
718e3744 | 15481 | /* "exit-address-family" command. */ |
15482 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
15483 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
15484 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 15485 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 15486 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
8ecd3266 | 15487 | install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); |
8b1fb8be LB |
15488 | install_element (BGP_ENCAP_NODE, &exit_address_family_cmd); |
15489 | install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd); | |
718e3744 | 15490 | |
15491 | /* "clear ip bgp commands" */ | |
15492 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
15493 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
15494 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
01080f7c | 15495 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_cmd); |
718e3744 | 15496 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
01080f7c | 15497 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_cmd); |
718e3744 | 15498 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
01080f7c | 15499 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_cmd); |
718e3744 | 15500 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
01080f7c | 15501 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_cmd); |
15502 | ||
718e3744 | 15503 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
15504 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
15505 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
01080f7c | 15506 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_cmd); |
718e3744 | 15507 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
01080f7c | 15508 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_cmd); |
718e3744 | 15509 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
01080f7c | 15510 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_cmd); |
718e3744 | 15511 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
01080f7c | 15512 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_cmd); |
718e3744 | 15513 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
01080f7c | 15514 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_cmd); |
718e3744 | 15515 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
01080f7c | 15516 | install_element (ENABLE_NODE, &clear_bgp_instance_external_cmd); |
718e3744 | 15517 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
01080f7c | 15518 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_cmd); |
718e3744 | 15519 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
01080f7c | 15520 | install_element (ENABLE_NODE, &clear_bgp_instance_as_cmd); |
718e3744 | 15521 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
01080f7c | 15522 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_cmd); |
718e3744 | 15523 | |
15524 | /* "clear ip bgp neighbor soft in" */ | |
15525 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
15526 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
15527 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
01080f7c | 15528 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_cmd); |
718e3744 | 15529 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
718e3744 | 15530 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
01080f7c | 15531 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_in_cmd); |
718e3744 | 15532 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
01080f7c | 15533 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_in_cmd); |
718e3744 | 15534 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
15535 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
01080f7c | 15536 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_in_cmd); |
718e3744 | 15537 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
01080f7c | 15538 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_in_cmd); |
718e3744 | 15539 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
15540 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
01080f7c | 15541 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_in_cmd); |
718e3744 | 15542 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
01080f7c | 15543 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_in_cmd); |
718e3744 | 15544 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
15545 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
01080f7c | 15546 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_in_cmd); |
718e3744 | 15547 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
01080f7c | 15548 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_in_cmd); |
718e3744 | 15549 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
15550 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
15551 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
15552 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
01080f7c | 15553 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_cmd); |
718e3744 | 15554 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
718e3744 | 15555 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
01080f7c | 15556 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_in_cmd); |
718e3744 | 15557 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
01080f7c | 15558 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_in_cmd); |
718e3744 | 15559 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
15560 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
01080f7c | 15561 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd); |
718e3744 | 15562 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
01080f7c | 15563 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_in_cmd); |
718e3744 | 15564 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
15565 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
01080f7c | 15566 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_in_cmd); |
718e3744 | 15567 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
01080f7c | 15568 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_in_cmd); |
718e3744 | 15569 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
15570 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
01080f7c | 15571 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_in_cmd); |
718e3744 | 15572 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
01080f7c | 15573 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_in_cmd); |
718e3744 | 15574 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
15575 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
15576 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
15577 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
15578 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
15579 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
15580 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
587ff0fd LB |
15581 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd); |
15582 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd); | |
15583 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd); | |
15584 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd); | |
15585 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd); | |
15586 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd); | |
718e3744 | 15587 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
15588 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
15589 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
01080f7c | 15590 | install_element (ENABLE_NODE, &clear_bgp_instance_all_in_cmd); |
718e3744 | 15591 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
15592 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
01080f7c | 15593 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_in_cmd); |
718e3744 | 15594 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
01080f7c | 15595 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_in_cmd); |
718e3744 | 15596 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
15597 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
01080f7c | 15598 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_in_cmd); |
718e3744 | 15599 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
01080f7c | 15600 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_in_cmd); |
718e3744 | 15601 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
15602 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
01080f7c | 15603 | install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_in_cmd); |
718e3744 | 15604 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
01080f7c | 15605 | install_element (ENABLE_NODE, &clear_bgp_instance_external_in_cmd); |
718e3744 | 15606 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
15607 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
01080f7c | 15608 | install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_in_cmd); |
718e3744 | 15609 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
01080f7c | 15610 | install_element (ENABLE_NODE, &clear_bgp_instance_as_in_cmd); |
718e3744 | 15611 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
15612 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
01080f7c | 15613 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_in_cmd); |
718e3744 | 15614 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
01080f7c | 15615 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_in_cmd); |
718e3744 | 15616 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
15617 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
01080f7c | 15618 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_in_cmd); |
718e3744 | 15619 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
01080f7c | 15620 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_in_cmd); |
718e3744 | 15621 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
15622 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
01080f7c | 15623 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_in_cmd); |
718e3744 | 15624 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
01080f7c | 15625 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_in_cmd); |
718e3744 | 15626 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
15627 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
01080f7c | 15628 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_in_cmd); |
718e3744 | 15629 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
01080f7c | 15630 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_in_cmd); |
718e3744 | 15631 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
15632 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
01080f7c | 15633 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_in_cmd); |
718e3744 | 15634 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
01080f7c | 15635 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_in_cmd); |
718e3744 | 15636 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
718e3744 | 15637 | |
8ad7271d DS |
15638 | /* clear ip bgp prefix */ |
15639 | install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); | |
01080f7c | 15640 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_prefix_cmd); |
8ad7271d | 15641 | install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); |
01080f7c | 15642 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_safi_prefix_cmd); |
8ad7271d | 15643 | |
718e3744 | 15644 | /* "clear ip bgp neighbor soft out" */ |
15645 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
15646 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
15647 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
01080f7c | 15648 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_out_cmd); |
718e3744 | 15649 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
01080f7c | 15650 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_out_cmd); |
718e3744 | 15651 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
01080f7c | 15652 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_out_cmd); |
718e3744 | 15653 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
01080f7c | 15654 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_out_cmd); |
718e3744 | 15655 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
01080f7c | 15656 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_out_cmd); |
718e3744 | 15657 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
01080f7c | 15658 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_out_cmd); |
718e3744 | 15659 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
01080f7c | 15660 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_out_cmd); |
718e3744 | 15661 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
01080f7c | 15662 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_out_cmd); |
718e3744 | 15663 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
01080f7c | 15664 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_out_cmd); |
718e3744 | 15665 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
15666 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
15667 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
01080f7c | 15668 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_out_cmd); |
718e3744 | 15669 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
01080f7c | 15670 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_out_cmd); |
718e3744 | 15671 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
01080f7c | 15672 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_out_cmd); |
718e3744 | 15673 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
01080f7c | 15674 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd); |
718e3744 | 15675 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
01080f7c | 15676 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_out_cmd); |
718e3744 | 15677 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
01080f7c | 15678 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_out_cmd); |
718e3744 | 15679 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
01080f7c | 15680 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_out_cmd); |
718e3744 | 15681 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
01080f7c | 15682 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_out_cmd); |
718e3744 | 15683 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
01080f7c | 15684 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_out_cmd); |
718e3744 | 15685 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
15686 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
15687 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
15688 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
15689 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
15690 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
587ff0fd LB |
15691 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd); |
15692 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd); | |
15693 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd); | |
15694 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd); | |
15695 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd); | |
15696 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd); | |
718e3744 | 15697 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
15698 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
15699 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
01080f7c | 15700 | install_element (ENABLE_NODE, &clear_bgp_instance_all_out_cmd); |
718e3744 | 15701 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
01080f7c | 15702 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_out_cmd); |
718e3744 | 15703 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
01080f7c | 15704 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_out_cmd); |
718e3744 | 15705 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
01080f7c | 15706 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_out_cmd); |
718e3744 | 15707 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
01080f7c | 15708 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_out_cmd); |
718e3744 | 15709 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
01080f7c | 15710 | install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_out_cmd); |
718e3744 | 15711 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
01080f7c | 15712 | install_element (ENABLE_NODE, &clear_bgp_instance_external_out_cmd); |
718e3744 | 15713 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
01080f7c | 15714 | install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_out_cmd); |
718e3744 | 15715 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
01080f7c | 15716 | install_element (ENABLE_NODE, &clear_bgp_instance_as_out_cmd); |
718e3744 | 15717 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
01080f7c | 15718 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_out_cmd); |
718e3744 | 15719 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
01080f7c | 15720 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_out_cmd); |
718e3744 | 15721 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
01080f7c | 15722 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_out_cmd); |
718e3744 | 15723 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
01080f7c | 15724 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_out_cmd); |
718e3744 | 15725 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
01080f7c | 15726 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_out_cmd); |
718e3744 | 15727 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
01080f7c | 15728 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_out_cmd); |
718e3744 | 15729 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
01080f7c | 15730 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_out_cmd); |
718e3744 | 15731 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
01080f7c | 15732 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_out_cmd); |
718e3744 | 15733 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
01080f7c | 15734 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_out_cmd); |
718e3744 | 15735 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
01080f7c | 15736 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_out_cmd); |
718e3744 | 15737 | |
15738 | /* "clear ip bgp neighbor soft" */ | |
15739 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
15740 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
15741 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
01080f7c | 15742 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_cmd); |
718e3744 | 15743 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
01080f7c | 15744 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_cmd); |
718e3744 | 15745 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
01080f7c | 15746 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_cmd); |
718e3744 | 15747 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
01080f7c | 15748 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_cmd); |
718e3744 | 15749 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
15750 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
15751 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
01080f7c | 15752 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_cmd); |
718e3744 | 15753 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
01080f7c | 15754 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_cmd); |
718e3744 | 15755 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
01080f7c | 15756 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_cmd); |
718e3744 | 15757 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
01080f7c | 15758 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_cmd); |
718e3744 | 15759 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
15760 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
15761 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
587ff0fd LB |
15762 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd); |
15763 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd); | |
15764 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd); | |
718e3744 | 15765 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
15766 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
15767 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
01080f7c | 15768 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_cmd); |
718e3744 | 15769 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
01080f7c | 15770 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_cmd); |
718e3744 | 15771 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
01080f7c | 15772 | install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_cmd); |
718e3744 | 15773 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
01080f7c | 15774 | install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_cmd); |
718e3744 | 15775 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
01080f7c | 15776 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_cmd); |
718e3744 | 15777 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
01080f7c | 15778 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_cmd); |
718e3744 | 15779 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
01080f7c | 15780 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_cmd); |
718e3744 | 15781 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
01080f7c | 15782 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_cmd); |
718e3744 | 15783 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
01080f7c | 15784 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_cmd); |
718e3744 | 15785 | |
15786 | /* "show ip bgp summary" commands. */ | |
15787 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15788 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15789 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15790 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15791 | install_element (VIEW_NODE, &show_bgp_updgrps_cmd); |
15792 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15793 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15794 | install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15795 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15796 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15797 | install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd); |
15798 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15799 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15800 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15801 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15802 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15803 | install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15804 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15805 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15806 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15807 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15808 | install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15809 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
718e3744 | 15810 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15811 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd); |
718e3744 | 15812 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
95cbbd2a | 15813 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 15814 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 15815 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 15816 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
15817 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15818 | #ifdef HAVE_IPV6 | |
15819 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
15820 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15821 | install_element (VIEW_NODE, &show_bgp_instance_all_summary_cmd); |
718e3744 | 15822 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
95cbbd2a | 15823 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 15824 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 15825 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
15826 | #endif /* HAVE_IPV6 */ |
15827 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15828 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15829 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15830 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15831 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd); |
15832 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15833 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15834 | install_element (RESTRICTED_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15835 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15836 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15837 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd); |
15838 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15839 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15840 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15841 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15842 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15843 | install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15844 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15845 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15846 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15847 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15848 | install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15849 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
62687ff1 | 15850 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15851 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd); |
62687ff1 | 15852 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); |
95cbbd2a | 15853 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
62687ff1 | 15854 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 15855 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
62687ff1 PJ |
15856 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
15857 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15858 | #ifdef HAVE_IPV6 | |
15859 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
15860 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15861 | install_element (RESTRICTED_NODE, &show_bgp_instance_all_summary_cmd); |
62687ff1 | 15862 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); |
95cbbd2a | 15863 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
62687ff1 | 15864 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 15865 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 15866 | #endif /* HAVE_IPV6 */ |
15867 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15868 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15869 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15870 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15871 | install_element (ENABLE_NODE, &show_bgp_updgrps_cmd); |
15872 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15873 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15874 | install_element (ENABLE_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15875 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15876 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15877 | install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd); |
15878 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15879 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15880 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15881 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15882 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15883 | install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15884 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15885 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15886 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15887 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15888 | install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15889 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
718e3744 | 15890 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15891 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_summary_cmd); |
718e3744 | 15892 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
95cbbd2a | 15893 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 15894 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 15895 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 15896 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
15897 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15898 | #ifdef HAVE_IPV6 | |
15899 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
15900 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15901 | install_element (ENABLE_NODE, &show_bgp_instance_all_summary_cmd); |
718e3744 | 15902 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
95cbbd2a | 15903 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 15904 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 15905 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 15906 | #endif /* HAVE_IPV6 */ |
15907 | ||
15908 | /* "show ip bgp neighbors" commands. */ | |
15909 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
15910 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
15911 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
15912 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
15913 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
15914 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
15915 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
15916 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
15917 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
f186de26 | 15918 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd); |
718e3744 | 15919 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
62687ff1 PJ |
15920 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
15921 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
15922 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
15923 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
15924 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 15925 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
15926 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
15927 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
15928 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
15929 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
15930 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
15931 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
15932 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
15933 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
f186de26 | 15934 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd); |
718e3744 | 15935 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
15936 | ||
15937 | #ifdef HAVE_IPV6 | |
15938 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
15939 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
15940 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
15941 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 15942 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
15943 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
15944 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
15945 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
15946 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
15947 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
15948 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
15949 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 15950 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
15951 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
15952 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
15953 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 15954 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
15955 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
15956 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
15957 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 15958 | |
15959 | /* Old commands. */ | |
15960 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
15961 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
15962 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
15963 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
15964 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 15965 | |
f14e6fdb DS |
15966 | /* "show ip bgp peer-group" commands. */ |
15967 | install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); | |
15968 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
15969 | install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd); | |
15970 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
15971 | install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd); | |
15972 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
15973 | install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd); | |
15974 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
15975 | ||
718e3744 | 15976 | /* "show ip bgp paths" commands. */ |
15977 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
15978 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
15979 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
15980 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
15981 | ||
15982 | /* "show ip bgp community" commands. */ | |
15983 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
15984 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
15985 | ||
15986 | /* "show ip bgp attribute-info" commands. */ | |
15987 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
15988 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
15989 | ||
15990 | /* "redistribute" commands. */ | |
15991 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
15992 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
15993 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
15994 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
15995 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
15996 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
15997 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
15998 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
15999 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
16000 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
7c8ff89e DS |
16001 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd); |
16002 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
16003 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
16004 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
16005 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
16006 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
16007 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
16008 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
16009 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
16010 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
919e0666 DW |
16011 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_cmd); |
16012 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_cmd); | |
16013 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
16014 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
16015 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
16016 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
16017 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
16018 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
16019 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
16020 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
16021 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_cmd); | |
16022 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
16023 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
16024 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
16025 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
16026 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
16027 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
16028 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
16029 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
16030 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
718e3744 | 16031 | #ifdef HAVE_IPV6 |
16032 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
16033 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
16034 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
16035 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
16036 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
16037 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
16038 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
16039 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
16040 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
16041 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
16042 | #endif /* HAVE_IPV6 */ | |
16043 | ||
fa411a21 NH |
16044 | /* ttl_security commands */ |
16045 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
16046 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
16047 | ||
4bf6a362 PJ |
16048 | /* "show bgp memory" commands. */ |
16049 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 16050 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
16051 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
16052 | ||
e0081f70 ML |
16053 | /* "show bgp views" commands. */ |
16054 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
16055 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
16056 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
16057 | ||
8386ac43 | 16058 | /* "show bgp vrfs" commands. */ |
16059 | install_element (VIEW_NODE, &show_bgp_vrfs_cmd); | |
16060 | install_element (RESTRICTED_NODE, &show_bgp_vrfs_cmd); | |
16061 | install_element (ENABLE_NODE, &show_bgp_vrfs_cmd); | |
16062 | ||
718e3744 | 16063 | /* Community-list. */ |
16064 | community_list_vty (); | |
16065 | } | |
6b0655a2 | 16066 | |
718e3744 | 16067 | #include "memory.h" |
16068 | #include "bgp_regex.h" | |
16069 | #include "bgp_clist.h" | |
16070 | #include "bgp_ecommunity.h" | |
16071 | ||
16072 | /* VTY functions. */ | |
16073 | ||
16074 | /* Direction value to string conversion. */ | |
94f2b392 | 16075 | static const char * |
718e3744 | 16076 | community_direct_str (int direct) |
16077 | { | |
16078 | switch (direct) | |
16079 | { | |
16080 | case COMMUNITY_DENY: | |
16081 | return "deny"; | |
718e3744 | 16082 | case COMMUNITY_PERMIT: |
16083 | return "permit"; | |
718e3744 | 16084 | default: |
16085 | return "unknown"; | |
718e3744 | 16086 | } |
16087 | } | |
16088 | ||
16089 | /* Display error string. */ | |
94f2b392 | 16090 | static void |
718e3744 | 16091 | community_list_perror (struct vty *vty, int ret) |
16092 | { | |
16093 | switch (ret) | |
16094 | { | |
16095 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 16096 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 16097 | break; |
16098 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
16099 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
16100 | break; | |
16101 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
16102 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
16103 | break; | |
16104 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
16105 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
16106 | break; | |
16107 | } | |
16108 | } | |
16109 | ||
16110 | /* VTY interface for community_set() function. */ | |
94f2b392 | 16111 | static int |
fd79ac91 | 16112 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
16113 | int style, int reject_all_digit_name) | |
718e3744 | 16114 | { |
16115 | int ret; | |
16116 | int direct; | |
16117 | char *str; | |
16118 | ||
16119 | /* Check the list type. */ | |
16120 | if (strncmp (argv[1], "p", 1) == 0) | |
16121 | direct = COMMUNITY_PERMIT; | |
16122 | else if (strncmp (argv[1], "d", 1) == 0) | |
16123 | direct = COMMUNITY_DENY; | |
16124 | else | |
16125 | { | |
16126 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16127 | VTY_NEWLINE); | |
16128 | return CMD_WARNING; | |
16129 | } | |
16130 | ||
16131 | /* All digit name check. */ | |
16132 | if (reject_all_digit_name && all_digit (argv[0])) | |
16133 | { | |
16134 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
16135 | return CMD_WARNING; | |
16136 | } | |
16137 | ||
16138 | /* Concat community string argument. */ | |
16139 | if (argc > 1) | |
16140 | str = argv_concat (argv, argc, 2); | |
16141 | else | |
16142 | str = NULL; | |
16143 | ||
16144 | /* When community_list_set() return nevetive value, it means | |
16145 | malformed community string. */ | |
16146 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
16147 | ||
16148 | /* Free temporary community list string allocated by | |
16149 | argv_concat(). */ | |
16150 | if (str) | |
16151 | XFREE (MTYPE_TMP, str); | |
16152 | ||
16153 | if (ret < 0) | |
16154 | { | |
16155 | /* Display error string. */ | |
16156 | community_list_perror (vty, ret); | |
16157 | return CMD_WARNING; | |
16158 | } | |
16159 | ||
16160 | return CMD_SUCCESS; | |
16161 | } | |
16162 | ||
718e3744 | 16163 | /* Communiyt-list entry delete. */ |
94f2b392 | 16164 | static int |
fee6e4e4 | 16165 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
813d4307 | 16166 | int style, int delete_all) |
718e3744 | 16167 | { |
16168 | int ret; | |
fee6e4e4 | 16169 | int direct = 0; |
16170 | char *str = NULL; | |
718e3744 | 16171 | |
fee6e4e4 | 16172 | if (argc > 1) |
718e3744 | 16173 | { |
fee6e4e4 | 16174 | /* Check the list direct. */ |
16175 | if (strncmp (argv[1], "p", 1) == 0) | |
16176 | direct = COMMUNITY_PERMIT; | |
16177 | else if (strncmp (argv[1], "d", 1) == 0) | |
16178 | direct = COMMUNITY_DENY; | |
16179 | else | |
16180 | { | |
16181 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16182 | VTY_NEWLINE); | |
16183 | return CMD_WARNING; | |
16184 | } | |
718e3744 | 16185 | |
fee6e4e4 | 16186 | /* Concat community string argument. */ |
16187 | str = argv_concat (argv, argc, 2); | |
16188 | } | |
718e3744 | 16189 | |
16190 | /* Unset community list. */ | |
813d4307 | 16191 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); |
718e3744 | 16192 | |
16193 | /* Free temporary community list string allocated by | |
16194 | argv_concat(). */ | |
fee6e4e4 | 16195 | if (str) |
16196 | XFREE (MTYPE_TMP, str); | |
718e3744 | 16197 | |
16198 | if (ret < 0) | |
16199 | { | |
16200 | community_list_perror (vty, ret); | |
16201 | return CMD_WARNING; | |
16202 | } | |
16203 | ||
16204 | return CMD_SUCCESS; | |
16205 | } | |
16206 | ||
16207 | /* "community-list" keyword help string. */ | |
16208 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
718e3744 | 16209 | |
718e3744 | 16210 | DEFUN (ip_community_list_standard, |
16211 | ip_community_list_standard_cmd, | |
16212 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
16213 | IP_STR | |
16214 | COMMUNITY_LIST_STR | |
16215 | "Community list number (standard)\n" | |
16216 | "Specify community to reject\n" | |
16217 | "Specify community to accept\n" | |
16218 | COMMUNITY_VAL_STR) | |
16219 | { | |
16220 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
16221 | } | |
16222 | ||
16223 | ALIAS (ip_community_list_standard, | |
16224 | ip_community_list_standard2_cmd, | |
16225 | "ip community-list <1-99> (deny|permit)", | |
16226 | IP_STR | |
16227 | COMMUNITY_LIST_STR | |
16228 | "Community list number (standard)\n" | |
16229 | "Specify community to reject\n" | |
16230 | "Specify community to accept\n") | |
16231 | ||
16232 | DEFUN (ip_community_list_expanded, | |
16233 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 16234 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 16235 | IP_STR |
16236 | COMMUNITY_LIST_STR | |
16237 | "Community list number (expanded)\n" | |
16238 | "Specify community to reject\n" | |
16239 | "Specify community to accept\n" | |
16240 | "An ordered list as a regular-expression\n") | |
16241 | { | |
16242 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
16243 | } | |
16244 | ||
16245 | DEFUN (ip_community_list_name_standard, | |
16246 | ip_community_list_name_standard_cmd, | |
16247 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
16248 | IP_STR | |
16249 | COMMUNITY_LIST_STR | |
16250 | "Add a standard community-list entry\n" | |
16251 | "Community list name\n" | |
16252 | "Specify community to reject\n" | |
16253 | "Specify community to accept\n" | |
16254 | COMMUNITY_VAL_STR) | |
16255 | { | |
16256 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
16257 | } | |
16258 | ||
16259 | ALIAS (ip_community_list_name_standard, | |
16260 | ip_community_list_name_standard2_cmd, | |
16261 | "ip community-list standard WORD (deny|permit)", | |
16262 | IP_STR | |
16263 | COMMUNITY_LIST_STR | |
16264 | "Add a standard community-list entry\n" | |
16265 | "Community list name\n" | |
16266 | "Specify community to reject\n" | |
16267 | "Specify community to accept\n") | |
16268 | ||
16269 | DEFUN (ip_community_list_name_expanded, | |
16270 | ip_community_list_name_expanded_cmd, | |
16271 | "ip community-list expanded WORD (deny|permit) .LINE", | |
16272 | IP_STR | |
16273 | COMMUNITY_LIST_STR | |
16274 | "Add an expanded community-list entry\n" | |
16275 | "Community list name\n" | |
16276 | "Specify community to reject\n" | |
16277 | "Specify community to accept\n" | |
16278 | "An ordered list as a regular-expression\n") | |
16279 | { | |
16280 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
16281 | } | |
16282 | ||
fee6e4e4 | 16283 | DEFUN (no_ip_community_list_standard_all, |
16284 | no_ip_community_list_standard_all_cmd, | |
16285 | "no ip community-list <1-99>", | |
16286 | NO_STR | |
16287 | IP_STR | |
16288 | COMMUNITY_LIST_STR | |
16289 | "Community list number (standard)\n") | |
16290 | { | |
813d4307 DW |
16291 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
16292 | } | |
16293 | ||
16294 | DEFUN (no_ip_community_list_standard_direction, | |
16295 | no_ip_community_list_standard_direction_cmd, | |
16296 | "no ip community-list <1-99> (deny|permit)", | |
16297 | NO_STR | |
16298 | IP_STR | |
16299 | COMMUNITY_LIST_STR | |
16300 | "Community list number (standard)\n" | |
16301 | "Specify community to reject\n" | |
16302 | "Specify community to accept\n") | |
16303 | { | |
16304 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
fee6e4e4 | 16305 | } |
16306 | ||
813d4307 | 16307 | |
fee6e4e4 | 16308 | DEFUN (no_ip_community_list_expanded_all, |
16309 | no_ip_community_list_expanded_all_cmd, | |
16310 | "no ip community-list <100-500>", | |
718e3744 | 16311 | NO_STR |
16312 | IP_STR | |
16313 | COMMUNITY_LIST_STR | |
718e3744 | 16314 | "Community list number (expanded)\n") |
16315 | { | |
813d4307 | 16316 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16317 | } |
16318 | ||
fee6e4e4 | 16319 | DEFUN (no_ip_community_list_name_standard_all, |
16320 | no_ip_community_list_name_standard_all_cmd, | |
16321 | "no ip community-list standard WORD", | |
718e3744 | 16322 | NO_STR |
16323 | IP_STR | |
16324 | COMMUNITY_LIST_STR | |
16325 | "Add a standard community-list entry\n" | |
718e3744 | 16326 | "Community list name\n") |
16327 | { | |
813d4307 | 16328 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
718e3744 | 16329 | } |
16330 | ||
fee6e4e4 | 16331 | DEFUN (no_ip_community_list_name_expanded_all, |
16332 | no_ip_community_list_name_expanded_all_cmd, | |
16333 | "no ip community-list expanded WORD", | |
718e3744 | 16334 | NO_STR |
16335 | IP_STR | |
16336 | COMMUNITY_LIST_STR | |
fee6e4e4 | 16337 | "Add an expanded community-list entry\n" |
16338 | "Community list name\n") | |
718e3744 | 16339 | { |
813d4307 | 16340 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16341 | } |
16342 | ||
16343 | DEFUN (no_ip_community_list_standard, | |
16344 | no_ip_community_list_standard_cmd, | |
16345 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
16346 | NO_STR | |
16347 | IP_STR | |
16348 | COMMUNITY_LIST_STR | |
16349 | "Community list number (standard)\n" | |
16350 | "Specify community to reject\n" | |
16351 | "Specify community to accept\n" | |
16352 | COMMUNITY_VAL_STR) | |
16353 | { | |
813d4307 | 16354 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
718e3744 | 16355 | } |
16356 | ||
16357 | DEFUN (no_ip_community_list_expanded, | |
16358 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 16359 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 16360 | NO_STR |
16361 | IP_STR | |
16362 | COMMUNITY_LIST_STR | |
16363 | "Community list number (expanded)\n" | |
16364 | "Specify community to reject\n" | |
16365 | "Specify community to accept\n" | |
16366 | "An ordered list as a regular-expression\n") | |
16367 | { | |
813d4307 | 16368 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16369 | } |
16370 | ||
16371 | DEFUN (no_ip_community_list_name_standard, | |
16372 | no_ip_community_list_name_standard_cmd, | |
16373 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
16374 | NO_STR | |
16375 | IP_STR | |
16376 | COMMUNITY_LIST_STR | |
16377 | "Specify a standard community-list\n" | |
16378 | "Community list name\n" | |
16379 | "Specify community to reject\n" | |
16380 | "Specify community to accept\n" | |
16381 | COMMUNITY_VAL_STR) | |
16382 | { | |
813d4307 DW |
16383 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
16384 | } | |
16385 | ||
16386 | DEFUN (no_ip_community_list_name_standard_brief, | |
16387 | no_ip_community_list_name_standard_brief_cmd, | |
16388 | "no ip community-list standard WORD (deny|permit)", | |
16389 | NO_STR | |
16390 | IP_STR | |
16391 | COMMUNITY_LIST_STR | |
16392 | "Specify a standard community-list\n" | |
16393 | "Community list name\n" | |
16394 | "Specify community to reject\n" | |
16395 | "Specify community to accept\n") | |
16396 | { | |
16397 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
718e3744 | 16398 | } |
16399 | ||
16400 | DEFUN (no_ip_community_list_name_expanded, | |
16401 | no_ip_community_list_name_expanded_cmd, | |
16402 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
16403 | NO_STR | |
16404 | IP_STR | |
16405 | COMMUNITY_LIST_STR | |
16406 | "Specify an expanded community-list\n" | |
16407 | "Community list name\n" | |
16408 | "Specify community to reject\n" | |
16409 | "Specify community to accept\n" | |
16410 | "An ordered list as a regular-expression\n") | |
16411 | { | |
813d4307 | 16412 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16413 | } |
16414 | ||
94f2b392 | 16415 | static void |
718e3744 | 16416 | community_list_show (struct vty *vty, struct community_list *list) |
16417 | { | |
16418 | struct community_entry *entry; | |
16419 | ||
16420 | for (entry = list->head; entry; entry = entry->next) | |
16421 | { | |
16422 | if (entry == list->head) | |
16423 | { | |
16424 | if (all_digit (list->name)) | |
16425 | vty_out (vty, "Community %s list %s%s", | |
16426 | entry->style == COMMUNITY_LIST_STANDARD ? | |
16427 | "standard" : "(expanded) access", | |
16428 | list->name, VTY_NEWLINE); | |
16429 | else | |
16430 | vty_out (vty, "Named Community %s list %s%s", | |
16431 | entry->style == COMMUNITY_LIST_STANDARD ? | |
16432 | "standard" : "expanded", | |
16433 | list->name, VTY_NEWLINE); | |
16434 | } | |
16435 | if (entry->any) | |
16436 | vty_out (vty, " %s%s", | |
16437 | community_direct_str (entry->direct), VTY_NEWLINE); | |
16438 | else | |
16439 | vty_out (vty, " %s %s%s", | |
16440 | community_direct_str (entry->direct), | |
16441 | entry->style == COMMUNITY_LIST_STANDARD | |
16442 | ? community_str (entry->u.com) : entry->config, | |
16443 | VTY_NEWLINE); | |
16444 | } | |
16445 | } | |
16446 | ||
16447 | DEFUN (show_ip_community_list, | |
16448 | show_ip_community_list_cmd, | |
16449 | "show ip community-list", | |
16450 | SHOW_STR | |
16451 | IP_STR | |
16452 | "List community-list\n") | |
16453 | { | |
16454 | struct community_list *list; | |
16455 | struct community_list_master *cm; | |
16456 | ||
fee6e4e4 | 16457 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 16458 | if (! cm) |
16459 | return CMD_SUCCESS; | |
16460 | ||
16461 | for (list = cm->num.head; list; list = list->next) | |
16462 | community_list_show (vty, list); | |
16463 | ||
16464 | for (list = cm->str.head; list; list = list->next) | |
16465 | community_list_show (vty, list); | |
16466 | ||
16467 | return CMD_SUCCESS; | |
16468 | } | |
16469 | ||
16470 | DEFUN (show_ip_community_list_arg, | |
16471 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 16472 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 16473 | SHOW_STR |
16474 | IP_STR | |
16475 | "List community-list\n" | |
16476 | "Community-list number\n" | |
16477 | "Community-list name\n") | |
16478 | { | |
16479 | struct community_list *list; | |
16480 | ||
fee6e4e4 | 16481 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 16482 | if (! list) |
16483 | { | |
b729294c | 16484 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 16485 | return CMD_WARNING; |
16486 | } | |
16487 | ||
16488 | community_list_show (vty, list); | |
16489 | ||
16490 | return CMD_SUCCESS; | |
16491 | } | |
6b0655a2 | 16492 | |
94f2b392 | 16493 | static int |
fd79ac91 | 16494 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
16495 | int style, int reject_all_digit_name) | |
718e3744 | 16496 | { |
16497 | int ret; | |
16498 | int direct; | |
16499 | char *str; | |
16500 | ||
16501 | /* Check the list type. */ | |
16502 | if (strncmp (argv[1], "p", 1) == 0) | |
16503 | direct = COMMUNITY_PERMIT; | |
16504 | else if (strncmp (argv[1], "d", 1) == 0) | |
16505 | direct = COMMUNITY_DENY; | |
16506 | else | |
16507 | { | |
16508 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16509 | VTY_NEWLINE); | |
16510 | return CMD_WARNING; | |
16511 | } | |
16512 | ||
16513 | /* All digit name check. */ | |
16514 | if (reject_all_digit_name && all_digit (argv[0])) | |
16515 | { | |
16516 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
16517 | return CMD_WARNING; | |
16518 | } | |
16519 | ||
16520 | /* Concat community string argument. */ | |
16521 | if (argc > 1) | |
16522 | str = argv_concat (argv, argc, 2); | |
16523 | else | |
16524 | str = NULL; | |
16525 | ||
16526 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
16527 | ||
16528 | /* Free temporary community list string allocated by | |
16529 | argv_concat(). */ | |
16530 | if (str) | |
16531 | XFREE (MTYPE_TMP, str); | |
16532 | ||
16533 | if (ret < 0) | |
16534 | { | |
16535 | community_list_perror (vty, ret); | |
16536 | return CMD_WARNING; | |
16537 | } | |
16538 | return CMD_SUCCESS; | |
16539 | } | |
16540 | ||
94f2b392 | 16541 | static int |
fee6e4e4 | 16542 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
813d4307 | 16543 | int style, int delete_all) |
718e3744 | 16544 | { |
16545 | int ret; | |
fee6e4e4 | 16546 | int direct = 0; |
16547 | char *str = NULL; | |
718e3744 | 16548 | |
fee6e4e4 | 16549 | if (argc > 1) |
718e3744 | 16550 | { |
fee6e4e4 | 16551 | /* Check the list direct. */ |
16552 | if (strncmp (argv[1], "p", 1) == 0) | |
16553 | direct = COMMUNITY_PERMIT; | |
16554 | else if (strncmp (argv[1], "d", 1) == 0) | |
16555 | direct = COMMUNITY_DENY; | |
16556 | else | |
16557 | { | |
16558 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16559 | VTY_NEWLINE); | |
16560 | return CMD_WARNING; | |
16561 | } | |
718e3744 | 16562 | |
fee6e4e4 | 16563 | /* Concat community string argument. */ |
16564 | str = argv_concat (argv, argc, 2); | |
718e3744 | 16565 | } |
16566 | ||
718e3744 | 16567 | /* Unset community list. */ |
813d4307 | 16568 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); |
718e3744 | 16569 | |
16570 | /* Free temporary community list string allocated by | |
16571 | argv_concat(). */ | |
fee6e4e4 | 16572 | if (str) |
16573 | XFREE (MTYPE_TMP, str); | |
718e3744 | 16574 | |
16575 | if (ret < 0) | |
16576 | { | |
16577 | community_list_perror (vty, ret); | |
16578 | return CMD_WARNING; | |
16579 | } | |
16580 | ||
16581 | return CMD_SUCCESS; | |
16582 | } | |
16583 | ||
16584 | /* "extcommunity-list" keyword help string. */ | |
16585 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
16586 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
16587 | ||
16588 | DEFUN (ip_extcommunity_list_standard, | |
16589 | ip_extcommunity_list_standard_cmd, | |
16590 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
16591 | IP_STR | |
16592 | EXTCOMMUNITY_LIST_STR | |
16593 | "Extended Community list number (standard)\n" | |
16594 | "Specify community to reject\n" | |
16595 | "Specify community to accept\n" | |
16596 | EXTCOMMUNITY_VAL_STR) | |
16597 | { | |
16598 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
16599 | } | |
16600 | ||
16601 | ALIAS (ip_extcommunity_list_standard, | |
16602 | ip_extcommunity_list_standard2_cmd, | |
16603 | "ip extcommunity-list <1-99> (deny|permit)", | |
16604 | IP_STR | |
16605 | EXTCOMMUNITY_LIST_STR | |
16606 | "Extended Community list number (standard)\n" | |
16607 | "Specify community to reject\n" | |
16608 | "Specify community to accept\n") | |
16609 | ||
16610 | DEFUN (ip_extcommunity_list_expanded, | |
16611 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 16612 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 16613 | IP_STR |
16614 | EXTCOMMUNITY_LIST_STR | |
16615 | "Extended Community list number (expanded)\n" | |
16616 | "Specify community to reject\n" | |
16617 | "Specify community to accept\n" | |
16618 | "An ordered list as a regular-expression\n") | |
16619 | { | |
16620 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
16621 | } | |
16622 | ||
16623 | DEFUN (ip_extcommunity_list_name_standard, | |
16624 | ip_extcommunity_list_name_standard_cmd, | |
16625 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
16626 | IP_STR | |
16627 | EXTCOMMUNITY_LIST_STR | |
16628 | "Specify standard extcommunity-list\n" | |
16629 | "Extended Community list name\n" | |
16630 | "Specify community to reject\n" | |
16631 | "Specify community to accept\n" | |
16632 | EXTCOMMUNITY_VAL_STR) | |
16633 | { | |
16634 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
16635 | } | |
16636 | ||
16637 | ALIAS (ip_extcommunity_list_name_standard, | |
16638 | ip_extcommunity_list_name_standard2_cmd, | |
16639 | "ip extcommunity-list standard WORD (deny|permit)", | |
16640 | IP_STR | |
16641 | EXTCOMMUNITY_LIST_STR | |
16642 | "Specify standard extcommunity-list\n" | |
16643 | "Extended Community list name\n" | |
16644 | "Specify community to reject\n" | |
16645 | "Specify community to accept\n") | |
16646 | ||
16647 | DEFUN (ip_extcommunity_list_name_expanded, | |
16648 | ip_extcommunity_list_name_expanded_cmd, | |
16649 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
16650 | IP_STR | |
16651 | EXTCOMMUNITY_LIST_STR | |
16652 | "Specify expanded extcommunity-list\n" | |
16653 | "Extended Community list name\n" | |
16654 | "Specify community to reject\n" | |
16655 | "Specify community to accept\n" | |
16656 | "An ordered list as a regular-expression\n") | |
16657 | { | |
16658 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
16659 | } | |
16660 | ||
fee6e4e4 | 16661 | DEFUN (no_ip_extcommunity_list_standard_all, |
16662 | no_ip_extcommunity_list_standard_all_cmd, | |
16663 | "no ip extcommunity-list <1-99>", | |
16664 | NO_STR | |
16665 | IP_STR | |
16666 | EXTCOMMUNITY_LIST_STR | |
16667 | "Extended Community list number (standard)\n") | |
16668 | { | |
813d4307 DW |
16669 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
16670 | } | |
16671 | ||
16672 | DEFUN (no_ip_extcommunity_list_standard_direction, | |
16673 | no_ip_extcommunity_list_standard_direction_cmd, | |
16674 | "no ip extcommunity-list <1-99> (deny|permit)", | |
16675 | NO_STR | |
16676 | IP_STR | |
16677 | EXTCOMMUNITY_LIST_STR | |
16678 | "Extended Community list number (standard)\n" | |
16679 | "Specify community to reject\n" | |
16680 | "Specify community to accept\n") | |
16681 | { | |
16682 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
fee6e4e4 | 16683 | } |
16684 | ||
16685 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
16686 | no_ip_extcommunity_list_expanded_all_cmd, | |
16687 | "no ip extcommunity-list <100-500>", | |
718e3744 | 16688 | NO_STR |
16689 | IP_STR | |
16690 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 16691 | "Extended Community list number (expanded)\n") |
16692 | { | |
813d4307 | 16693 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16694 | } |
16695 | ||
fee6e4e4 | 16696 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
16697 | no_ip_extcommunity_list_name_standard_all_cmd, | |
16698 | "no ip extcommunity-list standard WORD", | |
718e3744 | 16699 | NO_STR |
16700 | IP_STR | |
16701 | EXTCOMMUNITY_LIST_STR | |
16702 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 16703 | "Extended Community list name\n") |
16704 | { | |
813d4307 | 16705 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
fee6e4e4 | 16706 | } |
16707 | ||
16708 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
16709 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
16710 | "no ip extcommunity-list expanded WORD", | |
16711 | NO_STR | |
16712 | IP_STR | |
16713 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 16714 | "Specify expanded extcommunity-list\n" |
16715 | "Extended Community list name\n") | |
16716 | { | |
813d4307 | 16717 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16718 | } |
16719 | ||
16720 | DEFUN (no_ip_extcommunity_list_standard, | |
16721 | no_ip_extcommunity_list_standard_cmd, | |
16722 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
16723 | NO_STR | |
16724 | IP_STR | |
16725 | EXTCOMMUNITY_LIST_STR | |
16726 | "Extended Community list number (standard)\n" | |
16727 | "Specify community to reject\n" | |
16728 | "Specify community to accept\n" | |
16729 | EXTCOMMUNITY_VAL_STR) | |
16730 | { | |
813d4307 | 16731 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
718e3744 | 16732 | } |
16733 | ||
16734 | DEFUN (no_ip_extcommunity_list_expanded, | |
16735 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 16736 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 16737 | NO_STR |
16738 | IP_STR | |
16739 | EXTCOMMUNITY_LIST_STR | |
16740 | "Extended Community list number (expanded)\n" | |
16741 | "Specify community to reject\n" | |
16742 | "Specify community to accept\n" | |
16743 | "An ordered list as a regular-expression\n") | |
16744 | { | |
813d4307 | 16745 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16746 | } |
16747 | ||
16748 | DEFUN (no_ip_extcommunity_list_name_standard, | |
16749 | no_ip_extcommunity_list_name_standard_cmd, | |
16750 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
16751 | NO_STR | |
16752 | IP_STR | |
16753 | EXTCOMMUNITY_LIST_STR | |
16754 | "Specify standard extcommunity-list\n" | |
16755 | "Extended Community list name\n" | |
16756 | "Specify community to reject\n" | |
16757 | "Specify community to accept\n" | |
16758 | EXTCOMMUNITY_VAL_STR) | |
16759 | { | |
813d4307 DW |
16760 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
16761 | } | |
16762 | ||
16763 | DEFUN (no_ip_extcommunity_list_name_standard_brief, | |
16764 | no_ip_extcommunity_list_name_standard_brief_cmd, | |
16765 | "no ip extcommunity-list standard WORD (deny|permit)", | |
16766 | NO_STR | |
16767 | IP_STR | |
16768 | EXTCOMMUNITY_LIST_STR | |
16769 | "Specify standard extcommunity-list\n" | |
16770 | "Extended Community list name\n" | |
16771 | "Specify community to reject\n" | |
16772 | "Specify community to accept\n") | |
16773 | { | |
16774 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
718e3744 | 16775 | } |
16776 | ||
16777 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
16778 | no_ip_extcommunity_list_name_expanded_cmd, | |
16779 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
16780 | NO_STR | |
16781 | IP_STR | |
16782 | EXTCOMMUNITY_LIST_STR | |
16783 | "Specify expanded extcommunity-list\n" | |
16784 | "Community list name\n" | |
16785 | "Specify community to reject\n" | |
16786 | "Specify community to accept\n" | |
16787 | "An ordered list as a regular-expression\n") | |
16788 | { | |
813d4307 | 16789 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16790 | } |
16791 | ||
94f2b392 | 16792 | static void |
718e3744 | 16793 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
16794 | { | |
16795 | struct community_entry *entry; | |
16796 | ||
16797 | for (entry = list->head; entry; entry = entry->next) | |
16798 | { | |
16799 | if (entry == list->head) | |
16800 | { | |
16801 | if (all_digit (list->name)) | |
16802 | vty_out (vty, "Extended community %s list %s%s", | |
16803 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16804 | "standard" : "(expanded) access", | |
16805 | list->name, VTY_NEWLINE); | |
16806 | else | |
16807 | vty_out (vty, "Named extended community %s list %s%s", | |
16808 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16809 | "standard" : "expanded", | |
16810 | list->name, VTY_NEWLINE); | |
16811 | } | |
16812 | if (entry->any) | |
16813 | vty_out (vty, " %s%s", | |
16814 | community_direct_str (entry->direct), VTY_NEWLINE); | |
16815 | else | |
16816 | vty_out (vty, " %s %s%s", | |
16817 | community_direct_str (entry->direct), | |
16818 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16819 | entry->u.ecom->str : entry->config, | |
16820 | VTY_NEWLINE); | |
16821 | } | |
16822 | } | |
16823 | ||
16824 | DEFUN (show_ip_extcommunity_list, | |
16825 | show_ip_extcommunity_list_cmd, | |
16826 | "show ip extcommunity-list", | |
16827 | SHOW_STR | |
16828 | IP_STR | |
16829 | "List extended-community list\n") | |
16830 | { | |
16831 | struct community_list *list; | |
16832 | struct community_list_master *cm; | |
16833 | ||
fee6e4e4 | 16834 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16835 | if (! cm) |
16836 | return CMD_SUCCESS; | |
16837 | ||
16838 | for (list = cm->num.head; list; list = list->next) | |
16839 | extcommunity_list_show (vty, list); | |
16840 | ||
16841 | for (list = cm->str.head; list; list = list->next) | |
16842 | extcommunity_list_show (vty, list); | |
16843 | ||
16844 | return CMD_SUCCESS; | |
16845 | } | |
16846 | ||
16847 | DEFUN (show_ip_extcommunity_list_arg, | |
16848 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 16849 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 16850 | SHOW_STR |
16851 | IP_STR | |
16852 | "List extended-community list\n" | |
16853 | "Extcommunity-list number\n" | |
16854 | "Extcommunity-list name\n") | |
16855 | { | |
16856 | struct community_list *list; | |
16857 | ||
fee6e4e4 | 16858 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16859 | if (! list) |
16860 | { | |
b729294c | 16861 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 16862 | return CMD_WARNING; |
16863 | } | |
16864 | ||
16865 | extcommunity_list_show (vty, list); | |
16866 | ||
16867 | return CMD_SUCCESS; | |
16868 | } | |
6b0655a2 | 16869 | |
718e3744 | 16870 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 16871 | static const char * |
718e3744 | 16872 | community_list_config_str (struct community_entry *entry) |
16873 | { | |
fd79ac91 | 16874 | const char *str; |
718e3744 | 16875 | |
16876 | if (entry->any) | |
16877 | str = ""; | |
16878 | else | |
16879 | { | |
16880 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
16881 | str = community_str (entry->u.com); | |
16882 | else | |
16883 | str = entry->config; | |
16884 | } | |
16885 | return str; | |
16886 | } | |
16887 | ||
16888 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 16889 | static int |
718e3744 | 16890 | community_list_config_write (struct vty *vty) |
16891 | { | |
16892 | struct community_list *list; | |
16893 | struct community_entry *entry; | |
16894 | struct community_list_master *cm; | |
16895 | int write = 0; | |
16896 | ||
16897 | /* Community-list. */ | |
fee6e4e4 | 16898 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 16899 | |
16900 | for (list = cm->num.head; list; list = list->next) | |
16901 | for (entry = list->head; entry; entry = entry->next) | |
16902 | { | |
fee6e4e4 | 16903 | vty_out (vty, "ip community-list %s %s %s%s", |
16904 | list->name, community_direct_str (entry->direct), | |
16905 | community_list_config_str (entry), | |
16906 | VTY_NEWLINE); | |
718e3744 | 16907 | write++; |
16908 | } | |
16909 | for (list = cm->str.head; list; list = list->next) | |
16910 | for (entry = list->head; entry; entry = entry->next) | |
16911 | { | |
16912 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
16913 | entry->style == COMMUNITY_LIST_STANDARD | |
16914 | ? "standard" : "expanded", | |
16915 | list->name, community_direct_str (entry->direct), | |
16916 | community_list_config_str (entry), | |
16917 | VTY_NEWLINE); | |
16918 | write++; | |
16919 | } | |
16920 | ||
16921 | /* Extcommunity-list. */ | |
fee6e4e4 | 16922 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16923 | |
16924 | for (list = cm->num.head; list; list = list->next) | |
16925 | for (entry = list->head; entry; entry = entry->next) | |
16926 | { | |
fee6e4e4 | 16927 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
16928 | list->name, community_direct_str (entry->direct), | |
16929 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 16930 | write++; |
16931 | } | |
16932 | for (list = cm->str.head; list; list = list->next) | |
16933 | for (entry = list->head; entry; entry = entry->next) | |
16934 | { | |
16935 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
16936 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
16937 | ? "standard" : "expanded", | |
16938 | list->name, community_direct_str (entry->direct), | |
16939 | community_list_config_str (entry), VTY_NEWLINE); | |
16940 | write++; | |
16941 | } | |
16942 | return write; | |
16943 | } | |
16944 | ||
7fc626de | 16945 | static struct cmd_node community_list_node = |
718e3744 | 16946 | { |
16947 | COMMUNITY_LIST_NODE, | |
16948 | "", | |
16949 | 1 /* Export to vtysh. */ | |
16950 | }; | |
16951 | ||
94f2b392 | 16952 | static void |
16953 | community_list_vty (void) | |
718e3744 | 16954 | { |
16955 | install_node (&community_list_node, community_list_config_write); | |
16956 | ||
16957 | /* Community-list. */ | |
718e3744 | 16958 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
16959 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
16960 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
16961 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
16962 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
16963 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 16964 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
813d4307 | 16965 | install_element (CONFIG_NODE, &no_ip_community_list_standard_direction_cmd); |
fee6e4e4 | 16966 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
16967 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
16968 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 16969 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
16970 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
16971 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
813d4307 | 16972 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_brief_cmd); |
718e3744 | 16973 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
16974 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
16975 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
16976 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
16977 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
16978 | ||
16979 | /* Extcommunity-list. */ | |
16980 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
16981 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
16982 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
16983 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
16984 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
16985 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 16986 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
813d4307 | 16987 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_direction_cmd); |
fee6e4e4 | 16988 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
16989 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
16990 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 16991 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
16992 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
16993 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
813d4307 | 16994 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_brief_cmd); |
718e3744 | 16995 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
16996 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
16997 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
16998 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
16999 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
17000 | } |