]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* BGP VTY interface. |
2 | Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro | |
3 | ||
4 | This file is part of GNU Zebra. | |
5 | ||
6 | GNU Zebra is free software; you can redistribute it and/or modify it | |
7 | under the terms of the GNU General Public License as published by the | |
8 | Free Software Foundation; either version 2, or (at your option) any | |
9 | later version. | |
10 | ||
11 | GNU Zebra is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU Zebra; see the file COPYING. If not, write to the Free | |
18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
20 | ||
21 | #include <zebra.h> | |
22 | ||
23 | #include "command.h" | |
afec25d9 | 24 | #include "lib/json.h" |
718e3744 | 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" |
fc7948fa | 33 | #include "memory_vty.h" |
4bf6a362 | 34 | #include "hash.h" |
3f9c7369 | 35 | #include "queue.h" |
039f3a34 | 36 | #include "filter.h" |
718e3744 | 37 | |
38 | #include "bgpd/bgpd.h" | |
4bf6a362 | 39 | #include "bgpd/bgp_advertise.h" |
718e3744 | 40 | #include "bgpd/bgp_attr.h" |
41 | #include "bgpd/bgp_aspath.h" | |
42 | #include "bgpd/bgp_community.h" | |
4bf6a362 PJ |
43 | #include "bgpd/bgp_ecommunity.h" |
44 | #include "bgpd/bgp_damp.h" | |
718e3744 | 45 | #include "bgpd/bgp_debug.h" |
e0701b79 | 46 | #include "bgpd/bgp_fsm.h" |
718e3744 | 47 | #include "bgpd/bgp_mplsvpn.h" |
4bf6a362 | 48 | #include "bgpd/bgp_nexthop.h" |
718e3744 | 49 | #include "bgpd/bgp_open.h" |
4bf6a362 | 50 | #include "bgpd/bgp_regex.h" |
718e3744 | 51 | #include "bgpd/bgp_route.h" |
52 | #include "bgpd/bgp_zebra.h" | |
fee0f4c6 | 53 | #include "bgpd/bgp_table.h" |
94f2b392 | 54 | #include "bgpd/bgp_vty.h" |
165b5fff | 55 | #include "bgpd/bgp_mpath.h" |
cb1faec9 | 56 | #include "bgpd/bgp_packet.h" |
3f9c7369 | 57 | #include "bgpd/bgp_updgrp.h" |
c43ed2e4 | 58 | #include "bgpd/bgp_bfd.h" |
718e3744 | 59 | |
20eb8864 | 60 | static struct peer_group * |
61 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact); | |
62 | ||
718e3744 | 63 | /* Utility function to get address family from current node. */ |
64 | afi_t | |
65 | bgp_node_afi (struct vty *vty) | |
66 | { | |
4e851f1f LB |
67 | afi_t afi; |
68 | switch (vty->node) | |
69 | { | |
70 | case BGP_IPV6_NODE: | |
71 | case BGP_IPV6M_NODE: | |
72 | case BGP_VPNV6_NODE: | |
73 | case BGP_ENCAPV6_NODE: | |
74 | afi = AFI_IP6; | |
75 | break; | |
76 | default: | |
77 | afi = AFI_IP; | |
78 | break; | |
79 | } | |
80 | return afi; | |
718e3744 | 81 | } |
82 | ||
83 | /* Utility function to get subsequent address family from current | |
84 | node. */ | |
85 | safi_t | |
86 | bgp_node_safi (struct vty *vty) | |
87 | { | |
4e851f1f LB |
88 | safi_t safi; |
89 | switch (vty->node) | |
90 | { | |
91 | case BGP_ENCAP_NODE: | |
92 | case BGP_ENCAPV6_NODE: | |
93 | safi = SAFI_ENCAP; | |
94 | break; | |
95 | case BGP_VPNV4_NODE: | |
96 | case BGP_VPNV6_NODE: | |
97 | safi = SAFI_MPLS_VPN; | |
98 | break; | |
99 | case BGP_IPV4M_NODE: | |
100 | case BGP_IPV6M_NODE: | |
101 | safi = SAFI_MULTICAST; | |
102 | break; | |
103 | default: | |
104 | safi = SAFI_UNICAST; | |
105 | break; | |
106 | } | |
107 | return safi; | |
718e3744 | 108 | } |
109 | ||
8b1fb8be LB |
110 | int |
111 | bgp_parse_afi(const char *str, afi_t *afi) | |
112 | { | |
113 | if (!strcmp(str, "ipv4")) { | |
114 | *afi = AFI_IP; | |
115 | return 0; | |
116 | } | |
117 | #ifdef HAVE_IPV6 | |
118 | if (!strcmp(str, "ipv6")) { | |
119 | *afi = AFI_IP6; | |
120 | return 0; | |
121 | } | |
122 | #endif /* HAVE_IPV6 */ | |
123 | return -1; | |
124 | } | |
125 | ||
126 | int | |
127 | bgp_parse_safi(const char *str, safi_t *safi) | |
128 | { | |
129 | if (!strcmp(str, "encap")) { | |
130 | *safi = SAFI_ENCAP; | |
131 | return 0; | |
132 | } | |
133 | if (!strcmp(str, "multicast")) { | |
134 | *safi = SAFI_MULTICAST; | |
135 | return 0; | |
136 | } | |
137 | if (!strcmp(str, "unicast")) { | |
138 | *safi = SAFI_UNICAST; | |
139 | return 0; | |
140 | } | |
141 | if (!strcmp(str, "vpn")) { | |
142 | *safi = SAFI_MPLS_VPN; | |
143 | return 0; | |
144 | } | |
145 | return -1; | |
146 | } | |
147 | ||
94f2b392 | 148 | static int |
6aeb9e78 | 149 | peer_address_self_check (struct bgp *bgp, union sockunion *su) |
718e3744 | 150 | { |
151 | struct interface *ifp = NULL; | |
152 | ||
153 | if (su->sa.sa_family == AF_INET) | |
6aeb9e78 | 154 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr, bgp->vrf_id); |
718e3744 | 155 | #ifdef HAVE_IPV6 |
156 | else if (su->sa.sa_family == AF_INET6) | |
f2345335 | 157 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr, |
6aeb9e78 | 158 | su->sin6.sin6_scope_id, bgp->vrf_id); |
718e3744 | 159 | #endif /* HAVE IPV6 */ |
160 | ||
161 | if (ifp) | |
162 | return 1; | |
163 | ||
164 | return 0; | |
165 | } | |
166 | ||
167 | /* Utility function for looking up peer from VTY. */ | |
f14e6fdb DS |
168 | /* This is used only for configuration, so disallow if attempted on |
169 | * a dynamic neighbor. | |
170 | */ | |
94f2b392 | 171 | static struct peer * |
fd79ac91 | 172 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 173 | { |
174 | int ret; | |
175 | struct bgp *bgp; | |
176 | union sockunion su; | |
177 | struct peer *peer; | |
178 | ||
179 | bgp = vty->index; | |
180 | ||
181 | ret = str2sockunion (ip_str, &su); | |
182 | if (ret < 0) | |
183 | { | |
a80beece DS |
184 | peer = peer_lookup_by_conf_if (bgp, ip_str); |
185 | if (!peer) | |
186 | { | |
04b6bdc0 DW |
187 | if ((peer = peer_lookup_by_hostname(bgp, ip_str)) == NULL) |
188 | { | |
189 | vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE); | |
190 | return NULL; | |
191 | } | |
a80beece | 192 | } |
718e3744 | 193 | } |
a80beece | 194 | else |
718e3744 | 195 | { |
a80beece DS |
196 | peer = peer_lookup (bgp, &su); |
197 | if (! peer) | |
198 | { | |
199 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
200 | VTY_NEWLINE); | |
201 | return NULL; | |
202 | } | |
f14e6fdb DS |
203 | if (peer_dynamic_neighbor (peer)) |
204 | { | |
205 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
206 | VTY_NEWLINE); | |
207 | return NULL; | |
208 | } | |
209 | ||
718e3744 | 210 | } |
211 | return peer; | |
212 | } | |
213 | ||
214 | /* Utility function for looking up peer or peer group. */ | |
f14e6fdb DS |
215 | /* This is used only for configuration, so disallow if attempted on |
216 | * a dynamic neighbor. | |
217 | */ | |
c43ed2e4 | 218 | struct peer * |
fd79ac91 | 219 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 220 | { |
221 | int ret; | |
222 | struct bgp *bgp; | |
223 | union sockunion su; | |
f14e6fdb DS |
224 | struct peer *peer = NULL; |
225 | struct peer_group *group = NULL; | |
718e3744 | 226 | |
227 | bgp = vty->index; | |
228 | ||
229 | ret = str2sockunion (peer_str, &su); | |
230 | if (ret == 0) | |
231 | { | |
f14e6fdb | 232 | /* IP address, locate peer. */ |
718e3744 | 233 | peer = peer_lookup (bgp, &su); |
718e3744 | 234 | } |
235 | else | |
236 | { | |
f14e6fdb | 237 | /* Not IP, could match either peer configured on interface or a group. */ |
a80beece | 238 | peer = peer_lookup_by_conf_if (bgp, peer_str); |
f14e6fdb DS |
239 | if (!peer) |
240 | group = peer_group_lookup (bgp, peer_str); | |
241 | } | |
a80beece | 242 | |
f14e6fdb DS |
243 | if (peer) |
244 | { | |
245 | if (peer_dynamic_neighbor (peer)) | |
246 | { | |
247 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
248 | VTY_NEWLINE); | |
249 | return NULL; | |
250 | } | |
251 | ||
252 | return peer; | |
718e3744 | 253 | } |
254 | ||
f14e6fdb DS |
255 | if (group) |
256 | return group->conf; | |
257 | ||
718e3744 | 258 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
259 | VTY_NEWLINE); | |
260 | ||
261 | return NULL; | |
262 | } | |
263 | ||
c43ed2e4 | 264 | int |
718e3744 | 265 | bgp_vty_return (struct vty *vty, int ret) |
266 | { | |
fd79ac91 | 267 | const char *str = NULL; |
718e3744 | 268 | |
269 | switch (ret) | |
270 | { | |
271 | case BGP_ERR_INVALID_VALUE: | |
272 | str = "Invalid value"; | |
273 | break; | |
274 | case BGP_ERR_INVALID_FLAG: | |
275 | str = "Invalid flag"; | |
276 | break; | |
718e3744 | 277 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
278 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
279 | break; | |
718e3744 | 280 | case BGP_ERR_PEER_FLAG_CONFLICT: |
281 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
282 | break; | |
718e3744 | 283 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
284 | str = "Specify remote-as or peer-group remote AS first"; | |
285 | break; | |
286 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
287 | str = "Cannot change the peer-group. Deconfigure first"; | |
288 | break; | |
289 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
4c48cf63 | 290 | str = "Peer is not a member of this peer-group"; |
718e3744 | 291 | break; |
292 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
293 | str = "Prefix/distribute list can not co-exist"; | |
294 | break; | |
295 | case BGP_ERR_NOT_INTERNAL_PEER: | |
296 | str = "Invalid command. Not an internal neighbor"; | |
297 | break; | |
298 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
5000f21c | 299 | str = "remove-private-AS cannot be configured for IBGP peers"; |
718e3744 | 300 | break; |
301 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
302 | str = "Local-AS allowed only for EBGP peers"; | |
303 | break; | |
304 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
305 | str = "Cannot have local-as same as BGP AS number"; | |
306 | break; | |
0df7c91f PJ |
307 | case BGP_ERR_TCPSIG_FAILED: |
308 | str = "Error while applying TCP-Sig to session(s)"; | |
309 | break; | |
fa411a21 NH |
310 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
311 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
312 | break; | |
f5a4827d SH |
313 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
314 | str = "ttl-security only allowed for EBGP peers"; | |
315 | break; | |
c7122e14 DS |
316 | case BGP_ERR_AS_OVERRIDE: |
317 | str = "as-override cannot be configured for IBGP peers"; | |
318 | break; | |
f14e6fdb DS |
319 | case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT: |
320 | str = "Invalid limit for number of dynamic neighbors"; | |
321 | break; | |
322 | case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS: | |
323 | str = "Dynamic neighbor listen range already exists"; | |
324 | break; | |
325 | case BGP_ERR_INVALID_FOR_DYNAMIC_PEER: | |
326 | str = "Operation not allowed on a dynamic neighbor"; | |
327 | break; | |
63fa10b5 QY |
328 | case BGP_ERR_INVALID_FOR_DIRECT_PEER: |
329 | str = "Operation not allowed on a directly connected neighbor"; | |
330 | break; | |
718e3744 | 331 | } |
332 | if (str) | |
333 | { | |
334 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
335 | return CMD_WARNING; | |
336 | } | |
337 | return CMD_SUCCESS; | |
338 | } | |
339 | ||
7aafcaca DS |
340 | /* BGP clear sort. */ |
341 | enum clear_sort | |
342 | { | |
343 | clear_all, | |
344 | clear_peer, | |
345 | clear_group, | |
346 | clear_external, | |
347 | clear_as | |
348 | }; | |
349 | ||
7aafcaca DS |
350 | static void |
351 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, | |
352 | safi_t safi, int error) | |
353 | { | |
354 | switch (error) | |
355 | { | |
356 | case BGP_ERR_AF_UNCONFIGURED: | |
357 | vty_out (vty, | |
358 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
359 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
360 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
361 | peer->host, VTY_NEWLINE); | |
362 | break; | |
363 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
364 | 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); | |
365 | break; | |
366 | default: | |
367 | break; | |
368 | } | |
369 | } | |
370 | ||
371 | /* `clear ip bgp' functions. */ | |
372 | static int | |
373 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, | |
374 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) | |
375 | { | |
376 | int ret; | |
377 | struct peer *peer; | |
378 | struct listnode *node, *nnode; | |
379 | ||
380 | /* Clear all neighbors. */ | |
381 | /* | |
382 | * Pass along pointer to next node to peer_clear() when walking all nodes | |
383 | * on the BGP instance as that may get freed if it is a doppelganger | |
384 | */ | |
385 | if (sort == clear_all) | |
386 | { | |
387 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
388 | { | |
389 | if (stype == BGP_CLEAR_SOFT_NONE) | |
390 | ret = peer_clear (peer, &nnode); | |
391 | else if (peer->afc[afi][safi]) | |
392 | ret = peer_clear_soft (peer, afi, safi, stype); | |
393 | else | |
394 | ret = 0; | |
395 | ||
396 | if (ret < 0) | |
397 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
398 | } | |
399 | ||
400 | /* This is to apply read-only mode on this clear. */ | |
401 | if (stype == BGP_CLEAR_SOFT_NONE) | |
402 | bgp->update_delay_over = 0; | |
403 | ||
404 | return CMD_SUCCESS; | |
405 | } | |
406 | ||
407 | /* Clear specified neighbors. */ | |
408 | if (sort == clear_peer) | |
409 | { | |
410 | union sockunion su; | |
411 | int ret; | |
412 | ||
413 | /* Make sockunion for lookup. */ | |
414 | ret = str2sockunion (arg, &su); | |
415 | if (ret < 0) | |
416 | { | |
417 | peer = peer_lookup_by_conf_if (bgp, arg); | |
418 | if (!peer) | |
419 | { | |
04b6bdc0 DW |
420 | peer = peer_lookup_by_hostname(bgp, arg); |
421 | if (!peer) | |
422 | { | |
423 | vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE); | |
424 | return CMD_WARNING; | |
425 | } | |
7aafcaca DS |
426 | } |
427 | } | |
428 | else | |
429 | { | |
430 | peer = peer_lookup (bgp, &su); | |
431 | if (! peer) | |
432 | { | |
433 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
434 | return CMD_WARNING; | |
435 | } | |
436 | } | |
437 | ||
438 | if (stype == BGP_CLEAR_SOFT_NONE) | |
439 | ret = peer_clear (peer, NULL); | |
440 | else | |
441 | ret = peer_clear_soft (peer, afi, safi, stype); | |
442 | ||
443 | if (ret < 0) | |
444 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
445 | ||
446 | return CMD_SUCCESS; | |
447 | } | |
448 | ||
449 | /* Clear all peer-group members. */ | |
450 | if (sort == clear_group) | |
451 | { | |
452 | struct peer_group *group; | |
453 | ||
454 | group = peer_group_lookup (bgp, arg); | |
455 | if (! group) | |
456 | { | |
457 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
458 | return CMD_WARNING; | |
459 | } | |
460 | ||
461 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
462 | { | |
463 | if (stype == BGP_CLEAR_SOFT_NONE) | |
464 | { | |
18f1dc06 | 465 | peer_clear (peer, NULL); |
7aafcaca DS |
466 | continue; |
467 | } | |
468 | ||
c8560b44 | 469 | if (! peer->afc[afi][safi]) |
7aafcaca DS |
470 | continue; |
471 | ||
472 | ret = peer_clear_soft (peer, afi, safi, stype); | |
473 | ||
474 | if (ret < 0) | |
475 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
476 | } | |
477 | return CMD_SUCCESS; | |
478 | } | |
479 | ||
480 | if (sort == clear_external) | |
481 | { | |
482 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
483 | { | |
484 | if (peer->sort == BGP_PEER_IBGP) | |
485 | continue; | |
486 | ||
487 | if (stype == BGP_CLEAR_SOFT_NONE) | |
488 | ret = peer_clear (peer, &nnode); | |
489 | else | |
490 | ret = peer_clear_soft (peer, afi, safi, stype); | |
491 | ||
492 | if (ret < 0) | |
493 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
494 | } | |
495 | return CMD_SUCCESS; | |
496 | } | |
497 | ||
498 | if (sort == clear_as) | |
499 | { | |
500 | as_t as; | |
501 | int find = 0; | |
502 | ||
503 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); | |
504 | ||
505 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
506 | { | |
507 | if (peer->as != as) | |
508 | continue; | |
509 | ||
510 | find = 1; | |
511 | if (stype == BGP_CLEAR_SOFT_NONE) | |
512 | ret = peer_clear (peer, &nnode); | |
513 | else | |
514 | ret = peer_clear_soft (peer, afi, safi, stype); | |
515 | ||
516 | if (ret < 0) | |
517 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
518 | } | |
519 | if (! find) | |
520 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
521 | VTY_NEWLINE); | |
522 | return CMD_SUCCESS; | |
523 | } | |
524 | ||
525 | return CMD_SUCCESS; | |
526 | } | |
527 | ||
528 | static int | |
529 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, | |
530 | enum clear_sort sort, enum bgp_clear_type stype, | |
531 | const char *arg) | |
532 | { | |
533 | struct bgp *bgp; | |
534 | ||
535 | /* BGP structure lookup. */ | |
536 | if (name) | |
537 | { | |
538 | bgp = bgp_lookup_by_name (name); | |
539 | if (bgp == NULL) | |
540 | { | |
6aeb9e78 | 541 | vty_out (vty, "Can't find BGP instance %s%s", name, VTY_NEWLINE); |
7aafcaca DS |
542 | return CMD_WARNING; |
543 | } | |
544 | } | |
545 | else | |
546 | { | |
f31fa004 | 547 | bgp = bgp_get_default (); |
7aafcaca DS |
548 | if (bgp == NULL) |
549 | { | |
550 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
551 | return CMD_WARNING; | |
552 | } | |
553 | } | |
554 | ||
555 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); | |
556 | } | |
557 | ||
558 | /* clear soft inbound */ | |
559 | static void | |
f31fa004 | 560 | bgp_clear_star_soft_in (struct vty *vty, const char *name) |
7aafcaca | 561 | { |
f31fa004 | 562 | bgp_clear_vty (vty,name, AFI_IP, SAFI_UNICAST, clear_all, |
7aafcaca | 563 | BGP_CLEAR_SOFT_IN, NULL); |
f31fa004 | 564 | bgp_clear_vty (vty, name, AFI_IP6, SAFI_UNICAST, clear_all, |
7aafcaca | 565 | BGP_CLEAR_SOFT_IN, NULL); |
7aafcaca DS |
566 | } |
567 | ||
568 | /* clear soft outbound */ | |
569 | static void | |
f31fa004 | 570 | bgp_clear_star_soft_out (struct vty *vty, const char *name) |
7aafcaca | 571 | { |
f31fa004 | 572 | bgp_clear_vty (vty, name, AFI_IP, SAFI_UNICAST, clear_all, |
7aafcaca | 573 | BGP_CLEAR_SOFT_OUT, NULL); |
f31fa004 | 574 | bgp_clear_vty (vty, name, AFI_IP6, SAFI_UNICAST, clear_all, |
7aafcaca | 575 | BGP_CLEAR_SOFT_OUT, NULL); |
7aafcaca DS |
576 | } |
577 | ||
578 | ||
718e3744 | 579 | /* BGP global configuration. */ |
580 | ||
581 | DEFUN (bgp_multiple_instance_func, | |
582 | bgp_multiple_instance_cmd, | |
583 | "bgp multiple-instance", | |
584 | BGP_STR | |
585 | "Enable bgp multiple instance\n") | |
586 | { | |
587 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
588 | return CMD_SUCCESS; | |
589 | } | |
590 | ||
591 | DEFUN (no_bgp_multiple_instance, | |
592 | no_bgp_multiple_instance_cmd, | |
593 | "no bgp multiple-instance", | |
594 | NO_STR | |
595 | BGP_STR | |
596 | "BGP multiple instance\n") | |
597 | { | |
598 | int ret; | |
599 | ||
600 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
601 | if (ret < 0) | |
602 | { | |
603 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
604 | return CMD_WARNING; | |
605 | } | |
606 | return CMD_SUCCESS; | |
607 | } | |
608 | ||
609 | DEFUN (bgp_config_type, | |
610 | bgp_config_type_cmd, | |
611 | "bgp config-type (cisco|zebra)", | |
612 | BGP_STR | |
613 | "Configuration type\n" | |
614 | "cisco\n" | |
615 | "zebra\n") | |
616 | { | |
afec25d9 | 617 | if (strncmp (argv[2]->arg, "c", 1) == 0) |
718e3744 | 618 | bgp_option_set (BGP_OPT_CONFIG_CISCO); |
619 | else | |
620 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
621 | ||
622 | return CMD_SUCCESS; | |
623 | } | |
624 | ||
f412b39a DW |
625 | /* |
626 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
627 | * "no bgp config-type (cisco|zebra)", | |
628 | * NO_STR | |
629 | * BGP_STR | |
630 | * "Configuration type\n" | |
631 | * "cisco\n" | |
632 | * "zebra\n" | |
633 | * | |
634 | */ | |
718e3744 | 635 | DEFUN (no_bgp_config_type, |
636 | no_bgp_config_type_cmd, | |
637 | "no bgp config-type", | |
638 | NO_STR | |
639 | BGP_STR | |
640 | "Display configuration type\n") | |
641 | { | |
642 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
643 | return CMD_SUCCESS; | |
644 | } | |
645 | ||
813d4307 | 646 | |
718e3744 | 647 | DEFUN (no_synchronization, |
648 | no_synchronization_cmd, | |
649 | "no synchronization", | |
650 | NO_STR | |
651 | "Perform IGP synchronization\n") | |
652 | { | |
653 | return CMD_SUCCESS; | |
654 | } | |
655 | ||
656 | DEFUN (no_auto_summary, | |
657 | no_auto_summary_cmd, | |
658 | "no auto-summary", | |
659 | NO_STR | |
660 | "Enable automatic network number summarization\n") | |
661 | { | |
662 | return CMD_SUCCESS; | |
663 | } | |
3d515fd9 | 664 | |
718e3744 | 665 | /* "router bgp" commands. */ |
f412b39a DW |
666 | /* |
667 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
668 | * "router bgp", | |
669 | * ROUTER_STR | |
670 | * BGP_STR | |
671 | * | |
672 | * "router bgp " CMD_AS_RANGE " (view|vrf) WORD", | |
673 | * ROUTER_STR | |
674 | * BGP_STR | |
675 | * AS_STR | |
676 | * "BGP view\nBGP VRF\n" | |
677 | * "View/VRF name\n" | |
678 | * | |
679 | */ | |
680 | DEFUN (router_bgp, | |
681 | router_bgp_cmd, | |
320da874 | 682 | "router bgp " CMD_AS_RANGE, |
718e3744 | 683 | ROUTER_STR |
684 | BGP_STR | |
685 | AS_STR) | |
686 | { | |
687 | int ret; | |
688 | as_t as; | |
689 | struct bgp *bgp; | |
fd79ac91 | 690 | const char *name = NULL; |
ad4cbda1 | 691 | enum bgp_instance_type inst_type; |
718e3744 | 692 | |
2385a876 DW |
693 | // "router bgp" without an ASN |
694 | if (argc < 1) | |
695 | { | |
6aeb9e78 | 696 | //Pending: Make VRF option available for ASN less config |
2385a876 | 697 | bgp = bgp_get_default(); |
718e3744 | 698 | |
2385a876 DW |
699 | if (bgp == NULL) |
700 | { | |
701 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
702 | return CMD_WARNING; | |
703 | } | |
718e3744 | 704 | |
2385a876 DW |
705 | if (listcount(bm->bgp) > 1) |
706 | { | |
707 | vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE); | |
708 | return CMD_WARNING; | |
709 | } | |
710 | } | |
711 | ||
712 | // "router bgp X" | |
713 | else | |
718e3744 | 714 | { |
afec25d9 | 715 | VTY_GET_INTEGER_RANGE ("AS", as, argv[2]->arg, 1, BGP_AS4_MAX); |
2385a876 | 716 | |
ad4cbda1 | 717 | inst_type = BGP_INSTANCE_TYPE_DEFAULT; |
6aeb9e78 | 718 | if (argc == 3) |
ad4cbda1 | 719 | { |
afec25d9 DW |
720 | name = argv[4]->arg; |
721 | if (!strcmp(argv[3]->arg, "vrf")) | |
ad4cbda1 | 722 | inst_type = BGP_INSTANCE_TYPE_VRF; |
afec25d9 | 723 | else if (!strcmp(argv[3]->arg, "view")) |
ad4cbda1 | 724 | inst_type = BGP_INSTANCE_TYPE_VIEW; |
725 | } | |
2385a876 | 726 | |
ad4cbda1 | 727 | ret = bgp_get (&bgp, &as, name, inst_type); |
2385a876 DW |
728 | switch (ret) |
729 | { | |
730 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
731 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
732 | VTY_NEWLINE); | |
733 | return CMD_WARNING; | |
734 | case BGP_ERR_AS_MISMATCH: | |
735 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); | |
736 | return CMD_WARNING; | |
737 | case BGP_ERR_INSTANCE_MISMATCH: | |
6aeb9e78 | 738 | vty_out (vty, "BGP instance name and AS number mismatch%s", VTY_NEWLINE); |
2385a876 DW |
739 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
740 | as, VTY_NEWLINE); | |
741 | return CMD_WARNING; | |
742 | } | |
6aeb9e78 DS |
743 | |
744 | /* Pending: handle when user tries to change a view to vrf n vv. */ | |
718e3744 | 745 | } |
746 | ||
747 | vty->node = BGP_NODE; | |
748 | vty->index = bgp; | |
749 | ||
750 | return CMD_SUCCESS; | |
751 | } | |
752 | ||
6b0655a2 | 753 | |
2385a876 | 754 | |
718e3744 | 755 | /* "no router bgp" commands. */ |
f412b39a DW |
756 | /* |
757 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
758 | * "no router bgp", | |
759 | * NO_STR | |
760 | * ROUTER_STR | |
761 | * BGP_STR | |
762 | * | |
763 | * "no router bgp " CMD_AS_RANGE " (view|vrf) WORD", | |
764 | * NO_STR | |
765 | * ROUTER_STR | |
766 | * BGP_STR | |
767 | * AS_STR | |
768 | * "BGP view\nBGP VRF\n" | |
769 | * "View/VRF name\n" | |
770 | * | |
771 | */ | |
718e3744 | 772 | DEFUN (no_router_bgp, |
773 | no_router_bgp_cmd, | |
320da874 | 774 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 775 | NO_STR |
776 | ROUTER_STR | |
777 | BGP_STR | |
778 | AS_STR) | |
779 | { | |
780 | as_t as; | |
781 | struct bgp *bgp; | |
fd79ac91 | 782 | const char *name = NULL; |
718e3744 | 783 | |
718e3744 | 784 | |
7fb21a9f QY |
785 | // "no router bgp" without an ASN |
786 | if (argc < 1) | |
787 | { | |
788 | //Pending: Make VRF option available for ASN less config | |
789 | bgp = bgp_get_default(); | |
718e3744 | 790 | |
7fb21a9f QY |
791 | if (bgp == NULL) |
792 | { | |
793 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
794 | return CMD_WARNING; | |
795 | } | |
796 | ||
797 | if (listcount(bm->bgp) > 1) | |
798 | { | |
799 | vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE); | |
800 | return CMD_WARNING; | |
801 | } | |
802 | } | |
803 | else | |
718e3744 | 804 | { |
afec25d9 | 805 | VTY_GET_INTEGER_RANGE ("AS", as, argv[3]->arg, 1, BGP_AS4_MAX); |
7fb21a9f QY |
806 | |
807 | if (argc == 3) | |
afec25d9 | 808 | name = argv[5]->arg; |
7fb21a9f QY |
809 | |
810 | /* Lookup bgp structure. */ | |
811 | bgp = bgp_lookup (as, name); | |
812 | if (! bgp) | |
813 | { | |
814 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
815 | return CMD_WARNING; | |
816 | } | |
718e3744 | 817 | } |
818 | ||
819 | bgp_delete (bgp); | |
820 | ||
821 | return CMD_SUCCESS; | |
822 | } | |
823 | ||
6b0655a2 | 824 | |
7fb21a9f | 825 | |
718e3744 | 826 | /* BGP router-id. */ |
827 | ||
828 | DEFUN (bgp_router_id, | |
829 | bgp_router_id_cmd, | |
830 | "bgp router-id A.B.C.D", | |
831 | BGP_STR | |
832 | "Override configured router identifier\n" | |
833 | "Manually configured router identifier\n") | |
834 | { | |
835 | int ret; | |
836 | struct in_addr id; | |
837 | struct bgp *bgp; | |
838 | ||
839 | bgp = vty->index; | |
840 | ||
afec25d9 | 841 | ret = inet_aton (argv[2]->arg, &id); |
718e3744 | 842 | if (! ret) |
843 | { | |
844 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
845 | return CMD_WARNING; | |
846 | } | |
847 | ||
0e6cb743 | 848 | bgp_router_id_static_set (bgp, id); |
718e3744 | 849 | |
850 | return CMD_SUCCESS; | |
851 | } | |
852 | ||
f412b39a DW |
853 | /* |
854 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
855 | * "no bgp router-id A.B.C.D", | |
856 | * NO_STR | |
857 | * BGP_STR | |
858 | * "Override configured router identifier\n" | |
859 | * "Manually configured router identifier\n" | |
860 | * | |
861 | */ | |
718e3744 | 862 | DEFUN (no_bgp_router_id, |
863 | no_bgp_router_id_cmd, | |
864 | "no bgp router-id", | |
865 | NO_STR | |
866 | BGP_STR | |
867 | "Override configured router identifier\n") | |
868 | { | |
869 | int ret; | |
870 | struct in_addr id; | |
871 | struct bgp *bgp; | |
872 | ||
873 | bgp = vty->index; | |
874 | ||
875 | if (argc == 1) | |
876 | { | |
afec25d9 | 877 | ret = inet_aton (argv[3]->arg, &id); |
718e3744 | 878 | if (! ret) |
e018c7cc SK |
879 | { |
880 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
881 | return CMD_WARNING; | |
882 | } | |
718e3744 | 883 | |
18a6dce6 | 884 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
e018c7cc SK |
885 | { |
886 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
887 | return CMD_WARNING; | |
888 | } | |
718e3744 | 889 | } |
890 | ||
0e6cb743 DL |
891 | id.s_addr = 0; |
892 | bgp_router_id_static_set (bgp, id); | |
718e3744 | 893 | |
894 | return CMD_SUCCESS; | |
895 | } | |
896 | ||
6b0655a2 | 897 | |
718e3744 | 898 | /* BGP Cluster ID. */ |
899 | ||
f412b39a DW |
900 | /* |
901 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
902 | * "bgp cluster-id <1-4294967295>", | |
903 | * BGP_STR | |
904 | * "Configure Route-Reflector Cluster-id\n" | |
905 | * "Route-Reflector Cluster-id as 32 bit quantity\n" | |
906 | * | |
907 | */ | |
718e3744 | 908 | DEFUN (bgp_cluster_id, |
909 | bgp_cluster_id_cmd, | |
910 | "bgp cluster-id A.B.C.D", | |
911 | BGP_STR | |
912 | "Configure Route-Reflector Cluster-id\n" | |
913 | "Route-Reflector Cluster-id in IP address format\n") | |
914 | { | |
915 | int ret; | |
916 | struct bgp *bgp; | |
917 | struct in_addr cluster; | |
918 | ||
919 | bgp = vty->index; | |
920 | ||
afec25d9 | 921 | ret = inet_aton (argv[2]->arg, &cluster); |
718e3744 | 922 | if (! ret) |
923 | { | |
924 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
925 | return CMD_WARNING; | |
926 | } | |
927 | ||
928 | bgp_cluster_id_set (bgp, &cluster); | |
f31fa004 | 929 | bgp_clear_star_soft_out (vty, bgp->name); |
718e3744 | 930 | |
931 | return CMD_SUCCESS; | |
932 | } | |
933 | ||
718e3744 | 934 | |
f412b39a DW |
935 | /* |
936 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
937 | * "no bgp cluster-id A.B.C.D", | |
938 | * NO_STR | |
939 | * BGP_STR | |
940 | * "Configure Route-Reflector Cluster-id\n" | |
941 | * "Route-Reflector Cluster-id in IP address format\n" | |
942 | * | |
943 | * "no bgp cluster-id <1-4294967295>", | |
944 | * NO_STR | |
945 | * BGP_STR | |
946 | * "Configure Route-Reflector Cluster-id\n" | |
947 | * "Route-Reflector Cluster-id as 32 bit quantity\n" | |
948 | * | |
949 | */ | |
718e3744 | 950 | DEFUN (no_bgp_cluster_id, |
951 | no_bgp_cluster_id_cmd, | |
952 | "no bgp cluster-id", | |
953 | NO_STR | |
954 | BGP_STR | |
955 | "Configure Route-Reflector Cluster-id\n") | |
956 | { | |
957 | int ret; | |
958 | struct bgp *bgp; | |
959 | struct in_addr cluster; | |
960 | ||
961 | bgp = vty->index; | |
962 | ||
963 | if (argc == 1) | |
964 | { | |
afec25d9 | 965 | ret = inet_aton (argv[3]->arg, &cluster); |
718e3744 | 966 | if (! ret) |
967 | { | |
968 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
969 | return CMD_WARNING; | |
970 | } | |
971 | } | |
972 | ||
973 | bgp_cluster_id_unset (bgp); | |
f31fa004 | 974 | bgp_clear_star_soft_out (vty, bgp->name); |
718e3744 | 975 | |
976 | return CMD_SUCCESS; | |
977 | } | |
978 | ||
6b0655a2 | 979 | |
813d4307 | 980 | |
718e3744 | 981 | DEFUN (bgp_confederation_identifier, |
982 | bgp_confederation_identifier_cmd, | |
320da874 | 983 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 984 | "BGP specific commands\n" |
985 | "AS confederation parameters\n" | |
986 | "AS number\n" | |
987 | "Set routing domain confederation AS\n") | |
988 | { | |
989 | struct bgp *bgp; | |
990 | as_t as; | |
991 | ||
992 | bgp = vty->index; | |
993 | ||
afec25d9 | 994 | VTY_GET_INTEGER_RANGE ("AS", as, argv[3]->arg, 1, BGP_AS4_MAX); |
718e3744 | 995 | |
996 | bgp_confederation_id_set (bgp, as); | |
997 | ||
998 | return CMD_SUCCESS; | |
999 | } | |
1000 | ||
f412b39a DW |
1001 | /* |
1002 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
1003 | * "no bgp confederation identifier " CMD_AS_RANGE, | |
1004 | * NO_STR | |
1005 | * "BGP specific commands\n" | |
1006 | * "AS confederation parameters\n" | |
1007 | * "AS number\n" | |
1008 | * "Set routing domain confederation AS\n" | |
1009 | * | |
1010 | */ | |
718e3744 | 1011 | DEFUN (no_bgp_confederation_identifier, |
1012 | no_bgp_confederation_identifier_cmd, | |
1013 | "no bgp confederation identifier", | |
1014 | NO_STR | |
1015 | "BGP specific commands\n" | |
1016 | "AS confederation parameters\n" | |
1017 | "AS number\n") | |
1018 | { | |
1019 | struct bgp *bgp; | |
718e3744 | 1020 | |
1021 | bgp = vty->index; | |
1022 | ||
718e3744 | 1023 | bgp_confederation_id_unset (bgp); |
1024 | ||
1025 | return CMD_SUCCESS; | |
1026 | } | |
1027 | ||
6b0655a2 | 1028 | |
718e3744 | 1029 | DEFUN (bgp_confederation_peers, |
1030 | bgp_confederation_peers_cmd, | |
320da874 | 1031 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 1032 | "BGP specific commands\n" |
1033 | "AS confederation parameters\n" | |
1034 | "Peer ASs in BGP confederation\n" | |
1035 | AS_STR) | |
1036 | { | |
1037 | struct bgp *bgp; | |
1038 | as_t as; | |
1039 | int i; | |
1040 | ||
1041 | bgp = vty->index; | |
1042 | ||
1043 | for (i = 0; i < argc; i++) | |
1044 | { | |
afec25d9 | 1045 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i]->arg, 1, BGP_AS4_MAX); |
718e3744 | 1046 | |
1047 | if (bgp->as == as) | |
1048 | { | |
1049 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
1050 | VTY_NEWLINE); | |
1051 | continue; | |
1052 | } | |
1053 | ||
1054 | bgp_confederation_peers_add (bgp, as); | |
1055 | } | |
1056 | return CMD_SUCCESS; | |
1057 | } | |
1058 | ||
1059 | DEFUN (no_bgp_confederation_peers, | |
1060 | no_bgp_confederation_peers_cmd, | |
320da874 | 1061 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 1062 | NO_STR |
1063 | "BGP specific commands\n" | |
1064 | "AS confederation parameters\n" | |
1065 | "Peer ASs in BGP confederation\n" | |
1066 | AS_STR) | |
1067 | { | |
1068 | struct bgp *bgp; | |
1069 | as_t as; | |
1070 | int i; | |
1071 | ||
1072 | bgp = vty->index; | |
1073 | ||
1074 | for (i = 0; i < argc; i++) | |
1075 | { | |
afec25d9 | 1076 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i]->arg, 1, BGP_AS4_MAX); |
0b2aa3a0 | 1077 | |
718e3744 | 1078 | bgp_confederation_peers_remove (bgp, as); |
1079 | } | |
1080 | return CMD_SUCCESS; | |
1081 | } | |
6b0655a2 | 1082 | |
5e242b0d DS |
1083 | /** |
1084 | * Central routine for maximum-paths configuration. | |
1085 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
1086 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
1087 | */ | |
ffd0c037 DS |
1088 | static int |
1089 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, | |
5e242b0d | 1090 | u_int16_t options, int set) |
165b5fff JB |
1091 | { |
1092 | struct bgp *bgp; | |
ffd0c037 | 1093 | u_int16_t maxpaths = 0; |
165b5fff | 1094 | int ret; |
5e242b0d DS |
1095 | afi_t afi; |
1096 | safi_t safi; | |
165b5fff JB |
1097 | |
1098 | bgp = vty->index; | |
5e242b0d DS |
1099 | afi = bgp_node_afi (vty); |
1100 | safi = bgp_node_safi (vty); | |
165b5fff | 1101 | |
5e242b0d DS |
1102 | if (set) |
1103 | { | |
73ac8160 | 1104 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
5b964da3 | 1105 | MULTIPATH_NUM); |
5e242b0d DS |
1106 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
1107 | options); | |
1108 | } | |
1109 | else | |
1110 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 1111 | |
165b5fff JB |
1112 | if (ret < 0) |
1113 | { | |
1114 | vty_out (vty, | |
5e242b0d DS |
1115 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
1116 | (set == 1) ? "" : "un", | |
1117 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
1118 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
1119 | return CMD_WARNING; |
1120 | } | |
1121 | ||
7aafcaca DS |
1122 | bgp_recalculate_all_bestpaths (bgp); |
1123 | ||
165b5fff JB |
1124 | return CMD_SUCCESS; |
1125 | } | |
1126 | ||
abc920f8 DS |
1127 | DEFUN (bgp_maxmed_admin, |
1128 | bgp_maxmed_admin_cmd, | |
1129 | "bgp max-med administrative ", | |
1130 | BGP_STR | |
1131 | "Advertise routes with max-med\n" | |
1132 | "Administratively applied, for an indefinite period\n") | |
1133 | { | |
1134 | struct bgp *bgp; | |
1135 | ||
1136 | bgp = vty->index; | |
1137 | ||
1138 | bgp->v_maxmed_admin = 1; | |
1139 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1140 | ||
1141 | bgp_maxmed_update(bgp); | |
1142 | ||
1143 | return CMD_SUCCESS; | |
1144 | } | |
1145 | ||
1146 | DEFUN (bgp_maxmed_admin_medv, | |
1147 | bgp_maxmed_admin_medv_cmd, | |
1148 | "bgp max-med administrative <0-4294967294>", | |
1149 | BGP_STR | |
1150 | "Advertise routes with max-med\n" | |
1151 | "Administratively applied, for an indefinite period\n" | |
1152 | "Max MED value to be used\n") | |
1153 | { | |
1154 | struct bgp *bgp; | |
1155 | ||
1156 | bgp = vty->index; | |
1157 | ||
1158 | bgp->v_maxmed_admin = 1; | |
afec25d9 | 1159 | VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[3]->arg); |
abc920f8 DS |
1160 | |
1161 | bgp_maxmed_update(bgp); | |
1162 | ||
1163 | return CMD_SUCCESS; | |
1164 | } | |
1165 | ||
f412b39a DW |
1166 | /* |
1167 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
1168 | * "no bgp max-med administrative <0-4294967294>", | |
1169 | * NO_STR | |
1170 | * BGP_STR | |
1171 | * "Advertise routes with max-med\n" | |
1172 | * "Administratively applied, for an indefinite period\n" | |
1173 | * "Max MED value to be used\n" | |
1174 | * | |
1175 | */ | |
abc920f8 DS |
1176 | DEFUN (no_bgp_maxmed_admin, |
1177 | no_bgp_maxmed_admin_cmd, | |
1178 | "no bgp max-med administrative", | |
1179 | NO_STR | |
1180 | BGP_STR | |
1181 | "Advertise routes with max-med\n" | |
1182 | "Administratively applied, for an indefinite period\n") | |
1183 | { | |
1184 | struct bgp *bgp; | |
1185 | ||
1186 | bgp = vty->index; | |
1187 | ||
1188 | bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED; | |
1189 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1190 | ||
1191 | bgp_maxmed_update(bgp); | |
1192 | ||
1193 | return CMD_SUCCESS; | |
1194 | } | |
1195 | ||
abc920f8 DS |
1196 | |
1197 | ||
1198 | DEFUN (bgp_maxmed_onstartup, | |
1199 | bgp_maxmed_onstartup_cmd, | |
1200 | "bgp max-med on-startup <5-86400>", | |
1201 | BGP_STR | |
1202 | "Advertise routes with max-med\n" | |
1203 | "Effective on a startup\n" | |
1204 | "Time (seconds) period for max-med\n") | |
1205 | { | |
1206 | struct bgp *bgp; | |
1207 | ||
1208 | bgp = vty->index; | |
1209 | ||
1210 | if (argc != 1) | |
1211 | { | |
1212 | vty_out (vty, "%% Must supply max-med on-startup period"); | |
1213 | return CMD_WARNING; | |
1214 | } | |
1215 | ||
afec25d9 | 1216 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[3]->arg); |
abc920f8 DS |
1217 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; |
1218 | ||
1219 | bgp_maxmed_update(bgp); | |
1220 | ||
1221 | return CMD_SUCCESS; | |
1222 | } | |
1223 | ||
1224 | DEFUN (bgp_maxmed_onstartup_medv, | |
1225 | bgp_maxmed_onstartup_medv_cmd, | |
1226 | "bgp max-med on-startup <5-86400> <0-4294967294>", | |
1227 | BGP_STR | |
1228 | "Advertise routes with max-med\n" | |
1229 | "Effective on a startup\n" | |
1230 | "Time (seconds) period for max-med\n" | |
1231 | "Max MED value to be used\n") | |
1232 | { | |
1233 | struct bgp *bgp; | |
1234 | ||
1235 | bgp = vty->index; | |
1236 | ||
1237 | if (argc != 2) | |
1238 | { | |
1239 | vty_out (vty, "%% Must supply max-med on-startup period and med value"); | |
1240 | return CMD_WARNING; | |
1241 | } | |
1242 | ||
afec25d9 DW |
1243 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[3]->arg); |
1244 | VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[4]->arg); | |
abc920f8 DS |
1245 | |
1246 | bgp_maxmed_update(bgp); | |
1247 | ||
1248 | return CMD_SUCCESS; | |
1249 | } | |
1250 | ||
f412b39a DW |
1251 | /* |
1252 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
1253 | * "no bgp max-med on-startup <5-86400> <0-4294967294>", | |
1254 | * NO_STR | |
1255 | * BGP_STR | |
1256 | * "Advertise routes with max-med\n" | |
1257 | * "Effective on a startup\n" | |
1258 | * "Time (seconds) period for max-med\n" | |
1259 | * "Max MED value to be used\n" | |
1260 | * | |
1261 | * "no bgp max-med on-startup <5-86400>", | |
1262 | * NO_STR | |
1263 | * BGP_STR | |
1264 | * "Advertise routes with max-med\n" | |
1265 | * "Effective on a startup\n" | |
1266 | * "Time (seconds) period for max-med\n" | |
1267 | * | |
1268 | */ | |
abc920f8 DS |
1269 | DEFUN (no_bgp_maxmed_onstartup, |
1270 | no_bgp_maxmed_onstartup_cmd, | |
1271 | "no bgp max-med on-startup", | |
1272 | NO_STR | |
1273 | BGP_STR | |
1274 | "Advertise routes with max-med\n" | |
1275 | "Effective on a startup\n") | |
1276 | { | |
1277 | struct bgp *bgp; | |
1278 | ||
1279 | bgp = vty->index; | |
1280 | ||
1281 | /* Cancel max-med onstartup if its on */ | |
1282 | if (bgp->t_maxmed_onstartup) | |
1283 | { | |
1284 | THREAD_TIMER_OFF (bgp->t_maxmed_onstartup); | |
1285 | bgp->maxmed_onstartup_over = 1; | |
1286 | } | |
1287 | ||
1288 | bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED; | |
1289 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1290 | ||
1291 | bgp_maxmed_update(bgp); | |
1292 | ||
1293 | return CMD_SUCCESS; | |
1294 | } | |
1295 | ||
abc920f8 | 1296 | |
abc920f8 | 1297 | |
f188f2c4 DS |
1298 | static int |
1299 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
1300 | const char *wait) | |
1301 | { | |
1302 | struct bgp *bgp; | |
1303 | u_int16_t update_delay; | |
1304 | u_int16_t establish_wait; | |
1305 | ||
1306 | ||
1307 | bgp = vty->index; | |
1308 | ||
1309 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
1310 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
1311 | ||
1312 | if (!wait) /* update-delay <delay> */ | |
1313 | { | |
1314 | bgp->v_update_delay = update_delay; | |
1315 | bgp->v_establish_wait = bgp->v_update_delay; | |
1316 | return CMD_SUCCESS; | |
1317 | } | |
1318 | ||
1319 | /* update-delay <delay> <establish-wait> */ | |
1320 | establish_wait = atoi (wait); | |
1321 | if (update_delay < establish_wait) | |
1322 | { | |
1323 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
1324 | VTY_NEWLINE); | |
1325 | return CMD_WARNING; | |
1326 | } | |
1327 | ||
1328 | bgp->v_update_delay = update_delay; | |
1329 | bgp->v_establish_wait = establish_wait; | |
1330 | ||
1331 | return CMD_SUCCESS; | |
1332 | } | |
1333 | ||
1334 | static int | |
1335 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
1336 | { | |
1337 | struct bgp *bgp; | |
1338 | ||
1339 | bgp = vty->index; | |
1340 | ||
1341 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
1342 | bgp->v_establish_wait = bgp->v_update_delay; | |
1343 | ||
1344 | return CMD_SUCCESS; | |
1345 | } | |
1346 | ||
1347 | int | |
1348 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
1349 | { | |
1350 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
1351 | { | |
1352 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
1353 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
1354 | vty_out (vty, " %d", bgp->v_establish_wait); | |
1355 | vty_out (vty, "%s", VTY_NEWLINE); | |
1356 | } | |
1357 | ||
1358 | return 0; | |
1359 | } | |
1360 | ||
1361 | ||
1362 | /* Update-delay configuration */ | |
1363 | DEFUN (bgp_update_delay, | |
1364 | bgp_update_delay_cmd, | |
1365 | "update-delay <0-3600>", | |
1366 | "Force initial delay for best-path and updates\n" | |
1367 | "Seconds\n") | |
1368 | { | |
afec25d9 | 1369 | return bgp_update_delay_config_vty(vty, argv[1]->arg, NULL); |
f188f2c4 DS |
1370 | } |
1371 | ||
1372 | DEFUN (bgp_update_delay_establish_wait, | |
1373 | bgp_update_delay_establish_wait_cmd, | |
1374 | "update-delay <0-3600> <1-3600>", | |
1375 | "Force initial delay for best-path and updates\n" | |
1376 | "Seconds\n" | |
1377 | "Wait for peers to be established\n" | |
1378 | "Seconds\n") | |
1379 | { | |
afec25d9 | 1380 | return bgp_update_delay_config_vty(vty, argv[1]->arg, argv[2]->arg); |
f188f2c4 DS |
1381 | } |
1382 | ||
1383 | /* Update-delay deconfiguration */ | |
f412b39a DW |
1384 | /* |
1385 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
1386 | * "no update-delay <0-3600> <1-3600>", | |
1387 | * "Force initial delay for best-path and updates\n" | |
1388 | * "Seconds\n" | |
1389 | * "Wait for peers to be established\n" | |
1390 | * "Seconds\n" | |
1391 | * | |
1392 | */ | |
f188f2c4 DS |
1393 | DEFUN (no_bgp_update_delay, |
1394 | no_bgp_update_delay_cmd, | |
1395 | "no update-delay <0-3600>", | |
1396 | "Force initial delay for best-path and updates\n" | |
1397 | "Seconds\n") | |
1398 | { | |
1399 | return bgp_update_delay_deconfig_vty(vty); | |
1400 | } | |
1401 | ||
5e242b0d | 1402 | |
ffd0c037 DS |
1403 | static int |
1404 | bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set) | |
cb1faec9 DS |
1405 | { |
1406 | struct bgp *bgp; | |
cb1faec9 DS |
1407 | |
1408 | bgp = vty->index; | |
1409 | ||
1410 | if (set) | |
1411 | VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num, | |
4543bbb4 | 1412 | 1, 10000); |
cb1faec9 DS |
1413 | else |
1414 | bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX; | |
1415 | ||
1416 | return CMD_SUCCESS; | |
1417 | } | |
1418 | ||
1419 | int | |
1420 | bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) | |
1421 | { | |
1422 | if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX) | |
1423 | vty_out (vty, " write-quanta %d%s", | |
1424 | bgp->wpkt_quanta, VTY_NEWLINE); | |
1425 | ||
1426 | return 0; | |
1427 | } | |
1428 | ||
1429 | ||
1430 | /* Update-delay configuration */ | |
1431 | DEFUN (bgp_wpkt_quanta, | |
1432 | bgp_wpkt_quanta_cmd, | |
4543bbb4 | 1433 | "write-quanta <1-10000>", |
cb1faec9 DS |
1434 | "How many packets to write to peer socket per run\n" |
1435 | "Number of packets\n") | |
1436 | { | |
afec25d9 | 1437 | return bgp_wpkt_quanta_config_vty(vty, argv[1]->arg, 1); |
cb1faec9 DS |
1438 | } |
1439 | ||
1440 | /* Update-delay deconfiguration */ | |
1441 | DEFUN (no_bgp_wpkt_quanta, | |
1442 | no_bgp_wpkt_quanta_cmd, | |
4543bbb4 | 1443 | "no write-quanta <1-10000>", |
cb1faec9 DS |
1444 | "How many packets to write to peer socket per run\n" |
1445 | "Number of packets\n") | |
1446 | { | |
afec25d9 | 1447 | return bgp_wpkt_quanta_config_vty(vty, argv[2]->arg, 0); |
cb1faec9 DS |
1448 | } |
1449 | ||
ffd0c037 | 1450 | static int |
3f9c7369 DS |
1451 | bgp_coalesce_config_vty (struct vty *vty, const char *num, char set) |
1452 | { | |
1453 | struct bgp *bgp; | |
1454 | ||
1455 | bgp = vty->index; | |
1456 | ||
1457 | if (set) | |
1458 | VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num, | |
1459 | 0, 4294967295); | |
1460 | else | |
1461 | bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; | |
1462 | ||
1463 | return CMD_SUCCESS; | |
1464 | } | |
1465 | ||
1466 | int | |
1467 | bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp) | |
1468 | { | |
1469 | if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME) | |
1470 | vty_out (vty, " coalesce-time %d%s", | |
1471 | bgp->coalesce_time, VTY_NEWLINE); | |
1472 | ||
1473 | return 0; | |
1474 | } | |
1475 | ||
1476 | ||
1477 | DEFUN (bgp_coalesce_time, | |
1478 | bgp_coalesce_time_cmd, | |
1479 | "coalesce-time <0-4294967295>", | |
1480 | "Subgroup coalesce timer\n" | |
1481 | "Subgroup coalesce timer value (in ms)\n") | |
1482 | { | |
afec25d9 | 1483 | return bgp_coalesce_config_vty(vty, argv[1]->arg, 1); |
3f9c7369 DS |
1484 | } |
1485 | ||
1486 | DEFUN (no_bgp_coalesce_time, | |
1487 | no_bgp_coalesce_time_cmd, | |
1488 | "no coalesce-time <0-4294967295>", | |
1489 | "Subgroup coalesce timer\n" | |
1490 | "Subgroup coalesce timer value (in ms)\n") | |
1491 | { | |
afec25d9 | 1492 | return bgp_coalesce_config_vty(vty, argv[2]->arg, 0); |
3f9c7369 DS |
1493 | } |
1494 | ||
5e242b0d DS |
1495 | /* Maximum-paths configuration */ |
1496 | DEFUN (bgp_maxpaths, | |
1497 | bgp_maxpaths_cmd, | |
a565fbdd | 1498 | "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), |
5e242b0d DS |
1499 | "Forward packets over multiple paths\n" |
1500 | "Number of paths\n") | |
1501 | { | |
afec25d9 | 1502 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[1]->arg, 0, 1); |
5e242b0d DS |
1503 | } |
1504 | ||
165b5fff JB |
1505 | DEFUN (bgp_maxpaths_ibgp, |
1506 | bgp_maxpaths_ibgp_cmd, | |
a565fbdd | 1507 | "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), |
165b5fff JB |
1508 | "Forward packets over multiple paths\n" |
1509 | "iBGP-multipath\n" | |
1510 | "Number of paths\n") | |
1511 | { | |
afec25d9 | 1512 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[2]->arg, 0, 1); |
5e242b0d | 1513 | } |
165b5fff | 1514 | |
5e242b0d DS |
1515 | DEFUN (bgp_maxpaths_ibgp_cluster, |
1516 | bgp_maxpaths_ibgp_cluster_cmd, | |
a565fbdd | 1517 | "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", |
5e242b0d DS |
1518 | "Forward packets over multiple paths\n" |
1519 | "iBGP-multipath\n" | |
1520 | "Number of paths\n" | |
1521 | "Match the cluster length\n") | |
1522 | { | |
afec25d9 | 1523 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[2]->arg, |
5e242b0d | 1524 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); |
165b5fff JB |
1525 | } |
1526 | ||
f412b39a DW |
1527 | /* |
1528 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
1529 | * "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM), | |
1530 | * NO_STR | |
1531 | * "Forward packets over multiple paths\n" | |
1532 | * "Number of paths\n" | |
1533 | * | |
1534 | */ | |
165b5fff JB |
1535 | DEFUN (no_bgp_maxpaths, |
1536 | no_bgp_maxpaths_cmd, | |
1537 | "no maximum-paths", | |
1538 | NO_STR | |
1539 | "Forward packets over multiple paths\n" | |
1540 | "Number of paths\n") | |
1541 | { | |
5e242b0d | 1542 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
1543 | } |
1544 | ||
165b5fff | 1545 | |
f412b39a DW |
1546 | /* |
1547 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
1548 | * "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM) " equal-cluster-length", | |
1549 | * NO_STR | |
1550 | * "Forward packets over multiple paths\n" | |
1551 | * "iBGP-multipath\n" | |
1552 | * "Number of paths\n" | |
1553 | * "Match the cluster length\n" | |
1554 | * | |
1555 | * "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM), | |
1556 | * NO_STR | |
1557 | * "Forward packets over multiple paths\n" | |
1558 | * "iBGP-multipath\n" | |
1559 | * "Number of paths\n" | |
1560 | * | |
1561 | */ | |
165b5fff JB |
1562 | DEFUN (no_bgp_maxpaths_ibgp, |
1563 | no_bgp_maxpaths_ibgp_cmd, | |
1564 | "no maximum-paths ibgp", | |
1565 | NO_STR | |
1566 | "Forward packets over multiple paths\n" | |
1567 | "iBGP-multipath\n" | |
1568 | "Number of paths\n") | |
1569 | { | |
5e242b0d | 1570 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
1571 | } |
1572 | ||
165b5fff | 1573 | |
5e242b0d | 1574 | |
165b5fff JB |
1575 | int |
1576 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
1577 | safi_t safi, int *write) | |
1578 | { | |
d5b77cc2 | 1579 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != MULTIPATH_NUM) |
165b5fff JB |
1580 | { |
1581 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1582 | vty_out (vty, " maximum-paths %d%s", |
165b5fff JB |
1583 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); |
1584 | } | |
1585 | ||
d5b77cc2 | 1586 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != MULTIPATH_NUM) |
165b5fff JB |
1587 | { |
1588 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1589 | vty_out (vty, " maximum-paths ibgp %d", |
5e242b0d DS |
1590 | bgp->maxpaths[afi][safi].maxpaths_ibgp); |
1591 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
1592 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
1593 | vty_out (vty, " equal-cluster-length"); | |
1594 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
1595 | } |
1596 | ||
1597 | return 0; | |
1598 | } | |
6b0655a2 | 1599 | |
718e3744 | 1600 | /* BGP timers. */ |
1601 | ||
1602 | DEFUN (bgp_timers, | |
1603 | bgp_timers_cmd, | |
1604 | "timers bgp <0-65535> <0-65535>", | |
1605 | "Adjust routing timers\n" | |
1606 | "BGP timers\n" | |
1607 | "Keepalive interval\n" | |
1608 | "Holdtime\n") | |
1609 | { | |
1610 | struct bgp *bgp; | |
1611 | unsigned long keepalive = 0; | |
1612 | unsigned long holdtime = 0; | |
1613 | ||
1614 | bgp = vty->index; | |
1615 | ||
afec25d9 DW |
1616 | VTY_GET_INTEGER ("keepalive", keepalive, argv[2]->arg); |
1617 | VTY_GET_INTEGER ("holdtime", holdtime, argv[3]->arg); | |
718e3744 | 1618 | |
1619 | /* Holdtime value check. */ | |
1620 | if (holdtime < 3 && holdtime != 0) | |
1621 | { | |
1622 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
1623 | VTY_NEWLINE); | |
1624 | return CMD_WARNING; | |
1625 | } | |
1626 | ||
1627 | bgp_timers_set (bgp, keepalive, holdtime); | |
1628 | ||
1629 | return CMD_SUCCESS; | |
1630 | } | |
1631 | ||
f412b39a DW |
1632 | /* |
1633 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
1634 | * "no timers bgp <0-65535> <0-65535>", | |
1635 | * NO_STR | |
1636 | * "Adjust routing timers\n" | |
1637 | * "BGP timers\n" | |
1638 | * "Keepalive interval\n" | |
1639 | * "Holdtime\n" | |
1640 | * | |
1641 | */ | |
718e3744 | 1642 | DEFUN (no_bgp_timers, |
1643 | no_bgp_timers_cmd, | |
1644 | "no timers bgp", | |
1645 | NO_STR | |
1646 | "Adjust routing timers\n" | |
1647 | "BGP timers\n") | |
1648 | { | |
1649 | struct bgp *bgp; | |
1650 | ||
1651 | bgp = vty->index; | |
1652 | bgp_timers_unset (bgp); | |
1653 | ||
1654 | return CMD_SUCCESS; | |
1655 | } | |
1656 | ||
6b0655a2 | 1657 | |
718e3744 | 1658 | DEFUN (bgp_client_to_client_reflection, |
1659 | bgp_client_to_client_reflection_cmd, | |
1660 | "bgp client-to-client reflection", | |
1661 | "BGP specific commands\n" | |
1662 | "Configure client to client route reflection\n" | |
1663 | "reflection of routes allowed\n") | |
1664 | { | |
1665 | struct bgp *bgp; | |
1666 | ||
1667 | bgp = vty->index; | |
1668 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
f31fa004 | 1669 | bgp_clear_star_soft_out (vty, bgp->name); |
7aafcaca | 1670 | |
718e3744 | 1671 | return CMD_SUCCESS; |
1672 | } | |
1673 | ||
1674 | DEFUN (no_bgp_client_to_client_reflection, | |
1675 | no_bgp_client_to_client_reflection_cmd, | |
1676 | "no bgp client-to-client reflection", | |
1677 | NO_STR | |
1678 | "BGP specific commands\n" | |
1679 | "Configure client to client route reflection\n" | |
1680 | "reflection of routes allowed\n") | |
1681 | { | |
1682 | struct bgp *bgp; | |
1683 | ||
1684 | bgp = vty->index; | |
1685 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
f31fa004 | 1686 | bgp_clear_star_soft_out (vty, bgp->name); |
7aafcaca | 1687 | |
718e3744 | 1688 | return CMD_SUCCESS; |
1689 | } | |
1690 | ||
1691 | /* "bgp always-compare-med" configuration. */ | |
1692 | DEFUN (bgp_always_compare_med, | |
1693 | bgp_always_compare_med_cmd, | |
1694 | "bgp always-compare-med", | |
1695 | "BGP specific commands\n" | |
1696 | "Allow comparing MED from different neighbors\n") | |
1697 | { | |
1698 | struct bgp *bgp; | |
1699 | ||
1700 | bgp = vty->index; | |
1701 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1702 | bgp_recalculate_all_bestpaths (bgp); |
1703 | ||
718e3744 | 1704 | return CMD_SUCCESS; |
1705 | } | |
1706 | ||
1707 | DEFUN (no_bgp_always_compare_med, | |
1708 | no_bgp_always_compare_med_cmd, | |
1709 | "no bgp always-compare-med", | |
1710 | NO_STR | |
1711 | "BGP specific commands\n" | |
1712 | "Allow comparing MED from different neighbors\n") | |
1713 | { | |
1714 | struct bgp *bgp; | |
1715 | ||
1716 | bgp = vty->index; | |
1717 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1718 | bgp_recalculate_all_bestpaths (bgp); |
1719 | ||
718e3744 | 1720 | return CMD_SUCCESS; |
1721 | } | |
6b0655a2 | 1722 | |
718e3744 | 1723 | /* "bgp deterministic-med" configuration. */ |
1724 | DEFUN (bgp_deterministic_med, | |
1725 | bgp_deterministic_med_cmd, | |
1726 | "bgp deterministic-med", | |
1727 | "BGP specific commands\n" | |
1728 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1729 | { | |
1730 | struct bgp *bgp; | |
1731 | ||
1732 | bgp = vty->index; | |
1475ac87 DW |
1733 | |
1734 | if (!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1735 | { | |
1736 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1737 | bgp_recalculate_all_bestpaths (bgp); | |
1738 | } | |
7aafcaca | 1739 | |
718e3744 | 1740 | return CMD_SUCCESS; |
1741 | } | |
1742 | ||
1743 | DEFUN (no_bgp_deterministic_med, | |
1744 | no_bgp_deterministic_med_cmd, | |
1745 | "no bgp deterministic-med", | |
1746 | NO_STR | |
1747 | "BGP specific commands\n" | |
1748 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1749 | { | |
1750 | struct bgp *bgp; | |
06370dac DW |
1751 | int bestpath_per_as_used; |
1752 | afi_t afi; | |
1753 | safi_t safi; | |
1754 | struct peer *peer; | |
1755 | struct listnode *node, *nnode; | |
718e3744 | 1756 | |
1757 | bgp = vty->index; | |
1475ac87 DW |
1758 | |
1759 | if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1760 | { | |
06370dac DW |
1761 | bestpath_per_as_used = 0; |
1762 | ||
1763 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
1764 | { | |
1765 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
1766 | for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) | |
1767 | if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) | |
1768 | { | |
1769 | bestpath_per_as_used = 1; | |
1770 | break; | |
1771 | } | |
1772 | ||
1773 | if (bestpath_per_as_used) | |
1774 | break; | |
1775 | } | |
1776 | ||
1777 | if (bestpath_per_as_used) | |
1778 | { | |
1779 | vty_out (vty, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s", | |
1780 | VTY_NEWLINE); | |
1781 | return CMD_WARNING; | |
1782 | } | |
1783 | else | |
1784 | { | |
1785 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1786 | bgp_recalculate_all_bestpaths (bgp); | |
1787 | } | |
1475ac87 | 1788 | } |
7aafcaca | 1789 | |
718e3744 | 1790 | return CMD_SUCCESS; |
1791 | } | |
538621f2 | 1792 | |
1793 | /* "bgp graceful-restart" configuration. */ | |
1794 | DEFUN (bgp_graceful_restart, | |
1795 | bgp_graceful_restart_cmd, | |
1796 | "bgp graceful-restart", | |
1797 | "BGP specific commands\n" | |
1798 | "Graceful restart capability parameters\n") | |
1799 | { | |
1800 | struct bgp *bgp; | |
1801 | ||
1802 | bgp = vty->index; | |
1803 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1804 | return CMD_SUCCESS; | |
1805 | } | |
1806 | ||
1807 | DEFUN (no_bgp_graceful_restart, | |
1808 | no_bgp_graceful_restart_cmd, | |
1809 | "no bgp graceful-restart", | |
1810 | NO_STR | |
1811 | "BGP specific commands\n" | |
1812 | "Graceful restart capability parameters\n") | |
1813 | { | |
1814 | struct bgp *bgp; | |
1815 | ||
1816 | bgp = vty->index; | |
1817 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1818 | return CMD_SUCCESS; | |
1819 | } | |
1820 | ||
93406d87 | 1821 | DEFUN (bgp_graceful_restart_stalepath_time, |
1822 | bgp_graceful_restart_stalepath_time_cmd, | |
1823 | "bgp graceful-restart stalepath-time <1-3600>", | |
1824 | "BGP specific commands\n" | |
1825 | "Graceful restart capability parameters\n" | |
1826 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1827 | "Delay value (seconds)\n") | |
1828 | { | |
1829 | struct bgp *bgp; | |
1830 | u_int32_t stalepath; | |
1831 | ||
1832 | bgp = vty->index; | |
1833 | if (! bgp) | |
1834 | return CMD_WARNING; | |
1835 | ||
afec25d9 | 1836 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[3]->arg, 1, 3600); |
93406d87 | 1837 | bgp->stalepath_time = stalepath; |
1838 | return CMD_SUCCESS; | |
1839 | } | |
1840 | ||
eb6f1b41 PG |
1841 | DEFUN (bgp_graceful_restart_restart_time, |
1842 | bgp_graceful_restart_restart_time_cmd, | |
1843 | "bgp graceful-restart restart-time <1-3600>", | |
1844 | "BGP specific commands\n" | |
1845 | "Graceful restart capability parameters\n" | |
1846 | "Set the time to wait to delete stale routes before a BGP open message is received\n" | |
1847 | "Delay value (seconds)\n") | |
1848 | { | |
1849 | struct bgp *bgp; | |
1850 | u_int32_t restart; | |
1851 | ||
1852 | bgp = vty->index; | |
1853 | if (! bgp) | |
1854 | return CMD_WARNING; | |
1855 | ||
afec25d9 | 1856 | VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[3]->arg, 1, 3600); |
eb6f1b41 PG |
1857 | bgp->restart_time = restart; |
1858 | return CMD_SUCCESS; | |
1859 | } | |
1860 | ||
f412b39a DW |
1861 | /* |
1862 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
1863 | * "no bgp graceful-restart stalepath-time <1-3600>", | |
1864 | * NO_STR | |
1865 | * "BGP specific commands\n" | |
1866 | * "Graceful restart capability parameters\n" | |
1867 | * "Set the max time to hold onto restarting peer's stale paths\n" | |
1868 | * "Delay value (seconds)\n" | |
1869 | * | |
1870 | */ | |
93406d87 | 1871 | DEFUN (no_bgp_graceful_restart_stalepath_time, |
1872 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1873 | "no bgp graceful-restart stalepath-time", | |
1874 | NO_STR | |
1875 | "BGP specific commands\n" | |
1876 | "Graceful restart capability parameters\n" | |
1877 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1878 | { | |
1879 | struct bgp *bgp; | |
1880 | ||
1881 | bgp = vty->index; | |
1882 | if (! bgp) | |
1883 | return CMD_WARNING; | |
1884 | ||
1885 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1886 | return CMD_SUCCESS; | |
1887 | } | |
1888 | ||
f412b39a DW |
1889 | /* |
1890 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
1891 | * "no bgp graceful-restart restart-time <1-3600>", | |
1892 | * NO_STR | |
1893 | * "BGP specific commands\n" | |
1894 | * "Graceful restart capability parameters\n" | |
1895 | * "Set the time to wait to delete stale routes before a BGP open message is received\n" | |
1896 | * "Delay value (seconds)\n" | |
1897 | * | |
1898 | */ | |
eb6f1b41 PG |
1899 | DEFUN (no_bgp_graceful_restart_restart_time, |
1900 | no_bgp_graceful_restart_restart_time_cmd, | |
1901 | "no bgp graceful-restart restart-time", | |
1902 | NO_STR | |
1903 | "BGP specific commands\n" | |
1904 | "Graceful restart capability parameters\n" | |
1905 | "Set the time to wait to delete stale routes before a BGP open message is received\n") | |
1906 | { | |
1907 | struct bgp *bgp; | |
1908 | ||
1909 | bgp = vty->index; | |
1910 | if (! bgp) | |
1911 | return CMD_WARNING; | |
1912 | ||
1913 | bgp->restart_time = BGP_DEFAULT_RESTART_TIME; | |
1914 | return CMD_SUCCESS; | |
1915 | } | |
1916 | ||
93406d87 | 1917 | |
eb6f1b41 | 1918 | |
718e3744 | 1919 | /* "bgp fast-external-failover" configuration. */ |
1920 | DEFUN (bgp_fast_external_failover, | |
1921 | bgp_fast_external_failover_cmd, | |
1922 | "bgp fast-external-failover", | |
1923 | BGP_STR | |
1924 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1925 | { | |
1926 | struct bgp *bgp; | |
1927 | ||
1928 | bgp = vty->index; | |
1929 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1930 | return CMD_SUCCESS; | |
1931 | } | |
1932 | ||
1933 | DEFUN (no_bgp_fast_external_failover, | |
1934 | no_bgp_fast_external_failover_cmd, | |
1935 | "no bgp fast-external-failover", | |
1936 | NO_STR | |
1937 | BGP_STR | |
1938 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1939 | { | |
1940 | struct bgp *bgp; | |
1941 | ||
1942 | bgp = vty->index; | |
1943 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1944 | return CMD_SUCCESS; | |
1945 | } | |
6b0655a2 | 1946 | |
718e3744 | 1947 | /* "bgp enforce-first-as" configuration. */ |
1948 | DEFUN (bgp_enforce_first_as, | |
1949 | bgp_enforce_first_as_cmd, | |
1950 | "bgp enforce-first-as", | |
1951 | BGP_STR | |
1952 | "Enforce the first AS for EBGP routes\n") | |
1953 | { | |
1954 | struct bgp *bgp; | |
1955 | ||
1956 | bgp = vty->index; | |
1957 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
f31fa004 | 1958 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 1959 | |
718e3744 | 1960 | return CMD_SUCCESS; |
1961 | } | |
1962 | ||
1963 | DEFUN (no_bgp_enforce_first_as, | |
1964 | no_bgp_enforce_first_as_cmd, | |
1965 | "no bgp enforce-first-as", | |
1966 | NO_STR | |
1967 | BGP_STR | |
1968 | "Enforce the first AS for EBGP routes\n") | |
1969 | { | |
1970 | struct bgp *bgp; | |
1971 | ||
1972 | bgp = vty->index; | |
1973 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
f31fa004 | 1974 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 1975 | |
718e3744 | 1976 | return CMD_SUCCESS; |
1977 | } | |
6b0655a2 | 1978 | |
718e3744 | 1979 | /* "bgp bestpath compare-routerid" configuration. */ |
1980 | DEFUN (bgp_bestpath_compare_router_id, | |
1981 | bgp_bestpath_compare_router_id_cmd, | |
1982 | "bgp bestpath compare-routerid", | |
1983 | "BGP specific commands\n" | |
1984 | "Change the default bestpath selection\n" | |
1985 | "Compare router-id for identical EBGP paths\n") | |
1986 | { | |
1987 | struct bgp *bgp; | |
1988 | ||
1989 | bgp = vty->index; | |
1990 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1991 | bgp_recalculate_all_bestpaths (bgp); |
1992 | ||
718e3744 | 1993 | return CMD_SUCCESS; |
1994 | } | |
1995 | ||
1996 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1997 | no_bgp_bestpath_compare_router_id_cmd, | |
1998 | "no bgp bestpath compare-routerid", | |
1999 | NO_STR | |
2000 | "BGP specific commands\n" | |
2001 | "Change the default bestpath selection\n" | |
2002 | "Compare router-id for identical EBGP paths\n") | |
2003 | { | |
2004 | struct bgp *bgp; | |
2005 | ||
2006 | bgp = vty->index; | |
2007 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
2008 | bgp_recalculate_all_bestpaths (bgp); |
2009 | ||
718e3744 | 2010 | return CMD_SUCCESS; |
2011 | } | |
6b0655a2 | 2012 | |
718e3744 | 2013 | /* "bgp bestpath as-path ignore" configuration. */ |
2014 | DEFUN (bgp_bestpath_aspath_ignore, | |
2015 | bgp_bestpath_aspath_ignore_cmd, | |
2016 | "bgp bestpath as-path ignore", | |
2017 | "BGP specific commands\n" | |
2018 | "Change the default bestpath selection\n" | |
2019 | "AS-path attribute\n" | |
2020 | "Ignore as-path length in selecting a route\n") | |
2021 | { | |
2022 | struct bgp *bgp; | |
2023 | ||
2024 | bgp = vty->index; | |
2025 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
2026 | bgp_recalculate_all_bestpaths (bgp); |
2027 | ||
718e3744 | 2028 | return CMD_SUCCESS; |
2029 | } | |
2030 | ||
2031 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
2032 | no_bgp_bestpath_aspath_ignore_cmd, | |
2033 | "no bgp bestpath as-path ignore", | |
2034 | NO_STR | |
2035 | "BGP specific commands\n" | |
2036 | "Change the default bestpath selection\n" | |
2037 | "AS-path attribute\n" | |
2038 | "Ignore as-path length in selecting a route\n") | |
2039 | { | |
2040 | struct bgp *bgp; | |
2041 | ||
2042 | bgp = vty->index; | |
2043 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
2044 | bgp_recalculate_all_bestpaths (bgp); |
2045 | ||
718e3744 | 2046 | return CMD_SUCCESS; |
2047 | } | |
6b0655a2 | 2048 | |
6811845b | 2049 | /* "bgp bestpath as-path confed" configuration. */ |
2050 | DEFUN (bgp_bestpath_aspath_confed, | |
2051 | bgp_bestpath_aspath_confed_cmd, | |
2052 | "bgp bestpath as-path confed", | |
2053 | "BGP specific commands\n" | |
2054 | "Change the default bestpath selection\n" | |
2055 | "AS-path attribute\n" | |
2056 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
2057 | { | |
2058 | struct bgp *bgp; | |
2059 | ||
2060 | bgp = vty->index; | |
2061 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
2062 | bgp_recalculate_all_bestpaths (bgp); |
2063 | ||
6811845b | 2064 | return CMD_SUCCESS; |
2065 | } | |
2066 | ||
2067 | DEFUN (no_bgp_bestpath_aspath_confed, | |
2068 | no_bgp_bestpath_aspath_confed_cmd, | |
2069 | "no bgp bestpath as-path confed", | |
2070 | NO_STR | |
2071 | "BGP specific commands\n" | |
2072 | "Change the default bestpath selection\n" | |
2073 | "AS-path attribute\n" | |
2074 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
2075 | { | |
2076 | struct bgp *bgp; | |
2077 | ||
2078 | bgp = vty->index; | |
2079 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
2080 | bgp_recalculate_all_bestpaths (bgp); |
2081 | ||
6811845b | 2082 | return CMD_SUCCESS; |
2083 | } | |
6b0655a2 | 2084 | |
2fdd455c PM |
2085 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
2086 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
2087 | bgp_bestpath_aspath_multipath_relax_cmd, | |
219178b6 | 2088 | "bgp bestpath as-path multipath-relax {as-set|no-as-set}", |
16fc1eec DS |
2089 | "BGP specific commands\n" |
2090 | "Change the default bestpath selection\n" | |
2091 | "AS-path attribute\n" | |
2092 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
219178b6 | 2093 | "Generate an AS_SET\n" |
16fc1eec DS |
2094 | "Do not generate an AS_SET\n") |
2095 | { | |
2096 | struct bgp *bgp; | |
2097 | ||
2098 | bgp = vty->index; | |
2099 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
219178b6 DW |
2100 | |
2101 | /* no-as-set is now the default behavior so we can silently | |
2102 | * ignore it */ | |
afec25d9 | 2103 | if (argv[4]->arg != NULL && strncmp (argv[4]->arg, "a", 1) == 0) |
219178b6 DW |
2104 | bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); |
2105 | else | |
2106 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ; | |
2107 | ||
7aafcaca DS |
2108 | bgp_recalculate_all_bestpaths (bgp); |
2109 | ||
16fc1eec DS |
2110 | return CMD_SUCCESS; |
2111 | } | |
2112 | ||
219178b6 DW |
2113 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, |
2114 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
2115 | "no bgp bestpath as-path multipath-relax {as-set|no-as-set}", | |
16fc1eec DS |
2116 | NO_STR |
2117 | "BGP specific commands\n" | |
2118 | "Change the default bestpath selection\n" | |
2119 | "AS-path attribute\n" | |
2120 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
219178b6 | 2121 | "Generate an AS_SET\n" |
16fc1eec DS |
2122 | "Do not generate an AS_SET\n") |
2123 | { | |
2124 | struct bgp *bgp; | |
2125 | ||
2126 | bgp = vty->index; | |
2127 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
219178b6 | 2128 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); |
7aafcaca DS |
2129 | bgp_recalculate_all_bestpaths (bgp); |
2130 | ||
2fdd455c PM |
2131 | return CMD_SUCCESS; |
2132 | } | |
6b0655a2 | 2133 | |
848973c7 | 2134 | /* "bgp log-neighbor-changes" configuration. */ |
2135 | DEFUN (bgp_log_neighbor_changes, | |
2136 | bgp_log_neighbor_changes_cmd, | |
2137 | "bgp log-neighbor-changes", | |
2138 | "BGP specific commands\n" | |
2139 | "Log neighbor up/down and reset reason\n") | |
2140 | { | |
2141 | struct bgp *bgp; | |
2142 | ||
2143 | bgp = vty->index; | |
2144 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
2145 | return CMD_SUCCESS; | |
2146 | } | |
2147 | ||
2148 | DEFUN (no_bgp_log_neighbor_changes, | |
2149 | no_bgp_log_neighbor_changes_cmd, | |
2150 | "no bgp log-neighbor-changes", | |
2151 | NO_STR | |
2152 | "BGP specific commands\n" | |
2153 | "Log neighbor up/down and reset reason\n") | |
2154 | { | |
2155 | struct bgp *bgp; | |
2156 | ||
2157 | bgp = vty->index; | |
2158 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
2159 | return CMD_SUCCESS; | |
2160 | } | |
6b0655a2 | 2161 | |
718e3744 | 2162 | /* "bgp bestpath med" configuration. */ |
2163 | DEFUN (bgp_bestpath_med, | |
2164 | bgp_bestpath_med_cmd, | |
2165 | "bgp bestpath med (confed|missing-as-worst)", | |
2166 | "BGP specific commands\n" | |
2167 | "Change the default bestpath selection\n" | |
2168 | "MED attribute\n" | |
2169 | "Compare MED among confederation paths\n" | |
2170 | "Treat missing MED as the least preferred one\n") | |
2171 | { | |
2172 | struct bgp *bgp; | |
2173 | ||
2174 | bgp = vty->index; | |
2175 | ||
afec25d9 | 2176 | if (strncmp (argv[3]->arg, "confed", 1) == 0) |
718e3744 | 2177 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); |
2178 | else | |
2179 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2180 | ||
7aafcaca DS |
2181 | bgp_recalculate_all_bestpaths (bgp); |
2182 | ||
718e3744 | 2183 | return CMD_SUCCESS; |
2184 | } | |
2185 | ||
f412b39a DW |
2186 | /* |
2187 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
2188 | * "bgp bestpath med missing-as-worst confed", | |
2189 | * "BGP specific commands\n" | |
2190 | * "Change the default bestpath selection\n" | |
2191 | * "MED attribute\n" | |
2192 | * "Treat missing MED as the least preferred one\n" | |
2193 | * "Compare MED among confederation paths\n" | |
2194 | * | |
2195 | */ | |
718e3744 | 2196 | DEFUN (bgp_bestpath_med2, |
2197 | bgp_bestpath_med2_cmd, | |
2198 | "bgp bestpath med confed missing-as-worst", | |
2199 | "BGP specific commands\n" | |
2200 | "Change the default bestpath selection\n" | |
2201 | "MED attribute\n" | |
2202 | "Compare MED among confederation paths\n" | |
2203 | "Treat missing MED as the least preferred one\n") | |
2204 | { | |
2205 | struct bgp *bgp; | |
2206 | ||
2207 | bgp = vty->index; | |
2208 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2209 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2210 | bgp_recalculate_all_bestpaths (bgp); |
2211 | ||
718e3744 | 2212 | return CMD_SUCCESS; |
2213 | } | |
2214 | ||
718e3744 | 2215 | |
2216 | DEFUN (no_bgp_bestpath_med, | |
2217 | no_bgp_bestpath_med_cmd, | |
2218 | "no bgp bestpath med (confed|missing-as-worst)", | |
2219 | NO_STR | |
2220 | "BGP specific commands\n" | |
2221 | "Change the default bestpath selection\n" | |
2222 | "MED attribute\n" | |
2223 | "Compare MED among confederation paths\n" | |
2224 | "Treat missing MED as the least preferred one\n") | |
2225 | { | |
2226 | struct bgp *bgp; | |
2227 | ||
2228 | bgp = vty->index; | |
2229 | ||
afec25d9 | 2230 | if (strncmp (argv[4]->arg, "confed", 1) == 0) |
718e3744 | 2231 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); |
2232 | else | |
2233 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2234 | ||
7aafcaca DS |
2235 | bgp_recalculate_all_bestpaths (bgp); |
2236 | ||
718e3744 | 2237 | return CMD_SUCCESS; |
2238 | } | |
2239 | ||
f412b39a DW |
2240 | /* |
2241 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
2242 | * "no bgp bestpath med missing-as-worst confed", | |
2243 | * NO_STR | |
2244 | * "BGP specific commands\n" | |
2245 | * "Change the default bestpath selection\n" | |
2246 | * "MED attribute\n" | |
2247 | * "Treat missing MED as the least preferred one\n" | |
2248 | * "Compare MED among confederation paths\n" | |
2249 | * | |
2250 | */ | |
718e3744 | 2251 | DEFUN (no_bgp_bestpath_med2, |
2252 | no_bgp_bestpath_med2_cmd, | |
2253 | "no bgp bestpath med confed missing-as-worst", | |
2254 | NO_STR | |
2255 | "BGP specific commands\n" | |
2256 | "Change the default bestpath selection\n" | |
2257 | "MED attribute\n" | |
2258 | "Compare MED among confederation paths\n" | |
2259 | "Treat missing MED as the least preferred one\n") | |
2260 | { | |
2261 | struct bgp *bgp; | |
2262 | ||
2263 | bgp = vty->index; | |
2264 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2265 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2266 | bgp_recalculate_all_bestpaths (bgp); |
2267 | ||
718e3744 | 2268 | return CMD_SUCCESS; |
2269 | } | |
2270 | ||
6b0655a2 | 2271 | |
718e3744 | 2272 | /* "no bgp default ipv4-unicast". */ |
2273 | DEFUN (no_bgp_default_ipv4_unicast, | |
2274 | no_bgp_default_ipv4_unicast_cmd, | |
2275 | "no bgp default ipv4-unicast", | |
2276 | NO_STR | |
2277 | "BGP specific commands\n" | |
2278 | "Configure BGP defaults\n" | |
2279 | "Activate ipv4-unicast for a peer by default\n") | |
2280 | { | |
2281 | struct bgp *bgp; | |
2282 | ||
2283 | bgp = vty->index; | |
2284 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2285 | return CMD_SUCCESS; | |
2286 | } | |
2287 | ||
2288 | DEFUN (bgp_default_ipv4_unicast, | |
2289 | bgp_default_ipv4_unicast_cmd, | |
2290 | "bgp default ipv4-unicast", | |
2291 | "BGP specific commands\n" | |
2292 | "Configure BGP defaults\n" | |
2293 | "Activate ipv4-unicast for a peer by default\n") | |
2294 | { | |
2295 | struct bgp *bgp; | |
2296 | ||
2297 | bgp = vty->index; | |
2298 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2299 | return CMD_SUCCESS; | |
2300 | } | |
6b0655a2 | 2301 | |
04b6bdc0 DW |
2302 | /* Display hostname in certain command outputs */ |
2303 | DEFUN (bgp_default_show_hostname, | |
2304 | bgp_default_show_hostname_cmd, | |
2305 | "bgp default show-hostname", | |
2306 | "BGP specific commands\n" | |
2307 | "Configure BGP defaults\n" | |
2308 | "Show hostname in certain command ouputs\n") | |
2309 | { | |
2310 | struct bgp *bgp; | |
2311 | ||
2312 | bgp = vty->index; | |
2313 | bgp_flag_set (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2314 | return CMD_SUCCESS; | |
2315 | } | |
2316 | ||
2317 | DEFUN (no_bgp_default_show_hostname, | |
2318 | no_bgp_default_show_hostname_cmd, | |
2319 | "no bgp default show-hostname", | |
2320 | NO_STR | |
2321 | "BGP specific commands\n" | |
2322 | "Configure BGP defaults\n" | |
2323 | "Show hostname in certain command ouputs\n") | |
2324 | { | |
2325 | struct bgp *bgp; | |
2326 | ||
2327 | bgp = vty->index; | |
2328 | bgp_flag_unset (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2329 | return CMD_SUCCESS; | |
2330 | } | |
2331 | ||
8233ef81 | 2332 | /* "bgp network import-check" configuration. */ |
718e3744 | 2333 | DEFUN (bgp_network_import_check, |
2334 | bgp_network_import_check_cmd, | |
5623e905 | 2335 | "bgp network import-check", |
718e3744 | 2336 | "BGP specific commands\n" |
2337 | "BGP network command\n" | |
5623e905 | 2338 | "Check BGP network route exists in IGP\n") |
718e3744 | 2339 | { |
2340 | struct bgp *bgp; | |
2341 | ||
2342 | bgp = vty->index; | |
078430f6 DS |
2343 | if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2344 | { | |
2345 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
5623e905 | 2346 | bgp_static_redo_import_check(bgp); |
078430f6 DS |
2347 | } |
2348 | ||
718e3744 | 2349 | return CMD_SUCCESS; |
2350 | } | |
2351 | ||
8233ef81 DW |
2352 | ALIAS_HIDDEN (bgp_network_import_check, |
2353 | bgp_network_import_check_exact_cmd, | |
2354 | "bgp network import-check exact", | |
2355 | "BGP specific commands\n" | |
2356 | "BGP network command\n" | |
2357 | "Check BGP network route exists in IGP\n" | |
2358 | "Match route precisely\n") | |
2359 | ||
718e3744 | 2360 | DEFUN (no_bgp_network_import_check, |
2361 | no_bgp_network_import_check_cmd, | |
5623e905 | 2362 | "no bgp network import-check", |
718e3744 | 2363 | NO_STR |
2364 | "BGP specific commands\n" | |
2365 | "BGP network command\n" | |
2366 | "Check BGP network route exists in IGP\n") | |
2367 | { | |
2368 | struct bgp *bgp; | |
2369 | ||
2370 | bgp = vty->index; | |
078430f6 DS |
2371 | if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2372 | { | |
2373 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
078430f6 DS |
2374 | bgp_static_redo_import_check(bgp); |
2375 | } | |
5623e905 | 2376 | |
718e3744 | 2377 | return CMD_SUCCESS; |
2378 | } | |
6b0655a2 | 2379 | |
718e3744 | 2380 | DEFUN (bgp_default_local_preference, |
2381 | bgp_default_local_preference_cmd, | |
2382 | "bgp default local-preference <0-4294967295>", | |
2383 | "BGP specific commands\n" | |
2384 | "Configure BGP defaults\n" | |
2385 | "local preference (higher=more preferred)\n" | |
2386 | "Configure default local preference value\n") | |
2387 | { | |
2388 | struct bgp *bgp; | |
2389 | u_int32_t local_pref; | |
2390 | ||
2391 | bgp = vty->index; | |
2392 | ||
afec25d9 | 2393 | VTY_GET_INTEGER ("local preference", local_pref, argv[3]->arg); |
718e3744 | 2394 | |
2395 | bgp_default_local_preference_set (bgp, local_pref); | |
f31fa004 | 2396 | bgp_clear_star_soft_in (vty, bgp->name); |
718e3744 | 2397 | |
2398 | return CMD_SUCCESS; | |
2399 | } | |
2400 | ||
f412b39a DW |
2401 | /* |
2402 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
2403 | * "no bgp default local-preference <0-4294967295>", | |
2404 | * NO_STR | |
2405 | * "BGP specific commands\n" | |
2406 | * "Configure BGP defaults\n" | |
2407 | * "local preference (higher=more preferred)\n" | |
2408 | * "Configure default local preference value\n" | |
2409 | * | |
2410 | */ | |
718e3744 | 2411 | DEFUN (no_bgp_default_local_preference, |
2412 | no_bgp_default_local_preference_cmd, | |
2413 | "no bgp default local-preference", | |
2414 | NO_STR | |
2415 | "BGP specific commands\n" | |
2416 | "Configure BGP defaults\n" | |
2417 | "local preference (higher=more preferred)\n") | |
2418 | { | |
2419 | struct bgp *bgp; | |
2420 | ||
2421 | bgp = vty->index; | |
2422 | bgp_default_local_preference_unset (bgp); | |
f31fa004 | 2423 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 2424 | |
718e3744 | 2425 | return CMD_SUCCESS; |
2426 | } | |
2427 | ||
6b0655a2 | 2428 | |
3f9c7369 DS |
2429 | DEFUN (bgp_default_subgroup_pkt_queue_max, |
2430 | bgp_default_subgroup_pkt_queue_max_cmd, | |
2431 | "bgp default subgroup-pkt-queue-max <20-100>", | |
2432 | "BGP specific commands\n" | |
2433 | "Configure BGP defaults\n" | |
2434 | "subgroup-pkt-queue-max\n" | |
2435 | "Configure subgroup packet queue max\n") | |
8bd9d948 | 2436 | { |
3f9c7369 DS |
2437 | struct bgp *bgp; |
2438 | u_int32_t max_size; | |
8bd9d948 | 2439 | |
3f9c7369 DS |
2440 | bgp = vty->index; |
2441 | ||
afec25d9 | 2442 | VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[3]->arg); |
3f9c7369 DS |
2443 | |
2444 | bgp_default_subgroup_pkt_queue_max_set (bgp, max_size); | |
2445 | ||
2446 | return CMD_SUCCESS; | |
2447 | } | |
2448 | ||
f412b39a DW |
2449 | /* |
2450 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
2451 | * "no bgp default subgroup-pkt-queue-max <20-100>", | |
2452 | * NO_STR | |
2453 | * "BGP specific commands\n" | |
2454 | * "Configure BGP defaults\n" | |
2455 | * "subgroup-pkt-queue-max\n" | |
2456 | * "Configure subgroup packet queue max\n" | |
2457 | * | |
2458 | */ | |
3f9c7369 DS |
2459 | DEFUN (no_bgp_default_subgroup_pkt_queue_max, |
2460 | no_bgp_default_subgroup_pkt_queue_max_cmd, | |
2461 | "no bgp default subgroup-pkt-queue-max", | |
2462 | NO_STR | |
2463 | "BGP specific commands\n" | |
2464 | "Configure BGP defaults\n" | |
2465 | "subgroup-pkt-queue-max\n") | |
2466 | { | |
2467 | struct bgp *bgp; | |
2468 | ||
2469 | bgp = vty->index; | |
2470 | bgp_default_subgroup_pkt_queue_max_unset (bgp); | |
2471 | return CMD_SUCCESS; | |
8bd9d948 DS |
2472 | } |
2473 | ||
813d4307 | 2474 | |
8bd9d948 DS |
2475 | DEFUN (bgp_rr_allow_outbound_policy, |
2476 | bgp_rr_allow_outbound_policy_cmd, | |
2477 | "bgp route-reflector allow-outbound-policy", | |
2478 | "BGP specific commands\n" | |
2479 | "Allow modifications made by out route-map\n" | |
2480 | "on ibgp neighbors\n") | |
2481 | { | |
2482 | struct bgp *bgp; | |
8bd9d948 DS |
2483 | |
2484 | bgp = vty->index; | |
2485 | ||
2486 | if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2487 | { | |
2488 | bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2489 | update_group_announce_rrclients(bgp); |
f31fa004 | 2490 | bgp_clear_star_soft_out (vty, bgp->name); |
8bd9d948 DS |
2491 | } |
2492 | ||
2493 | return CMD_SUCCESS; | |
2494 | } | |
2495 | ||
2496 | DEFUN (no_bgp_rr_allow_outbound_policy, | |
2497 | no_bgp_rr_allow_outbound_policy_cmd, | |
2498 | "no bgp route-reflector allow-outbound-policy", | |
2499 | NO_STR | |
2500 | "BGP specific commands\n" | |
2501 | "Allow modifications made by out route-map\n" | |
2502 | "on ibgp neighbors\n") | |
2503 | { | |
2504 | struct bgp *bgp; | |
8bd9d948 DS |
2505 | |
2506 | bgp = vty->index; | |
2507 | ||
2508 | if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2509 | { | |
2510 | bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2511 | update_group_announce_rrclients(bgp); |
f31fa004 | 2512 | bgp_clear_star_soft_out (vty, bgp->name); |
8bd9d948 DS |
2513 | } |
2514 | ||
2515 | return CMD_SUCCESS; | |
2516 | } | |
2517 | ||
f14e6fdb DS |
2518 | DEFUN (bgp_listen_limit, |
2519 | bgp_listen_limit_cmd, | |
2520 | "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2521 | "BGP specific commands\n" | |
2522 | "Configure BGP defaults\n" | |
2523 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2524 | "Configure Dynamic Neighbors listen limit value\n") | |
2525 | { | |
2526 | struct bgp *bgp; | |
2527 | int listen_limit; | |
2528 | ||
2529 | bgp = vty->index; | |
2530 | ||
afec25d9 | 2531 | VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[3]->arg, |
f14e6fdb DS |
2532 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN, |
2533 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX); | |
2534 | ||
2535 | bgp_listen_limit_set (bgp, listen_limit); | |
2536 | ||
2537 | return CMD_SUCCESS; | |
2538 | } | |
2539 | ||
f412b39a DW |
2540 | /* |
2541 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
2542 | * "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2543 | * NO_STR | |
2544 | * "BGP specific commands\n" | |
2545 | * "Configure BGP defaults\n" | |
2546 | * "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2547 | * "Configure Dynamic Neighbors listen limit value\n" | |
2548 | * | |
2549 | */ | |
f14e6fdb DS |
2550 | DEFUN (no_bgp_listen_limit, |
2551 | no_bgp_listen_limit_cmd, | |
2552 | "no bgp listen limit", | |
2553 | "BGP specific commands\n" | |
2554 | "Configure BGP defaults\n" | |
2555 | "unset maximum number of BGP Dynamic Neighbors that can be created\n" | |
2556 | "Configure Dynamic Neighbors listen limit value to default\n") | |
2557 | { | |
2558 | struct bgp *bgp; | |
2559 | ||
2560 | bgp = vty->index; | |
2561 | bgp_listen_limit_unset (bgp); | |
2562 | return CMD_SUCCESS; | |
2563 | } | |
2564 | ||
2565 | ||
20eb8864 | 2566 | /* |
2567 | * Check if this listen range is already configured. Check for exact | |
2568 | * match or overlap based on input. | |
2569 | */ | |
2570 | static struct peer_group * | |
2571 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact) | |
2572 | { | |
2573 | struct listnode *node, *nnode; | |
2574 | struct listnode *node1, *nnode1; | |
2575 | struct peer_group *group; | |
2576 | struct prefix *lr; | |
2577 | afi_t afi; | |
2578 | int match; | |
2579 | ||
2580 | afi = family2afi(range->family); | |
2581 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2582 | { | |
2583 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node1, | |
2584 | nnode1, lr)) | |
2585 | { | |
2586 | if (exact) | |
2587 | match = prefix_same (range, lr); | |
2588 | else | |
2589 | match = (prefix_match (range, lr) || prefix_match (lr, range)); | |
2590 | if (match) | |
2591 | return group; | |
2592 | } | |
2593 | } | |
2594 | ||
2595 | return NULL; | |
2596 | } | |
2597 | ||
f14e6fdb DS |
2598 | DEFUN (bgp_listen_range, |
2599 | bgp_listen_range_cmd, | |
2600 | LISTEN_RANGE_CMD "peer-group WORD" , | |
2601 | "BGP specific commands\n" | |
2602 | "Configure BGP Dynamic Neighbors\n" | |
2603 | "add a listening range for Dynamic Neighbors\n" | |
2604 | LISTEN_RANGE_ADDR_STR) | |
2605 | { | |
2606 | struct bgp *bgp; | |
2607 | struct prefix range; | |
20eb8864 | 2608 | struct peer_group *group, *existing_group; |
f14e6fdb DS |
2609 | afi_t afi; |
2610 | int ret; | |
2611 | ||
2612 | bgp = vty->index; | |
2613 | ||
afec25d9 | 2614 | //VTY_GET_IPV4_PREFIX ("listen range", range, argv[3]->arg); |
f14e6fdb DS |
2615 | |
2616 | /* Convert IP prefix string to struct prefix. */ | |
afec25d9 | 2617 | ret = str2prefix (argv[3]->arg, &range); |
f14e6fdb DS |
2618 | if (! ret) |
2619 | { | |
2620 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2621 | return CMD_WARNING; | |
2622 | } | |
2623 | ||
2624 | afi = family2afi(range.family); | |
2625 | ||
2626 | #ifdef HAVE_IPV6 | |
2627 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2628 | { | |
2629 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2630 | VTY_NEWLINE); | |
2631 | return CMD_WARNING; | |
2632 | } | |
2633 | #endif /* HAVE_IPV6 */ | |
2634 | ||
2635 | apply_mask (&range); | |
2636 | ||
20eb8864 | 2637 | /* Check if same listen range is already configured. */ |
2638 | existing_group = listen_range_exists (bgp, &range, 1); | |
2639 | if (existing_group) | |
2640 | { | |
afec25d9 | 2641 | if (strcmp (existing_group->name, argv[5]->arg) == 0) |
20eb8864 | 2642 | return CMD_SUCCESS; |
2643 | else | |
2644 | { | |
2645 | vty_out (vty, "%% Same listen range is attached to peer-group %s%s", | |
2646 | existing_group->name, VTY_NEWLINE); | |
2647 | return CMD_WARNING; | |
2648 | } | |
2649 | } | |
2650 | ||
2651 | /* Check if an overlapping listen range exists. */ | |
2652 | if (listen_range_exists (bgp, &range, 0)) | |
2653 | { | |
2654 | vty_out (vty, "%% Listen range overlaps with existing listen range%s", | |
2655 | VTY_NEWLINE); | |
2656 | return CMD_WARNING; | |
2657 | } | |
f14e6fdb | 2658 | |
afec25d9 | 2659 | group = peer_group_lookup (bgp, argv[5]->arg); |
f14e6fdb DS |
2660 | if (! group) |
2661 | { | |
2662 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2663 | return CMD_WARNING; | |
2664 | } | |
2665 | ||
2666 | ret = peer_group_listen_range_add(group, &range); | |
2667 | return bgp_vty_return (vty, ret); | |
2668 | } | |
2669 | ||
2670 | DEFUN (no_bgp_listen_range, | |
2671 | no_bgp_listen_range_cmd, | |
2672 | "no bgp listen range A.B.C.D/M peer-group WORD" , | |
2673 | "BGP specific commands\n" | |
2674 | "Configure BGP defaults\n" | |
2675 | "delete a listening range for Dynamic Neighbors\n" | |
2676 | "Remove Dynamic Neighbors listening range\n") | |
2677 | { | |
2678 | struct bgp *bgp; | |
2679 | struct prefix range; | |
2680 | struct peer_group *group; | |
2681 | afi_t afi; | |
2682 | int ret; | |
2683 | ||
2684 | bgp = vty->index; | |
2685 | ||
afec25d9 | 2686 | // VTY_GET_IPV4_PREFIX ("listen range", range, argv[4]->arg); |
f14e6fdb DS |
2687 | |
2688 | /* Convert IP prefix string to struct prefix. */ | |
afec25d9 | 2689 | ret = str2prefix (argv[4]->arg, &range); |
f14e6fdb DS |
2690 | if (! ret) |
2691 | { | |
2692 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2693 | return CMD_WARNING; | |
2694 | } | |
2695 | ||
2696 | afi = family2afi(range.family); | |
2697 | ||
2698 | #ifdef HAVE_IPV6 | |
2699 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2700 | { | |
2701 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2702 | VTY_NEWLINE); | |
2703 | return CMD_WARNING; | |
2704 | } | |
2705 | #endif /* HAVE_IPV6 */ | |
2706 | ||
2707 | apply_mask (&range); | |
2708 | ||
2709 | ||
afec25d9 | 2710 | group = peer_group_lookup (bgp, argv[6]->arg); |
f14e6fdb DS |
2711 | if (! group) |
2712 | { | |
2713 | vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); | |
2714 | return CMD_WARNING; | |
2715 | } | |
2716 | ||
2717 | ret = peer_group_listen_range_del(group, &range); | |
2718 | return bgp_vty_return (vty, ret); | |
2719 | } | |
2720 | ||
2721 | int | |
2722 | bgp_config_write_listen (struct vty *vty, struct bgp *bgp) | |
2723 | { | |
2724 | struct peer_group *group; | |
2725 | struct listnode *node, *nnode, *rnode, *nrnode; | |
2726 | struct prefix *range; | |
2727 | afi_t afi; | |
4690c7d7 | 2728 | char buf[PREFIX2STR_BUFFER]; |
f14e6fdb DS |
2729 | |
2730 | if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT) | |
2731 | vty_out (vty, " bgp listen limit %d%s", | |
2732 | bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
2733 | ||
2734 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2735 | { | |
2736 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
2737 | { | |
2738 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range)) | |
2739 | { | |
2740 | prefix2str(range, buf, sizeof(buf)); | |
2741 | vty_out(vty, " bgp listen range %s peer-group %s%s", | |
2742 | buf, group->name, VTY_NEWLINE); | |
2743 | } | |
2744 | } | |
2745 | } | |
2746 | ||
2747 | return 0; | |
2748 | } | |
2749 | ||
2750 | ||
907f92c8 DS |
2751 | DEFUN (bgp_disable_connected_route_check, |
2752 | bgp_disable_connected_route_check_cmd, | |
2753 | "bgp disable-ebgp-connected-route-check", | |
2754 | "BGP specific commands\n" | |
2755 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2756 | { | |
2757 | struct bgp *bgp; | |
2758 | ||
2759 | bgp = vty->index; | |
2760 | bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
f31fa004 | 2761 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 2762 | |
907f92c8 DS |
2763 | return CMD_SUCCESS; |
2764 | } | |
2765 | ||
2766 | DEFUN (no_bgp_disable_connected_route_check, | |
2767 | no_bgp_disable_connected_route_check_cmd, | |
2768 | "no bgp disable-ebgp-connected-route-check", | |
2769 | NO_STR | |
2770 | "BGP specific commands\n" | |
2771 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2772 | { | |
2773 | struct bgp *bgp; | |
2774 | ||
2775 | bgp = vty->index; | |
2776 | bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
f31fa004 | 2777 | bgp_clear_star_soft_in (vty, bgp->name); |
7aafcaca | 2778 | |
907f92c8 DS |
2779 | return CMD_SUCCESS; |
2780 | } | |
2781 | ||
2782 | ||
718e3744 | 2783 | static int |
fd79ac91 | 2784 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
2785 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 2786 | { |
2787 | int ret; | |
2788 | struct bgp *bgp; | |
2789 | as_t as; | |
0299c004 | 2790 | int as_type = AS_SPECIFIED; |
718e3744 | 2791 | union sockunion su; |
2792 | ||
2793 | bgp = vty->index; | |
2794 | ||
0299c004 DS |
2795 | if (strncmp(as_str, "internal", strlen("internal")) == 0) |
2796 | { | |
2797 | as = 0; | |
2798 | as_type = AS_INTERNAL; | |
2799 | } | |
2800 | else if (strncmp(as_str, "external", strlen("external")) == 0) | |
2801 | { | |
2802 | as = 0; | |
2803 | as_type = AS_EXTERNAL; | |
2804 | } | |
2805 | else | |
2806 | { | |
2807 | /* Get AS number. */ | |
2808 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); | |
2809 | } | |
718e3744 | 2810 | |
2811 | /* If peer is peer group, call proper function. */ | |
2812 | ret = str2sockunion (peer_str, &su); | |
2813 | if (ret < 0) | |
2814 | { | |
a80beece | 2815 | /* Check for peer by interface */ |
0299c004 | 2816 | ret = peer_remote_as (bgp, NULL, peer_str, &as, as_type, afi, safi); |
718e3744 | 2817 | if (ret < 0) |
a80beece | 2818 | { |
0299c004 | 2819 | ret = peer_group_remote_as (bgp, peer_str, &as, as_type); |
a80beece DS |
2820 | if (ret < 0) |
2821 | { | |
2822 | vty_out (vty, "%% Create the peer-group or interface first%s", | |
2823 | VTY_NEWLINE); | |
2824 | return CMD_WARNING; | |
2825 | } | |
2826 | return CMD_SUCCESS; | |
2827 | } | |
718e3744 | 2828 | } |
a80beece | 2829 | else |
718e3744 | 2830 | { |
6aeb9e78 | 2831 | if (peer_address_self_check (bgp, &su)) |
a80beece DS |
2832 | { |
2833 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2834 | VTY_NEWLINE); | |
2835 | return CMD_WARNING; | |
2836 | } | |
0299c004 | 2837 | ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi); |
718e3744 | 2838 | } |
2839 | ||
718e3744 | 2840 | /* This peer belongs to peer group. */ |
2841 | switch (ret) | |
2842 | { | |
2843 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 2844 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 2845 | return CMD_WARNING; |
718e3744 | 2846 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 2847 | 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 | 2848 | return CMD_WARNING; |
718e3744 | 2849 | } |
2850 | return bgp_vty_return (vty, ret); | |
2851 | } | |
2852 | ||
2853 | DEFUN (neighbor_remote_as, | |
2854 | neighbor_remote_as_cmd, | |
0299c004 | 2855 | NEIGHBOR_CMD2 "remote-as (" CMD_AS_RANGE "|external|internal)", |
718e3744 | 2856 | NEIGHBOR_STR |
2857 | NEIGHBOR_ADDR_STR2 | |
2858 | "Specify a BGP neighbor\n" | |
2859 | AS_STR) | |
2860 | { | |
afec25d9 | 2861 | return peer_remote_as_vty (vty, argv[1]->arg, argv[3]->arg, AFI_IP, SAFI_UNICAST); |
718e3744 | 2862 | } |
6b0655a2 | 2863 | |
4c48cf63 DW |
2864 | static int |
2865 | peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, | |
b3a39dc5 DD |
2866 | safi_t safi, int v6only, const char *peer_group_name, |
2867 | const char *as_str) | |
a80beece | 2868 | { |
b3a39dc5 DD |
2869 | as_t as = 0; |
2870 | int as_type = AS_UNSPECIFIED; | |
a80beece DS |
2871 | struct bgp *bgp; |
2872 | struct peer *peer; | |
2873 | struct peer_group *group; | |
4c48cf63 DW |
2874 | int ret = 0; |
2875 | union sockunion su; | |
a80beece DS |
2876 | |
2877 | bgp = vty->index; | |
4c48cf63 DW |
2878 | group = peer_group_lookup (bgp, conf_if); |
2879 | ||
a80beece DS |
2880 | if (group) |
2881 | { | |
2882 | vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE); | |
2883 | return CMD_WARNING; | |
2884 | } | |
2885 | ||
b3a39dc5 DD |
2886 | if (as_str) |
2887 | { | |
2888 | if (strncmp(as_str, "internal", strlen("internal")) == 0) | |
2889 | { | |
2890 | as_type = AS_INTERNAL; | |
2891 | } | |
2892 | else if (strncmp(as_str, "external", strlen("external")) == 0) | |
2893 | { | |
2894 | as_type = AS_EXTERNAL; | |
2895 | } | |
2896 | else | |
2897 | { | |
2898 | /* Get AS number. */ | |
2899 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); | |
2900 | as_type = AS_SPECIFIED; | |
2901 | } | |
2902 | } | |
2903 | ||
4c48cf63 DW |
2904 | peer = peer_lookup_by_conf_if (bgp, conf_if); |
2905 | if (!peer) | |
2906 | { | |
2907 | if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4) | |
2908 | && afi == AFI_IP && safi == SAFI_UNICAST) | |
b3a39dc5 DD |
2909 | peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, 0, 0, |
2910 | NULL); | |
4c48cf63 | 2911 | else |
b3a39dc5 DD |
2912 | peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, afi, safi, |
2913 | NULL); | |
4c48cf63 DW |
2914 | |
2915 | if (peer && v6only) | |
2916 | SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
4a04e5f7 | 2917 | |
2918 | /* Request zebra to initiate IPv6 RAs on this interface. We do this | |
2919 | * any unnumbered peer in order to not worry about run-time transitions | |
2920 | * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address | |
2921 | * gets deleted later etc.) | |
2922 | */ | |
2923 | if (peer->ifp) | |
b3a39dc5 DD |
2924 | { |
2925 | bgp_zebra_initiate_radv (bgp, peer); | |
2926 | } | |
2927 | peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE); | |
4c48cf63 DW |
2928 | } |
2929 | else if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) || | |
2930 | (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))) | |
2931 | { | |
2932 | if (v6only) | |
2933 | SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
2934 | else | |
2935 | UNSET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); | |
2936 | ||
2937 | /* v6only flag changed. Reset bgp seesion */ | |
2938 | if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) | |
2939 | { | |
2940 | peer->last_reset = PEER_DOWN_V6ONLY_CHANGE; | |
2941 | bgp_notify_send (peer, BGP_NOTIFY_CEASE, | |
2942 | BGP_NOTIFY_CEASE_CONFIG_CHANGE); | |
2943 | } | |
2944 | else | |
2945 | bgp_session_reset(peer); | |
2946 | } | |
2947 | ||
a80beece DS |
2948 | if (!peer) |
2949 | return CMD_WARNING; | |
2950 | ||
4c48cf63 DW |
2951 | if (peer_group_name) |
2952 | { | |
2953 | group = peer_group_lookup (bgp, peer_group_name); | |
2954 | if (! group) | |
2955 | { | |
2956 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2957 | return CMD_WARNING; | |
2958 | } | |
2959 | ||
2960 | ret = peer_group_bind (bgp, &su, peer, group, &as); | |
2961 | } | |
2962 | ||
2963 | return bgp_vty_return (vty, ret); | |
a80beece DS |
2964 | } |
2965 | ||
f412b39a DW |
2966 | /* |
2967 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
2968 | * "neighbor WORD interface peer-group WORD", | |
2969 | * NEIGHBOR_STR | |
2970 | * "Interface name or neighbor tag\n" | |
2971 | * "Enable BGP on interface\n" | |
2972 | * "Member of the peer-group\n" | |
2973 | * "peer-group name\n" | |
2974 | * | |
2975 | */ | |
4c48cf63 DW |
2976 | DEFUN (neighbor_interface_config, |
2977 | neighbor_interface_config_cmd, | |
2978 | "neighbor WORD interface", | |
2979 | NEIGHBOR_STR | |
2980 | "Interface name or neighbor tag\n" | |
2981 | "Enable BGP on interface\n") | |
2982 | { | |
2983 | if (argc == 2) | |
afec25d9 DW |
2984 | return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 0, |
2985 | argv[3]->arg, NULL); | |
4c48cf63 | 2986 | else |
afec25d9 | 2987 | return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 0, |
b3a39dc5 | 2988 | NULL, NULL); |
4c48cf63 DW |
2989 | } |
2990 | ||
4c48cf63 | 2991 | |
f412b39a DW |
2992 | /* |
2993 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
2994 | * "neighbor WORD interface v6only peer-group WORD", | |
2995 | * NEIGHBOR_STR | |
2996 | * "Interface name or neighbor tag\n" | |
2997 | * "Enable BGP on interface\n" | |
2998 | * "Enable BGP with v6 link-local only\n" | |
2999 | * "Member of the peer-group\n" | |
3000 | * "peer-group name\n" | |
3001 | * | |
3002 | */ | |
4c48cf63 DW |
3003 | DEFUN (neighbor_interface_config_v6only, |
3004 | neighbor_interface_config_v6only_cmd, | |
3005 | "neighbor WORD interface v6only", | |
3006 | NEIGHBOR_STR | |
3007 | "Interface name or neighbor tag\n" | |
3008 | "Enable BGP on interface\n" | |
3009 | "Enable BGP with v6 link-local only\n") | |
3010 | { | |
afec25d9 DW |
3011 | return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 1, |
3012 | argv[5]->arg, NULL); | |
4c48cf63 DW |
3013 | } |
3014 | ||
a80beece | 3015 | |
b3a39dc5 DD |
3016 | DEFUN (neighbor_interface_config_remote_as, |
3017 | neighbor_interface_config_remote_as_cmd, | |
3018 | "neighbor WORD interface remote-as (" CMD_AS_RANGE "|external|internal)", | |
3019 | NEIGHBOR_STR | |
3020 | "Interface name or neighbor tag\n" | |
3021 | "Enable BGP on interface\n" | |
3022 | AS_STR) | |
3023 | { | |
afec25d9 DW |
3024 | return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 0, |
3025 | NULL, argv[4]->arg); | |
b3a39dc5 DD |
3026 | } |
3027 | ||
3028 | DEFUN (neighbor_interface_v6only_config_remote_as, | |
3029 | neighbor_interface_v6only_config_remote_as_cmd, | |
3030 | "neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|external|internal)", | |
3031 | NEIGHBOR_STR | |
3032 | "Interface name or neighbor tag\n" | |
3033 | "Enable BGP on interface\n" | |
3034 | AS_STR) | |
3035 | { | |
afec25d9 DW |
3036 | return peer_conf_interface_get (vty, argv[1]->arg, AFI_IP, SAFI_UNICAST, 1, |
3037 | NULL, argv[5]->arg); | |
b3a39dc5 DD |
3038 | } |
3039 | ||
718e3744 | 3040 | DEFUN (neighbor_peer_group, |
3041 | neighbor_peer_group_cmd, | |
3042 | "neighbor WORD peer-group", | |
3043 | NEIGHBOR_STR | |
a80beece | 3044 | "Interface name or neighbor tag\n" |
718e3744 | 3045 | "Configure peer-group\n") |
3046 | { | |
3047 | struct bgp *bgp; | |
a80beece | 3048 | struct peer *peer; |
718e3744 | 3049 | struct peer_group *group; |
3050 | ||
3051 | bgp = vty->index; | |
afec25d9 | 3052 | peer = peer_lookup_by_conf_if (bgp, argv[1]->arg); |
a80beece DS |
3053 | if (peer) |
3054 | { | |
3055 | vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); | |
3056 | return CMD_WARNING; | |
3057 | } | |
718e3744 | 3058 | |
afec25d9 | 3059 | group = peer_group_get (bgp, argv[1]->arg); |
718e3744 | 3060 | if (! group) |
3061 | return CMD_WARNING; | |
3062 | ||
3063 | return CMD_SUCCESS; | |
3064 | } | |
3065 | ||
f412b39a DW |
3066 | /* |
3067 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
3068 | * NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)", | |
3069 | * NO_STR | |
3070 | * NEIGHBOR_STR | |
3071 | * NEIGHBOR_ADDR_STR | |
3072 | * "Specify a BGP neighbor\n" | |
3073 | * AS_STR | |
3074 | * | |
3075 | */ | |
718e3744 | 3076 | DEFUN (no_neighbor, |
3077 | no_neighbor_cmd, | |
3078 | NO_NEIGHBOR_CMD2, | |
3079 | NO_STR | |
3080 | NEIGHBOR_STR | |
3081 | NEIGHBOR_ADDR_STR2) | |
3082 | { | |
3083 | int ret; | |
3084 | union sockunion su; | |
3085 | struct peer_group *group; | |
3086 | struct peer *peer; | |
1ff9a340 | 3087 | struct peer *other; |
718e3744 | 3088 | |
afec25d9 | 3089 | ret = str2sockunion (argv[2]->arg, &su); |
718e3744 | 3090 | if (ret < 0) |
3091 | { | |
a80beece | 3092 | /* look up for neighbor by interface name config. */ |
afec25d9 | 3093 | peer = peer_lookup_by_conf_if (vty->index, argv[2]->arg); |
a80beece DS |
3094 | if (peer) |
3095 | { | |
4a04e5f7 | 3096 | /* Request zebra to terminate IPv6 RAs on this interface. */ |
3097 | if (peer->ifp) | |
3098 | bgp_zebra_terminate_radv (peer->bgp, peer); | |
a80beece DS |
3099 | peer_delete (peer); |
3100 | return CMD_SUCCESS; | |
3101 | } | |
3102 | ||
afec25d9 | 3103 | group = peer_group_lookup (vty->index, argv[2]->arg); |
718e3744 | 3104 | if (group) |
3105 | peer_group_delete (group); | |
3106 | else | |
3107 | { | |
3108 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
3109 | return CMD_WARNING; | |
3110 | } | |
3111 | } | |
3112 | else | |
3113 | { | |
3114 | peer = peer_lookup (vty->index, &su); | |
3115 | if (peer) | |
1ff9a340 | 3116 | { |
f14e6fdb DS |
3117 | if (peer_dynamic_neighbor (peer)) |
3118 | { | |
3119 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
3120 | VTY_NEWLINE); | |
3121 | return CMD_WARNING; | |
3122 | } | |
3123 | ||
1ff9a340 DS |
3124 | other = peer->doppelganger; |
3125 | peer_delete (peer); | |
3126 | if (other && other->status != Deleted) | |
3127 | peer_delete(other); | |
3128 | } | |
718e3744 | 3129 | } |
3130 | ||
3131 | return CMD_SUCCESS; | |
3132 | } | |
3133 | ||
718e3744 | 3134 | |
f412b39a DW |
3135 | /* |
3136 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
3137 | * "no neighbor WORD interface remote-as (" CMD_AS_RANGE "|internal|external)", | |
3138 | * NO_STR | |
3139 | * NEIGHBOR_STR | |
3140 | * "Interface name\n" | |
3141 | * "Configure BGP on interface\n" | |
3142 | * AS_STR | |
3143 | * | |
3144 | * "no neighbor WORD interface v6only peer-group WORD", | |
3145 | * NO_STR | |
3146 | * NEIGHBOR_STR | |
3147 | * "Interface name\n" | |
3148 | * "Configure BGP on interface\n" | |
3149 | * "Enable BGP with v6 link-local only\n" | |
3150 | * "Member of the peer-group\n" | |
3151 | * "peer-group name\n" | |
3152 | * | |
3153 | * "no neighbor WORD interface v6only remote-as (" CMD_AS_RANGE "|internal|external)", | |
3154 | * NO_STR | |
3155 | * NEIGHBOR_STR | |
3156 | * "Interface name\n" | |
3157 | * "Configure BGP on interface\n" | |
3158 | * "Enable BGP with v6 link-local only\n" | |
3159 | * AS_STR | |
3160 | * | |
3161 | * "no neighbor WORD interface v6only", | |
3162 | * NO_STR | |
3163 | * NEIGHBOR_STR | |
3164 | * "Interface name\n" | |
3165 | * "Configure BGP on interface\n" | |
3166 | * "Enable BGP with v6 link-local only\n" | |
3167 | * | |
3168 | * "no neighbor WORD interface peer-group WORD", | |
3169 | * NO_STR | |
3170 | * NEIGHBOR_STR | |
3171 | * "Interface name\n" | |
3172 | * "Configure BGP on interface\n" | |
3173 | * "Member of the peer-group\n" | |
3174 | * "peer-group name\n" | |
3175 | * | |
3176 | */ | |
a80beece DS |
3177 | DEFUN (no_neighbor_interface_config, |
3178 | no_neighbor_interface_config_cmd, | |
4c48cf63 | 3179 | "no neighbor WORD interface", |
a80beece DS |
3180 | NO_STR |
3181 | NEIGHBOR_STR | |
3182 | "Interface name\n" | |
3183 | "Configure BGP on interface\n") | |
3184 | { | |
3185 | struct peer *peer; | |
3186 | ||
3187 | /* look up for neighbor by interface name config. */ | |
afec25d9 | 3188 | peer = peer_lookup_by_conf_if (vty->index, argv[2]->arg); |
a80beece DS |
3189 | if (peer) |
3190 | { | |
4a04e5f7 | 3191 | /* Request zebra to terminate IPv6 RAs on this interface. */ |
3192 | if (peer->ifp) | |
3193 | bgp_zebra_terminate_radv (peer->bgp, peer); | |
a80beece DS |
3194 | peer_delete (peer); |
3195 | } | |
3196 | else | |
3197 | { | |
3198 | vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE); | |
3199 | return CMD_WARNING; | |
3200 | } | |
3201 | return CMD_SUCCESS; | |
3202 | } | |
3203 | ||
4c48cf63 | 3204 | |
4c48cf63 | 3205 | |
4c48cf63 | 3206 | |
b3a39dc5 | 3207 | |
4c48cf63 | 3208 | |
718e3744 | 3209 | DEFUN (no_neighbor_peer_group, |
3210 | no_neighbor_peer_group_cmd, | |
3211 | "no neighbor WORD peer-group", | |
3212 | NO_STR | |
3213 | NEIGHBOR_STR | |
3214 | "Neighbor tag\n" | |
3215 | "Configure peer-group\n") | |
3216 | { | |
3217 | struct peer_group *group; | |
3218 | ||
afec25d9 | 3219 | group = peer_group_lookup (vty->index, argv[2]->arg); |
718e3744 | 3220 | if (group) |
3221 | peer_group_delete (group); | |
3222 | else | |
3223 | { | |
3224 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
3225 | return CMD_WARNING; | |
3226 | } | |
3227 | return CMD_SUCCESS; | |
3228 | } | |
3229 | ||
a80beece DS |
3230 | DEFUN (no_neighbor_interface_peer_group_remote_as, |
3231 | no_neighbor_interface_peer_group_remote_as_cmd, | |
0299c004 | 3232 | "no neighbor WORD remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 3233 | NO_STR |
3234 | NEIGHBOR_STR | |
a80beece | 3235 | "Interface name or neighbor tag\n" |
718e3744 | 3236 | "Specify a BGP neighbor\n" |
3237 | AS_STR) | |
3238 | { | |
3239 | struct peer_group *group; | |
a80beece DS |
3240 | struct peer *peer; |
3241 | ||
3242 | /* look up for neighbor by interface name config. */ | |
afec25d9 | 3243 | peer = peer_lookup_by_conf_if (vty->index, argv[2]->arg); |
a80beece DS |
3244 | if (peer) |
3245 | { | |
0299c004 | 3246 | peer_as_change (peer, 0, AS_SPECIFIED); |
a80beece DS |
3247 | return CMD_SUCCESS; |
3248 | } | |
718e3744 | 3249 | |
afec25d9 | 3250 | group = peer_group_lookup (vty->index, argv[2]->arg); |
718e3744 | 3251 | if (group) |
3252 | peer_group_remote_as_delete (group); | |
3253 | else | |
3254 | { | |
a80beece | 3255 | vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE); |
718e3744 | 3256 | return CMD_WARNING; |
3257 | } | |
3258 | return CMD_SUCCESS; | |
3259 | } | |
6b0655a2 | 3260 | |
718e3744 | 3261 | DEFUN (neighbor_local_as, |
3262 | neighbor_local_as_cmd, | |
320da874 | 3263 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 3264 | NEIGHBOR_STR |
3265 | NEIGHBOR_ADDR_STR2 | |
3266 | "Specify a local-as number\n" | |
3267 | "AS number used as local AS\n") | |
3268 | { | |
3269 | struct peer *peer; | |
3270 | int ret; | |
3271 | ||
afec25d9 | 3272 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
718e3744 | 3273 | if (! peer) |
3274 | return CMD_WARNING; | |
3275 | ||
afec25d9 | 3276 | ret = peer_local_as_set (peer, atoi (argv[3]->arg), 0, 0); |
718e3744 | 3277 | return bgp_vty_return (vty, ret); |
3278 | } | |
3279 | ||
3280 | DEFUN (neighbor_local_as_no_prepend, | |
3281 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 3282 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 3283 | NEIGHBOR_STR |
3284 | NEIGHBOR_ADDR_STR2 | |
3285 | "Specify a local-as number\n" | |
3286 | "AS number used as local AS\n" | |
3287 | "Do not prepend local-as to updates from ebgp peers\n") | |
3288 | { | |
3289 | struct peer *peer; | |
3290 | int ret; | |
3291 | ||
afec25d9 | 3292 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
718e3744 | 3293 | if (! peer) |
3294 | return CMD_WARNING; | |
3295 | ||
afec25d9 | 3296 | ret = peer_local_as_set (peer, atoi (argv[3]->arg), 1, 0); |
718e3744 | 3297 | return bgp_vty_return (vty, ret); |
3298 | } | |
3299 | ||
9d3f9705 AC |
3300 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
3301 | neighbor_local_as_no_prepend_replace_as_cmd, | |
3302 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
3303 | NEIGHBOR_STR | |
3304 | NEIGHBOR_ADDR_STR2 | |
3305 | "Specify a local-as number\n" | |
3306 | "AS number used as local AS\n" | |
3307 | "Do not prepend local-as to updates from ebgp peers\n" | |
3308 | "Do not prepend local-as to updates from ibgp peers\n") | |
3309 | { | |
3310 | struct peer *peer; | |
3311 | int ret; | |
3312 | ||
afec25d9 | 3313 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
9d3f9705 AC |
3314 | if (! peer) |
3315 | return CMD_WARNING; | |
3316 | ||
afec25d9 | 3317 | ret = peer_local_as_set (peer, atoi (argv[3]->arg), 1, 1); |
9d3f9705 AC |
3318 | return bgp_vty_return (vty, ret); |
3319 | } | |
3320 | ||
3321 | ||
f412b39a DW |
3322 | /* |
3323 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
3324 | * NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, | |
3325 | * NO_STR | |
3326 | * NEIGHBOR_STR | |
3327 | * NEIGHBOR_ADDR_STR2 | |
3328 | * "Specify a local-as number\n" | |
3329 | * "AS number used as local AS\n" | |
3330 | * | |
3331 | * NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", | |
3332 | * NO_STR | |
3333 | * NEIGHBOR_STR | |
3334 | * NEIGHBOR_ADDR_STR2 | |
3335 | * "Specify a local-as number\n" | |
3336 | * "AS number used as local AS\n" | |
3337 | * "Do not prepend local-as to updates from ebgp peers\n" | |
3338 | * | |
3339 | * NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
3340 | * NO_STR | |
3341 | * NEIGHBOR_STR | |
3342 | * NEIGHBOR_ADDR_STR2 | |
3343 | * "Specify a local-as number\n" | |
3344 | * "AS number used as local AS\n" | |
3345 | * "Do not prepend local-as to updates from ebgp peers\n" | |
3346 | * "Do not prepend local-as to updates from ibgp peers\n" | |
3347 | * | |
3348 | */ | |
718e3744 | 3349 | DEFUN (no_neighbor_local_as, |
3350 | no_neighbor_local_as_cmd, | |
3351 | NO_NEIGHBOR_CMD2 "local-as", | |
3352 | NO_STR | |
3353 | NEIGHBOR_STR | |
3354 | NEIGHBOR_ADDR_STR2 | |
3355 | "Specify a local-as number\n") | |
3356 | { | |
3357 | struct peer *peer; | |
3358 | int ret; | |
3359 | ||
afec25d9 | 3360 | peer = peer_and_group_lookup_vty (vty, argv[2]->arg); |
718e3744 | 3361 | if (! peer) |
3362 | return CMD_WARNING; | |
3363 | ||
3364 | ret = peer_local_as_unset (peer); | |
3365 | return bgp_vty_return (vty, ret); | |
3366 | } | |
3367 | ||
718e3744 | 3368 | |
9d3f9705 | 3369 | |
6b0655a2 | 3370 | |
3f9c7369 DS |
3371 | DEFUN (neighbor_solo, |
3372 | neighbor_solo_cmd, | |
3373 | NEIGHBOR_CMD2 "solo", | |
3374 | NEIGHBOR_STR | |
3375 | NEIGHBOR_ADDR_STR2 | |
3376 | "Solo peer - part of its own update group\n") | |
3377 | { | |
3378 | struct peer *peer; | |
3379 | int ret; | |
3380 | ||
afec25d9 | 3381 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
3f9c7369 DS |
3382 | if (! peer) |
3383 | return CMD_WARNING; | |
3384 | ||
3385 | ret = update_group_adjust_soloness(peer, 1); | |
3386 | return bgp_vty_return (vty, ret); | |
3387 | } | |
3388 | ||
3389 | DEFUN (no_neighbor_solo, | |
3390 | no_neighbor_solo_cmd, | |
3391 | NO_NEIGHBOR_CMD2 "solo", | |
3392 | NO_STR | |
3393 | NEIGHBOR_STR | |
3394 | NEIGHBOR_ADDR_STR2 | |
3395 | "Solo peer - part of its own update group\n") | |
3396 | { | |
3397 | struct peer *peer; | |
3398 | int ret; | |
3399 | ||
afec25d9 | 3400 | peer = peer_and_group_lookup_vty (vty, argv[2]->arg); |
3f9c7369 DS |
3401 | if (! peer) |
3402 | return CMD_WARNING; | |
3403 | ||
3404 | ret = update_group_adjust_soloness(peer, 0); | |
3405 | return bgp_vty_return (vty, ret); | |
3406 | } | |
3407 | ||
0df7c91f PJ |
3408 | DEFUN (neighbor_password, |
3409 | neighbor_password_cmd, | |
3410 | NEIGHBOR_CMD2 "password LINE", | |
3411 | NEIGHBOR_STR | |
3412 | NEIGHBOR_ADDR_STR2 | |
3413 | "Set a password\n" | |
3414 | "The password\n") | |
3415 | { | |
3416 | struct peer *peer; | |
3417 | int ret; | |
3418 | ||
afec25d9 | 3419 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
0df7c91f PJ |
3420 | if (! peer) |
3421 | return CMD_WARNING; | |
3422 | ||
afec25d9 | 3423 | ret = peer_password_set (peer, argv[3]->arg); |
0df7c91f PJ |
3424 | return bgp_vty_return (vty, ret); |
3425 | } | |
3426 | ||
f412b39a DW |
3427 | /* |
3428 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
3429 | * NO_NEIGHBOR_CMD2 "password LINE", | |
3430 | * NO_STR | |
3431 | * NEIGHBOR_STR | |
3432 | * NEIGHBOR_ADDR_STR2 | |
3433 | * "Set a password\n" | |
3434 | * "The password\n" | |
3435 | * | |
3436 | */ | |
0df7c91f PJ |
3437 | DEFUN (no_neighbor_password, |
3438 | no_neighbor_password_cmd, | |
3439 | NO_NEIGHBOR_CMD2 "password", | |
3440 | NO_STR | |
3441 | NEIGHBOR_STR | |
3442 | NEIGHBOR_ADDR_STR2 | |
3443 | "Set a password\n") | |
3444 | { | |
3445 | struct peer *peer; | |
3446 | int ret; | |
3447 | ||
afec25d9 | 3448 | peer = peer_and_group_lookup_vty (vty, argv[2]->arg); |
0df7c91f PJ |
3449 | if (! peer) |
3450 | return CMD_WARNING; | |
3451 | ||
3452 | ret = peer_password_unset (peer); | |
3453 | return bgp_vty_return (vty, ret); | |
3454 | } | |
6b0655a2 | 3455 | |
813d4307 | 3456 | |
718e3744 | 3457 | DEFUN (neighbor_activate, |
3458 | neighbor_activate_cmd, | |
3459 | NEIGHBOR_CMD2 "activate", | |
3460 | NEIGHBOR_STR | |
3461 | NEIGHBOR_ADDR_STR2 | |
3462 | "Enable the Address Family for this Neighbor\n") | |
3463 | { | |
c8560b44 | 3464 | int ret; |
718e3744 | 3465 | struct peer *peer; |
3466 | ||
afec25d9 | 3467 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
718e3744 | 3468 | if (! peer) |
3469 | return CMD_WARNING; | |
3470 | ||
c8560b44 | 3471 | ret = peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
718e3744 | 3472 | |
c8560b44 DW |
3473 | if (ret) |
3474 | return CMD_WARNING; | |
718e3744 | 3475 | return CMD_SUCCESS; |
3476 | } | |
3477 | ||
3478 | DEFUN (no_neighbor_activate, | |
3479 | no_neighbor_activate_cmd, | |
3480 | NO_NEIGHBOR_CMD2 "activate", | |
3481 | NO_STR | |
3482 | NEIGHBOR_STR | |
3483 | NEIGHBOR_ADDR_STR2 | |
3484 | "Enable the Address Family for this Neighbor\n") | |
3485 | { | |
3486 | int ret; | |
3487 | struct peer *peer; | |
3488 | ||
3489 | /* Lookup peer. */ | |
afec25d9 | 3490 | peer = peer_and_group_lookup_vty (vty, argv[2]->arg); |
718e3744 | 3491 | if (! peer) |
3492 | return CMD_WARNING; | |
3493 | ||
3494 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
3495 | ||
c8560b44 DW |
3496 | if (ret) |
3497 | return CMD_WARNING; | |
3498 | return CMD_SUCCESS; | |
718e3744 | 3499 | } |
6b0655a2 | 3500 | |
718e3744 | 3501 | DEFUN (neighbor_set_peer_group, |
3502 | neighbor_set_peer_group_cmd, | |
a80beece | 3503 | NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3504 | NEIGHBOR_STR |
a80beece | 3505 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3506 | "Member of the peer-group\n" |
3507 | "peer-group name\n") | |
3508 | { | |
3509 | int ret; | |
3510 | as_t as; | |
3511 | union sockunion su; | |
3512 | struct bgp *bgp; | |
a80beece | 3513 | struct peer *peer; |
718e3744 | 3514 | struct peer_group *group; |
3515 | ||
3516 | bgp = vty->index; | |
a80beece | 3517 | peer = NULL; |
718e3744 | 3518 | |
afec25d9 | 3519 | ret = str2sockunion (argv[1]->arg, &su); |
718e3744 | 3520 | if (ret < 0) |
3521 | { | |
afec25d9 | 3522 | peer = peer_lookup_by_conf_if (bgp, argv[1]->arg); |
a80beece DS |
3523 | if (!peer) |
3524 | { | |
afec25d9 | 3525 | vty_out (vty, "%% Malformed address or name: %s%s", argv[1]->arg, VTY_NEWLINE); |
a80beece DS |
3526 | return CMD_WARNING; |
3527 | } | |
3528 | } | |
3529 | else | |
3530 | { | |
6aeb9e78 | 3531 | if (peer_address_self_check (bgp, &su)) |
a80beece DS |
3532 | { |
3533 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
3534 | VTY_NEWLINE); | |
3535 | return CMD_WARNING; | |
3536 | } | |
f14e6fdb DS |
3537 | |
3538 | /* Disallow for dynamic neighbor. */ | |
3539 | peer = peer_lookup (bgp, &su); | |
3540 | if (peer && peer_dynamic_neighbor (peer)) | |
3541 | { | |
3542 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
3543 | VTY_NEWLINE); | |
3544 | return CMD_WARNING; | |
3545 | } | |
718e3744 | 3546 | } |
3547 | ||
afec25d9 | 3548 | group = peer_group_lookup (bgp, argv[3]->arg); |
718e3744 | 3549 | if (! group) |
3550 | { | |
3551 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3552 | return CMD_WARNING; | |
3553 | } | |
3554 | ||
c8560b44 | 3555 | ret = peer_group_bind (bgp, &su, peer, group, &as); |
718e3744 | 3556 | |
3557 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
3558 | { | |
aea339f7 | 3559 | 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 | 3560 | return CMD_WARNING; |
3561 | } | |
3562 | ||
3563 | return bgp_vty_return (vty, ret); | |
3564 | } | |
3565 | ||
3566 | DEFUN (no_neighbor_set_peer_group, | |
3567 | no_neighbor_set_peer_group_cmd, | |
a80beece | 3568 | NO_NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3569 | NO_STR |
3570 | NEIGHBOR_STR | |
a80beece | 3571 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3572 | "Member of the peer-group\n" |
3573 | "peer-group name\n") | |
3574 | { | |
3575 | int ret; | |
3576 | struct bgp *bgp; | |
3577 | struct peer *peer; | |
3578 | struct peer_group *group; | |
3579 | ||
3580 | bgp = vty->index; | |
3581 | ||
afec25d9 | 3582 | peer = peer_lookup_vty (vty, argv[2]->arg); |
718e3744 | 3583 | if (! peer) |
3584 | return CMD_WARNING; | |
3585 | ||
afec25d9 | 3586 | group = peer_group_lookup (bgp, argv[4]->arg); |
718e3744 | 3587 | if (! group) |
3588 | { | |
3589 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3590 | return CMD_WARNING; | |
3591 | } | |
3592 | ||
c8560b44 | 3593 | ret = peer_group_unbind (bgp, peer, group); |
718e3744 | 3594 | |
3595 | return bgp_vty_return (vty, ret); | |
3596 | } | |
6b0655a2 | 3597 | |
94f2b392 | 3598 | static int |
fd79ac91 | 3599 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
3600 | u_int16_t flag, int set) | |
718e3744 | 3601 | { |
3602 | int ret; | |
3603 | struct peer *peer; | |
3604 | ||
3605 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3606 | if (! peer) | |
3607 | return CMD_WARNING; | |
3608 | ||
8cdabf90 SK |
3609 | /* |
3610 | * If 'neighbor <interface>', then this is for directly connected peers, | |
3611 | * we should not accept disable-connected-check. | |
3612 | */ | |
3613 | if (peer->conf_if && (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK)) { | |
3614 | vty_out (vty, "%s is directly connected peer, cannot accept disable-" | |
3615 | "connected-check%s", ip_str, VTY_NEWLINE); | |
3616 | return CMD_WARNING; | |
3617 | } | |
3618 | ||
718e3744 | 3619 | if (set) |
3620 | ret = peer_flag_set (peer, flag); | |
3621 | else | |
3622 | ret = peer_flag_unset (peer, flag); | |
3623 | ||
3624 | return bgp_vty_return (vty, ret); | |
3625 | } | |
3626 | ||
94f2b392 | 3627 | static int |
fd79ac91 | 3628 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3629 | { |
3630 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
3631 | } | |
3632 | ||
94f2b392 | 3633 | static int |
fd79ac91 | 3634 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3635 | { |
3636 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
3637 | } | |
3638 | ||
3639 | /* neighbor passive. */ | |
3640 | DEFUN (neighbor_passive, | |
3641 | neighbor_passive_cmd, | |
3642 | NEIGHBOR_CMD2 "passive", | |
3643 | NEIGHBOR_STR | |
3644 | NEIGHBOR_ADDR_STR2 | |
3645 | "Don't send open messages to this neighbor\n") | |
3646 | { | |
afec25d9 | 3647 | return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_PASSIVE); |
718e3744 | 3648 | } |
3649 | ||
3650 | DEFUN (no_neighbor_passive, | |
3651 | no_neighbor_passive_cmd, | |
3652 | NO_NEIGHBOR_CMD2 "passive", | |
3653 | NO_STR | |
3654 | NEIGHBOR_STR | |
3655 | NEIGHBOR_ADDR_STR2 | |
3656 | "Don't send open messages to this neighbor\n") | |
3657 | { | |
afec25d9 | 3658 | return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_PASSIVE); |
718e3744 | 3659 | } |
6b0655a2 | 3660 | |
718e3744 | 3661 | /* neighbor shutdown. */ |
3662 | DEFUN (neighbor_shutdown, | |
3663 | neighbor_shutdown_cmd, | |
3664 | NEIGHBOR_CMD2 "shutdown", | |
3665 | NEIGHBOR_STR | |
3666 | NEIGHBOR_ADDR_STR2 | |
3667 | "Administratively shut down this neighbor\n") | |
3668 | { | |
afec25d9 | 3669 | return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_SHUTDOWN); |
718e3744 | 3670 | } |
3671 | ||
3672 | DEFUN (no_neighbor_shutdown, | |
3673 | no_neighbor_shutdown_cmd, | |
3674 | NO_NEIGHBOR_CMD2 "shutdown", | |
3675 | NO_STR | |
3676 | NEIGHBOR_STR | |
3677 | NEIGHBOR_ADDR_STR2 | |
3678 | "Administratively shut down this neighbor\n") | |
3679 | { | |
afec25d9 | 3680 | return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_SHUTDOWN); |
718e3744 | 3681 | } |
6b0655a2 | 3682 | |
718e3744 | 3683 | /* neighbor capability dynamic. */ |
3684 | DEFUN (neighbor_capability_dynamic, | |
3685 | neighbor_capability_dynamic_cmd, | |
3686 | NEIGHBOR_CMD2 "capability dynamic", | |
3687 | NEIGHBOR_STR | |
3688 | NEIGHBOR_ADDR_STR2 | |
3689 | "Advertise capability to the peer\n" | |
3690 | "Advertise dynamic capability to this neighbor\n") | |
3691 | { | |
afec25d9 | 3692 | return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_DYNAMIC_CAPABILITY); |
718e3744 | 3693 | } |
3694 | ||
3695 | DEFUN (no_neighbor_capability_dynamic, | |
3696 | no_neighbor_capability_dynamic_cmd, | |
3697 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
3698 | NO_STR | |
3699 | NEIGHBOR_STR | |
3700 | NEIGHBOR_ADDR_STR2 | |
3701 | "Advertise capability to the peer\n" | |
3702 | "Advertise dynamic capability to this neighbor\n") | |
3703 | { | |
afec25d9 | 3704 | return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_DYNAMIC_CAPABILITY); |
718e3744 | 3705 | } |
6b0655a2 | 3706 | |
718e3744 | 3707 | /* neighbor dont-capability-negotiate */ |
3708 | DEFUN (neighbor_dont_capability_negotiate, | |
3709 | neighbor_dont_capability_negotiate_cmd, | |
3710 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3711 | NEIGHBOR_STR | |
3712 | NEIGHBOR_ADDR_STR2 | |
3713 | "Do not perform capability negotiation\n") | |
3714 | { | |
afec25d9 | 3715 | return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_DONT_CAPABILITY); |
718e3744 | 3716 | } |
3717 | ||
3718 | DEFUN (no_neighbor_dont_capability_negotiate, | |
3719 | no_neighbor_dont_capability_negotiate_cmd, | |
3720 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3721 | NO_STR | |
3722 | NEIGHBOR_STR | |
3723 | NEIGHBOR_ADDR_STR2 | |
3724 | "Do not perform capability negotiation\n") | |
3725 | { | |
afec25d9 | 3726 | return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_DONT_CAPABILITY); |
718e3744 | 3727 | } |
6b0655a2 | 3728 | |
8a92a8a0 DS |
3729 | /* neighbor capability extended next hop encoding */ |
3730 | DEFUN (neighbor_capability_enhe, | |
3731 | neighbor_capability_enhe_cmd, | |
3732 | NEIGHBOR_CMD2 "capability extended-nexthop", | |
3733 | NEIGHBOR_STR | |
3734 | NEIGHBOR_ADDR_STR2 | |
3735 | "Advertise capability to the peer\n" | |
3736 | "Advertise extended next-hop capability to the peer\n") | |
3737 | { | |
afec25d9 | 3738 | return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_CAPABILITY_ENHE); |
8a92a8a0 DS |
3739 | } |
3740 | ||
3741 | DEFUN (no_neighbor_capability_enhe, | |
3742 | no_neighbor_capability_enhe_cmd, | |
3743 | NO_NEIGHBOR_CMD2 "capability extended-nexthop", | |
3744 | NO_STR | |
3745 | NEIGHBOR_STR | |
3746 | NEIGHBOR_ADDR_STR2 | |
3747 | "Advertise capability to the peer\n" | |
3748 | "Advertise extended next-hop capability to the peer\n") | |
3749 | { | |
afec25d9 | 3750 | return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_CAPABILITY_ENHE); |
8a92a8a0 DS |
3751 | } |
3752 | ||
94f2b392 | 3753 | static int |
fd79ac91 | 3754 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3755 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 3756 | { |
3757 | int ret; | |
3758 | struct peer *peer; | |
3759 | ||
3760 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3761 | if (! peer) | |
3762 | return CMD_WARNING; | |
3763 | ||
3764 | if (set) | |
3765 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
3766 | else | |
3767 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
3768 | ||
3769 | return bgp_vty_return (vty, ret); | |
3770 | } | |
3771 | ||
94f2b392 | 3772 | static int |
fd79ac91 | 3773 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3774 | safi_t safi, u_int32_t flag) |
718e3744 | 3775 | { |
3776 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
3777 | } | |
3778 | ||
94f2b392 | 3779 | static int |
fd79ac91 | 3780 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3781 | safi_t safi, u_int32_t flag) |
718e3744 | 3782 | { |
3783 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
3784 | } | |
6b0655a2 | 3785 | |
718e3744 | 3786 | /* neighbor capability orf prefix-list. */ |
3787 | DEFUN (neighbor_capability_orf_prefix, | |
3788 | neighbor_capability_orf_prefix_cmd, | |
3789 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3790 | NEIGHBOR_STR | |
3791 | NEIGHBOR_ADDR_STR2 | |
3792 | "Advertise capability to the peer\n" | |
3793 | "Advertise ORF capability to the peer\n" | |
3794 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3795 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3796 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3797 | "Capability to SEND the ORF to this neighbor\n") | |
3798 | { | |
3799 | u_int16_t flag = 0; | |
3800 | ||
afec25d9 | 3801 | if (strncmp (argv[5]->arg, "s", 1) == 0) |
718e3744 | 3802 | flag = PEER_FLAG_ORF_PREFIX_SM; |
afec25d9 | 3803 | else if (strncmp (argv[5]->arg, "r", 1) == 0) |
718e3744 | 3804 | flag = PEER_FLAG_ORF_PREFIX_RM; |
afec25d9 | 3805 | else if (strncmp (argv[5]->arg, "b", 1) == 0) |
718e3744 | 3806 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
3807 | else | |
3808 | return CMD_WARNING; | |
3809 | ||
afec25d9 | 3810 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
718e3744 | 3811 | bgp_node_safi (vty), flag); |
3812 | } | |
3813 | ||
3814 | DEFUN (no_neighbor_capability_orf_prefix, | |
3815 | no_neighbor_capability_orf_prefix_cmd, | |
3816 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3817 | NO_STR | |
3818 | NEIGHBOR_STR | |
3819 | NEIGHBOR_ADDR_STR2 | |
3820 | "Advertise capability to the peer\n" | |
3821 | "Advertise ORF capability to the peer\n" | |
3822 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3823 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3824 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3825 | "Capability to SEND the ORF to this neighbor\n") | |
3826 | { | |
3827 | u_int16_t flag = 0; | |
3828 | ||
afec25d9 | 3829 | if (strncmp (argv[6]->arg, "s", 1) == 0) |
718e3744 | 3830 | flag = PEER_FLAG_ORF_PREFIX_SM; |
afec25d9 | 3831 | else if (strncmp (argv[6]->arg, "r", 1) == 0) |
718e3744 | 3832 | flag = PEER_FLAG_ORF_PREFIX_RM; |
afec25d9 | 3833 | else if (strncmp (argv[6]->arg, "b", 1) == 0) |
718e3744 | 3834 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; |
3835 | else | |
3836 | return CMD_WARNING; | |
3837 | ||
afec25d9 | 3838 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 3839 | bgp_node_safi (vty), flag); |
3840 | } | |
6b0655a2 | 3841 | |
718e3744 | 3842 | /* neighbor next-hop-self. */ |
3843 | DEFUN (neighbor_nexthop_self, | |
3844 | neighbor_nexthop_self_cmd, | |
a538debe | 3845 | NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3846 | NEIGHBOR_STR |
3847 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3848 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3849 | { |
afec25d9 | 3850 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
a538debe DS |
3851 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); |
3852 | } | |
9e7a53c1 | 3853 | |
a538debe DS |
3854 | /* neighbor next-hop-self. */ |
3855 | DEFUN (neighbor_nexthop_self_force, | |
3856 | neighbor_nexthop_self_force_cmd, | |
3857 | NEIGHBOR_CMD2 "next-hop-self force", | |
3858 | NEIGHBOR_STR | |
3859 | NEIGHBOR_ADDR_STR2 | |
3860 | "Disable the next hop calculation for this neighbor\n" | |
3861 | "Set the next hop to self for reflected routes\n") | |
3862 | { | |
afec25d9 | 3863 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
a538debe | 3864 | bgp_node_safi (vty), |
88b8ed8d | 3865 | PEER_FLAG_FORCE_NEXTHOP_SELF); |
718e3744 | 3866 | } |
3867 | ||
3868 | DEFUN (no_neighbor_nexthop_self, | |
3869 | no_neighbor_nexthop_self_cmd, | |
a538debe | 3870 | NO_NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3871 | NO_STR |
3872 | NEIGHBOR_STR | |
3873 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3874 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3875 | { |
afec25d9 | 3876 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
9e7a53c1 | 3877 | bgp_node_safi (vty), |
88b8ed8d | 3878 | PEER_FLAG_NEXTHOP_SELF); |
718e3744 | 3879 | } |
6b0655a2 | 3880 | |
88b8ed8d | 3881 | DEFUN (no_neighbor_nexthop_self_force, |
a538debe DS |
3882 | no_neighbor_nexthop_self_force_cmd, |
3883 | NO_NEIGHBOR_CMD2 "next-hop-self force", | |
3884 | NO_STR | |
3885 | NEIGHBOR_STR | |
3886 | NEIGHBOR_ADDR_STR2 | |
3887 | "Disable the next hop calculation for this neighbor\n" | |
3888 | "Set the next hop to self for reflected routes\n") | |
88b8ed8d | 3889 | { |
afec25d9 | 3890 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
88b8ed8d DW |
3891 | bgp_node_safi (vty), |
3892 | PEER_FLAG_FORCE_NEXTHOP_SELF); | |
3893 | } | |
a538debe | 3894 | |
c7122e14 DS |
3895 | /* neighbor as-override */ |
3896 | DEFUN (neighbor_as_override, | |
3897 | neighbor_as_override_cmd, | |
3898 | NEIGHBOR_CMD2 "as-override", | |
3899 | NEIGHBOR_STR | |
3900 | NEIGHBOR_ADDR_STR2 | |
3901 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3902 | { | |
afec25d9 | 3903 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
c7122e14 DS |
3904 | bgp_node_safi (vty), |
3905 | PEER_FLAG_AS_OVERRIDE); | |
3906 | } | |
3907 | ||
3908 | DEFUN (no_neighbor_as_override, | |
3909 | no_neighbor_as_override_cmd, | |
3910 | NO_NEIGHBOR_CMD2 "as-override", | |
3911 | NO_STR | |
3912 | NEIGHBOR_STR | |
3913 | NEIGHBOR_ADDR_STR2 | |
3914 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3915 | { | |
afec25d9 | 3916 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
c7122e14 DS |
3917 | bgp_node_safi (vty), |
3918 | PEER_FLAG_AS_OVERRIDE); | |
3919 | } | |
3920 | ||
718e3744 | 3921 | /* neighbor remove-private-AS. */ |
3922 | DEFUN (neighbor_remove_private_as, | |
3923 | neighbor_remove_private_as_cmd, | |
3924 | NEIGHBOR_CMD2 "remove-private-AS", | |
3925 | NEIGHBOR_STR | |
3926 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3927 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3928 | { |
afec25d9 | 3929 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
718e3744 | 3930 | bgp_node_safi (vty), |
3931 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
3932 | } | |
3933 | ||
5000f21c DS |
3934 | DEFUN (neighbor_remove_private_as_all, |
3935 | neighbor_remove_private_as_all_cmd, | |
3936 | NEIGHBOR_CMD2 "remove-private-AS all", | |
3937 | NEIGHBOR_STR | |
3938 | NEIGHBOR_ADDR_STR2 | |
3939 | "Remove private ASNs in outbound updates\n" | |
3940 | "Apply to all AS numbers") | |
3941 | { | |
afec25d9 | 3942 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5000f21c | 3943 | bgp_node_safi (vty), |
5000f21c DS |
3944 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); |
3945 | } | |
3946 | ||
3947 | DEFUN (neighbor_remove_private_as_replace_as, | |
3948 | neighbor_remove_private_as_replace_as_cmd, | |
3949 | NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3950 | NEIGHBOR_STR | |
3951 | NEIGHBOR_ADDR_STR2 | |
3952 | "Remove private ASNs in outbound updates\n" | |
3953 | "Replace private ASNs with our ASN in outbound updates\n") | |
3954 | { | |
afec25d9 | 3955 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5000f21c | 3956 | bgp_node_safi (vty), |
5000f21c DS |
3957 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); |
3958 | } | |
3959 | ||
3960 | DEFUN (neighbor_remove_private_as_all_replace_as, | |
3961 | neighbor_remove_private_as_all_replace_as_cmd, | |
3962 | NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3963 | NEIGHBOR_STR | |
3964 | NEIGHBOR_ADDR_STR2 | |
3965 | "Remove private ASNs in outbound updates\n" | |
3966 | "Apply to all AS numbers" | |
3967 | "Replace private ASNs with our ASN in outbound updates\n") | |
3968 | { | |
afec25d9 | 3969 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5000f21c | 3970 | bgp_node_safi (vty), |
88b8ed8d | 3971 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); |
5000f21c DS |
3972 | } |
3973 | ||
718e3744 | 3974 | DEFUN (no_neighbor_remove_private_as, |
3975 | no_neighbor_remove_private_as_cmd, | |
3976 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
3977 | NO_STR | |
3978 | NEIGHBOR_STR | |
3979 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3980 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3981 | { |
afec25d9 | 3982 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 3983 | bgp_node_safi (vty), |
88b8ed8d | 3984 | PEER_FLAG_REMOVE_PRIVATE_AS); |
718e3744 | 3985 | } |
6b0655a2 | 3986 | |
88b8ed8d | 3987 | DEFUN (no_neighbor_remove_private_as_all, |
5000f21c DS |
3988 | no_neighbor_remove_private_as_all_cmd, |
3989 | NO_NEIGHBOR_CMD2 "remove-private-AS all", | |
3990 | NO_STR | |
3991 | NEIGHBOR_STR | |
3992 | NEIGHBOR_ADDR_STR2 | |
3993 | "Remove private ASNs in outbound updates\n" | |
3994 | "Apply to all AS numbers") | |
88b8ed8d | 3995 | { |
afec25d9 | 3996 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
88b8ed8d DW |
3997 | bgp_node_safi (vty), |
3998 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3999 | } | |
5000f21c | 4000 | |
88b8ed8d | 4001 | DEFUN (no_neighbor_remove_private_as_replace_as, |
5000f21c DS |
4002 | no_neighbor_remove_private_as_replace_as_cmd, |
4003 | NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
4004 | NO_STR | |
4005 | NEIGHBOR_STR | |
4006 | NEIGHBOR_ADDR_STR2 | |
4007 | "Remove private ASNs in outbound updates\n" | |
4008 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d | 4009 | { |
afec25d9 | 4010 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
88b8ed8d DW |
4011 | bgp_node_safi (vty), |
4012 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
4013 | } | |
5000f21c | 4014 | |
88b8ed8d | 4015 | DEFUN (no_neighbor_remove_private_as_all_replace_as, |
5000f21c DS |
4016 | no_neighbor_remove_private_as_all_replace_as_cmd, |
4017 | NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
4018 | NO_STR | |
4019 | NEIGHBOR_STR | |
4020 | NEIGHBOR_ADDR_STR2 | |
4021 | "Remove private ASNs in outbound updates\n" | |
4022 | "Apply to all AS numbers" | |
4023 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d | 4024 | { |
afec25d9 | 4025 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
88b8ed8d DW |
4026 | bgp_node_safi (vty), |
4027 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); | |
4028 | } | |
5000f21c DS |
4029 | |
4030 | ||
718e3744 | 4031 | /* neighbor send-community. */ |
4032 | DEFUN (neighbor_send_community, | |
4033 | neighbor_send_community_cmd, | |
4034 | NEIGHBOR_CMD2 "send-community", | |
4035 | NEIGHBOR_STR | |
4036 | NEIGHBOR_ADDR_STR2 | |
4037 | "Send Community attribute to this neighbor\n") | |
4038 | { | |
afec25d9 | 4039 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
718e3744 | 4040 | bgp_node_safi (vty), |
4041 | PEER_FLAG_SEND_COMMUNITY); | |
4042 | } | |
4043 | ||
4044 | DEFUN (no_neighbor_send_community, | |
4045 | no_neighbor_send_community_cmd, | |
4046 | NO_NEIGHBOR_CMD2 "send-community", | |
4047 | NO_STR | |
4048 | NEIGHBOR_STR | |
4049 | NEIGHBOR_ADDR_STR2 | |
4050 | "Send Community attribute to this neighbor\n") | |
4051 | { | |
afec25d9 | 4052 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 4053 | bgp_node_safi (vty), |
4054 | PEER_FLAG_SEND_COMMUNITY); | |
4055 | } | |
6b0655a2 | 4056 | |
718e3744 | 4057 | /* neighbor send-community extended. */ |
4058 | DEFUN (neighbor_send_community_type, | |
4059 | neighbor_send_community_type_cmd, | |
4060 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
4061 | NEIGHBOR_STR | |
4062 | NEIGHBOR_ADDR_STR2 | |
4063 | "Send Community attribute to this neighbor\n" | |
4064 | "Send Standard and Extended Community attributes\n" | |
4065 | "Send Extended Community attributes\n" | |
4066 | "Send Standard Community attributes\n") | |
4067 | { | |
afec25d9 DW |
4068 | if (strncmp (argv[3]->arg, "s", 1) == 0) |
4069 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), | |
718e3744 | 4070 | bgp_node_safi (vty), |
4071 | PEER_FLAG_SEND_COMMUNITY); | |
afec25d9 DW |
4072 | if (strncmp (argv[3]->arg, "e", 1) == 0) |
4073 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), | |
718e3744 | 4074 | bgp_node_safi (vty), |
4075 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
4076 | ||
afec25d9 | 4077 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
718e3744 | 4078 | bgp_node_safi (vty), |
4079 | (PEER_FLAG_SEND_COMMUNITY| | |
4080 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
4081 | } | |
4082 | ||
4083 | DEFUN (no_neighbor_send_community_type, | |
4084 | no_neighbor_send_community_type_cmd, | |
4085 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
4086 | NO_STR | |
4087 | NEIGHBOR_STR | |
4088 | NEIGHBOR_ADDR_STR2 | |
4089 | "Send Community attribute to this neighbor\n" | |
4090 | "Send Standard and Extended Community attributes\n" | |
4091 | "Send Extended Community attributes\n" | |
4092 | "Send Standard Community attributes\n") | |
4093 | { | |
afec25d9 DW |
4094 | if (strncmp (argv[4]->arg, "s", 1) == 0) |
4095 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), | |
718e3744 | 4096 | bgp_node_safi (vty), |
4097 | PEER_FLAG_SEND_COMMUNITY); | |
afec25d9 DW |
4098 | if (strncmp (argv[4]->arg, "e", 1) == 0) |
4099 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), | |
718e3744 | 4100 | bgp_node_safi (vty), |
4101 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
4102 | ||
afec25d9 | 4103 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 4104 | bgp_node_safi (vty), |
4105 | (PEER_FLAG_SEND_COMMUNITY | | |
4106 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
4107 | } | |
6b0655a2 | 4108 | |
718e3744 | 4109 | /* neighbor soft-reconfig. */ |
4110 | DEFUN (neighbor_soft_reconfiguration, | |
4111 | neighbor_soft_reconfiguration_cmd, | |
4112 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
4113 | NEIGHBOR_STR | |
4114 | NEIGHBOR_ADDR_STR2 | |
4115 | "Per neighbor soft reconfiguration\n" | |
4116 | "Allow inbound soft reconfiguration for this neighbor\n") | |
4117 | { | |
afec25d9 | 4118 | return peer_af_flag_set_vty (vty, argv[1]->arg, |
718e3744 | 4119 | bgp_node_afi (vty), bgp_node_safi (vty), |
4120 | PEER_FLAG_SOFT_RECONFIG); | |
4121 | } | |
4122 | ||
4123 | DEFUN (no_neighbor_soft_reconfiguration, | |
4124 | no_neighbor_soft_reconfiguration_cmd, | |
4125 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
4126 | NO_STR | |
4127 | NEIGHBOR_STR | |
4128 | NEIGHBOR_ADDR_STR2 | |
4129 | "Per neighbor soft reconfiguration\n" | |
4130 | "Allow inbound soft reconfiguration for this neighbor\n") | |
4131 | { | |
afec25d9 | 4132 | return peer_af_flag_unset_vty (vty, argv[2]->arg, |
718e3744 | 4133 | bgp_node_afi (vty), bgp_node_safi (vty), |
4134 | PEER_FLAG_SOFT_RECONFIG); | |
4135 | } | |
6b0655a2 | 4136 | |
718e3744 | 4137 | DEFUN (neighbor_route_reflector_client, |
4138 | neighbor_route_reflector_client_cmd, | |
4139 | NEIGHBOR_CMD2 "route-reflector-client", | |
4140 | NEIGHBOR_STR | |
4141 | NEIGHBOR_ADDR_STR2 | |
4142 | "Configure a neighbor as Route Reflector client\n") | |
4143 | { | |
4144 | struct peer *peer; | |
4145 | ||
4146 | ||
afec25d9 | 4147 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
718e3744 | 4148 | if (! peer) |
4149 | return CMD_WARNING; | |
4150 | ||
afec25d9 | 4151 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
718e3744 | 4152 | bgp_node_safi (vty), |
4153 | PEER_FLAG_REFLECTOR_CLIENT); | |
4154 | } | |
4155 | ||
4156 | DEFUN (no_neighbor_route_reflector_client, | |
4157 | no_neighbor_route_reflector_client_cmd, | |
4158 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
4159 | NO_STR | |
4160 | NEIGHBOR_STR | |
4161 | NEIGHBOR_ADDR_STR2 | |
4162 | "Configure a neighbor as Route Reflector client\n") | |
4163 | { | |
afec25d9 | 4164 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 4165 | bgp_node_safi (vty), |
4166 | PEER_FLAG_REFLECTOR_CLIENT); | |
4167 | } | |
6b0655a2 | 4168 | |
718e3744 | 4169 | /* neighbor route-server-client. */ |
4170 | DEFUN (neighbor_route_server_client, | |
4171 | neighbor_route_server_client_cmd, | |
4172 | NEIGHBOR_CMD2 "route-server-client", | |
4173 | NEIGHBOR_STR | |
4174 | NEIGHBOR_ADDR_STR2 | |
4175 | "Configure a neighbor as Route Server client\n") | |
4176 | { | |
2a3d5731 DW |
4177 | struct peer *peer; |
4178 | ||
afec25d9 | 4179 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
2a3d5731 DW |
4180 | if (! peer) |
4181 | return CMD_WARNING; | |
afec25d9 | 4182 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
2a3d5731 DW |
4183 | bgp_node_safi (vty), |
4184 | PEER_FLAG_RSERVER_CLIENT); | |
718e3744 | 4185 | } |
4186 | ||
4187 | DEFUN (no_neighbor_route_server_client, | |
4188 | no_neighbor_route_server_client_cmd, | |
4189 | NO_NEIGHBOR_CMD2 "route-server-client", | |
4190 | NO_STR | |
4191 | NEIGHBOR_STR | |
4192 | NEIGHBOR_ADDR_STR2 | |
4193 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 4194 | { |
afec25d9 | 4195 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
2a3d5731 DW |
4196 | bgp_node_safi (vty), |
4197 | PEER_FLAG_RSERVER_CLIENT); | |
fee0f4c6 | 4198 | } |
6b0655a2 | 4199 | |
fee0f4c6 | 4200 | DEFUN (neighbor_nexthop_local_unchanged, |
4201 | neighbor_nexthop_local_unchanged_cmd, | |
4202 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
4203 | NEIGHBOR_STR | |
4204 | NEIGHBOR_ADDR_STR2 | |
4205 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
4206 | "Leave link-local nexthop unchanged for this peer\n") | |
4207 | { | |
afec25d9 | 4208 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
fee0f4c6 | 4209 | bgp_node_safi (vty), |
4210 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
4211 | } | |
6b0655a2 | 4212 | |
fee0f4c6 | 4213 | DEFUN (no_neighbor_nexthop_local_unchanged, |
4214 | no_neighbor_nexthop_local_unchanged_cmd, | |
4215 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
4216 | NO_STR | |
4217 | NEIGHBOR_STR | |
4218 | NEIGHBOR_ADDR_STR2 | |
4219 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
4220 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 4221 | { |
afec25d9 | 4222 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 4223 | bgp_node_safi (vty), |
fee0f4c6 | 4224 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 4225 | } |
6b0655a2 | 4226 | |
f412b39a DW |
4227 | /* |
4228 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
4229 | * NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4230 | * NEIGHBOR_STR | |
4231 | * NEIGHBOR_ADDR_STR2 | |
4232 | * "BGP attribute is propagated unchanged to this neighbor\n" | |
4233 | * "Med attribute\n" | |
4234 | * "Nexthop attribute\n" | |
4235 | * "As-path attribute\n" | |
4236 | * | |
4237 | * NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4238 | * NEIGHBOR_STR | |
4239 | * NEIGHBOR_ADDR_STR2 | |
4240 | * "BGP attribute is propagated unchanged to this neighbor\n" | |
4241 | * "Med attribute\n" | |
4242 | * "As-path attribute\n" | |
4243 | * "Nexthop attribute\n" | |
4244 | * | |
4245 | * NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4246 | * NEIGHBOR_STR | |
4247 | * NEIGHBOR_ADDR_STR2 | |
4248 | * "BGP attribute is propagated unchanged to this neighbor\n" | |
4249 | * "As-path attribute\n" | |
4250 | * "Nexthop attribute\n" | |
4251 | * "Med attribute\n" | |
4252 | * | |
4253 | * NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4254 | * NEIGHBOR_STR | |
4255 | * NEIGHBOR_ADDR_STR2 | |
4256 | * "BGP attribute is propagated unchanged to this neighbor\n" | |
4257 | * "Nexthop attribute\n" | |
4258 | * "As-path attribute\n" | |
4259 | * "Med attribute\n" | |
4260 | * | |
4261 | * NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4262 | * NEIGHBOR_STR | |
4263 | * NEIGHBOR_ADDR_STR2 | |
4264 | * "BGP attribute is propagated unchanged to this neighbor\n" | |
4265 | * "As-path attribute\n" | |
4266 | * "Med attribute\n" | |
4267 | * "Nexthop attribute\n" | |
4268 | * | |
4269 | * NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4270 | * NEIGHBOR_STR | |
4271 | * NEIGHBOR_ADDR_STR2 | |
4272 | * "BGP attribute is propagated unchanged to this neighbor\n" | |
4273 | * "Nexthop attribute\n" | |
4274 | * "Med attribute\n" | |
4275 | * "As-path attribute\n" | |
4276 | * | |
4277 | */ | |
718e3744 | 4278 | DEFUN (neighbor_attr_unchanged, |
4279 | neighbor_attr_unchanged_cmd, | |
4280 | NEIGHBOR_CMD2 "attribute-unchanged", | |
4281 | NEIGHBOR_STR | |
4282 | NEIGHBOR_ADDR_STR2 | |
4283 | "BGP attribute is propagated unchanged to this neighbor\n") | |
4284 | { | |
afec25d9 | 4285 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
718e3744 | 4286 | bgp_node_safi (vty), |
4287 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4288 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4289 | PEER_FLAG_MED_UNCHANGED)); | |
4290 | } | |
4291 | ||
4292 | DEFUN (neighbor_attr_unchanged1, | |
4293 | neighbor_attr_unchanged1_cmd, | |
4294 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4295 | NEIGHBOR_STR | |
4296 | NEIGHBOR_ADDR_STR2 | |
4297 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4298 | "As-path attribute\n" | |
4299 | "Nexthop attribute\n" | |
4300 | "Med attribute\n") | |
4301 | { | |
4302 | u_int16_t flags = 0; | |
4303 | ||
afec25d9 | 4304 | if (strncmp (argv[3]->arg, "as-path", 1) == 0) |
718e3744 | 4305 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
afec25d9 | 4306 | else if (strncmp (argv[3]->arg, "next-hop", 1) == 0) |
718e3744 | 4307 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
afec25d9 | 4308 | else if (strncmp (argv[3]->arg, "med", 1) == 0) |
718e3744 | 4309 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
4310 | ||
afec25d9 | 4311 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
718e3744 | 4312 | bgp_node_safi (vty), flags); |
4313 | } | |
4314 | ||
4315 | DEFUN (neighbor_attr_unchanged2, | |
4316 | neighbor_attr_unchanged2_cmd, | |
4317 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4318 | NEIGHBOR_STR | |
4319 | NEIGHBOR_ADDR_STR2 | |
4320 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4321 | "As-path attribute\n" | |
4322 | "Nexthop attribute\n" | |
4323 | "Med attribute\n") | |
4324 | { | |
4325 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4326 | ||
afec25d9 | 4327 | if (strncmp (argv[4]->arg, "next-hop", 1) == 0) |
718e3744 | 4328 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
afec25d9 | 4329 | else if (strncmp (argv[4]->arg, "med", 1) == 0) |
718e3744 | 4330 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
4331 | ||
afec25d9 | 4332 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
718e3744 | 4333 | bgp_node_safi (vty), flags); |
4334 | ||
4335 | } | |
4336 | ||
4337 | DEFUN (neighbor_attr_unchanged3, | |
4338 | neighbor_attr_unchanged3_cmd, | |
4339 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4340 | NEIGHBOR_STR | |
4341 | NEIGHBOR_ADDR_STR2 | |
4342 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4343 | "Nexthop attribute\n" | |
4344 | "As-path attribute\n" | |
4345 | "Med attribute\n") | |
4346 | { | |
4347 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4348 | ||
afec25d9 | 4349 | if (strncmp (argv[4]->arg, "as-path", 1) == 0) |
718e3744 | 4350 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
afec25d9 | 4351 | else if (strncmp (argv[4]->arg, "med", 1) == 0) |
718e3744 | 4352 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
4353 | ||
afec25d9 | 4354 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
718e3744 | 4355 | bgp_node_safi (vty), flags); |
4356 | } | |
4357 | ||
4358 | DEFUN (neighbor_attr_unchanged4, | |
4359 | neighbor_attr_unchanged4_cmd, | |
4360 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4361 | NEIGHBOR_STR | |
4362 | NEIGHBOR_ADDR_STR2 | |
4363 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4364 | "Med attribute\n" | |
4365 | "As-path attribute\n" | |
4366 | "Nexthop attribute\n") | |
4367 | { | |
4368 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4369 | ||
afec25d9 | 4370 | if (strncmp (argv[4]->arg, "as-path", 1) == 0) |
718e3744 | 4371 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
afec25d9 | 4372 | else if (strncmp (argv[4]->arg, "next-hop", 1) == 0) |
718e3744 | 4373 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
4374 | ||
afec25d9 | 4375 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
718e3744 | 4376 | bgp_node_safi (vty), flags); |
4377 | } | |
4378 | ||
718e3744 | 4379 | |
718e3744 | 4380 | |
718e3744 | 4381 | |
718e3744 | 4382 | |
718e3744 | 4383 | |
718e3744 | 4384 | |
f412b39a DW |
4385 | /* |
4386 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
4387 | * NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4388 | * NO_STR | |
4389 | * NEIGHBOR_STR | |
4390 | * NEIGHBOR_ADDR_STR2 | |
4391 | * "BGP attribute is propagated unchanged to this neighbor\n" | |
4392 | * "Nexthop attribute\n" | |
4393 | * "Med attribute\n" | |
4394 | * "As-path attribute\n" | |
4395 | * | |
4396 | * NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4397 | * NO_STR | |
4398 | * NEIGHBOR_STR | |
4399 | * NEIGHBOR_ADDR_STR2 | |
4400 | * "BGP attribute is propagated unchanged to this neighbor\n" | |
4401 | * "As-path attribute\n" | |
4402 | * "Med attribute\n" | |
4403 | * "Nexthop attribute\n" | |
4404 | * | |
4405 | * NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4406 | * NO_STR | |
4407 | * NEIGHBOR_STR | |
4408 | * NEIGHBOR_ADDR_STR2 | |
4409 | * "BGP attribute is propagated unchanged to this neighbor\n" | |
4410 | * "Med attribute\n" | |
4411 | * "As-path attribute\n" | |
4412 | * "Nexthop attribute\n" | |
4413 | * | |
4414 | * NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4415 | * NO_STR | |
4416 | * NEIGHBOR_STR | |
4417 | * NEIGHBOR_ADDR_STR2 | |
4418 | * "BGP attribute is propagated unchanged to this neighbor\n" | |
4419 | * "Nexthop attribute\n" | |
4420 | * "As-path attribute\n" | |
4421 | * "Med attribute\n" | |
4422 | * | |
4423 | * NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4424 | * NO_STR | |
4425 | * NEIGHBOR_STR | |
4426 | * NEIGHBOR_ADDR_STR2 | |
4427 | * "BGP attribute is propagated unchanged to this neighbor\n" | |
4428 | * "As-path attribute\n" | |
4429 | * "Nexthop attribute\n" | |
4430 | * "Med attribute\n" | |
4431 | * | |
4432 | * NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4433 | * NO_STR | |
4434 | * NEIGHBOR_STR | |
4435 | * NEIGHBOR_ADDR_STR2 | |
4436 | * "BGP attribute is propagated unchanged to this neighbor\n" | |
4437 | * "Med attribute\n" | |
4438 | * "Nexthop attribute\n" | |
4439 | * "As-path attribute\n" | |
4440 | * | |
4441 | */ | |
718e3744 | 4442 | DEFUN (no_neighbor_attr_unchanged, |
4443 | no_neighbor_attr_unchanged_cmd, | |
4444 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
4445 | NO_STR | |
4446 | NEIGHBOR_STR | |
4447 | NEIGHBOR_ADDR_STR2 | |
4448 | "BGP attribute is propagated unchanged to this neighbor\n") | |
4449 | { | |
afec25d9 | 4450 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 4451 | bgp_node_safi (vty), |
4452 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4453 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4454 | PEER_FLAG_MED_UNCHANGED)); | |
4455 | } | |
4456 | ||
4457 | DEFUN (no_neighbor_attr_unchanged1, | |
4458 | no_neighbor_attr_unchanged1_cmd, | |
4459 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4460 | NO_STR | |
4461 | NEIGHBOR_STR | |
4462 | NEIGHBOR_ADDR_STR2 | |
4463 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4464 | "As-path attribute\n" | |
4465 | "Nexthop attribute\n" | |
4466 | "Med attribute\n") | |
4467 | { | |
4468 | u_int16_t flags = 0; | |
4469 | ||
afec25d9 | 4470 | if (strncmp (argv[4]->arg, "as-path", 1) == 0) |
718e3744 | 4471 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
afec25d9 | 4472 | else if (strncmp (argv[4]->arg, "next-hop", 1) == 0) |
718e3744 | 4473 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
afec25d9 | 4474 | else if (strncmp (argv[4]->arg, "med", 1) == 0) |
718e3744 | 4475 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
4476 | ||
afec25d9 | 4477 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 4478 | bgp_node_safi (vty), flags); |
4479 | } | |
4480 | ||
4481 | DEFUN (no_neighbor_attr_unchanged2, | |
4482 | no_neighbor_attr_unchanged2_cmd, | |
4483 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4484 | NO_STR | |
4485 | NEIGHBOR_STR | |
4486 | NEIGHBOR_ADDR_STR2 | |
4487 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4488 | "As-path attribute\n" | |
4489 | "Nexthop attribute\n" | |
4490 | "Med attribute\n") | |
4491 | { | |
4492 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4493 | ||
afec25d9 | 4494 | if (strncmp (argv[5]->arg, "next-hop", 1) == 0) |
718e3744 | 4495 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
afec25d9 | 4496 | else if (strncmp (argv[5]->arg, "med", 1) == 0) |
718e3744 | 4497 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
4498 | ||
afec25d9 | 4499 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 4500 | bgp_node_safi (vty), flags); |
4501 | } | |
4502 | ||
4503 | DEFUN (no_neighbor_attr_unchanged3, | |
4504 | no_neighbor_attr_unchanged3_cmd, | |
4505 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4506 | NO_STR | |
4507 | NEIGHBOR_STR | |
4508 | NEIGHBOR_ADDR_STR2 | |
4509 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4510 | "Nexthop attribute\n" | |
4511 | "As-path attribute\n" | |
4512 | "Med attribute\n") | |
4513 | { | |
4514 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4515 | ||
afec25d9 | 4516 | if (strncmp (argv[5]->arg, "as-path", 1) == 0) |
718e3744 | 4517 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
afec25d9 | 4518 | else if (strncmp (argv[5]->arg, "med", 1) == 0) |
718e3744 | 4519 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); |
4520 | ||
afec25d9 | 4521 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 4522 | bgp_node_safi (vty), flags); |
4523 | } | |
4524 | ||
4525 | DEFUN (no_neighbor_attr_unchanged4, | |
4526 | no_neighbor_attr_unchanged4_cmd, | |
4527 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4528 | NO_STR | |
4529 | NEIGHBOR_STR | |
4530 | NEIGHBOR_ADDR_STR2 | |
4531 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4532 | "Med attribute\n" | |
4533 | "As-path attribute\n" | |
4534 | "Nexthop attribute\n") | |
4535 | { | |
4536 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4537 | ||
afec25d9 | 4538 | if (strncmp (argv[5]->arg, "as-path", 1) == 0) |
718e3744 | 4539 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); |
afec25d9 | 4540 | else if (strncmp (argv[5]->arg, "next-hop", 1) == 0) |
718e3744 | 4541 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); |
4542 | ||
afec25d9 | 4543 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 4544 | bgp_node_safi (vty), flags); |
4545 | } | |
4546 | ||
718e3744 | 4547 | |
718e3744 | 4548 | |
718e3744 | 4549 | |
718e3744 | 4550 | |
718e3744 | 4551 | |
718e3744 | 4552 | |
718e3744 | 4553 | /* EBGP multihop configuration. */ |
94f2b392 | 4554 | static int |
fd79ac91 | 4555 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
4556 | const char *ttl_str) | |
718e3744 | 4557 | { |
4558 | struct peer *peer; | |
fd79ac91 | 4559 | unsigned int ttl; |
718e3744 | 4560 | |
4561 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4562 | if (! peer) | |
4563 | return CMD_WARNING; | |
4564 | ||
63fa10b5 QY |
4565 | if (peer->conf_if) |
4566 | return bgp_vty_return (vty, BGP_ERR_INVALID_FOR_DIRECT_PEER); | |
4567 | ||
718e3744 | 4568 | if (! ttl_str) |
9b1be336 | 4569 | ttl = MAXTTL; |
718e3744 | 4570 | else |
9b1be336 | 4571 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, MAXTTL); |
718e3744 | 4572 | |
89b6d1f8 | 4573 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 4574 | } |
4575 | ||
94f2b392 | 4576 | static int |
fd79ac91 | 4577 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4578 | { |
4579 | struct peer *peer; | |
4580 | ||
4581 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4582 | if (! peer) | |
4583 | return CMD_WARNING; | |
4584 | ||
89b6d1f8 | 4585 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 4586 | } |
4587 | ||
4588 | /* neighbor ebgp-multihop. */ | |
4589 | DEFUN (neighbor_ebgp_multihop, | |
4590 | neighbor_ebgp_multihop_cmd, | |
4591 | NEIGHBOR_CMD2 "ebgp-multihop", | |
4592 | NEIGHBOR_STR | |
4593 | NEIGHBOR_ADDR_STR2 | |
4594 | "Allow EBGP neighbors not on directly connected networks\n") | |
4595 | { | |
afec25d9 | 4596 | return peer_ebgp_multihop_set_vty (vty, argv[1]->arg, NULL); |
718e3744 | 4597 | } |
4598 | ||
4599 | DEFUN (neighbor_ebgp_multihop_ttl, | |
4600 | neighbor_ebgp_multihop_ttl_cmd, | |
9b1be336 | 4601 | NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), |
718e3744 | 4602 | NEIGHBOR_STR |
4603 | NEIGHBOR_ADDR_STR2 | |
4604 | "Allow EBGP neighbors not on directly connected networks\n" | |
4605 | "maximum hop count\n") | |
4606 | { | |
afec25d9 | 4607 | return peer_ebgp_multihop_set_vty (vty, argv[1]->arg, argv[3]->arg); |
718e3744 | 4608 | } |
4609 | ||
f412b39a DW |
4610 | /* |
4611 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
4612 | * NO_NEIGHBOR_CMD2 "ebgp-multihop " CMD_RANGE_STR(1, MAXTTL), | |
4613 | * NO_STR | |
4614 | * NEIGHBOR_STR | |
4615 | * NEIGHBOR_ADDR_STR2 | |
4616 | * "Allow EBGP neighbors not on directly connected networks\n" | |
4617 | * "maximum hop count\n" | |
4618 | * | |
4619 | */ | |
718e3744 | 4620 | DEFUN (no_neighbor_ebgp_multihop, |
4621 | no_neighbor_ebgp_multihop_cmd, | |
4622 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
4623 | NO_STR | |
4624 | NEIGHBOR_STR | |
4625 | NEIGHBOR_ADDR_STR2 | |
4626 | "Allow EBGP neighbors not on directly connected networks\n") | |
4627 | { | |
afec25d9 | 4628 | return peer_ebgp_multihop_unset_vty (vty, argv[2]->arg); |
718e3744 | 4629 | } |
4630 | ||
6b0655a2 | 4631 | |
6ffd2079 | 4632 | /* disable-connected-check */ |
f412b39a DW |
4633 | /* |
4634 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
4635 | * NEIGHBOR_CMD2 "enforce-multihop", | |
4636 | * NEIGHBOR_STR | |
4637 | * NEIGHBOR_ADDR_STR2 | |
4638 | * "Enforce EBGP neighbors perform multihop\n" | |
4639 | * | |
4640 | */ | |
6ffd2079 | 4641 | DEFUN (neighbor_disable_connected_check, |
4642 | neighbor_disable_connected_check_cmd, | |
4643 | NEIGHBOR_CMD2 "disable-connected-check", | |
4644 | NEIGHBOR_STR | |
4645 | NEIGHBOR_ADDR_STR2 | |
4646 | "one-hop away EBGP peer using loopback address\n") | |
4647 | { | |
afec25d9 | 4648 | return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_DISABLE_CONNECTED_CHECK); |
6ffd2079 | 4649 | } |
4650 | ||
f412b39a DW |
4651 | /* |
4652 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
4653 | * NO_NEIGHBOR_CMD2 "enforce-multihop", | |
4654 | * NO_STR | |
4655 | * NEIGHBOR_STR | |
4656 | * NEIGHBOR_ADDR_STR2 | |
4657 | * "Enforce EBGP neighbors perform multihop\n" | |
4658 | * | |
4659 | */ | |
6ffd2079 | 4660 | DEFUN (no_neighbor_disable_connected_check, |
4661 | no_neighbor_disable_connected_check_cmd, | |
4662 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
4663 | NO_STR | |
4664 | NEIGHBOR_STR | |
4665 | NEIGHBOR_ADDR_STR2 | |
4666 | "one-hop away EBGP peer using loopback address\n") | |
4667 | { | |
afec25d9 | 4668 | return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_DISABLE_CONNECTED_CHECK); |
6ffd2079 | 4669 | } |
4670 | ||
718e3744 | 4671 | /* Enforce multihop. */ |
718e3744 | 4672 | |
6ffd2079 | 4673 | /* Enforce multihop. */ |
6b0655a2 | 4674 | |
718e3744 | 4675 | DEFUN (neighbor_description, |
4676 | neighbor_description_cmd, | |
4677 | NEIGHBOR_CMD2 "description .LINE", | |
4678 | NEIGHBOR_STR | |
4679 | NEIGHBOR_ADDR_STR2 | |
4680 | "Neighbor specific description\n" | |
4681 | "Up to 80 characters describing this neighbor\n") | |
4682 | { | |
4683 | struct peer *peer; | |
718e3744 | 4684 | char *str; |
718e3744 | 4685 | |
afec25d9 | 4686 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
718e3744 | 4687 | if (! peer) |
4688 | return CMD_WARNING; | |
4689 | ||
4690 | if (argc == 1) | |
4691 | return CMD_SUCCESS; | |
4692 | ||
3b8b1855 | 4693 | str = argv_concat(argv, argc, 1); |
718e3744 | 4694 | |
4695 | peer_description_set (peer, str); | |
4696 | ||
3b8b1855 | 4697 | XFREE (MTYPE_TMP, str); |
718e3744 | 4698 | |
4699 | return CMD_SUCCESS; | |
4700 | } | |
4701 | ||
f412b39a DW |
4702 | /* |
4703 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
4704 | * NO_NEIGHBOR_CMD2 "description .LINE", | |
4705 | * NO_STR | |
4706 | * NEIGHBOR_STR | |
4707 | * NEIGHBOR_ADDR_STR2 | |
4708 | * "Neighbor specific description\n" | |
4709 | * "Up to 80 characters describing this neighbor\n" | |
4710 | * | |
4711 | */ | |
718e3744 | 4712 | DEFUN (no_neighbor_description, |
4713 | no_neighbor_description_cmd, | |
4714 | NO_NEIGHBOR_CMD2 "description", | |
4715 | NO_STR | |
4716 | NEIGHBOR_STR | |
4717 | NEIGHBOR_ADDR_STR2 | |
4718 | "Neighbor specific description\n") | |
4719 | { | |
4720 | struct peer *peer; | |
4721 | ||
afec25d9 | 4722 | peer = peer_and_group_lookup_vty (vty, argv[2]->arg); |
718e3744 | 4723 | if (! peer) |
4724 | return CMD_WARNING; | |
4725 | ||
4726 | peer_description_unset (peer); | |
4727 | ||
4728 | return CMD_SUCCESS; | |
4729 | } | |
4730 | ||
6b0655a2 | 4731 | |
718e3744 | 4732 | /* Neighbor update-source. */ |
94f2b392 | 4733 | static int |
fd79ac91 | 4734 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
4735 | const char *source_str) | |
718e3744 | 4736 | { |
4737 | struct peer *peer; | |
718e3744 | 4738 | |
4739 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4740 | if (! peer) | |
4741 | return CMD_WARNING; | |
4742 | ||
a80beece DS |
4743 | if (peer->conf_if) |
4744 | return CMD_WARNING; | |
4745 | ||
718e3744 | 4746 | if (source_str) |
4747 | { | |
c63b83fe JBD |
4748 | union sockunion su; |
4749 | int ret = str2sockunion (source_str, &su); | |
4750 | ||
4751 | if (ret == 0) | |
4752 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 4753 | else |
4754 | peer_update_source_if_set (peer, source_str); | |
4755 | } | |
4756 | else | |
4757 | peer_update_source_unset (peer); | |
4758 | ||
4759 | return CMD_SUCCESS; | |
4760 | } | |
4761 | ||
dcb52bd5 DS |
4762 | #define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD" |
4763 | #define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")" | |
4764 | #define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}" | |
369688c0 PJ |
4765 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
4766 | "IPv4 address\n" \ | |
9a1a331d PJ |
4767 | "IPv6 address\n" \ |
4768 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 4769 | |
718e3744 | 4770 | DEFUN (neighbor_update_source, |
4771 | neighbor_update_source_cmd, | |
dcb52bd5 | 4772 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_REQ_STR, |
718e3744 | 4773 | NEIGHBOR_STR |
4774 | NEIGHBOR_ADDR_STR2 | |
4775 | "Source of routing updates\n" | |
369688c0 | 4776 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 4777 | { |
afec25d9 | 4778 | return peer_update_source_vty (vty, argv[1]->arg, argv[3]->arg); |
718e3744 | 4779 | } |
4780 | ||
4781 | DEFUN (no_neighbor_update_source, | |
4782 | no_neighbor_update_source_cmd, | |
dcb52bd5 | 4783 | NO_NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_OPT_STR, |
718e3744 | 4784 | NO_STR |
4785 | NEIGHBOR_STR | |
4786 | NEIGHBOR_ADDR_STR2 | |
dcb52bd5 DS |
4787 | "Source of routing updates\n" |
4788 | BGP_UPDATE_SOURCE_HELP_STR) | |
718e3744 | 4789 | { |
afec25d9 | 4790 | return peer_update_source_vty (vty, argv[2]->arg, NULL); |
718e3744 | 4791 | } |
6b0655a2 | 4792 | |
94f2b392 | 4793 | static int |
fd79ac91 | 4794 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
4795 | afi_t afi, safi_t safi, | |
4796 | const char *rmap, int set) | |
718e3744 | 4797 | { |
4798 | int ret; | |
4799 | struct peer *peer; | |
4800 | ||
4801 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4802 | if (! peer) | |
4803 | return CMD_WARNING; | |
4804 | ||
4805 | if (set) | |
4806 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
4807 | else | |
4808 | ret = peer_default_originate_unset (peer, afi, safi); | |
4809 | ||
4810 | return bgp_vty_return (vty, ret); | |
4811 | } | |
4812 | ||
4813 | /* neighbor default-originate. */ | |
4814 | DEFUN (neighbor_default_originate, | |
4815 | neighbor_default_originate_cmd, | |
4816 | NEIGHBOR_CMD2 "default-originate", | |
4817 | NEIGHBOR_STR | |
4818 | NEIGHBOR_ADDR_STR2 | |
4819 | "Originate default route to this neighbor\n") | |
4820 | { | |
afec25d9 | 4821 | return peer_default_originate_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
718e3744 | 4822 | bgp_node_safi (vty), NULL, 1); |
4823 | } | |
4824 | ||
4825 | DEFUN (neighbor_default_originate_rmap, | |
4826 | neighbor_default_originate_rmap_cmd, | |
4827 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4828 | NEIGHBOR_STR | |
4829 | NEIGHBOR_ADDR_STR2 | |
4830 | "Originate default route to this neighbor\n" | |
4831 | "Route-map to specify criteria to originate default\n" | |
4832 | "route-map name\n") | |
4833 | { | |
afec25d9 DW |
4834 | return peer_default_originate_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
4835 | bgp_node_safi (vty), argv[4]->arg, 1); | |
718e3744 | 4836 | } |
4837 | ||
f412b39a DW |
4838 | /* |
4839 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
4840 | * NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4841 | * NO_STR | |
4842 | * NEIGHBOR_STR | |
4843 | * NEIGHBOR_ADDR_STR2 | |
4844 | * "Originate default route to this neighbor\n" | |
4845 | * "Route-map to specify criteria to originate default\n" | |
4846 | * "route-map name\n" | |
4847 | * | |
4848 | */ | |
718e3744 | 4849 | DEFUN (no_neighbor_default_originate, |
4850 | no_neighbor_default_originate_cmd, | |
4851 | NO_NEIGHBOR_CMD2 "default-originate", | |
4852 | NO_STR | |
4853 | NEIGHBOR_STR | |
4854 | NEIGHBOR_ADDR_STR2 | |
4855 | "Originate default route to this neighbor\n") | |
4856 | { | |
afec25d9 | 4857 | return peer_default_originate_set_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 4858 | bgp_node_safi (vty), NULL, 0); |
4859 | } | |
4860 | ||
6b0655a2 | 4861 | |
718e3744 | 4862 | /* Set neighbor's BGP port. */ |
94f2b392 | 4863 | static int |
fd79ac91 | 4864 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
4865 | const char *port_str) | |
718e3744 | 4866 | { |
4867 | struct peer *peer; | |
4868 | u_int16_t port; | |
4869 | struct servent *sp; | |
4870 | ||
4871 | peer = peer_lookup_vty (vty, ip_str); | |
4872 | if (! peer) | |
4873 | return CMD_WARNING; | |
4874 | ||
4875 | if (! port_str) | |
4876 | { | |
4877 | sp = getservbyname ("bgp", "tcp"); | |
4878 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
4879 | } | |
4880 | else | |
4881 | { | |
4882 | VTY_GET_INTEGER("port", port, port_str); | |
4883 | } | |
4884 | ||
4885 | peer_port_set (peer, port); | |
4886 | ||
4887 | return CMD_SUCCESS; | |
4888 | } | |
4889 | ||
f418446b | 4890 | /* Set specified peer's BGP port. */ |
718e3744 | 4891 | DEFUN (neighbor_port, |
4892 | neighbor_port_cmd, | |
4893 | NEIGHBOR_CMD "port <0-65535>", | |
4894 | NEIGHBOR_STR | |
4895 | NEIGHBOR_ADDR_STR | |
4896 | "Neighbor's BGP port\n" | |
4897 | "TCP port number\n") | |
4898 | { | |
afec25d9 | 4899 | return peer_port_vty (vty, argv[1]->arg, AFI_IP, argv[3]->arg); |
718e3744 | 4900 | } |
4901 | ||
f412b39a DW |
4902 | /* |
4903 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
4904 | * NO_NEIGHBOR_CMD "port <0-65535>", | |
4905 | * NO_STR | |
4906 | * NEIGHBOR_STR | |
4907 | * NEIGHBOR_ADDR_STR | |
4908 | * "Neighbor's BGP port\n" | |
4909 | * "TCP port number\n" | |
4910 | * | |
4911 | */ | |
718e3744 | 4912 | DEFUN (no_neighbor_port, |
4913 | no_neighbor_port_cmd, | |
4914 | NO_NEIGHBOR_CMD "port", | |
4915 | NO_STR | |
4916 | NEIGHBOR_STR | |
4917 | NEIGHBOR_ADDR_STR | |
4918 | "Neighbor's BGP port\n") | |
4919 | { | |
afec25d9 | 4920 | return peer_port_vty (vty, argv[2]->arg, AFI_IP, NULL); |
718e3744 | 4921 | } |
4922 | ||
6b0655a2 | 4923 | |
718e3744 | 4924 | /* neighbor weight. */ |
94f2b392 | 4925 | static int |
fd79ac91 | 4926 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
4927 | const char *weight_str) | |
718e3744 | 4928 | { |
1f9a9fff | 4929 | int ret; |
718e3744 | 4930 | struct peer *peer; |
4931 | unsigned long weight; | |
4932 | ||
4933 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4934 | if (! peer) | |
4935 | return CMD_WARNING; | |
4936 | ||
4937 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
4938 | ||
1f9a9fff PJ |
4939 | ret = peer_weight_set (peer, weight); |
4940 | return bgp_vty_return (vty, ret); | |
718e3744 | 4941 | } |
4942 | ||
94f2b392 | 4943 | static int |
fd79ac91 | 4944 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4945 | { |
1f9a9fff | 4946 | int ret; |
718e3744 | 4947 | struct peer *peer; |
4948 | ||
4949 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4950 | if (! peer) | |
4951 | return CMD_WARNING; | |
4952 | ||
1f9a9fff PJ |
4953 | ret = peer_weight_unset (peer); |
4954 | return bgp_vty_return (vty, ret); | |
718e3744 | 4955 | } |
4956 | ||
4957 | DEFUN (neighbor_weight, | |
4958 | neighbor_weight_cmd, | |
4959 | NEIGHBOR_CMD2 "weight <0-65535>", | |
4960 | NEIGHBOR_STR | |
4961 | NEIGHBOR_ADDR_STR2 | |
4962 | "Set default weight for routes from this neighbor\n" | |
4963 | "default weight\n") | |
4964 | { | |
afec25d9 | 4965 | return peer_weight_set_vty (vty, argv[1]->arg, argv[3]->arg); |
718e3744 | 4966 | } |
4967 | ||
f412b39a DW |
4968 | /* |
4969 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
4970 | * NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
4971 | * NO_STR | |
4972 | * NEIGHBOR_STR | |
4973 | * NEIGHBOR_ADDR_STR2 | |
4974 | * "Set default weight for routes from this neighbor\n" | |
4975 | * "default weight\n" | |
4976 | * | |
4977 | */ | |
718e3744 | 4978 | DEFUN (no_neighbor_weight, |
4979 | no_neighbor_weight_cmd, | |
4980 | NO_NEIGHBOR_CMD2 "weight", | |
4981 | NO_STR | |
4982 | NEIGHBOR_STR | |
4983 | NEIGHBOR_ADDR_STR2 | |
4984 | "Set default weight for routes from this neighbor\n") | |
4985 | { | |
afec25d9 | 4986 | return peer_weight_unset_vty (vty, argv[2]->arg); |
718e3744 | 4987 | } |
4988 | ||
6b0655a2 | 4989 | |
718e3744 | 4990 | /* Override capability negotiation. */ |
4991 | DEFUN (neighbor_override_capability, | |
4992 | neighbor_override_capability_cmd, | |
4993 | NEIGHBOR_CMD2 "override-capability", | |
4994 | NEIGHBOR_STR | |
4995 | NEIGHBOR_ADDR_STR2 | |
4996 | "Override capability negotiation result\n") | |
4997 | { | |
afec25d9 | 4998 | return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_OVERRIDE_CAPABILITY); |
718e3744 | 4999 | } |
5000 | ||
5001 | DEFUN (no_neighbor_override_capability, | |
5002 | no_neighbor_override_capability_cmd, | |
5003 | NO_NEIGHBOR_CMD2 "override-capability", | |
5004 | NO_STR | |
5005 | NEIGHBOR_STR | |
5006 | NEIGHBOR_ADDR_STR2 | |
5007 | "Override capability negotiation result\n") | |
5008 | { | |
afec25d9 | 5009 | return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_OVERRIDE_CAPABILITY); |
718e3744 | 5010 | } |
6b0655a2 | 5011 | |
718e3744 | 5012 | DEFUN (neighbor_strict_capability, |
5013 | neighbor_strict_capability_cmd, | |
5014 | NEIGHBOR_CMD "strict-capability-match", | |
5015 | NEIGHBOR_STR | |
5016 | NEIGHBOR_ADDR_STR | |
5017 | "Strict capability negotiation match\n") | |
5018 | { | |
afec25d9 | 5019 | return peer_flag_set_vty (vty, argv[1]->arg, PEER_FLAG_STRICT_CAP_MATCH); |
718e3744 | 5020 | } |
5021 | ||
5022 | DEFUN (no_neighbor_strict_capability, | |
5023 | no_neighbor_strict_capability_cmd, | |
5024 | NO_NEIGHBOR_CMD "strict-capability-match", | |
5025 | NO_STR | |
5026 | NEIGHBOR_STR | |
5027 | NEIGHBOR_ADDR_STR | |
5028 | "Strict capability negotiation match\n") | |
5029 | { | |
afec25d9 | 5030 | return peer_flag_unset_vty (vty, argv[2]->arg, PEER_FLAG_STRICT_CAP_MATCH); |
718e3744 | 5031 | } |
6b0655a2 | 5032 | |
94f2b392 | 5033 | static int |
fd79ac91 | 5034 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
5035 | const char *keep_str, const char *hold_str) | |
718e3744 | 5036 | { |
5037 | int ret; | |
5038 | struct peer *peer; | |
5039 | u_int32_t keepalive; | |
5040 | u_int32_t holdtime; | |
5041 | ||
5042 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5043 | if (! peer) | |
5044 | return CMD_WARNING; | |
5045 | ||
5046 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
5047 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
5048 | ||
5049 | ret = peer_timers_set (peer, keepalive, holdtime); | |
5050 | ||
5051 | return bgp_vty_return (vty, ret); | |
5052 | } | |
6b0655a2 | 5053 | |
94f2b392 | 5054 | static int |
fd79ac91 | 5055 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 5056 | { |
5057 | int ret; | |
5058 | struct peer *peer; | |
5059 | ||
0c412461 | 5060 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 5061 | if (! peer) |
5062 | return CMD_WARNING; | |
5063 | ||
5064 | ret = peer_timers_unset (peer); | |
5065 | ||
5066 | return bgp_vty_return (vty, ret); | |
5067 | } | |
5068 | ||
5069 | DEFUN (neighbor_timers, | |
5070 | neighbor_timers_cmd, | |
5071 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
5072 | NEIGHBOR_STR | |
5073 | NEIGHBOR_ADDR_STR2 | |
5074 | "BGP per neighbor timers\n" | |
5075 | "Keepalive interval\n" | |
5076 | "Holdtime\n") | |
5077 | { | |
afec25d9 | 5078 | return peer_timers_set_vty (vty, argv[1]->arg, argv[3]->arg, argv[4]->arg); |
718e3744 | 5079 | } |
5080 | ||
f412b39a DW |
5081 | /* |
5082 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
5083 | * NO_NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
5084 | * NO_STR | |
5085 | * NEIGHBOR_STR | |
5086 | * NEIGHBOR_ADDR_STR2 | |
5087 | * "BGP per neighbor timers\n" | |
5088 | * "Keepalive interval\n" | |
5089 | * "Holdtime\n" | |
5090 | * | |
5091 | */ | |
718e3744 | 5092 | DEFUN (no_neighbor_timers, |
5093 | no_neighbor_timers_cmd, | |
5094 | NO_NEIGHBOR_CMD2 "timers", | |
5095 | NO_STR | |
5096 | NEIGHBOR_STR | |
5097 | NEIGHBOR_ADDR_STR2 | |
5098 | "BGP per neighbor timers\n") | |
5099 | { | |
afec25d9 | 5100 | return peer_timers_unset_vty (vty, argv[2]->arg); |
718e3744 | 5101 | } |
6b0655a2 | 5102 | |
813d4307 | 5103 | |
94f2b392 | 5104 | static int |
fd79ac91 | 5105 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
5106 | const char *time_str) | |
718e3744 | 5107 | { |
5108 | int ret; | |
5109 | struct peer *peer; | |
5110 | u_int32_t connect; | |
5111 | ||
966f821c | 5112 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 5113 | if (! peer) |
5114 | return CMD_WARNING; | |
5115 | ||
5116 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
5117 | ||
5118 | ret = peer_timers_connect_set (peer, connect); | |
5119 | ||
966f821c | 5120 | return bgp_vty_return (vty, ret); |
718e3744 | 5121 | } |
5122 | ||
94f2b392 | 5123 | static int |
fd79ac91 | 5124 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 5125 | { |
5126 | int ret; | |
5127 | struct peer *peer; | |
5128 | ||
5129 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5130 | if (! peer) | |
5131 | return CMD_WARNING; | |
5132 | ||
5133 | ret = peer_timers_connect_unset (peer); | |
5134 | ||
966f821c | 5135 | return bgp_vty_return (vty, ret); |
718e3744 | 5136 | } |
5137 | ||
5138 | DEFUN (neighbor_timers_connect, | |
5139 | neighbor_timers_connect_cmd, | |
8e0d0089 | 5140 | NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 5141 | NEIGHBOR_STR |
966f821c | 5142 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5143 | "BGP per neighbor timers\n" |
5144 | "BGP connect timer\n" | |
5145 | "Connect timer\n") | |
5146 | { | |
afec25d9 | 5147 | return peer_timers_connect_set_vty (vty, argv[1]->arg, argv[4]->arg); |
718e3744 | 5148 | } |
5149 | ||
f412b39a DW |
5150 | /* |
5151 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
5152 | * NO_NEIGHBOR_CMD2 "timers connect <1-65535>", | |
5153 | * NO_STR | |
5154 | * NEIGHBOR_STR | |
5155 | * NEIGHBOR_ADDR_STR2 | |
5156 | * "BGP per neighbor timers\n" | |
5157 | * "BGP connect timer\n" | |
5158 | * "Connect timer\n" | |
5159 | * | |
5160 | */ | |
718e3744 | 5161 | DEFUN (no_neighbor_timers_connect, |
5162 | no_neighbor_timers_connect_cmd, | |
966f821c | 5163 | NO_NEIGHBOR_CMD2 "timers connect", |
718e3744 | 5164 | NO_STR |
5165 | NEIGHBOR_STR | |
966f821c | 5166 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5167 | "BGP per neighbor timers\n" |
5168 | "BGP connect timer\n") | |
5169 | { | |
afec25d9 | 5170 | return peer_timers_connect_unset_vty (vty, argv[2]->arg); |
718e3744 | 5171 | } |
5172 | ||
6b0655a2 | 5173 | |
94f2b392 | 5174 | static int |
fd79ac91 | 5175 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
5176 | const char *time_str, int set) | |
718e3744 | 5177 | { |
5178 | int ret; | |
5179 | struct peer *peer; | |
5180 | u_int32_t routeadv = 0; | |
5181 | ||
966f821c | 5182 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 5183 | if (! peer) |
5184 | return CMD_WARNING; | |
5185 | ||
5186 | if (time_str) | |
5187 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
5188 | ||
5189 | if (set) | |
5190 | ret = peer_advertise_interval_set (peer, routeadv); | |
5191 | else | |
5192 | ret = peer_advertise_interval_unset (peer); | |
5193 | ||
966f821c | 5194 | return bgp_vty_return (vty, ret); |
718e3744 | 5195 | } |
5196 | ||
5197 | DEFUN (neighbor_advertise_interval, | |
5198 | neighbor_advertise_interval_cmd, | |
966f821c | 5199 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 5200 | NEIGHBOR_STR |
966f821c | 5201 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5202 | "Minimum interval between sending BGP routing updates\n" |
5203 | "time in seconds\n") | |
5204 | { | |
afec25d9 | 5205 | return peer_advertise_interval_vty (vty, argv[1]->arg, argv[3]->arg, 1); |
718e3744 | 5206 | } |
5207 | ||
f412b39a DW |
5208 | /* |
5209 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
5210 | * NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", | |
5211 | * NO_STR | |
5212 | * NEIGHBOR_STR | |
5213 | * NEIGHBOR_ADDR_STR2 | |
5214 | * "Minimum interval between sending BGP routing updates\n" | |
5215 | * "time in seconds\n" | |
5216 | * | |
5217 | */ | |
718e3744 | 5218 | DEFUN (no_neighbor_advertise_interval, |
5219 | no_neighbor_advertise_interval_cmd, | |
966f821c | 5220 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
718e3744 | 5221 | NO_STR |
5222 | NEIGHBOR_STR | |
966f821c | 5223 | NEIGHBOR_ADDR_STR2 |
718e3744 | 5224 | "Minimum interval between sending BGP routing updates\n") |
5225 | { | |
afec25d9 | 5226 | return peer_advertise_interval_vty (vty, argv[2]->arg, NULL, 0); |
718e3744 | 5227 | } |
5228 | ||
6b0655a2 | 5229 | |
518f0eb1 DS |
5230 | /* Time to wait before processing route-map updates */ |
5231 | DEFUN (bgp_set_route_map_delay_timer, | |
5232 | bgp_set_route_map_delay_timer_cmd, | |
5233 | "bgp route-map delay-timer <0-600>", | |
5234 | SET_STR | |
5235 | "BGP route-map delay timer\n" | |
5236 | "Time in secs to wait before processing route-map changes\n" | |
f414725f | 5237 | "0 disables the timer, no route updates happen when route-maps change\n") |
518f0eb1 DS |
5238 | { |
5239 | u_int32_t rmap_delay_timer; | |
518f0eb1 | 5240 | |
afec25d9 | 5241 | if (argv[3]->arg) |
518f0eb1 | 5242 | { |
afec25d9 | 5243 | VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[3]->arg, 0, 600); |
5fe9f963 | 5244 | bm->rmap_update_timer = rmap_delay_timer; |
518f0eb1 DS |
5245 | |
5246 | /* if the dynamic update handling is being disabled, and a timer is | |
5247 | * running, stop the timer and act as if the timer has already fired. | |
5248 | */ | |
5fe9f963 | 5249 | if (!rmap_delay_timer && bm->t_rmap_update ) |
518f0eb1 | 5250 | { |
5fe9f963 | 5251 | BGP_TIMER_OFF(bm->t_rmap_update); |
5252 | thread_execute (bm->master, bgp_route_map_update_timer, NULL, 0); | |
518f0eb1 DS |
5253 | } |
5254 | return CMD_SUCCESS; | |
5255 | } | |
5256 | else | |
ffd0c037 | 5257 | return CMD_WARNING; |
518f0eb1 DS |
5258 | } |
5259 | ||
f412b39a DW |
5260 | /* |
5261 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
5262 | * "no bgp route-map delay-timer <0-600>", | |
5263 | * NO_STR | |
5264 | * "Default BGP route-map delay timer\n" | |
5265 | * "Reset to default time to wait for processing route-map changes\n" | |
5266 | * "0 disables the timer, no route updates happen when route-maps change\n" | |
5267 | * | |
5268 | */ | |
518f0eb1 DS |
5269 | DEFUN (no_bgp_set_route_map_delay_timer, |
5270 | no_bgp_set_route_map_delay_timer_cmd, | |
5271 | "no bgp route-map delay-timer", | |
5272 | NO_STR | |
5273 | "Default BGP route-map delay timer\n" | |
f414725f | 5274 | "Reset to default time to wait for processing route-map changes\n") |
518f0eb1 | 5275 | { |
518f0eb1 | 5276 | |
5fe9f963 | 5277 | bm->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER; |
518f0eb1 DS |
5278 | |
5279 | return CMD_SUCCESS; | |
5280 | } | |
5281 | ||
f414725f | 5282 | |
718e3744 | 5283 | /* neighbor interface */ |
94f2b392 | 5284 | static int |
fd79ac91 | 5285 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 5286 | { |
718e3744 | 5287 | struct peer *peer; |
5288 | ||
5289 | peer = peer_lookup_vty (vty, ip_str); | |
a80beece | 5290 | if (! peer || peer->conf_if) |
718e3744 | 5291 | return CMD_WARNING; |
5292 | ||
5293 | if (str) | |
ffd0c037 | 5294 | peer_interface_set (peer, str); |
718e3744 | 5295 | else |
ffd0c037 | 5296 | peer_interface_unset (peer); |
718e3744 | 5297 | |
5298 | return CMD_SUCCESS; | |
5299 | } | |
5300 | ||
5301 | DEFUN (neighbor_interface, | |
5302 | neighbor_interface_cmd, | |
5303 | NEIGHBOR_CMD "interface WORD", | |
5304 | NEIGHBOR_STR | |
5305 | NEIGHBOR_ADDR_STR | |
5306 | "Interface\n" | |
5307 | "Interface name\n") | |
5308 | { | |
8ffedcea | 5309 | if (argc == 3) |
afec25d9 | 5310 | return peer_interface_vty (vty, argv[1]->arg, argv[3]->arg); |
8ffedcea | 5311 | else |
afec25d9 | 5312 | return peer_interface_vty (vty, argv[1]->arg, argv[3]->arg); |
718e3744 | 5313 | } |
5314 | ||
5315 | DEFUN (no_neighbor_interface, | |
5316 | no_neighbor_interface_cmd, | |
8ffedcea | 5317 | NO_NEIGHBOR_CMD2 "interface WORD", |
718e3744 | 5318 | NO_STR |
5319 | NEIGHBOR_STR | |
5320 | NEIGHBOR_ADDR_STR | |
5321 | "Interface\n" | |
5322 | "Interface name\n") | |
5323 | { | |
afec25d9 | 5324 | return peer_interface_vty (vty, argv[2]->arg, NULL); |
718e3744 | 5325 | } |
6b0655a2 | 5326 | |
718e3744 | 5327 | /* Set distribute list to the peer. */ |
94f2b392 | 5328 | static int |
fd79ac91 | 5329 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
5330 | afi_t afi, safi_t safi, | |
5331 | const char *name_str, const char *direct_str) | |
718e3744 | 5332 | { |
5333 | int ret; | |
5334 | struct peer *peer; | |
5335 | int direct = FILTER_IN; | |
5336 | ||
5337 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5338 | if (! peer) | |
5339 | return CMD_WARNING; | |
5340 | ||
5341 | /* Check filter direction. */ | |
5342 | if (strncmp (direct_str, "i", 1) == 0) | |
5343 | direct = FILTER_IN; | |
5344 | else if (strncmp (direct_str, "o", 1) == 0) | |
5345 | direct = FILTER_OUT; | |
5346 | ||
5347 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
5348 | ||
5349 | return bgp_vty_return (vty, ret); | |
5350 | } | |
5351 | ||
94f2b392 | 5352 | static int |
fd79ac91 | 5353 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5354 | safi_t safi, const char *direct_str) | |
718e3744 | 5355 | { |
5356 | int ret; | |
5357 | struct peer *peer; | |
5358 | int direct = FILTER_IN; | |
5359 | ||
5360 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5361 | if (! peer) | |
5362 | return CMD_WARNING; | |
5363 | ||
5364 | /* Check filter direction. */ | |
5365 | if (strncmp (direct_str, "i", 1) == 0) | |
5366 | direct = FILTER_IN; | |
5367 | else if (strncmp (direct_str, "o", 1) == 0) | |
5368 | direct = FILTER_OUT; | |
5369 | ||
5370 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
5371 | ||
5372 | return bgp_vty_return (vty, ret); | |
5373 | } | |
5374 | ||
5375 | DEFUN (neighbor_distribute_list, | |
5376 | neighbor_distribute_list_cmd, | |
5377 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5378 | NEIGHBOR_STR | |
5379 | NEIGHBOR_ADDR_STR2 | |
5380 | "Filter updates to/from this neighbor\n" | |
5381 | "IP access-list number\n" | |
5382 | "IP access-list number (expanded range)\n" | |
5383 | "IP Access-list name\n" | |
5384 | "Filter incoming updates\n" | |
5385 | "Filter outgoing updates\n") | |
5386 | { | |
afec25d9 DW |
5387 | return peer_distribute_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5388 | bgp_node_safi (vty), argv[3]->arg, argv[4]->arg); | |
718e3744 | 5389 | } |
5390 | ||
5391 | DEFUN (no_neighbor_distribute_list, | |
5392 | no_neighbor_distribute_list_cmd, | |
5393 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5394 | NO_STR | |
5395 | NEIGHBOR_STR | |
5396 | NEIGHBOR_ADDR_STR2 | |
5397 | "Filter updates to/from this neighbor\n" | |
5398 | "IP access-list number\n" | |
5399 | "IP access-list number (expanded range)\n" | |
5400 | "IP Access-list name\n" | |
5401 | "Filter incoming updates\n" | |
5402 | "Filter outgoing updates\n") | |
5403 | { | |
afec25d9 DW |
5404 | return peer_distribute_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
5405 | bgp_node_safi (vty), argv[5]->arg); | |
718e3744 | 5406 | } |
6b0655a2 | 5407 | |
718e3744 | 5408 | /* Set prefix list to the peer. */ |
94f2b392 | 5409 | static int |
fd79ac91 | 5410 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5411 | safi_t safi, const char *name_str, | |
5412 | const char *direct_str) | |
718e3744 | 5413 | { |
5414 | int ret; | |
5415 | struct peer *peer; | |
5416 | int direct = FILTER_IN; | |
5417 | ||
5418 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5419 | if (! peer) | |
5420 | return CMD_WARNING; | |
5421 | ||
5422 | /* Check filter direction. */ | |
5423 | if (strncmp (direct_str, "i", 1) == 0) | |
5424 | direct = FILTER_IN; | |
5425 | else if (strncmp (direct_str, "o", 1) == 0) | |
5426 | direct = FILTER_OUT; | |
5427 | ||
5428 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
5429 | ||
5430 | return bgp_vty_return (vty, ret); | |
5431 | } | |
5432 | ||
94f2b392 | 5433 | static int |
fd79ac91 | 5434 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5435 | safi_t safi, const char *direct_str) | |
718e3744 | 5436 | { |
5437 | int ret; | |
5438 | struct peer *peer; | |
5439 | int direct = FILTER_IN; | |
5440 | ||
5441 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5442 | if (! peer) | |
5443 | return CMD_WARNING; | |
5444 | ||
5445 | /* Check filter direction. */ | |
5446 | if (strncmp (direct_str, "i", 1) == 0) | |
5447 | direct = FILTER_IN; | |
5448 | else if (strncmp (direct_str, "o", 1) == 0) | |
5449 | direct = FILTER_OUT; | |
5450 | ||
5451 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
5452 | ||
5453 | return bgp_vty_return (vty, ret); | |
5454 | } | |
5455 | ||
5456 | DEFUN (neighbor_prefix_list, | |
5457 | neighbor_prefix_list_cmd, | |
5458 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5459 | NEIGHBOR_STR | |
5460 | NEIGHBOR_ADDR_STR2 | |
5461 | "Filter updates to/from this neighbor\n" | |
5462 | "Name of a prefix list\n" | |
5463 | "Filter incoming updates\n" | |
5464 | "Filter outgoing updates\n") | |
5465 | { | |
afec25d9 DW |
5466 | return peer_prefix_list_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5467 | bgp_node_safi (vty), argv[3]->arg, argv[4]->arg); | |
718e3744 | 5468 | } |
5469 | ||
5470 | DEFUN (no_neighbor_prefix_list, | |
5471 | no_neighbor_prefix_list_cmd, | |
5472 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5473 | NO_STR | |
5474 | NEIGHBOR_STR | |
5475 | NEIGHBOR_ADDR_STR2 | |
5476 | "Filter updates to/from this neighbor\n" | |
5477 | "Name of a prefix list\n" | |
5478 | "Filter incoming updates\n" | |
5479 | "Filter outgoing updates\n") | |
5480 | { | |
afec25d9 DW |
5481 | return peer_prefix_list_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
5482 | bgp_node_safi (vty), argv[5]->arg); | |
718e3744 | 5483 | } |
6b0655a2 | 5484 | |
94f2b392 | 5485 | static int |
fd79ac91 | 5486 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
5487 | afi_t afi, safi_t safi, | |
5488 | const char *name_str, const char *direct_str) | |
718e3744 | 5489 | { |
5490 | int ret; | |
5491 | struct peer *peer; | |
5492 | int direct = FILTER_IN; | |
5493 | ||
5494 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5495 | if (! peer) | |
5496 | return CMD_WARNING; | |
5497 | ||
5498 | /* Check filter direction. */ | |
5499 | if (strncmp (direct_str, "i", 1) == 0) | |
5500 | direct = FILTER_IN; | |
5501 | else if (strncmp (direct_str, "o", 1) == 0) | |
5502 | direct = FILTER_OUT; | |
5503 | ||
5504 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
5505 | ||
5506 | return bgp_vty_return (vty, ret); | |
5507 | } | |
5508 | ||
94f2b392 | 5509 | static int |
fd79ac91 | 5510 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
5511 | afi_t afi, safi_t safi, | |
5512 | const char *direct_str) | |
718e3744 | 5513 | { |
5514 | int ret; | |
5515 | struct peer *peer; | |
5516 | int direct = FILTER_IN; | |
5517 | ||
5518 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5519 | if (! peer) | |
5520 | return CMD_WARNING; | |
5521 | ||
5522 | /* Check filter direction. */ | |
5523 | if (strncmp (direct_str, "i", 1) == 0) | |
5524 | direct = FILTER_IN; | |
5525 | else if (strncmp (direct_str, "o", 1) == 0) | |
5526 | direct = FILTER_OUT; | |
5527 | ||
5528 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
5529 | ||
5530 | return bgp_vty_return (vty, ret); | |
5531 | } | |
5532 | ||
5533 | DEFUN (neighbor_filter_list, | |
5534 | neighbor_filter_list_cmd, | |
5535 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5536 | NEIGHBOR_STR | |
5537 | NEIGHBOR_ADDR_STR2 | |
5538 | "Establish BGP filters\n" | |
5539 | "AS path access-list name\n" | |
5540 | "Filter incoming routes\n" | |
5541 | "Filter outgoing routes\n") | |
5542 | { | |
afec25d9 DW |
5543 | return peer_aslist_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5544 | bgp_node_safi (vty), argv[3]->arg, argv[4]->arg); | |
718e3744 | 5545 | } |
5546 | ||
5547 | DEFUN (no_neighbor_filter_list, | |
5548 | no_neighbor_filter_list_cmd, | |
5549 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5550 | NO_STR | |
5551 | NEIGHBOR_STR | |
5552 | NEIGHBOR_ADDR_STR2 | |
5553 | "Establish BGP filters\n" | |
5554 | "AS path access-list name\n" | |
5555 | "Filter incoming routes\n" | |
5556 | "Filter outgoing routes\n") | |
5557 | { | |
afec25d9 DW |
5558 | return peer_aslist_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
5559 | bgp_node_safi (vty), argv[5]->arg); | |
718e3744 | 5560 | } |
6b0655a2 | 5561 | |
718e3744 | 5562 | /* Set route-map to the peer. */ |
94f2b392 | 5563 | static int |
fd79ac91 | 5564 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
5565 | afi_t afi, safi_t safi, | |
5566 | const char *name_str, const char *direct_str) | |
718e3744 | 5567 | { |
5568 | int ret; | |
5569 | struct peer *peer; | |
fee0f4c6 | 5570 | int direct = RMAP_IN; |
718e3744 | 5571 | |
5572 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5573 | if (! peer) | |
5574 | return CMD_WARNING; | |
5575 | ||
5576 | /* Check filter direction. */ | |
fee0f4c6 | 5577 | if (strncmp (direct_str, "in", 2) == 0) |
5578 | direct = RMAP_IN; | |
718e3744 | 5579 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5580 | direct = RMAP_OUT; |
718e3744 | 5581 | |
5582 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
5583 | ||
5584 | return bgp_vty_return (vty, ret); | |
5585 | } | |
5586 | ||
94f2b392 | 5587 | static int |
fd79ac91 | 5588 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5589 | safi_t safi, const char *direct_str) | |
718e3744 | 5590 | { |
5591 | int ret; | |
5592 | struct peer *peer; | |
fee0f4c6 | 5593 | int direct = RMAP_IN; |
718e3744 | 5594 | |
5595 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5596 | if (! peer) | |
5597 | return CMD_WARNING; | |
5598 | ||
5599 | /* Check filter direction. */ | |
fee0f4c6 | 5600 | if (strncmp (direct_str, "in", 2) == 0) |
5601 | direct = RMAP_IN; | |
718e3744 | 5602 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5603 | direct = RMAP_OUT; |
718e3744 | 5604 | |
5605 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
5606 | ||
5607 | return bgp_vty_return (vty, ret); | |
5608 | } | |
5609 | ||
5610 | DEFUN (neighbor_route_map, | |
5611 | neighbor_route_map_cmd, | |
2a3d5731 | 5612 | NEIGHBOR_CMD2 "route-map WORD (in|out)", |
718e3744 | 5613 | NEIGHBOR_STR |
5614 | NEIGHBOR_ADDR_STR2 | |
5615 | "Apply route map to neighbor\n" | |
5616 | "Name of route map\n" | |
5617 | "Apply map to incoming routes\n" | |
2a3d5731 | 5618 | "Apply map to outbound routes\n") |
718e3744 | 5619 | { |
afec25d9 DW |
5620 | return peer_route_map_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5621 | bgp_node_safi (vty), argv[3]->arg, argv[4]->arg); | |
718e3744 | 5622 | } |
5623 | ||
5624 | DEFUN (no_neighbor_route_map, | |
5625 | no_neighbor_route_map_cmd, | |
2a3d5731 | 5626 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out)", |
718e3744 | 5627 | NO_STR |
5628 | NEIGHBOR_STR | |
5629 | NEIGHBOR_ADDR_STR2 | |
5630 | "Apply route map to neighbor\n" | |
5631 | "Name of route map\n" | |
5632 | "Apply map to incoming routes\n" | |
2a3d5731 | 5633 | "Apply map to outbound routes\n") |
718e3744 | 5634 | { |
afec25d9 DW |
5635 | return peer_route_map_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
5636 | bgp_node_safi (vty), argv[5]->arg); | |
718e3744 | 5637 | } |
6b0655a2 | 5638 | |
718e3744 | 5639 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 5640 | static int |
fd79ac91 | 5641 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5642 | safi_t safi, const char *name_str) | |
718e3744 | 5643 | { |
5644 | int ret; | |
5645 | struct peer *peer; | |
5646 | ||
5647 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5648 | if (! peer) | |
5649 | return CMD_WARNING; | |
5650 | ||
5651 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
5652 | ||
5653 | return bgp_vty_return (vty, ret); | |
5654 | } | |
5655 | ||
5656 | /* Unset route-map from the peer. */ | |
94f2b392 | 5657 | static int |
fd79ac91 | 5658 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5659 | safi_t safi) |
5660 | { | |
5661 | int ret; | |
5662 | struct peer *peer; | |
5663 | ||
5664 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5665 | if (! peer) | |
5666 | return CMD_WARNING; | |
5667 | ||
5668 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
5669 | ||
5670 | return bgp_vty_return (vty, ret); | |
5671 | } | |
5672 | ||
5673 | DEFUN (neighbor_unsuppress_map, | |
5674 | neighbor_unsuppress_map_cmd, | |
5675 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5676 | NEIGHBOR_STR | |
5677 | NEIGHBOR_ADDR_STR2 | |
5678 | "Route-map to selectively unsuppress suppressed routes\n" | |
5679 | "Name of route map\n") | |
5680 | { | |
afec25d9 DW |
5681 | return peer_unsuppress_map_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5682 | bgp_node_safi (vty), argv[3]->arg); | |
718e3744 | 5683 | } |
5684 | ||
5685 | DEFUN (no_neighbor_unsuppress_map, | |
5686 | no_neighbor_unsuppress_map_cmd, | |
5687 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5688 | NO_STR | |
5689 | NEIGHBOR_STR | |
5690 | NEIGHBOR_ADDR_STR2 | |
5691 | "Route-map to selectively unsuppress suppressed routes\n" | |
5692 | "Name of route map\n") | |
5693 | { | |
afec25d9 | 5694 | return peer_unsuppress_map_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 5695 | bgp_node_safi (vty)); |
5696 | } | |
6b0655a2 | 5697 | |
94f2b392 | 5698 | static int |
fd79ac91 | 5699 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5700 | safi_t safi, const char *num_str, | |
0a486e5f | 5701 | const char *threshold_str, int warning, |
5702 | const char *restart_str) | |
718e3744 | 5703 | { |
5704 | int ret; | |
5705 | struct peer *peer; | |
5706 | u_int32_t max; | |
e0701b79 | 5707 | u_char threshold; |
0a486e5f | 5708 | u_int16_t restart; |
718e3744 | 5709 | |
5710 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5711 | if (! peer) | |
5712 | return CMD_WARNING; | |
5713 | ||
e6ec1c36 | 5714 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 5715 | if (threshold_str) |
5716 | threshold = atoi (threshold_str); | |
5717 | else | |
5718 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 5719 | |
0a486e5f | 5720 | if (restart_str) |
5721 | restart = atoi (restart_str); | |
5722 | else | |
5723 | restart = 0; | |
5724 | ||
5725 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 5726 | |
5727 | return bgp_vty_return (vty, ret); | |
5728 | } | |
5729 | ||
94f2b392 | 5730 | static int |
fd79ac91 | 5731 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5732 | safi_t safi) |
5733 | { | |
5734 | int ret; | |
5735 | struct peer *peer; | |
5736 | ||
5737 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5738 | if (! peer) | |
5739 | return CMD_WARNING; | |
5740 | ||
5741 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
5742 | ||
5743 | return bgp_vty_return (vty, ret); | |
5744 | } | |
5745 | ||
5746 | /* Maximum number of prefix configuration. prefix count is different | |
5747 | for each peer configuration. So this configuration can be set for | |
5748 | each peer configuration. */ | |
5749 | DEFUN (neighbor_maximum_prefix, | |
5750 | neighbor_maximum_prefix_cmd, | |
5751 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5752 | NEIGHBOR_STR | |
5753 | NEIGHBOR_ADDR_STR2 | |
5754 | "Maximum number of prefix accept from this peer\n" | |
5755 | "maximum no. of prefix limit\n") | |
5756 | { | |
afec25d9 DW |
5757 | return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5758 | bgp_node_safi (vty), argv[3]->arg, NULL, 0, | |
0a486e5f | 5759 | NULL); |
718e3744 | 5760 | } |
5761 | ||
e0701b79 | 5762 | DEFUN (neighbor_maximum_prefix_threshold, |
5763 | neighbor_maximum_prefix_threshold_cmd, | |
5764 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
5765 | NEIGHBOR_STR | |
5766 | NEIGHBOR_ADDR_STR2 | |
5767 | "Maximum number of prefix accept from this peer\n" | |
5768 | "maximum no. of prefix limit\n" | |
5769 | "Threshold value (%) at which to generate a warning msg\n") | |
5770 | { | |
afec25d9 DW |
5771 | return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5772 | bgp_node_safi (vty), argv[3]->arg, argv[4]->arg, 0, | |
0a486e5f | 5773 | NULL); |
5774 | } | |
e0701b79 | 5775 | |
718e3744 | 5776 | DEFUN (neighbor_maximum_prefix_warning, |
5777 | neighbor_maximum_prefix_warning_cmd, | |
5778 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5779 | NEIGHBOR_STR | |
5780 | NEIGHBOR_ADDR_STR2 | |
5781 | "Maximum number of prefix accept from this peer\n" | |
5782 | "maximum no. of prefix limit\n" | |
5783 | "Only give warning message when limit is exceeded\n") | |
5784 | { | |
afec25d9 DW |
5785 | return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5786 | bgp_node_safi (vty), argv[3]->arg, NULL, 1, | |
0a486e5f | 5787 | NULL); |
718e3744 | 5788 | } |
5789 | ||
e0701b79 | 5790 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
5791 | neighbor_maximum_prefix_threshold_warning_cmd, | |
5792 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
5793 | NEIGHBOR_STR | |
5794 | NEIGHBOR_ADDR_STR2 | |
5795 | "Maximum number of prefix accept from this peer\n" | |
5796 | "maximum no. of prefix limit\n" | |
5797 | "Threshold value (%) at which to generate a warning msg\n" | |
5798 | "Only give warning message when limit is exceeded\n") | |
5799 | { | |
afec25d9 DW |
5800 | return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5801 | bgp_node_safi (vty), argv[3]->arg, argv[4]->arg, 1, NULL); | |
0a486e5f | 5802 | } |
5803 | ||
5804 | DEFUN (neighbor_maximum_prefix_restart, | |
5805 | neighbor_maximum_prefix_restart_cmd, | |
5806 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
5807 | NEIGHBOR_STR | |
5808 | NEIGHBOR_ADDR_STR2 | |
5809 | "Maximum number of prefix accept from this peer\n" | |
5810 | "maximum no. of prefix limit\n" | |
5811 | "Restart bgp connection after limit is exceeded\n" | |
5812 | "Restart interval in minutes") | |
5813 | { | |
afec25d9 DW |
5814 | return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5815 | bgp_node_safi (vty), argv[3]->arg, NULL, 0, argv[5]->arg); | |
0a486e5f | 5816 | } |
5817 | ||
5818 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
5819 | neighbor_maximum_prefix_threshold_restart_cmd, | |
5820 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5821 | NEIGHBOR_STR | |
5822 | NEIGHBOR_ADDR_STR2 | |
5823 | "Maximum number of prefix accept from this peer\n" | |
5824 | "maximum no. of prefix limit\n" | |
5825 | "Threshold value (%) at which to generate a warning msg\n" | |
5826 | "Restart bgp connection after limit is exceeded\n" | |
5827 | "Restart interval in minutes") | |
5828 | { | |
afec25d9 DW |
5829 | return peer_maximum_prefix_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
5830 | bgp_node_safi (vty), argv[3]->arg, argv[4]->arg, 0, argv[6]->arg); | |
0a486e5f | 5831 | } |
e0701b79 | 5832 | |
f412b39a DW |
5833 | /* |
5834 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
5835 | * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5836 | * NO_STR | |
5837 | * NEIGHBOR_STR | |
5838 | * NEIGHBOR_ADDR_STR2 | |
5839 | * "Maximum number of prefix accept from this peer\n" | |
5840 | * "maximum no. of prefix limit\n" | |
5841 | * | |
5842 | * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5843 | * NO_STR | |
5844 | * NEIGHBOR_STR | |
5845 | * NEIGHBOR_ADDR_STR2 | |
5846 | * "Maximum number of prefix accept from this peer\n" | |
5847 | * "maximum no. of prefix limit\n" | |
5848 | * "Threshold value (%) at which to generate a warning msg\n" | |
5849 | * "Restart bgp connection after limit is exceeded\n" | |
5850 | * "Restart interval in minutes" | |
5851 | * | |
5852 | * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5853 | * NO_STR | |
5854 | * NEIGHBOR_STR | |
5855 | * NEIGHBOR_ADDR_STR2 | |
5856 | * "Maximum number of prefix accept from this peer\n" | |
5857 | * "maximum no. of prefix limit\n" | |
5858 | * "Only give warning message when limit is exceeded\n" | |
5859 | * | |
5860 | * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
5861 | * NO_STR | |
5862 | * NEIGHBOR_STR | |
5863 | * NEIGHBOR_ADDR_STR2 | |
5864 | * "Maximum number of prefix accept from this peer\n" | |
5865 | * "maximum no. of prefix limit\n" | |
5866 | * "Restart bgp connection after limit is exceeded\n" | |
5867 | * "Restart interval in minutes" | |
5868 | * | |
5869 | * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
5870 | * NO_STR | |
5871 | * NEIGHBOR_STR | |
5872 | * NEIGHBOR_ADDR_STR2 | |
5873 | * "Maximum number of prefix accept from this peer\n" | |
5874 | * "maximum no. of prefix limit\n" | |
5875 | * "Threshold value (%) at which to generate a warning msg\n" | |
5876 | * "Only give warning message when limit is exceeded\n" | |
5877 | * | |
5878 | * NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
5879 | * NO_STR | |
5880 | * NEIGHBOR_STR | |
5881 | * NEIGHBOR_ADDR_STR2 | |
5882 | * "Maximum number of prefix accept from this peer\n" | |
5883 | * "maximum no. of prefix limit\n" | |
5884 | * "Threshold value (%) at which to generate a warning msg\n" | |
5885 | * | |
5886 | */ | |
718e3744 | 5887 | DEFUN (no_neighbor_maximum_prefix, |
5888 | no_neighbor_maximum_prefix_cmd, | |
5889 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
5890 | NO_STR | |
5891 | NEIGHBOR_STR | |
5892 | NEIGHBOR_ADDR_STR2 | |
5893 | "Maximum number of prefix accept from this peer\n") | |
5894 | { | |
afec25d9 | 5895 | return peer_maximum_prefix_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
718e3744 | 5896 | bgp_node_safi (vty)); |
5897 | } | |
5898 | ||
718e3744 | 5899 | |
0a486e5f | 5900 | |
0a486e5f | 5901 | |
e0701b79 | 5902 | |
0a486e5f | 5903 | |
6b0655a2 | 5904 | |
718e3744 | 5905 | /* "neighbor allowas-in" */ |
f412b39a DW |
5906 | /* |
5907 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
5908 | * NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5909 | * NEIGHBOR_STR | |
5910 | * NEIGHBOR_ADDR_STR2 | |
5911 | * "Accept as-path with my AS present in it\n" | |
5912 | * "Number of occurances of AS number\n" | |
5913 | * | |
5914 | */ | |
718e3744 | 5915 | DEFUN (neighbor_allowas_in, |
5916 | neighbor_allowas_in_cmd, | |
5917 | NEIGHBOR_CMD2 "allowas-in", | |
5918 | NEIGHBOR_STR | |
5919 | NEIGHBOR_ADDR_STR2 | |
5920 | "Accept as-path with my AS present in it\n") | |
5921 | { | |
5922 | int ret; | |
5923 | struct peer *peer; | |
fd79ac91 | 5924 | unsigned int allow_num; |
718e3744 | 5925 | |
afec25d9 | 5926 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
718e3744 | 5927 | if (! peer) |
5928 | return CMD_WARNING; | |
5929 | ||
5930 | if (argc == 1) | |
5931 | allow_num = 3; | |
5932 | else | |
afec25d9 | 5933 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[3]->arg, 1, 10); |
718e3744 | 5934 | |
5935 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
5936 | allow_num); | |
5937 | ||
5938 | return bgp_vty_return (vty, ret); | |
5939 | } | |
5940 | ||
718e3744 | 5941 | |
f412b39a DW |
5942 | /* |
5943 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
5944 | * NO_NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5945 | * NO_STR | |
5946 | * NEIGHBOR_STR | |
5947 | * NEIGHBOR_ADDR_STR2 | |
5948 | * "allow local ASN appears in aspath attribute\n" | |
5949 | * "Number of occurances of AS number\n" | |
5950 | * | |
5951 | */ | |
718e3744 | 5952 | DEFUN (no_neighbor_allowas_in, |
5953 | no_neighbor_allowas_in_cmd, | |
5954 | NO_NEIGHBOR_CMD2 "allowas-in", | |
5955 | NO_STR | |
5956 | NEIGHBOR_STR | |
5957 | NEIGHBOR_ADDR_STR2 | |
5958 | "allow local ASN appears in aspath attribute\n") | |
5959 | { | |
5960 | int ret; | |
5961 | struct peer *peer; | |
5962 | ||
afec25d9 | 5963 | peer = peer_and_group_lookup_vty (vty, argv[2]->arg); |
718e3744 | 5964 | if (! peer) |
5965 | return CMD_WARNING; | |
5966 | ||
5967 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
5968 | ||
5969 | return bgp_vty_return (vty, ret); | |
5970 | } | |
6b0655a2 | 5971 | |
813d4307 | 5972 | |
fa411a21 NH |
5973 | DEFUN (neighbor_ttl_security, |
5974 | neighbor_ttl_security_cmd, | |
5975 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5976 | NEIGHBOR_STR | |
5977 | NEIGHBOR_ADDR_STR2 | |
5978 | "Specify the maximum number of hops to the BGP peer\n") | |
5979 | { | |
5980 | struct peer *peer; | |
89b6d1f8 | 5981 | int gtsm_hops; |
fa411a21 | 5982 | |
afec25d9 | 5983 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
fa411a21 NH |
5984 | if (! peer) |
5985 | return CMD_WARNING; | |
5986 | ||
afec25d9 | 5987 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[4]->arg, 1, 254); |
fa411a21 | 5988 | |
8cdabf90 SK |
5989 | /* |
5990 | * If 'neighbor swpX', then this is for directly connected peers, | |
5991 | * we should not accept a ttl-security hops value greater than 1. | |
5992 | */ | |
5993 | if (peer->conf_if && (gtsm_hops > 1)) { | |
5994 | vty_out (vty, "%s is directly connected peer, hops cannot exceed 1%s", | |
afec25d9 | 5995 | argv[1]->arg, VTY_NEWLINE); |
8cdabf90 SK |
5996 | return CMD_WARNING; |
5997 | } | |
5998 | ||
89b6d1f8 | 5999 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
6000 | } |
6001 | ||
6002 | DEFUN (no_neighbor_ttl_security, | |
6003 | no_neighbor_ttl_security_cmd, | |
6004 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
6005 | NO_STR | |
6006 | NEIGHBOR_STR | |
6007 | NEIGHBOR_ADDR_STR2 | |
6008 | "Specify the maximum number of hops to the BGP peer\n") | |
6009 | { | |
6010 | struct peer *peer; | |
fa411a21 | 6011 | |
afec25d9 | 6012 | peer = peer_and_group_lookup_vty (vty, argv[2]->arg); |
fa411a21 NH |
6013 | if (! peer) |
6014 | return CMD_WARNING; | |
6015 | ||
89b6d1f8 | 6016 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 6017 | } |
6b0655a2 | 6018 | |
adbac85e DW |
6019 | DEFUN (neighbor_addpath_tx_all_paths, |
6020 | neighbor_addpath_tx_all_paths_cmd, | |
6021 | NEIGHBOR_CMD2 "addpath-tx-all-paths", | |
6022 | NEIGHBOR_STR | |
6023 | NEIGHBOR_ADDR_STR2 | |
6024 | "Use addpath to advertise all paths to a neighbor\n") | |
6025 | { | |
6026 | struct peer *peer; | |
6027 | ||
afec25d9 | 6028 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
adbac85e DW |
6029 | if (! peer) |
6030 | return CMD_WARNING; | |
6031 | ||
afec25d9 | 6032 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
adbac85e DW |
6033 | bgp_node_safi (vty), |
6034 | PEER_FLAG_ADDPATH_TX_ALL_PATHS); | |
6035 | } | |
6036 | ||
6037 | DEFUN (no_neighbor_addpath_tx_all_paths, | |
6038 | no_neighbor_addpath_tx_all_paths_cmd, | |
6039 | NO_NEIGHBOR_CMD2 "addpath-tx-all-paths", | |
6040 | NO_STR | |
6041 | NEIGHBOR_STR | |
6042 | NEIGHBOR_ADDR_STR2 | |
6043 | "Use addpath to advertise all paths to a neighbor\n") | |
6044 | { | |
afec25d9 | 6045 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
adbac85e DW |
6046 | bgp_node_safi (vty), |
6047 | PEER_FLAG_ADDPATH_TX_ALL_PATHS); | |
6048 | } | |
6049 | ||
06370dac DW |
6050 | DEFUN (neighbor_addpath_tx_bestpath_per_as, |
6051 | neighbor_addpath_tx_bestpath_per_as_cmd, | |
6052 | NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", | |
6053 | NEIGHBOR_STR | |
6054 | NEIGHBOR_ADDR_STR2 | |
6055 | "Use addpath to advertise the bestpath per each neighboring AS\n") | |
6056 | { | |
6057 | struct peer *peer; | |
6058 | ||
afec25d9 | 6059 | peer = peer_and_group_lookup_vty (vty, argv[1]->arg); |
06370dac DW |
6060 | if (! peer) |
6061 | return CMD_WARNING; | |
6062 | ||
afec25d9 | 6063 | return peer_af_flag_set_vty (vty, argv[1]->arg, bgp_node_afi (vty), |
06370dac DW |
6064 | bgp_node_safi (vty), |
6065 | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); | |
6066 | } | |
6067 | ||
6068 | DEFUN (no_neighbor_addpath_tx_bestpath_per_as, | |
6069 | no_neighbor_addpath_tx_bestpath_per_as_cmd, | |
6070 | NO_NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", | |
6071 | NO_STR | |
6072 | NEIGHBOR_STR | |
6073 | NEIGHBOR_ADDR_STR2 | |
6074 | "Use addpath to advertise the bestpath per each neighboring AS\n") | |
6075 | { | |
afec25d9 | 6076 | return peer_af_flag_unset_vty (vty, argv[2]->arg, bgp_node_afi (vty), |
06370dac DW |
6077 | bgp_node_safi (vty), |
6078 | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); | |
6079 | } | |
6080 | ||
6081 | ||
718e3744 | 6082 | /* Address family configuration. */ |
6083 | DEFUN (address_family_ipv4, | |
6084 | address_family_ipv4_cmd, | |
6085 | "address-family ipv4", | |
6086 | "Enter Address Family command mode\n" | |
6087 | "Address family\n") | |
6088 | { | |
6089 | vty->node = BGP_IPV4_NODE; | |
6090 | return CMD_SUCCESS; | |
6091 | } | |
6092 | ||
6093 | DEFUN (address_family_ipv4_safi, | |
6094 | address_family_ipv4_safi_cmd, | |
6095 | "address-family ipv4 (unicast|multicast)", | |
6096 | "Enter Address Family command mode\n" | |
6097 | "Address family\n" | |
6098 | "Address Family modifier\n" | |
6099 | "Address Family modifier\n") | |
6100 | { | |
afec25d9 | 6101 | if (strncmp (argv[2]->arg, "m", 1) == 0) |
718e3744 | 6102 | vty->node = BGP_IPV4M_NODE; |
6103 | else | |
6104 | vty->node = BGP_IPV4_NODE; | |
6105 | ||
6106 | return CMD_SUCCESS; | |
6107 | } | |
6108 | ||
25ffbdc1 | 6109 | DEFUN (address_family_ipv6, |
6110 | address_family_ipv6_cmd, | |
6111 | "address-family ipv6", | |
718e3744 | 6112 | "Enter Address Family command mode\n" |
25ffbdc1 | 6113 | "Address family\n") |
718e3744 | 6114 | { |
6115 | vty->node = BGP_IPV6_NODE; | |
6116 | return CMD_SUCCESS; | |
6117 | } | |
6118 | ||
25ffbdc1 | 6119 | DEFUN (address_family_ipv6_safi, |
6120 | address_family_ipv6_safi_cmd, | |
6121 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 6122 | "Enter Address Family command mode\n" |
25ffbdc1 | 6123 | "Address family\n" |
6124 | "Address Family modifier\n" | |
6125 | "Address Family modifier\n") | |
6126 | { | |
afec25d9 | 6127 | if (strncmp (argv[2]->arg, "m", 1) == 0) |
25ffbdc1 | 6128 | vty->node = BGP_IPV6M_NODE; |
6129 | else | |
6130 | vty->node = BGP_IPV6_NODE; | |
6131 | ||
6132 | return CMD_SUCCESS; | |
6133 | } | |
718e3744 | 6134 | |
f412b39a DW |
6135 | /* |
6136 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6137 | * "address-family vpnv4 unicast", | |
6138 | * "Enter Address Family command mode\n" | |
6139 | * "Address family\n" | |
6140 | * "Address Family Modifier\n" | |
6141 | * | |
6142 | */ | |
718e3744 | 6143 | DEFUN (address_family_vpnv4, |
6144 | address_family_vpnv4_cmd, | |
6145 | "address-family vpnv4", | |
6146 | "Enter Address Family command mode\n" | |
6147 | "Address family\n") | |
6148 | { | |
6149 | vty->node = BGP_VPNV4_NODE; | |
6150 | return CMD_SUCCESS; | |
6151 | } | |
6152 | ||
718e3744 | 6153 | |
f412b39a DW |
6154 | /* |
6155 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6156 | * "address-family vpnv6 unicast", | |
6157 | * "Enter Address Family command mode\n" | |
6158 | * "Address family\n" | |
6159 | * "Address Family Modifier\n" | |
6160 | * | |
6161 | */ | |
8ecd3266 | 6162 | DEFUN (address_family_vpnv6, |
6163 | address_family_vpnv6_cmd, | |
6164 | "address-family vpnv6", | |
6165 | "Enter Address Family command mode\n" | |
6166 | "Address family\n") | |
6167 | { | |
6168 | vty->node = BGP_VPNV6_NODE; | |
6169 | return CMD_SUCCESS; | |
6170 | } | |
6171 | ||
8ecd3266 | 6172 | |
f412b39a DW |
6173 | /* |
6174 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6175 | * "address-family encapv4", | |
6176 | * "Enter Address Family command mode\n" | |
6177 | * "Address family\n" | |
6178 | * | |
6179 | */ | |
8b1fb8be LB |
6180 | DEFUN (address_family_encap, |
6181 | address_family_encap_cmd, | |
6182 | "address-family encap", | |
6183 | "Enter Address Family command mode\n" | |
6184 | "Address family\n") | |
6185 | { | |
6186 | vty->node = BGP_ENCAP_NODE; | |
6187 | return CMD_SUCCESS; | |
6188 | } | |
6189 | ||
8b1fb8be LB |
6190 | |
6191 | DEFUN (address_family_encapv6, | |
6192 | address_family_encapv6_cmd, | |
6193 | "address-family encapv6", | |
6194 | "Enter Address Family command mode\n" | |
6195 | "Address family\n") | |
6196 | { | |
6197 | vty->node = BGP_ENCAPV6_NODE; | |
6198 | return CMD_SUCCESS; | |
6199 | } | |
6200 | ||
718e3744 | 6201 | DEFUN (exit_address_family, |
6202 | exit_address_family_cmd, | |
6203 | "exit-address-family", | |
6204 | "Exit from Address Family configuration mode\n") | |
6205 | { | |
a8a80d53 | 6206 | if (vty->node == BGP_IPV4_NODE |
6207 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 6208 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 6209 | || vty->node == BGP_IPV6_NODE |
8ecd3266 | 6210 | || vty->node == BGP_IPV6M_NODE |
8b1fb8be LB |
6211 | || vty->node == BGP_VPNV6_NODE |
6212 | || vty->node == BGP_ENCAP_NODE | |
6213 | || vty->node == BGP_ENCAPV6_NODE) | |
718e3744 | 6214 | vty->node = BGP_NODE; |
6215 | return CMD_SUCCESS; | |
6216 | } | |
6b0655a2 | 6217 | |
8ad7271d DS |
6218 | /* Recalculate bestpath and re-advertise a prefix */ |
6219 | static int | |
01080f7c | 6220 | bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str, |
8ad7271d DS |
6221 | afi_t afi, safi_t safi, struct prefix_rd *prd) |
6222 | { | |
6223 | int ret; | |
6224 | struct prefix match; | |
6225 | struct bgp_node *rn; | |
6226 | struct bgp_node *rm; | |
8ad7271d DS |
6227 | struct bgp *bgp; |
6228 | struct bgp_table *table; | |
6229 | struct bgp_table *rib; | |
6230 | ||
6231 | /* BGP structure lookup. */ | |
6232 | if (view_name) | |
6233 | { | |
6234 | bgp = bgp_lookup_by_name (view_name); | |
6235 | if (bgp == NULL) | |
6236 | { | |
6aeb9e78 | 6237 | vty_out (vty, "%% Can't find BGP instance %s%s", view_name, VTY_NEWLINE); |
8ad7271d DS |
6238 | return CMD_WARNING; |
6239 | } | |
6240 | } | |
6241 | else | |
6242 | { | |
6243 | bgp = bgp_get_default (); | |
6244 | if (bgp == NULL) | |
6245 | { | |
6246 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
6247 | return CMD_WARNING; | |
6248 | } | |
6249 | } | |
6250 | ||
6251 | /* Check IP address argument. */ | |
6252 | ret = str2prefix (ip_str, &match); | |
6253 | if (! ret) | |
6254 | { | |
6255 | vty_out (vty, "%% address is malformed%s", VTY_NEWLINE); | |
6256 | return CMD_WARNING; | |
6257 | } | |
6258 | ||
6259 | match.family = afi2family (afi); | |
6260 | rib = bgp->rib[afi][safi]; | |
6261 | ||
6262 | if (safi == SAFI_MPLS_VPN) | |
6263 | { | |
6264 | for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn)) | |
6265 | { | |
6266 | if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) | |
6267 | continue; | |
6268 | ||
6269 | if ((table = rn->info) != NULL) | |
6270 | { | |
6271 | if ((rm = bgp_node_match (table, &match)) != NULL) | |
6272 | { | |
6273 | if (rm->p.prefixlen == match.prefixlen) | |
6274 | { | |
6275 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
6276 | bgp_process (bgp, rm, afi, safi); | |
6277 | } | |
6278 | bgp_unlock_node (rm); | |
6279 | } | |
6280 | } | |
6281 | } | |
6282 | } | |
6283 | else | |
6284 | { | |
6285 | if ((rn = bgp_node_match (rib, &match)) != NULL) | |
6286 | { | |
6287 | if (rn->p.prefixlen == match.prefixlen) | |
6288 | { | |
6289 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
6290 | bgp_process (bgp, rn, afi, safi); | |
6291 | } | |
6292 | bgp_unlock_node (rn); | |
6293 | } | |
6294 | } | |
6295 | ||
6296 | return CMD_SUCCESS; | |
6297 | } | |
6298 | ||
f412b39a DW |
6299 | /* |
6300 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6301 | * "clear bgp *", | |
6302 | * CLEAR_STR | |
6303 | * BGP_STR | |
6304 | * "Clear all peers\n" | |
6305 | * | |
6306 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 *", | |
6307 | * CLEAR_STR | |
6308 | * BGP_STR | |
6309 | * BGP_INSTANCE_HELP_STR | |
6310 | * "Address family\n" | |
6311 | * "Clear all peers\n" | |
6312 | * | |
6313 | * "clear ip bgp " BGP_INSTANCE_CMD " *", | |
6314 | * CLEAR_STR | |
6315 | * IP_STR | |
6316 | * BGP_STR | |
6317 | * BGP_INSTANCE_HELP_STR | |
6318 | * "Clear all peers\n" | |
6319 | * | |
6320 | * "clear bgp ipv6 *", | |
6321 | * CLEAR_STR | |
6322 | * BGP_STR | |
6323 | * "Address family\n" | |
6324 | * "Clear all peers\n" | |
6325 | * | |
6326 | * "clear bgp " BGP_INSTANCE_CMD " *", | |
6327 | * CLEAR_STR | |
6328 | * BGP_STR | |
6329 | * BGP_INSTANCE_HELP_STR | |
6330 | * "Clear all peers\n" | |
6331 | * | |
6332 | */ | |
718e3744 | 6333 | DEFUN (clear_ip_bgp_all, |
6334 | clear_ip_bgp_all_cmd, | |
6335 | "clear ip bgp *", | |
6336 | CLEAR_STR | |
6337 | IP_STR | |
6338 | BGP_STR | |
6339 | "Clear all peers\n") | |
6340 | { | |
afec25d9 | 6341 | return bgp_clear_vty (vty, argv[4]->arg, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); |
718e3744 | 6342 | } |
6343 | ||
01080f7c | 6344 | |
718e3744 | 6345 | |
718e3744 | 6346 | |
718e3744 | 6347 | |
718e3744 | 6348 | |
f412b39a DW |
6349 | /* |
6350 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6351 | * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", | |
6352 | * CLEAR_STR | |
6353 | * BGP_STR | |
6354 | * BGP_INSTANCE_HELP_STR | |
6355 | * "BGP neighbor IP address to clear\n" | |
6356 | * "BGP IPv6 neighbor to clear\n" | |
6357 | * "BGP neighbor on interface to clear\n" | |
6358 | * | |
6359 | * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", | |
6360 | * CLEAR_STR | |
6361 | * BGP_STR | |
6362 | * "Address family\n" | |
6363 | * "BGP neighbor address to clear\n" | |
6364 | * "BGP IPv6 neighbor to clear\n" | |
6365 | * "BGP neighbor on interface to clear\n" | |
6366 | * | |
6367 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD)", | |
6368 | * CLEAR_STR | |
6369 | * BGP_STR | |
6370 | * BGP_INSTANCE_HELP_STR | |
6371 | * "Address family\n" | |
6372 | * "BGP neighbor IP address to clear\n" | |
6373 | * "BGP IPv6 neighbor to clear\n" | |
6374 | * "BGP neighbor on interface to clear\n" | |
6375 | * | |
6376 | * "clear bgp (A.B.C.D|X:X::X:X|WORD)", | |
6377 | * CLEAR_STR | |
6378 | * BGP_STR | |
6379 | * "BGP neighbor address to clear\n" | |
6380 | * "BGP IPv6 neighbor to clear\n" | |
6381 | * "BGP neighbor on interface to clear\n" | |
6382 | * | |
6383 | * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD)", | |
6384 | * CLEAR_STR | |
6385 | * IP_STR | |
6386 | * BGP_STR | |
6387 | * BGP_INSTANCE_HELP_STR | |
6388 | * "BGP neighbor IP address to clear\n" | |
6389 | * "BGP IPv6 neighbor to clear\n" | |
6390 | * "BGP neighbor on interface to clear\n" | |
6391 | * | |
6392 | */ | |
718e3744 | 6393 | DEFUN (clear_ip_bgp_peer, |
f412b39a | 6394 | clear_ip_bgp_peer_cmd, |
a80beece | 6395 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6396 | CLEAR_STR |
6397 | IP_STR | |
6398 | BGP_STR | |
6399 | "BGP neighbor IP address to clear\n" | |
a80beece DS |
6400 | "BGP IPv6 neighbor to clear\n" |
6401 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6402 | { |
01080f7c | 6403 | if (argc == 3) |
6404 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6405 | ||
afec25d9 | 6406 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[3]->arg); |
718e3744 | 6407 | } |
6408 | ||
01080f7c | 6409 | |
718e3744 | 6410 | |
01080f7c | 6411 | |
718e3744 | 6412 | |
01080f7c | 6413 | |
f412b39a DW |
6414 | /* |
6415 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6416 | * "clear bgp peer-group WORD", | |
6417 | * CLEAR_STR | |
6418 | * BGP_STR | |
6419 | * "Clear all members of peer-group\n" | |
6420 | * "BGP peer-group name\n" | |
6421 | * | |
6422 | * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD", | |
6423 | * CLEAR_STR | |
6424 | * IP_STR | |
6425 | * BGP_STR | |
6426 | * BGP_INSTANCE_HELP_STR | |
6427 | * "Clear all members of peer-group\n" | |
6428 | * "BGP peer-group name\n" | |
6429 | * | |
6430 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD", | |
6431 | * CLEAR_STR | |
6432 | * BGP_STR | |
6433 | * BGP_INSTANCE_HELP_STR | |
6434 | * "Address family\n" | |
6435 | * "Clear all members of peer-group\n" | |
6436 | * "BGP peer-group name\n" | |
6437 | * | |
6438 | * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD", | |
6439 | * CLEAR_STR | |
6440 | * BGP_STR | |
6441 | * BGP_INSTANCE_HELP_STR | |
6442 | * "Clear all members of peer-group\n" | |
6443 | * "BGP peer-group name\n" | |
6444 | * | |
6445 | * "clear bgp ipv6 peer-group WORD", | |
6446 | * CLEAR_STR | |
6447 | * BGP_STR | |
6448 | * "Address family\n" | |
6449 | * "Clear all members of peer-group\n" | |
6450 | * "BGP peer-group name\n" | |
6451 | * | |
6452 | */ | |
718e3744 | 6453 | DEFUN (clear_ip_bgp_peer_group, |
f412b39a | 6454 | clear_ip_bgp_peer_group_cmd, |
718e3744 | 6455 | "clear ip bgp peer-group WORD", |
6456 | CLEAR_STR | |
6457 | IP_STR | |
6458 | BGP_STR | |
6459 | "Clear all members of peer-group\n" | |
6460 | "BGP peer-group name\n") | |
6461 | { | |
01080f7c | 6462 | if (argc == 3) |
6463 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6464 | ||
afec25d9 | 6465 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[4]->arg); |
718e3744 | 6466 | } |
6467 | ||
01080f7c | 6468 | |
718e3744 | 6469 | |
01080f7c | 6470 | |
718e3744 | 6471 | |
01080f7c | 6472 | |
f412b39a DW |
6473 | /* |
6474 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6475 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 external", | |
6476 | * CLEAR_STR | |
6477 | * BGP_STR | |
6478 | * BGP_INSTANCE_HELP_STR | |
6479 | * "Address family\n" | |
6480 | * "Clear all external peers\n" | |
6481 | * | |
6482 | * "clear bgp " BGP_INSTANCE_CMD " external", | |
6483 | * CLEAR_STR | |
6484 | * BGP_STR | |
6485 | * BGP_INSTANCE_HELP_STR | |
6486 | * "Clear all external peers\n" | |
6487 | * | |
6488 | * "clear bgp external", | |
6489 | * CLEAR_STR | |
6490 | * BGP_STR | |
6491 | * "Clear all external peers\n" | |
6492 | * | |
6493 | * "clear bgp ipv6 external", | |
6494 | * CLEAR_STR | |
6495 | * BGP_STR | |
6496 | * "Address family\n" | |
6497 | * "Clear all external peers\n" | |
6498 | * | |
6499 | * "clear ip bgp " BGP_INSTANCE_CMD " external", | |
6500 | * CLEAR_STR | |
6501 | * IP_STR | |
6502 | * BGP_STR | |
6503 | * BGP_INSTANCE_HELP_STR | |
6504 | * "Clear all external peers\n" | |
6505 | * | |
6506 | */ | |
718e3744 | 6507 | DEFUN (clear_ip_bgp_external, |
6508 | clear_ip_bgp_external_cmd, | |
6509 | "clear ip bgp external", | |
6510 | CLEAR_STR | |
6511 | IP_STR | |
6512 | BGP_STR | |
6513 | "Clear all external peers\n") | |
6514 | { | |
01080f7c | 6515 | if (argc == 2) |
6516 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
6517 | ||
718e3744 | 6518 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); |
6519 | } | |
6520 | ||
01080f7c | 6521 | |
718e3744 | 6522 | |
01080f7c | 6523 | |
718e3744 | 6524 | |
01080f7c | 6525 | |
f412b39a DW |
6526 | /* |
6527 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6528 | * "clear bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", | |
6529 | * CLEAR_STR | |
6530 | * BGP_STR | |
6531 | * BGP_INSTANCE_HELP_STR | |
6532 | * "Clear bestpath and re-advertise\n" | |
6533 | * "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" | |
6534 | * | |
6535 | * "clear ip bgp " BGP_INSTANCE_CMD " prefix A.B.C.D/M", | |
6536 | * CLEAR_STR | |
6537 | * IP_STR | |
6538 | * BGP_STR | |
6539 | * BGP_INSTANCE_HELP_STR | |
6540 | * "Clear bestpath and re-advertise\n" | |
6541 | * "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" | |
6542 | * | |
6543 | * "clear bgp prefix A.B.C.D/M", | |
6544 | * CLEAR_STR | |
6545 | * BGP_STR | |
6546 | * "Clear bestpath and re-advertise\n" | |
6547 | * "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n" | |
6548 | * | |
6549 | */ | |
8ad7271d DS |
6550 | DEFUN (clear_ip_bgp_prefix, |
6551 | clear_ip_bgp_prefix_cmd, | |
6552 | "clear ip bgp prefix A.B.C.D/M", | |
6553 | CLEAR_STR | |
6554 | IP_STR | |
6555 | BGP_STR | |
6556 | "Clear bestpath and re-advertise\n" | |
6557 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6558 | { | |
01080f7c | 6559 | if (argc == 3) |
6560 | return bgp_clear_prefix (vty, argv[1], argv[2], AFI_IP, SAFI_UNICAST, NULL); | |
6561 | ||
afec25d9 | 6562 | return bgp_clear_prefix (vty, NULL, argv[4]->arg, AFI_IP, SAFI_UNICAST, NULL); |
8ad7271d DS |
6563 | } |
6564 | ||
01080f7c | 6565 | |
8ad7271d DS |
6566 | |
6567 | ||
f412b39a DW |
6568 | /* |
6569 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6570 | * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, | |
6571 | * CLEAR_STR | |
6572 | * IP_STR | |
6573 | * BGP_STR | |
6574 | * BGP_INSTANCE_HELP_STR | |
6575 | * "Clear peers with the AS number\n" | |
6576 | * | |
6577 | * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE, | |
6578 | * CLEAR_STR | |
6579 | * BGP_STR | |
6580 | * BGP_INSTANCE_HELP_STR | |
6581 | * "Clear peers with the AS number\n" | |
6582 | * | |
6583 | * "clear bgp ipv6 " CMD_AS_RANGE, | |
6584 | * CLEAR_STR | |
6585 | * BGP_STR | |
6586 | * "Address family\n" | |
6587 | * "Clear peers with the AS number\n" | |
6588 | * | |
6589 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE, | |
6590 | * CLEAR_STR | |
6591 | * BGP_STR | |
6592 | * BGP_INSTANCE_HELP_STR | |
6593 | * "Address family\n" | |
6594 | * "Clear peers with the AS number\n" | |
6595 | * | |
6596 | * "clear bgp " CMD_AS_RANGE, | |
6597 | * CLEAR_STR | |
6598 | * BGP_STR | |
6599 | * "Clear peers with the AS number\n" | |
6600 | * | |
6601 | */ | |
718e3744 | 6602 | DEFUN (clear_ip_bgp_as, |
6603 | clear_ip_bgp_as_cmd, | |
320da874 | 6604 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 6605 | CLEAR_STR |
6606 | IP_STR | |
6607 | BGP_STR | |
6608 | "Clear peers with the AS number\n") | |
6609 | { | |
01080f7c | 6610 | if (argc == 3) |
6611 | return bgp_clear_vty (vty, argv[1], 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[2]); | |
6612 | ||
afec25d9 | 6613 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[3]->arg); |
718e3744 | 6614 | } |
6615 | ||
01080f7c | 6616 | |
718e3744 | 6617 | |
01080f7c | 6618 | |
6b0655a2 | 6619 | |
01080f7c | 6620 | |
718e3744 | 6621 | /* Outbound soft-reconfiguration */ |
f412b39a DW |
6622 | /* |
6623 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6624 | * "clear ip bgp " BGP_INSTANCE_CMD " * out", | |
6625 | * CLEAR_STR | |
6626 | * IP_STR | |
6627 | * BGP_STR | |
6628 | * BGP_INSTANCE_HELP_STR | |
6629 | * "Clear all peers\n" | |
6630 | * BGP_SOFT_OUT_STR | |
6631 | * | |
6632 | * "clear ip bgp " BGP_INSTANCE_CMD " * soft out", | |
6633 | * CLEAR_STR | |
6634 | * IP_STR | |
6635 | * BGP_STR | |
6636 | * BGP_INSTANCE_HELP_STR | |
6637 | * "Clear all peers\n" | |
6638 | * BGP_SOFT_STR | |
6639 | * BGP_SOFT_OUT_STR | |
6640 | * | |
6641 | * "clear ip bgp * out", | |
6642 | * CLEAR_STR | |
6643 | * IP_STR | |
6644 | * BGP_STR | |
6645 | * "Clear all peers\n" | |
6646 | * BGP_SOFT_OUT_STR | |
6647 | * | |
6648 | */ | |
718e3744 | 6649 | DEFUN (clear_ip_bgp_all_soft_out, |
6650 | clear_ip_bgp_all_soft_out_cmd, | |
6651 | "clear ip bgp * soft out", | |
6652 | CLEAR_STR | |
6653 | IP_STR | |
6654 | BGP_STR | |
6655 | "Clear all peers\n" | |
e0bce756 DS |
6656 | BGP_SOFT_STR |
6657 | BGP_SOFT_OUT_STR) | |
718e3744 | 6658 | { |
6aeb9e78 DS |
6659 | if (argc == 2) |
6660 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 6661 | BGP_CLEAR_SOFT_OUT, NULL); |
6662 | ||
6663 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6664 | BGP_CLEAR_SOFT_OUT, NULL); | |
6665 | } | |
6666 | ||
01080f7c | 6667 | |
718e3744 | 6668 | |
718e3744 | 6669 | |
f412b39a DW |
6670 | /* |
6671 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6672 | * "clear ip bgp * ipv4 (unicast|multicast) out", | |
6673 | * CLEAR_STR | |
6674 | * IP_STR | |
6675 | * BGP_STR | |
6676 | * "Clear all peers\n" | |
6677 | * "Address family\n" | |
6678 | * "Address Family modifier\n" | |
6679 | * "Address Family modifier\n" | |
6680 | * BGP_SOFT_OUT_STR | |
6681 | * | |
6682 | */ | |
718e3744 | 6683 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, |
6684 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
6685 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
6686 | CLEAR_STR | |
6687 | IP_STR | |
6688 | BGP_STR | |
6689 | "Clear all peers\n" | |
6690 | "Address family\n" | |
6691 | "Address Family modifier\n" | |
6692 | "Address Family modifier\n" | |
e0bce756 DS |
6693 | BGP_SOFT_STR |
6694 | BGP_SOFT_OUT_STR) | |
718e3744 | 6695 | { |
afec25d9 | 6696 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 6697 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
6698 | BGP_CLEAR_SOFT_OUT, NULL); | |
6699 | ||
6700 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6701 | BGP_CLEAR_SOFT_OUT, NULL); | |
6702 | } | |
6703 | ||
f412b39a DW |
6704 | /* |
6705 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6706 | * "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) out", | |
6707 | * CLEAR_STR | |
6708 | * IP_STR | |
6709 | * BGP_STR | |
6710 | * BGP_INSTANCE_HELP_STR | |
6711 | * "Clear all peers\n" | |
6712 | * "Address family\n" | |
6713 | * "Address Family modifier\n" | |
6714 | * "Address Family modifier\n" | |
6715 | * BGP_SOFT_OUT_STR | |
6716 | * | |
6717 | */ | |
01080f7c | 6718 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, |
6719 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
6720 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft out", | |
6721 | CLEAR_STR | |
6722 | IP_STR | |
6723 | BGP_STR | |
6724 | BGP_INSTANCE_HELP_STR | |
6725 | "Clear all peers\n" | |
6726 | "Address family\n" | |
6727 | "Address Family modifier\n" | |
6728 | "Address Family modifier\n" | |
6729 | BGP_SOFT_OUT_STR) | |
6730 | { | |
afec25d9 DW |
6731 | if (strncmp (argv[7]->arg, "m", 1) == 0) |
6732 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_all, | |
01080f7c | 6733 | BGP_CLEAR_SOFT_OUT, NULL); |
6734 | ||
afec25d9 | 6735 | return bgp_clear_vty (vty, argv[3]->arg, AFI_IP, SAFI_UNICAST, clear_all, |
01080f7c | 6736 | BGP_CLEAR_SOFT_OUT, NULL); |
6737 | } | |
6738 | ||
718e3744 | 6739 | |
718e3744 | 6740 | |
f412b39a DW |
6741 | /* |
6742 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6743 | * "clear ip bgp * vpnv4 unicast out", | |
6744 | * CLEAR_STR | |
6745 | * IP_STR | |
6746 | * BGP_STR | |
6747 | * "Clear all peers\n" | |
6748 | * "Address family\n" | |
6749 | * "Address Family Modifier\n" | |
6750 | * BGP_SOFT_OUT_STR | |
6751 | * | |
6752 | */ | |
718e3744 | 6753 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, |
6754 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
6755 | "clear ip bgp * vpnv4 unicast soft out", | |
6756 | CLEAR_STR | |
6757 | IP_STR | |
6758 | BGP_STR | |
6759 | "Clear all peers\n" | |
6760 | "Address family\n" | |
6761 | "Address Family Modifier\n" | |
e0bce756 DS |
6762 | BGP_SOFT_STR |
6763 | BGP_SOFT_OUT_STR) | |
718e3744 | 6764 | { |
6765 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6766 | BGP_CLEAR_SOFT_OUT, NULL); | |
6767 | } | |
6768 | ||
718e3744 | 6769 | |
f412b39a DW |
6770 | /* |
6771 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6772 | * "clear ip bgp * encap unicast out", | |
6773 | * CLEAR_STR | |
6774 | * IP_STR | |
6775 | * BGP_STR | |
6776 | * "Clear all peers\n" | |
6777 | * "Address family\n" | |
6778 | * "Address Family Modifier\n" | |
6779 | * "Soft reconfig outbound update\n" | |
6780 | * | |
6781 | */ | |
587ff0fd LB |
6782 | DEFUN (clear_ip_bgp_all_encap_soft_out, |
6783 | clear_ip_bgp_all_encap_soft_out_cmd, | |
6784 | "clear ip bgp * encap unicast soft out", | |
6785 | CLEAR_STR | |
6786 | IP_STR | |
6787 | BGP_STR | |
6788 | "Clear all peers\n" | |
6789 | "Address family\n" | |
6790 | "Address Family Modifier\n" | |
6791 | "Soft reconfig\n" | |
6792 | "Soft reconfig outbound update\n") | |
6793 | { | |
6794 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
6795 | BGP_CLEAR_SOFT_OUT, NULL); | |
6796 | } | |
6797 | ||
587ff0fd | 6798 | |
f412b39a DW |
6799 | /* |
6800 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6801 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft out", | |
6802 | * CLEAR_STR | |
6803 | * BGP_STR | |
6804 | * BGP_INSTANCE_HELP_STR | |
6805 | * "Address family\n" | |
6806 | * "Clear all peers\n" | |
6807 | * BGP_SOFT_STR | |
6808 | * BGP_SOFT_OUT_STR | |
6809 | * | |
6810 | * "clear bgp ipv6 * soft out", | |
6811 | * CLEAR_STR | |
6812 | * BGP_STR | |
6813 | * "Address family\n" | |
6814 | * "Clear all peers\n" | |
6815 | * BGP_SOFT_STR | |
6816 | * BGP_SOFT_OUT_STR | |
6817 | * | |
6818 | * "clear bgp " BGP_INSTANCE_CMD " * soft out", | |
6819 | * CLEAR_STR | |
6820 | * BGP_STR | |
6821 | * BGP_INSTANCE_HELP_STR | |
6822 | * "Clear all peers\n" | |
6823 | * BGP_SOFT_STR | |
6824 | * BGP_SOFT_OUT_STR | |
6825 | * | |
6826 | * "clear bgp ipv6 * out", | |
6827 | * CLEAR_STR | |
6828 | * BGP_STR | |
6829 | * "Address family\n" | |
6830 | * "Clear all peers\n" | |
6831 | * BGP_SOFT_OUT_STR | |
6832 | * | |
6833 | * "clear bgp * out", | |
6834 | * CLEAR_STR | |
6835 | * BGP_STR | |
6836 | * "Clear all peers\n" | |
6837 | * BGP_SOFT_OUT_STR | |
6838 | * | |
6839 | * "clear bgp " BGP_INSTANCE_CMD " * out", | |
6840 | * CLEAR_STR | |
6841 | * BGP_STR | |
6842 | * BGP_INSTANCE_HELP_STR | |
6843 | * "Clear all peers\n" | |
6844 | * BGP_SOFT_OUT_STR | |
6845 | * | |
6846 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 * out", | |
6847 | * CLEAR_STR | |
6848 | * BGP_STR | |
6849 | * BGP_INSTANCE_HELP_STR | |
6850 | * "Address family\n" | |
6851 | * "Clear all peers\n" | |
6852 | * BGP_SOFT_OUT_STR | |
6853 | * | |
6854 | */ | |
718e3744 | 6855 | DEFUN (clear_bgp_all_soft_out, |
6856 | clear_bgp_all_soft_out_cmd, | |
6857 | "clear bgp * soft out", | |
6858 | CLEAR_STR | |
6859 | BGP_STR | |
6860 | "Clear all peers\n" | |
e0bce756 DS |
6861 | BGP_SOFT_STR |
6862 | BGP_SOFT_OUT_STR) | |
718e3744 | 6863 | { |
6aeb9e78 DS |
6864 | if (argc == 2) |
6865 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
718e3744 | 6866 | BGP_CLEAR_SOFT_OUT, NULL); |
6867 | ||
6868 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6869 | BGP_CLEAR_SOFT_OUT, NULL); | |
6870 | } | |
6871 | ||
718e3744 | 6872 | |
718e3744 | 6873 | |
01080f7c | 6874 | |
718e3744 | 6875 | |
01080f7c | 6876 | |
718e3744 | 6877 | |
01080f7c | 6878 | |
8ad7271d DS |
6879 | DEFUN (clear_bgp_ipv6_safi_prefix, |
6880 | clear_bgp_ipv6_safi_prefix_cmd, | |
6881 | "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6882 | CLEAR_STR | |
6883 | BGP_STR | |
6884 | "Address family\n" | |
6885 | "Address Family Modifier\n" | |
6886 | "Clear bestpath and re-advertise\n" | |
6887 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6888 | { | |
afec25d9 DW |
6889 | if (strncmp (argv[3]->arg, "m", 1) == 0) |
6890 | return bgp_clear_prefix (vty, NULL, argv[5]->arg, AFI_IP6, SAFI_MULTICAST, NULL); | |
8ad7271d | 6891 | else |
afec25d9 | 6892 | return bgp_clear_prefix (vty, NULL, argv[5]->arg, AFI_IP6, SAFI_UNICAST, NULL); |
8ad7271d DS |
6893 | } |
6894 | ||
01080f7c | 6895 | DEFUN (clear_bgp_instance_ipv6_safi_prefix, |
6896 | clear_bgp_instance_ipv6_safi_prefix_cmd, | |
6897 | "clear bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6898 | CLEAR_STR | |
6899 | BGP_STR | |
6900 | BGP_INSTANCE_HELP_STR | |
6901 | "Address family\n" | |
6902 | "Address Family Modifier\n" | |
6903 | "Clear bestpath and re-advertise\n" | |
6904 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6905 | { | |
afec25d9 DW |
6906 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
6907 | return bgp_clear_prefix (vty, argv[3]->arg, argv[7]->arg, AFI_IP6, SAFI_MULTICAST, NULL); | |
01080f7c | 6908 | else |
afec25d9 | 6909 | return bgp_clear_prefix (vty, argv[3]->arg, argv[7]->arg, AFI_IP6, SAFI_UNICAST, NULL); |
01080f7c | 6910 | } |
6911 | ||
f412b39a DW |
6912 | /* |
6913 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6914 | * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft out", | |
6915 | * CLEAR_STR | |
6916 | * IP_STR | |
6917 | * BGP_STR | |
6918 | * BGP_INSTANCE_HELP_STR | |
6919 | * "BGP neighbor address to clear\n" | |
6920 | * "BGP neighbor on interface to clear\n" | |
6921 | * BGP_SOFT_STR | |
6922 | * BGP_SOFT_OUT_STR | |
6923 | * | |
6924 | * "clear ip bgp (A.B.C.D|WORD) out", | |
6925 | * CLEAR_STR | |
6926 | * IP_STR | |
6927 | * BGP_STR | |
6928 | * "BGP neighbor address to clear\n" | |
6929 | * "BGP neighbor on interface to clear\n" | |
6930 | * BGP_SOFT_OUT_STR | |
6931 | * | |
6932 | * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) out", | |
6933 | * CLEAR_STR | |
6934 | * IP_STR | |
6935 | * BGP_STR | |
6936 | * BGP_INSTANCE_HELP_STR | |
6937 | * "BGP neighbor address to clear\n" | |
6938 | * "BGP neighbor on interface to clear\n" | |
6939 | * BGP_SOFT_OUT_STR | |
6940 | * | |
6941 | */ | |
718e3744 | 6942 | DEFUN (clear_ip_bgp_peer_soft_out, |
6943 | clear_ip_bgp_peer_soft_out_cmd, | |
db64ea86 | 6944 | "clear ip bgp (A.B.C.D|WORD) soft out", |
718e3744 | 6945 | CLEAR_STR |
6946 | IP_STR | |
6947 | BGP_STR | |
6948 | "BGP neighbor address to clear\n" | |
db64ea86 | 6949 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6950 | BGP_SOFT_STR |
6951 | BGP_SOFT_OUT_STR) | |
718e3744 | 6952 | { |
01080f7c | 6953 | if (argc == 3) |
6954 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
6955 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
6956 | ||
718e3744 | 6957 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
afec25d9 | 6958 | BGP_CLEAR_SOFT_OUT, argv[3]->arg); |
718e3744 | 6959 | } |
6960 | ||
01080f7c | 6961 | |
718e3744 | 6962 | |
01080f7c | 6963 | |
f412b39a DW |
6964 | /* |
6965 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
6966 | * "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out", | |
6967 | * CLEAR_STR | |
6968 | * IP_STR | |
6969 | * BGP_STR | |
6970 | * "BGP neighbor address to clear\n" | |
6971 | * "BGP neighbor on interface to clear\n" | |
6972 | * "Address family\n" | |
6973 | * "Address Family modifier\n" | |
6974 | * "Address Family modifier\n" | |
6975 | * BGP_SOFT_OUT_STR | |
6976 | * | |
6977 | */ | |
718e3744 | 6978 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, |
6979 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
db64ea86 | 6980 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", |
718e3744 | 6981 | CLEAR_STR |
6982 | IP_STR | |
6983 | BGP_STR | |
6984 | "BGP neighbor address to clear\n" | |
db64ea86 | 6985 | "BGP neighbor on interface to clear\n" |
718e3744 | 6986 | "Address family\n" |
6987 | "Address Family modifier\n" | |
6988 | "Address Family modifier\n" | |
e0bce756 DS |
6989 | BGP_SOFT_STR |
6990 | BGP_SOFT_OUT_STR) | |
718e3744 | 6991 | { |
afec25d9 | 6992 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 6993 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
afec25d9 | 6994 | BGP_CLEAR_SOFT_OUT, argv[3]->arg); |
718e3744 | 6995 | |
6996 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
afec25d9 | 6997 | BGP_CLEAR_SOFT_OUT, argv[3]->arg); |
718e3744 | 6998 | } |
6999 | ||
f412b39a DW |
7000 | /* |
7001 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7002 | * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) out", | |
7003 | * CLEAR_STR | |
7004 | * IP_STR | |
7005 | * BGP_STR | |
7006 | * BGP_INSTANCE_HELP_STR | |
7007 | * "BGP neighbor address to clear\n" | |
7008 | * "BGP neighbor on interface to clear\n" | |
7009 | * "Address family\n" | |
7010 | * "Address Family modifier\n" | |
7011 | * "Address Family modifier\n" | |
7012 | * BGP_SOFT_OUT_STR | |
7013 | * | |
7014 | */ | |
01080f7c | 7015 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_out, |
7016 | clear_ip_bgp_instance_peer_ipv4_soft_out_cmd, | |
7017 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", | |
7018 | CLEAR_STR | |
7019 | IP_STR | |
7020 | BGP_STR | |
7021 | BGP_INSTANCE_HELP_STR | |
7022 | "BGP neighbor address to clear\n" | |
7023 | "BGP neighbor on interface to clear\n" | |
7024 | "Address family\n" | |
7025 | "Address Family modifier\n" | |
7026 | "Address Family modifier\n" | |
7027 | BGP_SOFT_STR | |
7028 | BGP_SOFT_OUT_STR) | |
7029 | { | |
afec25d9 DW |
7030 | if (strncmp (argv[7]->arg, "m", 1) == 0) |
7031 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, | |
7032 | BGP_CLEAR_SOFT_OUT, argv[5]->arg); | |
01080f7c | 7033 | |
afec25d9 DW |
7034 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_peer, |
7035 | BGP_CLEAR_SOFT_OUT, argv[5]->arg); | |
01080f7c | 7036 | } |
7037 | ||
718e3744 | 7038 | |
01080f7c | 7039 | |
db64ea86 | 7040 | /* NOTE: WORD peers have not been tested for vpnv4 */ |
f412b39a DW |
7041 | /* |
7042 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7043 | * "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out", | |
7044 | * CLEAR_STR | |
7045 | * IP_STR | |
7046 | * BGP_STR | |
7047 | * "BGP neighbor address to clear\n" | |
7048 | * "BGP neighbor on interface to clear\n" | |
7049 | * "Address family\n" | |
7050 | * "Address Family Modifier\n" | |
7051 | * BGP_SOFT_OUT_STR | |
7052 | * | |
7053 | */ | |
718e3744 | 7054 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
7055 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
db64ea86 | 7056 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out", |
718e3744 | 7057 | CLEAR_STR |
7058 | IP_STR | |
7059 | BGP_STR | |
7060 | "BGP neighbor address to clear\n" | |
db64ea86 | 7061 | "BGP neighbor on interface to clear\n" |
718e3744 | 7062 | "Address family\n" |
7063 | "Address Family Modifier\n" | |
e0bce756 DS |
7064 | BGP_SOFT_STR |
7065 | BGP_SOFT_OUT_STR) | |
718e3744 | 7066 | { |
7067 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
afec25d9 | 7068 | BGP_CLEAR_SOFT_OUT, argv[3]->arg); |
718e3744 | 7069 | } |
7070 | ||
718e3744 | 7071 | |
f412b39a DW |
7072 | /* |
7073 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7074 | * "clear ip bgp A.B.C.D encap unicast out", | |
7075 | * CLEAR_STR | |
7076 | * IP_STR | |
7077 | * BGP_STR | |
7078 | * "BGP neighbor address to clear\n" | |
7079 | * "Address family\n" | |
7080 | * "Address Family Modifier\n" | |
7081 | * "Soft reconfig outbound update\n" | |
7082 | * | |
7083 | */ | |
587ff0fd LB |
7084 | DEFUN (clear_ip_bgp_peer_encap_soft_out, |
7085 | clear_ip_bgp_peer_encap_soft_out_cmd, | |
7086 | "clear ip bgp A.B.C.D encap unicast soft out", | |
7087 | CLEAR_STR | |
7088 | IP_STR | |
7089 | BGP_STR | |
7090 | "BGP neighbor address to clear\n" | |
7091 | "Address family\n" | |
7092 | "Address Family Modifier\n" | |
7093 | "Soft reconfig\n" | |
7094 | "Soft reconfig outbound update\n") | |
7095 | { | |
7096 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
afec25d9 | 7097 | BGP_CLEAR_SOFT_OUT, argv[3]->arg); |
587ff0fd LB |
7098 | } |
7099 | ||
587ff0fd | 7100 | |
f412b39a DW |
7101 | /* |
7102 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7103 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", | |
7104 | * CLEAR_STR | |
7105 | * BGP_STR | |
7106 | * BGP_INSTANCE_HELP_STR | |
7107 | * "Address family\n" | |
7108 | * "BGP neighbor address to clear\n" | |
7109 | * "BGP IPv6 neighbor to clear\n" | |
7110 | * "BGP neighbor on interface to clear\n" | |
7111 | * BGP_SOFT_STR | |
7112 | * BGP_SOFT_OUT_STR | |
7113 | * | |
7114 | * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", | |
7115 | * CLEAR_STR | |
7116 | * BGP_STR | |
7117 | * "Address family\n" | |
7118 | * "BGP neighbor address to clear\n" | |
7119 | * "BGP IPv6 neighbor to clear\n" | |
7120 | * "BGP neighbor on interface to clear\n" | |
7121 | * BGP_SOFT_OUT_STR | |
7122 | * | |
7123 | * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft out", | |
7124 | * CLEAR_STR | |
7125 | * BGP_STR | |
7126 | * BGP_INSTANCE_HELP_STR | |
7127 | * "BGP neighbor address to clear\n" | |
7128 | * "BGP IPv6 neighbor to clear\n" | |
7129 | * "BGP neighbor on interface to clear\n" | |
7130 | * BGP_SOFT_STR | |
7131 | * BGP_SOFT_OUT_STR | |
7132 | * | |
7133 | * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", | |
7134 | * CLEAR_STR | |
7135 | * BGP_STR | |
7136 | * "Address family\n" | |
7137 | * "BGP neighbor address to clear\n" | |
7138 | * "BGP IPv6 neighbor to clear\n" | |
7139 | * "BGP neighbor on interface to clear\n" | |
7140 | * BGP_SOFT_STR | |
7141 | * BGP_SOFT_OUT_STR | |
7142 | * | |
7143 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) out", | |
7144 | * CLEAR_STR | |
7145 | * BGP_STR | |
7146 | * BGP_INSTANCE_HELP_STR | |
7147 | * "Address family\n" | |
7148 | * "BGP neighbor address to clear\n" | |
7149 | * "BGP IPv6 neighbor to clear\n" | |
7150 | * "BGP neighbor on interface to clear\n" | |
7151 | * BGP_SOFT_OUT_STR | |
7152 | * | |
7153 | * "clear bgp (A.B.C.D|X:X::X:X|WORD) out", | |
7154 | * CLEAR_STR | |
7155 | * BGP_STR | |
7156 | * "BGP neighbor address to clear\n" | |
7157 | * "BGP IPv6 neighbor to clear\n" | |
7158 | * "BGP neighbor on interface to clear\n" | |
7159 | * BGP_SOFT_OUT_STR | |
7160 | * | |
7161 | * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) out", | |
7162 | * CLEAR_STR | |
7163 | * BGP_STR | |
7164 | * BGP_INSTANCE_HELP_STR | |
7165 | * "BGP neighbor address to clear\n" | |
7166 | * "BGP IPv6 neighbor to clear\n" | |
7167 | * "BGP neighbor on interface to clear\n" | |
7168 | * BGP_SOFT_OUT_STR | |
7169 | * | |
7170 | */ | |
718e3744 | 7171 | DEFUN (clear_bgp_peer_soft_out, |
7172 | clear_bgp_peer_soft_out_cmd, | |
a80beece | 7173 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 7174 | CLEAR_STR |
7175 | BGP_STR | |
7176 | "BGP neighbor address to clear\n" | |
7177 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7178 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
7179 | BGP_SOFT_STR |
7180 | BGP_SOFT_OUT_STR) | |
718e3744 | 7181 | { |
01080f7c | 7182 | if (argc == 3) |
7183 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
7184 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7185 | ||
718e3744 | 7186 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
afec25d9 | 7187 | BGP_CLEAR_SOFT_OUT, argv[2]->arg); |
718e3744 | 7188 | } |
7189 | ||
01080f7c | 7190 | |
f412b39a DW |
7191 | |
7192 | ||
7193 | ||
7194 | ||
7195 | ||
7196 | ||
7197 | /* | |
7198 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7199 | * "clear ip bgp peer-group WORD out", | |
7200 | * CLEAR_STR | |
7201 | * IP_STR | |
7202 | * BGP_STR | |
7203 | * "Clear all members of peer-group\n" | |
7204 | * "BGP peer-group name\n" | |
7205 | * BGP_SOFT_OUT_STR | |
7206 | * | |
7207 | * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", | |
7208 | * CLEAR_STR | |
7209 | * IP_STR | |
7210 | * BGP_STR | |
7211 | * BGP_INSTANCE_HELP_STR | |
7212 | * "Clear all members of peer-group\n" | |
7213 | * "BGP peer-group name\n" | |
7214 | * BGP_SOFT_STR | |
7215 | * BGP_SOFT_OUT_STR | |
7216 | * | |
7217 | * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD out", | |
7218 | * CLEAR_STR | |
7219 | * IP_STR | |
7220 | * BGP_STR | |
7221 | * BGP_INSTANCE_HELP_STR | |
7222 | * "Clear all members of peer-group\n" | |
7223 | * "BGP peer-group name\n" | |
7224 | * BGP_SOFT_OUT_STR | |
7225 | * | |
7226 | */ | |
7227 | DEFUN (clear_ip_bgp_peer_group_soft_out, | |
7228 | clear_ip_bgp_peer_group_soft_out_cmd, | |
7229 | "clear ip bgp peer-group WORD soft out", | |
718e3744 | 7230 | CLEAR_STR |
f412b39a | 7231 | IP_STR |
718e3744 | 7232 | BGP_STR |
f412b39a DW |
7233 | "Clear all members of peer-group\n" |
7234 | "BGP peer-group name\n" | |
e0bce756 DS |
7235 | BGP_SOFT_STR |
7236 | BGP_SOFT_OUT_STR) | |
f412b39a DW |
7237 | { |
7238 | if (argc == 3) | |
7239 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
7240 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
01080f7c | 7241 | |
718e3744 | 7242 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
afec25d9 | 7243 | BGP_CLEAR_SOFT_OUT, argv[4]->arg); |
718e3744 | 7244 | } |
7245 | ||
01080f7c | 7246 | |
718e3744 | 7247 | |
01080f7c | 7248 | |
f412b39a DW |
7249 | /* |
7250 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7251 | * "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
7252 | * CLEAR_STR | |
7253 | * IP_STR | |
7254 | * BGP_STR | |
7255 | * "Clear all members of peer-group\n" | |
7256 | * "BGP peer-group name\n" | |
7257 | * "Address family\n" | |
7258 | * "Address Family modifier\n" | |
7259 | * "Address Family modifier\n" | |
7260 | * BGP_SOFT_OUT_STR | |
7261 | * | |
7262 | */ | |
718e3744 | 7263 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, |
7264 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
7265 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
7266 | CLEAR_STR | |
7267 | IP_STR | |
7268 | BGP_STR | |
7269 | "Clear all members of peer-group\n" | |
7270 | "BGP peer-group name\n" | |
7271 | "Address family\n" | |
7272 | "Address Family modifier\n" | |
7273 | "Address Family modifier\n" | |
e0bce756 DS |
7274 | BGP_SOFT_STR |
7275 | BGP_SOFT_OUT_STR) | |
718e3744 | 7276 | { |
afec25d9 | 7277 | if (strncmp (argv[6]->arg, "m", 1) == 0) |
718e3744 | 7278 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
afec25d9 | 7279 | BGP_CLEAR_SOFT_OUT, argv[4]->arg); |
718e3744 | 7280 | |
7281 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
afec25d9 | 7282 | BGP_CLEAR_SOFT_OUT, argv[4]->arg); |
718e3744 | 7283 | } |
7284 | ||
f412b39a DW |
7285 | /* |
7286 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7287 | * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) out", | |
7288 | * CLEAR_STR | |
7289 | * IP_STR | |
7290 | * BGP_STR | |
7291 | * BGP_INSTANCE_HELP_STR | |
7292 | * "Clear all members of peer-group\n" | |
7293 | * "BGP peer-group name\n" | |
7294 | * "Address family\n" | |
7295 | * "Address Family modifier\n" | |
7296 | * "Address Family modifier\n" | |
7297 | * BGP_SOFT_OUT_STR | |
7298 | * | |
7299 | */ | |
01080f7c | 7300 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_out, |
7301 | clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd, | |
7302 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft out", | |
7303 | CLEAR_STR | |
7304 | IP_STR | |
7305 | BGP_STR | |
7306 | BGP_INSTANCE_HELP_STR | |
7307 | "Clear all members of peer-group\n" | |
7308 | "BGP peer-group name\n" | |
7309 | "Address family\n" | |
7310 | "Address Family modifier\n" | |
7311 | "Address Family modifier\n" | |
7312 | BGP_SOFT_STR | |
7313 | BGP_SOFT_OUT_STR) | |
7314 | { | |
afec25d9 DW |
7315 | if (strncmp (argv[8]->arg, "m", 1) == 0) |
7316 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_group, | |
7317 | BGP_CLEAR_SOFT_OUT, argv[6]->arg); | |
01080f7c | 7318 | |
afec25d9 DW |
7319 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_group, |
7320 | BGP_CLEAR_SOFT_OUT, argv[6]->arg); | |
01080f7c | 7321 | } |
7322 | ||
718e3744 | 7323 | |
01080f7c | 7324 | |
f412b39a DW |
7325 | /* |
7326 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7327 | * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft out", | |
7328 | * CLEAR_STR | |
7329 | * BGP_STR | |
7330 | * BGP_INSTANCE_HELP_STR | |
7331 | * "Clear all members of peer-group\n" | |
7332 | * "BGP peer-group name\n" | |
7333 | * BGP_SOFT_STR | |
7334 | * BGP_SOFT_OUT_STR | |
7335 | * | |
7336 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD out", | |
7337 | * CLEAR_STR | |
7338 | * BGP_STR | |
7339 | * BGP_INSTANCE_HELP_STR | |
7340 | * "Address family\n" | |
7341 | * "Clear all members of peer-group\n" | |
7342 | * "BGP peer-group name\n" | |
7343 | * BGP_SOFT_OUT_STR | |
7344 | * | |
7345 | * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD out", | |
7346 | * CLEAR_STR | |
7347 | * BGP_STR | |
7348 | * BGP_INSTANCE_HELP_STR | |
7349 | * "Clear all members of peer-group\n" | |
7350 | * "BGP peer-group name\n" | |
7351 | * BGP_SOFT_OUT_STR | |
7352 | * | |
7353 | * "clear bgp ipv6 peer-group WORD soft out", | |
7354 | * CLEAR_STR | |
7355 | * BGP_STR | |
7356 | * "Address family\n" | |
7357 | * "Clear all members of peer-group\n" | |
7358 | * "BGP peer-group name\n" | |
7359 | * BGP_SOFT_STR | |
7360 | * BGP_SOFT_OUT_STR | |
7361 | * | |
7362 | * "clear bgp peer-group WORD out", | |
7363 | * CLEAR_STR | |
7364 | * BGP_STR | |
7365 | * "Clear all members of peer-group\n" | |
7366 | * "BGP peer-group name\n" | |
7367 | * BGP_SOFT_OUT_STR | |
7368 | * | |
7369 | * "clear bgp ipv6 peer-group WORD out", | |
7370 | * CLEAR_STR | |
7371 | * BGP_STR | |
7372 | * "Address family\n" | |
7373 | * "Clear all members of peer-group\n" | |
7374 | * "BGP peer-group name\n" | |
7375 | * BGP_SOFT_OUT_STR | |
7376 | * | |
7377 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft out", | |
7378 | * CLEAR_STR | |
7379 | * BGP_STR | |
7380 | * BGP_INSTANCE_HELP_STR | |
7381 | * "Address family\n" | |
7382 | * "Clear all members of peer-group\n" | |
7383 | * "BGP peer-group name\n" | |
7384 | * BGP_SOFT_STR | |
7385 | * BGP_SOFT_OUT_STR | |
7386 | * | |
7387 | */ | |
718e3744 | 7388 | DEFUN (clear_bgp_peer_group_soft_out, |
7389 | clear_bgp_peer_group_soft_out_cmd, | |
7390 | "clear bgp peer-group WORD soft out", | |
7391 | CLEAR_STR | |
7392 | BGP_STR | |
7393 | "Clear all members of peer-group\n" | |
7394 | "BGP peer-group name\n" | |
e0bce756 DS |
7395 | BGP_SOFT_STR |
7396 | BGP_SOFT_OUT_STR) | |
718e3744 | 7397 | { |
01080f7c | 7398 | if (argc == 3) |
7399 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
7400 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7401 | ||
718e3744 | 7402 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
afec25d9 | 7403 | BGP_CLEAR_SOFT_OUT, argv[3]->arg); |
718e3744 | 7404 | } |
7405 | ||
01080f7c | 7406 | |
718e3744 | 7407 | |
01080f7c | 7408 | |
718e3744 | 7409 | |
01080f7c | 7410 | |
718e3744 | 7411 | |
01080f7c | 7412 | |
f412b39a DW |
7413 | /* |
7414 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7415 | * "clear ip bgp " BGP_INSTANCE_CMD " external soft out", | |
7416 | * CLEAR_STR | |
7417 | * IP_STR | |
7418 | * BGP_STR | |
7419 | * BGP_INSTANCE_HELP_STR | |
7420 | * "Clear all external peers\n" | |
7421 | * BGP_SOFT_STR | |
7422 | * BGP_SOFT_OUT_STR | |
7423 | * | |
7424 | * "clear ip bgp " BGP_INSTANCE_CMD " external out", | |
7425 | * CLEAR_STR | |
7426 | * IP_STR | |
7427 | * BGP_STR | |
7428 | * BGP_INSTANCE_HELP_STR | |
7429 | * "Clear all external peers\n" | |
7430 | * BGP_SOFT_OUT_STR | |
7431 | * | |
7432 | * "clear ip bgp external out", | |
7433 | * CLEAR_STR | |
7434 | * IP_STR | |
7435 | * BGP_STR | |
7436 | * "Clear all external peers\n" | |
7437 | * BGP_SOFT_OUT_STR | |
7438 | * | |
7439 | */ | |
718e3744 | 7440 | DEFUN (clear_ip_bgp_external_soft_out, |
f412b39a | 7441 | clear_ip_bgp_external_soft_out_cmd, |
718e3744 | 7442 | "clear ip bgp external soft out", |
7443 | CLEAR_STR | |
7444 | IP_STR | |
7445 | BGP_STR | |
7446 | "Clear all external peers\n" | |
e0bce756 DS |
7447 | BGP_SOFT_STR |
7448 | BGP_SOFT_OUT_STR) | |
01080f7c | 7449 | { |
7450 | if (argc == 2) | |
7451 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
7452 | BGP_CLEAR_SOFT_OUT, NULL); | |
7453 | ||
7454 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7455 | BGP_CLEAR_SOFT_OUT, NULL); | |
7456 | } | |
7457 | ||
01080f7c | 7458 | |
718e3744 | 7459 | |
718e3744 | 7460 | |
f412b39a DW |
7461 | /* |
7462 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7463 | * "clear ip bgp external ipv4 (unicast|multicast) out", | |
7464 | * CLEAR_STR | |
7465 | * IP_STR | |
7466 | * BGP_STR | |
7467 | * "Clear all external peers\n" | |
7468 | * "Address family\n" | |
7469 | * "Address Family modifier\n" | |
7470 | * "Address Family modifier\n" | |
7471 | * BGP_SOFT_OUT_STR | |
7472 | * | |
7473 | */ | |
718e3744 | 7474 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, |
7475 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
7476 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
7477 | CLEAR_STR | |
7478 | IP_STR | |
7479 | BGP_STR | |
7480 | "Clear all external peers\n" | |
7481 | "Address family\n" | |
7482 | "Address Family modifier\n" | |
7483 | "Address Family modifier\n" | |
e0bce756 DS |
7484 | BGP_SOFT_STR |
7485 | BGP_SOFT_OUT_STR) | |
718e3744 | 7486 | { |
afec25d9 | 7487 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 7488 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
7489 | BGP_CLEAR_SOFT_OUT, NULL); | |
7490 | ||
7491 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7492 | BGP_CLEAR_SOFT_OUT, NULL); | |
7493 | } | |
7494 | ||
f412b39a DW |
7495 | /* |
7496 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7497 | * "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) out", | |
7498 | * CLEAR_STR | |
7499 | * IP_STR | |
7500 | * BGP_STR | |
7501 | * BGP_INSTANCE_HELP_STR | |
7502 | * "Clear all external peers\n" | |
7503 | * "Address family\n" | |
7504 | * "Address Family modifier\n" | |
7505 | * "Address Family modifier\n" | |
7506 | * BGP_SOFT_OUT_STR | |
7507 | * | |
7508 | */ | |
01080f7c | 7509 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft_out, |
7510 | clear_ip_bgp_instance_external_ipv4_soft_out_cmd, | |
7511 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft out", | |
7512 | CLEAR_STR | |
7513 | IP_STR | |
7514 | BGP_STR | |
7515 | BGP_INSTANCE_HELP_STR | |
7516 | "Clear all external peers\n" | |
7517 | "Address family\n" | |
7518 | "Address Family modifier\n" | |
7519 | "Address Family modifier\n" | |
7520 | BGP_SOFT_STR | |
7521 | BGP_SOFT_OUT_STR) | |
7522 | { | |
afec25d9 DW |
7523 | if (strncmp (argv[7]->arg, "m", 1) == 0) |
7524 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_external, | |
01080f7c | 7525 | BGP_CLEAR_SOFT_OUT, NULL); |
7526 | ||
afec25d9 | 7527 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_external, |
01080f7c | 7528 | BGP_CLEAR_SOFT_OUT, NULL); |
7529 | } | |
7530 | ||
718e3744 | 7531 | |
01080f7c | 7532 | |
f412b39a DW |
7533 | /* |
7534 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7535 | * "clear bgp ipv6 external WORD out", | |
7536 | * CLEAR_STR | |
7537 | * BGP_STR | |
7538 | * "Address family\n" | |
7539 | * "Clear all external peers\n" | |
7540 | * BGP_SOFT_OUT_STR | |
7541 | * | |
7542 | * "clear bgp " BGP_INSTANCE_CMD " external soft out", | |
7543 | * CLEAR_STR | |
7544 | * BGP_STR | |
7545 | * BGP_INSTANCE_HELP_STR | |
7546 | * "Clear all external peers\n" | |
7547 | * BGP_SOFT_STR | |
7548 | * BGP_SOFT_OUT_STR | |
7549 | * | |
7550 | * "clear bgp " BGP_INSTANCE_CMD " external out", | |
7551 | * CLEAR_STR | |
7552 | * BGP_STR | |
7553 | * BGP_INSTANCE_HELP_STR | |
7554 | * "Clear all external peers\n" | |
7555 | * BGP_SOFT_OUT_STR | |
7556 | * | |
7557 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD out", | |
7558 | * CLEAR_STR | |
7559 | * BGP_STR | |
7560 | * BGP_INSTANCE_HELP_STR | |
7561 | * "Address family\n" | |
7562 | * "Clear all external peers\n" | |
7563 | * BGP_SOFT_OUT_STR | |
7564 | * | |
7565 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft out", | |
7566 | * CLEAR_STR | |
7567 | * BGP_STR | |
7568 | * BGP_INSTANCE_HELP_STR | |
7569 | * "Address family\n" | |
7570 | * "Clear all external peers\n" | |
7571 | * BGP_SOFT_STR | |
7572 | * BGP_SOFT_OUT_STR | |
7573 | * | |
7574 | * "clear bgp ipv6 external soft out", | |
7575 | * CLEAR_STR | |
7576 | * BGP_STR | |
7577 | * "Address family\n" | |
7578 | * "Clear all external peers\n" | |
7579 | * BGP_SOFT_STR | |
7580 | * BGP_SOFT_OUT_STR | |
7581 | * | |
7582 | * "clear bgp external out", | |
7583 | * CLEAR_STR | |
7584 | * BGP_STR | |
7585 | * "Clear all external peers\n" | |
7586 | * BGP_SOFT_OUT_STR | |
7587 | * | |
7588 | */ | |
718e3744 | 7589 | DEFUN (clear_bgp_external_soft_out, |
7590 | clear_bgp_external_soft_out_cmd, | |
7591 | "clear bgp external soft out", | |
7592 | CLEAR_STR | |
7593 | BGP_STR | |
7594 | "Clear all external peers\n" | |
e0bce756 DS |
7595 | BGP_SOFT_STR |
7596 | BGP_SOFT_OUT_STR) | |
718e3744 | 7597 | { |
01080f7c | 7598 | if (argc == 2) |
7599 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
7600 | BGP_CLEAR_SOFT_OUT, NULL); | |
7601 | ||
718e3744 | 7602 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
7603 | BGP_CLEAR_SOFT_OUT, NULL); | |
7604 | } | |
7605 | ||
01080f7c | 7606 | |
718e3744 | 7607 | |
01080f7c | 7608 | |
718e3744 | 7609 | |
01080f7c | 7610 | |
718e3744 | 7611 | |
01080f7c | 7612 | |
f412b39a DW |
7613 | /* |
7614 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7615 | * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", | |
7616 | * CLEAR_STR | |
7617 | * IP_STR | |
7618 | * BGP_STR | |
7619 | * BGP_INSTANCE_HELP_STR | |
7620 | * "Clear peers with the AS number\n" | |
7621 | * BGP_SOFT_STR | |
7622 | * BGP_SOFT_OUT_STR | |
7623 | * | |
7624 | * "clear ip bgp " CMD_AS_RANGE " out", | |
7625 | * CLEAR_STR | |
7626 | * IP_STR | |
7627 | * BGP_STR | |
7628 | * "Clear peers with the AS number\n" | |
7629 | * BGP_SOFT_OUT_STR | |
7630 | * | |
7631 | * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", | |
7632 | * CLEAR_STR | |
7633 | * IP_STR | |
7634 | * BGP_STR | |
7635 | * BGP_INSTANCE_HELP_STR | |
7636 | * "Clear peers with the AS number\n" | |
7637 | * BGP_SOFT_OUT_STR | |
7638 | * | |
7639 | */ | |
718e3744 | 7640 | DEFUN (clear_ip_bgp_as_soft_out, |
7641 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 7642 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 7643 | CLEAR_STR |
7644 | IP_STR | |
7645 | BGP_STR | |
7646 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7647 | BGP_SOFT_STR |
7648 | BGP_SOFT_OUT_STR) | |
718e3744 | 7649 | { |
01080f7c | 7650 | if (argc == 3) |
7651 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
7652 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7653 | ||
718e3744 | 7654 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
afec25d9 | 7655 | BGP_CLEAR_SOFT_OUT, argv[3]->arg); |
718e3744 | 7656 | } |
7657 | ||
01080f7c | 7658 | |
718e3744 | 7659 | |
01080f7c | 7660 | |
f412b39a DW |
7661 | /* |
7662 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7663 | * "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", | |
7664 | * CLEAR_STR | |
7665 | * IP_STR | |
7666 | * BGP_STR | |
7667 | * "Clear peers with the AS number\n" | |
7668 | * "Address family\n" | |
7669 | * "Address Family modifier\n" | |
7670 | * "Address Family modifier\n" | |
7671 | * BGP_SOFT_OUT_STR | |
7672 | * | |
7673 | */ | |
718e3744 | 7674 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, |
7675 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 7676 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 7677 | CLEAR_STR |
7678 | IP_STR | |
7679 | BGP_STR | |
7680 | "Clear peers with the AS number\n" | |
7681 | "Address family\n" | |
7682 | "Address Family modifier\n" | |
7683 | "Address Family modifier\n" | |
e0bce756 DS |
7684 | BGP_SOFT_STR |
7685 | BGP_SOFT_OUT_STR) | |
718e3744 | 7686 | { |
afec25d9 | 7687 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 7688 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
afec25d9 | 7689 | BGP_CLEAR_SOFT_OUT, argv[3]->arg); |
718e3744 | 7690 | |
7691 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
afec25d9 | 7692 | BGP_CLEAR_SOFT_OUT, argv[3]->arg); |
718e3744 | 7693 | } |
7694 | ||
f412b39a DW |
7695 | /* |
7696 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7697 | * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) out", | |
7698 | * CLEAR_STR | |
7699 | * IP_STR | |
7700 | * BGP_STR | |
7701 | * BGP_INSTANCE_HELP_STR | |
7702 | * "Clear peers with the AS number\n" | |
7703 | * "Address family\n" | |
7704 | * "Address Family modifier\n" | |
7705 | * "Address Family modifier\n" | |
7706 | * BGP_SOFT_OUT_STR | |
7707 | * | |
7708 | */ | |
01080f7c | 7709 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft_out, |
7710 | clear_ip_bgp_instance_as_ipv4_soft_out_cmd, | |
7711 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", | |
7712 | CLEAR_STR | |
7713 | IP_STR | |
7714 | BGP_STR | |
7715 | BGP_INSTANCE_HELP_STR | |
7716 | "Clear peers with the AS number\n" | |
7717 | "Address family\n" | |
7718 | "Address Family modifier\n" | |
7719 | "Address Family modifier\n" | |
7720 | BGP_SOFT_STR | |
7721 | BGP_SOFT_OUT_STR) | |
7722 | { | |
afec25d9 DW |
7723 | if (strncmp (argv[7]->arg, "m", 1) == 0) |
7724 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_as, | |
7725 | BGP_CLEAR_SOFT_OUT, argv[5]->arg); | |
01080f7c | 7726 | |
afec25d9 DW |
7727 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_as, |
7728 | BGP_CLEAR_SOFT_OUT, argv[5]->arg); | |
01080f7c | 7729 | } |
7730 | ||
718e3744 | 7731 | |
01080f7c | 7732 | |
f412b39a DW |
7733 | /* |
7734 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7735 | * "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", | |
7736 | * CLEAR_STR | |
7737 | * IP_STR | |
7738 | * BGP_STR | |
7739 | * "Clear peers with the AS number\n" | |
7740 | * "Address family\n" | |
7741 | * "Address Family modifier\n" | |
7742 | * BGP_SOFT_OUT_STR | |
7743 | * | |
7744 | */ | |
718e3744 | 7745 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, |
7746 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 7747 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 7748 | CLEAR_STR |
7749 | IP_STR | |
7750 | BGP_STR | |
7751 | "Clear peers with the AS number\n" | |
7752 | "Address family\n" | |
7753 | "Address Family modifier\n" | |
e0bce756 DS |
7754 | BGP_SOFT_STR |
7755 | BGP_SOFT_OUT_STR) | |
718e3744 | 7756 | { |
7757 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
afec25d9 | 7758 | BGP_CLEAR_SOFT_OUT, argv[3]->arg); |
718e3744 | 7759 | } |
7760 | ||
718e3744 | 7761 | |
f412b39a DW |
7762 | /* |
7763 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7764 | * "clear ip bgp " CMD_AS_RANGE " encap unicast out", | |
7765 | * CLEAR_STR | |
7766 | * IP_STR | |
7767 | * BGP_STR | |
7768 | * "Clear peers with the AS number\n" | |
7769 | * "Address family\n" | |
7770 | * "Address Family modifier\n" | |
7771 | * "Soft reconfig outbound update\n" | |
7772 | * | |
7773 | */ | |
587ff0fd LB |
7774 | DEFUN (clear_ip_bgp_as_encap_soft_out, |
7775 | clear_ip_bgp_as_encap_soft_out_cmd, | |
7776 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft out", | |
7777 | CLEAR_STR | |
7778 | IP_STR | |
7779 | BGP_STR | |
7780 | "Clear peers with the AS number\n" | |
7781 | "Address family\n" | |
7782 | "Address Family modifier\n" | |
7783 | "Soft reconfig\n" | |
7784 | "Soft reconfig outbound update\n") | |
7785 | { | |
7786 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
afec25d9 | 7787 | BGP_CLEAR_SOFT_OUT, argv[3]->arg); |
587ff0fd LB |
7788 | } |
7789 | ||
587ff0fd | 7790 | |
f412b39a DW |
7791 | /* |
7792 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7793 | * "clear bgp ipv6 " CMD_AS_RANGE " soft out", | |
7794 | * CLEAR_STR | |
7795 | * BGP_STR | |
7796 | * "Address family\n" | |
7797 | * "Clear peers with the AS number\n" | |
7798 | * BGP_SOFT_STR | |
7799 | * BGP_SOFT_OUT_STR | |
7800 | * | |
7801 | * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " out", | |
7802 | * CLEAR_STR | |
7803 | * BGP_STR | |
7804 | * BGP_INSTANCE_HELP_STR | |
7805 | * "Clear peers with the AS number\n" | |
7806 | * BGP_SOFT_OUT_STR | |
7807 | * | |
7808 | * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft out", | |
7809 | * CLEAR_STR | |
7810 | * BGP_STR | |
7811 | * BGP_INSTANCE_HELP_STR | |
7812 | * "Clear peers with the AS number\n" | |
7813 | * BGP_SOFT_STR | |
7814 | * BGP_SOFT_OUT_STR | |
7815 | * | |
7816 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " out", | |
7817 | * CLEAR_STR | |
7818 | * BGP_STR | |
7819 | * BGP_INSTANCE_HELP_STR | |
7820 | * "Address family\n" | |
7821 | * "Clear peers with the AS number\n" | |
7822 | * BGP_SOFT_OUT_STR | |
7823 | * | |
7824 | * "clear bgp " CMD_AS_RANGE " out", | |
7825 | * CLEAR_STR | |
7826 | * BGP_STR | |
7827 | * "Clear peers with the AS number\n" | |
7828 | * BGP_SOFT_OUT_STR | |
7829 | * | |
7830 | * "clear bgp ipv6 " CMD_AS_RANGE " out", | |
7831 | * CLEAR_STR | |
7832 | * BGP_STR | |
7833 | * "Address family\n" | |
7834 | * "Clear peers with the AS number\n" | |
7835 | * BGP_SOFT_OUT_STR | |
7836 | * | |
7837 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft out", | |
7838 | * CLEAR_STR | |
7839 | * BGP_STR | |
7840 | * BGP_INSTANCE_HELP_STR | |
7841 | * "Address family\n" | |
7842 | * "Clear peers with the AS number\n" | |
7843 | * BGP_SOFT_STR | |
7844 | * BGP_SOFT_OUT_STR | |
7845 | * | |
7846 | */ | |
718e3744 | 7847 | DEFUN (clear_bgp_as_soft_out, |
7848 | clear_bgp_as_soft_out_cmd, | |
320da874 | 7849 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 7850 | CLEAR_STR |
7851 | BGP_STR | |
7852 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7853 | BGP_SOFT_STR |
7854 | BGP_SOFT_OUT_STR) | |
718e3744 | 7855 | { |
01080f7c | 7856 | if (argc == 3) |
7857 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
7858 | BGP_CLEAR_SOFT_OUT, argv[2]); | |
7859 | ||
718e3744 | 7860 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
afec25d9 | 7861 | BGP_CLEAR_SOFT_OUT, argv[2]->arg); |
718e3744 | 7862 | } |
7863 | ||
01080f7c | 7864 | |
718e3744 | 7865 | |
01080f7c | 7866 | |
718e3744 | 7867 | |
01080f7c | 7868 | |
6b0655a2 | 7869 | |
01080f7c | 7870 | |
718e3744 | 7871 | /* Inbound soft-reconfiguration */ |
f412b39a DW |
7872 | /* |
7873 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7874 | * "clear ip bgp " BGP_INSTANCE_CMD " * in", | |
7875 | * CLEAR_STR | |
7876 | * IP_STR | |
7877 | * BGP_STR | |
7878 | * BGP_INSTANCE_HELP_STR | |
7879 | * "Clear all peers\n" | |
7880 | * BGP_SOFT_IN_STR | |
7881 | * | |
7882 | * "clear ip bgp " BGP_INSTANCE_CMD " * soft in", | |
7883 | * CLEAR_STR | |
7884 | * IP_STR | |
7885 | * BGP_STR | |
7886 | * BGP_INSTANCE_HELP_STR | |
7887 | * "Clear all peers\n" | |
7888 | * BGP_SOFT_STR | |
7889 | * BGP_SOFT_IN_STR | |
7890 | * | |
7891 | * "clear ip bgp * in", | |
7892 | * CLEAR_STR | |
7893 | * IP_STR | |
7894 | * BGP_STR | |
7895 | * "Clear all peers\n" | |
7896 | * BGP_SOFT_IN_STR | |
7897 | * | |
7898 | */ | |
718e3744 | 7899 | DEFUN (clear_ip_bgp_all_soft_in, |
7900 | clear_ip_bgp_all_soft_in_cmd, | |
7901 | "clear ip bgp * soft in", | |
7902 | CLEAR_STR | |
7903 | IP_STR | |
7904 | BGP_STR | |
7905 | "Clear all peers\n" | |
e0bce756 DS |
7906 | BGP_SOFT_STR |
7907 | BGP_SOFT_IN_STR) | |
718e3744 | 7908 | { |
6aeb9e78 DS |
7909 | if (argc == 2) |
7910 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 7911 | BGP_CLEAR_SOFT_IN, NULL); |
7912 | ||
7913 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7914 | BGP_CLEAR_SOFT_IN, NULL); | |
7915 | } | |
7916 | ||
718e3744 | 7917 | |
718e3744 | 7918 | |
01080f7c | 7919 | |
718e3744 | 7920 | DEFUN (clear_ip_bgp_all_in_prefix_filter, |
7921 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
7922 | "clear ip bgp * in prefix-filter", | |
7923 | CLEAR_STR | |
7924 | IP_STR | |
7925 | BGP_STR | |
7926 | "Clear all peers\n" | |
e0bce756 | 7927 | BGP_SOFT_IN_STR |
718e3744 | 7928 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7929 | { | |
6aeb9e78 DS |
7930 | if (argc== 2) |
7931 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 7932 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); |
7933 | ||
7934 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7935 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7936 | } | |
7937 | ||
f412b39a DW |
7938 | /* |
7939 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7940 | * "clear ip bgp * ipv4 (unicast|multicast) in", | |
7941 | * CLEAR_STR | |
7942 | * IP_STR | |
7943 | * BGP_STR | |
7944 | * "Clear all peers\n" | |
7945 | * "Address family\n" | |
7946 | * "Address Family modifier\n" | |
7947 | * "Address Family modifier\n" | |
7948 | * BGP_SOFT_IN_STR | |
7949 | * | |
7950 | */ | |
718e3744 | 7951 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, |
7952 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
7953 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
7954 | CLEAR_STR | |
7955 | IP_STR | |
7956 | BGP_STR | |
7957 | "Clear all peers\n" | |
7958 | "Address family\n" | |
7959 | "Address Family modifier\n" | |
7960 | "Address Family modifier\n" | |
e0bce756 DS |
7961 | BGP_SOFT_STR |
7962 | BGP_SOFT_IN_STR) | |
718e3744 | 7963 | { |
afec25d9 | 7964 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 7965 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
7966 | BGP_CLEAR_SOFT_IN, NULL); | |
7967 | ||
7968 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7969 | BGP_CLEAR_SOFT_IN, NULL); | |
7970 | } | |
7971 | ||
f412b39a DW |
7972 | /* |
7973 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
7974 | * "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) in", | |
7975 | * CLEAR_STR | |
7976 | * IP_STR | |
7977 | * BGP_STR | |
7978 | * BGP_INSTANCE_HELP_STR | |
7979 | * "Clear all peers\n" | |
7980 | * "Address family\n" | |
7981 | * "Address Family modifier\n" | |
7982 | * "Address Family modifier\n" | |
7983 | * BGP_SOFT_IN_STR | |
7984 | * | |
7985 | */ | |
718e3744 | 7986 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, |
7987 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
8386ac43 | 7988 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft in", |
718e3744 | 7989 | CLEAR_STR |
7990 | IP_STR | |
7991 | BGP_STR | |
8386ac43 | 7992 | BGP_INSTANCE_HELP_STR |
718e3744 | 7993 | "Clear all peers\n" |
7994 | "Address family\n" | |
7995 | "Address Family modifier\n" | |
7996 | "Address Family modifier\n" | |
e0bce756 DS |
7997 | BGP_SOFT_STR |
7998 | BGP_SOFT_IN_STR) | |
718e3744 | 7999 | { |
afec25d9 DW |
8000 | if (strncmp (argv[7]->arg, "m", 1) == 0) |
8001 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_all, | |
718e3744 | 8002 | BGP_CLEAR_SOFT_IN, NULL); |
8003 | ||
afec25d9 | 8004 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_all, |
718e3744 | 8005 | BGP_CLEAR_SOFT_IN, NULL); |
8006 | } | |
8007 | ||
718e3744 | 8008 | |
718e3744 | 8009 | |
01080f7c | 8010 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, |
8011 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
8012 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
718e3744 | 8013 | CLEAR_STR |
8014 | IP_STR | |
8015 | BGP_STR | |
8016 | "Clear all peers\n" | |
8017 | "Address family\n" | |
8018 | "Address Family modifier\n" | |
8019 | "Address Family modifier\n" | |
e0bce756 | 8020 | BGP_SOFT_IN_STR |
718e3744 | 8021 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8022 | { | |
afec25d9 | 8023 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
01080f7c | 8024 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
8025 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
718e3744 | 8026 | |
01080f7c | 8027 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, |
8028 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
718e3744 | 8029 | } |
8030 | ||
f412b39a DW |
8031 | /* |
8032 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8033 | * "clear ip bgp * vpnv4 unicast in", | |
8034 | * CLEAR_STR | |
8035 | * IP_STR | |
8036 | * BGP_STR | |
8037 | * "Clear all peers\n" | |
8038 | * "Address family\n" | |
8039 | * "Address Family Modifier\n" | |
8040 | * BGP_SOFT_IN_STR | |
8041 | * | |
8042 | */ | |
718e3744 | 8043 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, |
8044 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
8045 | "clear ip bgp * vpnv4 unicast soft in", | |
8046 | CLEAR_STR | |
8047 | IP_STR | |
8048 | BGP_STR | |
8049 | "Clear all peers\n" | |
8050 | "Address family\n" | |
8051 | "Address Family Modifier\n" | |
e0bce756 DS |
8052 | BGP_SOFT_STR |
8053 | BGP_SOFT_IN_STR) | |
718e3744 | 8054 | { |
8055 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
8056 | BGP_CLEAR_SOFT_IN, NULL); | |
8057 | } | |
8058 | ||
718e3744 | 8059 | |
f412b39a DW |
8060 | /* |
8061 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8062 | * "clear ip bgp * encap unicast in", | |
8063 | * CLEAR_STR | |
8064 | * IP_STR | |
8065 | * BGP_STR | |
8066 | * "Clear all peers\n" | |
8067 | * "Address family\n" | |
8068 | * "Address Family Modifier\n" | |
8069 | * "Soft reconfig inbound update\n" | |
8070 | * | |
8071 | */ | |
587ff0fd LB |
8072 | DEFUN (clear_ip_bgp_all_encap_soft_in, |
8073 | clear_ip_bgp_all_encap_soft_in_cmd, | |
8074 | "clear ip bgp * encap unicast soft in", | |
8075 | CLEAR_STR | |
8076 | IP_STR | |
8077 | BGP_STR | |
8078 | "Clear all peers\n" | |
8079 | "Address family\n" | |
8080 | "Address Family Modifier\n" | |
8081 | "Soft reconfig\n" | |
8082 | "Soft reconfig inbound update\n") | |
8083 | { | |
8084 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
8085 | BGP_CLEAR_SOFT_IN, NULL); | |
8086 | } | |
8087 | ||
587ff0fd | 8088 | |
f412b39a DW |
8089 | /* |
8090 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8091 | * "clear bgp ipv6 * soft in", | |
8092 | * CLEAR_STR | |
8093 | * BGP_STR | |
8094 | * "Address family\n" | |
8095 | * "Clear all peers\n" | |
8096 | * BGP_SOFT_STR | |
8097 | * BGP_SOFT_IN_STR | |
8098 | * | |
8099 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 * in", | |
8100 | * CLEAR_STR | |
8101 | * BGP_STR | |
8102 | * BGP_INSTANCE_HELP_STR | |
8103 | * "Address family\n" | |
8104 | * "Clear all peers\n" | |
8105 | * BGP_SOFT_IN_STR | |
8106 | * | |
8107 | * "clear bgp * in", | |
8108 | * CLEAR_STR | |
8109 | * BGP_STR | |
8110 | * "Clear all peers\n" | |
8111 | * BGP_SOFT_IN_STR | |
8112 | * | |
8113 | * "clear bgp " BGP_INSTANCE_CMD " * in", | |
8114 | * CLEAR_STR | |
8115 | * BGP_STR | |
8116 | * BGP_INSTANCE_HELP_STR | |
8117 | * "Clear all peers\n" | |
8118 | * BGP_SOFT_IN_STR | |
8119 | * | |
8120 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft in", | |
8121 | * CLEAR_STR | |
8122 | * BGP_STR | |
8123 | * BGP_INSTANCE_HELP_STR | |
8124 | * "Address family\n" | |
8125 | * "Clear all peers\n" | |
8126 | * BGP_SOFT_STR | |
8127 | * BGP_SOFT_IN_STR | |
8128 | * | |
8129 | * "clear bgp ipv6 * in", | |
8130 | * CLEAR_STR | |
8131 | * BGP_STR | |
8132 | * "Address family\n" | |
8133 | * "Clear all peers\n" | |
8134 | * BGP_SOFT_IN_STR | |
8135 | * | |
8136 | * "clear bgp " BGP_INSTANCE_CMD " * soft in", | |
8137 | * CLEAR_STR | |
8138 | * BGP_STR | |
8139 | * BGP_INSTANCE_HELP_STR | |
8140 | * "Clear all peers\n" | |
8141 | * BGP_SOFT_STR | |
8142 | * BGP_SOFT_IN_STR | |
8143 | * | |
8144 | */ | |
718e3744 | 8145 | DEFUN (clear_bgp_all_soft_in, |
8146 | clear_bgp_all_soft_in_cmd, | |
8147 | "clear bgp * soft in", | |
8148 | CLEAR_STR | |
8149 | BGP_STR | |
8150 | "Clear all peers\n" | |
e0bce756 DS |
8151 | BGP_SOFT_STR |
8152 | BGP_SOFT_IN_STR) | |
718e3744 | 8153 | { |
6aeb9e78 DS |
8154 | if (argc == 2) |
8155 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
718e3744 | 8156 | BGP_CLEAR_SOFT_IN, NULL); |
8157 | ||
8158 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
8159 | BGP_CLEAR_SOFT_IN, NULL); | |
8160 | } | |
8161 | ||
718e3744 | 8162 | |
718e3744 | 8163 | |
01080f7c | 8164 | |
718e3744 | 8165 | |
01080f7c | 8166 | |
718e3744 | 8167 | |
01080f7c | 8168 | |
f412b39a DW |
8169 | /* |
8170 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8171 | * "clear bgp ipv6 * in prefix-filter", | |
8172 | * CLEAR_STR | |
8173 | * BGP_STR | |
8174 | * "Address family\n" | |
8175 | * "Clear all peers\n" | |
8176 | * BGP_SOFT_IN_STR | |
8177 | * "Push out prefix-list ORF and do inbound soft reconfig\n" | |
8178 | * | |
8179 | */ | |
718e3744 | 8180 | DEFUN (clear_bgp_all_in_prefix_filter, |
8181 | clear_bgp_all_in_prefix_filter_cmd, | |
8182 | "clear bgp * in prefix-filter", | |
8183 | CLEAR_STR | |
8184 | BGP_STR | |
8185 | "Clear all peers\n" | |
e0bce756 | 8186 | BGP_SOFT_IN_STR |
718e3744 | 8187 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8188 | { | |
8189 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
8190 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8191 | } | |
8192 | ||
718e3744 | 8193 | |
f412b39a DW |
8194 | /* |
8195 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8196 | * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) in", | |
8197 | * CLEAR_STR | |
8198 | * IP_STR | |
8199 | * BGP_STR | |
8200 | * BGP_INSTANCE_HELP_STR | |
8201 | * "BGP neighbor address to clear\n" | |
8202 | * "BGP neighbor on interface to clear\n" | |
8203 | * BGP_SOFT_IN_STR | |
8204 | * | |
8205 | * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft in", | |
8206 | * CLEAR_STR | |
8207 | * IP_STR | |
8208 | * BGP_STR | |
8209 | * BGP_INSTANCE_HELP_STR | |
8210 | * "BGP neighbor address to clear\n" | |
8211 | * "BGP neighbor on interface to clear\n" | |
8212 | * BGP_SOFT_STR | |
8213 | * BGP_SOFT_IN_STR | |
8214 | * | |
8215 | * "clear ip bgp (A.B.C.D|WORD) in", | |
8216 | * CLEAR_STR | |
8217 | * IP_STR | |
8218 | * BGP_STR | |
8219 | * "BGP neighbor address to clear\n" | |
8220 | * "BGP neighbor on interface to clear\n" | |
8221 | * BGP_SOFT_IN_STR | |
8222 | * | |
8223 | */ | |
718e3744 | 8224 | DEFUN (clear_ip_bgp_peer_soft_in, |
8225 | clear_ip_bgp_peer_soft_in_cmd, | |
db64ea86 | 8226 | "clear ip bgp (A.B.C.D|WORD) soft in", |
718e3744 | 8227 | CLEAR_STR |
8228 | IP_STR | |
8229 | BGP_STR | |
8230 | "BGP neighbor address to clear\n" | |
db64ea86 | 8231 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
8232 | BGP_SOFT_STR |
8233 | BGP_SOFT_IN_STR) | |
718e3744 | 8234 | { |
01080f7c | 8235 | if (argc == 3) |
8236 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
8237 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8238 | ||
718e3744 | 8239 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
afec25d9 | 8240 | BGP_CLEAR_SOFT_IN, argv[3]->arg); |
718e3744 | 8241 | } |
8242 | ||
01080f7c | 8243 | |
01080f7c | 8244 | |
01080f7c | 8245 | |
718e3744 | 8246 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, |
8247 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
db64ea86 | 8248 | "clear ip bgp (A.B.C.D|WORD) in prefix-filter", |
718e3744 | 8249 | CLEAR_STR |
8250 | IP_STR | |
8251 | BGP_STR | |
8252 | "BGP neighbor address to clear\n" | |
db64ea86 | 8253 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8254 | BGP_SOFT_IN_STR |
718e3744 | 8255 | "Push out the existing ORF prefix-list\n") |
8256 | { | |
8257 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
afec25d9 | 8258 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); |
718e3744 | 8259 | } |
8260 | ||
f412b39a DW |
8261 | /* |
8262 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8263 | * "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in", | |
8264 | * CLEAR_STR | |
8265 | * IP_STR | |
8266 | * BGP_STR | |
8267 | * "BGP neighbor address to clear\n" | |
8268 | * "BGP neighbor on interface to clear\n" | |
8269 | * "Address family\n" | |
8270 | * "Address Family modifier\n" | |
8271 | * "Address Family modifier\n" | |
8272 | * BGP_SOFT_IN_STR | |
8273 | * | |
8274 | */ | |
718e3744 | 8275 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, |
8276 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
db64ea86 | 8277 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", |
718e3744 | 8278 | CLEAR_STR |
8279 | IP_STR | |
8280 | BGP_STR | |
8281 | "BGP neighbor address to clear\n" | |
db64ea86 | 8282 | "BGP neighbor on interface to clear\n" |
718e3744 | 8283 | "Address family\n" |
8284 | "Address Family modifier\n" | |
8285 | "Address Family modifier\n" | |
e0bce756 DS |
8286 | BGP_SOFT_STR |
8287 | BGP_SOFT_IN_STR) | |
718e3744 | 8288 | { |
afec25d9 | 8289 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 8290 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
afec25d9 | 8291 | BGP_CLEAR_SOFT_IN, argv[3]->arg); |
718e3744 | 8292 | |
8293 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
afec25d9 | 8294 | BGP_CLEAR_SOFT_IN, argv[3]->arg); |
718e3744 | 8295 | } |
8296 | ||
f412b39a DW |
8297 | /* |
8298 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8299 | * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) in", | |
8300 | * CLEAR_STR | |
8301 | * IP_STR | |
8302 | * BGP_STR | |
8303 | * BGP_INSTANCE_HELP_STR | |
8304 | * "BGP neighbor address to clear\n" | |
8305 | * "BGP neighbor on interface to clear\n" | |
8306 | * "Address family\n" | |
8307 | * "Address Family modifier\n" | |
8308 | * "Address Family modifier\n" | |
8309 | * BGP_SOFT_IN_STR | |
8310 | * | |
8311 | */ | |
01080f7c | 8312 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft_in, |
8313 | clear_ip_bgp_instance_peer_ipv4_soft_in_cmd, | |
8314 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", | |
8315 | CLEAR_STR | |
8316 | IP_STR | |
8317 | BGP_STR | |
8318 | BGP_INSTANCE_HELP_STR | |
8319 | "BGP neighbor address to clear\n" | |
8320 | "BGP neighbor on interface to clear\n" | |
8321 | "Address family\n" | |
8322 | "Address Family modifier\n" | |
8323 | "Address Family modifier\n" | |
8324 | BGP_SOFT_STR | |
8325 | BGP_SOFT_IN_STR) | |
8326 | { | |
afec25d9 DW |
8327 | if (strncmp (argv[7]->arg, "m", 1) == 0) |
8328 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, | |
8329 | BGP_CLEAR_SOFT_IN, argv[5]->arg); | |
01080f7c | 8330 | |
afec25d9 DW |
8331 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_peer, |
8332 | BGP_CLEAR_SOFT_IN, argv[5]->arg); | |
01080f7c | 8333 | } |
8334 | ||
718e3744 | 8335 | |
01080f7c | 8336 | |
718e3744 | 8337 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, |
8338 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
db64ea86 | 8339 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 8340 | CLEAR_STR |
8341 | IP_STR | |
8342 | BGP_STR | |
8343 | "BGP neighbor address to clear\n" | |
db64ea86 | 8344 | "BGP neighbor on interface to clear\n" |
718e3744 | 8345 | "Address family\n" |
8346 | "Address Family modifier\n" | |
8347 | "Address Family modifier\n" | |
e0bce756 | 8348 | BGP_SOFT_IN_STR |
718e3744 | 8349 | "Push out the existing ORF prefix-list\n") |
8350 | { | |
afec25d9 | 8351 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 8352 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
afec25d9 | 8353 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); |
718e3744 | 8354 | |
8355 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
afec25d9 | 8356 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); |
718e3744 | 8357 | } |
8358 | ||
f412b39a DW |
8359 | /* |
8360 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8361 | * "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in", | |
8362 | * CLEAR_STR | |
8363 | * IP_STR | |
8364 | * BGP_STR | |
8365 | * "BGP neighbor address to clear\n" | |
8366 | * "BGP neighbor on interface to clear\n" | |
8367 | * "Address family\n" | |
8368 | * "Address Family Modifier\n" | |
8369 | * BGP_SOFT_IN_STR | |
8370 | * | |
8371 | */ | |
718e3744 | 8372 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, |
8373 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
db64ea86 | 8374 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in", |
718e3744 | 8375 | CLEAR_STR |
8376 | IP_STR | |
8377 | BGP_STR | |
8378 | "BGP neighbor address to clear\n" | |
db64ea86 | 8379 | "BGP neighbor on interface to clear\n" |
718e3744 | 8380 | "Address family\n" |
8381 | "Address Family Modifier\n" | |
f412b39a | 8382 | BGP_SOFT_STR |
01080f7c | 8383 | BGP_SOFT_IN_STR) |
f412b39a DW |
8384 | { |
8385 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
8386 | BGP_CLEAR_SOFT_IN, argv[3]->arg); | |
8387 | } | |
8388 | ||
01080f7c | 8389 | |
f412b39a DW |
8390 | /* |
8391 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8392 | * "clear ip bgp A.B.C.D encap unicast in", | |
8393 | * CLEAR_STR | |
8394 | * IP_STR | |
8395 | * BGP_STR | |
8396 | * "BGP neighbor address to clear\n" | |
8397 | * "Address family\n" | |
8398 | * "Address Family Modifier\n" | |
8399 | * "Soft reconfig inbound update\n" | |
8400 | * | |
8401 | */ | |
8402 | DEFUN (clear_ip_bgp_peer_encap_soft_in, | |
8403 | clear_ip_bgp_peer_encap_soft_in_cmd, | |
8404 | "clear ip bgp A.B.C.D encap unicast soft in", | |
718e3744 | 8405 | CLEAR_STR |
f412b39a | 8406 | IP_STR |
718e3744 | 8407 | BGP_STR |
718e3744 | 8408 | "BGP neighbor address to clear\n" |
f412b39a DW |
8409 | "Address family\n" |
8410 | "Address Family Modifier\n" | |
8411 | "Soft reconfig\n" | |
8412 | "Soft reconfig inbound update\n") | |
8413 | { | |
8414 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
8415 | BGP_CLEAR_SOFT_IN, argv[3]->arg); | |
8416 | } | |
718e3744 | 8417 | |
f412b39a DW |
8418 | |
8419 | /* | |
8420 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8421 | * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", | |
8422 | * CLEAR_STR | |
8423 | * BGP_STR | |
8424 | * "Address family\n" | |
8425 | * "BGP neighbor address to clear\n" | |
8426 | * "BGP IPv6 neighbor to clear\n" | |
8427 | * "BGP neighbor on interface to clear\n" | |
8428 | * BGP_SOFT_IN_STR | |
8429 | * | |
8430 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", | |
8431 | * CLEAR_STR | |
8432 | * BGP_STR | |
8433 | * BGP_INSTANCE_HELP_STR | |
8434 | * "Address family\n" | |
8435 | * "BGP neighbor address to clear\n" | |
8436 | * "BGP IPv6 neighbor to clear\n" | |
8437 | * "BGP neighbor on interface to clear\n" | |
8438 | * BGP_SOFT_STR | |
8439 | * BGP_SOFT_IN_STR | |
8440 | * | |
8441 | * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", | |
8442 | * CLEAR_STR | |
8443 | * BGP_STR | |
8444 | * "Address family\n" | |
8445 | * "BGP neighbor address to clear\n" | |
8446 | * "BGP IPv6 neighbor to clear\n" | |
8447 | * "BGP neighbor on interface to clear\n" | |
8448 | * BGP_SOFT_STR | |
8449 | * BGP_SOFT_IN_STR | |
8450 | * | |
8451 | * "clear bgp (A.B.C.D|X:X::X:X|WORD) in", | |
8452 | * CLEAR_STR | |
8453 | * BGP_STR | |
8454 | * "BGP neighbor address to clear\n" | |
8455 | * "BGP IPv6 neighbor to clear\n" | |
8456 | * "BGP neighbor on interface to clear\n" | |
8457 | * BGP_SOFT_IN_STR | |
8458 | * | |
8459 | * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft in", | |
8460 | * CLEAR_STR | |
8461 | * BGP_STR | |
8462 | * BGP_INSTANCE_HELP_STR | |
8463 | * "BGP neighbor address to clear\n" | |
8464 | * "BGP IPv6 neighbor to clear\n" | |
8465 | * "BGP neighbor on interface to clear\n" | |
8466 | * BGP_SOFT_STR | |
8467 | * BGP_SOFT_IN_STR | |
8468 | * | |
8469 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) in", | |
8470 | * CLEAR_STR | |
8471 | * BGP_STR | |
8472 | * BGP_INSTANCE_HELP_STR | |
8473 | * "Address family\n" | |
8474 | * "BGP neighbor address to clear\n" | |
8475 | * "BGP IPv6 neighbor to clear\n" | |
8476 | * "BGP neighbor on interface to clear\n" | |
8477 | * BGP_SOFT_IN_STR | |
8478 | * | |
8479 | * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) in", | |
8480 | * CLEAR_STR | |
8481 | * BGP_STR | |
8482 | * BGP_INSTANCE_HELP_STR | |
8483 | * "BGP neighbor address to clear\n" | |
8484 | * "BGP IPv6 neighbor to clear\n" | |
8485 | * "BGP neighbor on interface to clear\n" | |
8486 | * BGP_SOFT_IN_STR | |
8487 | * | |
8488 | */ | |
8489 | DEFUN (clear_bgp_peer_soft_in, | |
8490 | clear_bgp_peer_soft_in_cmd, | |
8491 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", | |
01080f7c | 8492 | CLEAR_STR |
8493 | BGP_STR | |
01080f7c | 8494 | "BGP neighbor address to clear\n" |
8495 | "BGP IPv6 neighbor to clear\n" | |
8496 | "BGP neighbor on interface to clear\n" | |
f412b39a | 8497 | BGP_SOFT_STR |
01080f7c | 8498 | BGP_SOFT_IN_STR) |
f412b39a DW |
8499 | { |
8500 | if (argc == 3) | |
8501 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
8502 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8503 | ||
8504 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
8505 | BGP_CLEAR_SOFT_IN, argv[2]->arg); | |
8506 | } | |
8507 | ||
8508 | ||
8509 | ||
8510 | ||
8511 | ||
8512 | ||
8513 | ||
01080f7c | 8514 | |
f412b39a DW |
8515 | /* |
8516 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8517 | * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", | |
8518 | * CLEAR_STR | |
8519 | * BGP_STR | |
8520 | * "Address family\n" | |
8521 | * "BGP neighbor address to clear\n" | |
8522 | * "BGP IPv6 neighbor to clear\n" | |
8523 | * "BGP neighbor on interface to clear\n" | |
8524 | * BGP_SOFT_IN_STR | |
8525 | * "Push out the existing ORF prefix-list\n" | |
8526 | * | |
8527 | */ | |
718e3744 | 8528 | DEFUN (clear_bgp_peer_in_prefix_filter, |
8529 | clear_bgp_peer_in_prefix_filter_cmd, | |
a80beece | 8530 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 8531 | CLEAR_STR |
8532 | BGP_STR | |
8533 | "BGP neighbor address to clear\n" | |
8534 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8535 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8536 | BGP_SOFT_IN_STR |
718e3744 | 8537 | "Push out the existing ORF prefix-list\n") |
8538 | { | |
8539 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
afec25d9 | 8540 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[2]->arg); |
718e3744 | 8541 | } |
8542 | ||
718e3744 | 8543 | |
f412b39a DW |
8544 | /* |
8545 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8546 | * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", | |
8547 | * CLEAR_STR | |
8548 | * IP_STR | |
8549 | * BGP_STR | |
8550 | * BGP_INSTANCE_HELP_STR | |
8551 | * "Clear all members of peer-group\n" | |
8552 | * "BGP peer-group name\n" | |
8553 | * BGP_SOFT_STR | |
8554 | * BGP_SOFT_IN_STR | |
8555 | * | |
8556 | * "clear ip bgp peer-group WORD in", | |
8557 | * CLEAR_STR | |
8558 | * IP_STR | |
8559 | * BGP_STR | |
8560 | * "Clear all members of peer-group\n" | |
8561 | * "BGP peer-group name\n" | |
8562 | * BGP_SOFT_IN_STR | |
8563 | * | |
8564 | * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD in", | |
8565 | * CLEAR_STR | |
8566 | * IP_STR | |
8567 | * BGP_STR | |
8568 | * BGP_INSTANCE_HELP_STR | |
8569 | * "Clear all members of peer-group\n" | |
8570 | * "BGP peer-group name\n" | |
8571 | * BGP_SOFT_IN_STR | |
8572 | * | |
8573 | */ | |
718e3744 | 8574 | DEFUN (clear_ip_bgp_peer_group_soft_in, |
8575 | clear_ip_bgp_peer_group_soft_in_cmd, | |
8576 | "clear ip bgp peer-group WORD soft in", | |
8577 | CLEAR_STR | |
8578 | IP_STR | |
8579 | BGP_STR | |
8580 | "Clear all members of peer-group\n" | |
8581 | "BGP peer-group name\n" | |
e0bce756 DS |
8582 | BGP_SOFT_STR |
8583 | BGP_SOFT_IN_STR) | |
718e3744 | 8584 | { |
01080f7c | 8585 | if (argc == 3) |
8586 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
8587 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8588 | ||
718e3744 | 8589 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
afec25d9 | 8590 | BGP_CLEAR_SOFT_IN, argv[4]->arg); |
718e3744 | 8591 | } |
8592 | ||
01080f7c | 8593 | |
718e3744 | 8594 | |
01080f7c | 8595 | |
718e3744 | 8596 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, |
8597 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
8598 | "clear ip bgp peer-group WORD in prefix-filter", | |
8599 | CLEAR_STR | |
8600 | IP_STR | |
8601 | BGP_STR | |
8602 | "Clear all members of peer-group\n" | |
8603 | "BGP peer-group name\n" | |
e0bce756 | 8604 | BGP_SOFT_IN_STR |
718e3744 | 8605 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8606 | { | |
8607 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
afec25d9 | 8608 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[4]->arg); |
718e3744 | 8609 | } |
8610 | ||
f412b39a DW |
8611 | /* |
8612 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8613 | * "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
8614 | * CLEAR_STR | |
8615 | * IP_STR | |
8616 | * BGP_STR | |
8617 | * "Clear all members of peer-group\n" | |
8618 | * "BGP peer-group name\n" | |
8619 | * "Address family\n" | |
8620 | * "Address Family modifier\n" | |
8621 | * "Address Family modifier\n" | |
8622 | * BGP_SOFT_IN_STR | |
8623 | * | |
8624 | */ | |
718e3744 | 8625 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, |
8626 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
8627 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
8628 | CLEAR_STR | |
8629 | IP_STR | |
8630 | BGP_STR | |
8631 | "Clear all members of peer-group\n" | |
8632 | "BGP peer-group name\n" | |
8633 | "Address family\n" | |
8634 | "Address Family modifier\n" | |
8635 | "Address Family modifier\n" | |
e0bce756 DS |
8636 | BGP_SOFT_STR |
8637 | BGP_SOFT_IN_STR) | |
718e3744 | 8638 | { |
afec25d9 | 8639 | if (strncmp (argv[6]->arg, "m", 1) == 0) |
718e3744 | 8640 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
afec25d9 | 8641 | BGP_CLEAR_SOFT_IN, argv[4]->arg); |
718e3744 | 8642 | |
8643 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
afec25d9 | 8644 | BGP_CLEAR_SOFT_IN, argv[4]->arg); |
718e3744 | 8645 | } |
8646 | ||
f412b39a DW |
8647 | /* |
8648 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8649 | * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) in", | |
8650 | * CLEAR_STR | |
8651 | * IP_STR | |
8652 | * BGP_STR | |
8653 | * BGP_INSTANCE_HELP_STR | |
8654 | * "Clear all members of peer-group\n" | |
8655 | * "BGP peer-group name\n" | |
8656 | * "Address family\n" | |
8657 | * "Address Family modifier\n" | |
8658 | * "Address Family modifier\n" | |
8659 | * BGP_SOFT_IN_STR | |
8660 | * | |
8661 | */ | |
01080f7c | 8662 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft_in, |
8663 | clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd, | |
8664 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft in", | |
8665 | CLEAR_STR | |
8666 | IP_STR | |
8667 | BGP_STR | |
8668 | BGP_INSTANCE_HELP_STR | |
8669 | "Clear all members of peer-group\n" | |
8670 | "BGP peer-group name\n" | |
8671 | "Address family\n" | |
8672 | "Address Family modifier\n" | |
8673 | "Address Family modifier\n" | |
8674 | BGP_SOFT_STR | |
8675 | BGP_SOFT_IN_STR) | |
8676 | { | |
afec25d9 DW |
8677 | if (strncmp (argv[8]->arg, "m", 1) == 0) |
8678 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_group, | |
8679 | BGP_CLEAR_SOFT_IN, argv[6]->arg); | |
01080f7c | 8680 | |
afec25d9 DW |
8681 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_group, |
8682 | BGP_CLEAR_SOFT_IN, argv[6]->arg); | |
01080f7c | 8683 | } |
8684 | ||
718e3744 | 8685 | |
01080f7c | 8686 | |
718e3744 | 8687 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, |
8688 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
8689 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
8690 | CLEAR_STR | |
8691 | IP_STR | |
8692 | BGP_STR | |
8693 | "Clear all members of peer-group\n" | |
8694 | "BGP peer-group name\n" | |
8695 | "Address family\n" | |
8696 | "Address Family modifier\n" | |
8697 | "Address Family modifier\n" | |
e0bce756 | 8698 | BGP_SOFT_IN_STR |
718e3744 | 8699 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8700 | { | |
afec25d9 | 8701 | if (strncmp (argv[6]->arg, "m", 1) == 0) |
718e3744 | 8702 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
afec25d9 | 8703 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[4]->arg); |
718e3744 | 8704 | |
8705 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
afec25d9 | 8706 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[4]->arg); |
718e3744 | 8707 | } |
8708 | ||
f412b39a DW |
8709 | /* |
8710 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8711 | * "clear bgp ipv6 peer-group WORD in", | |
8712 | * CLEAR_STR | |
8713 | * BGP_STR | |
8714 | * "Address family\n" | |
8715 | * "Clear all members of peer-group\n" | |
8716 | * "BGP peer-group name\n" | |
8717 | * BGP_SOFT_IN_STR | |
8718 | * | |
8719 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft in", | |
8720 | * CLEAR_STR | |
8721 | * BGP_STR | |
8722 | * BGP_INSTANCE_HELP_STR | |
8723 | * "Address family\n" | |
8724 | * "Clear all members of peer-group\n" | |
8725 | * "BGP peer-group name\n" | |
8726 | * BGP_SOFT_STR | |
8727 | * BGP_SOFT_IN_STR | |
8728 | * | |
8729 | * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft in", | |
8730 | * CLEAR_STR | |
8731 | * BGP_STR | |
8732 | * BGP_INSTANCE_HELP_STR | |
8733 | * "Clear all members of peer-group\n" | |
8734 | * "BGP peer-group name\n" | |
8735 | * BGP_SOFT_STR | |
8736 | * BGP_SOFT_IN_STR | |
8737 | * | |
8738 | * "clear bgp peer-group WORD in", | |
8739 | * CLEAR_STR | |
8740 | * BGP_STR | |
8741 | * "Clear all members of peer-group\n" | |
8742 | * "BGP peer-group name\n" | |
8743 | * BGP_SOFT_IN_STR | |
8744 | * | |
8745 | * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD in", | |
8746 | * CLEAR_STR | |
8747 | * BGP_STR | |
8748 | * BGP_INSTANCE_HELP_STR | |
8749 | * "Clear all members of peer-group\n" | |
8750 | * "BGP peer-group name\n" | |
8751 | * BGP_SOFT_IN_STR | |
8752 | * | |
8753 | * "clear bgp ipv6 peer-group WORD soft in", | |
8754 | * CLEAR_STR | |
8755 | * BGP_STR | |
8756 | * "Address family\n" | |
8757 | * "Clear all members of peer-group\n" | |
8758 | * "BGP peer-group name\n" | |
8759 | * BGP_SOFT_STR | |
8760 | * BGP_SOFT_IN_STR | |
8761 | * | |
8762 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD in", | |
8763 | * CLEAR_STR | |
8764 | * BGP_STR | |
8765 | * BGP_INSTANCE_HELP_STR | |
8766 | * "Address family\n" | |
8767 | * "Clear all members of peer-group\n" | |
8768 | * "BGP peer-group name\n" | |
8769 | * BGP_SOFT_IN_STR | |
8770 | * | |
8771 | */ | |
718e3744 | 8772 | DEFUN (clear_bgp_peer_group_soft_in, |
8773 | clear_bgp_peer_group_soft_in_cmd, | |
8774 | "clear bgp peer-group WORD soft in", | |
8775 | CLEAR_STR | |
8776 | BGP_STR | |
8777 | "Clear all members of peer-group\n" | |
8778 | "BGP peer-group name\n" | |
e0bce756 DS |
8779 | BGP_SOFT_STR |
8780 | BGP_SOFT_IN_STR) | |
718e3744 | 8781 | { |
01080f7c | 8782 | if (argc == 3) |
8783 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
8784 | BGP_CLEAR_SOFT_IN, argv[2]); | |
8785 | ||
718e3744 | 8786 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
afec25d9 | 8787 | BGP_CLEAR_SOFT_IN, argv[3]->arg); |
718e3744 | 8788 | } |
8789 | ||
01080f7c | 8790 | |
718e3744 | 8791 | |
01080f7c | 8792 | |
718e3744 | 8793 | |
01080f7c | 8794 | |
718e3744 | 8795 | |
01080f7c | 8796 | |
f412b39a DW |
8797 | /* |
8798 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8799 | * "clear bgp ipv6 peer-group WORD in prefix-filter", | |
8800 | * CLEAR_STR | |
8801 | * BGP_STR | |
8802 | * "Address family\n" | |
8803 | * "Clear all members of peer-group\n" | |
8804 | * "BGP peer-group name\n" | |
8805 | * BGP_SOFT_IN_STR | |
8806 | * "Push out prefix-list ORF and do inbound soft reconfig\n" | |
8807 | * | |
8808 | */ | |
718e3744 | 8809 | DEFUN (clear_bgp_peer_group_in_prefix_filter, |
8810 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
8811 | "clear bgp peer-group WORD in prefix-filter", | |
8812 | CLEAR_STR | |
8813 | BGP_STR | |
8814 | "Clear all members of peer-group\n" | |
8815 | "BGP peer-group name\n" | |
e0bce756 | 8816 | BGP_SOFT_IN_STR |
718e3744 | 8817 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8818 | { | |
8819 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
afec25d9 | 8820 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); |
718e3744 | 8821 | } |
8822 | ||
718e3744 | 8823 | |
f412b39a DW |
8824 | /* |
8825 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8826 | * "clear ip bgp external in", | |
8827 | * CLEAR_STR | |
8828 | * IP_STR | |
8829 | * BGP_STR | |
8830 | * "Clear all external peers\n" | |
8831 | * BGP_SOFT_IN_STR | |
8832 | * | |
8833 | * "clear ip bgp " BGP_INSTANCE_CMD " external in", | |
8834 | * CLEAR_STR | |
8835 | * IP_STR | |
8836 | * BGP_STR | |
8837 | * BGP_INSTANCE_HELP_STR | |
8838 | * "Clear all external peers\n" | |
8839 | * BGP_SOFT_IN_STR | |
8840 | * | |
8841 | * "clear ip bgp " BGP_INSTANCE_CMD " external soft in", | |
8842 | * CLEAR_STR | |
8843 | * IP_STR | |
8844 | * BGP_STR | |
8845 | * BGP_INSTANCE_HELP_STR | |
8846 | * "Clear all external peers\n" | |
8847 | * BGP_SOFT_STR | |
8848 | * BGP_SOFT_IN_STR | |
8849 | * | |
8850 | */ | |
718e3744 | 8851 | DEFUN (clear_ip_bgp_external_soft_in, |
8852 | clear_ip_bgp_external_soft_in_cmd, | |
8853 | "clear ip bgp external soft in", | |
8854 | CLEAR_STR | |
8855 | IP_STR | |
8856 | BGP_STR | |
8857 | "Clear all external peers\n" | |
e0bce756 DS |
8858 | BGP_SOFT_STR |
8859 | BGP_SOFT_IN_STR) | |
718e3744 | 8860 | { |
01080f7c | 8861 | if (argc == 2) |
8862 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
8863 | BGP_CLEAR_SOFT_IN, NULL); | |
8864 | ||
718e3744 | 8865 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
8866 | BGP_CLEAR_SOFT_IN, NULL); | |
8867 | } | |
8868 | ||
01080f7c | 8869 | |
718e3744 | 8870 | |
01080f7c | 8871 | |
718e3744 | 8872 | DEFUN (clear_ip_bgp_external_in_prefix_filter, |
8873 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
8874 | "clear ip bgp external in prefix-filter", | |
8875 | CLEAR_STR | |
8876 | IP_STR | |
8877 | BGP_STR | |
8878 | "Clear all external peers\n" | |
e0bce756 | 8879 | BGP_SOFT_IN_STR |
718e3744 | 8880 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8881 | { | |
8882 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8883 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8884 | } | |
8885 | ||
f412b39a DW |
8886 | /* |
8887 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8888 | * "clear ip bgp external ipv4 (unicast|multicast) in", | |
8889 | * CLEAR_STR | |
8890 | * IP_STR | |
8891 | * BGP_STR | |
8892 | * "Clear all external peers\n" | |
8893 | * "Address family\n" | |
8894 | * "Address Family modifier\n" | |
8895 | * "Address Family modifier\n" | |
8896 | * BGP_SOFT_IN_STR | |
8897 | * | |
8898 | */ | |
718e3744 | 8899 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, |
8900 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
8901 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
8902 | CLEAR_STR | |
8903 | IP_STR | |
8904 | BGP_STR | |
8905 | "Clear all external peers\n" | |
8906 | "Address family\n" | |
8907 | "Address Family modifier\n" | |
8908 | "Address Family modifier\n" | |
e0bce756 DS |
8909 | BGP_SOFT_STR |
8910 | BGP_SOFT_IN_STR) | |
718e3744 | 8911 | { |
afec25d9 | 8912 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 8913 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
8914 | BGP_CLEAR_SOFT_IN, NULL); | |
8915 | ||
8916 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8917 | BGP_CLEAR_SOFT_IN, NULL); | |
8918 | } | |
8919 | ||
f412b39a DW |
8920 | /* |
8921 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8922 | * "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) in", | |
8923 | * CLEAR_STR | |
8924 | * IP_STR | |
8925 | * BGP_STR | |
8926 | * BGP_INSTANCE_HELP_STR | |
8927 | * "Clear all external peers\n" | |
8928 | * "Address family\n" | |
8929 | * "Address Family modifier\n" | |
8930 | * "Address Family modifier\n" | |
8931 | * BGP_SOFT_IN_STR | |
8932 | * | |
8933 | */ | |
01080f7c | 8934 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft_in, |
8935 | clear_ip_bgp_instance_external_ipv4_soft_in_cmd, | |
8936 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft in", | |
8937 | CLEAR_STR | |
8938 | IP_STR | |
8939 | BGP_STR | |
8940 | BGP_INSTANCE_HELP_STR | |
8941 | "Clear all external peers\n" | |
8942 | "Address family\n" | |
8943 | "Address Family modifier\n" | |
8944 | "Address Family modifier\n" | |
8945 | BGP_SOFT_STR | |
8946 | BGP_SOFT_IN_STR) | |
8947 | { | |
afec25d9 DW |
8948 | if (strncmp (argv[7]->arg, "m", 1) == 0) |
8949 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_external, | |
01080f7c | 8950 | BGP_CLEAR_SOFT_IN, NULL); |
8951 | ||
afec25d9 | 8952 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_external, |
01080f7c | 8953 | BGP_CLEAR_SOFT_IN, NULL); |
8954 | } | |
8955 | ||
718e3744 | 8956 | |
01080f7c | 8957 | |
718e3744 | 8958 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, |
8959 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
8960 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
8961 | CLEAR_STR | |
8962 | IP_STR | |
8963 | BGP_STR | |
8964 | "Clear all external peers\n" | |
8965 | "Address family\n" | |
8966 | "Address Family modifier\n" | |
8967 | "Address Family modifier\n" | |
e0bce756 | 8968 | BGP_SOFT_IN_STR |
718e3744 | 8969 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
8970 | { | |
afec25d9 | 8971 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 8972 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
8973 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8974 | ||
8975 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8976 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
8977 | } | |
8978 | ||
f412b39a DW |
8979 | /* |
8980 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
8981 | * "clear bgp " BGP_INSTANCE_CMD " external in", | |
8982 | * CLEAR_STR | |
8983 | * BGP_STR | |
8984 | * BGP_INSTANCE_HELP_STR | |
8985 | * "Clear all external peers\n" | |
8986 | * BGP_SOFT_IN_STR | |
8987 | * | |
8988 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft in", | |
8989 | * CLEAR_STR | |
8990 | * BGP_STR | |
8991 | * BGP_INSTANCE_HELP_STR | |
8992 | * "Address family\n" | |
8993 | * "Clear all external peers\n" | |
8994 | * BGP_SOFT_STR | |
8995 | * BGP_SOFT_IN_STR | |
8996 | * | |
8997 | * "clear bgp " BGP_INSTANCE_CMD " external soft in", | |
8998 | * CLEAR_STR | |
8999 | * BGP_STR | |
9000 | * BGP_INSTANCE_HELP_STR | |
9001 | * "Clear all external peers\n" | |
9002 | * BGP_SOFT_STR | |
9003 | * BGP_SOFT_IN_STR | |
9004 | * | |
9005 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 external WORD in", | |
9006 | * CLEAR_STR | |
9007 | * BGP_STR | |
9008 | * BGP_INSTANCE_HELP_STR | |
9009 | * "Address family\n" | |
9010 | * "Clear all external peers\n" | |
9011 | * BGP_SOFT_IN_STR | |
9012 | * | |
9013 | * "clear bgp ipv6 external soft in", | |
9014 | * CLEAR_STR | |
9015 | * BGP_STR | |
9016 | * "Address family\n" | |
9017 | * "Clear all external peers\n" | |
9018 | * BGP_SOFT_STR | |
9019 | * BGP_SOFT_IN_STR | |
9020 | * | |
9021 | * "clear bgp ipv6 external WORD in", | |
9022 | * CLEAR_STR | |
9023 | * BGP_STR | |
9024 | * "Address family\n" | |
9025 | * "Clear all external peers\n" | |
9026 | * BGP_SOFT_IN_STR | |
9027 | * | |
9028 | * "clear bgp external in", | |
9029 | * CLEAR_STR | |
9030 | * BGP_STR | |
9031 | * "Clear all external peers\n" | |
9032 | * BGP_SOFT_IN_STR | |
9033 | * | |
9034 | */ | |
718e3744 | 9035 | DEFUN (clear_bgp_external_soft_in, |
9036 | clear_bgp_external_soft_in_cmd, | |
9037 | "clear bgp external soft in", | |
9038 | CLEAR_STR | |
9039 | BGP_STR | |
9040 | "Clear all external peers\n" | |
e0bce756 DS |
9041 | BGP_SOFT_STR |
9042 | BGP_SOFT_IN_STR) | |
718e3744 | 9043 | { |
01080f7c | 9044 | if (argc == 2) |
9045 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
9046 | BGP_CLEAR_SOFT_IN, NULL); | |
9047 | ||
718e3744 | 9048 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
9049 | BGP_CLEAR_SOFT_IN, NULL); | |
9050 | } | |
9051 | ||
01080f7c | 9052 | |
718e3744 | 9053 | |
01080f7c | 9054 | |
718e3744 | 9055 | |
01080f7c | 9056 | |
718e3744 | 9057 | |
01080f7c | 9058 | |
f412b39a DW |
9059 | /* |
9060 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9061 | * "clear bgp ipv6 external in prefix-filter", | |
9062 | * CLEAR_STR | |
9063 | * BGP_STR | |
9064 | * "Address family\n" | |
9065 | * "Clear all external peers\n" | |
9066 | * BGP_SOFT_IN_STR | |
9067 | * "Push out prefix-list ORF and do inbound soft reconfig\n" | |
9068 | * | |
9069 | */ | |
718e3744 | 9070 | DEFUN (clear_bgp_external_in_prefix_filter, |
9071 | clear_bgp_external_in_prefix_filter_cmd, | |
9072 | "clear bgp external in prefix-filter", | |
9073 | CLEAR_STR | |
9074 | BGP_STR | |
9075 | "Clear all external peers\n" | |
e0bce756 | 9076 | BGP_SOFT_IN_STR |
718e3744 | 9077 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
f412b39a DW |
9078 | { |
9079 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
9080 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
9081 | } | |
718e3744 | 9082 | |
f412b39a DW |
9083 | |
9084 | /* | |
9085 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9086 | * "clear ip bgp " CMD_AS_RANGE " in", | |
9087 | * CLEAR_STR | |
9088 | * IP_STR | |
9089 | * BGP_STR | |
9090 | * "Clear peers with the AS number\n" | |
9091 | * BGP_SOFT_IN_STR | |
9092 | * | |
9093 | * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", | |
9094 | * CLEAR_STR | |
9095 | * IP_STR | |
9096 | * BGP_STR | |
9097 | * BGP_INSTANCE_HELP_STR | |
9098 | * "Clear peers with the AS number\n" | |
9099 | * BGP_SOFT_IN_STR | |
9100 | * | |
9101 | * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", | |
9102 | * CLEAR_STR | |
9103 | * IP_STR | |
9104 | * BGP_STR | |
9105 | * BGP_INSTANCE_HELP_STR | |
9106 | * "Clear peers with the AS number\n" | |
9107 | * BGP_SOFT_STR | |
9108 | * BGP_SOFT_IN_STR | |
9109 | * | |
9110 | */ | |
718e3744 | 9111 | DEFUN (clear_ip_bgp_as_soft_in, |
9112 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 9113 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 9114 | CLEAR_STR |
9115 | IP_STR | |
9116 | BGP_STR | |
9117 | "Clear peers with the AS number\n" | |
e0bce756 DS |
9118 | BGP_SOFT_STR |
9119 | BGP_SOFT_IN_STR) | |
718e3744 | 9120 | { |
01080f7c | 9121 | if (argc == 3) |
9122 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
9123 | BGP_CLEAR_SOFT_IN, argv[2]); | |
9124 | ||
718e3744 | 9125 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
afec25d9 | 9126 | BGP_CLEAR_SOFT_IN, argv[3]->arg); |
718e3744 | 9127 | } |
9128 | ||
01080f7c | 9129 | |
01080f7c | 9130 | |
718e3744 | 9131 | |
9132 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
9133 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 9134 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 9135 | CLEAR_STR |
9136 | IP_STR | |
9137 | BGP_STR | |
9138 | "Clear peers with the AS number\n" | |
e0bce756 | 9139 | BGP_SOFT_IN_STR |
718e3744 | 9140 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
9141 | { | |
9142 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
afec25d9 | 9143 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); |
718e3744 | 9144 | } |
9145 | ||
f412b39a DW |
9146 | /* |
9147 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9148 | * "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", | |
9149 | * CLEAR_STR | |
9150 | * IP_STR | |
9151 | * BGP_STR | |
9152 | * "Clear peers with the AS number\n" | |
9153 | * "Address family\n" | |
9154 | * "Address Family modifier\n" | |
9155 | * "Address Family modifier\n" | |
9156 | * BGP_SOFT_IN_STR | |
9157 | * | |
9158 | */ | |
718e3744 | 9159 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, |
9160 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 9161 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 9162 | CLEAR_STR |
9163 | IP_STR | |
9164 | BGP_STR | |
9165 | "Clear peers with the AS number\n" | |
9166 | "Address family\n" | |
9167 | "Address Family modifier\n" | |
9168 | "Address Family modifier\n" | |
e0bce756 DS |
9169 | BGP_SOFT_STR |
9170 | BGP_SOFT_IN_STR) | |
718e3744 | 9171 | { |
afec25d9 | 9172 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 9173 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
afec25d9 | 9174 | BGP_CLEAR_SOFT_IN, argv[3]->arg); |
718e3744 | 9175 | |
9176 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
afec25d9 | 9177 | BGP_CLEAR_SOFT_IN, argv[3]->arg); |
718e3744 | 9178 | } |
9179 | ||
f412b39a DW |
9180 | /* |
9181 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9182 | * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) in", | |
9183 | * CLEAR_STR | |
9184 | * IP_STR | |
9185 | * BGP_STR | |
9186 | * BGP_INSTANCE_HELP_STR | |
9187 | * "Clear peers with the AS number\n" | |
9188 | * "Address family\n" | |
9189 | * "Address Family modifier\n" | |
9190 | * "Address Family modifier\n" | |
9191 | * BGP_SOFT_IN_STR | |
9192 | * | |
9193 | */ | |
01080f7c | 9194 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft_in, |
9195 | clear_ip_bgp_instance_as_ipv4_soft_in_cmd, | |
9196 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", | |
9197 | CLEAR_STR | |
9198 | IP_STR | |
9199 | BGP_STR | |
9200 | BGP_INSTANCE_HELP_STR | |
9201 | "Clear peers with the AS number\n" | |
9202 | "Address family\n" | |
9203 | "Address Family modifier\n" | |
9204 | "Address Family modifier\n" | |
9205 | BGP_SOFT_STR | |
9206 | BGP_SOFT_IN_STR) | |
9207 | { | |
afec25d9 DW |
9208 | if (strncmp (argv[7]->arg, "m", 1) == 0) |
9209 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_as, | |
9210 | BGP_CLEAR_SOFT_IN, argv[5]->arg); | |
01080f7c | 9211 | |
afec25d9 DW |
9212 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_as, |
9213 | BGP_CLEAR_SOFT_IN, argv[5]->arg); | |
01080f7c | 9214 | } |
9215 | ||
718e3744 | 9216 | |
01080f7c | 9217 | |
718e3744 | 9218 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, |
9219 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 9220 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 9221 | CLEAR_STR |
9222 | IP_STR | |
9223 | BGP_STR | |
9224 | "Clear peers with the AS number\n" | |
9225 | "Address family\n" | |
9226 | "Address Family modifier\n" | |
9227 | "Address Family modifier\n" | |
e0bce756 | 9228 | BGP_SOFT_IN_STR |
718e3744 | 9229 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
9230 | { | |
afec25d9 | 9231 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 9232 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
afec25d9 | 9233 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); |
718e3744 | 9234 | |
9235 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
afec25d9 | 9236 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[3]->arg); |
718e3744 | 9237 | } |
9238 | ||
f412b39a DW |
9239 | /* |
9240 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9241 | * "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", | |
9242 | * CLEAR_STR | |
9243 | * IP_STR | |
9244 | * BGP_STR | |
9245 | * "Clear peers with the AS number\n" | |
9246 | * "Address family\n" | |
9247 | * "Address Family modifier\n" | |
9248 | * BGP_SOFT_IN_STR | |
9249 | * | |
9250 | */ | |
718e3744 | 9251 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, |
9252 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 9253 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 9254 | CLEAR_STR |
9255 | IP_STR | |
9256 | BGP_STR | |
9257 | "Clear peers with the AS number\n" | |
9258 | "Address family\n" | |
9259 | "Address Family modifier\n" | |
e0bce756 DS |
9260 | BGP_SOFT_STR |
9261 | BGP_SOFT_IN_STR) | |
718e3744 | 9262 | { |
9263 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
afec25d9 | 9264 | BGP_CLEAR_SOFT_IN, argv[3]->arg); |
718e3744 | 9265 | } |
9266 | ||
718e3744 | 9267 | |
f412b39a DW |
9268 | /* |
9269 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9270 | * "clear ip bgp " CMD_AS_RANGE " encap unicast in", | |
9271 | * CLEAR_STR | |
9272 | * IP_STR | |
9273 | * BGP_STR | |
9274 | * "Clear peers with the AS number\n" | |
9275 | * "Address family\n" | |
9276 | * "Address Family modifier\n" | |
9277 | * "Soft reconfig inbound update\n" | |
9278 | * | |
9279 | */ | |
587ff0fd LB |
9280 | DEFUN (clear_ip_bgp_as_encap_soft_in, |
9281 | clear_ip_bgp_as_encap_soft_in_cmd, | |
9282 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft in", | |
9283 | CLEAR_STR | |
9284 | IP_STR | |
9285 | BGP_STR | |
9286 | "Clear peers with the AS number\n" | |
9287 | "Address family\n" | |
9288 | "Address Family modifier\n" | |
9289 | "Soft reconfig\n" | |
9290 | "Soft reconfig inbound update\n") | |
9291 | { | |
9292 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
afec25d9 | 9293 | BGP_CLEAR_SOFT_IN, argv[3]->arg); |
587ff0fd LB |
9294 | } |
9295 | ||
587ff0fd | 9296 | |
f412b39a DW |
9297 | /* |
9298 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9299 | * "clear bgp ipv6 " CMD_AS_RANGE " in", | |
9300 | * CLEAR_STR | |
9301 | * BGP_STR | |
9302 | * "Address family\n" | |
9303 | * "Clear peers with the AS number\n" | |
9304 | * BGP_SOFT_IN_STR | |
9305 | * | |
9306 | * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " in", | |
9307 | * CLEAR_STR | |
9308 | * BGP_STR | |
9309 | * BGP_INSTANCE_HELP_STR | |
9310 | * "Clear peers with the AS number\n" | |
9311 | * BGP_SOFT_IN_STR | |
9312 | * | |
9313 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " in", | |
9314 | * CLEAR_STR | |
9315 | * BGP_STR | |
9316 | * BGP_INSTANCE_HELP_STR | |
9317 | * "Address family\n" | |
9318 | * "Clear peers with the AS number\n" | |
9319 | * BGP_SOFT_IN_STR | |
9320 | * | |
9321 | * "clear bgp ipv6 " CMD_AS_RANGE " soft in", | |
9322 | * CLEAR_STR | |
9323 | * BGP_STR | |
9324 | * "Address family\n" | |
9325 | * "Clear peers with the AS number\n" | |
9326 | * BGP_SOFT_STR | |
9327 | * BGP_SOFT_IN_STR | |
9328 | * | |
9329 | * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft in", | |
9330 | * CLEAR_STR | |
9331 | * BGP_STR | |
9332 | * BGP_INSTANCE_HELP_STR | |
9333 | * "Clear peers with the AS number\n" | |
9334 | * BGP_SOFT_STR | |
9335 | * BGP_SOFT_IN_STR | |
9336 | * | |
9337 | * "clear bgp " CMD_AS_RANGE " in", | |
9338 | * CLEAR_STR | |
9339 | * BGP_STR | |
9340 | * "Clear peers with the AS number\n" | |
9341 | * BGP_SOFT_IN_STR | |
9342 | * | |
9343 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft in", | |
9344 | * CLEAR_STR | |
9345 | * BGP_STR | |
9346 | * BGP_INSTANCE_HELP_STR | |
9347 | * "Address family\n" | |
9348 | * "Clear peers with the AS number\n" | |
9349 | * BGP_SOFT_STR | |
9350 | * BGP_SOFT_IN_STR | |
9351 | * | |
9352 | */ | |
718e3744 | 9353 | DEFUN (clear_bgp_as_soft_in, |
9354 | clear_bgp_as_soft_in_cmd, | |
320da874 | 9355 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 9356 | CLEAR_STR |
9357 | BGP_STR | |
9358 | "Clear peers with the AS number\n" | |
e0bce756 DS |
9359 | BGP_SOFT_STR |
9360 | BGP_SOFT_IN_STR) | |
718e3744 | 9361 | { |
01080f7c | 9362 | if (argc == 3) |
9363 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
9364 | BGP_CLEAR_SOFT_IN, argv[2]); | |
9365 | ||
718e3744 | 9366 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
afec25d9 | 9367 | BGP_CLEAR_SOFT_IN, argv[2]->arg); |
718e3744 | 9368 | } |
9369 | ||
01080f7c | 9370 | |
718e3744 | 9371 | |
01080f7c | 9372 | |
718e3744 | 9373 | |
01080f7c | 9374 | |
718e3744 | 9375 | |
01080f7c | 9376 | |
f412b39a DW |
9377 | /* |
9378 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9379 | * "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", | |
9380 | * CLEAR_STR | |
9381 | * BGP_STR | |
9382 | * "Address family\n" | |
9383 | * "Clear peers with the AS number\n" | |
9384 | * BGP_SOFT_IN_STR | |
9385 | * "Push out prefix-list ORF and do inbound soft reconfig\n" | |
9386 | * | |
9387 | */ | |
718e3744 | 9388 | DEFUN (clear_bgp_as_in_prefix_filter, |
9389 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 9390 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 9391 | CLEAR_STR |
9392 | BGP_STR | |
9393 | "Clear peers with the AS number\n" | |
e0bce756 | 9394 | BGP_SOFT_IN_STR |
718e3744 | 9395 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
9396 | { | |
9397 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
afec25d9 | 9398 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[2]->arg); |
718e3744 | 9399 | } |
9400 | ||
6b0655a2 | 9401 | |
718e3744 | 9402 | /* Both soft-reconfiguration */ |
f412b39a DW |
9403 | /* |
9404 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9405 | * "clear ip bgp " BGP_INSTANCE_CMD " * soft", | |
9406 | * CLEAR_STR | |
9407 | * IP_STR | |
9408 | * BGP_STR | |
9409 | * BGP_INSTANCE_HELP_STR | |
9410 | * "Clear all peers\n" | |
9411 | * BGP_SOFT_STR | |
9412 | * | |
9413 | */ | |
718e3744 | 9414 | DEFUN (clear_ip_bgp_all_soft, |
9415 | clear_ip_bgp_all_soft_cmd, | |
9416 | "clear ip bgp * soft", | |
9417 | CLEAR_STR | |
9418 | IP_STR | |
9419 | BGP_STR | |
9420 | "Clear all peers\n" | |
e0bce756 | 9421 | BGP_SOFT_STR) |
718e3744 | 9422 | { |
6aeb9e78 DS |
9423 | if (argc == 2) |
9424 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_all, | |
718e3744 | 9425 | BGP_CLEAR_SOFT_BOTH, NULL); |
9426 | ||
9427 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9428 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9429 | } | |
9430 | ||
718e3744 | 9431 | |
9432 | ||
9433 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
9434 | clear_ip_bgp_all_ipv4_soft_cmd, | |
9435 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
9436 | CLEAR_STR | |
9437 | IP_STR | |
9438 | BGP_STR | |
9439 | "Clear all peers\n" | |
9440 | "Address family\n" | |
9441 | "Address Family Modifier\n" | |
9442 | "Address Family Modifier\n" | |
e0bce756 | 9443 | BGP_SOFT_STR) |
718e3744 | 9444 | { |
afec25d9 | 9445 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 9446 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, |
9447 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9448 | ||
9449 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9450 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9451 | } | |
9452 | ||
9453 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
9454 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
8386ac43 | 9455 | "clear ip bgp " BGP_INSTANCE_CMD " * ipv4 (unicast|multicast) soft", |
718e3744 | 9456 | CLEAR_STR |
9457 | IP_STR | |
9458 | BGP_STR | |
8386ac43 | 9459 | BGP_INSTANCE_HELP_STR |
718e3744 | 9460 | "Clear all peers\n" |
9461 | "Address family\n" | |
9462 | "Address Family Modifier\n" | |
9463 | "Address Family Modifier\n" | |
e0bce756 | 9464 | BGP_SOFT_STR) |
718e3744 | 9465 | { |
afec25d9 DW |
9466 | if (strncmp (argv[7]->arg, "m", 1) == 0) |
9467 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_all, | |
718e3744 | 9468 | BGP_CLEAR_SOFT_BOTH, NULL); |
9469 | ||
9470 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
9471 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9472 | } | |
9473 | ||
9474 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
9475 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
9476 | "clear ip bgp * vpnv4 unicast soft", | |
9477 | CLEAR_STR | |
9478 | IP_STR | |
9479 | BGP_STR | |
9480 | "Clear all peers\n" | |
9481 | "Address family\n" | |
9482 | "Address Family Modifier\n" | |
e0bce756 | 9483 | BGP_SOFT_STR) |
718e3744 | 9484 | { |
9485 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
9486 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9487 | } | |
9488 | ||
587ff0fd LB |
9489 | DEFUN (clear_ip_bgp_all_encap_soft, |
9490 | clear_ip_bgp_all_encap_soft_cmd, | |
9491 | "clear ip bgp * encap unicast soft", | |
9492 | CLEAR_STR | |
9493 | IP_STR | |
9494 | BGP_STR | |
9495 | "Clear all peers\n" | |
9496 | "Address family\n" | |
9497 | "Address Family Modifier\n" | |
9498 | "Soft reconfig\n") | |
9499 | { | |
9500 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all, | |
9501 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
9502 | } | |
9503 | ||
f412b39a DW |
9504 | /* |
9505 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9506 | * "clear bgp ipv6 * soft", | |
9507 | * CLEAR_STR | |
9508 | * BGP_STR | |
9509 | * "Address family\n" | |
9510 | * "Clear all peers\n" | |
9511 | * BGP_SOFT_STR | |
9512 | * | |
9513 | * "clear bgp " BGP_INSTANCE_CMD " * soft", | |
9514 | * CLEAR_STR | |
9515 | * BGP_STR | |
9516 | * BGP_INSTANCE_HELP_STR | |
9517 | * "Clear all peers\n" | |
9518 | * BGP_SOFT_STR | |
9519 | * | |
9520 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 * soft", | |
9521 | * CLEAR_STR | |
9522 | * BGP_STR | |
9523 | * BGP_INSTANCE_HELP_STR | |
9524 | * "Address family\n" | |
9525 | * "Clear all peers\n" | |
9526 | * BGP_SOFT_STR | |
9527 | * | |
9528 | */ | |
718e3744 | 9529 | DEFUN (clear_bgp_all_soft, |
9530 | clear_bgp_all_soft_cmd, | |
9531 | "clear bgp * soft", | |
9532 | CLEAR_STR | |
9533 | BGP_STR | |
9534 | "Clear all peers\n" | |
e0bce756 | 9535 | BGP_SOFT_STR) |
718e3744 | 9536 | { |
6aeb9e78 DS |
9537 | if (argc == 2) |
9538 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_all, | |
01080f7c | 9539 | BGP_CLEAR_SOFT_BOTH, NULL); |
718e3744 | 9540 | |
9541 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
01080f7c | 9542 | BGP_CLEAR_SOFT_BOTH, NULL); |
718e3744 | 9543 | } |
9544 | ||
718e3744 | 9545 | |
718e3744 | 9546 | |
01080f7c | 9547 | |
f412b39a DW |
9548 | /* |
9549 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9550 | * "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) soft", | |
9551 | * CLEAR_STR | |
9552 | * IP_STR | |
9553 | * BGP_STR | |
9554 | * BGP_INSTANCE_HELP_STR | |
9555 | * "BGP neighbor address to clear\n" | |
9556 | * "BGP neighbor on interface to clear\n" | |
9557 | * BGP_SOFT_STR | |
9558 | * | |
9559 | */ | |
718e3744 | 9560 | DEFUN (clear_ip_bgp_peer_soft, |
9561 | clear_ip_bgp_peer_soft_cmd, | |
db64ea86 | 9562 | "clear ip bgp (A.B.C.D|WORD) soft", |
718e3744 | 9563 | CLEAR_STR |
9564 | IP_STR | |
9565 | BGP_STR | |
9566 | "BGP neighbor address to clear\n" | |
db64ea86 | 9567 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9568 | BGP_SOFT_STR) |
718e3744 | 9569 | { |
01080f7c | 9570 | if (argc == 3) |
9571 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_peer, | |
9572 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9573 | ||
718e3744 | 9574 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, |
afec25d9 | 9575 | BGP_CLEAR_SOFT_BOTH, argv[3]->arg); |
718e3744 | 9576 | } |
9577 | ||
01080f7c | 9578 | |
718e3744 | 9579 | DEFUN (clear_ip_bgp_peer_ipv4_soft, |
9580 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
db64ea86 | 9581 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", |
718e3744 | 9582 | CLEAR_STR |
9583 | IP_STR | |
9584 | BGP_STR | |
9585 | "BGP neighbor address to clear\n" | |
db64ea86 | 9586 | "BGP neighbor on interface to clear\n" |
718e3744 | 9587 | "Address family\n" |
9588 | "Address Family Modifier\n" | |
9589 | "Address Family Modifier\n" | |
e0bce756 | 9590 | BGP_SOFT_STR) |
718e3744 | 9591 | { |
afec25d9 | 9592 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 9593 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, |
afec25d9 | 9594 | BGP_CLEAR_SOFT_BOTH, argv[3]->arg); |
718e3744 | 9595 | |
9596 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
afec25d9 | 9597 | BGP_CLEAR_SOFT_BOTH, argv[3]->arg); |
718e3744 | 9598 | } |
9599 | ||
01080f7c | 9600 | DEFUN (clear_ip_bgp_instance_peer_ipv4_soft, |
9601 | clear_ip_bgp_instance_peer_ipv4_soft_cmd, | |
9602 | "clear ip bgp " BGP_INSTANCE_CMD " (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", | |
9603 | CLEAR_STR | |
9604 | IP_STR | |
9605 | BGP_STR | |
9606 | BGP_INSTANCE_HELP_STR | |
9607 | "BGP neighbor address to clear\n" | |
9608 | "BGP neighbor on interface to clear\n" | |
9609 | "Address family\n" | |
9610 | "Address Family Modifier\n" | |
9611 | "Address Family Modifier\n" | |
9612 | BGP_SOFT_STR) | |
9613 | { | |
afec25d9 DW |
9614 | if (strncmp (argv[7]->arg, "m", 1) == 0) |
9615 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_peer, | |
9616 | BGP_CLEAR_SOFT_BOTH, argv[5]->arg); | |
01080f7c | 9617 | |
afec25d9 DW |
9618 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_peer, |
9619 | BGP_CLEAR_SOFT_BOTH, argv[5]->arg); | |
01080f7c | 9620 | } |
9621 | ||
718e3744 | 9622 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, |
9623 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
db64ea86 | 9624 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft", |
718e3744 | 9625 | CLEAR_STR |
9626 | IP_STR | |
9627 | BGP_STR | |
9628 | "BGP neighbor address to clear\n" | |
db64ea86 | 9629 | "BGP neighbor on interface to clear\n" |
718e3744 | 9630 | "Address family\n" |
9631 | "Address Family Modifier\n" | |
e0bce756 | 9632 | BGP_SOFT_STR) |
718e3744 | 9633 | { |
9634 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
afec25d9 | 9635 | BGP_CLEAR_SOFT_BOTH, argv[3]->arg); |
718e3744 | 9636 | } |
9637 | ||
587ff0fd LB |
9638 | DEFUN (clear_ip_bgp_peer_encap_soft, |
9639 | clear_ip_bgp_peer_encap_soft_cmd, | |
9640 | "clear ip bgp A.B.C.D encap unicast soft", | |
9641 | CLEAR_STR | |
9642 | IP_STR | |
9643 | BGP_STR | |
9644 | "BGP neighbor address to clear\n" | |
9645 | "Address family\n" | |
9646 | "Address Family Modifier\n" | |
9647 | "Soft reconfig\n") | |
9648 | { | |
9649 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer, | |
afec25d9 | 9650 | BGP_CLEAR_SOFT_BOTH, argv[3]->arg); |
587ff0fd LB |
9651 | } |
9652 | ||
f412b39a DW |
9653 | /* |
9654 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9655 | * "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", | |
9656 | * CLEAR_STR | |
9657 | * BGP_STR | |
9658 | * "Address family\n" | |
9659 | * "BGP neighbor address to clear\n" | |
9660 | * "BGP IPv6 neighbor to clear\n" | |
9661 | * "BGP neighbor on interface to clear\n" | |
9662 | * BGP_SOFT_STR | |
9663 | * | |
9664 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 (A.B.C.D|X:X::X:X|WORD) soft", | |
9665 | * CLEAR_STR | |
9666 | * BGP_STR | |
9667 | * BGP_INSTANCE_HELP_STR | |
9668 | * "Address family\n" | |
9669 | * "BGP neighbor address to clear\n" | |
9670 | * "BGP IPv6 neighbor to clear\n" | |
9671 | * "BGP neighbor on interface to clear\n" | |
9672 | * BGP_SOFT_STR | |
9673 | * | |
9674 | * "clear bgp " BGP_INSTANCE_CMD " (A.B.C.D|X:X::X:X|WORD) soft", | |
9675 | * CLEAR_STR | |
9676 | * BGP_STR | |
9677 | * BGP_INSTANCE_HELP_STR | |
9678 | * "BGP neighbor address to clear\n" | |
9679 | * "BGP IPv6 neighbor to clear\n" | |
9680 | * "BGP neighbor on interface to clear\n" | |
9681 | * BGP_SOFT_STR | |
9682 | * | |
9683 | */ | |
718e3744 | 9684 | DEFUN (clear_bgp_peer_soft, |
9685 | clear_bgp_peer_soft_cmd, | |
a80beece | 9686 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 9687 | CLEAR_STR |
9688 | BGP_STR | |
9689 | "BGP neighbor address to clear\n" | |
9690 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 9691 | "BGP neighbor on interface to clear\n" |
e0bce756 | 9692 | BGP_SOFT_STR) |
718e3744 | 9693 | { |
01080f7c | 9694 | if (argc == 3) |
9695 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_peer, | |
9696 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9697 | ||
718e3744 | 9698 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, |
afec25d9 | 9699 | BGP_CLEAR_SOFT_BOTH, argv[2]->arg); |
718e3744 | 9700 | } |
9701 | ||
01080f7c | 9702 | |
718e3744 | 9703 | |
01080f7c | 9704 | |
f412b39a DW |
9705 | /* |
9706 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9707 | * "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD soft", | |
9708 | * CLEAR_STR | |
9709 | * IP_STR | |
9710 | * BGP_STR | |
9711 | * BGP_INSTANCE_HELP_STR | |
9712 | * "Clear all members of peer-group\n" | |
9713 | * "BGP peer-group name\n" | |
9714 | * BGP_SOFT_STR | |
9715 | * | |
9716 | */ | |
718e3744 | 9717 | DEFUN (clear_ip_bgp_peer_group_soft, |
9718 | clear_ip_bgp_peer_group_soft_cmd, | |
9719 | "clear ip bgp peer-group WORD soft", | |
9720 | CLEAR_STR | |
9721 | IP_STR | |
9722 | BGP_STR | |
9723 | "Clear all members of peer-group\n" | |
9724 | "BGP peer-group name\n" | |
e0bce756 | 9725 | BGP_SOFT_STR) |
718e3744 | 9726 | { |
01080f7c | 9727 | if (argc == 3) |
9728 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_group, | |
9729 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9730 | ||
718e3744 | 9731 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, |
afec25d9 | 9732 | BGP_CLEAR_SOFT_BOTH, argv[4]->arg); |
718e3744 | 9733 | } |
9734 | ||
01080f7c | 9735 | |
718e3744 | 9736 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, |
9737 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
9738 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
9739 | CLEAR_STR | |
9740 | IP_STR | |
9741 | BGP_STR | |
9742 | "Clear all members of peer-group\n" | |
9743 | "BGP peer-group name\n" | |
9744 | "Address family\n" | |
9745 | "Address Family modifier\n" | |
9746 | "Address Family modifier\n" | |
e0bce756 | 9747 | BGP_SOFT_STR) |
718e3744 | 9748 | { |
afec25d9 | 9749 | if (strncmp (argv[6]->arg, "m", 1) == 0) |
718e3744 | 9750 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, |
afec25d9 | 9751 | BGP_CLEAR_SOFT_BOTH, argv[4]->arg); |
718e3744 | 9752 | |
9753 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
afec25d9 | 9754 | BGP_CLEAR_SOFT_BOTH, argv[4]->arg); |
718e3744 | 9755 | } |
9756 | ||
01080f7c | 9757 | DEFUN (clear_ip_bgp_instance_peer_group_ipv4_soft, |
9758 | clear_ip_bgp_instance_peer_group_ipv4_soft_cmd, | |
9759 | "clear ip bgp " BGP_INSTANCE_CMD " peer-group WORD ipv4 (unicast|multicast) soft", | |
9760 | CLEAR_STR | |
9761 | IP_STR | |
9762 | BGP_STR | |
9763 | BGP_INSTANCE_HELP_STR | |
9764 | "Clear all members of peer-group\n" | |
9765 | "BGP peer-group name\n" | |
9766 | "Address family\n" | |
9767 | "Address Family modifier\n" | |
9768 | "Address Family modifier\n" | |
9769 | BGP_SOFT_STR) | |
9770 | { | |
afec25d9 DW |
9771 | if (strncmp (argv[8]->arg, "m", 1) == 0) |
9772 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_group, | |
9773 | BGP_CLEAR_SOFT_BOTH, argv[6]->arg); | |
01080f7c | 9774 | |
afec25d9 DW |
9775 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_group, |
9776 | BGP_CLEAR_SOFT_BOTH, argv[6]->arg); | |
01080f7c | 9777 | } |
9778 | ||
f412b39a DW |
9779 | /* |
9780 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9781 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 peer-group WORD soft", | |
9782 | * CLEAR_STR | |
9783 | * BGP_STR | |
9784 | * BGP_INSTANCE_HELP_STR | |
9785 | * "Address family\n" | |
9786 | * "Clear all members of peer-group\n" | |
9787 | * "BGP peer-group name\n" | |
9788 | * BGP_SOFT_STR | |
9789 | * | |
9790 | * "clear bgp " BGP_INSTANCE_CMD " peer-group WORD soft", | |
9791 | * CLEAR_STR | |
9792 | * BGP_STR | |
9793 | * BGP_INSTANCE_HELP_STR | |
9794 | * "Clear all members of peer-group\n" | |
9795 | * "BGP peer-group name\n" | |
9796 | * BGP_SOFT_STR | |
9797 | * | |
9798 | * "clear bgp ipv6 peer-group WORD soft", | |
9799 | * CLEAR_STR | |
9800 | * BGP_STR | |
9801 | * "Address family\n" | |
9802 | * "Clear all members of peer-group\n" | |
9803 | * "BGP peer-group name\n" | |
9804 | * BGP_SOFT_STR | |
9805 | * | |
9806 | */ | |
718e3744 | 9807 | DEFUN (clear_bgp_peer_group_soft, |
9808 | clear_bgp_peer_group_soft_cmd, | |
9809 | "clear bgp peer-group WORD soft", | |
9810 | CLEAR_STR | |
9811 | BGP_STR | |
9812 | "Clear all members of peer-group\n" | |
9813 | "BGP peer-group name\n" | |
e0bce756 | 9814 | BGP_SOFT_STR) |
718e3744 | 9815 | { |
01080f7c | 9816 | if (argc == 3) |
9817 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_group, | |
9818 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9819 | ||
718e3744 | 9820 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, |
afec25d9 | 9821 | BGP_CLEAR_SOFT_BOTH, argv[3]->arg); |
718e3744 | 9822 | } |
9823 | ||
01080f7c | 9824 | |
718e3744 | 9825 | |
01080f7c | 9826 | |
f412b39a DW |
9827 | /* |
9828 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9829 | * "clear ip bgp " BGP_INSTANCE_CMD " external soft", | |
9830 | * CLEAR_STR | |
9831 | * IP_STR | |
9832 | * BGP_STR | |
9833 | * BGP_INSTANCE_HELP_STR | |
9834 | * "Clear all external peers\n" | |
9835 | * BGP_SOFT_STR | |
9836 | * | |
9837 | */ | |
718e3744 | 9838 | DEFUN (clear_ip_bgp_external_soft, |
9839 | clear_ip_bgp_external_soft_cmd, | |
9840 | "clear ip bgp external soft", | |
9841 | CLEAR_STR | |
9842 | IP_STR | |
9843 | BGP_STR | |
9844 | "Clear all external peers\n" | |
e0bce756 | 9845 | BGP_SOFT_STR) |
718e3744 | 9846 | { |
01080f7c | 9847 | if (argc == 2) |
9848 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_external, | |
9849 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9850 | ||
718e3744 | 9851 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, |
9852 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9853 | } | |
9854 | ||
01080f7c | 9855 | |
718e3744 | 9856 | DEFUN (clear_ip_bgp_external_ipv4_soft, |
9857 | clear_ip_bgp_external_ipv4_soft_cmd, | |
9858 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
9859 | CLEAR_STR | |
9860 | IP_STR | |
9861 | BGP_STR | |
9862 | "Clear all external peers\n" | |
9863 | "Address family\n" | |
9864 | "Address Family modifier\n" | |
9865 | "Address Family modifier\n" | |
e0bce756 | 9866 | BGP_SOFT_STR) |
718e3744 | 9867 | { |
afec25d9 | 9868 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 9869 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, |
9870 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9871 | ||
9872 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
9873 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9874 | } | |
9875 | ||
01080f7c | 9876 | DEFUN (clear_ip_bgp_instance_external_ipv4_soft, |
9877 | clear_ip_bgp_instance_external_ipv4_soft_cmd, | |
9878 | "clear ip bgp " BGP_INSTANCE_CMD " external ipv4 (unicast|multicast) soft", | |
9879 | CLEAR_STR | |
9880 | IP_STR | |
9881 | BGP_STR | |
9882 | BGP_INSTANCE_HELP_STR | |
9883 | "Clear all external peers\n" | |
9884 | "Address family\n" | |
9885 | "Address Family modifier\n" | |
9886 | "Address Family modifier\n" | |
9887 | BGP_SOFT_STR) | |
9888 | { | |
afec25d9 DW |
9889 | if (strncmp (argv[7]->arg, "m", 1) == 0) |
9890 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_external, | |
01080f7c | 9891 | BGP_CLEAR_SOFT_BOTH, NULL); |
9892 | ||
afec25d9 | 9893 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, clear_external, |
01080f7c | 9894 | BGP_CLEAR_SOFT_BOTH, NULL); |
9895 | } | |
9896 | ||
f412b39a DW |
9897 | /* |
9898 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9899 | * "clear bgp " BGP_INSTANCE_CMD " external soft", | |
9900 | * CLEAR_STR | |
9901 | * BGP_STR | |
9902 | * BGP_INSTANCE_HELP_STR | |
9903 | * "Clear all external peers\n" | |
9904 | * BGP_SOFT_STR | |
9905 | * | |
9906 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 external soft", | |
9907 | * CLEAR_STR | |
9908 | * BGP_STR | |
9909 | * BGP_INSTANCE_HELP_STR | |
9910 | * "Address family\n" | |
9911 | * "Clear all external peers\n" | |
9912 | * BGP_SOFT_STR | |
9913 | * | |
9914 | * "clear bgp ipv6 external soft", | |
9915 | * CLEAR_STR | |
9916 | * BGP_STR | |
9917 | * "Address family\n" | |
9918 | * "Clear all external peers\n" | |
9919 | * BGP_SOFT_STR | |
9920 | * | |
9921 | */ | |
718e3744 | 9922 | DEFUN (clear_bgp_external_soft, |
9923 | clear_bgp_external_soft_cmd, | |
9924 | "clear bgp external soft", | |
9925 | CLEAR_STR | |
9926 | BGP_STR | |
9927 | "Clear all external peers\n" | |
e0bce756 | 9928 | BGP_SOFT_STR) |
718e3744 | 9929 | { |
01080f7c | 9930 | if (argc == 2) |
9931 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_external, | |
9932 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9933 | ||
718e3744 | 9934 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, |
9935 | BGP_CLEAR_SOFT_BOTH, NULL); | |
9936 | } | |
9937 | ||
01080f7c | 9938 | |
718e3744 | 9939 | |
01080f7c | 9940 | |
f412b39a DW |
9941 | /* |
9942 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
9943 | * "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", | |
9944 | * CLEAR_STR | |
9945 | * IP_STR | |
9946 | * BGP_STR | |
9947 | * BGP_INSTANCE_HELP_STR | |
9948 | * "Clear peers with the AS number\n" | |
9949 | * BGP_SOFT_STR | |
9950 | * | |
9951 | */ | |
718e3744 | 9952 | DEFUN (clear_ip_bgp_as_soft, |
9953 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 9954 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 9955 | CLEAR_STR |
9956 | IP_STR | |
9957 | BGP_STR | |
9958 | "Clear peers with the AS number\n" | |
e0bce756 | 9959 | BGP_SOFT_STR) |
718e3744 | 9960 | { |
01080f7c | 9961 | if (argc == 3) |
9962 | return bgp_clear_vty (vty, argv[1], AFI_IP, SAFI_UNICAST, clear_as, | |
9963 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
9964 | ||
718e3744 | 9965 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, |
afec25d9 | 9966 | BGP_CLEAR_SOFT_BOTH, argv[3]->arg); |
718e3744 | 9967 | } |
9968 | ||
01080f7c | 9969 | |
718e3744 | 9970 | DEFUN (clear_ip_bgp_as_ipv4_soft, |
9971 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 9972 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 9973 | CLEAR_STR |
9974 | IP_STR | |
9975 | BGP_STR | |
9976 | "Clear peers with the AS number\n" | |
9977 | "Address family\n" | |
9978 | "Address Family Modifier\n" | |
9979 | "Address Family Modifier\n" | |
e0bce756 | 9980 | BGP_SOFT_STR) |
718e3744 | 9981 | { |
afec25d9 | 9982 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
718e3744 | 9983 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, |
afec25d9 | 9984 | BGP_CLEAR_SOFT_BOTH, argv[3]->arg); |
718e3744 | 9985 | |
9986 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
afec25d9 | 9987 | BGP_CLEAR_SOFT_BOTH, argv[3]->arg); |
718e3744 | 9988 | } |
9989 | ||
01080f7c | 9990 | DEFUN (clear_ip_bgp_instance_as_ipv4_soft, |
9991 | clear_ip_bgp_instance_as_ipv4_soft_cmd, | |
9992 | "clear ip bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", | |
9993 | CLEAR_STR | |
9994 | IP_STR | |
9995 | BGP_STR | |
9996 | BGP_INSTANCE_HELP_STR | |
9997 | "Clear peers with the AS number\n" | |
9998 | "Address family\n" | |
9999 | "Address Family Modifier\n" | |
10000 | "Address Family Modifier\n" | |
10001 | BGP_SOFT_STR) | |
10002 | { | |
afec25d9 DW |
10003 | if (strncmp (argv[7]->arg, "m", 1) == 0) |
10004 | return bgp_clear_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, clear_as, | |
10005 | BGP_CLEAR_SOFT_BOTH, argv[5]->arg); | |
01080f7c | 10006 | |
afec25d9 DW |
10007 | return bgp_clear_vty (vty, argv[4]->arg,AFI_IP, SAFI_UNICAST, clear_as, |
10008 | BGP_CLEAR_SOFT_BOTH, argv[5]->arg); | |
01080f7c | 10009 | } |
10010 | ||
718e3744 | 10011 | DEFUN (clear_ip_bgp_as_vpnv4_soft, |
10012 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 10013 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 10014 | CLEAR_STR |
10015 | IP_STR | |
10016 | BGP_STR | |
10017 | "Clear peers with the AS number\n" | |
10018 | "Address family\n" | |
10019 | "Address Family Modifier\n" | |
e0bce756 | 10020 | BGP_SOFT_STR) |
718e3744 | 10021 | { |
10022 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
afec25d9 | 10023 | BGP_CLEAR_SOFT_BOTH, argv[3]->arg); |
718e3744 | 10024 | } |
10025 | ||
587ff0fd LB |
10026 | DEFUN (clear_ip_bgp_as_encap_soft, |
10027 | clear_ip_bgp_as_encap_soft_cmd, | |
10028 | "clear ip bgp " CMD_AS_RANGE " encap unicast soft", | |
10029 | CLEAR_STR | |
10030 | IP_STR | |
10031 | BGP_STR | |
10032 | "Clear peers with the AS number\n" | |
10033 | "Address family\n" | |
10034 | "Address Family Modifier\n" | |
10035 | "Soft reconfig\n") | |
10036 | { | |
10037 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as, | |
afec25d9 | 10038 | BGP_CLEAR_SOFT_BOTH, argv[3]->arg); |
587ff0fd LB |
10039 | } |
10040 | ||
f412b39a DW |
10041 | /* |
10042 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
10043 | * "clear bgp ipv6 " CMD_AS_RANGE " soft", | |
10044 | * CLEAR_STR | |
10045 | * BGP_STR | |
10046 | * "Address family\n" | |
10047 | * "Clear peers with the AS number\n" | |
10048 | * BGP_SOFT_STR | |
10049 | * | |
10050 | * "clear bgp " BGP_INSTANCE_CMD " ipv6 " CMD_AS_RANGE " soft", | |
10051 | * CLEAR_STR | |
10052 | * BGP_STR | |
10053 | * BGP_INSTANCE_HELP_STR | |
10054 | * "Address family\n" | |
10055 | * "Clear peers with the AS number\n" | |
10056 | * BGP_SOFT_STR | |
10057 | * | |
10058 | * "clear bgp " BGP_INSTANCE_CMD " " CMD_AS_RANGE " soft", | |
10059 | * CLEAR_STR | |
10060 | * BGP_STR | |
10061 | * BGP_INSTANCE_HELP_STR | |
10062 | * "Clear peers with the AS number\n" | |
10063 | * BGP_SOFT_STR | |
10064 | * | |
10065 | */ | |
718e3744 | 10066 | DEFUN (clear_bgp_as_soft, |
10067 | clear_bgp_as_soft_cmd, | |
320da874 | 10068 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 10069 | CLEAR_STR |
10070 | BGP_STR | |
10071 | "Clear peers with the AS number\n" | |
e0bce756 | 10072 | BGP_SOFT_STR) |
718e3744 | 10073 | { |
01080f7c | 10074 | if (argc == 3) |
10075 | return bgp_clear_vty (vty, argv[1], AFI_IP6, SAFI_UNICAST, clear_as, | |
10076 | BGP_CLEAR_SOFT_BOTH, argv[2]); | |
10077 | ||
718e3744 | 10078 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, |
afec25d9 | 10079 | BGP_CLEAR_SOFT_BOTH, argv[2]->arg); |
718e3744 | 10080 | } |
10081 | ||
f412b39a DW |
10082 | |
10083 | ||
01080f7c | 10084 | |
e0081f70 ML |
10085 | DEFUN (show_bgp_views, |
10086 | show_bgp_views_cmd, | |
10087 | "show bgp views", | |
10088 | SHOW_STR | |
10089 | BGP_STR | |
10090 | "Show the defined BGP views\n") | |
10091 | { | |
10092 | struct list *inst = bm->bgp; | |
10093 | struct listnode *node; | |
10094 | struct bgp *bgp; | |
10095 | ||
10096 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
10097 | { | |
8386ac43 | 10098 | vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE); |
e0081f70 ML |
10099 | return CMD_WARNING; |
10100 | } | |
10101 | ||
10102 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
10103 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
8386ac43 | 10104 | { |
10105 | /* Skip VRFs. */ | |
10106 | if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) | |
10107 | continue; | |
10108 | vty_out (vty, "\t%s (AS%u)%s", | |
10109 | bgp->name ? bgp->name : "(null)", | |
10110 | bgp->as, VTY_NEWLINE); | |
10111 | } | |
e0081f70 ML |
10112 | |
10113 | return CMD_SUCCESS; | |
10114 | } | |
10115 | ||
8386ac43 | 10116 | DEFUN (show_bgp_vrfs, |
10117 | show_bgp_vrfs_cmd, | |
b162fa78 | 10118 | "show bgp vrfs [json]", |
8386ac43 | 10119 | SHOW_STR |
10120 | BGP_STR | |
10121 | "Show BGP VRFs\n" | |
10122 | "JavaScript Object Notation\n") | |
10123 | { | |
10124 | struct list *inst = bm->bgp; | |
10125 | struct listnode *node; | |
10126 | struct bgp *bgp; | |
10127 | u_char uj = use_json(argc, argv); | |
10128 | json_object *json = NULL; | |
10129 | json_object *json_vrfs = NULL; | |
10130 | int count = 0; | |
10131 | static char header[] = "Type Id RouterId #PeersCfg #PeersEstb Name"; | |
10132 | ||
10133 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
10134 | { | |
10135 | vty_out (vty, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE); | |
10136 | return CMD_WARNING; | |
10137 | } | |
10138 | ||
10139 | if (uj) | |
10140 | { | |
10141 | json = json_object_new_object(); | |
10142 | json_vrfs = json_object_new_object(); | |
10143 | } | |
10144 | ||
10145 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
10146 | { | |
10147 | const char *name, *type; | |
10148 | struct peer *peer; | |
10149 | struct listnode *node, *nnode; | |
10150 | int peers_cfg, peers_estb; | |
10151 | json_object *json_vrf = NULL; | |
5c81a5f3 | 10152 | int vrf_id_ui; |
8386ac43 | 10153 | |
10154 | /* Skip Views. */ | |
10155 | if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) | |
10156 | continue; | |
10157 | ||
10158 | count++; | |
10159 | if (!uj && count == 1) | |
10160 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
10161 | ||
10162 | peers_cfg = peers_estb = 0; | |
10163 | if (uj) | |
10164 | json_vrf = json_object_new_object(); | |
10165 | ||
10166 | ||
10167 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
10168 | { | |
10169 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) | |
10170 | continue; | |
10171 | peers_cfg++; | |
10172 | if (peer->status == Established) | |
10173 | peers_estb++; | |
10174 | } | |
10175 | ||
10176 | if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10177 | { | |
10178 | name = "Default"; | |
10179 | type = "DFLT"; | |
10180 | } | |
10181 | else | |
10182 | { | |
10183 | name = bgp->name; | |
10184 | type = "VRF"; | |
10185 | } | |
10186 | ||
5c81a5f3 | 10187 | vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id; |
8386ac43 | 10188 | if (uj) |
10189 | { | |
10190 | json_object_string_add(json_vrf, "type", type); | |
5c81a5f3 | 10191 | json_object_int_add(json_vrf, "vrfId", vrf_id_ui); |
8386ac43 | 10192 | json_object_string_add(json_vrf, "routerId", inet_ntoa (bgp->router_id)); |
10193 | json_object_int_add(json_vrf, "numConfiguredPeers", peers_cfg); | |
10194 | json_object_int_add(json_vrf, "numEstablishedPeers", peers_estb); | |
10195 | ||
10196 | json_object_object_add(json_vrfs, name, json_vrf); | |
10197 | } | |
10198 | else | |
5c81a5f3 | 10199 | vty_out (vty, "%4s %-5d %-16s %9u %10u %s%s", |
10200 | type, vrf_id_ui, inet_ntoa (bgp->router_id), | |
8386ac43 | 10201 | peers_cfg, peers_estb, name, |
10202 | VTY_NEWLINE); | |
10203 | } | |
10204 | ||
10205 | if (uj) | |
10206 | { | |
10207 | json_object_object_add(json, "vrfs", json_vrfs); | |
10208 | ||
10209 | json_object_int_add(json, "totalVrfs", count); | |
10210 | ||
10211 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
10212 | json_object_free(json); | |
10213 | } | |
10214 | else | |
10215 | { | |
10216 | if (count) | |
10217 | vty_out (vty, "%sTotal number of VRFs (including default): %d%s", | |
10218 | VTY_NEWLINE, count, VTY_NEWLINE); | |
10219 | } | |
10220 | ||
10221 | return CMD_SUCCESS; | |
10222 | } | |
10223 | ||
f412b39a | 10224 | DEFUN (show_bgp_memory, |
4bf6a362 PJ |
10225 | show_bgp_memory_cmd, |
10226 | "show bgp memory", | |
10227 | SHOW_STR | |
10228 | BGP_STR | |
10229 | "Global BGP memory statistics\n") | |
10230 | { | |
10231 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
10232 | unsigned long count; | |
10233 | ||
10234 | /* RIB related usage stats */ | |
10235 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
10236 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
10237 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10238 | count * sizeof (struct bgp_node)), | |
10239 | VTY_NEWLINE); | |
10240 | ||
10241 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
10242 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
10243 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10244 | count * sizeof (struct bgp_info)), | |
10245 | VTY_NEWLINE); | |
fb982c25 PJ |
10246 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
10247 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
10248 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10249 | count * sizeof (struct bgp_info_extra)), | |
10250 | VTY_NEWLINE); | |
4bf6a362 PJ |
10251 | |
10252 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
10253 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
10254 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10255 | count * sizeof (struct bgp_static)), | |
10256 | VTY_NEWLINE); | |
3f9c7369 DS |
10257 | |
10258 | if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET))) | |
10259 | vty_out (vty, "%ld Packets, using %s of memory%s", count, | |
10260 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10261 | count * sizeof (struct bpacket)), | |
10262 | VTY_NEWLINE); | |
4bf6a362 PJ |
10263 | |
10264 | /* Adj-In/Out */ | |
10265 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
10266 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
10267 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10268 | count * sizeof (struct bgp_adj_in)), | |
10269 | VTY_NEWLINE); | |
10270 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
10271 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
10272 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10273 | count * sizeof (struct bgp_adj_out)), | |
10274 | VTY_NEWLINE); | |
10275 | ||
10276 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
10277 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
10278 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10279 | count * sizeof (struct bgp_nexthop_cache)), | |
10280 | VTY_NEWLINE); | |
10281 | ||
10282 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
10283 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
10284 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10285 | count * sizeof (struct bgp_damp_info)), | |
10286 | VTY_NEWLINE); | |
10287 | ||
10288 | /* Attributes */ | |
10289 | count = attr_count(); | |
10290 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
10291 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10292 | count * sizeof(struct attr)), | |
10293 | VTY_NEWLINE); | |
fb982c25 PJ |
10294 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
10295 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
10296 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10297 | count * sizeof(struct attr_extra)), | |
10298 | VTY_NEWLINE); | |
4bf6a362 PJ |
10299 | |
10300 | if ((count = attr_unknown_count())) | |
10301 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
10302 | ||
10303 | /* AS_PATH attributes */ | |
10304 | count = aspath_count (); | |
10305 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
10306 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10307 | count * sizeof (struct aspath)), | |
10308 | VTY_NEWLINE); | |
10309 | ||
10310 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
10311 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
10312 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10313 | count * sizeof (struct assegment)), | |
10314 | VTY_NEWLINE); | |
10315 | ||
10316 | /* Other attributes */ | |
10317 | if ((count = community_count ())) | |
10318 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
10319 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10320 | count * sizeof (struct community)), | |
10321 | VTY_NEWLINE); | |
10322 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
10323 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
10324 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10325 | count * sizeof (struct ecommunity)), | |
10326 | VTY_NEWLINE); | |
10327 | ||
10328 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
10329 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
10330 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10331 | count * sizeof (struct cluster_list)), | |
10332 | VTY_NEWLINE); | |
10333 | ||
10334 | /* Peer related usage */ | |
10335 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
10336 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
10337 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10338 | count * sizeof (struct peer)), | |
10339 | VTY_NEWLINE); | |
10340 | ||
4a1ab8e4 | 10341 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) |
4bf6a362 PJ |
10342 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
10343 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10344 | count * sizeof (struct peer_group)), | |
10345 | VTY_NEWLINE); | |
10346 | ||
10347 | /* Other */ | |
10348 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
10349 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
10350 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10351 | count * sizeof (struct hash)), | |
10352 | VTY_NEWLINE); | |
10353 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
10354 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
10355 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10356 | count * sizeof (struct hash_backet)), | |
10357 | VTY_NEWLINE); | |
10358 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
10359 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
10360 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10361 | count * sizeof (regex_t)), | |
10362 | VTY_NEWLINE); | |
10363 | return CMD_SUCCESS; | |
10364 | } | |
fee0f4c6 | 10365 | |
718e3744 | 10366 | /* Show BGP peer's summary information. */ |
94f2b392 | 10367 | static int |
b05a1c8b | 10368 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, |
9f689658 | 10369 | u_char use_json, json_object *json) |
718e3744 | 10370 | { |
10371 | struct peer *peer; | |
1eb8ef25 | 10372 | struct listnode *node, *nnode; |
f14e6fdb DS |
10373 | unsigned int count = 0, dn_count = 0; |
10374 | char timebuf[BGP_UPTIME_LEN], dn_flag[2]; | |
718e3744 | 10375 | int len; |
ffd0c037 DS |
10376 | json_object *json_peer = NULL; |
10377 | json_object *json_peers = NULL; | |
718e3744 | 10378 | |
10379 | /* Header string for each address family. */ | |
4a7ac06c | 10380 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; |
47fc97cc | 10381 | |
b05a1c8b DS |
10382 | if (use_json) |
10383 | { | |
9f689658 DD |
10384 | if (json == NULL) |
10385 | json = json_object_new_object(); | |
10386 | ||
f1aa5d8a | 10387 | json_peers = json_object_new_object(); |
b05a1c8b DS |
10388 | } |
10389 | ||
1eb8ef25 | 10390 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 10391 | { |
1ff9a340 DS |
10392 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
10393 | continue; | |
10394 | ||
718e3744 | 10395 | if (peer->afc[afi][safi]) |
10396 | { | |
b05a1c8b | 10397 | if (!count) |
4bf6a362 PJ |
10398 | { |
10399 | unsigned long ents; | |
10400 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
5c81a5f3 | 10401 | int vrf_id_ui; |
10402 | ||
10403 | vrf_id_ui = (bgp->vrf_id == VRF_UNKNOWN) ? -1 : bgp->vrf_id; | |
b05a1c8b | 10404 | |
4bf6a362 | 10405 | /* Usage summary and header */ |
b05a1c8b DS |
10406 | if (use_json) |
10407 | { | |
62d6dca0 | 10408 | json_object_string_add(json, "routerId", inet_ntoa (bgp->router_id)); |
f1aa5d8a | 10409 | json_object_int_add(json, "as", bgp->as); |
9f689658 DD |
10410 | json_object_int_add(json, "vrfId", vrf_id_ui); |
10411 | json_object_string_add(json, "vrfName", | |
10412 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10413 | ? "Default" : bgp->name); | |
b05a1c8b DS |
10414 | } |
10415 | else | |
10416 | { | |
10417 | vty_out (vty, | |
5c81a5f3 | 10418 | "BGP router identifier %s, local AS number %u vrf-id %d", |
10419 | inet_ntoa (bgp->router_id), bgp->as, vrf_id_ui); | |
6aeb9e78 | 10420 | vty_out (vty, "%s", VTY_NEWLINE); |
b05a1c8b DS |
10421 | } |
10422 | ||
f188f2c4 DS |
10423 | if (bgp_update_delay_configured(bgp)) |
10424 | { | |
b05a1c8b | 10425 | if (use_json) |
f188f2c4 | 10426 | { |
62d6dca0 | 10427 | json_object_int_add(json, "updateDelayLimit", bgp->v_update_delay); |
b05a1c8b DS |
10428 | |
10429 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
62d6dca0 | 10430 | json_object_int_add(json, "updateDelayEstablishWait", bgp->v_establish_wait); |
b05a1c8b DS |
10431 | |
10432 | if (bgp_update_delay_active(bgp)) | |
10433 | { | |
62d6dca0 DS |
10434 | json_object_string_add(json, "updateDelayFirstNeighbor", bgp->update_delay_begin_time); |
10435 | json_object_boolean_true_add(json, "updateDelayInProgress"); | |
b05a1c8b DS |
10436 | } |
10437 | else | |
10438 | { | |
10439 | if (bgp->update_delay_over) | |
10440 | { | |
62d6dca0 | 10441 | json_object_string_add(json, "updateDelayFirstNeighbor", |
f1aa5d8a | 10442 | bgp->update_delay_begin_time); |
62d6dca0 | 10443 | json_object_string_add(json, "updateDelayBestpathResumed", |
f1aa5d8a | 10444 | bgp->update_delay_end_time); |
62d6dca0 | 10445 | json_object_string_add(json, "updateDelayZebraUpdateResume", |
f1aa5d8a | 10446 | bgp->update_delay_zebra_resume_time); |
62d6dca0 | 10447 | json_object_string_add(json, "updateDelayPeerUpdateResume", |
f1aa5d8a | 10448 | bgp->update_delay_peers_resume_time); |
b05a1c8b DS |
10449 | } |
10450 | } | |
f188f2c4 DS |
10451 | } |
10452 | else | |
10453 | { | |
b05a1c8b DS |
10454 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", |
10455 | bgp->v_update_delay, VTY_NEWLINE); | |
10456 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
10457 | vty_out (vty, " Establish wait: %d seconds%s", | |
10458 | bgp->v_establish_wait, VTY_NEWLINE); | |
10459 | ||
10460 | if (bgp_update_delay_active(bgp)) | |
f188f2c4 DS |
10461 | { |
10462 | vty_out (vty, " First neighbor established: %s%s", | |
10463 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
b05a1c8b DS |
10464 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); |
10465 | } | |
10466 | else | |
10467 | { | |
10468 | if (bgp->update_delay_over) | |
10469 | { | |
10470 | vty_out (vty, " First neighbor established: %s%s", | |
10471 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
10472 | vty_out (vty, " Best-paths resumed: %s%s", | |
10473 | bgp->update_delay_end_time, VTY_NEWLINE); | |
10474 | vty_out (vty, " zebra update resumed: %s%s", | |
10475 | bgp->update_delay_zebra_resume_time, VTY_NEWLINE); | |
10476 | vty_out (vty, " peers update resumed: %s%s", | |
10477 | bgp->update_delay_peers_resume_time, VTY_NEWLINE); | |
10478 | } | |
f188f2c4 DS |
10479 | } |
10480 | } | |
10481 | } | |
4bf6a362 | 10482 | |
b05a1c8b DS |
10483 | if (use_json) |
10484 | { | |
10485 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
62d6dca0 | 10486 | json_object_boolean_true_add(json, "maxMedOnStartup"); |
b05a1c8b | 10487 | if (bgp->v_maxmed_admin) |
62d6dca0 | 10488 | json_object_boolean_true_add(json, "maxMedAdministrative"); |
b05a1c8b | 10489 | |
62d6dca0 | 10490 | json_object_int_add(json, "tableVersion", bgp_table_version(bgp->rib[afi][safi])); |
b05a1c8b DS |
10491 | |
10492 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
62d6dca0 DS |
10493 | json_object_int_add(json, "ribCount", ents); |
10494 | json_object_int_add(json, "ribMemory", ents * sizeof (struct bgp_node)); | |
b05a1c8b DS |
10495 | |
10496 | ents = listcount (bgp->peer); | |
62d6dca0 DS |
10497 | json_object_int_add(json, "peerCount", ents); |
10498 | json_object_int_add(json, "peerMemory", ents * sizeof (struct peer)); | |
b05a1c8b | 10499 | |
b05a1c8b DS |
10500 | if ((ents = listcount (bgp->group))) |
10501 | { | |
62d6dca0 DS |
10502 | json_object_int_add(json, "peerGroupCount", ents); |
10503 | json_object_int_add(json, "peerGroupMemory", ents * sizeof (struct peer_group)); | |
b05a1c8b | 10504 | } |
3f9c7369 | 10505 | |
b05a1c8b | 10506 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
62d6dca0 | 10507 | json_object_boolean_true_add(json, "dampeningEnabled"); |
b05a1c8b DS |
10508 | } |
10509 | else | |
10510 | { | |
10511 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
10512 | vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE); | |
10513 | if (bgp->v_maxmed_admin) | |
10514 | vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE); | |
10515 | ||
ffd0c037 | 10516 | vty_out(vty, "BGP table version %" PRIu64 "%s", |
b05a1c8b DS |
10517 | bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE); |
10518 | ||
10519 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
10520 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
10521 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10522 | ents * sizeof (struct bgp_node)), | |
10523 | VTY_NEWLINE); | |
10524 | ||
10525 | /* Peer related usage */ | |
10526 | ents = listcount (bgp->peer); | |
10527 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
10528 | ents, | |
10529 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10530 | ents * sizeof (struct peer)), | |
10531 | VTY_NEWLINE); | |
10532 | ||
b05a1c8b DS |
10533 | if ((ents = listcount (bgp->group))) |
10534 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
10535 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
10536 | ents * sizeof (struct peer_group)), | |
10537 | VTY_NEWLINE); | |
10538 | ||
10539 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
10540 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
10541 | vty_out (vty, "%s", VTY_NEWLINE); | |
10542 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
10543 | } | |
4bf6a362 PJ |
10544 | } |
10545 | ||
b05a1c8b | 10546 | count++; |
718e3744 | 10547 | |
b05a1c8b DS |
10548 | if (use_json) |
10549 | { | |
10550 | json_peer = json_object_new_object(); | |
f14e6fdb | 10551 | |
b05a1c8b | 10552 | if (peer_dynamic_neighbor(peer)) |
62d6dca0 | 10553 | json_object_boolean_true_add(json_peer, "dynamicPeer"); |
b05a1c8b | 10554 | |
04b6bdc0 DW |
10555 | if (peer->hostname) |
10556 | json_object_string_add(json_peer, "hostname", peer->hostname); | |
10557 | ||
10558 | if (peer->domainname) | |
10559 | json_object_string_add(json_peer, "domainname", peer->domainname); | |
10560 | ||
62d6dca0 | 10561 | json_object_int_add(json_peer, "remoteAs", peer->as); |
f1aa5d8a | 10562 | json_object_int_add(json_peer, "version", 4); |
62d6dca0 | 10563 | json_object_int_add(json_peer, "msgRcvd", |
f1aa5d8a DS |
10564 | peer->open_in + peer->update_in + peer->keepalive_in |
10565 | + peer->notify_in + peer->refresh_in | |
10566 | + peer->dynamic_cap_in); | |
62d6dca0 | 10567 | json_object_int_add(json_peer, "msgSent", |
f1aa5d8a DS |
10568 | peer->open_out + peer->update_out + peer->keepalive_out |
10569 | + peer->notify_out + peer->refresh_out | |
10570 | + peer->dynamic_cap_out); | |
10571 | ||
62d6dca0 | 10572 | json_object_int_add(json_peer, "tableVersion", peer->version[afi][safi]); |
f1aa5d8a DS |
10573 | json_object_int_add(json_peer, "outq", peer->obuf->count); |
10574 | json_object_int_add(json_peer, "inq", 0); | |
856ca177 | 10575 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, use_json, json_peer); |
62d6dca0 | 10576 | json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][safi]); |
b05a1c8b DS |
10577 | |
10578 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
f1aa5d8a | 10579 | json_object_string_add(json_peer, "state", "Idle (Admin)"); |
b05a1c8b | 10580 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
f1aa5d8a | 10581 | json_object_string_add(json_peer, "state", "Idle (PfxCt)"); |
b05a1c8b | 10582 | else |
f1aa5d8a | 10583 | json_object_string_add(json_peer, "state", LOOKUP(bgp_status_msg, peer->status)); |
b05a1c8b | 10584 | |
f1aa5d8a | 10585 | if (peer->conf_if) |
62d6dca0 | 10586 | json_object_string_add(json_peer, "idType", "interface"); |
f1aa5d8a | 10587 | else if (peer->su.sa.sa_family == AF_INET) |
62d6dca0 | 10588 | json_object_string_add(json_peer, "idType", "ipv4"); |
f1aa5d8a | 10589 | else if (peer->su.sa.sa_family == AF_INET6) |
62d6dca0 | 10590 | json_object_string_add(json_peer, "idType", "ipv6"); |
b05a1c8b | 10591 | |
f1aa5d8a | 10592 | json_object_object_add(json_peers, peer->host, json_peer); |
b05a1c8b DS |
10593 | } |
10594 | else | |
10595 | { | |
10596 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
10597 | if (peer_dynamic_neighbor(peer)) | |
10598 | { | |
10599 | dn_count++; | |
10600 | dn_flag[0] = '*'; | |
10601 | } | |
10602 | ||
04b6bdc0 DW |
10603 | if (peer->hostname && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME)) |
10604 | len = vty_out (vty, "%s%s(%s)", dn_flag, peer->hostname, | |
10605 | peer->host); | |
10606 | else | |
10607 | len = vty_out (vty, "%s%s", dn_flag, peer->host); | |
b05a1c8b DS |
10608 | len = 16 - len; |
10609 | ||
10610 | if (len < 1) | |
10611 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
10612 | else | |
10613 | vty_out (vty, "%*s", len, " "); | |
10614 | ||
10615 | vty_out (vty, "4 "); | |
10616 | ||
ee046671 | 10617 | vty_out (vty, "%5u %7d %7d %8" PRIu64 " %4d %4zd ", |
b05a1c8b DS |
10618 | peer->as, |
10619 | peer->open_in + peer->update_in + peer->keepalive_in | |
10620 | + peer->notify_in + peer->refresh_in | |
10621 | + peer->dynamic_cap_in, | |
10622 | peer->open_out + peer->update_out + peer->keepalive_out | |
10623 | + peer->notify_out + peer->refresh_out | |
10624 | + peer->dynamic_cap_out, | |
10625 | peer->version[afi][safi], | |
10626 | 0, | |
ffd0c037 | 10627 | peer->obuf->count); |
b05a1c8b | 10628 | |
f1aa5d8a | 10629 | vty_out (vty, "%-8s", |
856ca177 | 10630 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); |
b05a1c8b DS |
10631 | |
10632 | if (peer->status == Established) | |
10633 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); | |
10634 | else | |
10635 | { | |
10636 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
10637 | vty_out (vty, " Idle (Admin)"); | |
10638 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
10639 | vty_out (vty, " Idle (PfxCt)"); | |
10640 | else | |
10641 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
10642 | } | |
10643 | vty_out (vty, "%s", VTY_NEWLINE); | |
10644 | } | |
718e3744 | 10645 | } |
10646 | } | |
10647 | ||
b05a1c8b DS |
10648 | if (use_json) |
10649 | { | |
10650 | json_object_object_add(json, "peers", json_peers); | |
14151a32 | 10651 | |
62d6dca0 DS |
10652 | json_object_int_add(json, "totalPeers", count); |
10653 | json_object_int_add(json, "dynamicPeers", dn_count); | |
14151a32 | 10654 | |
b05a1c8b | 10655 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); |
f1aa5d8a | 10656 | json_object_free(json); |
b05a1c8b DS |
10657 | } |
10658 | else | |
f14e6fdb | 10659 | { |
b05a1c8b DS |
10660 | if (count) |
10661 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
10662 | count, VTY_NEWLINE); | |
10663 | else | |
9f689658 DD |
10664 | { |
10665 | if (use_json) | |
10666 | vty_out(vty, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s", | |
10667 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
10668 | else | |
10669 | vty_out (vty, "No %s neighbor is configured%s", | |
10670 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
10671 | } | |
b05a1c8b | 10672 | |
9f689658 | 10673 | if (dn_count && ! use_json) |
b05a1c8b DS |
10674 | { |
10675 | vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE); | |
10676 | vty_out(vty, | |
10677 | "%d dynamic neighbor(s), limit %d%s", | |
10678 | dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
10679 | } | |
f14e6fdb DS |
10680 | } |
10681 | ||
718e3744 | 10682 | return CMD_SUCCESS; |
10683 | } | |
10684 | ||
47fc97cc DS |
10685 | static int |
10686 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
b05a1c8b | 10687 | afi_t afi, safi_t safi, u_char use_json) |
718e3744 | 10688 | { |
10689 | struct bgp *bgp; | |
10690 | ||
10691 | if (name) | |
10692 | { | |
10693 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 10694 | |
718e3744 | 10695 | if (! bgp) |
10696 | { | |
47fc97cc | 10697 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 10698 | return CMD_WARNING; |
10699 | } | |
10700 | ||
9f689658 | 10701 | bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); |
718e3744 | 10702 | return CMD_SUCCESS; |
10703 | } | |
47fc97cc | 10704 | |
718e3744 | 10705 | bgp = bgp_get_default (); |
10706 | ||
10707 | if (bgp) | |
9f689658 | 10708 | bgp_show_summary (vty, bgp, afi, safi, use_json, NULL); |
47fc97cc | 10709 | |
718e3744 | 10710 | return CMD_SUCCESS; |
10711 | } | |
10712 | ||
f186de26 | 10713 | static void |
10714 | bgp_show_all_instances_summary_vty (struct vty *vty, afi_t afi, safi_t safi, | |
10715 | u_char use_json) | |
10716 | { | |
10717 | struct listnode *node, *nnode; | |
10718 | struct bgp *bgp; | |
9f689658 DD |
10719 | json_object *json = NULL; |
10720 | int is_first = 1; | |
10721 | ||
10722 | if (use_json) | |
10723 | vty_out (vty, "{%s", VTY_NEWLINE); | |
f186de26 | 10724 | |
10725 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
10726 | { | |
9f689658 DD |
10727 | if (use_json) |
10728 | { | |
10729 | if (!(json = json_object_new_object())) | |
10730 | { | |
10731 | zlog_err("Unable to allocate memory for JSON object"); | |
10732 | vty_out (vty, | |
10733 | "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s", | |
10734 | VTY_NEWLINE); | |
10735 | return; | |
10736 | } | |
10737 | ||
10738 | if (! is_first) | |
10739 | vty_out (vty, ",%s", VTY_NEWLINE); | |
10740 | else | |
10741 | is_first = 0; | |
10742 | ||
10743 | vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10744 | ? "Default" : bgp->name); | |
10745 | } | |
10746 | else | |
10747 | { | |
10748 | vty_out (vty, "%sInstance %s:%s", | |
10749 | VTY_NEWLINE, | |
10750 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
10751 | ? "Default" : bgp->name, VTY_NEWLINE); | |
10752 | } | |
10753 | bgp_show_summary (vty, bgp, afi, safi, use_json, json); | |
f186de26 | 10754 | } |
9f689658 DD |
10755 | |
10756 | if (use_json) | |
10757 | vty_out (vty, "}%s", VTY_NEWLINE); | |
10758 | ||
f186de26 | 10759 | } |
10760 | ||
718e3744 | 10761 | /* `show ip bgp summary' commands. */ |
47fc97cc | 10762 | DEFUN (show_ip_bgp_summary, |
718e3744 | 10763 | show_ip_bgp_summary_cmd, |
b162fa78 | 10764 | "show ip bgp summary [json]", |
47fc97cc DS |
10765 | SHOW_STR |
10766 | IP_STR | |
10767 | BGP_STR | |
b05a1c8b DS |
10768 | "Summary of BGP neighbor status\n" |
10769 | "JavaScript Object Notation\n") | |
47fc97cc | 10770 | { |
db7c8528 DS |
10771 | u_char uj = use_json(argc, argv); |
10772 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); | |
718e3744 | 10773 | } |
10774 | ||
10775 | DEFUN (show_ip_bgp_instance_summary, | |
10776 | show_ip_bgp_instance_summary_cmd, | |
b162fa78 | 10777 | "show ip bgp " BGP_INSTANCE_CMD " summary [json]", |
718e3744 | 10778 | SHOW_STR |
10779 | IP_STR | |
10780 | BGP_STR | |
8386ac43 | 10781 | BGP_INSTANCE_HELP_STR |
b05a1c8b DS |
10782 | "Summary of BGP neighbor status\n" |
10783 | "JavaScript Object Notation\n") | |
718e3744 | 10784 | { |
db7c8528 | 10785 | u_char uj = use_json(argc, argv); |
afec25d9 | 10786 | return bgp_show_summary_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10787 | } |
10788 | ||
f186de26 | 10789 | DEFUN (show_ip_bgp_instance_all_summary, |
10790 | show_ip_bgp_instance_all_summary_cmd, | |
b162fa78 | 10791 | "show ip bgp " BGP_INSTANCE_ALL_CMD " summary [json]", |
f186de26 | 10792 | SHOW_STR |
10793 | IP_STR | |
10794 | BGP_STR | |
10795 | BGP_INSTANCE_ALL_HELP_STR | |
10796 | "Summary of BGP neighbor status\n" | |
10797 | "JavaScript Object Notation\n") | |
10798 | { | |
10799 | u_char uj = use_json(argc, argv); | |
10800 | ||
10801 | bgp_show_all_instances_summary_vty (vty, AFI_IP, SAFI_UNICAST, uj); | |
10802 | return CMD_SUCCESS; | |
10803 | } | |
10804 | ||
f412b39a DW |
10805 | /* |
10806 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
b162fa78 | 10807 | * "show bgp ipv4 (unicast|multicast) summary [json]", |
f412b39a DW |
10808 | * SHOW_STR |
10809 | * BGP_STR | |
10810 | * "Address family\n" | |
10811 | * "Address Family modifier\n" | |
10812 | * "Address Family modifier\n" | |
10813 | * "Summary of BGP neighbor status\n" | |
10814 | * | |
10815 | */ | |
10816 | DEFUN (show_ip_bgp_ipv4_summary, | |
718e3744 | 10817 | show_ip_bgp_ipv4_summary_cmd, |
b162fa78 | 10818 | "show ip bgp ipv4 (unicast|multicast) summary [json]", |
718e3744 | 10819 | SHOW_STR |
10820 | IP_STR | |
10821 | BGP_STR | |
10822 | "Address family\n" | |
10823 | "Address Family modifier\n" | |
10824 | "Address Family modifier\n" | |
b05a1c8b DS |
10825 | "Summary of BGP neighbor status\n" |
10826 | "JavaScript Object Notation\n") | |
718e3744 | 10827 | { |
db7c8528 | 10828 | u_char uj = use_json(argc, argv); |
afec25d9 | 10829 | if (strncmp (argv[4]->arg, "m", 1) == 0) |
db7c8528 | 10830 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj); |
718e3744 | 10831 | |
db7c8528 | 10832 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10833 | } |
10834 | ||
95cbbd2a | 10835 | |
e3e29b32 LB |
10836 | DEFUN (show_bgp_ipv4_vpn_summary, |
10837 | show_bgp_ipv4_vpn_summary_cmd, | |
b162fa78 | 10838 | "show bgp ipv4 vpn summary [json]", |
e3e29b32 LB |
10839 | SHOW_STR |
10840 | BGP_STR | |
10841 | "IPv4\n" | |
10842 | "Display VPN NLRI specific information\n" | |
10843 | "Summary of BGP neighbor status\n" | |
10844 | JSON_STR) | |
10845 | { | |
10846 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json (argc, argv)); | |
10847 | } | |
10848 | ||
10849 | /* `show ip bgp summary' commands. */ | |
10850 | DEFUN (show_bgp_ipv6_vpn_summary, | |
10851 | show_bgp_ipv6_vpn_summary_cmd, | |
b162fa78 | 10852 | "show bgp ipv6 vpn summary [json]", |
e3e29b32 LB |
10853 | SHOW_STR |
10854 | BGP_STR | |
10855 | "IPv6\n" | |
10856 | "Display VPN NLRI specific information\n" | |
10857 | "Summary of BGP neighbor status\n" | |
10858 | JSON_STR) | |
10859 | { | |
10860 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN, use_json (argc, argv)); | |
10861 | } | |
10862 | ||
f412b39a DW |
10863 | /* |
10864 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
b162fa78 | 10865 | * "show bgp view WORD ipv4 (unicast|multicast) summary [json]", |
f412b39a DW |
10866 | * SHOW_STR |
10867 | * BGP_STR | |
10868 | * "BGP view\n" | |
10869 | * "View name\n" | |
10870 | * "Address family\n" | |
10871 | * "Address Family modifier\n" | |
10872 | * "Address Family modifier\n" | |
10873 | * "Summary of BGP neighbor status\n" | |
10874 | * | |
10875 | */ | |
718e3744 | 10876 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
10877 | show_ip_bgp_instance_ipv4_summary_cmd, | |
b162fa78 | 10878 | "show ip bgp view WORD ipv4 (unicast|multicast) summary [json]", |
718e3744 | 10879 | SHOW_STR |
10880 | IP_STR | |
10881 | BGP_STR | |
10882 | "BGP view\n" | |
10883 | "View name\n" | |
10884 | "Address family\n" | |
10885 | "Address Family modifier\n" | |
10886 | "Address Family modifier\n" | |
b05a1c8b DS |
10887 | "Summary of BGP neighbor status\n" |
10888 | "JavaScript Object Notation\n") | |
718e3744 | 10889 | { |
db7c8528 | 10890 | u_char uj = use_json(argc, argv); |
afec25d9 DW |
10891 | if (strncmp (argv[6]->arg, "m", 1) == 0) |
10892 | return bgp_show_summary_vty (vty, argv[4]->arg, AFI_IP, SAFI_MULTICAST, uj); | |
718e3744 | 10893 | else |
afec25d9 | 10894 | return bgp_show_summary_vty (vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 10895 | } |
10896 | ||
95cbbd2a | 10897 | |
718e3744 | 10898 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
10899 | show_ip_bgp_vpnv4_all_summary_cmd, | |
b162fa78 | 10900 | "show ip bgp vpnv4 all summary [json]", |
718e3744 | 10901 | SHOW_STR |
10902 | IP_STR | |
10903 | BGP_STR | |
10904 | "Display VPNv4 NLRI specific information\n" | |
10905 | "Display information about all VPNv4 NLRIs\n" | |
b05a1c8b DS |
10906 | "Summary of BGP neighbor status\n" |
10907 | "JavaScript Object Notation\n") | |
718e3744 | 10908 | { |
db7c8528 DS |
10909 | u_char uj = use_json(argc, argv); |
10910 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); | |
718e3744 | 10911 | } |
10912 | ||
10913 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
10914 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
b162fa78 | 10915 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary [json]", |
718e3744 | 10916 | SHOW_STR |
10917 | IP_STR | |
10918 | BGP_STR | |
10919 | "Display VPNv4 NLRI specific information\n" | |
10920 | "Display information for a route distinguisher\n" | |
10921 | "VPN Route Distinguisher\n" | |
b05a1c8b DS |
10922 | "Summary of BGP neighbor status\n" |
10923 | "JavaScript Object Notation\n") | |
718e3744 | 10924 | { |
10925 | int ret; | |
10926 | struct prefix_rd prd; | |
db7c8528 | 10927 | u_char uj = use_json(argc, argv); |
718e3744 | 10928 | |
afec25d9 | 10929 | ret = str2prefix_rd (argv[5]->arg, &prd); |
718e3744 | 10930 | if (! ret) |
10931 | { | |
10932 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
10933 | return CMD_WARNING; | |
10934 | } | |
10935 | ||
db7c8528 | 10936 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); |
718e3744 | 10937 | } |
10938 | ||
10939 | #ifdef HAVE_IPV6 | |
f412b39a DW |
10940 | /* |
10941 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
b162fa78 | 10942 | * "show bgp ipv6 summary [json]", |
f412b39a DW |
10943 | * SHOW_STR |
10944 | * BGP_STR | |
10945 | * "Address family\n" | |
10946 | * "Summary of BGP neighbor status\n" | |
10947 | * | |
10948 | */ | |
47fc97cc | 10949 | DEFUN (show_bgp_summary, |
718e3744 | 10950 | show_bgp_summary_cmd, |
b162fa78 | 10951 | "show bgp summary [json]", |
718e3744 | 10952 | SHOW_STR |
10953 | BGP_STR | |
b05a1c8b DS |
10954 | "Summary of BGP neighbor status\n" |
10955 | "JavaScript Object Notation\n") | |
718e3744 | 10956 | { |
db7c8528 | 10957 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); |
718e3744 | 10958 | } |
10959 | ||
f412b39a DW |
10960 | /* |
10961 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
b162fa78 | 10962 | * "show bgp " BGP_INSTANCE_CMD " ipv6 summary [json]", |
f412b39a DW |
10963 | * SHOW_STR |
10964 | * BGP_STR | |
10965 | * BGP_INSTANCE_HELP_STR | |
10966 | * "Address family\n" | |
10967 | * "Summary of BGP neighbor status\n" | |
10968 | * | |
10969 | */ | |
718e3744 | 10970 | DEFUN (show_bgp_instance_summary, |
10971 | show_bgp_instance_summary_cmd, | |
b162fa78 | 10972 | "show bgp " BGP_INSTANCE_CMD " summary [json]", |
718e3744 | 10973 | SHOW_STR |
10974 | BGP_STR | |
8386ac43 | 10975 | BGP_INSTANCE_HELP_STR |
b05a1c8b DS |
10976 | "Summary of BGP neighbor status\n" |
10977 | "JavaScript Object Notation\n") | |
718e3744 | 10978 | { |
afec25d9 | 10979 | return bgp_show_summary_vty (vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); |
718e3744 | 10980 | } |
10981 | ||
f186de26 | 10982 | DEFUN (show_bgp_instance_all_summary, |
10983 | show_bgp_instance_all_summary_cmd, | |
b162fa78 | 10984 | "show bgp " BGP_INSTANCE_ALL_CMD " summary [json]", |
f186de26 | 10985 | SHOW_STR |
10986 | BGP_STR | |
10987 | BGP_INSTANCE_ALL_HELP_STR | |
10988 | "Summary of BGP neighbor status\n" | |
10989 | "JavaScript Object Notation\n") | |
10990 | { | |
10991 | u_char uj = use_json(argc, argv); | |
10992 | ||
10993 | bgp_show_all_instances_summary_vty (vty, AFI_IP6, SAFI_UNICAST, uj); | |
10994 | return CMD_SUCCESS; | |
10995 | } | |
10996 | ||
718e3744 | 10997 | |
718e3744 | 10998 | |
95cbbd2a ML |
10999 | DEFUN (show_bgp_ipv6_safi_summary, |
11000 | show_bgp_ipv6_safi_summary_cmd, | |
b162fa78 | 11001 | "show bgp ipv6 (unicast|multicast) summary [json]", |
95cbbd2a ML |
11002 | SHOW_STR |
11003 | BGP_STR | |
11004 | "Address family\n" | |
11005 | "Address Family modifier\n" | |
11006 | "Address Family modifier\n" | |
b05a1c8b DS |
11007 | "Summary of BGP neighbor status\n" |
11008 | "JavaScript Object Notation\n") | |
95cbbd2a | 11009 | { |
db7c8528 | 11010 | u_char uj = use_json(argc, argv); |
afec25d9 | 11011 | if (strncmp (argv[3]->arg, "m", 1) == 0) |
db7c8528 | 11012 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); |
95cbbd2a | 11013 | |
db7c8528 | 11014 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); |
95cbbd2a ML |
11015 | } |
11016 | ||
11017 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
11018 | show_bgp_instance_ipv6_safi_summary_cmd, | |
b162fa78 | 11019 | "show bgp " BGP_INSTANCE_CMD " ipv6 (unicast|multicast) summary [json]", |
95cbbd2a ML |
11020 | SHOW_STR |
11021 | BGP_STR | |
8386ac43 | 11022 | BGP_INSTANCE_HELP_STR |
95cbbd2a ML |
11023 | "Address family\n" |
11024 | "Address Family modifier\n" | |
11025 | "Address Family modifier\n" | |
b05a1c8b DS |
11026 | "Summary of BGP neighbor status\n" |
11027 | "JavaScript Object Notation\n") | |
95cbbd2a | 11028 | { |
db7c8528 | 11029 | u_char uj = use_json(argc, argv); |
afec25d9 DW |
11030 | if (strncmp (argv[5]->arg, "m", 1) == 0) |
11031 | return bgp_show_summary_vty (vty, argv[3]->arg, AFI_IP6, SAFI_MULTICAST, uj); | |
95cbbd2a | 11032 | |
afec25d9 | 11033 | return bgp_show_summary_vty (vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, uj); |
95cbbd2a ML |
11034 | } |
11035 | ||
718e3744 | 11036 | /* old command */ |
f412b39a | 11037 | DEFUN (show_ipv6_bgp_summary, |
718e3744 | 11038 | show_ipv6_bgp_summary_cmd, |
b162fa78 | 11039 | "show ipv6 bgp summary [json]", |
718e3744 | 11040 | SHOW_STR |
11041 | IPV6_STR | |
11042 | BGP_STR | |
b05a1c8b DS |
11043 | "Summary of BGP neighbor status\n" |
11044 | "JavaScript Object Notation\n") | |
718e3744 | 11045 | { |
db7c8528 DS |
11046 | u_char uj = use_json(argc, argv); |
11047 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); | |
718e3744 | 11048 | } |
11049 | ||
11050 | /* old command */ | |
f412b39a | 11051 | DEFUN (show_ipv6_mbgp_summary, |
718e3744 | 11052 | show_ipv6_mbgp_summary_cmd, |
b162fa78 | 11053 | "show ipv6 mbgp summary [json]", |
718e3744 | 11054 | SHOW_STR |
11055 | IPV6_STR | |
11056 | MBGP_STR | |
b05a1c8b DS |
11057 | "Summary of BGP neighbor status\n" |
11058 | "JavaScript Object Notation\n") | |
718e3744 | 11059 | { |
db7c8528 DS |
11060 | u_char uj = use_json(argc, argv); |
11061 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); | |
718e3744 | 11062 | } |
11063 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 11064 | |
fd79ac91 | 11065 | const char * |
538621f2 | 11066 | afi_safi_print (afi_t afi, safi_t safi) |
11067 | { | |
11068 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
11069 | return "IPv4 Unicast"; | |
11070 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
11071 | return "IPv4 Multicast"; | |
11072 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
945c8fe9 | 11073 | return "VPN-IPv4 Unicast"; |
8b1fb8be LB |
11074 | else if (afi == AFI_IP && safi == SAFI_ENCAP) |
11075 | return "ENCAP-IPv4 Unicast"; | |
538621f2 | 11076 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) |
11077 | return "IPv6 Unicast"; | |
11078 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
11079 | return "IPv6 Multicast"; | |
945c8fe9 LB |
11080 | else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN) |
11081 | return "VPN-IPv6 Unicast"; | |
8b1fb8be LB |
11082 | else if (afi == AFI_IP6 && safi == SAFI_ENCAP) |
11083 | return "ENCAP-IPv6 Unicast"; | |
538621f2 | 11084 | else |
11085 | return "Unknown"; | |
11086 | } | |
11087 | ||
718e3744 | 11088 | /* Show BGP peer's information. */ |
11089 | enum show_type | |
11090 | { | |
11091 | show_all, | |
11092 | show_peer | |
11093 | }; | |
11094 | ||
94f2b392 | 11095 | static void |
856ca177 MS |
11096 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
11097 | u_int16_t adv_smcap, u_int16_t adv_rmcap, u_int16_t rcv_smcap, | |
11098 | u_int16_t rcv_rmcap, u_char use_json, json_object *json_pref) | |
718e3744 | 11099 | { |
11100 | /* Send-Mode */ | |
11101 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
11102 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
11103 | { | |
856ca177 MS |
11104 | if (use_json) |
11105 | { | |
11106 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
11107 | json_object_string_add(json_pref, "sendMode", "advertisedAndReceived"); | |
11108 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
11109 | json_object_string_add(json_pref, "sendMode", "advertised"); | |
11110 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
11111 | json_object_string_add(json_pref, "sendMode", "received"); | |
11112 | } | |
11113 | else | |
11114 | { | |
11115 | vty_out (vty, " Send-mode: "); | |
11116 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
11117 | vty_out (vty, "advertised"); | |
11118 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
11119 | vty_out (vty, "%sreceived", | |
11120 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
11121 | ", " : ""); | |
11122 | vty_out (vty, "%s", VTY_NEWLINE); | |
11123 | } | |
718e3744 | 11124 | } |
11125 | ||
11126 | /* Receive-Mode */ | |
11127 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
11128 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
11129 | { | |
856ca177 MS |
11130 | if (use_json) |
11131 | { | |
11132 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
11133 | json_object_string_add(json_pref, "recvMode", "advertisedAndReceived"); | |
11134 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
11135 | json_object_string_add(json_pref, "recvMode", "advertised"); | |
11136 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
11137 | json_object_string_add(json_pref, "recvMode", "received"); | |
11138 | } | |
11139 | else | |
11140 | { | |
11141 | vty_out (vty, " Receive-mode: "); | |
11142 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
11143 | vty_out (vty, "advertised"); | |
11144 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
11145 | vty_out (vty, "%sreceived", | |
11146 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
11147 | ", " : ""); | |
11148 | vty_out (vty, "%s", VTY_NEWLINE); | |
11149 | } | |
718e3744 | 11150 | } |
11151 | } | |
11152 | ||
94f2b392 | 11153 | static void |
856ca177 MS |
11154 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
11155 | u_char use_json, json_object *json_neigh) | |
718e3744 | 11156 | { |
11157 | struct bgp_filter *filter; | |
3f9c7369 | 11158 | struct peer_af *paf; |
718e3744 | 11159 | char orf_pfx_name[BUFSIZ]; |
11160 | int orf_pfx_count; | |
856ca177 MS |
11161 | json_object *json_af = NULL; |
11162 | json_object *json_prefA = NULL; | |
11163 | json_object *json_prefB = NULL; | |
11164 | json_object *json_addr = NULL; | |
718e3744 | 11165 | |
856ca177 MS |
11166 | if (use_json) |
11167 | { | |
11168 | json_addr = json_object_new_object(); | |
11169 | json_af = json_object_new_object(); | |
11170 | json_prefA = json_object_new_object(); | |
11171 | json_prefB = json_object_new_object(); | |
11172 | filter = &p->filter[afi][safi]; | |
718e3744 | 11173 | |
c8560b44 | 11174 | if (peer_group_active(p)) |
856ca177 | 11175 | json_object_string_add(json_addr, "peerGroupMember", p->group->name); |
538621f2 | 11176 | |
856ca177 MS |
11177 | paf = peer_af_find(p, afi, safi); |
11178 | if (paf && PAF_SUBGRP(paf)) | |
11179 | { | |
11180 | json_object_int_add(json_addr, "updateGroupId", PAF_UPDGRP(paf)->id); | |
11181 | json_object_int_add(json_addr, "subGroupId", PAF_SUBGRP(paf)->id); | |
11182 | json_object_int_add(json_addr, "packetQueueLength", bpacket_queue_virtual_length(paf)); | |
11183 | } | |
11184 | ||
11185 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11186 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
11187 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11188 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
11189 | { | |
11190 | json_object_int_add(json_af, "orfType", ORF_TYPE_PREFIX); | |
11191 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11192 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11193 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11194 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
11195 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, json_prefA); | |
11196 | json_object_object_add(json_af, "orfPrefixList", json_prefA); | |
11197 | } | |
11198 | ||
11199 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11200 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11201 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11202 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11203 | { | |
11204 | json_object_int_add(json_af, "orfOldType", ORF_TYPE_PREFIX_OLD); | |
11205 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11206 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11207 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11208 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
11209 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, json_prefB); | |
11210 | json_object_object_add(json_af, "orfOldPrefixList", json_prefB); | |
11211 | } | |
11212 | ||
11213 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11214 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
11215 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11216 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11217 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
11218 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11219 | json_object_object_add(json_addr, "afDependentCap", json_af); | |
11220 | ||
11221 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
11222 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
11223 | ||
11224 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
11225 | || orf_pfx_count) | |
11226 | { | |
11227 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
11228 | json_object_boolean_true_add(json_neigh, "orfSent"); | |
11229 | if (orf_pfx_count) | |
11230 | json_object_int_add(json_addr, "orfRecvCounter", orf_pfx_count); | |
11231 | } | |
11232 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
11233 | json_object_string_add(json_addr, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd"); | |
11234 | ||
11235 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
11236 | json_object_boolean_true_add(json_addr, "routeReflectorClient"); | |
11237 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
11238 | json_object_boolean_true_add(json_addr, "routeServerClient"); | |
11239 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
11240 | json_object_boolean_true_add(json_addr, "inboundSoftConfigPermit"); | |
11241 | ||
88b8ed8d DW |
11242 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
11243 | json_object_boolean_true_add(json_addr, "privateAsNumsAllReplacedInUpdatesToNbr"); | |
11244 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 11245 | json_object_boolean_true_add(json_addr, "privateAsNumsReplacedInUpdatesToNbr"); |
88b8ed8d DW |
11246 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
11247 | json_object_boolean_true_add(json_addr, "privateAsNumsAllRemovedInUpdatesToNbr"); | |
856ca177 MS |
11248 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
11249 | json_object_boolean_true_add(json_addr, "privateAsNumsRemovedInUpdatesToNbr"); | |
11250 | ||
adbac85e DW |
11251 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) |
11252 | json_object_boolean_true_add(json_addr, "addpathTxAllPaths"); | |
11253 | ||
06370dac DW |
11254 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) |
11255 | json_object_boolean_true_add(json_addr, "addpathTxBestpathPerAS"); | |
11256 | ||
856ca177 MS |
11257 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
11258 | json_object_string_add(json_addr, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs"); | |
11259 | ||
11260 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
11261 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
11262 | json_object_boolean_true_add(json_addr, "routerAlwaysNextHop"); | |
11263 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
11264 | json_object_boolean_true_add(json_addr, "unchangedAsPathPropogatedToNbr"); | |
11265 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
11266 | json_object_boolean_true_add(json_addr, "unchangedNextHopPropogatedToNbr"); | |
11267 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
11268 | json_object_boolean_true_add(json_addr, "unchangedMedPropogatedToNbr"); | |
718e3744 | 11269 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
856ca177 MS |
11270 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
11271 | { | |
11272 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11273 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11274 | json_object_string_add(json_addr, "commAttriSentToNbr", "extendedAndStandard"); | |
11275 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11276 | json_object_string_add(json_addr, "commAttriSentToNbr", "extended"); | |
11277 | else | |
11278 | json_object_string_add(json_addr, "commAttriSentToNbr", "standard"); | |
11279 | } | |
11280 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
11281 | { | |
11282 | if (p->default_rmap[afi][safi].name) | |
11283 | json_object_string_add(json_addr, "defaultRouteMap", p->default_rmap[afi][safi].name); | |
11284 | ||
11285 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
11286 | json_object_boolean_true_add(json_addr, "defaultSent"); | |
11287 | else | |
11288 | json_object_boolean_true_add(json_addr, "defaultNotSent"); | |
11289 | } | |
11290 | ||
11291 | if (filter->plist[FILTER_IN].name | |
11292 | || filter->dlist[FILTER_IN].name | |
11293 | || filter->aslist[FILTER_IN].name | |
11294 | || filter->map[RMAP_IN].name) | |
11295 | json_object_boolean_true_add(json_addr, "inboundPathPolicyConfig"); | |
11296 | if (filter->plist[FILTER_OUT].name | |
11297 | || filter->dlist[FILTER_OUT].name | |
11298 | || filter->aslist[FILTER_OUT].name | |
11299 | || filter->map[RMAP_OUT].name | |
11300 | || filter->usmap.name) | |
11301 | json_object_boolean_true_add(json_addr, "outboundPathPolicyConfig"); | |
856ca177 MS |
11302 | |
11303 | /* prefix-list */ | |
11304 | if (filter->plist[FILTER_IN].name) | |
11305 | json_object_string_add(json_addr, "incomingUpdatePrefixFilterList", filter->plist[FILTER_IN].name); | |
11306 | if (filter->plist[FILTER_OUT].name) | |
11307 | json_object_string_add(json_addr, "outgoingUpdatePrefixFilterList", filter->plist[FILTER_OUT].name); | |
11308 | ||
11309 | /* distribute-list */ | |
11310 | if (filter->dlist[FILTER_IN].name) | |
11311 | json_object_string_add(json_addr, "incomingUpdateNetworkFilterList", filter->dlist[FILTER_IN].name); | |
11312 | if (filter->dlist[FILTER_OUT].name) | |
11313 | json_object_string_add(json_addr, "outgoingUpdateNetworkFilterList", filter->dlist[FILTER_OUT].name); | |
11314 | ||
11315 | /* filter-list. */ | |
11316 | if (filter->aslist[FILTER_IN].name) | |
11317 | json_object_string_add(json_addr, "incomingUpdateAsPathFilterList", filter->aslist[FILTER_IN].name); | |
11318 | if (filter->aslist[FILTER_OUT].name) | |
11319 | json_object_string_add(json_addr, "outgoingUpdateAsPathFilterList", filter->aslist[FILTER_OUT].name); | |
11320 | ||
11321 | /* route-map. */ | |
11322 | if (filter->map[RMAP_IN].name) | |
11323 | json_object_string_add(json_addr, "routeMapForIncomingAdvertisements", filter->map[RMAP_IN].name); | |
11324 | if (filter->map[RMAP_OUT].name) | |
11325 | json_object_string_add(json_addr, "routeMapForOutgoingAdvertisements", filter->map[RMAP_OUT].name); | |
856ca177 MS |
11326 | |
11327 | /* unsuppress-map */ | |
11328 | if (filter->usmap.name) | |
11329 | json_object_string_add(json_addr, "selectiveUnsuppressRouteMap", filter->usmap.name); | |
11330 | ||
11331 | /* Receive prefix count */ | |
11332 | json_object_int_add(json_addr, "acceptedPrefixCounter", p->pcount[afi][safi]); | |
11333 | ||
11334 | /* Maximum prefix */ | |
11335 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
11336 | { | |
11337 | json_object_int_add(json_addr, "prefixAllowedMax", p->pmax[afi][safi]); | |
11338 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) | |
11339 | json_object_boolean_true_add(json_addr, "prefixAllowedMaxWarning"); | |
11340 | json_object_int_add(json_addr, "prefixAllowedWarningThresh", p->pmax_threshold[afi][safi]); | |
11341 | if (p->pmax_restart[afi][safi]) | |
11342 | json_object_int_add(json_addr, "prefixAllowedRestartIntervalMsecs", p->pmax_restart[afi][safi] * 60000); | |
11343 | } | |
11344 | json_object_object_add(json_neigh, afi_safi_print (afi, safi), json_addr); | |
11345 | ||
11346 | } | |
11347 | else | |
11348 | { | |
11349 | filter = &p->filter[afi][safi]; | |
11350 | ||
11351 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), | |
11352 | VTY_NEWLINE); | |
11353 | ||
c8560b44 | 11354 | if (peer_group_active(p)) |
856ca177 MS |
11355 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
11356 | ||
11357 | paf = peer_af_find(p, afi, safi); | |
11358 | if (paf && PAF_SUBGRP(paf)) | |
11359 | { | |
11360 | vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s", | |
11361 | PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE); | |
11362 | vty_out (vty, " Packet Queue length %d%s", | |
11363 | bpacket_queue_virtual_length(paf), VTY_NEWLINE); | |
11364 | } | |
718e3744 | 11365 | else |
856ca177 MS |
11366 | { |
11367 | vty_out(vty, " Not part of any update group%s", VTY_NEWLINE); | |
11368 | } | |
11369 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11370 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
11371 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11372 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11373 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
11374 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11375 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
11376 | ||
11377 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11378 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
11379 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11380 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
11381 | { | |
11382 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
11383 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
11384 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11385 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11386 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11387 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
11388 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, NULL); | |
11389 | } | |
11390 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
11391 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
11392 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
11393 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
11394 | { | |
11395 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
11396 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
11397 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
11398 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
11399 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
11400 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
11401 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, NULL); | |
11402 | } | |
718e3744 | 11403 | |
856ca177 MS |
11404 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
11405 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
718e3744 | 11406 | |
856ca177 MS |
11407 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
11408 | || orf_pfx_count) | |
11409 | { | |
11410 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
11411 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
11412 | vty_out (vty, " sent;"); | |
11413 | if (orf_pfx_count) | |
11414 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
11415 | vty_out (vty, "%s", VTY_NEWLINE); | |
11416 | } | |
11417 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
11418 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
11419 | ||
11420 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
11421 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
11422 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
11423 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
11424 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
11425 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
11426 | ||
88b8ed8d DW |
11427 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
11428 | vty_out (vty, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE); | |
11429 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 11430 | vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE); |
88b8ed8d DW |
11431 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
11432 | vty_out (vty, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE); | |
856ca177 MS |
11433 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
11434 | vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE); | |
11435 | ||
adbac85e DW |
11436 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) |
11437 | vty_out (vty, " Advertise all paths via addpath%s", VTY_NEWLINE); | |
11438 | ||
06370dac DW |
11439 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) |
11440 | vty_out (vty, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE); | |
11441 | ||
856ca177 MS |
11442 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
11443 | vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE); | |
11444 | ||
11445 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
11446 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
11447 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); | |
11448 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
11449 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11450 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
11451 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11452 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
11453 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
11454 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11455 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11456 | { | |
11457 | vty_out (vty, " Community attribute sent to this neighbor"); | |
11458 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
11459 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11460 | vty_out (vty, "(both)%s", VTY_NEWLINE); | |
11461 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
11462 | vty_out (vty, "(extended)%s", VTY_NEWLINE); | |
11463 | else | |
11464 | vty_out (vty, "(standard)%s", VTY_NEWLINE); | |
11465 | } | |
11466 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
11467 | { | |
11468 | vty_out (vty, " Default information originate,"); | |
11469 | ||
11470 | if (p->default_rmap[afi][safi].name) | |
11471 | vty_out (vty, " default route-map %s%s,", | |
11472 | p->default_rmap[afi][safi].map ? "*" : "", | |
11473 | p->default_rmap[afi][safi].name); | |
11474 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
11475 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
11476 | else | |
11477 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
11478 | } | |
718e3744 | 11479 | |
856ca177 MS |
11480 | if (filter->plist[FILTER_IN].name |
11481 | || filter->dlist[FILTER_IN].name | |
11482 | || filter->aslist[FILTER_IN].name | |
11483 | || filter->map[RMAP_IN].name) | |
11484 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); | |
11485 | if (filter->plist[FILTER_OUT].name | |
11486 | || filter->dlist[FILTER_OUT].name | |
11487 | || filter->aslist[FILTER_OUT].name | |
11488 | || filter->map[RMAP_OUT].name | |
11489 | || filter->usmap.name) | |
11490 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
856ca177 MS |
11491 | |
11492 | /* prefix-list */ | |
11493 | if (filter->plist[FILTER_IN].name) | |
11494 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
11495 | filter->plist[FILTER_IN].plist ? "*" : "", | |
11496 | filter->plist[FILTER_IN].name, | |
11497 | VTY_NEWLINE); | |
11498 | if (filter->plist[FILTER_OUT].name) | |
11499 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
11500 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
11501 | filter->plist[FILTER_OUT].name, | |
11502 | VTY_NEWLINE); | |
11503 | ||
11504 | /* distribute-list */ | |
11505 | if (filter->dlist[FILTER_IN].name) | |
11506 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
11507 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
11508 | filter->dlist[FILTER_IN].name, | |
11509 | VTY_NEWLINE); | |
11510 | if (filter->dlist[FILTER_OUT].name) | |
11511 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
11512 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
11513 | filter->dlist[FILTER_OUT].name, | |
11514 | VTY_NEWLINE); | |
11515 | ||
11516 | /* filter-list. */ | |
11517 | if (filter->aslist[FILTER_IN].name) | |
11518 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
11519 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
11520 | filter->aslist[FILTER_IN].name, | |
11521 | VTY_NEWLINE); | |
11522 | if (filter->aslist[FILTER_OUT].name) | |
11523 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
11524 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
11525 | filter->aslist[FILTER_OUT].name, | |
11526 | VTY_NEWLINE); | |
11527 | ||
11528 | /* route-map. */ | |
11529 | if (filter->map[RMAP_IN].name) | |
11530 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", | |
11531 | filter->map[RMAP_IN].map ? "*" : "", | |
11532 | filter->map[RMAP_IN].name, | |
11533 | VTY_NEWLINE); | |
11534 | if (filter->map[RMAP_OUT].name) | |
11535 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", | |
11536 | filter->map[RMAP_OUT].map ? "*" : "", | |
11537 | filter->map[RMAP_OUT].name, | |
11538 | VTY_NEWLINE); | |
856ca177 MS |
11539 | |
11540 | /* unsuppress-map */ | |
11541 | if (filter->usmap.name) | |
11542 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
11543 | filter->usmap.map ? "*" : "", | |
11544 | filter->usmap.name, VTY_NEWLINE); | |
11545 | ||
11546 | /* Receive prefix count */ | |
11547 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); | |
11548 | ||
11549 | /* Maximum prefix */ | |
11550 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
11551 | { | |
11552 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], | |
11553 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) | |
11554 | ? " (warning-only)" : "", VTY_NEWLINE); | |
11555 | vty_out (vty, " Threshold for warning message %d%%", | |
11556 | p->pmax_threshold[afi][safi]); | |
11557 | if (p->pmax_restart[afi][safi]) | |
11558 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
11559 | vty_out (vty, "%s", VTY_NEWLINE); | |
11560 | } | |
718e3744 | 11561 | |
0a486e5f | 11562 | vty_out (vty, "%s", VTY_NEWLINE); |
718e3744 | 11563 | } |
718e3744 | 11564 | } |
11565 | ||
94f2b392 | 11566 | static void |
e8f7da3a | 11567 | bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *json) |
718e3744 | 11568 | { |
11569 | struct bgp *bgp; | |
4690c7d7 | 11570 | char buf1[PREFIX2STR_BUFFER], buf[SU_ADDRSTRLEN]; |
718e3744 | 11571 | char timebuf[BGP_UPTIME_LEN]; |
f14e6fdb | 11572 | char dn_flag[2]; |
3a8c7ba1 DW |
11573 | const char *subcode_str; |
11574 | const char *code_str; | |
538621f2 | 11575 | afi_t afi; |
11576 | safi_t safi; | |
d6661008 DS |
11577 | u_int16_t i; |
11578 | u_char *msg; | |
e8f7da3a | 11579 | json_object *json_neigh = NULL; |
718e3744 | 11580 | |
11581 | bgp = p->bgp; | |
11582 | ||
e8f7da3a DW |
11583 | if (use_json) |
11584 | json_neigh = json_object_new_object(); | |
11585 | ||
856ca177 | 11586 | if (!use_json) |
f14e6fdb | 11587 | { |
856ca177 MS |
11588 | if (p->conf_if) /* Configured interface name. */ |
11589 | vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if, | |
11590 | BGP_PEER_SU_UNSPEC(p) ? "None" : | |
11591 | sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
11592 | else /* Configured IP address. */ | |
11593 | { | |
11594 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
11595 | if (peer_dynamic_neighbor(p)) | |
11596 | dn_flag[0] = '*'; | |
f14e6fdb | 11597 | |
856ca177 MS |
11598 | vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host); |
11599 | } | |
f14e6fdb DS |
11600 | } |
11601 | ||
856ca177 MS |
11602 | if (use_json) |
11603 | { | |
11604 | if (p->conf_if && BGP_PEER_SU_UNSPEC(p)) | |
11605 | json_object_string_add(json_neigh, "bgpNeighborAddr", "none"); | |
11606 | else if (p->conf_if && !BGP_PEER_SU_UNSPEC(p)) | |
11607 | json_object_string_add(json_neigh, "bgpNeighborAddr", sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
11608 | ||
11609 | json_object_int_add(json_neigh, "remoteAs", p->as); | |
11610 | ||
11611 | if (p->change_local_as) | |
11612 | json_object_int_add(json_neigh, "localAs", p->change_local_as); | |
11613 | else | |
11614 | json_object_int_add(json_neigh, "localAs", p->local_as); | |
11615 | ||
11616 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND)) | |
11617 | json_object_boolean_true_add(json_neigh, "localAsNoPrepend"); | |
66b199b2 | 11618 | |
856ca177 MS |
11619 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS)) |
11620 | json_object_boolean_true_add(json_neigh, "localAsReplaceAs"); | |
11621 | } | |
11622 | else | |
11623 | { | |
f8cfafda DS |
11624 | if ((p->as_type == AS_SPECIFIED) || |
11625 | (p->as_type == AS_EXTERNAL) || | |
11626 | (p->as_type == AS_INTERNAL)) | |
11627 | vty_out (vty, "remote AS %u, ", p->as); | |
11628 | else | |
11629 | vty_out (vty, "remote AS Unspecified, "); | |
856ca177 MS |
11630 | vty_out (vty, "local AS %u%s%s, ", |
11631 | p->change_local_as ? p->change_local_as : p->local_as, | |
11632 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
11633 | " no-prepend" : "", | |
11634 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
11635 | " replace-as" : ""); | |
11636 | } | |
66b199b2 DS |
11637 | /* peer type internal, external, confed-internal or confed-external */ |
11638 | if (p->as == p->local_as) | |
11639 | { | |
856ca177 MS |
11640 | if (use_json) |
11641 | { | |
11642 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11643 | json_object_boolean_true_add(json_neigh, "nbrConfedInternalLink"); | |
11644 | else | |
11645 | json_object_boolean_true_add(json_neigh, "nbrInternalLink"); | |
11646 | } | |
66b199b2 | 11647 | else |
856ca177 MS |
11648 | { |
11649 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11650 | vty_out (vty, "confed-internal link%s", VTY_NEWLINE); | |
11651 | else | |
11652 | vty_out (vty, "internal link%s", VTY_NEWLINE); | |
11653 | } | |
66b199b2 DS |
11654 | } |
11655 | else | |
11656 | { | |
856ca177 MS |
11657 | if (use_json) |
11658 | { | |
11659 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
11660 | json_object_boolean_true_add(json_neigh, "nbrConfedExternalLink"); | |
11661 | else | |
11662 | json_object_boolean_true_add(json_neigh, "nbrExternalLink"); | |
11663 | } | |
66b199b2 | 11664 | else |
856ca177 MS |
11665 | { |
11666 | if (bgp_confederation_peers_check(bgp, p->as)) | |
11667 | vty_out (vty, "confed-external link%s", VTY_NEWLINE); | |
11668 | else | |
11669 | vty_out (vty, "external link%s", VTY_NEWLINE); | |
11670 | } | |
66b199b2 | 11671 | } |
718e3744 | 11672 | |
11673 | /* Description. */ | |
11674 | if (p->desc) | |
856ca177 MS |
11675 | { |
11676 | if (use_json) | |
11677 | json_object_string_add(json_neigh, "nbrDesc", p->desc); | |
11678 | else | |
11679 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
11680 | } | |
6410e93a | 11681 | |
04b6bdc0 DW |
11682 | if (p->hostname) |
11683 | { | |
d1570739 DW |
11684 | if (use_json) |
11685 | { | |
11686 | if (p->hostname) | |
11687 | json_object_string_add(json_neigh, "hostname", p->hostname); | |
11688 | ||
11689 | if (p->domainname) | |
11690 | json_object_string_add(json_neigh, "domainname", p->domainname); | |
11691 | } | |
04b6bdc0 | 11692 | else |
d1570739 DW |
11693 | { |
11694 | if (p->domainname && (p->domainname[0] != '\0')) | |
11695 | vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname, | |
11696 | VTY_NEWLINE); | |
11697 | else | |
11698 | vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE); | |
11699 | } | |
11700 | ||
04b6bdc0 DW |
11701 | } |
11702 | ||
c744aa9f | 11703 | /* Peer-group */ |
718e3744 | 11704 | if (p->group) |
f14e6fdb | 11705 | { |
856ca177 MS |
11706 | if (use_json) |
11707 | { | |
11708 | json_object_string_add(json_neigh, "peerGroup", p->group->name); | |
11709 | ||
11710 | if (dn_flag[0]) | |
11711 | { | |
40ee54a7 | 11712 | struct prefix prefix, *range = NULL; |
f14e6fdb | 11713 | |
40ee54a7 TT |
11714 | sockunion2hostprefix(&(p->su), &prefix); |
11715 | range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix); | |
856ca177 MS |
11716 | |
11717 | if (range) | |
11718 | { | |
11719 | prefix2str(range, buf1, sizeof(buf1)); | |
11720 | json_object_string_add(json_neigh, "peerSubnetRangeGroup", buf1); | |
11721 | } | |
11722 | } | |
11723 | } | |
11724 | else | |
f14e6fdb | 11725 | { |
856ca177 MS |
11726 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
11727 | p->group->name, VTY_NEWLINE); | |
f14e6fdb | 11728 | |
856ca177 | 11729 | if (dn_flag[0]) |
f14e6fdb | 11730 | { |
40ee54a7 | 11731 | struct prefix prefix, *range = NULL; |
856ca177 | 11732 | |
40ee54a7 TT |
11733 | sockunion2hostprefix(&(p->su), &prefix); |
11734 | range = peer_group_lookup_dynamic_neighbor_range (p->group, &prefix); | |
856ca177 MS |
11735 | |
11736 | if (range) | |
11737 | { | |
11738 | prefix2str(range, buf1, sizeof(buf1)); | |
11739 | vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTY_NEWLINE); | |
11740 | } | |
f14e6fdb DS |
11741 | } |
11742 | } | |
11743 | } | |
718e3744 | 11744 | |
856ca177 MS |
11745 | if (use_json) |
11746 | { | |
11747 | /* Administrative shutdown. */ | |
11748 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
11749 | json_object_boolean_true_add(json_neigh, "adminShutDown"); | |
718e3744 | 11750 | |
856ca177 MS |
11751 | /* BGP Version. */ |
11752 | json_object_int_add(json_neigh, "bgpVersion", 4); | |
11753 | json_object_string_add(json_neigh, "remoteRouterId", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ)); | |
718e3744 | 11754 | |
856ca177 MS |
11755 | /* Confederation */ |
11756 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) && bgp_confederation_peers_check (bgp, p->as)) | |
11757 | json_object_boolean_true_add(json_neigh, "nbrCommonAdmin"); | |
11758 | ||
11759 | /* Status. */ | |
11760 | json_object_string_add(json_neigh, "bgpState", LOOKUP (bgp_status_msg, p->status)); | |
11761 | ||
11762 | if (p->status == Established) | |
11763 | { | |
11764 | time_t uptime; | |
11765 | struct tm *tm; | |
11766 | ||
11767 | uptime = bgp_clock(); | |
11768 | uptime -= p->uptime; | |
11769 | tm = gmtime(&uptime); | |
11770 | ||
11771 | json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
11772 | } | |
11773 | ||
11774 | else if (p->status == Active) | |
11775 | { | |
11776 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
11777 | json_object_string_add(json_neigh, "bgpStateIs", "passive"); | |
11778 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
11779 | json_object_string_add(json_neigh, "bgpStateIs", "passiveNSF"); | |
11780 | } | |
11781 | ||
11782 | /* read timer */ | |
11783 | time_t uptime; | |
11784 | struct tm *tm; | |
11785 | ||
11786 | uptime = bgp_clock(); | |
11787 | uptime -= p->readtime; | |
11788 | tm = gmtime(&uptime); | |
11789 | json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
11790 | ||
11791 | uptime = bgp_clock(); | |
11792 | uptime -= p->last_write; | |
11793 | tm = gmtime(&uptime); | |
39e871e6 ST |
11794 | json_object_int_add(json_neigh, "bgpTimerLastWrite", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); |
11795 | ||
11796 | uptime = bgp_clock(); | |
11797 | uptime -= p->update_time; | |
11798 | tm = gmtime(&uptime); | |
11799 | json_object_int_add(json_neigh, "bgpInUpdateElapsedTimeMsecs", | |
11800 | (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
856ca177 MS |
11801 | |
11802 | /* Configured timer values. */ | |
11803 | json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs", p->v_holdtime * 1000); | |
11804 | json_object_int_add(json_neigh, "bgpTimerKeepAliveIntervalMsecs", p->v_keepalive * 1000); | |
11805 | ||
11806 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
11807 | { | |
11808 | json_object_int_add(json_neigh, "bgpTimerConfiguredHoldTimeMsecs", p->holdtime * 1000); | |
11809 | json_object_int_add(json_neigh, "bgpTimerConfiguredKeepAliveIntervalMsecs", p->keepalive * 1000); | |
11810 | } | |
93406d87 | 11811 | } |
856ca177 MS |
11812 | else |
11813 | { | |
11814 | /* Administrative shutdown. */ | |
11815 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
11816 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
11817 | ||
11818 | /* BGP Version. */ | |
11819 | vty_out (vty, " BGP version 4"); | |
11820 | vty_out (vty, ", remote router ID %s%s", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
11821 | VTY_NEWLINE); | |
11822 | ||
11823 | /* Confederation */ | |
11824 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) | |
11825 | && bgp_confederation_peers_check (bgp, p->as)) | |
11826 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); | |
718e3744 | 11827 | |
856ca177 MS |
11828 | /* Status. */ |
11829 | vty_out (vty, " BGP state = %s", LOOKUP (bgp_status_msg, p->status)); | |
718e3744 | 11830 | |
856ca177 MS |
11831 | if (p->status == Established) |
11832 | vty_out (vty, ", up for %8s", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
11833 | ||
11834 | else if (p->status == Active) | |
11835 | { | |
11836 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
11837 | vty_out (vty, " (passive)"); | |
11838 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
11839 | vty_out (vty, " (NSF passive)"); | |
11840 | } | |
11841 | vty_out (vty, "%s", VTY_NEWLINE); | |
93406d87 | 11842 | |
856ca177 MS |
11843 | /* read timer */ |
11844 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
11845 | vty_out (vty, ", Last write %s%s", | |
11846 | peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTY_NEWLINE); | |
11847 | ||
11848 | /* Configured timer values. */ | |
11849 | vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s", | |
11850 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); | |
11851 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
11852 | { | |
11853 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
11854 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
11855 | p->keepalive, VTY_NEWLINE); | |
11856 | } | |
11857 | } | |
718e3744 | 11858 | /* Capability. */ |
11859 | if (p->status == Established) | |
11860 | { | |
538621f2 | 11861 | if (p->cap |
718e3744 | 11862 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
11863 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
11864 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
11865 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
11866 | #ifdef HAVE_IPV6 | |
11867 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
11868 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
11869 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
11870 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
945c8fe9 LB |
11871 | || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN] |
11872 | || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN] | |
8b1fb8be LB |
11873 | || p->afc_adv[AFI_IP6][SAFI_ENCAP] |
11874 | || p->afc_recv[AFI_IP6][SAFI_ENCAP] | |
718e3744 | 11875 | #endif /* HAVE_IPV6 */ |
8b1fb8be LB |
11876 | || p->afc_adv[AFI_IP][SAFI_ENCAP] |
11877 | || p->afc_recv[AFI_IP][SAFI_ENCAP] | |
718e3744 | 11878 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] |
11879 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
11880 | { | |
856ca177 MS |
11881 | if (use_json) |
11882 | { | |
11883 | json_object *json_cap = NULL; | |
11884 | ||
11885 | json_cap = json_object_new_object(); | |
11886 | ||
11887 | /* AS4 */ | |
11888 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
11889 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11890 | { | |
11891 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) && CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11892 | json_object_string_add(json_cap, "4byteAs", "advertisedAndReceived"); | |
11893 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
11894 | json_object_string_add(json_cap, "4byteAs", "advertised"); | |
11895 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
11896 | json_object_string_add(json_cap, "4byteAs", "received"); | |
11897 | } | |
11898 | ||
11899 | /* AddPath */ | |
11900 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
11901 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
11902 | { | |
11903 | json_object *json_add = NULL; | |
11904 | const char *print_store; | |
718e3744 | 11905 | |
856ca177 | 11906 | json_add = json_object_new_object(); |
a82478b9 | 11907 | |
856ca177 MS |
11908 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
11909 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11910 | { | |
11911 | json_object *json_sub = NULL; | |
11912 | json_sub = json_object_new_object(); | |
11913 | print_store = afi_safi_print (afi, safi); | |
11914 | ||
11915 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
11916 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11917 | { | |
11918 | 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)) | |
11919 | json_object_boolean_true_add(json_sub, "txAdvertisedAndReceived"); | |
11920 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) | |
11921 | json_object_boolean_true_add(json_sub, "txAdvertised"); | |
11922 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
11923 | json_object_boolean_true_add(json_sub, "txReceived"); | |
11924 | } | |
11925 | ||
11926 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
11927 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11928 | { | |
11929 | 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)) | |
11930 | json_object_boolean_true_add(json_sub, "rxAdvertisedAndReceived"); | |
11931 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) | |
11932 | json_object_boolean_true_add(json_sub, "rxAdvertised"); | |
11933 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11934 | json_object_boolean_true_add(json_sub, "rxReceived"); | |
11935 | } | |
11936 | ||
11937 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
11938 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV) || | |
11939 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
11940 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
11941 | json_object_object_add(json_add, print_store, json_sub); | |
11942 | } | |
a82478b9 | 11943 | |
856ca177 MS |
11944 | json_object_object_add(json_cap, "addPath", json_add); |
11945 | } | |
11946 | ||
11947 | /* Dynamic */ | |
11948 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
11949 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11950 | { | |
11951 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) && CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11952 | json_object_string_add(json_cap, "dynamic", "advertisedAndReceived"); | |
11953 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
11954 | json_object_string_add(json_cap, "dynamic", "advertised"); | |
11955 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
11956 | json_object_string_add(json_cap, "dynamic", "received"); | |
11957 | } | |
11958 | ||
11959 | /* Extended nexthop */ | |
11960 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
11961 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11962 | { | |
11963 | json_object *json_nxt = NULL; | |
11964 | const char *print_store; | |
11965 | ||
11966 | json_nxt = json_object_new_object(); | |
11967 | ||
11968 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) && CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11969 | json_object_string_add(json_cap, "extendedNexthop", "advertisedAndReceived"); | |
11970 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
11971 | json_object_string_add(json_cap, "extendedNexthop", "advertised"); | |
11972 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11973 | json_object_string_add(json_cap, "extendedNexthop", "received"); | |
11974 | ||
11975 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
11976 | { | |
11977 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11978 | { | |
11979 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
11980 | { | |
11981 | print_store = afi_safi_print (AFI_IP, safi); | |
11982 | json_object_string_add(json_nxt, print_store, "recieved"); | |
11983 | } | |
11984 | } | |
11985 | json_object_object_add(json_cap, "extendedNexthopFamililesByPeer", json_nxt); | |
11986 | } | |
11987 | } | |
11988 | ||
11989 | /* Route Refresh */ | |
11990 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
11991 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
11992 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
11993 | { | |
11994 | 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))) | |
11995 | { | |
11996 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) | |
11997 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOldNew"); | |
11998 | else | |
11999 | { | |
12000 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
12001 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOld"); | |
12002 | else | |
12003 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedNew"); | |
12004 | } | |
12005 | } | |
12006 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
12007 | json_object_string_add(json_cap, "routeRefresh", "advertised"); | |
12008 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
12009 | json_object_string_add(json_cap, "routeRefresh", "received"); | |
12010 | } | |
12011 | ||
12012 | /* Multiprotocol Extensions */ | |
12013 | json_object *json_multi = NULL; | |
12014 | json_multi = json_object_new_object(); | |
12015 | ||
12016 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12017 | { | |
12018 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12019 | { | |
12020 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
12021 | { | |
12022 | json_object *json_exten = NULL; | |
12023 | json_exten = json_object_new_object(); | |
12024 | ||
12025 | if (p->afc_adv[afi][safi] && p->afc_recv[afi][safi]) | |
12026 | json_object_boolean_true_add(json_exten, "advertisedAndReceived"); | |
12027 | else if (p->afc_adv[afi][safi]) | |
12028 | json_object_boolean_true_add(json_exten, "advertised"); | |
12029 | else if (p->afc_recv[afi][safi]) | |
12030 | json_object_boolean_true_add(json_exten, "received"); | |
12031 | ||
12032 | json_object_object_add(json_multi, afi_safi_print (afi, safi), json_exten); | |
12033 | } | |
12034 | } | |
12035 | } | |
12036 | json_object_object_add(json_cap, "multiprotocolExtensions", json_multi); | |
12037 | ||
12038 | /* Gracefull Restart */ | |
12039 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
12040 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
12041 | { | |
12042 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) && CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
12043 | json_object_string_add(json_cap, "gracefulRestart", "advertisedAndReceived"); | |
12044 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
12045 | json_object_string_add(json_cap, "gracefulRestartCapability", "advertised"); | |
12046 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
12047 | json_object_string_add(json_cap, "gracefulRestartCapability", "received"); | |
12048 | ||
12049 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
12050 | { | |
12051 | int restart_af_count = 0; | |
12052 | json_object *json_restart = NULL; | |
12053 | json_restart = json_object_new_object(); | |
12054 | ||
12055 | json_object_int_add(json_cap, "gracefulRestartRemoteTimerMsecs", p->v_gr_restart * 1000); | |
12056 | ||
12057 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12058 | { | |
12059 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12060 | { | |
12061 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
12062 | { | |
12063 | json_object *json_sub = NULL; | |
12064 | json_sub = json_object_new_object(); | |
12065 | ||
12066 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV)) | |
12067 | json_object_boolean_true_add(json_sub, "preserved"); | |
12068 | restart_af_count++; | |
12069 | json_object_object_add(json_restart, afi_safi_print (afi, safi), json_sub); | |
12070 | } | |
12071 | } | |
12072 | } | |
12073 | if (! restart_af_count) | |
12074 | json_object_string_add(json_cap, "addressFamiliesByPeer", "none"); | |
12075 | else | |
12076 | json_object_object_add(json_cap, "addressFamiliesByPeer", json_restart); | |
12077 | } | |
12078 | } | |
12079 | json_object_object_add(json_neigh, "neighborCapabilities", json_cap); | |
12080 | } | |
12081 | else | |
12082 | { | |
12083 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
12084 | ||
12085 | /* AS4 */ | |
12086 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
12087 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
12088 | { | |
12089 | vty_out (vty, " 4 Byte AS:"); | |
12090 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
12091 | vty_out (vty, " advertised"); | |
12092 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
12093 | vty_out (vty, " %sreceived", | |
12094 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
12095 | vty_out (vty, "%s", VTY_NEWLINE); | |
12096 | } | |
12097 | ||
12098 | /* AddPath */ | |
12099 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
12100 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
12101 | { | |
12102 | vty_out (vty, " AddPath:%s", VTY_NEWLINE); | |
a82478b9 | 12103 | |
856ca177 MS |
12104 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
12105 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
a82478b9 | 12106 | { |
856ca177 MS |
12107 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || |
12108 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
12109 | { | |
12110 | vty_out (vty, " %s: TX ", afi_safi_print (afi, safi)); | |
a82478b9 | 12111 | |
856ca177 MS |
12112 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) |
12113 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 12114 | |
856ca177 MS |
12115 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) |
12116 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" ); | |
a82478b9 | 12117 | |
856ca177 MS |
12118 | vty_out (vty, "%s", VTY_NEWLINE); |
12119 | } | |
a82478b9 | 12120 | |
856ca177 | 12121 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || |
a82478b9 | 12122 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
856ca177 MS |
12123 | { |
12124 | vty_out (vty, " %s: RX ", afi_safi_print (afi, safi)); | |
a82478b9 | 12125 | |
856ca177 MS |
12126 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) |
12127 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 12128 | |
856ca177 MS |
12129 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
12130 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" ); | |
a82478b9 | 12131 | |
856ca177 MS |
12132 | vty_out (vty, "%s", VTY_NEWLINE); |
12133 | } | |
a82478b9 | 12134 | } |
856ca177 | 12135 | } |
a82478b9 | 12136 | |
856ca177 MS |
12137 | /* Dynamic */ |
12138 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
12139 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
12140 | { | |
12141 | vty_out (vty, " Dynamic:"); | |
12142 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
12143 | vty_out (vty, " advertised"); | |
12144 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
12145 | vty_out (vty, " %sreceived", | |
12146 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
12147 | vty_out (vty, "%s", VTY_NEWLINE); | |
12148 | } | |
12149 | ||
12150 | /* Extended nexthop */ | |
12151 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
12152 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
12153 | { | |
12154 | vty_out (vty, " Extended nexthop:"); | |
12155 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
12156 | vty_out (vty, " advertised"); | |
12157 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
12158 | vty_out (vty, " %sreceived", | |
12159 | CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) ? "and " : ""); | |
12160 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 12161 | |
856ca177 MS |
12162 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) |
12163 | { | |
12164 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
12165 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12166 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
12167 | vty_out (vty, " %s%s", | |
12168 | afi_safi_print (AFI_IP, safi), VTY_NEWLINE); | |
12169 | } | |
12170 | } | |
8a92a8a0 | 12171 | |
856ca177 MS |
12172 | /* Route Refresh */ |
12173 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
12174 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
12175 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
12176 | { | |
12177 | vty_out (vty, " Route refresh:"); | |
12178 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
12179 | vty_out (vty, " advertised"); | |
12180 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
12181 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
12182 | vty_out (vty, " %sreceived(%s)", | |
12183 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
12184 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
12185 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
12186 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
8a92a8a0 | 12187 | |
856ca177 MS |
12188 | vty_out (vty, "%s", VTY_NEWLINE); |
12189 | } | |
718e3744 | 12190 | |
856ca177 MS |
12191 | /* Multiprotocol Extensions */ |
12192 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12193 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12194 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
12195 | { | |
12196 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); | |
12197 | if (p->afc_adv[afi][safi]) | |
12198 | vty_out (vty, " advertised"); | |
12199 | if (p->afc_recv[afi][safi]) | |
12200 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
12201 | vty_out (vty, "%s", VTY_NEWLINE); | |
12202 | } | |
538621f2 | 12203 | |
04b6bdc0 DW |
12204 | /* Hostname capability */ |
12205 | if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV) || | |
12206 | CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) | |
12207 | { | |
12208 | vty_out (vty, " Hostname Capability:"); | |
12209 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV)) | |
12210 | vty_out (vty, " advertised"); | |
12211 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_RCV)) | |
12212 | vty_out (vty, " %sreceived", | |
12213 | CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV) ? "and " : ""); | |
12214 | vty_out (vty, "%s", VTY_NEWLINE); | |
12215 | } | |
12216 | ||
856ca177 MS |
12217 | /* Gracefull Restart */ |
12218 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
12219 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
12220 | { | |
12221 | vty_out (vty, " Graceful Restart Capabilty:"); | |
12222 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
538621f2 | 12223 | vty_out (vty, " advertised"); |
856ca177 MS |
12224 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
12225 | vty_out (vty, " %sreceived", | |
12226 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
12227 | vty_out (vty, "%s", VTY_NEWLINE); | |
538621f2 | 12228 | |
856ca177 MS |
12229 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
12230 | { | |
12231 | int restart_af_count = 0; | |
12232 | ||
12233 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
12234 | p->v_gr_restart, VTY_NEWLINE); | |
12235 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
12236 | ||
12237 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12238 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12239 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
12240 | { | |
12241 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", | |
12242 | afi_safi_print (afi, safi), | |
12243 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
12244 | "preserved" : "not preserved"); | |
12245 | restart_af_count++; | |
12246 | } | |
12247 | if (! restart_af_count) | |
12248 | vty_out (vty, "none"); | |
12249 | vty_out (vty, "%s", VTY_NEWLINE); | |
12250 | } | |
12251 | } | |
12252 | } | |
718e3744 | 12253 | } |
12254 | } | |
12255 | ||
93406d87 | 12256 | /* graceful restart information */ |
12257 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
12258 | || p->t_gr_restart | |
12259 | || p->t_gr_stale) | |
12260 | { | |
856ca177 MS |
12261 | json_object *json_grace = NULL; |
12262 | json_object *json_grace_send = NULL; | |
12263 | json_object *json_grace_recv = NULL; | |
93406d87 | 12264 | int eor_send_af_count = 0; |
12265 | int eor_receive_af_count = 0; | |
12266 | ||
856ca177 MS |
12267 | if (use_json) |
12268 | { | |
12269 | json_grace = json_object_new_object(); | |
12270 | json_grace_send = json_object_new_object(); | |
12271 | json_grace_recv = json_object_new_object(); | |
12272 | ||
12273 | if (p->status == Established) | |
12274 | { | |
12275 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12276 | { | |
12277 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12278 | { | |
12279 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
12280 | { | |
12281 | json_object_boolean_true_add(json_grace_send, afi_safi_print (afi, safi)); | |
12282 | eor_send_af_count++; | |
12283 | } | |
12284 | } | |
12285 | } | |
12286 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12287 | { | |
12288 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12289 | { | |
12290 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
12291 | { | |
12292 | json_object_boolean_true_add(json_grace_recv, afi_safi_print (afi, safi)); | |
12293 | eor_receive_af_count++; | |
12294 | } | |
12295 | } | |
12296 | } | |
12297 | } | |
12298 | ||
12299 | json_object_object_add(json_grace, "endOfRibSend", json_grace_send); | |
12300 | json_object_object_add(json_grace, "endOfRibRecv", json_grace_recv); | |
12301 | ||
12302 | if (p->t_gr_restart) | |
12303 | json_object_int_add(json_grace, "gracefulRestartTimerMsecs", thread_timer_remain_second (p->t_gr_restart) * 1000); | |
12304 | ||
12305 | if (p->t_gr_stale) | |
12306 | json_object_int_add(json_grace, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p->t_gr_stale) * 1000); | |
12307 | ||
12308 | json_object_object_add(json_neigh, "gracefulRestartInfo", json_grace); | |
12309 | } | |
12310 | else | |
12311 | { | |
12312 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
12313 | if (p->status == Established) | |
12314 | { | |
12315 | vty_out (vty, " End-of-RIB send: "); | |
12316 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12317 | { | |
12318 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12319 | { | |
12320 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
12321 | { | |
12322 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
12323 | afi_safi_print (afi, safi)); | |
12324 | eor_send_af_count++; | |
12325 | } | |
12326 | } | |
12327 | } | |
12328 | vty_out (vty, "%s", VTY_NEWLINE); | |
12329 | vty_out (vty, " End-of-RIB received: "); | |
12330 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
12331 | { | |
12332 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12333 | { | |
12334 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
12335 | { | |
12336 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
12337 | afi_safi_print (afi, safi)); | |
12338 | eor_receive_af_count++; | |
12339 | } | |
12340 | } | |
12341 | } | |
12342 | vty_out (vty, "%s", VTY_NEWLINE); | |
12343 | } | |
93406d87 | 12344 | |
856ca177 MS |
12345 | if (p->t_gr_restart) |
12346 | vty_out (vty, " The remaining time of restart timer is %ld%s", | |
12347 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
0b2aa3a0 | 12348 | |
856ca177 MS |
12349 | if (p->t_gr_stale) |
12350 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", | |
12351 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
12352 | } | |
12353 | } | |
12354 | if (use_json) | |
12355 | { | |
12356 | json_object *json_stat = NULL; | |
12357 | json_stat = json_object_new_object(); | |
12358 | /* Packet counts. */ | |
12359 | json_object_int_add(json_stat, "depthInq", 0); | |
12360 | json_object_int_add(json_stat, "depthOutq", (unsigned long) p->obuf->count); | |
12361 | json_object_int_add(json_stat, "opensSent", p->open_out); | |
12362 | json_object_int_add(json_stat, "opensRecv", p->open_in); | |
12363 | json_object_int_add(json_stat, "notificationsSent", p->notify_out); | |
12364 | json_object_int_add(json_stat, "notificationsRecv", p->notify_in); | |
12365 | json_object_int_add(json_stat, "updatesSent", p->update_out); | |
12366 | json_object_int_add(json_stat, "updatesRecv", p->update_in); | |
12367 | json_object_int_add(json_stat, "keepalivesSent", p->keepalive_out); | |
12368 | json_object_int_add(json_stat, "keepalivesRecv", p->keepalive_in); | |
12369 | json_object_int_add(json_stat, "routeRefreshSent", p->refresh_out); | |
12370 | json_object_int_add(json_stat, "routeRefreshRecv", p->refresh_in); | |
12371 | json_object_int_add(json_stat, "capabilitySent", p->dynamic_cap_out); | |
12372 | json_object_int_add(json_stat, "capabilityRecv", p->dynamic_cap_in); | |
12373 | 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); | |
12374 | 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); | |
12375 | json_object_object_add(json_neigh, "messageStats", json_stat); | |
12376 | } | |
12377 | else | |
12378 | { | |
12379 | /* Packet counts. */ | |
12380 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); | |
12381 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
12382 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); | |
12383 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); | |
12384 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
12385 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
12386 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
12387 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
12388 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
12389 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
12390 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
12391 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
12392 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
12393 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 12394 | } |
12395 | ||
856ca177 MS |
12396 | if (use_json) |
12397 | { | |
12398 | /* advertisement-interval */ | |
12399 | json_object_int_add(json_neigh, "minBtwnAdvertisementRunsTimerMsecs", p->v_routeadv * 1000); | |
718e3744 | 12400 | |
856ca177 MS |
12401 | /* Update-source. */ |
12402 | if (p->update_if || p->update_source) | |
12403 | { | |
12404 | if (p->update_if) | |
12405 | json_object_string_add(json_neigh, "updateSource", p->update_if); | |
12406 | else if (p->update_source) | |
12407 | json_object_string_add(json_neigh, "updateSource", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
12408 | } | |
12409 | ||
12410 | /* Default weight */ | |
12411 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
12412 | json_object_int_add(json_neigh, "defaultWeight", p->weight); | |
12413 | ||
12414 | } | |
12415 | else | |
12416 | { | |
12417 | /* advertisement-interval */ | |
12418 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
12419 | p->v_routeadv, VTY_NEWLINE); | |
12420 | ||
12421 | /* Update-source. */ | |
12422 | if (p->update_if || p->update_source) | |
12423 | { | |
12424 | vty_out (vty, " Update source is "); | |
12425 | if (p->update_if) | |
12426 | vty_out (vty, "%s", p->update_if); | |
12427 | else if (p->update_source) | |
12428 | vty_out (vty, "%s", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
12429 | vty_out (vty, "%s", VTY_NEWLINE); | |
12430 | } | |
12431 | ||
12432 | /* Default weight */ | |
12433 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
12434 | vty_out (vty, " Default weight %d%s", p->weight, VTY_NEWLINE); | |
12435 | ||
12436 | vty_out (vty, "%s", VTY_NEWLINE); | |
12437 | } | |
718e3744 | 12438 | |
12439 | /* Address Family Information */ | |
856ca177 MS |
12440 | json_object *json_hold = NULL; |
12441 | ||
12442 | if (use_json) | |
12443 | json_hold = json_object_new_object(); | |
12444 | ||
538621f2 | 12445 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
12446 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
12447 | if (p->afc[afi][safi]) | |
856ca177 | 12448 | bgp_show_peer_afi (vty, p, afi, safi, use_json, json_hold); |
718e3744 | 12449 | |
856ca177 MS |
12450 | if (use_json) |
12451 | { | |
12452 | json_object_int_add(json_hold, "connectionsEstablished", p->established); | |
12453 | json_object_int_add(json_hold, "connectionsDropped", p->dropped); | |
12454 | } | |
12455 | else | |
12456 | vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped, | |
12457 | VTY_NEWLINE); | |
718e3744 | 12458 | |
d6661008 | 12459 | if (! p->last_reset) |
856ca177 MS |
12460 | { |
12461 | if (use_json) | |
12462 | json_object_string_add(json_hold, "lastReset", "never"); | |
12463 | else | |
12464 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); | |
12465 | } | |
e0701b79 | 12466 | else |
d6661008 | 12467 | { |
856ca177 MS |
12468 | if (use_json) |
12469 | { | |
12470 | time_t uptime; | |
12471 | struct tm *tm; | |
12472 | ||
12473 | uptime = bgp_clock(); | |
12474 | uptime -= p->resettime; | |
12475 | tm = gmtime(&uptime); | |
12476 | json_object_int_add(json_hold, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
12477 | json_object_string_add(json_hold, "lastResetDueTo", peer_down_str[(int) p->last_reset]); | |
12478 | if (p->last_reset_cause_size) | |
12479 | { | |
39e871e6 ST |
12480 | char errorcodesubcode_hexstr[5]; |
12481 | sprintf(errorcodesubcode_hexstr, "%02X%02X", p->notify.code, p->notify.subcode); | |
12482 | json_object_string_add(json_hold, "lastErrorCodeSubcode", errorcodesubcode_hexstr); | |
856ca177 MS |
12483 | } |
12484 | } | |
12485 | else | |
d6661008 | 12486 | { |
3a8c7ba1 DW |
12487 | vty_out (vty, " Last reset %s, ", |
12488 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
12489 | ||
12490 | if (p->last_reset == PEER_DOWN_NOTIFY_SEND || | |
12491 | p->last_reset == PEER_DOWN_NOTIFY_RECEIVED) | |
12492 | { | |
12493 | code_str = bgp_notify_code_str(p->notify.code); | |
12494 | subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode); | |
12495 | vty_out (vty, "due to NOTIFICATION %s (%s%s)%s", | |
12496 | p->last_reset == PEER_DOWN_NOTIFY_SEND ? "sent" : "received", | |
12497 | code_str, subcode_str, VTY_NEWLINE); | |
12498 | } | |
12499 | else | |
12500 | { | |
12501 | vty_out (vty, "due to %s%s", | |
12502 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
12503 | } | |
856ca177 MS |
12504 | |
12505 | if (p->last_reset_cause_size) | |
d6661008 | 12506 | { |
856ca177 MS |
12507 | msg = p->last_reset_cause; |
12508 | vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); | |
12509 | for (i = 1; i <= p->last_reset_cause_size; i++) | |
12510 | { | |
12511 | vty_out(vty, "%02X", *msg++); | |
d6661008 | 12512 | |
856ca177 MS |
12513 | if (i != p->last_reset_cause_size) |
12514 | { | |
12515 | if (i % 16 == 0) | |
12516 | { | |
12517 | vty_out(vty, "%s ", VTY_NEWLINE); | |
12518 | } | |
12519 | else if (i % 4 == 0) | |
12520 | { | |
12521 | vty_out(vty, " "); | |
12522 | } | |
12523 | } | |
12524 | } | |
12525 | vty_out(vty, "%s", VTY_NEWLINE); | |
d6661008 | 12526 | } |
d6661008 DS |
12527 | } |
12528 | } | |
848973c7 | 12529 | |
718e3744 | 12530 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
12531 | { | |
856ca177 MS |
12532 | if (use_json) |
12533 | json_object_boolean_true_add(json_hold, "prefixesConfigExceedMax"); | |
12534 | else | |
12535 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 12536 | |
12537 | if (p->t_pmax_restart) | |
856ca177 MS |
12538 | { |
12539 | if (use_json) | |
12540 | { | |
e8f7da3a | 12541 | json_object_boolean_true_add(json_hold, "reducePrefixNumFrom"); |
856ca177 MS |
12542 | json_object_int_add(json_hold, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); |
12543 | } | |
12544 | else | |
12545 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
12546 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
12547 | VTY_NEWLINE); | |
12548 | } | |
0a486e5f | 12549 | else |
856ca177 MS |
12550 | { |
12551 | if (use_json) | |
e8f7da3a | 12552 | json_object_boolean_true_add(json_hold, "reducePrefixNumAndClearIpBgp"); |
856ca177 MS |
12553 | else |
12554 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
12555 | p->host, VTY_NEWLINE); | |
12556 | } | |
718e3744 | 12557 | } |
12558 | ||
856ca177 MS |
12559 | if (use_json) |
12560 | json_object_object_add(json_neigh, "addressFamilyInfo", json_hold); | |
12561 | ||
f5a4827d | 12562 | /* EBGP Multihop and GTSM */ |
6d85b15b | 12563 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d | 12564 | { |
856ca177 MS |
12565 | if (use_json) |
12566 | { | |
12567 | if (p->gtsm_hops > 0) | |
12568 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->gtsm_hops); | |
12569 | else if (p->ttl > 1) | |
12570 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->ttl); | |
12571 | } | |
12572 | else | |
12573 | { | |
12574 | if (p->gtsm_hops > 0) | |
12575 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
12576 | p->gtsm_hops, VTY_NEWLINE); | |
12577 | else if (p->ttl > 1) | |
12578 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
12579 | p->ttl, VTY_NEWLINE); | |
12580 | } | |
f5a4827d | 12581 | } |
5d804b43 PM |
12582 | else |
12583 | { | |
12584 | if (p->gtsm_hops > 0) | |
856ca177 MS |
12585 | { |
12586 | if (use_json) | |
12587 | json_object_int_add(json_neigh, "internalBgpNbrMaxHopsAway", p->gtsm_hops); | |
12588 | else | |
12589 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
12590 | p->gtsm_hops, VTY_NEWLINE); | |
12591 | } | |
5d804b43 | 12592 | } |
718e3744 | 12593 | |
12594 | /* Local address. */ | |
12595 | if (p->su_local) | |
12596 | { | |
856ca177 MS |
12597 | if (use_json) |
12598 | { | |
12599 | json_object_string_add(json_neigh, "hostLocal", sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN)); | |
12600 | json_object_int_add(json_neigh, "portLocal", ntohs (p->su_local->sin.sin_port)); | |
12601 | } | |
12602 | else | |
12603 | vty_out (vty, "Local host: %s, Local port: %d%s", | |
12604 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), | |
12605 | ntohs (p->su_local->sin.sin_port), | |
12606 | VTY_NEWLINE); | |
718e3744 | 12607 | } |
12608 | ||
12609 | /* Remote address. */ | |
12610 | if (p->su_remote) | |
12611 | { | |
856ca177 MS |
12612 | if (use_json) |
12613 | { | |
12614 | json_object_string_add(json_neigh, "hostForeign", sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN)); | |
12615 | json_object_int_add(json_neigh, "portForeign", ntohs (p->su_remote->sin.sin_port)); | |
12616 | } | |
12617 | else | |
12618 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
718e3744 | 12619 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
12620 | ntohs (p->su_remote->sin.sin_port), | |
12621 | VTY_NEWLINE); | |
12622 | } | |
12623 | ||
12624 | /* Nexthop display. */ | |
12625 | if (p->su_local) | |
12626 | { | |
856ca177 MS |
12627 | if (use_json) |
12628 | { | |
12629 | json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ)); | |
718e3744 | 12630 | #ifdef HAVE_IPV6 |
856ca177 MS |
12631 | json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ)); |
12632 | json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ)); | |
12633 | if (p->shared_network) | |
12634 | json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork"); | |
12635 | else | |
12636 | json_object_string_add(json_neigh, "bgpConnection", "nonSharedNetwork"); | |
12637 | #endif /* HAVE_IPV6 */ | |
12638 | } | |
12639 | else | |
12640 | { | |
12641 | vty_out (vty, "Nexthop: %s%s", | |
12642 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
12643 | VTY_NEWLINE); | |
12644 | #ifdef HAVE_IPV6 | |
12645 | vty_out (vty, "Nexthop global: %s%s", | |
12646 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
12647 | VTY_NEWLINE); | |
12648 | vty_out (vty, "Nexthop local: %s%s", | |
12649 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
12650 | VTY_NEWLINE); | |
12651 | vty_out (vty, "BGP connection: %s%s", | |
12652 | p->shared_network ? "shared network" : "non shared network", | |
12653 | VTY_NEWLINE); | |
718e3744 | 12654 | #endif /* HAVE_IPV6 */ |
856ca177 | 12655 | } |
718e3744 | 12656 | } |
12657 | ||
12658 | /* Timer information. */ | |
856ca177 MS |
12659 | if (use_json) |
12660 | { | |
39e871e6 | 12661 | json_object_int_add(json_neigh, "connectRetryTimer", p->v_connect); |
dd9275d6 ST |
12662 | if (p->status == Established && p->rtt) |
12663 | json_object_int_add(json_neigh, "estimatedRttInMsecs", p->rtt); | |
856ca177 MS |
12664 | if (p->t_start) |
12665 | json_object_int_add(json_neigh, "nextStartTimerDueInMsecs", thread_timer_remain_second (p->t_start) * 1000); | |
12666 | if (p->t_connect) | |
12667 | json_object_int_add(json_neigh, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p->t_connect) * 1000); | |
12668 | if (p->t_routeadv) | |
12669 | { | |
12670 | json_object_int_add(json_neigh, "mraiInterval", p->v_routeadv); | |
12671 | json_object_int_add(json_neigh, "mraiTimerExpireInMsecs", thread_timer_remain_second (p->t_routeadv) * 1000); | |
12672 | } | |
cb1faec9 | 12673 | |
856ca177 MS |
12674 | if (p->t_read) |
12675 | json_object_string_add(json_neigh, "readThread", "on"); | |
12676 | else | |
12677 | json_object_string_add(json_neigh, "readThread", "off"); | |
12678 | if (p->t_write) | |
12679 | json_object_string_add(json_neigh, "writeThread", "on"); | |
12680 | else | |
12681 | json_object_string_add(json_neigh, "writeThread", "off"); | |
12682 | } | |
12683 | else | |
12684 | { | |
39e871e6 ST |
12685 | vty_out (vty, "BGP Connect Retry Timer in Seconds: %d%s", |
12686 | p->v_connect, VTY_NEWLINE); | |
dd9275d6 ST |
12687 | if (p->status == Established && p->rtt) |
12688 | vty_out (vty, "Estimated round trip time: %d ms%s", | |
12689 | p->rtt, VTY_NEWLINE); | |
856ca177 MS |
12690 | if (p->t_start) |
12691 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
12692 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
12693 | if (p->t_connect) | |
12694 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
12695 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
12696 | if (p->t_routeadv) | |
12697 | vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s", | |
12698 | p->v_routeadv, thread_timer_remain_second (p->t_routeadv), | |
12699 | VTY_NEWLINE); | |
12700 | ||
12701 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
12702 | p->t_read ? "on" : "off", | |
12703 | p->t_write ? "on" : "off", | |
12704 | VTY_NEWLINE); | |
12705 | } | |
718e3744 | 12706 | |
12707 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
12708 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
856ca177 MS |
12709 | bgp_capability_vty_out (vty, p, use_json, json_neigh); |
12710 | ||
12711 | if (!use_json) | |
12712 | vty_out (vty, "%s", VTY_NEWLINE); | |
c43ed2e4 DS |
12713 | |
12714 | /* BFD information. */ | |
856ca177 MS |
12715 | bgp_bfd_show_info(vty, p, use_json, json_neigh); |
12716 | ||
12717 | if (use_json) | |
12718 | { | |
12719 | if (p->conf_if) /* Configured interface name. */ | |
12720 | json_object_object_add(json, p->conf_if, json_neigh); | |
12721 | else /* Configured IP address. */ | |
12722 | json_object_object_add(json, p->host, json_neigh); | |
12723 | } | |
718e3744 | 12724 | } |
12725 | ||
94f2b392 | 12726 | static int |
856ca177 MS |
12727 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type, |
12728 | union sockunion *su, const char *conf_if, u_char use_json, json_object *json) | |
718e3744 | 12729 | { |
1eb8ef25 | 12730 | struct listnode *node, *nnode; |
718e3744 | 12731 | struct peer *peer; |
12732 | int find = 0; | |
12733 | ||
1eb8ef25 | 12734 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 12735 | { |
1ff9a340 DS |
12736 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
12737 | continue; | |
12738 | ||
718e3744 | 12739 | switch (type) |
856ca177 MS |
12740 | { |
12741 | case show_all: | |
e8f7da3a | 12742 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12743 | break; |
12744 | case show_peer: | |
12745 | if (conf_if) | |
12746 | { | |
4873b3b9 DW |
12747 | if ((peer->conf_if && !strcmp(peer->conf_if, conf_if)) || |
12748 | (peer->hostname && !strcmp(peer->hostname, conf_if))) | |
856ca177 MS |
12749 | { |
12750 | find = 1; | |
e8f7da3a | 12751 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12752 | } |
12753 | } | |
12754 | else | |
12755 | { | |
12756 | if (sockunion_same (&peer->su, su)) | |
12757 | { | |
12758 | find = 1; | |
e8f7da3a | 12759 | bgp_show_peer (vty, peer, use_json, json); |
856ca177 MS |
12760 | } |
12761 | } | |
12762 | break; | |
718e3744 | 12763 | } |
12764 | } | |
12765 | ||
12766 | if (type == show_peer && ! find) | |
856ca177 MS |
12767 | { |
12768 | if (use_json) | |
12769 | json_object_boolean_true_add(json, "bgpNoSuchNeighbor"); | |
12770 | else | |
12771 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
12772 | } | |
12773 | ||
12774 | if (use_json) | |
12775 | { | |
12776 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
12777 | json_object_free(json); | |
12778 | } | |
12779 | else | |
12780 | { | |
12781 | vty_out (vty, "%s", VTY_NEWLINE); | |
12782 | } | |
12783 | ||
718e3744 | 12784 | return CMD_SUCCESS; |
12785 | } | |
12786 | ||
94f2b392 | 12787 | static int |
fd79ac91 | 12788 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
9f689658 DD |
12789 | enum show_type type, const char *ip_str, u_char use_json, |
12790 | json_object *json) | |
718e3744 | 12791 | { |
12792 | int ret; | |
12793 | struct bgp *bgp; | |
12794 | union sockunion su; | |
856ca177 | 12795 | |
9f689658 | 12796 | if (use_json && (json == NULL)) |
856ca177 | 12797 | json = json_object_new_object(); |
718e3744 | 12798 | |
718e3744 | 12799 | if (name) |
12800 | { | |
12801 | bgp = bgp_lookup_by_name (name); | |
718e3744 | 12802 | if (! bgp) |
12803 | { | |
856ca177 MS |
12804 | if (use_json) |
12805 | { | |
12806 | json_object_boolean_true_add(json, "bgpNoSuchInstance"); | |
12807 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
12808 | json_object_free(json); | |
12809 | } | |
12810 | else | |
12811 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
12812 | ||
718e3744 | 12813 | return CMD_WARNING; |
12814 | } | |
718e3744 | 12815 | } |
a80beece DS |
12816 | else |
12817 | { | |
12818 | bgp = bgp_get_default (); | |
12819 | } | |
718e3744 | 12820 | |
12821 | if (bgp) | |
a80beece DS |
12822 | { |
12823 | if (ip_str) | |
12824 | { | |
12825 | ret = str2sockunion (ip_str, &su); | |
12826 | if (ret < 0) | |
856ca177 | 12827 | bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json); |
a80beece | 12828 | else |
856ca177 | 12829 | bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json); |
a80beece DS |
12830 | } |
12831 | else | |
12832 | { | |
856ca177 | 12833 | bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json); |
a80beece DS |
12834 | } |
12835 | } | |
718e3744 | 12836 | |
12837 | return CMD_SUCCESS; | |
12838 | } | |
12839 | ||
f186de26 | 12840 | static void |
12841 | bgp_show_all_instances_neighbors_vty (struct vty *vty, u_char use_json) | |
12842 | { | |
12843 | struct listnode *node, *nnode; | |
12844 | struct bgp *bgp; | |
12845 | json_object *json = NULL; | |
9f689658 DD |
12846 | int is_first = 1; |
12847 | ||
12848 | if (use_json) | |
12849 | vty_out (vty, "{%s", VTY_NEWLINE); | |
f186de26 | 12850 | |
12851 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
12852 | { | |
f186de26 | 12853 | if (use_json) |
9f689658 DD |
12854 | { |
12855 | if (!(json = json_object_new_object())) | |
12856 | { | |
12857 | zlog_err("Unable to allocate memory for JSON object"); | |
12858 | vty_out (vty, | |
12859 | "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s", | |
12860 | VTY_NEWLINE); | |
12861 | return; | |
12862 | } | |
12863 | ||
12864 | json_object_int_add(json, "vrfId", | |
12865 | (bgp->vrf_id == VRF_UNKNOWN) | |
12866 | ? -1 : bgp->vrf_id); | |
12867 | json_object_string_add(json, "vrfName", | |
12868 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12869 | ? "Default" : bgp->name); | |
12870 | ||
12871 | if (! is_first) | |
12872 | vty_out (vty, ",%s", VTY_NEWLINE); | |
12873 | else | |
12874 | is_first = 0; | |
12875 | ||
12876 | vty_out(vty, "\"%s\":", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12877 | ? "Default" : bgp->name); | |
12878 | } | |
12879 | else | |
12880 | { | |
12881 | vty_out (vty, "%sInstance %s:%s", | |
12882 | VTY_NEWLINE, | |
12883 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) | |
12884 | ? "Default" : bgp->name, | |
12885 | VTY_NEWLINE); | |
12886 | } | |
f186de26 | 12887 | bgp_show_neighbor (vty, bgp, show_all, NULL, NULL, use_json, json); |
12888 | } | |
9f689658 DD |
12889 | |
12890 | if (use_json) | |
12891 | vty_out (vty, "}%s", VTY_NEWLINE); | |
f186de26 | 12892 | } |
12893 | ||
718e3744 | 12894 | /* "show ip bgp neighbors" commands. */ |
f412b39a DW |
12895 | /* |
12896 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
b162fa78 | 12897 | * "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors [json]", |
f412b39a DW |
12898 | * SHOW_STR |
12899 | * IP_STR | |
12900 | * BGP_STR | |
12901 | * "Display VPNv4 NLRI specific information\n" | |
12902 | * "Display information for a route distinguisher\n" | |
12903 | * "VPN Route Distinguisher\n" | |
12904 | * "Detailed information on TCP and BGP neighbor connections\n" | |
12905 | * "JavaScript Object Notation\n" | |
12906 | * | |
b162fa78 | 12907 | * "show bgp neighbors [json]", |
f412b39a DW |
12908 | * SHOW_STR |
12909 | * BGP_STR | |
12910 | * "Detailed information on TCP and BGP neighbor connections\n" | |
12911 | * "JavaScript Object Notation\n" | |
12912 | * | |
b162fa78 | 12913 | * "show ip bgp vpnv4 all neighbors [json]", |
f412b39a DW |
12914 | * SHOW_STR |
12915 | * IP_STR | |
12916 | * BGP_STR | |
12917 | * "Display VPNv4 NLRI specific information\n" | |
12918 | * "Display information about all VPNv4 NLRIs\n" | |
12919 | * "Detailed information on TCP and BGP neighbor connections\n" | |
12920 | * "JavaScript Object Notation\n" | |
12921 | * | |
b162fa78 | 12922 | * "show ip bgp ipv4 (unicast|multicast) neighbors [json]", |
f412b39a DW |
12923 | * SHOW_STR |
12924 | * IP_STR | |
12925 | * BGP_STR | |
12926 | * "Address family\n" | |
12927 | * "Address Family modifier\n" | |
12928 | * "Address Family modifier\n" | |
12929 | * "Detailed information on TCP and BGP neighbor connections\n" | |
12930 | * "JavaScript Object Notation\n" | |
12931 | * | |
b162fa78 | 12932 | * "show bgp ipv6 neighbors [json]", |
f412b39a DW |
12933 | * SHOW_STR |
12934 | * BGP_STR | |
12935 | * "Address family\n" | |
12936 | * "Detailed information on TCP and BGP neighbor connections\n" | |
12937 | * "JavaScript Object Notation\n" | |
12938 | * | |
12939 | */ | |
718e3744 | 12940 | DEFUN (show_ip_bgp_neighbors, |
12941 | show_ip_bgp_neighbors_cmd, | |
b162fa78 | 12942 | "show ip bgp neighbors [json]", |
718e3744 | 12943 | SHOW_STR |
12944 | IP_STR | |
12945 | BGP_STR | |
856ca177 MS |
12946 | "Detailed information on TCP and BGP neighbor connections\n" |
12947 | "JavaScript Object Notation\n") | |
718e3744 | 12948 | { |
db7c8528 | 12949 | u_char uj = use_json(argc, argv); |
856ca177 | 12950 | |
9f689658 | 12951 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, uj, NULL); |
718e3744 | 12952 | } |
12953 | ||
718e3744 | 12954 | |
718e3744 | 12955 | |
718e3744 | 12956 | |
718e3744 | 12957 | |
718e3744 | 12958 | |
f412b39a DW |
12959 | /* |
12960 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
b162fa78 | 12961 | * "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) [json]", |
f412b39a DW |
12962 | * SHOW_STR |
12963 | * IP_STR | |
12964 | * BGP_STR | |
12965 | * "Address family\n" | |
12966 | * "Address Family modifier\n" | |
12967 | * "Address Family modifier\n" | |
12968 | * "Detailed information on TCP and BGP neighbor connections\n" | |
12969 | * "Neighbor to display information about\n" | |
12970 | * "Neighbor to display information about\n" | |
12971 | * "Neighbor on bgp configured interface\n" | |
12972 | * "JavaScript Object Notation\n" | |
12973 | * | |
b162fa78 | 12974 | * "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D [json]", |
f412b39a DW |
12975 | * SHOW_STR |
12976 | * IP_STR | |
12977 | * BGP_STR | |
12978 | * "Display VPNv4 NLRI specific information\n" | |
12979 | * "Display information about all VPNv4 NLRIs\n" | |
12980 | * "Detailed information on TCP and BGP neighbor connections\n" | |
12981 | * "Neighbor to display information about\n" | |
12982 | * "JavaScript Object Notation\n" | |
12983 | * | |
b162fa78 | 12984 | * "show ip bgp vpnv4 all neighbors A.B.C.D [json]", |
f412b39a DW |
12985 | * SHOW_STR |
12986 | * IP_STR | |
12987 | * BGP_STR | |
12988 | * "Display VPNv4 NLRI specific information\n" | |
12989 | * "Display information about all VPNv4 NLRIs\n" | |
12990 | * "Detailed information on TCP and BGP neighbor connections\n" | |
12991 | * "Neighbor to display information about\n" | |
12992 | * "JavaScript Object Notation\n" | |
12993 | * | |
b162fa78 | 12994 | * "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) [json]", |
f412b39a DW |
12995 | * SHOW_STR |
12996 | * BGP_STR | |
12997 | * "Address family\n" | |
12998 | * "Detailed information on TCP and BGP neighbor connections\n" | |
12999 | * "Neighbor to display information about\n" | |
13000 | * "Neighbor to display information about\n" | |
13001 | * "Neighbor on bgp configured interface\n" | |
13002 | * "JavaScript Object Notation\n" | |
13003 | * | |
b162fa78 | 13004 | * "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) [json]", |
f412b39a DW |
13005 | * SHOW_STR |
13006 | * BGP_STR | |
13007 | * "Detailed information on TCP and BGP neighbor connections\n" | |
13008 | * "Neighbor to display information about\n" | |
13009 | * "Neighbor to display information about\n" | |
13010 | * "Neighbor on bgp configured interface\n" | |
13011 | * "JavaScript Object Notation\n" | |
13012 | * | |
13013 | */ | |
718e3744 | 13014 | DEFUN (show_ip_bgp_neighbors_peer, |
13015 | show_ip_bgp_neighbors_peer_cmd, | |
b162fa78 | 13016 | "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) [json]", |
718e3744 | 13017 | SHOW_STR |
13018 | IP_STR | |
13019 | BGP_STR | |
13020 | "Detailed information on TCP and BGP neighbor connections\n" | |
13021 | "Neighbor to display information about\n" | |
a80beece | 13022 | "Neighbor to display information about\n" |
856ca177 MS |
13023 | "Neighbor on bgp configured interface\n" |
13024 | "JavaScript Object Notation\n") | |
718e3744 | 13025 | { |
db7c8528 | 13026 | u_char uj = use_json(argc, argv); |
856ca177 | 13027 | |
9f689658 | 13028 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], uj, NULL); |
718e3744 | 13029 | } |
13030 | ||
718e3744 | 13031 | |
718e3744 | 13032 | |
718e3744 | 13033 | |
718e3744 | 13034 | |
718e3744 | 13035 | |
f412b39a DW |
13036 | /* |
13037 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
b162fa78 | 13038 | * "show bgp " BGP_INSTANCE_CMD " neighbors [json]", |
f412b39a DW |
13039 | * SHOW_STR |
13040 | * BGP_STR | |
13041 | * BGP_INSTANCE_HELP_STR | |
13042 | * "Detailed information on TCP and BGP neighbor connections\n" | |
13043 | * "JavaScript Object Notation\n" | |
13044 | * | |
b162fa78 | 13045 | * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors [json]", |
f412b39a DW |
13046 | * SHOW_STR |
13047 | * BGP_STR | |
13048 | * BGP_INSTANCE_HELP_STR | |
13049 | * "Address family\n" | |
13050 | * "Detailed information on TCP and BGP neighbor connections\n" | |
13051 | * "JavaScript Object Notation\n" | |
13052 | * | |
13053 | */ | |
718e3744 | 13054 | DEFUN (show_ip_bgp_instance_neighbors, |
13055 | show_ip_bgp_instance_neighbors_cmd, | |
b162fa78 | 13056 | "show ip bgp " BGP_INSTANCE_CMD " neighbors [json]", |
718e3744 | 13057 | SHOW_STR |
13058 | IP_STR | |
13059 | BGP_STR | |
8386ac43 | 13060 | BGP_INSTANCE_HELP_STR |
856ca177 MS |
13061 | "Detailed information on TCP and BGP neighbor connections\n" |
13062 | "JavaScript Object Notation\n") | |
718e3744 | 13063 | { |
db7c8528 | 13064 | u_char uj = use_json(argc, argv); |
856ca177 | 13065 | |
afec25d9 | 13066 | return bgp_show_neighbor_vty (vty, argv[4]->arg, show_all, NULL, uj, NULL); |
718e3744 | 13067 | } |
13068 | ||
f186de26 | 13069 | DEFUN (show_ip_bgp_instance_all_neighbors, |
13070 | show_ip_bgp_instance_all_neighbors_cmd, | |
b162fa78 | 13071 | "show ip bgp " BGP_INSTANCE_ALL_CMD " neighbors [json]", |
f186de26 | 13072 | SHOW_STR |
13073 | IP_STR | |
13074 | BGP_STR | |
13075 | BGP_INSTANCE_ALL_HELP_STR | |
13076 | "Detailed information on TCP and BGP neighbor connections\n" | |
13077 | "JavaScript Object Notation\n") | |
13078 | { | |
13079 | u_char uj = use_json(argc, argv); | |
13080 | ||
13081 | bgp_show_all_instances_neighbors_vty (vty, uj); | |
13082 | return CMD_SUCCESS; | |
13083 | } | |
13084 | ||
bb46e94f | 13085 | |
bb46e94f | 13086 | |
f412b39a DW |
13087 | /* |
13088 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
b162fa78 | 13089 | * "show bgp " BGP_INSTANCE_CMD " ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) [json]", |
f412b39a DW |
13090 | * SHOW_STR |
13091 | * BGP_STR | |
13092 | * BGP_INSTANCE_HELP_STR | |
13093 | * "Address family\n" | |
13094 | * "Detailed information on TCP and BGP neighbor connections\n" | |
13095 | * "Neighbor to display information about\n" | |
13096 | * "Neighbor to display information about\n" | |
13097 | * "Neighbor on bgp configured interface\n" | |
13098 | * "JavaScript Object Notation\n" | |
13099 | * | |
b162fa78 | 13100 | * "show bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) [json]", |
f412b39a DW |
13101 | * SHOW_STR |
13102 | * BGP_STR | |
13103 | * BGP_INSTANCE_HELP_STR | |
13104 | * "Detailed information on TCP and BGP neighbor connections\n" | |
13105 | * "Neighbor to display information about\n" | |
13106 | * "Neighbor to display information about\n" | |
13107 | * "Neighbor on bgp configured interface\n" | |
13108 | * "JavaScript Object Notation\n" | |
13109 | * | |
13110 | */ | |
718e3744 | 13111 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
13112 | show_ip_bgp_instance_neighbors_peer_cmd, | |
b162fa78 | 13113 | "show ip bgp " BGP_INSTANCE_CMD " neighbors (A.B.C.D|X:X::X:X|WORD) [json]", |
718e3744 | 13114 | SHOW_STR |
13115 | IP_STR | |
13116 | BGP_STR | |
8386ac43 | 13117 | BGP_INSTANCE_HELP_STR |
718e3744 | 13118 | "Detailed information on TCP and BGP neighbor connections\n" |
13119 | "Neighbor to display information about\n" | |
a80beece | 13120 | "Neighbor to display information about\n" |
856ca177 MS |
13121 | "Neighbor on bgp configured interface\n" |
13122 | "JavaScript Object Notation\n") | |
718e3744 | 13123 | { |
db7c8528 | 13124 | u_char uj = use_json(argc, argv); |
856ca177 | 13125 | |
afec25d9 | 13126 | return bgp_show_neighbor_vty (vty, argv[4]->arg, show_peer, argv[6]->arg, uj, NULL); |
718e3744 | 13127 | } |
bb46e94f | 13128 | |
bb46e94f | 13129 | |
6b0655a2 | 13130 | |
718e3744 | 13131 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
13132 | paths' and `show ip mbgp paths'. Those functions results are the | |
13133 | same.*/ | |
f412b39a | 13134 | DEFUN (show_ip_bgp_paths, |
718e3744 | 13135 | show_ip_bgp_paths_cmd, |
13136 | "show ip bgp paths", | |
13137 | SHOW_STR | |
13138 | IP_STR | |
13139 | BGP_STR | |
13140 | "Path information\n") | |
13141 | { | |
13142 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
13143 | aspath_print_all_vty (vty); | |
13144 | return CMD_SUCCESS; | |
13145 | } | |
13146 | ||
f412b39a | 13147 | DEFUN (show_ip_bgp_ipv4_paths, |
718e3744 | 13148 | show_ip_bgp_ipv4_paths_cmd, |
13149 | "show ip bgp ipv4 (unicast|multicast) paths", | |
13150 | SHOW_STR | |
13151 | IP_STR | |
13152 | BGP_STR | |
13153 | "Address family\n" | |
13154 | "Address Family modifier\n" | |
13155 | "Address Family modifier\n" | |
13156 | "Path information\n") | |
13157 | { | |
13158 | vty_out (vty, "Address Refcnt Path\r\n"); | |
13159 | aspath_print_all_vty (vty); | |
13160 | ||
13161 | return CMD_SUCCESS; | |
13162 | } | |
6b0655a2 | 13163 | |
718e3744 | 13164 | #include "hash.h" |
13165 | ||
94f2b392 | 13166 | static void |
718e3744 | 13167 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
13168 | { | |
13169 | struct community *com; | |
13170 | ||
13171 | com = (struct community *) backet->data; | |
6c4f4e6e | 13172 | vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt, |
718e3744 | 13173 | community_str (com), VTY_NEWLINE); |
13174 | } | |
13175 | ||
13176 | /* Show BGP's community internal data. */ | |
f412b39a | 13177 | DEFUN (show_ip_bgp_community_info, |
718e3744 | 13178 | show_ip_bgp_community_info_cmd, |
13179 | "show ip bgp community-info", | |
13180 | SHOW_STR | |
13181 | IP_STR | |
13182 | BGP_STR | |
13183 | "List all bgp community information\n") | |
13184 | { | |
13185 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
13186 | ||
13187 | hash_iterate (community_hash (), | |
13188 | (void (*) (struct hash_backet *, void *)) | |
13189 | community_show_all_iterator, | |
13190 | vty); | |
13191 | ||
13192 | return CMD_SUCCESS; | |
13193 | } | |
13194 | ||
f412b39a | 13195 | DEFUN (show_ip_bgp_attr_info, |
718e3744 | 13196 | show_ip_bgp_attr_info_cmd, |
13197 | "show ip bgp attribute-info", | |
13198 | SHOW_STR | |
13199 | IP_STR | |
13200 | BGP_STR | |
13201 | "List all bgp attribute information\n") | |
13202 | { | |
13203 | attr_show_all (vty); | |
13204 | return CMD_SUCCESS; | |
13205 | } | |
6b0655a2 | 13206 | |
8386ac43 | 13207 | static int bgp_show_update_groups(struct vty *vty, const char *name, |
13208 | int afi, int safi, | |
f43e655e | 13209 | uint64_t subgrp_id) |
3f9c7369 DS |
13210 | { |
13211 | struct bgp *bgp; | |
13212 | ||
8386ac43 | 13213 | if (name) |
13214 | bgp = bgp_lookup_by_name (name); | |
13215 | else | |
13216 | bgp = bgp_get_default (); | |
13217 | ||
3f9c7369 | 13218 | if (bgp) |
8fe8a7f6 | 13219 | update_group_show(bgp, afi, safi, vty, subgrp_id); |
3f9c7369 DS |
13220 | return CMD_SUCCESS; |
13221 | } | |
13222 | ||
f186de26 | 13223 | static void |
13224 | bgp_show_all_instances_updgrps_vty (struct vty *vty, afi_t afi, safi_t safi) | |
13225 | { | |
13226 | struct listnode *node, *nnode; | |
13227 | struct bgp *bgp; | |
13228 | ||
13229 | for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) | |
13230 | { | |
13231 | vty_out (vty, "%sInstance %s:%s", | |
13232 | VTY_NEWLINE, | |
13233 | (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) ? "Default" : bgp->name, | |
13234 | VTY_NEWLINE); | |
13235 | update_group_show(bgp, afi, safi, vty, 0); | |
13236 | } | |
13237 | } | |
13238 | ||
8fe8a7f6 DS |
13239 | DEFUN (show_ip_bgp_updgrps, |
13240 | show_ip_bgp_updgrps_cmd, | |
13241 | "show ip bgp update-groups", | |
13242 | SHOW_STR | |
13243 | IP_STR | |
13244 | BGP_STR | |
13245 | "Detailed info about dynamic update groups\n") | |
13246 | { | |
8386ac43 | 13247 | return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, 0)); |
13248 | } | |
13249 | ||
13250 | DEFUN (show_ip_bgp_instance_updgrps, | |
13251 | show_ip_bgp_instance_updgrps_cmd, | |
13252 | "show ip bgp " BGP_INSTANCE_CMD " update-groups", | |
13253 | SHOW_STR | |
13254 | IP_STR | |
13255 | BGP_STR | |
13256 | BGP_INSTANCE_HELP_STR | |
13257 | "Detailed info about dynamic update groups\n") | |
13258 | { | |
afec25d9 | 13259 | return (bgp_show_update_groups(vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, 0)); |
8fe8a7f6 DS |
13260 | } |
13261 | ||
f186de26 | 13262 | DEFUN (show_ip_bgp_instance_all_updgrps, |
13263 | show_ip_bgp_instance_all_updgrps_cmd, | |
13264 | "show ip bgp " BGP_INSTANCE_ALL_CMD " update-groups", | |
13265 | SHOW_STR | |
13266 | IP_STR | |
13267 | BGP_STR | |
13268 | BGP_INSTANCE_ALL_HELP_STR | |
13269 | "Detailed info about dynamic update groups\n") | |
13270 | { | |
13271 | bgp_show_all_instances_updgrps_vty (vty, AFI_IP, SAFI_UNICAST); | |
13272 | return CMD_SUCCESS; | |
13273 | } | |
13274 | ||
3f9c7369 DS |
13275 | DEFUN (show_bgp_ipv6_updgrps, |
13276 | show_bgp_ipv6_updgrps_cmd, | |
8fe8a7f6 | 13277 | "show bgp update-groups", |
3f9c7369 DS |
13278 | SHOW_STR |
13279 | BGP_STR | |
8fe8a7f6 | 13280 | "Detailed info about v6 dynamic update groups\n") |
3f9c7369 | 13281 | { |
8386ac43 | 13282 | return (bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, 0)); |
13283 | } | |
13284 | ||
13285 | DEFUN (show_bgp_instance_ipv6_updgrps, | |
13286 | show_bgp_instance_ipv6_updgrps_cmd, | |
13287 | "show bgp " BGP_INSTANCE_CMD " update-groups", | |
13288 | SHOW_STR | |
13289 | BGP_STR | |
13290 | BGP_INSTANCE_HELP_STR | |
13291 | "Detailed info about v6 dynamic update groups\n") | |
13292 | { | |
afec25d9 | 13293 | return (bgp_show_update_groups(vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, 0)); |
3f9c7369 DS |
13294 | } |
13295 | ||
f186de26 | 13296 | DEFUN (show_bgp_instance_all_ipv6_updgrps, |
13297 | show_bgp_instance_all_ipv6_updgrps_cmd, | |
13298 | "show bgp " BGP_INSTANCE_ALL_CMD " update-groups", | |
13299 | SHOW_STR | |
13300 | BGP_STR | |
13301 | BGP_INSTANCE_ALL_HELP_STR | |
13302 | "Detailed info about v6 dynamic update groups\n") | |
13303 | { | |
13304 | bgp_show_all_instances_updgrps_vty (vty, AFI_IP6, SAFI_UNICAST); | |
13305 | return CMD_SUCCESS; | |
13306 | } | |
13307 | ||
3f9c7369 DS |
13308 | DEFUN (show_bgp_updgrps, |
13309 | show_bgp_updgrps_cmd, | |
8fe8a7f6 | 13310 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups", |
3f9c7369 DS |
13311 | SHOW_STR |
13312 | BGP_STR | |
13313 | "Address family\n" | |
13314 | "Address family\n" | |
13315 | "Address Family modifier\n" | |
13316 | "Address Family modifier\n" | |
8fe8a7f6 | 13317 | "Detailed info about dynamic update groups\n") |
3f9c7369 | 13318 | { |
3f9c7369 DS |
13319 | afi_t afi; |
13320 | safi_t safi; | |
13321 | ||
afec25d9 DW |
13322 | afi = (strcmp(argv[2]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; |
13323 | safi = (strncmp (argv[3]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8386ac43 | 13324 | return (bgp_show_update_groups(vty, NULL, afi, safi, 0)); |
8fe8a7f6 DS |
13325 | } |
13326 | ||
13327 | DEFUN (show_ip_bgp_updgrps_s, | |
13328 | show_ip_bgp_updgrps_s_cmd, | |
13329 | "show ip bgp update-groups SUBGROUP-ID", | |
13330 | SHOW_STR | |
13331 | IP_STR | |
13332 | BGP_STR | |
13333 | "Detailed info about dynamic update groups\n" | |
13334 | "Specific subgroup to display detailed info for\n") | |
13335 | { | |
f43e655e | 13336 | uint64_t subgrp_id; |
8fe8a7f6 DS |
13337 | |
13338 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
8386ac43 | 13339 | return (bgp_show_update_groups(vty, NULL, AFI_IP, SAFI_UNICAST, subgrp_id)); |
13340 | } | |
13341 | ||
13342 | DEFUN (show_ip_bgp_instance_updgrps_s, | |
13343 | show_ip_bgp_instance_updgrps_s_cmd, | |
13344 | "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID", | |
13345 | SHOW_STR | |
13346 | IP_STR | |
13347 | BGP_STR | |
13348 | BGP_INSTANCE_HELP_STR | |
13349 | "Detailed info about dynamic update groups\n" | |
13350 | "Specific subgroup to display detailed info for\n") | |
13351 | { | |
f43e655e | 13352 | uint64_t subgrp_id; |
8386ac43 | 13353 | |
13354 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
afec25d9 | 13355 | return (bgp_show_update_groups(vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, subgrp_id)); |
8fe8a7f6 DS |
13356 | } |
13357 | ||
13358 | DEFUN (show_bgp_ipv6_updgrps_s, | |
13359 | show_bgp_ipv6_updgrps_s_cmd, | |
13360 | "show bgp update-groups SUBGROUP-ID", | |
13361 | SHOW_STR | |
13362 | BGP_STR | |
13363 | "Detailed info about v6 dynamic update groups\n" | |
13364 | "Specific subgroup to display detailed info for\n") | |
13365 | { | |
f43e655e | 13366 | uint64_t subgrp_id; |
8fe8a7f6 DS |
13367 | |
13368 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
8386ac43 | 13369 | return(bgp_show_update_groups(vty, NULL, AFI_IP6, SAFI_UNICAST, subgrp_id)); |
13370 | } | |
13371 | ||
13372 | DEFUN (show_bgp_instance_ipv6_updgrps_s, | |
13373 | show_bgp_instance_ipv6_updgrps_s_cmd, | |
13374 | "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID", | |
13375 | SHOW_STR | |
13376 | BGP_STR | |
13377 | "Detailed info about v6 dynamic update groups\n" | |
13378 | "Specific subgroup to display detailed info for\n") | |
13379 | { | |
f43e655e | 13380 | uint64_t subgrp_id; |
8386ac43 | 13381 | |
13382 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
afec25d9 | 13383 | return(bgp_show_update_groups(vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, subgrp_id)); |
8fe8a7f6 DS |
13384 | } |
13385 | ||
13386 | DEFUN (show_bgp_updgrps_s, | |
13387 | show_bgp_updgrps_s_cmd, | |
13388 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID", | |
13389 | SHOW_STR | |
13390 | BGP_STR | |
13391 | "Address family\n" | |
13392 | "Address family\n" | |
13393 | "Address Family modifier\n" | |
13394 | "Address Family modifier\n" | |
13395 | "Detailed info about v6 dynamic update groups\n" | |
13396 | "Specific subgroup to display detailed info for") | |
13397 | { | |
13398 | afi_t afi; | |
13399 | safi_t safi; | |
f43e655e | 13400 | uint64_t subgrp_id; |
8fe8a7f6 | 13401 | |
afec25d9 DW |
13402 | afi = (strcmp(argv[2]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; |
13403 | safi = (strncmp (argv[3]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8fe8a7f6 DS |
13404 | |
13405 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
8386ac43 | 13406 | return(bgp_show_update_groups(vty, NULL, afi, safi, subgrp_id)); |
3f9c7369 DS |
13407 | } |
13408 | ||
13409 | DEFUN (show_bgp_updgrps_stats, | |
13410 | show_bgp_updgrps_stats_cmd, | |
13411 | "show bgp update-groups statistics", | |
13412 | SHOW_STR | |
13413 | BGP_STR | |
13414 | "BGP update groups\n" | |
13415 | "Statistics\n") | |
13416 | { | |
13417 | struct bgp *bgp; | |
13418 | ||
13419 | bgp = bgp_get_default(); | |
13420 | if (bgp) | |
13421 | update_group_show_stats(bgp, vty); | |
13422 | ||
13423 | return CMD_SUCCESS; | |
13424 | } | |
13425 | ||
8386ac43 | 13426 | DEFUN (show_bgp_instance_updgrps_stats, |
13427 | show_bgp_instance_updgrps_stats_cmd, | |
13428 | "show bgp " BGP_INSTANCE_CMD " update-groups statistics", | |
13429 | SHOW_STR | |
13430 | BGP_STR | |
13431 | BGP_INSTANCE_HELP_STR | |
13432 | "BGP update groups\n" | |
13433 | "Statistics\n") | |
13434 | { | |
13435 | struct bgp *bgp; | |
13436 | ||
afec25d9 | 13437 | bgp = bgp_lookup_by_name (argv[3]->arg); |
8386ac43 | 13438 | if (bgp) |
13439 | update_group_show_stats(bgp, vty); | |
13440 | ||
13441 | return CMD_SUCCESS; | |
13442 | } | |
13443 | ||
3f9c7369 | 13444 | static void |
8386ac43 | 13445 | show_bgp_updgrps_adj_info_aux (struct vty *vty, const char *name, |
13446 | afi_t afi, safi_t safi, | |
f43e655e | 13447 | const char *what, uint64_t subgrp_id) |
3f9c7369 DS |
13448 | { |
13449 | struct bgp *bgp; | |
8386ac43 | 13450 | |
13451 | if (name) | |
13452 | bgp = bgp_lookup_by_name (name); | |
13453 | else | |
13454 | bgp = bgp_get_default (); | |
13455 | ||
3f9c7369 DS |
13456 | if (bgp) |
13457 | { | |
13458 | if (!strcmp(what, "advertise-queue")) | |
13459 | update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id); | |
13460 | else if (!strcmp(what, "advertised-routes")) | |
13461 | update_group_show_advertised(bgp, afi, safi, vty, subgrp_id); | |
13462 | else if (!strcmp(what, "packet-queue")) | |
13463 | update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id); | |
13464 | } | |
13465 | } | |
13466 | ||
13467 | DEFUN (show_ip_bgp_updgrps_adj, | |
13468 | show_ip_bgp_updgrps_adj_cmd, | |
13469 | "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13470 | SHOW_STR | |
13471 | IP_STR | |
13472 | BGP_STR | |
13473 | "BGP update groups\n" | |
13474 | "Advertisement queue\n" | |
13475 | "Announced routes\n" | |
13476 | "Packet queue\n") | |
8fe8a7f6 | 13477 | |
3f9c7369 | 13478 | { |
afec25d9 | 13479 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[4]->arg, 0); |
8386ac43 | 13480 | return CMD_SUCCESS; |
13481 | } | |
13482 | ||
13483 | DEFUN (show_ip_bgp_instance_updgrps_adj, | |
13484 | show_ip_bgp_instance_updgrps_adj_cmd, | |
13485 | "show ip bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13486 | SHOW_STR | |
13487 | IP_STR | |
13488 | BGP_STR | |
13489 | BGP_INSTANCE_HELP_STR | |
13490 | "BGP update groups\n" | |
13491 | "Advertisement queue\n" | |
13492 | "Announced routes\n" | |
13493 | "Packet queue\n") | |
13494 | ||
13495 | { | |
afec25d9 | 13496 | show_bgp_updgrps_adj_info_aux(vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, argv[6]->arg, 0); |
3f9c7369 DS |
13497 | return CMD_SUCCESS; |
13498 | } | |
13499 | ||
13500 | DEFUN (show_bgp_updgrps_afi_adj, | |
13501 | show_bgp_updgrps_afi_adj_cmd, | |
13502 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13503 | SHOW_STR | |
13504 | BGP_STR | |
13505 | "Address family\n" | |
13506 | "Address family\n" | |
13507 | "Address Family modifier\n" | |
13508 | "Address Family modifier\n" | |
13509 | "BGP update groups\n" | |
13510 | "Advertisement queue\n" | |
13511 | "Announced routes\n" | |
8fe8a7f6 DS |
13512 | "Packet queue\n" |
13513 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
13514 | { |
13515 | afi_t afi; | |
13516 | safi_t safi; | |
13517 | ||
afec25d9 DW |
13518 | afi = (strcmp(argv[2]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; |
13519 | safi = (strncmp (argv[3]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
13520 | show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[5]->arg, 0); | |
8fe8a7f6 | 13521 | return CMD_SUCCESS; |
3f9c7369 DS |
13522 | } |
13523 | ||
13524 | DEFUN (show_bgp_updgrps_adj, | |
13525 | show_bgp_updgrps_adj_cmd, | |
13526 | "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13527 | SHOW_STR | |
13528 | BGP_STR | |
13529 | "BGP update groups\n" | |
13530 | "Advertisement queue\n" | |
13531 | "Announced routes\n" | |
13532 | "Packet queue\n") | |
13533 | { | |
afec25d9 | 13534 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[3]->arg, 0); |
8386ac43 | 13535 | return CMD_SUCCESS; |
13536 | } | |
13537 | ||
13538 | DEFUN (show_bgp_instance_updgrps_adj, | |
13539 | show_bgp_instance_updgrps_adj_cmd, | |
13540 | "show bgp " BGP_INSTANCE_CMD " update-groups (advertise-queue|advertised-routes|packet-queue)", | |
13541 | SHOW_STR | |
13542 | BGP_STR | |
13543 | BGP_INSTANCE_HELP_STR | |
13544 | "BGP update groups\n" | |
13545 | "Advertisement queue\n" | |
13546 | "Announced routes\n" | |
13547 | "Packet queue\n") | |
13548 | { | |
afec25d9 | 13549 | show_bgp_updgrps_adj_info_aux(vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, argv[5]->arg, 0); |
3f9c7369 DS |
13550 | return CMD_SUCCESS; |
13551 | } | |
13552 | ||
13553 | DEFUN (show_ip_bgp_updgrps_adj_s, | |
8fe8a7f6 | 13554 | show_ip_bgp_updgrps_adj_s_cmd, |
3f9c7369 DS |
13555 | "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
13556 | SHOW_STR | |
13557 | IP_STR | |
13558 | BGP_STR | |
13559 | "BGP update groups\n" | |
8fe8a7f6 | 13560 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
13561 | "Advertisement queue\n" |
13562 | "Announced routes\n" | |
13563 | "Packet queue\n") | |
3f9c7369 | 13564 | |
3f9c7369 | 13565 | { |
f43e655e | 13566 | uint64_t subgrp_id; |
8fe8a7f6 | 13567 | |
afec25d9 | 13568 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[5]->arg); |
8fe8a7f6 | 13569 | |
8386ac43 | 13570 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id); |
13571 | return CMD_SUCCESS; | |
13572 | } | |
13573 | ||
13574 | DEFUN (show_ip_bgp_instance_updgrps_adj_s, | |
13575 | show_ip_bgp_instance_updgrps_adj_s_cmd, | |
13576 | "show ip bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13577 | SHOW_STR | |
13578 | IP_STR | |
13579 | BGP_STR | |
13580 | BGP_INSTANCE_HELP_STR | |
13581 | "BGP update groups\n" | |
13582 | "Specific subgroup to display info for\n" | |
13583 | "Advertisement queue\n" | |
13584 | "Announced routes\n" | |
13585 | "Packet queue\n") | |
13586 | ||
13587 | { | |
f43e655e | 13588 | uint64_t subgrp_id; |
8386ac43 | 13589 | |
afec25d9 | 13590 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[7]->arg); |
8386ac43 | 13591 | |
afec25d9 | 13592 | show_bgp_updgrps_adj_info_aux(vty, argv[4]->arg, AFI_IP, SAFI_UNICAST, argv[3], subgrp_id); |
3f9c7369 DS |
13593 | return CMD_SUCCESS; |
13594 | } | |
13595 | ||
8fe8a7f6 DS |
13596 | DEFUN (show_bgp_updgrps_afi_adj_s, |
13597 | show_bgp_updgrps_afi_adj_s_cmd, | |
3f9c7369 DS |
13598 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
13599 | SHOW_STR | |
13600 | BGP_STR | |
13601 | "Address family\n" | |
13602 | "Address family\n" | |
13603 | "Address Family modifier\n" | |
13604 | "Address Family modifier\n" | |
13605 | "BGP update groups\n" | |
8fe8a7f6 | 13606 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
13607 | "Advertisement queue\n" |
13608 | "Announced routes\n" | |
8fe8a7f6 DS |
13609 | "Packet queue\n" |
13610 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
13611 | { |
13612 | afi_t afi; | |
13613 | safi_t safi; | |
f43e655e | 13614 | uint64_t subgrp_id; |
3f9c7369 | 13615 | |
afec25d9 DW |
13616 | afi = (strcmp(argv[2]->arg, "ipv4") == 0) ? AFI_IP : AFI_IP6; |
13617 | safi = (strncmp (argv[3]->arg, "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
13618 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[6]->arg); | |
8fe8a7f6 | 13619 | |
8386ac43 | 13620 | show_bgp_updgrps_adj_info_aux(vty, NULL, afi, safi, argv[3], subgrp_id); |
8fe8a7f6 | 13621 | return CMD_SUCCESS; |
3f9c7369 DS |
13622 | } |
13623 | ||
8fe8a7f6 DS |
13624 | DEFUN (show_bgp_updgrps_adj_s, |
13625 | show_bgp_updgrps_adj_s_cmd, | |
13626 | "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13627 | SHOW_STR | |
13628 | BGP_STR | |
13629 | "BGP update groups\n" | |
13630 | "Specific subgroup to display info for\n" | |
13631 | "Advertisement queue\n" | |
13632 | "Announced routes\n" | |
13633 | "Packet queue\n") | |
13634 | { | |
f43e655e | 13635 | uint64_t subgrp_id; |
8fe8a7f6 | 13636 | |
afec25d9 | 13637 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[4]->arg); |
8fe8a7f6 | 13638 | |
8386ac43 | 13639 | show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id); |
8fe8a7f6 DS |
13640 | return CMD_SUCCESS; |
13641 | } | |
13642 | ||
8386ac43 | 13643 | DEFUN (show_bgp_instance_updgrps_adj_s, |
13644 | show_bgp_instance_updgrps_adj_s_cmd, | |
13645 | "show bgp " BGP_INSTANCE_CMD " update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
13646 | SHOW_STR | |
13647 | BGP_STR | |
13648 | BGP_INSTANCE_HELP_STR | |
13649 | "BGP update groups\n" | |
13650 | "Specific subgroup to display info for\n" | |
13651 | "Advertisement queue\n" | |
13652 | "Announced routes\n" | |
13653 | "Packet queue\n") | |
13654 | { | |
f43e655e | 13655 | uint64_t subgrp_id; |
8386ac43 | 13656 | |
afec25d9 | 13657 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[6]->arg); |
8386ac43 | 13658 | |
afec25d9 | 13659 | show_bgp_updgrps_adj_info_aux(vty, argv[3]->arg, AFI_IP6, SAFI_UNICAST, argv[3], subgrp_id); |
8386ac43 | 13660 | return CMD_SUCCESS; |
13661 | } | |
13662 | ||
13663 | ||
8fe8a7f6 | 13664 | |
f14e6fdb DS |
13665 | static int |
13666 | bgp_show_one_peer_group (struct vty *vty, struct peer_group *group) | |
13667 | { | |
13668 | struct listnode *node, *nnode; | |
13669 | struct prefix *range; | |
13670 | struct peer *conf; | |
13671 | struct peer *peer; | |
4690c7d7 | 13672 | char buf[PREFIX2STR_BUFFER]; |
f14e6fdb DS |
13673 | afi_t afi; |
13674 | safi_t safi; | |
ffd0c037 DS |
13675 | const char *peer_status; |
13676 | const char *af_str; | |
f14e6fdb DS |
13677 | int lr_count; |
13678 | int dynamic; | |
13679 | int af_cfgd; | |
13680 | ||
13681 | conf = group->conf; | |
13682 | ||
0299c004 DS |
13683 | if (conf->as_type == AS_SPECIFIED || |
13684 | conf->as_type == AS_EXTERNAL) { | |
66b199b2 | 13685 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
f14e6fdb | 13686 | VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE); |
0299c004 | 13687 | } else if (conf->as_type == AS_INTERNAL) { |
66b199b2 | 13688 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
0299c004 | 13689 | VTY_NEWLINE, group->name, group->bgp->as, VTY_NEWLINE); |
66b199b2 DS |
13690 | } else { |
13691 | vty_out (vty, "%sBGP peer-group %s%s", | |
13692 | VTY_NEWLINE, group->name, VTY_NEWLINE); | |
0299c004 | 13693 | } |
f14e6fdb | 13694 | |
0299c004 | 13695 | if ((group->bgp->as == conf->as) || (conf->as_type == AS_INTERNAL)) |
f14e6fdb DS |
13696 | vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE); |
13697 | else | |
13698 | vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE); | |
13699 | ||
13700 | /* Display AFs configured. */ | |
13701 | vty_out (vty, " Configured address-families:"); | |
13702 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
13703 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
13704 | { | |
13705 | if (conf->afc[afi][safi]) | |
13706 | { | |
13707 | af_cfgd = 1; | |
13708 | vty_out (vty, " %s;", afi_safi_print(afi, safi)); | |
13709 | } | |
13710 | } | |
13711 | if (!af_cfgd) | |
13712 | vty_out (vty, " none%s", VTY_NEWLINE); | |
13713 | else | |
13714 | vty_out (vty, "%s", VTY_NEWLINE); | |
13715 | ||
13716 | /* Display listen ranges (for dynamic neighbors), if any */ | |
13717 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
13718 | { | |
13719 | if (afi == AFI_IP) | |
13720 | af_str = "IPv4"; | |
13721 | else if (afi == AFI_IP6) | |
13722 | af_str = "IPv6"; | |
13723 | lr_count = listcount(group->listen_range[afi]); | |
13724 | if (lr_count) | |
13725 | { | |
13726 | vty_out(vty, | |
13727 | " %d %s listen range(s)%s", | |
13728 | lr_count, af_str, VTY_NEWLINE); | |
13729 | ||
13730 | ||
13731 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node, | |
13732 | nnode, range)) | |
13733 | { | |
13734 | prefix2str(range, buf, sizeof(buf)); | |
13735 | vty_out(vty, " %s%s", buf, VTY_NEWLINE); | |
13736 | } | |
13737 | } | |
13738 | } | |
13739 | ||
13740 | /* Display group members and their status */ | |
13741 | if (listcount(group->peer)) | |
13742 | { | |
13743 | vty_out (vty, " Peer-group members:%s", VTY_NEWLINE); | |
13744 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
13745 | { | |
13746 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
13747 | peer_status = "Idle (Admin)"; | |
13748 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
13749 | peer_status = "Idle (PfxCt)"; | |
13750 | else | |
13751 | peer_status = LOOKUP(bgp_status_msg, peer->status); | |
13752 | ||
13753 | dynamic = peer_dynamic_neighbor(peer); | |
13754 | vty_out (vty, " %s %s %s %s", | |
13755 | peer->host, dynamic ? "(dynamic)" : "", | |
13756 | peer_status, VTY_NEWLINE); | |
13757 | } | |
13758 | } | |
13759 | ||
13760 | return CMD_SUCCESS; | |
13761 | } | |
13762 | ||
13763 | /* Show BGP peer group's information. */ | |
13764 | enum show_group_type | |
13765 | { | |
13766 | show_all_groups, | |
13767 | show_peer_group | |
13768 | }; | |
13769 | ||
13770 | static int | |
13771 | bgp_show_peer_group (struct vty *vty, struct bgp *bgp, | |
13772 | enum show_group_type type, const char *group_name) | |
13773 | { | |
13774 | struct listnode *node, *nnode; | |
13775 | struct peer_group *group; | |
13776 | int find = 0; | |
13777 | ||
13778 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
13779 | { | |
13780 | switch (type) | |
13781 | { | |
13782 | case show_all_groups: | |
13783 | bgp_show_one_peer_group (vty, group); | |
13784 | break; | |
13785 | case show_peer_group: | |
13786 | if (group_name && (strcmp(group->name, group_name) == 0)) | |
13787 | { | |
13788 | find = 1; | |
13789 | bgp_show_one_peer_group (vty, group); | |
13790 | } | |
13791 | break; | |
13792 | } | |
13793 | } | |
13794 | ||
13795 | if (type == show_peer_group && ! find) | |
6d9e66dc | 13796 | vty_out (vty, "%% No such peer-group%s", VTY_NEWLINE); |
f14e6fdb DS |
13797 | |
13798 | return CMD_SUCCESS; | |
13799 | } | |
13800 | ||
13801 | static int | |
13802 | bgp_show_peer_group_vty (struct vty *vty, const char *name, | |
13803 | enum show_group_type type, const char *group_name) | |
13804 | { | |
13805 | struct bgp *bgp; | |
13806 | int ret = CMD_SUCCESS; | |
13807 | ||
13808 | if (name) | |
8386ac43 | 13809 | bgp = bgp_lookup_by_name (name); |
13810 | else | |
13811 | bgp = bgp_get_default (); | |
f14e6fdb | 13812 | |
8386ac43 | 13813 | if (! bgp) |
13814 | { | |
13815 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
13816 | return CMD_WARNING; | |
f14e6fdb DS |
13817 | } |
13818 | ||
8386ac43 | 13819 | ret = bgp_show_peer_group (vty, bgp, type, group_name); |
f14e6fdb DS |
13820 | |
13821 | return ret; | |
13822 | } | |
13823 | ||
13824 | DEFUN (show_ip_bgp_peer_groups, | |
13825 | show_ip_bgp_peer_groups_cmd, | |
13826 | "show ip bgp peer-group", | |
13827 | SHOW_STR | |
13828 | IP_STR | |
13829 | BGP_STR | |
13830 | "Detailed information on all BGP peer groups\n") | |
13831 | { | |
13832 | return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL); | |
13833 | } | |
13834 | ||
13835 | DEFUN (show_ip_bgp_instance_peer_groups, | |
13836 | show_ip_bgp_instance_peer_groups_cmd, | |
8386ac43 | 13837 | "show ip bgp " BGP_INSTANCE_CMD " peer-group", |
f14e6fdb DS |
13838 | SHOW_STR |
13839 | IP_STR | |
13840 | BGP_STR | |
8386ac43 | 13841 | BGP_INSTANCE_HELP_STR |
f14e6fdb DS |
13842 | "Detailed information on all BGP peer groups\n") |
13843 | { | |
afec25d9 | 13844 | return bgp_show_peer_group_vty (vty, argv[4]->arg, show_all_groups, NULL); |
f14e6fdb DS |
13845 | } |
13846 | ||
13847 | DEFUN (show_ip_bgp_peer_group, | |
13848 | show_ip_bgp_peer_group_cmd, | |
13849 | "show ip bgp peer-group WORD", | |
13850 | SHOW_STR | |
13851 | IP_STR | |
13852 | BGP_STR | |
13853 | "BGP peer-group name\n" | |
13854 | "Detailed information on a BGP peer group\n") | |
13855 | { | |
afec25d9 | 13856 | return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[4]->arg); |
f14e6fdb DS |
13857 | } |
13858 | ||
13859 | DEFUN (show_ip_bgp_instance_peer_group, | |
13860 | show_ip_bgp_instance_peer_group_cmd, | |
8386ac43 | 13861 | "show ip bgp " BGP_INSTANCE_CMD " peer-group WORD", |
f14e6fdb DS |
13862 | SHOW_STR |
13863 | IP_STR | |
13864 | BGP_STR | |
8386ac43 | 13865 | BGP_INSTANCE_HELP_STR |
f14e6fdb DS |
13866 | "BGP peer-group name\n" |
13867 | "Detailed information on a BGP peer group\n") | |
13868 | { | |
afec25d9 | 13869 | return bgp_show_peer_group_vty (vty, argv[4]->arg, show_peer_group, argv[6]->arg); |
f14e6fdb | 13870 | } |
3f9c7369 | 13871 | |
718e3744 | 13872 | /* Redistribute VTY commands. */ |
13873 | ||
718e3744 | 13874 | DEFUN (bgp_redistribute_ipv4, |
13875 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 13876 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 13877 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13878 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 13879 | { |
13880 | int type; | |
13881 | ||
afec25d9 | 13882 | type = proto_redistnum (AFI_IP, argv[1]->arg); |
e0ca5fde | 13883 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
718e3744 | 13884 | { |
13885 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13886 | return CMD_WARNING; | |
13887 | } | |
7c8ff89e | 13888 | bgp_redist_add(vty->index, AFI_IP, type, 0); |
6aeb9e78 | 13889 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13890 | } |
13891 | ||
13892 | DEFUN (bgp_redistribute_ipv4_rmap, | |
13893 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 13894 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 13895 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13896 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13897 | "Route map reference\n" |
13898 | "Pointer to route-map entries\n") | |
13899 | { | |
13900 | int type; | |
7c8ff89e | 13901 | struct bgp_redist *red; |
718e3744 | 13902 | |
afec25d9 | 13903 | type = proto_redistnum (AFI_IP, argv[1]->arg); |
e0ca5fde | 13904 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
718e3744 | 13905 | { |
13906 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13907 | return CMD_WARNING; | |
13908 | } | |
13909 | ||
7c8ff89e | 13910 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
afec25d9 | 13911 | bgp_redistribute_rmap_set (red, argv[3]->arg); |
6aeb9e78 | 13912 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13913 | } |
13914 | ||
13915 | DEFUN (bgp_redistribute_ipv4_metric, | |
13916 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 13917 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 13918 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13919 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13920 | "Metric for redistributed routes\n" |
13921 | "Default metric\n") | |
13922 | { | |
13923 | int type; | |
13924 | u_int32_t metric; | |
7c8ff89e | 13925 | struct bgp_redist *red; |
718e3744 | 13926 | |
afec25d9 | 13927 | type = proto_redistnum (AFI_IP, argv[1]->arg); |
e0ca5fde | 13928 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
718e3744 | 13929 | { |
13930 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13931 | return CMD_WARNING; | |
13932 | } | |
afec25d9 | 13933 | VTY_GET_INTEGER ("metric", metric, argv[3]->arg); |
718e3744 | 13934 | |
7c8ff89e | 13935 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 13936 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
6aeb9e78 | 13937 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13938 | } |
13939 | ||
13940 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
13941 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 13942 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 13943 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13944 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13945 | "Route map reference\n" |
13946 | "Pointer to route-map entries\n" | |
13947 | "Metric for redistributed routes\n" | |
13948 | "Default metric\n") | |
13949 | { | |
13950 | int type; | |
13951 | u_int32_t metric; | |
7c8ff89e | 13952 | struct bgp_redist *red; |
718e3744 | 13953 | |
afec25d9 | 13954 | type = proto_redistnum (AFI_IP, argv[1]->arg); |
e0ca5fde | 13955 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
718e3744 | 13956 | { |
13957 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13958 | return CMD_WARNING; | |
13959 | } | |
afec25d9 | 13960 | VTY_GET_INTEGER ("metric", metric, argv[5]->arg); |
718e3744 | 13961 | |
7c8ff89e | 13962 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
afec25d9 | 13963 | bgp_redistribute_rmap_set (red, argv[3]->arg); |
caf958b4 | 13964 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
6aeb9e78 | 13965 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13966 | } |
13967 | ||
13968 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
13969 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 13970 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 13971 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 13972 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 13973 | "Metric for redistributed routes\n" |
13974 | "Default metric\n" | |
13975 | "Route map reference\n" | |
13976 | "Pointer to route-map entries\n") | |
13977 | { | |
13978 | int type; | |
13979 | u_int32_t metric; | |
7c8ff89e | 13980 | struct bgp_redist *red; |
718e3744 | 13981 | |
afec25d9 | 13982 | type = proto_redistnum (AFI_IP, argv[1]->arg); |
e0ca5fde | 13983 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
718e3744 | 13984 | { |
13985 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
13986 | return CMD_WARNING; | |
13987 | } | |
afec25d9 | 13988 | VTY_GET_INTEGER ("metric", metric, argv[3]->arg); |
718e3744 | 13989 | |
7c8ff89e | 13990 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 13991 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
afec25d9 | 13992 | bgp_redistribute_rmap_set (red, argv[5]->arg); |
6aeb9e78 | 13993 | return bgp_redistribute_set (vty->index, AFI_IP, type, 0); |
718e3744 | 13994 | } |
13995 | ||
7c8ff89e DS |
13996 | DEFUN (bgp_redistribute_ipv4_ospf, |
13997 | bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 13998 | "redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
13999 | "Redistribute information from another routing protocol\n" |
14000 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
14001 | "Non-main Kernel Routing Table\n" |
14002 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
14003 | { |
14004 | u_short instance; | |
7a4bb9c5 | 14005 | u_short protocol; |
7c8ff89e | 14006 | |
afec25d9 | 14007 | VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); |
7a4bb9c5 | 14008 | |
afec25d9 | 14009 | if (strncmp(argv[1]->arg, "o", 1) == 0) |
7a4bb9c5 DS |
14010 | protocol = ZEBRA_ROUTE_OSPF; |
14011 | else | |
14012 | protocol = ZEBRA_ROUTE_TABLE; | |
14013 | ||
14014 | bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
6aeb9e78 | 14015 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
14016 | } |
14017 | ||
14018 | DEFUN (bgp_redistribute_ipv4_ospf_rmap, | |
14019 | bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 14020 | "redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
14021 | "Redistribute information from another routing protocol\n" |
14022 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
14023 | "Non-main Kernel Routing Table\n" |
14024 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
14025 | "Route map reference\n" |
14026 | "Pointer to route-map entries\n") | |
14027 | { | |
14028 | struct bgp_redist *red; | |
14029 | u_short instance; | |
7a4bb9c5 | 14030 | int protocol; |
7c8ff89e | 14031 | |
afec25d9 | 14032 | if (strncmp(argv[1]->arg, "o", 1) == 0) |
7a4bb9c5 DS |
14033 | protocol = ZEBRA_ROUTE_OSPF; |
14034 | else | |
14035 | protocol = ZEBRA_ROUTE_TABLE; | |
14036 | ||
afec25d9 | 14037 | VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); |
7a4bb9c5 | 14038 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); |
afec25d9 | 14039 | bgp_redistribute_rmap_set (red, argv[4]->arg); |
6aeb9e78 | 14040 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
14041 | } |
14042 | ||
14043 | DEFUN (bgp_redistribute_ipv4_ospf_metric, | |
14044 | bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 14045 | "redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
14046 | "Redistribute information from another routing protocol\n" |
14047 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
14048 | "Non-main Kernel Routing Table\n" |
14049 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
14050 | "Metric for redistributed routes\n" |
14051 | "Default metric\n") | |
14052 | { | |
14053 | u_int32_t metric; | |
14054 | struct bgp_redist *red; | |
14055 | u_short instance; | |
7a4bb9c5 | 14056 | int protocol; |
7c8ff89e | 14057 | |
afec25d9 | 14058 | if (strncmp(argv[1]->arg, "o", 1) == 0) |
7a4bb9c5 DS |
14059 | protocol = ZEBRA_ROUTE_OSPF; |
14060 | else | |
14061 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 14062 | |
afec25d9 DW |
14063 | VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); |
14064 | VTY_GET_INTEGER ("metric", metric, argv[4]->arg); | |
7a4bb9c5 DS |
14065 | |
14066 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 14067 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
6aeb9e78 | 14068 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
14069 | } |
14070 | ||
14071 | DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, | |
14072 | bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 14073 | "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
14074 | "Redistribute information from another routing protocol\n" |
14075 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
14076 | "Non-main Kernel Routing Table\n" |
14077 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
14078 | "Route map reference\n" |
14079 | "Pointer to route-map entries\n" | |
14080 | "Metric for redistributed routes\n" | |
14081 | "Default metric\n") | |
14082 | { | |
14083 | u_int32_t metric; | |
14084 | struct bgp_redist *red; | |
14085 | u_short instance; | |
7a4bb9c5 | 14086 | int protocol; |
7c8ff89e | 14087 | |
afec25d9 | 14088 | if (strncmp(argv[1]->arg, "o", 1) == 0) |
7a4bb9c5 DS |
14089 | protocol = ZEBRA_ROUTE_OSPF; |
14090 | else | |
14091 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 14092 | |
afec25d9 DW |
14093 | VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); |
14094 | VTY_GET_INTEGER ("metric", metric, argv[6]->arg); | |
7a4bb9c5 DS |
14095 | |
14096 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
afec25d9 | 14097 | bgp_redistribute_rmap_set (red, argv[4]->arg); |
caf958b4 | 14098 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
6aeb9e78 | 14099 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
14100 | } |
14101 | ||
14102 | DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, | |
14103 | bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 14104 | "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
14105 | "Redistribute information from another routing protocol\n" |
14106 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
14107 | "Non-main Kernel Routing Table\n" |
14108 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
14109 | "Metric for redistributed routes\n" |
14110 | "Default metric\n" | |
14111 | "Route map reference\n" | |
14112 | "Pointer to route-map entries\n") | |
14113 | { | |
14114 | u_int32_t metric; | |
14115 | struct bgp_redist *red; | |
14116 | u_short instance; | |
7a4bb9c5 | 14117 | int protocol; |
7c8ff89e | 14118 | |
afec25d9 | 14119 | if (strncmp(argv[1]->arg, "o", 1) == 0) |
7a4bb9c5 DS |
14120 | protocol = ZEBRA_ROUTE_OSPF; |
14121 | else | |
14122 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 14123 | |
afec25d9 DW |
14124 | VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg); |
14125 | VTY_GET_INTEGER ("metric", metric, argv[4]->arg); | |
7a4bb9c5 DS |
14126 | |
14127 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 14128 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
afec25d9 | 14129 | bgp_redistribute_rmap_set (red, argv[6]->arg); |
6aeb9e78 | 14130 | return bgp_redistribute_set (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
14131 | } |
14132 | ||
f412b39a DW |
14133 | /* |
14134 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
14135 | * "no redistribute (ospf|table) <1-65535> route-map WORD", | |
14136 | * NO_STR | |
14137 | * "Redistribute information from another routing protocol\n" | |
14138 | * "Open Shortest Path First (OSPFv2)\n" | |
14139 | * "Non-main Kernel Routing Table\n" | |
14140 | * "Instance ID/Table ID\n" | |
14141 | * "Route map reference\n" | |
14142 | * "Pointer to route-map entries\n" | |
14143 | * | |
14144 | * "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", | |
14145 | * NO_STR | |
14146 | * "Redistribute information from another routing protocol\n" | |
14147 | * "Open Shortest Path First (OSPFv2)\n" | |
14148 | * "Non-main Kernel Routing Table\n" | |
14149 | * "Instance ID/Table ID\n" | |
14150 | * "Metric for redistributed routes\n" | |
14151 | * "Default metric\n" | |
14152 | * | |
14153 | * "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", | |
14154 | * NO_STR | |
14155 | * "Redistribute information from another routing protocol\n" | |
14156 | * "Open Shortest Path First (OSPFv2)\n" | |
14157 | * "Non-main Kernel Routing Table\n" | |
14158 | * "Instance ID/Table ID\n" | |
14159 | * "Route map reference\n" | |
14160 | * "Pointer to route-map entries\n" | |
14161 | * "Metric for redistributed routes\n" | |
14162 | * "Default metric\n" | |
14163 | * | |
14164 | * "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", | |
14165 | * NO_STR | |
14166 | * "Redistribute information from another routing protocol\n" | |
14167 | * "Open Shortest Path First (OSPFv2)\n" | |
14168 | * "Non-main Kernel Routing Table\n" | |
14169 | * "Instance ID/Table ID\n" | |
14170 | * "Metric for redistributed routes\n" | |
14171 | * "Default metric\n" | |
14172 | * "Route map reference\n" | |
14173 | * "Pointer to route-map entries\n" | |
14174 | * | |
14175 | */ | |
7c8ff89e DS |
14176 | DEFUN (no_bgp_redistribute_ipv4_ospf, |
14177 | no_bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 14178 | "no redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
14179 | NO_STR |
14180 | "Redistribute information from another routing protocol\n" | |
14181 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
14182 | "Non-main Kernel Routing Table\n" |
14183 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
14184 | { |
14185 | u_short instance; | |
7a4bb9c5 DS |
14186 | int protocol; |
14187 | ||
afec25d9 | 14188 | if (strncmp(argv[2]->arg, "o", 1) == 0) |
7a4bb9c5 DS |
14189 | protocol = ZEBRA_ROUTE_OSPF; |
14190 | else | |
14191 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 14192 | |
afec25d9 | 14193 | VTY_GET_INTEGER ("Instance ID", instance, argv[3]->arg); |
7a4bb9c5 | 14194 | return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); |
7c8ff89e DS |
14195 | } |
14196 | ||
7c8ff89e | 14197 | |
7c8ff89e | 14198 | |
7c8ff89e | 14199 | |
7c8ff89e | 14200 | |
f412b39a DW |
14201 | /* |
14202 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
14203 | * "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", | |
14204 | * NO_STR | |
14205 | * "Redistribute information from another routing protocol\n" | |
14206 | * QUAGGA_IP_REDIST_HELP_STR_BGPD | |
14207 | * "Metric for redistributed routes\n" | |
14208 | * "Default metric\n" | |
14209 | * "Route map reference\n" | |
14210 | * "Pointer to route-map entries\n" | |
14211 | * | |
14212 | * "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", | |
14213 | * NO_STR | |
14214 | * "Redistribute information from another routing protocol\n" | |
14215 | * QUAGGA_IP_REDIST_HELP_STR_BGPD | |
14216 | * "Route map reference\n" | |
14217 | * "Pointer to route-map entries\n" | |
14218 | * | |
14219 | * "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", | |
14220 | * NO_STR | |
14221 | * "Redistribute information from another routing protocol\n" | |
14222 | * QUAGGA_IP_REDIST_HELP_STR_BGPD | |
14223 | * "Route map reference\n" | |
14224 | * "Pointer to route-map entries\n" | |
14225 | * "Metric for redistributed routes\n" | |
14226 | * "Default metric\n" | |
14227 | * | |
14228 | * "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", | |
14229 | * NO_STR | |
14230 | * "Redistribute information from another routing protocol\n" | |
14231 | * QUAGGA_IP_REDIST_HELP_STR_BGPD | |
14232 | * "Metric for redistributed routes\n" | |
14233 | * "Default metric\n" | |
14234 | * | |
14235 | */ | |
718e3744 | 14236 | DEFUN (no_bgp_redistribute_ipv4, |
14237 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 14238 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 14239 | NO_STR |
14240 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14241 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 14242 | { |
14243 | int type; | |
14244 | ||
afec25d9 | 14245 | type = proto_redistnum (AFI_IP, argv[2]->arg); |
e0ca5fde | 14246 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
718e3744 | 14247 | { |
14248 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14249 | return CMD_WARNING; | |
14250 | } | |
7c8ff89e | 14251 | return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); |
718e3744 | 14252 | } |
14253 | ||
718e3744 | 14254 | |
718e3744 | 14255 | |
718e3744 | 14256 | |
6b0655a2 | 14257 | |
718e3744 | 14258 | #ifdef HAVE_IPV6 |
14259 | DEFUN (bgp_redistribute_ipv6, | |
14260 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 14261 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 14262 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14263 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 14264 | { |
14265 | int type; | |
14266 | ||
afec25d9 | 14267 | type = proto_redistnum (AFI_IP6, argv[1]->arg); |
e0ca5fde | 14268 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
718e3744 | 14269 | { |
14270 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14271 | return CMD_WARNING; | |
14272 | } | |
14273 | ||
7c8ff89e | 14274 | bgp_redist_add(vty->index, AFI_IP6, type, 0); |
6aeb9e78 | 14275 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14276 | } |
14277 | ||
14278 | DEFUN (bgp_redistribute_ipv6_rmap, | |
14279 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 14280 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 14281 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14282 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14283 | "Route map reference\n" |
14284 | "Pointer to route-map entries\n") | |
14285 | { | |
14286 | int type; | |
7c8ff89e | 14287 | struct bgp_redist *red; |
718e3744 | 14288 | |
afec25d9 | 14289 | type = proto_redistnum (AFI_IP6, argv[1]->arg); |
e0ca5fde | 14290 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
718e3744 | 14291 | { |
14292 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14293 | return CMD_WARNING; | |
14294 | } | |
14295 | ||
7c8ff89e | 14296 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
afec25d9 | 14297 | bgp_redistribute_rmap_set (red, argv[3]->arg); |
6aeb9e78 | 14298 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14299 | } |
14300 | ||
14301 | DEFUN (bgp_redistribute_ipv6_metric, | |
14302 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 14303 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 14304 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14305 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14306 | "Metric for redistributed routes\n" |
14307 | "Default metric\n") | |
14308 | { | |
14309 | int type; | |
14310 | u_int32_t metric; | |
7c8ff89e | 14311 | struct bgp_redist *red; |
718e3744 | 14312 | |
afec25d9 | 14313 | type = proto_redistnum (AFI_IP6, argv[1]->arg); |
e0ca5fde | 14314 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
718e3744 | 14315 | { |
14316 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14317 | return CMD_WARNING; | |
14318 | } | |
afec25d9 | 14319 | VTY_GET_INTEGER ("metric", metric, argv[3]->arg); |
718e3744 | 14320 | |
7c8ff89e | 14321 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 14322 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
6aeb9e78 | 14323 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14324 | } |
14325 | ||
14326 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
14327 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 14328 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 14329 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14330 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14331 | "Route map reference\n" |
14332 | "Pointer to route-map entries\n" | |
14333 | "Metric for redistributed routes\n" | |
14334 | "Default metric\n") | |
14335 | { | |
14336 | int type; | |
14337 | u_int32_t metric; | |
7c8ff89e | 14338 | struct bgp_redist *red; |
718e3744 | 14339 | |
afec25d9 | 14340 | type = proto_redistnum (AFI_IP6, argv[1]->arg); |
e0ca5fde | 14341 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
718e3744 | 14342 | { |
14343 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14344 | return CMD_WARNING; | |
14345 | } | |
afec25d9 | 14346 | VTY_GET_INTEGER ("metric", metric, argv[5]->arg); |
718e3744 | 14347 | |
7c8ff89e | 14348 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
afec25d9 | 14349 | bgp_redistribute_rmap_set (red, argv[3]->arg); |
caf958b4 | 14350 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
6aeb9e78 | 14351 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14352 | } |
14353 | ||
14354 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
14355 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 14356 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 14357 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 14358 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 14359 | "Metric for redistributed routes\n" |
14360 | "Default metric\n" | |
14361 | "Route map reference\n" | |
14362 | "Pointer to route-map entries\n") | |
14363 | { | |
14364 | int type; | |
14365 | u_int32_t metric; | |
7c8ff89e | 14366 | struct bgp_redist *red; |
718e3744 | 14367 | |
afec25d9 | 14368 | type = proto_redistnum (AFI_IP6, argv[1]->arg); |
e0ca5fde | 14369 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
718e3744 | 14370 | { |
14371 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14372 | return CMD_WARNING; | |
14373 | } | |
afec25d9 | 14374 | VTY_GET_INTEGER ("metric", metric, argv[3]->arg); |
718e3744 | 14375 | |
7c8ff89e | 14376 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 14377 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric); |
afec25d9 | 14378 | bgp_redistribute_rmap_set (red, argv[5]->arg); |
6aeb9e78 | 14379 | return bgp_redistribute_set (vty->index, AFI_IP6, type, 0); |
718e3744 | 14380 | } |
14381 | ||
f412b39a DW |
14382 | /* |
14383 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
14384 | * "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", | |
14385 | * NO_STR | |
14386 | * "Redistribute information from another routing protocol\n" | |
14387 | * QUAGGA_IP6_REDIST_HELP_STR_BGPD | |
14388 | * "Route map reference\n" | |
14389 | * "Pointer to route-map entries\n" | |
14390 | * | |
14391 | * "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", | |
14392 | * NO_STR | |
14393 | * "Redistribute information from another routing protocol\n" | |
14394 | * QUAGGA_IP6_REDIST_HELP_STR_BGPD | |
14395 | * "Route map reference\n" | |
14396 | * "Pointer to route-map entries\n" | |
14397 | * "Metric for redistributed routes\n" | |
14398 | * "Default metric\n" | |
14399 | * | |
14400 | * "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", | |
14401 | * NO_STR | |
14402 | * "Redistribute information from another routing protocol\n" | |
14403 | * QUAGGA_IP6_REDIST_HELP_STR_BGPD | |
14404 | * "Metric for redistributed routes\n" | |
14405 | * "Default metric\n" | |
14406 | * "Route map reference\n" | |
14407 | * "Pointer to route-map entries\n" | |
14408 | * | |
14409 | * "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", | |
14410 | * NO_STR | |
14411 | * "Redistribute information from another routing protocol\n" | |
14412 | * QUAGGA_IP6_REDIST_HELP_STR_BGPD | |
14413 | * "Metric for redistributed routes\n" | |
14414 | * "Default metric\n" | |
14415 | * | |
14416 | */ | |
718e3744 | 14417 | DEFUN (no_bgp_redistribute_ipv6, |
14418 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 14419 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 14420 | NO_STR |
14421 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 14422 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 14423 | { |
14424 | int type; | |
14425 | ||
afec25d9 | 14426 | type = proto_redistnum (AFI_IP6, argv[2]->arg); |
e0ca5fde | 14427 | if (type < 0 || type == ZEBRA_ROUTE_BGP) |
718e3744 | 14428 | { |
14429 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
14430 | return CMD_WARNING; | |
14431 | } | |
14432 | ||
7c8ff89e | 14433 | return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0); |
718e3744 | 14434 | } |
14435 | ||
718e3744 | 14436 | |
718e3744 | 14437 | |
718e3744 | 14438 | |
718e3744 | 14439 | #endif /* HAVE_IPV6 */ |
6b0655a2 | 14440 | |
718e3744 | 14441 | int |
14442 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
14443 | safi_t safi, int *write) | |
14444 | { | |
14445 | int i; | |
718e3744 | 14446 | |
14447 | /* Unicast redistribution only. */ | |
14448 | if (safi != SAFI_UNICAST) | |
14449 | return 0; | |
14450 | ||
14451 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
14452 | { | |
14453 | /* Redistribute BGP does not make sense. */ | |
7c8ff89e | 14454 | if (i != ZEBRA_ROUTE_BGP) |
718e3744 | 14455 | { |
7c8ff89e DS |
14456 | struct list *red_list; |
14457 | struct listnode *node; | |
14458 | struct bgp_redist *red; | |
718e3744 | 14459 | |
7c8ff89e DS |
14460 | red_list = bgp->redist[afi][i]; |
14461 | if (!red_list) | |
14462 | continue; | |
718e3744 | 14463 | |
7c8ff89e DS |
14464 | for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) |
14465 | { | |
14466 | /* Display "address-family" when it is not yet diplayed. */ | |
14467 | bgp_config_write_family_header (vty, afi, safi, write); | |
14468 | ||
14469 | /* "redistribute" configuration. */ | |
0b960b4d | 14470 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
7c8ff89e DS |
14471 | if (red->instance) |
14472 | vty_out (vty, " %d", red->instance); | |
14473 | if (red->redist_metric_flag) | |
14474 | vty_out (vty, " metric %u", red->redist_metric); | |
14475 | if (red->rmap.name) | |
14476 | vty_out (vty, " route-map %s", red->rmap.name); | |
14477 | vty_out (vty, "%s", VTY_NEWLINE); | |
14478 | } | |
718e3744 | 14479 | } |
14480 | } | |
14481 | return *write; | |
14482 | } | |
6b0655a2 | 14483 | |
718e3744 | 14484 | /* BGP node structure. */ |
7fc626de | 14485 | static struct cmd_node bgp_node = |
718e3744 | 14486 | { |
14487 | BGP_NODE, | |
14488 | "%s(config-router)# ", | |
14489 | 1, | |
14490 | }; | |
14491 | ||
7fc626de | 14492 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 14493 | { |
14494 | BGP_IPV4_NODE, | |
14495 | "%s(config-router-af)# ", | |
14496 | 1, | |
14497 | }; | |
14498 | ||
7fc626de | 14499 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 14500 | { |
14501 | BGP_IPV4M_NODE, | |
14502 | "%s(config-router-af)# ", | |
14503 | 1, | |
14504 | }; | |
14505 | ||
7fc626de | 14506 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 14507 | { |
14508 | BGP_IPV6_NODE, | |
14509 | "%s(config-router-af)# ", | |
14510 | 1, | |
14511 | }; | |
14512 | ||
7fc626de | 14513 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 14514 | { |
14515 | BGP_IPV6M_NODE, | |
14516 | "%s(config-router-af)# ", | |
14517 | 1, | |
14518 | }; | |
14519 | ||
7fc626de | 14520 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 14521 | { |
14522 | BGP_VPNV4_NODE, | |
14523 | "%s(config-router-af)# ", | |
14524 | 1 | |
14525 | }; | |
6b0655a2 | 14526 | |
8ecd3266 | 14527 | static struct cmd_node bgp_vpnv6_node = |
14528 | { | |
14529 | BGP_VPNV6_NODE, | |
14530 | "%s(config-router-af-vpnv6)# ", | |
14531 | 1 | |
14532 | }; | |
14533 | ||
8b1fb8be LB |
14534 | static struct cmd_node bgp_encap_node = |
14535 | { | |
14536 | BGP_ENCAP_NODE, | |
14537 | "%s(config-router-af-encap)# ", | |
14538 | 1 | |
14539 | }; | |
14540 | ||
14541 | static struct cmd_node bgp_encapv6_node = | |
14542 | { | |
14543 | BGP_ENCAPV6_NODE, | |
14544 | "%s(config-router-af-encapv6)# ", | |
14545 | 1 | |
14546 | }; | |
14547 | ||
1f8ae70b | 14548 | static void community_list_vty (void); |
14549 | ||
718e3744 | 14550 | void |
94f2b392 | 14551 | bgp_vty_init (void) |
718e3744 | 14552 | { |
718e3744 | 14553 | /* Install bgp top node. */ |
14554 | install_node (&bgp_node, bgp_config_write); | |
14555 | install_node (&bgp_ipv4_unicast_node, NULL); | |
14556 | install_node (&bgp_ipv4_multicast_node, NULL); | |
14557 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 14558 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 14559 | install_node (&bgp_vpnv4_node, NULL); |
8ecd3266 | 14560 | install_node (&bgp_vpnv6_node, NULL); |
8b1fb8be LB |
14561 | install_node (&bgp_encap_node, NULL); |
14562 | install_node (&bgp_encapv6_node, NULL); | |
718e3744 | 14563 | |
14564 | /* Install default VTY commands to new nodes. */ | |
14565 | install_default (BGP_NODE); | |
14566 | install_default (BGP_IPV4_NODE); | |
14567 | install_default (BGP_IPV4M_NODE); | |
14568 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 14569 | install_default (BGP_IPV6M_NODE); |
718e3744 | 14570 | install_default (BGP_VPNV4_NODE); |
8ecd3266 | 14571 | install_default (BGP_VPNV6_NODE); |
8b1fb8be LB |
14572 | install_default (BGP_ENCAP_NODE); |
14573 | install_default (BGP_ENCAPV6_NODE); | |
718e3744 | 14574 | |
14575 | /* "bgp multiple-instance" commands. */ | |
14576 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
14577 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
14578 | ||
14579 | /* "bgp config-type" commands. */ | |
14580 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
718e3744 | 14581 | |
5fe9f963 | 14582 | /* bgp route-map delay-timer commands. */ |
14583 | install_element (CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd); | |
14584 | install_element (CONFIG_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
5fe9f963 | 14585 | |
718e3744 | 14586 | /* Dummy commands (Currently not supported) */ |
14587 | install_element (BGP_NODE, &no_synchronization_cmd); | |
14588 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
14589 | ||
14590 | /* "router bgp" commands. */ | |
14591 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
718e3744 | 14592 | |
14593 | /* "no router bgp" commands. */ | |
14594 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
718e3744 | 14595 | |
14596 | /* "bgp router-id" commands. */ | |
14597 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
14598 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
718e3744 | 14599 | |
14600 | /* "bgp cluster-id" commands. */ | |
14601 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
718e3744 | 14602 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); |
718e3744 | 14603 | |
14604 | /* "bgp confederation" commands. */ | |
14605 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
14606 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
718e3744 | 14607 | |
14608 | /* "bgp confederation peers" commands. */ | |
14609 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
14610 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
14611 | ||
abc920f8 DS |
14612 | /* bgp max-med command */ |
14613 | install_element (BGP_NODE, &bgp_maxmed_admin_cmd); | |
14614 | install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd); | |
14615 | install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); | |
abc920f8 DS |
14616 | install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); |
14617 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); | |
abc920f8 | 14618 | install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); |
abc920f8 | 14619 | |
907f92c8 DS |
14620 | /* bgp disable-ebgp-connected-nh-check */ |
14621 | install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd); | |
14622 | install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd); | |
14623 | ||
f188f2c4 DS |
14624 | /* bgp update-delay command */ |
14625 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
14626 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
14627 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
f188f2c4 | 14628 | |
cb1faec9 DS |
14629 | install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); |
14630 | install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); | |
14631 | ||
3f9c7369 DS |
14632 | install_element (BGP_NODE, &bgp_coalesce_time_cmd); |
14633 | install_element (BGP_NODE, &no_bgp_coalesce_time_cmd); | |
14634 | ||
165b5fff JB |
14635 | /* "maximum-paths" commands. */ |
14636 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
14637 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
165b5fff JB |
14638 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); |
14639 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
431aa9f9 DS |
14640 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
14641 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
165b5fff | 14642 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14643 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14644 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
165b5fff | 14645 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14646 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 14647 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
431aa9f9 | 14648 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 14649 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 | 14650 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
165b5fff | 14651 | |
718e3744 | 14652 | /* "timers bgp" commands. */ |
14653 | install_element (BGP_NODE, &bgp_timers_cmd); | |
14654 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
718e3744 | 14655 | |
5fe9f963 | 14656 | /* route-map delay-timer commands - per instance for backwards compat. */ |
518f0eb1 DS |
14657 | install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd); |
14658 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
14659 | ||
718e3744 | 14660 | /* "bgp client-to-client reflection" commands */ |
14661 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
14662 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
14663 | ||
14664 | /* "bgp always-compare-med" commands */ | |
14665 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
14666 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
14667 | ||
14668 | /* "bgp deterministic-med" commands */ | |
14669 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
14670 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 14671 | |
538621f2 | 14672 | /* "bgp graceful-restart" commands */ |
14673 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
14674 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 14675 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
14676 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
eb6f1b41 PG |
14677 | install_element (BGP_NODE, &bgp_graceful_restart_restart_time_cmd); |
14678 | install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_cmd); | |
718e3744 | 14679 | |
14680 | /* "bgp fast-external-failover" commands */ | |
14681 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
14682 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
14683 | ||
14684 | /* "bgp enforce-first-as" commands */ | |
14685 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
14686 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
14687 | ||
14688 | /* "bgp bestpath compare-routerid" commands */ | |
14689 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
14690 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
14691 | ||
14692 | /* "bgp bestpath as-path ignore" commands */ | |
14693 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
14694 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
14695 | ||
6811845b | 14696 | /* "bgp bestpath as-path confed" commands */ |
14697 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
14698 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
14699 | ||
2fdd455c PM |
14700 | /* "bgp bestpath as-path multipath-relax" commands */ |
14701 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
14702 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
14703 | ||
848973c7 | 14704 | /* "bgp log-neighbor-changes" commands */ |
14705 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
14706 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
14707 | ||
718e3744 | 14708 | /* "bgp bestpath med" commands */ |
14709 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
14710 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
718e3744 | 14711 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); |
14712 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
718e3744 | 14713 | |
14714 | /* "no bgp default ipv4-unicast" commands. */ | |
14715 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
14716 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
14717 | ||
14718 | /* "bgp network import-check" commands. */ | |
14719 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
8233ef81 | 14720 | install_element (BGP_NODE, &bgp_network_import_check_exact_cmd); |
718e3744 | 14721 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); |
14722 | ||
14723 | /* "bgp default local-preference" commands. */ | |
14724 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
14725 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
718e3744 | 14726 | |
04b6bdc0 DW |
14727 | /* bgp default show-hostname */ |
14728 | install_element (BGP_NODE, &bgp_default_show_hostname_cmd); | |
14729 | install_element (BGP_NODE, &no_bgp_default_show_hostname_cmd); | |
14730 | ||
3f9c7369 DS |
14731 | /* "bgp default subgroup-pkt-queue-max" commands. */ |
14732 | install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd); | |
14733 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd); | |
14734 | ||
8bd9d948 DS |
14735 | /* bgp ibgp-allow-policy-mods command */ |
14736 | install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd); | |
14737 | install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd); | |
14738 | ||
f14e6fdb DS |
14739 | /* "bgp listen limit" commands. */ |
14740 | install_element (BGP_NODE, &bgp_listen_limit_cmd); | |
14741 | install_element (BGP_NODE, &no_bgp_listen_limit_cmd); | |
14742 | ||
14743 | /* "bgp listen range" commands. */ | |
14744 | install_element (BGP_NODE, &bgp_listen_range_cmd); | |
14745 | install_element (BGP_NODE, &no_bgp_listen_range_cmd); | |
14746 | ||
718e3744 | 14747 | /* "neighbor remote-as" commands. */ |
14748 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
a80beece | 14749 | install_element (BGP_NODE, &neighbor_interface_config_cmd); |
4c48cf63 | 14750 | install_element (BGP_NODE, &neighbor_interface_config_v6only_cmd); |
b3a39dc5 DD |
14751 | install_element (BGP_NODE, &neighbor_interface_config_remote_as_cmd); |
14752 | install_element (BGP_NODE, &neighbor_interface_v6only_config_remote_as_cmd); | |
718e3744 | 14753 | install_element (BGP_NODE, &no_neighbor_cmd); |
a80beece | 14754 | install_element (BGP_NODE, &no_neighbor_interface_config_cmd); |
718e3744 | 14755 | |
14756 | /* "neighbor peer-group" commands. */ | |
14757 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
14758 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
a80beece | 14759 | install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd); |
718e3744 | 14760 | |
14761 | /* "neighbor local-as" commands. */ | |
14762 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
14763 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 14764 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 14765 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
718e3744 | 14766 | |
3f9c7369 DS |
14767 | /* "neighbor solo" commands. */ |
14768 | install_element (BGP_NODE, &neighbor_solo_cmd); | |
14769 | install_element (BGP_NODE, &no_neighbor_solo_cmd); | |
14770 | ||
0df7c91f PJ |
14771 | /* "neighbor password" commands. */ |
14772 | install_element (BGP_NODE, &neighbor_password_cmd); | |
14773 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
14774 | ||
718e3744 | 14775 | /* "neighbor activate" commands. */ |
14776 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
14777 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
14778 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
14779 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 14780 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 14781 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
8ecd3266 | 14782 | install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd); |
8b1fb8be LB |
14783 | install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd); |
14784 | install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd); | |
718e3744 | 14785 | |
14786 | /* "no neighbor activate" commands. */ | |
14787 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
14788 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
14789 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
14790 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 14791 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 14792 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
8ecd3266 | 14793 | install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd); |
8b1fb8be LB |
14794 | install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd); |
14795 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd); | |
718e3744 | 14796 | |
c8560b44 DW |
14797 | /* "neighbor peer-group" set commands. |
14798 | * Long term we should only accept this command under BGP_NODE and not all of | |
14799 | * the afi/safi sub-contexts. For now though we need to accept it for backwards | |
14800 | * compatibility. This changed when we stopped requiring that peers be assigned | |
14801 | * to their peer-group under each address-family sub-context. | |
14802 | */ | |
718e3744 | 14803 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
14804 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
14805 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
14806 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 14807 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 14808 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
8ecd3266 | 14809 | install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd); |
8b1fb8be LB |
14810 | install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd); |
14811 | install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd); | |
c8560b44 | 14812 | |
718e3744 | 14813 | /* "no neighbor peer-group unset" commands. */ |
14814 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
14815 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
14816 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
14817 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 14818 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 14819 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
8ecd3266 | 14820 | install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd); |
8b1fb8be LB |
14821 | install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd); |
14822 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
a58545bb | 14823 | |
718e3744 | 14824 | /* "neighbor softreconfiguration inbound" commands.*/ |
14825 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
14826 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14827 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
14828 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14829 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
14830 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14831 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
14832 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 14833 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
14834 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 14835 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
14836 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8ecd3266 | 14837 | install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd); |
14838 | install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8b1fb8be LB |
14839 | install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd); |
14840 | install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
14841 | install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
14842 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 14843 | |
14844 | /* "neighbor attribute-unchanged" commands. */ | |
14845 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
14846 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
14847 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
14848 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
14849 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
718e3744 | 14850 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); |
14851 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14852 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14853 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14854 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
718e3744 | 14855 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); |
14856 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
14857 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
14858 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
14859 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
718e3744 | 14860 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); |
14861 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14862 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14863 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14864 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
718e3744 | 14865 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); |
14866 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
14867 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
14868 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
14869 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
718e3744 | 14870 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); |
14871 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14872 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14873 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14874 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
718e3744 | 14875 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); |
14876 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14877 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14878 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14879 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
718e3744 | 14880 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
14881 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14882 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14883 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14884 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
25ffbdc1 | 14885 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
14886 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
14887 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
14888 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
14889 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
25ffbdc1 | 14890 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); |
14891 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14892 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14893 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14894 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
718e3744 | 14895 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
14896 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
14897 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
14898 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
14899 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
718e3744 | 14900 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); |
14901 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14902 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14903 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14904 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
8ecd3266 | 14905 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd); |
14906 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14907 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14908 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14909 | install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd); | |
8ecd3266 | 14910 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd); |
14911 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14912 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14913 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14914 | install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
8ecd3266 | 14915 | |
8b1fb8be LB |
14916 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd); |
14917 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd); | |
14918 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd); | |
14919 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd); | |
14920 | install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd); | |
8b1fb8be LB |
14921 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd); |
14922 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14923 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14924 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14925 | install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
8b1fb8be LB |
14926 | |
14927 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd); | |
14928 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
14929 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
14930 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
14931 | install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
8b1fb8be LB |
14932 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd); |
14933 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
14934 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
14935 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
14936 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
718e3744 | 14937 | |
fee0f4c6 | 14938 | /* "nexthop-local unchanged" commands */ |
14939 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
14940 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
14941 | ||
718e3744 | 14942 | /* "neighbor next-hop-self" commands. */ |
14943 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
14944 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
14945 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
14946 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
14947 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
14948 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
14949 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
14950 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 14951 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
14952 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 14953 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
14954 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
8ecd3266 | 14955 | install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd); |
14956 | install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd); | |
8b1fb8be LB |
14957 | install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd); |
14958 | install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd); | |
14959 | install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd); | |
14960 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 14961 | |
a538debe DS |
14962 | /* "neighbor next-hop-self force" commands. */ |
14963 | install_element (BGP_NODE, &neighbor_nexthop_self_force_cmd); | |
14964 | install_element (BGP_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14965 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd); | |
14966 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14967 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd); | |
14968 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14969 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd); | |
14970 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14971 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd); | |
14972 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
14973 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd); | |
14974 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
8ecd3266 | 14975 | install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_force_cmd); |
14976 | install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
a538debe | 14977 | |
c7122e14 DS |
14978 | /* "neighbor as-override" commands. */ |
14979 | install_element (BGP_NODE, &neighbor_as_override_cmd); | |
14980 | install_element (BGP_NODE, &no_neighbor_as_override_cmd); | |
14981 | install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd); | |
14982 | install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd); | |
14983 | install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd); | |
14984 | install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd); | |
14985 | install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd); | |
14986 | install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd); | |
14987 | install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd); | |
14988 | install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd); | |
14989 | install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd); | |
14990 | install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd); | |
8ecd3266 | 14991 | install_element (BGP_VPNV6_NODE, &neighbor_as_override_cmd); |
14992 | install_element (BGP_VPNV6_NODE, &no_neighbor_as_override_cmd); | |
c7122e14 | 14993 | |
718e3744 | 14994 | /* "neighbor remove-private-AS" commands. */ |
14995 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
14996 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
14997 | install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd); |
14998 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd); | |
14999 | install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
15000 | install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
15001 | install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
15002 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 15003 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
15004 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
15005 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd); |
15006 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
15007 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
15008 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
15009 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
15010 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 15011 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
15012 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
15013 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd); |
15014 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
15015 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
15016 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
15017 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
15018 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 15019 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
15020 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
15021 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd); |
15022 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
15023 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
15024 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
15025 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
15026 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
25ffbdc1 | 15027 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
15028 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
15029 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd); |
15030 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
15031 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
15032 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
15033 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
15034 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 15035 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
15036 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
15037 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd); |
15038 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
15039 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
15040 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
15041 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
15042 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
8ecd3266 | 15043 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd); |
15044 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd); | |
15045 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_cmd); | |
15046 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
15047 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
15048 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
15049 | install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
15050 | install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
8b1fb8be LB |
15051 | install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd); |
15052 | install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd); | |
15053 | install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd); | |
15054 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
718e3744 | 15055 | |
15056 | /* "neighbor send-community" commands.*/ | |
15057 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
15058 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
15059 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
15060 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
15061 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
15062 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
15063 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
15064 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
15065 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
15066 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
15067 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
15068 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
15069 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
15070 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
15071 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
15072 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 15073 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
15074 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
15075 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
15076 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 15077 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
15078 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
15079 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
15080 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
8ecd3266 | 15081 | install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd); |
15082 | install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd); | |
15083 | install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd); | |
15084 | install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd); | |
8b1fb8be LB |
15085 | install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd); |
15086 | install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd); | |
15087 | install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd); | |
15088 | install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd); | |
15089 | install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd); | |
15090 | install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd); | |
15091 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd); | |
15092 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 15093 | |
15094 | /* "neighbor route-reflector" commands.*/ | |
15095 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
15096 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
15097 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
15098 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
15099 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
15100 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
15101 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
15102 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 15103 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
15104 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 15105 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
15106 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
8ecd3266 | 15107 | install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd); |
15108 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
8b1fb8be LB |
15109 | install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd); |
15110 | install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd); | |
15111 | install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd); | |
15112 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 15113 | |
15114 | /* "neighbor route-server" commands.*/ | |
15115 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
15116 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
15117 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
15118 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
15119 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
15120 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
15121 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
15122 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 15123 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
15124 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 15125 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
15126 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
8ecd3266 | 15127 | install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd); |
15128 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd); | |
8b1fb8be LB |
15129 | install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd); |
15130 | install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd); | |
15131 | install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd); | |
15132 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 15133 | |
adbac85e DW |
15134 | /* "neighbor addpath-tx-all-paths" commands.*/ |
15135 | install_element (BGP_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15136 | install_element (BGP_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15137 | install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15138 | install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15139 | install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15140 | install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15141 | install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15142 | install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15143 | install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15144 | install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
15145 | install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
15146 | install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
8ecd3266 | 15147 | install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_all_paths_cmd); |
15148 | install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
adbac85e | 15149 | |
06370dac DW |
15150 | /* "neighbor addpath-tx-bestpath-per-AS" commands.*/ |
15151 | install_element (BGP_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15152 | install_element (BGP_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15153 | install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15154 | install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15155 | install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15156 | install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15157 | install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15158 | install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15159 | install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15160 | install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
15161 | install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
15162 | install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
8ecd3266 | 15163 | install_element (BGP_VPNV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); |
15164 | install_element (BGP_VPNV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
06370dac | 15165 | |
718e3744 | 15166 | /* "neighbor passive" commands. */ |
15167 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
15168 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
15169 | ||
d5a5c8f0 | 15170 | |
718e3744 | 15171 | /* "neighbor shutdown" commands. */ |
15172 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
15173 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
15174 | ||
8a92a8a0 DS |
15175 | /* "neighbor capability extended-nexthop" commands.*/ |
15176 | install_element (BGP_NODE, &neighbor_capability_enhe_cmd); | |
15177 | install_element (BGP_NODE, &no_neighbor_capability_enhe_cmd); | |
15178 | ||
718e3744 | 15179 | /* "neighbor capability orf prefix-list" commands.*/ |
15180 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
15181 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
15182 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
15183 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
15184 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
15185 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
15186 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
15187 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 15188 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
15189 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 15190 | |
15191 | /* "neighbor capability dynamic" commands.*/ | |
15192 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
15193 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
15194 | ||
15195 | /* "neighbor dont-capability-negotiate" commands. */ | |
15196 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
15197 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
15198 | ||
15199 | /* "neighbor ebgp-multihop" commands. */ | |
15200 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
15201 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
15202 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
718e3744 | 15203 | |
6ffd2079 | 15204 | /* "neighbor disable-connected-check" commands. */ |
15205 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
15206 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 15207 | |
15208 | /* "neighbor description" commands. */ | |
15209 | install_element (BGP_NODE, &neighbor_description_cmd); | |
15210 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
718e3744 | 15211 | |
15212 | /* "neighbor update-source" commands. "*/ | |
15213 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
15214 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
15215 | ||
15216 | /* "neighbor default-originate" commands. */ | |
15217 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
15218 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
15219 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
718e3744 | 15220 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); |
15221 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
15222 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
718e3744 | 15223 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); |
15224 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
15225 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
718e3744 | 15226 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); |
15227 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
15228 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
25ffbdc1 | 15229 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
15230 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
15231 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
718e3744 | 15232 | |
15233 | /* "neighbor port" commands. */ | |
15234 | install_element (BGP_NODE, &neighbor_port_cmd); | |
15235 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
718e3744 | 15236 | |
15237 | /* "neighbor weight" commands. */ | |
15238 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
15239 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
718e3744 | 15240 | |
15241 | /* "neighbor override-capability" commands. */ | |
15242 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
15243 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
15244 | ||
15245 | /* "neighbor strict-capability-match" commands. */ | |
15246 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
15247 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
15248 | ||
15249 | /* "neighbor timers" commands. */ | |
15250 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
15251 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
15252 | ||
15253 | /* "neighbor timers connect" commands. */ | |
15254 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
15255 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
718e3744 | 15256 | |
15257 | /* "neighbor advertisement-interval" commands. */ | |
15258 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
15259 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
718e3744 | 15260 | |
718e3744 | 15261 | /* "neighbor interface" commands. */ |
15262 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
15263 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
15264 | ||
15265 | /* "neighbor distribute" commands. */ | |
15266 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
15267 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
15268 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
15269 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
15270 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
15271 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
15272 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
15273 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 15274 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
15275 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 15276 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
15277 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
8ecd3266 | 15278 | install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd); |
15279 | install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd); | |
8b1fb8be LB |
15280 | install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd); |
15281 | install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd); | |
15282 | install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd); | |
15283 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 15284 | |
15285 | /* "neighbor prefix-list" commands. */ | |
15286 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
15287 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
15288 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
15289 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
15290 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
15291 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
15292 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
15293 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 15294 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
15295 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 15296 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
15297 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
8ecd3266 | 15298 | install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd); |
15299 | install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd); | |
8b1fb8be LB |
15300 | install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd); |
15301 | install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd); | |
15302 | install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd); | |
15303 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 15304 | |
15305 | /* "neighbor filter-list" commands. */ | |
15306 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
15307 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
15308 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
15309 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
15310 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
15311 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
15312 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
15313 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 15314 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
15315 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 15316 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
15317 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
8ecd3266 | 15318 | install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd); |
15319 | install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd); | |
8b1fb8be LB |
15320 | install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd); |
15321 | install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd); | |
15322 | install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd); | |
15323 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 15324 | |
15325 | /* "neighbor route-map" commands. */ | |
15326 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
15327 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
15328 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
15329 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
15330 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
15331 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
15332 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
15333 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 15334 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
15335 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 15336 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
15337 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
8ecd3266 | 15338 | install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd); |
15339 | install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd); | |
8b1fb8be LB |
15340 | install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd); |
15341 | install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd); | |
15342 | install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd); | |
15343 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 15344 | |
15345 | /* "neighbor unsuppress-map" commands. */ | |
15346 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
15347 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
15348 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
15349 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
15350 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
15351 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
15352 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
15353 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 15354 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
15355 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 15356 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
bb86c601 | 15357 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); |
8ecd3266 | 15358 | install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd); |
bb86c601 | 15359 | install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd); |
8b1fb8be LB |
15360 | install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd); |
15361 | install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd); | |
15362 | install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd); | |
15363 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 15364 | |
15365 | /* "neighbor maximum-prefix" commands. */ | |
15366 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 15367 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15368 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15369 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15370 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
15371 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15372 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
718e3744 | 15373 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15374 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15375 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15376 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15377 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
15378 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15379 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
718e3744 | 15380 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15381 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15382 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15383 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15384 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
15385 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15386 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
718e3744 | 15387 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15388 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15389 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15390 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15391 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
15392 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15393 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
25ffbdc1 | 15394 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
15395 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15396 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15397 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15398 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15399 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15400 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
718e3744 | 15401 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 15402 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 15403 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 15404 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 15405 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
15406 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 15407 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
8ecd3266 | 15408 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd); |
15409 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15410 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15411 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15412 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15413 | install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15414 | install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd); | |
718e3744 | 15415 | |
8b1fb8be LB |
15416 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd); |
15417 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15418 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15419 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15420 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15421 | install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15422 | install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd); | |
8b1fb8be LB |
15423 | |
15424 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd); | |
15425 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
15426 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd); | |
15427 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
15428 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd); | |
15429 | install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
15430 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd); | |
8b1fb8be | 15431 | |
718e3744 | 15432 | /* "neighbor allowas-in" */ |
15433 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
718e3744 | 15434 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); |
15435 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); | |
718e3744 | 15436 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); |
15437 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); | |
718e3744 | 15438 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); |
15439 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); | |
718e3744 | 15440 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); |
25ffbdc1 | 15441 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
25ffbdc1 | 15442 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); |
718e3744 | 15443 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
718e3744 | 15444 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); |
8ecd3266 | 15445 | install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd); |
8ecd3266 | 15446 | install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd); |
8b1fb8be | 15447 | install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd); |
8b1fb8be LB |
15448 | install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd); |
15449 | install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd); | |
8b1fb8be | 15450 | install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd); |
718e3744 | 15451 | |
15452 | /* address-family commands. */ | |
15453 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
15454 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
15455 | #ifdef HAVE_IPV6 | |
15456 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 15457 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 15458 | #endif /* HAVE_IPV6 */ |
15459 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
718e3744 | 15460 | |
8b1fb8be | 15461 | install_element (BGP_NODE, &address_family_vpnv6_cmd); |
8b1fb8be LB |
15462 | |
15463 | install_element (BGP_NODE, &address_family_encap_cmd); | |
8b1fb8be LB |
15464 | #ifdef HAVE_IPV6 |
15465 | install_element (BGP_NODE, &address_family_encapv6_cmd); | |
15466 | #endif | |
15467 | ||
718e3744 | 15468 | /* "exit-address-family" command. */ |
15469 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
15470 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
15471 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 15472 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 15473 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
8ecd3266 | 15474 | install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); |
8b1fb8be LB |
15475 | install_element (BGP_ENCAP_NODE, &exit_address_family_cmd); |
15476 | install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd); | |
718e3744 | 15477 | |
15478 | /* "clear ip bgp commands" */ | |
15479 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
718e3744 | 15480 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); |
15481 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); | |
15482 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); | |
15483 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); | |
f412b39a | 15484 | |
718e3744 | 15485 | |
15486 | /* "clear ip bgp neighbor soft in" */ | |
15487 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
718e3744 | 15488 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); |
718e3744 | 15489 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); |
718e3744 | 15490 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); |
15491 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
718e3744 | 15492 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); |
15493 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
718e3744 | 15494 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); |
15495 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
718e3744 | 15496 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); |
15497 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
15498 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
718e3744 | 15499 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); |
718e3744 | 15500 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); |
01080f7c | 15501 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_in_cmd); |
718e3744 | 15502 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); |
15503 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
01080f7c | 15504 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_in_cmd); |
718e3744 | 15505 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); |
15506 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
01080f7c | 15507 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_in_cmd); |
718e3744 | 15508 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); |
15509 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
01080f7c | 15510 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_in_cmd); |
718e3744 | 15511 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); |
15512 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
718e3744 | 15513 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); |
718e3744 | 15514 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); |
587ff0fd | 15515 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd); |
587ff0fd | 15516 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd); |
587ff0fd | 15517 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd); |
718e3744 | 15518 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); |
718e3744 | 15519 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); |
15520 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
718e3744 | 15521 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); |
15522 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
718e3744 | 15523 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); |
15524 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
718e3744 | 15525 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); |
15526 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
718e3744 | 15527 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); |
718e3744 | 15528 | |
8ad7271d DS |
15529 | /* clear ip bgp prefix */ |
15530 | install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); | |
15531 | install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); | |
01080f7c | 15532 | install_element (ENABLE_NODE, &clear_bgp_instance_ipv6_safi_prefix_cmd); |
8ad7271d | 15533 | |
718e3744 | 15534 | /* "clear ip bgp neighbor soft out" */ |
15535 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
718e3744 | 15536 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); |
718e3744 | 15537 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); |
718e3744 | 15538 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); |
718e3744 | 15539 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); |
718e3744 | 15540 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); |
15541 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
718e3744 | 15542 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); |
01080f7c | 15543 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_out_cmd); |
718e3744 | 15544 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); |
01080f7c | 15545 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_out_cmd); |
718e3744 | 15546 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); |
01080f7c | 15547 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_out_cmd); |
718e3744 | 15548 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); |
01080f7c | 15549 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_out_cmd); |
718e3744 | 15550 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); |
718e3744 | 15551 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); |
718e3744 | 15552 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); |
587ff0fd | 15553 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd); |
587ff0fd | 15554 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd); |
587ff0fd | 15555 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd); |
718e3744 | 15556 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); |
718e3744 | 15557 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); |
718e3744 | 15558 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); |
718e3744 | 15559 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); |
718e3744 | 15560 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); |
718e3744 | 15561 | |
15562 | /* "clear ip bgp neighbor soft" */ | |
15563 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
718e3744 | 15564 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); |
15565 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); | |
15566 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); | |
15567 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); | |
15568 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); | |
15569 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
15570 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
01080f7c | 15571 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_ipv4_soft_cmd); |
718e3744 | 15572 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); |
01080f7c | 15573 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_group_ipv4_soft_cmd); |
718e3744 | 15574 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); |
01080f7c | 15575 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_external_ipv4_soft_cmd); |
718e3744 | 15576 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); |
01080f7c | 15577 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_as_ipv4_soft_cmd); |
718e3744 | 15578 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); |
15579 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
15580 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
587ff0fd LB |
15581 | install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd); |
15582 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd); | |
15583 | install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd); | |
718e3744 | 15584 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); |
718e3744 | 15585 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); |
15586 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); | |
15587 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); | |
15588 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); | |
718e3744 | 15589 | |
15590 | /* "show ip bgp summary" commands. */ | |
15591 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15592 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15593 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15594 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15595 | install_element (VIEW_NODE, &show_bgp_updgrps_cmd); |
15596 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15597 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15598 | install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15599 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15600 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15601 | install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd); |
15602 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15603 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15604 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15605 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15606 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15607 | install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15608 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15609 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15610 | install_element (VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15611 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15612 | install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15613 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
718e3744 | 15614 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15615 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_summary_cmd); |
718e3744 | 15616 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); |
15617 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); | |
15618 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); | |
15619 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15620 | #ifdef HAVE_IPV6 | |
15621 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
15622 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15623 | install_element (VIEW_NODE, &show_bgp_instance_all_summary_cmd); |
95cbbd2a | 15624 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
95cbbd2a | 15625 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
15626 | #endif /* HAVE_IPV6 */ |
15627 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15628 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15629 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15630 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15631 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd); |
15632 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15633 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15634 | install_element (RESTRICTED_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15635 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15636 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15637 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd); |
15638 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15639 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15640 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15641 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15642 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15643 | install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15644 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15645 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15646 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15647 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15648 | install_element (RESTRICTED_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15649 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
62687ff1 | 15650 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15651 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_all_summary_cmd); |
62687ff1 PJ |
15652 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); |
15653 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); | |
15654 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); | |
15655 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15656 | #ifdef HAVE_IPV6 | |
15657 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
15658 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15659 | install_element (RESTRICTED_NODE, &show_bgp_instance_all_summary_cmd); |
95cbbd2a | 15660 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
95cbbd2a | 15661 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 15662 | #endif /* HAVE_IPV6 */ |
15663 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 | 15664 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); |
8386ac43 | 15665 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_cmd); |
f186de26 | 15666 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_updgrps_cmd); |
3f9c7369 DS |
15667 | install_element (ENABLE_NODE, &show_bgp_updgrps_cmd); |
15668 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8386ac43 | 15669 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_cmd); |
f186de26 | 15670 | install_element (ENABLE_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); |
8fe8a7f6 | 15671 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd); |
8386ac43 | 15672 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_s_cmd); |
8fe8a7f6 DS |
15673 | install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd); |
15674 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
8386ac43 | 15675 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_updgrps_s_cmd); |
3f9c7369 | 15676 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd); |
8386ac43 | 15677 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15678 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd); |
8386ac43 | 15679 | install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_cmd); |
3f9c7369 | 15680 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd); |
8fe8a7f6 | 15681 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15682 | install_element (ENABLE_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15683 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd); |
8386ac43 | 15684 | install_element (ENABLE_NODE, &show_bgp_instance_updgrps_adj_s_cmd); |
8fe8a7f6 | 15685 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd); |
718e3744 | 15686 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
f186de26 | 15687 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_summary_cmd); |
718e3744 | 15688 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); |
15689 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); | |
15690 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); | |
15691 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
15692 | #ifdef HAVE_IPV6 | |
15693 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
15694 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); | |
f186de26 | 15695 | install_element (ENABLE_NODE, &show_bgp_instance_all_summary_cmd); |
95cbbd2a | 15696 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
95cbbd2a | 15697 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 15698 | #endif /* HAVE_IPV6 */ |
15699 | ||
e3e29b32 LB |
15700 | install_element (VIEW_NODE, &show_bgp_ipv4_vpn_summary_cmd); |
15701 | install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_summary_cmd); | |
15702 | ||
15703 | install_element (VIEW_NODE, &show_bgp_ipv6_vpn_summary_cmd); | |
15704 | install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_summary_cmd); | |
15705 | ||
718e3744 | 15706 | /* "show ip bgp neighbors" commands. */ |
15707 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
718e3744 | 15708 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); |
718e3744 | 15709 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); |
f186de26 | 15710 | install_element (VIEW_NODE, &show_ip_bgp_instance_all_neighbors_cmd); |
718e3744 | 15711 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
62687ff1 | 15712 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
62687ff1 | 15713 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
718e3744 | 15714 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
718e3744 | 15715 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); |
718e3744 | 15716 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); |
f186de26 | 15717 | install_element (ENABLE_NODE, &show_ip_bgp_instance_all_neighbors_cmd); |
718e3744 | 15718 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); |
15719 | ||
15720 | #ifdef HAVE_IPV6 | |
718e3744 | 15721 | |
15722 | /* Old commands. */ | |
15723 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
15724 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
15725 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
15726 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
15727 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 15728 | |
f14e6fdb DS |
15729 | /* "show ip bgp peer-group" commands. */ |
15730 | install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); | |
15731 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
15732 | install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd); | |
15733 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
15734 | install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd); | |
15735 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
15736 | install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd); | |
15737 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
15738 | ||
718e3744 | 15739 | /* "show ip bgp paths" commands. */ |
15740 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
15741 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
15742 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
15743 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
15744 | ||
15745 | /* "show ip bgp community" commands. */ | |
15746 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
15747 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
15748 | ||
15749 | /* "show ip bgp attribute-info" commands. */ | |
15750 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
15751 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
15752 | ||
15753 | /* "redistribute" commands. */ | |
15754 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
15755 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
15756 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
718e3744 | 15757 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); |
718e3744 | 15758 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
15759 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
7c8ff89e DS |
15760 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd); |
15761 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
15762 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
7c8ff89e | 15763 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); |
7c8ff89e | 15764 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); |
7c8ff89e | 15765 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); |
919e0666 DW |
15766 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_cmd); |
15767 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_cmd); | |
15768 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
919e0666 | 15769 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_cmd); |
919e0666 DW |
15770 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); |
15771 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
919e0666 DW |
15772 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_cmd); |
15773 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
15774 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
919e0666 | 15775 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); |
919e0666 | 15776 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); |
919e0666 | 15777 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); |
718e3744 | 15778 | #ifdef HAVE_IPV6 |
15779 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
15780 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
15781 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
718e3744 | 15782 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); |
718e3744 | 15783 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); |
15784 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
718e3744 | 15785 | #endif /* HAVE_IPV6 */ |
15786 | ||
fa411a21 NH |
15787 | /* ttl_security commands */ |
15788 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
15789 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
15790 | ||
4bf6a362 PJ |
15791 | /* "show bgp memory" commands. */ |
15792 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 15793 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
15794 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
15795 | ||
e0081f70 ML |
15796 | /* "show bgp views" commands. */ |
15797 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
15798 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
15799 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
15800 | ||
8386ac43 | 15801 | /* "show bgp vrfs" commands. */ |
15802 | install_element (VIEW_NODE, &show_bgp_vrfs_cmd); | |
15803 | install_element (RESTRICTED_NODE, &show_bgp_vrfs_cmd); | |
15804 | install_element (ENABLE_NODE, &show_bgp_vrfs_cmd); | |
15805 | ||
718e3744 | 15806 | /* Community-list. */ |
15807 | community_list_vty (); | |
15808 | } | |
6b0655a2 | 15809 | |
718e3744 | 15810 | #include "memory.h" |
15811 | #include "bgp_regex.h" | |
15812 | #include "bgp_clist.h" | |
15813 | #include "bgp_ecommunity.h" | |
15814 | ||
15815 | /* VTY functions. */ | |
15816 | ||
15817 | /* Direction value to string conversion. */ | |
94f2b392 | 15818 | static const char * |
718e3744 | 15819 | community_direct_str (int direct) |
15820 | { | |
15821 | switch (direct) | |
15822 | { | |
15823 | case COMMUNITY_DENY: | |
15824 | return "deny"; | |
718e3744 | 15825 | case COMMUNITY_PERMIT: |
15826 | return "permit"; | |
718e3744 | 15827 | default: |
15828 | return "unknown"; | |
718e3744 | 15829 | } |
15830 | } | |
15831 | ||
15832 | /* Display error string. */ | |
94f2b392 | 15833 | static void |
718e3744 | 15834 | community_list_perror (struct vty *vty, int ret) |
15835 | { | |
15836 | switch (ret) | |
15837 | { | |
15838 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 15839 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 15840 | break; |
15841 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
15842 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
15843 | break; | |
15844 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
15845 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
15846 | break; | |
15847 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
15848 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
15849 | break; | |
15850 | } | |
15851 | } | |
15852 | ||
15853 | /* VTY interface for community_set() function. */ | |
94f2b392 | 15854 | static int |
fd79ac91 | 15855 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
15856 | int style, int reject_all_digit_name) | |
718e3744 | 15857 | { |
15858 | int ret; | |
15859 | int direct; | |
15860 | char *str; | |
15861 | ||
15862 | /* Check the list type. */ | |
15863 | if (strncmp (argv[1], "p", 1) == 0) | |
15864 | direct = COMMUNITY_PERMIT; | |
15865 | else if (strncmp (argv[1], "d", 1) == 0) | |
15866 | direct = COMMUNITY_DENY; | |
15867 | else | |
15868 | { | |
15869 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
15870 | VTY_NEWLINE); | |
15871 | return CMD_WARNING; | |
15872 | } | |
15873 | ||
15874 | /* All digit name check. */ | |
15875 | if (reject_all_digit_name && all_digit (argv[0])) | |
15876 | { | |
15877 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
15878 | return CMD_WARNING; | |
15879 | } | |
15880 | ||
15881 | /* Concat community string argument. */ | |
15882 | if (argc > 1) | |
15883 | str = argv_concat (argv, argc, 2); | |
15884 | else | |
15885 | str = NULL; | |
15886 | ||
15887 | /* When community_list_set() return nevetive value, it means | |
15888 | malformed community string. */ | |
15889 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
15890 | ||
15891 | /* Free temporary community list string allocated by | |
15892 | argv_concat(). */ | |
15893 | if (str) | |
15894 | XFREE (MTYPE_TMP, str); | |
15895 | ||
15896 | if (ret < 0) | |
15897 | { | |
15898 | /* Display error string. */ | |
15899 | community_list_perror (vty, ret); | |
15900 | return CMD_WARNING; | |
15901 | } | |
15902 | ||
15903 | return CMD_SUCCESS; | |
15904 | } | |
15905 | ||
718e3744 | 15906 | /* Communiyt-list entry delete. */ |
94f2b392 | 15907 | static int |
fee6e4e4 | 15908 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
813d4307 | 15909 | int style, int delete_all) |
718e3744 | 15910 | { |
15911 | int ret; | |
fee6e4e4 | 15912 | int direct = 0; |
15913 | char *str = NULL; | |
718e3744 | 15914 | |
fee6e4e4 | 15915 | if (argc > 1) |
718e3744 | 15916 | { |
fee6e4e4 | 15917 | /* Check the list direct. */ |
15918 | if (strncmp (argv[1], "p", 1) == 0) | |
15919 | direct = COMMUNITY_PERMIT; | |
15920 | else if (strncmp (argv[1], "d", 1) == 0) | |
15921 | direct = COMMUNITY_DENY; | |
15922 | else | |
15923 | { | |
15924 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
15925 | VTY_NEWLINE); | |
15926 | return CMD_WARNING; | |
15927 | } | |
718e3744 | 15928 | |
fee6e4e4 | 15929 | /* Concat community string argument. */ |
15930 | str = argv_concat (argv, argc, 2); | |
15931 | } | |
718e3744 | 15932 | |
15933 | /* Unset community list. */ | |
813d4307 | 15934 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); |
718e3744 | 15935 | |
15936 | /* Free temporary community list string allocated by | |
15937 | argv_concat(). */ | |
fee6e4e4 | 15938 | if (str) |
15939 | XFREE (MTYPE_TMP, str); | |
718e3744 | 15940 | |
15941 | if (ret < 0) | |
15942 | { | |
15943 | community_list_perror (vty, ret); | |
15944 | return CMD_WARNING; | |
15945 | } | |
15946 | ||
15947 | return CMD_SUCCESS; | |
15948 | } | |
15949 | ||
15950 | /* "community-list" keyword help string. */ | |
15951 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
718e3744 | 15952 | |
f412b39a DW |
15953 | /* |
15954 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
15955 | * "ip community-list <1-99> (deny|permit)", | |
15956 | * IP_STR | |
15957 | * COMMUNITY_LIST_STR | |
15958 | * "Community list number (standard)\n" | |
15959 | * "Specify community to reject\n" | |
15960 | * "Specify community to accept\n" | |
15961 | * | |
15962 | */ | |
718e3744 | 15963 | DEFUN (ip_community_list_standard, |
15964 | ip_community_list_standard_cmd, | |
15965 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
15966 | IP_STR | |
15967 | COMMUNITY_LIST_STR | |
15968 | "Community list number (standard)\n" | |
15969 | "Specify community to reject\n" | |
15970 | "Specify community to accept\n" | |
15971 | COMMUNITY_VAL_STR) | |
15972 | { | |
15973 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
15974 | } | |
15975 | ||
718e3744 | 15976 | |
15977 | DEFUN (ip_community_list_expanded, | |
15978 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 15979 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 15980 | IP_STR |
15981 | COMMUNITY_LIST_STR | |
15982 | "Community list number (expanded)\n" | |
15983 | "Specify community to reject\n" | |
15984 | "Specify community to accept\n" | |
15985 | "An ordered list as a regular-expression\n") | |
15986 | { | |
15987 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
15988 | } | |
15989 | ||
f412b39a DW |
15990 | /* |
15991 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
15992 | * "ip community-list standard WORD (deny|permit)", | |
15993 | * IP_STR | |
15994 | * COMMUNITY_LIST_STR | |
15995 | * "Add a standard community-list entry\n" | |
15996 | * "Community list name\n" | |
15997 | * "Specify community to reject\n" | |
15998 | * "Specify community to accept\n" | |
15999 | * | |
16000 | */ | |
718e3744 | 16001 | DEFUN (ip_community_list_name_standard, |
16002 | ip_community_list_name_standard_cmd, | |
16003 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
16004 | IP_STR | |
16005 | COMMUNITY_LIST_STR | |
16006 | "Add a standard community-list entry\n" | |
16007 | "Community list name\n" | |
16008 | "Specify community to reject\n" | |
16009 | "Specify community to accept\n" | |
16010 | COMMUNITY_VAL_STR) | |
16011 | { | |
16012 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
16013 | } | |
16014 | ||
718e3744 | 16015 | |
16016 | DEFUN (ip_community_list_name_expanded, | |
16017 | ip_community_list_name_expanded_cmd, | |
16018 | "ip community-list expanded WORD (deny|permit) .LINE", | |
16019 | IP_STR | |
16020 | COMMUNITY_LIST_STR | |
16021 | "Add an expanded community-list entry\n" | |
16022 | "Community list name\n" | |
16023 | "Specify community to reject\n" | |
16024 | "Specify community to accept\n" | |
16025 | "An ordered list as a regular-expression\n") | |
16026 | { | |
16027 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
16028 | } | |
16029 | ||
fee6e4e4 | 16030 | DEFUN (no_ip_community_list_standard_all, |
16031 | no_ip_community_list_standard_all_cmd, | |
16032 | "no ip community-list <1-99>", | |
16033 | NO_STR | |
16034 | IP_STR | |
16035 | COMMUNITY_LIST_STR | |
16036 | "Community list number (standard)\n") | |
16037 | { | |
813d4307 DW |
16038 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
16039 | } | |
16040 | ||
16041 | DEFUN (no_ip_community_list_standard_direction, | |
16042 | no_ip_community_list_standard_direction_cmd, | |
16043 | "no ip community-list <1-99> (deny|permit)", | |
16044 | NO_STR | |
16045 | IP_STR | |
16046 | COMMUNITY_LIST_STR | |
16047 | "Community list number (standard)\n" | |
16048 | "Specify community to reject\n" | |
16049 | "Specify community to accept\n") | |
16050 | { | |
16051 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
fee6e4e4 | 16052 | } |
16053 | ||
813d4307 | 16054 | |
fee6e4e4 | 16055 | DEFUN (no_ip_community_list_expanded_all, |
16056 | no_ip_community_list_expanded_all_cmd, | |
16057 | "no ip community-list <100-500>", | |
718e3744 | 16058 | NO_STR |
16059 | IP_STR | |
16060 | COMMUNITY_LIST_STR | |
718e3744 | 16061 | "Community list number (expanded)\n") |
16062 | { | |
813d4307 | 16063 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16064 | } |
16065 | ||
fee6e4e4 | 16066 | DEFUN (no_ip_community_list_name_standard_all, |
16067 | no_ip_community_list_name_standard_all_cmd, | |
16068 | "no ip community-list standard WORD", | |
718e3744 | 16069 | NO_STR |
16070 | IP_STR | |
16071 | COMMUNITY_LIST_STR | |
16072 | "Add a standard community-list entry\n" | |
718e3744 | 16073 | "Community list name\n") |
16074 | { | |
813d4307 | 16075 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
718e3744 | 16076 | } |
16077 | ||
fee6e4e4 | 16078 | DEFUN (no_ip_community_list_name_expanded_all, |
16079 | no_ip_community_list_name_expanded_all_cmd, | |
16080 | "no ip community-list expanded WORD", | |
718e3744 | 16081 | NO_STR |
16082 | IP_STR | |
16083 | COMMUNITY_LIST_STR | |
fee6e4e4 | 16084 | "Add an expanded community-list entry\n" |
16085 | "Community list name\n") | |
718e3744 | 16086 | { |
813d4307 | 16087 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16088 | } |
16089 | ||
16090 | DEFUN (no_ip_community_list_standard, | |
16091 | no_ip_community_list_standard_cmd, | |
16092 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
16093 | NO_STR | |
16094 | IP_STR | |
16095 | COMMUNITY_LIST_STR | |
16096 | "Community list number (standard)\n" | |
16097 | "Specify community to reject\n" | |
16098 | "Specify community to accept\n" | |
16099 | COMMUNITY_VAL_STR) | |
16100 | { | |
813d4307 | 16101 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
718e3744 | 16102 | } |
16103 | ||
16104 | DEFUN (no_ip_community_list_expanded, | |
16105 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 16106 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 16107 | NO_STR |
16108 | IP_STR | |
16109 | COMMUNITY_LIST_STR | |
16110 | "Community list number (expanded)\n" | |
16111 | "Specify community to reject\n" | |
16112 | "Specify community to accept\n" | |
16113 | "An ordered list as a regular-expression\n") | |
16114 | { | |
813d4307 | 16115 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16116 | } |
16117 | ||
16118 | DEFUN (no_ip_community_list_name_standard, | |
16119 | no_ip_community_list_name_standard_cmd, | |
16120 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
16121 | NO_STR | |
16122 | IP_STR | |
16123 | COMMUNITY_LIST_STR | |
16124 | "Specify a standard community-list\n" | |
16125 | "Community list name\n" | |
16126 | "Specify community to reject\n" | |
16127 | "Specify community to accept\n" | |
16128 | COMMUNITY_VAL_STR) | |
16129 | { | |
813d4307 DW |
16130 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
16131 | } | |
16132 | ||
16133 | DEFUN (no_ip_community_list_name_standard_brief, | |
16134 | no_ip_community_list_name_standard_brief_cmd, | |
16135 | "no ip community-list standard WORD (deny|permit)", | |
16136 | NO_STR | |
16137 | IP_STR | |
16138 | COMMUNITY_LIST_STR | |
16139 | "Specify a standard community-list\n" | |
16140 | "Community list name\n" | |
16141 | "Specify community to reject\n" | |
16142 | "Specify community to accept\n") | |
16143 | { | |
16144 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
718e3744 | 16145 | } |
16146 | ||
16147 | DEFUN (no_ip_community_list_name_expanded, | |
16148 | no_ip_community_list_name_expanded_cmd, | |
16149 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
16150 | NO_STR | |
16151 | IP_STR | |
16152 | COMMUNITY_LIST_STR | |
16153 | "Specify an expanded community-list\n" | |
16154 | "Community list name\n" | |
16155 | "Specify community to reject\n" | |
16156 | "Specify community to accept\n" | |
16157 | "An ordered list as a regular-expression\n") | |
16158 | { | |
813d4307 | 16159 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16160 | } |
16161 | ||
94f2b392 | 16162 | static void |
718e3744 | 16163 | community_list_show (struct vty *vty, struct community_list *list) |
16164 | { | |
16165 | struct community_entry *entry; | |
16166 | ||
16167 | for (entry = list->head; entry; entry = entry->next) | |
16168 | { | |
16169 | if (entry == list->head) | |
16170 | { | |
16171 | if (all_digit (list->name)) | |
16172 | vty_out (vty, "Community %s list %s%s", | |
16173 | entry->style == COMMUNITY_LIST_STANDARD ? | |
16174 | "standard" : "(expanded) access", | |
16175 | list->name, VTY_NEWLINE); | |
16176 | else | |
16177 | vty_out (vty, "Named Community %s list %s%s", | |
16178 | entry->style == COMMUNITY_LIST_STANDARD ? | |
16179 | "standard" : "expanded", | |
16180 | list->name, VTY_NEWLINE); | |
16181 | } | |
16182 | if (entry->any) | |
16183 | vty_out (vty, " %s%s", | |
16184 | community_direct_str (entry->direct), VTY_NEWLINE); | |
16185 | else | |
16186 | vty_out (vty, " %s %s%s", | |
16187 | community_direct_str (entry->direct), | |
16188 | entry->style == COMMUNITY_LIST_STANDARD | |
16189 | ? community_str (entry->u.com) : entry->config, | |
16190 | VTY_NEWLINE); | |
16191 | } | |
16192 | } | |
16193 | ||
16194 | DEFUN (show_ip_community_list, | |
16195 | show_ip_community_list_cmd, | |
16196 | "show ip community-list", | |
16197 | SHOW_STR | |
16198 | IP_STR | |
16199 | "List community-list\n") | |
16200 | { | |
16201 | struct community_list *list; | |
16202 | struct community_list_master *cm; | |
16203 | ||
fee6e4e4 | 16204 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 16205 | if (! cm) |
16206 | return CMD_SUCCESS; | |
16207 | ||
16208 | for (list = cm->num.head; list; list = list->next) | |
16209 | community_list_show (vty, list); | |
16210 | ||
16211 | for (list = cm->str.head; list; list = list->next) | |
16212 | community_list_show (vty, list); | |
16213 | ||
16214 | return CMD_SUCCESS; | |
16215 | } | |
16216 | ||
16217 | DEFUN (show_ip_community_list_arg, | |
16218 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 16219 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 16220 | SHOW_STR |
16221 | IP_STR | |
16222 | "List community-list\n" | |
16223 | "Community-list number\n" | |
16224 | "Community-list name\n") | |
16225 | { | |
16226 | struct community_list *list; | |
16227 | ||
afec25d9 | 16228 | list = community_list_lookup (bgp_clist, argv[3]->arg, COMMUNITY_LIST_MASTER); |
718e3744 | 16229 | if (! list) |
16230 | { | |
b729294c | 16231 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 16232 | return CMD_WARNING; |
16233 | } | |
16234 | ||
16235 | community_list_show (vty, list); | |
16236 | ||
16237 | return CMD_SUCCESS; | |
16238 | } | |
6b0655a2 | 16239 | |
94f2b392 | 16240 | static int |
afec25d9 | 16241 | extcommunity_list_set_vty (struct vty *vty, int argc, struct cmd_token **argv, |
fd79ac91 | 16242 | int style, int reject_all_digit_name) |
718e3744 | 16243 | { |
16244 | int ret; | |
16245 | int direct; | |
16246 | char *str; | |
16247 | ||
16248 | /* Check the list type. */ | |
16249 | if (strncmp (argv[1], "p", 1) == 0) | |
16250 | direct = COMMUNITY_PERMIT; | |
16251 | else if (strncmp (argv[1], "d", 1) == 0) | |
16252 | direct = COMMUNITY_DENY; | |
16253 | else | |
16254 | { | |
16255 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16256 | VTY_NEWLINE); | |
16257 | return CMD_WARNING; | |
16258 | } | |
16259 | ||
16260 | /* All digit name check. */ | |
16261 | if (reject_all_digit_name && all_digit (argv[0])) | |
16262 | { | |
16263 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
16264 | return CMD_WARNING; | |
16265 | } | |
16266 | ||
16267 | /* Concat community string argument. */ | |
16268 | if (argc > 1) | |
16269 | str = argv_concat (argv, argc, 2); | |
16270 | else | |
16271 | str = NULL; | |
16272 | ||
16273 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
16274 | ||
16275 | /* Free temporary community list string allocated by | |
16276 | argv_concat(). */ | |
16277 | if (str) | |
16278 | XFREE (MTYPE_TMP, str); | |
16279 | ||
16280 | if (ret < 0) | |
16281 | { | |
16282 | community_list_perror (vty, ret); | |
16283 | return CMD_WARNING; | |
16284 | } | |
16285 | return CMD_SUCCESS; | |
16286 | } | |
16287 | ||
94f2b392 | 16288 | static int |
afec25d9 | 16289 | extcommunity_list_unset_vty (struct vty *vty, int argc, struct cmd_token **argv, |
813d4307 | 16290 | int style, int delete_all) |
718e3744 | 16291 | { |
16292 | int ret; | |
fee6e4e4 | 16293 | int direct = 0; |
16294 | char *str = NULL; | |
718e3744 | 16295 | |
fee6e4e4 | 16296 | if (argc > 1) |
718e3744 | 16297 | { |
fee6e4e4 | 16298 | /* Check the list direct. */ |
16299 | if (strncmp (argv[1], "p", 1) == 0) | |
16300 | direct = COMMUNITY_PERMIT; | |
16301 | else if (strncmp (argv[1], "d", 1) == 0) | |
16302 | direct = COMMUNITY_DENY; | |
16303 | else | |
16304 | { | |
16305 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
16306 | VTY_NEWLINE); | |
16307 | return CMD_WARNING; | |
16308 | } | |
718e3744 | 16309 | |
fee6e4e4 | 16310 | /* Concat community string argument. */ |
16311 | str = argv_concat (argv, argc, 2); | |
718e3744 | 16312 | } |
16313 | ||
718e3744 | 16314 | /* Unset community list. */ |
813d4307 | 16315 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); |
718e3744 | 16316 | |
16317 | /* Free temporary community list string allocated by | |
16318 | argv_concat(). */ | |
fee6e4e4 | 16319 | if (str) |
16320 | XFREE (MTYPE_TMP, str); | |
718e3744 | 16321 | |
16322 | if (ret < 0) | |
16323 | { | |
16324 | community_list_perror (vty, ret); | |
16325 | return CMD_WARNING; | |
16326 | } | |
16327 | ||
16328 | return CMD_SUCCESS; | |
16329 | } | |
16330 | ||
16331 | /* "extcommunity-list" keyword help string. */ | |
16332 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
16333 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
16334 | ||
f412b39a DW |
16335 | /* |
16336 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
16337 | * "ip extcommunity-list <1-99> (deny|permit)", | |
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 | */ | |
718e3744 | 16345 | DEFUN (ip_extcommunity_list_standard, |
16346 | ip_extcommunity_list_standard_cmd, | |
16347 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
16348 | IP_STR | |
16349 | EXTCOMMUNITY_LIST_STR | |
16350 | "Extended Community list number (standard)\n" | |
16351 | "Specify community to reject\n" | |
16352 | "Specify community to accept\n" | |
16353 | EXTCOMMUNITY_VAL_STR) | |
16354 | { | |
16355 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
16356 | } | |
16357 | ||
718e3744 | 16358 | |
16359 | DEFUN (ip_extcommunity_list_expanded, | |
16360 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 16361 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 16362 | IP_STR |
16363 | EXTCOMMUNITY_LIST_STR | |
16364 | "Extended Community list number (expanded)\n" | |
16365 | "Specify community to reject\n" | |
16366 | "Specify community to accept\n" | |
16367 | "An ordered list as a regular-expression\n") | |
16368 | { | |
16369 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
16370 | } | |
16371 | ||
f412b39a DW |
16372 | /* |
16373 | * CHECK ME - The following ALIASes need to be implemented in this DEFUN | |
16374 | * "ip extcommunity-list standard WORD (deny|permit)", | |
16375 | * IP_STR | |
16376 | * EXTCOMMUNITY_LIST_STR | |
16377 | * "Specify standard extcommunity-list\n" | |
16378 | * "Extended Community list name\n" | |
16379 | * "Specify community to reject\n" | |
16380 | * "Specify community to accept\n" | |
16381 | * | |
16382 | */ | |
718e3744 | 16383 | DEFUN (ip_extcommunity_list_name_standard, |
16384 | ip_extcommunity_list_name_standard_cmd, | |
16385 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
16386 | IP_STR | |
16387 | EXTCOMMUNITY_LIST_STR | |
16388 | "Specify standard extcommunity-list\n" | |
16389 | "Extended Community list name\n" | |
16390 | "Specify community to reject\n" | |
16391 | "Specify community to accept\n" | |
16392 | EXTCOMMUNITY_VAL_STR) | |
16393 | { | |
16394 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
16395 | } | |
16396 | ||
718e3744 | 16397 | |
16398 | DEFUN (ip_extcommunity_list_name_expanded, | |
16399 | ip_extcommunity_list_name_expanded_cmd, | |
16400 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
16401 | IP_STR | |
16402 | EXTCOMMUNITY_LIST_STR | |
16403 | "Specify expanded extcommunity-list\n" | |
16404 | "Extended Community list name\n" | |
16405 | "Specify community to reject\n" | |
16406 | "Specify community to accept\n" | |
16407 | "An ordered list as a regular-expression\n") | |
16408 | { | |
16409 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
16410 | } | |
16411 | ||
fee6e4e4 | 16412 | DEFUN (no_ip_extcommunity_list_standard_all, |
16413 | no_ip_extcommunity_list_standard_all_cmd, | |
16414 | "no ip extcommunity-list <1-99>", | |
16415 | NO_STR | |
16416 | IP_STR | |
16417 | EXTCOMMUNITY_LIST_STR | |
16418 | "Extended Community list number (standard)\n") | |
16419 | { | |
813d4307 DW |
16420 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
16421 | } | |
16422 | ||
16423 | DEFUN (no_ip_extcommunity_list_standard_direction, | |
16424 | no_ip_extcommunity_list_standard_direction_cmd, | |
16425 | "no ip extcommunity-list <1-99> (deny|permit)", | |
16426 | NO_STR | |
16427 | IP_STR | |
16428 | EXTCOMMUNITY_LIST_STR | |
16429 | "Extended Community list number (standard)\n" | |
16430 | "Specify community to reject\n" | |
16431 | "Specify community to accept\n") | |
16432 | { | |
16433 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
fee6e4e4 | 16434 | } |
16435 | ||
16436 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
16437 | no_ip_extcommunity_list_expanded_all_cmd, | |
16438 | "no ip extcommunity-list <100-500>", | |
718e3744 | 16439 | NO_STR |
16440 | IP_STR | |
16441 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 16442 | "Extended Community list number (expanded)\n") |
16443 | { | |
813d4307 | 16444 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16445 | } |
16446 | ||
fee6e4e4 | 16447 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
16448 | no_ip_extcommunity_list_name_standard_all_cmd, | |
16449 | "no ip extcommunity-list standard WORD", | |
718e3744 | 16450 | NO_STR |
16451 | IP_STR | |
16452 | EXTCOMMUNITY_LIST_STR | |
16453 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 16454 | "Extended Community list name\n") |
16455 | { | |
813d4307 | 16456 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
fee6e4e4 | 16457 | } |
16458 | ||
16459 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
16460 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
16461 | "no ip extcommunity-list expanded WORD", | |
16462 | NO_STR | |
16463 | IP_STR | |
16464 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 16465 | "Specify expanded extcommunity-list\n" |
16466 | "Extended Community list name\n") | |
16467 | { | |
813d4307 | 16468 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 16469 | } |
16470 | ||
16471 | DEFUN (no_ip_extcommunity_list_standard, | |
16472 | no_ip_extcommunity_list_standard_cmd, | |
16473 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
16474 | NO_STR | |
16475 | IP_STR | |
16476 | EXTCOMMUNITY_LIST_STR | |
16477 | "Extended Community list number (standard)\n" | |
16478 | "Specify community to reject\n" | |
16479 | "Specify community to accept\n" | |
16480 | EXTCOMMUNITY_VAL_STR) | |
16481 | { | |
813d4307 | 16482 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
718e3744 | 16483 | } |
16484 | ||
16485 | DEFUN (no_ip_extcommunity_list_expanded, | |
16486 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 16487 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 16488 | NO_STR |
16489 | IP_STR | |
16490 | EXTCOMMUNITY_LIST_STR | |
16491 | "Extended Community list number (expanded)\n" | |
16492 | "Specify community to reject\n" | |
16493 | "Specify community to accept\n" | |
16494 | "An ordered list as a regular-expression\n") | |
16495 | { | |
813d4307 | 16496 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16497 | } |
16498 | ||
16499 | DEFUN (no_ip_extcommunity_list_name_standard, | |
16500 | no_ip_extcommunity_list_name_standard_cmd, | |
16501 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
16502 | NO_STR | |
16503 | IP_STR | |
16504 | EXTCOMMUNITY_LIST_STR | |
16505 | "Specify standard extcommunity-list\n" | |
16506 | "Extended Community list name\n" | |
16507 | "Specify community to reject\n" | |
16508 | "Specify community to accept\n" | |
16509 | EXTCOMMUNITY_VAL_STR) | |
16510 | { | |
813d4307 DW |
16511 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
16512 | } | |
16513 | ||
16514 | DEFUN (no_ip_extcommunity_list_name_standard_brief, | |
16515 | no_ip_extcommunity_list_name_standard_brief_cmd, | |
16516 | "no ip extcommunity-list standard WORD (deny|permit)", | |
16517 | NO_STR | |
16518 | IP_STR | |
16519 | EXTCOMMUNITY_LIST_STR | |
16520 | "Specify standard extcommunity-list\n" | |
16521 | "Extended Community list name\n" | |
16522 | "Specify community to reject\n" | |
16523 | "Specify community to accept\n") | |
16524 | { | |
16525 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
718e3744 | 16526 | } |
16527 | ||
16528 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
16529 | no_ip_extcommunity_list_name_expanded_cmd, | |
16530 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
16531 | NO_STR | |
16532 | IP_STR | |
16533 | EXTCOMMUNITY_LIST_STR | |
16534 | "Specify expanded extcommunity-list\n" | |
16535 | "Community list name\n" | |
16536 | "Specify community to reject\n" | |
16537 | "Specify community to accept\n" | |
16538 | "An ordered list as a regular-expression\n") | |
16539 | { | |
813d4307 | 16540 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 16541 | } |
16542 | ||
94f2b392 | 16543 | static void |
718e3744 | 16544 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
16545 | { | |
16546 | struct community_entry *entry; | |
16547 | ||
16548 | for (entry = list->head; entry; entry = entry->next) | |
16549 | { | |
16550 | if (entry == list->head) | |
16551 | { | |
16552 | if (all_digit (list->name)) | |
16553 | vty_out (vty, "Extended community %s list %s%s", | |
16554 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16555 | "standard" : "(expanded) access", | |
16556 | list->name, VTY_NEWLINE); | |
16557 | else | |
16558 | vty_out (vty, "Named extended community %s list %s%s", | |
16559 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16560 | "standard" : "expanded", | |
16561 | list->name, VTY_NEWLINE); | |
16562 | } | |
16563 | if (entry->any) | |
16564 | vty_out (vty, " %s%s", | |
16565 | community_direct_str (entry->direct), VTY_NEWLINE); | |
16566 | else | |
16567 | vty_out (vty, " %s %s%s", | |
16568 | community_direct_str (entry->direct), | |
16569 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
16570 | entry->u.ecom->str : entry->config, | |
16571 | VTY_NEWLINE); | |
16572 | } | |
16573 | } | |
16574 | ||
16575 | DEFUN (show_ip_extcommunity_list, | |
16576 | show_ip_extcommunity_list_cmd, | |
16577 | "show ip extcommunity-list", | |
16578 | SHOW_STR | |
16579 | IP_STR | |
16580 | "List extended-community list\n") | |
16581 | { | |
16582 | struct community_list *list; | |
16583 | struct community_list_master *cm; | |
16584 | ||
fee6e4e4 | 16585 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16586 | if (! cm) |
16587 | return CMD_SUCCESS; | |
16588 | ||
16589 | for (list = cm->num.head; list; list = list->next) | |
16590 | extcommunity_list_show (vty, list); | |
16591 | ||
16592 | for (list = cm->str.head; list; list = list->next) | |
16593 | extcommunity_list_show (vty, list); | |
16594 | ||
16595 | return CMD_SUCCESS; | |
16596 | } | |
16597 | ||
16598 | DEFUN (show_ip_extcommunity_list_arg, | |
16599 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 16600 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 16601 | SHOW_STR |
16602 | IP_STR | |
16603 | "List extended-community list\n" | |
16604 | "Extcommunity-list number\n" | |
16605 | "Extcommunity-list name\n") | |
16606 | { | |
16607 | struct community_list *list; | |
16608 | ||
afec25d9 | 16609 | list = community_list_lookup (bgp_clist, argv[3]->arg, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16610 | if (! list) |
16611 | { | |
b729294c | 16612 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 16613 | return CMD_WARNING; |
16614 | } | |
16615 | ||
16616 | extcommunity_list_show (vty, list); | |
16617 | ||
16618 | return CMD_SUCCESS; | |
16619 | } | |
6b0655a2 | 16620 | |
718e3744 | 16621 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 16622 | static const char * |
718e3744 | 16623 | community_list_config_str (struct community_entry *entry) |
16624 | { | |
fd79ac91 | 16625 | const char *str; |
718e3744 | 16626 | |
16627 | if (entry->any) | |
16628 | str = ""; | |
16629 | else | |
16630 | { | |
16631 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
16632 | str = community_str (entry->u.com); | |
16633 | else | |
16634 | str = entry->config; | |
16635 | } | |
16636 | return str; | |
16637 | } | |
16638 | ||
16639 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 16640 | static int |
718e3744 | 16641 | community_list_config_write (struct vty *vty) |
16642 | { | |
16643 | struct community_list *list; | |
16644 | struct community_entry *entry; | |
16645 | struct community_list_master *cm; | |
16646 | int write = 0; | |
16647 | ||
16648 | /* Community-list. */ | |
fee6e4e4 | 16649 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 16650 | |
16651 | for (list = cm->num.head; list; list = list->next) | |
16652 | for (entry = list->head; entry; entry = entry->next) | |
16653 | { | |
fee6e4e4 | 16654 | vty_out (vty, "ip community-list %s %s %s%s", |
16655 | list->name, community_direct_str (entry->direct), | |
16656 | community_list_config_str (entry), | |
16657 | VTY_NEWLINE); | |
718e3744 | 16658 | write++; |
16659 | } | |
16660 | for (list = cm->str.head; list; list = list->next) | |
16661 | for (entry = list->head; entry; entry = entry->next) | |
16662 | { | |
16663 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
16664 | entry->style == COMMUNITY_LIST_STANDARD | |
16665 | ? "standard" : "expanded", | |
16666 | list->name, community_direct_str (entry->direct), | |
16667 | community_list_config_str (entry), | |
16668 | VTY_NEWLINE); | |
16669 | write++; | |
16670 | } | |
16671 | ||
16672 | /* Extcommunity-list. */ | |
fee6e4e4 | 16673 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 16674 | |
16675 | for (list = cm->num.head; list; list = list->next) | |
16676 | for (entry = list->head; entry; entry = entry->next) | |
16677 | { | |
fee6e4e4 | 16678 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
16679 | list->name, community_direct_str (entry->direct), | |
16680 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 16681 | write++; |
16682 | } | |
16683 | for (list = cm->str.head; list; list = list->next) | |
16684 | for (entry = list->head; entry; entry = entry->next) | |
16685 | { | |
16686 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
16687 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
16688 | ? "standard" : "expanded", | |
16689 | list->name, community_direct_str (entry->direct), | |
16690 | community_list_config_str (entry), VTY_NEWLINE); | |
16691 | write++; | |
16692 | } | |
16693 | return write; | |
16694 | } | |
16695 | ||
7fc626de | 16696 | static struct cmd_node community_list_node = |
718e3744 | 16697 | { |
16698 | COMMUNITY_LIST_NODE, | |
16699 | "", | |
16700 | 1 /* Export to vtysh. */ | |
16701 | }; | |
16702 | ||
94f2b392 | 16703 | static void |
16704 | community_list_vty (void) | |
718e3744 | 16705 | { |
16706 | install_node (&community_list_node, community_list_config_write); | |
16707 | ||
16708 | /* Community-list. */ | |
718e3744 | 16709 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
718e3744 | 16710 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); |
16711 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
718e3744 | 16712 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); |
fee6e4e4 | 16713 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
813d4307 | 16714 | install_element (CONFIG_NODE, &no_ip_community_list_standard_direction_cmd); |
fee6e4e4 | 16715 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
16716 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
16717 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 16718 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
16719 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
16720 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
813d4307 | 16721 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_brief_cmd); |
718e3744 | 16722 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
16723 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
16724 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
16725 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
16726 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
16727 | ||
16728 | /* Extcommunity-list. */ | |
16729 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
718e3744 | 16730 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); |
16731 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
718e3744 | 16732 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); |
fee6e4e4 | 16733 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
813d4307 | 16734 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_direction_cmd); |
fee6e4e4 | 16735 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
16736 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
16737 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 16738 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
16739 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
16740 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
813d4307 | 16741 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_brief_cmd); |
718e3744 | 16742 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
16743 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
16744 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
16745 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
16746 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
16747 | } |