]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* BGP VTY interface. |
2 | Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro | |
3 | ||
4 | This file is part of GNU Zebra. | |
5 | ||
6 | GNU Zebra is free software; you can redistribute it and/or modify it | |
7 | under the terms of the GNU General Public License as published by the | |
8 | Free Software Foundation; either version 2, or (at your option) any | |
9 | later version. | |
10 | ||
11 | GNU Zebra is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU Zebra; see the file COPYING. If not, write to the Free | |
18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
20 | ||
21 | #include <zebra.h> | |
22 | ||
856ca177 | 23 | #include "lib/json.h" |
718e3744 | 24 | #include "command.h" |
25 | #include "prefix.h" | |
26 | #include "plist.h" | |
27 | #include "buffer.h" | |
28 | #include "linklist.h" | |
29 | #include "stream.h" | |
30 | #include "thread.h" | |
31 | #include "log.h" | |
3b8b1855 | 32 | #include "memory.h" |
4bf6a362 | 33 | #include "hash.h" |
3f9c7369 | 34 | #include "queue.h" |
718e3744 | 35 | |
36 | #include "bgpd/bgpd.h" | |
4bf6a362 | 37 | #include "bgpd/bgp_advertise.h" |
718e3744 | 38 | #include "bgpd/bgp_attr.h" |
39 | #include "bgpd/bgp_aspath.h" | |
40 | #include "bgpd/bgp_community.h" | |
4bf6a362 PJ |
41 | #include "bgpd/bgp_ecommunity.h" |
42 | #include "bgpd/bgp_damp.h" | |
718e3744 | 43 | #include "bgpd/bgp_debug.h" |
e0701b79 | 44 | #include "bgpd/bgp_fsm.h" |
718e3744 | 45 | #include "bgpd/bgp_mplsvpn.h" |
4bf6a362 | 46 | #include "bgpd/bgp_nexthop.h" |
718e3744 | 47 | #include "bgpd/bgp_open.h" |
4bf6a362 | 48 | #include "bgpd/bgp_regex.h" |
718e3744 | 49 | #include "bgpd/bgp_route.h" |
50 | #include "bgpd/bgp_zebra.h" | |
fee0f4c6 | 51 | #include "bgpd/bgp_table.h" |
94f2b392 | 52 | #include "bgpd/bgp_vty.h" |
165b5fff | 53 | #include "bgpd/bgp_mpath.h" |
cb1faec9 | 54 | #include "bgpd/bgp_packet.h" |
3f9c7369 | 55 | #include "bgpd/bgp_updgrp.h" |
c43ed2e4 | 56 | #include "bgpd/bgp_bfd.h" |
718e3744 | 57 | |
20eb8864 | 58 | static struct peer_group * |
59 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact); | |
60 | ||
718e3744 | 61 | /* Utility function to get address family from current node. */ |
62 | afi_t | |
63 | bgp_node_afi (struct vty *vty) | |
64 | { | |
8ecd3266 | 65 | if (vty->node == BGP_IPV6_NODE || |
66 | vty->node == BGP_IPV6M_NODE || | |
67 | vty->node == BGP_VPNV6_NODE) | |
718e3744 | 68 | return AFI_IP6; |
69 | return AFI_IP; | |
70 | } | |
71 | ||
72 | /* Utility function to get subsequent address family from current | |
73 | node. */ | |
74 | safi_t | |
75 | bgp_node_safi (struct vty *vty) | |
76 | { | |
6407da5a | 77 | if (vty->node == BGP_VPNV4_NODE || vty->node == BGP_VPNV6_NODE) |
8ecd3266 | 78 | return SAFI_MPLS_VPN; |
25ffbdc1 | 79 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 80 | return SAFI_MULTICAST; |
81 | return SAFI_UNICAST; | |
82 | } | |
83 | ||
94f2b392 | 84 | static int |
6aeb9e78 | 85 | peer_address_self_check (struct bgp *bgp, union sockunion *su) |
718e3744 | 86 | { |
87 | struct interface *ifp = NULL; | |
88 | ||
89 | if (su->sa.sa_family == AF_INET) | |
6aeb9e78 | 90 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr, bgp->vrf_id); |
718e3744 | 91 | #ifdef HAVE_IPV6 |
92 | else if (su->sa.sa_family == AF_INET6) | |
f2345335 | 93 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr, |
6aeb9e78 | 94 | su->sin6.sin6_scope_id, bgp->vrf_id); |
718e3744 | 95 | #endif /* HAVE IPV6 */ |
96 | ||
97 | if (ifp) | |
98 | return 1; | |
99 | ||
100 | return 0; | |
101 | } | |
102 | ||
103 | /* Utility function for looking up peer from VTY. */ | |
f14e6fdb DS |
104 | /* This is used only for configuration, so disallow if attempted on |
105 | * a dynamic neighbor. | |
106 | */ | |
94f2b392 | 107 | static struct peer * |
fd79ac91 | 108 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 109 | { |
110 | int ret; | |
111 | struct bgp *bgp; | |
112 | union sockunion su; | |
113 | struct peer *peer; | |
114 | ||
115 | bgp = vty->index; | |
116 | ||
117 | ret = str2sockunion (ip_str, &su); | |
118 | if (ret < 0) | |
119 | { | |
a80beece DS |
120 | peer = peer_lookup_by_conf_if (bgp, ip_str); |
121 | if (!peer) | |
122 | { | |
04b6bdc0 DW |
123 | if ((peer = peer_lookup_by_hostname(bgp, ip_str)) == NULL) |
124 | { | |
125 | vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE); | |
126 | return NULL; | |
127 | } | |
a80beece | 128 | } |
718e3744 | 129 | } |
a80beece | 130 | else |
718e3744 | 131 | { |
a80beece DS |
132 | peer = peer_lookup (bgp, &su); |
133 | if (! peer) | |
134 | { | |
135 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
136 | VTY_NEWLINE); | |
137 | return NULL; | |
138 | } | |
f14e6fdb DS |
139 | if (peer_dynamic_neighbor (peer)) |
140 | { | |
141 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
142 | VTY_NEWLINE); | |
143 | return NULL; | |
144 | } | |
145 | ||
718e3744 | 146 | } |
147 | return peer; | |
148 | } | |
149 | ||
150 | /* Utility function for looking up peer or peer group. */ | |
f14e6fdb DS |
151 | /* This is used only for configuration, so disallow if attempted on |
152 | * a dynamic neighbor. | |
153 | */ | |
c43ed2e4 | 154 | struct peer * |
fd79ac91 | 155 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 156 | { |
157 | int ret; | |
158 | struct bgp *bgp; | |
159 | union sockunion su; | |
f14e6fdb DS |
160 | struct peer *peer = NULL; |
161 | struct peer_group *group = NULL; | |
718e3744 | 162 | |
163 | bgp = vty->index; | |
164 | ||
165 | ret = str2sockunion (peer_str, &su); | |
166 | if (ret == 0) | |
167 | { | |
f14e6fdb | 168 | /* IP address, locate peer. */ |
718e3744 | 169 | peer = peer_lookup (bgp, &su); |
718e3744 | 170 | } |
171 | else | |
172 | { | |
f14e6fdb | 173 | /* Not IP, could match either peer configured on interface or a group. */ |
a80beece | 174 | peer = peer_lookup_by_conf_if (bgp, peer_str); |
f14e6fdb DS |
175 | if (!peer) |
176 | group = peer_group_lookup (bgp, peer_str); | |
177 | } | |
a80beece | 178 | |
f14e6fdb DS |
179 | if (peer) |
180 | { | |
181 | if (peer_dynamic_neighbor (peer)) | |
182 | { | |
183 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
184 | VTY_NEWLINE); | |
185 | return NULL; | |
186 | } | |
187 | ||
188 | return peer; | |
718e3744 | 189 | } |
190 | ||
f14e6fdb DS |
191 | if (group) |
192 | return group->conf; | |
193 | ||
718e3744 | 194 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
195 | VTY_NEWLINE); | |
196 | ||
197 | return NULL; | |
198 | } | |
199 | ||
c43ed2e4 | 200 | int |
718e3744 | 201 | bgp_vty_return (struct vty *vty, int ret) |
202 | { | |
fd79ac91 | 203 | const char *str = NULL; |
718e3744 | 204 | |
205 | switch (ret) | |
206 | { | |
207 | case BGP_ERR_INVALID_VALUE: | |
208 | str = "Invalid value"; | |
209 | break; | |
210 | case BGP_ERR_INVALID_FLAG: | |
211 | str = "Invalid flag"; | |
212 | break; | |
718e3744 | 213 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
214 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
215 | break; | |
718e3744 | 216 | case BGP_ERR_PEER_FLAG_CONFLICT: |
217 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
218 | break; | |
718e3744 | 219 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
220 | str = "Specify remote-as or peer-group remote AS first"; | |
221 | break; | |
222 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
223 | str = "Cannot change the peer-group. Deconfigure first"; | |
224 | break; | |
225 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
4c48cf63 | 226 | str = "Peer is not a member of this peer-group"; |
718e3744 | 227 | break; |
228 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
229 | str = "Prefix/distribute list can not co-exist"; | |
230 | break; | |
231 | case BGP_ERR_NOT_INTERNAL_PEER: | |
232 | str = "Invalid command. Not an internal neighbor"; | |
233 | break; | |
234 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
5000f21c | 235 | str = "remove-private-AS cannot be configured for IBGP peers"; |
718e3744 | 236 | break; |
237 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
238 | str = "Local-AS allowed only for EBGP peers"; | |
239 | break; | |
240 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
241 | str = "Cannot have local-as same as BGP AS number"; | |
242 | break; | |
0df7c91f PJ |
243 | case BGP_ERR_TCPSIG_FAILED: |
244 | str = "Error while applying TCP-Sig to session(s)"; | |
245 | break; | |
fa411a21 NH |
246 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
247 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
248 | break; | |
f5a4827d SH |
249 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
250 | str = "ttl-security only allowed for EBGP peers"; | |
251 | break; | |
c7122e14 DS |
252 | case BGP_ERR_AS_OVERRIDE: |
253 | str = "as-override cannot be configured for IBGP peers"; | |
254 | break; | |
f14e6fdb DS |
255 | case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT: |
256 | str = "Invalid limit for number of dynamic neighbors"; | |
257 | break; | |
258 | case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS: | |
259 | str = "Dynamic neighbor listen range already exists"; | |
260 | break; | |
261 | case BGP_ERR_INVALID_FOR_DYNAMIC_PEER: | |
262 | str = "Operation not allowed on a dynamic neighbor"; | |
263 | break; | |
718e3744 | 264 | } |
265 | if (str) | |
266 | { | |
267 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
268 | return CMD_WARNING; | |
269 | } | |
270 | return CMD_SUCCESS; | |
271 | } | |
272 | ||
7aafcaca DS |
273 | /* BGP clear sort. */ |
274 | enum clear_sort | |
275 | { | |
276 | clear_all, | |
277 | clear_peer, | |
278 | clear_group, | |
279 | clear_external, | |
280 | clear_as | |
281 | }; | |
282 | ||
7aafcaca DS |
283 | static void |
284 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, | |
285 | safi_t safi, int error) | |
286 | { | |
287 | switch (error) | |
288 | { | |
289 | case BGP_ERR_AF_UNCONFIGURED: | |
290 | vty_out (vty, | |
291 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
292 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
293 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
294 | peer->host, VTY_NEWLINE); | |
295 | break; | |
296 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
297 | 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); | |
298 | break; | |
299 | default: | |
300 | break; | |
301 | } | |
302 | } | |
303 | ||
304 | /* `clear ip bgp' functions. */ | |
305 | static int | |
306 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, | |
307 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) | |
308 | { | |
309 | int ret; | |
310 | struct peer *peer; | |
311 | struct listnode *node, *nnode; | |
312 | ||
313 | /* Clear all neighbors. */ | |
314 | /* | |
315 | * Pass along pointer to next node to peer_clear() when walking all nodes | |
316 | * on the BGP instance as that may get freed if it is a doppelganger | |
317 | */ | |
318 | if (sort == clear_all) | |
319 | { | |
320 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
321 | { | |
322 | if (stype == BGP_CLEAR_SOFT_NONE) | |
323 | ret = peer_clear (peer, &nnode); | |
324 | else if (peer->afc[afi][safi]) | |
325 | ret = peer_clear_soft (peer, afi, safi, stype); | |
326 | else | |
327 | ret = 0; | |
328 | ||
329 | if (ret < 0) | |
330 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
331 | } | |
332 | ||
333 | /* This is to apply read-only mode on this clear. */ | |
334 | if (stype == BGP_CLEAR_SOFT_NONE) | |
335 | bgp->update_delay_over = 0; | |
336 | ||
337 | return CMD_SUCCESS; | |
338 | } | |
339 | ||
340 | /* Clear specified neighbors. */ | |
341 | if (sort == clear_peer) | |
342 | { | |
343 | union sockunion su; | |
344 | int ret; | |
345 | ||
346 | /* Make sockunion for lookup. */ | |
347 | ret = str2sockunion (arg, &su); | |
348 | if (ret < 0) | |
349 | { | |
350 | peer = peer_lookup_by_conf_if (bgp, arg); | |
351 | if (!peer) | |
352 | { | |
04b6bdc0 DW |
353 | peer = peer_lookup_by_hostname(bgp, arg); |
354 | if (!peer) | |
355 | { | |
356 | vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE); | |
357 | return CMD_WARNING; | |
358 | } | |
7aafcaca DS |
359 | } |
360 | } | |
361 | else | |
362 | { | |
363 | peer = peer_lookup (bgp, &su); | |
364 | if (! peer) | |
365 | { | |
366 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
367 | return CMD_WARNING; | |
368 | } | |
369 | } | |
370 | ||
371 | if (stype == BGP_CLEAR_SOFT_NONE) | |
372 | ret = peer_clear (peer, NULL); | |
373 | else | |
374 | ret = peer_clear_soft (peer, afi, safi, stype); | |
375 | ||
376 | if (ret < 0) | |
377 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
378 | ||
379 | return CMD_SUCCESS; | |
380 | } | |
381 | ||
382 | /* Clear all peer-group members. */ | |
383 | if (sort == clear_group) | |
384 | { | |
385 | struct peer_group *group; | |
386 | ||
387 | group = peer_group_lookup (bgp, arg); | |
388 | if (! group) | |
389 | { | |
390 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
391 | return CMD_WARNING; | |
392 | } | |
393 | ||
394 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
395 | { | |
396 | if (stype == BGP_CLEAR_SOFT_NONE) | |
397 | { | |
18f1dc06 | 398 | peer_clear (peer, NULL); |
7aafcaca DS |
399 | continue; |
400 | } | |
401 | ||
c8560b44 | 402 | if (! peer->afc[afi][safi]) |
7aafcaca DS |
403 | continue; |
404 | ||
405 | ret = peer_clear_soft (peer, afi, safi, stype); | |
406 | ||
407 | if (ret < 0) | |
408 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
409 | } | |
410 | return CMD_SUCCESS; | |
411 | } | |
412 | ||
413 | if (sort == clear_external) | |
414 | { | |
415 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
416 | { | |
417 | if (peer->sort == BGP_PEER_IBGP) | |
418 | continue; | |
419 | ||
420 | if (stype == BGP_CLEAR_SOFT_NONE) | |
421 | ret = peer_clear (peer, &nnode); | |
422 | else | |
423 | ret = peer_clear_soft (peer, afi, safi, stype); | |
424 | ||
425 | if (ret < 0) | |
426 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
427 | } | |
428 | return CMD_SUCCESS; | |
429 | } | |
430 | ||
431 | if (sort == clear_as) | |
432 | { | |
433 | as_t as; | |
434 | int find = 0; | |
435 | ||
436 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); | |
437 | ||
438 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
439 | { | |
440 | if (peer->as != as) | |
441 | continue; | |
442 | ||
443 | find = 1; | |
444 | if (stype == BGP_CLEAR_SOFT_NONE) | |
445 | ret = peer_clear (peer, &nnode); | |
446 | else | |
447 | ret = peer_clear_soft (peer, afi, safi, stype); | |
448 | ||
449 | if (ret < 0) | |
450 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
451 | } | |
452 | if (! find) | |
453 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
454 | VTY_NEWLINE); | |
455 | return CMD_SUCCESS; | |
456 | } | |
457 | ||
458 | return CMD_SUCCESS; | |
459 | } | |
460 | ||
461 | static int | |
462 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, | |
463 | enum clear_sort sort, enum bgp_clear_type stype, | |
464 | const char *arg) | |
465 | { | |
466 | struct bgp *bgp; | |
467 | ||
468 | /* BGP structure lookup. */ | |
469 | if (name) | |
470 | { | |
471 | bgp = bgp_lookup_by_name (name); | |
472 | if (bgp == NULL) | |
473 | { | |
6aeb9e78 | 474 | vty_out (vty, "Can't find BGP instance %s%s", name, VTY_NEWLINE); |
7aafcaca DS |
475 | return CMD_WARNING; |
476 | } | |
477 | } | |
478 | else | |
479 | { | |
480 | bgp = bgp_get_default (); | |
481 | if (bgp == NULL) | |
482 | { | |
483 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
484 | return CMD_WARNING; | |
485 | } | |
486 | } | |
487 | ||
488 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); | |
489 | } | |
490 | ||
491 | /* clear soft inbound */ | |
492 | static void | |
493 | bgp_clear_star_soft_in (struct vty *vty) | |
494 | { | |
495 | bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
496 | BGP_CLEAR_SOFT_IN, NULL); | |
497 | #ifdef HAVE_IPV6 | |
498 | bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
499 | BGP_CLEAR_SOFT_IN, NULL); | |
500 | #endif /* HAVE_IPV6 */ | |
501 | } | |
502 | ||
503 | /* clear soft outbound */ | |
504 | static void | |
505 | bgp_clear_star_soft_out (struct vty *vty) | |
506 | { | |
507 | bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
508 | BGP_CLEAR_SOFT_OUT, NULL); | |
509 | #ifdef HAVE_IPV6 | |
510 | bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
511 | BGP_CLEAR_SOFT_OUT, NULL); | |
512 | #endif /* HAVE_IPV6 */ | |
513 | } | |
514 | ||
515 | ||
718e3744 | 516 | /* BGP global configuration. */ |
517 | ||
518 | DEFUN (bgp_multiple_instance_func, | |
519 | bgp_multiple_instance_cmd, | |
520 | "bgp multiple-instance", | |
521 | BGP_STR | |
522 | "Enable bgp multiple instance\n") | |
523 | { | |
524 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
525 | return CMD_SUCCESS; | |
526 | } | |
527 | ||
528 | DEFUN (no_bgp_multiple_instance, | |
529 | no_bgp_multiple_instance_cmd, | |
530 | "no bgp multiple-instance", | |
531 | NO_STR | |
532 | BGP_STR | |
533 | "BGP multiple instance\n") | |
534 | { | |
535 | int ret; | |
536 | ||
537 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
538 | if (ret < 0) | |
539 | { | |
540 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
541 | return CMD_WARNING; | |
542 | } | |
543 | return CMD_SUCCESS; | |
544 | } | |
545 | ||
546 | DEFUN (bgp_config_type, | |
547 | bgp_config_type_cmd, | |
548 | "bgp config-type (cisco|zebra)", | |
549 | BGP_STR | |
550 | "Configuration type\n" | |
551 | "cisco\n" | |
552 | "zebra\n") | |
553 | { | |
554 | if (strncmp (argv[0], "c", 1) == 0) | |
555 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
556 | else | |
557 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
558 | ||
559 | return CMD_SUCCESS; | |
560 | } | |
561 | ||
562 | DEFUN (no_bgp_config_type, | |
563 | no_bgp_config_type_cmd, | |
564 | "no bgp config-type", | |
565 | NO_STR | |
566 | BGP_STR | |
567 | "Display configuration type\n") | |
568 | { | |
569 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
570 | return CMD_SUCCESS; | |
571 | } | |
572 | ||
813d4307 DW |
573 | ALIAS (no_bgp_config_type, |
574 | no_bgp_config_type_val_cmd, | |
575 | "no bgp config-type (cisco|zebra)", | |
576 | NO_STR | |
577 | BGP_STR | |
578 | "Configuration type\n" | |
579 | "cisco\n" | |
580 | "zebra\n") | |
581 | ||
718e3744 | 582 | DEFUN (no_synchronization, |
583 | no_synchronization_cmd, | |
584 | "no synchronization", | |
585 | NO_STR | |
586 | "Perform IGP synchronization\n") | |
587 | { | |
588 | return CMD_SUCCESS; | |
589 | } | |
590 | ||
591 | DEFUN (no_auto_summary, | |
592 | no_auto_summary_cmd, | |
593 | "no auto-summary", | |
594 | NO_STR | |
595 | "Enable automatic network number summarization\n") | |
596 | { | |
597 | return CMD_SUCCESS; | |
598 | } | |
3d515fd9 | 599 | |
718e3744 | 600 | /* "router bgp" commands. */ |
601 | DEFUN (router_bgp, | |
602 | router_bgp_cmd, | |
320da874 | 603 | "router bgp " CMD_AS_RANGE, |
718e3744 | 604 | ROUTER_STR |
605 | BGP_STR | |
606 | AS_STR) | |
607 | { | |
608 | int ret; | |
609 | as_t as; | |
610 | struct bgp *bgp; | |
fd79ac91 | 611 | const char *name = NULL; |
ad4cbda1 | 612 | enum bgp_instance_type inst_type; |
718e3744 | 613 | |
2385a876 DW |
614 | // "router bgp" without an ASN |
615 | if (argc < 1) | |
616 | { | |
6aeb9e78 | 617 | //Pending: Make VRF option available for ASN less config |
2385a876 | 618 | bgp = bgp_get_default(); |
718e3744 | 619 | |
2385a876 DW |
620 | if (bgp == NULL) |
621 | { | |
622 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
623 | return CMD_WARNING; | |
624 | } | |
718e3744 | 625 | |
2385a876 DW |
626 | if (listcount(bm->bgp) > 1) |
627 | { | |
628 | vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE); | |
629 | return CMD_WARNING; | |
630 | } | |
631 | } | |
632 | ||
633 | // "router bgp X" | |
634 | else | |
718e3744 | 635 | { |
2385a876 DW |
636 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
637 | ||
ad4cbda1 | 638 | inst_type = BGP_INSTANCE_TYPE_DEFAULT; |
6aeb9e78 | 639 | if (argc == 3) |
ad4cbda1 | 640 | { |
641 | name = argv[2]; | |
642 | if (!strcmp(argv[1], "vrf")) | |
643 | inst_type = BGP_INSTANCE_TYPE_VRF; | |
644 | else if (!strcmp(argv[1], "view")) | |
645 | inst_type = BGP_INSTANCE_TYPE_VIEW; | |
646 | } | |
2385a876 | 647 | |
ad4cbda1 | 648 | ret = bgp_get (&bgp, &as, name, inst_type); |
2385a876 DW |
649 | switch (ret) |
650 | { | |
651 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
652 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
653 | VTY_NEWLINE); | |
654 | return CMD_WARNING; | |
655 | case BGP_ERR_AS_MISMATCH: | |
656 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); | |
657 | return CMD_WARNING; | |
658 | case BGP_ERR_INSTANCE_MISMATCH: | |
6aeb9e78 | 659 | vty_out (vty, "BGP instance name and AS number mismatch%s", VTY_NEWLINE); |
2385a876 DW |
660 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
661 | as, VTY_NEWLINE); | |
662 | return CMD_WARNING; | |
663 | } | |
6aeb9e78 DS |
664 | |
665 | /* Pending: handle when user tries to change a view to vrf n vv. */ | |
718e3744 | 666 | } |
667 | ||
668 | vty->node = BGP_NODE; | |
669 | vty->index = bgp; | |
670 | ||
671 | return CMD_SUCCESS; | |
672 | } | |
673 | ||
674 | ALIAS (router_bgp, | |
6aeb9e78 DS |
675 | router_bgp_instance_cmd, |
676 | "router bgp " CMD_AS_RANGE " (view|vrf) WORD", | |
718e3744 | 677 | ROUTER_STR |
678 | BGP_STR | |
679 | AS_STR | |
6aeb9e78 | 680 | "BGP view\nBGP VRF\n" |
8386ac43 | 681 | "View/VRF name\n") |
6b0655a2 | 682 | |
2385a876 DW |
683 | ALIAS (router_bgp, |
684 | router_bgp_noasn_cmd, | |
685 | "router bgp", | |
686 | ROUTER_STR | |
687 | BGP_STR) | |
688 | ||
718e3744 | 689 | /* "no router bgp" commands. */ |
690 | DEFUN (no_router_bgp, | |
691 | no_router_bgp_cmd, | |
320da874 | 692 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 693 | NO_STR |
694 | ROUTER_STR | |
695 | BGP_STR | |
696 | AS_STR) | |
697 | { | |
698 | as_t as; | |
699 | struct bgp *bgp; | |
fd79ac91 | 700 | const char *name = NULL; |
718e3744 | 701 | |
0b2aa3a0 | 702 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 703 | |
6aeb9e78 DS |
704 | if (argc == 3) |
705 | name = argv[2]; | |
718e3744 | 706 | |
707 | /* Lookup bgp structure. */ | |
708 | bgp = bgp_lookup (as, name); | |
709 | if (! bgp) | |
710 | { | |
711 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
712 | return CMD_WARNING; | |
713 | } | |
714 | ||
715 | bgp_delete (bgp); | |
716 | ||
717 | return CMD_SUCCESS; | |
718 | } | |
719 | ||
720 | ALIAS (no_router_bgp, | |
6aeb9e78 DS |
721 | no_router_bgp_instance_cmd, |
722 | "no router bgp " CMD_AS_RANGE " (view|vrf) WORD", | |
718e3744 | 723 | NO_STR |
724 | ROUTER_STR | |
725 | BGP_STR | |
726 | AS_STR | |
6aeb9e78 | 727 | "BGP view\nBGP VRF\n" |
8386ac43 | 728 | "View/VRF name\n") |
6b0655a2 | 729 | |
718e3744 | 730 | /* BGP router-id. */ |
731 | ||
732 | DEFUN (bgp_router_id, | |
733 | bgp_router_id_cmd, | |
734 | "bgp router-id A.B.C.D", | |
735 | BGP_STR | |
736 | "Override configured router identifier\n" | |
737 | "Manually configured router identifier\n") | |
738 | { | |
739 | int ret; | |
740 | struct in_addr id; | |
741 | struct bgp *bgp; | |
742 | ||
743 | bgp = vty->index; | |
744 | ||
745 | ret = inet_aton (argv[0], &id); | |
746 | if (! ret) | |
747 | { | |
748 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
749 | return CMD_WARNING; | |
750 | } | |
751 | ||
c2d58d6d | 752 | if (IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
753 | return CMD_SUCCESS; | |
754 | ||
18a6dce6 | 755 | bgp->router_id_static = id; |
718e3744 | 756 | bgp_router_id_set (bgp, &id); |
757 | ||
758 | return CMD_SUCCESS; | |
759 | } | |
760 | ||
761 | DEFUN (no_bgp_router_id, | |
762 | no_bgp_router_id_cmd, | |
763 | "no bgp router-id", | |
764 | NO_STR | |
765 | BGP_STR | |
766 | "Override configured router identifier\n") | |
767 | { | |
768 | int ret; | |
769 | struct in_addr id; | |
770 | struct bgp *bgp; | |
771 | ||
772 | bgp = vty->index; | |
773 | ||
774 | if (argc == 1) | |
775 | { | |
776 | ret = inet_aton (argv[0], &id); | |
777 | if (! ret) | |
778 | { | |
779 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
780 | return CMD_WARNING; | |
781 | } | |
782 | ||
18a6dce6 | 783 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
718e3744 | 784 | { |
785 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
786 | return CMD_WARNING; | |
787 | } | |
788 | } | |
789 | ||
18a6dce6 | 790 | bgp->router_id_static.s_addr = 0; |
6aeb9e78 | 791 | bgp_router_id_set (bgp, &bgp->router_id_zebra); |
718e3744 | 792 | |
793 | return CMD_SUCCESS; | |
794 | } | |
795 | ||
796 | ALIAS (no_bgp_router_id, | |
797 | no_bgp_router_id_val_cmd, | |
798 | "no bgp router-id A.B.C.D", | |
799 | NO_STR | |
800 | BGP_STR | |
801 | "Override configured router identifier\n" | |
802 | "Manually configured router identifier\n") | |
6b0655a2 | 803 | |
718e3744 | 804 | /* BGP Cluster ID. */ |
805 | ||
806 | DEFUN (bgp_cluster_id, | |
807 | bgp_cluster_id_cmd, | |
808 | "bgp cluster-id A.B.C.D", | |
809 | BGP_STR | |
810 | "Configure Route-Reflector Cluster-id\n" | |
811 | "Route-Reflector Cluster-id in IP address format\n") | |
812 | { | |
813 | int ret; | |
814 | struct bgp *bgp; | |
815 | struct in_addr cluster; | |
816 | ||
817 | bgp = vty->index; | |
818 | ||
819 | ret = inet_aton (argv[0], &cluster); | |
820 | if (! ret) | |
821 | { | |
822 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
823 | return CMD_WARNING; | |
824 | } | |
825 | ||
826 | bgp_cluster_id_set (bgp, &cluster); | |
7aafcaca | 827 | bgp_clear_star_soft_out (vty); |
718e3744 | 828 | |
829 | return CMD_SUCCESS; | |
830 | } | |
831 | ||
832 | ALIAS (bgp_cluster_id, | |
833 | bgp_cluster_id32_cmd, | |
834 | "bgp cluster-id <1-4294967295>", | |
835 | BGP_STR | |
836 | "Configure Route-Reflector Cluster-id\n" | |
837 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
838 | ||
839 | DEFUN (no_bgp_cluster_id, | |
840 | no_bgp_cluster_id_cmd, | |
841 | "no bgp cluster-id", | |
842 | NO_STR | |
843 | BGP_STR | |
844 | "Configure Route-Reflector Cluster-id\n") | |
845 | { | |
846 | int ret; | |
847 | struct bgp *bgp; | |
848 | struct in_addr cluster; | |
849 | ||
850 | bgp = vty->index; | |
851 | ||
852 | if (argc == 1) | |
853 | { | |
854 | ret = inet_aton (argv[0], &cluster); | |
855 | if (! ret) | |
856 | { | |
857 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
858 | return CMD_WARNING; | |
859 | } | |
860 | } | |
861 | ||
862 | bgp_cluster_id_unset (bgp); | |
7aafcaca | 863 | bgp_clear_star_soft_out (vty); |
718e3744 | 864 | |
865 | return CMD_SUCCESS; | |
866 | } | |
867 | ||
868 | ALIAS (no_bgp_cluster_id, | |
813d4307 | 869 | no_bgp_cluster_id_ip_cmd, |
718e3744 | 870 | "no bgp cluster-id A.B.C.D", |
871 | NO_STR | |
872 | BGP_STR | |
873 | "Configure Route-Reflector Cluster-id\n" | |
874 | "Route-Reflector Cluster-id in IP address format\n") | |
6b0655a2 | 875 | |
813d4307 DW |
876 | ALIAS (no_bgp_cluster_id, |
877 | no_bgp_cluster_id_decimal_cmd, | |
878 | "no bgp cluster-id <1-4294967295>", | |
879 | NO_STR | |
880 | BGP_STR | |
881 | "Configure Route-Reflector Cluster-id\n" | |
882 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
883 | ||
718e3744 | 884 | DEFUN (bgp_confederation_identifier, |
885 | bgp_confederation_identifier_cmd, | |
320da874 | 886 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 887 | "BGP specific commands\n" |
888 | "AS confederation parameters\n" | |
889 | "AS number\n" | |
890 | "Set routing domain confederation AS\n") | |
891 | { | |
892 | struct bgp *bgp; | |
893 | as_t as; | |
894 | ||
895 | bgp = vty->index; | |
896 | ||
0b2aa3a0 | 897 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 898 | |
899 | bgp_confederation_id_set (bgp, as); | |
900 | ||
901 | return CMD_SUCCESS; | |
902 | } | |
903 | ||
904 | DEFUN (no_bgp_confederation_identifier, | |
905 | no_bgp_confederation_identifier_cmd, | |
906 | "no bgp confederation identifier", | |
907 | NO_STR | |
908 | "BGP specific commands\n" | |
909 | "AS confederation parameters\n" | |
910 | "AS number\n") | |
911 | { | |
912 | struct bgp *bgp; | |
718e3744 | 913 | |
914 | bgp = vty->index; | |
915 | ||
718e3744 | 916 | bgp_confederation_id_unset (bgp); |
917 | ||
918 | return CMD_SUCCESS; | |
919 | } | |
920 | ||
921 | ALIAS (no_bgp_confederation_identifier, | |
922 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 923 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 924 | NO_STR |
925 | "BGP specific commands\n" | |
926 | "AS confederation parameters\n" | |
927 | "AS number\n" | |
928 | "Set routing domain confederation AS\n") | |
6b0655a2 | 929 | |
718e3744 | 930 | DEFUN (bgp_confederation_peers, |
931 | bgp_confederation_peers_cmd, | |
320da874 | 932 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 933 | "BGP specific commands\n" |
934 | "AS confederation parameters\n" | |
935 | "Peer ASs in BGP confederation\n" | |
936 | AS_STR) | |
937 | { | |
938 | struct bgp *bgp; | |
939 | as_t as; | |
940 | int i; | |
941 | ||
942 | bgp = vty->index; | |
943 | ||
944 | for (i = 0; i < argc; i++) | |
945 | { | |
0b2aa3a0 | 946 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 947 | |
948 | if (bgp->as == as) | |
949 | { | |
950 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
951 | VTY_NEWLINE); | |
952 | continue; | |
953 | } | |
954 | ||
955 | bgp_confederation_peers_add (bgp, as); | |
956 | } | |
957 | return CMD_SUCCESS; | |
958 | } | |
959 | ||
960 | DEFUN (no_bgp_confederation_peers, | |
961 | no_bgp_confederation_peers_cmd, | |
320da874 | 962 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 963 | NO_STR |
964 | "BGP specific commands\n" | |
965 | "AS confederation parameters\n" | |
966 | "Peer ASs in BGP confederation\n" | |
967 | AS_STR) | |
968 | { | |
969 | struct bgp *bgp; | |
970 | as_t as; | |
971 | int i; | |
972 | ||
973 | bgp = vty->index; | |
974 | ||
975 | for (i = 0; i < argc; i++) | |
976 | { | |
0b2aa3a0 PJ |
977 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
978 | ||
718e3744 | 979 | bgp_confederation_peers_remove (bgp, as); |
980 | } | |
981 | return CMD_SUCCESS; | |
982 | } | |
6b0655a2 | 983 | |
5e242b0d DS |
984 | /** |
985 | * Central routine for maximum-paths configuration. | |
986 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
987 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
988 | */ | |
ffd0c037 DS |
989 | static int |
990 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, | |
5e242b0d | 991 | u_int16_t options, int set) |
165b5fff JB |
992 | { |
993 | struct bgp *bgp; | |
ffd0c037 | 994 | u_int16_t maxpaths = 0; |
165b5fff | 995 | int ret; |
5e242b0d DS |
996 | afi_t afi; |
997 | safi_t safi; | |
165b5fff JB |
998 | |
999 | bgp = vty->index; | |
5e242b0d DS |
1000 | afi = bgp_node_afi (vty); |
1001 | safi = bgp_node_safi (vty); | |
165b5fff | 1002 | |
5e242b0d DS |
1003 | if (set) |
1004 | { | |
73ac8160 | 1005 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
5b964da3 | 1006 | MULTIPATH_NUM); |
5e242b0d DS |
1007 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
1008 | options); | |
1009 | } | |
1010 | else | |
1011 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 1012 | |
165b5fff JB |
1013 | if (ret < 0) |
1014 | { | |
1015 | vty_out (vty, | |
5e242b0d DS |
1016 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
1017 | (set == 1) ? "" : "un", | |
1018 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
1019 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
1020 | return CMD_WARNING; |
1021 | } | |
1022 | ||
7aafcaca DS |
1023 | bgp_recalculate_all_bestpaths (bgp); |
1024 | ||
165b5fff JB |
1025 | return CMD_SUCCESS; |
1026 | } | |
1027 | ||
abc920f8 DS |
1028 | DEFUN (bgp_maxmed_admin, |
1029 | bgp_maxmed_admin_cmd, | |
1030 | "bgp max-med administrative ", | |
1031 | BGP_STR | |
1032 | "Advertise routes with max-med\n" | |
1033 | "Administratively applied, for an indefinite period\n") | |
1034 | { | |
1035 | struct bgp *bgp; | |
1036 | ||
1037 | bgp = vty->index; | |
1038 | ||
1039 | bgp->v_maxmed_admin = 1; | |
1040 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1041 | ||
1042 | bgp_maxmed_update(bgp); | |
1043 | ||
1044 | return CMD_SUCCESS; | |
1045 | } | |
1046 | ||
1047 | DEFUN (bgp_maxmed_admin_medv, | |
1048 | bgp_maxmed_admin_medv_cmd, | |
1049 | "bgp max-med administrative <0-4294967294>", | |
1050 | BGP_STR | |
1051 | "Advertise routes with max-med\n" | |
1052 | "Administratively applied, for an indefinite period\n" | |
1053 | "Max MED value to be used\n") | |
1054 | { | |
1055 | struct bgp *bgp; | |
1056 | ||
1057 | bgp = vty->index; | |
1058 | ||
1059 | bgp->v_maxmed_admin = 1; | |
1060 | VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]); | |
1061 | ||
1062 | bgp_maxmed_update(bgp); | |
1063 | ||
1064 | return CMD_SUCCESS; | |
1065 | } | |
1066 | ||
1067 | DEFUN (no_bgp_maxmed_admin, | |
1068 | no_bgp_maxmed_admin_cmd, | |
1069 | "no bgp max-med administrative", | |
1070 | NO_STR | |
1071 | BGP_STR | |
1072 | "Advertise routes with max-med\n" | |
1073 | "Administratively applied, for an indefinite period\n") | |
1074 | { | |
1075 | struct bgp *bgp; | |
1076 | ||
1077 | bgp = vty->index; | |
1078 | ||
1079 | bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED; | |
1080 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1081 | ||
1082 | bgp_maxmed_update(bgp); | |
1083 | ||
1084 | return CMD_SUCCESS; | |
1085 | } | |
1086 | ||
1087 | ALIAS (no_bgp_maxmed_admin, | |
1088 | no_bgp_maxmed_admin_medv_cmd, | |
1089 | "no bgp max-med administrative <0-4294967294>", | |
1090 | NO_STR | |
1091 | BGP_STR | |
1092 | "Advertise routes with max-med\n" | |
1093 | "Administratively applied, for an indefinite period\n" | |
1094 | "Max MED value to be used\n") | |
1095 | ||
1096 | ||
1097 | DEFUN (bgp_maxmed_onstartup, | |
1098 | bgp_maxmed_onstartup_cmd, | |
1099 | "bgp max-med on-startup <5-86400>", | |
1100 | BGP_STR | |
1101 | "Advertise routes with max-med\n" | |
1102 | "Effective on a startup\n" | |
1103 | "Time (seconds) period for max-med\n") | |
1104 | { | |
1105 | struct bgp *bgp; | |
1106 | ||
1107 | bgp = vty->index; | |
1108 | ||
1109 | if (argc != 1) | |
1110 | { | |
1111 | vty_out (vty, "%% Must supply max-med on-startup period"); | |
1112 | return CMD_WARNING; | |
1113 | } | |
1114 | ||
1115 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1116 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1117 | ||
1118 | bgp_maxmed_update(bgp); | |
1119 | ||
1120 | return CMD_SUCCESS; | |
1121 | } | |
1122 | ||
1123 | DEFUN (bgp_maxmed_onstartup_medv, | |
1124 | bgp_maxmed_onstartup_medv_cmd, | |
1125 | "bgp max-med on-startup <5-86400> <0-4294967294>", | |
1126 | BGP_STR | |
1127 | "Advertise routes with max-med\n" | |
1128 | "Effective on a startup\n" | |
1129 | "Time (seconds) period for max-med\n" | |
1130 | "Max MED value to be used\n") | |
1131 | { | |
1132 | struct bgp *bgp; | |
1133 | ||
1134 | bgp = vty->index; | |
1135 | ||
1136 | if (argc != 2) | |
1137 | { | |
1138 | vty_out (vty, "%% Must supply max-med on-startup period and med value"); | |
1139 | return CMD_WARNING; | |
1140 | } | |
1141 | ||
1142 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1143 | VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]); | |
1144 | ||
1145 | bgp_maxmed_update(bgp); | |
1146 | ||
1147 | return CMD_SUCCESS; | |
1148 | } | |
1149 | ||
1150 | DEFUN (no_bgp_maxmed_onstartup, | |
1151 | no_bgp_maxmed_onstartup_cmd, | |
1152 | "no bgp max-med on-startup", | |
1153 | NO_STR | |
1154 | BGP_STR | |
1155 | "Advertise routes with max-med\n" | |
1156 | "Effective on a startup\n") | |
1157 | { | |
1158 | struct bgp *bgp; | |
1159 | ||
1160 | bgp = vty->index; | |
1161 | ||
1162 | /* Cancel max-med onstartup if its on */ | |
1163 | if (bgp->t_maxmed_onstartup) | |
1164 | { | |
1165 | THREAD_TIMER_OFF (bgp->t_maxmed_onstartup); | |
1166 | bgp->maxmed_onstartup_over = 1; | |
1167 | } | |
1168 | ||
1169 | bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED; | |
1170 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1171 | ||
1172 | bgp_maxmed_update(bgp); | |
1173 | ||
1174 | return CMD_SUCCESS; | |
1175 | } | |
1176 | ||
1177 | ALIAS (no_bgp_maxmed_onstartup, | |
1178 | no_bgp_maxmed_onstartup_period_cmd, | |
1179 | "no bgp max-med on-startup <5-86400>", | |
1180 | NO_STR | |
1181 | BGP_STR | |
1182 | "Advertise routes with max-med\n" | |
1183 | "Effective on a startup\n" | |
1184 | "Time (seconds) period for max-med\n") | |
1185 | ||
1186 | ALIAS (no_bgp_maxmed_onstartup, | |
1187 | no_bgp_maxmed_onstartup_period_medv_cmd, | |
1188 | "no bgp max-med on-startup <5-86400> <0-4294967294>", | |
1189 | NO_STR | |
1190 | BGP_STR | |
1191 | "Advertise routes with max-med\n" | |
1192 | "Effective on a startup\n" | |
1193 | "Time (seconds) period for max-med\n" | |
1194 | "Max MED value to be used\n") | |
1195 | ||
f188f2c4 DS |
1196 | static int |
1197 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
1198 | const char *wait) | |
1199 | { | |
1200 | struct bgp *bgp; | |
1201 | u_int16_t update_delay; | |
1202 | u_int16_t establish_wait; | |
1203 | ||
1204 | ||
1205 | bgp = vty->index; | |
1206 | ||
1207 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
1208 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
1209 | ||
1210 | if (!wait) /* update-delay <delay> */ | |
1211 | { | |
1212 | bgp->v_update_delay = update_delay; | |
1213 | bgp->v_establish_wait = bgp->v_update_delay; | |
1214 | return CMD_SUCCESS; | |
1215 | } | |
1216 | ||
1217 | /* update-delay <delay> <establish-wait> */ | |
1218 | establish_wait = atoi (wait); | |
1219 | if (update_delay < establish_wait) | |
1220 | { | |
1221 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
1222 | VTY_NEWLINE); | |
1223 | return CMD_WARNING; | |
1224 | } | |
1225 | ||
1226 | bgp->v_update_delay = update_delay; | |
1227 | bgp->v_establish_wait = establish_wait; | |
1228 | ||
1229 | return CMD_SUCCESS; | |
1230 | } | |
1231 | ||
1232 | static int | |
1233 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
1234 | { | |
1235 | struct bgp *bgp; | |
1236 | ||
1237 | bgp = vty->index; | |
1238 | ||
1239 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
1240 | bgp->v_establish_wait = bgp->v_update_delay; | |
1241 | ||
1242 | return CMD_SUCCESS; | |
1243 | } | |
1244 | ||
1245 | int | |
1246 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
1247 | { | |
1248 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
1249 | { | |
1250 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
1251 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
1252 | vty_out (vty, " %d", bgp->v_establish_wait); | |
1253 | vty_out (vty, "%s", VTY_NEWLINE); | |
1254 | } | |
1255 | ||
1256 | return 0; | |
1257 | } | |
1258 | ||
1259 | ||
1260 | /* Update-delay configuration */ | |
1261 | DEFUN (bgp_update_delay, | |
1262 | bgp_update_delay_cmd, | |
1263 | "update-delay <0-3600>", | |
1264 | "Force initial delay for best-path and updates\n" | |
1265 | "Seconds\n") | |
1266 | { | |
1267 | return bgp_update_delay_config_vty(vty, argv[0], NULL); | |
1268 | } | |
1269 | ||
1270 | DEFUN (bgp_update_delay_establish_wait, | |
1271 | bgp_update_delay_establish_wait_cmd, | |
1272 | "update-delay <0-3600> <1-3600>", | |
1273 | "Force initial delay for best-path and updates\n" | |
1274 | "Seconds\n" | |
1275 | "Wait for peers to be established\n" | |
1276 | "Seconds\n") | |
1277 | { | |
1278 | return bgp_update_delay_config_vty(vty, argv[0], argv[1]); | |
1279 | } | |
1280 | ||
1281 | /* Update-delay deconfiguration */ | |
1282 | DEFUN (no_bgp_update_delay, | |
1283 | no_bgp_update_delay_cmd, | |
1284 | "no update-delay <0-3600>", | |
1285 | "Force initial delay for best-path and updates\n" | |
1286 | "Seconds\n") | |
1287 | { | |
1288 | return bgp_update_delay_deconfig_vty(vty); | |
1289 | } | |
1290 | ||
1291 | ALIAS (no_bgp_update_delay, | |
1292 | no_bgp_update_delay_establish_wait_cmd, | |
1293 | "no update-delay <0-3600> <1-3600>", | |
1294 | "Force initial delay for best-path and updates\n" | |
1295 | "Seconds\n" | |
1296 | "Wait for peers to be established\n" | |
1297 | "Seconds\n") | |
5e242b0d | 1298 | |
ffd0c037 DS |
1299 | static int |
1300 | bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set) | |
cb1faec9 DS |
1301 | { |
1302 | struct bgp *bgp; | |
cb1faec9 DS |
1303 | |
1304 | bgp = vty->index; | |
1305 | ||
1306 | if (set) | |
1307 | VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num, | |
4543bbb4 | 1308 | 1, 10000); |
cb1faec9 DS |
1309 | else |
1310 | bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX; | |
1311 | ||
1312 | return CMD_SUCCESS; | |
1313 | } | |
1314 | ||
1315 | int | |
1316 | bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) | |
1317 | { | |
1318 | if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX) | |
1319 | vty_out (vty, " write-quanta %d%s", | |
1320 | bgp->wpkt_quanta, VTY_NEWLINE); | |
1321 | ||
1322 | return 0; | |
1323 | } | |
1324 | ||
1325 | ||
1326 | /* Update-delay configuration */ | |
1327 | DEFUN (bgp_wpkt_quanta, | |
1328 | bgp_wpkt_quanta_cmd, | |
4543bbb4 | 1329 | "write-quanta <1-10000>", |
cb1faec9 DS |
1330 | "How many packets to write to peer socket per run\n" |
1331 | "Number of packets\n") | |
1332 | { | |
1333 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 1); | |
1334 | } | |
1335 | ||
1336 | /* Update-delay deconfiguration */ | |
1337 | DEFUN (no_bgp_wpkt_quanta, | |
1338 | no_bgp_wpkt_quanta_cmd, | |
4543bbb4 | 1339 | "no write-quanta <1-10000>", |
cb1faec9 DS |
1340 | "How many packets to write to peer socket per run\n" |
1341 | "Number of packets\n") | |
1342 | { | |
1343 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); | |
1344 | } | |
1345 | ||
ffd0c037 | 1346 | static int |
3f9c7369 DS |
1347 | bgp_coalesce_config_vty (struct vty *vty, const char *num, char set) |
1348 | { | |
1349 | struct bgp *bgp; | |
1350 | ||
1351 | bgp = vty->index; | |
1352 | ||
1353 | if (set) | |
1354 | VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num, | |
1355 | 0, 4294967295); | |
1356 | else | |
1357 | bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; | |
1358 | ||
1359 | return CMD_SUCCESS; | |
1360 | } | |
1361 | ||
1362 | int | |
1363 | bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp) | |
1364 | { | |
1365 | if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME) | |
1366 | vty_out (vty, " coalesce-time %d%s", | |
1367 | bgp->coalesce_time, VTY_NEWLINE); | |
1368 | ||
1369 | return 0; | |
1370 | } | |
1371 | ||
1372 | ||
1373 | DEFUN (bgp_coalesce_time, | |
1374 | bgp_coalesce_time_cmd, | |
1375 | "coalesce-time <0-4294967295>", | |
1376 | "Subgroup coalesce timer\n" | |
1377 | "Subgroup coalesce timer value (in ms)\n") | |
1378 | { | |
1379 | return bgp_coalesce_config_vty(vty, argv[0], 1); | |
1380 | } | |
1381 | ||
1382 | DEFUN (no_bgp_coalesce_time, | |
1383 | no_bgp_coalesce_time_cmd, | |
1384 | "no coalesce-time <0-4294967295>", | |
1385 | "Subgroup coalesce timer\n" | |
1386 | "Subgroup coalesce timer value (in ms)\n") | |
1387 | { | |
1388 | return bgp_coalesce_config_vty(vty, argv[0], 0); | |
1389 | } | |
1390 | ||
5e242b0d DS |
1391 | /* Maximum-paths configuration */ |
1392 | DEFUN (bgp_maxpaths, | |
1393 | bgp_maxpaths_cmd, | |
a565fbdd | 1394 | "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), |
5e242b0d DS |
1395 | "Forward packets over multiple paths\n" |
1396 | "Number of paths\n") | |
1397 | { | |
1398 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); | |
1399 | } | |
1400 | ||
165b5fff JB |
1401 | DEFUN (bgp_maxpaths_ibgp, |
1402 | bgp_maxpaths_ibgp_cmd, | |
a565fbdd | 1403 | "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1404 | "Forward packets over multiple paths\n" |
1405 | "iBGP-multipath\n" | |
1406 | "Number of paths\n") | |
1407 | { | |
5e242b0d DS |
1408 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); |
1409 | } | |
165b5fff | 1410 | |
5e242b0d DS |
1411 | DEFUN (bgp_maxpaths_ibgp_cluster, |
1412 | bgp_maxpaths_ibgp_cluster_cmd, | |
a565fbdd | 1413 | "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", |
5e242b0d DS |
1414 | "Forward packets over multiple paths\n" |
1415 | "iBGP-multipath\n" | |
1416 | "Number of paths\n" | |
1417 | "Match the cluster length\n") | |
1418 | { | |
1419 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], | |
1420 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); | |
165b5fff JB |
1421 | } |
1422 | ||
1423 | DEFUN (no_bgp_maxpaths, | |
1424 | no_bgp_maxpaths_cmd, | |
1425 | "no maximum-paths", | |
1426 | NO_STR | |
1427 | "Forward packets over multiple paths\n" | |
1428 | "Number of paths\n") | |
1429 | { | |
5e242b0d | 1430 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
1431 | } |
1432 | ||
1433 | ALIAS (no_bgp_maxpaths, | |
1434 | no_bgp_maxpaths_arg_cmd, | |
a565fbdd | 1435 | "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1436 | NO_STR |
1437 | "Forward packets over multiple paths\n" | |
1438 | "Number of paths\n") | |
1439 | ||
1440 | DEFUN (no_bgp_maxpaths_ibgp, | |
1441 | no_bgp_maxpaths_ibgp_cmd, | |
1442 | "no maximum-paths ibgp", | |
1443 | NO_STR | |
1444 | "Forward packets over multiple paths\n" | |
1445 | "iBGP-multipath\n" | |
1446 | "Number of paths\n") | |
1447 | { | |
5e242b0d | 1448 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
1449 | } |
1450 | ||
1451 | ALIAS (no_bgp_maxpaths_ibgp, | |
1452 | no_bgp_maxpaths_ibgp_arg_cmd, | |
a565fbdd | 1453 | "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1454 | NO_STR |
1455 | "Forward packets over multiple paths\n" | |
1456 | "iBGP-multipath\n" | |
1457 | "Number of paths\n") | |
1458 | ||
5e242b0d DS |
1459 | ALIAS (no_bgp_maxpaths_ibgp, |
1460 | no_bgp_maxpaths_ibgp_cluster_cmd, | |
a565fbdd | 1461 | "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", |
5e242b0d DS |
1462 | NO_STR |
1463 | "Forward packets over multiple paths\n" | |
1464 | "iBGP-multipath\n" | |
1465 | "Number of paths\n" | |
1466 | "Match the cluster length\n") | |
1467 | ||
165b5fff JB |
1468 | int |
1469 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
1470 | safi_t safi, int *write) | |
1471 | { | |
d5b77cc2 | 1472 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != MULTIPATH_NUM) |
165b5fff JB |
1473 | { |
1474 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1475 | vty_out (vty, " maximum-paths %d%s", |
165b5fff JB |
1476 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); |
1477 | } | |
1478 | ||
d5b77cc2 | 1479 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != MULTIPATH_NUM) |
165b5fff JB |
1480 | { |
1481 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1482 | vty_out (vty, " maximum-paths ibgp %d", |
5e242b0d DS |
1483 | bgp->maxpaths[afi][safi].maxpaths_ibgp); |
1484 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
1485 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
1486 | vty_out (vty, " equal-cluster-length"); | |
1487 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
1488 | } |
1489 | ||
1490 | return 0; | |
1491 | } | |
6b0655a2 | 1492 | |
718e3744 | 1493 | /* BGP timers. */ |
1494 | ||
1495 | DEFUN (bgp_timers, | |
1496 | bgp_timers_cmd, | |
1497 | "timers bgp <0-65535> <0-65535>", | |
1498 | "Adjust routing timers\n" | |
1499 | "BGP timers\n" | |
1500 | "Keepalive interval\n" | |
1501 | "Holdtime\n") | |
1502 | { | |
1503 | struct bgp *bgp; | |
1504 | unsigned long keepalive = 0; | |
1505 | unsigned long holdtime = 0; | |
1506 | ||
1507 | bgp = vty->index; | |
1508 | ||
1509 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
1510 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
1511 | ||
1512 | /* Holdtime value check. */ | |
1513 | if (holdtime < 3 && holdtime != 0) | |
1514 | { | |
1515 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
1516 | VTY_NEWLINE); | |
1517 | return CMD_WARNING; | |
1518 | } | |
1519 | ||
1520 | bgp_timers_set (bgp, keepalive, holdtime); | |
1521 | ||
1522 | return CMD_SUCCESS; | |
1523 | } | |
1524 | ||
1525 | DEFUN (no_bgp_timers, | |
1526 | no_bgp_timers_cmd, | |
1527 | "no timers bgp", | |
1528 | NO_STR | |
1529 | "Adjust routing timers\n" | |
1530 | "BGP timers\n") | |
1531 | { | |
1532 | struct bgp *bgp; | |
1533 | ||
1534 | bgp = vty->index; | |
1535 | bgp_timers_unset (bgp); | |
1536 | ||
1537 | return CMD_SUCCESS; | |
1538 | } | |
1539 | ||
1540 | ALIAS (no_bgp_timers, | |
1541 | no_bgp_timers_arg_cmd, | |
1542 | "no timers bgp <0-65535> <0-65535>", | |
1543 | NO_STR | |
1544 | "Adjust routing timers\n" | |
1545 | "BGP timers\n" | |
1546 | "Keepalive interval\n" | |
1547 | "Holdtime\n") | |
6b0655a2 | 1548 | |
718e3744 | 1549 | DEFUN (bgp_client_to_client_reflection, |
1550 | bgp_client_to_client_reflection_cmd, | |
1551 | "bgp client-to-client reflection", | |
1552 | "BGP specific commands\n" | |
1553 | "Configure client to client route reflection\n" | |
1554 | "reflection of routes allowed\n") | |
1555 | { | |
1556 | struct bgp *bgp; | |
1557 | ||
1558 | bgp = vty->index; | |
1559 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
7aafcaca DS |
1560 | bgp_clear_star_soft_out (vty); |
1561 | ||
718e3744 | 1562 | return CMD_SUCCESS; |
1563 | } | |
1564 | ||
1565 | DEFUN (no_bgp_client_to_client_reflection, | |
1566 | no_bgp_client_to_client_reflection_cmd, | |
1567 | "no bgp client-to-client reflection", | |
1568 | NO_STR | |
1569 | "BGP specific commands\n" | |
1570 | "Configure client to client route reflection\n" | |
1571 | "reflection of routes allowed\n") | |
1572 | { | |
1573 | struct bgp *bgp; | |
1574 | ||
1575 | bgp = vty->index; | |
1576 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
7aafcaca DS |
1577 | bgp_clear_star_soft_out (vty); |
1578 | ||
718e3744 | 1579 | return CMD_SUCCESS; |
1580 | } | |
1581 | ||
1582 | /* "bgp always-compare-med" configuration. */ | |
1583 | DEFUN (bgp_always_compare_med, | |
1584 | bgp_always_compare_med_cmd, | |
1585 | "bgp always-compare-med", | |
1586 | "BGP specific commands\n" | |
1587 | "Allow comparing MED from different neighbors\n") | |
1588 | { | |
1589 | struct bgp *bgp; | |
1590 | ||
1591 | bgp = vty->index; | |
1592 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1593 | bgp_recalculate_all_bestpaths (bgp); |
1594 | ||
718e3744 | 1595 | return CMD_SUCCESS; |
1596 | } | |
1597 | ||
1598 | DEFUN (no_bgp_always_compare_med, | |
1599 | no_bgp_always_compare_med_cmd, | |
1600 | "no bgp always-compare-med", | |
1601 | NO_STR | |
1602 | "BGP specific commands\n" | |
1603 | "Allow comparing MED from different neighbors\n") | |
1604 | { | |
1605 | struct bgp *bgp; | |
1606 | ||
1607 | bgp = vty->index; | |
1608 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1609 | bgp_recalculate_all_bestpaths (bgp); |
1610 | ||
718e3744 | 1611 | return CMD_SUCCESS; |
1612 | } | |
6b0655a2 | 1613 | |
718e3744 | 1614 | /* "bgp deterministic-med" configuration. */ |
1615 | DEFUN (bgp_deterministic_med, | |
1616 | bgp_deterministic_med_cmd, | |
1617 | "bgp deterministic-med", | |
1618 | "BGP specific commands\n" | |
1619 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1620 | { | |
1621 | struct bgp *bgp; | |
1622 | ||
1623 | bgp = vty->index; | |
1475ac87 DW |
1624 | |
1625 | if (!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1626 | { | |
1627 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1628 | bgp_recalculate_all_bestpaths (bgp); | |
1629 | } | |
7aafcaca | 1630 | |
718e3744 | 1631 | return CMD_SUCCESS; |
1632 | } | |
1633 | ||
1634 | DEFUN (no_bgp_deterministic_med, | |
1635 | no_bgp_deterministic_med_cmd, | |
1636 | "no bgp deterministic-med", | |
1637 | NO_STR | |
1638 | "BGP specific commands\n" | |
1639 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1640 | { | |
1641 | struct bgp *bgp; | |
06370dac DW |
1642 | int bestpath_per_as_used; |
1643 | afi_t afi; | |
1644 | safi_t safi; | |
1645 | struct peer *peer; | |
1646 | struct listnode *node, *nnode; | |
718e3744 | 1647 | |
1648 | bgp = vty->index; | |
1475ac87 DW |
1649 | |
1650 | if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1651 | { | |
06370dac DW |
1652 | bestpath_per_as_used = 0; |
1653 | ||
1654 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
1655 | { | |
1656 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
1657 | for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) | |
1658 | if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) | |
1659 | { | |
1660 | bestpath_per_as_used = 1; | |
1661 | break; | |
1662 | } | |
1663 | ||
1664 | if (bestpath_per_as_used) | |
1665 | break; | |
1666 | } | |
1667 | ||
1668 | if (bestpath_per_as_used) | |
1669 | { | |
1670 | vty_out (vty, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s", | |
1671 | VTY_NEWLINE); | |
1672 | return CMD_WARNING; | |
1673 | } | |
1674 | else | |
1675 | { | |
1676 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1677 | bgp_recalculate_all_bestpaths (bgp); | |
1678 | } | |
1475ac87 | 1679 | } |
7aafcaca | 1680 | |
718e3744 | 1681 | return CMD_SUCCESS; |
1682 | } | |
538621f2 | 1683 | |
1684 | /* "bgp graceful-restart" configuration. */ | |
1685 | DEFUN (bgp_graceful_restart, | |
1686 | bgp_graceful_restart_cmd, | |
1687 | "bgp graceful-restart", | |
1688 | "BGP specific commands\n" | |
1689 | "Graceful restart capability parameters\n") | |
1690 | { | |
1691 | struct bgp *bgp; | |
1692 | ||
1693 | bgp = vty->index; | |
1694 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1695 | return CMD_SUCCESS; | |
1696 | } | |
1697 | ||
1698 | DEFUN (no_bgp_graceful_restart, | |
1699 | no_bgp_graceful_restart_cmd, | |
1700 | "no bgp graceful-restart", | |
1701 | NO_STR | |
1702 | "BGP specific commands\n" | |
1703 | "Graceful restart capability parameters\n") | |
1704 | { | |
1705 | struct bgp *bgp; | |
1706 | ||
1707 | bgp = vty->index; | |
1708 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1709 | return CMD_SUCCESS; | |
1710 | } | |
1711 | ||
93406d87 | 1712 | DEFUN (bgp_graceful_restart_stalepath_time, |
1713 | bgp_graceful_restart_stalepath_time_cmd, | |
1714 | "bgp graceful-restart stalepath-time <1-3600>", | |
1715 | "BGP specific commands\n" | |
1716 | "Graceful restart capability parameters\n" | |
1717 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1718 | "Delay value (seconds)\n") | |
1719 | { | |
1720 | struct bgp *bgp; | |
1721 | u_int32_t stalepath; | |
1722 | ||
1723 | bgp = vty->index; | |
1724 | if (! bgp) | |
1725 | return CMD_WARNING; | |
1726 | ||
1727 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
1728 | bgp->stalepath_time = stalepath; | |
1729 | return CMD_SUCCESS; | |
1730 | } | |
1731 | ||
1732 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
1733 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1734 | "no bgp graceful-restart stalepath-time", | |
1735 | NO_STR | |
1736 | "BGP specific commands\n" | |
1737 | "Graceful restart capability parameters\n" | |
1738 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1739 | { | |
1740 | struct bgp *bgp; | |
1741 | ||
1742 | bgp = vty->index; | |
1743 | if (! bgp) | |
1744 | return CMD_WARNING; | |
1745 | ||
1746 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1747 | return CMD_SUCCESS; | |
1748 | } | |
1749 | ||
1750 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
1751 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
1752 | "no bgp graceful-restart stalepath-time <1-3600>", | |
1753 | NO_STR | |
1754 | "BGP specific commands\n" | |
1755 | "Graceful restart capability parameters\n" | |
1756 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1757 | "Delay value (seconds)\n") | |
1758 | ||
718e3744 | 1759 | /* "bgp fast-external-failover" configuration. */ |
1760 | DEFUN (bgp_fast_external_failover, | |
1761 | bgp_fast_external_failover_cmd, | |
1762 | "bgp fast-external-failover", | |
1763 | BGP_STR | |
1764 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1765 | { | |
1766 | struct bgp *bgp; | |
1767 | ||
1768 | bgp = vty->index; | |
1769 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1770 | return CMD_SUCCESS; | |
1771 | } | |
1772 | ||
1773 | DEFUN (no_bgp_fast_external_failover, | |
1774 | no_bgp_fast_external_failover_cmd, | |
1775 | "no bgp fast-external-failover", | |
1776 | NO_STR | |
1777 | BGP_STR | |
1778 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1779 | { | |
1780 | struct bgp *bgp; | |
1781 | ||
1782 | bgp = vty->index; | |
1783 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1784 | return CMD_SUCCESS; | |
1785 | } | |
6b0655a2 | 1786 | |
718e3744 | 1787 | /* "bgp enforce-first-as" configuration. */ |
1788 | DEFUN (bgp_enforce_first_as, | |
1789 | bgp_enforce_first_as_cmd, | |
1790 | "bgp enforce-first-as", | |
1791 | BGP_STR | |
1792 | "Enforce the first AS for EBGP routes\n") | |
1793 | { | |
1794 | struct bgp *bgp; | |
1795 | ||
1796 | bgp = vty->index; | |
1797 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
7aafcaca DS |
1798 | bgp_clear_star_soft_in (vty); |
1799 | ||
718e3744 | 1800 | return CMD_SUCCESS; |
1801 | } | |
1802 | ||
1803 | DEFUN (no_bgp_enforce_first_as, | |
1804 | no_bgp_enforce_first_as_cmd, | |
1805 | "no bgp enforce-first-as", | |
1806 | NO_STR | |
1807 | BGP_STR | |
1808 | "Enforce the first AS for EBGP routes\n") | |
1809 | { | |
1810 | struct bgp *bgp; | |
1811 | ||
1812 | bgp = vty->index; | |
1813 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
7aafcaca DS |
1814 | bgp_clear_star_soft_in (vty); |
1815 | ||
718e3744 | 1816 | return CMD_SUCCESS; |
1817 | } | |
6b0655a2 | 1818 | |
718e3744 | 1819 | /* "bgp bestpath compare-routerid" configuration. */ |
1820 | DEFUN (bgp_bestpath_compare_router_id, | |
1821 | bgp_bestpath_compare_router_id_cmd, | |
1822 | "bgp bestpath compare-routerid", | |
1823 | "BGP specific commands\n" | |
1824 | "Change the default bestpath selection\n" | |
1825 | "Compare router-id for identical EBGP paths\n") | |
1826 | { | |
1827 | struct bgp *bgp; | |
1828 | ||
1829 | bgp = vty->index; | |
1830 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1831 | bgp_recalculate_all_bestpaths (bgp); |
1832 | ||
718e3744 | 1833 | return CMD_SUCCESS; |
1834 | } | |
1835 | ||
1836 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1837 | no_bgp_bestpath_compare_router_id_cmd, | |
1838 | "no bgp bestpath compare-routerid", | |
1839 | NO_STR | |
1840 | "BGP specific commands\n" | |
1841 | "Change the default bestpath selection\n" | |
1842 | "Compare router-id for identical EBGP paths\n") | |
1843 | { | |
1844 | struct bgp *bgp; | |
1845 | ||
1846 | bgp = vty->index; | |
1847 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1848 | bgp_recalculate_all_bestpaths (bgp); |
1849 | ||
718e3744 | 1850 | return CMD_SUCCESS; |
1851 | } | |
6b0655a2 | 1852 | |
718e3744 | 1853 | /* "bgp bestpath as-path ignore" configuration. */ |
1854 | DEFUN (bgp_bestpath_aspath_ignore, | |
1855 | bgp_bestpath_aspath_ignore_cmd, | |
1856 | "bgp bestpath as-path ignore", | |
1857 | "BGP specific commands\n" | |
1858 | "Change the default bestpath selection\n" | |
1859 | "AS-path attribute\n" | |
1860 | "Ignore as-path length in selecting a route\n") | |
1861 | { | |
1862 | struct bgp *bgp; | |
1863 | ||
1864 | bgp = vty->index; | |
1865 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1866 | bgp_recalculate_all_bestpaths (bgp); |
1867 | ||
718e3744 | 1868 | return CMD_SUCCESS; |
1869 | } | |
1870 | ||
1871 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
1872 | no_bgp_bestpath_aspath_ignore_cmd, | |
1873 | "no bgp bestpath as-path ignore", | |
1874 | NO_STR | |
1875 | "BGP specific commands\n" | |
1876 | "Change the default bestpath selection\n" | |
1877 | "AS-path attribute\n" | |
1878 | "Ignore as-path length in selecting a route\n") | |
1879 | { | |
1880 | struct bgp *bgp; | |
1881 | ||
1882 | bgp = vty->index; | |
1883 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1884 | bgp_recalculate_all_bestpaths (bgp); |
1885 | ||
718e3744 | 1886 | return CMD_SUCCESS; |
1887 | } | |
6b0655a2 | 1888 | |
6811845b | 1889 | /* "bgp bestpath as-path confed" configuration. */ |
1890 | DEFUN (bgp_bestpath_aspath_confed, | |
1891 | bgp_bestpath_aspath_confed_cmd, | |
1892 | "bgp bestpath as-path confed", | |
1893 | "BGP specific commands\n" | |
1894 | "Change the default bestpath selection\n" | |
1895 | "AS-path attribute\n" | |
1896 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1897 | { | |
1898 | struct bgp *bgp; | |
1899 | ||
1900 | bgp = vty->index; | |
1901 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1902 | bgp_recalculate_all_bestpaths (bgp); |
1903 | ||
6811845b | 1904 | return CMD_SUCCESS; |
1905 | } | |
1906 | ||
1907 | DEFUN (no_bgp_bestpath_aspath_confed, | |
1908 | no_bgp_bestpath_aspath_confed_cmd, | |
1909 | "no bgp bestpath as-path confed", | |
1910 | NO_STR | |
1911 | "BGP specific commands\n" | |
1912 | "Change the default bestpath selection\n" | |
1913 | "AS-path attribute\n" | |
1914 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1915 | { | |
1916 | struct bgp *bgp; | |
1917 | ||
1918 | bgp = vty->index; | |
1919 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1920 | bgp_recalculate_all_bestpaths (bgp); |
1921 | ||
6811845b | 1922 | return CMD_SUCCESS; |
1923 | } | |
6b0655a2 | 1924 | |
2fdd455c PM |
1925 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
1926 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
1927 | bgp_bestpath_aspath_multipath_relax_cmd, | |
219178b6 | 1928 | "bgp bestpath as-path multipath-relax {as-set|no-as-set}", |
16fc1eec DS |
1929 | "BGP specific commands\n" |
1930 | "Change the default bestpath selection\n" | |
1931 | "AS-path attribute\n" | |
1932 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
219178b6 | 1933 | "Generate an AS_SET\n" |
16fc1eec DS |
1934 | "Do not generate an AS_SET\n") |
1935 | { | |
1936 | struct bgp *bgp; | |
1937 | ||
1938 | bgp = vty->index; | |
1939 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
219178b6 DW |
1940 | |
1941 | /* no-as-set is now the default behavior so we can silently | |
1942 | * ignore it */ | |
1943 | if (argv[0] != NULL && strncmp (argv[0], "a", 1) == 0) | |
1944 | bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); | |
1945 | else | |
1946 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ; | |
1947 | ||
7aafcaca DS |
1948 | bgp_recalculate_all_bestpaths (bgp); |
1949 | ||
16fc1eec DS |
1950 | return CMD_SUCCESS; |
1951 | } | |
1952 | ||
219178b6 DW |
1953 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, |
1954 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
1955 | "no bgp bestpath as-path multipath-relax {as-set|no-as-set}", | |
16fc1eec DS |
1956 | NO_STR |
1957 | "BGP specific commands\n" | |
1958 | "Change the default bestpath selection\n" | |
1959 | "AS-path attribute\n" | |
1960 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
219178b6 | 1961 | "Generate an AS_SET\n" |
16fc1eec DS |
1962 | "Do not generate an AS_SET\n") |
1963 | { | |
1964 | struct bgp *bgp; | |
1965 | ||
1966 | bgp = vty->index; | |
1967 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
219178b6 | 1968 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); |
7aafcaca DS |
1969 | bgp_recalculate_all_bestpaths (bgp); |
1970 | ||
2fdd455c PM |
1971 | return CMD_SUCCESS; |
1972 | } | |
6b0655a2 | 1973 | |
848973c7 | 1974 | /* "bgp log-neighbor-changes" configuration. */ |
1975 | DEFUN (bgp_log_neighbor_changes, | |
1976 | bgp_log_neighbor_changes_cmd, | |
1977 | "bgp log-neighbor-changes", | |
1978 | "BGP specific commands\n" | |
1979 | "Log neighbor up/down and reset reason\n") | |
1980 | { | |
1981 | struct bgp *bgp; | |
1982 | ||
1983 | bgp = vty->index; | |
1984 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1985 | return CMD_SUCCESS; | |
1986 | } | |
1987 | ||
1988 | DEFUN (no_bgp_log_neighbor_changes, | |
1989 | no_bgp_log_neighbor_changes_cmd, | |
1990 | "no bgp log-neighbor-changes", | |
1991 | NO_STR | |
1992 | "BGP specific commands\n" | |
1993 | "Log neighbor up/down and reset reason\n") | |
1994 | { | |
1995 | struct bgp *bgp; | |
1996 | ||
1997 | bgp = vty->index; | |
1998 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1999 | return CMD_SUCCESS; | |
2000 | } | |
6b0655a2 | 2001 | |
718e3744 | 2002 | /* "bgp bestpath med" configuration. */ |
2003 | DEFUN (bgp_bestpath_med, | |
2004 | bgp_bestpath_med_cmd, | |
2005 | "bgp bestpath med (confed|missing-as-worst)", | |
2006 | "BGP specific commands\n" | |
2007 | "Change the default bestpath selection\n" | |
2008 | "MED attribute\n" | |
2009 | "Compare MED among confederation paths\n" | |
2010 | "Treat missing MED as the least preferred one\n") | |
2011 | { | |
2012 | struct bgp *bgp; | |
2013 | ||
2014 | bgp = vty->index; | |
2015 | ||
2016 | if (strncmp (argv[0], "confed", 1) == 0) | |
2017 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2018 | else | |
2019 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2020 | ||
7aafcaca DS |
2021 | bgp_recalculate_all_bestpaths (bgp); |
2022 | ||
718e3744 | 2023 | return CMD_SUCCESS; |
2024 | } | |
2025 | ||
2026 | DEFUN (bgp_bestpath_med2, | |
2027 | bgp_bestpath_med2_cmd, | |
2028 | "bgp bestpath med confed missing-as-worst", | |
2029 | "BGP specific commands\n" | |
2030 | "Change the default bestpath selection\n" | |
2031 | "MED attribute\n" | |
2032 | "Compare MED among confederation paths\n" | |
2033 | "Treat missing MED as the least preferred one\n") | |
2034 | { | |
2035 | struct bgp *bgp; | |
2036 | ||
2037 | bgp = vty->index; | |
2038 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2039 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2040 | bgp_recalculate_all_bestpaths (bgp); |
2041 | ||
718e3744 | 2042 | return CMD_SUCCESS; |
2043 | } | |
2044 | ||
2045 | ALIAS (bgp_bestpath_med2, | |
2046 | bgp_bestpath_med3_cmd, | |
2047 | "bgp bestpath med missing-as-worst confed", | |
2048 | "BGP specific commands\n" | |
2049 | "Change the default bestpath selection\n" | |
2050 | "MED attribute\n" | |
2051 | "Treat missing MED as the least preferred one\n" | |
2052 | "Compare MED among confederation paths\n") | |
2053 | ||
2054 | DEFUN (no_bgp_bestpath_med, | |
2055 | no_bgp_bestpath_med_cmd, | |
2056 | "no bgp bestpath med (confed|missing-as-worst)", | |
2057 | NO_STR | |
2058 | "BGP specific commands\n" | |
2059 | "Change the default bestpath selection\n" | |
2060 | "MED attribute\n" | |
2061 | "Compare MED among confederation paths\n" | |
2062 | "Treat missing MED as the least preferred one\n") | |
2063 | { | |
2064 | struct bgp *bgp; | |
2065 | ||
2066 | bgp = vty->index; | |
2067 | ||
2068 | if (strncmp (argv[0], "confed", 1) == 0) | |
2069 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2070 | else | |
2071 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2072 | ||
7aafcaca DS |
2073 | bgp_recalculate_all_bestpaths (bgp); |
2074 | ||
718e3744 | 2075 | return CMD_SUCCESS; |
2076 | } | |
2077 | ||
2078 | DEFUN (no_bgp_bestpath_med2, | |
2079 | no_bgp_bestpath_med2_cmd, | |
2080 | "no bgp bestpath med confed missing-as-worst", | |
2081 | NO_STR | |
2082 | "BGP specific commands\n" | |
2083 | "Change the default bestpath selection\n" | |
2084 | "MED attribute\n" | |
2085 | "Compare MED among confederation paths\n" | |
2086 | "Treat missing MED as the least preferred one\n") | |
2087 | { | |
2088 | struct bgp *bgp; | |
2089 | ||
2090 | bgp = vty->index; | |
2091 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2092 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2093 | bgp_recalculate_all_bestpaths (bgp); |
2094 | ||
718e3744 | 2095 | return CMD_SUCCESS; |
2096 | } | |
2097 | ||
2098 | ALIAS (no_bgp_bestpath_med2, | |
2099 | no_bgp_bestpath_med3_cmd, | |
2100 | "no bgp bestpath med missing-as-worst confed", | |
2101 | NO_STR | |
2102 | "BGP specific commands\n" | |
2103 | "Change the default bestpath selection\n" | |
2104 | "MED attribute\n" | |
2105 | "Treat missing MED as the least preferred one\n" | |
2106 | "Compare MED among confederation paths\n") | |
6b0655a2 | 2107 | |
718e3744 | 2108 | /* "no bgp default ipv4-unicast". */ |
2109 | DEFUN (no_bgp_default_ipv4_unicast, | |
2110 | no_bgp_default_ipv4_unicast_cmd, | |
2111 | "no bgp default ipv4-unicast", | |
2112 | NO_STR | |
2113 | "BGP specific commands\n" | |
2114 | "Configure BGP defaults\n" | |
2115 | "Activate ipv4-unicast for a peer by default\n") | |
2116 | { | |
2117 | struct bgp *bgp; | |
2118 | ||
2119 | bgp = vty->index; | |
2120 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2121 | return CMD_SUCCESS; | |
2122 | } | |
2123 | ||
2124 | DEFUN (bgp_default_ipv4_unicast, | |
2125 | bgp_default_ipv4_unicast_cmd, | |
2126 | "bgp default ipv4-unicast", | |
2127 | "BGP specific commands\n" | |
2128 | "Configure BGP defaults\n" | |
2129 | "Activate ipv4-unicast for a peer by default\n") | |
2130 | { | |
2131 | struct bgp *bgp; | |
2132 | ||
2133 | bgp = vty->index; | |
2134 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2135 | return CMD_SUCCESS; | |
2136 | } | |
6b0655a2 | 2137 | |
04b6bdc0 DW |
2138 | /* Display hostname in certain command outputs */ |
2139 | DEFUN (bgp_default_show_hostname, | |
2140 | bgp_default_show_hostname_cmd, | |
2141 | "bgp default show-hostname", | |
2142 | "BGP specific commands\n" | |
2143 | "Configure BGP defaults\n" | |
2144 | "Show hostname in certain command ouputs\n") | |
2145 | { | |
2146 | struct bgp *bgp; | |
2147 | ||
2148 | bgp = vty->index; | |
2149 | bgp_flag_set (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2150 | return CMD_SUCCESS; | |
2151 | } | |
2152 | ||
2153 | DEFUN (no_bgp_default_show_hostname, | |
2154 | no_bgp_default_show_hostname_cmd, | |
2155 | "no bgp default show-hostname", | |
2156 | NO_STR | |
2157 | "BGP specific commands\n" | |
2158 | "Configure BGP defaults\n" | |
2159 | "Show hostname in certain command ouputs\n") | |
2160 | { | |
2161 | struct bgp *bgp; | |
2162 | ||
2163 | bgp = vty->index; | |
2164 | bgp_flag_unset (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2165 | return CMD_SUCCESS; | |
2166 | } | |
2167 | ||
8233ef81 | 2168 | /* "bgp network import-check" configuration. */ |
718e3744 | 2169 | DEFUN (bgp_network_import_check, |
2170 | bgp_network_import_check_cmd, | |
5623e905 | 2171 | "bgp network import-check", |
718e3744 | 2172 | "BGP specific commands\n" |
2173 | "BGP network command\n" | |
5623e905 | 2174 | "Check BGP network route exists in IGP\n") |
718e3744 | 2175 | { |
2176 | struct bgp *bgp; | |
2177 | ||
2178 | bgp = vty->index; | |
078430f6 DS |
2179 | if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2180 | { | |
2181 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
5623e905 | 2182 | bgp_static_redo_import_check(bgp); |
078430f6 DS |
2183 | } |
2184 | ||
718e3744 | 2185 | return CMD_SUCCESS; |
2186 | } | |
2187 | ||
8233ef81 DW |
2188 | ALIAS_HIDDEN (bgp_network_import_check, |
2189 | bgp_network_import_check_exact_cmd, | |
2190 | "bgp network import-check exact", | |
2191 | "BGP specific commands\n" | |
2192 | "BGP network command\n" | |
2193 | "Check BGP network route exists in IGP\n" | |
2194 | "Match route precisely\n") | |
2195 | ||
718e3744 | 2196 | DEFUN (no_bgp_network_import_check, |
2197 | no_bgp_network_import_check_cmd, | |
5623e905 | 2198 | "no bgp network import-check", |
718e3744 | 2199 | NO_STR |
2200 | "BGP specific commands\n" | |
2201 | "BGP network command\n" | |
2202 | "Check BGP network route exists in IGP\n") | |
2203 | { | |
2204 | struct bgp *bgp; | |
2205 | ||
2206 | bgp = vty->index; | |
078430f6 DS |
2207 | if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2208 | { | |
2209 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
078430f6 DS |
2210 | bgp_static_redo_import_check(bgp); |
2211 | } | |
5623e905 | 2212 | |
718e3744 | 2213 | return CMD_SUCCESS; |
2214 | } | |
6b0655a2 | 2215 | |
718e3744 | 2216 | DEFUN (bgp_default_local_preference, |
2217 | bgp_default_local_preference_cmd, | |
2218 | "bgp default local-preference <0-4294967295>", | |
2219 | "BGP specific commands\n" | |
2220 | "Configure BGP defaults\n" | |
2221 | "local preference (higher=more preferred)\n" | |
2222 | "Configure default local preference value\n") | |
2223 | { | |
2224 | struct bgp *bgp; | |
2225 | u_int32_t local_pref; | |
2226 | ||
2227 | bgp = vty->index; | |
2228 | ||
2229 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
2230 | ||
2231 | bgp_default_local_preference_set (bgp, local_pref); | |
7aafcaca | 2232 | bgp_clear_star_soft_in (vty); |
718e3744 | 2233 | |
2234 | return CMD_SUCCESS; | |
2235 | } | |
2236 | ||
2237 | DEFUN (no_bgp_default_local_preference, | |
2238 | no_bgp_default_local_preference_cmd, | |
2239 | "no bgp default local-preference", | |
2240 | NO_STR | |
2241 | "BGP specific commands\n" | |
2242 | "Configure BGP defaults\n" | |
2243 | "local preference (higher=more preferred)\n") | |
2244 | { | |
2245 | struct bgp *bgp; | |
2246 | ||
2247 | bgp = vty->index; | |
2248 | bgp_default_local_preference_unset (bgp); | |
7aafcaca DS |
2249 | bgp_clear_star_soft_in (vty); |
2250 | ||
718e3744 | 2251 | return CMD_SUCCESS; |
2252 | } | |
2253 | ||
2254 | ALIAS (no_bgp_default_local_preference, | |
2255 | no_bgp_default_local_preference_val_cmd, | |
2256 | "no bgp default local-preference <0-4294967295>", | |
2257 | NO_STR | |
2258 | "BGP specific commands\n" | |
2259 | "Configure BGP defaults\n" | |
2260 | "local preference (higher=more preferred)\n" | |
2261 | "Configure default local preference value\n") | |
6b0655a2 | 2262 | |
3f9c7369 DS |
2263 | DEFUN (bgp_default_subgroup_pkt_queue_max, |
2264 | bgp_default_subgroup_pkt_queue_max_cmd, | |
2265 | "bgp default subgroup-pkt-queue-max <20-100>", | |
2266 | "BGP specific commands\n" | |
2267 | "Configure BGP defaults\n" | |
2268 | "subgroup-pkt-queue-max\n" | |
2269 | "Configure subgroup packet queue max\n") | |
8bd9d948 | 2270 | { |
3f9c7369 DS |
2271 | struct bgp *bgp; |
2272 | u_int32_t max_size; | |
8bd9d948 | 2273 | |
3f9c7369 DS |
2274 | bgp = vty->index; |
2275 | ||
2276 | VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]); | |
2277 | ||
2278 | bgp_default_subgroup_pkt_queue_max_set (bgp, max_size); | |
2279 | ||
2280 | return CMD_SUCCESS; | |
2281 | } | |
2282 | ||
2283 | DEFUN (no_bgp_default_subgroup_pkt_queue_max, | |
2284 | no_bgp_default_subgroup_pkt_queue_max_cmd, | |
2285 | "no bgp default subgroup-pkt-queue-max", | |
2286 | NO_STR | |
2287 | "BGP specific commands\n" | |
2288 | "Configure BGP defaults\n" | |
2289 | "subgroup-pkt-queue-max\n") | |
2290 | { | |
2291 | struct bgp *bgp; | |
2292 | ||
2293 | bgp = vty->index; | |
2294 | bgp_default_subgroup_pkt_queue_max_unset (bgp); | |
2295 | return CMD_SUCCESS; | |
8bd9d948 DS |
2296 | } |
2297 | ||
813d4307 DW |
2298 | ALIAS (no_bgp_default_subgroup_pkt_queue_max, |
2299 | no_bgp_default_subgroup_pkt_queue_max_val_cmd, | |
2300 | "no bgp default subgroup-pkt-queue-max <20-100>", | |
2301 | NO_STR | |
2302 | "BGP specific commands\n" | |
2303 | "Configure BGP defaults\n" | |
2304 | "subgroup-pkt-queue-max\n" | |
2305 | "Configure subgroup packet queue max\n") | |
2306 | ||
8bd9d948 DS |
2307 | DEFUN (bgp_rr_allow_outbound_policy, |
2308 | bgp_rr_allow_outbound_policy_cmd, | |
2309 | "bgp route-reflector allow-outbound-policy", | |
2310 | "BGP specific commands\n" | |
2311 | "Allow modifications made by out route-map\n" | |
2312 | "on ibgp neighbors\n") | |
2313 | { | |
2314 | struct bgp *bgp; | |
8bd9d948 DS |
2315 | |
2316 | bgp = vty->index; | |
2317 | ||
2318 | if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2319 | { | |
2320 | bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2321 | update_group_announce_rrclients(bgp); |
7aafcaca | 2322 | bgp_clear_star_soft_out (vty); |
8bd9d948 DS |
2323 | } |
2324 | ||
2325 | return CMD_SUCCESS; | |
2326 | } | |
2327 | ||
2328 | DEFUN (no_bgp_rr_allow_outbound_policy, | |
2329 | no_bgp_rr_allow_outbound_policy_cmd, | |
2330 | "no bgp route-reflector allow-outbound-policy", | |
2331 | NO_STR | |
2332 | "BGP specific commands\n" | |
2333 | "Allow modifications made by out route-map\n" | |
2334 | "on ibgp neighbors\n") | |
2335 | { | |
2336 | struct bgp *bgp; | |
8bd9d948 DS |
2337 | |
2338 | bgp = vty->index; | |
2339 | ||
2340 | if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2341 | { | |
2342 | bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2343 | update_group_announce_rrclients(bgp); |
7aafcaca | 2344 | bgp_clear_star_soft_out (vty); |
8bd9d948 DS |
2345 | } |
2346 | ||
2347 | return CMD_SUCCESS; | |
2348 | } | |
2349 | ||
f14e6fdb DS |
2350 | DEFUN (bgp_listen_limit, |
2351 | bgp_listen_limit_cmd, | |
2352 | "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2353 | "BGP specific commands\n" | |
2354 | "Configure BGP defaults\n" | |
2355 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2356 | "Configure Dynamic Neighbors listen limit value\n") | |
2357 | { | |
2358 | struct bgp *bgp; | |
2359 | int listen_limit; | |
2360 | ||
2361 | bgp = vty->index; | |
2362 | ||
2363 | VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0], | |
2364 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN, | |
2365 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX); | |
2366 | ||
2367 | bgp_listen_limit_set (bgp, listen_limit); | |
2368 | ||
2369 | return CMD_SUCCESS; | |
2370 | } | |
2371 | ||
2372 | DEFUN (no_bgp_listen_limit, | |
2373 | no_bgp_listen_limit_cmd, | |
2374 | "no bgp listen limit", | |
2375 | "BGP specific commands\n" | |
2376 | "Configure BGP defaults\n" | |
2377 | "unset maximum number of BGP Dynamic Neighbors that can be created\n" | |
2378 | "Configure Dynamic Neighbors listen limit value to default\n") | |
2379 | { | |
2380 | struct bgp *bgp; | |
2381 | ||
2382 | bgp = vty->index; | |
2383 | bgp_listen_limit_unset (bgp); | |
2384 | return CMD_SUCCESS; | |
2385 | } | |
2386 | ||
813d4307 DW |
2387 | ALIAS (no_bgp_listen_limit, |
2388 | no_bgp_listen_limit_val_cmd, | |
2389 | "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2390 | NO_STR | |
2391 | "BGP specific commands\n" | |
2392 | "Configure BGP defaults\n" | |
2393 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2394 | "Configure Dynamic Neighbors listen limit value\n") | |
f14e6fdb | 2395 | |
20eb8864 | 2396 | /* |
2397 | * Check if this listen range is already configured. Check for exact | |
2398 | * match or overlap based on input. | |
2399 | */ | |
2400 | static struct peer_group * | |
2401 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact) | |
2402 | { | |
2403 | struct listnode *node, *nnode; | |
2404 | struct listnode *node1, *nnode1; | |
2405 | struct peer_group *group; | |
2406 | struct prefix *lr; | |
2407 | afi_t afi; | |
2408 | int match; | |
2409 | ||
2410 | afi = family2afi(range->family); | |
2411 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2412 | { | |
2413 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node1, | |
2414 | nnode1, lr)) | |
2415 | { | |
2416 | if (exact) | |
2417 | match = prefix_same (range, lr); | |
2418 | else | |
2419 | match = (prefix_match (range, lr) || prefix_match (lr, range)); | |
2420 | if (match) | |
2421 | return group; | |
2422 | } | |
2423 | } | |
2424 | ||
2425 | return NULL; | |
2426 | } | |
2427 | ||
f14e6fdb DS |
2428 | DEFUN (bgp_listen_range, |
2429 | bgp_listen_range_cmd, | |
2430 | LISTEN_RANGE_CMD "peer-group WORD" , | |
2431 | "BGP specific commands\n" | |
2432 | "Configure BGP Dynamic Neighbors\n" | |
2433 | "add a listening range for Dynamic Neighbors\n" | |
2434 | LISTEN_RANGE_ADDR_STR) | |
2435 | { | |
2436 | struct bgp *bgp; | |
2437 | struct prefix range; | |
20eb8864 | 2438 | struct peer_group *group, *existing_group; |
f14e6fdb DS |
2439 | afi_t afi; |
2440 | int ret; | |
2441 | ||
2442 | bgp = vty->index; | |
2443 | ||
2444 | //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2445 | ||
2446 | /* Convert IP prefix string to struct prefix. */ | |
2447 | ret = str2prefix (argv[0], &range); | |
2448 | if (! ret) | |
2449 | { | |
2450 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2451 | return CMD_WARNING; | |
2452 | } | |
2453 | ||
2454 | afi = family2afi(range.family); | |
2455 | ||
2456 | #ifdef HAVE_IPV6 | |
2457 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2458 | { | |
2459 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2460 | VTY_NEWLINE); | |
2461 | return CMD_WARNING; | |
2462 | } | |
2463 | #endif /* HAVE_IPV6 */ | |
2464 | ||
2465 | apply_mask (&range); | |
2466 | ||
20eb8864 | 2467 | /* Check if same listen range is already configured. */ |
2468 | existing_group = listen_range_exists (bgp, &range, 1); | |
2469 | if (existing_group) | |
2470 | { | |
2471 | if (strcmp (existing_group->name, argv[1]) == 0) | |
2472 | return CMD_SUCCESS; | |
2473 | else | |
2474 | { | |
2475 | vty_out (vty, "%% Same listen range is attached to peer-group %s%s", | |
2476 | existing_group->name, VTY_NEWLINE); | |
2477 | return CMD_WARNING; | |
2478 | } | |
2479 | } | |
2480 | ||
2481 | /* Check if an overlapping listen range exists. */ | |
2482 | if (listen_range_exists (bgp, &range, 0)) | |
2483 | { | |
2484 | vty_out (vty, "%% Listen range overlaps with existing listen range%s", | |
2485 | VTY_NEWLINE); | |
2486 | return CMD_WARNING; | |
2487 | } | |
f14e6fdb DS |
2488 | |
2489 | group = peer_group_lookup (bgp, argv[1]); | |
2490 | if (! group) | |
2491 | { | |
2492 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2493 | return CMD_WARNING; | |
2494 | } | |
2495 | ||
2496 | ret = peer_group_listen_range_add(group, &range); | |
2497 | return bgp_vty_return (vty, ret); | |
2498 | } | |
2499 | ||
2500 | DEFUN (no_bgp_listen_range, | |
2501 | no_bgp_listen_range_cmd, | |
2502 | "no bgp listen range A.B.C.D/M peer-group WORD" , | |
2503 | "BGP specific commands\n" | |
2504 | "Configure BGP defaults\n" | |
2505 | "delete a listening range for Dynamic Neighbors\n" | |
2506 | "Remove Dynamic Neighbors listening range\n") | |
2507 | { | |
2508 | struct bgp *bgp; | |
2509 | struct prefix range; | |
2510 | struct peer_group *group; | |
2511 | afi_t afi; | |
2512 | int ret; | |
2513 | ||
2514 | bgp = vty->index; | |
2515 | ||
2516 | // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2517 | ||
2518 | /* Convert IP prefix string to struct prefix. */ | |
2519 | ret = str2prefix (argv[0], &range); | |
2520 | if (! ret) | |
2521 | { | |
2522 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2523 | return CMD_WARNING; | |
2524 | } | |
2525 | ||
2526 | afi = family2afi(range.family); | |
2527 | ||
2528 | #ifdef HAVE_IPV6 | |
2529 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2530 | { | |
2531 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2532 | VTY_NEWLINE); | |
2533 | return CMD_WARNING; | |
2534 | } | |
2535 | #endif /* HAVE_IPV6 */ | |
2536 | ||
2537 | apply_mask (&range); | |
2538 | ||
2539 | ||
2540 | group = peer_group_lookup (bgp, argv[1]); | |
2541 | if (! group) | |
2542 | { | |
2543 | vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); | |
2544 | return CMD_WARNING; | |
2545 | } | |
2546 | ||
2547 | ret = peer_group_listen_range_del(group, &range); | |
2548 | return bgp_vty_return (vty, ret); | |
2549 | } | |
2550 | ||
2551 | int | |
2552 | bgp_config_write_listen (struct vty *vty, struct bgp *bgp) | |
2553 | { | |
2554 | struct peer_group *group; | |
2555 | struct listnode *node, *nnode, *rnode, *nrnode; | |
2556 | struct prefix *range; | |
2557 | afi_t afi; | |
4690c7d7 | 2558 | char buf[PREFIX2STR_BUFFER]; |
f14e6fdb DS |
2559 | |
2560 | if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT) | |
2561 | vty_out (vty, " bgp listen limit %d%s", | |
2562 | bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
2563 | ||
2564 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2565 | { | |
2566 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
2567 | { | |
2568 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range)) | |
2569 | { | |
2570 | prefix2str(range, buf, sizeof(buf)); | |
2571 | vty_out(vty, " bgp listen range %s peer-group %s%s", | |
2572 | buf, group->name, VTY_NEWLINE); | |
2573 | } | |
2574 | } | |
2575 | } | |
2576 | ||
2577 | return 0; | |
2578 | } | |
2579 | ||
2580 | ||
907f92c8 DS |
2581 | DEFUN (bgp_disable_connected_route_check, |
2582 | bgp_disable_connected_route_check_cmd, | |
2583 | "bgp disable-ebgp-connected-route-check", | |
2584 | "BGP specific commands\n" | |
2585 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2586 | { | |
2587 | struct bgp *bgp; | |
2588 | ||
2589 | bgp = vty->index; | |
2590 | bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
7aafcaca DS |
2591 | bgp_clear_star_soft_in (vty); |
2592 | ||
907f92c8 DS |
2593 | return CMD_SUCCESS; |
2594 | } | |
2595 | ||
2596 | DEFUN (no_bgp_disable_connected_route_check, | |
2597 | no_bgp_disable_connected_route_check_cmd, | |
2598 | "no bgp disable-ebgp-connected-route-check", | |
2599 | NO_STR | |
2600 | "BGP specific commands\n" | |
2601 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2602 | { | |
2603 | struct bgp *bgp; | |
2604 | ||
2605 | bgp = vty->index; | |
2606 | bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
7aafcaca DS |
2607 | bgp_clear_star_soft_in (vty); |
2608 | ||
907f92c8 DS |
2609 | return CMD_SUCCESS; |
2610 | } | |
2611 | ||
2612 | ||
718e3744 | 2613 | static int |
fd79ac91 | 2614 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
2615 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 2616 | { |
2617 | int ret; | |
2618 | struct bgp *bgp; | |
2619 | as_t as; | |
0299c004 | 2620 | int as_type = AS_SPECIFIED; |
718e3744 | 2621 | union sockunion su; |
2622 | ||
2623 | bgp = vty->index; | |
2624 | ||
0299c004 DS |
2625 | if (strncmp(as_str, "internal", strlen("internal")) == 0) |
2626 | { | |
2627 | as = 0; | |
2628 | as_type = AS_INTERNAL; | |
2629 | } | |
2630 | else if (strncmp(as_str, "external", strlen("external")) == 0) | |
2631 | { | |
2632 | as = 0; | |
2633 | as_type = AS_EXTERNAL; | |
2634 | } | |
2635 | else | |
2636 | { | |
2637 | /* Get AS number. */ | |
2638 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); | |
2639 | } | |
718e3744 | 2640 | |
2641 | /* If peer is peer group, call proper function. */ | |
2642 | ret = str2sockunion (peer_str, &su); | |
2643 | if (ret < 0) | |
2644 | { | |
a80beece | 2645 | /* Check for peer by interface */ |
0299c004 | 2646 | ret = peer_remote_as (bgp, NULL, peer_str, &as, as_type, afi, safi); |
718e3744 | 2647 | if (ret < 0) |
a80beece | 2648 | { |
0299c004 | 2649 | ret = peer_group_remote_as (bgp, peer_str, &as, as_type); |
a80beece DS |
2650 | if (ret < 0) |
2651 | { | |
2652 | vty_out (vty, "%% Create the peer-group or interface first%s", | |
2653 | VTY_NEWLINE); | |
2654 | return CMD_WARNING; | |
2655 | } | |
2656 | return CMD_SUCCESS; | |
2657 | } | |
718e3744 | 2658 | } |
a80beece | 2659 | else |
718e3744 | 2660 | { |
6aeb9e78 | 2661 | if (peer_address_self_check (bgp, &su)) |
a80beece DS |
2662 | { |
2663 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2664 | VTY_NEWLINE); | |
2665 | return CMD_WARNING; | |
2666 | } | |
0299c004 | 2667 | ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi); |
718e3744 | 2668 | } |
2669 | ||
718e3744 | 2670 | /* This peer belongs to peer group. */ |
2671 | switch (ret) | |
2672 | { | |
2673 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 2674 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 2675 | return CMD_WARNING; |
718e3744 | 2676 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 2677 | 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 | 2678 | return CMD_WARNING; |
718e3744 | 2679 | } |
2680 | return bgp_vty_return (vty, ret); | |
2681 | } | |
2682 | ||
2683 | DEFUN (neighbor_remote_as, | |
2684 | neighbor_remote_as_cmd, | |
0299c004 | 2685 | NEIGHBOR_CMD2 "remote-as (" CMD_AS_RANGE "|external|internal)", |
718e3744 | 2686 | NEIGHBOR_STR |
2687 | NEIGHBOR_ADDR_STR2 | |
2688 | "Specify a BGP neighbor\n" | |
2689 | AS_STR) | |
2690 | { | |
2691 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
2692 | } | |
6b0655a2 | 2693 | |
4c48cf63 DW |
2694 | static int |
2695 | peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, | |
2696 | safi_t safi, int v6only, const char *peer_group_name) | |
a80beece | 2697 | { |
4c48cf63 | 2698 | as_t as; |
a80beece DS |
2699 | struct bgp *bgp; |
2700 | struct peer *peer; | |
2701 | struct peer_group *group; | |
4c48cf63 DW |
2702 | int ret = 0; |
2703 | union sockunion su; | |
a80beece DS |
2704 | |
2705 | bgp = vty->index; | |
4c48cf63 DW |
2706 | group = peer_group_lookup (bgp, conf_if); |
2707 | ||
a80beece DS |
2708 | if (group) |
2709 | { | |
2710 | vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE); | |
2711 | return CMD_WARNING; | |
2712 | } | |
2713 | ||
4c48cf63 DW |
2714 | peer = peer_lookup_by_conf_if (bgp, conf_if); |
2715 | if (!peer) | |
2716 | { | |
2717 | if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4) | |
2718 | && afi == AFI_IP && safi == SAFI_UNICAST) | |
f813b13b | 2719 | peer = peer_create (NULL, conf_if, bgp, bgp->as, 0, AS_UNSPECIFIED, 0, 0, NULL); |
4c48cf63 | 2720 | else |
f813b13b | 2721 | peer = peer_create (NULL, conf_if, bgp, bgp->as, 0, AS_UNSPECIFIED, afi, safi, NULL); |
4c48cf63 DW |
2722 | |
2723 | if (peer && v6only) | |
2724 | SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
4a04e5f7 | 2725 | |
2726 | /* Request zebra to initiate IPv6 RAs on this interface. We do this | |
2727 | * any unnumbered peer in order to not worry about run-time transitions | |
2728 | * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address | |
2729 | * gets deleted later etc.) | |
2730 | */ | |
2731 | if (peer->ifp) | |
2732 | bgp_zebra_initiate_radv (bgp, peer); | |
4c48cf63 DW |
2733 | } |
2734 | else if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) || | |
2735 | (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))) | |
2736 | { | |
2737 | if (v6only) | |
2738 | SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
2739 | else | |
2740 | UNSET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
2741 | ||
2742 | /* v6only flag changed. Reset bgp seesion */ | |
2743 | if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) | |
2744 | { | |
2745 | peer->last_reset = PEER_DOWN_V6ONLY_CHANGE; | |
2746 | bgp_notify_send (peer, BGP_NOTIFY_CEASE, | |
2747 | BGP_NOTIFY_CEASE_CONFIG_CHANGE); | |
2748 | } | |
2749 | else | |
2750 | bgp_session_reset(peer); | |
2751 | } | |
2752 | ||
a80beece DS |
2753 | if (!peer) |
2754 | return CMD_WARNING; | |
2755 | ||
4c48cf63 DW |
2756 | if (peer_group_name) |
2757 | { | |
2758 | group = peer_group_lookup (bgp, peer_group_name); | |
2759 | if (! group) | |
2760 | { | |
2761 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2762 | return CMD_WARNING; | |
2763 | } | |
2764 | ||
2765 | ret = peer_group_bind (bgp, &su, peer, group, &as); | |
2766 | } | |
2767 | ||
2768 | return bgp_vty_return (vty, ret); | |
a80beece DS |
2769 | } |
2770 | ||
4c48cf63 DW |
2771 | DEFUN (neighbor_interface_config, |
2772 | neighbor_interface_config_cmd, | |
2773 | "neighbor WORD interface", | |
2774 | NEIGHBOR_STR | |
2775 | "Interface name or neighbor tag\n" | |
2776 | "Enable BGP on interface\n") | |
2777 | { | |
2778 | if (argc == 2) | |
2779 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, argv[1]); | |
2780 | else | |
2781 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 0, NULL); | |
2782 | } | |
2783 | ||
2784 | ALIAS (neighbor_interface_config, | |
2785 | neighbor_interface_config_peergroup_cmd, | |
2786 | "neighbor WORD interface peer-group WORD", | |
2787 | NEIGHBOR_STR | |
2788 | "Interface name or neighbor tag\n" | |
2789 | "Enable BGP on interface\n" | |
2790 | "Member of the peer-group\n" | |
2791 | "peer-group name\n") | |
2792 | ||
2793 | DEFUN (neighbor_interface_config_v6only, | |
2794 | neighbor_interface_config_v6only_cmd, | |
2795 | "neighbor WORD interface v6only", | |
2796 | NEIGHBOR_STR | |
2797 | "Interface name or neighbor tag\n" | |
2798 | "Enable BGP on interface\n" | |
2799 | "Enable BGP with v6 link-local only\n") | |
2800 | { | |
2801 | if (argc == 2) | |
2802 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, argv[1]); | |
2803 | else | |
2804 | return peer_conf_interface_get (vty, argv[0], AFI_IP, SAFI_UNICAST, 1, NULL); | |
2805 | } | |
2806 | ||
2807 | ALIAS (neighbor_interface_config_v6only, | |
2808 | neighbor_interface_config_v6only_peergroup_cmd, | |
2809 | "neighbor WORD interface v6only peer-group WORD", | |
2810 | NEIGHBOR_STR | |
2811 | "Interface name or neighbor tag\n" | |
2812 | "Enable BGP on interface\n" | |
2813 | "Enable BGP with v6 link-local only\n" | |
2814 | "Member of the peer-group\n" | |
2815 | "peer-group name\n") | |
a80beece | 2816 | |
718e3744 | 2817 | DEFUN (neighbor_peer_group, |
2818 | neighbor_peer_group_cmd, | |
2819 | "neighbor WORD peer-group", | |
2820 | NEIGHBOR_STR | |
a80beece | 2821 | "Interface name or neighbor tag\n" |
718e3744 | 2822 | "Configure peer-group\n") |
2823 | { | |
2824 | struct bgp *bgp; | |
a80beece | 2825 | struct peer *peer; |
718e3744 | 2826 | struct peer_group *group; |
2827 | ||
2828 | bgp = vty->index; | |
a80beece DS |
2829 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2830 | if (peer) | |
2831 | { | |
2832 | vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); | |
2833 | return CMD_WARNING; | |
2834 | } | |
718e3744 | 2835 | |
2836 | group = peer_group_get (bgp, argv[0]); | |
2837 | if (! group) | |
2838 | return CMD_WARNING; | |
2839 | ||
2840 | return CMD_SUCCESS; | |
2841 | } | |
2842 | ||
2843 | DEFUN (no_neighbor, | |
2844 | no_neighbor_cmd, | |
2845 | NO_NEIGHBOR_CMD2, | |
2846 | NO_STR | |
2847 | NEIGHBOR_STR | |
2848 | NEIGHBOR_ADDR_STR2) | |
2849 | { | |
2850 | int ret; | |
2851 | union sockunion su; | |
2852 | struct peer_group *group; | |
2853 | struct peer *peer; | |
1ff9a340 | 2854 | struct peer *other; |
718e3744 | 2855 | |
2856 | ret = str2sockunion (argv[0], &su); | |
2857 | if (ret < 0) | |
2858 | { | |
a80beece DS |
2859 | /* look up for neighbor by interface name config. */ |
2860 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2861 | if (peer) | |
2862 | { | |
4a04e5f7 | 2863 | /* Request zebra to terminate IPv6 RAs on this interface. */ |
2864 | if (peer->ifp) | |
2865 | bgp_zebra_terminate_radv (peer->bgp, peer); | |
a80beece DS |
2866 | peer_delete (peer); |
2867 | return CMD_SUCCESS; | |
2868 | } | |
2869 | ||
718e3744 | 2870 | group = peer_group_lookup (vty->index, argv[0]); |
2871 | if (group) | |
2872 | peer_group_delete (group); | |
2873 | else | |
2874 | { | |
2875 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2876 | return CMD_WARNING; | |
2877 | } | |
2878 | } | |
2879 | else | |
2880 | { | |
2881 | peer = peer_lookup (vty->index, &su); | |
2882 | if (peer) | |
1ff9a340 | 2883 | { |
f14e6fdb DS |
2884 | if (peer_dynamic_neighbor (peer)) |
2885 | { | |
2886 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
2887 | VTY_NEWLINE); | |
2888 | return CMD_WARNING; | |
2889 | } | |
2890 | ||
1ff9a340 DS |
2891 | other = peer->doppelganger; |
2892 | peer_delete (peer); | |
2893 | if (other && other->status != Deleted) | |
2894 | peer_delete(other); | |
2895 | } | |
718e3744 | 2896 | } |
2897 | ||
2898 | return CMD_SUCCESS; | |
2899 | } | |
2900 | ||
2901 | ALIAS (no_neighbor, | |
2902 | no_neighbor_remote_as_cmd, | |
0299c004 | 2903 | NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 2904 | NO_STR |
2905 | NEIGHBOR_STR | |
2906 | NEIGHBOR_ADDR_STR | |
2907 | "Specify a BGP neighbor\n" | |
2908 | AS_STR) | |
2909 | ||
a80beece DS |
2910 | DEFUN (no_neighbor_interface_config, |
2911 | no_neighbor_interface_config_cmd, | |
4c48cf63 | 2912 | "no neighbor WORD interface", |
a80beece DS |
2913 | NO_STR |
2914 | NEIGHBOR_STR | |
2915 | "Interface name\n" | |
2916 | "Configure BGP on interface\n") | |
2917 | { | |
2918 | struct peer *peer; | |
2919 | ||
2920 | /* look up for neighbor by interface name config. */ | |
2921 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2922 | if (peer) | |
2923 | { | |
4a04e5f7 | 2924 | /* Request zebra to terminate IPv6 RAs on this interface. */ |
2925 | if (peer->ifp) | |
2926 | bgp_zebra_terminate_radv (peer->bgp, peer); | |
a80beece DS |
2927 | peer_delete (peer); |
2928 | } | |
2929 | else | |
2930 | { | |
2931 | vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE); | |
2932 | return CMD_WARNING; | |
2933 | } | |
2934 | return CMD_SUCCESS; | |
2935 | } | |
2936 | ||
4c48cf63 DW |
2937 | ALIAS (no_neighbor_interface_config, |
2938 | no_neighbor_interface_config_peergroup_cmd, | |
2939 | "no neighbor WORD interface peer-group WORD", | |
2940 | NO_STR | |
2941 | NEIGHBOR_STR | |
2942 | "Interface name\n" | |
2943 | "Configure BGP on interface\n" | |
2944 | "Member of the peer-group\n" | |
2945 | "peer-group name\n") | |
2946 | ||
2947 | ALIAS (no_neighbor_interface_config, | |
2948 | no_neighbor_interface_config_v6only_cmd, | |
2949 | "no neighbor WORD interface v6only", | |
2950 | NO_STR | |
2951 | NEIGHBOR_STR | |
2952 | "Interface name\n" | |
2953 | "Configure BGP on interface\n" | |
2954 | "Enable BGP with v6 link-local only\n") | |
2955 | ||
2956 | ALIAS (no_neighbor_interface_config, | |
2957 | no_neighbor_interface_config_v6only_peergroup_cmd, | |
2958 | "no neighbor WORD interface v6only peer-group WORD", | |
2959 | NO_STR | |
2960 | NEIGHBOR_STR | |
2961 | "Interface name\n" | |
2962 | "Configure BGP on interface\n" | |
2963 | "Enable BGP with v6 link-local only\n" | |
2964 | "Member of the peer-group\n" | |
2965 | "peer-group name\n") | |
2966 | ||
2967 | ||
718e3744 | 2968 | DEFUN (no_neighbor_peer_group, |
2969 | no_neighbor_peer_group_cmd, | |
2970 | "no neighbor WORD peer-group", | |
2971 | NO_STR | |
2972 | NEIGHBOR_STR | |
2973 | "Neighbor tag\n" | |
2974 | "Configure peer-group\n") | |
2975 | { | |
2976 | struct peer_group *group; | |
2977 | ||
2978 | group = peer_group_lookup (vty->index, argv[0]); | |
2979 | if (group) | |
2980 | peer_group_delete (group); | |
2981 | else | |
2982 | { | |
2983 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2984 | return CMD_WARNING; | |
2985 | } | |
2986 | return CMD_SUCCESS; | |
2987 | } | |
2988 | ||
a80beece DS |
2989 | DEFUN (no_neighbor_interface_peer_group_remote_as, |
2990 | no_neighbor_interface_peer_group_remote_as_cmd, | |
0299c004 | 2991 | "no neighbor WORD remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 2992 | NO_STR |
2993 | NEIGHBOR_STR | |
a80beece | 2994 | "Interface name or neighbor tag\n" |
718e3744 | 2995 | "Specify a BGP neighbor\n" |
2996 | AS_STR) | |
2997 | { | |
2998 | struct peer_group *group; | |
a80beece DS |
2999 | struct peer *peer; |
3000 | ||
3001 | /* look up for neighbor by interface name config. */ | |
3002 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
3003 | if (peer) | |
3004 | { | |
0299c004 | 3005 | peer_as_change (peer, 0, AS_SPECIFIED); |
a80beece DS |
3006 | return CMD_SUCCESS; |
3007 | } | |
718e3744 | 3008 | |
3009 | group = peer_group_lookup (vty->index, argv[0]); | |
3010 | if (group) | |
3011 | peer_group_remote_as_delete (group); | |
3012 | else | |
3013 | { | |
a80beece | 3014 | vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE); |
718e3744 | 3015 | return CMD_WARNING; |
3016 | } | |
3017 | return CMD_SUCCESS; | |
3018 | } | |
6b0655a2 | 3019 | |
718e3744 | 3020 | DEFUN (neighbor_local_as, |
3021 | neighbor_local_as_cmd, | |
320da874 | 3022 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 3023 | NEIGHBOR_STR |
3024 | NEIGHBOR_ADDR_STR2 | |
3025 | "Specify a local-as number\n" | |
3026 | "AS number used as local AS\n") | |
3027 | { | |
3028 | struct peer *peer; | |
3029 | int ret; | |
3030 | ||
3031 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3032 | if (! peer) | |
3033 | return CMD_WARNING; | |
3034 | ||
9d3f9705 | 3035 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
718e3744 | 3036 | return bgp_vty_return (vty, ret); |
3037 | } | |
3038 | ||
3039 | DEFUN (neighbor_local_as_no_prepend, | |
3040 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 3041 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 3042 | NEIGHBOR_STR |
3043 | NEIGHBOR_ADDR_STR2 | |
3044 | "Specify a local-as number\n" | |
3045 | "AS number used as local AS\n" | |
3046 | "Do not prepend local-as to updates from ebgp peers\n") | |
3047 | { | |
3048 | struct peer *peer; | |
3049 | int ret; | |
3050 | ||
3051 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3052 | if (! peer) | |
3053 | return CMD_WARNING; | |
3054 | ||
9d3f9705 | 3055 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
718e3744 | 3056 | return bgp_vty_return (vty, ret); |
3057 | } | |
3058 | ||
9d3f9705 AC |
3059 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
3060 | neighbor_local_as_no_prepend_replace_as_cmd, | |
3061 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
3062 | NEIGHBOR_STR | |
3063 | NEIGHBOR_ADDR_STR2 | |
3064 | "Specify a local-as number\n" | |
3065 | "AS number used as local AS\n" | |
3066 | "Do not prepend local-as to updates from ebgp peers\n" | |
3067 | "Do not prepend local-as to updates from ibgp peers\n") | |
3068 | { | |
3069 | struct peer *peer; | |
3070 | int ret; | |
3071 | ||
3072 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3073 | if (! peer) | |
3074 | return CMD_WARNING; | |
3075 | ||
3076 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); | |
3077 | return bgp_vty_return (vty, ret); | |
3078 | } | |
3079 | ||
3080 | ||
718e3744 | 3081 | DEFUN (no_neighbor_local_as, |
3082 | no_neighbor_local_as_cmd, | |
3083 | NO_NEIGHBOR_CMD2 "local-as", | |
3084 | NO_STR | |
3085 | NEIGHBOR_STR | |
3086 | NEIGHBOR_ADDR_STR2 | |
3087 | "Specify a local-as number\n") | |
3088 | { | |
3089 | struct peer *peer; | |
3090 | int ret; | |
3091 | ||
3092 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3093 | if (! peer) | |
3094 | return CMD_WARNING; | |
3095 | ||
3096 | ret = peer_local_as_unset (peer); | |
3097 | return bgp_vty_return (vty, ret); | |
3098 | } | |
3099 | ||
3100 | ALIAS (no_neighbor_local_as, | |
3101 | no_neighbor_local_as_val_cmd, | |
320da874 | 3102 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 3103 | NO_STR |
3104 | NEIGHBOR_STR | |
3105 | NEIGHBOR_ADDR_STR2 | |
3106 | "Specify a local-as number\n" | |
3107 | "AS number used as local AS\n") | |
3108 | ||
3109 | ALIAS (no_neighbor_local_as, | |
3110 | no_neighbor_local_as_val2_cmd, | |
320da874 | 3111 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 3112 | NO_STR |
3113 | NEIGHBOR_STR | |
3114 | NEIGHBOR_ADDR_STR2 | |
3115 | "Specify a local-as number\n" | |
3116 | "AS number used as local AS\n" | |
3117 | "Do not prepend local-as to updates from ebgp peers\n") | |
9d3f9705 AC |
3118 | |
3119 | ALIAS (no_neighbor_local_as, | |
3120 | no_neighbor_local_as_val3_cmd, | |
3121 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
3122 | NO_STR | |
3123 | NEIGHBOR_STR | |
3124 | NEIGHBOR_ADDR_STR2 | |
3125 | "Specify a local-as number\n" | |
3126 | "AS number used as local AS\n" | |
3127 | "Do not prepend local-as to updates from ebgp peers\n" | |
3128 | "Do not prepend local-as to updates from ibgp peers\n") | |
6b0655a2 | 3129 | |
3f9c7369 DS |
3130 | DEFUN (neighbor_solo, |
3131 | neighbor_solo_cmd, | |
3132 | NEIGHBOR_CMD2 "solo", | |
3133 | NEIGHBOR_STR | |
3134 | NEIGHBOR_ADDR_STR2 | |
3135 | "Solo peer - part of its own update group\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 | ||
3144 | ret = update_group_adjust_soloness(peer, 1); | |
3145 | return bgp_vty_return (vty, ret); | |
3146 | } | |
3147 | ||
3148 | DEFUN (no_neighbor_solo, | |
3149 | no_neighbor_solo_cmd, | |
3150 | NO_NEIGHBOR_CMD2 "solo", | |
3151 | NO_STR | |
3152 | NEIGHBOR_STR | |
3153 | NEIGHBOR_ADDR_STR2 | |
3154 | "Solo peer - part of its own update group\n") | |
3155 | { | |
3156 | struct peer *peer; | |
3157 | int ret; | |
3158 | ||
3159 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3160 | if (! peer) | |
3161 | return CMD_WARNING; | |
3162 | ||
3163 | ret = update_group_adjust_soloness(peer, 0); | |
3164 | return bgp_vty_return (vty, ret); | |
3165 | } | |
3166 | ||
0df7c91f PJ |
3167 | DEFUN (neighbor_password, |
3168 | neighbor_password_cmd, | |
3169 | NEIGHBOR_CMD2 "password LINE", | |
3170 | NEIGHBOR_STR | |
3171 | NEIGHBOR_ADDR_STR2 | |
3172 | "Set a password\n" | |
3173 | "The password\n") | |
3174 | { | |
3175 | struct peer *peer; | |
3176 | int ret; | |
3177 | ||
3178 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3179 | if (! peer) | |
3180 | return CMD_WARNING; | |
3181 | ||
3182 | ret = peer_password_set (peer, argv[1]); | |
3183 | return bgp_vty_return (vty, ret); | |
3184 | } | |
3185 | ||
3186 | DEFUN (no_neighbor_password, | |
3187 | no_neighbor_password_cmd, | |
3188 | NO_NEIGHBOR_CMD2 "password", | |
3189 | NO_STR | |
3190 | NEIGHBOR_STR | |
3191 | NEIGHBOR_ADDR_STR2 | |
3192 | "Set a password\n") | |
3193 | { | |
3194 | struct peer *peer; | |
3195 | int ret; | |
3196 | ||
3197 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3198 | if (! peer) | |
3199 | return CMD_WARNING; | |
3200 | ||
3201 | ret = peer_password_unset (peer); | |
3202 | return bgp_vty_return (vty, ret); | |
3203 | } | |
6b0655a2 | 3204 | |
813d4307 DW |
3205 | ALIAS (no_neighbor_password, |
3206 | no_neighbor_password_val_cmd, | |
3207 | NO_NEIGHBOR_CMD2 "password LINE", | |
3208 | NO_STR | |
3209 | NEIGHBOR_STR | |
3210 | NEIGHBOR_ADDR_STR2 | |
3211 | "Set a password\n" | |
3212 | "The password\n") | |
3213 | ||
718e3744 | 3214 | DEFUN (neighbor_activate, |
3215 | neighbor_activate_cmd, | |
3216 | NEIGHBOR_CMD2 "activate", | |
3217 | NEIGHBOR_STR | |
3218 | NEIGHBOR_ADDR_STR2 | |
3219 | "Enable the Address Family for this Neighbor\n") | |
3220 | { | |
c8560b44 | 3221 | int ret; |
718e3744 | 3222 | struct peer *peer; |
3223 | ||
3224 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3225 | if (! peer) | |
3226 | return CMD_WARNING; | |
3227 | ||
c8560b44 | 3228 | ret = peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
718e3744 | 3229 | |
c8560b44 DW |
3230 | if (ret) |
3231 | return CMD_WARNING; | |
718e3744 | 3232 | return CMD_SUCCESS; |
3233 | } | |
3234 | ||
3235 | DEFUN (no_neighbor_activate, | |
3236 | no_neighbor_activate_cmd, | |
3237 | NO_NEIGHBOR_CMD2 "activate", | |
3238 | NO_STR | |
3239 | NEIGHBOR_STR | |
3240 | NEIGHBOR_ADDR_STR2 | |
3241 | "Enable the Address Family for this Neighbor\n") | |
3242 | { | |
3243 | int ret; | |
3244 | struct peer *peer; | |
3245 | ||
3246 | /* Lookup peer. */ | |
3247 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3248 | if (! peer) | |
3249 | return CMD_WARNING; | |
3250 | ||
3251 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
3252 | ||
c8560b44 DW |
3253 | if (ret) |
3254 | return CMD_WARNING; | |
3255 | return CMD_SUCCESS; | |
718e3744 | 3256 | } |
6b0655a2 | 3257 | |
718e3744 | 3258 | DEFUN (neighbor_set_peer_group, |
3259 | neighbor_set_peer_group_cmd, | |
a80beece | 3260 | NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3261 | NEIGHBOR_STR |
a80beece | 3262 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3263 | "Member of the peer-group\n" |
3264 | "peer-group name\n") | |
3265 | { | |
3266 | int ret; | |
3267 | as_t as; | |
3268 | union sockunion su; | |
3269 | struct bgp *bgp; | |
a80beece | 3270 | struct peer *peer; |
718e3744 | 3271 | struct peer_group *group; |
3272 | ||
3273 | bgp = vty->index; | |
a80beece | 3274 | peer = NULL; |
718e3744 | 3275 | |
3276 | ret = str2sockunion (argv[0], &su); | |
3277 | if (ret < 0) | |
3278 | { | |
a80beece DS |
3279 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
3280 | if (!peer) | |
3281 | { | |
3282 | vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); | |
3283 | return CMD_WARNING; | |
3284 | } | |
3285 | } | |
3286 | else | |
3287 | { | |
6aeb9e78 | 3288 | if (peer_address_self_check (bgp, &su)) |
a80beece DS |
3289 | { |
3290 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
3291 | VTY_NEWLINE); | |
3292 | return CMD_WARNING; | |
3293 | } | |
f14e6fdb DS |
3294 | |
3295 | /* Disallow for dynamic neighbor. */ | |
3296 | peer = peer_lookup (bgp, &su); | |
3297 | if (peer && peer_dynamic_neighbor (peer)) | |
3298 | { | |
3299 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
3300 | VTY_NEWLINE); | |
3301 | return CMD_WARNING; | |
3302 | } | |
718e3744 | 3303 | } |
3304 | ||
3305 | group = peer_group_lookup (bgp, argv[1]); | |
3306 | if (! group) | |
3307 | { | |
3308 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3309 | return CMD_WARNING; | |
3310 | } | |
3311 | ||
c8560b44 | 3312 | ret = peer_group_bind (bgp, &su, peer, group, &as); |
718e3744 | 3313 | |
3314 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
3315 | { | |
aea339f7 | 3316 | 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 | 3317 | return CMD_WARNING; |
3318 | } | |
3319 | ||
3320 | return bgp_vty_return (vty, ret); | |
3321 | } | |
3322 | ||
3323 | DEFUN (no_neighbor_set_peer_group, | |
3324 | no_neighbor_set_peer_group_cmd, | |
a80beece | 3325 | NO_NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3326 | NO_STR |
3327 | NEIGHBOR_STR | |
a80beece | 3328 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3329 | "Member of the peer-group\n" |
3330 | "peer-group name\n") | |
3331 | { | |
3332 | int ret; | |
3333 | struct bgp *bgp; | |
3334 | struct peer *peer; | |
3335 | struct peer_group *group; | |
3336 | ||
3337 | bgp = vty->index; | |
3338 | ||
3339 | peer = peer_lookup_vty (vty, argv[0]); | |
3340 | if (! peer) | |
3341 | return CMD_WARNING; | |
3342 | ||
3343 | group = peer_group_lookup (bgp, argv[1]); | |
3344 | if (! group) | |
3345 | { | |
3346 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3347 | return CMD_WARNING; | |
3348 | } | |
3349 | ||
c8560b44 | 3350 | ret = peer_group_unbind (bgp, peer, group); |
718e3744 | 3351 | |
3352 | return bgp_vty_return (vty, ret); | |
3353 | } | |
6b0655a2 | 3354 | |
94f2b392 | 3355 | static int |
fd79ac91 | 3356 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
3357 | u_int16_t flag, int set) | |
718e3744 | 3358 | { |
3359 | int ret; | |
3360 | struct peer *peer; | |
3361 | ||
3362 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3363 | if (! peer) | |
3364 | return CMD_WARNING; | |
3365 | ||
3366 | if (set) | |
3367 | ret = peer_flag_set (peer, flag); | |
3368 | else | |
3369 | ret = peer_flag_unset (peer, flag); | |
3370 | ||
3371 | return bgp_vty_return (vty, ret); | |
3372 | } | |
3373 | ||
94f2b392 | 3374 | static int |
fd79ac91 | 3375 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3376 | { |
3377 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
3378 | } | |
3379 | ||
94f2b392 | 3380 | static int |
fd79ac91 | 3381 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3382 | { |
3383 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
3384 | } | |
3385 | ||
3386 | /* neighbor passive. */ | |
3387 | DEFUN (neighbor_passive, | |
3388 | neighbor_passive_cmd, | |
3389 | NEIGHBOR_CMD2 "passive", | |
3390 | NEIGHBOR_STR | |
3391 | NEIGHBOR_ADDR_STR2 | |
3392 | "Don't send open messages to this neighbor\n") | |
3393 | { | |
3394 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3395 | } | |
3396 | ||
3397 | DEFUN (no_neighbor_passive, | |
3398 | no_neighbor_passive_cmd, | |
3399 | NO_NEIGHBOR_CMD2 "passive", | |
3400 | NO_STR | |
3401 | NEIGHBOR_STR | |
3402 | NEIGHBOR_ADDR_STR2 | |
3403 | "Don't send open messages to this neighbor\n") | |
3404 | { | |
3405 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3406 | } | |
6b0655a2 | 3407 | |
718e3744 | 3408 | /* neighbor shutdown. */ |
3409 | DEFUN (neighbor_shutdown, | |
3410 | neighbor_shutdown_cmd, | |
3411 | NEIGHBOR_CMD2 "shutdown", | |
3412 | NEIGHBOR_STR | |
3413 | NEIGHBOR_ADDR_STR2 | |
3414 | "Administratively shut down this neighbor\n") | |
3415 | { | |
3416 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3417 | } | |
3418 | ||
3419 | DEFUN (no_neighbor_shutdown, | |
3420 | no_neighbor_shutdown_cmd, | |
3421 | NO_NEIGHBOR_CMD2 "shutdown", | |
3422 | NO_STR | |
3423 | NEIGHBOR_STR | |
3424 | NEIGHBOR_ADDR_STR2 | |
3425 | "Administratively shut down this neighbor\n") | |
3426 | { | |
3427 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3428 | } | |
6b0655a2 | 3429 | |
718e3744 | 3430 | /* neighbor capability dynamic. */ |
3431 | DEFUN (neighbor_capability_dynamic, | |
3432 | neighbor_capability_dynamic_cmd, | |
3433 | NEIGHBOR_CMD2 "capability dynamic", | |
3434 | NEIGHBOR_STR | |
3435 | NEIGHBOR_ADDR_STR2 | |
3436 | "Advertise capability to the peer\n" | |
3437 | "Advertise dynamic capability to this neighbor\n") | |
3438 | { | |
3439 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3440 | } | |
3441 | ||
3442 | DEFUN (no_neighbor_capability_dynamic, | |
3443 | no_neighbor_capability_dynamic_cmd, | |
3444 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
3445 | NO_STR | |
3446 | NEIGHBOR_STR | |
3447 | NEIGHBOR_ADDR_STR2 | |
3448 | "Advertise capability to the peer\n" | |
3449 | "Advertise dynamic capability to this neighbor\n") | |
3450 | { | |
3451 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3452 | } | |
6b0655a2 | 3453 | |
718e3744 | 3454 | /* neighbor dont-capability-negotiate */ |
3455 | DEFUN (neighbor_dont_capability_negotiate, | |
3456 | neighbor_dont_capability_negotiate_cmd, | |
3457 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3458 | NEIGHBOR_STR | |
3459 | NEIGHBOR_ADDR_STR2 | |
3460 | "Do not perform capability negotiation\n") | |
3461 | { | |
3462 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3463 | } | |
3464 | ||
3465 | DEFUN (no_neighbor_dont_capability_negotiate, | |
3466 | no_neighbor_dont_capability_negotiate_cmd, | |
3467 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3468 | NO_STR | |
3469 | NEIGHBOR_STR | |
3470 | NEIGHBOR_ADDR_STR2 | |
3471 | "Do not perform capability negotiation\n") | |
3472 | { | |
3473 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3474 | } | |
6b0655a2 | 3475 | |
8a92a8a0 DS |
3476 | /* neighbor capability extended next hop encoding */ |
3477 | DEFUN (neighbor_capability_enhe, | |
3478 | neighbor_capability_enhe_cmd, | |
3479 | NEIGHBOR_CMD2 "capability extended-nexthop", | |
3480 | NEIGHBOR_STR | |
3481 | NEIGHBOR_ADDR_STR2 | |
3482 | "Advertise capability to the peer\n" | |
3483 | "Advertise extended next-hop capability to the peer\n") | |
3484 | { | |
3485 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3486 | } | |
3487 | ||
3488 | DEFUN (no_neighbor_capability_enhe, | |
3489 | no_neighbor_capability_enhe_cmd, | |
3490 | NO_NEIGHBOR_CMD2 "capability extended-nexthop", | |
3491 | NO_STR | |
3492 | NEIGHBOR_STR | |
3493 | NEIGHBOR_ADDR_STR2 | |
3494 | "Advertise capability to the peer\n" | |
3495 | "Advertise extended next-hop capability to the peer\n") | |
3496 | { | |
3497 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3498 | } | |
3499 | ||
94f2b392 | 3500 | static int |
fd79ac91 | 3501 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3502 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 3503 | { |
3504 | int ret; | |
3505 | struct peer *peer; | |
3506 | ||
3507 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3508 | if (! peer) | |
3509 | return CMD_WARNING; | |
3510 | ||
3511 | if (set) | |
3512 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
3513 | else | |
3514 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
3515 | ||
3516 | return bgp_vty_return (vty, ret); | |
3517 | } | |
3518 | ||
94f2b392 | 3519 | static int |
fd79ac91 | 3520 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3521 | safi_t safi, u_int32_t flag) |
718e3744 | 3522 | { |
3523 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
3524 | } | |
3525 | ||
94f2b392 | 3526 | static int |
fd79ac91 | 3527 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3528 | safi_t safi, u_int32_t flag) |
718e3744 | 3529 | { |
3530 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
3531 | } | |
6b0655a2 | 3532 | |
718e3744 | 3533 | /* neighbor capability orf prefix-list. */ |
3534 | DEFUN (neighbor_capability_orf_prefix, | |
3535 | neighbor_capability_orf_prefix_cmd, | |
3536 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3537 | NEIGHBOR_STR | |
3538 | NEIGHBOR_ADDR_STR2 | |
3539 | "Advertise capability to the peer\n" | |
3540 | "Advertise ORF capability to the peer\n" | |
3541 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3542 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3543 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3544 | "Capability to SEND the ORF to this neighbor\n") | |
3545 | { | |
3546 | u_int16_t flag = 0; | |
3547 | ||
3548 | if (strncmp (argv[1], "s", 1) == 0) | |
3549 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3550 | else if (strncmp (argv[1], "r", 1) == 0) | |
3551 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3552 | else if (strncmp (argv[1], "b", 1) == 0) | |
3553 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3554 | else | |
3555 | return CMD_WARNING; | |
3556 | ||
3557 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3558 | bgp_node_safi (vty), flag); | |
3559 | } | |
3560 | ||
3561 | DEFUN (no_neighbor_capability_orf_prefix, | |
3562 | no_neighbor_capability_orf_prefix_cmd, | |
3563 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3564 | NO_STR | |
3565 | NEIGHBOR_STR | |
3566 | NEIGHBOR_ADDR_STR2 | |
3567 | "Advertise capability to the peer\n" | |
3568 | "Advertise ORF capability to the peer\n" | |
3569 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3570 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3571 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3572 | "Capability to SEND the ORF to this neighbor\n") | |
3573 | { | |
3574 | u_int16_t flag = 0; | |
3575 | ||
3576 | if (strncmp (argv[1], "s", 1) == 0) | |
3577 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3578 | else if (strncmp (argv[1], "r", 1) == 0) | |
3579 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3580 | else if (strncmp (argv[1], "b", 1) == 0) | |
3581 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3582 | else | |
3583 | return CMD_WARNING; | |
3584 | ||
3585 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3586 | bgp_node_safi (vty), flag); | |
3587 | } | |
6b0655a2 | 3588 | |
718e3744 | 3589 | /* neighbor next-hop-self. */ |
3590 | DEFUN (neighbor_nexthop_self, | |
3591 | neighbor_nexthop_self_cmd, | |
a538debe | 3592 | NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3593 | NEIGHBOR_STR |
3594 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3595 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3596 | { |
a538debe DS |
3597 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3598 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); | |
3599 | } | |
9e7a53c1 | 3600 | |
a538debe DS |
3601 | /* neighbor next-hop-self. */ |
3602 | DEFUN (neighbor_nexthop_self_force, | |
3603 | neighbor_nexthop_self_force_cmd, | |
3604 | NEIGHBOR_CMD2 "next-hop-self force", | |
3605 | NEIGHBOR_STR | |
3606 | NEIGHBOR_ADDR_STR2 | |
3607 | "Disable the next hop calculation for this neighbor\n" | |
3608 | "Set the next hop to self for reflected routes\n") | |
3609 | { | |
3610 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3611 | bgp_node_safi (vty), | |
88b8ed8d | 3612 | PEER_FLAG_FORCE_NEXTHOP_SELF); |
718e3744 | 3613 | } |
3614 | ||
3615 | DEFUN (no_neighbor_nexthop_self, | |
3616 | no_neighbor_nexthop_self_cmd, | |
a538debe | 3617 | NO_NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3618 | NO_STR |
3619 | NEIGHBOR_STR | |
3620 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3621 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3622 | { |
3623 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
9e7a53c1 | 3624 | bgp_node_safi (vty), |
88b8ed8d | 3625 | PEER_FLAG_NEXTHOP_SELF); |
718e3744 | 3626 | } |
6b0655a2 | 3627 | |
88b8ed8d | 3628 | DEFUN (no_neighbor_nexthop_self_force, |
a538debe DS |
3629 | no_neighbor_nexthop_self_force_cmd, |
3630 | NO_NEIGHBOR_CMD2 "next-hop-self force", | |
3631 | NO_STR | |
3632 | NEIGHBOR_STR | |
3633 | NEIGHBOR_ADDR_STR2 | |
3634 | "Disable the next hop calculation for this neighbor\n" | |
3635 | "Set the next hop to self for reflected routes\n") | |
88b8ed8d DW |
3636 | { |
3637 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3638 | bgp_node_safi (vty), | |
3639 | PEER_FLAG_FORCE_NEXTHOP_SELF); | |
3640 | } | |
a538debe | 3641 | |
c7122e14 DS |
3642 | /* neighbor as-override */ |
3643 | DEFUN (neighbor_as_override, | |
3644 | neighbor_as_override_cmd, | |
3645 | NEIGHBOR_CMD2 "as-override", | |
3646 | NEIGHBOR_STR | |
3647 | NEIGHBOR_ADDR_STR2 | |
3648 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3649 | { | |
3650 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3651 | bgp_node_safi (vty), | |
3652 | PEER_FLAG_AS_OVERRIDE); | |
3653 | } | |
3654 | ||
3655 | DEFUN (no_neighbor_as_override, | |
3656 | no_neighbor_as_override_cmd, | |
3657 | NO_NEIGHBOR_CMD2 "as-override", | |
3658 | NO_STR | |
3659 | NEIGHBOR_STR | |
3660 | NEIGHBOR_ADDR_STR2 | |
3661 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3662 | { | |
3663 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3664 | bgp_node_safi (vty), | |
3665 | PEER_FLAG_AS_OVERRIDE); | |
3666 | } | |
3667 | ||
718e3744 | 3668 | /* neighbor remove-private-AS. */ |
3669 | DEFUN (neighbor_remove_private_as, | |
3670 | neighbor_remove_private_as_cmd, | |
3671 | NEIGHBOR_CMD2 "remove-private-AS", | |
3672 | NEIGHBOR_STR | |
3673 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3674 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3675 | { |
3676 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3677 | bgp_node_safi (vty), | |
3678 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
3679 | } | |
3680 | ||
5000f21c DS |
3681 | DEFUN (neighbor_remove_private_as_all, |
3682 | neighbor_remove_private_as_all_cmd, | |
3683 | NEIGHBOR_CMD2 "remove-private-AS all", | |
3684 | NEIGHBOR_STR | |
3685 | NEIGHBOR_ADDR_STR2 | |
3686 | "Remove private ASNs in outbound updates\n" | |
3687 | "Apply to all AS numbers") | |
3688 | { | |
5000f21c DS |
3689 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3690 | bgp_node_safi (vty), | |
5000f21c DS |
3691 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); |
3692 | } | |
3693 | ||
3694 | DEFUN (neighbor_remove_private_as_replace_as, | |
3695 | neighbor_remove_private_as_replace_as_cmd, | |
3696 | NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3697 | NEIGHBOR_STR | |
3698 | NEIGHBOR_ADDR_STR2 | |
3699 | "Remove private ASNs in outbound updates\n" | |
3700 | "Replace private ASNs with our ASN in outbound updates\n") | |
3701 | { | |
5000f21c DS |
3702 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3703 | bgp_node_safi (vty), | |
5000f21c DS |
3704 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); |
3705 | } | |
3706 | ||
3707 | DEFUN (neighbor_remove_private_as_all_replace_as, | |
3708 | neighbor_remove_private_as_all_replace_as_cmd, | |
3709 | NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3710 | NEIGHBOR_STR | |
3711 | NEIGHBOR_ADDR_STR2 | |
3712 | "Remove private ASNs in outbound updates\n" | |
3713 | "Apply to all AS numbers" | |
3714 | "Replace private ASNs with our ASN in outbound updates\n") | |
3715 | { | |
3716 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3717 | bgp_node_safi (vty), | |
88b8ed8d | 3718 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); |
5000f21c DS |
3719 | } |
3720 | ||
718e3744 | 3721 | DEFUN (no_neighbor_remove_private_as, |
3722 | no_neighbor_remove_private_as_cmd, | |
3723 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
3724 | NO_STR | |
3725 | NEIGHBOR_STR | |
3726 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3727 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3728 | { |
3729 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3730 | bgp_node_safi (vty), | |
88b8ed8d | 3731 | PEER_FLAG_REMOVE_PRIVATE_AS); |
718e3744 | 3732 | } |
6b0655a2 | 3733 | |
88b8ed8d | 3734 | DEFUN (no_neighbor_remove_private_as_all, |
5000f21c DS |
3735 | no_neighbor_remove_private_as_all_cmd, |
3736 | NO_NEIGHBOR_CMD2 "remove-private-AS all", | |
3737 | NO_STR | |
3738 | NEIGHBOR_STR | |
3739 | NEIGHBOR_ADDR_STR2 | |
3740 | "Remove private ASNs in outbound updates\n" | |
3741 | "Apply to all AS numbers") | |
88b8ed8d DW |
3742 | { |
3743 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3744 | bgp_node_safi (vty), | |
3745 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3746 | } | |
5000f21c | 3747 | |
88b8ed8d | 3748 | DEFUN (no_neighbor_remove_private_as_replace_as, |
5000f21c DS |
3749 | no_neighbor_remove_private_as_replace_as_cmd, |
3750 | NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3751 | NO_STR | |
3752 | NEIGHBOR_STR | |
3753 | NEIGHBOR_ADDR_STR2 | |
3754 | "Remove private ASNs in outbound updates\n" | |
3755 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d DW |
3756 | { |
3757 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3758 | bgp_node_safi (vty), | |
3759 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3760 | } | |
5000f21c | 3761 | |
88b8ed8d | 3762 | DEFUN (no_neighbor_remove_private_as_all_replace_as, |
5000f21c DS |
3763 | no_neighbor_remove_private_as_all_replace_as_cmd, |
3764 | NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3765 | NO_STR | |
3766 | NEIGHBOR_STR | |
3767 | NEIGHBOR_ADDR_STR2 | |
3768 | "Remove private ASNs in outbound updates\n" | |
3769 | "Apply to all AS numbers" | |
3770 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d DW |
3771 | { |
3772 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3773 | bgp_node_safi (vty), | |
3774 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); | |
3775 | } | |
5000f21c DS |
3776 | |
3777 | ||
718e3744 | 3778 | /* neighbor send-community. */ |
3779 | DEFUN (neighbor_send_community, | |
3780 | neighbor_send_community_cmd, | |
3781 | NEIGHBOR_CMD2 "send-community", | |
3782 | NEIGHBOR_STR | |
3783 | NEIGHBOR_ADDR_STR2 | |
3784 | "Send Community attribute to this neighbor\n") | |
3785 | { | |
3786 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3787 | bgp_node_safi (vty), | |
3788 | PEER_FLAG_SEND_COMMUNITY); | |
3789 | } | |
3790 | ||
3791 | DEFUN (no_neighbor_send_community, | |
3792 | no_neighbor_send_community_cmd, | |
3793 | NO_NEIGHBOR_CMD2 "send-community", | |
3794 | NO_STR | |
3795 | NEIGHBOR_STR | |
3796 | NEIGHBOR_ADDR_STR2 | |
3797 | "Send Community attribute to this neighbor\n") | |
3798 | { | |
3799 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3800 | bgp_node_safi (vty), | |
3801 | PEER_FLAG_SEND_COMMUNITY); | |
3802 | } | |
6b0655a2 | 3803 | |
718e3744 | 3804 | /* neighbor send-community extended. */ |
3805 | DEFUN (neighbor_send_community_type, | |
3806 | neighbor_send_community_type_cmd, | |
3807 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3808 | NEIGHBOR_STR | |
3809 | NEIGHBOR_ADDR_STR2 | |
3810 | "Send Community attribute to this neighbor\n" | |
3811 | "Send Standard and Extended Community attributes\n" | |
3812 | "Send Extended Community attributes\n" | |
3813 | "Send Standard Community attributes\n") | |
3814 | { | |
3815 | if (strncmp (argv[1], "s", 1) == 0) | |
3816 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3817 | bgp_node_safi (vty), | |
3818 | PEER_FLAG_SEND_COMMUNITY); | |
3819 | if (strncmp (argv[1], "e", 1) == 0) | |
3820 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3821 | bgp_node_safi (vty), | |
3822 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3823 | ||
3824 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3825 | bgp_node_safi (vty), | |
3826 | (PEER_FLAG_SEND_COMMUNITY| | |
3827 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3828 | } | |
3829 | ||
3830 | DEFUN (no_neighbor_send_community_type, | |
3831 | no_neighbor_send_community_type_cmd, | |
3832 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3833 | NO_STR | |
3834 | NEIGHBOR_STR | |
3835 | NEIGHBOR_ADDR_STR2 | |
3836 | "Send Community attribute to this neighbor\n" | |
3837 | "Send Standard and Extended Community attributes\n" | |
3838 | "Send Extended Community attributes\n" | |
3839 | "Send Standard Community attributes\n") | |
3840 | { | |
3841 | if (strncmp (argv[1], "s", 1) == 0) | |
3842 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3843 | bgp_node_safi (vty), | |
3844 | PEER_FLAG_SEND_COMMUNITY); | |
3845 | if (strncmp (argv[1], "e", 1) == 0) | |
3846 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3847 | bgp_node_safi (vty), | |
3848 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3849 | ||
3850 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3851 | bgp_node_safi (vty), | |
3852 | (PEER_FLAG_SEND_COMMUNITY | | |
3853 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3854 | } | |
6b0655a2 | 3855 | |
718e3744 | 3856 | /* neighbor soft-reconfig. */ |
3857 | DEFUN (neighbor_soft_reconfiguration, | |
3858 | neighbor_soft_reconfiguration_cmd, | |
3859 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3860 | NEIGHBOR_STR | |
3861 | NEIGHBOR_ADDR_STR2 | |
3862 | "Per neighbor soft reconfiguration\n" | |
3863 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3864 | { | |
3865 | return peer_af_flag_set_vty (vty, argv[0], | |
3866 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3867 | PEER_FLAG_SOFT_RECONFIG); | |
3868 | } | |
3869 | ||
3870 | DEFUN (no_neighbor_soft_reconfiguration, | |
3871 | no_neighbor_soft_reconfiguration_cmd, | |
3872 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3873 | NO_STR | |
3874 | NEIGHBOR_STR | |
3875 | NEIGHBOR_ADDR_STR2 | |
3876 | "Per neighbor soft reconfiguration\n" | |
3877 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3878 | { | |
3879 | return peer_af_flag_unset_vty (vty, argv[0], | |
3880 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3881 | PEER_FLAG_SOFT_RECONFIG); | |
3882 | } | |
6b0655a2 | 3883 | |
718e3744 | 3884 | DEFUN (neighbor_route_reflector_client, |
3885 | neighbor_route_reflector_client_cmd, | |
3886 | NEIGHBOR_CMD2 "route-reflector-client", | |
3887 | NEIGHBOR_STR | |
3888 | NEIGHBOR_ADDR_STR2 | |
3889 | "Configure a neighbor as Route Reflector client\n") | |
3890 | { | |
3891 | struct peer *peer; | |
3892 | ||
3893 | ||
3894 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3895 | if (! peer) | |
3896 | return CMD_WARNING; | |
3897 | ||
3898 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3899 | bgp_node_safi (vty), | |
3900 | PEER_FLAG_REFLECTOR_CLIENT); | |
3901 | } | |
3902 | ||
3903 | DEFUN (no_neighbor_route_reflector_client, | |
3904 | no_neighbor_route_reflector_client_cmd, | |
3905 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
3906 | NO_STR | |
3907 | NEIGHBOR_STR | |
3908 | NEIGHBOR_ADDR_STR2 | |
3909 | "Configure a neighbor as Route Reflector client\n") | |
3910 | { | |
3911 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3912 | bgp_node_safi (vty), | |
3913 | PEER_FLAG_REFLECTOR_CLIENT); | |
3914 | } | |
6b0655a2 | 3915 | |
718e3744 | 3916 | /* neighbor route-server-client. */ |
3917 | DEFUN (neighbor_route_server_client, | |
3918 | neighbor_route_server_client_cmd, | |
3919 | NEIGHBOR_CMD2 "route-server-client", | |
3920 | NEIGHBOR_STR | |
3921 | NEIGHBOR_ADDR_STR2 | |
3922 | "Configure a neighbor as Route Server client\n") | |
3923 | { | |
2a3d5731 DW |
3924 | struct peer *peer; |
3925 | ||
3926 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3927 | if (! peer) | |
3928 | return CMD_WARNING; | |
3929 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3930 | bgp_node_safi (vty), | |
3931 | PEER_FLAG_RSERVER_CLIENT); | |
718e3744 | 3932 | } |
3933 | ||
3934 | DEFUN (no_neighbor_route_server_client, | |
3935 | no_neighbor_route_server_client_cmd, | |
3936 | NO_NEIGHBOR_CMD2 "route-server-client", | |
3937 | NO_STR | |
3938 | NEIGHBOR_STR | |
3939 | NEIGHBOR_ADDR_STR2 | |
3940 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 3941 | { |
2a3d5731 DW |
3942 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
3943 | bgp_node_safi (vty), | |
3944 | PEER_FLAG_RSERVER_CLIENT); | |
fee0f4c6 | 3945 | } |
6b0655a2 | 3946 | |
fee0f4c6 | 3947 | DEFUN (neighbor_nexthop_local_unchanged, |
3948 | neighbor_nexthop_local_unchanged_cmd, | |
3949 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3950 | NEIGHBOR_STR | |
3951 | NEIGHBOR_ADDR_STR2 | |
3952 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
3953 | "Leave link-local nexthop unchanged for this peer\n") | |
3954 | { | |
3955 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3956 | bgp_node_safi (vty), | |
3957 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
3958 | } | |
6b0655a2 | 3959 | |
fee0f4c6 | 3960 | DEFUN (no_neighbor_nexthop_local_unchanged, |
3961 | no_neighbor_nexthop_local_unchanged_cmd, | |
3962 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3963 | NO_STR | |
3964 | NEIGHBOR_STR | |
3965 | NEIGHBOR_ADDR_STR2 | |
3966 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
3967 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 3968 | { |
3969 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3970 | bgp_node_safi (vty), | |
fee0f4c6 | 3971 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 3972 | } |
6b0655a2 | 3973 | |
718e3744 | 3974 | DEFUN (neighbor_attr_unchanged, |
3975 | neighbor_attr_unchanged_cmd, | |
3976 | NEIGHBOR_CMD2 "attribute-unchanged", | |
3977 | NEIGHBOR_STR | |
3978 | NEIGHBOR_ADDR_STR2 | |
3979 | "BGP attribute is propagated unchanged to this neighbor\n") | |
3980 | { | |
3981 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3982 | bgp_node_safi (vty), | |
3983 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
3984 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
3985 | PEER_FLAG_MED_UNCHANGED)); | |
3986 | } | |
3987 | ||
3988 | DEFUN (neighbor_attr_unchanged1, | |
3989 | neighbor_attr_unchanged1_cmd, | |
3990 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
3991 | NEIGHBOR_STR | |
3992 | NEIGHBOR_ADDR_STR2 | |
3993 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3994 | "As-path attribute\n" | |
3995 | "Nexthop attribute\n" | |
3996 | "Med attribute\n") | |
3997 | { | |
3998 | u_int16_t flags = 0; | |
3999 | ||
4000 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4001 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4002 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4003 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4004 | else if (strncmp (argv[1], "med", 1) == 0) | |
4005 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4006 | ||
4007 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4008 | bgp_node_safi (vty), flags); | |
4009 | } | |
4010 | ||
4011 | DEFUN (neighbor_attr_unchanged2, | |
4012 | neighbor_attr_unchanged2_cmd, | |
4013 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4014 | NEIGHBOR_STR | |
4015 | NEIGHBOR_ADDR_STR2 | |
4016 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4017 | "As-path attribute\n" | |
4018 | "Nexthop attribute\n" | |
4019 | "Med attribute\n") | |
4020 | { | |
4021 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4022 | ||
4023 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4024 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4025 | else if (strncmp (argv[1], "med", 1) == 0) | |
4026 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4027 | ||
4028 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4029 | bgp_node_safi (vty), flags); | |
4030 | ||
4031 | } | |
4032 | ||
4033 | DEFUN (neighbor_attr_unchanged3, | |
4034 | neighbor_attr_unchanged3_cmd, | |
4035 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4036 | NEIGHBOR_STR | |
4037 | NEIGHBOR_ADDR_STR2 | |
4038 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4039 | "Nexthop attribute\n" | |
4040 | "As-path attribute\n" | |
4041 | "Med attribute\n") | |
4042 | { | |
4043 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4044 | ||
4045 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4046 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4047 | else if (strncmp (argv[1], "med", 1) == 0) | |
4048 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4049 | ||
4050 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4051 | bgp_node_safi (vty), flags); | |
4052 | } | |
4053 | ||
4054 | DEFUN (neighbor_attr_unchanged4, | |
4055 | neighbor_attr_unchanged4_cmd, | |
4056 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4057 | NEIGHBOR_STR | |
4058 | NEIGHBOR_ADDR_STR2 | |
4059 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4060 | "Med attribute\n" | |
4061 | "As-path attribute\n" | |
4062 | "Nexthop attribute\n") | |
4063 | { | |
4064 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4065 | ||
4066 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4067 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4068 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4069 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4070 | ||
4071 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4072 | bgp_node_safi (vty), flags); | |
4073 | } | |
4074 | ||
4075 | ALIAS (neighbor_attr_unchanged, | |
4076 | neighbor_attr_unchanged5_cmd, | |
4077 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4078 | NEIGHBOR_STR | |
4079 | NEIGHBOR_ADDR_STR2 | |
4080 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4081 | "As-path attribute\n" | |
4082 | "Nexthop attribute\n" | |
4083 | "Med attribute\n") | |
4084 | ||
4085 | ALIAS (neighbor_attr_unchanged, | |
4086 | neighbor_attr_unchanged6_cmd, | |
4087 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4088 | NEIGHBOR_STR | |
4089 | NEIGHBOR_ADDR_STR2 | |
4090 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4091 | "As-path attribute\n" | |
4092 | "Med attribute\n" | |
4093 | "Nexthop attribute\n") | |
4094 | ||
4095 | ALIAS (neighbor_attr_unchanged, | |
4096 | neighbor_attr_unchanged7_cmd, | |
4097 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4098 | NEIGHBOR_STR | |
4099 | NEIGHBOR_ADDR_STR2 | |
4100 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4101 | "Nexthop attribute\n" | |
4102 | "Med attribute\n" | |
4103 | "As-path attribute\n") | |
4104 | ||
4105 | ALIAS (neighbor_attr_unchanged, | |
4106 | neighbor_attr_unchanged8_cmd, | |
4107 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4108 | NEIGHBOR_STR | |
4109 | NEIGHBOR_ADDR_STR2 | |
4110 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4111 | "Nexthop attribute\n" | |
4112 | "As-path attribute\n" | |
4113 | "Med attribute\n") | |
4114 | ||
4115 | ALIAS (neighbor_attr_unchanged, | |
4116 | neighbor_attr_unchanged9_cmd, | |
4117 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4118 | NEIGHBOR_STR | |
4119 | NEIGHBOR_ADDR_STR2 | |
4120 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4121 | "Med attribute\n" | |
4122 | "Nexthop attribute\n" | |
4123 | "As-path attribute\n") | |
4124 | ||
4125 | ALIAS (neighbor_attr_unchanged, | |
4126 | neighbor_attr_unchanged10_cmd, | |
4127 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4128 | NEIGHBOR_STR | |
4129 | NEIGHBOR_ADDR_STR2 | |
4130 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4131 | "Med attribute\n" | |
4132 | "As-path attribute\n" | |
4133 | "Nexthop attribute\n") | |
4134 | ||
4135 | DEFUN (no_neighbor_attr_unchanged, | |
4136 | no_neighbor_attr_unchanged_cmd, | |
4137 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
4138 | NO_STR | |
4139 | NEIGHBOR_STR | |
4140 | NEIGHBOR_ADDR_STR2 | |
4141 | "BGP attribute is propagated unchanged to this neighbor\n") | |
4142 | { | |
4143 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4144 | bgp_node_safi (vty), | |
4145 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4146 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4147 | PEER_FLAG_MED_UNCHANGED)); | |
4148 | } | |
4149 | ||
4150 | DEFUN (no_neighbor_attr_unchanged1, | |
4151 | no_neighbor_attr_unchanged1_cmd, | |
4152 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4153 | NO_STR | |
4154 | NEIGHBOR_STR | |
4155 | NEIGHBOR_ADDR_STR2 | |
4156 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4157 | "As-path attribute\n" | |
4158 | "Nexthop attribute\n" | |
4159 | "Med attribute\n") | |
4160 | { | |
4161 | u_int16_t flags = 0; | |
4162 | ||
4163 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4164 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4165 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4166 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4167 | else if (strncmp (argv[1], "med", 1) == 0) | |
4168 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4169 | ||
4170 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4171 | bgp_node_safi (vty), flags); | |
4172 | } | |
4173 | ||
4174 | DEFUN (no_neighbor_attr_unchanged2, | |
4175 | no_neighbor_attr_unchanged2_cmd, | |
4176 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4177 | NO_STR | |
4178 | NEIGHBOR_STR | |
4179 | NEIGHBOR_ADDR_STR2 | |
4180 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4181 | "As-path attribute\n" | |
4182 | "Nexthop attribute\n" | |
4183 | "Med attribute\n") | |
4184 | { | |
4185 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4186 | ||
4187 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4188 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4189 | else if (strncmp (argv[1], "med", 1) == 0) | |
4190 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4191 | ||
4192 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4193 | bgp_node_safi (vty), flags); | |
4194 | } | |
4195 | ||
4196 | DEFUN (no_neighbor_attr_unchanged3, | |
4197 | no_neighbor_attr_unchanged3_cmd, | |
4198 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4199 | NO_STR | |
4200 | NEIGHBOR_STR | |
4201 | NEIGHBOR_ADDR_STR2 | |
4202 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4203 | "Nexthop attribute\n" | |
4204 | "As-path attribute\n" | |
4205 | "Med attribute\n") | |
4206 | { | |
4207 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4208 | ||
4209 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4210 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4211 | else if (strncmp (argv[1], "med", 1) == 0) | |
4212 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4213 | ||
4214 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4215 | bgp_node_safi (vty), flags); | |
4216 | } | |
4217 | ||
4218 | DEFUN (no_neighbor_attr_unchanged4, | |
4219 | no_neighbor_attr_unchanged4_cmd, | |
4220 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4221 | NO_STR | |
4222 | NEIGHBOR_STR | |
4223 | NEIGHBOR_ADDR_STR2 | |
4224 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4225 | "Med attribute\n" | |
4226 | "As-path attribute\n" | |
4227 | "Nexthop attribute\n") | |
4228 | { | |
4229 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4230 | ||
4231 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4232 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4233 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4234 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4235 | ||
4236 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4237 | bgp_node_safi (vty), flags); | |
4238 | } | |
4239 | ||
4240 | ALIAS (no_neighbor_attr_unchanged, | |
4241 | no_neighbor_attr_unchanged5_cmd, | |
4242 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4243 | NO_STR | |
4244 | NEIGHBOR_STR | |
4245 | NEIGHBOR_ADDR_STR2 | |
4246 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4247 | "As-path attribute\n" | |
4248 | "Nexthop attribute\n" | |
4249 | "Med attribute\n") | |
4250 | ||
4251 | ALIAS (no_neighbor_attr_unchanged, | |
4252 | no_neighbor_attr_unchanged6_cmd, | |
4253 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4254 | NO_STR | |
4255 | NEIGHBOR_STR | |
4256 | NEIGHBOR_ADDR_STR2 | |
4257 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4258 | "As-path attribute\n" | |
4259 | "Med attribute\n" | |
4260 | "Nexthop attribute\n") | |
4261 | ||
4262 | ALIAS (no_neighbor_attr_unchanged, | |
4263 | no_neighbor_attr_unchanged7_cmd, | |
4264 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4265 | NO_STR | |
4266 | NEIGHBOR_STR | |
4267 | NEIGHBOR_ADDR_STR2 | |
4268 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4269 | "Nexthop attribute\n" | |
4270 | "Med attribute\n" | |
4271 | "As-path attribute\n") | |
4272 | ||
4273 | ALIAS (no_neighbor_attr_unchanged, | |
4274 | no_neighbor_attr_unchanged8_cmd, | |
4275 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4276 | NO_STR | |
4277 | NEIGHBOR_STR | |
4278 | NEIGHBOR_ADDR_STR2 | |
4279 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4280 | "Nexthop attribute\n" | |
4281 | "As-path attribute\n" | |
4282 | "Med attribute\n") | |
4283 | ||
4284 | ALIAS (no_neighbor_attr_unchanged, | |
4285 | no_neighbor_attr_unchanged9_cmd, | |
4286 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4287 | NO_STR | |
4288 | NEIGHBOR_STR | |
4289 | NEIGHBOR_ADDR_STR2 | |
4290 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4291 | "Med attribute\n" | |
4292 | "Nexthop attribute\n" | |
4293 | "As-path attribute\n") | |
4294 | ||
4295 | ALIAS (no_neighbor_attr_unchanged, | |
4296 | no_neighbor_attr_unchanged10_cmd, | |
4297 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4298 | NO_STR | |
4299 | NEIGHBOR_STR | |
4300 | NEIGHBOR_ADDR_STR2 | |
4301 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4302 | "Med attribute\n" | |
4303 | "As-path attribute\n" | |
4304 | "Nexthop attribute\n") | |
4305 | ||
718e3744 | 4306 | /* EBGP multihop configuration. */ |
94f2b392 | 4307 | static int |
fd79ac91 | 4308 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
4309 | const char *ttl_str) | |
718e3744 | 4310 | { |
4311 | struct peer *peer; | |
fd79ac91 | 4312 | unsigned int ttl; |
718e3744 | 4313 | |
4314 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4315 | if (! peer) | |
4316 | return CMD_WARNING; | |
4317 | ||
4318 | if (! ttl_str) | |
9b1be336 | 4319 | ttl = MAXTTL; |
718e3744 | 4320 | else |
9b1be336 | 4321 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, MAXTTL); |
718e3744 | 4322 | |
89b6d1f8 | 4323 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 4324 | } |
4325 | ||
94f2b392 | 4326 | static int |
fd79ac91 | 4327 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4328 | { |
4329 | struct peer *peer; | |
4330 | ||
4331 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4332 | if (! peer) | |
4333 | return CMD_WARNING; | |
4334 | ||
89b6d1f8 | 4335 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 4336 | } |
4337 | ||
4338 | /* neighbor ebgp-multihop. */ | |
4339 | DEFUN (neighbor_ebgp_multihop, | |
4340 | neighbor_ebgp_multihop_cmd, | |
4341 | NEIGHBOR_CMD2 "ebgp-multihop", | |
4342 | NEIGHBOR_STR | |
4343 | NEIGHBOR_ADDR_STR2 | |
4344 | "Allow EBGP neighbors not on directly connected networks\n") | |
4345 | { | |
4346 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
4347 | } | |
4348 | ||
4349 | DEFUN (neighbor_ebgp_multihop_ttl, | |
4350 | neighbor_ebgp_multihop_ttl_cmd, | |
9b1be336 | 4351 | NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), |
718e3744 | 4352 | NEIGHBOR_STR |
4353 | NEIGHBOR_ADDR_STR2 | |
4354 | "Allow EBGP neighbors not on directly connected networks\n" | |
4355 | "maximum hop count\n") | |
4356 | { | |
4357 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
4358 | } | |
4359 | ||
4360 | DEFUN (no_neighbor_ebgp_multihop, | |
4361 | no_neighbor_ebgp_multihop_cmd, | |
4362 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
4363 | NO_STR | |
4364 | NEIGHBOR_STR | |
4365 | NEIGHBOR_ADDR_STR2 | |
4366 | "Allow EBGP neighbors not on directly connected networks\n") | |
4367 | { | |
4368 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
4369 | } | |
4370 | ||
4371 | ALIAS (no_neighbor_ebgp_multihop, | |
4372 | no_neighbor_ebgp_multihop_ttl_cmd, | |
9b1be336 | 4373 | NO_NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), |
718e3744 | 4374 | NO_STR |
4375 | NEIGHBOR_STR | |
4376 | NEIGHBOR_ADDR_STR2 | |
4377 | "Allow EBGP neighbors not on directly connected networks\n" | |
4378 | "maximum hop count\n") | |
6b0655a2 | 4379 | |
6ffd2079 | 4380 | /* disable-connected-check */ |
4381 | DEFUN (neighbor_disable_connected_check, | |
4382 | neighbor_disable_connected_check_cmd, | |
4383 | NEIGHBOR_CMD2 "disable-connected-check", | |
4384 | NEIGHBOR_STR | |
4385 | NEIGHBOR_ADDR_STR2 | |
4386 | "one-hop away EBGP peer using loopback address\n") | |
4387 | { | |
4388 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4389 | } | |
4390 | ||
4391 | DEFUN (no_neighbor_disable_connected_check, | |
4392 | no_neighbor_disable_connected_check_cmd, | |
4393 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
4394 | NO_STR | |
4395 | NEIGHBOR_STR | |
4396 | NEIGHBOR_ADDR_STR2 | |
4397 | "one-hop away EBGP peer using loopback address\n") | |
4398 | { | |
4399 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4400 | } | |
4401 | ||
718e3744 | 4402 | /* Enforce multihop. */ |
6ffd2079 | 4403 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 4404 | neighbor_enforce_multihop_cmd, |
4405 | NEIGHBOR_CMD2 "enforce-multihop", | |
4406 | NEIGHBOR_STR | |
4407 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4408 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 4409 | |
6ffd2079 | 4410 | /* Enforce multihop. */ |
4411 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 4412 | no_neighbor_enforce_multihop_cmd, |
4413 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
4414 | NO_STR | |
4415 | NEIGHBOR_STR | |
4416 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4417 | "Enforce EBGP neighbors perform multihop\n") |
6b0655a2 | 4418 | |
718e3744 | 4419 | DEFUN (neighbor_description, |
4420 | neighbor_description_cmd, | |
4421 | NEIGHBOR_CMD2 "description .LINE", | |
4422 | NEIGHBOR_STR | |
4423 | NEIGHBOR_ADDR_STR2 | |
4424 | "Neighbor specific description\n" | |
4425 | "Up to 80 characters describing this neighbor\n") | |
4426 | { | |
4427 | struct peer *peer; | |
718e3744 | 4428 | char *str; |
718e3744 | 4429 | |
4430 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4431 | if (! peer) | |
4432 | return CMD_WARNING; | |
4433 | ||
4434 | if (argc == 1) | |
4435 | return CMD_SUCCESS; | |
4436 | ||
3b8b1855 | 4437 | str = argv_concat(argv, argc, 1); |
718e3744 | 4438 | |
4439 | peer_description_set (peer, str); | |
4440 | ||
3b8b1855 | 4441 | XFREE (MTYPE_TMP, str); |
718e3744 | 4442 | |
4443 | return CMD_SUCCESS; | |
4444 | } | |
4445 | ||
4446 | DEFUN (no_neighbor_description, | |
4447 | no_neighbor_description_cmd, | |
4448 | NO_NEIGHBOR_CMD2 "description", | |
4449 | NO_STR | |
4450 | NEIGHBOR_STR | |
4451 | NEIGHBOR_ADDR_STR2 | |
4452 | "Neighbor specific description\n") | |
4453 | { | |
4454 | struct peer *peer; | |
4455 | ||
4456 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4457 | if (! peer) | |
4458 | return CMD_WARNING; | |
4459 | ||
4460 | peer_description_unset (peer); | |
4461 | ||
4462 | return CMD_SUCCESS; | |
4463 | } | |
4464 | ||
4465 | ALIAS (no_neighbor_description, | |
4466 | no_neighbor_description_val_cmd, | |
4467 | NO_NEIGHBOR_CMD2 "description .LINE", | |
4468 | NO_STR | |
4469 | NEIGHBOR_STR | |
4470 | NEIGHBOR_ADDR_STR2 | |
4471 | "Neighbor specific description\n" | |
4472 | "Up to 80 characters describing this neighbor\n") | |
6b0655a2 | 4473 | |
718e3744 | 4474 | /* Neighbor update-source. */ |
94f2b392 | 4475 | static int |
fd79ac91 | 4476 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
4477 | const char *source_str) | |
718e3744 | 4478 | { |
4479 | struct peer *peer; | |
718e3744 | 4480 | |
4481 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4482 | if (! peer) | |
4483 | return CMD_WARNING; | |
4484 | ||
a80beece DS |
4485 | if (peer->conf_if) |
4486 | return CMD_WARNING; | |
4487 | ||
718e3744 | 4488 | if (source_str) |
4489 | { | |
c63b83fe JBD |
4490 | union sockunion su; |
4491 | int ret = str2sockunion (source_str, &su); | |
4492 | ||
4493 | if (ret == 0) | |
4494 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 4495 | else |
4496 | peer_update_source_if_set (peer, source_str); | |
4497 | } | |
4498 | else | |
4499 | peer_update_source_unset (peer); | |
4500 | ||
4501 | return CMD_SUCCESS; | |
4502 | } | |
4503 | ||
dcb52bd5 DS |
4504 | #define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD" |
4505 | #define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")" | |
4506 | #define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}" | |
369688c0 PJ |
4507 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
4508 | "IPv4 address\n" \ | |
9a1a331d PJ |
4509 | "IPv6 address\n" \ |
4510 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 4511 | |
718e3744 | 4512 | DEFUN (neighbor_update_source, |
4513 | neighbor_update_source_cmd, | |
dcb52bd5 | 4514 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_REQ_STR, |
718e3744 | 4515 | NEIGHBOR_STR |
4516 | NEIGHBOR_ADDR_STR2 | |
4517 | "Source of routing updates\n" | |
369688c0 | 4518 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 4519 | { |
4520 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
4521 | } | |
4522 | ||
4523 | DEFUN (no_neighbor_update_source, | |
4524 | no_neighbor_update_source_cmd, | |
dcb52bd5 | 4525 | NO_NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_OPT_STR, |
718e3744 | 4526 | NO_STR |
4527 | NEIGHBOR_STR | |
4528 | NEIGHBOR_ADDR_STR2 | |
dcb52bd5 DS |
4529 | "Source of routing updates\n" |
4530 | BGP_UPDATE_SOURCE_HELP_STR) | |
718e3744 | 4531 | { |
4532 | return peer_update_source_vty (vty, argv[0], NULL); | |
4533 | } | |
6b0655a2 | 4534 | |
94f2b392 | 4535 | static int |
fd79ac91 | 4536 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
4537 | afi_t afi, safi_t safi, | |
4538 | const char *rmap, int set) | |
718e3744 | 4539 | { |
4540 | int ret; | |
4541 | struct peer *peer; | |
4542 | ||
4543 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4544 | if (! peer) | |
4545 | return CMD_WARNING; | |
4546 | ||
4547 | if (set) | |
4548 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
4549 | else | |
4550 | ret = peer_default_originate_unset (peer, afi, safi); | |
4551 | ||
4552 | return bgp_vty_return (vty, ret); | |
4553 | } | |
4554 | ||
4555 | /* neighbor default-originate. */ | |
4556 | DEFUN (neighbor_default_originate, | |
4557 | neighbor_default_originate_cmd, | |
4558 | NEIGHBOR_CMD2 "default-originate", | |
4559 | NEIGHBOR_STR | |
4560 | NEIGHBOR_ADDR_STR2 | |
4561 | "Originate default route to this neighbor\n") | |
4562 | { | |
4563 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4564 | bgp_node_safi (vty), NULL, 1); | |
4565 | } | |
4566 | ||
4567 | DEFUN (neighbor_default_originate_rmap, | |
4568 | neighbor_default_originate_rmap_cmd, | |
4569 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4570 | NEIGHBOR_STR | |
4571 | NEIGHBOR_ADDR_STR2 | |
4572 | "Originate default route to this neighbor\n" | |
4573 | "Route-map to specify criteria to originate default\n" | |
4574 | "route-map name\n") | |
4575 | { | |
4576 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4577 | bgp_node_safi (vty), argv[1], 1); | |
4578 | } | |
4579 | ||
4580 | DEFUN (no_neighbor_default_originate, | |
4581 | no_neighbor_default_originate_cmd, | |
4582 | NO_NEIGHBOR_CMD2 "default-originate", | |
4583 | NO_STR | |
4584 | NEIGHBOR_STR | |
4585 | NEIGHBOR_ADDR_STR2 | |
4586 | "Originate default route to this neighbor\n") | |
4587 | { | |
4588 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4589 | bgp_node_safi (vty), NULL, 0); | |
4590 | } | |
4591 | ||
4592 | ALIAS (no_neighbor_default_originate, | |
4593 | no_neighbor_default_originate_rmap_cmd, | |
4594 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4595 | NO_STR | |
4596 | NEIGHBOR_STR | |
4597 | NEIGHBOR_ADDR_STR2 | |
4598 | "Originate default route to this neighbor\n" | |
4599 | "Route-map to specify criteria to originate default\n" | |
4600 | "route-map name\n") | |
6b0655a2 | 4601 | |
718e3744 | 4602 | /* Set neighbor's BGP port. */ |
94f2b392 | 4603 | static int |
fd79ac91 | 4604 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
4605 | const char *port_str) | |
718e3744 | 4606 | { |
4607 | struct peer *peer; | |
4608 | u_int16_t port; | |
4609 | struct servent *sp; | |
4610 | ||
4611 | peer = peer_lookup_vty (vty, ip_str); | |
4612 | if (! peer) | |
4613 | return CMD_WARNING; | |
4614 | ||
4615 | if (! port_str) | |
4616 | { | |
4617 | sp = getservbyname ("bgp", "tcp"); | |
4618 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
4619 | } | |
4620 | else | |
4621 | { | |
4622 | VTY_GET_INTEGER("port", port, port_str); | |
4623 | } | |
4624 | ||
4625 | peer_port_set (peer, port); | |
4626 | ||
4627 | return CMD_SUCCESS; | |
4628 | } | |
4629 | ||
f418446b | 4630 | /* Set specified peer's BGP port. */ |
718e3744 | 4631 | DEFUN (neighbor_port, |
4632 | neighbor_port_cmd, | |
4633 | NEIGHBOR_CMD "port <0-65535>", | |
4634 | NEIGHBOR_STR | |
4635 | NEIGHBOR_ADDR_STR | |
4636 | "Neighbor's BGP port\n" | |
4637 | "TCP port number\n") | |
4638 | { | |
4639 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
4640 | } | |
4641 | ||
4642 | DEFUN (no_neighbor_port, | |
4643 | no_neighbor_port_cmd, | |
4644 | NO_NEIGHBOR_CMD "port", | |
4645 | NO_STR | |
4646 | NEIGHBOR_STR | |
4647 | NEIGHBOR_ADDR_STR | |
4648 | "Neighbor's BGP port\n") | |
4649 | { | |
4650 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
4651 | } | |
4652 | ||
4653 | ALIAS (no_neighbor_port, | |
4654 | no_neighbor_port_val_cmd, | |
4655 | NO_NEIGHBOR_CMD "port <0-65535>", | |
4656 | NO_STR | |
4657 | NEIGHBOR_STR | |
4658 | NEIGHBOR_ADDR_STR | |
4659 | "Neighbor's BGP port\n" | |
4660 | "TCP port number\n") | |
6b0655a2 | 4661 | |
718e3744 | 4662 | /* neighbor weight. */ |
94f2b392 | 4663 | static int |
fd79ac91 | 4664 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
4665 | const char *weight_str) | |
718e3744 | 4666 | { |
1f9a9fff | 4667 | int ret; |
718e3744 | 4668 | struct peer *peer; |
4669 | unsigned long weight; | |
4670 | ||
4671 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4672 | if (! peer) | |
4673 | return CMD_WARNING; | |
4674 | ||
4675 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
4676 | ||
1f9a9fff PJ |
4677 | ret = peer_weight_set (peer, weight); |
4678 | return bgp_vty_return (vty, ret); | |
718e3744 | 4679 | } |
4680 | ||
94f2b392 | 4681 | static int |
fd79ac91 | 4682 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4683 | { |
1f9a9fff | 4684 | int ret; |
718e3744 | 4685 | struct peer *peer; |
4686 | ||
4687 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4688 | if (! peer) | |
4689 | return CMD_WARNING; | |
4690 | ||
1f9a9fff PJ |
4691 | ret = peer_weight_unset (peer); |
4692 | return bgp_vty_return (vty, ret); | |
718e3744 | 4693 | } |
4694 | ||
4695 | DEFUN (neighbor_weight, | |
4696 | neighbor_weight_cmd, | |
4697 | NEIGHBOR_CMD2 "weight <0-65535>", | |
4698 | NEIGHBOR_STR | |
4699 | NEIGHBOR_ADDR_STR2 | |
4700 | "Set default weight for routes from this neighbor\n" | |
4701 | "default weight\n") | |
4702 | { | |
4703 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
4704 | } | |
4705 | ||
4706 | DEFUN (no_neighbor_weight, | |
4707 | no_neighbor_weight_cmd, | |
4708 | NO_NEIGHBOR_CMD2 "weight", | |
4709 | NO_STR | |
4710 | NEIGHBOR_STR | |
4711 | NEIGHBOR_ADDR_STR2 | |
4712 | "Set default weight for routes from this neighbor\n") | |
4713 | { | |
4714 | return peer_weight_unset_vty (vty, argv[0]); | |
4715 | } | |
4716 | ||
4717 | ALIAS (no_neighbor_weight, | |
4718 | no_neighbor_weight_val_cmd, | |
4719 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
4720 | NO_STR | |
4721 | NEIGHBOR_STR | |
4722 | NEIGHBOR_ADDR_STR2 | |
4723 | "Set default weight for routes from this neighbor\n" | |
4724 | "default weight\n") | |
6b0655a2 | 4725 | |
718e3744 | 4726 | /* Override capability negotiation. */ |
4727 | DEFUN (neighbor_override_capability, | |
4728 | neighbor_override_capability_cmd, | |
4729 | NEIGHBOR_CMD2 "override-capability", | |
4730 | NEIGHBOR_STR | |
4731 | NEIGHBOR_ADDR_STR2 | |
4732 | "Override capability negotiation result\n") | |
4733 | { | |
4734 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4735 | } | |
4736 | ||
4737 | DEFUN (no_neighbor_override_capability, | |
4738 | no_neighbor_override_capability_cmd, | |
4739 | NO_NEIGHBOR_CMD2 "override-capability", | |
4740 | NO_STR | |
4741 | NEIGHBOR_STR | |
4742 | NEIGHBOR_ADDR_STR2 | |
4743 | "Override capability negotiation result\n") | |
4744 | { | |
4745 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4746 | } | |
6b0655a2 | 4747 | |
718e3744 | 4748 | DEFUN (neighbor_strict_capability, |
4749 | neighbor_strict_capability_cmd, | |
4750 | NEIGHBOR_CMD "strict-capability-match", | |
4751 | NEIGHBOR_STR | |
4752 | NEIGHBOR_ADDR_STR | |
4753 | "Strict capability negotiation match\n") | |
4754 | { | |
4755 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4756 | } | |
4757 | ||
4758 | DEFUN (no_neighbor_strict_capability, | |
4759 | no_neighbor_strict_capability_cmd, | |
4760 | NO_NEIGHBOR_CMD "strict-capability-match", | |
4761 | NO_STR | |
4762 | NEIGHBOR_STR | |
4763 | NEIGHBOR_ADDR_STR | |
4764 | "Strict capability negotiation match\n") | |
4765 | { | |
4766 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4767 | } | |
6b0655a2 | 4768 | |
94f2b392 | 4769 | static int |
fd79ac91 | 4770 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
4771 | const char *keep_str, const char *hold_str) | |
718e3744 | 4772 | { |
4773 | int ret; | |
4774 | struct peer *peer; | |
4775 | u_int32_t keepalive; | |
4776 | u_int32_t holdtime; | |
4777 | ||
4778 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4779 | if (! peer) | |
4780 | return CMD_WARNING; | |
4781 | ||
4782 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
4783 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
4784 | ||
4785 | ret = peer_timers_set (peer, keepalive, holdtime); | |
4786 | ||
4787 | return bgp_vty_return (vty, ret); | |
4788 | } | |
6b0655a2 | 4789 | |
94f2b392 | 4790 | static int |
fd79ac91 | 4791 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4792 | { |
4793 | int ret; | |
4794 | struct peer *peer; | |
4795 | ||
0c412461 | 4796 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4797 | if (! peer) |
4798 | return CMD_WARNING; | |
4799 | ||
4800 | ret = peer_timers_unset (peer); | |
4801 | ||
4802 | return bgp_vty_return (vty, ret); | |
4803 | } | |
4804 | ||
4805 | DEFUN (neighbor_timers, | |
4806 | neighbor_timers_cmd, | |
4807 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4808 | NEIGHBOR_STR | |
4809 | NEIGHBOR_ADDR_STR2 | |
4810 | "BGP per neighbor timers\n" | |
4811 | "Keepalive interval\n" | |
4812 | "Holdtime\n") | |
4813 | { | |
4814 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
4815 | } | |
4816 | ||
4817 | DEFUN (no_neighbor_timers, | |
4818 | no_neighbor_timers_cmd, | |
4819 | NO_NEIGHBOR_CMD2 "timers", | |
4820 | NO_STR | |
4821 | NEIGHBOR_STR | |
4822 | NEIGHBOR_ADDR_STR2 | |
4823 | "BGP per neighbor timers\n") | |
4824 | { | |
4825 | return peer_timers_unset_vty (vty, argv[0]); | |
4826 | } | |
6b0655a2 | 4827 | |
813d4307 DW |
4828 | ALIAS (no_neighbor_timers, |
4829 | no_neighbor_timers_val_cmd, | |
4830 | NO_NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4831 | NO_STR | |
4832 | NEIGHBOR_STR | |
4833 | NEIGHBOR_ADDR_STR2 | |
4834 | "BGP per neighbor timers\n" | |
4835 | "Keepalive interval\n" | |
4836 | "Holdtime\n") | |
4837 | ||
94f2b392 | 4838 | static int |
fd79ac91 | 4839 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
4840 | const char *time_str) | |
718e3744 | 4841 | { |
4842 | int ret; | |
4843 | struct peer *peer; | |
4844 | u_int32_t connect; | |
4845 | ||
966f821c | 4846 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4847 | if (! peer) |
4848 | return CMD_WARNING; | |
4849 | ||
4850 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
4851 | ||
4852 | ret = peer_timers_connect_set (peer, connect); | |
4853 | ||
966f821c | 4854 | return bgp_vty_return (vty, ret); |
718e3744 | 4855 | } |
4856 | ||
94f2b392 | 4857 | static int |
fd79ac91 | 4858 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4859 | { |
4860 | int ret; | |
4861 | struct peer *peer; | |
4862 | ||
4863 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4864 | if (! peer) | |
4865 | return CMD_WARNING; | |
4866 | ||
4867 | ret = peer_timers_connect_unset (peer); | |
4868 | ||
966f821c | 4869 | return bgp_vty_return (vty, ret); |
718e3744 | 4870 | } |
4871 | ||
4872 | DEFUN (neighbor_timers_connect, | |
4873 | neighbor_timers_connect_cmd, | |
8e0d0089 | 4874 | NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 4875 | NEIGHBOR_STR |
966f821c | 4876 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4877 | "BGP per neighbor timers\n" |
4878 | "BGP connect timer\n" | |
4879 | "Connect timer\n") | |
4880 | { | |
4881 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
4882 | } | |
4883 | ||
4884 | DEFUN (no_neighbor_timers_connect, | |
4885 | no_neighbor_timers_connect_cmd, | |
966f821c | 4886 | NO_NEIGHBOR_CMD2 "timers connect", |
718e3744 | 4887 | NO_STR |
4888 | NEIGHBOR_STR | |
966f821c | 4889 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4890 | "BGP per neighbor timers\n" |
4891 | "BGP connect timer\n") | |
4892 | { | |
4893 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
4894 | } | |
4895 | ||
4896 | ALIAS (no_neighbor_timers_connect, | |
4897 | no_neighbor_timers_connect_val_cmd, | |
8e0d0089 | 4898 | NO_NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 4899 | NO_STR |
4900 | NEIGHBOR_STR | |
966f821c | 4901 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4902 | "BGP per neighbor timers\n" |
4903 | "BGP connect timer\n" | |
4904 | "Connect timer\n") | |
6b0655a2 | 4905 | |
94f2b392 | 4906 | static int |
fd79ac91 | 4907 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
4908 | const char *time_str, int set) | |
718e3744 | 4909 | { |
4910 | int ret; | |
4911 | struct peer *peer; | |
4912 | u_int32_t routeadv = 0; | |
4913 | ||
966f821c | 4914 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4915 | if (! peer) |
4916 | return CMD_WARNING; | |
4917 | ||
4918 | if (time_str) | |
4919 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
4920 | ||
4921 | if (set) | |
4922 | ret = peer_advertise_interval_set (peer, routeadv); | |
4923 | else | |
4924 | ret = peer_advertise_interval_unset (peer); | |
4925 | ||
966f821c | 4926 | return bgp_vty_return (vty, ret); |
718e3744 | 4927 | } |
4928 | ||
4929 | DEFUN (neighbor_advertise_interval, | |
4930 | neighbor_advertise_interval_cmd, | |
966f821c | 4931 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4932 | NEIGHBOR_STR |
966f821c | 4933 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4934 | "Minimum interval between sending BGP routing updates\n" |
4935 | "time in seconds\n") | |
4936 | { | |
4937 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
4938 | } | |
4939 | ||
4940 | DEFUN (no_neighbor_advertise_interval, | |
4941 | no_neighbor_advertise_interval_cmd, | |
966f821c | 4942 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
718e3744 | 4943 | NO_STR |
4944 | NEIGHBOR_STR | |
966f821c | 4945 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4946 | "Minimum interval between sending BGP routing updates\n") |
4947 | { | |
4948 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
4949 | } | |
4950 | ||
4951 | ALIAS (no_neighbor_advertise_interval, | |
4952 | no_neighbor_advertise_interval_val_cmd, | |
966f821c | 4953 | NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4954 | NO_STR |
4955 | NEIGHBOR_STR | |
966f821c | 4956 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4957 | "Minimum interval between sending BGP routing updates\n" |
4958 | "time in seconds\n") | |
6b0655a2 | 4959 | |
518f0eb1 DS |
4960 | /* Time to wait before processing route-map updates */ |
4961 | DEFUN (bgp_set_route_map_delay_timer, | |
4962 | bgp_set_route_map_delay_timer_cmd, | |
4963 | "bgp route-map delay-timer <0-600>", | |
4964 | SET_STR | |
4965 | "BGP route-map delay timer\n" | |
4966 | "Time in secs to wait before processing route-map changes\n" | |
f414725f | 4967 | "0 disables the timer, no route updates happen when route-maps change\n") |
518f0eb1 DS |
4968 | { |
4969 | u_int32_t rmap_delay_timer; | |
518f0eb1 | 4970 | |
518f0eb1 DS |
4971 | if (argv[0]) |
4972 | { | |
4973 | VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); | |
5fe9f963 | 4974 | bm->rmap_update_timer = rmap_delay_timer; |
518f0eb1 DS |
4975 | |
4976 | /* if the dynamic update handling is being disabled, and a timer is | |
4977 | * running, stop the timer and act as if the timer has already fired. | |
4978 | */ | |
5fe9f963 | 4979 | if (!rmap_delay_timer && bm->t_rmap_update ) |
518f0eb1 | 4980 | { |
5fe9f963 | 4981 | BGP_TIMER_OFF(bm->t_rmap_update); |
4982 | thread_execute (bm->master, bgp_route_map_update_timer, NULL, 0); | |
518f0eb1 DS |
4983 | } |
4984 | return CMD_SUCCESS; | |
4985 | } | |
4986 | else | |
ffd0c037 | 4987 | return CMD_WARNING; |
518f0eb1 DS |
4988 | } |
4989 | ||
4990 | DEFUN (no_bgp_set_route_map_delay_timer, | |
4991 | no_bgp_set_route_map_delay_timer_cmd, | |
4992 | "no bgp route-map delay-timer", | |
4993 | NO_STR | |
4994 | "Default BGP route-map delay timer\n" | |
f414725f | 4995 | "Reset to default time to wait for processing route-map changes\n") |
518f0eb1 | 4996 | { |
518f0eb1 | 4997 | |
5fe9f963 | 4998 | bm->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER; |
518f0eb1 DS |
4999 | |
5000 | return CMD_SUCCESS; | |
5001 | } | |
5002 | ||
f414725f DS |
5003 | ALIAS (no_bgp_set_route_map_delay_timer, |
5004 | no_bgp_set_route_map_delay_timer_val_cmd, | |
5005 | "no bgp route-map delay-timer <0-600>", | |
5006 | NO_STR | |
5007 | "Default BGP route-map delay timer\n" | |
5008 | "Reset to default time to wait for processing route-map changes\n" | |
5009 | "0 disables the timer, no route updates happen when route-maps change\n") | |
5010 | ||
718e3744 | 5011 | /* neighbor interface */ |
94f2b392 | 5012 | static int |
fd79ac91 | 5013 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 5014 | { |
718e3744 | 5015 | struct peer *peer; |
5016 | ||
5017 | peer = peer_lookup_vty (vty, ip_str); | |
a80beece | 5018 | if (! peer || peer->conf_if) |
718e3744 | 5019 | return CMD_WARNING; |
5020 | ||
5021 | if (str) | |
ffd0c037 | 5022 | peer_interface_set (peer, str); |
718e3744 | 5023 | else |
ffd0c037 | 5024 | peer_interface_unset (peer); |
718e3744 | 5025 | |
5026 | return CMD_SUCCESS; | |
5027 | } | |
5028 | ||
5029 | DEFUN (neighbor_interface, | |
5030 | neighbor_interface_cmd, | |
5031 | NEIGHBOR_CMD "interface WORD", | |
5032 | NEIGHBOR_STR | |
5033 | NEIGHBOR_ADDR_STR | |
5034 | "Interface\n" | |
5035 | "Interface name\n") | |
5036 | { | |
8ffedcea DS |
5037 | if (argc == 3) |
5038 | return peer_interface_vty (vty, argv[0], argv[1]); | |
5039 | else | |
5040 | return peer_interface_vty (vty, argv[0], argv[1]); | |
718e3744 | 5041 | } |
5042 | ||
5043 | DEFUN (no_neighbor_interface, | |
5044 | no_neighbor_interface_cmd, | |
8ffedcea | 5045 | NO_NEIGHBOR_CMD2 "interface WORD", |
718e3744 | 5046 | NO_STR |
5047 | NEIGHBOR_STR | |
5048 | NEIGHBOR_ADDR_STR | |
5049 | "Interface\n" | |
5050 | "Interface name\n") | |
5051 | { | |
5052 | return peer_interface_vty (vty, argv[0], NULL); | |
5053 | } | |
6b0655a2 | 5054 | |
718e3744 | 5055 | /* Set distribute list to the peer. */ |
94f2b392 | 5056 | static int |
fd79ac91 | 5057 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
5058 | afi_t afi, safi_t safi, | |
5059 | const char *name_str, const char *direct_str) | |
718e3744 | 5060 | { |
5061 | int ret; | |
5062 | struct peer *peer; | |
5063 | int direct = FILTER_IN; | |
5064 | ||
5065 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5066 | if (! peer) | |
5067 | return CMD_WARNING; | |
5068 | ||
5069 | /* Check filter direction. */ | |
5070 | if (strncmp (direct_str, "i", 1) == 0) | |
5071 | direct = FILTER_IN; | |
5072 | else if (strncmp (direct_str, "o", 1) == 0) | |
5073 | direct = FILTER_OUT; | |
5074 | ||
5075 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
5076 | ||
5077 | return bgp_vty_return (vty, ret); | |
5078 | } | |
5079 | ||
94f2b392 | 5080 | static int |
fd79ac91 | 5081 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5082 | safi_t safi, const char *direct_str) | |
718e3744 | 5083 | { |
5084 | int ret; | |
5085 | struct peer *peer; | |
5086 | int direct = FILTER_IN; | |
5087 | ||
5088 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5089 | if (! peer) | |
5090 | return CMD_WARNING; | |
5091 | ||
5092 | /* Check filter direction. */ | |
5093 | if (strncmp (direct_str, "i", 1) == 0) | |
5094 | direct = FILTER_IN; | |
5095 | else if (strncmp (direct_str, "o", 1) == 0) | |
5096 | direct = FILTER_OUT; | |
5097 | ||
5098 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
5099 | ||
5100 | return bgp_vty_return (vty, ret); | |
5101 | } | |
5102 | ||
5103 | DEFUN (neighbor_distribute_list, | |
5104 | neighbor_distribute_list_cmd, | |
5105 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5106 | NEIGHBOR_STR | |
5107 | NEIGHBOR_ADDR_STR2 | |
5108 | "Filter updates to/from this neighbor\n" | |
5109 | "IP access-list number\n" | |
5110 | "IP access-list number (expanded range)\n" | |
5111 | "IP Access-list name\n" | |
5112 | "Filter incoming updates\n" | |
5113 | "Filter outgoing updates\n") | |
5114 | { | |
5115 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5116 | bgp_node_safi (vty), argv[1], argv[2]); | |
5117 | } | |
5118 | ||
5119 | DEFUN (no_neighbor_distribute_list, | |
5120 | no_neighbor_distribute_list_cmd, | |
5121 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5122 | NO_STR | |
5123 | NEIGHBOR_STR | |
5124 | NEIGHBOR_ADDR_STR2 | |
5125 | "Filter updates to/from this neighbor\n" | |
5126 | "IP access-list number\n" | |
5127 | "IP access-list number (expanded range)\n" | |
5128 | "IP Access-list name\n" | |
5129 | "Filter incoming updates\n" | |
5130 | "Filter outgoing updates\n") | |
5131 | { | |
5132 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5133 | bgp_node_safi (vty), argv[2]); | |
5134 | } | |
6b0655a2 | 5135 | |
718e3744 | 5136 | /* Set prefix list to the peer. */ |
94f2b392 | 5137 | static int |
fd79ac91 | 5138 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5139 | safi_t safi, const char *name_str, | |
5140 | const char *direct_str) | |
718e3744 | 5141 | { |
5142 | int ret; | |
5143 | struct peer *peer; | |
5144 | int direct = FILTER_IN; | |
5145 | ||
5146 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5147 | if (! peer) | |
5148 | return CMD_WARNING; | |
5149 | ||
5150 | /* Check filter direction. */ | |
5151 | if (strncmp (direct_str, "i", 1) == 0) | |
5152 | direct = FILTER_IN; | |
5153 | else if (strncmp (direct_str, "o", 1) == 0) | |
5154 | direct = FILTER_OUT; | |
5155 | ||
5156 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
5157 | ||
5158 | return bgp_vty_return (vty, ret); | |
5159 | } | |
5160 | ||
94f2b392 | 5161 | static int |
fd79ac91 | 5162 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5163 | safi_t safi, const char *direct_str) | |
718e3744 | 5164 | { |
5165 | int ret; | |
5166 | struct peer *peer; | |
5167 | int direct = FILTER_IN; | |
5168 | ||
5169 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5170 | if (! peer) | |
5171 | return CMD_WARNING; | |
5172 | ||
5173 | /* Check filter direction. */ | |
5174 | if (strncmp (direct_str, "i", 1) == 0) | |
5175 | direct = FILTER_IN; | |
5176 | else if (strncmp (direct_str, "o", 1) == 0) | |
5177 | direct = FILTER_OUT; | |
5178 | ||
5179 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
5180 | ||
5181 | return bgp_vty_return (vty, ret); | |
5182 | } | |
5183 | ||
5184 | DEFUN (neighbor_prefix_list, | |
5185 | neighbor_prefix_list_cmd, | |
5186 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5187 | NEIGHBOR_STR | |
5188 | NEIGHBOR_ADDR_STR2 | |
5189 | "Filter updates to/from this neighbor\n" | |
5190 | "Name of a prefix list\n" | |
5191 | "Filter incoming updates\n" | |
5192 | "Filter outgoing updates\n") | |
5193 | { | |
5194 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5195 | bgp_node_safi (vty), argv[1], argv[2]); | |
5196 | } | |
5197 | ||
5198 | DEFUN (no_neighbor_prefix_list, | |
5199 | no_neighbor_prefix_list_cmd, | |
5200 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5201 | NO_STR | |
5202 | NEIGHBOR_STR | |
5203 | NEIGHBOR_ADDR_STR2 | |
5204 | "Filter updates to/from this neighbor\n" | |
5205 | "Name of a prefix list\n" | |
5206 | "Filter incoming updates\n" | |
5207 | "Filter outgoing updates\n") | |
5208 | { | |
5209 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5210 | bgp_node_safi (vty), argv[2]); | |
5211 | } | |
6b0655a2 | 5212 | |
94f2b392 | 5213 | static int |
fd79ac91 | 5214 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
5215 | afi_t afi, safi_t safi, | |
5216 | const char *name_str, const char *direct_str) | |
718e3744 | 5217 | { |
5218 | int ret; | |
5219 | struct peer *peer; | |
5220 | int direct = FILTER_IN; | |
5221 | ||
5222 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5223 | if (! peer) | |
5224 | return CMD_WARNING; | |
5225 | ||
5226 | /* Check filter direction. */ | |
5227 | if (strncmp (direct_str, "i", 1) == 0) | |
5228 | direct = FILTER_IN; | |
5229 | else if (strncmp (direct_str, "o", 1) == 0) | |
5230 | direct = FILTER_OUT; | |
5231 | ||
5232 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
5233 | ||
5234 | return bgp_vty_return (vty, ret); | |
5235 | } | |
5236 | ||
94f2b392 | 5237 | static int |
fd79ac91 | 5238 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
5239 | afi_t afi, safi_t safi, | |
5240 | const char *direct_str) | |
718e3744 | 5241 | { |
5242 | int ret; | |
5243 | struct peer *peer; | |
5244 | int direct = FILTER_IN; | |
5245 | ||
5246 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5247 | if (! peer) | |
5248 | return CMD_WARNING; | |
5249 | ||
5250 | /* Check filter direction. */ | |
5251 | if (strncmp (direct_str, "i", 1) == 0) | |
5252 | direct = FILTER_IN; | |
5253 | else if (strncmp (direct_str, "o", 1) == 0) | |
5254 | direct = FILTER_OUT; | |
5255 | ||
5256 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
5257 | ||
5258 | return bgp_vty_return (vty, ret); | |
5259 | } | |
5260 | ||
5261 | DEFUN (neighbor_filter_list, | |
5262 | neighbor_filter_list_cmd, | |
5263 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5264 | NEIGHBOR_STR | |
5265 | NEIGHBOR_ADDR_STR2 | |
5266 | "Establish BGP filters\n" | |
5267 | "AS path access-list name\n" | |
5268 | "Filter incoming routes\n" | |
5269 | "Filter outgoing routes\n") | |
5270 | { | |
5271 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5272 | bgp_node_safi (vty), argv[1], argv[2]); | |
5273 | } | |
5274 | ||
5275 | DEFUN (no_neighbor_filter_list, | |
5276 | no_neighbor_filter_list_cmd, | |
5277 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5278 | NO_STR | |
5279 | NEIGHBOR_STR | |
5280 | NEIGHBOR_ADDR_STR2 | |
5281 | "Establish BGP filters\n" | |
5282 | "AS path access-list name\n" | |
5283 | "Filter incoming routes\n" | |
5284 | "Filter outgoing routes\n") | |
5285 | { | |
5286 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5287 | bgp_node_safi (vty), argv[2]); | |
5288 | } | |
6b0655a2 | 5289 | |
718e3744 | 5290 | /* Set route-map to the peer. */ |
94f2b392 | 5291 | static int |
fd79ac91 | 5292 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
5293 | afi_t afi, safi_t safi, | |
5294 | const char *name_str, const char *direct_str) | |
718e3744 | 5295 | { |
5296 | int ret; | |
5297 | struct peer *peer; | |
fee0f4c6 | 5298 | int direct = RMAP_IN; |
718e3744 | 5299 | |
5300 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5301 | if (! peer) | |
5302 | return CMD_WARNING; | |
5303 | ||
5304 | /* Check filter direction. */ | |
fee0f4c6 | 5305 | if (strncmp (direct_str, "in", 2) == 0) |
5306 | direct = RMAP_IN; | |
718e3744 | 5307 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5308 | direct = RMAP_OUT; |
718e3744 | 5309 | |
5310 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
5311 | ||
5312 | return bgp_vty_return (vty, ret); | |
5313 | } | |
5314 | ||
94f2b392 | 5315 | static int |
fd79ac91 | 5316 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5317 | safi_t safi, const char *direct_str) | |
718e3744 | 5318 | { |
5319 | int ret; | |
5320 | struct peer *peer; | |
fee0f4c6 | 5321 | int direct = RMAP_IN; |
718e3744 | 5322 | |
5323 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5324 | if (! peer) | |
5325 | return CMD_WARNING; | |
5326 | ||
5327 | /* Check filter direction. */ | |
fee0f4c6 | 5328 | if (strncmp (direct_str, "in", 2) == 0) |
5329 | direct = RMAP_IN; | |
718e3744 | 5330 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5331 | direct = RMAP_OUT; |
718e3744 | 5332 | |
5333 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
5334 | ||
5335 | return bgp_vty_return (vty, ret); | |
5336 | } | |
5337 | ||
5338 | DEFUN (neighbor_route_map, | |
5339 | neighbor_route_map_cmd, | |
2a3d5731 | 5340 | NEIGHBOR_CMD2 "route-map WORD (in|out)", |
718e3744 | 5341 | NEIGHBOR_STR |
5342 | NEIGHBOR_ADDR_STR2 | |
5343 | "Apply route map to neighbor\n" | |
5344 | "Name of route map\n" | |
5345 | "Apply map to incoming routes\n" | |
2a3d5731 | 5346 | "Apply map to outbound routes\n") |
718e3744 | 5347 | { |
5348 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5349 | bgp_node_safi (vty), argv[1], argv[2]); | |
5350 | } | |
5351 | ||
5352 | DEFUN (no_neighbor_route_map, | |
5353 | no_neighbor_route_map_cmd, | |
2a3d5731 | 5354 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out)", |
718e3744 | 5355 | NO_STR |
5356 | NEIGHBOR_STR | |
5357 | NEIGHBOR_ADDR_STR2 | |
5358 | "Apply route map to neighbor\n" | |
5359 | "Name of route map\n" | |
5360 | "Apply map to incoming routes\n" | |
2a3d5731 | 5361 | "Apply map to outbound routes\n") |
718e3744 | 5362 | { |
5363 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5364 | bgp_node_safi (vty), argv[2]); | |
5365 | } | |
6b0655a2 | 5366 | |
718e3744 | 5367 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 5368 | static int |
fd79ac91 | 5369 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5370 | safi_t safi, const char *name_str) | |
718e3744 | 5371 | { |
5372 | int ret; | |
5373 | struct peer *peer; | |
5374 | ||
5375 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5376 | if (! peer) | |
5377 | return CMD_WARNING; | |
5378 | ||
5379 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
5380 | ||
5381 | return bgp_vty_return (vty, ret); | |
5382 | } | |
5383 | ||
5384 | /* Unset route-map from the peer. */ | |
94f2b392 | 5385 | static int |
fd79ac91 | 5386 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5387 | safi_t safi) |
5388 | { | |
5389 | int ret; | |
5390 | struct peer *peer; | |
5391 | ||
5392 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5393 | if (! peer) | |
5394 | return CMD_WARNING; | |
5395 | ||
5396 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
5397 | ||
5398 | return bgp_vty_return (vty, ret); | |
5399 | } | |
5400 | ||
5401 | DEFUN (neighbor_unsuppress_map, | |
5402 | neighbor_unsuppress_map_cmd, | |
5403 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5404 | NEIGHBOR_STR | |
5405 | NEIGHBOR_ADDR_STR2 | |
5406 | "Route-map to selectively unsuppress suppressed routes\n" | |
5407 | "Name of route map\n") | |
5408 | { | |
5409 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5410 | bgp_node_safi (vty), argv[1]); | |
5411 | } | |
5412 | ||
5413 | DEFUN (no_neighbor_unsuppress_map, | |
5414 | no_neighbor_unsuppress_map_cmd, | |
5415 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5416 | NO_STR | |
5417 | NEIGHBOR_STR | |
5418 | NEIGHBOR_ADDR_STR2 | |
5419 | "Route-map to selectively unsuppress suppressed routes\n" | |
5420 | "Name of route map\n") | |
5421 | { | |
5422 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5423 | bgp_node_safi (vty)); | |
5424 | } | |
6b0655a2 | 5425 | |
94f2b392 | 5426 | static int |
fd79ac91 | 5427 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5428 | safi_t safi, const char *num_str, | |
0a486e5f | 5429 | const char *threshold_str, int warning, |
5430 | const char *restart_str) | |
718e3744 | 5431 | { |
5432 | int ret; | |
5433 | struct peer *peer; | |
5434 | u_int32_t max; | |
e0701b79 | 5435 | u_char threshold; |
0a486e5f | 5436 | u_int16_t restart; |
718e3744 | 5437 | |
5438 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5439 | if (! peer) | |
5440 | return CMD_WARNING; | |
5441 | ||
e6ec1c36 | 5442 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 5443 | if (threshold_str) |
5444 | threshold = atoi (threshold_str); | |
5445 | else | |
5446 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 5447 | |
0a486e5f | 5448 | if (restart_str) |
5449 | restart = atoi (restart_str); | |
5450 | else | |
5451 | restart = 0; | |
5452 | ||
5453 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 5454 | |
5455 | return bgp_vty_return (vty, ret); | |
5456 | } | |
5457 | ||
94f2b392 | 5458 | static int |
fd79ac91 | 5459 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5460 | safi_t safi) |
5461 | { | |
5462 | int ret; | |
5463 | struct peer *peer; | |
5464 | ||
5465 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5466 | if (! peer) | |
5467 | return CMD_WARNING; | |
5468 | ||
5469 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
5470 | ||
5471 | return bgp_vty_return (vty, ret); | |
5472 | } | |
5473 | ||
5474 | /* Maximum number of prefix configuration. prefix count is different | |
5475 | for each peer configuration. So this configuration can be set for | |
5476 | each peer configuration. */ | |
5477 | DEFUN (neighbor_maximum_prefix, | |
5478 | neighbor_maximum_prefix_cmd, | |
5479 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5480 | NEIGHBOR_STR | |
5481 | NEIGHBOR_ADDR_STR2 | |
5482 | "Maximum number of prefix accept from this peer\n" | |
5483 | "maximum no. of prefix limit\n") | |
5484 | { | |
5485 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5486 | bgp_node_safi (vty), argv[1], NULL, 0, |
5487 | NULL); | |
718e3744 | 5488 | } |
5489 | ||
e0701b79 | 5490 | DEFUN (neighbor_maximum_prefix_threshold, |
5491 | neighbor_maximum_prefix_threshold_cmd, | |
5492 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
5493 | NEIGHBOR_STR | |
5494 | NEIGHBOR_ADDR_STR2 | |
5495 | "Maximum number of prefix accept from this peer\n" | |
5496 | "maximum no. of prefix limit\n" | |
5497 | "Threshold value (%) at which to generate a warning msg\n") | |
5498 | { | |
5499 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5500 | bgp_node_safi (vty), argv[1], argv[2], 0, |
5501 | NULL); | |
5502 | } | |
e0701b79 | 5503 | |
718e3744 | 5504 | DEFUN (neighbor_maximum_prefix_warning, |
5505 | neighbor_maximum_prefix_warning_cmd, | |
5506 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5507 | NEIGHBOR_STR | |
5508 | NEIGHBOR_ADDR_STR2 | |
5509 | "Maximum number of prefix accept from this peer\n" | |
5510 | "maximum no. of prefix limit\n" | |
5511 | "Only give warning message when limit is exceeded\n") | |
5512 | { | |
5513 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5514 | bgp_node_safi (vty), argv[1], NULL, 1, |
5515 | NULL); | |
718e3744 | 5516 | } |
5517 | ||
e0701b79 | 5518 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
5519 | neighbor_maximum_prefix_threshold_warning_cmd, | |
5520 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
5521 | NEIGHBOR_STR | |
5522 | NEIGHBOR_ADDR_STR2 | |
5523 | "Maximum number of prefix accept from this peer\n" | |
5524 | "maximum no. of prefix limit\n" | |
5525 | "Threshold value (%) at which to generate a warning msg\n" | |
5526 | "Only give warning message when limit is exceeded\n") | |
5527 | { | |
5528 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5529 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
5530 | } | |
5531 | ||
5532 | DEFUN (neighbor_maximum_prefix_restart, | |
5533 | neighbor_maximum_prefix_restart_cmd, | |
5534 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
5535 | NEIGHBOR_STR | |
5536 | NEIGHBOR_ADDR_STR2 | |
5537 | "Maximum number of prefix accept from this peer\n" | |
5538 | "maximum no. of prefix limit\n" | |
5539 | "Restart bgp connection after limit is exceeded\n" | |
5540 | "Restart interval in minutes") | |
5541 | { | |
5542 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5543 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
5544 | } | |
5545 | ||
5546 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
5547 | neighbor_maximum_prefix_threshold_restart_cmd, | |
5548 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5549 | NEIGHBOR_STR | |
5550 | NEIGHBOR_ADDR_STR2 | |
5551 | "Maximum number of prefix accept from this peer\n" | |
5552 | "maximum no. of prefix limit\n" | |
5553 | "Threshold value (%) at which to generate a warning msg\n" | |
5554 | "Restart bgp connection after limit is exceeded\n" | |
5555 | "Restart interval in minutes") | |
5556 | { | |
5557 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5558 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
5559 | } | |
e0701b79 | 5560 | |
718e3744 | 5561 | DEFUN (no_neighbor_maximum_prefix, |
5562 | no_neighbor_maximum_prefix_cmd, | |
5563 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
5564 | NO_STR | |
5565 | NEIGHBOR_STR | |
5566 | NEIGHBOR_ADDR_STR2 | |
5567 | "Maximum number of prefix accept from this peer\n") | |
5568 | { | |
5569 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5570 | bgp_node_safi (vty)); | |
5571 | } | |
5572 | ||
5573 | ALIAS (no_neighbor_maximum_prefix, | |
5574 | no_neighbor_maximum_prefix_val_cmd, | |
5575 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5576 | NO_STR | |
5577 | NEIGHBOR_STR | |
5578 | NEIGHBOR_ADDR_STR2 | |
5579 | "Maximum number of prefix accept from this peer\n" | |
5580 | "maximum no. of prefix limit\n") | |
5581 | ||
5582 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5583 | no_neighbor_maximum_prefix_threshold_cmd, |
813d4307 | 5584 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
0a486e5f | 5585 | NO_STR |
5586 | NEIGHBOR_STR | |
5587 | NEIGHBOR_ADDR_STR2 | |
5588 | "Maximum number of prefix accept from this peer\n" | |
5589 | "maximum no. of prefix limit\n" | |
5590 | "Threshold value (%) at which to generate a warning msg\n") | |
5591 | ||
5592 | ALIAS (no_neighbor_maximum_prefix, | |
5593 | no_neighbor_maximum_prefix_warning_cmd, | |
5594 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5595 | NO_STR | |
5596 | NEIGHBOR_STR | |
5597 | NEIGHBOR_ADDR_STR2 | |
5598 | "Maximum number of prefix accept from this peer\n" | |
5599 | "maximum no. of prefix limit\n" | |
e8e1946e | 5600 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 5601 | |
5602 | ALIAS (no_neighbor_maximum_prefix, | |
5603 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 5604 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
5605 | NO_STR | |
5606 | NEIGHBOR_STR | |
5607 | NEIGHBOR_ADDR_STR2 | |
5608 | "Maximum number of prefix accept from this peer\n" | |
5609 | "maximum no. of prefix limit\n" | |
5610 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 5611 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 5612 | |
5613 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5614 | no_neighbor_maximum_prefix_restart_cmd, |
5615 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 5616 | NO_STR |
5617 | NEIGHBOR_STR | |
5618 | NEIGHBOR_ADDR_STR2 | |
5619 | "Maximum number of prefix accept from this peer\n" | |
5620 | "maximum no. of prefix limit\n" | |
0a486e5f | 5621 | "Restart bgp connection after limit is exceeded\n" |
5622 | "Restart interval in minutes") | |
5623 | ||
5624 | ALIAS (no_neighbor_maximum_prefix, | |
5625 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
5626 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5627 | NO_STR | |
5628 | NEIGHBOR_STR | |
5629 | NEIGHBOR_ADDR_STR2 | |
5630 | "Maximum number of prefix accept from this peer\n" | |
5631 | "maximum no. of prefix limit\n" | |
5632 | "Threshold value (%) at which to generate a warning msg\n" | |
5633 | "Restart bgp connection after limit is exceeded\n" | |
5634 | "Restart interval in minutes") | |
6b0655a2 | 5635 | |
718e3744 | 5636 | /* "neighbor allowas-in" */ |
5637 | DEFUN (neighbor_allowas_in, | |
5638 | neighbor_allowas_in_cmd, | |
5639 | NEIGHBOR_CMD2 "allowas-in", | |
5640 | NEIGHBOR_STR | |
5641 | NEIGHBOR_ADDR_STR2 | |
5642 | "Accept as-path with my AS present in it\n") | |
5643 | { | |
5644 | int ret; | |
5645 | struct peer *peer; | |
fd79ac91 | 5646 | unsigned int allow_num; |
718e3744 | 5647 | |
5648 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5649 | if (! peer) | |
5650 | return CMD_WARNING; | |
5651 | ||
5652 | if (argc == 1) | |
5653 | allow_num = 3; | |
5654 | else | |
5655 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
5656 | ||
5657 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
5658 | allow_num); | |
5659 | ||
5660 | return bgp_vty_return (vty, ret); | |
5661 | } | |
5662 | ||
5663 | ALIAS (neighbor_allowas_in, | |
5664 | neighbor_allowas_in_arg_cmd, | |
5665 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5666 | NEIGHBOR_STR | |
5667 | NEIGHBOR_ADDR_STR2 | |
5668 | "Accept as-path with my AS present in it\n" | |
5669 | "Number of occurances of AS number\n") | |
5670 | ||
5671 | DEFUN (no_neighbor_allowas_in, | |
5672 | no_neighbor_allowas_in_cmd, | |
5673 | NO_NEIGHBOR_CMD2 "allowas-in", | |
5674 | NO_STR | |
5675 | NEIGHBOR_STR | |
5676 | NEIGHBOR_ADDR_STR2 | |
5677 | "allow local ASN appears in aspath attribute\n") | |
5678 | { | |
5679 | int ret; | |
5680 | struct peer *peer; | |
5681 | ||
5682 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5683 | if (! peer) | |
5684 | return CMD_WARNING; | |
5685 | ||
5686 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
5687 | ||
5688 | return bgp_vty_return (vty, ret); | |
5689 | } | |
6b0655a2 | 5690 | |
813d4307 DW |
5691 | ALIAS (no_neighbor_allowas_in, |
5692 | no_neighbor_allowas_in_val_cmd, | |
5693 | NO_NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5694 | NO_STR | |
5695 | NEIGHBOR_STR | |
5696 | NEIGHBOR_ADDR_STR2 | |
5697 | "allow local ASN appears in aspath attribute\n" | |
5698 | "Number of occurances of AS number\n") | |
5699 | ||
fa411a21 NH |
5700 | DEFUN (neighbor_ttl_security, |
5701 | neighbor_ttl_security_cmd, | |
5702 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5703 | NEIGHBOR_STR | |
5704 | NEIGHBOR_ADDR_STR2 | |
5705 | "Specify the maximum number of hops to the BGP peer\n") | |
5706 | { | |
5707 | struct peer *peer; | |
89b6d1f8 | 5708 | int gtsm_hops; |
fa411a21 NH |
5709 | |
5710 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5711 | if (! peer) | |
5712 | return CMD_WARNING; | |
5713 | ||
5714 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); | |
5715 | ||
89b6d1f8 | 5716 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
5717 | } |
5718 | ||
5719 | DEFUN (no_neighbor_ttl_security, | |
5720 | no_neighbor_ttl_security_cmd, | |
5721 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5722 | NO_STR | |
5723 | NEIGHBOR_STR | |
5724 | NEIGHBOR_ADDR_STR2 | |
5725 | "Specify the maximum number of hops to the BGP peer\n") | |
5726 | { | |
5727 | struct peer *peer; | |
fa411a21 NH |
5728 | |
5729 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5730 | if (! peer) | |
5731 | return CMD_WARNING; | |
5732 | ||
89b6d1f8 | 5733 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 5734 | } |
6b0655a2 | 5735 | |
adbac85e DW |
5736 | DEFUN (neighbor_addpath_tx_all_paths, |
5737 | neighbor_addpath_tx_all_paths_cmd, | |
5738 | NEIGHBOR_CMD2 "addpath-tx-all-paths", | |
5739 | NEIGHBOR_STR | |
5740 | NEIGHBOR_ADDR_STR2 | |
5741 | "Use addpath to advertise all paths to a neighbor\n") | |
5742 | { | |
5743 | struct peer *peer; | |
5744 | ||
adbac85e DW |
5745 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
5746 | if (! peer) | |
5747 | return CMD_WARNING; | |
5748 | ||
5749 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5750 | bgp_node_safi (vty), | |
5751 | PEER_FLAG_ADDPATH_TX_ALL_PATHS); | |
5752 | } | |
5753 | ||
5754 | DEFUN (no_neighbor_addpath_tx_all_paths, | |
5755 | no_neighbor_addpath_tx_all_paths_cmd, | |
5756 | NO_NEIGHBOR_CMD2 "addpath-tx-all-paths", | |
5757 | NO_STR | |
5758 | NEIGHBOR_STR | |
5759 | NEIGHBOR_ADDR_STR2 | |
5760 | "Use addpath to advertise all paths to a neighbor\n") | |
5761 | { | |
5762 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5763 | bgp_node_safi (vty), | |
5764 | PEER_FLAG_ADDPATH_TX_ALL_PATHS); | |
5765 | } | |
5766 | ||
06370dac DW |
5767 | DEFUN (neighbor_addpath_tx_bestpath_per_as, |
5768 | neighbor_addpath_tx_bestpath_per_as_cmd, | |
5769 | NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", | |
5770 | NEIGHBOR_STR | |
5771 | NEIGHBOR_ADDR_STR2 | |
5772 | "Use addpath to advertise the bestpath per each neighboring AS\n") | |
5773 | { | |
5774 | struct peer *peer; | |
5775 | ||
5776 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5777 | if (! peer) | |
5778 | return CMD_WARNING; | |
5779 | ||
5780 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5781 | bgp_node_safi (vty), | |
5782 | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); | |
5783 | } | |
5784 | ||
5785 | DEFUN (no_neighbor_addpath_tx_bestpath_per_as, | |
5786 | no_neighbor_addpath_tx_bestpath_per_as_cmd, | |
5787 | NO_NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", | |
5788 | NO_STR | |
5789 | NEIGHBOR_STR | |
5790 | NEIGHBOR_ADDR_STR2 | |
5791 | "Use addpath to advertise the bestpath per each neighboring AS\n") | |
5792 | { | |
5793 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5794 | bgp_node_safi (vty), | |
5795 | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); | |
5796 | } | |
5797 | ||
5798 | ||
718e3744 | 5799 | /* Address family configuration. */ |
5800 | DEFUN (address_family_ipv4, | |
5801 | address_family_ipv4_cmd, | |
5802 | "address-family ipv4", | |
5803 | "Enter Address Family command mode\n" | |
5804 | "Address family\n") | |
5805 | { | |
5806 | vty->node = BGP_IPV4_NODE; | |
5807 | return CMD_SUCCESS; | |
5808 | } | |
5809 | ||
5810 | DEFUN (address_family_ipv4_safi, | |
5811 | address_family_ipv4_safi_cmd, | |
5812 | "address-family ipv4 (unicast|multicast)", | |
5813 | "Enter Address Family command mode\n" | |
5814 | "Address family\n" | |
5815 | "Address Family modifier\n" | |
5816 | "Address Family modifier\n") | |
5817 | { | |
5818 | if (strncmp (argv[0], "m", 1) == 0) | |
5819 | vty->node = BGP_IPV4M_NODE; | |
5820 | else | |
5821 | vty->node = BGP_IPV4_NODE; | |
5822 | ||
5823 | return CMD_SUCCESS; | |
5824 | } | |
5825 | ||
25ffbdc1 | 5826 | DEFUN (address_family_ipv6, |
5827 | address_family_ipv6_cmd, | |
5828 | "address-family ipv6", | |
718e3744 | 5829 | "Enter Address Family command mode\n" |
25ffbdc1 | 5830 | "Address family\n") |
718e3744 | 5831 | { |
5832 | vty->node = BGP_IPV6_NODE; | |
5833 | return CMD_SUCCESS; | |
5834 | } | |
5835 | ||
25ffbdc1 | 5836 | DEFUN (address_family_ipv6_safi, |
5837 | address_family_ipv6_safi_cmd, | |
5838 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 5839 | "Enter Address Family command mode\n" |
25ffbdc1 | 5840 | "Address family\n" |
5841 | "Address Family modifier\n" | |
5842 | "Address Family modifier\n") | |
5843 | { | |
5844 | if (strncmp (argv[0], "m", 1) == 0) | |
5845 | vty->node = BGP_IPV6M_NODE; | |
5846 | else | |
5847 | vty->node = BGP_IPV6_NODE; | |
5848 | ||
5849 | return CMD_SUCCESS; | |
5850 | } | |
718e3744 | 5851 | |
5852 | DEFUN (address_family_vpnv4, | |
5853 | address_family_vpnv4_cmd, | |
5854 | "address-family vpnv4", | |
5855 | "Enter Address Family command mode\n" | |
5856 | "Address family\n") | |
5857 | { | |
5858 | vty->node = BGP_VPNV4_NODE; | |
5859 | return CMD_SUCCESS; | |
5860 | } | |
5861 | ||
5862 | ALIAS (address_family_vpnv4, | |
5863 | address_family_vpnv4_unicast_cmd, | |
5864 | "address-family vpnv4 unicast", | |
5865 | "Enter Address Family command mode\n" | |
5866 | "Address family\n" | |
5867 | "Address Family Modifier\n") | |
5868 | ||
8ecd3266 | 5869 | DEFUN (address_family_vpnv6, |
5870 | address_family_vpnv6_cmd, | |
5871 | "address-family vpnv6", | |
5872 | "Enter Address Family command mode\n" | |
5873 | "Address family\n") | |
5874 | { | |
5875 | vty->node = BGP_VPNV6_NODE; | |
5876 | return CMD_SUCCESS; | |
5877 | } | |
5878 | ||
5879 | ALIAS (address_family_vpnv6, | |
5880 | address_family_vpnv6_unicast_cmd, | |
5881 | "address-family vpnv6 unicast", | |
5882 | "Enter Address Family command mode\n" | |
5883 | "Address family\n" | |
5884 | "Address Family Modifier\n") | |
5885 | ||
718e3744 | 5886 | DEFUN (exit_address_family, |
5887 | exit_address_family_cmd, | |
5888 | "exit-address-family", | |
5889 | "Exit from Address Family configuration mode\n") | |
5890 | { | |
a8a80d53 | 5891 | if (vty->node == BGP_IPV4_NODE |
5892 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 5893 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 5894 | || vty->node == BGP_IPV6_NODE |
8ecd3266 | 5895 | || vty->node == BGP_IPV6M_NODE |
5896 | || vty->node == BGP_VPNV6_NODE) | |
718e3744 | 5897 | vty->node = BGP_NODE; |
5898 | return CMD_SUCCESS; | |
5899 | } | |
6b0655a2 | 5900 | |
8ad7271d DS |
5901 | /* Recalculate bestpath and re-advertise a prefix */ |
5902 | static int | |
01080f7c | 5903 | bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, |
8ad7271d DS |
5904 | afi_t afi, safi_t safi, struct prefix_rd *prd) |
5905 | { | |
5906 | int ret; | |
5907 | struct prefix match; | |
5908 | struct bgp_node *rn; | |
5909 | struct bgp_node *rm; | |
8ad7271d DS |
5910 | struct bgp *bgp; |
5911 | struct bgp_table *table; | |
5912 | struct bgp_table *rib; | |
5913 | ||
5914 | /* BGP structure lookup. */ | |
5915 | if (view_name) | |
5916 | { | |
5917 | bgp = bgp_lookup_by_name (view_name); | |
5918 | if (bgp == NULL) | |
5919 | { | |
6aeb9e78 | 5920 | vty_out (vty, "%% Can't find BGP instance %s%s", view_name, VTY_NEWLINE); |
8ad7271d DS |
5921 | return CMD_WARNING; |
5922 | } | |
5923 | } | |
5924 | else | |
5925 | { | |
5926 | bgp = bgp_get_default (); | |
5927 | if (bgp == NULL) | |
5928 | { | |
5929 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
5930 | return CMD_WARNING; | |
5931 | } | |
5932 | } | |
5933 | ||
5934 | /* Check IP address argument. */ | |
5935 | ret = str2prefix (ip_str, &match); | |
5936 | if (! ret) | |
5937 | { | |
5938 | vty_out (vty, "%% address is malformed%s", VTY_NEWLINE); | |
5939 | return CMD_WARNING; | |
5940 | } | |
5941 | ||
5942 | match.family = afi2family (afi); | |
5943 | rib = bgp->rib[afi][safi]; | |
5944 | ||
5945 | if (safi == SAFI_MPLS_VPN) | |
5946 | { | |
5947 | for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn)) | |
5948 | { | |
5949 | if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) | |
5950 | continue; | |
5951 | ||
5952 | if ((table = rn->info) != NULL) | |
5953 | { | |
5954 | if ((rm = bgp_node_match (table, &match)) != NULL) | |
5955 | { | |
5956 | if (rm->p.prefixlen == match.prefixlen) | |
5957 | { | |
5958 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5959 | bgp_process (bgp, rm, afi, safi); | |
5960 | } | |
5961 | bgp_unlock_node (rm); | |
5962 | } | |
5963 | } | |
5964 | } | |
5965 | } | |
5966 | else | |
5967 | { | |
5968 | if ((rn = bgp_node_match (rib, &match)) != NULL) | |
5969 | { | |
5970 | if (rn->p.prefixlen == match.prefixlen) | |
5971 | { | |
5972 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5973 | bgp_process (bgp, rn, afi, safi); | |
5974 | } | |
5975 | bgp_unlock_node (rn); | |
5976 | } | |
5977 | } | |
5978 | ||
5979 | return CMD_SUCCESS; | |
5980 | } | |
5981 | ||
718e3744 | 5982 | DEFUN (clear_ip_bgp_all, |
5983 | clear_ip_bgp_all_cmd, | |
5984 | "clear ip bgp *", | |
5985 | CLEAR_STR | |
5986 | IP_STR | |
5987 | BGP_STR | |
5988 | "Clear all peers\n") | |
5989 | { | |
6aeb9e78 DS |
5990 | if (argc == 2) |
5991 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
718e3744 | 5992 | |
5993 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5994 | } | |
5995 | ||
01080f7c | 5996 | ALIAS (clear_ip_bgp_all, |
5997 | clear_ip_bgp_instance_all_cmd, | |
5998 | "clear ip bgp " BGP_INSTANCE_CMD " *", | |
5999 | CLEAR_STR | |
6000 | IP_STR | |
6001 | BGP_STR | |
6002 | BGP_INSTANCE_HELP_STR | |
6003 | "Clear all peers\n") | |
6004 | ||
718e3744 | 6005 | ALIAS (clear_ip_bgp_all, |
6006 | clear_bgp_all_cmd, | |
6007 | "clear bgp *", | |
6008 | CLEAR_STR | |
6009 | BGP_STR | |
6010 | "Clear all peers\n") | |
6011 | ||
6012 | ALIAS (clear_ip_bgp_all, | |
01080f7c | 6013 | clear_bgp_instance_all_cmd, |
6014 | "clear bgp " BGP_INSTANCE_CMD " *", | |
718e3744 | 6015 | CLEAR_STR |
6016 | BGP_STR | |
01080f7c | 6017 | BGP_INSTANCE_HELP_STR |
718e3744 | 6018 | "Clear all peers\n") |
6019 | ||
6020 | ALIAS (clear_ip_bgp_all, | |
01080f7c | 6021 | clear_bgp_ipv6_all_cmd, |
6022 | "clear bgp ipv6 *", | |
718e3744 | 6023 | CLEAR_STR |
718e3744 | 6024 | BGP_STR |
01080f7c | 6025 | "Address family\n" |
718e3744 | 6026 | "Clear all peers\n") |
6027 | ||
6028 | ALIAS (clear_ip_bgp_all, | |
01080f7c | 6029 | clear_bgp_instance_ipv6_all_cmd, |
6030 | "clear bgp " BGP_INSTANCE_CMD " ipv6 *", | |
718e3744 | 6031 | CLEAR_STR |
6032 | BGP_STR | |
8386ac43 | 6033 | BGP_INSTANCE_HELP_STR |
01080f7c | 6034 | "Address family\n" |
718e3744 | 6035 | "Clear all peers\n") |
6036 | ||
6037 | DEFUN (clear_ip_bgp_peer, | |
6038 | clear_ip_bgp_peer_cmd, | |
a80beece | 6039 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6040 | CLEAR_STR |
6041 | IP_STR | |
6042 | BGP_STR | |
6043 | "BGP neighbor IP address to clear\n" | |
a80beece DS |
6044 | "BGP IPv6 neighbor to clear\n" |
6045 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6046 | { |
01080f7c | 6047 | if (argc == 3) |
6048 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6049 | ||
718e3744 | 6050 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); |
6051 | } | |
6052 | ||
01080f7c | 6053 | ALIAS (clear_ip_bgp_peer, |
6054 | clear_ip_bgp_instance_peer_cmd, | |
6055 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", | |
6056 | CLEAR_STR | |
6057 | IP_STR | |
6058 | BGP_STR | |
6059 | BGP_INSTANCE_HELP_STR | |
6060 | "BGP neighbor IP address to clear\n" | |
6061 | "BGP IPv6 neighbor to clear\n" | |
6062 | "BGP neighbor on interface to clear\n") | |
6063 | ||
718e3744 | 6064 | ALIAS (clear_ip_bgp_peer, |
6065 | clear_bgp_peer_cmd, | |
a80beece | 6066 | "clear bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6067 | CLEAR_STR |
6068 | BGP_STR | |
6069 | "BGP neighbor address to clear\n" | |
a80beece DS |
6070 | "BGP IPv6 neighbor to clear\n" |
6071 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6072 | |
01080f7c | 6073 | ALIAS (clear_ip_bgp_peer, |
6074 | clear_bgp_instance_peer_cmd, | |
6075 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", | |
6076 | CLEAR_STR | |
6077 | BGP_STR | |
6078 | BGP_INSTANCE_HELP_STR | |
6079 | "BGP neighbor IP address to clear\n" | |
6080 | "BGP IPv6 neighbor to clear\n" | |
6081 | "BGP neighbor on interface to clear\n") | |
6082 | ||
718e3744 | 6083 | ALIAS (clear_ip_bgp_peer, |
6084 | clear_bgp_ipv6_peer_cmd, | |
a80beece | 6085 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6086 | CLEAR_STR |
6087 | BGP_STR | |
6088 | "Address family\n" | |
6089 | "BGP neighbor address to clear\n" | |
a80beece DS |
6090 | "BGP IPv6 neighbor to clear\n" |
6091 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6092 | |
01080f7c | 6093 | ALIAS (clear_ip_bgp_peer, |
6094 | clear_bgp_instance_ipv6_peer_cmd, | |
6095 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD)", | |
6096 | CLEAR_STR | |
6097 | BGP_STR | |
6098 | BGP_INSTANCE_HELP_STR | |
6099 | "Address family\n" | |
6100 | "BGP neighbor IP address to clear\n" | |
6101 | "BGP IPv6 neighbor to clear\n" | |
6102 | "BGP neighbor on interface to clear\n") | |
6103 | ||
718e3744 | 6104 | DEFUN (clear_ip_bgp_peer_group, |
6105 | clear_ip_bgp_peer_group_cmd, | |
6106 | "clear ip bgp peer-group WORD", | |
6107 | CLEAR_STR | |
6108 | IP_STR | |
6109 | BGP_STR | |
6110 | "Clear all members of peer-group\n" | |
6111 | "BGP peer-group name\n") | |
6112 | { | |
01080f7c | 6113 | if (argc == 3) |
6114 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6115 | ||
718e3744 | 6116 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); |
6117 | } | |
6118 | ||
01080f7c | 6119 | ALIAS (clear_ip_bgp_peer_group, |
6120 | clear_ip_bgp_instance_peer_group_cmd, | |
6121 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD", | |
6122 | CLEAR_STR | |
6123 | IP_STR | |
6124 | BGP_STR | |
6125 | BGP_INSTANCE_HELP_STR | |
6126 | "Clear all members of peer-group\n" | |
6127 | "BGP peer-group name\n") | |
6128 | ||
718e3744 | 6129 | ALIAS (clear_ip_bgp_peer_group, |
6130 | clear_bgp_peer_group_cmd, | |
6131 | "clear bgp peer-group WORD", | |
6132 | CLEAR_STR | |
6133 | BGP_STR | |
6134 | "Clear all members of peer-group\n" | |
6135 | "BGP peer-group name\n") | |
6136 | ||
01080f7c | 6137 | ALIAS (clear_ip_bgp_peer_group, |
6138 | clear_bgp_instance_peer_group_cmd, | |
6139 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD", | |
6140 | CLEAR_STR | |
6141 | BGP_STR | |
6142 | BGP_INSTANCE_HELP_STR | |
6143 | "Clear all members of peer-group\n" | |
6144 | "BGP peer-group name\n") | |
6145 | ||
718e3744 | 6146 | ALIAS (clear_ip_bgp_peer_group, |
6147 | clear_bgp_ipv6_peer_group_cmd, | |
6148 | "clear bgp ipv6 peer-group WORD", | |
6149 | CLEAR_STR | |
6150 | BGP_STR | |
6151 | "Address family\n" | |
6152 | "Clear all members of peer-group\n" | |
6153 | "BGP peer-group name\n") | |
6154 | ||
01080f7c | 6155 | ALIAS (clear_ip_bgp_peer_group, |
6156 | clear_bgp_instance_ipv6_peer_group_cmd, | |
6157 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD", | |
6158 | CLEAR_STR | |
6159 | BGP_STR | |
6160 | BGP_INSTANCE_HELP_STR | |
6161 | "Address family\n" | |
6162 | "Clear all members of peer-group\n" | |
6163 | "BGP peer-group name\n") | |
6164 | ||
718e3744 | 6165 | DEFUN (clear_ip_bgp_external, |
6166 | clear_ip_bgp_external_cmd, | |
6167 | "clear ip bgp external", | |
6168 | CLEAR_STR | |
6169 | IP_STR | |
6170 | BGP_STR | |
6171 | "Clear all external peers\n") | |
6172 | { | |
01080f7c | 6173 | if (argc == 2) |
6174 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
6175 | ||
718e3744 | 6176 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
6177 | } | |
6178 | ||
01080f7c | 6179 | ALIAS (clear_ip_bgp_external, |
6180 | clear_ip_bgp_instance_external_cmd, | |
6181 | "clear ip bgp " BGP_INSTANCE_CMD " external", | |
6182 | CLEAR_STR | |
6183 | IP_STR | |
6184 | BGP_STR | |
6185 | BGP_INSTANCE_HELP_STR | |
6186 | "Clear all external peers\n") | |
6187 | ||
718e3744 | 6188 | ALIAS (clear_ip_bgp_external, |
6189 | clear_bgp_external_cmd, | |
6190 | "clear bgp external", | |
6191 | CLEAR_STR | |
6192 | BGP_STR | |
6193 | "Clear all external peers\n") | |
6194 | ||
01080f7c | 6195 | ALIAS (clear_ip_bgp_external, |
6196 | clear_bgp_instance_external_cmd, | |
6197 | "clear bgp " BGP_INSTANCE_CMD " external", | |
6198 | CLEAR_STR | |
6199 | BGP_STR | |
6200 | BGP_INSTANCE_HELP_STR | |
6201 | "Clear all external peers\n") | |
6202 | ||
718e3744 | 6203 | ALIAS (clear_ip_bgp_external, |
6204 | clear_bgp_ipv6_external_cmd, | |
6205 | "clear bgp ipv6 external", | |
6206 | CLEAR_STR | |
6207 | BGP_STR | |
6208 | "Address family\n" | |
6209 | "Clear all external peers\n") | |
6210 | ||
01080f7c | 6211 | ALIAS (clear_ip_bgp_external, |
6212 | clear_bgp_instance_ipv6_external_cmd, | |
6213 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external", | |
6214 | CLEAR_STR | |
6215 | BGP_STR | |
6216 | BGP_INSTANCE_HELP_STR | |
6217 | "Address family\n" | |
6218 | "Clear all external peers\n") | |
6219 | ||
8ad7271d DS |
6220 | DEFUN (clear_ip_bgp_prefix, |
6221 | clear_ip_bgp_prefix_cmd, | |
6222 | "clear ip bgp prefix A.B.C.D/M", | |
6223 | CLEAR_STR | |
6224 | IP_STR | |
6225 | BGP_STR | |
6226 | "Clear bestpath and re-advertise\n" | |
6227 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6228 | { | |
01080f7c | 6229 | if (argc == 3) |
6230 | return bgp_clear_prefix (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL); | |
6231 | ||
8ad7271d DS |
6232 | return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL); |
6233 | } | |
6234 | ||
01080f7c | 6235 | ALIAS (clear_ip_bgp_prefix, |
6236 | clear_ip_bgp_instance_prefix_cmd, | |
6237 | "clear ip bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", | |
6238 | CLEAR_STR | |
6239 | IP_STR | |
6240 | BGP_STR | |
6241 | BGP_INSTANCE_HELP_STR | |
6242 | "Clear bestpath and re-advertise\n" | |
6243 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6244 | ||
8ad7271d DS |
6245 | ALIAS (clear_ip_bgp_prefix, |
6246 | clear_bgp_prefix_cmd, | |
6247 | "clear bgp prefix A.B.C.D/M", | |
6248 | CLEAR_STR | |
6249 | BGP_STR | |
6250 | "Clear bestpath and re-advertise\n" | |
6251 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6252 | ||
01080f7c | 6253 | ALIAS (clear_ip_bgp_prefix, |
6254 | clear_bgp_instance_prefix_cmd, | |
6255 | "clear bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", | |
6256 | CLEAR_STR | |
6257 | BGP_STR | |
6258 | BGP_INSTANCE_HELP_STR | |
6259 | "Clear bestpath and re-advertise\n" | |
6260 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
8ad7271d | 6261 | |
718e3744 | 6262 | DEFUN (clear_ip_bgp_as, |
6263 | clear_ip_bgp_as_cmd, | |
320da874 | 6264 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 6265 | CLEAR_STR |
6266 | IP_STR | |
6267 | BGP_STR | |
6268 | "Clear peers with the AS number\n") | |
6269 | { | |
01080f7c | 6270 | if (argc == 3) |
6271 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6272 | ||
718e3744 | 6273 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); |
6274 | } | |
6275 | ||
01080f7c | 6276 | ALIAS (clear_ip_bgp_as, |
6277 | clear_ip_bgp_instance_as_cmd, | |
6278 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, | |
6279 | CLEAR_STR | |
6280 | IP_STR | |
6281 | BGP_STR | |
6282 | BGP_INSTANCE_HELP_STR | |
6283 | "Clear peers with the AS number\n") | |
6284 | ||
718e3744 | 6285 | ALIAS (clear_ip_bgp_as, |
6286 | clear_bgp_as_cmd, | |
320da874 | 6287 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 6288 | CLEAR_STR |
6289 | BGP_STR | |
6290 | "Clear peers with the AS number\n") | |
6291 | ||
01080f7c | 6292 | ALIAS (clear_ip_bgp_as, |
6293 | clear_bgp_instance_as_cmd, | |
6294 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, | |
6295 | CLEAR_STR | |
6296 | BGP_STR | |
6297 | BGP_INSTANCE_HELP_STR | |
6298 | "Clear peers with the AS number\n") | |
6299 | ||
718e3744 | 6300 | ALIAS (clear_ip_bgp_as, |
6301 | clear_bgp_ipv6_as_cmd, | |
320da874 | 6302 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 6303 | CLEAR_STR |
6304 | BGP_STR | |
6305 | "Address family\n" | |
6306 | "Clear peers with the AS number\n") | |
6b0655a2 | 6307 | |
01080f7c | 6308 | ALIAS (clear_ip_bgp_as, |
6309 | clear_bgp_instance_ipv6_as_cmd, | |
6310 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE, | |
6311 | CLEAR_STR | |
6312 | BGP_STR | |
6313 | BGP_INSTANCE_HELP_STR | |
6314 | "Address family\n" | |
6315 | "Clear peers with the AS number\n") | |
6316 | ||
718e3744 | 6317 | /* Outbound soft-reconfiguration */ |
6318 | DEFUN (clear_ip_bgp_all_soft_out, | |
6319 | clear_ip_bgp_all_soft_out_cmd, | |
6320 | "clear ip bgp * soft out", | |
6321 | CLEAR_STR | |
6322 | IP_STR | |
6323 | BGP_STR | |
6324 | "Clear all peers\n" | |
e0bce756 DS |
6325 | BGP_SOFT_STR |
6326 | BGP_SOFT_OUT_STR) | |
718e3744 | 6327 | { |
6aeb9e78 DS |
6328 | if (argc == 2) |
6329 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 6330 | BGP_CLEAR_SOFT_OUT, NULL); |
6331 | ||
6332 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6333 | BGP_CLEAR_SOFT_OUT, NULL); | |
6334 | } | |
6335 | ||
01080f7c | 6336 | ALIAS (clear_ip_bgp_all_soft_out, |
6337 | clear_ip_bgp_instance_all_soft_out_cmd, | |
6338 | "clear ip bgp " BGP_INSTANCE_CMD " * soft out", | |
6339 | CLEAR_STR | |
6340 | IP_STR | |
6341 | BGP_STR | |
6342 | BGP_INSTANCE_HELP_STR | |
6343 | "Clear all peers\n" | |
6344 | BGP_SOFT_STR | |
6345 | BGP_SOFT_OUT_STR) | |
6346 | ||
718e3744 | 6347 | ALIAS (clear_ip_bgp_all_soft_out, |
6348 | clear_ip_bgp_all_out_cmd, | |
6349 | "clear ip bgp * out", | |
6350 | CLEAR_STR | |
6351 | IP_STR | |
6352 | BGP_STR | |
6353 | "Clear all peers\n" | |
e0bce756 | 6354 | BGP_SOFT_OUT_STR) |
718e3744 | 6355 | |
6356 | ALIAS (clear_ip_bgp_all_soft_out, | |
01080f7c | 6357 | clear_ip_bgp_instance_all_out_cmd, |
6358 | "clear ip bgp " BGP_INSTANCE_CMD " * out", | |
718e3744 | 6359 | CLEAR_STR |
6360 | IP_STR | |
6361 | BGP_STR | |
8386ac43 | 6362 | BGP_INSTANCE_HELP_STR |
718e3744 | 6363 | "Clear all peers\n" |
e0bce756 | 6364 | BGP_SOFT_OUT_STR) |
718e3744 | 6365 | |
6366 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
6367 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
6368 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
6369 | CLEAR_STR | |
6370 | IP_STR | |
6371 | BGP_STR | |
6372 | "Clear all peers\n" | |
6373 | "Address family\n" | |
6374 | "Address Family modifier\n" | |
6375 | "Address Family modifier\n" | |
e0bce756 DS |
6376 | BGP_SOFT_STR |
6377 | BGP_SOFT_OUT_STR) | |
718e3744 | 6378 | { |
6379 | if (strncmp (argv[0], "m", 1) == 0) | |
6380 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6381 | BGP_CLEAR_SOFT_OUT, NULL); | |
6382 | ||
6383 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6384 | BGP_CLEAR_SOFT_OUT, NULL); | |
6385 | } | |
6386 | ||
01080f7c | 6387 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
6388 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
6389 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft out", | |
6390 | CLEAR_STR | |
6391 | IP_STR | |
6392 | BGP_STR | |
6393 | BGP_INSTANCE_HELP_STR | |
6394 | "Clear all peers\n" | |
6395 | "Address family\n" | |
6396 | "Address Family modifier\n" | |
6397 | "Address Family modifier\n" | |
6398 | BGP_SOFT_OUT_STR) | |
6399 | { | |
6400 | if (strncmp (argv[2], "m", 1) == 0) | |
6401 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, | |
6402 | BGP_CLEAR_SOFT_OUT, NULL); | |
6403 | ||
6404 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6405 | BGP_CLEAR_SOFT_OUT, NULL); | |
6406 | } | |
6407 | ||
718e3744 | 6408 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, |
6409 | clear_ip_bgp_all_ipv4_out_cmd, | |
6410 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
6411 | CLEAR_STR | |
6412 | IP_STR | |
6413 | BGP_STR | |
6414 | "Clear all peers\n" | |
6415 | "Address family\n" | |
6416 | "Address Family modifier\n" | |
6417 | "Address Family modifier\n" | |
e0bce756 | 6418 | BGP_SOFT_OUT_STR) |
718e3744 | 6419 | |
01080f7c | 6420 | ALIAS (clear_ip_bgp_instance_all_ipv4_soft_out, |
6421 | clear_ip_bgp_instance_all_ipv4_out_cmd, | |
6422 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) out", | |
718e3744 | 6423 | CLEAR_STR |
6424 | IP_STR | |
6425 | BGP_STR | |
8386ac43 | 6426 | BGP_INSTANCE_HELP_STR |
718e3744 | 6427 | "Clear all peers\n" |
6428 | "Address family\n" | |
6429 | "Address Family modifier\n" | |
6430 | "Address Family modifier\n" | |
e0bce756 | 6431 | BGP_SOFT_OUT_STR) |
718e3744 | 6432 | |
6433 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
6434 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
6435 | "clear ip bgp * vpnv4 unicast soft out", | |
6436 | CLEAR_STR | |
6437 | IP_STR | |
6438 | BGP_STR | |
6439 | "Clear all peers\n" | |
6440 | "Address family\n" | |
6441 | "Address Family Modifier\n" | |
e0bce756 DS |
6442 | BGP_SOFT_STR |
6443 | BGP_SOFT_OUT_STR) | |
718e3744 | 6444 | { |
6445 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6446 | BGP_CLEAR_SOFT_OUT, NULL); | |
6447 | } | |
6448 | ||
6449 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
6450 | clear_ip_bgp_all_vpnv4_out_cmd, | |
6451 | "clear ip bgp * vpnv4 unicast out", | |
6452 | CLEAR_STR | |
6453 | IP_STR | |
6454 | BGP_STR | |
6455 | "Clear all peers\n" | |
6456 | "Address family\n" | |
6457 | "Address Family Modifier\n" | |
e0bce756 | 6458 | BGP_SOFT_OUT_STR) |
718e3744 | 6459 | |
587ff0fd LB |
6460 | DEFUN (clear_ip_bgp_all_encap_soft_out, |
6461 | clear_ip_bgp_all_encap_soft_out_cmd, | |
6462 | "clear ip bgp * encap unicast soft out", | |
6463 | CLEAR_STR | |
6464 | IP_STR | |
6465 | BGP_STR | |
6466 | "Clear all peers\n" | |
6467 | "Address family\n" | |
6468 | "Address Family Modifier\n" | |
6469 | "Soft reconfig\n" | |
6470 | "Soft reconfig outbound update\n") | |
6471 | { | |
6472 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
6473 | BGP_CLEAR_SOFT_OUT, NULL); | |
6474 | } | |
6475 | ||
6476 | ALIAS (clear_ip_bgp_all_encap_soft_out, | |
6477 | clear_ip_bgp_all_encap_out_cmd, | |
6478 | "clear ip bgp * encap unicast out", | |
6479 | CLEAR_STR | |
6480 | IP_STR | |
6481 | BGP_STR | |
6482 | "Clear all peers\n" | |
6483 | "Address family\n" | |
6484 | "Address Family Modifier\n" | |
6485 | "Soft reconfig outbound update\n") | |
6486 | ||
718e3744 | 6487 | DEFUN (clear_bgp_all_soft_out, |
6488 | clear_bgp_all_soft_out_cmd, | |
6489 | "clear bgp * soft out", | |
6490 | CLEAR_STR | |
6491 | BGP_STR | |
6492 | "Clear all peers\n" | |
e0bce756 DS |
6493 | BGP_SOFT_STR |
6494 | BGP_SOFT_OUT_STR) | |
718e3744 | 6495 | { |
6aeb9e78 DS |
6496 | if (argc == 2) |
6497 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
718e3744 | 6498 | BGP_CLEAR_SOFT_OUT, NULL); |
6499 | ||
6500 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6501 | BGP_CLEAR_SOFT_OUT, NULL); | |
6502 | } | |
6503 | ||
6504 | ALIAS (clear_bgp_all_soft_out, | |
6505 | clear_bgp_instance_all_soft_out_cmd, | |
8386ac43 | 6506 | "clear bgp " BGP_INSTANCE_CMD " * soft out", |
718e3744 | 6507 | CLEAR_STR |
6508 | BGP_STR | |
8386ac43 | 6509 | BGP_INSTANCE_HELP_STR |
718e3744 | 6510 | "Clear all peers\n" |
e0bce756 DS |
6511 | BGP_SOFT_STR |
6512 | BGP_SOFT_OUT_STR) | |
718e3744 | 6513 | |
6514 | ALIAS (clear_bgp_all_soft_out, | |
6515 | clear_bgp_all_out_cmd, | |
6516 | "clear bgp * out", | |
6517 | CLEAR_STR | |
6518 | BGP_STR | |
6519 | "Clear all peers\n" | |
e0bce756 | 6520 | BGP_SOFT_OUT_STR) |
718e3744 | 6521 | |
01080f7c | 6522 | ALIAS (clear_bgp_all_soft_out, |
6523 | clear_bgp_instance_all_out_cmd, | |
6524 | "clear bgp " BGP_INSTANCE_CMD " * out", | |
6525 | CLEAR_STR | |
6526 | BGP_STR | |
6527 | BGP_INSTANCE_HELP_STR | |
6528 | "Clear all peers\n" | |
6529 | BGP_SOFT_OUT_STR) | |
6530 | ||
718e3744 | 6531 | ALIAS (clear_bgp_all_soft_out, |
6532 | clear_bgp_ipv6_all_soft_out_cmd, | |
6533 | "clear bgp ipv6 * soft out", | |
6534 | CLEAR_STR | |
6535 | BGP_STR | |
6536 | "Address family\n" | |
6537 | "Clear all peers\n" | |
e0bce756 DS |
6538 | BGP_SOFT_STR |
6539 | BGP_SOFT_OUT_STR) | |
718e3744 | 6540 | |
01080f7c | 6541 | ALIAS (clear_bgp_all_soft_out, |
6542 | clear_bgp_instance_ipv6_all_soft_out_cmd, | |
6543 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft out", | |
6544 | CLEAR_STR | |
6545 | BGP_STR | |
6546 | BGP_INSTANCE_HELP_STR | |
6547 | "Address family\n" | |
6548 | "Clear all peers\n" | |
6549 | BGP_SOFT_STR | |
6550 | BGP_SOFT_OUT_STR) | |
6551 | ||
718e3744 | 6552 | ALIAS (clear_bgp_all_soft_out, |
6553 | clear_bgp_ipv6_all_out_cmd, | |
6554 | "clear bgp ipv6 * out", | |
6555 | CLEAR_STR | |
6556 | BGP_STR | |
6557 | "Address family\n" | |
6558 | "Clear all peers\n" | |
e0bce756 | 6559 | BGP_SOFT_OUT_STR) |
718e3744 | 6560 | |
01080f7c | 6561 | ALIAS (clear_bgp_all_soft_out, |
6562 | clear_bgp_instance_ipv6_all_out_cmd, | |
6563 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * out", | |
6564 | CLEAR_STR | |
6565 | BGP_STR | |
6566 | BGP_INSTANCE_HELP_STR | |
6567 | "Address family\n" | |
6568 | "Clear all peers\n" | |
6569 | BGP_SOFT_OUT_STR) | |
6570 | ||
8ad7271d DS |
6571 | DEFUN (clear_bgp_ipv6_safi_prefix, |
6572 | clear_bgp_ipv6_safi_prefix_cmd, | |
6573 | "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6574 | CLEAR_STR | |
6575 | BGP_STR | |
6576 | "Address family\n" | |
6577 | "Address Family Modifier\n" | |
6578 | "Clear bestpath and re-advertise\n" | |
6579 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6580 | { | |
6581 | if (strncmp (argv[0], "m", 1) == 0) | |
6582 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL); | |
6583 | else | |
6584 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL); | |
6585 | } | |
6586 | ||
01080f7c | 6587 | DEFUN (clear_bgp_instance_ipv6_safi_prefix, |
6588 | clear_bgp_instance_ipv6_safi_prefix_cmd, | |
6589 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6590 | CLEAR_STR | |
6591 | BGP_STR | |
6592 | BGP_INSTANCE_HELP_STR | |
6593 | "Address family\n" | |
6594 | "Address Family Modifier\n" | |
6595 | "Clear bestpath and re-advertise\n" | |
6596 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6597 | { | |
6598 | if (strncmp (argv[2], "m", 1) == 0) | |
6599 | return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_MULTICAST, NULL); | |
6600 | else | |
6601 | return bgp_clear_prefix (vty, argv[1], argv[3], AFI_IP6, SAFI_UNICAST, NULL); | |
6602 | } | |
6603 | ||
718e3744 | 6604 | DEFUN (clear_ip_bgp_peer_soft_out, |
6605 | clear_ip_bgp_peer_soft_out_cmd, | |
db64ea86 | 6606 | "clear ip bgp (A.B.C.D|WORD) soft out", |
718e3744 | 6607 | CLEAR_STR |
6608 | IP_STR | |
6609 | BGP_STR | |
6610 | "BGP neighbor address to clear\n" | |
db64ea86 | 6611 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6612 | BGP_SOFT_STR |
6613 | BGP_SOFT_OUT_STR) | |
718e3744 | 6614 | { |
01080f7c | 6615 | if (argc == 3) |
6616 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
6617 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6618 | ||
718e3744 | 6619 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
6620 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6621 | } | |
6622 | ||
01080f7c | 6623 | ALIAS (clear_ip_bgp_peer_soft_out, |
6624 | clear_ip_bgp_instance_peer_soft_out_cmd, | |
6625 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft out", | |
6626 | CLEAR_STR | |
6627 | IP_STR | |
6628 | BGP_STR | |
6629 | BGP_INSTANCE_HELP_STR | |
6630 | "BGP neighbor address to clear\n" | |
6631 | "BGP neighbor on interface to clear\n" | |
6632 | BGP_SOFT_STR | |
6633 | BGP_SOFT_OUT_STR) | |
6634 | ||
718e3744 | 6635 | ALIAS (clear_ip_bgp_peer_soft_out, |
6636 | clear_ip_bgp_peer_out_cmd, | |
db64ea86 | 6637 | "clear ip bgp (A.B.C.D|WORD) out", |
718e3744 | 6638 | CLEAR_STR |
6639 | IP_STR | |
6640 | BGP_STR | |
6641 | "BGP neighbor address to clear\n" | |
db64ea86 | 6642 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6643 | BGP_SOFT_OUT_STR) |
718e3744 | 6644 | |
01080f7c | 6645 | ALIAS (clear_ip_bgp_peer_soft_out, |
6646 | clear_ip_bgp_instance_peer_out_cmd, | |
6647 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) out", | |
6648 | CLEAR_STR | |
6649 | IP_STR | |
6650 | BGP_STR | |
6651 | BGP_INSTANCE_HELP_STR | |
6652 | "BGP neighbor address to clear\n" | |
6653 | "BGP neighbor on interface to clear\n" | |
6654 | BGP_SOFT_OUT_STR) | |
6655 | ||
718e3744 | 6656 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
6657 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
db64ea86 | 6658 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", |
718e3744 | 6659 | CLEAR_STR |
6660 | IP_STR | |
6661 | BGP_STR | |
6662 | "BGP neighbor address to clear\n" | |
db64ea86 | 6663 | "BGP neighbor on interface to clear\n" |
718e3744 | 6664 | "Address family\n" |
6665 | "Address Family modifier\n" | |
6666 | "Address Family modifier\n" | |
e0bce756 DS |
6667 | BGP_SOFT_STR |
6668 | BGP_SOFT_OUT_STR) | |
718e3744 | 6669 | { |
6670 | if (strncmp (argv[1], "m", 1) == 0) | |
6671 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6672 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6673 | ||
6674 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6675 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6676 | } | |
6677 | ||
01080f7c | 6678 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, |
6679 | clear_ip_bgp_instance_peer_ipv4_soft_out_cmd, | |
6680 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", | |
6681 | CLEAR_STR | |
6682 | IP_STR | |
6683 | BGP_STR | |
6684 | BGP_INSTANCE_HELP_STR | |
6685 | "BGP neighbor address to clear\n" | |
6686 | "BGP neighbor on interface to clear\n" | |
6687 | "Address family\n" | |
6688 | "Address Family modifier\n" | |
6689 | "Address Family modifier\n" | |
6690 | BGP_SOFT_STR | |
6691 | BGP_SOFT_OUT_STR) | |
6692 | { | |
6693 | if (strncmp (argv[3], "m", 1) == 0) | |
6694 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, | |
6695 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6696 | ||
6697 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
6698 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6699 | } | |
6700 | ||
718e3744 | 6701 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, |
6702 | clear_ip_bgp_peer_ipv4_out_cmd, | |
db64ea86 | 6703 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out", |
718e3744 | 6704 | CLEAR_STR |
6705 | IP_STR | |
6706 | BGP_STR | |
6707 | "BGP neighbor address to clear\n" | |
db64ea86 | 6708 | "BGP neighbor on interface to clear\n" |
718e3744 | 6709 | "Address family\n" |
6710 | "Address Family modifier\n" | |
6711 | "Address Family modifier\n" | |
e0bce756 | 6712 | BGP_SOFT_OUT_STR) |
718e3744 | 6713 | |
01080f7c | 6714 | ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_out, |
6715 | clear_ip_bgp_instance_peer_ipv4_out_cmd, | |
6716 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) out", | |
6717 | CLEAR_STR | |
6718 | IP_STR | |
6719 | BGP_STR | |
6720 | BGP_INSTANCE_HELP_STR | |
6721 | "BGP neighbor address to clear\n" | |
6722 | "BGP neighbor on interface to clear\n" | |
6723 | "Address family\n" | |
6724 | "Address Family modifier\n" | |
6725 | "Address Family modifier\n" | |
6726 | BGP_SOFT_OUT_STR) | |
6727 | ||
db64ea86 | 6728 | /* NOTE: WORD peers have not been tested for vpnv4 */ |
718e3744 | 6729 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
6730 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
db64ea86 | 6731 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out", |
718e3744 | 6732 | CLEAR_STR |
6733 | IP_STR | |
6734 | BGP_STR | |
6735 | "BGP neighbor address to clear\n" | |
db64ea86 | 6736 | "BGP neighbor on interface to clear\n" |
718e3744 | 6737 | "Address family\n" |
6738 | "Address Family Modifier\n" | |
e0bce756 DS |
6739 | BGP_SOFT_STR |
6740 | BGP_SOFT_OUT_STR) | |
718e3744 | 6741 | { |
6742 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6743 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6744 | } | |
6745 | ||
6746 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
6747 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
db64ea86 | 6748 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out", |
718e3744 | 6749 | CLEAR_STR |
6750 | IP_STR | |
6751 | BGP_STR | |
6752 | "BGP neighbor address to clear\n" | |
db64ea86 | 6753 | "BGP neighbor on interface to clear\n" |
718e3744 | 6754 | "Address family\n" |
6755 | "Address Family Modifier\n" | |
e0bce756 | 6756 | BGP_SOFT_OUT_STR) |
718e3744 | 6757 | |
587ff0fd LB |
6758 | DEFUN (clear_ip_bgp_peer_encap_soft_out, |
6759 | clear_ip_bgp_peer_encap_soft_out_cmd, | |
6760 | "clear ip bgp A.B.C.D encap unicast soft out", | |
6761 | CLEAR_STR | |
6762 | IP_STR | |
6763 | BGP_STR | |
6764 | "BGP neighbor address to clear\n" | |
6765 | "Address family\n" | |
6766 | "Address Family Modifier\n" | |
6767 | "Soft reconfig\n" | |
6768 | "Soft reconfig outbound update\n") | |
6769 | { | |
6770 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
6771 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6772 | } | |
6773 | ||
6774 | ALIAS (clear_ip_bgp_peer_encap_soft_out, | |
6775 | clear_ip_bgp_peer_encap_out_cmd, | |
6776 | "clear ip bgp A.B.C.D encap unicast out", | |
6777 | CLEAR_STR | |
6778 | IP_STR | |
6779 | BGP_STR | |
6780 | "BGP neighbor address to clear\n" | |
6781 | "Address family\n" | |
6782 | "Address Family Modifier\n" | |
6783 | "Soft reconfig outbound update\n") | |
6784 | ||
718e3744 | 6785 | DEFUN (clear_bgp_peer_soft_out, |
6786 | clear_bgp_peer_soft_out_cmd, | |
a80beece | 6787 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6788 | CLEAR_STR |
6789 | BGP_STR | |
6790 | "BGP neighbor address to clear\n" | |
6791 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6792 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6793 | BGP_SOFT_STR |
6794 | BGP_SOFT_OUT_STR) | |
718e3744 | 6795 | { |
01080f7c | 6796 | if (argc == 3) |
6797 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
6798 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6799 | ||
718e3744 | 6800 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
6801 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6802 | } | |
6803 | ||
01080f7c | 6804 | ALIAS (clear_bgp_peer_soft_out, |
6805 | clear_bgp_instance_peer_soft_out_cmd, | |
6806 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft out", | |
6807 | CLEAR_STR | |
6808 | BGP_STR | |
6809 | BGP_INSTANCE_HELP_STR | |
6810 | "BGP neighbor address to clear\n" | |
6811 | "BGP IPv6 neighbor to clear\n" | |
6812 | "BGP neighbor on interface to clear\n" | |
6813 | BGP_SOFT_STR | |
6814 | BGP_SOFT_OUT_STR) | |
6815 | ||
718e3744 | 6816 | ALIAS (clear_bgp_peer_soft_out, |
6817 | clear_bgp_ipv6_peer_soft_out_cmd, | |
a80beece | 6818 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6819 | CLEAR_STR |
6820 | BGP_STR | |
6821 | "Address family\n" | |
6822 | "BGP neighbor address to clear\n" | |
6823 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6824 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6825 | BGP_SOFT_STR |
6826 | BGP_SOFT_OUT_STR) | |
718e3744 | 6827 | |
01080f7c | 6828 | ALIAS (clear_bgp_peer_soft_out, |
6829 | clear_bgp_instance_ipv6_peer_soft_out_cmd, | |
6830 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", | |
6831 | CLEAR_STR | |
6832 | BGP_STR | |
6833 | BGP_INSTANCE_HELP_STR | |
6834 | "Address family\n" | |
6835 | "BGP neighbor address to clear\n" | |
6836 | "BGP IPv6 neighbor to clear\n" | |
6837 | "BGP neighbor on interface to clear\n" | |
6838 | BGP_SOFT_STR | |
6839 | BGP_SOFT_OUT_STR) | |
6840 | ||
718e3744 | 6841 | ALIAS (clear_bgp_peer_soft_out, |
6842 | clear_bgp_peer_out_cmd, | |
a80beece | 6843 | "clear bgp (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 6844 | CLEAR_STR |
6845 | BGP_STR | |
6846 | "BGP neighbor address to clear\n" | |
6847 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6848 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6849 | BGP_SOFT_OUT_STR) |
718e3744 | 6850 | |
01080f7c | 6851 | ALIAS (clear_bgp_peer_soft_out, |
6852 | clear_bgp_instance_peer_out_cmd, | |
6853 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) out", | |
6854 | CLEAR_STR | |
6855 | BGP_STR | |
6856 | BGP_INSTANCE_HELP_STR | |
6857 | "BGP neighbor address to clear\n" | |
6858 | "BGP IPv6 neighbor to clear\n" | |
6859 | "BGP neighbor on interface to clear\n" | |
6860 | BGP_SOFT_OUT_STR) | |
6861 | ||
718e3744 | 6862 | ALIAS (clear_bgp_peer_soft_out, |
6863 | clear_bgp_ipv6_peer_out_cmd, | |
a80beece | 6864 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 6865 | CLEAR_STR |
6866 | BGP_STR | |
6867 | "Address family\n" | |
6868 | "BGP neighbor address to clear\n" | |
6869 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6870 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6871 | BGP_SOFT_OUT_STR) |
718e3744 | 6872 | |
01080f7c | 6873 | ALIAS (clear_bgp_peer_soft_out, |
6874 | clear_bgp_instance_ipv6_peer_out_cmd, | |
6875 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) out", | |
6876 | CLEAR_STR | |
6877 | BGP_STR | |
6878 | BGP_INSTANCE_HELP_STR | |
6879 | "Address family\n" | |
6880 | "BGP neighbor address to clear\n" | |
6881 | "BGP IPv6 neighbor to clear\n" | |
6882 | "BGP neighbor on interface to clear\n" | |
6883 | BGP_SOFT_OUT_STR) | |
6884 | ||
718e3744 | 6885 | DEFUN (clear_ip_bgp_peer_group_soft_out, |
6886 | clear_ip_bgp_peer_group_soft_out_cmd, | |
6887 | "clear ip bgp peer-group WORD soft out", | |
6888 | CLEAR_STR | |
6889 | IP_STR | |
6890 | BGP_STR | |
6891 | "Clear all members of peer-group\n" | |
6892 | "BGP peer-group name\n" | |
e0bce756 DS |
6893 | BGP_SOFT_STR |
6894 | BGP_SOFT_OUT_STR) | |
718e3744 | 6895 | { |
01080f7c | 6896 | if (argc == 3) |
6897 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
6898 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6899 | ||
718e3744 | 6900 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
6901 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6902 | } | |
6903 | ||
01080f7c | 6904 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
6905 | clear_ip_bgp_instance_peer_group_soft_out_cmd, | |
6906 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", | |
6907 | CLEAR_STR | |
6908 | IP_STR | |
6909 | BGP_STR | |
6910 | BGP_INSTANCE_HELP_STR | |
6911 | "Clear all members of peer-group\n" | |
6912 | "BGP peer-group name\n" | |
6913 | BGP_SOFT_STR | |
6914 | BGP_SOFT_OUT_STR) | |
6915 | ||
718e3744 | 6916 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
6917 | clear_ip_bgp_peer_group_out_cmd, | |
6918 | "clear ip bgp peer-group WORD out", | |
6919 | CLEAR_STR | |
6920 | IP_STR | |
6921 | BGP_STR | |
6922 | "Clear all members of peer-group\n" | |
6923 | "BGP peer-group name\n" | |
e0bce756 | 6924 | BGP_SOFT_OUT_STR) |
718e3744 | 6925 | |
01080f7c | 6926 | ALIAS (clear_ip_bgp_peer_group_soft_out, |
6927 | clear_ip_bgp_instance_peer_group_out_cmd, | |
6928 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD out", | |
6929 | CLEAR_STR | |
6930 | IP_STR | |
6931 | BGP_STR | |
6932 | BGP_INSTANCE_HELP_STR | |
6933 | "Clear all members of peer-group\n" | |
6934 | "BGP peer-group name\n" | |
6935 | BGP_SOFT_OUT_STR) | |
6936 | ||
718e3744 | 6937 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
6938 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
6939 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
6940 | CLEAR_STR | |
6941 | IP_STR | |
6942 | BGP_STR | |
6943 | "Clear all members of peer-group\n" | |
6944 | "BGP peer-group name\n" | |
6945 | "Address family\n" | |
6946 | "Address Family modifier\n" | |
6947 | "Address Family modifier\n" | |
e0bce756 DS |
6948 | BGP_SOFT_STR |
6949 | BGP_SOFT_OUT_STR) | |
718e3744 | 6950 | { |
6951 | if (strncmp (argv[1], "m", 1) == 0) | |
6952 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6953 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6954 | ||
6955 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6956 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6957 | } | |
6958 | ||
01080f7c | 6959 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, |
6960 | clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd, | |
6961 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft out", | |
6962 | CLEAR_STR | |
6963 | IP_STR | |
6964 | BGP_STR | |
6965 | BGP_INSTANCE_HELP_STR | |
6966 | "Clear all members of peer-group\n" | |
6967 | "BGP peer-group name\n" | |
6968 | "Address family\n" | |
6969 | "Address Family modifier\n" | |
6970 | "Address Family modifier\n" | |
6971 | BGP_SOFT_STR | |
6972 | BGP_SOFT_OUT_STR) | |
6973 | { | |
6974 | if (strncmp (argv[3], "m", 1) == 0) | |
6975 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, | |
6976 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6977 | ||
6978 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
6979 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6980 | } | |
6981 | ||
718e3744 | 6982 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, |
6983 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
6984 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
6985 | CLEAR_STR | |
6986 | IP_STR | |
6987 | BGP_STR | |
6988 | "Clear all members of peer-group\n" | |
6989 | "BGP peer-group name\n" | |
6990 | "Address family\n" | |
6991 | "Address Family modifier\n" | |
6992 | "Address Family modifier\n" | |
e0bce756 | 6993 | BGP_SOFT_OUT_STR) |
718e3744 | 6994 | |
01080f7c | 6995 | ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_out, |
6996 | clear_ip_bgp_instance_peer_group_ipv4_out_cmd, | |
6997 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) out", | |
6998 | CLEAR_STR | |
6999 | IP_STR | |
7000 | BGP_STR | |
7001 | BGP_INSTANCE_HELP_STR | |
7002 | "Clear all members of peer-group\n" | |
7003 | "BGP peer-group name\n" | |
7004 | "Address family\n" | |
7005 | "Address Family modifier\n" | |
7006 | "Address Family modifier\n" | |
7007 | BGP_SOFT_OUT_STR) | |
7008 | ||
718e3744 | 7009 | DEFUN (clear_bgp_peer_group_soft_out, |
7010 | clear_bgp_peer_group_soft_out_cmd, | |
7011 | "clear bgp peer-group WORD soft out", | |
7012 | CLEAR_STR | |
7013 | BGP_STR | |
7014 | "Clear all members of peer-group\n" | |
7015 | "BGP peer-group name\n" | |
e0bce756 DS |
7016 | BGP_SOFT_STR |
7017 | BGP_SOFT_OUT_STR) | |
718e3744 | 7018 | { |
01080f7c | 7019 | if (argc == 3) |
7020 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
7021 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7022 | ||
718e3744 | 7023 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
7024 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7025 | } | |
7026 | ||
01080f7c | 7027 | ALIAS (clear_bgp_peer_group_soft_out, |
7028 | clear_bgp_instance_peer_group_soft_out_cmd, | |
7029 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", | |
7030 | CLEAR_STR | |
7031 | BGP_STR | |
7032 | BGP_INSTANCE_HELP_STR | |
7033 | "Clear all members of peer-group\n" | |
7034 | "BGP peer-group name\n" | |
7035 | BGP_SOFT_STR | |
7036 | BGP_SOFT_OUT_STR) | |
7037 | ||
718e3744 | 7038 | ALIAS (clear_bgp_peer_group_soft_out, |
7039 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
7040 | "clear bgp ipv6 peer-group WORD soft out", | |
7041 | CLEAR_STR | |
7042 | BGP_STR | |
7043 | "Address family\n" | |
7044 | "Clear all members of peer-group\n" | |
7045 | "BGP peer-group name\n" | |
e0bce756 DS |
7046 | BGP_SOFT_STR |
7047 | BGP_SOFT_OUT_STR) | |
718e3744 | 7048 | |
01080f7c | 7049 | ALIAS (clear_bgp_peer_group_soft_out, |
7050 | clear_bgp_instance_ipv6_peer_group_soft_out_cmd, | |
7051 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft out", | |
7052 | CLEAR_STR | |
7053 | BGP_STR | |
7054 | BGP_INSTANCE_HELP_STR | |
7055 | "Address family\n" | |
7056 | "Clear all members of peer-group\n" | |
7057 | "BGP peer-group name\n" | |
7058 | BGP_SOFT_STR | |
7059 | BGP_SOFT_OUT_STR) | |
7060 | ||
718e3744 | 7061 | ALIAS (clear_bgp_peer_group_soft_out, |
7062 | clear_bgp_peer_group_out_cmd, | |
7063 | "clear bgp peer-group WORD out", | |
7064 | CLEAR_STR | |
7065 | BGP_STR | |
7066 | "Clear all members of peer-group\n" | |
7067 | "BGP peer-group name\n" | |
e0bce756 | 7068 | BGP_SOFT_OUT_STR) |
718e3744 | 7069 | |
01080f7c | 7070 | ALIAS (clear_bgp_peer_group_soft_out, |
7071 | clear_bgp_instance_peer_group_out_cmd, | |
7072 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD out", | |
7073 | CLEAR_STR | |
7074 | BGP_STR | |
7075 | BGP_INSTANCE_HELP_STR | |
7076 | "Clear all members of peer-group\n" | |
7077 | "BGP peer-group name\n" | |
7078 | BGP_SOFT_OUT_STR) | |
7079 | ||
718e3744 | 7080 | ALIAS (clear_bgp_peer_group_soft_out, |
7081 | clear_bgp_ipv6_peer_group_out_cmd, | |
7082 | "clear bgp ipv6 peer-group WORD out", | |
7083 | CLEAR_STR | |
7084 | BGP_STR | |
7085 | "Address family\n" | |
7086 | "Clear all members of peer-group\n" | |
7087 | "BGP peer-group name\n" | |
e0bce756 | 7088 | BGP_SOFT_OUT_STR) |
718e3744 | 7089 | |
01080f7c | 7090 | ALIAS (clear_bgp_peer_group_soft_out, |
7091 | clear_bgp_instance_ipv6_peer_group_out_cmd, | |
7092 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD out", | |
7093 | CLEAR_STR | |
7094 | BGP_STR | |
7095 | BGP_INSTANCE_HELP_STR | |
7096 | "Address family\n" | |
7097 | "Clear all members of peer-group\n" | |
7098 | "BGP peer-group name\n" | |
7099 | BGP_SOFT_OUT_STR) | |
7100 | ||
718e3744 | 7101 | DEFUN (clear_ip_bgp_external_soft_out, |
7102 | clear_ip_bgp_external_soft_out_cmd, | |
7103 | "clear ip bgp external soft out", | |
7104 | CLEAR_STR | |
7105 | IP_STR | |
7106 | BGP_STR | |
7107 | "Clear all external peers\n" | |
e0bce756 DS |
7108 | BGP_SOFT_STR |
7109 | BGP_SOFT_OUT_STR) | |
01080f7c | 7110 | { |
7111 | if (argc == 2) | |
7112 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
7113 | BGP_CLEAR_SOFT_OUT, NULL); | |
7114 | ||
7115 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7116 | BGP_CLEAR_SOFT_OUT, NULL); | |
7117 | } | |
7118 | ||
7119 | ALIAS (clear_ip_bgp_external_soft_out, | |
7120 | clear_ip_bgp_instance_external_soft_out_cmd, | |
7121 | "clear ip bgp " BGP_INSTANCE_CMD " external soft out", | |
7122 | CLEAR_STR | |
7123 | IP_STR | |
7124 | BGP_STR | |
7125 | BGP_INSTANCE_HELP_STR | |
7126 | "Clear all external peers\n" | |
7127 | BGP_SOFT_STR | |
7128 | BGP_SOFT_OUT_STR) | |
7129 | ||
7130 | ALIAS (clear_ip_bgp_external_soft_out, | |
7131 | clear_ip_bgp_external_out_cmd, | |
7132 | "clear ip bgp external out", | |
7133 | CLEAR_STR | |
7134 | IP_STR | |
7135 | BGP_STR | |
7136 | "Clear all external peers\n" | |
7137 | BGP_SOFT_OUT_STR) | |
718e3744 | 7138 | |
7139 | ALIAS (clear_ip_bgp_external_soft_out, | |
01080f7c | 7140 | clear_ip_bgp_instance_external_out_cmd, |
7141 | "clear ip bgp " BGP_INSTANCE_CMD " external out", | |
718e3744 | 7142 | CLEAR_STR |
7143 | IP_STR | |
7144 | BGP_STR | |
01080f7c | 7145 | BGP_INSTANCE_HELP_STR |
718e3744 | 7146 | "Clear all external peers\n" |
e0bce756 | 7147 | BGP_SOFT_OUT_STR) |
718e3744 | 7148 | |
7149 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
7150 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
7151 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
7152 | CLEAR_STR | |
7153 | IP_STR | |
7154 | BGP_STR | |
7155 | "Clear all external peers\n" | |
7156 | "Address family\n" | |
7157 | "Address Family modifier\n" | |
7158 | "Address Family modifier\n" | |
e0bce756 DS |
7159 | BGP_SOFT_STR |
7160 | BGP_SOFT_OUT_STR) | |
718e3744 | 7161 | { |
7162 | if (strncmp (argv[0], "m", 1) == 0) | |
7163 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7164 | BGP_CLEAR_SOFT_OUT, NULL); | |
7165 | ||
7166 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7167 | BGP_CLEAR_SOFT_OUT, NULL); | |
7168 | } | |
7169 | ||
01080f7c | 7170 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, |
7171 | clear_ip_bgp_instance_external_ipv4_soft_out_cmd, | |
7172 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft out", | |
7173 | CLEAR_STR | |
7174 | IP_STR | |
7175 | BGP_STR | |
7176 | BGP_INSTANCE_HELP_STR | |
7177 | "Clear all external peers\n" | |
7178 | "Address family\n" | |
7179 | "Address Family modifier\n" | |
7180 | "Address Family modifier\n" | |
7181 | BGP_SOFT_STR | |
7182 | BGP_SOFT_OUT_STR) | |
7183 | { | |
7184 | if (strncmp (argv[2], "m", 1) == 0) | |
7185 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, | |
7186 | BGP_CLEAR_SOFT_OUT, NULL); | |
7187 | ||
7188 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
7189 | BGP_CLEAR_SOFT_OUT, NULL); | |
7190 | } | |
7191 | ||
718e3744 | 7192 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, |
7193 | clear_ip_bgp_external_ipv4_out_cmd, | |
7194 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
7195 | CLEAR_STR | |
7196 | IP_STR | |
7197 | BGP_STR | |
7198 | "Clear all external peers\n" | |
7199 | "Address family\n" | |
7200 | "Address Family modifier\n" | |
7201 | "Address Family modifier\n" | |
e0bce756 | 7202 | BGP_SOFT_OUT_STR) |
718e3744 | 7203 | |
01080f7c | 7204 | ALIAS (clear_ip_bgp_instance_external_ipv4_soft_out, |
7205 | clear_ip_bgp_instance_external_ipv4_out_cmd, | |
7206 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) out", | |
7207 | CLEAR_STR | |
7208 | IP_STR | |
7209 | BGP_STR | |
7210 | BGP_INSTANCE_HELP_STR | |
7211 | "Clear all external peers\n" | |
7212 | "Address family\n" | |
7213 | "Address Family modifier\n" | |
7214 | "Address Family modifier\n" | |
7215 | BGP_SOFT_OUT_STR) | |
7216 | ||
718e3744 | 7217 | DEFUN (clear_bgp_external_soft_out, |
7218 | clear_bgp_external_soft_out_cmd, | |
7219 | "clear bgp external soft out", | |
7220 | CLEAR_STR | |
7221 | BGP_STR | |
7222 | "Clear all external peers\n" | |
e0bce756 DS |
7223 | BGP_SOFT_STR |
7224 | BGP_SOFT_OUT_STR) | |
718e3744 | 7225 | { |
01080f7c | 7226 | if (argc == 2) |
7227 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
7228 | BGP_CLEAR_SOFT_OUT, NULL); | |
7229 | ||
718e3744 | 7230 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
7231 | BGP_CLEAR_SOFT_OUT, NULL); | |
7232 | } | |
7233 | ||
01080f7c | 7234 | ALIAS (clear_bgp_external_soft_out, |
7235 | clear_bgp_instance_external_soft_out_cmd, | |
7236 | "clear bgp " BGP_INSTANCE_CMD " external soft out", | |
7237 | CLEAR_STR | |
7238 | BGP_STR | |
7239 | BGP_INSTANCE_HELP_STR | |
7240 | "Clear all external peers\n" | |
7241 | BGP_SOFT_STR | |
7242 | BGP_SOFT_OUT_STR) | |
7243 | ||
718e3744 | 7244 | ALIAS (clear_bgp_external_soft_out, |
7245 | clear_bgp_ipv6_external_soft_out_cmd, | |
7246 | "clear bgp ipv6 external soft out", | |
7247 | CLEAR_STR | |
7248 | BGP_STR | |
7249 | "Address family\n" | |
7250 | "Clear all external peers\n" | |
e0bce756 DS |
7251 | BGP_SOFT_STR |
7252 | BGP_SOFT_OUT_STR) | |
718e3744 | 7253 | |
01080f7c | 7254 | ALIAS (clear_bgp_external_soft_out, |
7255 | clear_bgp_instance_ipv6_external_soft_out_cmd, | |
7256 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft out", | |
7257 | CLEAR_STR | |
7258 | BGP_STR | |
7259 | BGP_INSTANCE_HELP_STR | |
7260 | "Address family\n" | |
7261 | "Clear all external peers\n" | |
7262 | BGP_SOFT_STR | |
7263 | BGP_SOFT_OUT_STR) | |
7264 | ||
718e3744 | 7265 | ALIAS (clear_bgp_external_soft_out, |
7266 | clear_bgp_external_out_cmd, | |
7267 | "clear bgp external out", | |
7268 | CLEAR_STR | |
7269 | BGP_STR | |
7270 | "Clear all external peers\n" | |
e0bce756 | 7271 | BGP_SOFT_OUT_STR) |
718e3744 | 7272 | |
01080f7c | 7273 | ALIAS (clear_bgp_external_soft_out, |
7274 | clear_bgp_instance_external_out_cmd, | |
7275 | "clear bgp " BGP_INSTANCE_CMD " external out", | |
7276 | CLEAR_STR | |
7277 | BGP_STR | |
7278 | BGP_INSTANCE_HELP_STR | |
7279 | "Clear all external peers\n" | |
7280 | BGP_SOFT_OUT_STR) | |
7281 | ||
718e3744 | 7282 | ALIAS (clear_bgp_external_soft_out, |
7283 | clear_bgp_ipv6_external_out_cmd, | |
7284 | "clear bgp ipv6 external WORD out", | |
7285 | CLEAR_STR | |
7286 | BGP_STR | |
7287 | "Address family\n" | |
7288 | "Clear all external peers\n" | |
e0bce756 | 7289 | BGP_SOFT_OUT_STR) |
718e3744 | 7290 | |
01080f7c | 7291 | ALIAS (clear_bgp_external_soft_out, |
7292 | clear_bgp_instance_ipv6_external_out_cmd, | |
7293 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD out", | |
7294 | CLEAR_STR | |
7295 | BGP_STR | |
7296 | BGP_INSTANCE_HELP_STR | |
7297 | "Address family\n" | |
7298 | "Clear all external peers\n" | |
7299 | BGP_SOFT_OUT_STR) | |
7300 | ||
718e3744 | 7301 | DEFUN (clear_ip_bgp_as_soft_out, |
7302 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 7303 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 7304 | CLEAR_STR |
7305 | IP_STR | |
7306 | BGP_STR | |
7307 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7308 | BGP_SOFT_STR |
7309 | BGP_SOFT_OUT_STR) | |
718e3744 | 7310 | { |
01080f7c | 7311 | if (argc == 3) |
7312 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
7313 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7314 | ||
718e3744 | 7315 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
7316 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7317 | } | |
7318 | ||
01080f7c | 7319 | ALIAS (clear_ip_bgp_as_soft_out, |
7320 | clear_ip_bgp_instance_as_soft_out_cmd, | |
7321 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", | |
7322 | CLEAR_STR | |
7323 | IP_STR | |
7324 | BGP_STR | |
7325 | BGP_INSTANCE_HELP_STR | |
7326 | "Clear peers with the AS number\n" | |
7327 | BGP_SOFT_STR | |
7328 | BGP_SOFT_OUT_STR) | |
7329 | ||
718e3744 | 7330 | ALIAS (clear_ip_bgp_as_soft_out, |
7331 | clear_ip_bgp_as_out_cmd, | |
320da874 | 7332 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 7333 | CLEAR_STR |
7334 | IP_STR | |
7335 | BGP_STR | |
7336 | "Clear peers with the AS number\n" | |
e0bce756 | 7337 | BGP_SOFT_OUT_STR) |
718e3744 | 7338 | |
01080f7c | 7339 | ALIAS (clear_ip_bgp_as_soft_out, |
7340 | clear_ip_bgp_instance_as_out_cmd, | |
7341 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", | |
7342 | CLEAR_STR | |
7343 | IP_STR | |
7344 | BGP_STR | |
7345 | BGP_INSTANCE_HELP_STR | |
7346 | "Clear peers with the AS number\n" | |
7347 | BGP_SOFT_OUT_STR) | |
7348 | ||
718e3744 | 7349 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
7350 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 7351 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 7352 | CLEAR_STR |
7353 | IP_STR | |
7354 | BGP_STR | |
7355 | "Clear peers with the AS number\n" | |
7356 | "Address family\n" | |
7357 | "Address Family modifier\n" | |
7358 | "Address Family modifier\n" | |
e0bce756 DS |
7359 | BGP_SOFT_STR |
7360 | BGP_SOFT_OUT_STR) | |
718e3744 | 7361 | { |
7362 | if (strncmp (argv[1], "m", 1) == 0) | |
7363 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7364 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7365 | ||
7366 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7367 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7368 | } | |
7369 | ||
01080f7c | 7370 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, |
7371 | clear_ip_bgp_instance_as_ipv4_soft_out_cmd, | |
7372 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", | |
7373 | CLEAR_STR | |
7374 | IP_STR | |
7375 | BGP_STR | |
7376 | BGP_INSTANCE_HELP_STR | |
7377 | "Clear peers with the AS number\n" | |
7378 | "Address family\n" | |
7379 | "Address Family modifier\n" | |
7380 | "Address Family modifier\n" | |
7381 | BGP_SOFT_STR | |
7382 | BGP_SOFT_OUT_STR) | |
7383 | { | |
7384 | if (strncmp (argv[3], "m", 1) == 0) | |
7385 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, | |
7386 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7387 | ||
7388 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
7389 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7390 | } | |
7391 | ||
718e3744 | 7392 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, |
7393 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 7394 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 7395 | CLEAR_STR |
7396 | IP_STR | |
7397 | BGP_STR | |
7398 | "Clear peers with the AS number\n" | |
7399 | "Address family\n" | |
7400 | "Address Family modifier\n" | |
7401 | "Address Family modifier\n" | |
e0bce756 | 7402 | BGP_SOFT_OUT_STR) |
718e3744 | 7403 | |
01080f7c | 7404 | ALIAS (clear_ip_bgp_instance_as_ipv4_soft_out, |
7405 | clear_ip_bgp_instance_as_ipv4_out_cmd, | |
7406 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) out", | |
7407 | CLEAR_STR | |
7408 | IP_STR | |
7409 | BGP_STR | |
7410 | BGP_INSTANCE_HELP_STR | |
7411 | "Clear peers with the AS number\n" | |
7412 | "Address family\n" | |
7413 | "Address Family modifier\n" | |
7414 | "Address Family modifier\n" | |
7415 | BGP_SOFT_OUT_STR) | |
7416 | ||
718e3744 | 7417 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
7418 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 7419 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 7420 | CLEAR_STR |
7421 | IP_STR | |
7422 | BGP_STR | |
7423 | "Clear peers with the AS number\n" | |
7424 | "Address family\n" | |
7425 | "Address Family modifier\n" | |
e0bce756 DS |
7426 | BGP_SOFT_STR |
7427 | BGP_SOFT_OUT_STR) | |
718e3744 | 7428 | { |
7429 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7430 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7431 | } | |
7432 | ||
7433 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
7434 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 7435 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 7436 | CLEAR_STR |
7437 | IP_STR | |
7438 | BGP_STR | |
7439 | "Clear peers with the AS number\n" | |
7440 | "Address family\n" | |
7441 | "Address Family modifier\n" | |
e0bce756 | 7442 | BGP_SOFT_OUT_STR) |
718e3744 | 7443 | |
587ff0fd LB |
7444 | DEFUN (clear_ip_bgp_as_encap_soft_out, |
7445 | clear_ip_bgp_as_encap_soft_out_cmd, | |
7446 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft out", | |
7447 | CLEAR_STR | |
7448 | IP_STR | |
7449 | BGP_STR | |
7450 | "Clear peers with the AS number\n" | |
7451 | "Address family\n" | |
7452 | "Address Family modifier\n" | |
7453 | "Soft reconfig\n" | |
7454 | "Soft reconfig outbound update\n") | |
7455 | { | |
7456 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
7457 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7458 | } | |
7459 | ||
7460 | ALIAS (clear_ip_bgp_as_encap_soft_out, | |
7461 | clear_ip_bgp_as_encap_out_cmd, | |
7462 | "clear ip bgp " CMD_AS_RANGE " encap unicast out", | |
7463 | CLEAR_STR | |
7464 | IP_STR | |
7465 | BGP_STR | |
7466 | "Clear peers with the AS number\n" | |
7467 | "Address family\n" | |
7468 | "Address Family modifier\n" | |
7469 | "Soft reconfig outbound update\n") | |
7470 | ||
718e3744 | 7471 | DEFUN (clear_bgp_as_soft_out, |
7472 | clear_bgp_as_soft_out_cmd, | |
320da874 | 7473 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 7474 | CLEAR_STR |
7475 | BGP_STR | |
7476 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7477 | BGP_SOFT_STR |
7478 | BGP_SOFT_OUT_STR) | |
718e3744 | 7479 | { |
01080f7c | 7480 | if (argc == 3) |
7481 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
7482 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7483 | ||
718e3744 | 7484 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
7485 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
7486 | } | |
7487 | ||
01080f7c | 7488 | ALIAS (clear_bgp_as_soft_out, |
7489 | clear_bgp_instance_as_soft_out_cmd, | |
7490 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", | |
7491 | CLEAR_STR | |
7492 | BGP_STR | |
7493 | BGP_INSTANCE_HELP_STR | |
7494 | "Clear peers with the AS number\n" | |
7495 | BGP_SOFT_STR | |
7496 | BGP_SOFT_OUT_STR) | |
7497 | ||
718e3744 | 7498 | ALIAS (clear_bgp_as_soft_out, |
7499 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 7500 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 7501 | CLEAR_STR |
7502 | BGP_STR | |
7503 | "Address family\n" | |
7504 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7505 | BGP_SOFT_STR |
7506 | BGP_SOFT_OUT_STR) | |
718e3744 | 7507 | |
01080f7c | 7508 | ALIAS (clear_bgp_as_soft_out, |
7509 | clear_bgp_instance_ipv6_as_soft_out_cmd, | |
7510 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft out", | |
7511 | CLEAR_STR | |
7512 | BGP_STR | |
7513 | BGP_INSTANCE_HELP_STR | |
7514 | "Address family\n" | |
7515 | "Clear peers with the AS number\n" | |
7516 | BGP_SOFT_STR | |
7517 | BGP_SOFT_OUT_STR) | |
7518 | ||
718e3744 | 7519 | ALIAS (clear_bgp_as_soft_out, |
7520 | clear_bgp_as_out_cmd, | |
320da874 | 7521 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 7522 | CLEAR_STR |
7523 | BGP_STR | |
7524 | "Clear peers with the AS number\n" | |
e0bce756 | 7525 | BGP_SOFT_OUT_STR) |
718e3744 | 7526 | |
01080f7c | 7527 | ALIAS (clear_bgp_as_soft_out, |
7528 | clear_bgp_instance_as_out_cmd, | |
7529 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", | |
7530 | CLEAR_STR | |
7531 | BGP_STR | |
7532 | BGP_INSTANCE_HELP_STR | |
7533 | "Clear peers with the AS number\n" | |
7534 | BGP_SOFT_OUT_STR) | |
7535 | ||
718e3744 | 7536 | ALIAS (clear_bgp_as_soft_out, |
7537 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 7538 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 7539 | CLEAR_STR |
7540 | BGP_STR | |
7541 | "Address family\n" | |
7542 | "Clear peers with the AS number\n" | |
e0bce756 | 7543 | BGP_SOFT_OUT_STR) |
6b0655a2 | 7544 | |
01080f7c | 7545 | ALIAS (clear_bgp_as_soft_out, |
7546 | clear_bgp_instance_ipv6_as_out_cmd, | |
7547 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " out", | |
7548 | CLEAR_STR | |
7549 | BGP_STR | |
7550 | BGP_INSTANCE_HELP_STR | |
7551 | "Address family\n" | |
7552 | "Clear peers with the AS number\n" | |
7553 | BGP_SOFT_OUT_STR) | |
7554 | ||
718e3744 | 7555 | /* Inbound soft-reconfiguration */ |
7556 | DEFUN (clear_ip_bgp_all_soft_in, | |
7557 | clear_ip_bgp_all_soft_in_cmd, | |
7558 | "clear ip bgp * soft in", | |
7559 | CLEAR_STR | |
7560 | IP_STR | |
7561 | BGP_STR | |
7562 | "Clear all peers\n" | |
e0bce756 DS |
7563 | BGP_SOFT_STR |
7564 | BGP_SOFT_IN_STR) | |
718e3744 | 7565 | { |
6aeb9e78 DS |
7566 | if (argc == 2) |
7567 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 7568 | BGP_CLEAR_SOFT_IN, NULL); |
7569 | ||
7570 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7571 | BGP_CLEAR_SOFT_IN, NULL); | |
7572 | } | |
7573 | ||
7574 | ALIAS (clear_ip_bgp_all_soft_in, | |
7575 | clear_ip_bgp_instance_all_soft_in_cmd, | |
8386ac43 | 7576 | "clear ip bgp " BGP_INSTANCE_CMD " * soft in", |
718e3744 | 7577 | CLEAR_STR |
7578 | IP_STR | |
7579 | BGP_STR | |
8386ac43 | 7580 | BGP_INSTANCE_HELP_STR |
718e3744 | 7581 | "Clear all peers\n" |
e0bce756 DS |
7582 | BGP_SOFT_STR |
7583 | BGP_SOFT_IN_STR) | |
718e3744 | 7584 | |
7585 | ALIAS (clear_ip_bgp_all_soft_in, | |
7586 | clear_ip_bgp_all_in_cmd, | |
7587 | "clear ip bgp * in", | |
7588 | CLEAR_STR | |
7589 | IP_STR | |
7590 | BGP_STR | |
7591 | "Clear all peers\n" | |
e0bce756 | 7592 | BGP_SOFT_IN_STR) |
718e3744 | 7593 | |
01080f7c | 7594 | ALIAS (clear_ip_bgp_all_soft_in, |
7595 | clear_ip_bgp_instance_all_in_cmd, | |
7596 | "clear ip bgp " BGP_INSTANCE_CMD " * in", | |
7597 | CLEAR_STR | |
7598 | IP_STR | |
7599 | BGP_STR | |
7600 | BGP_INSTANCE_HELP_STR | |
7601 | "Clear all peers\n" | |
7602 | BGP_SOFT_IN_STR) | |
7603 | ||
718e3744 | 7604 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
7605 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
7606 | "clear ip bgp * in prefix-filter", | |
7607 | CLEAR_STR | |
7608 | IP_STR | |
7609 | BGP_STR | |
7610 | "Clear all peers\n" | |
e0bce756 | 7611 | BGP_SOFT_IN_STR |
718e3744 | 7612 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7613 | { | |
6aeb9e78 DS |
7614 | if (argc== 2) |
7615 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 7616 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
7617 | ||
7618 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7619 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7620 | } | |
7621 | ||
718e3744 | 7622 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
7623 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
7624 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
7625 | CLEAR_STR | |
7626 | IP_STR | |
7627 | BGP_STR | |
7628 | "Clear all peers\n" | |
7629 | "Address family\n" | |
7630 | "Address Family modifier\n" | |
7631 | "Address Family modifier\n" | |
e0bce756 DS |
7632 | BGP_SOFT_STR |
7633 | BGP_SOFT_IN_STR) | |
718e3744 | 7634 | { |
7635 | if (strncmp (argv[0], "m", 1) == 0) | |
7636 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7637 | BGP_CLEAR_SOFT_IN, NULL); | |
7638 | ||
7639 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7640 | BGP_CLEAR_SOFT_IN, NULL); | |
7641 | } | |
7642 | ||
718e3744 | 7643 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
7644 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
8386ac43 | 7645 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft in", |
718e3744 | 7646 | CLEAR_STR |
7647 | IP_STR | |
7648 | BGP_STR | |
8386ac43 | 7649 | BGP_INSTANCE_HELP_STR |
718e3744 | 7650 | "Clear all peers\n" |
7651 | "Address family\n" | |
7652 | "Address Family modifier\n" | |
7653 | "Address Family modifier\n" | |
e0bce756 DS |
7654 | BGP_SOFT_STR |
7655 | BGP_SOFT_IN_STR) | |
718e3744 | 7656 | { |
6aeb9e78 DS |
7657 | if (strncmp (argv[2], "m", 1) == 0) |
7658 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, | |
718e3744 | 7659 | BGP_CLEAR_SOFT_IN, NULL); |
7660 | ||
6aeb9e78 | 7661 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, |
718e3744 | 7662 | BGP_CLEAR_SOFT_IN, NULL); |
7663 | } | |
7664 | ||
01080f7c | 7665 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, |
7666 | clear_ip_bgp_all_ipv4_in_cmd, | |
7667 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
718e3744 | 7668 | CLEAR_STR |
7669 | IP_STR | |
7670 | BGP_STR | |
7671 | "Clear all peers\n" | |
7672 | "Address family\n" | |
7673 | "Address Family modifier\n" | |
7674 | "Address Family modifier\n" | |
01080f7c | 7675 | BGP_SOFT_IN_STR) |
718e3744 | 7676 | |
01080f7c | 7677 | ALIAS (clear_ip_bgp_instance_all_ipv4_soft_in, |
7678 | clear_ip_bgp_instance_all_ipv4_in_cmd, | |
7679 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) in", | |
7680 | CLEAR_STR | |
7681 | IP_STR | |
7682 | BGP_STR | |
7683 | BGP_INSTANCE_HELP_STR | |
7684 | "Clear all peers\n" | |
7685 | "Address family\n" | |
7686 | "Address Family modifier\n" | |
7687 | "Address Family modifier\n" | |
7688 | BGP_SOFT_IN_STR) | |
718e3744 | 7689 | |
01080f7c | 7690 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
7691 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
7692 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
718e3744 | 7693 | CLEAR_STR |
7694 | IP_STR | |
7695 | BGP_STR | |
7696 | "Clear all peers\n" | |
7697 | "Address family\n" | |
7698 | "Address Family modifier\n" | |
7699 | "Address Family modifier\n" | |
e0bce756 | 7700 | BGP_SOFT_IN_STR |
718e3744 | 7701 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7702 | { | |
01080f7c | 7703 | if (strncmp (argv[0], "m", 1) == 0) |
7704 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7705 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
718e3744 | 7706 | |
01080f7c | 7707 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
7708 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
718e3744 | 7709 | } |
7710 | ||
7711 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
7712 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
7713 | "clear ip bgp * vpnv4 unicast soft in", | |
7714 | CLEAR_STR | |
7715 | IP_STR | |
7716 | BGP_STR | |
7717 | "Clear all peers\n" | |
7718 | "Address family\n" | |
7719 | "Address Family Modifier\n" | |
e0bce756 DS |
7720 | BGP_SOFT_STR |
7721 | BGP_SOFT_IN_STR) | |
718e3744 | 7722 | { |
7723 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
7724 | BGP_CLEAR_SOFT_IN, NULL); | |
7725 | } | |
7726 | ||
7727 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
7728 | clear_ip_bgp_all_vpnv4_in_cmd, | |
7729 | "clear ip bgp * vpnv4 unicast in", | |
7730 | CLEAR_STR | |
7731 | IP_STR | |
7732 | BGP_STR | |
7733 | "Clear all peers\n" | |
7734 | "Address family\n" | |
7735 | "Address Family Modifier\n" | |
e0bce756 | 7736 | BGP_SOFT_IN_STR) |
718e3744 | 7737 | |
587ff0fd LB |
7738 | DEFUN (clear_ip_bgp_all_encap_soft_in, |
7739 | clear_ip_bgp_all_encap_soft_in_cmd, | |
7740 | "clear ip bgp * encap unicast soft in", | |
7741 | CLEAR_STR | |
7742 | IP_STR | |
7743 | BGP_STR | |
7744 | "Clear all peers\n" | |
7745 | "Address family\n" | |
7746 | "Address Family Modifier\n" | |
7747 | "Soft reconfig\n" | |
7748 | "Soft reconfig inbound update\n") | |
7749 | { | |
7750 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
7751 | BGP_CLEAR_SOFT_IN, NULL); | |
7752 | } | |
7753 | ||
7754 | ALIAS (clear_ip_bgp_all_encap_soft_in, | |
7755 | clear_ip_bgp_all_encap_in_cmd, | |
7756 | "clear ip bgp * encap unicast in", | |
7757 | CLEAR_STR | |
7758 | IP_STR | |
7759 | BGP_STR | |
7760 | "Clear all peers\n" | |
7761 | "Address family\n" | |
7762 | "Address Family Modifier\n" | |
7763 | "Soft reconfig inbound update\n") | |
7764 | ||
718e3744 | 7765 | DEFUN (clear_bgp_all_soft_in, |
7766 | clear_bgp_all_soft_in_cmd, | |
7767 | "clear bgp * soft in", | |
7768 | CLEAR_STR | |
7769 | BGP_STR | |
7770 | "Clear all peers\n" | |
e0bce756 DS |
7771 | BGP_SOFT_STR |
7772 | BGP_SOFT_IN_STR) | |
718e3744 | 7773 | { |
6aeb9e78 DS |
7774 | if (argc == 2) |
7775 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
718e3744 | 7776 | BGP_CLEAR_SOFT_IN, NULL); |
7777 | ||
7778 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7779 | BGP_CLEAR_SOFT_IN, NULL); | |
7780 | } | |
7781 | ||
7782 | ALIAS (clear_bgp_all_soft_in, | |
7783 | clear_bgp_instance_all_soft_in_cmd, | |
8386ac43 | 7784 | "clear bgp " BGP_INSTANCE_CMD " * soft in", |
718e3744 | 7785 | CLEAR_STR |
7786 | BGP_STR | |
8386ac43 | 7787 | BGP_INSTANCE_HELP_STR |
718e3744 | 7788 | "Clear all peers\n" |
e0bce756 DS |
7789 | BGP_SOFT_STR |
7790 | BGP_SOFT_IN_STR) | |
718e3744 | 7791 | |
7792 | ALIAS (clear_bgp_all_soft_in, | |
7793 | clear_bgp_ipv6_all_soft_in_cmd, | |
7794 | "clear bgp ipv6 * soft in", | |
7795 | CLEAR_STR | |
7796 | BGP_STR | |
7797 | "Address family\n" | |
7798 | "Clear all peers\n" | |
e0bce756 DS |
7799 | BGP_SOFT_STR |
7800 | BGP_SOFT_IN_STR) | |
718e3744 | 7801 | |
01080f7c | 7802 | ALIAS (clear_bgp_all_soft_in, |
7803 | clear_bgp_instance_ipv6_all_soft_in_cmd, | |
7804 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft in", | |
7805 | CLEAR_STR | |
7806 | BGP_STR | |
7807 | BGP_INSTANCE_HELP_STR | |
7808 | "Address family\n" | |
7809 | "Clear all peers\n" | |
7810 | BGP_SOFT_STR | |
7811 | BGP_SOFT_IN_STR) | |
7812 | ||
718e3744 | 7813 | ALIAS (clear_bgp_all_soft_in, |
7814 | clear_bgp_all_in_cmd, | |
7815 | "clear bgp * in", | |
7816 | CLEAR_STR | |
7817 | BGP_STR | |
7818 | "Clear all peers\n" | |
e0bce756 | 7819 | BGP_SOFT_IN_STR) |
718e3744 | 7820 | |
01080f7c | 7821 | ALIAS (clear_bgp_all_soft_in, |
7822 | clear_bgp_instance_all_in_cmd, | |
7823 | "clear bgp " BGP_INSTANCE_CMD " * in", | |
7824 | CLEAR_STR | |
7825 | BGP_STR | |
7826 | BGP_INSTANCE_HELP_STR | |
7827 | "Clear all peers\n" | |
7828 | BGP_SOFT_IN_STR) | |
7829 | ||
718e3744 | 7830 | ALIAS (clear_bgp_all_soft_in, |
7831 | clear_bgp_ipv6_all_in_cmd, | |
7832 | "clear bgp ipv6 * in", | |
7833 | CLEAR_STR | |
7834 | BGP_STR | |
7835 | "Address family\n" | |
7836 | "Clear all peers\n" | |
e0bce756 | 7837 | BGP_SOFT_IN_STR) |
718e3744 | 7838 | |
01080f7c | 7839 | ALIAS (clear_bgp_all_soft_in, |
7840 | clear_bgp_instance_ipv6_all_in_cmd, | |
7841 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * in", | |
7842 | CLEAR_STR | |
7843 | BGP_STR | |
7844 | BGP_INSTANCE_HELP_STR | |
7845 | "Address family\n" | |
7846 | "Clear all peers\n" | |
7847 | BGP_SOFT_IN_STR) | |
7848 | ||
718e3744 | 7849 | DEFUN (clear_bgp_all_in_prefix_filter, |
7850 | clear_bgp_all_in_prefix_filter_cmd, | |
7851 | "clear bgp * in prefix-filter", | |
7852 | CLEAR_STR | |
7853 | BGP_STR | |
7854 | "Clear all peers\n" | |
e0bce756 | 7855 | BGP_SOFT_IN_STR |
718e3744 | 7856 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7857 | { | |
7858 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7859 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7860 | } | |
7861 | ||
7862 | ALIAS (clear_bgp_all_in_prefix_filter, | |
7863 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
7864 | "clear bgp ipv6 * in prefix-filter", | |
7865 | CLEAR_STR | |
7866 | BGP_STR | |
7867 | "Address family\n" | |
7868 | "Clear all peers\n" | |
e0bce756 | 7869 | BGP_SOFT_IN_STR |
718e3744 | 7870 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7871 | ||
7872 | DEFUN (clear_ip_bgp_peer_soft_in, | |
7873 | clear_ip_bgp_peer_soft_in_cmd, | |
db64ea86 | 7874 | "clear ip bgp (A.B.C.D|WORD) soft in", |
718e3744 | 7875 | CLEAR_STR |
7876 | IP_STR | |
7877 | BGP_STR | |
7878 | "BGP neighbor address to clear\n" | |
db64ea86 | 7879 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
7880 | BGP_SOFT_STR |
7881 | BGP_SOFT_IN_STR) | |
718e3744 | 7882 | { |
01080f7c | 7883 | if (argc == 3) |
7884 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
7885 | BGP_CLEAR_SOFT_IN, argv[2]); | |
7886 | ||
718e3744 | 7887 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
7888 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7889 | } | |
7890 | ||
01080f7c | 7891 | ALIAS (clear_ip_bgp_peer_soft_in, |
7892 | clear_ip_bgp_instance_peer_soft_in_cmd, | |
7893 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft in", | |
7894 | CLEAR_STR | |
7895 | IP_STR | |
7896 | BGP_STR | |
7897 | BGP_INSTANCE_HELP_STR | |
7898 | "BGP neighbor address to clear\n" | |
7899 | "BGP neighbor on interface to clear\n" | |
7900 | BGP_SOFT_STR | |
7901 | BGP_SOFT_IN_STR) | |
7902 | ||
718e3744 | 7903 | ALIAS (clear_ip_bgp_peer_soft_in, |
7904 | clear_ip_bgp_peer_in_cmd, | |
db64ea86 | 7905 | "clear ip bgp (A.B.C.D|WORD) in", |
718e3744 | 7906 | CLEAR_STR |
7907 | IP_STR | |
7908 | BGP_STR | |
7909 | "BGP neighbor address to clear\n" | |
db64ea86 | 7910 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7911 | BGP_SOFT_IN_STR) |
01080f7c | 7912 | |
7913 | ALIAS (clear_ip_bgp_peer_soft_in, | |
7914 | clear_ip_bgp_instance_peer_in_cmd, | |
7915 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) in", | |
7916 | CLEAR_STR | |
7917 | IP_STR | |
7918 | BGP_STR | |
7919 | BGP_INSTANCE_HELP_STR | |
7920 | "BGP neighbor address to clear\n" | |
7921 | "BGP neighbor on interface to clear\n" | |
7922 | BGP_SOFT_IN_STR) | |
7923 | ||
718e3744 | 7924 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
7925 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
db64ea86 | 7926 | "clear ip bgp (A.B.C.D|WORD) in prefix-filter", |
718e3744 | 7927 | CLEAR_STR |
7928 | IP_STR | |
7929 | BGP_STR | |
7930 | "BGP neighbor address to clear\n" | |
db64ea86 | 7931 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7932 | BGP_SOFT_IN_STR |
718e3744 | 7933 | "Push out the existing ORF prefix-list\n") |
7934 | { | |
7935 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7936 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7937 | } | |
7938 | ||
7939 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
7940 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
db64ea86 | 7941 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", |
718e3744 | 7942 | CLEAR_STR |
7943 | IP_STR | |
7944 | BGP_STR | |
7945 | "BGP neighbor address to clear\n" | |
db64ea86 | 7946 | "BGP neighbor on interface to clear\n" |
718e3744 | 7947 | "Address family\n" |
7948 | "Address Family modifier\n" | |
7949 | "Address Family modifier\n" | |
e0bce756 DS |
7950 | BGP_SOFT_STR |
7951 | BGP_SOFT_IN_STR) | |
718e3744 | 7952 | { |
7953 | if (strncmp (argv[1], "m", 1) == 0) | |
7954 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
7955 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7956 | ||
7957 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7958 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7959 | } | |
7960 | ||
01080f7c | 7961 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, |
7962 | clear_ip_bgp_instance_peer_ipv4_soft_in_cmd, | |
7963 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", | |
7964 | CLEAR_STR | |
7965 | IP_STR | |
7966 | BGP_STR | |
7967 | BGP_INSTANCE_HELP_STR | |
7968 | "BGP neighbor address to clear\n" | |
7969 | "BGP neighbor on interface to clear\n" | |
7970 | "Address family\n" | |
7971 | "Address Family modifier\n" | |
7972 | "Address Family modifier\n" | |
7973 | BGP_SOFT_STR | |
7974 | BGP_SOFT_IN_STR) | |
7975 | { | |
7976 | if (strncmp (argv[3], "m", 1) == 0) | |
7977 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, | |
7978 | BGP_CLEAR_SOFT_IN, argv[2]); | |
7979 | ||
7980 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
7981 | BGP_CLEAR_SOFT_IN, argv[2]); | |
7982 | } | |
7983 | ||
718e3744 | 7984 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, |
7985 | clear_ip_bgp_peer_ipv4_in_cmd, | |
db64ea86 | 7986 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in", |
718e3744 | 7987 | CLEAR_STR |
7988 | IP_STR | |
7989 | BGP_STR | |
7990 | "BGP neighbor address to clear\n" | |
db64ea86 | 7991 | "BGP neighbor on interface to clear\n" |
718e3744 | 7992 | "Address family\n" |
7993 | "Address Family modifier\n" | |
7994 | "Address Family modifier\n" | |
e0bce756 | 7995 | BGP_SOFT_IN_STR) |
718e3744 | 7996 | |
01080f7c | 7997 | ALIAS (clear_ip_bgp_instance_peer_ipv4_soft_in, |
7998 | clear_ip_bgp_instance_peer_ipv4_in_cmd, | |
7999 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) in", | |
8000 | CLEAR_STR | |
8001 | IP_STR | |
8002 | BGP_STR | |
8003 | BGP_INSTANCE_HELP_STR | |
8004 | "BGP neighbor address to clear\n" | |
8005 | "BGP neighbor on interface to clear\n" | |
8006 | "Address family\n" | |
8007 | "Address Family modifier\n" | |
8008 | "Address Family modifier\n" | |
8009 | BGP_SOFT_IN_STR) | |
8010 | ||
718e3744 | 8011 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
8012 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
db64ea86 | 8013 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 8014 | CLEAR_STR |
8015 | IP_STR | |
8016 | BGP_STR | |
8017 | "BGP neighbor address to clear\n" | |
db64ea86 | 8018 | "BGP neighbor on interface to clear\n" |
718e3744 | 8019 | "Address family\n" |
8020 | "Address Family modifier\n" | |
8021 | "Address Family modifier\n" | |
e0bce756 | 8022 | BGP_SOFT_IN_STR |
718e3744 | 8023 | "Push out the existing ORF prefix-list\n") |
8024 | { | |
8025 | if (strncmp (argv[1], "m", 1) == 0) | |
8026 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
8027 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8028 | ||
8029 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8030 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8031 | } | |
8032 | ||
8033 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
8034 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
db64ea86 | 8035 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in", |
718e3744 | 8036 | CLEAR_STR |
8037 | IP_STR | |
8038 | BGP_STR | |
8039 | "BGP neighbor address to clear\n" | |
db64ea86 | 8040 | "BGP neighbor on interface to clear\n" |
718e3744 | 8041 | "Address family\n" |
8042 | "Address Family Modifier\n" | |
e0bce756 DS |
8043 | BGP_SOFT_STR |
8044 | BGP_SOFT_IN_STR) | |
718e3744 | 8045 | { |
8046 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
8047 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8048 | } | |
8049 | ||
8050 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
8051 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
db64ea86 | 8052 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in", |
718e3744 | 8053 | CLEAR_STR |
8054 | IP_STR | |
8055 | BGP_STR | |
8056 | "BGP neighbor address to clear\n" | |
db64ea86 | 8057 | "BGP neighbor on interface to clear\n" |
718e3744 | 8058 | "Address family\n" |
8059 | "Address Family Modifier\n" | |
e0bce756 | 8060 | BGP_SOFT_IN_STR) |
718e3744 | 8061 | |
587ff0fd LB |
8062 | DEFUN (clear_ip_bgp_peer_encap_soft_in, |
8063 | clear_ip_bgp_peer_encap_soft_in_cmd, | |
8064 | "clear ip bgp A.B.C.D encap unicast soft in", | |
8065 | CLEAR_STR | |
8066 | IP_STR | |
8067 | BGP_STR | |
8068 | "BGP neighbor address to clear\n" | |
8069 | "Address family\n" | |
8070 | "Address Family Modifier\n" | |
8071 | "Soft reconfig\n" | |
8072 | "Soft reconfig inbound update\n") | |
8073 | { | |
8074 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
8075 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8076 | } | |
8077 | ||
8078 | ALIAS (clear_ip_bgp_peer_encap_soft_in, | |
8079 | clear_ip_bgp_peer_encap_in_cmd, | |
8080 | "clear ip bgp A.B.C.D encap unicast in", | |
8081 | CLEAR_STR | |
8082 | IP_STR | |
8083 | BGP_STR | |
8084 | "BGP neighbor address to clear\n" | |
8085 | "Address family\n" | |
8086 | "Address Family Modifier\n" | |
8087 | "Soft reconfig inbound update\n") | |
8088 | ||
718e3744 | 8089 | DEFUN (clear_bgp_peer_soft_in, |
8090 | clear_bgp_peer_soft_in_cmd, | |
a80beece | 8091 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 8092 | CLEAR_STR |
8093 | BGP_STR | |
8094 | "BGP neighbor address to clear\n" | |
8095 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8096 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
8097 | BGP_SOFT_STR |
8098 | BGP_SOFT_IN_STR) | |
718e3744 | 8099 | { |
01080f7c | 8100 | if (argc == 3) |
8101 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
8102 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8103 | ||
718e3744 | 8104 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
8105 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8106 | } | |
8107 | ||
01080f7c | 8108 | ALIAS (clear_bgp_peer_soft_in, |
8109 | clear_bgp_instance_peer_soft_in_cmd, | |
8110 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft in", | |
8111 | CLEAR_STR | |
8112 | BGP_STR | |
8113 | BGP_INSTANCE_HELP_STR | |
8114 | "BGP neighbor address to clear\n" | |
8115 | "BGP IPv6 neighbor to clear\n" | |
8116 | "BGP neighbor on interface to clear\n" | |
8117 | BGP_SOFT_STR | |
8118 | BGP_SOFT_IN_STR) | |
8119 | ||
718e3744 | 8120 | ALIAS (clear_bgp_peer_soft_in, |
8121 | clear_bgp_ipv6_peer_soft_in_cmd, | |
a80beece | 8122 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 8123 | CLEAR_STR |
8124 | BGP_STR | |
8125 | "Address family\n" | |
8126 | "BGP neighbor address to clear\n" | |
8127 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8128 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
8129 | BGP_SOFT_STR |
8130 | BGP_SOFT_IN_STR) | |
718e3744 | 8131 | |
01080f7c | 8132 | ALIAS (clear_bgp_peer_soft_in, |
8133 | clear_bgp_instance_ipv6_peer_soft_in_cmd, | |
8134 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", | |
8135 | CLEAR_STR | |
8136 | BGP_STR | |
8137 | BGP_INSTANCE_HELP_STR | |
8138 | "Address family\n" | |
8139 | "BGP neighbor address to clear\n" | |
8140 | "BGP IPv6 neighbor to clear\n" | |
8141 | "BGP neighbor on interface to clear\n" | |
8142 | BGP_SOFT_STR | |
8143 | BGP_SOFT_IN_STR) | |
8144 | ||
718e3744 | 8145 | ALIAS (clear_bgp_peer_soft_in, |
8146 | clear_bgp_peer_in_cmd, | |
a80beece | 8147 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 8148 | CLEAR_STR |
8149 | BGP_STR | |
8150 | "BGP neighbor address to clear\n" | |
8151 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8152 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8153 | BGP_SOFT_IN_STR) |
718e3744 | 8154 | |
01080f7c | 8155 | ALIAS (clear_bgp_peer_soft_in, |
8156 | clear_bgp_instance_peer_in_cmd, | |
8157 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) in", | |
8158 | CLEAR_STR | |
8159 | BGP_STR | |
8160 | BGP_INSTANCE_HELP_STR | |
8161 | "BGP neighbor address to clear\n" | |
8162 | "BGP IPv6 neighbor to clear\n" | |
8163 | "BGP neighbor on interface to clear\n" | |
8164 | BGP_SOFT_IN_STR) | |
8165 | ||
718e3744 | 8166 | ALIAS (clear_bgp_peer_soft_in, |
8167 | clear_bgp_ipv6_peer_in_cmd, | |
a80beece | 8168 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 8169 | CLEAR_STR |
8170 | BGP_STR | |
8171 | "Address family\n" | |
8172 | "BGP neighbor address to clear\n" | |
8173 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8174 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8175 | BGP_SOFT_IN_STR) |
718e3744 | 8176 | |
01080f7c | 8177 | ALIAS (clear_bgp_peer_soft_in, |
8178 | clear_bgp_instance_ipv6_peer_in_cmd, | |
8179 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) in", | |
8180 | CLEAR_STR | |
8181 | BGP_STR | |
8182 | BGP_INSTANCE_HELP_STR | |
8183 | "Address family\n" | |
8184 | "BGP neighbor address to clear\n" | |
8185 | "BGP IPv6 neighbor to clear\n" | |
8186 | "BGP neighbor on interface to clear\n" | |
8187 | BGP_SOFT_IN_STR) | |
8188 | ||
718e3744 | 8189 | DEFUN (clear_bgp_peer_in_prefix_filter, |
8190 | clear_bgp_peer_in_prefix_filter_cmd, | |
a80beece | 8191 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 8192 | CLEAR_STR |
8193 | BGP_STR | |
8194 | "BGP neighbor address to clear\n" | |
8195 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8196 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8197 | BGP_SOFT_IN_STR |
718e3744 | 8198 | "Push out the existing ORF prefix-list\n") |
8199 | { | |
8200 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
8201 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8202 | } | |
8203 | ||
8204 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
8205 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
a80beece | 8206 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 8207 | CLEAR_STR |
8208 | BGP_STR | |
8209 | "Address family\n" | |
8210 | "BGP neighbor address to clear\n" | |
8211 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8212 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8213 | BGP_SOFT_IN_STR |
718e3744 | 8214 | "Push out the existing ORF prefix-list\n") |
8215 | ||
8216 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
8217 | clear_ip_bgp_peer_group_soft_in_cmd, | |
8218 | "clear ip bgp peer-group WORD soft in", | |
8219 | CLEAR_STR | |
8220 | IP_STR | |
8221 | BGP_STR | |
8222 | "Clear all members of peer-group\n" | |
8223 | "BGP peer-group name\n" | |
e0bce756 DS |
8224 | BGP_SOFT_STR |
8225 | BGP_SOFT_IN_STR) | |
718e3744 | 8226 | { |
01080f7c | 8227 | if (argc == 3) |
8228 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
8229 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8230 | ||
718e3744 | 8231 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
8232 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8233 | } | |
8234 | ||
01080f7c | 8235 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
8236 | clear_ip_bgp_instance_peer_group_soft_in_cmd, | |
8237 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", | |
8238 | CLEAR_STR | |
8239 | IP_STR | |
8240 | BGP_STR | |
8241 | BGP_INSTANCE_HELP_STR | |
8242 | "Clear all members of peer-group\n" | |
8243 | "BGP peer-group name\n" | |
8244 | BGP_SOFT_STR | |
8245 | BGP_SOFT_IN_STR) | |
8246 | ||
718e3744 | 8247 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
8248 | clear_ip_bgp_peer_group_in_cmd, | |
8249 | "clear ip bgp peer-group WORD in", | |
8250 | CLEAR_STR | |
8251 | IP_STR | |
8252 | BGP_STR | |
8253 | "Clear all members of peer-group\n" | |
8254 | "BGP peer-group name\n" | |
e0bce756 | 8255 | BGP_SOFT_IN_STR) |
718e3744 | 8256 | |
01080f7c | 8257 | ALIAS (clear_ip_bgp_peer_group_soft_in, |
8258 | clear_ip_bgp_instance_peer_group_in_cmd, | |
8259 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD in", | |
8260 | CLEAR_STR | |
8261 | IP_STR | |
8262 | BGP_STR | |
8263 | BGP_INSTANCE_HELP_STR | |
8264 | "Clear all members of peer-group\n" | |
8265 | "BGP peer-group name\n" | |
8266 | BGP_SOFT_IN_STR) | |
8267 | ||
718e3744 | 8268 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
8269 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
8270 | "clear ip bgp peer-group WORD in prefix-filter", | |
8271 | CLEAR_STR | |
8272 | IP_STR | |
8273 | BGP_STR | |
8274 | "Clear all members of peer-group\n" | |
8275 | "BGP peer-group name\n" | |
e0bce756 | 8276 | BGP_SOFT_IN_STR |
718e3744 | 8277 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8278 | { | |
8279 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
8280 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8281 | } | |
8282 | ||
8283 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
8284 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
8285 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
8286 | CLEAR_STR | |
8287 | IP_STR | |
8288 | BGP_STR | |
8289 | "Clear all members of peer-group\n" | |
8290 | "BGP peer-group name\n" | |
8291 | "Address family\n" | |
8292 | "Address Family modifier\n" | |
8293 | "Address Family modifier\n" | |
e0bce756 DS |
8294 | BGP_SOFT_STR |
8295 | BGP_SOFT_IN_STR) | |
718e3744 | 8296 | { |
8297 | if (strncmp (argv[1], "m", 1) == 0) | |
8298 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
8299 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8300 | ||
8301 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
8302 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8303 | } | |
8304 | ||
01080f7c | 8305 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, |
8306 | clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd, | |
8307 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft in", | |
8308 | CLEAR_STR | |
8309 | IP_STR | |
8310 | BGP_STR | |
8311 | BGP_INSTANCE_HELP_STR | |
8312 | "Clear all members of peer-group\n" | |
8313 | "BGP peer-group name\n" | |
8314 | "Address family\n" | |
8315 | "Address Family modifier\n" | |
8316 | "Address Family modifier\n" | |
8317 | BGP_SOFT_STR | |
8318 | BGP_SOFT_IN_STR) | |
8319 | { | |
8320 | if (strncmp (argv[3], "m", 1) == 0) | |
8321 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, | |
8322 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8323 | ||
8324 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
8325 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8326 | } | |
8327 | ||
718e3744 | 8328 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, |
8329 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
8330 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
8331 | CLEAR_STR | |
8332 | IP_STR | |
8333 | BGP_STR | |
8334 | "Clear all members of peer-group\n" | |
8335 | "BGP peer-group name\n" | |
8336 | "Address family\n" | |
8337 | "Address Family modifier\n" | |
8338 | "Address Family modifier\n" | |
e0bce756 | 8339 | BGP_SOFT_IN_STR) |
718e3744 | 8340 | |
01080f7c | 8341 | ALIAS (clear_ip_bgp_instance_peer_group_ipv4_soft_in, |
8342 | clear_ip_bgp_instance_peer_group_ipv4_in_cmd, | |
8343 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) in", | |
8344 | CLEAR_STR | |
8345 | IP_STR | |
8346 | BGP_STR | |
8347 | BGP_INSTANCE_HELP_STR | |
8348 | "Clear all members of peer-group\n" | |
8349 | "BGP peer-group name\n" | |
8350 | "Address family\n" | |
8351 | "Address Family modifier\n" | |
8352 | "Address Family modifier\n" | |
8353 | BGP_SOFT_IN_STR) | |
8354 | ||
718e3744 | 8355 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
8356 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
8357 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
8358 | CLEAR_STR | |
8359 | IP_STR | |
8360 | BGP_STR | |
8361 | "Clear all members of peer-group\n" | |
8362 | "BGP peer-group name\n" | |
8363 | "Address family\n" | |
8364 | "Address Family modifier\n" | |
8365 | "Address Family modifier\n" | |
e0bce756 | 8366 | BGP_SOFT_IN_STR |
718e3744 | 8367 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8368 | { | |
8369 | if (strncmp (argv[1], "m", 1) == 0) | |
8370 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
8371 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8372 | ||
8373 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
8374 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8375 | } | |
8376 | ||
8377 | DEFUN (clear_bgp_peer_group_soft_in, | |
8378 | clear_bgp_peer_group_soft_in_cmd, | |
8379 | "clear bgp peer-group WORD soft in", | |
8380 | CLEAR_STR | |
8381 | BGP_STR | |
8382 | "Clear all members of peer-group\n" | |
8383 | "BGP peer-group name\n" | |
e0bce756 DS |
8384 | BGP_SOFT_STR |
8385 | BGP_SOFT_IN_STR) | |
718e3744 | 8386 | { |
01080f7c | 8387 | if (argc == 3) |
8388 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
8389 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8390 | ||
718e3744 | 8391 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
8392 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8393 | } | |
8394 | ||
01080f7c | 8395 | ALIAS (clear_bgp_peer_group_soft_in, |
8396 | clear_bgp_instance_peer_group_soft_in_cmd, | |
8397 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", | |
8398 | CLEAR_STR | |
8399 | BGP_STR | |
8400 | BGP_INSTANCE_HELP_STR | |
8401 | "Clear all members of peer-group\n" | |
8402 | "BGP peer-group name\n" | |
8403 | BGP_SOFT_STR | |
8404 | BGP_SOFT_IN_STR) | |
8405 | ||
718e3744 | 8406 | ALIAS (clear_bgp_peer_group_soft_in, |
8407 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
8408 | "clear bgp ipv6 peer-group WORD soft in", | |
8409 | CLEAR_STR | |
8410 | BGP_STR | |
8411 | "Address family\n" | |
8412 | "Clear all members of peer-group\n" | |
8413 | "BGP peer-group name\n" | |
e0bce756 DS |
8414 | BGP_SOFT_STR |
8415 | BGP_SOFT_IN_STR) | |
718e3744 | 8416 | |
01080f7c | 8417 | ALIAS (clear_bgp_peer_group_soft_in, |
8418 | clear_bgp_instance_ipv6_peer_group_soft_in_cmd, | |
8419 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft in", | |
8420 | CLEAR_STR | |
8421 | BGP_STR | |
8422 | BGP_INSTANCE_HELP_STR | |
8423 | "Address family\n" | |
8424 | "Clear all members of peer-group\n" | |
8425 | "BGP peer-group name\n" | |
8426 | BGP_SOFT_STR | |
8427 | BGP_SOFT_IN_STR) | |
8428 | ||
718e3744 | 8429 | ALIAS (clear_bgp_peer_group_soft_in, |
8430 | clear_bgp_peer_group_in_cmd, | |
8431 | "clear bgp peer-group WORD in", | |
8432 | CLEAR_STR | |
8433 | BGP_STR | |
8434 | "Clear all members of peer-group\n" | |
8435 | "BGP peer-group name\n" | |
e0bce756 | 8436 | BGP_SOFT_IN_STR) |
718e3744 | 8437 | |
01080f7c | 8438 | ALIAS (clear_bgp_peer_group_soft_in, |
8439 | clear_bgp_instance_peer_group_in_cmd, | |
8440 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD in", | |
8441 | CLEAR_STR | |
8442 | BGP_STR | |
8443 | BGP_INSTANCE_HELP_STR | |
8444 | "Clear all members of peer-group\n" | |
8445 | "BGP peer-group name\n" | |
8446 | BGP_SOFT_IN_STR) | |
8447 | ||
718e3744 | 8448 | ALIAS (clear_bgp_peer_group_soft_in, |
8449 | clear_bgp_ipv6_peer_group_in_cmd, | |
8450 | "clear bgp ipv6 peer-group WORD in", | |
8451 | CLEAR_STR | |
8452 | BGP_STR | |
8453 | "Address family\n" | |
8454 | "Clear all members of peer-group\n" | |
8455 | "BGP peer-group name\n" | |
e0bce756 | 8456 | BGP_SOFT_IN_STR) |
718e3744 | 8457 | |
01080f7c | 8458 | ALIAS (clear_bgp_peer_group_soft_in, |
8459 | clear_bgp_instance_ipv6_peer_group_in_cmd, | |
8460 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD in", | |
8461 | CLEAR_STR | |
8462 | BGP_STR | |
8463 | BGP_INSTANCE_HELP_STR | |
8464 | "Address family\n" | |
8465 | "Clear all members of peer-group\n" | |
8466 | "BGP peer-group name\n" | |
8467 | BGP_SOFT_IN_STR) | |
8468 | ||
718e3744 | 8469 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
8470 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
8471 | "clear bgp peer-group WORD in prefix-filter", | |
8472 | CLEAR_STR | |
8473 | BGP_STR | |
8474 | "Clear all members of peer-group\n" | |
8475 | "BGP peer-group name\n" | |
e0bce756 | 8476 | BGP_SOFT_IN_STR |
718e3744 | 8477 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8478 | { | |
8479 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
8480 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8481 | } | |
8482 | ||
8483 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
8484 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
8485 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
8486 | CLEAR_STR | |
8487 | BGP_STR | |
8488 | "Address family\n" | |
8489 | "Clear all members of peer-group\n" | |
8490 | "BGP peer-group name\n" | |
e0bce756 | 8491 | BGP_SOFT_IN_STR |
718e3744 | 8492 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8493 | ||
8494 | DEFUN (clear_ip_bgp_external_soft_in, | |
8495 | clear_ip_bgp_external_soft_in_cmd, | |
8496 | "clear ip bgp external soft in", | |
8497 | CLEAR_STR | |
8498 | IP_STR | |
8499 | BGP_STR | |
8500 | "Clear all external peers\n" | |
e0bce756 DS |
8501 | BGP_SOFT_STR |
8502 | BGP_SOFT_IN_STR) | |
718e3744 | 8503 | { |
01080f7c | 8504 | if (argc == 2) |
8505 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
8506 | BGP_CLEAR_SOFT_IN, NULL); | |
8507 | ||
718e3744 | 8508 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
8509 | BGP_CLEAR_SOFT_IN, NULL); | |
8510 | } | |
8511 | ||
01080f7c | 8512 | ALIAS (clear_ip_bgp_external_soft_in, |
8513 | clear_ip_bgp_instance_external_soft_in_cmd, | |
8514 | "clear ip bgp " BGP_INSTANCE_CMD " external soft in", | |
8515 | CLEAR_STR | |
8516 | IP_STR | |
8517 | BGP_STR | |
8518 | BGP_INSTANCE_HELP_STR | |
8519 | "Clear all external peers\n" | |
8520 | BGP_SOFT_STR | |
8521 | BGP_SOFT_IN_STR) | |
8522 | ||
718e3744 | 8523 | ALIAS (clear_ip_bgp_external_soft_in, |
8524 | clear_ip_bgp_external_in_cmd, | |
8525 | "clear ip bgp external in", | |
8526 | CLEAR_STR | |
8527 | IP_STR | |
8528 | BGP_STR | |
8529 | "Clear all external peers\n" | |
e0bce756 | 8530 | BGP_SOFT_IN_STR) |
718e3744 | 8531 | |
01080f7c | 8532 | ALIAS (clear_ip_bgp_external_soft_in, |
8533 | clear_ip_bgp_instance_external_in_cmd, | |
8534 | "clear ip bgp " BGP_INSTANCE_CMD " external in", | |
8535 | CLEAR_STR | |
8536 | IP_STR | |
8537 | BGP_STR | |
8538 | BGP_INSTANCE_HELP_STR | |
8539 | "Clear all external peers\n" | |
8540 | BGP_SOFT_IN_STR) | |
8541 | ||
718e3744 | 8542 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
8543 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
8544 | "clear ip bgp external in prefix-filter", | |
8545 | CLEAR_STR | |
8546 | IP_STR | |
8547 | BGP_STR | |
8548 | "Clear all external peers\n" | |
e0bce756 | 8549 | BGP_SOFT_IN_STR |
718e3744 | 8550 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8551 | { | |
8552 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8553 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8554 | } | |
8555 | ||
8556 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
8557 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
8558 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
8559 | CLEAR_STR | |
8560 | IP_STR | |
8561 | BGP_STR | |
8562 | "Clear all external peers\n" | |
8563 | "Address family\n" | |
8564 | "Address Family modifier\n" | |
8565 | "Address Family modifier\n" | |
e0bce756 DS |
8566 | BGP_SOFT_STR |
8567 | BGP_SOFT_IN_STR) | |
718e3744 | 8568 | { |
8569 | if (strncmp (argv[0], "m", 1) == 0) | |
8570 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
8571 | BGP_CLEAR_SOFT_IN, NULL); | |
8572 | ||
8573 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8574 | BGP_CLEAR_SOFT_IN, NULL); | |
8575 | } | |
8576 | ||
01080f7c | 8577 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, |
8578 | clear_ip_bgp_instance_external_ipv4_soft_in_cmd, | |
8579 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft in", | |
8580 | CLEAR_STR | |
8581 | IP_STR | |
8582 | BGP_STR | |
8583 | BGP_INSTANCE_HELP_STR | |
8584 | "Clear all external peers\n" | |
8585 | "Address family\n" | |
8586 | "Address Family modifier\n" | |
8587 | "Address Family modifier\n" | |
8588 | BGP_SOFT_STR | |
8589 | BGP_SOFT_IN_STR) | |
8590 | { | |
8591 | if (strncmp (argv[2], "m", 1) == 0) | |
8592 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, | |
8593 | BGP_CLEAR_SOFT_IN, NULL); | |
8594 | ||
8595 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
8596 | BGP_CLEAR_SOFT_IN, NULL); | |
8597 | } | |
8598 | ||
718e3744 | 8599 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, |
8600 | clear_ip_bgp_external_ipv4_in_cmd, | |
8601 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
8602 | CLEAR_STR | |
8603 | IP_STR | |
8604 | BGP_STR | |
8605 | "Clear all external peers\n" | |
8606 | "Address family\n" | |
8607 | "Address Family modifier\n" | |
8608 | "Address Family modifier\n" | |
e0bce756 | 8609 | BGP_SOFT_IN_STR) |
718e3744 | 8610 | |
01080f7c | 8611 | ALIAS (clear_ip_bgp_instance_external_ipv4_soft_in, |
8612 | clear_ip_bgp_instance_external_ipv4_in_cmd, | |
8613 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) in", | |
8614 | CLEAR_STR | |
8615 | IP_STR | |
8616 | BGP_STR | |
8617 | BGP_INSTANCE_HELP_STR | |
8618 | "Clear all external peers\n" | |
8619 | "Address family\n" | |
8620 | "Address Family modifier\n" | |
8621 | "Address Family modifier\n" | |
8622 | BGP_SOFT_IN_STR) | |
8623 | ||
718e3744 | 8624 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
8625 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
8626 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
8627 | CLEAR_STR | |
8628 | IP_STR | |
8629 | BGP_STR | |
8630 | "Clear all external peers\n" | |
8631 | "Address family\n" | |
8632 | "Address Family modifier\n" | |
8633 | "Address Family modifier\n" | |
e0bce756 | 8634 | BGP_SOFT_IN_STR |
718e3744 | 8635 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8636 | { | |
8637 | if (strncmp (argv[0], "m", 1) == 0) | |
8638 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
8639 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8640 | ||
8641 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8642 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8643 | } | |
8644 | ||
8645 | DEFUN (clear_bgp_external_soft_in, | |
8646 | clear_bgp_external_soft_in_cmd, | |
8647 | "clear bgp external soft in", | |
8648 | CLEAR_STR | |
8649 | BGP_STR | |
8650 | "Clear all external peers\n" | |
e0bce756 DS |
8651 | BGP_SOFT_STR |
8652 | BGP_SOFT_IN_STR) | |
718e3744 | 8653 | { |
01080f7c | 8654 | if (argc == 2) |
8655 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
8656 | BGP_CLEAR_SOFT_IN, NULL); | |
8657 | ||
718e3744 | 8658 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
8659 | BGP_CLEAR_SOFT_IN, NULL); | |
8660 | } | |
8661 | ||
01080f7c | 8662 | ALIAS (clear_bgp_external_soft_in, |
8663 | clear_bgp_instance_external_soft_in_cmd, | |
8664 | "clear bgp " BGP_INSTANCE_CMD " external soft in", | |
8665 | CLEAR_STR | |
8666 | BGP_STR | |
8667 | BGP_INSTANCE_HELP_STR | |
8668 | "Clear all external peers\n" | |
8669 | BGP_SOFT_STR | |
8670 | BGP_SOFT_IN_STR) | |
8671 | ||
718e3744 | 8672 | ALIAS (clear_bgp_external_soft_in, |
8673 | clear_bgp_ipv6_external_soft_in_cmd, | |
8674 | "clear bgp ipv6 external soft in", | |
8675 | CLEAR_STR | |
8676 | BGP_STR | |
8677 | "Address family\n" | |
8678 | "Clear all external peers\n" | |
e0bce756 DS |
8679 | BGP_SOFT_STR |
8680 | BGP_SOFT_IN_STR) | |
718e3744 | 8681 | |
01080f7c | 8682 | ALIAS (clear_bgp_external_soft_in, |
8683 | clear_bgp_instance_ipv6_external_soft_in_cmd, | |
8684 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft in", | |
8685 | CLEAR_STR | |
8686 | BGP_STR | |
8687 | BGP_INSTANCE_HELP_STR | |
8688 | "Address family\n" | |
8689 | "Clear all external peers\n" | |
8690 | BGP_SOFT_STR | |
8691 | BGP_SOFT_IN_STR) | |
8692 | ||
718e3744 | 8693 | ALIAS (clear_bgp_external_soft_in, |
8694 | clear_bgp_external_in_cmd, | |
8695 | "clear bgp external in", | |
8696 | CLEAR_STR | |
8697 | BGP_STR | |
8698 | "Clear all external peers\n" | |
e0bce756 | 8699 | BGP_SOFT_IN_STR) |
718e3744 | 8700 | |
01080f7c | 8701 | ALIAS (clear_bgp_external_soft_in, |
8702 | clear_bgp_instance_external_in_cmd, | |
8703 | "clear bgp " BGP_INSTANCE_CMD " external in", | |
8704 | CLEAR_STR | |
8705 | BGP_STR | |
8706 | BGP_INSTANCE_HELP_STR | |
8707 | "Clear all external peers\n" | |
8708 | BGP_SOFT_IN_STR) | |
8709 | ||
718e3744 | 8710 | ALIAS (clear_bgp_external_soft_in, |
8711 | clear_bgp_ipv6_external_in_cmd, | |
8712 | "clear bgp ipv6 external WORD in", | |
8713 | CLEAR_STR | |
8714 | BGP_STR | |
8715 | "Address family\n" | |
8716 | "Clear all external peers\n" | |
e0bce756 | 8717 | BGP_SOFT_IN_STR) |
718e3744 | 8718 | |
01080f7c | 8719 | ALIAS (clear_bgp_external_soft_in, |
8720 | clear_bgp_instance_ipv6_external_in_cmd, | |
8721 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD in", | |
8722 | CLEAR_STR | |
8723 | BGP_STR | |
8724 | BGP_INSTANCE_HELP_STR | |
8725 | "Address family\n" | |
8726 | "Clear all external peers\n" | |
8727 | BGP_SOFT_IN_STR) | |
8728 | ||
718e3744 | 8729 | DEFUN (clear_bgp_external_in_prefix_filter, |
8730 | clear_bgp_external_in_prefix_filter_cmd, | |
8731 | "clear bgp external in prefix-filter", | |
8732 | CLEAR_STR | |
8733 | BGP_STR | |
8734 | "Clear all external peers\n" | |
e0bce756 | 8735 | BGP_SOFT_IN_STR |
718e3744 | 8736 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8737 | { | |
8738 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
8739 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8740 | } | |
8741 | ||
8742 | ALIAS (clear_bgp_external_in_prefix_filter, | |
8743 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
8744 | "clear bgp ipv6 external in prefix-filter", | |
8745 | CLEAR_STR | |
8746 | BGP_STR | |
8747 | "Address family\n" | |
8748 | "Clear all external peers\n" | |
e0bce756 | 8749 | BGP_SOFT_IN_STR |
718e3744 | 8750 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8751 | ||
8752 | DEFUN (clear_ip_bgp_as_soft_in, | |
8753 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 8754 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 8755 | CLEAR_STR |
8756 | IP_STR | |
8757 | BGP_STR | |
8758 | "Clear peers with the AS number\n" | |
e0bce756 DS |
8759 | BGP_SOFT_STR |
8760 | BGP_SOFT_IN_STR) | |
718e3744 | 8761 | { |
01080f7c | 8762 | if (argc == 3) |
8763 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
8764 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8765 | ||
718e3744 | 8766 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
8767 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8768 | } | |
8769 | ||
8770 | ALIAS (clear_ip_bgp_as_soft_in, | |
01080f7c | 8771 | clear_ip_bgp_instance_as_soft_in_cmd, |
8772 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", | |
8773 | CLEAR_STR | |
8774 | IP_STR | |
8775 | BGP_STR | |
8776 | BGP_INSTANCE_HELP_STR | |
8777 | "Clear peers with the AS number\n" | |
8778 | BGP_SOFT_STR | |
8779 | BGP_SOFT_IN_STR) | |
8780 | ||
8781 | ALIAS (clear_ip_bgp_as_soft_in, | |
8782 | clear_ip_bgp_as_in_cmd, | |
8783 | "clear ip bgp " CMD_AS_RANGE " in", | |
8784 | CLEAR_STR | |
8785 | IP_STR | |
8786 | BGP_STR | |
8787 | "Clear peers with the AS number\n" | |
8788 | BGP_SOFT_IN_STR) | |
8789 | ||
8790 | ALIAS (clear_ip_bgp_as_soft_in, | |
8791 | clear_ip_bgp_instance_as_in_cmd, | |
8792 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", | |
718e3744 | 8793 | CLEAR_STR |
8794 | IP_STR | |
8795 | BGP_STR | |
01080f7c | 8796 | BGP_INSTANCE_HELP_STR |
718e3744 | 8797 | "Clear peers with the AS number\n" |
e0bce756 | 8798 | BGP_SOFT_IN_STR) |
718e3744 | 8799 | |
8800 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
8801 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 8802 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 8803 | CLEAR_STR |
8804 | IP_STR | |
8805 | BGP_STR | |
8806 | "Clear peers with the AS number\n" | |
e0bce756 | 8807 | BGP_SOFT_IN_STR |
718e3744 | 8808 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8809 | { | |
8810 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
8811 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8812 | } | |
8813 | ||
8814 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
8815 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 8816 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 8817 | CLEAR_STR |
8818 | IP_STR | |
8819 | BGP_STR | |
8820 | "Clear peers with the AS number\n" | |
8821 | "Address family\n" | |
8822 | "Address Family modifier\n" | |
8823 | "Address Family modifier\n" | |
e0bce756 DS |
8824 | BGP_SOFT_STR |
8825 | BGP_SOFT_IN_STR) | |
718e3744 | 8826 | { |
8827 | if (strncmp (argv[1], "m", 1) == 0) | |
8828 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
8829 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8830 | ||
8831 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
8832 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8833 | } | |
8834 | ||
01080f7c | 8835 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, |
8836 | clear_ip_bgp_instance_as_ipv4_soft_in_cmd, | |
8837 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", | |
8838 | CLEAR_STR | |
8839 | IP_STR | |
8840 | BGP_STR | |
8841 | BGP_INSTANCE_HELP_STR | |
8842 | "Clear peers with the AS number\n" | |
8843 | "Address family\n" | |
8844 | "Address Family modifier\n" | |
8845 | "Address Family modifier\n" | |
8846 | BGP_SOFT_STR | |
8847 | BGP_SOFT_IN_STR) | |
8848 | { | |
8849 | if (strncmp (argv[3], "m", 1) == 0) | |
8850 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, | |
8851 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8852 | ||
8853 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
8854 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8855 | } | |
8856 | ||
718e3744 | 8857 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, |
8858 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 8859 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 8860 | CLEAR_STR |
8861 | IP_STR | |
8862 | BGP_STR | |
8863 | "Clear peers with the AS number\n" | |
8864 | "Address family\n" | |
8865 | "Address Family modifier\n" | |
8866 | "Address Family modifier\n" | |
e0bce756 | 8867 | BGP_SOFT_IN_STR) |
718e3744 | 8868 | |
01080f7c | 8869 | ALIAS (clear_ip_bgp_instance_as_ipv4_soft_in, |
8870 | clear_ip_bgp_instance_as_ipv4_in_cmd, | |
8871 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) in", | |
8872 | CLEAR_STR | |
8873 | IP_STR | |
8874 | BGP_STR | |
8875 | BGP_INSTANCE_HELP_STR | |
8876 | "Clear peers with the AS number\n" | |
8877 | "Address family\n" | |
8878 | "Address Family modifier\n" | |
8879 | "Address Family modifier\n" | |
8880 | BGP_SOFT_IN_STR) | |
8881 | ||
718e3744 | 8882 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
8883 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 8884 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 8885 | CLEAR_STR |
8886 | IP_STR | |
8887 | BGP_STR | |
8888 | "Clear peers with the AS number\n" | |
8889 | "Address family\n" | |
8890 | "Address Family modifier\n" | |
8891 | "Address Family modifier\n" | |
e0bce756 | 8892 | BGP_SOFT_IN_STR |
718e3744 | 8893 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8894 | { | |
8895 | if (strncmp (argv[1], "m", 1) == 0) | |
8896 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
8897 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8898 | ||
8899 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
8900 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
8901 | } | |
8902 | ||
8903 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
8904 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 8905 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 8906 | CLEAR_STR |
8907 | IP_STR | |
8908 | BGP_STR | |
8909 | "Clear peers with the AS number\n" | |
8910 | "Address family\n" | |
8911 | "Address Family modifier\n" | |
e0bce756 DS |
8912 | BGP_SOFT_STR |
8913 | BGP_SOFT_IN_STR) | |
718e3744 | 8914 | { |
8915 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
8916 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8917 | } | |
8918 | ||
8919 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
8920 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 8921 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 8922 | CLEAR_STR |
8923 | IP_STR | |
8924 | BGP_STR | |
8925 | "Clear peers with the AS number\n" | |
8926 | "Address family\n" | |
8927 | "Address Family modifier\n" | |
e0bce756 | 8928 | BGP_SOFT_IN_STR) |
718e3744 | 8929 | |
587ff0fd LB |
8930 | DEFUN (clear_ip_bgp_as_encap_soft_in, |
8931 | clear_ip_bgp_as_encap_soft_in_cmd, | |
8932 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft in", | |
8933 | CLEAR_STR | |
8934 | IP_STR | |
8935 | BGP_STR | |
8936 | "Clear peers with the AS number\n" | |
8937 | "Address family\n" | |
8938 | "Address Family modifier\n" | |
8939 | "Soft reconfig\n" | |
8940 | "Soft reconfig inbound update\n") | |
8941 | { | |
8942 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
8943 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8944 | } | |
8945 | ||
8946 | ALIAS (clear_ip_bgp_as_encap_soft_in, | |
8947 | clear_ip_bgp_as_encap_in_cmd, | |
8948 | "clear ip bgp " CMD_AS_RANGE " encap unicast in", | |
8949 | CLEAR_STR | |
8950 | IP_STR | |
8951 | BGP_STR | |
8952 | "Clear peers with the AS number\n" | |
8953 | "Address family\n" | |
8954 | "Address Family modifier\n" | |
8955 | "Soft reconfig inbound update\n") | |
8956 | ||
718e3744 | 8957 | DEFUN (clear_bgp_as_soft_in, |
8958 | clear_bgp_as_soft_in_cmd, | |
320da874 | 8959 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 8960 | CLEAR_STR |
8961 | BGP_STR | |
8962 | "Clear peers with the AS number\n" | |
e0bce756 DS |
8963 | BGP_SOFT_STR |
8964 | BGP_SOFT_IN_STR) | |
718e3744 | 8965 | { |
01080f7c | 8966 | if (argc == 3) |
8967 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
8968 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8969 | ||
718e3744 | 8970 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
8971 | BGP_CLEAR_SOFT_IN, argv[0]); | |
8972 | } | |
8973 | ||
01080f7c | 8974 | ALIAS (clear_bgp_as_soft_in, |
8975 | clear_bgp_instance_as_soft_in_cmd, | |
8976 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", | |
8977 | CLEAR_STR | |
8978 | BGP_STR | |
8979 | BGP_INSTANCE_HELP_STR | |
8980 | "Clear peers with the AS number\n" | |
8981 | BGP_SOFT_STR | |
8982 | BGP_SOFT_IN_STR) | |
8983 | ||
718e3744 | 8984 | ALIAS (clear_bgp_as_soft_in, |
8985 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 8986 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 8987 | CLEAR_STR |
8988 | BGP_STR | |
8989 | "Address family\n" | |
8990 | "Clear peers with the AS number\n" | |
e0bce756 DS |
8991 | BGP_SOFT_STR |
8992 | BGP_SOFT_IN_STR) | |
718e3744 | 8993 | |
01080f7c | 8994 | ALIAS (clear_bgp_as_soft_in, |
8995 | clear_bgp_instance_ipv6_as_soft_in_cmd, | |
8996 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft in", | |
8997 | CLEAR_STR | |
8998 | BGP_STR | |
8999 | BGP_INSTANCE_HELP_STR | |
9000 | "Address family\n" | |
9001 | "Clear peers with the AS number\n" | |
9002 | BGP_SOFT_STR | |
9003 | BGP_SOFT_IN_STR) | |
9004 | ||
718e3744 | 9005 | ALIAS (clear_bgp_as_soft_in, |
9006 | clear_bgp_as_in_cmd, | |
320da874 | 9007 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 9008 | CLEAR_STR |
9009 | BGP_STR | |
9010 | "Clear peers with the AS number\n" | |
e0bce756 | 9011 | BGP_SOFT_IN_STR) |
718e3744 | 9012 | |
01080f7c | 9013 | ALIAS (clear_bgp_as_soft_in, |
9014 | clear_bgp_instance_as_in_cmd, | |
9015 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", | |
9016 | CLEAR_STR | |
9017 | BGP_STR | |
9018 | BGP_INSTANCE_HELP_STR | |
9019 | "Clear peers with the AS number\n" | |
9020 | BGP_SOFT_IN_STR) | |
9021 | ||
718e3744 | 9022 | ALIAS (clear_bgp_as_soft_in, |
9023 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 9024 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 9025 | CLEAR_STR |
9026 | BGP_STR | |
9027 | "Address family\n" | |
9028 | "Clear peers with the AS number\n" | |
e0bce756 | 9029 | BGP_SOFT_IN_STR) |
718e3744 | 9030 | |
01080f7c | 9031 | ALIAS (clear_bgp_as_soft_in, |
9032 | clear_bgp_instance_ipv6_as_in_cmd, | |
9033 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " in", | |
9034 | CLEAR_STR | |
9035 | BGP_STR | |
9036 | BGP_INSTANCE_HELP_STR | |
9037 | "Address family\n" | |
9038 | "Clear peers with the AS number\n" | |
9039 | BGP_SOFT_IN_STR) | |
9040 | ||
718e3744 | 9041 | DEFUN (clear_bgp_as_in_prefix_filter, |
9042 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 9043 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 9044 | CLEAR_STR |
9045 | BGP_STR | |
9046 | "Clear peers with the AS number\n" | |
e0bce756 | 9047 | BGP_SOFT_IN_STR |
718e3744 | 9048 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
9049 | { | |
9050 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
9051 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
9052 | } | |
9053 | ||
9054 | ALIAS (clear_bgp_as_in_prefix_filter, | |
9055 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 9056 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 9057 | CLEAR_STR |
9058 | BGP_STR | |
9059 | "Address family\n" | |
9060 | "Clear peers with the AS number\n" | |
e0bce756 | 9061 | BGP_SOFT_IN_STR |
718e3744 | 9062 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6b0655a2 | 9063 | |
718e3744 | 9064 | /* Both soft-reconfiguration */ |
9065 | DEFUN (clear_ip_bgp_all_soft, | |
9066 | clear_ip_bgp_all_soft_cmd, | |
9067 | "clear ip bgp * soft", | |
9068 | CLEAR_STR | |
9069 | IP_STR | |
9070 | BGP_STR | |
9071 | "Clear all peers\n" | |
e0bce756 | 9072 | BGP_SOFT_STR) |
718e3744 | 9073 | { |
6aeb9e78 DS |
9074 | if (argc == 2) |
9075 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 9076 | BGP_CLEAR_SOFT_BOTH, NULL); |
9077 | ||
9078 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9079 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9080 | } | |
9081 | ||
9082 | ALIAS (clear_ip_bgp_all_soft, | |
9083 | clear_ip_bgp_instance_all_soft_cmd, | |
8386ac43 | 9084 | "clear ip bgp " BGP_INSTANCE_CMD " * soft", |
718e3744 | 9085 | CLEAR_STR |
9086 | IP_STR | |
9087 | BGP_STR | |
8386ac43 | 9088 | BGP_INSTANCE_HELP_STR |
718e3744 | 9089 | "Clear all peers\n" |
e0bce756 | 9090 | BGP_SOFT_STR) |
718e3744 | 9091 | |
9092 | ||
9093 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
9094 | clear_ip_bgp_all_ipv4_soft_cmd, | |
9095 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
9096 | CLEAR_STR | |
9097 | IP_STR | |
9098 | BGP_STR | |
9099 | "Clear all peers\n" | |
9100 | "Address family\n" | |
9101 | "Address Family Modifier\n" | |
9102 | "Address Family Modifier\n" | |
e0bce756 | 9103 | BGP_SOFT_STR) |
718e3744 | 9104 | { |
9105 | if (strncmp (argv[0], "m", 1) == 0) | |
9106 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
9107 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9108 | ||
9109 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9110 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9111 | } | |
9112 | ||
9113 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
9114 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
8386ac43 | 9115 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft", |
718e3744 | 9116 | CLEAR_STR |
9117 | IP_STR | |
9118 | BGP_STR | |
8386ac43 | 9119 | BGP_INSTANCE_HELP_STR |
718e3744 | 9120 | "Clear all peers\n" |
9121 | "Address family\n" | |
9122 | "Address Family Modifier\n" | |
9123 | "Address Family Modifier\n" | |
e0bce756 | 9124 | BGP_SOFT_STR) |
718e3744 | 9125 | { |
6aeb9e78 DS |
9126 | if (strncmp (argv[2], "m", 1) == 0) |
9127 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_all, | |
718e3744 | 9128 | BGP_CLEAR_SOFT_BOTH, NULL); |
9129 | ||
9130 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9131 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9132 | } | |
9133 | ||
9134 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
9135 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
9136 | "clear ip bgp * vpnv4 unicast soft", | |
9137 | CLEAR_STR | |
9138 | IP_STR | |
9139 | BGP_STR | |
9140 | "Clear all peers\n" | |
9141 | "Address family\n" | |
9142 | "Address Family Modifier\n" | |
e0bce756 | 9143 | BGP_SOFT_STR) |
718e3744 | 9144 | { |
9145 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
9146 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9147 | } | |
9148 | ||
587ff0fd LB |
9149 | DEFUN (clear_ip_bgp_all_encap_soft, |
9150 | clear_ip_bgp_all_encap_soft_cmd, | |
9151 | "clear ip bgp * encap unicast soft", | |
9152 | CLEAR_STR | |
9153 | IP_STR | |
9154 | BGP_STR | |
9155 | "Clear all peers\n" | |
9156 | "Address family\n" | |
9157 | "Address Family Modifier\n" | |
9158 | "Soft reconfig\n") | |
9159 | { | |
9160 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
9161 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9162 | } | |
9163 | ||
718e3744 | 9164 | DEFUN (clear_bgp_all_soft, |
9165 | clear_bgp_all_soft_cmd, | |
9166 | "clear bgp * soft", | |
9167 | CLEAR_STR | |
9168 | BGP_STR | |
9169 | "Clear all peers\n" | |
e0bce756 | 9170 | BGP_SOFT_STR) |
718e3744 | 9171 | { |
6aeb9e78 DS |
9172 | if (argc == 2) |
9173 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
01080f7c | 9174 | BGP_CLEAR_SOFT_BOTH, NULL); |
718e3744 | 9175 | |
9176 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
01080f7c | 9177 | BGP_CLEAR_SOFT_BOTH, NULL); |
718e3744 | 9178 | } |
9179 | ||
9180 | ALIAS (clear_bgp_all_soft, | |
9181 | clear_bgp_instance_all_soft_cmd, | |
8386ac43 | 9182 | "clear bgp " BGP_INSTANCE_CMD " * soft", |
718e3744 | 9183 | CLEAR_STR |
9184 | BGP_STR | |
8386ac43 | 9185 | BGP_INSTANCE_HELP_STR |
718e3744 | 9186 | "Clear all peers\n" |
e0bce756 | 9187 | BGP_SOFT_STR) |
718e3744 | 9188 | |
9189 | ALIAS (clear_bgp_all_soft, | |
9190 | clear_bgp_ipv6_all_soft_cmd, | |
9191 | "clear bgp ipv6 * soft", | |
9192 | CLEAR_STR | |
9193 | BGP_STR | |
9194 | "Address family\n" | |
9195 | "Clear all peers\n" | |
e0bce756 | 9196 | BGP_SOFT_STR) |
718e3744 | 9197 | |
01080f7c | 9198 | ALIAS (clear_bgp_all_soft, |
9199 | clear_bgp_instance_ipv6_all_soft_cmd, | |
9200 | "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft", | |
9201 | CLEAR_STR | |
9202 | BGP_STR | |
9203 | BGP_INSTANCE_HELP_STR | |
9204 | "Address family\n" | |
9205 | "Clear all peers\n" | |
9206 | BGP_SOFT_STR) | |
9207 | ||
718e3744 | 9208 | DEFUN (clear_ip_bgp_peer_soft, |
9209 | clear_ip_bgp_peer_soft_cmd, | |
db64ea86 | 9210 | "clear ip bgp (A.B.C.D|WORD) soft", |
718e3744 | 9211 | CLEAR_STR |
9212 | IP_STR | |
9213 | BGP_STR | |
9214 | "BGP neighbor address to clear\n" | |
db64ea86 | 9215 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9216 | BGP_SOFT_STR) |
718e3744 | 9217 | { |
01080f7c | 9218 | if (argc == 3) |
9219 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
9220 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9221 | ||
718e3744 | 9222 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
9223 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9224 | } | |
9225 | ||
01080f7c | 9226 | ALIAS (clear_ip_bgp_peer_soft, |
9227 | clear_ip_bgp_instance_peer_soft_cmd, | |
9228 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft", | |
9229 | CLEAR_STR | |
9230 | IP_STR | |
9231 | BGP_STR | |
9232 | BGP_INSTANCE_HELP_STR | |
9233 | "BGP neighbor address to clear\n" | |
9234 | "BGP neighbor on interface to clear\n" | |
9235 | BGP_SOFT_STR) | |
9236 | ||
718e3744 | 9237 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
9238 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
db64ea86 | 9239 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", |
718e3744 | 9240 | CLEAR_STR |
9241 | IP_STR | |
9242 | BGP_STR | |
9243 | "BGP neighbor address to clear\n" | |
db64ea86 | 9244 | "BGP neighbor on interface to clear\n" |
718e3744 | 9245 | "Address family\n" |
9246 | "Address Family Modifier\n" | |
9247 | "Address Family Modifier\n" | |
e0bce756 | 9248 | BGP_SOFT_STR) |
718e3744 | 9249 | { |
9250 | if (strncmp (argv[1], "m", 1) == 0) | |
9251 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
9252 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9253 | ||
9254 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
9255 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9256 | } | |
9257 | ||
01080f7c | 9258 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, |
9259 | clear_ip_bgp_instance_peer_ipv4_soft_cmd, | |
9260 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", | |
9261 | CLEAR_STR | |
9262 | IP_STR | |
9263 | BGP_STR | |
9264 | BGP_INSTANCE_HELP_STR | |
9265 | "BGP neighbor address to clear\n" | |
9266 | "BGP neighbor on interface to clear\n" | |
9267 | "Address family\n" | |
9268 | "Address Family Modifier\n" | |
9269 | "Address Family Modifier\n" | |
9270 | BGP_SOFT_STR) | |
9271 | { | |
9272 | if (strncmp (argv[3], "m", 1) == 0) | |
9273 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_peer, | |
9274 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9275 | ||
9276 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
9277 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9278 | } | |
9279 | ||
718e3744 | 9280 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
9281 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
db64ea86 | 9282 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft", |
718e3744 | 9283 | CLEAR_STR |
9284 | IP_STR | |
9285 | BGP_STR | |
9286 | "BGP neighbor address to clear\n" | |
db64ea86 | 9287 | "BGP neighbor on interface to clear\n" |
718e3744 | 9288 | "Address family\n" |
9289 | "Address Family Modifier\n" | |
e0bce756 | 9290 | BGP_SOFT_STR) |
718e3744 | 9291 | { |
9292 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
9293 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9294 | } | |
9295 | ||
587ff0fd LB |
9296 | DEFUN (clear_ip_bgp_peer_encap_soft, |
9297 | clear_ip_bgp_peer_encap_soft_cmd, | |
9298 | "clear ip bgp A.B.C.D encap unicast soft", | |
9299 | CLEAR_STR | |
9300 | IP_STR | |
9301 | BGP_STR | |
9302 | "BGP neighbor address to clear\n" | |
9303 | "Address family\n" | |
9304 | "Address Family Modifier\n" | |
9305 | "Soft reconfig\n") | |
9306 | { | |
9307 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
9308 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9309 | } | |
9310 | ||
718e3744 | 9311 | DEFUN (clear_bgp_peer_soft, |
9312 | clear_bgp_peer_soft_cmd, | |
a80beece | 9313 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 9314 | CLEAR_STR |
9315 | BGP_STR | |
9316 | "BGP neighbor address to clear\n" | |
9317 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 9318 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9319 | BGP_SOFT_STR) |
718e3744 | 9320 | { |
01080f7c | 9321 | if (argc == 3) |
9322 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
9323 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9324 | ||
718e3744 | 9325 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
9326 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9327 | } | |
9328 | ||
01080f7c | 9329 | ALIAS (clear_bgp_peer_soft, |
9330 | clear_bgp_instance_peer_soft_cmd, | |
9331 | "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft", | |
9332 | CLEAR_STR | |
9333 | BGP_STR | |
9334 | BGP_INSTANCE_HELP_STR | |
9335 | "BGP neighbor address to clear\n" | |
9336 | "BGP IPv6 neighbor to clear\n" | |
9337 | "BGP neighbor on interface to clear\n" | |
9338 | BGP_SOFT_STR) | |
9339 | ||
718e3744 | 9340 | ALIAS (clear_bgp_peer_soft, |
9341 | clear_bgp_ipv6_peer_soft_cmd, | |
a80beece | 9342 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 9343 | CLEAR_STR |
9344 | BGP_STR | |
9345 | "Address family\n" | |
9346 | "BGP neighbor address to clear\n" | |
9347 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 9348 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9349 | BGP_SOFT_STR) |
718e3744 | 9350 | |
01080f7c | 9351 | ALIAS (clear_bgp_peer_soft, |
9352 | clear_bgp_instance_ipv6_peer_soft_cmd, | |
9353 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft", | |
9354 | CLEAR_STR | |
9355 | BGP_STR | |
9356 | BGP_INSTANCE_HELP_STR | |
9357 | "Address family\n" | |
9358 | "BGP neighbor address to clear\n" | |
9359 | "BGP IPv6 neighbor to clear\n" | |
9360 | "BGP neighbor on interface to clear\n" | |
9361 | BGP_SOFT_STR) | |
9362 | ||
718e3744 | 9363 | DEFUN (clear_ip_bgp_peer_group_soft, |
9364 | clear_ip_bgp_peer_group_soft_cmd, | |
9365 | "clear ip bgp peer-group WORD soft", | |
9366 | CLEAR_STR | |
9367 | IP_STR | |
9368 | BGP_STR | |
9369 | "Clear all members of peer-group\n" | |
9370 | "BGP peer-group name\n" | |
e0bce756 | 9371 | BGP_SOFT_STR) |
718e3744 | 9372 | { |
01080f7c | 9373 | if (argc == 3) |
9374 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
9375 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9376 | ||
718e3744 | 9377 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
9378 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9379 | } | |
9380 | ||
01080f7c | 9381 | ALIAS (clear_ip_bgp_peer_group_soft, |
9382 | clear_ip_bgp_instance_peer_group_soft_cmd, | |
9383 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft", | |
9384 | CLEAR_STR | |
9385 | IP_STR | |
9386 | BGP_STR | |
9387 | BGP_INSTANCE_HELP_STR | |
9388 | "Clear all members of peer-group\n" | |
9389 | "BGP peer-group name\n" | |
9390 | BGP_SOFT_STR) | |
9391 | ||
718e3744 | 9392 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
9393 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
9394 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
9395 | CLEAR_STR | |
9396 | IP_STR | |
9397 | BGP_STR | |
9398 | "Clear all members of peer-group\n" | |
9399 | "BGP peer-group name\n" | |
9400 | "Address family\n" | |
9401 | "Address Family modifier\n" | |
9402 | "Address Family modifier\n" | |
e0bce756 | 9403 | BGP_SOFT_STR) |
718e3744 | 9404 | { |
9405 | if (strncmp (argv[1], "m", 1) == 0) | |
9406 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
9407 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9408 | ||
9409 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
9410 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9411 | } | |
9412 | ||
01080f7c | 9413 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, |
9414 | clear_ip_bgp_instance_peer_group_ipv4_soft_cmd, | |
9415 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft", | |
9416 | CLEAR_STR | |
9417 | IP_STR | |
9418 | BGP_STR | |
9419 | BGP_INSTANCE_HELP_STR | |
9420 | "Clear all members of peer-group\n" | |
9421 | "BGP peer-group name\n" | |
9422 | "Address family\n" | |
9423 | "Address Family modifier\n" | |
9424 | "Address Family modifier\n" | |
9425 | BGP_SOFT_STR) | |
9426 | { | |
9427 | if (strncmp (argv[3], "m", 1) == 0) | |
9428 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_group, | |
9429 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9430 | ||
9431 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
9432 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9433 | } | |
9434 | ||
718e3744 | 9435 | DEFUN (clear_bgp_peer_group_soft, |
9436 | clear_bgp_peer_group_soft_cmd, | |
9437 | "clear bgp peer-group WORD soft", | |
9438 | CLEAR_STR | |
9439 | BGP_STR | |
9440 | "Clear all members of peer-group\n" | |
9441 | "BGP peer-group name\n" | |
e0bce756 | 9442 | BGP_SOFT_STR) |
718e3744 | 9443 | { |
01080f7c | 9444 | if (argc == 3) |
9445 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
9446 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9447 | ||
718e3744 | 9448 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
9449 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9450 | } | |
9451 | ||
01080f7c | 9452 | ALIAS (clear_bgp_peer_group_soft, |
9453 | clear_bgp_instance_peer_group_soft_cmd, | |
9454 | "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft", | |
9455 | CLEAR_STR | |
9456 | BGP_STR | |
9457 | BGP_INSTANCE_HELP_STR | |
9458 | "Clear all members of peer-group\n" | |
9459 | "BGP peer-group name\n" | |
9460 | BGP_SOFT_STR) | |
9461 | ||
718e3744 | 9462 | ALIAS (clear_bgp_peer_group_soft, |
9463 | clear_bgp_ipv6_peer_group_soft_cmd, | |
9464 | "clear bgp ipv6 peer-group WORD soft", | |
9465 | CLEAR_STR | |
9466 | BGP_STR | |
9467 | "Address family\n" | |
9468 | "Clear all members of peer-group\n" | |
9469 | "BGP peer-group name\n" | |
e0bce756 | 9470 | BGP_SOFT_STR) |
718e3744 | 9471 | |
01080f7c | 9472 | ALIAS (clear_bgp_peer_group_soft, |
9473 | clear_bgp_instance_ipv6_peer_group_soft_cmd, | |
9474 | "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft", | |
9475 | CLEAR_STR | |
9476 | BGP_STR | |
9477 | BGP_INSTANCE_HELP_STR | |
9478 | "Address family\n" | |
9479 | "Clear all members of peer-group\n" | |
9480 | "BGP peer-group name\n" | |
9481 | BGP_SOFT_STR) | |
9482 | ||
718e3744 | 9483 | DEFUN (clear_ip_bgp_external_soft, |
9484 | clear_ip_bgp_external_soft_cmd, | |
9485 | "clear ip bgp external soft", | |
9486 | CLEAR_STR | |
9487 | IP_STR | |
9488 | BGP_STR | |
9489 | "Clear all external peers\n" | |
e0bce756 | 9490 | BGP_SOFT_STR) |
718e3744 | 9491 | { |
01080f7c | 9492 | if (argc == 2) |
9493 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
9494 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9495 | ||
718e3744 | 9496 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
9497 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9498 | } | |
9499 | ||
01080f7c | 9500 | ALIAS (clear_ip_bgp_external_soft, |
9501 | clear_ip_bgp_instance_external_soft_cmd, | |
9502 | "clear ip bgp " BGP_INSTANCE_CMD " external soft", | |
9503 | CLEAR_STR | |
9504 | IP_STR | |
9505 | BGP_STR | |
9506 | BGP_INSTANCE_HELP_STR | |
9507 | "Clear all external peers\n" | |
9508 | BGP_SOFT_STR) | |
9509 | ||
718e3744 | 9510 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
9511 | clear_ip_bgp_external_ipv4_soft_cmd, | |
9512 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
9513 | CLEAR_STR | |
9514 | IP_STR | |
9515 | BGP_STR | |
9516 | "Clear all external peers\n" | |
9517 | "Address family\n" | |
9518 | "Address Family modifier\n" | |
9519 | "Address Family modifier\n" | |
e0bce756 | 9520 | BGP_SOFT_STR) |
718e3744 | 9521 | { |
9522 | if (strncmp (argv[0], "m", 1) == 0) | |
9523 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
9524 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9525 | ||
9526 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
9527 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9528 | } | |
9529 | ||
01080f7c | 9530 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft, |
9531 | clear_ip_bgp_instance_external_ipv4_soft_cmd, | |
9532 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft", | |
9533 | CLEAR_STR | |
9534 | IP_STR | |
9535 | BGP_STR | |
9536 | BGP_INSTANCE_HELP_STR | |
9537 | "Clear all external peers\n" | |
9538 | "Address family\n" | |
9539 | "Address Family modifier\n" | |
9540 | "Address Family modifier\n" | |
9541 | BGP_SOFT_STR) | |
9542 | { | |
9543 | if (strncmp (argv[2], "m", 1) == 0) | |
9544 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_external, | |
9545 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9546 | ||
9547 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
9548 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9549 | } | |
9550 | ||
718e3744 | 9551 | DEFUN (clear_bgp_external_soft, |
9552 | clear_bgp_external_soft_cmd, | |
9553 | "clear bgp external soft", | |
9554 | CLEAR_STR | |
9555 | BGP_STR | |
9556 | "Clear all external peers\n" | |
e0bce756 | 9557 | BGP_SOFT_STR) |
718e3744 | 9558 | { |
01080f7c | 9559 | if (argc == 2) |
9560 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
9561 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9562 | ||
718e3744 | 9563 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
9564 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9565 | } | |
9566 | ||
01080f7c | 9567 | ALIAS (clear_bgp_external_soft, |
9568 | clear_bgp_instance_external_soft_cmd, | |
9569 | "clear bgp " BGP_INSTANCE_CMD " external soft", | |
9570 | CLEAR_STR | |
9571 | BGP_STR | |
9572 | BGP_INSTANCE_HELP_STR | |
9573 | "Clear all external peers\n" | |
9574 | BGP_SOFT_STR) | |
9575 | ||
718e3744 | 9576 | ALIAS (clear_bgp_external_soft, |
9577 | clear_bgp_ipv6_external_soft_cmd, | |
9578 | "clear bgp ipv6 external soft", | |
9579 | CLEAR_STR | |
9580 | BGP_STR | |
9581 | "Address family\n" | |
9582 | "Clear all external peers\n" | |
e0bce756 | 9583 | BGP_SOFT_STR) |
718e3744 | 9584 | |
01080f7c | 9585 | ALIAS (clear_bgp_external_soft, |
9586 | clear_bgp_instance_ipv6_external_soft_cmd, | |
9587 | "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft", | |
9588 | CLEAR_STR | |
9589 | BGP_STR | |
9590 | BGP_INSTANCE_HELP_STR | |
9591 | "Address family\n" | |
9592 | "Clear all external peers\n" | |
9593 | BGP_SOFT_STR) | |
9594 | ||
718e3744 | 9595 | DEFUN (clear_ip_bgp_as_soft, |
9596 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 9597 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 9598 | CLEAR_STR |
9599 | IP_STR | |
9600 | BGP_STR | |
9601 | "Clear peers with the AS number\n" | |
e0bce756 | 9602 | BGP_SOFT_STR) |
718e3744 | 9603 | { |
01080f7c | 9604 | if (argc == 3) |
9605 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
9606 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9607 | ||
718e3744 | 9608 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
9609 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9610 | } | |
9611 | ||
01080f7c | 9612 | ALIAS (clear_ip_bgp_as_soft, |
9613 | clear_ip_bgp_instance_as_soft_cmd, | |
9614 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", | |
9615 | CLEAR_STR | |
9616 | IP_STR | |
9617 | BGP_STR | |
9618 | BGP_INSTANCE_HELP_STR | |
9619 | "Clear peers with the AS number\n" | |
9620 | BGP_SOFT_STR) | |
9621 | ||
718e3744 | 9622 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
9623 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 9624 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 9625 | CLEAR_STR |
9626 | IP_STR | |
9627 | BGP_STR | |
9628 | "Clear peers with the AS number\n" | |
9629 | "Address family\n" | |
9630 | "Address Family Modifier\n" | |
9631 | "Address Family Modifier\n" | |
e0bce756 | 9632 | BGP_SOFT_STR) |
718e3744 | 9633 | { |
9634 | if (strncmp (argv[1], "m", 1) == 0) | |
9635 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
9636 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9637 | ||
9638 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
9639 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9640 | } | |
9641 | ||
01080f7c | 9642 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft, |
9643 | clear_ip_bgp_instance_as_ipv4_soft_cmd, | |
9644 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", | |
9645 | CLEAR_STR | |
9646 | IP_STR | |
9647 | BGP_STR | |
9648 | BGP_INSTANCE_HELP_STR | |
9649 | "Clear peers with the AS number\n" | |
9650 | "Address family\n" | |
9651 | "Address Family Modifier\n" | |
9652 | "Address Family Modifier\n" | |
9653 | BGP_SOFT_STR) | |
9654 | { | |
9655 | if (strncmp (argv[3], "m", 1) == 0) | |
9656 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_MULTICAST, clear_as, | |
9657 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9658 | ||
9659 | return bgp_clear_vty (vty, argv[1],AFI_IP, SAFI_UNICAST, clear_as, | |
9660 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9661 | } | |
9662 | ||
718e3744 | 9663 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
9664 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 9665 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 9666 | CLEAR_STR |
9667 | IP_STR | |
9668 | BGP_STR | |
9669 | "Clear peers with the AS number\n" | |
9670 | "Address family\n" | |
9671 | "Address Family Modifier\n" | |
e0bce756 | 9672 | BGP_SOFT_STR) |
718e3744 | 9673 | { |
9674 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
9675 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9676 | } | |
9677 | ||
587ff0fd LB |
9678 | DEFUN (clear_ip_bgp_as_encap_soft, |
9679 | clear_ip_bgp_as_encap_soft_cmd, | |
9680 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft", | |
9681 | CLEAR_STR | |
9682 | IP_STR | |
9683 | BGP_STR | |
9684 | "Clear peers with the AS number\n" | |
9685 | "Address family\n" | |
9686 | "Address Family Modifier\n" | |
9687 | "Soft reconfig\n") | |
9688 | { | |
9689 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
9690 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9691 | } | |
9692 | ||
718e3744 | 9693 | DEFUN (clear_bgp_as_soft, |
9694 | clear_bgp_as_soft_cmd, | |
320da874 | 9695 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 9696 | CLEAR_STR |
9697 | BGP_STR | |
9698 | "Clear peers with the AS number\n" | |
e0bce756 | 9699 | BGP_SOFT_STR) |
718e3744 | 9700 | { |
01080f7c | 9701 | if (argc == 3) |
9702 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
9703 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9704 | ||
718e3744 | 9705 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
9706 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9707 | } | |
9708 | ||
01080f7c | 9709 | ALIAS (clear_bgp_as_soft, |
9710 | clear_bgp_instance_as_soft_cmd, | |
9711 | "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", | |
9712 | CLEAR_STR | |
9713 | BGP_STR | |
9714 | BGP_INSTANCE_HELP_STR | |
9715 | "Clear peers with the AS number\n" | |
9716 | BGP_SOFT_STR) | |
9717 | ||
718e3744 | 9718 | ALIAS (clear_bgp_as_soft, |
9719 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 9720 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 9721 | CLEAR_STR |
9722 | BGP_STR | |
9723 | "Address family\n" | |
9724 | "Clear peers with the AS number\n" | |
e0bce756 | 9725 | BGP_SOFT_STR) |
6b0655a2 | 9726 | |
01080f7c | 9727 | ALIAS (clear_bgp_as_soft, |
9728 | clear_bgp_instance_ipv6_as_soft_cmd, | |
9729 | "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft", | |
9730 | CLEAR_STR | |
9731 | BGP_STR | |
9732 | BGP_INSTANCE_HELP_STR | |
9733 | "Address family\n" | |
9734 | "Clear peers with the AS number\n" | |
9735 | BGP_SOFT_STR) | |
9736 | ||
e0081f70 ML |
9737 | DEFUN (show_bgp_views, |
9738 | show_bgp_views_cmd, | |
9739 | "show bgp views", | |
9740 | SHOW_STR | |
9741 | BGP_STR | |
9742 | "Show the defined BGP views\n") | |
9743 | { | |
9744 | struct list *inst = bm->bgp; | |
9745 | struct listnode *node; | |
9746 | struct bgp *bgp; | |
9747 | ||
9748 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
9749 | { | |
8386ac43 | 9750 | vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE); |
e0081f70 ML |
9751 | return CMD_WARNING; |
9752 | } | |
9753 | ||
9754 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
9755 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
8386ac43 | 9756 | { |
9757 | /* Skip VRFs. */ | |
9758 | if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) | |
9759 | continue; | |
9760 | vty_out (vty, "\t%s (AS%u)%s", | |
9761 | bgp->name ? bgp->name : "(null)", | |
9762 | bgp->as, VTY_NEWLINE); | |
9763 | } | |
e0081f70 ML |
9764 | |
9765 | return CMD_SUCCESS; | |
9766 | } | |
9767 | ||
8386ac43 | 9768 | DEFUN (show_bgp_vrfs, |
9769 | show_bgp_vrfs_cmd, | |
9770 | "show bgp vrfs {json}", | |
9771 | SHOW_STR | |
9772 | BGP_STR | |
9773 | "Show BGP VRFs\n" | |
9774 | "JavaScript Object Notation\n") | |
9775 | { | |
9776 | struct list *inst = bm->bgp; | |
9777 | struct listnode *node; | |
9778 | struct bgp *bgp; | |
9779 | u_char uj = use_json(argc, argv); | |
9780 | json_object *json = NULL; | |
9781 | json_object *json_vrfs = NULL; | |
9782 | int count = 0; | |
9783 | static char header[] = "Type Id RouterId #PeersCfg #PeersEstb Name"; | |
9784 | ||
9785 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
9786 | { | |
9787 | vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE); | |
9788 | return CMD_WARNING; | |
9789 | } | |
9790 | ||
9791 | if (uj) | |
9792 | { | |
9793 | json = json_object_new_object(); | |
9794 | json_vrfs = json_object_new_object(); | |
9795 | } | |
9796 | ||
9797 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
9798 | { | |
9799 | const char *name, *type; | |
9800 | struct peer *peer; | |
9801 | struct listnode *node, *nnode; | |
9802 | int peers_cfg, peers_estb; | |
9803 | json_object *json_vrf = NULL; | |
5c81a5f3 | 9804 | int vrf_id_ui; |
8386ac43 | 9805 | |
9806 | /* Skip Views. */ | |
9807 | if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) | |
9808 | continue; | |
9809 | ||
9810 | count++; | |
9811 | if (!uj && count == 1) | |
9812 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
9813 | ||
9814 | peers_cfg = peers_estb = 0; | |
9815 | if (uj) | |
9816 | json_vrf = json_object_new_object(); | |
9817 | ||
9818 | ||
9819 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
9820 | { | |
9821 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) | |
9822 | continue; | |
9823 | peers_cfg++; | |
9824 | if (peer->status == Established) | |
9825 | peers_estb++; | |
9826 | } | |
9827 | ||
9828 | if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
9829 | { | |
9830 | name = "Default"; | |
9831 | type = "DFLT"; | |
9832 | } | |
9833 | else | |
9834 | { | |
9835 | name = bgp->name; | |
9836 | type = "VRF"; | |
9837 | } | |
9838 | ||
5c81a5f3 | 9839 | vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id; |
8386ac43 | 9840 | if (uj) |
9841 | { | |
9842 | json_object_string_add(json_vrf, "type", type); | |
5c81a5f3 | 9843 | json_object_int_add(json_vrf, "vrfId", vrf_id_ui); |
8386ac43 | 9844 | json_object_string_add(json_vrf, "routerId", inet_ntoa (bgp->router_id)); |
9845 | json_object_int_add(json_vrf, "numConfiguredPeers", peers_cfg); | |
9846 | json_object_int_add(json_vrf, "numEstablishedPeers", peers_estb); | |
9847 | ||
9848 | json_object_object_add(json_vrfs, name, json_vrf); | |
9849 | } | |
9850 | else | |
5c81a5f3 | 9851 | vty_out (vty, "%4s %-5d %-16s %9u %10u %s%s", |
9852 | type, vrf_id_ui, inet_ntoa (bgp->router_id), | |
8386ac43 | 9853 | peers_cfg, peers_estb, name, |
9854 | VTY_NEWLINE); | |
9855 | } | |
9856 | ||
9857 | if (uj) | |
9858 | { | |
9859 | json_object_object_add(json, "vrfs", json_vrfs); | |
9860 | ||
9861 | json_object_int_add(json, "totalVrfs", count); | |
9862 | ||
9863 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
9864 | json_object_free(json); | |
9865 | } | |
9866 | else | |
9867 | { | |
9868 | if (count) | |
9869 | vty_out (vty, "%sTotal number of VRFs (including default): %d%s", | |
9870 | VTY_NEWLINE, count, VTY_NEWLINE); | |
9871 | } | |
9872 | ||
9873 | return CMD_SUCCESS; | |
9874 | } | |
9875 | ||
4bf6a362 PJ |
9876 | DEFUN (show_bgp_memory, |
9877 | show_bgp_memory_cmd, | |
9878 | "show bgp memory", | |
9879 | SHOW_STR | |
9880 | BGP_STR | |
9881 | "Global BGP memory statistics\n") | |
9882 | { | |
9883 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
9884 | unsigned long count; | |
9885 | ||
9886 | /* RIB related usage stats */ | |
9887 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
9888 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
9889 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9890 | count * sizeof (struct bgp_node)), | |
9891 | VTY_NEWLINE); | |
9892 | ||
9893 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
9894 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
9895 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9896 | count * sizeof (struct bgp_info)), | |
9897 | VTY_NEWLINE); | |
fb982c25 PJ |
9898 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
9899 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
9900 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9901 | count * sizeof (struct bgp_info_extra)), | |
9902 | VTY_NEWLINE); | |
4bf6a362 PJ |
9903 | |
9904 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
9905 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
9906 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9907 | count * sizeof (struct bgp_static)), | |
9908 | VTY_NEWLINE); | |
3f9c7369 DS |
9909 | |
9910 | if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET))) | |
9911 | vty_out (vty, "%ld Packets, using %s of memory%s", count, | |
9912 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9913 | count * sizeof (struct bpacket)), | |
9914 | VTY_NEWLINE); | |
4bf6a362 PJ |
9915 | |
9916 | /* Adj-In/Out */ | |
9917 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
9918 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
9919 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9920 | count * sizeof (struct bgp_adj_in)), | |
9921 | VTY_NEWLINE); | |
9922 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
9923 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
9924 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9925 | count * sizeof (struct bgp_adj_out)), | |
9926 | VTY_NEWLINE); | |
9927 | ||
9928 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
9929 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
9930 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9931 | count * sizeof (struct bgp_nexthop_cache)), | |
9932 | VTY_NEWLINE); | |
9933 | ||
9934 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
9935 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
9936 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9937 | count * sizeof (struct bgp_damp_info)), | |
9938 | VTY_NEWLINE); | |
9939 | ||
9940 | /* Attributes */ | |
9941 | count = attr_count(); | |
9942 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
9943 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9944 | count * sizeof(struct attr)), | |
9945 | VTY_NEWLINE); | |
fb982c25 PJ |
9946 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
9947 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
9948 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9949 | count * sizeof(struct attr_extra)), | |
9950 | VTY_NEWLINE); | |
4bf6a362 PJ |
9951 | |
9952 | if ((count = attr_unknown_count())) | |
9953 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
9954 | ||
9955 | /* AS_PATH attributes */ | |
9956 | count = aspath_count (); | |
9957 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
9958 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9959 | count * sizeof (struct aspath)), | |
9960 | VTY_NEWLINE); | |
9961 | ||
9962 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
9963 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
9964 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9965 | count * sizeof (struct assegment)), | |
9966 | VTY_NEWLINE); | |
9967 | ||
9968 | /* Other attributes */ | |
9969 | if ((count = community_count ())) | |
9970 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
9971 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9972 | count * sizeof (struct community)), | |
9973 | VTY_NEWLINE); | |
9974 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
9975 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
9976 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9977 | count * sizeof (struct ecommunity)), | |
9978 | VTY_NEWLINE); | |
9979 | ||
9980 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
9981 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
9982 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9983 | count * sizeof (struct cluster_list)), | |
9984 | VTY_NEWLINE); | |
9985 | ||
9986 | /* Peer related usage */ | |
9987 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
9988 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
9989 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9990 | count * sizeof (struct peer)), | |
9991 | VTY_NEWLINE); | |
9992 | ||
6e919709 | 9993 | if ((count = mtype_stats_alloc (MTYPE_BGP_PEER_GROUP))) |
4bf6a362 PJ |
9994 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
9995 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
9996 | count * sizeof (struct peer_group)), | |
9997 | VTY_NEWLINE); | |
9998 | ||
9999 | /* Other */ | |
10000 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
10001 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
10002 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10003 | count * sizeof (struct hash)), | |
10004 | VTY_NEWLINE); | |
10005 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
10006 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
10007 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10008 | count * sizeof (struct hash_backet)), | |
10009 | VTY_NEWLINE); | |
10010 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
10011 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
10012 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10013 | count * sizeof (regex_t)), | |
10014 | VTY_NEWLINE); | |
10015 | return CMD_SUCCESS; | |
10016 | } | |
fee0f4c6 | 10017 | |
718e3744 | 10018 | /* Show BGP peer's summary information. */ |
94f2b392 | 10019 | static int |
b05a1c8b | 10020 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, |
9f689658 | 10021 | u_char use_json, json_object *json) |
718e3744 | 10022 | { |
10023 | struct peer *peer; | |
1eb8ef25 | 10024 | struct listnode *node, *nnode; |
f14e6fdb DS |
10025 | unsigned int count = 0, dn_count = 0; |
10026 | char timebuf[BGP_UPTIME_LEN], dn_flag[2]; | |
718e3744 | 10027 | int len; |
ffd0c037 DS |
10028 | json_object *json_peer = NULL; |
10029 | json_object *json_peers = NULL; | |
718e3744 | 10030 | |
10031 | /* Header string for each address family. */ | |
4a7ac06c | 10032 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; |
47fc97cc | 10033 | |
b05a1c8b DS |
10034 | if (use_json) |
10035 | { | |
9f689658 DD |
10036 | if (json == NULL) |
10037 | json = json_object_new_object(); | |
10038 | ||
f1aa5d8a | 10039 | json_peers = json_object_new_object(); |
b05a1c8b DS |
10040 | } |
10041 | ||
1eb8ef25 | 10042 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 10043 | { |
1ff9a340 DS |
10044 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
10045 | continue; | |
10046 | ||
718e3744 | 10047 | if (peer->afc[afi][safi]) |
10048 | { | |
b05a1c8b | 10049 | if (!count) |
4bf6a362 PJ |
10050 | { |
10051 | unsigned long ents; | |
10052 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
5c81a5f3 | 10053 | int vrf_id_ui; |
10054 | ||
10055 | vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id; | |
b05a1c8b | 10056 | |
4bf6a362 | 10057 | /* Usage summary and header */ |
b05a1c8b DS |
10058 | if (use_json) |
10059 | { | |
62d6dca0 | 10060 | json_object_string_add(json, "routerId", inet_ntoa (bgp->router_id)); |
f1aa5d8a | 10061 | json_object_int_add(json, "as", bgp->as); |
9f689658 DD |
10062 | json_object_int_add(json, "vrfId", vrf_id_ui); |
10063 | json_object_string_add(json, "vrfName", | |
10064 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10065 | ? "Default" : bgp->name); | |
b05a1c8b DS |
10066 | } |
10067 | else | |
10068 | { | |
10069 | vty_out (vty, | |
5c81a5f3 | 10070 | "BGP router identifier %s, local AS number %u vrf-id %d", |
10071 | inet_ntoa (bgp->router_id), bgp->as, vrf_id_ui); | |
6aeb9e78 | 10072 | vty_out (vty, "%s", VTY_NEWLINE); |
b05a1c8b DS |
10073 | } |
10074 | ||
f188f2c4 DS |
10075 | if (bgp_update_delay_configured(bgp)) |
10076 | { | |
b05a1c8b | 10077 | if (use_json) |
f188f2c4 | 10078 | { |
62d6dca0 | 10079 | json_object_int_add(json, "updateDelayLimit", bgp->v_update_delay); |
b05a1c8b DS |
10080 | |
10081 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
62d6dca0 | 10082 | json_object_int_add(json, "updateDelayEstablishWait", bgp->v_establish_wait); |
b05a1c8b DS |
10083 | |
10084 | if (bgp_update_delay_active(bgp)) | |
10085 | { | |
62d6dca0 DS |
10086 | json_object_string_add(json, "updateDelayFirstNeighbor", bgp->update_delay_begin_time); |
10087 | json_object_boolean_true_add(json, "updateDelayInProgress"); | |
b05a1c8b DS |
10088 | } |
10089 | else | |
10090 | { | |
10091 | if (bgp->update_delay_over) | |
10092 | { | |
62d6dca0 | 10093 | json_object_string_add(json, "updateDelayFirstNeighbor", |
f1aa5d8a | 10094 | bgp->update_delay_begin_time); |
62d6dca0 | 10095 | json_object_string_add(json, "updateDelayBestpathResumed", |
f1aa5d8a | 10096 | bgp->update_delay_end_time); |
62d6dca0 | 10097 | json_object_string_add(json, "updateDelayZebraUpdateResume", |
f1aa5d8a | 10098 | bgp->update_delay_zebra_resume_time); |
62d6dca0 | 10099 | json_object_string_add(json, "updateDelayPeerUpdateResume", |
f1aa5d8a | 10100 | bgp->update_delay_peers_resume_time); |
b05a1c8b DS |
10101 | } |
10102 | } | |
f188f2c4 DS |
10103 | } |
10104 | else | |
10105 | { | |
b05a1c8b DS |
10106 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", |
10107 | bgp->v_update_delay, VTY_NEWLINE); | |
10108 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
10109 | vty_out (vty, " Establish wait: %d seconds%s", | |
10110 | bgp->v_establish_wait, VTY_NEWLINE); | |
10111 | ||
10112 | if (bgp_update_delay_active(bgp)) | |
f188f2c4 DS |
10113 | { |
10114 | vty_out (vty, " First neighbor established: %s%s", | |
10115 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
b05a1c8b DS |
10116 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); |
10117 | } | |
10118 | else | |
10119 | { | |
10120 | if (bgp->update_delay_over) | |
10121 | { | |
10122 | vty_out (vty, " First neighbor established: %s%s", | |
10123 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
10124 | vty_out (vty, " Best-paths resumed: %s%s", | |
10125 | bgp->update_delay_end_time, VTY_NEWLINE); | |
10126 | vty_out (vty, " zebra update resumed: %s%s", | |
10127 | bgp->update_delay_zebra_resume_time, VTY_NEWLINE); | |
10128 | vty_out (vty, " peers update resumed: %s%s", | |
10129 | bgp->update_delay_peers_resume_time, VTY_NEWLINE); | |
10130 | } | |
f188f2c4 DS |
10131 | } |
10132 | } | |
10133 | } | |
4bf6a362 | 10134 | |
b05a1c8b DS |
10135 | if (use_json) |
10136 | { | |
10137 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
62d6dca0 | 10138 | json_object_boolean_true_add(json, "maxMedOnStartup"); |
b05a1c8b | 10139 | if (bgp->v_maxmed_admin) |
62d6dca0 | 10140 | json_object_boolean_true_add(json, "maxMedAdministrative"); |
b05a1c8b | 10141 | |
62d6dca0 | 10142 | json_object_int_add(json, "tableVersion", bgp_table_version(bgp->rib[afi][safi])); |
b05a1c8b DS |
10143 | |
10144 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
62d6dca0 DS |
10145 | json_object_int_add(json, "ribCount", ents); |
10146 | json_object_int_add(json, "ribMemory", ents * sizeof (struct bgp_node)); | |
b05a1c8b DS |
10147 | |
10148 | ents = listcount (bgp->peer); | |
62d6dca0 DS |
10149 | json_object_int_add(json, "peerCount", ents); |
10150 | json_object_int_add(json, "peerMemory", ents * sizeof (struct peer)); | |
b05a1c8b | 10151 | |
b05a1c8b DS |
10152 | if ((ents = listcount (bgp->group))) |
10153 | { | |
62d6dca0 DS |
10154 | json_object_int_add(json, "peerGroupCount", ents); |
10155 | json_object_int_add(json, "peerGroupMemory", ents * sizeof (struct peer_group)); | |
b05a1c8b | 10156 | } |
3f9c7369 | 10157 | |
b05a1c8b | 10158 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
62d6dca0 | 10159 | json_object_boolean_true_add(json, "dampeningEnabled"); |
b05a1c8b DS |
10160 | } |
10161 | else | |
10162 | { | |
10163 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
10164 | vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE); | |
10165 | if (bgp->v_maxmed_admin) | |
10166 | vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE); | |
10167 | ||
ffd0c037 | 10168 | vty_out(vty, "BGP table version %" PRIu64 "%s", |
b05a1c8b DS |
10169 | bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE); |
10170 | ||
10171 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
10172 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
10173 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10174 | ents * sizeof (struct bgp_node)), | |
10175 | VTY_NEWLINE); | |
10176 | ||
10177 | /* Peer related usage */ | |
10178 | ents = listcount (bgp->peer); | |
10179 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
10180 | ents, | |
10181 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10182 | ents * sizeof (struct peer)), | |
10183 | VTY_NEWLINE); | |
10184 | ||
b05a1c8b DS |
10185 | if ((ents = listcount (bgp->group))) |
10186 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
10187 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10188 | ents * sizeof (struct peer_group)), | |
10189 | VTY_NEWLINE); | |
10190 | ||
10191 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
10192 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
10193 | vty_out (vty, "%s", VTY_NEWLINE); | |
10194 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
10195 | } | |
4bf6a362 PJ |
10196 | } |
10197 | ||
b05a1c8b | 10198 | count++; |
718e3744 | 10199 | |
b05a1c8b DS |
10200 | if (use_json) |
10201 | { | |
10202 | json_peer = json_object_new_object(); | |
f14e6fdb | 10203 | |
b05a1c8b | 10204 | if (peer_dynamic_neighbor(peer)) |
62d6dca0 | 10205 | json_object_boolean_true_add(json_peer, "dynamicPeer"); |
b05a1c8b | 10206 | |
04b6bdc0 DW |
10207 | if (peer->hostname) |
10208 | json_object_string_add(json_peer, "hostname", peer->hostname); | |
10209 | ||
10210 | if (peer->domainname) | |
10211 | json_object_string_add(json_peer, "domainname", peer->domainname); | |
10212 | ||
62d6dca0 | 10213 | json_object_int_add(json_peer, "remoteAs", peer->as); |
f1aa5d8a | 10214 | json_object_int_add(json_peer, "version", 4); |
62d6dca0 | 10215 | json_object_int_add(json_peer, "msgRcvd", |
f1aa5d8a DS |
10216 | peer->open_in + peer->update_in + peer->keepalive_in |
10217 | + peer->notify_in + peer->refresh_in | |
10218 | + peer->dynamic_cap_in); | |
62d6dca0 | 10219 | json_object_int_add(json_peer, "msgSent", |
f1aa5d8a DS |
10220 | peer->open_out + peer->update_out + peer->keepalive_out |
10221 | + peer->notify_out + peer->refresh_out | |
10222 | + peer->dynamic_cap_out); | |
10223 | ||
62d6dca0 | 10224 | json_object_int_add(json_peer, "tableVersion", peer->version[afi][safi]); |
f1aa5d8a DS |
10225 | json_object_int_add(json_peer, "outq", peer->obuf->count); |
10226 | json_object_int_add(json_peer, "inq", 0); | |
856ca177 | 10227 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, use_json, json_peer); |
62d6dca0 | 10228 | json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][safi]); |
b05a1c8b DS |
10229 | |
10230 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
f1aa5d8a | 10231 | json_object_string_add(json_peer, "state", "Idle (Admin)"); |
b05a1c8b | 10232 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
f1aa5d8a | 10233 | json_object_string_add(json_peer, "state", "Idle (PfxCt)"); |
b05a1c8b | 10234 | else |
f1aa5d8a | 10235 | json_object_string_add(json_peer, "state", LOOKUP(bgp_status_msg, peer->status)); |
b05a1c8b | 10236 | |
f1aa5d8a | 10237 | if (peer->conf_if) |
62d6dca0 | 10238 | json_object_string_add(json_peer, "idType", "interface"); |
f1aa5d8a | 10239 | else if (peer->su.sa.sa_family == AF_INET) |
62d6dca0 | 10240 | json_object_string_add(json_peer, "idType", "ipv4"); |
f1aa5d8a | 10241 | else if (peer->su.sa.sa_family == AF_INET6) |
62d6dca0 | 10242 | json_object_string_add(json_peer, "idType", "ipv6"); |
b05a1c8b | 10243 | |
f1aa5d8a | 10244 | json_object_object_add(json_peers, peer->host, json_peer); |
b05a1c8b DS |
10245 | } |
10246 | else | |
10247 | { | |
10248 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
10249 | if (peer_dynamic_neighbor(peer)) | |
10250 | { | |
10251 | dn_count++; | |
10252 | dn_flag[0] = '*'; | |
10253 | } | |
10254 | ||
04b6bdc0 DW |
10255 | if (peer->hostname && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME)) |
10256 | len = vty_out (vty, "%s%s(%s)", dn_flag, peer->hostname, | |
10257 | peer->host); | |
10258 | else | |
10259 | len = vty_out (vty, "%s%s", dn_flag, peer->host); | |
b05a1c8b DS |
10260 | len = 16 - len; |
10261 | ||
10262 | if (len < 1) | |
10263 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
10264 | else | |
10265 | vty_out (vty, "%*s", len, " "); | |
10266 | ||
10267 | vty_out (vty, "4 "); | |
10268 | ||
ee046671 | 10269 | vty_out (vty, "%5u %7d %7d %8" PRIu64 " %4d %4zd ", |
b05a1c8b DS |
10270 | peer->as, |
10271 | peer->open_in + peer->update_in + peer->keepalive_in | |
10272 | + peer->notify_in + peer->refresh_in | |
10273 | + peer->dynamic_cap_in, | |
10274 | peer->open_out + peer->update_out + peer->keepalive_out | |
10275 | + peer->notify_out + peer->refresh_out | |
10276 | + peer->dynamic_cap_out, | |
10277 | peer->version[afi][safi], | |
10278 | 0, | |
ffd0c037 | 10279 | peer->obuf->count); |
b05a1c8b | 10280 | |
f1aa5d8a | 10281 | vty_out (vty, "%-8s", |
856ca177 | 10282 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); |
b05a1c8b DS |
10283 | |
10284 | if (peer->status == Established) | |
10285 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); | |
10286 | else | |
10287 | { | |
10288 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
10289 | vty_out (vty, " Idle (Admin)"); | |
10290 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
10291 | vty_out (vty, " Idle (PfxCt)"); | |
10292 | else | |
10293 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
10294 | } | |
10295 | vty_out (vty, "%s", VTY_NEWLINE); | |
10296 | } | |
718e3744 | 10297 | } |
10298 | } | |
10299 | ||
b05a1c8b DS |
10300 | if (use_json) |
10301 | { | |
10302 | json_object_object_add(json, "peers", json_peers); | |
14151a32 | 10303 | |
62d6dca0 DS |
10304 | json_object_int_add(json, "totalPeers", count); |
10305 | json_object_int_add(json, "dynamicPeers", dn_count); | |
14151a32 | 10306 | |
b05a1c8b | 10307 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); |
f1aa5d8a | 10308 | json_object_free(json); |
b05a1c8b DS |
10309 | } |
10310 | else | |
f14e6fdb | 10311 | { |
b05a1c8b DS |
10312 | if (count) |
10313 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
10314 | count, VTY_NEWLINE); | |
10315 | else | |
9f689658 DD |
10316 | { |
10317 | if (use_json) | |
10318 | vty_out(vty, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s", | |
10319 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
10320 | else | |
10321 | vty_out (vty, "No %s neighbor is configured%s", | |
10322 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
10323 | } | |
b05a1c8b | 10324 | |
9f689658 | 10325 | if (dn_count && ! use_json) |
b05a1c8b DS |
10326 | { |
10327 | vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE); | |
10328 | vty_out(vty, | |
10329 | "%d dynamic neighbor(s), limit %d%s", | |
10330 | dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
10331 | } | |
f14e6fdb DS |
10332 | } |
10333 | ||
718e3744 | 10334 | return CMD_SUCCESS; |
10335 | } | |
10336 | ||
47fc97cc DS |
10337 | static int |
10338 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
b05a1c8b | 10339 | afi_t afi, safi_t safi, u_char use_json) |
718e3744 | 10340 | { |
10341 | struct bgp *bgp; | |
10342 | ||
10343 | if (name) | |
10344 | { | |
10345 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 10346 | |
718e3744 | 10347 | if (! bgp) |
10348 | { | |
47fc97cc | 10349 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 10350 | return CMD_WARNING; |
10351 | } | |
10352 | ||
9f689658 | 10353 | bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); |
718e3744 | 10354 | return CMD_SUCCESS; |
10355 | } | |
47fc97cc | 10356 | |
718e3744 | 10357 | bgp = bgp_get_default (); |
10358 | ||
10359 | if (bgp) | |
9f689658 | 10360 | bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); |
47fc97cc | 10361 | |
718e3744 | 10362 | return CMD_SUCCESS; |
10363 | } | |
10364 | ||
f186de26 | 10365 | static void |
10366 | bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi, | |
10367 | u_char use_json) | |
10368 | { | |
10369 | struct listnode *node, *nnode; | |
10370 | struct bgp *bgp; | |
9f689658 DD |
10371 | json_object *json = NULL; |
10372 | int is_first = 1; | |
10373 | ||
10374 | if (use_json) | |
10375 | vty_out (vty, "{%s", VTY_NEWLINE); | |
f186de26 | 10376 | |
10377 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
10378 | { | |
9f689658 DD |
10379 | if (use_json) |
10380 | { | |
10381 | if (!(json = json_object_new_object())) | |
10382 | { | |
10383 | zlog_err("Unable to allocate memory for JSON object"); | |
10384 | vty_out (vty, | |
10385 | "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s", | |
10386 | VTY_NEWLINE); | |
10387 | return; | |
10388 | } | |
10389 | ||
10390 | if (! is_first) | |
10391 | vty_out (vty, ",%s", VTY_NEWLINE); | |
10392 | else | |
10393 | is_first = 0; | |
10394 | ||
10395 | vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10396 | ? "Default" : bgp->name); | |
10397 | } | |
10398 | else | |
10399 | { | |
10400 | vty_out (vty, "%sInstance %s:%s", | |
10401 | VTY_NEWLINE, | |
10402 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10403 | ? "Default" : bgp->name, VTY_NEWLINE); | |
10404 | } | |
10405 | bgp_show_summary (vty, bgp, afi, safi, use_json, json); | |
f186de26 | 10406 | } |
9f689658 DD |
10407 | |
10408 | if (use_json) | |
10409 | vty_out (vty, "}%s", VTY_NEWLINE); | |
10410 | ||
f186de26 | 10411 | } |
10412 | ||
718e3744 | 10413 | /* `show ip bgp summary' commands. */ |
47fc97cc | 10414 | DEFUN (show_ip_bgp_summary, |
718e3744 | 10415 | show_ip_bgp_summary_cmd, |
b05a1c8b | 10416 | "show ip bgp summary {json}", |
47fc97cc DS |
10417 | SHOW_STR |
10418 | IP_STR | |
10419 | BGP_STR | |
b05a1c8b DS |
10420 | "Summary of BGP neighbor status\n" |
10421 | "JavaScript Object Notation\n") | |
47fc97cc | 10422 | { |
db7c8528 DS |
10423 | u_char uj = use_json(argc, argv); |
10424 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); | |
718e3744 | 10425 | } |
10426 | ||
10427 | DEFUN (show_ip_bgp_instance_summary, | |
10428 | show_ip_bgp_instance_summary_cmd, | |
8386ac43 | 10429 | "show ip bgp " BGP_INSTANCE_CMD " summary {json}", |
718e3744 | 10430 | SHOW_STR |
10431 | IP_STR | |
10432 | BGP_STR | |
8386ac43 | 10433 | BGP_INSTANCE_HELP_STR |
b05a1c8b DS |
10434 | "Summary of BGP neighbor status\n" |
10435 | "JavaScript Object Notation\n") | |
718e3744 | 10436 | { |
db7c8528 | 10437 | u_char uj = use_json(argc, argv); |
6aeb9e78 | 10438 | return bgp_show_summary_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10439 | } |
10440 | ||
f186de26 | 10441 | DEFUN (show_ip_bgp_instance_all_summary, |
10442 | show_ip_bgp_instance_all_summary_cmd, | |
10443 | "show ip bgp " BGP_INSTANCE_ALL_CMD " summary {json}", | |
10444 | SHOW_STR | |
10445 | IP_STR | |
10446 | BGP_STR | |
10447 | BGP_INSTANCE_ALL_HELP_STR | |
10448 | "Summary of BGP neighbor status\n" | |
10449 | "JavaScript Object Notation\n") | |
10450 | { | |
10451 | u_char uj = use_json(argc, argv); | |
10452 | ||
10453 | bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj); | |
10454 | return CMD_SUCCESS; | |
10455 | } | |
10456 | ||
718e3744 | 10457 | DEFUN (show_ip_bgp_ipv4_summary, |
10458 | show_ip_bgp_ipv4_summary_cmd, | |
b05a1c8b | 10459 | "show ip bgp ipv4 (unicast|multicast) summary {json}", |
718e3744 | 10460 | SHOW_STR |
10461 | IP_STR | |
10462 | BGP_STR | |
10463 | "Address family\n" | |
10464 | "Address Family modifier\n" | |
10465 | "Address Family modifier\n" | |
b05a1c8b DS |
10466 | "Summary of BGP neighbor status\n" |
10467 | "JavaScript Object Notation\n") | |
718e3744 | 10468 | { |
db7c8528 | 10469 | u_char uj = use_json(argc, argv); |
718e3744 | 10470 | if (strncmp (argv[0], "m", 1) == 0) |
db7c8528 | 10471 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj); |
718e3744 | 10472 | |
db7c8528 | 10473 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10474 | } |
10475 | ||
95cbbd2a ML |
10476 | ALIAS (show_ip_bgp_ipv4_summary, |
10477 | show_bgp_ipv4_safi_summary_cmd, | |
b05a1c8b | 10478 | "show bgp ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10479 | SHOW_STR |
10480 | BGP_STR | |
10481 | "Address family\n" | |
10482 | "Address Family modifier\n" | |
10483 | "Address Family modifier\n" | |
10484 | "Summary of BGP neighbor status\n") | |
10485 | ||
718e3744 | 10486 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
10487 | show_ip_bgp_instance_ipv4_summary_cmd, | |
b05a1c8b | 10488 | "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}", |
718e3744 | 10489 | SHOW_STR |
10490 | IP_STR | |
10491 | BGP_STR | |
10492 | "BGP view\n" | |
10493 | "View name\n" | |
10494 | "Address family\n" | |
10495 | "Address Family modifier\n" | |
10496 | "Address Family modifier\n" | |
b05a1c8b DS |
10497 | "Summary of BGP neighbor status\n" |
10498 | "JavaScript Object Notation\n") | |
718e3744 | 10499 | { |
db7c8528 | 10500 | u_char uj = use_json(argc, argv); |
718e3744 | 10501 | if (strncmp (argv[1], "m", 1) == 0) |
db7c8528 | 10502 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, uj); |
718e3744 | 10503 | else |
db7c8528 | 10504 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10505 | } |
10506 | ||
95cbbd2a ML |
10507 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
10508 | show_bgp_instance_ipv4_safi_summary_cmd, | |
b05a1c8b | 10509 | "show bgp view WORD ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10510 | SHOW_STR |
10511 | BGP_STR | |
10512 | "BGP view\n" | |
10513 | "View name\n" | |
10514 | "Address family\n" | |
10515 | "Address Family modifier\n" | |
10516 | "Address Family modifier\n" | |
10517 | "Summary of BGP neighbor status\n") | |
10518 | ||
718e3744 | 10519 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
10520 | show_ip_bgp_vpnv4_all_summary_cmd, | |
b05a1c8b | 10521 | "show ip bgp vpnv4 all summary {json}", |
718e3744 | 10522 | SHOW_STR |
10523 | IP_STR | |
10524 | BGP_STR | |
10525 | "Display VPNv4 NLRI specific information\n" | |
10526 | "Display information about all VPNv4 NLRIs\n" | |
b05a1c8b DS |
10527 | "Summary of BGP neighbor status\n" |
10528 | "JavaScript Object Notation\n") | |
718e3744 | 10529 | { |
db7c8528 DS |
10530 | u_char uj = use_json(argc, argv); |
10531 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); | |
718e3744 | 10532 | } |
10533 | ||
10534 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
10535 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
b05a1c8b | 10536 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}", |
718e3744 | 10537 | SHOW_STR |
10538 | IP_STR | |
10539 | BGP_STR | |
10540 | "Display VPNv4 NLRI specific information\n" | |
10541 | "Display information for a route distinguisher\n" | |
10542 | "VPN Route Distinguisher\n" | |
b05a1c8b DS |
10543 | "Summary of BGP neighbor status\n" |
10544 | "JavaScript Object Notation\n") | |
718e3744 | 10545 | { |
10546 | int ret; | |
10547 | struct prefix_rd prd; | |
db7c8528 | 10548 | u_char uj = use_json(argc, argv); |
718e3744 | 10549 | |
10550 | ret = str2prefix_rd (argv[0], &prd); | |
10551 | if (! ret) | |
10552 | { | |
10553 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
10554 | return CMD_WARNING; | |
10555 | } | |
10556 | ||
db7c8528 | 10557 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); |
718e3744 | 10558 | } |
10559 | ||
10560 | #ifdef HAVE_IPV6 | |
47fc97cc | 10561 | DEFUN (show_bgp_summary, |
718e3744 | 10562 | show_bgp_summary_cmd, |
b05a1c8b | 10563 | "show bgp summary {json}", |
718e3744 | 10564 | SHOW_STR |
10565 | BGP_STR | |
b05a1c8b DS |
10566 | "Summary of BGP neighbor status\n" |
10567 | "JavaScript Object Notation\n") | |
718e3744 | 10568 | { |
db7c8528 | 10569 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); |
718e3744 | 10570 | } |
10571 | ||
10572 | DEFUN (show_bgp_instance_summary, | |
10573 | show_bgp_instance_summary_cmd, | |
8386ac43 | 10574 | "show bgp " BGP_INSTANCE_CMD " summary {json}", |
718e3744 | 10575 | SHOW_STR |
10576 | BGP_STR | |
8386ac43 | 10577 | BGP_INSTANCE_HELP_STR |
b05a1c8b DS |
10578 | "Summary of BGP neighbor status\n" |
10579 | "JavaScript Object Notation\n") | |
718e3744 | 10580 | { |
6aeb9e78 | 10581 | return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); |
718e3744 | 10582 | } |
10583 | ||
f186de26 | 10584 | DEFUN (show_bgp_instance_all_summary, |
10585 | show_bgp_instance_all_summary_cmd, | |
10586 | "show bgp " BGP_INSTANCE_ALL_CMD " summary {json}", | |
10587 | SHOW_STR | |
10588 | BGP_STR | |
10589 | BGP_INSTANCE_ALL_HELP_STR | |
10590 | "Summary of BGP neighbor status\n" | |
10591 | "JavaScript Object Notation\n") | |
10592 | { | |
10593 | u_char uj = use_json(argc, argv); | |
10594 | ||
10595 | bgp_show_all_instances_summary_vty (vty, AFI_IP6, SAFI_UNICAST, uj); | |
10596 | return CMD_SUCCESS; | |
10597 | } | |
10598 | ||
718e3744 | 10599 | ALIAS (show_bgp_summary, |
10600 | show_bgp_ipv6_summary_cmd, | |
b05a1c8b | 10601 | "show bgp ipv6 summary {json}", |
718e3744 | 10602 | SHOW_STR |
10603 | BGP_STR | |
10604 | "Address family\n" | |
10605 | "Summary of BGP neighbor status\n") | |
10606 | ||
10607 | ALIAS (show_bgp_instance_summary, | |
10608 | show_bgp_instance_ipv6_summary_cmd, | |
8386ac43 | 10609 | "show bgp " BGP_INSTANCE_CMD " ipv6 summary {json}", |
718e3744 | 10610 | SHOW_STR |
10611 | BGP_STR | |
8386ac43 | 10612 | BGP_INSTANCE_HELP_STR |
718e3744 | 10613 | "Address family\n" |
10614 | "Summary of BGP neighbor status\n") | |
10615 | ||
95cbbd2a ML |
10616 | DEFUN (show_bgp_ipv6_safi_summary, |
10617 | show_bgp_ipv6_safi_summary_cmd, | |
b05a1c8b | 10618 | "show bgp ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10619 | SHOW_STR |
10620 | BGP_STR | |
10621 | "Address family\n" | |
10622 | "Address Family modifier\n" | |
10623 | "Address Family modifier\n" | |
b05a1c8b DS |
10624 | "Summary of BGP neighbor status\n" |
10625 | "JavaScript Object Notation\n") | |
95cbbd2a | 10626 | { |
db7c8528 | 10627 | u_char uj = use_json(argc, argv); |
95cbbd2a | 10628 | if (strncmp (argv[0], "m", 1) == 0) |
db7c8528 | 10629 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); |
95cbbd2a | 10630 | |
db7c8528 | 10631 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); |
95cbbd2a ML |
10632 | } |
10633 | ||
10634 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
10635 | show_bgp_instance_ipv6_safi_summary_cmd, | |
8386ac43 | 10636 | "show bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
10637 | SHOW_STR |
10638 | BGP_STR | |
8386ac43 | 10639 | BGP_INSTANCE_HELP_STR |
95cbbd2a ML |
10640 | "Address family\n" |
10641 | "Address Family modifier\n" | |
10642 | "Address Family modifier\n" | |
b05a1c8b DS |
10643 | "Summary of BGP neighbor status\n" |
10644 | "JavaScript Object Notation\n") | |
95cbbd2a | 10645 | { |
db7c8528 | 10646 | u_char uj = use_json(argc, argv); |
6aeb9e78 DS |
10647 | if (strncmp (argv[2], "m", 1) == 0) |
10648 | return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_MULTICAST, uj); | |
95cbbd2a | 10649 | |
6aeb9e78 | 10650 | return bgp_show_summary_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, uj); |
95cbbd2a ML |
10651 | } |
10652 | ||
718e3744 | 10653 | /* old command */ |
10654 | DEFUN (show_ipv6_bgp_summary, | |
10655 | show_ipv6_bgp_summary_cmd, | |
b05a1c8b | 10656 | "show ipv6 bgp summary {json}", |
718e3744 | 10657 | SHOW_STR |
10658 | IPV6_STR | |
10659 | BGP_STR | |
b05a1c8b DS |
10660 | "Summary of BGP neighbor status\n" |
10661 | "JavaScript Object Notation\n") | |
718e3744 | 10662 | { |
db7c8528 DS |
10663 | u_char uj = use_json(argc, argv); |
10664 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); | |
718e3744 | 10665 | } |
10666 | ||
10667 | /* old command */ | |
10668 | DEFUN (show_ipv6_mbgp_summary, | |
10669 | show_ipv6_mbgp_summary_cmd, | |
b05a1c8b | 10670 | "show ipv6 mbgp summary {json}", |
718e3744 | 10671 | SHOW_STR |
10672 | IPV6_STR | |
10673 | MBGP_STR | |
b05a1c8b DS |
10674 | "Summary of BGP neighbor status\n" |
10675 | "JavaScript Object Notation\n") | |
718e3744 | 10676 | { |
db7c8528 DS |
10677 | u_char uj = use_json(argc, argv); |
10678 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); | |
718e3744 | 10679 | } |
10680 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 10681 | |
fd79ac91 | 10682 | const char * |
538621f2 | 10683 | afi_safi_print (afi_t afi, safi_t safi) |
10684 | { | |
10685 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
10686 | return "IPv4 Unicast"; | |
10687 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
10688 | return "IPv4 Multicast"; | |
10689 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
945c8fe9 | 10690 | return "VPN-IPv4 Unicast"; |
538621f2 | 10691 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
10692 | return "IPv6 Unicast"; | |
10693 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
10694 | return "IPv6 Multicast"; | |
945c8fe9 LB |
10695 | else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN) |
10696 | return "VPN-IPv6 Unicast"; | |
538621f2 | 10697 | else |
10698 | return "Unknown"; | |
10699 | } | |
10700 | ||
718e3744 | 10701 | /* Show BGP peer's information. */ |
10702 | enum show_type | |
10703 | { | |
10704 | show_all, | |
10705 | show_peer | |
10706 | }; | |
10707 | ||
94f2b392 | 10708 | static void |
856ca177 MS |
10709 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
10710 | u_int16_t adv_smcap, u_int16_t adv_rmcap, u_int16_t rcv_smcap, | |
10711 | u_int16_t rcv_rmcap, u_char use_json, json_object *json_pref) | |
718e3744 | 10712 | { |
10713 | /* Send-Mode */ | |
10714 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
10715 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10716 | { | |
856ca177 MS |
10717 | if (use_json) |
10718 | { | |
10719 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10720 | json_object_string_add(json_pref, "sendMode", "advertisedAndReceived"); | |
10721 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
10722 | json_object_string_add(json_pref, "sendMode", "advertised"); | |
10723 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10724 | json_object_string_add(json_pref, "sendMode", "received"); | |
10725 | } | |
10726 | else | |
10727 | { | |
10728 | vty_out (vty, " Send-mode: "); | |
10729 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
10730 | vty_out (vty, "advertised"); | |
10731 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
10732 | vty_out (vty, "%sreceived", | |
10733 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
10734 | ", " : ""); | |
10735 | vty_out (vty, "%s", VTY_NEWLINE); | |
10736 | } | |
718e3744 | 10737 | } |
10738 | ||
10739 | /* Receive-Mode */ | |
10740 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
10741 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10742 | { | |
856ca177 MS |
10743 | if (use_json) |
10744 | { | |
10745 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10746 | json_object_string_add(json_pref, "recvMode", "advertisedAndReceived"); | |
10747 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
10748 | json_object_string_add(json_pref, "recvMode", "advertised"); | |
10749 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10750 | json_object_string_add(json_pref, "recvMode", "received"); | |
10751 | } | |
10752 | else | |
10753 | { | |
10754 | vty_out (vty, " Receive-mode: "); | |
10755 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
10756 | vty_out (vty, "advertised"); | |
10757 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
10758 | vty_out (vty, "%sreceived", | |
10759 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
10760 | ", " : ""); | |
10761 | vty_out (vty, "%s", VTY_NEWLINE); | |
10762 | } | |
718e3744 | 10763 | } |
10764 | } | |
10765 | ||
94f2b392 | 10766 | static void |
856ca177 MS |
10767 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
10768 | u_char use_json, json_object *json_neigh) | |
718e3744 | 10769 | { |
10770 | struct bgp_filter *filter; | |
3f9c7369 | 10771 | struct peer_af *paf; |
718e3744 | 10772 | char orf_pfx_name[BUFSIZ]; |
10773 | int orf_pfx_count; | |
856ca177 MS |
10774 | json_object *json_af = NULL; |
10775 | json_object *json_prefA = NULL; | |
10776 | json_object *json_prefB = NULL; | |
10777 | json_object *json_addr = NULL; | |
718e3744 | 10778 | |
856ca177 MS |
10779 | if (use_json) |
10780 | { | |
10781 | json_addr = json_object_new_object(); | |
10782 | json_af = json_object_new_object(); | |
10783 | json_prefA = json_object_new_object(); | |
10784 | json_prefB = json_object_new_object(); | |
10785 | filter = &p->filter[afi][safi]; | |
718e3744 | 10786 | |
c8560b44 | 10787 | if (peer_group_active(p)) |
856ca177 | 10788 | json_object_string_add(json_addr, "peerGroupMember", p->group->name); |
538621f2 | 10789 | |
856ca177 MS |
10790 | paf = peer_af_find(p, afi, safi); |
10791 | if (paf && PAF_SUBGRP(paf)) | |
10792 | { | |
10793 | json_object_int_add(json_addr, "updateGroupId", PAF_UPDGRP(paf)->id); | |
10794 | json_object_int_add(json_addr, "subGroupId", PAF_SUBGRP(paf)->id); | |
10795 | json_object_int_add(json_addr, "packetQueueLength", bpacket_queue_virtual_length(paf)); | |
10796 | } | |
10797 | ||
10798 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
10799 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
10800 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
10801 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
10802 | { | |
10803 | json_object_int_add(json_af, "orfType", ORF_TYPE_PREFIX); | |
10804 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
10805 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
10806 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
10807 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
10808 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, json_prefA); | |
10809 | json_object_object_add(json_af, "orfPrefixList", json_prefA); | |
10810 | } | |
10811 | ||
10812 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
10813 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
10814 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
10815 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
10816 | { | |
10817 | json_object_int_add(json_af, "orfOldType", ORF_TYPE_PREFIX_OLD); | |
10818 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
10819 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
10820 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
10821 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
10822 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, json_prefB); | |
10823 | json_object_object_add(json_af, "orfOldPrefixList", json_prefB); | |
10824 | } | |
10825 | ||
10826 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
10827 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
10828 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
10829 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
10830 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
10831 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
10832 | json_object_object_add(json_addr, "afDependentCap", json_af); | |
10833 | ||
10834 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
10835 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
10836 | ||
10837 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
10838 | || orf_pfx_count) | |
10839 | { | |
10840 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
10841 | json_object_boolean_true_add(json_neigh, "orfSent"); | |
10842 | if (orf_pfx_count) | |
10843 | json_object_int_add(json_addr, "orfRecvCounter", orf_pfx_count); | |
10844 | } | |
10845 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
10846 | json_object_string_add(json_addr, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd"); | |
10847 | ||
10848 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
10849 | json_object_boolean_true_add(json_addr, "routeReflectorClient"); | |
10850 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
10851 | json_object_boolean_true_add(json_addr, "routeServerClient"); | |
10852 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
10853 | json_object_boolean_true_add(json_addr, "inboundSoftConfigPermit"); | |
10854 | ||
88b8ed8d DW |
10855 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
10856 | json_object_boolean_true_add(json_addr, "privateAsNumsAllReplacedInUpdatesToNbr"); | |
10857 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 10858 | json_object_boolean_true_add(json_addr, "privateAsNumsReplacedInUpdatesToNbr"); |
88b8ed8d DW |
10859 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
10860 | json_object_boolean_true_add(json_addr, "privateAsNumsAllRemovedInUpdatesToNbr"); | |
856ca177 MS |
10861 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
10862 | json_object_boolean_true_add(json_addr, "privateAsNumsRemovedInUpdatesToNbr"); | |
10863 | ||
adbac85e DW |
10864 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) |
10865 | json_object_boolean_true_add(json_addr, "addpathTxAllPaths"); | |
10866 | ||
06370dac DW |
10867 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) |
10868 | json_object_boolean_true_add(json_addr, "addpathTxBestpathPerAS"); | |
10869 | ||
856ca177 MS |
10870 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
10871 | json_object_string_add(json_addr, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs"); | |
10872 | ||
10873 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
10874 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
10875 | json_object_boolean_true_add(json_addr, "routerAlwaysNextHop"); | |
10876 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
10877 | json_object_boolean_true_add(json_addr, "unchangedAsPathPropogatedToNbr"); | |
10878 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
10879 | json_object_boolean_true_add(json_addr, "unchangedNextHopPropogatedToNbr"); | |
10880 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
10881 | json_object_boolean_true_add(json_addr, "unchangedMedPropogatedToNbr"); | |
718e3744 | 10882 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
856ca177 MS |
10883 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
10884 | { | |
10885 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
10886 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
10887 | json_object_string_add(json_addr, "commAttriSentToNbr", "extendedAndStandard"); | |
10888 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
10889 | json_object_string_add(json_addr, "commAttriSentToNbr", "extended"); | |
10890 | else | |
10891 | json_object_string_add(json_addr, "commAttriSentToNbr", "standard"); | |
10892 | } | |
10893 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
10894 | { | |
10895 | if (p->default_rmap[afi][safi].name) | |
10896 | json_object_string_add(json_addr, "defaultRouteMap", p->default_rmap[afi][safi].name); | |
10897 | ||
10898 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
10899 | json_object_boolean_true_add(json_addr, "defaultSent"); | |
10900 | else | |
10901 | json_object_boolean_true_add(json_addr, "defaultNotSent"); | |
10902 | } | |
10903 | ||
10904 | if (filter->plist[FILTER_IN].name | |
10905 | || filter->dlist[FILTER_IN].name | |
10906 | || filter->aslist[FILTER_IN].name | |
10907 | || filter->map[RMAP_IN].name) | |
10908 | json_object_boolean_true_add(json_addr, "inboundPathPolicyConfig"); | |
10909 | if (filter->plist[FILTER_OUT].name | |
10910 | || filter->dlist[FILTER_OUT].name | |
10911 | || filter->aslist[FILTER_OUT].name | |
10912 | || filter->map[RMAP_OUT].name | |
10913 | || filter->usmap.name) | |
10914 | json_object_boolean_true_add(json_addr, "outboundPathPolicyConfig"); | |
856ca177 MS |
10915 | |
10916 | /* prefix-list */ | |
10917 | if (filter->plist[FILTER_IN].name) | |
10918 | json_object_string_add(json_addr, "incomingUpdatePrefixFilterList", filter->plist[FILTER_IN].name); | |
10919 | if (filter->plist[FILTER_OUT].name) | |
10920 | json_object_string_add(json_addr, "outgoingUpdatePrefixFilterList", filter->plist[FILTER_OUT].name); | |
10921 | ||
10922 | /* distribute-list */ | |
10923 | if (filter->dlist[FILTER_IN].name) | |
10924 | json_object_string_add(json_addr, "incomingUpdateNetworkFilterList", filter->dlist[FILTER_IN].name); | |
10925 | if (filter->dlist[FILTER_OUT].name) | |
10926 | json_object_string_add(json_addr, "outgoingUpdateNetworkFilterList", filter->dlist[FILTER_OUT].name); | |
10927 | ||
10928 | /* filter-list. */ | |
10929 | if (filter->aslist[FILTER_IN].name) | |
10930 | json_object_string_add(json_addr, "incomingUpdateAsPathFilterList", filter->aslist[FILTER_IN].name); | |
10931 | if (filter->aslist[FILTER_OUT].name) | |
10932 | json_object_string_add(json_addr, "outgoingUpdateAsPathFilterList", filter->aslist[FILTER_OUT].name); | |
10933 | ||
10934 | /* route-map. */ | |
10935 | if (filter->map[RMAP_IN].name) | |
10936 | json_object_string_add(json_addr, "routeMapForIncomingAdvertisements", filter->map[RMAP_IN].name); | |
10937 | if (filter->map[RMAP_OUT].name) | |
10938 | json_object_string_add(json_addr, "routeMapForOutgoingAdvertisements", filter->map[RMAP_OUT].name); | |
856ca177 MS |
10939 | |
10940 | /* unsuppress-map */ | |
10941 | if (filter->usmap.name) | |
10942 | json_object_string_add(json_addr, "selectiveUnsuppressRouteMap", filter->usmap.name); | |
10943 | ||
10944 | /* Receive prefix count */ | |
10945 | json_object_int_add(json_addr, "acceptedPrefixCounter", p->pcount[afi][safi]); | |
10946 | ||
10947 | /* Maximum prefix */ | |
10948 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
10949 | { | |
10950 | json_object_int_add(json_addr, "prefixAllowedMax", p->pmax[afi][safi]); | |
10951 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) | |
10952 | json_object_boolean_true_add(json_addr, "prefixAllowedMaxWarning"); | |
10953 | json_object_int_add(json_addr, "prefixAllowedWarningThresh", p->pmax_threshold[afi][safi]); | |
10954 | if (p->pmax_restart[afi][safi]) | |
10955 | json_object_int_add(json_addr, "prefixAllowedRestartIntervalMsecs", p->pmax_restart[afi][safi] * 60000); | |
10956 | } | |
10957 | json_object_object_add(json_neigh, afi_safi_print (afi, safi), json_addr); | |
10958 | ||
10959 | } | |
10960 | else | |
10961 | { | |
10962 | filter = &p->filter[afi][safi]; | |
10963 | ||
10964 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), | |
10965 | VTY_NEWLINE); | |
10966 | ||
c8560b44 | 10967 | if (peer_group_active(p)) |
856ca177 MS |
10968 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
10969 | ||
10970 | paf = peer_af_find(p, afi, safi); | |
10971 | if (paf && PAF_SUBGRP(paf)) | |
10972 | { | |
10973 | vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s", | |
10974 | PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE); | |
10975 | vty_out (vty, " Packet Queue length %d%s", | |
10976 | bpacket_queue_virtual_length(paf), VTY_NEWLINE); | |
10977 | } | |
718e3744 | 10978 | else |
856ca177 MS |
10979 | { |
10980 | vty_out(vty, " Not part of any update group%s", VTY_NEWLINE); | |
10981 | } | |
10982 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
10983 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
10984 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
10985 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
10986 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
10987 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
10988 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
10989 | ||
10990 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
10991 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
10992 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
10993 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
10994 | { | |
10995 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
10996 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
10997 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
10998 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
10999 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11000 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
11001 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, NULL); | |
11002 | } | |
11003 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11004 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11005 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11006 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11007 | { | |
11008 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
11009 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
11010 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11011 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11012 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11013 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
11014 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, NULL); | |
11015 | } | |
718e3744 | 11016 | |
856ca177 MS |
11017 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
11018 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
718e3744 | 11019 | |
856ca177 MS |
11020 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
11021 | || orf_pfx_count) | |
11022 | { | |
11023 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
11024 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
11025 | vty_out (vty, " sent;"); | |
11026 | if (orf_pfx_count) | |
11027 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
11028 | vty_out (vty, "%s", VTY_NEWLINE); | |
11029 | } | |
11030 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
11031 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
11032 | ||
11033 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
11034 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
11035 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
11036 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
11037 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
11038 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
11039 | ||
88b8ed8d DW |
11040 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
11041 | vty_out (vty, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE); | |
11042 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 11043 | vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE); |
88b8ed8d DW |
11044 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
11045 | vty_out (vty, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE); | |
856ca177 MS |
11046 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
11047 | vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE); | |
11048 | ||
adbac85e DW |
11049 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) |
11050 | vty_out (vty, " Advertise all paths via addpath%s", VTY_NEWLINE); | |
11051 | ||
06370dac DW |
11052 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) |
11053 | vty_out (vty, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE); | |
11054 | ||
856ca177 MS |
11055 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
11056 | vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE); | |
11057 | ||
11058 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
11059 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
11060 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); | |
11061 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
11062 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11063 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
11064 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11065 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
11066 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11067 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11068 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11069 | { | |
11070 | vty_out (vty, " Community attribute sent to this neighbor"); | |
11071 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11072 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11073 | vty_out (vty, "(both)%s", VTY_NEWLINE); | |
11074 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11075 | vty_out (vty, "(extended)%s", VTY_NEWLINE); | |
11076 | else | |
11077 | vty_out (vty, "(standard)%s", VTY_NEWLINE); | |
11078 | } | |
11079 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
11080 | { | |
11081 | vty_out (vty, " Default information originate,"); | |
11082 | ||
11083 | if (p->default_rmap[afi][safi].name) | |
11084 | vty_out (vty, " default route-map %s%s,", | |
11085 | p->default_rmap[afi][safi].map ? "*" : "", | |
11086 | p->default_rmap[afi][safi].name); | |
11087 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
11088 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
11089 | else | |
11090 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
11091 | } | |
718e3744 | 11092 | |
856ca177 MS |
11093 | if (filter->plist[FILTER_IN].name |
11094 | || filter->dlist[FILTER_IN].name | |
11095 | || filter->aslist[FILTER_IN].name | |
11096 | || filter->map[RMAP_IN].name) | |
11097 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); | |
11098 | if (filter->plist[FILTER_OUT].name | |
11099 | || filter->dlist[FILTER_OUT].name | |
11100 | || filter->aslist[FILTER_OUT].name | |
11101 | || filter->map[RMAP_OUT].name | |
11102 | || filter->usmap.name) | |
11103 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
856ca177 MS |
11104 | |
11105 | /* prefix-list */ | |
11106 | if (filter->plist[FILTER_IN].name) | |
11107 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
11108 | filter->plist[FILTER_IN].plist ? "*" : "", | |
11109 | filter->plist[FILTER_IN].name, | |
11110 | VTY_NEWLINE); | |
11111 | if (filter->plist[FILTER_OUT].name) | |
11112 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
11113 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
11114 | filter->plist[FILTER_OUT].name, | |
11115 | VTY_NEWLINE); | |
11116 | ||
11117 | /* distribute-list */ | |
11118 | if (filter->dlist[FILTER_IN].name) | |
11119 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
11120 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
11121 | filter->dlist[FILTER_IN].name, | |
11122 | VTY_NEWLINE); | |
11123 | if (filter->dlist[FILTER_OUT].name) | |
11124 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
11125 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
11126 | filter->dlist[FILTER_OUT].name, | |
11127 | VTY_NEWLINE); | |
11128 | ||
11129 | /* filter-list. */ | |
11130 | if (filter->aslist[FILTER_IN].name) | |
11131 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
11132 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
11133 | filter->aslist[FILTER_IN].name, | |
11134 | VTY_NEWLINE); | |
11135 | if (filter->aslist[FILTER_OUT].name) | |
11136 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
11137 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
11138 | filter->aslist[FILTER_OUT].name, | |
11139 | VTY_NEWLINE); | |
11140 | ||
11141 | /* route-map. */ | |
11142 | if (filter->map[RMAP_IN].name) | |
11143 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", | |
11144 | filter->map[RMAP_IN].map ? "*" : "", | |
11145 | filter->map[RMAP_IN].name, | |
11146 | VTY_NEWLINE); | |
11147 | if (filter->map[RMAP_OUT].name) | |
11148 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", | |
11149 | filter->map[RMAP_OUT].map ? "*" : "", | |
11150 | filter->map[RMAP_OUT].name, | |
11151 | VTY_NEWLINE); | |
856ca177 MS |
11152 | |
11153 | /* unsuppress-map */ | |
11154 | if (filter->usmap.name) | |
11155 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
11156 | filter->usmap.map ? "*" : "", | |
11157 | filter->usmap.name, VTY_NEWLINE); | |
11158 | ||
11159 | /* Receive prefix count */ | |
11160 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); | |
11161 | ||
11162 | /* Maximum prefix */ | |
11163 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
11164 | { | |
11165 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], | |
11166 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) | |
11167 | ? " (warning-only)" : "", VTY_NEWLINE); | |
11168 | vty_out (vty, " Threshold for warning message %d%%", | |
11169 | p->pmax_threshold[afi][safi]); | |
11170 | if (p->pmax_restart[afi][safi]) | |
11171 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
11172 | vty_out (vty, "%s", VTY_NEWLINE); | |
11173 | } | |
718e3744 | 11174 | |
0a486e5f | 11175 | vty_out (vty, "%s", VTY_NEWLINE); |
718e3744 | 11176 | } |
718e3744 | 11177 | } |
11178 | ||
94f2b392 | 11179 | static void |
e8f7da3a | 11180 | bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *json) |
718e3744 | 11181 | { |
11182 | struct bgp *bgp; | |
4690c7d7 | 11183 | char buf1[PREFIX2STR_BUFFER], buf[SU_ADDRSTRLEN]; |
718e3744 | 11184 | char timebuf[BGP_UPTIME_LEN]; |
f14e6fdb | 11185 | char dn_flag[2]; |
3a8c7ba1 DW |
11186 | const char *subcode_str; |
11187 | const char *code_str; | |
538621f2 | 11188 | afi_t afi; |
11189 | safi_t safi; | |
d6661008 DS |
11190 | u_int16_t i; |
11191 | u_char *msg; | |
e8f7da3a | 11192 | json_object *json_neigh = NULL; |
718e3744 | 11193 | |
11194 | bgp = p->bgp; | |
11195 | ||
e8f7da3a DW |
11196 | if (use_json) |
11197 | json_neigh = json_object_new_object(); | |
11198 | ||
856ca177 | 11199 | if (!use_json) |
f14e6fdb | 11200 | { |
856ca177 MS |
11201 | if (p->conf_if) /* Configured interface name. */ |
11202 | vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if, | |
11203 | BGP_PEER_SU_UNSPEC(p) ? "None" : | |
11204 | sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
11205 | else /* Configured IP address. */ | |
11206 | { | |
11207 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
11208 | if (peer_dynamic_neighbor(p)) | |
11209 | dn_flag[0] = '*'; | |
f14e6fdb | 11210 | |
856ca177 MS |
11211 | vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host); |
11212 | } | |
f14e6fdb DS |
11213 | } |
11214 | ||
856ca177 MS |
11215 | if (use_json) |
11216 | { | |
11217 | if (p->conf_if && BGP_PEER_SU_UNSPEC(p)) | |
11218 | json_object_string_add(json_neigh, "bgpNeighborAddr", "none"); | |
11219 | else if (p->conf_if && !BGP_PEER_SU_UNSPEC(p)) | |
11220 | json_object_string_add(json_neigh, "bgpNeighborAddr", sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
11221 | ||
11222 | json_object_int_add(json_neigh, "remoteAs", p->as); | |
11223 | ||
11224 | if (p->change_local_as) | |
11225 | json_object_int_add(json_neigh, "localAs", p->change_local_as); | |
11226 | else | |
11227 | json_object_int_add(json_neigh, "localAs", p->local_as); | |
11228 | ||
11229 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND)) | |
11230 | json_object_boolean_true_add(json_neigh, "localAsNoPrepend"); | |
66b199b2 | 11231 | |
856ca177 MS |
11232 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS)) |
11233 | json_object_boolean_true_add(json_neigh, "localAsReplaceAs"); | |
11234 | } | |
11235 | else | |
11236 | { | |
f8cfafda DS |
11237 | if ((p->as_type == AS_SPECIFIED) || |
11238 | (p->as_type == AS_EXTERNAL) || | |
11239 | (p->as_type == AS_INTERNAL)) | |
11240 | vty_out (vty, "remote AS %u, ", p->as); | |
11241 | else | |
11242 | vty_out (vty, "remote AS Unspecified, "); | |
856ca177 MS |
11243 | vty_out (vty, "local AS %u%s%s, ", |
11244 | p->change_local_as ? p->change_local_as : p->local_as, | |
11245 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
11246 | " no-prepend" : "", | |
11247 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
11248 | " replace-as" : ""); | |
11249 | } | |
66b199b2 DS |
11250 | /* peer type internal, external, confed-internal or confed-external */ |
11251 | if (p->as == p->local_as) | |
11252 | { | |
856ca177 MS |
11253 | if (use_json) |
11254 | { | |
11255 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11256 | json_object_boolean_true_add(json_neigh, "nbrConfedInternalLink"); | |
11257 | else | |
11258 | json_object_boolean_true_add(json_neigh, "nbrInternalLink"); | |
11259 | } | |
66b199b2 | 11260 | else |
856ca177 MS |
11261 | { |
11262 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11263 | vty_out (vty, "confed-internal link%s", VTY_NEWLINE); | |
11264 | else | |
11265 | vty_out (vty, "internal link%s", VTY_NEWLINE); | |
11266 | } | |
66b199b2 DS |
11267 | } |
11268 | else | |
11269 | { | |
856ca177 MS |
11270 | if (use_json) |
11271 | { | |
11272 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11273 | json_object_boolean_true_add(json_neigh, "nbrConfedExternalLink"); | |
11274 | else | |
11275 | json_object_boolean_true_add(json_neigh, "nbrExternalLink"); | |
11276 | } | |
66b199b2 | 11277 | else |
856ca177 MS |
11278 | { |
11279 | if (bgp_confederation_peers_check(bgp, p->as)) | |
11280 | vty_out (vty, "confed-external link%s", VTY_NEWLINE); | |
11281 | else | |
11282 | vty_out (vty, "external link%s", VTY_NEWLINE); | |
11283 | } | |
66b199b2 | 11284 | } |
718e3744 | 11285 | |
11286 | /* Description. */ | |
11287 | if (p->desc) | |
856ca177 MS |
11288 | { |
11289 | if (use_json) | |
11290 | json_object_string_add(json_neigh, "nbrDesc", p->desc); | |
11291 | else | |
11292 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
11293 | } | |
6410e93a | 11294 | |
04b6bdc0 DW |
11295 | if (p->hostname) |
11296 | { | |
d1570739 DW |
11297 | if (use_json) |
11298 | { | |
11299 | if (p->hostname) | |
11300 | json_object_string_add(json_neigh, "hostname", p->hostname); | |
11301 | ||
11302 | if (p->domainname) | |
11303 | json_object_string_add(json_neigh, "domainname", p->domainname); | |
11304 | } | |
04b6bdc0 | 11305 | else |
d1570739 DW |
11306 | { |
11307 | if (p->domainname && (p->domainname[0] != '\0')) | |
11308 | vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname, | |
11309 | VTY_NEWLINE); | |
11310 | else | |
11311 | vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE); | |
11312 | } | |
11313 | ||
04b6bdc0 DW |
11314 | } |
11315 | ||
c744aa9f | 11316 | /* Peer-group */ |
718e3744 | 11317 | if (p->group) |
f14e6fdb | 11318 | { |
856ca177 MS |
11319 | if (use_json) |
11320 | { | |
11321 | json_object_string_add(json_neigh, "peerGroup", p->group->name); | |
11322 | ||
11323 | if (dn_flag[0]) | |
11324 | { | |
40ee54a7 | 11325 | struct prefix prefix, *range = NULL; |
f14e6fdb | 11326 | |
40ee54a7 TT |
11327 | sockunion2hostprefix(&(p->su), &prefix); |
11328 | range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix); | |
856ca177 MS |
11329 | |
11330 | if (range) | |
11331 | { | |
11332 | prefix2str(range, buf1, sizeof(buf1)); | |
11333 | json_object_string_add(json_neigh, "peerSubnetRangeGroup", buf1); | |
11334 | } | |
11335 | } | |
11336 | } | |
11337 | else | |
f14e6fdb | 11338 | { |
856ca177 MS |
11339 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
11340 | p->group->name, VTY_NEWLINE); | |
f14e6fdb | 11341 | |
856ca177 | 11342 | if (dn_flag[0]) |
f14e6fdb | 11343 | { |
40ee54a7 | 11344 | struct prefix prefix, *range = NULL; |
856ca177 | 11345 | |
40ee54a7 TT |
11346 | sockunion2hostprefix(&(p->su), &prefix); |
11347 | range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix); | |
856ca177 MS |
11348 | |
11349 | if (range) | |
11350 | { | |
11351 | prefix2str(range, buf1, sizeof(buf1)); | |
11352 | vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTY_NEWLINE); | |
11353 | } | |
f14e6fdb DS |
11354 | } |
11355 | } | |
11356 | } | |
718e3744 | 11357 | |
856ca177 MS |
11358 | if (use_json) |
11359 | { | |
11360 | /* Administrative shutdown. */ | |
11361 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
11362 | json_object_boolean_true_add(json_neigh, "adminShutDown"); | |
718e3744 | 11363 | |
856ca177 MS |
11364 | /* BGP Version. */ |
11365 | json_object_int_add(json_neigh, "bgpVersion", 4); | |
11366 | json_object_string_add(json_neigh, "remoteRouterId", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ)); | |
718e3744 | 11367 | |
856ca177 MS |
11368 | /* Confederation */ |
11369 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) && bgp_confederation_peers_check (bgp, p->as)) | |
11370 | json_object_boolean_true_add(json_neigh, "nbrCommonAdmin"); | |
11371 | ||
11372 | /* Status. */ | |
11373 | json_object_string_add(json_neigh, "bgpState", LOOKUP (bgp_status_msg, p->status)); | |
11374 | ||
11375 | if (p->status == Established) | |
11376 | { | |
11377 | time_t uptime; | |
11378 | struct tm *tm; | |
11379 | ||
11380 | uptime = bgp_clock(); | |
11381 | uptime -= p->uptime; | |
11382 | tm = gmtime(&uptime); | |
11383 | ||
11384 | json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
11385 | } | |
11386 | ||
11387 | else if (p->status == Active) | |
11388 | { | |
11389 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
11390 | json_object_string_add(json_neigh, "bgpStateIs", "passive"); | |
11391 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
11392 | json_object_string_add(json_neigh, "bgpStateIs", "passiveNSF"); | |
11393 | } | |
11394 | ||
11395 | /* read timer */ | |
11396 | time_t uptime; | |
11397 | struct tm *tm; | |
11398 | ||
11399 | uptime = bgp_clock(); | |
11400 | uptime -= p->readtime; | |
11401 | tm = gmtime(&uptime); | |
11402 | json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
11403 | ||
11404 | uptime = bgp_clock(); | |
11405 | uptime -= p->last_write; | |
11406 | tm = gmtime(&uptime); | |
11407 | json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
11408 | ||
11409 | /* Configured timer values. */ | |
11410 | json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs", p->v_holdtime * 1000); | |
11411 | json_object_int_add(json_neigh, "bgpTimerKeepAliveIntervalMsecs", p->v_keepalive * 1000); | |
11412 | ||
11413 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
11414 | { | |
11415 | json_object_int_add(json_neigh, "bgpTimerConfiguredHoldTimeMsecs", p->holdtime * 1000); | |
11416 | json_object_int_add(json_neigh, "bgpTimerConfiguredKeepAliveIntervalMsecs", p->keepalive * 1000); | |
11417 | } | |
93406d87 | 11418 | } |
856ca177 MS |
11419 | else |
11420 | { | |
11421 | /* Administrative shutdown. */ | |
11422 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
11423 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
11424 | ||
11425 | /* BGP Version. */ | |
11426 | vty_out (vty, " BGP version 4"); | |
11427 | vty_out (vty, ", remote router ID %s%s", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
11428 | VTY_NEWLINE); | |
11429 | ||
11430 | /* Confederation */ | |
11431 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) | |
11432 | && bgp_confederation_peers_check (bgp, p->as)) | |
11433 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); | |
718e3744 | 11434 | |
856ca177 MS |
11435 | /* Status. */ |
11436 | vty_out (vty, " BGP state = %s", LOOKUP (bgp_status_msg, p->status)); | |
718e3744 | 11437 | |
856ca177 MS |
11438 | if (p->status == Established) |
11439 | vty_out (vty, ", up for %8s", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
11440 | ||
11441 | else if (p->status == Active) | |
11442 | { | |
11443 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
11444 | vty_out (vty, " (passive)"); | |
11445 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
11446 | vty_out (vty, " (NSF passive)"); | |
11447 | } | |
11448 | vty_out (vty, "%s", VTY_NEWLINE); | |
93406d87 | 11449 | |
856ca177 MS |
11450 | /* read timer */ |
11451 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
11452 | vty_out (vty, ", Last write %s%s", | |
11453 | peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTY_NEWLINE); | |
11454 | ||
11455 | /* Configured timer values. */ | |
11456 | vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s", | |
11457 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); | |
11458 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
11459 | { | |
11460 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
11461 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
11462 | p->keepalive, VTY_NEWLINE); | |
11463 | } | |
11464 | } | |
718e3744 | 11465 | /* Capability. */ |
11466 | if (p->status == Established) | |
11467 | { | |
538621f2 | 11468 | if (p->cap |
718e3744 | 11469 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
11470 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
11471 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
11472 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
11473 | #ifdef HAVE_IPV6 | |
11474 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
11475 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
11476 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
11477 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
945c8fe9 LB |
11478 | || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN] |
11479 | || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN] | |
718e3744 | 11480 | #endif /* HAVE_IPV6 */ |
11481 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] | |
11482 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
11483 | { | |
856ca177 MS |
11484 | if (use_json) |
11485 | { | |
11486 | json_object *json_cap = NULL; | |
11487 | ||
11488 | json_cap = json_object_new_object(); | |
11489 | ||
11490 | /* AS4 */ | |
11491 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
11492 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11493 | { | |
11494 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) && CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11495 | json_object_string_add(json_cap, "4byteAs", "advertisedAndReceived"); | |
11496 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11497 | json_object_string_add(json_cap, "4byteAs", "advertised"); | |
11498 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11499 | json_object_string_add(json_cap, "4byteAs", "received"); | |
11500 | } | |
11501 | ||
11502 | /* AddPath */ | |
11503 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
11504 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
11505 | { | |
11506 | json_object *json_add = NULL; | |
11507 | const char *print_store; | |
718e3744 | 11508 | |
856ca177 | 11509 | json_add = json_object_new_object(); |
a82478b9 | 11510 | |
856ca177 MS |
11511 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
11512 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11513 | { | |
11514 | json_object *json_sub = NULL; | |
11515 | json_sub = json_object_new_object(); | |
11516 | print_store = afi_safi_print (afi, safi); | |
11517 | ||
11518 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
11519 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11520 | { | |
11521 | 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)) | |
11522 | json_object_boolean_true_add(json_sub, "txAdvertisedAndReceived"); | |
11523 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) | |
11524 | json_object_boolean_true_add(json_sub, "txAdvertised"); | |
11525 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11526 | json_object_boolean_true_add(json_sub, "txReceived"); | |
11527 | } | |
11528 | ||
11529 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
11530 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11531 | { | |
11532 | 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)) | |
11533 | json_object_boolean_true_add(json_sub, "rxAdvertisedAndReceived"); | |
11534 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) | |
11535 | json_object_boolean_true_add(json_sub, "rxAdvertised"); | |
11536 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11537 | json_object_boolean_true_add(json_sub, "rxReceived"); | |
11538 | } | |
11539 | ||
11540 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
11541 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV) || | |
11542 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
11543 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11544 | json_object_object_add(json_add, print_store, json_sub); | |
11545 | } | |
a82478b9 | 11546 | |
856ca177 MS |
11547 | json_object_object_add(json_cap, "addPath", json_add); |
11548 | } | |
11549 | ||
11550 | /* Dynamic */ | |
11551 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
11552 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11553 | { | |
11554 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) && CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11555 | json_object_string_add(json_cap, "dynamic", "advertisedAndReceived"); | |
11556 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11557 | json_object_string_add(json_cap, "dynamic", "advertised"); | |
11558 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11559 | json_object_string_add(json_cap, "dynamic", "received"); | |
11560 | } | |
11561 | ||
11562 | /* Extended nexthop */ | |
11563 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
11564 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11565 | { | |
11566 | json_object *json_nxt = NULL; | |
11567 | const char *print_store; | |
11568 | ||
11569 | json_nxt = json_object_new_object(); | |
11570 | ||
11571 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) && CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11572 | json_object_string_add(json_cap, "extendedNexthop", "advertisedAndReceived"); | |
11573 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11574 | json_object_string_add(json_cap, "extendedNexthop", "advertised"); | |
11575 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11576 | json_object_string_add(json_cap, "extendedNexthop", "received"); | |
11577 | ||
11578 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11579 | { | |
11580 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11581 | { | |
11582 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
11583 | { | |
11584 | print_store = afi_safi_print (AFI_IP, safi); | |
11585 | json_object_string_add(json_nxt, print_store, "recieved"); | |
11586 | } | |
11587 | } | |
11588 | json_object_object_add(json_cap, "extendedNexthopFamililesByPeer", json_nxt); | |
11589 | } | |
11590 | } | |
11591 | ||
11592 | /* Route Refresh */ | |
11593 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
11594 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11595 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11596 | { | |
11597 | 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))) | |
11598 | { | |
11599 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) | |
11600 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOldNew"); | |
11601 | else | |
11602 | { | |
11603 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11604 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOld"); | |
11605 | else | |
11606 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedNew"); | |
11607 | } | |
11608 | } | |
11609 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
11610 | json_object_string_add(json_cap, "routeRefresh", "advertised"); | |
11611 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11612 | json_object_string_add(json_cap, "routeRefresh", "received"); | |
11613 | } | |
11614 | ||
11615 | /* Multiprotocol Extensions */ | |
11616 | json_object *json_multi = NULL; | |
11617 | json_multi = json_object_new_object(); | |
11618 | ||
11619 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11620 | { | |
11621 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11622 | { | |
11623 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
11624 | { | |
11625 | json_object *json_exten = NULL; | |
11626 | json_exten = json_object_new_object(); | |
11627 | ||
11628 | if (p->afc_adv[afi][safi] && p->afc_recv[afi][safi]) | |
11629 | json_object_boolean_true_add(json_exten, "advertisedAndReceived"); | |
11630 | else if (p->afc_adv[afi][safi]) | |
11631 | json_object_boolean_true_add(json_exten, "advertised"); | |
11632 | else if (p->afc_recv[afi][safi]) | |
11633 | json_object_boolean_true_add(json_exten, "received"); | |
11634 | ||
11635 | json_object_object_add(json_multi, afi_safi_print (afi, safi), json_exten); | |
11636 | } | |
11637 | } | |
11638 | } | |
11639 | json_object_object_add(json_cap, "multiprotocolExtensions", json_multi); | |
11640 | ||
11641 | /* Gracefull Restart */ | |
11642 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
11643 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
11644 | { | |
11645 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) && CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
11646 | json_object_string_add(json_cap, "gracefulRestart", "advertisedAndReceived"); | |
11647 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
11648 | json_object_string_add(json_cap, "gracefulRestartCapability", "advertised"); | |
11649 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
11650 | json_object_string_add(json_cap, "gracefulRestartCapability", "received"); | |
11651 | ||
11652 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
11653 | { | |
11654 | int restart_af_count = 0; | |
11655 | json_object *json_restart = NULL; | |
11656 | json_restart = json_object_new_object(); | |
11657 | ||
11658 | json_object_int_add(json_cap, "gracefulRestartRemoteTimerMsecs", p->v_gr_restart * 1000); | |
11659 | ||
11660 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11661 | { | |
11662 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11663 | { | |
11664 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
11665 | { | |
11666 | json_object *json_sub = NULL; | |
11667 | json_sub = json_object_new_object(); | |
11668 | ||
11669 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV)) | |
11670 | json_object_boolean_true_add(json_sub, "preserved"); | |
11671 | restart_af_count++; | |
11672 | json_object_object_add(json_restart, afi_safi_print (afi, safi), json_sub); | |
11673 | } | |
11674 | } | |
11675 | } | |
11676 | if (! restart_af_count) | |
11677 | json_object_string_add(json_cap, "addressFamiliesByPeer", "none"); | |
11678 | else | |
11679 | json_object_object_add(json_cap, "addressFamiliesByPeer", json_restart); | |
11680 | } | |
11681 | } | |
11682 | json_object_object_add(json_neigh, "neighborCapabilities", json_cap); | |
11683 | } | |
11684 | else | |
11685 | { | |
11686 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
11687 | ||
11688 | /* AS4 */ | |
11689 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
11690 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11691 | { | |
11692 | vty_out (vty, " 4 Byte AS:"); | |
11693 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11694 | vty_out (vty, " advertised"); | |
11695 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11696 | vty_out (vty, " %sreceived", | |
11697 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
11698 | vty_out (vty, "%s", VTY_NEWLINE); | |
11699 | } | |
11700 | ||
11701 | /* AddPath */ | |
11702 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
11703 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
11704 | { | |
11705 | vty_out (vty, " AddPath:%s", VTY_NEWLINE); | |
a82478b9 | 11706 | |
856ca177 MS |
11707 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
11708 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
a82478b9 | 11709 | { |
856ca177 MS |
11710 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || |
11711 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11712 | { | |
11713 | vty_out (vty, " %s: TX ", afi_safi_print (afi, safi)); | |
a82478b9 | 11714 | |
856ca177 MS |
11715 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) |
11716 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 11717 | |
856ca177 MS |
11718 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) |
11719 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" ); | |
a82478b9 | 11720 | |
856ca177 MS |
11721 | vty_out (vty, "%s", VTY_NEWLINE); |
11722 | } | |
a82478b9 | 11723 | |
856ca177 | 11724 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || |
a82478b9 | 11725 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
856ca177 MS |
11726 | { |
11727 | vty_out (vty, " %s: RX ", afi_safi_print (afi, safi)); | |
a82478b9 | 11728 | |
856ca177 MS |
11729 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) |
11730 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 11731 | |
856ca177 MS |
11732 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
11733 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" ); | |
a82478b9 | 11734 | |
856ca177 MS |
11735 | vty_out (vty, "%s", VTY_NEWLINE); |
11736 | } | |
a82478b9 | 11737 | } |
856ca177 | 11738 | } |
a82478b9 | 11739 | |
856ca177 MS |
11740 | /* Dynamic */ |
11741 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
11742 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11743 | { | |
11744 | vty_out (vty, " Dynamic:"); | |
11745 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11746 | vty_out (vty, " advertised"); | |
11747 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11748 | vty_out (vty, " %sreceived", | |
11749 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
11750 | vty_out (vty, "%s", VTY_NEWLINE); | |
11751 | } | |
11752 | ||
11753 | /* Extended nexthop */ | |
11754 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
11755 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11756 | { | |
11757 | vty_out (vty, " Extended nexthop:"); | |
11758 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11759 | vty_out (vty, " advertised"); | |
11760 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11761 | vty_out (vty, " %sreceived", | |
11762 | CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) ? "and " : ""); | |
11763 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 11764 | |
856ca177 MS |
11765 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) |
11766 | { | |
11767 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
11768 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11769 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
11770 | vty_out (vty, " %s%s", | |
11771 | afi_safi_print (AFI_IP, safi), VTY_NEWLINE); | |
11772 | } | |
11773 | } | |
8a92a8a0 | 11774 | |
856ca177 MS |
11775 | /* Route Refresh */ |
11776 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
11777 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11778 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11779 | { | |
11780 | vty_out (vty, " Route refresh:"); | |
11781 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
11782 | vty_out (vty, " advertised"); | |
11783 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11784 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11785 | vty_out (vty, " %sreceived(%s)", | |
11786 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
11787 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
11788 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
11789 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
8a92a8a0 | 11790 | |
856ca177 MS |
11791 | vty_out (vty, "%s", VTY_NEWLINE); |
11792 | } | |
718e3744 | 11793 | |
856ca177 MS |
11794 | /* Multiprotocol Extensions */ |
11795 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11796 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11797 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
11798 | { | |
11799 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); | |
11800 | if (p->afc_adv[afi][safi]) | |
11801 | vty_out (vty, " advertised"); | |
11802 | if (p->afc_recv[afi][safi]) | |
11803 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
11804 | vty_out (vty, "%s", VTY_NEWLINE); | |
11805 | } | |
538621f2 | 11806 | |
04b6bdc0 DW |
11807 | /* Hostname capability */ |
11808 | if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV) || | |
11809 | CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) | |
11810 | { | |
11811 | vty_out (vty, " Hostname Capability:"); | |
11812 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV)) | |
11813 | vty_out (vty, " advertised"); | |
11814 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_RCV)) | |
11815 | vty_out (vty, " %sreceived", | |
11816 | CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV) ? "and " : ""); | |
11817 | vty_out (vty, "%s", VTY_NEWLINE); | |
11818 | } | |
11819 | ||
856ca177 MS |
11820 | /* Gracefull Restart */ |
11821 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
11822 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
11823 | { | |
11824 | vty_out (vty, " Graceful Restart Capabilty:"); | |
11825 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
538621f2 | 11826 | vty_out (vty, " advertised"); |
856ca177 MS |
11827 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
11828 | vty_out (vty, " %sreceived", | |
11829 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
11830 | vty_out (vty, "%s", VTY_NEWLINE); | |
538621f2 | 11831 | |
856ca177 MS |
11832 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
11833 | { | |
11834 | int restart_af_count = 0; | |
11835 | ||
11836 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
11837 | p->v_gr_restart, VTY_NEWLINE); | |
11838 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
11839 | ||
11840 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11841 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11842 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
11843 | { | |
11844 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", | |
11845 | afi_safi_print (afi, safi), | |
11846 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
11847 | "preserved" : "not preserved"); | |
11848 | restart_af_count++; | |
11849 | } | |
11850 | if (! restart_af_count) | |
11851 | vty_out (vty, "none"); | |
11852 | vty_out (vty, "%s", VTY_NEWLINE); | |
11853 | } | |
11854 | } | |
11855 | } | |
718e3744 | 11856 | } |
11857 | } | |
11858 | ||
93406d87 | 11859 | /* graceful restart information */ |
11860 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
11861 | || p->t_gr_restart | |
11862 | || p->t_gr_stale) | |
11863 | { | |
856ca177 MS |
11864 | json_object *json_grace = NULL; |
11865 | json_object *json_grace_send = NULL; | |
11866 | json_object *json_grace_recv = NULL; | |
93406d87 | 11867 | int eor_send_af_count = 0; |
11868 | int eor_receive_af_count = 0; | |
11869 | ||
856ca177 MS |
11870 | if (use_json) |
11871 | { | |
11872 | json_grace = json_object_new_object(); | |
11873 | json_grace_send = json_object_new_object(); | |
11874 | json_grace_recv = json_object_new_object(); | |
11875 | ||
11876 | if (p->status == Established) | |
11877 | { | |
11878 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11879 | { | |
11880 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11881 | { | |
11882 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
11883 | { | |
11884 | json_object_boolean_true_add(json_grace_send, afi_safi_print (afi, safi)); | |
11885 | eor_send_af_count++; | |
11886 | } | |
11887 | } | |
11888 | } | |
11889 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11890 | { | |
11891 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11892 | { | |
11893 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
11894 | { | |
11895 | json_object_boolean_true_add(json_grace_recv, afi_safi_print (afi, safi)); | |
11896 | eor_receive_af_count++; | |
11897 | } | |
11898 | } | |
11899 | } | |
11900 | } | |
11901 | ||
11902 | json_object_object_add(json_grace, "endOfRibSend", json_grace_send); | |
11903 | json_object_object_add(json_grace, "endOfRibRecv", json_grace_recv); | |
11904 | ||
11905 | if (p->t_gr_restart) | |
11906 | json_object_int_add(json_grace, "gracefulRestartTimerMsecs", thread_timer_remain_second (p->t_gr_restart) * 1000); | |
11907 | ||
11908 | if (p->t_gr_stale) | |
11909 | json_object_int_add(json_grace, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p->t_gr_stale) * 1000); | |
11910 | ||
11911 | json_object_object_add(json_neigh, "gracefulRestartInfo", json_grace); | |
11912 | } | |
11913 | else | |
11914 | { | |
11915 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
11916 | if (p->status == Established) | |
11917 | { | |
11918 | vty_out (vty, " End-of-RIB send: "); | |
11919 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11920 | { | |
11921 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11922 | { | |
11923 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
11924 | { | |
11925 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
11926 | afi_safi_print (afi, safi)); | |
11927 | eor_send_af_count++; | |
11928 | } | |
11929 | } | |
11930 | } | |
11931 | vty_out (vty, "%s", VTY_NEWLINE); | |
11932 | vty_out (vty, " End-of-RIB received: "); | |
11933 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
11934 | { | |
11935 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11936 | { | |
11937 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
11938 | { | |
11939 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
11940 | afi_safi_print (afi, safi)); | |
11941 | eor_receive_af_count++; | |
11942 | } | |
11943 | } | |
11944 | } | |
11945 | vty_out (vty, "%s", VTY_NEWLINE); | |
11946 | } | |
93406d87 | 11947 | |
856ca177 MS |
11948 | if (p->t_gr_restart) |
11949 | vty_out (vty, " The remaining time of restart timer is %ld%s", | |
11950 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
0b2aa3a0 | 11951 | |
856ca177 MS |
11952 | if (p->t_gr_stale) |
11953 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", | |
11954 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
11955 | } | |
11956 | } | |
11957 | if (use_json) | |
11958 | { | |
11959 | json_object *json_stat = NULL; | |
11960 | json_stat = json_object_new_object(); | |
11961 | /* Packet counts. */ | |
11962 | json_object_int_add(json_stat, "depthInq", 0); | |
11963 | json_object_int_add(json_stat, "depthOutq", (unsigned long) p->obuf->count); | |
11964 | json_object_int_add(json_stat, "opensSent", p->open_out); | |
11965 | json_object_int_add(json_stat, "opensRecv", p->open_in); | |
11966 | json_object_int_add(json_stat, "notificationsSent", p->notify_out); | |
11967 | json_object_int_add(json_stat, "notificationsRecv", p->notify_in); | |
11968 | json_object_int_add(json_stat, "updatesSent", p->update_out); | |
11969 | json_object_int_add(json_stat, "updatesRecv", p->update_in); | |
11970 | json_object_int_add(json_stat, "keepalivesSent", p->keepalive_out); | |
11971 | json_object_int_add(json_stat, "keepalivesRecv", p->keepalive_in); | |
11972 | json_object_int_add(json_stat, "routeRefreshSent", p->refresh_out); | |
11973 | json_object_int_add(json_stat, "routeRefreshRecv", p->refresh_in); | |
11974 | json_object_int_add(json_stat, "capabilitySent", p->dynamic_cap_out); | |
11975 | json_object_int_add(json_stat, "capabilityRecv", p->dynamic_cap_in); | |
11976 | 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); | |
11977 | 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); | |
11978 | json_object_object_add(json_neigh, "messageStats", json_stat); | |
11979 | } | |
11980 | else | |
11981 | { | |
11982 | /* Packet counts. */ | |
11983 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); | |
11984 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
11985 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); | |
11986 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); | |
11987 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
11988 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
11989 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
11990 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
11991 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
11992 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
11993 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
11994 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
11995 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
11996 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 11997 | } |
11998 | ||
856ca177 MS |
11999 | if (use_json) |
12000 | { | |
12001 | /* advertisement-interval */ | |
12002 | json_object_int_add(json_neigh, "minBtwnAdvertisementRunsTimerMsecs", p->v_routeadv * 1000); | |
718e3744 | 12003 | |
856ca177 MS |
12004 | /* Update-source. */ |
12005 | if (p->update_if || p->update_source) | |
12006 | { | |
12007 | if (p->update_if) | |
12008 | json_object_string_add(json_neigh, "updateSource", p->update_if); | |
12009 | else if (p->update_source) | |
12010 | json_object_string_add(json_neigh, "updateSource", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
12011 | } | |
12012 | ||
12013 | /* Default weight */ | |
12014 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
12015 | json_object_int_add(json_neigh, "defaultWeight", p->weight); | |
12016 | ||
12017 | } | |
12018 | else | |
12019 | { | |
12020 | /* advertisement-interval */ | |
12021 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
12022 | p->v_routeadv, VTY_NEWLINE); | |
12023 | ||
12024 | /* Update-source. */ | |
12025 | if (p->update_if || p->update_source) | |
12026 | { | |
12027 | vty_out (vty, " Update source is "); | |
12028 | if (p->update_if) | |
12029 | vty_out (vty, "%s", p->update_if); | |
12030 | else if (p->update_source) | |
12031 | vty_out (vty, "%s", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
12032 | vty_out (vty, "%s", VTY_NEWLINE); | |
12033 | } | |
12034 | ||
12035 | /* Default weight */ | |
12036 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
12037 | vty_out (vty, " Default weight %d%s", p->weight, VTY_NEWLINE); | |
12038 | ||
12039 | vty_out (vty, "%s", VTY_NEWLINE); | |
12040 | } | |
718e3744 | 12041 | |
12042 | /* Address Family Information */ | |
856ca177 MS |
12043 | json_object *json_hold = NULL; |
12044 | ||
12045 | if (use_json) | |
12046 | json_hold = json_object_new_object(); | |
12047 | ||
538621f2 | 12048 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
12049 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12050 | if (p->afc[afi][safi]) | |
856ca177 | 12051 | bgp_show_peer_afi (vty, p, afi, safi, use_json, json_hold); |
718e3744 | 12052 | |
856ca177 MS |
12053 | if (use_json) |
12054 | { | |
12055 | json_object_int_add(json_hold, "connectionsEstablished", p->established); | |
12056 | json_object_int_add(json_hold, "connectionsDropped", p->dropped); | |
12057 | } | |
12058 | else | |
12059 | vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped, | |
12060 | VTY_NEWLINE); | |
718e3744 | 12061 | |
d6661008 | 12062 | if (! p->last_reset) |
856ca177 MS |
12063 | { |
12064 | if (use_json) | |
12065 | json_object_string_add(json_hold, "lastReset", "never"); | |
12066 | else | |
12067 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); | |
12068 | } | |
e0701b79 | 12069 | else |
d6661008 | 12070 | { |
856ca177 MS |
12071 | if (use_json) |
12072 | { | |
12073 | time_t uptime; | |
12074 | struct tm *tm; | |
12075 | ||
12076 | uptime = bgp_clock(); | |
12077 | uptime -= p->resettime; | |
12078 | tm = gmtime(&uptime); | |
12079 | json_object_int_add(json_hold, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
12080 | json_object_string_add(json_hold, "lastResetDueTo", peer_down_str[(int) p->last_reset]); | |
12081 | if (p->last_reset_cause_size) | |
12082 | { | |
12083 | msg = p->last_reset_cause; | |
12084 | char adapter[BUFSIZ]; | |
12085 | sprintf(adapter, "%s", msg); | |
12086 | json_object_string_add(json_hold, "messageReceivedThatCausedBgpNotification", adapter); | |
12087 | } | |
12088 | } | |
12089 | else | |
d6661008 | 12090 | { |
3a8c7ba1 DW |
12091 | vty_out (vty, " Last reset %s, ", |
12092 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
12093 | ||
12094 | if (p->last_reset == PEER_DOWN_NOTIFY_SEND || | |
12095 | p->last_reset == PEER_DOWN_NOTIFY_RECEIVED) | |
12096 | { | |
12097 | code_str = bgp_notify_code_str(p->notify.code); | |
12098 | subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode); | |
12099 | vty_out (vty, "due to NOTIFICATION %s (%s%s)%s", | |
12100 | p->last_reset == PEER_DOWN_NOTIFY_SEND ? "sent" : "received", | |
12101 | code_str, subcode_str, VTY_NEWLINE); | |
12102 | } | |
12103 | else | |
12104 | { | |
12105 | vty_out (vty, "due to %s%s", | |
12106 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
12107 | } | |
856ca177 MS |
12108 | |
12109 | if (p->last_reset_cause_size) | |
d6661008 | 12110 | { |
856ca177 MS |
12111 | msg = p->last_reset_cause; |
12112 | vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); | |
12113 | for (i = 1; i <= p->last_reset_cause_size; i++) | |
12114 | { | |
12115 | vty_out(vty, "%02X", *msg++); | |
d6661008 | 12116 | |
856ca177 MS |
12117 | if (i != p->last_reset_cause_size) |
12118 | { | |
12119 | if (i % 16 == 0) | |
12120 | { | |
12121 | vty_out(vty, "%s ", VTY_NEWLINE); | |
12122 | } | |
12123 | else if (i % 4 == 0) | |
12124 | { | |
12125 | vty_out(vty, " "); | |
12126 | } | |
12127 | } | |
12128 | } | |
12129 | vty_out(vty, "%s", VTY_NEWLINE); | |
d6661008 | 12130 | } |
d6661008 DS |
12131 | } |
12132 | } | |
848973c7 | 12133 | |
718e3744 | 12134 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
12135 | { | |
856ca177 MS |
12136 | if (use_json) |
12137 | json_object_boolean_true_add(json_hold, "prefixesConfigExceedMax"); | |
12138 | else | |
12139 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 12140 | |
12141 | if (p->t_pmax_restart) | |
856ca177 MS |
12142 | { |
12143 | if (use_json) | |
12144 | { | |
e8f7da3a | 12145 | json_object_boolean_true_add(json_hold, "reducePrefixNumFrom"); |
856ca177 MS |
12146 | json_object_int_add(json_hold, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); |
12147 | } | |
12148 | else | |
12149 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
12150 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
12151 | VTY_NEWLINE); | |
12152 | } | |
0a486e5f | 12153 | else |
856ca177 MS |
12154 | { |
12155 | if (use_json) | |
e8f7da3a | 12156 | json_object_boolean_true_add(json_hold, "reducePrefixNumAndClearIpBgp"); |
856ca177 MS |
12157 | else |
12158 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
12159 | p->host, VTY_NEWLINE); | |
12160 | } | |
718e3744 | 12161 | } |
12162 | ||
856ca177 MS |
12163 | if (use_json) |
12164 | json_object_object_add(json_neigh, "addressFamilyInfo", json_hold); | |
12165 | ||
f5a4827d | 12166 | /* EBGP Multihop and GTSM */ |
6d85b15b | 12167 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d | 12168 | { |
856ca177 MS |
12169 | if (use_json) |
12170 | { | |
12171 | if (p->gtsm_hops > 0) | |
12172 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->gtsm_hops); | |
12173 | else if (p->ttl > 1) | |
12174 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->ttl); | |
12175 | } | |
12176 | else | |
12177 | { | |
12178 | if (p->gtsm_hops > 0) | |
12179 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
12180 | p->gtsm_hops, VTY_NEWLINE); | |
12181 | else if (p->ttl > 1) | |
12182 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
12183 | p->ttl, VTY_NEWLINE); | |
12184 | } | |
f5a4827d | 12185 | } |
5d804b43 PM |
12186 | else |
12187 | { | |
12188 | if (p->gtsm_hops > 0) | |
856ca177 MS |
12189 | { |
12190 | if (use_json) | |
12191 | json_object_int_add(json_neigh, "internalBgpNbrMaxHopsAway", p->gtsm_hops); | |
12192 | else | |
12193 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
12194 | p->gtsm_hops, VTY_NEWLINE); | |
12195 | } | |
5d804b43 | 12196 | } |
718e3744 | 12197 | |
12198 | /* Local address. */ | |
12199 | if (p->su_local) | |
12200 | { | |
856ca177 MS |
12201 | if (use_json) |
12202 | { | |
12203 | json_object_string_add(json_neigh, "hostLocal", sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN)); | |
12204 | json_object_int_add(json_neigh, "portLocal", ntohs (p->su_local->sin.sin_port)); | |
12205 | } | |
12206 | else | |
12207 | vty_out (vty, "Local host: %s, Local port: %d%s", | |
12208 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), | |
12209 | ntohs (p->su_local->sin.sin_port), | |
12210 | VTY_NEWLINE); | |
718e3744 | 12211 | } |
12212 | ||
12213 | /* Remote address. */ | |
12214 | if (p->su_remote) | |
12215 | { | |
856ca177 MS |
12216 | if (use_json) |
12217 | { | |
12218 | json_object_string_add(json_neigh, "hostForeign", sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN)); | |
12219 | json_object_int_add(json_neigh, "portForeign", ntohs (p->su_remote->sin.sin_port)); | |
12220 | } | |
12221 | else | |
12222 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
718e3744 | 12223 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
12224 | ntohs (p->su_remote->sin.sin_port), | |
12225 | VTY_NEWLINE); | |
12226 | } | |
12227 | ||
12228 | /* Nexthop display. */ | |
12229 | if (p->su_local) | |
12230 | { | |
856ca177 MS |
12231 | if (use_json) |
12232 | { | |
12233 | json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ)); | |
718e3744 | 12234 | #ifdef HAVE_IPV6 |
856ca177 MS |
12235 | json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ)); |
12236 | json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ)); | |
12237 | if (p->shared_network) | |
12238 | json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork"); | |
12239 | else | |
12240 | json_object_string_add(json_neigh, "bgpConnection", "nonSharedNetwork"); | |
12241 | #endif /* HAVE_IPV6 */ | |
12242 | } | |
12243 | else | |
12244 | { | |
12245 | vty_out (vty, "Nexthop: %s%s", | |
12246 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
12247 | VTY_NEWLINE); | |
12248 | #ifdef HAVE_IPV6 | |
12249 | vty_out (vty, "Nexthop global: %s%s", | |
12250 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
12251 | VTY_NEWLINE); | |
12252 | vty_out (vty, "Nexthop local: %s%s", | |
12253 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
12254 | VTY_NEWLINE); | |
12255 | vty_out (vty, "BGP connection: %s%s", | |
12256 | p->shared_network ? "shared network" : "non shared network", | |
12257 | VTY_NEWLINE); | |
718e3744 | 12258 | #endif /* HAVE_IPV6 */ |
856ca177 | 12259 | } |
718e3744 | 12260 | } |
12261 | ||
12262 | /* Timer information. */ | |
856ca177 MS |
12263 | if (use_json) |
12264 | { | |
dd9275d6 ST |
12265 | if (p->status == Established && p->rtt) |
12266 | json_object_int_add(json_neigh, "estimatedRttInMsecs", p->rtt); | |
856ca177 MS |
12267 | if (p->t_start) |
12268 | json_object_int_add(json_neigh, "nextStartTimerDueInMsecs", thread_timer_remain_second (p->t_start) * 1000); | |
12269 | if (p->t_connect) | |
12270 | json_object_int_add(json_neigh, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p->t_connect) * 1000); | |
12271 | if (p->t_routeadv) | |
12272 | { | |
12273 | json_object_int_add(json_neigh, "mraiInterval", p->v_routeadv); | |
12274 | json_object_int_add(json_neigh, "mraiTimerExpireInMsecs", thread_timer_remain_second (p->t_routeadv) * 1000); | |
12275 | } | |
cb1faec9 | 12276 | |
856ca177 MS |
12277 | if (p->t_read) |
12278 | json_object_string_add(json_neigh, "readThread", "on"); | |
12279 | else | |
12280 | json_object_string_add(json_neigh, "readThread", "off"); | |
12281 | if (p->t_write) | |
12282 | json_object_string_add(json_neigh, "writeThread", "on"); | |
12283 | else | |
12284 | json_object_string_add(json_neigh, "writeThread", "off"); | |
12285 | } | |
12286 | else | |
12287 | { | |
dd9275d6 ST |
12288 | /* TCP metrics. */ |
12289 | if (p->status == Established && p->rtt) | |
12290 | vty_out (vty, "Estimated round trip time: %d ms%s", | |
12291 | p->rtt, VTY_NEWLINE); | |
856ca177 MS |
12292 | if (p->t_start) |
12293 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
12294 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
12295 | if (p->t_connect) | |
12296 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
12297 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
12298 | if (p->t_routeadv) | |
12299 | vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s", | |
12300 | p->v_routeadv, thread_timer_remain_second (p->t_routeadv), | |
12301 | VTY_NEWLINE); | |
12302 | ||
12303 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
12304 | p->t_read ? "on" : "off", | |
12305 | p->t_write ? "on" : "off", | |
12306 | VTY_NEWLINE); | |
12307 | } | |
718e3744 | 12308 | |
12309 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
12310 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
856ca177 MS |
12311 | bgp_capability_vty_out (vty, p, use_json, json_neigh); |
12312 | ||
12313 | if (!use_json) | |
12314 | vty_out (vty, "%s", VTY_NEWLINE); | |
c43ed2e4 DS |
12315 | |
12316 | /* BFD information. */ | |
856ca177 MS |
12317 | bgp_bfd_show_info(vty, p, use_json, json_neigh); |
12318 | ||
12319 | if (use_json) | |
12320 | { | |
12321 | if (p->conf_if) /* Configured interface name. */ | |
12322 | json_object_object_add(json, p->conf_if, json_neigh); | |
12323 | else /* Configured IP address. */ | |
12324 | json_object_object_add(json, p->host, json_neigh); | |
12325 | } | |
718e3744 | 12326 | } |
12327 | ||
94f2b392 | 12328 | static int |
856ca177 MS |
12329 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type, |
12330 | union sockunion *su, const char *conf_if, u_char use_json, json_object *json) | |
718e3744 | 12331 | { |
1eb8ef25 | 12332 | struct listnode *node, *nnode; |
718e3744 | 12333 | struct peer *peer; |
12334 | int find = 0; | |
12335 | ||
1eb8ef25 | 12336 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 12337 | { |
1ff9a340 DS |
12338 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
12339 | continue; | |
12340 | ||
718e3744 | 12341 | switch (type) |
856ca177 MS |
12342 | { |
12343 | case show_all: | |
e8f7da3a | 12344 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12345 | break; |
12346 | case show_peer: | |
12347 | if (conf_if) | |
12348 | { | |
4873b3b9 DW |
12349 | if ((peer->conf_if && !strcmp(peer->conf_if, conf_if)) || |
12350 | (peer->hostname && !strcmp(peer->hostname, conf_if))) | |
856ca177 MS |
12351 | { |
12352 | find = 1; | |
e8f7da3a | 12353 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12354 | } |
12355 | } | |
12356 | else | |
12357 | { | |
12358 | if (sockunion_same (&peer->su, su)) | |
12359 | { | |
12360 | find = 1; | |
e8f7da3a | 12361 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12362 | } |
12363 | } | |
12364 | break; | |
718e3744 | 12365 | } |
12366 | } | |
12367 | ||
12368 | if (type == show_peer && ! find) | |
856ca177 MS |
12369 | { |
12370 | if (use_json) | |
12371 | json_object_boolean_true_add(json, "bgpNoSuchNeighbor"); | |
12372 | else | |
12373 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
12374 | } | |
12375 | ||
12376 | if (use_json) | |
12377 | { | |
12378 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
12379 | json_object_free(json); | |
12380 | } | |
12381 | else | |
12382 | { | |
12383 | vty_out (vty, "%s", VTY_NEWLINE); | |
12384 | } | |
12385 | ||
718e3744 | 12386 | return CMD_SUCCESS; |
12387 | } | |
12388 | ||
94f2b392 | 12389 | static int |
fd79ac91 | 12390 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
9f689658 DD |
12391 | enum show_type type, const char *ip_str, u_char use_json, |
12392 | json_object *json) | |
718e3744 | 12393 | { |
12394 | int ret; | |
12395 | struct bgp *bgp; | |
12396 | union sockunion su; | |
856ca177 | 12397 | |
9f689658 | 12398 | if (use_json && (json == NULL)) |
856ca177 | 12399 | json = json_object_new_object(); |
718e3744 | 12400 | |
718e3744 | 12401 | if (name) |
12402 | { | |
12403 | bgp = bgp_lookup_by_name (name); | |
718e3744 | 12404 | if (! bgp) |
12405 | { | |
856ca177 MS |
12406 | if (use_json) |
12407 | { | |
12408 | json_object_boolean_true_add(json, "bgpNoSuchInstance"); | |
12409 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
12410 | json_object_free(json); | |
12411 | } | |
12412 | else | |
12413 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
12414 | ||
718e3744 | 12415 | return CMD_WARNING; |
12416 | } | |
718e3744 | 12417 | } |
a80beece DS |
12418 | else |
12419 | { | |
12420 | bgp = bgp_get_default (); | |
12421 | } | |
718e3744 | 12422 | |
12423 | if (bgp) | |
a80beece DS |
12424 | { |
12425 | if (ip_str) | |
12426 | { | |
12427 | ret = str2sockunion (ip_str, &su); | |
12428 | if (ret < 0) | |
856ca177 | 12429 | bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json); |
a80beece | 12430 | else |
856ca177 | 12431 | bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json); |
a80beece DS |
12432 | } |
12433 | else | |
12434 | { | |
856ca177 | 12435 | bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json); |
a80beece DS |
12436 | } |
12437 | } | |
718e3744 | 12438 | |
12439 | return CMD_SUCCESS; | |
12440 | } | |
12441 | ||
f186de26 | 12442 | static void |
12443 | bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) | |
12444 | { | |
12445 | struct listnode *node, *nnode; | |
12446 | struct bgp *bgp; | |
12447 | json_object *json = NULL; | |
9f689658 DD |
12448 | int is_first = 1; |
12449 | ||
12450 | if (use_json) | |
12451 | vty_out (vty, "{%s", VTY_NEWLINE); | |
f186de26 | 12452 | |
12453 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
12454 | { | |
f186de26 | 12455 | if (use_json) |
9f689658 DD |
12456 | { |
12457 | if (!(json = json_object_new_object())) | |
12458 | { | |
12459 | zlog_err("Unable to allocate memory for JSON object"); | |
12460 | vty_out (vty, | |
12461 | "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s", | |
12462 | VTY_NEWLINE); | |
12463 | return; | |
12464 | } | |
12465 | ||
12466 | json_object_int_add(json, "vrfId", | |
12467 | (bgp->vrf_id == VRF_UNKNOWN) | |
12468 | ? -1 : bgp->vrf_id); | |
12469 | json_object_string_add(json, "vrfName", | |
12470 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12471 | ? "Default" : bgp->name); | |
12472 | ||
12473 | if (! is_first) | |
12474 | vty_out (vty, ",%s", VTY_NEWLINE); | |
12475 | else | |
12476 | is_first = 0; | |
12477 | ||
12478 | vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12479 | ? "Default" : bgp->name); | |
12480 | } | |
12481 | else | |
12482 | { | |
12483 | vty_out (vty, "%sInstance %s:%s", | |
12484 | VTY_NEWLINE, | |
12485 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12486 | ? "Default" : bgp->name, | |
12487 | VTY_NEWLINE); | |
12488 | } | |
f186de26 | 12489 | bgp_show_neighbor (vty, bgp, show_all, NULL, NULL, use_json, json); |
12490 | } | |
9f689658 DD |
12491 | |
12492 | if (use_json) | |
12493 | vty_out (vty, "}%s", VTY_NEWLINE); | |
f186de26 | 12494 | } |
12495 | ||
718e3744 | 12496 | /* "show ip bgp neighbors" commands. */ |
12497 | DEFUN (show_ip_bgp_neighbors, | |
12498 | show_ip_bgp_neighbors_cmd, | |
856ca177 | 12499 | "show ip bgp neighbors {json}", |
718e3744 | 12500 | SHOW_STR |
12501 | IP_STR | |
12502 | BGP_STR | |
856ca177 MS |
12503 | "Detailed information on TCP and BGP neighbor connections\n" |
12504 | "JavaScript Object Notation\n") | |
718e3744 | 12505 | { |
db7c8528 | 12506 | u_char uj = use_json(argc, argv); |
856ca177 | 12507 | |
9f689658 | 12508 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, uj, NULL); |
718e3744 | 12509 | } |
12510 | ||
12511 | ALIAS (show_ip_bgp_neighbors, | |
12512 | show_ip_bgp_ipv4_neighbors_cmd, | |
856ca177 | 12513 | "show ip bgp ipv4 (unicast|multicast) neighbors {json}", |
718e3744 | 12514 | SHOW_STR |
12515 | IP_STR | |
12516 | BGP_STR | |
12517 | "Address family\n" | |
12518 | "Address Family modifier\n" | |
12519 | "Address Family modifier\n" | |
856ca177 MS |
12520 | "Detailed information on TCP and BGP neighbor connections\n" |
12521 | "JavaScript Object Notation\n") | |
718e3744 | 12522 | |
12523 | ALIAS (show_ip_bgp_neighbors, | |
12524 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
856ca177 | 12525 | "show ip bgp vpnv4 all neighbors {json}", |
718e3744 | 12526 | SHOW_STR |
12527 | IP_STR | |
12528 | BGP_STR | |
12529 | "Display VPNv4 NLRI specific information\n" | |
12530 | "Display information about all VPNv4 NLRIs\n" | |
856ca177 MS |
12531 | "Detailed information on TCP and BGP neighbor connections\n" |
12532 | "JavaScript Object Notation\n") | |
718e3744 | 12533 | |
12534 | ALIAS (show_ip_bgp_neighbors, | |
12535 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
856ca177 | 12536 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}", |
718e3744 | 12537 | SHOW_STR |
12538 | IP_STR | |
12539 | BGP_STR | |
12540 | "Display VPNv4 NLRI specific information\n" | |
12541 | "Display information for a route distinguisher\n" | |
12542 | "VPN Route Distinguisher\n" | |
856ca177 MS |
12543 | "Detailed information on TCP and BGP neighbor connections\n" |
12544 | "JavaScript Object Notation\n") | |
718e3744 | 12545 | |
12546 | ALIAS (show_ip_bgp_neighbors, | |
12547 | show_bgp_neighbors_cmd, | |
856ca177 | 12548 | "show bgp neighbors {json}", |
718e3744 | 12549 | SHOW_STR |
12550 | BGP_STR | |
856ca177 MS |
12551 | "Detailed information on TCP and BGP neighbor connections\n" |
12552 | "JavaScript Object Notation\n") | |
718e3744 | 12553 | |
12554 | ALIAS (show_ip_bgp_neighbors, | |
12555 | show_bgp_ipv6_neighbors_cmd, | |
856ca177 | 12556 | "show bgp ipv6 neighbors {json}", |
718e3744 | 12557 | SHOW_STR |
12558 | BGP_STR | |
12559 | "Address family\n" | |
856ca177 MS |
12560 | "Detailed information on TCP and BGP neighbor connections\n" |
12561 | "JavaScript Object Notation\n") | |
718e3744 | 12562 | |
12563 | DEFUN (show_ip_bgp_neighbors_peer, | |
12564 | show_ip_bgp_neighbors_peer_cmd, | |
856ca177 | 12565 | "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12566 | SHOW_STR |
12567 | IP_STR | |
12568 | BGP_STR | |
12569 | "Detailed information on TCP and BGP neighbor connections\n" | |
12570 | "Neighbor to display information about\n" | |
a80beece | 12571 | "Neighbor to display information about\n" |
856ca177 MS |
12572 | "Neighbor on bgp configured interface\n" |
12573 | "JavaScript Object Notation\n") | |
718e3744 | 12574 | { |
db7c8528 | 12575 | u_char uj = use_json(argc, argv); |
856ca177 | 12576 | |
9f689658 | 12577 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], uj, NULL); |
718e3744 | 12578 | } |
12579 | ||
12580 | ALIAS (show_ip_bgp_neighbors_peer, | |
12581 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
856ca177 | 12582 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12583 | SHOW_STR |
12584 | IP_STR | |
12585 | BGP_STR | |
12586 | "Address family\n" | |
12587 | "Address Family modifier\n" | |
12588 | "Address Family modifier\n" | |
12589 | "Detailed information on TCP and BGP neighbor connections\n" | |
12590 | "Neighbor to display information about\n" | |
a80beece | 12591 | "Neighbor to display information about\n" |
856ca177 MS |
12592 | "Neighbor on bgp configured interface\n" |
12593 | "JavaScript Object Notation\n") | |
718e3744 | 12594 | |
12595 | ALIAS (show_ip_bgp_neighbors_peer, | |
12596 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
856ca177 | 12597 | "show ip bgp vpnv4 all neighbors A.B.C.D {json}", |
718e3744 | 12598 | SHOW_STR |
12599 | IP_STR | |
12600 | BGP_STR | |
12601 | "Display VPNv4 NLRI specific information\n" | |
12602 | "Display information about all VPNv4 NLRIs\n" | |
12603 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
12604 | "Neighbor to display information about\n" |
12605 | "JavaScript Object Notation\n") | |
718e3744 | 12606 | |
12607 | ALIAS (show_ip_bgp_neighbors_peer, | |
12608 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
856ca177 | 12609 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}", |
718e3744 | 12610 | SHOW_STR |
12611 | IP_STR | |
12612 | BGP_STR | |
12613 | "Display VPNv4 NLRI specific information\n" | |
12614 | "Display information about all VPNv4 NLRIs\n" | |
12615 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
12616 | "Neighbor to display information about\n" |
12617 | "JavaScript Object Notation\n") | |
718e3744 | 12618 | |
12619 | ALIAS (show_ip_bgp_neighbors_peer, | |
12620 | show_bgp_neighbors_peer_cmd, | |
856ca177 | 12621 | "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12622 | SHOW_STR |
12623 | BGP_STR | |
12624 | "Detailed information on TCP and BGP neighbor connections\n" | |
12625 | "Neighbor to display information about\n" | |
a80beece | 12626 | "Neighbor to display information about\n" |
856ca177 MS |
12627 | "Neighbor on bgp configured interface\n" |
12628 | "JavaScript Object Notation\n") | |
718e3744 | 12629 | |
12630 | ALIAS (show_ip_bgp_neighbors_peer, | |
12631 | show_bgp_ipv6_neighbors_peer_cmd, | |
856ca177 | 12632 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12633 | SHOW_STR |
12634 | BGP_STR | |
12635 | "Address family\n" | |
12636 | "Detailed information on TCP and BGP neighbor connections\n" | |
12637 | "Neighbor to display information about\n" | |
a80beece | 12638 | "Neighbor to display information about\n" |
856ca177 MS |
12639 | "Neighbor on bgp configured interface\n" |
12640 | "JavaScript Object Notation\n") | |
718e3744 | 12641 | |
12642 | DEFUN (show_ip_bgp_instance_neighbors, | |
12643 | show_ip_bgp_instance_neighbors_cmd, | |
8386ac43 | 12644 | "show ip bgp " BGP_INSTANCE_CMD " neighbors {json}", |
718e3744 | 12645 | SHOW_STR |
12646 | IP_STR | |
12647 | BGP_STR | |
8386ac43 | 12648 | BGP_INSTANCE_HELP_STR |
856ca177 MS |
12649 | "Detailed information on TCP and BGP neighbor connections\n" |
12650 | "JavaScript Object Notation\n") | |
718e3744 | 12651 | { |
db7c8528 | 12652 | u_char uj = use_json(argc, argv); |
856ca177 | 12653 | |
9f689658 | 12654 | return bgp_show_neighbor_vty (vty, argv[1], show_all, NULL, uj, NULL); |
718e3744 | 12655 | } |
12656 | ||
f186de26 | 12657 | DEFUN (show_ip_bgp_instance_all_neighbors, |
12658 | show_ip_bgp_instance_all_neighbors_cmd, | |
12659 | "show ip bgp " BGP_INSTANCE_ALL_CMD " neighbors {json}", | |
12660 | SHOW_STR | |
12661 | IP_STR | |
12662 | BGP_STR | |
12663 | BGP_INSTANCE_ALL_HELP_STR | |
12664 | "Detailed information on TCP and BGP neighbor connections\n" | |
12665 | "JavaScript Object Notation\n") | |
12666 | { | |
12667 | u_char uj = use_json(argc, argv); | |
12668 | ||
12669 | bgp_show_all_instances_neighbors_vty (vty, uj); | |
12670 | return CMD_SUCCESS; | |
12671 | } | |
12672 | ||
bb46e94f | 12673 | ALIAS (show_ip_bgp_instance_neighbors, |
12674 | show_bgp_instance_neighbors_cmd, | |
8386ac43 | 12675 | "show bgp " BGP_INSTANCE_CMD " neighbors {json}", |
bb46e94f | 12676 | SHOW_STR |
12677 | BGP_STR | |
8386ac43 | 12678 | BGP_INSTANCE_HELP_STR |
856ca177 MS |
12679 | "Detailed information on TCP and BGP neighbor connections\n" |
12680 | "JavaScript Object Notation\n") | |
bb46e94f | 12681 | |
12682 | ALIAS (show_ip_bgp_instance_neighbors, | |
12683 | show_bgp_instance_ipv6_neighbors_cmd, | |
8386ac43 | 12684 | "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors {json}", |
bb46e94f | 12685 | SHOW_STR |
12686 | BGP_STR | |
8386ac43 | 12687 | BGP_INSTANCE_HELP_STR |
bb46e94f | 12688 | "Address family\n" |
856ca177 MS |
12689 | "Detailed information on TCP and BGP neighbor connections\n" |
12690 | "JavaScript Object Notation\n") | |
bb46e94f | 12691 | |
718e3744 | 12692 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
12693 | show_ip_bgp_instance_neighbors_peer_cmd, | |
8386ac43 | 12694 | "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 12695 | SHOW_STR |
12696 | IP_STR | |
12697 | BGP_STR | |
8386ac43 | 12698 | BGP_INSTANCE_HELP_STR |
718e3744 | 12699 | "Detailed information on TCP and BGP neighbor connections\n" |
12700 | "Neighbor to display information about\n" | |
a80beece | 12701 | "Neighbor to display information about\n" |
856ca177 MS |
12702 | "Neighbor on bgp configured interface\n" |
12703 | "JavaScript Object Notation\n") | |
718e3744 | 12704 | { |
db7c8528 | 12705 | u_char uj = use_json(argc, argv); |
856ca177 | 12706 | |
9f689658 | 12707 | return bgp_show_neighbor_vty (vty, argv[1], show_peer, argv[2], uj, NULL); |
718e3744 | 12708 | } |
bb46e94f | 12709 | |
12710 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
12711 | show_bgp_instance_neighbors_peer_cmd, | |
8386ac43 | 12712 | "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 12713 | SHOW_STR |
12714 | BGP_STR | |
8386ac43 | 12715 | BGP_INSTANCE_HELP_STR |
bb46e94f | 12716 | "Detailed information on TCP and BGP neighbor connections\n" |
12717 | "Neighbor to display information about\n" | |
a80beece | 12718 | "Neighbor to display information about\n" |
856ca177 MS |
12719 | "Neighbor on bgp configured interface\n" |
12720 | "JavaScript Object Notation\n") | |
bb46e94f | 12721 | |
12722 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
12723 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
8386ac43 | 12724 | "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 12725 | SHOW_STR |
12726 | BGP_STR | |
8386ac43 | 12727 | BGP_INSTANCE_HELP_STR |
bb46e94f | 12728 | "Address family\n" |
12729 | "Detailed information on TCP and BGP neighbor connections\n" | |
12730 | "Neighbor to display information about\n" | |
a80beece | 12731 | "Neighbor to display information about\n" |
856ca177 MS |
12732 | "Neighbor on bgp configured interface\n" |
12733 | "JavaScript Object Notation\n") | |
6b0655a2 | 12734 | |
718e3744 | 12735 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
12736 | paths' and `show ip mbgp paths'. Those functions results are the | |
12737 | same.*/ | |
12738 | DEFUN (show_ip_bgp_paths, | |
12739 | show_ip_bgp_paths_cmd, | |
12740 | "show ip bgp paths", | |
12741 | SHOW_STR | |
12742 | IP_STR | |
12743 | BGP_STR | |
12744 | "Path information\n") | |
12745 | { | |
12746 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
12747 | aspath_print_all_vty (vty); | |
12748 | return CMD_SUCCESS; | |
12749 | } | |
12750 | ||
12751 | DEFUN (show_ip_bgp_ipv4_paths, | |
12752 | show_ip_bgp_ipv4_paths_cmd, | |
12753 | "show ip bgp ipv4 (unicast|multicast) paths", | |
12754 | SHOW_STR | |
12755 | IP_STR | |
12756 | BGP_STR | |
12757 | "Address family\n" | |
12758 | "Address Family modifier\n" | |
12759 | "Address Family modifier\n" | |
12760 | "Path information\n") | |
12761 | { | |
12762 | vty_out (vty, "Address Refcnt Path\r\n"); | |
12763 | aspath_print_all_vty (vty); | |
12764 | ||
12765 | return CMD_SUCCESS; | |
12766 | } | |
6b0655a2 | 12767 | |
718e3744 | 12768 | #include "hash.h" |
12769 | ||
94f2b392 | 12770 | static void |
718e3744 | 12771 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
12772 | { | |
12773 | struct community *com; | |
12774 | ||
12775 | com = (struct community *) backet->data; | |
6c4f4e6e | 12776 | vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt, |
718e3744 | 12777 | community_str (com), VTY_NEWLINE); |
12778 | } | |
12779 | ||
12780 | /* Show BGP's community internal data. */ | |
12781 | DEFUN (show_ip_bgp_community_info, | |
12782 | show_ip_bgp_community_info_cmd, | |
12783 | "show ip bgp community-info", | |
12784 | SHOW_STR | |
12785 | IP_STR | |
12786 | BGP_STR | |
12787 | "List all bgp community information\n") | |
12788 | { | |
12789 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
12790 | ||
12791 | hash_iterate (community_hash (), | |
12792 | (void (*) (struct hash_backet *, void *)) | |
12793 | community_show_all_iterator, | |
12794 | vty); | |
12795 | ||
12796 | return CMD_SUCCESS; | |
12797 | } | |
12798 | ||
12799 | DEFUN (show_ip_bgp_attr_info, | |
12800 | show_ip_bgp_attr_info_cmd, | |
12801 | "show ip bgp attribute-info", | |
12802 | SHOW_STR | |
12803 | IP_STR | |
12804 | BGP_STR | |
12805 | "List all bgp attribute information\n") | |
12806 | { | |
12807 | attr_show_all (vty); | |
12808 | return CMD_SUCCESS; | |
12809 | } | |
6b0655a2 | 12810 | |
8386ac43 | 12811 | static int bgp_show_update_groups(struct vty *vty, const char *name, |
12812 | int afi, int safi, | |
50ef26d4 | 12813 | u_int64_t subgrp_id) |
3f9c7369 DS |
12814 | { |
12815 | struct bgp *bgp; | |
12816 | ||
8386ac43 | 12817 | if (name) |
12818 | bgp = bgp_lookup_by_name (name); | |
12819 | else | |
12820 | bgp = bgp_get_default (); | |
12821 | ||
3f9c7369 | 12822 | if (bgp) |
8fe8a7f6 | 12823 | update_group_show(bgp, afi, safi, vty, subgrp_id); |
3f9c7369 DS |
12824 | return CMD_SUCCESS; |
12825 | } | |
12826 | ||
f186de26 | 12827 | static void |
12828 | bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi) | |
12829 | { | |
12830 | struct listnode *node, *nnode; | |
12831 | struct bgp *bgp; | |
12832 | ||
12833 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
12834 | { | |
12835 | vty_out (vty, "%sInstance %s:%s", | |
12836 | VTY_NEWLINE, | |
12837 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name, | |
12838 | VTY_NEWLINE); | |
12839 | update_group_show(bgp, afi, safi, vty, 0); | |
12840 | } | |
12841 | } | |
12842 | ||
8fe8a7f6 DS |
12843 | DEFUN (show_ip_bgp_updgrps, |
12844 | show_ip_bgp_updgrps_cmd, | |
12845 | "show ip bgp update-groups", | |
12846 | SHOW_STR | |
12847 | IP_STR | |
12848 | BGP_STR | |
12849 | "Detailed info about dynamic update groups\n") | |
12850 | { | |
8386ac43 | 12851 | return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, 0)); |
12852 | } | |
12853 | ||
12854 | DEFUN (show_ip_bgp_instance_updgrps, | |
12855 | show_ip_bgp_instance_updgrps_cmd, | |
12856 | "show ip bgp " BGP_INSTANCE_CMD " update-groups", | |
12857 | SHOW_STR | |
12858 | IP_STR | |
12859 | BGP_STR | |
12860 | BGP_INSTANCE_HELP_STR | |
12861 | "Detailed info about dynamic update groups\n") | |
12862 | { | |
12863 | return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, 0)); | |
8fe8a7f6 DS |
12864 | } |
12865 | ||
f186de26 | 12866 | DEFUN (show_ip_bgp_instance_all_updgrps, |
12867 | show_ip_bgp_instance_all_updgrps_cmd, | |
12868 | "show ip bgp " BGP_INSTANCE_ALL_CMD " update-groups", | |
12869 | SHOW_STR | |
12870 | IP_STR | |
12871 | BGP_STR | |
12872 | BGP_INSTANCE_ALL_HELP_STR | |
12873 | "Detailed info about dynamic update groups\n") | |
12874 | { | |
12875 | bgp_show_all_instances_updgrps_vty (vty, AFI_IP, SAFI_UNICAST); | |
12876 | return CMD_SUCCESS; | |
12877 | } | |
12878 | ||
3f9c7369 DS |
12879 | DEFUN (show_bgp_ipv6_updgrps, |
12880 | show_bgp_ipv6_updgrps_cmd, | |
8fe8a7f6 | 12881 | "show bgp update-groups", |
3f9c7369 DS |
12882 | SHOW_STR |
12883 | BGP_STR | |
8fe8a7f6 | 12884 | "Detailed info about v6 dynamic update groups\n") |
3f9c7369 | 12885 | { |
8386ac43 | 12886 | return (bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, 0)); |
12887 | } | |
12888 | ||
12889 | DEFUN (show_bgp_instance_ipv6_updgrps, | |
12890 | show_bgp_instance_ipv6_updgrps_cmd, | |
12891 | "show bgp " BGP_INSTANCE_CMD " update-groups", | |
12892 | SHOW_STR | |
12893 | BGP_STR | |
12894 | BGP_INSTANCE_HELP_STR | |
12895 | "Detailed info about v6 dynamic update groups\n") | |
12896 | { | |
12897 | return (bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, 0)); | |
3f9c7369 DS |
12898 | } |
12899 | ||
f186de26 | 12900 | DEFUN (show_bgp_instance_all_ipv6_updgrps, |
12901 | show_bgp_instance_all_ipv6_updgrps_cmd, | |
12902 | "show bgp " BGP_INSTANCE_ALL_CMD " update-groups", | |
12903 | SHOW_STR | |
12904 | BGP_STR | |
12905 | BGP_INSTANCE_ALL_HELP_STR | |
12906 | "Detailed info about v6 dynamic update groups\n") | |
12907 | { | |
12908 | bgp_show_all_instances_updgrps_vty (vty, AFI_IP6, SAFI_UNICAST); | |
12909 | return CMD_SUCCESS; | |
12910 | } | |
12911 | ||
3f9c7369 DS |
12912 | DEFUN (show_bgp_updgrps, |
12913 | show_bgp_updgrps_cmd, | |
8fe8a7f6 | 12914 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups", |
3f9c7369 DS |
12915 | SHOW_STR |
12916 | BGP_STR | |
12917 | "Address family\n" | |
12918 | "Address family\n" | |
12919 | "Address Family modifier\n" | |
12920 | "Address Family modifier\n" | |
8fe8a7f6 | 12921 | "Detailed info about dynamic update groups\n") |
3f9c7369 | 12922 | { |
3f9c7369 DS |
12923 | afi_t afi; |
12924 | safi_t safi; | |
12925 | ||
12926 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
12927 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8386ac43 | 12928 | return (bgp_show_update_groups(vty, NULL, afi, safi, 0)); |
8fe8a7f6 DS |
12929 | } |
12930 | ||
12931 | DEFUN (show_ip_bgp_updgrps_s, | |
12932 | show_ip_bgp_updgrps_s_cmd, | |
12933 | "show ip bgp update-groups SUBGROUP-ID", | |
12934 | SHOW_STR | |
12935 | IP_STR | |
12936 | BGP_STR | |
12937 | "Detailed info about dynamic update groups\n" | |
12938 | "Specific subgroup to display detailed info for\n") | |
12939 | { | |
12940 | u_int64_t subgrp_id; | |
12941 | ||
12942 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
8386ac43 | 12943 | return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, subgrp_id)); |
12944 | } | |
12945 | ||
12946 | DEFUN (show_ip_bgp_instance_updgrps_s, | |
12947 | show_ip_bgp_instance_updgrps_s_cmd, | |
12948 | "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID", | |
12949 | SHOW_STR | |
12950 | IP_STR | |
12951 | BGP_STR | |
12952 | BGP_INSTANCE_HELP_STR | |
12953 | "Detailed info about dynamic update groups\n" | |
12954 | "Specific subgroup to display detailed info for\n") | |
12955 | { | |
12956 | u_int64_t subgrp_id; | |
12957 | ||
12958 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
12959 | return (bgp_show_update_groups(vty, argv[1], AFI_IP, SAFI_UNICAST, subgrp_id)); | |
8fe8a7f6 DS |
12960 | } |
12961 | ||
12962 | DEFUN (show_bgp_ipv6_updgrps_s, | |
12963 | show_bgp_ipv6_updgrps_s_cmd, | |
12964 | "show bgp update-groups SUBGROUP-ID", | |
12965 | SHOW_STR | |
12966 | BGP_STR | |
12967 | "Detailed info about v6 dynamic update groups\n" | |
12968 | "Specific subgroup to display detailed info for\n") | |
12969 | { | |
12970 | u_int64_t subgrp_id; | |
12971 | ||
12972 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
8386ac43 | 12973 | return(bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, subgrp_id)); |
12974 | } | |
12975 | ||
12976 | DEFUN (show_bgp_instance_ipv6_updgrps_s, | |
12977 | show_bgp_instance_ipv6_updgrps_s_cmd, | |
12978 | "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID", | |
12979 | SHOW_STR | |
12980 | BGP_STR | |
12981 | "Detailed info about v6 dynamic update groups\n" | |
12982 | "Specific subgroup to display detailed info for\n") | |
12983 | { | |
12984 | u_int64_t subgrp_id; | |
12985 | ||
12986 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
12987 | return(bgp_show_update_groups(vty, argv[1], AFI_IP6, SAFI_UNICAST, subgrp_id)); | |
8fe8a7f6 DS |
12988 | } |
12989 | ||
12990 | DEFUN (show_bgp_updgrps_s, | |
12991 | show_bgp_updgrps_s_cmd, | |
12992 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID", | |
12993 | SHOW_STR | |
12994 | BGP_STR | |
12995 | "Address family\n" | |
12996 | "Address family\n" | |
12997 | "Address Family modifier\n" | |
12998 | "Address Family modifier\n" | |
12999 | "Detailed info about v6 dynamic update groups\n" | |
13000 | "Specific subgroup to display detailed info for") | |
13001 | { | |
13002 | afi_t afi; | |
13003 | safi_t safi; | |
13004 | u_int64_t subgrp_id; | |
13005 | ||
13006 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13007 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
13008 | ||
13009 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
8386ac43 | 13010 | return(bgp_show_update_groups(vty, NULL, afi, safi, subgrp_id)); |
3f9c7369 DS |
13011 | } |
13012 | ||
13013 | DEFUN (show_bgp_updgrps_stats, | |
13014 | show_bgp_updgrps_stats_cmd, | |
13015 | "show bgp update-groups statistics", | |
13016 | SHOW_STR | |
13017 | BGP_STR | |
13018 | "BGP update groups\n" | |
13019 | "Statistics\n") | |
13020 | { | |
13021 | struct bgp *bgp; | |
13022 | ||
13023 | bgp = bgp_get_default(); | |
13024 | if (bgp) | |
13025 | update_group_show_stats(bgp, vty); | |
13026 | ||
13027 | return CMD_SUCCESS; | |
13028 | } | |
13029 | ||
8386ac43 | 13030 | DEFUN (show_bgp_instance_updgrps_stats, |
13031 | show_bgp_instance_updgrps_stats_cmd, | |
13032 | "show bgp " BGP_INSTANCE_CMD " update-groups statistics", | |
13033 | SHOW_STR | |
13034 | BGP_STR | |
13035 | BGP_INSTANCE_HELP_STR | |
13036 | "BGP update groups\n" | |
13037 | "Statistics\n") | |
13038 | { | |
13039 | struct bgp *bgp; | |
13040 | ||
13041 | bgp = bgp_lookup_by_name (argv[1]); | |
13042 | if (bgp) | |
13043 | update_group_show_stats(bgp, vty); | |
13044 | ||
13045 | return CMD_SUCCESS; | |
13046 | } | |
13047 | ||
3f9c7369 | 13048 | static void |
8386ac43 | 13049 | show_bgp_updgrps_adj_info_aux (struct vty *vty, const char *name, |
13050 | afi_t afi, safi_t safi, | |
3f9c7369 DS |
13051 | const char *what, u_int64_t subgrp_id) |
13052 | { | |
13053 | struct bgp *bgp; | |
8386ac43 | 13054 | |
13055 | if (name) | |
13056 | bgp = bgp_lookup_by_name (name); | |
13057 | else | |
13058 | bgp = bgp_get_default (); | |
13059 | ||
3f9c7369 DS |
13060 | if (bgp) |
13061 | { | |
13062 | if (!strcmp(what, "advertise-queue")) | |
13063 | update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id); | |
13064 | else if (!strcmp(what, "advertised-routes")) | |
13065 | update_group_show_advertised(bgp, afi, safi, vty, subgrp_id); | |
13066 | else if (!strcmp(what, "packet-queue")) | |
13067 | update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id); | |
13068 | } | |
13069 | } | |
13070 | ||
13071 | DEFUN (show_ip_bgp_updgrps_adj, | |
13072 | show_ip_bgp_updgrps_adj_cmd, | |
13073 | "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13074 | SHOW_STR | |
13075 | IP_STR | |
13076 | BGP_STR | |
13077 | "BGP update groups\n" | |
13078 | "Advertisement queue\n" | |
13079 | "Announced routes\n" | |
13080 | "Packet queue\n") | |
8fe8a7f6 | 13081 | |
3f9c7369 | 13082 | { |
8386ac43 | 13083 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[0], 0); |
13084 | return CMD_SUCCESS; | |
13085 | } | |
13086 | ||
13087 | DEFUN (show_ip_bgp_instance_updgrps_adj, | |
13088 | show_ip_bgp_instance_updgrps_adj_cmd, | |
13089 | "show ip bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13090 | SHOW_STR | |
13091 | IP_STR | |
13092 | BGP_STR | |
13093 | BGP_INSTANCE_HELP_STR | |
13094 | "BGP update groups\n" | |
13095 | "Advertisement queue\n" | |
13096 | "Announced routes\n" | |
13097 | "Packet queue\n") | |
13098 | ||
13099 | { | |
13100 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[2], 0); | |
3f9c7369 DS |
13101 | return CMD_SUCCESS; |
13102 | } | |
13103 | ||
13104 | DEFUN (show_bgp_updgrps_afi_adj, | |
13105 | show_bgp_updgrps_afi_adj_cmd, | |
13106 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13107 | SHOW_STR | |
13108 | BGP_STR | |
13109 | "Address family\n" | |
13110 | "Address family\n" | |
13111 | "Address Family modifier\n" | |
13112 | "Address Family modifier\n" | |
13113 | "BGP update groups\n" | |
13114 | "Advertisement queue\n" | |
13115 | "Announced routes\n" | |
8fe8a7f6 DS |
13116 | "Packet queue\n" |
13117 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
13118 | { |
13119 | afi_t afi; | |
13120 | safi_t safi; | |
13121 | ||
13122 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13123 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8386ac43 | 13124 | show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[2], 0); |
8fe8a7f6 | 13125 | return CMD_SUCCESS; |
3f9c7369 DS |
13126 | } |
13127 | ||
13128 | DEFUN (show_bgp_updgrps_adj, | |
13129 | show_bgp_updgrps_adj_cmd, | |
13130 | "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13131 | SHOW_STR | |
13132 | BGP_STR | |
13133 | "BGP update groups\n" | |
13134 | "Advertisement queue\n" | |
13135 | "Announced routes\n" | |
13136 | "Packet queue\n") | |
13137 | { | |
8386ac43 | 13138 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[0], 0); |
13139 | return CMD_SUCCESS; | |
13140 | } | |
13141 | ||
13142 | DEFUN (show_bgp_instance_updgrps_adj, | |
13143 | show_bgp_instance_updgrps_adj_cmd, | |
13144 | "show bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13145 | SHOW_STR | |
13146 | BGP_STR | |
13147 | BGP_INSTANCE_HELP_STR | |
13148 | "BGP update groups\n" | |
13149 | "Advertisement queue\n" | |
13150 | "Announced routes\n" | |
13151 | "Packet queue\n") | |
13152 | { | |
13153 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[2], 0); | |
3f9c7369 DS |
13154 | return CMD_SUCCESS; |
13155 | } | |
13156 | ||
13157 | DEFUN (show_ip_bgp_updgrps_adj_s, | |
8fe8a7f6 | 13158 | show_ip_bgp_updgrps_adj_s_cmd, |
3f9c7369 DS |
13159 | "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
13160 | SHOW_STR | |
13161 | IP_STR | |
13162 | BGP_STR | |
13163 | "BGP update groups\n" | |
8fe8a7f6 | 13164 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
13165 | "Advertisement queue\n" |
13166 | "Announced routes\n" | |
13167 | "Packet queue\n") | |
3f9c7369 | 13168 | |
3f9c7369 | 13169 | { |
8fe8a7f6 DS |
13170 | u_int64_t subgrp_id; |
13171 | ||
13172 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
13173 | ||
8386ac43 | 13174 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id); |
13175 | return CMD_SUCCESS; | |
13176 | } | |
13177 | ||
13178 | DEFUN (show_ip_bgp_instance_updgrps_adj_s, | |
13179 | show_ip_bgp_instance_updgrps_adj_s_cmd, | |
13180 | "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13181 | SHOW_STR | |
13182 | IP_STR | |
13183 | BGP_STR | |
13184 | BGP_INSTANCE_HELP_STR | |
13185 | "BGP update groups\n" | |
13186 | "Specific subgroup to display info for\n" | |
13187 | "Advertisement queue\n" | |
13188 | "Announced routes\n" | |
13189 | "Packet queue\n") | |
13190 | ||
13191 | { | |
13192 | u_int64_t subgrp_id; | |
13193 | ||
13194 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13195 | ||
13196 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP, SAFI_UNICAST, argv[3], subgrp_id); | |
3f9c7369 DS |
13197 | return CMD_SUCCESS; |
13198 | } | |
13199 | ||
8fe8a7f6 DS |
13200 | DEFUN (show_bgp_updgrps_afi_adj_s, |
13201 | show_bgp_updgrps_afi_adj_s_cmd, | |
3f9c7369 DS |
13202 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
13203 | SHOW_STR | |
13204 | BGP_STR | |
13205 | "Address family\n" | |
13206 | "Address family\n" | |
13207 | "Address Family modifier\n" | |
13208 | "Address Family modifier\n" | |
13209 | "BGP update groups\n" | |
8fe8a7f6 | 13210 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
13211 | "Advertisement queue\n" |
13212 | "Announced routes\n" | |
8fe8a7f6 DS |
13213 | "Packet queue\n" |
13214 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
13215 | { |
13216 | afi_t afi; | |
13217 | safi_t safi; | |
8fe8a7f6 | 13218 | u_int64_t subgrp_id; |
3f9c7369 DS |
13219 | |
13220 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
13221 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8fe8a7f6 DS |
13222 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); |
13223 | ||
8386ac43 | 13224 | show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[3], subgrp_id); |
8fe8a7f6 | 13225 | return CMD_SUCCESS; |
3f9c7369 DS |
13226 | } |
13227 | ||
8fe8a7f6 DS |
13228 | DEFUN (show_bgp_updgrps_adj_s, |
13229 | show_bgp_updgrps_adj_s_cmd, | |
13230 | "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13231 | SHOW_STR | |
13232 | BGP_STR | |
13233 | "BGP update groups\n" | |
13234 | "Specific subgroup to display info for\n" | |
13235 | "Advertisement queue\n" | |
13236 | "Announced routes\n" | |
13237 | "Packet queue\n") | |
13238 | { | |
13239 | u_int64_t subgrp_id; | |
13240 | ||
13241 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
13242 | ||
8386ac43 | 13243 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id); |
8fe8a7f6 DS |
13244 | return CMD_SUCCESS; |
13245 | } | |
13246 | ||
8386ac43 | 13247 | DEFUN (show_bgp_instance_updgrps_adj_s, |
13248 | show_bgp_instance_updgrps_adj_s_cmd, | |
13249 | "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13250 | SHOW_STR | |
13251 | BGP_STR | |
13252 | BGP_INSTANCE_HELP_STR | |
13253 | "BGP update groups\n" | |
13254 | "Specific subgroup to display info for\n" | |
13255 | "Advertisement queue\n" | |
13256 | "Announced routes\n" | |
13257 | "Packet queue\n") | |
13258 | { | |
13259 | u_int64_t subgrp_id; | |
13260 | ||
13261 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
13262 | ||
13263 | show_bgp_updgrps_adj_info_aux(vty, argv[1], AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id); | |
13264 | return CMD_SUCCESS; | |
13265 | } | |
13266 | ||
13267 | ||
8fe8a7f6 | 13268 | |
f14e6fdb DS |
13269 | static int |
13270 | bgp_show_one_peer_group (struct vty *vty, struct peer_group *group) | |
13271 | { | |
13272 | struct listnode *node, *nnode; | |
13273 | struct prefix *range; | |
13274 | struct peer *conf; | |
13275 | struct peer *peer; | |
4690c7d7 | 13276 | char buf[PREFIX2STR_BUFFER]; |
f14e6fdb DS |
13277 | afi_t afi; |
13278 | safi_t safi; | |
ffd0c037 DS |
13279 | const char *peer_status; |
13280 | const char *af_str; | |
f14e6fdb DS |
13281 | int lr_count; |
13282 | int dynamic; | |
13283 | int af_cfgd; | |
13284 | ||
13285 | conf = group->conf; | |
13286 | ||
0299c004 DS |
13287 | if (conf->as_type == AS_SPECIFIED || |
13288 | conf->as_type == AS_EXTERNAL) { | |
66b199b2 | 13289 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
f14e6fdb | 13290 | VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE); |
0299c004 | 13291 | } else if (conf->as_type == AS_INTERNAL) { |
66b199b2 | 13292 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
0299c004 | 13293 | VTY_NEWLINE, group->name, group->bgp->as, VTY_NEWLINE); |
66b199b2 DS |
13294 | } else { |
13295 | vty_out (vty, "%sBGP peer-group %s%s", | |
13296 | VTY_NEWLINE, group->name, VTY_NEWLINE); | |
0299c004 | 13297 | } |
f14e6fdb | 13298 | |
0299c004 | 13299 | if ((group->bgp->as == conf->as) || (conf->as_type == AS_INTERNAL)) |
f14e6fdb DS |
13300 | vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE); |
13301 | else | |
13302 | vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE); | |
13303 | ||
13304 | /* Display AFs configured. */ | |
13305 | vty_out (vty, " Configured address-families:"); | |
13306 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
13307 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
13308 | { | |
13309 | if (conf->afc[afi][safi]) | |
13310 | { | |
13311 | af_cfgd = 1; | |
13312 | vty_out (vty, " %s;", afi_safi_print(afi, safi)); | |
13313 | } | |
13314 | } | |
13315 | if (!af_cfgd) | |
13316 | vty_out (vty, " none%s", VTY_NEWLINE); | |
13317 | else | |
13318 | vty_out (vty, "%s", VTY_NEWLINE); | |
13319 | ||
13320 | /* Display listen ranges (for dynamic neighbors), if any */ | |
13321 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
13322 | { | |
13323 | if (afi == AFI_IP) | |
13324 | af_str = "IPv4"; | |
13325 | else if (afi == AFI_IP6) | |
13326 | af_str = "IPv6"; | |
13327 | lr_count = listcount(group->listen_range[afi]); | |
13328 | if (lr_count) | |
13329 | { | |
13330 | vty_out(vty, | |
13331 | " %d %s listen range(s)%s", | |
13332 | lr_count, af_str, VTY_NEWLINE); | |
13333 | ||
13334 | ||
13335 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node, | |
13336 | nnode, range)) | |
13337 | { | |
13338 | prefix2str(range, buf, sizeof(buf)); | |
13339 | vty_out(vty, " %s%s", buf, VTY_NEWLINE); | |
13340 | } | |
13341 | } | |
13342 | } | |
13343 | ||
13344 | /* Display group members and their status */ | |
13345 | if (listcount(group->peer)) | |
13346 | { | |
13347 | vty_out (vty, " Peer-group members:%s", VTY_NEWLINE); | |
13348 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
13349 | { | |
13350 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
13351 | peer_status = "Idle (Admin)"; | |
13352 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
13353 | peer_status = "Idle (PfxCt)"; | |
13354 | else | |
13355 | peer_status = LOOKUP(bgp_status_msg, peer->status); | |
13356 | ||
13357 | dynamic = peer_dynamic_neighbor(peer); | |
13358 | vty_out (vty, " %s %s %s %s", | |
13359 | peer->host, dynamic ? "(dynamic)" : "", | |
13360 | peer_status, VTY_NEWLINE); | |
13361 | } | |
13362 | } | |
13363 | ||
13364 | return CMD_SUCCESS; | |
13365 | } | |
13366 | ||
13367 | /* Show BGP peer group's information. */ | |
13368 | enum show_group_type | |
13369 | { | |
13370 | show_all_groups, | |
13371 | show_peer_group | |
13372 | }; | |
13373 | ||
13374 | static int | |
13375 | bgp_show_peer_group (struct vty *vty, struct bgp *bgp, | |
13376 | enum show_group_type type, const char *group_name) | |
13377 | { | |
13378 | struct listnode *node, *nnode; | |
13379 | struct peer_group *group; | |
13380 | int find = 0; | |
13381 | ||
13382 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
13383 | { | |
13384 | switch (type) | |
13385 | { | |
13386 | case show_all_groups: | |
13387 | bgp_show_one_peer_group (vty, group); | |
13388 | break; | |
13389 | case show_peer_group: | |
13390 | if (group_name && (strcmp(group->name, group_name) == 0)) | |
13391 | { | |
13392 | find = 1; | |
13393 | bgp_show_one_peer_group (vty, group); | |
13394 | } | |
13395 | break; | |
13396 | } | |
13397 | } | |
13398 | ||
13399 | if (type == show_peer_group && ! find) | |
13400 | vty_out (vty, "%% No such peer-groupr%s", VTY_NEWLINE); | |
13401 | ||
13402 | return CMD_SUCCESS; | |
13403 | } | |
13404 | ||
13405 | static int | |
13406 | bgp_show_peer_group_vty (struct vty *vty, const char *name, | |
13407 | enum show_group_type type, const char *group_name) | |
13408 | { | |
13409 | struct bgp *bgp; | |
13410 | int ret = CMD_SUCCESS; | |
13411 | ||
13412 | if (name) | |
8386ac43 | 13413 | bgp = bgp_lookup_by_name (name); |
13414 | else | |
13415 | bgp = bgp_get_default (); | |
f14e6fdb | 13416 | |
8386ac43 | 13417 | if (! bgp) |
13418 | { | |
13419 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
13420 | return CMD_WARNING; | |
f14e6fdb DS |
13421 | } |
13422 | ||
8386ac43 | 13423 | ret = bgp_show_peer_group (vty, bgp, type, group_name); |
f14e6fdb DS |
13424 | |
13425 | return ret; | |
13426 | } | |
13427 | ||
13428 | DEFUN (show_ip_bgp_peer_groups, | |
13429 | show_ip_bgp_peer_groups_cmd, | |
13430 | "show ip bgp peer-group", | |
13431 | SHOW_STR | |
13432 | IP_STR | |
13433 | BGP_STR | |
13434 | "Detailed information on all BGP peer groups\n") | |
13435 | { | |
13436 | return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL); | |
13437 | } | |
13438 | ||
13439 | DEFUN (show_ip_bgp_instance_peer_groups, | |
13440 | show_ip_bgp_instance_peer_groups_cmd, | |
8386ac43 | 13441 | "show ip bgp " BGP_INSTANCE_CMD " peer-group", |
f14e6fdb DS |
13442 | SHOW_STR |
13443 | IP_STR | |
13444 | BGP_STR | |
8386ac43 | 13445 | BGP_INSTANCE_HELP_STR |
f14e6fdb DS |
13446 | "Detailed information on all BGP peer groups\n") |
13447 | { | |
8386ac43 | 13448 | return bgp_show_peer_group_vty (vty, argv[1], show_all_groups, NULL); |
f14e6fdb DS |
13449 | } |
13450 | ||
13451 | DEFUN (show_ip_bgp_peer_group, | |
13452 | show_ip_bgp_peer_group_cmd, | |
13453 | "show ip bgp peer-group WORD", | |
13454 | SHOW_STR | |
13455 | IP_STR | |
13456 | BGP_STR | |
13457 | "BGP peer-group name\n" | |
13458 | "Detailed information on a BGP peer group\n") | |
13459 | { | |
13460 | return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]); | |
13461 | } | |
13462 | ||
13463 | DEFUN (show_ip_bgp_instance_peer_group, | |
13464 | show_ip_bgp_instance_peer_group_cmd, | |
8386ac43 | 13465 | "show ip bgp " BGP_INSTANCE_CMD " peer-group WORD", |
f14e6fdb DS |
13466 | SHOW_STR |
13467 | IP_STR | |
13468 | BGP_STR | |
8386ac43 | 13469 | BGP_INSTANCE_HELP_STR |
f14e6fdb DS |
13470 | "BGP peer-group name\n" |
13471 | "Detailed information on a BGP peer group\n") | |
13472 | { | |
8386ac43 | 13473 | return bgp_show_peer_group_vty (vty, argv[1], show_peer_group, argv[2]); |
f14e6fdb | 13474 | } |
3f9c7369 | 13475 | |
718e3744 | 13476 | /* Redistribute VTY commands. */ |
13477 | ||
718e3744 | 13478 | DEFUN (bgp_redistribute_ipv4, |
13479 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 13480 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 13481 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13482 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 13483 | { |
13484 | int type; | |
13485 | ||
e0ca5fde DL |
13486 | type = proto_redistnum (AFI_IP, argv[0]); |
13487 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13488 | { |
13489 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13490 | return CMD_WARNING; | |
13491 | } | |
7c8ff89e | 13492 | bgp_redist_add(vty->index, AFI_IP, type, 0); |
6aeb9e78 | 13493 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13494 | } |
13495 | ||
13496 | DEFUN (bgp_redistribute_ipv4_rmap, | |
13497 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 13498 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 13499 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13500 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13501 | "Route map reference\n" |
13502 | "Pointer to route-map entries\n") | |
13503 | { | |
13504 | int type; | |
7c8ff89e | 13505 | struct bgp_redist *red; |
718e3744 | 13506 | |
e0ca5fde DL |
13507 | type = proto_redistnum (AFI_IP, argv[0]); |
13508 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13509 | { |
13510 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13511 | return CMD_WARNING; | |
13512 | } | |
13513 | ||
7c8ff89e DS |
13514 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
13515 | bgp_redistribute_rmap_set (red, argv[1]); | |
6aeb9e78 | 13516 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13517 | } |
13518 | ||
13519 | DEFUN (bgp_redistribute_ipv4_metric, | |
13520 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 13521 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 13522 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13523 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13524 | "Metric for redistributed routes\n" |
13525 | "Default metric\n") | |
13526 | { | |
13527 | int type; | |
13528 | u_int32_t metric; | |
7c8ff89e | 13529 | struct bgp_redist *red; |
718e3744 | 13530 | |
e0ca5fde DL |
13531 | type = proto_redistnum (AFI_IP, argv[0]); |
13532 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13533 | { |
13534 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13535 | return CMD_WARNING; | |
13536 | } | |
13537 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
13538 | ||
7c8ff89e | 13539 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 13540 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
6aeb9e78 | 13541 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13542 | } |
13543 | ||
13544 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
13545 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 13546 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 13547 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13548 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13549 | "Route map reference\n" |
13550 | "Pointer to route-map entries\n" | |
13551 | "Metric for redistributed routes\n" | |
13552 | "Default metric\n") | |
13553 | { | |
13554 | int type; | |
13555 | u_int32_t metric; | |
7c8ff89e | 13556 | struct bgp_redist *red; |
718e3744 | 13557 | |
e0ca5fde DL |
13558 | type = proto_redistnum (AFI_IP, argv[0]); |
13559 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13560 | { |
13561 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13562 | return CMD_WARNING; | |
13563 | } | |
13564 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13565 | ||
7c8ff89e DS |
13566 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
13567 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 13568 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
6aeb9e78 | 13569 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13570 | } |
13571 | ||
13572 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
13573 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 13574 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 13575 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13576 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13577 | "Metric for redistributed routes\n" |
13578 | "Default metric\n" | |
13579 | "Route map reference\n" | |
13580 | "Pointer to route-map entries\n") | |
13581 | { | |
13582 | int type; | |
13583 | u_int32_t metric; | |
7c8ff89e | 13584 | struct bgp_redist *red; |
718e3744 | 13585 | |
e0ca5fde DL |
13586 | type = proto_redistnum (AFI_IP, argv[0]); |
13587 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13588 | { |
13589 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13590 | return CMD_WARNING; | |
13591 | } | |
13592 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
13593 | ||
7c8ff89e | 13594 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 13595 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
7c8ff89e | 13596 | bgp_redistribute_rmap_set (red, argv[2]); |
6aeb9e78 | 13597 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13598 | } |
13599 | ||
7c8ff89e DS |
13600 | DEFUN (bgp_redistribute_ipv4_ospf, |
13601 | bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 13602 | "redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
13603 | "Redistribute information from another routing protocol\n" |
13604 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13605 | "Non-main Kernel Routing Table\n" |
13606 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
13607 | { |
13608 | u_short instance; | |
7a4bb9c5 | 13609 | u_short protocol; |
7c8ff89e | 13610 | |
7a4bb9c5 DS |
13611 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13612 | ||
13613 | if (strncmp(argv[0], "o", 1) == 0) | |
13614 | protocol = ZEBRA_ROUTE_OSPF; | |
13615 | else | |
13616 | protocol = ZEBRA_ROUTE_TABLE; | |
13617 | ||
13618 | bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
6aeb9e78 | 13619 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13620 | } |
13621 | ||
13622 | DEFUN (bgp_redistribute_ipv4_ospf_rmap, | |
13623 | bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 13624 | "redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
13625 | "Redistribute information from another routing protocol\n" |
13626 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13627 | "Non-main Kernel Routing Table\n" |
13628 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13629 | "Route map reference\n" |
13630 | "Pointer to route-map entries\n") | |
13631 | { | |
13632 | struct bgp_redist *red; | |
13633 | u_short instance; | |
7a4bb9c5 | 13634 | int protocol; |
7c8ff89e | 13635 | |
7a4bb9c5 DS |
13636 | if (strncmp(argv[0], "o", 1) == 0) |
13637 | protocol = ZEBRA_ROUTE_OSPF; | |
13638 | else | |
13639 | protocol = ZEBRA_ROUTE_TABLE; | |
13640 | ||
13641 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); | |
13642 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
13643 | bgp_redistribute_rmap_set (red, argv[2]); | |
6aeb9e78 | 13644 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13645 | } |
13646 | ||
13647 | DEFUN (bgp_redistribute_ipv4_ospf_metric, | |
13648 | bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 13649 | "redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
13650 | "Redistribute information from another routing protocol\n" |
13651 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13652 | "Non-main Kernel Routing Table\n" |
13653 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13654 | "Metric for redistributed routes\n" |
13655 | "Default metric\n") | |
13656 | { | |
13657 | u_int32_t metric; | |
13658 | struct bgp_redist *red; | |
13659 | u_short instance; | |
7a4bb9c5 | 13660 | int protocol; |
7c8ff89e | 13661 | |
7a4bb9c5 DS |
13662 | if (strncmp(argv[0], "o", 1) == 0) |
13663 | protocol = ZEBRA_ROUTE_OSPF; | |
13664 | else | |
13665 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13666 | |
7a4bb9c5 DS |
13667 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13668 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13669 | ||
13670 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 13671 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
6aeb9e78 | 13672 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13673 | } |
13674 | ||
13675 | DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, | |
13676 | bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 13677 | "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
13678 | "Redistribute information from another routing protocol\n" |
13679 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13680 | "Non-main Kernel Routing Table\n" |
13681 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13682 | "Route map reference\n" |
13683 | "Pointer to route-map entries\n" | |
13684 | "Metric for redistributed routes\n" | |
13685 | "Default metric\n") | |
13686 | { | |
13687 | u_int32_t metric; | |
13688 | struct bgp_redist *red; | |
13689 | u_short instance; | |
7a4bb9c5 | 13690 | int protocol; |
7c8ff89e | 13691 | |
7a4bb9c5 DS |
13692 | if (strncmp(argv[0], "o", 1) == 0) |
13693 | protocol = ZEBRA_ROUTE_OSPF; | |
13694 | else | |
13695 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13696 | |
7a4bb9c5 DS |
13697 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13698 | VTY_GET_INTEGER ("metric", metric, argv[3]); | |
13699 | ||
13700 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
13701 | bgp_redistribute_rmap_set (red, argv[2]); | |
caf958b4 | 13702 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
6aeb9e78 | 13703 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13704 | } |
13705 | ||
13706 | DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, | |
13707 | bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 13708 | "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
13709 | "Redistribute information from another routing protocol\n" |
13710 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13711 | "Non-main Kernel Routing Table\n" |
13712 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13713 | "Metric for redistributed routes\n" |
13714 | "Default metric\n" | |
13715 | "Route map reference\n" | |
13716 | "Pointer to route-map entries\n") | |
13717 | { | |
13718 | u_int32_t metric; | |
13719 | struct bgp_redist *red; | |
13720 | u_short instance; | |
7a4bb9c5 | 13721 | int protocol; |
7c8ff89e | 13722 | |
7a4bb9c5 DS |
13723 | if (strncmp(argv[0], "o", 1) == 0) |
13724 | protocol = ZEBRA_ROUTE_OSPF; | |
13725 | else | |
13726 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13727 | |
7a4bb9c5 DS |
13728 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13729 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13730 | ||
13731 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 13732 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
7a4bb9c5 | 13733 | bgp_redistribute_rmap_set (red, argv[3]); |
6aeb9e78 | 13734 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
13735 | } |
13736 | ||
13737 | DEFUN (no_bgp_redistribute_ipv4_ospf, | |
13738 | no_bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 13739 | "no redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
13740 | NO_STR |
13741 | "Redistribute information from another routing protocol\n" | |
13742 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13743 | "Non-main Kernel Routing Table\n" |
13744 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
13745 | { |
13746 | u_short instance; | |
7a4bb9c5 DS |
13747 | int protocol; |
13748 | ||
13749 | if (strncmp(argv[0], "o", 1) == 0) | |
13750 | protocol = ZEBRA_ROUTE_OSPF; | |
13751 | else | |
13752 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 13753 | |
7a4bb9c5 DS |
13754 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
13755 | return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); | |
7c8ff89e DS |
13756 | } |
13757 | ||
13758 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13759 | no_bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 13760 | "no redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
13761 | NO_STR |
13762 | "Redistribute information from another routing protocol\n" | |
13763 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13764 | "Non-main Kernel Routing Table\n" |
13765 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13766 | "Route map reference\n" |
13767 | "Pointer to route-map entries\n") | |
13768 | ||
13769 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13770 | no_bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 13771 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
13772 | NO_STR |
13773 | "Redistribute information from another routing protocol\n" | |
13774 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13775 | "Non-main Kernel Routing Table\n" |
13776 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13777 | "Metric for redistributed routes\n" |
13778 | "Default metric\n") | |
13779 | ||
13780 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13781 | no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 13782 | "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
13783 | NO_STR |
13784 | "Redistribute information from another routing protocol\n" | |
13785 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
13786 | "Non-main Kernel Routing Table\n" |
13787 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
13788 | "Route map reference\n" |
13789 | "Pointer to route-map entries\n" | |
13790 | "Metric for redistributed routes\n" | |
13791 | "Default metric\n") | |
13792 | ||
13793 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
13794 | no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 13795 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
13796 | NO_STR |
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 | "Metric for redistributed routes\n" |
13802 | "Default metric\n" | |
13803 | "Route map reference\n" | |
13804 | "Pointer to route-map entries\n") | |
13805 | ||
718e3744 | 13806 | DEFUN (no_bgp_redistribute_ipv4, |
13807 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 13808 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 13809 | NO_STR |
13810 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 13811 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 13812 | { |
13813 | int type; | |
13814 | ||
e0ca5fde DL |
13815 | type = proto_redistnum (AFI_IP, argv[0]); |
13816 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13817 | { |
13818 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13819 | return CMD_WARNING; | |
13820 | } | |
7c8ff89e | 13821 | return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); |
718e3744 | 13822 | } |
13823 | ||
503006bc | 13824 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 13825 | no_bgp_redistribute_ipv4_rmap_cmd, |
e0ca5fde | 13826 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 13827 | NO_STR |
13828 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 13829 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13830 | "Route map reference\n" |
13831 | "Pointer to route-map entries\n") | |
718e3744 | 13832 | |
503006bc | 13833 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 13834 | no_bgp_redistribute_ipv4_metric_cmd, |
e0ca5fde | 13835 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 13836 | NO_STR |
13837 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 13838 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13839 | "Metric for redistributed routes\n" |
13840 | "Default metric\n") | |
718e3744 | 13841 | |
503006bc | 13842 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 13843 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
e0ca5fde | 13844 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 13845 | NO_STR |
13846 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 13847 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13848 | "Route map reference\n" |
13849 | "Pointer to route-map entries\n" | |
13850 | "Metric for redistributed routes\n" | |
13851 | "Default metric\n") | |
718e3744 | 13852 | |
503006bc | 13853 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 13854 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
e0ca5fde | 13855 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 13856 | NO_STR |
13857 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 13858 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13859 | "Metric for redistributed routes\n" |
13860 | "Default metric\n" | |
13861 | "Route map reference\n" | |
13862 | "Pointer to route-map entries\n") | |
6b0655a2 | 13863 | |
718e3744 | 13864 | #ifdef HAVE_IPV6 |
13865 | DEFUN (bgp_redistribute_ipv6, | |
13866 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 13867 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 13868 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13869 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 13870 | { |
13871 | int type; | |
13872 | ||
e0ca5fde DL |
13873 | type = proto_redistnum (AFI_IP6, argv[0]); |
13874 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13875 | { |
13876 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13877 | return CMD_WARNING; | |
13878 | } | |
13879 | ||
7c8ff89e | 13880 | bgp_redist_add(vty->index, AFI_IP6, type, 0); |
6aeb9e78 | 13881 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 13882 | } |
13883 | ||
13884 | DEFUN (bgp_redistribute_ipv6_rmap, | |
13885 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 13886 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 13887 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13888 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 13889 | "Route map reference\n" |
13890 | "Pointer to route-map entries\n") | |
13891 | { | |
13892 | int type; | |
7c8ff89e | 13893 | struct bgp_redist *red; |
718e3744 | 13894 | |
e0ca5fde DL |
13895 | type = proto_redistnum (AFI_IP6, argv[0]); |
13896 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13897 | { |
13898 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13899 | return CMD_WARNING; | |
13900 | } | |
13901 | ||
7c8ff89e DS |
13902 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
13903 | bgp_redistribute_rmap_set (red, argv[1]); | |
6aeb9e78 | 13904 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 13905 | } |
13906 | ||
13907 | DEFUN (bgp_redistribute_ipv6_metric, | |
13908 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 13909 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 13910 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13911 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 13912 | "Metric for redistributed routes\n" |
13913 | "Default metric\n") | |
13914 | { | |
13915 | int type; | |
13916 | u_int32_t metric; | |
7c8ff89e | 13917 | struct bgp_redist *red; |
718e3744 | 13918 | |
e0ca5fde DL |
13919 | type = proto_redistnum (AFI_IP6, argv[0]); |
13920 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13921 | { |
13922 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13923 | return CMD_WARNING; | |
13924 | } | |
13925 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
13926 | ||
7c8ff89e | 13927 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 13928 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
6aeb9e78 | 13929 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 13930 | } |
13931 | ||
13932 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
13933 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 13934 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 13935 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13936 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 13937 | "Route map reference\n" |
13938 | "Pointer to route-map entries\n" | |
13939 | "Metric for redistributed routes\n" | |
13940 | "Default metric\n") | |
13941 | { | |
13942 | int type; | |
13943 | u_int32_t metric; | |
7c8ff89e | 13944 | struct bgp_redist *red; |
718e3744 | 13945 | |
e0ca5fde DL |
13946 | type = proto_redistnum (AFI_IP6, argv[0]); |
13947 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13948 | { |
13949 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13950 | return CMD_WARNING; | |
13951 | } | |
13952 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
13953 | ||
7c8ff89e DS |
13954 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
13955 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 13956 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
6aeb9e78 | 13957 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 13958 | } |
13959 | ||
13960 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
13961 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 13962 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 13963 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13964 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 13965 | "Metric for redistributed routes\n" |
13966 | "Default metric\n" | |
13967 | "Route map reference\n" | |
13968 | "Pointer to route-map entries\n") | |
13969 | { | |
13970 | int type; | |
13971 | u_int32_t metric; | |
7c8ff89e | 13972 | struct bgp_redist *red; |
718e3744 | 13973 | |
e0ca5fde DL |
13974 | type = proto_redistnum (AFI_IP6, argv[0]); |
13975 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13976 | { |
13977 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13978 | return CMD_WARNING; | |
13979 | } | |
13980 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
13981 | ||
7c8ff89e | 13982 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 13983 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric); |
7c8ff89e | 13984 | bgp_redistribute_rmap_set (red, argv[2]); |
6aeb9e78 | 13985 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 13986 | } |
13987 | ||
13988 | DEFUN (no_bgp_redistribute_ipv6, | |
13989 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 13990 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 13991 | NO_STR |
13992 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 13993 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 13994 | { |
13995 | int type; | |
13996 | ||
e0ca5fde DL |
13997 | type = proto_redistnum (AFI_IP6, argv[0]); |
13998 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 13999 | { |
14000 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14001 | return CMD_WARNING; | |
14002 | } | |
14003 | ||
7c8ff89e | 14004 | return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0); |
718e3744 | 14005 | } |
14006 | ||
503006bc | 14007 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14008 | no_bgp_redistribute_ipv6_rmap_cmd, |
e0ca5fde | 14009 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 14010 | NO_STR |
14011 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14012 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14013 | "Route map reference\n" |
14014 | "Pointer to route-map entries\n") | |
718e3744 | 14015 | |
503006bc | 14016 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14017 | no_bgp_redistribute_ipv6_metric_cmd, |
e0ca5fde | 14018 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 14019 | NO_STR |
14020 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14021 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14022 | "Metric for redistributed routes\n" |
14023 | "Default metric\n") | |
718e3744 | 14024 | |
503006bc | 14025 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14026 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
e0ca5fde | 14027 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 14028 | NO_STR |
14029 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14030 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14031 | "Route map reference\n" |
14032 | "Pointer to route-map entries\n" | |
14033 | "Metric for redistributed routes\n" | |
14034 | "Default metric\n") | |
718e3744 | 14035 | |
503006bc | 14036 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 14037 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
e0ca5fde | 14038 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 14039 | NO_STR |
14040 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14041 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14042 | "Metric for redistributed routes\n" |
14043 | "Default metric\n" | |
14044 | "Route map reference\n" | |
14045 | "Pointer to route-map entries\n") | |
14046 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 14047 | |
718e3744 | 14048 | int |
14049 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
14050 | safi_t safi, int *write) | |
14051 | { | |
14052 | int i; | |
718e3744 | 14053 | |
14054 | /* Unicast redistribution only. */ | |
14055 | if (safi != SAFI_UNICAST) | |
14056 | return 0; | |
14057 | ||
14058 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
14059 | { | |
14060 | /* Redistribute BGP does not make sense. */ | |
7c8ff89e | 14061 | if (i != ZEBRA_ROUTE_BGP) |
718e3744 | 14062 | { |
7c8ff89e DS |
14063 | struct list *red_list; |
14064 | struct listnode *node; | |
14065 | struct bgp_redist *red; | |
718e3744 | 14066 | |
7c8ff89e DS |
14067 | red_list = bgp->redist[afi][i]; |
14068 | if (!red_list) | |
14069 | continue; | |
718e3744 | 14070 | |
7c8ff89e DS |
14071 | for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) |
14072 | { | |
14073 | /* Display "address-family" when it is not yet diplayed. */ | |
14074 | bgp_config_write_family_header (vty, afi, safi, write); | |
14075 | ||
14076 | /* "redistribute" configuration. */ | |
0b960b4d | 14077 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
7c8ff89e DS |
14078 | if (red->instance) |
14079 | vty_out (vty, " %d", red->instance); | |
14080 | if (red->redist_metric_flag) | |
14081 | vty_out (vty, " metric %u", red->redist_metric); | |
14082 | if (red->rmap.name) | |
14083 | vty_out (vty, " route-map %s", red->rmap.name); | |
14084 | vty_out (vty, "%s", VTY_NEWLINE); | |
14085 | } | |
718e3744 | 14086 | } |
14087 | } | |
14088 | return *write; | |
14089 | } | |
6b0655a2 | 14090 | |
718e3744 | 14091 | /* BGP node structure. */ |
7fc626de | 14092 | static struct cmd_node bgp_node = |
718e3744 | 14093 | { |
14094 | BGP_NODE, | |
14095 | "%s(config-router)# ", | |
14096 | 1, | |
14097 | }; | |
14098 | ||
7fc626de | 14099 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 14100 | { |
14101 | BGP_IPV4_NODE, | |
14102 | "%s(config-router-af)# ", | |
14103 | 1, | |
14104 | }; | |
14105 | ||
7fc626de | 14106 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 14107 | { |
14108 | BGP_IPV4M_NODE, | |
14109 | "%s(config-router-af)# ", | |
14110 | 1, | |
14111 | }; | |
14112 | ||
7fc626de | 14113 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 14114 | { |
14115 | BGP_IPV6_NODE, | |
14116 | "%s(config-router-af)# ", | |
14117 | 1, | |
14118 | }; | |
14119 | ||
7fc626de | 14120 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 14121 | { |
14122 | BGP_IPV6M_NODE, | |
14123 | "%s(config-router-af)# ", | |
14124 | 1, | |
14125 | }; | |
14126 | ||
7fc626de | 14127 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 14128 | { |
14129 | BGP_VPNV4_NODE, | |
14130 | "%s(config-router-af)# ", | |
14131 | 1 | |
14132 | }; | |
6b0655a2 | 14133 | |
8ecd3266 | 14134 | static struct cmd_node bgp_vpnv6_node = |
14135 | { | |
14136 | BGP_VPNV6_NODE, | |
14137 | "%s(config-router-af-vpnv6)# ", | |
14138 | 1 | |
14139 | }; | |
14140 | ||
1f8ae70b | 14141 | static void community_list_vty (void); |
14142 | ||
718e3744 | 14143 | void |
94f2b392 | 14144 | bgp_vty_init (void) |
718e3744 | 14145 | { |
718e3744 | 14146 | /* Install bgp top node. */ |
14147 | install_node (&bgp_node, bgp_config_write); | |
14148 | install_node (&bgp_ipv4_unicast_node, NULL); | |
14149 | install_node (&bgp_ipv4_multicast_node, NULL); | |
14150 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 14151 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 14152 | install_node (&bgp_vpnv4_node, NULL); |
8ecd3266 | 14153 | install_node (&bgp_vpnv6_node, NULL); |
718e3744 | 14154 | |
14155 | /* Install default VTY commands to new nodes. */ | |
14156 | install_default (BGP_NODE); | |
14157 | install_default (BGP_IPV4_NODE); | |
14158 | install_default (BGP_IPV4M_NODE); | |
14159 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 14160 | install_default (BGP_IPV6M_NODE); |
718e3744 | 14161 | install_default (BGP_VPNV4_NODE); |
8ecd3266 | 14162 | install_default (BGP_VPNV6_NODE); |
718e3744 | 14163 | |
14164 | /* "bgp multiple-instance" commands. */ | |
14165 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
14166 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
14167 | ||
14168 | /* "bgp config-type" commands. */ | |
14169 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
813d4307 | 14170 | install_element (CONFIG_NODE, &no_bgp_config_type_val_cmd); |
718e3744 | 14171 | |
5fe9f963 | 14172 | /* bgp route-map delay-timer commands. */ |
14173 | install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd); | |
14174 | install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
14175 | install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); | |
14176 | ||
718e3744 | 14177 | /* Dummy commands (Currently not supported) */ |
14178 | install_element (BGP_NODE, &no_synchronization_cmd); | |
14179 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
14180 | ||
14181 | /* "router bgp" commands. */ | |
14182 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
6aeb9e78 | 14183 | install_element (CONFIG_NODE, &router_bgp_instance_cmd); |
2385a876 | 14184 | install_element (CONFIG_NODE, &router_bgp_noasn_cmd); |
718e3744 | 14185 | |
14186 | /* "no router bgp" commands. */ | |
14187 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
6aeb9e78 | 14188 | install_element (CONFIG_NODE, &no_router_bgp_instance_cmd); |
718e3744 | 14189 | |
14190 | /* "bgp router-id" commands. */ | |
14191 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
14192 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
14193 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
14194 | ||
14195 | /* "bgp cluster-id" commands. */ | |
14196 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
14197 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
14198 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
813d4307 DW |
14199 | install_element (BGP_NODE, &no_bgp_cluster_id_ip_cmd); |
14200 | install_element (BGP_NODE, &no_bgp_cluster_id_decimal_cmd); | |
718e3744 | 14201 | |
14202 | /* "bgp confederation" commands. */ | |
14203 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
14204 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
14205 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
14206 | ||
14207 | /* "bgp confederation peers" commands. */ | |
14208 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
14209 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
14210 | ||
abc920f8 DS |
14211 | /* bgp max-med command */ |
14212 | install_element (BGP_NODE, &bgp_maxmed_admin_cmd); | |
14213 | install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd); | |
14214 | install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); | |
14215 | install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd); | |
14216 | install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); | |
14217 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); | |
14218 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd); | |
14219 | install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); | |
14220 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd); | |
14221 | ||
907f92c8 DS |
14222 | /* bgp disable-ebgp-connected-nh-check */ |
14223 | install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd); | |
14224 | install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd); | |
14225 | ||
f188f2c4 DS |
14226 | /* bgp update-delay command */ |
14227 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
14228 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
14229 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
14230 | install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); | |
14231 | ||
cb1faec9 DS |
14232 | install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); |
14233 | install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); | |
14234 | ||
3f9c7369 DS |
14235 | install_element (BGP_NODE, &bgp_coalesce_time_cmd); |
14236 | install_element (BGP_NODE, &no_bgp_coalesce_time_cmd); | |
14237 | ||
165b5fff JB |
14238 | /* "maximum-paths" commands. */ |
14239 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
14240 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
14241 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); | |
14242 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); | |
14243 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
14244 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); | |
431aa9f9 DS |
14245 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
14246 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
14247 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); | |
165b5fff | 14248 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14249 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff JB |
14250 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
14251 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 14252 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14253 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14254 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14255 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14256 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14257 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
431aa9f9 | 14258 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14259 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 DS |
14260 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
14261 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 14262 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14263 | |
718e3744 | 14264 | /* "timers bgp" commands. */ |
14265 | install_element (BGP_NODE, &bgp_timers_cmd); | |
14266 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
14267 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
14268 | ||
5fe9f963 | 14269 | /* route-map delay-timer commands - per instance for backwards compat. */ |
518f0eb1 DS |
14270 | install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd); |
14271 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
f414725f | 14272 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); |
518f0eb1 | 14273 | |
718e3744 | 14274 | /* "bgp client-to-client reflection" commands */ |
14275 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
14276 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
14277 | ||
14278 | /* "bgp always-compare-med" commands */ | |
14279 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
14280 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
14281 | ||
14282 | /* "bgp deterministic-med" commands */ | |
14283 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
14284 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 14285 | |
538621f2 | 14286 | /* "bgp graceful-restart" commands */ |
14287 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
14288 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 14289 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
14290 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
14291 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 14292 | |
14293 | /* "bgp fast-external-failover" commands */ | |
14294 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
14295 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
14296 | ||
14297 | /* "bgp enforce-first-as" commands */ | |
14298 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
14299 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
14300 | ||
14301 | /* "bgp bestpath compare-routerid" commands */ | |
14302 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
14303 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
14304 | ||
14305 | /* "bgp bestpath as-path ignore" commands */ | |
14306 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
14307 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
14308 | ||
6811845b | 14309 | /* "bgp bestpath as-path confed" commands */ |
14310 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
14311 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
14312 | ||
2fdd455c PM |
14313 | /* "bgp bestpath as-path multipath-relax" commands */ |
14314 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
14315 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
14316 | ||
848973c7 | 14317 | /* "bgp log-neighbor-changes" commands */ |
14318 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
14319 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
14320 | ||
718e3744 | 14321 | /* "bgp bestpath med" commands */ |
14322 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
14323 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
14324 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
14325 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
14326 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
14327 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
14328 | ||
14329 | /* "no bgp default ipv4-unicast" commands. */ | |
14330 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
14331 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
14332 | ||
14333 | /* "bgp network import-check" commands. */ | |
14334 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
8233ef81 | 14335 | install_element (BGP_NODE, &bgp_network_import_check_exact_cmd); |
718e3744 | 14336 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
14337 | ||
14338 | /* "bgp default local-preference" commands. */ | |
14339 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
14340 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
14341 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
14342 | ||
04b6bdc0 DW |
14343 | /* bgp default show-hostname */ |
14344 | install_element (BGP_NODE, &bgp_default_show_hostname_cmd); | |
14345 | install_element (BGP_NODE, &no_bgp_default_show_hostname_cmd); | |
14346 | ||
3f9c7369 DS |
14347 | /* "bgp default subgroup-pkt-queue-max" commands. */ |
14348 | install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd); | |
14349 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd); | |
813d4307 | 14350 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_val_cmd); |
3f9c7369 | 14351 | |
8bd9d948 DS |
14352 | /* bgp ibgp-allow-policy-mods command */ |
14353 | install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd); | |
14354 | install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd); | |
14355 | ||
f14e6fdb DS |
14356 | /* "bgp listen limit" commands. */ |
14357 | install_element (BGP_NODE, &bgp_listen_limit_cmd); | |
14358 | install_element (BGP_NODE, &no_bgp_listen_limit_cmd); | |
813d4307 | 14359 | install_element (BGP_NODE, &no_bgp_listen_limit_val_cmd); |
f14e6fdb DS |
14360 | |
14361 | /* "bgp listen range" commands. */ | |
14362 | install_element (BGP_NODE, &bgp_listen_range_cmd); | |
14363 | install_element (BGP_NODE, &no_bgp_listen_range_cmd); | |
14364 | ||
718e3744 | 14365 | /* "neighbor remote-as" commands. */ |
14366 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
a80beece | 14367 | install_element (BGP_NODE, &neighbor_interface_config_cmd); |
4c48cf63 DW |
14368 | install_element (BGP_NODE, &neighbor_interface_config_v6only_cmd); |
14369 | install_element (BGP_NODE, &neighbor_interface_config_peergroup_cmd); | |
14370 | install_element (BGP_NODE, &neighbor_interface_config_v6only_peergroup_cmd); | |
718e3744 | 14371 | install_element (BGP_NODE, &no_neighbor_cmd); |
14372 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
a80beece | 14373 | install_element (BGP_NODE, &no_neighbor_interface_config_cmd); |
4c48cf63 DW |
14374 | install_element (BGP_NODE, &no_neighbor_interface_config_v6only_cmd); |
14375 | install_element (BGP_NODE, &no_neighbor_interface_config_peergroup_cmd); | |
14376 | install_element (BGP_NODE, &no_neighbor_interface_config_v6only_peergroup_cmd); | |
718e3744 | 14377 | |
14378 | /* "neighbor peer-group" commands. */ | |
14379 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
14380 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
a80beece | 14381 | install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd); |
718e3744 | 14382 | |
14383 | /* "neighbor local-as" commands. */ | |
14384 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
14385 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 14386 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 14387 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
14388 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
14389 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
9d3f9705 | 14390 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
718e3744 | 14391 | |
3f9c7369 DS |
14392 | /* "neighbor solo" commands. */ |
14393 | install_element (BGP_NODE, &neighbor_solo_cmd); | |
14394 | install_element (BGP_NODE, &no_neighbor_solo_cmd); | |
14395 | ||
0df7c91f PJ |
14396 | /* "neighbor password" commands. */ |
14397 | install_element (BGP_NODE, &neighbor_password_cmd); | |
14398 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
813d4307 | 14399 | install_element (BGP_NODE, &no_neighbor_password_val_cmd); |
0df7c91f | 14400 | |
718e3744 | 14401 | /* "neighbor activate" commands. */ |
14402 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
14403 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
14404 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
14405 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 14406 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 14407 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
8ecd3266 | 14408 | install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd); |
718e3744 | 14409 | |
14410 | /* "no neighbor activate" commands. */ | |
14411 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
14412 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
14413 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
14414 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 14415 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 14416 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
8ecd3266 | 14417 | install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd); |
718e3744 | 14418 | |
c8560b44 DW |
14419 | /* "neighbor peer-group" set commands. |
14420 | * Long term we should only accept this command under BGP_NODE and not all of | |
14421 | * the afi/safi sub-contexts. For now though we need to accept it for backwards | |
14422 | * compatibility. This changed when we stopped requiring that peers be assigned | |
14423 | * to their peer-group under each address-family sub-context. | |
14424 | */ | |
718e3744 | 14425 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
14426 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
14427 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
14428 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 14429 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 14430 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
8ecd3266 | 14431 | install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd); |
c8560b44 | 14432 | |
718e3744 | 14433 | /* "no neighbor peer-group unset" commands. */ |
14434 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
14435 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
14436 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
14437 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 14438 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 14439 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
8ecd3266 | 14440 | install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 14441 | |
718e3744 | 14442 | /* "neighbor softreconfiguration inbound" commands.*/ |
14443 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
14444 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14445 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
14446 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14447 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
14448 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14449 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
14450 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 14451 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
14452 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 14453 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
14454 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8ecd3266 | 14455 | install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd); |
14456 | install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 14457 | |
14458 | /* "neighbor attribute-unchanged" commands. */ | |
14459 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
14460 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
14461 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
14462 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
14463 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
14464 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
14465 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
14466 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
14467 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
14468 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
14469 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
14470 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
14471 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14472 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14473 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14474 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14475 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14476 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14477 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14478 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14479 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14480 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14481 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
14482 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
14483 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
14484 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
14485 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
14486 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
14487 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
14488 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
14489 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
14490 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
14491 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
14492 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
14493 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14494 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14495 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14496 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14497 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14498 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14499 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14500 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14501 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14502 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14503 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
14504 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
14505 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
14506 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
14507 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
14508 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
14509 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
14510 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
14511 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
14512 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
14513 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
14514 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
14515 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14516 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14517 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14518 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14519 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14520 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14521 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14522 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14523 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14524 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14525 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
14526 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14527 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14528 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14529 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
14530 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
14531 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
14532 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
14533 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
14534 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
14535 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
14536 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
14537 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14538 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14539 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14540 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14541 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14542 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14543 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14544 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14545 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14546 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 14547 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
14548 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
14549 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
14550 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
14551 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
14552 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
14553 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
14554 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
14555 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
14556 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
14557 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
14558 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
14559 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14560 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14561 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14562 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14563 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14564 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14565 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14566 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14567 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14568 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 14569 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
14570 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
14571 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
14572 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
14573 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
14574 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
14575 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
14576 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
14577 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
14578 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
14579 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
14580 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
14581 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14582 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14583 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14584 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14585 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14586 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14587 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14588 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14589 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14590 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
8ecd3266 | 14591 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd); |
14592 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14593 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14594 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14595 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd); | |
14596 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd); | |
14597 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd); | |
14598 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd); | |
14599 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd); | |
14600 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd); | |
14601 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd); | |
14602 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
14603 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14604 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14605 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14606 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
14607 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
14608 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
14609 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
14610 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
14611 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
14612 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
14613 | ||
718e3744 | 14614 | |
fee0f4c6 | 14615 | /* "nexthop-local unchanged" commands */ |
14616 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
14617 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
14618 | ||
718e3744 | 14619 | /* "neighbor next-hop-self" commands. */ |
14620 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
14621 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
14622 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
14623 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
14624 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
14625 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
14626 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
14627 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 14628 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
14629 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 14630 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
14631 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
8ecd3266 | 14632 | install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd); |
14633 | install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 14634 | |
a538debe DS |
14635 | /* "neighbor next-hop-self force" commands. */ |
14636 | install_element (BGP_NODE, &neighbor_nexthop_self_force_cmd); | |
14637 | install_element (BGP_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14638 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd); | |
14639 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14640 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd); | |
14641 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14642 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd); | |
14643 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14644 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd); | |
14645 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14646 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd); | |
14647 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
8ecd3266 | 14648 | install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_force_cmd); |
14649 | install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
a538debe | 14650 | |
c7122e14 DS |
14651 | /* "neighbor as-override" commands. */ |
14652 | install_element (BGP_NODE, &neighbor_as_override_cmd); | |
14653 | install_element (BGP_NODE, &no_neighbor_as_override_cmd); | |
14654 | install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd); | |
14655 | install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd); | |
14656 | install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd); | |
14657 | install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd); | |
14658 | install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd); | |
14659 | install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd); | |
14660 | install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd); | |
14661 | install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd); | |
14662 | install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd); | |
14663 | install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd); | |
8ecd3266 | 14664 | install_element (BGP_VPNV6_NODE, &neighbor_as_override_cmd); |
14665 | install_element (BGP_VPNV6_NODE, &no_neighbor_as_override_cmd); | |
c7122e14 | 14666 | |
718e3744 | 14667 | /* "neighbor remove-private-AS" commands. */ |
14668 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
14669 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14670 | install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd); |
14671 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14672 | install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14673 | install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14674 | install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14675 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14676 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
14677 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14678 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd); |
14679 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14680 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14681 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14682 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14683 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14684 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
14685 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14686 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd); |
14687 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14688 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14689 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14690 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14691 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14692 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
14693 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14694 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd); |
14695 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14696 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14697 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14698 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14699 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
25ffbdc1 | 14700 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
14701 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14702 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd); |
14703 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14704 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14705 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14706 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14707 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14708 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
14709 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14710 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd); |
14711 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14712 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14713 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14714 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14715 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
8ecd3266 | 14716 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd); |
14717 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd); | |
14718 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_cmd); | |
14719 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14720 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
14721 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
14722 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
14723 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 14724 | |
14725 | /* "neighbor send-community" commands.*/ | |
14726 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
14727 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
14728 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
14729 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
14730 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
14731 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
14732 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
14733 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
14734 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
14735 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
14736 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
14737 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
14738 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
14739 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
14740 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
14741 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 14742 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
14743 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
14744 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
14745 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 14746 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
14747 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
14748 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
14749 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
8ecd3266 | 14750 | install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd); |
14751 | install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd); | |
14752 | install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd); | |
14753 | install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 14754 | |
14755 | /* "neighbor route-reflector" commands.*/ | |
14756 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
14757 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
14758 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
14759 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
14760 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
14761 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
14762 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
14763 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 14764 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
14765 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 14766 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
14767 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
8ecd3266 | 14768 | install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd); |
14769 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 14770 | |
14771 | /* "neighbor route-server" commands.*/ | |
14772 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
14773 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
14774 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
14775 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
14776 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
14777 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
14778 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
14779 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 14780 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
14781 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 14782 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
14783 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
8ecd3266 | 14784 | install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd); |
14785 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 14786 | |
adbac85e DW |
14787 | /* "neighbor addpath-tx-all-paths" commands.*/ |
14788 | install_element (BGP_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
14789 | install_element (BGP_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
14790 | install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
14791 | install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
14792 | install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
14793 | install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
14794 | install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
14795 | install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
14796 | install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
14797 | install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
14798 | install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
14799 | install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
8ecd3266 | 14800 | install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_all_paths_cmd); |
14801 | install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
adbac85e | 14802 | |
06370dac DW |
14803 | /* "neighbor addpath-tx-bestpath-per-AS" commands.*/ |
14804 | install_element (BGP_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
14805 | install_element (BGP_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
14806 | install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
14807 | install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
14808 | install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
14809 | install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
14810 | install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
14811 | install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
14812 | install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
14813 | install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
14814 | install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
14815 | install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
8ecd3266 | 14816 | install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); |
14817 | install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
06370dac | 14818 | |
718e3744 | 14819 | /* "neighbor passive" commands. */ |
14820 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
14821 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
14822 | ||
d5a5c8f0 | 14823 | |
718e3744 | 14824 | /* "neighbor shutdown" commands. */ |
14825 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
14826 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
14827 | ||
8a92a8a0 DS |
14828 | /* "neighbor capability extended-nexthop" commands.*/ |
14829 | install_element (BGP_NODE, &neighbor_capability_enhe_cmd); | |
14830 | install_element (BGP_NODE, &no_neighbor_capability_enhe_cmd); | |
14831 | ||
718e3744 | 14832 | /* "neighbor capability orf prefix-list" commands.*/ |
14833 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
14834 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
14835 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
14836 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
14837 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
14838 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
14839 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
14840 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 14841 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
14842 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 14843 | |
14844 | /* "neighbor capability dynamic" commands.*/ | |
14845 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
14846 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
14847 | ||
14848 | /* "neighbor dont-capability-negotiate" commands. */ | |
14849 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
14850 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
14851 | ||
14852 | /* "neighbor ebgp-multihop" commands. */ | |
14853 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
14854 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
14855 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
14856 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
14857 | ||
6ffd2079 | 14858 | /* "neighbor disable-connected-check" commands. */ |
14859 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
14860 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 14861 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
14862 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
14863 | ||
14864 | /* "neighbor description" commands. */ | |
14865 | install_element (BGP_NODE, &neighbor_description_cmd); | |
14866 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
14867 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
14868 | ||
14869 | /* "neighbor update-source" commands. "*/ | |
14870 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
14871 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
14872 | ||
14873 | /* "neighbor default-originate" commands. */ | |
14874 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
14875 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
14876 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
14877 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
14878 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
14879 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
14880 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
14881 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
14882 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
14883 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
14884 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
14885 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
14886 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
14887 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
14888 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
14889 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 14890 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
14891 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
14892 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
14893 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 14894 | |
14895 | /* "neighbor port" commands. */ | |
14896 | install_element (BGP_NODE, &neighbor_port_cmd); | |
14897 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
14898 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
14899 | ||
14900 | /* "neighbor weight" commands. */ | |
14901 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
14902 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
14903 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
14904 | ||
14905 | /* "neighbor override-capability" commands. */ | |
14906 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
14907 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
14908 | ||
14909 | /* "neighbor strict-capability-match" commands. */ | |
14910 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
14911 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
14912 | ||
14913 | /* "neighbor timers" commands. */ | |
14914 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
14915 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
813d4307 | 14916 | install_element (BGP_NODE, &no_neighbor_timers_val_cmd); |
718e3744 | 14917 | |
14918 | /* "neighbor timers connect" commands. */ | |
14919 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
14920 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
14921 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
14922 | ||
14923 | /* "neighbor advertisement-interval" commands. */ | |
14924 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
14925 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
14926 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
14927 | ||
718e3744 | 14928 | /* "neighbor interface" commands. */ |
14929 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
14930 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
14931 | ||
14932 | /* "neighbor distribute" commands. */ | |
14933 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
14934 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
14935 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
14936 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
14937 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
14938 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
14939 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
14940 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 14941 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
14942 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 14943 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
14944 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
8ecd3266 | 14945 | install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd); |
14946 | install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 14947 | |
14948 | /* "neighbor prefix-list" commands. */ | |
14949 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
14950 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
14951 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
14952 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
14953 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
14954 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
14955 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
14956 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 14957 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
14958 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 14959 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
14960 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
8ecd3266 | 14961 | install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd); |
14962 | install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 14963 | |
14964 | /* "neighbor filter-list" commands. */ | |
14965 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
14966 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
14967 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
14968 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
14969 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
14970 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
14971 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
14972 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 14973 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
14974 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 14975 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
14976 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
8ecd3266 | 14977 | install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd); |
14978 | install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 14979 | |
14980 | /* "neighbor route-map" commands. */ | |
14981 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
14982 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
14983 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
14984 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
14985 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
14986 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
14987 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
14988 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 14989 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
14990 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 14991 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
14992 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
8ecd3266 | 14993 | install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd); |
14994 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 14995 | |
14996 | /* "neighbor unsuppress-map" commands. */ | |
14997 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
14998 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
14999 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
15000 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
15001 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
15002 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
15003 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
15004 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 15005 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
15006 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 15007 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
bb86c601 | 15008 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
8ecd3266 | 15009 | install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd); |
bb86c601 | 15010 | install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd); |
718e3744 | 15011 | |
15012 | /* "neighbor maximum-prefix" commands. */ | |
15013 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 15014 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15015 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15016 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15017 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
15018 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15019 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
15020 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15021 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15022 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15023 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15024 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15025 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15026 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15027 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15028 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15029 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15030 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
15031 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15032 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
15033 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15034 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15035 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15036 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15037 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15038 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15039 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15040 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15041 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15042 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15043 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
15044 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15045 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
15046 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15047 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15048 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15049 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15050 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15051 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15052 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15053 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15054 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15055 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15056 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
15057 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15058 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
15059 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15060 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15061 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15062 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15063 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15064 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 15065 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
15066 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15067 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15068 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15069 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15070 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15071 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
15072 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15073 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15074 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15075 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15076 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15077 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15078 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15079 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15080 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15081 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15082 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
15083 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15084 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
15085 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 15086 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
15087 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15088 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15089 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15090 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
8ecd3266 | 15091 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd); |
15092 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15093 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15094 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15095 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15096 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15097 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd); | |
15098 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
15099 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
15100 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
15101 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
15102 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
15103 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15104 | |
15105 | /* "neighbor allowas-in" */ | |
15106 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
15107 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
15108 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15109 | install_element (BGP_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15110 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
15111 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
15112 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15113 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15114 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
15115 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
15116 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15117 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15118 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
15119 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
15120 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15121 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_val_cmd); |
25ffbdc1 | 15122 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
15123 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
15124 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15125 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 15126 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
15127 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
15128 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 15129 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_val_cmd); |
8ecd3266 | 15130 | install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd); |
15131 | install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd); | |
15132 | install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd); | |
15133 | install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_val_cmd); | |
718e3744 | 15134 | |
15135 | /* address-family commands. */ | |
15136 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
15137 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
15138 | #ifdef HAVE_IPV6 | |
15139 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 15140 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 15141 | #endif /* HAVE_IPV6 */ |
15142 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
15143 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
15144 | ||
15145 | /* "exit-address-family" command. */ | |
15146 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
15147 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
15148 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 15149 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 15150 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
8ecd3266 | 15151 | install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); |
718e3744 | 15152 | |
15153 | /* "clear ip bgp commands" */ | |
15154 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
15155 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
15156 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
01080f7c | 15157 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_cmd); |
718e3744 | 15158 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); |
01080f7c | 15159 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_cmd); |
718e3744 | 15160 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); |
01080f7c | 15161 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_cmd); |
718e3744 | 15162 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); |
01080f7c | 15163 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_cmd); |
15164 | ||
718e3744 | 15165 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); |
15166 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
15167 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
01080f7c | 15168 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_cmd); |
718e3744 | 15169 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); |
01080f7c | 15170 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_cmd); |
718e3744 | 15171 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); |
01080f7c | 15172 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_cmd); |
718e3744 | 15173 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); |
01080f7c | 15174 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_cmd); |
718e3744 | 15175 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); |
01080f7c | 15176 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_cmd); |
718e3744 | 15177 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); |
01080f7c | 15178 | install_element (ENABLE_NODE, &clear_bgp_instance_external_cmd); |
718e3744 | 15179 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); |
01080f7c | 15180 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_cmd); |
718e3744 | 15181 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); |
01080f7c | 15182 | install_element (ENABLE_NODE, &clear_bgp_instance_as_cmd); |
718e3744 | 15183 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); |
01080f7c | 15184 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_cmd); |
718e3744 | 15185 | |
15186 | /* "clear ip bgp neighbor soft in" */ | |
15187 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
15188 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
15189 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
01080f7c | 15190 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_cmd); |
718e3744 | 15191 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
718e3744 | 15192 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
01080f7c | 15193 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_in_cmd); |
718e3744 | 15194 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); |
01080f7c | 15195 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_in_cmd); |
718e3744 | 15196 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
15197 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
01080f7c | 15198 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_in_cmd); |
718e3744 | 15199 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); |
01080f7c | 15200 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_in_cmd); |
718e3744 | 15201 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
15202 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
01080f7c | 15203 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_in_cmd); |
718e3744 | 15204 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); |
01080f7c | 15205 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_in_cmd); |
718e3744 | 15206 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
15207 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
01080f7c | 15208 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_in_cmd); |
718e3744 | 15209 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); |
01080f7c | 15210 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_in_cmd); |
718e3744 | 15211 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
15212 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
15213 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
15214 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
01080f7c | 15215 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_cmd); |
718e3744 | 15216 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
718e3744 | 15217 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
01080f7c | 15218 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_in_cmd); |
718e3744 | 15219 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); |
01080f7c | 15220 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_in_cmd); |
718e3744 | 15221 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
15222 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
01080f7c | 15223 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd); |
718e3744 | 15224 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); |
01080f7c | 15225 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_in_cmd); |
718e3744 | 15226 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
15227 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
01080f7c | 15228 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_in_cmd); |
718e3744 | 15229 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); |
01080f7c | 15230 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_in_cmd); |
718e3744 | 15231 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
15232 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
01080f7c | 15233 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_in_cmd); |
718e3744 | 15234 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); |
01080f7c | 15235 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_in_cmd); |
718e3744 | 15236 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
15237 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
15238 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
15239 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
15240 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
15241 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
15242 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
587ff0fd LB |
15243 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd); |
15244 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd); | |
15245 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd); | |
15246 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd); | |
15247 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd); | |
15248 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd); | |
718e3744 | 15249 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
15250 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
15251 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
01080f7c | 15252 | install_element (ENABLE_NODE, &clear_bgp_instance_all_in_cmd); |
718e3744 | 15253 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
15254 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
01080f7c | 15255 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_in_cmd); |
718e3744 | 15256 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); |
01080f7c | 15257 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_in_cmd); |
718e3744 | 15258 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
15259 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
01080f7c | 15260 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_in_cmd); |
718e3744 | 15261 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); |
01080f7c | 15262 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_in_cmd); |
718e3744 | 15263 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
15264 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
01080f7c | 15265 | install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_in_cmd); |
718e3744 | 15266 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); |
01080f7c | 15267 | install_element (ENABLE_NODE, &clear_bgp_instance_external_in_cmd); |
718e3744 | 15268 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
15269 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
01080f7c | 15270 | install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_in_cmd); |
718e3744 | 15271 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); |
01080f7c | 15272 | install_element (ENABLE_NODE, &clear_bgp_instance_as_in_cmd); |
718e3744 | 15273 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
15274 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
01080f7c | 15275 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_in_cmd); |
718e3744 | 15276 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); |
01080f7c | 15277 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_in_cmd); |
718e3744 | 15278 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); |
15279 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
01080f7c | 15280 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_in_cmd); |
718e3744 | 15281 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); |
01080f7c | 15282 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_in_cmd); |
718e3744 | 15283 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); |
15284 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
01080f7c | 15285 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_in_cmd); |
718e3744 | 15286 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); |
01080f7c | 15287 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_in_cmd); |
718e3744 | 15288 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); |
15289 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
01080f7c | 15290 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_in_cmd); |
718e3744 | 15291 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); |
01080f7c | 15292 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_in_cmd); |
718e3744 | 15293 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); |
15294 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
01080f7c | 15295 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_in_cmd); |
718e3744 | 15296 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); |
01080f7c | 15297 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_in_cmd); |
718e3744 | 15298 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); |
718e3744 | 15299 | |
8ad7271d DS |
15300 | /* clear ip bgp prefix */ |
15301 | install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); | |
01080f7c | 15302 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_prefix_cmd); |
8ad7271d | 15303 | install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); |
01080f7c | 15304 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_safi_prefix_cmd); |
8ad7271d | 15305 | |
718e3744 | 15306 | /* "clear ip bgp neighbor soft out" */ |
15307 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
15308 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
15309 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
01080f7c | 15310 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_out_cmd); |
718e3744 | 15311 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
01080f7c | 15312 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_out_cmd); |
718e3744 | 15313 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); |
01080f7c | 15314 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_out_cmd); |
718e3744 | 15315 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
01080f7c | 15316 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_out_cmd); |
718e3744 | 15317 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); |
01080f7c | 15318 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_out_cmd); |
718e3744 | 15319 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
01080f7c | 15320 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_out_cmd); |
718e3744 | 15321 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); |
01080f7c | 15322 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_out_cmd); |
718e3744 | 15323 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
01080f7c | 15324 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_out_cmd); |
718e3744 | 15325 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); |
01080f7c | 15326 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_out_cmd); |
718e3744 | 15327 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
15328 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
15329 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
01080f7c | 15330 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_out_cmd); |
718e3744 | 15331 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
01080f7c | 15332 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_out_cmd); |
718e3744 | 15333 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); |
01080f7c | 15334 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_out_cmd); |
718e3744 | 15335 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
01080f7c | 15336 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd); |
718e3744 | 15337 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); |
01080f7c | 15338 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_out_cmd); |
718e3744 | 15339 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
01080f7c | 15340 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_out_cmd); |
718e3744 | 15341 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); |
01080f7c | 15342 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_out_cmd); |
718e3744 | 15343 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
01080f7c | 15344 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_out_cmd); |
718e3744 | 15345 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); |
01080f7c | 15346 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_out_cmd); |
718e3744 | 15347 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
15348 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
15349 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
15350 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
15351 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
15352 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
587ff0fd LB |
15353 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd); |
15354 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd); | |
15355 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd); | |
15356 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd); | |
15357 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd); | |
15358 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd); | |
718e3744 | 15359 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
15360 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
15361 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
01080f7c | 15362 | install_element (ENABLE_NODE, &clear_bgp_instance_all_out_cmd); |
718e3744 | 15363 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
01080f7c | 15364 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_out_cmd); |
718e3744 | 15365 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); |
01080f7c | 15366 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_out_cmd); |
718e3744 | 15367 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
01080f7c | 15368 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_out_cmd); |
718e3744 | 15369 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); |
01080f7c | 15370 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_out_cmd); |
718e3744 | 15371 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
01080f7c | 15372 | install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_out_cmd); |
718e3744 | 15373 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); |
01080f7c | 15374 | install_element (ENABLE_NODE, &clear_bgp_instance_external_out_cmd); |
718e3744 | 15375 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
01080f7c | 15376 | install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_out_cmd); |
718e3744 | 15377 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); |
01080f7c | 15378 | install_element (ENABLE_NODE, &clear_bgp_instance_as_out_cmd); |
718e3744 | 15379 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); |
01080f7c | 15380 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_out_cmd); |
718e3744 | 15381 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); |
01080f7c | 15382 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_out_cmd); |
718e3744 | 15383 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); |
01080f7c | 15384 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_out_cmd); |
718e3744 | 15385 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); |
01080f7c | 15386 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_out_cmd); |
718e3744 | 15387 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); |
01080f7c | 15388 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_out_cmd); |
718e3744 | 15389 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); |
01080f7c | 15390 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_out_cmd); |
718e3744 | 15391 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); |
01080f7c | 15392 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_out_cmd); |
718e3744 | 15393 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); |
01080f7c | 15394 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_out_cmd); |
718e3744 | 15395 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); |
01080f7c | 15396 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_out_cmd); |
718e3744 | 15397 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); |
01080f7c | 15398 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_out_cmd); |
718e3744 | 15399 | |
15400 | /* "clear ip bgp neighbor soft" */ | |
15401 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
15402 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
15403 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
01080f7c | 15404 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_soft_cmd); |
718e3744 | 15405 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); |
01080f7c | 15406 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_soft_cmd); |
718e3744 | 15407 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); |
01080f7c | 15408 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_soft_cmd); |
718e3744 | 15409 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); |
01080f7c | 15410 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_soft_cmd); |
718e3744 | 15411 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); |
15412 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
15413 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
01080f7c | 15414 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_cmd); |
718e3744 | 15415 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
01080f7c | 15416 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_cmd); |
718e3744 | 15417 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
01080f7c | 15418 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_cmd); |
718e3744 | 15419 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
01080f7c | 15420 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_cmd); |
718e3744 | 15421 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
15422 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
15423 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
587ff0fd LB |
15424 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd); |
15425 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd); | |
15426 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd); | |
718e3744 | 15427 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
15428 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
15429 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
01080f7c | 15430 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_soft_cmd); |
718e3744 | 15431 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); |
01080f7c | 15432 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_group_soft_cmd); |
718e3744 | 15433 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); |
01080f7c | 15434 | install_element (ENABLE_NODE, &clear_bgp_instance_external_soft_cmd); |
718e3744 | 15435 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); |
01080f7c | 15436 | install_element (ENABLE_NODE, &clear_bgp_instance_as_soft_cmd); |
718e3744 | 15437 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); |
01080f7c | 15438 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_all_soft_cmd); |
718e3744 | 15439 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); |
01080f7c | 15440 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_soft_cmd); |
718e3744 | 15441 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); |
01080f7c | 15442 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_peer_group_soft_cmd); |
718e3744 | 15443 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); |
01080f7c | 15444 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_external_soft_cmd); |
718e3744 | 15445 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); |
01080f7c | 15446 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_as_soft_cmd); |
718e3744 | 15447 | |
15448 | /* "show ip bgp summary" commands. */ | |
15449 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15450 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15451 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15452 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15453 | install_element (VIEW_NODE, &show_bgp_updgrps_cmd); |
15454 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15455 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15456 | install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15457 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15458 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15459 | install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd); |
15460 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15461 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15462 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15463 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15464 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15465 | install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15466 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15467 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15468 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15469 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15470 | install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15471 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
718e3744 | 15472 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15473 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd); |
718e3744 | 15474 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
95cbbd2a | 15475 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 15476 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 15477 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 15478 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
15479 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15480 | #ifdef HAVE_IPV6 | |
15481 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
15482 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15483 | install_element (VIEW_NODE, &show_bgp_instance_all_summary_cmd); |
718e3744 | 15484 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); |
95cbbd2a | 15485 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 15486 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 15487 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
15488 | #endif /* HAVE_IPV6 */ |
15489 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15490 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15491 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15492 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15493 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd); |
15494 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15495 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15496 | install_element (RESTRICTED_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15497 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15498 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15499 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd); |
15500 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15501 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15502 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15503 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15504 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15505 | install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15506 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15507 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15508 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15509 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15510 | install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15511 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
62687ff1 | 15512 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15513 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd); |
62687ff1 | 15514 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); |
95cbbd2a | 15515 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
62687ff1 | 15516 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 15517 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
62687ff1 PJ |
15518 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
15519 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15520 | #ifdef HAVE_IPV6 | |
15521 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
15522 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15523 | install_element (RESTRICTED_NODE, &show_bgp_instance_all_summary_cmd); |
62687ff1 | 15524 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); |
95cbbd2a | 15525 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
62687ff1 | 15526 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 15527 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 15528 | #endif /* HAVE_IPV6 */ |
15529 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15530 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15531 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15532 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15533 | install_element (ENABLE_NODE, &show_bgp_updgrps_cmd); |
15534 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15535 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15536 | install_element (ENABLE_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15537 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15538 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15539 | install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd); |
15540 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15541 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15542 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15543 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15544 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15545 | install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15546 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15547 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15548 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15549 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15550 | install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15551 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
718e3744 | 15552 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15553 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_summary_cmd); |
718e3744 | 15554 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
95cbbd2a | 15555 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 15556 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 15557 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 15558 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
15559 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15560 | #ifdef HAVE_IPV6 | |
15561 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
15562 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15563 | install_element (ENABLE_NODE, &show_bgp_instance_all_summary_cmd); |
718e3744 | 15564 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); |
95cbbd2a | 15565 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 15566 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 15567 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 15568 | #endif /* HAVE_IPV6 */ |
15569 | ||
15570 | /* "show ip bgp neighbors" commands. */ | |
15571 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
15572 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
15573 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
15574 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
15575 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
15576 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
15577 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
15578 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
15579 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
f186de26 | 15580 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd); |
718e3744 | 15581 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
62687ff1 PJ |
15582 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
15583 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
15584 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
15585 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
15586 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 15587 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
15588 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
15589 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
15590 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
15591 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
15592 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
15593 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
15594 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
15595 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
f186de26 | 15596 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd); |
718e3744 | 15597 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
15598 | ||
15599 | #ifdef HAVE_IPV6 | |
15600 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
15601 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
15602 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
15603 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 15604 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
15605 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
15606 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
15607 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
15608 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
15609 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
15610 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
15611 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 15612 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
15613 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
15614 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
15615 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 15616 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
15617 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
15618 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
15619 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 15620 | |
15621 | /* Old commands. */ | |
15622 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
15623 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
15624 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
15625 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
15626 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 15627 | |
f14e6fdb DS |
15628 | /* "show ip bgp peer-group" commands. */ |
15629 | install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); | |
15630 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
15631 | install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd); | |
15632 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
15633 | install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd); | |
15634 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
15635 | install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd); | |
15636 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
15637 | ||
718e3744 | 15638 | /* "show ip bgp paths" commands. */ |
15639 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
15640 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
15641 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
15642 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
15643 | ||
15644 | /* "show ip bgp community" commands. */ | |
15645 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
15646 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
15647 | ||
15648 | /* "show ip bgp attribute-info" commands. */ | |
15649 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
15650 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
15651 | ||
15652 | /* "redistribute" commands. */ | |
15653 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
15654 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
15655 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
15656 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
15657 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
15658 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
15659 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
15660 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
15661 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
15662 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
7c8ff89e DS |
15663 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd); |
15664 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
15665 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
15666 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
15667 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
15668 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
15669 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
15670 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
15671 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
15672 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
919e0666 DW |
15673 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_cmd); |
15674 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_cmd); | |
15675 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
15676 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
15677 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
15678 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
15679 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
15680 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
15681 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
15682 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
15683 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_cmd); | |
15684 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
15685 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
15686 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
15687 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
15688 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
15689 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
15690 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
15691 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
15692 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
718e3744 | 15693 | #ifdef HAVE_IPV6 |
15694 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
15695 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
15696 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
15697 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
15698 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
15699 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
15700 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
15701 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
15702 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
15703 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
15704 | #endif /* HAVE_IPV6 */ | |
15705 | ||
fa411a21 NH |
15706 | /* ttl_security commands */ |
15707 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
15708 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
15709 | ||
4bf6a362 PJ |
15710 | /* "show bgp memory" commands. */ |
15711 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 15712 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
15713 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
15714 | ||
e0081f70 ML |
15715 | /* "show bgp views" commands. */ |
15716 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
15717 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
15718 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
15719 | ||
8386ac43 | 15720 | /* "show bgp vrfs" commands. */ |
15721 | install_element (VIEW_NODE, &show_bgp_vrfs_cmd); | |
15722 | install_element (RESTRICTED_NODE, &show_bgp_vrfs_cmd); | |
15723 | install_element (ENABLE_NODE, &show_bgp_vrfs_cmd); | |
15724 | ||
718e3744 | 15725 | /* Community-list. */ |
15726 | community_list_vty (); | |
15727 | } | |
6b0655a2 | 15728 | |
718e3744 | 15729 | #include "memory.h" |
15730 | #include "bgp_regex.h" | |
15731 | #include "bgp_clist.h" | |
15732 | #include "bgp_ecommunity.h" | |
15733 | ||
15734 | /* VTY functions. */ | |
15735 | ||
15736 | /* Direction value to string conversion. */ | |
94f2b392 | 15737 | static const char * |
718e3744 | 15738 | community_direct_str (int direct) |
15739 | { | |
15740 | switch (direct) | |
15741 | { | |
15742 | case COMMUNITY_DENY: | |
15743 | return "deny"; | |
718e3744 | 15744 | case COMMUNITY_PERMIT: |
15745 | return "permit"; | |
718e3744 | 15746 | default: |
15747 | return "unknown"; | |
718e3744 | 15748 | } |
15749 | } | |
15750 | ||
15751 | /* Display error string. */ | |
94f2b392 | 15752 | static void |
718e3744 | 15753 | community_list_perror (struct vty *vty, int ret) |
15754 | { | |
15755 | switch (ret) | |
15756 | { | |
15757 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 15758 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 15759 | break; |
15760 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
15761 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
15762 | break; | |
15763 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
15764 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
15765 | break; | |
15766 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
15767 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
15768 | break; | |
15769 | } | |
15770 | } | |
15771 | ||
15772 | /* VTY interface for community_set() function. */ | |
94f2b392 | 15773 | static int |
fd79ac91 | 15774 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
15775 | int style, int reject_all_digit_name) | |
718e3744 | 15776 | { |
15777 | int ret; | |
15778 | int direct; | |
15779 | char *str; | |
15780 | ||
15781 | /* Check the list type. */ | |
15782 | if (strncmp (argv[1], "p", 1) == 0) | |
15783 | direct = COMMUNITY_PERMIT; | |
15784 | else if (strncmp (argv[1], "d", 1) == 0) | |
15785 | direct = COMMUNITY_DENY; | |
15786 | else | |
15787 | { | |
15788 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
15789 | VTY_NEWLINE); | |
15790 | return CMD_WARNING; | |
15791 | } | |
15792 | ||
15793 | /* All digit name check. */ | |
15794 | if (reject_all_digit_name && all_digit (argv[0])) | |
15795 | { | |
15796 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
15797 | return CMD_WARNING; | |
15798 | } | |
15799 | ||
15800 | /* Concat community string argument. */ | |
15801 | if (argc > 1) | |
15802 | str = argv_concat (argv, argc, 2); | |
15803 | else | |
15804 | str = NULL; | |
15805 | ||
15806 | /* When community_list_set() return nevetive value, it means | |
15807 | malformed community string. */ | |
15808 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
15809 | ||
15810 | /* Free temporary community list string allocated by | |
15811 | argv_concat(). */ | |
15812 | if (str) | |
15813 | XFREE (MTYPE_TMP, str); | |
15814 | ||
15815 | if (ret < 0) | |
15816 | { | |
15817 | /* Display error string. */ | |
15818 | community_list_perror (vty, ret); | |
15819 | return CMD_WARNING; | |
15820 | } | |
15821 | ||
15822 | return CMD_SUCCESS; | |
15823 | } | |
15824 | ||
718e3744 | 15825 | /* Communiyt-list entry delete. */ |
94f2b392 | 15826 | static int |
fee6e4e4 | 15827 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
813d4307 | 15828 | int style, int delete_all) |
718e3744 | 15829 | { |
15830 | int ret; | |
fee6e4e4 | 15831 | int direct = 0; |
15832 | char *str = NULL; | |
718e3744 | 15833 | |
fee6e4e4 | 15834 | if (argc > 1) |
718e3744 | 15835 | { |
fee6e4e4 | 15836 | /* Check the list direct. */ |
15837 | if (strncmp (argv[1], "p", 1) == 0) | |
15838 | direct = COMMUNITY_PERMIT; | |
15839 | else if (strncmp (argv[1], "d", 1) == 0) | |
15840 | direct = COMMUNITY_DENY; | |
15841 | else | |
15842 | { | |
15843 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
15844 | VTY_NEWLINE); | |
15845 | return CMD_WARNING; | |
15846 | } | |
718e3744 | 15847 | |
fee6e4e4 | 15848 | /* Concat community string argument. */ |
15849 | str = argv_concat (argv, argc, 2); | |
15850 | } | |
718e3744 | 15851 | |
15852 | /* Unset community list. */ | |
813d4307 | 15853 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); |
718e3744 | 15854 | |
15855 | /* Free temporary community list string allocated by | |
15856 | argv_concat(). */ | |
fee6e4e4 | 15857 | if (str) |
15858 | XFREE (MTYPE_TMP, str); | |
718e3744 | 15859 | |
15860 | if (ret < 0) | |
15861 | { | |
15862 | community_list_perror (vty, ret); | |
15863 | return CMD_WARNING; | |
15864 | } | |
15865 | ||
15866 | return CMD_SUCCESS; | |
15867 | } | |
15868 | ||
15869 | /* "community-list" keyword help string. */ | |
15870 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
718e3744 | 15871 | |
718e3744 | 15872 | DEFUN (ip_community_list_standard, |
15873 | ip_community_list_standard_cmd, | |
15874 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
15875 | IP_STR | |
15876 | COMMUNITY_LIST_STR | |
15877 | "Community list number (standard)\n" | |
15878 | "Specify community to reject\n" | |
15879 | "Specify community to accept\n" | |
15880 | COMMUNITY_VAL_STR) | |
15881 | { | |
15882 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
15883 | } | |
15884 | ||
15885 | ALIAS (ip_community_list_standard, | |
15886 | ip_community_list_standard2_cmd, | |
15887 | "ip community-list <1-99> (deny|permit)", | |
15888 | IP_STR | |
15889 | COMMUNITY_LIST_STR | |
15890 | "Community list number (standard)\n" | |
15891 | "Specify community to reject\n" | |
15892 | "Specify community to accept\n") | |
15893 | ||
15894 | DEFUN (ip_community_list_expanded, | |
15895 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 15896 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 15897 | IP_STR |
15898 | COMMUNITY_LIST_STR | |
15899 | "Community list number (expanded)\n" | |
15900 | "Specify community to reject\n" | |
15901 | "Specify community to accept\n" | |
15902 | "An ordered list as a regular-expression\n") | |
15903 | { | |
15904 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
15905 | } | |
15906 | ||
15907 | DEFUN (ip_community_list_name_standard, | |
15908 | ip_community_list_name_standard_cmd, | |
15909 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
15910 | IP_STR | |
15911 | COMMUNITY_LIST_STR | |
15912 | "Add a standard community-list entry\n" | |
15913 | "Community list name\n" | |
15914 | "Specify community to reject\n" | |
15915 | "Specify community to accept\n" | |
15916 | COMMUNITY_VAL_STR) | |
15917 | { | |
15918 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
15919 | } | |
15920 | ||
15921 | ALIAS (ip_community_list_name_standard, | |
15922 | ip_community_list_name_standard2_cmd, | |
15923 | "ip community-list standard WORD (deny|permit)", | |
15924 | IP_STR | |
15925 | COMMUNITY_LIST_STR | |
15926 | "Add a standard community-list entry\n" | |
15927 | "Community list name\n" | |
15928 | "Specify community to reject\n" | |
15929 | "Specify community to accept\n") | |
15930 | ||
15931 | DEFUN (ip_community_list_name_expanded, | |
15932 | ip_community_list_name_expanded_cmd, | |
15933 | "ip community-list expanded WORD (deny|permit) .LINE", | |
15934 | IP_STR | |
15935 | COMMUNITY_LIST_STR | |
15936 | "Add an expanded community-list entry\n" | |
15937 | "Community list name\n" | |
15938 | "Specify community to reject\n" | |
15939 | "Specify community to accept\n" | |
15940 | "An ordered list as a regular-expression\n") | |
15941 | { | |
15942 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
15943 | } | |
15944 | ||
fee6e4e4 | 15945 | DEFUN (no_ip_community_list_standard_all, |
15946 | no_ip_community_list_standard_all_cmd, | |
15947 | "no ip community-list <1-99>", | |
15948 | NO_STR | |
15949 | IP_STR | |
15950 | COMMUNITY_LIST_STR | |
15951 | "Community list number (standard)\n") | |
15952 | { | |
813d4307 DW |
15953 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
15954 | } | |
15955 | ||
15956 | DEFUN (no_ip_community_list_standard_direction, | |
15957 | no_ip_community_list_standard_direction_cmd, | |
15958 | "no ip community-list <1-99> (deny|permit)", | |
15959 | NO_STR | |
15960 | IP_STR | |
15961 | COMMUNITY_LIST_STR | |
15962 | "Community list number (standard)\n" | |
15963 | "Specify community to reject\n" | |
15964 | "Specify community to accept\n") | |
15965 | { | |
15966 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
fee6e4e4 | 15967 | } |
15968 | ||
813d4307 | 15969 | |
fee6e4e4 | 15970 | DEFUN (no_ip_community_list_expanded_all, |
15971 | no_ip_community_list_expanded_all_cmd, | |
15972 | "no ip community-list <100-500>", | |
718e3744 | 15973 | NO_STR |
15974 | IP_STR | |
15975 | COMMUNITY_LIST_STR | |
718e3744 | 15976 | "Community list number (expanded)\n") |
15977 | { | |
813d4307 | 15978 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 15979 | } |
15980 | ||
fee6e4e4 | 15981 | DEFUN (no_ip_community_list_name_standard_all, |
15982 | no_ip_community_list_name_standard_all_cmd, | |
15983 | "no ip community-list standard WORD", | |
718e3744 | 15984 | NO_STR |
15985 | IP_STR | |
15986 | COMMUNITY_LIST_STR | |
15987 | "Add a standard community-list entry\n" | |
718e3744 | 15988 | "Community list name\n") |
15989 | { | |
813d4307 | 15990 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
718e3744 | 15991 | } |
15992 | ||
fee6e4e4 | 15993 | DEFUN (no_ip_community_list_name_expanded_all, |
15994 | no_ip_community_list_name_expanded_all_cmd, | |
15995 | "no ip community-list expanded WORD", | |
718e3744 | 15996 | NO_STR |
15997 | IP_STR | |
15998 | COMMUNITY_LIST_STR | |
fee6e4e4 | 15999 | "Add an expanded community-list entry\n" |
16000 | "Community list name\n") | |
718e3744 | 16001 | { |
813d4307 | 16002 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16003 | } |
16004 | ||
16005 | DEFUN (no_ip_community_list_standard, | |
16006 | no_ip_community_list_standard_cmd, | |
16007 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
16008 | NO_STR | |
16009 | IP_STR | |
16010 | COMMUNITY_LIST_STR | |
16011 | "Community list number (standard)\n" | |
16012 | "Specify community to reject\n" | |
16013 | "Specify community to accept\n" | |
16014 | COMMUNITY_VAL_STR) | |
16015 | { | |
813d4307 | 16016 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
718e3744 | 16017 | } |
16018 | ||
16019 | DEFUN (no_ip_community_list_expanded, | |
16020 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 16021 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 16022 | NO_STR |
16023 | IP_STR | |
16024 | COMMUNITY_LIST_STR | |
16025 | "Community list number (expanded)\n" | |
16026 | "Specify community to reject\n" | |
16027 | "Specify community to accept\n" | |
16028 | "An ordered list as a regular-expression\n") | |
16029 | { | |
813d4307 | 16030 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16031 | } |
16032 | ||
16033 | DEFUN (no_ip_community_list_name_standard, | |
16034 | no_ip_community_list_name_standard_cmd, | |
16035 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
16036 | NO_STR | |
16037 | IP_STR | |
16038 | COMMUNITY_LIST_STR | |
16039 | "Specify a standard community-list\n" | |
16040 | "Community list name\n" | |
16041 | "Specify community to reject\n" | |
16042 | "Specify community to accept\n" | |
16043 | COMMUNITY_VAL_STR) | |
16044 | { | |
813d4307 DW |
16045 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
16046 | } | |
16047 | ||
16048 | DEFUN (no_ip_community_list_name_standard_brief, | |
16049 | no_ip_community_list_name_standard_brief_cmd, | |
16050 | "no ip community-list standard WORD (deny|permit)", | |
16051 | NO_STR | |
16052 | IP_STR | |
16053 | COMMUNITY_LIST_STR | |
16054 | "Specify a standard community-list\n" | |
16055 | "Community list name\n" | |
16056 | "Specify community to reject\n" | |
16057 | "Specify community to accept\n") | |
16058 | { | |
16059 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
718e3744 | 16060 | } |
16061 | ||
16062 | DEFUN (no_ip_community_list_name_expanded, | |
16063 | no_ip_community_list_name_expanded_cmd, | |
16064 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
16065 | NO_STR | |
16066 | IP_STR | |
16067 | COMMUNITY_LIST_STR | |
16068 | "Specify an expanded community-list\n" | |
16069 | "Community list name\n" | |
16070 | "Specify community to reject\n" | |
16071 | "Specify community to accept\n" | |
16072 | "An ordered list as a regular-expression\n") | |
16073 | { | |
813d4307 | 16074 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16075 | } |
16076 | ||
94f2b392 | 16077 | static void |
718e3744 | 16078 | community_list_show (struct vty *vty, struct community_list *list) |
16079 | { | |
16080 | struct community_entry *entry; | |
16081 | ||
16082 | for (entry = list->head; entry; entry = entry->next) | |
16083 | { | |
16084 | if (entry == list->head) | |
16085 | { | |
16086 | if (all_digit (list->name)) | |
16087 | vty_out (vty, "Community %s list %s%s", | |
16088 | entry->style == COMMUNITY_LIST_STANDARD ? | |
16089 | "standard" : "(expanded) access", | |
16090 | list->name, VTY_NEWLINE); | |
16091 | else | |
16092 | vty_out (vty, "Named Community %s list %s%s", | |
16093 | entry->style == COMMUNITY_LIST_STANDARD ? | |
16094 | "standard" : "expanded", | |
16095 | list->name, VTY_NEWLINE); | |
16096 | } | |
16097 | if (entry->any) | |
16098 | vty_out (vty, " %s%s", | |
16099 | community_direct_str (entry->direct), VTY_NEWLINE); | |
16100 | else | |
16101 | vty_out (vty, " %s %s%s", | |
16102 | community_direct_str (entry->direct), | |
16103 | entry->style == COMMUNITY_LIST_STANDARD | |
16104 | ? community_str (entry->u.com) : entry->config, | |
16105 | VTY_NEWLINE); | |
16106 | } | |
16107 | } | |
16108 | ||
16109 | DEFUN (show_ip_community_list, | |
16110 | show_ip_community_list_cmd, | |
16111 | "show ip community-list", | |
16112 | SHOW_STR | |
16113 | IP_STR | |
16114 | "List community-list\n") | |
16115 | { | |
16116 | struct community_list *list; | |
16117 | struct community_list_master *cm; | |
16118 | ||
fee6e4e4 | 16119 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 16120 | if (! cm) |
16121 | return CMD_SUCCESS; | |
16122 | ||
16123 | for (list = cm->num.head; list; list = list->next) | |
16124 | community_list_show (vty, list); | |
16125 | ||
16126 | for (list = cm->str.head; list; list = list->next) | |
16127 | community_list_show (vty, list); | |
16128 | ||
16129 | return CMD_SUCCESS; | |
16130 | } | |
16131 | ||
16132 | DEFUN (show_ip_community_list_arg, | |
16133 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 16134 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 16135 | SHOW_STR |
16136 | IP_STR | |
16137 | "List community-list\n" | |
16138 | "Community-list number\n" | |
16139 | "Community-list name\n") | |
16140 | { | |
16141 | struct community_list *list; | |
16142 | ||
fee6e4e4 | 16143 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 16144 | if (! list) |
16145 | { | |
b729294c | 16146 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 16147 | return CMD_WARNING; |
16148 | } | |
16149 | ||
16150 | community_list_show (vty, list); | |
16151 | ||
16152 | return CMD_SUCCESS; | |
16153 | } | |
6b0655a2 | 16154 | |
94f2b392 | 16155 | static int |
fd79ac91 | 16156 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
16157 | int style, int reject_all_digit_name) | |
718e3744 | 16158 | { |
16159 | int ret; | |
16160 | int direct; | |
16161 | char *str; | |
16162 | ||
16163 | /* Check the list type. */ | |
16164 | if (strncmp (argv[1], "p", 1) == 0) | |
16165 | direct = COMMUNITY_PERMIT; | |
16166 | else if (strncmp (argv[1], "d", 1) == 0) | |
16167 | direct = COMMUNITY_DENY; | |
16168 | else | |
16169 | { | |
16170 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16171 | VTY_NEWLINE); | |
16172 | return CMD_WARNING; | |
16173 | } | |
16174 | ||
16175 | /* All digit name check. */ | |
16176 | if (reject_all_digit_name && all_digit (argv[0])) | |
16177 | { | |
16178 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
16179 | return CMD_WARNING; | |
16180 | } | |
16181 | ||
16182 | /* Concat community string argument. */ | |
16183 | if (argc > 1) | |
16184 | str = argv_concat (argv, argc, 2); | |
16185 | else | |
16186 | str = NULL; | |
16187 | ||
16188 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
16189 | ||
16190 | /* Free temporary community list string allocated by | |
16191 | argv_concat(). */ | |
16192 | if (str) | |
16193 | XFREE (MTYPE_TMP, str); | |
16194 | ||
16195 | if (ret < 0) | |
16196 | { | |
16197 | community_list_perror (vty, ret); | |
16198 | return CMD_WARNING; | |
16199 | } | |
16200 | return CMD_SUCCESS; | |
16201 | } | |
16202 | ||
94f2b392 | 16203 | static int |
fee6e4e4 | 16204 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
813d4307 | 16205 | int style, int delete_all) |
718e3744 | 16206 | { |
16207 | int ret; | |
fee6e4e4 | 16208 | int direct = 0; |
16209 | char *str = NULL; | |
718e3744 | 16210 | |
fee6e4e4 | 16211 | if (argc > 1) |
718e3744 | 16212 | { |
fee6e4e4 | 16213 | /* Check the list direct. */ |
16214 | if (strncmp (argv[1], "p", 1) == 0) | |
16215 | direct = COMMUNITY_PERMIT; | |
16216 | else if (strncmp (argv[1], "d", 1) == 0) | |
16217 | direct = COMMUNITY_DENY; | |
16218 | else | |
16219 | { | |
16220 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16221 | VTY_NEWLINE); | |
16222 | return CMD_WARNING; | |
16223 | } | |
718e3744 | 16224 | |
fee6e4e4 | 16225 | /* Concat community string argument. */ |
16226 | str = argv_concat (argv, argc, 2); | |
718e3744 | 16227 | } |
16228 | ||
718e3744 | 16229 | /* Unset community list. */ |
813d4307 | 16230 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); |
718e3744 | 16231 | |
16232 | /* Free temporary community list string allocated by | |
16233 | argv_concat(). */ | |
fee6e4e4 | 16234 | if (str) |
16235 | XFREE (MTYPE_TMP, str); | |
718e3744 | 16236 | |
16237 | if (ret < 0) | |
16238 | { | |
16239 | community_list_perror (vty, ret); | |
16240 | return CMD_WARNING; | |
16241 | } | |
16242 | ||
16243 | return CMD_SUCCESS; | |
16244 | } | |
16245 | ||
16246 | /* "extcommunity-list" keyword help string. */ | |
16247 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
16248 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
16249 | ||
16250 | DEFUN (ip_extcommunity_list_standard, | |
16251 | ip_extcommunity_list_standard_cmd, | |
16252 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
16253 | IP_STR | |
16254 | EXTCOMMUNITY_LIST_STR | |
16255 | "Extended Community list number (standard)\n" | |
16256 | "Specify community to reject\n" | |
16257 | "Specify community to accept\n" | |
16258 | EXTCOMMUNITY_VAL_STR) | |
16259 | { | |
16260 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
16261 | } | |
16262 | ||
16263 | ALIAS (ip_extcommunity_list_standard, | |
16264 | ip_extcommunity_list_standard2_cmd, | |
16265 | "ip extcommunity-list <1-99> (deny|permit)", | |
16266 | IP_STR | |
16267 | EXTCOMMUNITY_LIST_STR | |
16268 | "Extended Community list number (standard)\n" | |
16269 | "Specify community to reject\n" | |
16270 | "Specify community to accept\n") | |
16271 | ||
16272 | DEFUN (ip_extcommunity_list_expanded, | |
16273 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 16274 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 16275 | IP_STR |
16276 | EXTCOMMUNITY_LIST_STR | |
16277 | "Extended Community list number (expanded)\n" | |
16278 | "Specify community to reject\n" | |
16279 | "Specify community to accept\n" | |
16280 | "An ordered list as a regular-expression\n") | |
16281 | { | |
16282 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
16283 | } | |
16284 | ||
16285 | DEFUN (ip_extcommunity_list_name_standard, | |
16286 | ip_extcommunity_list_name_standard_cmd, | |
16287 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
16288 | IP_STR | |
16289 | EXTCOMMUNITY_LIST_STR | |
16290 | "Specify standard extcommunity-list\n" | |
16291 | "Extended Community list name\n" | |
16292 | "Specify community to reject\n" | |
16293 | "Specify community to accept\n" | |
16294 | EXTCOMMUNITY_VAL_STR) | |
16295 | { | |
16296 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
16297 | } | |
16298 | ||
16299 | ALIAS (ip_extcommunity_list_name_standard, | |
16300 | ip_extcommunity_list_name_standard2_cmd, | |
16301 | "ip extcommunity-list standard WORD (deny|permit)", | |
16302 | IP_STR | |
16303 | EXTCOMMUNITY_LIST_STR | |
16304 | "Specify standard extcommunity-list\n" | |
16305 | "Extended Community list name\n" | |
16306 | "Specify community to reject\n" | |
16307 | "Specify community to accept\n") | |
16308 | ||
16309 | DEFUN (ip_extcommunity_list_name_expanded, | |
16310 | ip_extcommunity_list_name_expanded_cmd, | |
16311 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
16312 | IP_STR | |
16313 | EXTCOMMUNITY_LIST_STR | |
16314 | "Specify expanded extcommunity-list\n" | |
16315 | "Extended Community list name\n" | |
16316 | "Specify community to reject\n" | |
16317 | "Specify community to accept\n" | |
16318 | "An ordered list as a regular-expression\n") | |
16319 | { | |
16320 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
16321 | } | |
16322 | ||
fee6e4e4 | 16323 | DEFUN (no_ip_extcommunity_list_standard_all, |
16324 | no_ip_extcommunity_list_standard_all_cmd, | |
16325 | "no ip extcommunity-list <1-99>", | |
16326 | NO_STR | |
16327 | IP_STR | |
16328 | EXTCOMMUNITY_LIST_STR | |
16329 | "Extended Community list number (standard)\n") | |
16330 | { | |
813d4307 DW |
16331 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
16332 | } | |
16333 | ||
16334 | DEFUN (no_ip_extcommunity_list_standard_direction, | |
16335 | no_ip_extcommunity_list_standard_direction_cmd, | |
16336 | "no ip extcommunity-list <1-99> (deny|permit)", | |
16337 | NO_STR | |
16338 | IP_STR | |
16339 | EXTCOMMUNITY_LIST_STR | |
16340 | "Extended Community list number (standard)\n" | |
16341 | "Specify community to reject\n" | |
16342 | "Specify community to accept\n") | |
16343 | { | |
16344 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
fee6e4e4 | 16345 | } |
16346 | ||
16347 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
16348 | no_ip_extcommunity_list_expanded_all_cmd, | |
16349 | "no ip extcommunity-list <100-500>", | |
718e3744 | 16350 | NO_STR |
16351 | IP_STR | |
16352 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 16353 | "Extended Community list number (expanded)\n") |
16354 | { | |
813d4307 | 16355 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16356 | } |
16357 | ||
fee6e4e4 | 16358 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
16359 | no_ip_extcommunity_list_name_standard_all_cmd, | |
16360 | "no ip extcommunity-list standard WORD", | |
718e3744 | 16361 | NO_STR |
16362 | IP_STR | |
16363 | EXTCOMMUNITY_LIST_STR | |
16364 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 16365 | "Extended Community list name\n") |
16366 | { | |
813d4307 | 16367 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
fee6e4e4 | 16368 | } |
16369 | ||
16370 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
16371 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
16372 | "no ip extcommunity-list expanded WORD", | |
16373 | NO_STR | |
16374 | IP_STR | |
16375 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 16376 | "Specify expanded extcommunity-list\n" |
16377 | "Extended Community list name\n") | |
16378 | { | |
813d4307 | 16379 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16380 | } |
16381 | ||
16382 | DEFUN (no_ip_extcommunity_list_standard, | |
16383 | no_ip_extcommunity_list_standard_cmd, | |
16384 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
16385 | NO_STR | |
16386 | IP_STR | |
16387 | EXTCOMMUNITY_LIST_STR | |
16388 | "Extended Community list number (standard)\n" | |
16389 | "Specify community to reject\n" | |
16390 | "Specify community to accept\n" | |
16391 | EXTCOMMUNITY_VAL_STR) | |
16392 | { | |
813d4307 | 16393 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
718e3744 | 16394 | } |
16395 | ||
16396 | DEFUN (no_ip_extcommunity_list_expanded, | |
16397 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 16398 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 16399 | NO_STR |
16400 | IP_STR | |
16401 | EXTCOMMUNITY_LIST_STR | |
16402 | "Extended Community list number (expanded)\n" | |
16403 | "Specify community to reject\n" | |
16404 | "Specify community to accept\n" | |
16405 | "An ordered list as a regular-expression\n") | |
16406 | { | |
813d4307 | 16407 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16408 | } |
16409 | ||
16410 | DEFUN (no_ip_extcommunity_list_name_standard, | |
16411 | no_ip_extcommunity_list_name_standard_cmd, | |
16412 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
16413 | NO_STR | |
16414 | IP_STR | |
16415 | EXTCOMMUNITY_LIST_STR | |
16416 | "Specify standard extcommunity-list\n" | |
16417 | "Extended Community list name\n" | |
16418 | "Specify community to reject\n" | |
16419 | "Specify community to accept\n" | |
16420 | EXTCOMMUNITY_VAL_STR) | |
16421 | { | |
813d4307 DW |
16422 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
16423 | } | |
16424 | ||
16425 | DEFUN (no_ip_extcommunity_list_name_standard_brief, | |
16426 | no_ip_extcommunity_list_name_standard_brief_cmd, | |
16427 | "no ip extcommunity-list standard WORD (deny|permit)", | |
16428 | NO_STR | |
16429 | IP_STR | |
16430 | EXTCOMMUNITY_LIST_STR | |
16431 | "Specify standard extcommunity-list\n" | |
16432 | "Extended Community list name\n" | |
16433 | "Specify community to reject\n" | |
16434 | "Specify community to accept\n") | |
16435 | { | |
16436 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
718e3744 | 16437 | } |
16438 | ||
16439 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
16440 | no_ip_extcommunity_list_name_expanded_cmd, | |
16441 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
16442 | NO_STR | |
16443 | IP_STR | |
16444 | EXTCOMMUNITY_LIST_STR | |
16445 | "Specify expanded extcommunity-list\n" | |
16446 | "Community list name\n" | |
16447 | "Specify community to reject\n" | |
16448 | "Specify community to accept\n" | |
16449 | "An ordered list as a regular-expression\n") | |
16450 | { | |
813d4307 | 16451 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16452 | } |
16453 | ||
94f2b392 | 16454 | static void |
718e3744 | 16455 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
16456 | { | |
16457 | struct community_entry *entry; | |
16458 | ||
16459 | for (entry = list->head; entry; entry = entry->next) | |
16460 | { | |
16461 | if (entry == list->head) | |
16462 | { | |
16463 | if (all_digit (list->name)) | |
16464 | vty_out (vty, "Extended community %s list %s%s", | |
16465 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16466 | "standard" : "(expanded) access", | |
16467 | list->name, VTY_NEWLINE); | |
16468 | else | |
16469 | vty_out (vty, "Named extended community %s list %s%s", | |
16470 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16471 | "standard" : "expanded", | |
16472 | list->name, VTY_NEWLINE); | |
16473 | } | |
16474 | if (entry->any) | |
16475 | vty_out (vty, " %s%s", | |
16476 | community_direct_str (entry->direct), VTY_NEWLINE); | |
16477 | else | |
16478 | vty_out (vty, " %s %s%s", | |
16479 | community_direct_str (entry->direct), | |
16480 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16481 | entry->u.ecom->str : entry->config, | |
16482 | VTY_NEWLINE); | |
16483 | } | |
16484 | } | |
16485 | ||
16486 | DEFUN (show_ip_extcommunity_list, | |
16487 | show_ip_extcommunity_list_cmd, | |
16488 | "show ip extcommunity-list", | |
16489 | SHOW_STR | |
16490 | IP_STR | |
16491 | "List extended-community list\n") | |
16492 | { | |
16493 | struct community_list *list; | |
16494 | struct community_list_master *cm; | |
16495 | ||
fee6e4e4 | 16496 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16497 | if (! cm) |
16498 | return CMD_SUCCESS; | |
16499 | ||
16500 | for (list = cm->num.head; list; list = list->next) | |
16501 | extcommunity_list_show (vty, list); | |
16502 | ||
16503 | for (list = cm->str.head; list; list = list->next) | |
16504 | extcommunity_list_show (vty, list); | |
16505 | ||
16506 | return CMD_SUCCESS; | |
16507 | } | |
16508 | ||
16509 | DEFUN (show_ip_extcommunity_list_arg, | |
16510 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 16511 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 16512 | SHOW_STR |
16513 | IP_STR | |
16514 | "List extended-community list\n" | |
16515 | "Extcommunity-list number\n" | |
16516 | "Extcommunity-list name\n") | |
16517 | { | |
16518 | struct community_list *list; | |
16519 | ||
fee6e4e4 | 16520 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16521 | if (! list) |
16522 | { | |
b729294c | 16523 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 16524 | return CMD_WARNING; |
16525 | } | |
16526 | ||
16527 | extcommunity_list_show (vty, list); | |
16528 | ||
16529 | return CMD_SUCCESS; | |
16530 | } | |
6b0655a2 | 16531 | |
718e3744 | 16532 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 16533 | static const char * |
718e3744 | 16534 | community_list_config_str (struct community_entry *entry) |
16535 | { | |
fd79ac91 | 16536 | const char *str; |
718e3744 | 16537 | |
16538 | if (entry->any) | |
16539 | str = ""; | |
16540 | else | |
16541 | { | |
16542 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
16543 | str = community_str (entry->u.com); | |
16544 | else | |
16545 | str = entry->config; | |
16546 | } | |
16547 | return str; | |
16548 | } | |
16549 | ||
16550 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 16551 | static int |
718e3744 | 16552 | community_list_config_write (struct vty *vty) |
16553 | { | |
16554 | struct community_list *list; | |
16555 | struct community_entry *entry; | |
16556 | struct community_list_master *cm; | |
16557 | int write = 0; | |
16558 | ||
16559 | /* Community-list. */ | |
fee6e4e4 | 16560 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 16561 | |
16562 | for (list = cm->num.head; list; list = list->next) | |
16563 | for (entry = list->head; entry; entry = entry->next) | |
16564 | { | |
fee6e4e4 | 16565 | vty_out (vty, "ip community-list %s %s %s%s", |
16566 | list->name, community_direct_str (entry->direct), | |
16567 | community_list_config_str (entry), | |
16568 | VTY_NEWLINE); | |
718e3744 | 16569 | write++; |
16570 | } | |
16571 | for (list = cm->str.head; list; list = list->next) | |
16572 | for (entry = list->head; entry; entry = entry->next) | |
16573 | { | |
16574 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
16575 | entry->style == COMMUNITY_LIST_STANDARD | |
16576 | ? "standard" : "expanded", | |
16577 | list->name, community_direct_str (entry->direct), | |
16578 | community_list_config_str (entry), | |
16579 | VTY_NEWLINE); | |
16580 | write++; | |
16581 | } | |
16582 | ||
16583 | /* Extcommunity-list. */ | |
fee6e4e4 | 16584 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16585 | |
16586 | for (list = cm->num.head; list; list = list->next) | |
16587 | for (entry = list->head; entry; entry = entry->next) | |
16588 | { | |
fee6e4e4 | 16589 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
16590 | list->name, community_direct_str (entry->direct), | |
16591 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 16592 | write++; |
16593 | } | |
16594 | for (list = cm->str.head; list; list = list->next) | |
16595 | for (entry = list->head; entry; entry = entry->next) | |
16596 | { | |
16597 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
16598 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
16599 | ? "standard" : "expanded", | |
16600 | list->name, community_direct_str (entry->direct), | |
16601 | community_list_config_str (entry), VTY_NEWLINE); | |
16602 | write++; | |
16603 | } | |
16604 | return write; | |
16605 | } | |
16606 | ||
7fc626de | 16607 | static struct cmd_node community_list_node = |
718e3744 | 16608 | { |
16609 | COMMUNITY_LIST_NODE, | |
16610 | "", | |
16611 | 1 /* Export to vtysh. */ | |
16612 | }; | |
16613 | ||
94f2b392 | 16614 | static void |
16615 | community_list_vty (void) | |
718e3744 | 16616 | { |
16617 | install_node (&community_list_node, community_list_config_write); | |
16618 | ||
16619 | /* Community-list. */ | |
718e3744 | 16620 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
16621 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
16622 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
16623 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
16624 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
16625 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 16626 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
813d4307 | 16627 | install_element (CONFIG_NODE, &no_ip_community_list_standard_direction_cmd); |
fee6e4e4 | 16628 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
16629 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
16630 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 16631 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
16632 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
16633 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
813d4307 | 16634 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_brief_cmd); |
718e3744 | 16635 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
16636 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
16637 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
16638 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
16639 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
16640 | ||
16641 | /* Extcommunity-list. */ | |
16642 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
16643 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
16644 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
16645 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
16646 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
16647 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 16648 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
813d4307 | 16649 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_direction_cmd); |
fee6e4e4 | 16650 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
16651 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
16652 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 16653 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
16654 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
16655 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
813d4307 | 16656 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_brief_cmd); |
718e3744 | 16657 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
16658 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
16659 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
16660 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
16661 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
16662 | } |