]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* BGP VTY interface. |
2 | Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro | |
3 | ||
4 | This file is part of GNU Zebra. | |
5 | ||
6 | GNU Zebra is free software; you can redistribute it and/or modify it | |
7 | under the terms of the GNU General Public License as published by the | |
8 | Free Software Foundation; either version 2, or (at your option) any | |
9 | later version. | |
10 | ||
11 | GNU Zebra is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU Zebra; see the file COPYING. If not, write to the Free | |
18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
20 | ||
21 | #include <zebra.h> | |
22 | ||
856ca177 | 23 | #include "lib/json.h" |
718e3744 | 24 | #include "command.h" |
25 | #include "prefix.h" | |
26 | #include "plist.h" | |
27 | #include "buffer.h" | |
28 | #include "linklist.h" | |
29 | #include "stream.h" | |
30 | #include "thread.h" | |
31 | #include "log.h" | |
3b8b1855 | 32 | #include "memory.h" |
4bf6a362 | 33 | #include "hash.h" |
3f9c7369 | 34 | #include "queue.h" |
718e3744 | 35 | |
36 | #include "bgpd/bgpd.h" | |
4bf6a362 | 37 | #include "bgpd/bgp_advertise.h" |
718e3744 | 38 | #include "bgpd/bgp_attr.h" |
39 | #include "bgpd/bgp_aspath.h" | |
40 | #include "bgpd/bgp_community.h" | |
4bf6a362 PJ |
41 | #include "bgpd/bgp_ecommunity.h" |
42 | #include "bgpd/bgp_damp.h" | |
718e3744 | 43 | #include "bgpd/bgp_debug.h" |
e0701b79 | 44 | #include "bgpd/bgp_fsm.h" |
718e3744 | 45 | #include "bgpd/bgp_mplsvpn.h" |
4bf6a362 | 46 | #include "bgpd/bgp_nexthop.h" |
718e3744 | 47 | #include "bgpd/bgp_open.h" |
4bf6a362 | 48 | #include "bgpd/bgp_regex.h" |
718e3744 | 49 | #include "bgpd/bgp_route.h" |
50 | #include "bgpd/bgp_zebra.h" | |
fee0f4c6 | 51 | #include "bgpd/bgp_table.h" |
94f2b392 | 52 | #include "bgpd/bgp_vty.h" |
165b5fff | 53 | #include "bgpd/bgp_mpath.h" |
cb1faec9 | 54 | #include "bgpd/bgp_packet.h" |
3f9c7369 | 55 | #include "bgpd/bgp_updgrp.h" |
c43ed2e4 | 56 | #include "bgpd/bgp_bfd.h" |
718e3744 | 57 | |
18a6dce6 | 58 | extern struct in_addr router_id_zebra; |
59 | ||
718e3744 | 60 | /* Utility function to get address family from current node. */ |
61 | afi_t | |
62 | bgp_node_afi (struct vty *vty) | |
63 | { | |
25ffbdc1 | 64 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 65 | return AFI_IP6; |
66 | return AFI_IP; | |
67 | } | |
68 | ||
69 | /* Utility function to get subsequent address family from current | |
70 | node. */ | |
71 | safi_t | |
72 | bgp_node_safi (struct vty *vty) | |
73 | { | |
74 | if (vty->node == BGP_VPNV4_NODE) | |
75 | return SAFI_MPLS_VPN; | |
25ffbdc1 | 76 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 77 | return SAFI_MULTICAST; |
78 | return SAFI_UNICAST; | |
79 | } | |
80 | ||
94f2b392 | 81 | static int |
718e3744 | 82 | peer_address_self_check (union sockunion *su) |
83 | { | |
84 | struct interface *ifp = NULL; | |
85 | ||
86 | if (su->sa.sa_family == AF_INET) | |
87 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); | |
88 | #ifdef HAVE_IPV6 | |
89 | else if (su->sa.sa_family == AF_INET6) | |
f2345335 DS |
90 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr, |
91 | su->sin6.sin6_scope_id); | |
718e3744 | 92 | #endif /* HAVE IPV6 */ |
93 | ||
94 | if (ifp) | |
95 | return 1; | |
96 | ||
97 | return 0; | |
98 | } | |
99 | ||
100 | /* Utility function for looking up peer from VTY. */ | |
f14e6fdb DS |
101 | /* This is used only for configuration, so disallow if attempted on |
102 | * a dynamic neighbor. | |
103 | */ | |
94f2b392 | 104 | static struct peer * |
fd79ac91 | 105 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 106 | { |
107 | int ret; | |
108 | struct bgp *bgp; | |
109 | union sockunion su; | |
110 | struct peer *peer; | |
111 | ||
112 | bgp = vty->index; | |
113 | ||
114 | ret = str2sockunion (ip_str, &su); | |
115 | if (ret < 0) | |
116 | { | |
a80beece DS |
117 | peer = peer_lookup_by_conf_if (bgp, ip_str); |
118 | if (!peer) | |
119 | { | |
c744aa9f DS |
120 | vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE); |
121 | return NULL; | |
a80beece | 122 | } |
718e3744 | 123 | } |
a80beece | 124 | else |
718e3744 | 125 | { |
a80beece DS |
126 | peer = peer_lookup (bgp, &su); |
127 | if (! peer) | |
128 | { | |
129 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
130 | VTY_NEWLINE); | |
131 | return NULL; | |
132 | } | |
f14e6fdb DS |
133 | if (peer_dynamic_neighbor (peer)) |
134 | { | |
135 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
136 | VTY_NEWLINE); | |
137 | return NULL; | |
138 | } | |
139 | ||
718e3744 | 140 | } |
141 | return peer; | |
142 | } | |
143 | ||
144 | /* Utility function for looking up peer or peer group. */ | |
f14e6fdb DS |
145 | /* This is used only for configuration, so disallow if attempted on |
146 | * a dynamic neighbor. | |
147 | */ | |
c43ed2e4 | 148 | struct peer * |
fd79ac91 | 149 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 150 | { |
151 | int ret; | |
152 | struct bgp *bgp; | |
153 | union sockunion su; | |
f14e6fdb DS |
154 | struct peer *peer = NULL; |
155 | struct peer_group *group = NULL; | |
718e3744 | 156 | |
157 | bgp = vty->index; | |
158 | ||
159 | ret = str2sockunion (peer_str, &su); | |
160 | if (ret == 0) | |
161 | { | |
f14e6fdb | 162 | /* IP address, locate peer. */ |
718e3744 | 163 | peer = peer_lookup (bgp, &su); |
718e3744 | 164 | } |
165 | else | |
166 | { | |
f14e6fdb | 167 | /* Not IP, could match either peer configured on interface or a group. */ |
a80beece | 168 | peer = peer_lookup_by_conf_if (bgp, peer_str); |
f14e6fdb DS |
169 | if (!peer) |
170 | group = peer_group_lookup (bgp, peer_str); | |
171 | } | |
a80beece | 172 | |
f14e6fdb DS |
173 | if (peer) |
174 | { | |
175 | if (peer_dynamic_neighbor (peer)) | |
176 | { | |
177 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
178 | VTY_NEWLINE); | |
179 | return NULL; | |
180 | } | |
181 | ||
182 | return peer; | |
718e3744 | 183 | } |
184 | ||
f14e6fdb DS |
185 | if (group) |
186 | return group->conf; | |
187 | ||
718e3744 | 188 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
189 | VTY_NEWLINE); | |
190 | ||
191 | return NULL; | |
192 | } | |
193 | ||
c43ed2e4 | 194 | int |
718e3744 | 195 | bgp_vty_return (struct vty *vty, int ret) |
196 | { | |
fd79ac91 | 197 | const char *str = NULL; |
718e3744 | 198 | |
199 | switch (ret) | |
200 | { | |
201 | case BGP_ERR_INVALID_VALUE: | |
202 | str = "Invalid value"; | |
203 | break; | |
204 | case BGP_ERR_INVALID_FLAG: | |
205 | str = "Invalid flag"; | |
206 | break; | |
207 | case BGP_ERR_PEER_INACTIVE: | |
208 | str = "Activate the neighbor for the address family first"; | |
209 | break; | |
210 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: | |
211 | str = "Invalid command for a peer-group member"; | |
212 | break; | |
213 | case BGP_ERR_PEER_GROUP_SHUTDOWN: | |
214 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
215 | break; | |
216 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: | |
217 | str = "This peer is a peer-group member. Please change peer-group configuration"; | |
218 | break; | |
219 | case BGP_ERR_PEER_FLAG_CONFLICT: | |
220 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
221 | break; | |
222 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: | |
223 | str = "No activate for peergroup can be given only if peer-group has no members"; | |
224 | break; | |
225 | case BGP_ERR_PEER_BELONGS_TO_GROUP: | |
226 | str = "No activate for an individual peer-group member is invalid"; | |
227 | break; | |
228 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: | |
229 | str = "Activate the peer-group for the address family first"; | |
230 | break; | |
231 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: | |
232 | str = "Specify remote-as or peer-group remote AS first"; | |
233 | break; | |
234 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
235 | str = "Cannot change the peer-group. Deconfigure first"; | |
236 | break; | |
237 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
238 | str = "Cannot have different peer-group for the neighbor"; | |
239 | break; | |
240 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
241 | str = "Prefix/distribute list can not co-exist"; | |
242 | break; | |
243 | case BGP_ERR_NOT_INTERNAL_PEER: | |
244 | str = "Invalid command. Not an internal neighbor"; | |
245 | break; | |
246 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
5000f21c | 247 | str = "remove-private-AS cannot be configured for IBGP peers"; |
718e3744 | 248 | break; |
249 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
250 | str = "Local-AS allowed only for EBGP peers"; | |
251 | break; | |
252 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
253 | str = "Cannot have local-as same as BGP AS number"; | |
254 | break; | |
0df7c91f PJ |
255 | case BGP_ERR_TCPSIG_FAILED: |
256 | str = "Error while applying TCP-Sig to session(s)"; | |
257 | break; | |
fa411a21 NH |
258 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
259 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
260 | break; | |
f5a4827d SH |
261 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
262 | str = "ttl-security only allowed for EBGP peers"; | |
263 | break; | |
c7122e14 DS |
264 | case BGP_ERR_AS_OVERRIDE: |
265 | str = "as-override cannot be configured for IBGP peers"; | |
266 | break; | |
f14e6fdb DS |
267 | case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT: |
268 | str = "Invalid limit for number of dynamic neighbors"; | |
269 | break; | |
270 | case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS: | |
271 | str = "Dynamic neighbor listen range already exists"; | |
272 | break; | |
273 | case BGP_ERR_INVALID_FOR_DYNAMIC_PEER: | |
274 | str = "Operation not allowed on a dynamic neighbor"; | |
275 | break; | |
718e3744 | 276 | } |
277 | if (str) | |
278 | { | |
279 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
280 | return CMD_WARNING; | |
281 | } | |
282 | return CMD_SUCCESS; | |
283 | } | |
284 | ||
7aafcaca DS |
285 | /* BGP clear sort. */ |
286 | enum clear_sort | |
287 | { | |
288 | clear_all, | |
289 | clear_peer, | |
290 | clear_group, | |
291 | clear_external, | |
292 | clear_as | |
293 | }; | |
294 | ||
295 | /* Force a bestpath recalculation for all prefixes. This is used | |
296 | * when 'bgp bestpath' commands are entered. | |
297 | */ | |
298 | static void | |
299 | bgp_recalculate_all_bestpaths (struct bgp *bgp) | |
300 | { | |
301 | afi_t afi; | |
302 | safi_t safi; | |
303 | struct bgp_node *rn; | |
304 | ||
305 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
306 | { | |
307 | for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) | |
308 | { | |
309 | for (rn = bgp_table_top (bgp->rib[afi][safi]); rn; rn = bgp_route_next (rn)) | |
310 | { | |
311 | bgp_process (bgp, rn, afi, safi); | |
312 | } | |
313 | } | |
314 | } | |
315 | } | |
316 | ||
317 | static void | |
318 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, | |
319 | safi_t safi, int error) | |
320 | { | |
321 | switch (error) | |
322 | { | |
323 | case BGP_ERR_AF_UNCONFIGURED: | |
324 | vty_out (vty, | |
325 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
326 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
327 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
328 | peer->host, VTY_NEWLINE); | |
329 | break; | |
330 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
331 | 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); | |
332 | break; | |
333 | default: | |
334 | break; | |
335 | } | |
336 | } | |
337 | ||
338 | /* `clear ip bgp' functions. */ | |
339 | static int | |
340 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, | |
341 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) | |
342 | { | |
343 | int ret; | |
344 | struct peer *peer; | |
345 | struct listnode *node, *nnode; | |
346 | ||
347 | /* Clear all neighbors. */ | |
348 | /* | |
349 | * Pass along pointer to next node to peer_clear() when walking all nodes | |
350 | * on the BGP instance as that may get freed if it is a doppelganger | |
351 | */ | |
352 | if (sort == clear_all) | |
353 | { | |
354 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
355 | { | |
356 | if (stype == BGP_CLEAR_SOFT_NONE) | |
357 | ret = peer_clear (peer, &nnode); | |
358 | else if (peer->afc[afi][safi]) | |
359 | ret = peer_clear_soft (peer, afi, safi, stype); | |
360 | else | |
361 | ret = 0; | |
362 | ||
363 | if (ret < 0) | |
364 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
365 | } | |
366 | ||
367 | /* This is to apply read-only mode on this clear. */ | |
368 | if (stype == BGP_CLEAR_SOFT_NONE) | |
369 | bgp->update_delay_over = 0; | |
370 | ||
371 | return CMD_SUCCESS; | |
372 | } | |
373 | ||
374 | /* Clear specified neighbors. */ | |
375 | if (sort == clear_peer) | |
376 | { | |
377 | union sockunion su; | |
378 | int ret; | |
379 | ||
380 | /* Make sockunion for lookup. */ | |
381 | ret = str2sockunion (arg, &su); | |
382 | if (ret < 0) | |
383 | { | |
384 | peer = peer_lookup_by_conf_if (bgp, arg); | |
385 | if (!peer) | |
386 | { | |
c744aa9f DS |
387 | vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE); |
388 | return CMD_WARNING; | |
7aafcaca DS |
389 | } |
390 | } | |
391 | else | |
392 | { | |
393 | peer = peer_lookup (bgp, &su); | |
394 | if (! peer) | |
395 | { | |
396 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
397 | return CMD_WARNING; | |
398 | } | |
399 | } | |
400 | ||
401 | if (stype == BGP_CLEAR_SOFT_NONE) | |
402 | ret = peer_clear (peer, NULL); | |
403 | else | |
404 | ret = peer_clear_soft (peer, afi, safi, stype); | |
405 | ||
406 | if (ret < 0) | |
407 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
408 | ||
409 | return CMD_SUCCESS; | |
410 | } | |
411 | ||
412 | /* Clear all peer-group members. */ | |
413 | if (sort == clear_group) | |
414 | { | |
415 | struct peer_group *group; | |
416 | ||
417 | group = peer_group_lookup (bgp, arg); | |
418 | if (! group) | |
419 | { | |
420 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
421 | return CMD_WARNING; | |
422 | } | |
423 | ||
424 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
425 | { | |
426 | if (stype == BGP_CLEAR_SOFT_NONE) | |
427 | { | |
428 | ret = peer_clear (peer, NULL); | |
429 | continue; | |
430 | } | |
431 | ||
432 | if (! peer->af_group[afi][safi]) | |
433 | continue; | |
434 | ||
435 | ret = peer_clear_soft (peer, afi, safi, stype); | |
436 | ||
437 | if (ret < 0) | |
438 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
439 | } | |
440 | return CMD_SUCCESS; | |
441 | } | |
442 | ||
443 | if (sort == clear_external) | |
444 | { | |
445 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
446 | { | |
447 | if (peer->sort == BGP_PEER_IBGP) | |
448 | continue; | |
449 | ||
450 | if (stype == BGP_CLEAR_SOFT_NONE) | |
451 | ret = peer_clear (peer, &nnode); | |
452 | else | |
453 | ret = peer_clear_soft (peer, afi, safi, stype); | |
454 | ||
455 | if (ret < 0) | |
456 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
457 | } | |
458 | return CMD_SUCCESS; | |
459 | } | |
460 | ||
461 | if (sort == clear_as) | |
462 | { | |
463 | as_t as; | |
464 | int find = 0; | |
465 | ||
466 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); | |
467 | ||
468 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
469 | { | |
470 | if (peer->as != as) | |
471 | continue; | |
472 | ||
473 | find = 1; | |
474 | if (stype == BGP_CLEAR_SOFT_NONE) | |
475 | ret = peer_clear (peer, &nnode); | |
476 | else | |
477 | ret = peer_clear_soft (peer, afi, safi, stype); | |
478 | ||
479 | if (ret < 0) | |
480 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
481 | } | |
482 | if (! find) | |
483 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
484 | VTY_NEWLINE); | |
485 | return CMD_SUCCESS; | |
486 | } | |
487 | ||
488 | return CMD_SUCCESS; | |
489 | } | |
490 | ||
491 | static int | |
492 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, | |
493 | enum clear_sort sort, enum bgp_clear_type stype, | |
494 | const char *arg) | |
495 | { | |
496 | struct bgp *bgp; | |
497 | ||
498 | /* BGP structure lookup. */ | |
499 | if (name) | |
500 | { | |
501 | bgp = bgp_lookup_by_name (name); | |
502 | if (bgp == NULL) | |
503 | { | |
504 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); | |
505 | return CMD_WARNING; | |
506 | } | |
507 | } | |
508 | else | |
509 | { | |
510 | bgp = bgp_get_default (); | |
511 | if (bgp == NULL) | |
512 | { | |
513 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
514 | return CMD_WARNING; | |
515 | } | |
516 | } | |
517 | ||
518 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); | |
519 | } | |
520 | ||
521 | /* clear soft inbound */ | |
522 | static void | |
523 | bgp_clear_star_soft_in (struct vty *vty) | |
524 | { | |
525 | bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
526 | BGP_CLEAR_SOFT_IN, NULL); | |
527 | #ifdef HAVE_IPV6 | |
528 | bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
529 | BGP_CLEAR_SOFT_IN, NULL); | |
530 | #endif /* HAVE_IPV6 */ | |
531 | } | |
532 | ||
533 | /* clear soft outbound */ | |
534 | static void | |
535 | bgp_clear_star_soft_out (struct vty *vty) | |
536 | { | |
537 | bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
538 | BGP_CLEAR_SOFT_OUT, NULL); | |
539 | #ifdef HAVE_IPV6 | |
540 | bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
541 | BGP_CLEAR_SOFT_OUT, NULL); | |
542 | #endif /* HAVE_IPV6 */ | |
543 | } | |
544 | ||
545 | ||
718e3744 | 546 | /* BGP global configuration. */ |
547 | ||
548 | DEFUN (bgp_multiple_instance_func, | |
549 | bgp_multiple_instance_cmd, | |
550 | "bgp multiple-instance", | |
551 | BGP_STR | |
552 | "Enable bgp multiple instance\n") | |
553 | { | |
554 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
555 | return CMD_SUCCESS; | |
556 | } | |
557 | ||
558 | DEFUN (no_bgp_multiple_instance, | |
559 | no_bgp_multiple_instance_cmd, | |
560 | "no bgp multiple-instance", | |
561 | NO_STR | |
562 | BGP_STR | |
563 | "BGP multiple instance\n") | |
564 | { | |
565 | int ret; | |
566 | ||
567 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
568 | if (ret < 0) | |
569 | { | |
570 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
571 | return CMD_WARNING; | |
572 | } | |
573 | return CMD_SUCCESS; | |
574 | } | |
575 | ||
576 | DEFUN (bgp_config_type, | |
577 | bgp_config_type_cmd, | |
578 | "bgp config-type (cisco|zebra)", | |
579 | BGP_STR | |
580 | "Configuration type\n" | |
581 | "cisco\n" | |
582 | "zebra\n") | |
583 | { | |
584 | if (strncmp (argv[0], "c", 1) == 0) | |
585 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
586 | else | |
587 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
588 | ||
589 | return CMD_SUCCESS; | |
590 | } | |
591 | ||
592 | DEFUN (no_bgp_config_type, | |
593 | no_bgp_config_type_cmd, | |
594 | "no bgp config-type", | |
595 | NO_STR | |
596 | BGP_STR | |
597 | "Display configuration type\n") | |
598 | { | |
599 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
600 | return CMD_SUCCESS; | |
601 | } | |
602 | ||
603 | DEFUN (no_synchronization, | |
604 | no_synchronization_cmd, | |
605 | "no synchronization", | |
606 | NO_STR | |
607 | "Perform IGP synchronization\n") | |
608 | { | |
609 | return CMD_SUCCESS; | |
610 | } | |
611 | ||
612 | DEFUN (no_auto_summary, | |
613 | no_auto_summary_cmd, | |
614 | "no auto-summary", | |
615 | NO_STR | |
616 | "Enable automatic network number summarization\n") | |
617 | { | |
618 | return CMD_SUCCESS; | |
619 | } | |
3d515fd9 | 620 | |
621 | DEFUN_DEPRECATED (neighbor_version, | |
622 | neighbor_version_cmd, | |
623 | NEIGHBOR_CMD "version (4|4-)", | |
624 | NEIGHBOR_STR | |
625 | NEIGHBOR_ADDR_STR | |
626 | "Set the BGP version to match a neighbor\n" | |
627 | "Neighbor's BGP version\n") | |
628 | { | |
629 | return CMD_SUCCESS; | |
630 | } | |
6b0655a2 | 631 | |
718e3744 | 632 | /* "router bgp" commands. */ |
633 | DEFUN (router_bgp, | |
634 | router_bgp_cmd, | |
320da874 | 635 | "router bgp " CMD_AS_RANGE, |
718e3744 | 636 | ROUTER_STR |
637 | BGP_STR | |
638 | AS_STR) | |
639 | { | |
640 | int ret; | |
641 | as_t as; | |
642 | struct bgp *bgp; | |
fd79ac91 | 643 | const char *name = NULL; |
718e3744 | 644 | |
0b2aa3a0 | 645 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 646 | |
647 | if (argc == 2) | |
648 | name = argv[1]; | |
649 | ||
650 | ret = bgp_get (&bgp, &as, name); | |
651 | switch (ret) | |
652 | { | |
653 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
654 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
655 | VTY_NEWLINE); | |
656 | return CMD_WARNING; | |
718e3744 | 657 | case BGP_ERR_AS_MISMATCH: |
aea339f7 | 658 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); |
718e3744 | 659 | return CMD_WARNING; |
718e3744 | 660 | case BGP_ERR_INSTANCE_MISMATCH: |
661 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); | |
aea339f7 | 662 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
718e3744 | 663 | as, VTY_NEWLINE); |
664 | return CMD_WARNING; | |
718e3744 | 665 | } |
666 | ||
667 | vty->node = BGP_NODE; | |
668 | vty->index = bgp; | |
669 | ||
670 | return CMD_SUCCESS; | |
671 | } | |
672 | ||
673 | ALIAS (router_bgp, | |
674 | router_bgp_view_cmd, | |
320da874 | 675 | "router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 676 | ROUTER_STR |
677 | BGP_STR | |
678 | AS_STR | |
679 | "BGP view\n" | |
680 | "view name\n") | |
6b0655a2 | 681 | |
718e3744 | 682 | /* "no router bgp" commands. */ |
683 | DEFUN (no_router_bgp, | |
684 | no_router_bgp_cmd, | |
320da874 | 685 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 686 | NO_STR |
687 | ROUTER_STR | |
688 | BGP_STR | |
689 | AS_STR) | |
690 | { | |
691 | as_t as; | |
692 | struct bgp *bgp; | |
fd79ac91 | 693 | const char *name = NULL; |
718e3744 | 694 | |
0b2aa3a0 | 695 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 696 | |
697 | if (argc == 2) | |
698 | name = argv[1]; | |
699 | ||
700 | /* Lookup bgp structure. */ | |
701 | bgp = bgp_lookup (as, name); | |
702 | if (! bgp) | |
703 | { | |
704 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
705 | return CMD_WARNING; | |
706 | } | |
707 | ||
708 | bgp_delete (bgp); | |
709 | ||
710 | return CMD_SUCCESS; | |
711 | } | |
712 | ||
713 | ALIAS (no_router_bgp, | |
714 | no_router_bgp_view_cmd, | |
320da874 | 715 | "no router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 716 | NO_STR |
717 | ROUTER_STR | |
718 | BGP_STR | |
719 | AS_STR | |
720 | "BGP view\n" | |
721 | "view name\n") | |
6b0655a2 | 722 | |
718e3744 | 723 | /* BGP router-id. */ |
724 | ||
725 | DEFUN (bgp_router_id, | |
726 | bgp_router_id_cmd, | |
727 | "bgp router-id A.B.C.D", | |
728 | BGP_STR | |
729 | "Override configured router identifier\n" | |
730 | "Manually configured router identifier\n") | |
731 | { | |
732 | int ret; | |
733 | struct in_addr id; | |
734 | struct bgp *bgp; | |
735 | ||
736 | bgp = vty->index; | |
737 | ||
738 | ret = inet_aton (argv[0], &id); | |
739 | if (! ret) | |
740 | { | |
741 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
742 | return CMD_WARNING; | |
743 | } | |
744 | ||
18a6dce6 | 745 | bgp->router_id_static = id; |
718e3744 | 746 | bgp_router_id_set (bgp, &id); |
747 | ||
748 | return CMD_SUCCESS; | |
749 | } | |
750 | ||
751 | DEFUN (no_bgp_router_id, | |
752 | no_bgp_router_id_cmd, | |
753 | "no bgp router-id", | |
754 | NO_STR | |
755 | BGP_STR | |
756 | "Override configured router identifier\n") | |
757 | { | |
758 | int ret; | |
759 | struct in_addr id; | |
760 | struct bgp *bgp; | |
761 | ||
762 | bgp = vty->index; | |
763 | ||
764 | if (argc == 1) | |
765 | { | |
766 | ret = inet_aton (argv[0], &id); | |
767 | if (! ret) | |
768 | { | |
769 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
770 | return CMD_WARNING; | |
771 | } | |
772 | ||
18a6dce6 | 773 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
718e3744 | 774 | { |
775 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
776 | return CMD_WARNING; | |
777 | } | |
778 | } | |
779 | ||
18a6dce6 | 780 | bgp->router_id_static.s_addr = 0; |
781 | bgp_router_id_set (bgp, &router_id_zebra); | |
718e3744 | 782 | |
783 | return CMD_SUCCESS; | |
784 | } | |
785 | ||
786 | ALIAS (no_bgp_router_id, | |
787 | no_bgp_router_id_val_cmd, | |
788 | "no bgp router-id A.B.C.D", | |
789 | NO_STR | |
790 | BGP_STR | |
791 | "Override configured router identifier\n" | |
792 | "Manually configured router identifier\n") | |
6b0655a2 | 793 | |
718e3744 | 794 | /* BGP Cluster ID. */ |
795 | ||
796 | DEFUN (bgp_cluster_id, | |
797 | bgp_cluster_id_cmd, | |
798 | "bgp cluster-id A.B.C.D", | |
799 | BGP_STR | |
800 | "Configure Route-Reflector Cluster-id\n" | |
801 | "Route-Reflector Cluster-id in IP address format\n") | |
802 | { | |
803 | int ret; | |
804 | struct bgp *bgp; | |
805 | struct in_addr cluster; | |
806 | ||
807 | bgp = vty->index; | |
808 | ||
809 | ret = inet_aton (argv[0], &cluster); | |
810 | if (! ret) | |
811 | { | |
812 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
813 | return CMD_WARNING; | |
814 | } | |
815 | ||
816 | bgp_cluster_id_set (bgp, &cluster); | |
7aafcaca | 817 | bgp_clear_star_soft_out (vty); |
718e3744 | 818 | |
819 | return CMD_SUCCESS; | |
820 | } | |
821 | ||
822 | ALIAS (bgp_cluster_id, | |
823 | bgp_cluster_id32_cmd, | |
824 | "bgp cluster-id <1-4294967295>", | |
825 | BGP_STR | |
826 | "Configure Route-Reflector Cluster-id\n" | |
827 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
828 | ||
829 | DEFUN (no_bgp_cluster_id, | |
830 | no_bgp_cluster_id_cmd, | |
831 | "no bgp cluster-id", | |
832 | NO_STR | |
833 | BGP_STR | |
834 | "Configure Route-Reflector Cluster-id\n") | |
835 | { | |
836 | int ret; | |
837 | struct bgp *bgp; | |
838 | struct in_addr cluster; | |
839 | ||
840 | bgp = vty->index; | |
841 | ||
842 | if (argc == 1) | |
843 | { | |
844 | ret = inet_aton (argv[0], &cluster); | |
845 | if (! ret) | |
846 | { | |
847 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
848 | return CMD_WARNING; | |
849 | } | |
850 | } | |
851 | ||
852 | bgp_cluster_id_unset (bgp); | |
7aafcaca | 853 | bgp_clear_star_soft_out (vty); |
718e3744 | 854 | |
855 | return CMD_SUCCESS; | |
856 | } | |
857 | ||
858 | ALIAS (no_bgp_cluster_id, | |
859 | no_bgp_cluster_id_arg_cmd, | |
860 | "no bgp cluster-id A.B.C.D", | |
861 | NO_STR | |
862 | BGP_STR | |
863 | "Configure Route-Reflector Cluster-id\n" | |
864 | "Route-Reflector Cluster-id in IP address format\n") | |
6b0655a2 | 865 | |
718e3744 | 866 | DEFUN (bgp_confederation_identifier, |
867 | bgp_confederation_identifier_cmd, | |
320da874 | 868 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 869 | "BGP specific commands\n" |
870 | "AS confederation parameters\n" | |
871 | "AS number\n" | |
872 | "Set routing domain confederation AS\n") | |
873 | { | |
874 | struct bgp *bgp; | |
875 | as_t as; | |
876 | ||
877 | bgp = vty->index; | |
878 | ||
0b2aa3a0 | 879 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 880 | |
881 | bgp_confederation_id_set (bgp, as); | |
882 | ||
883 | return CMD_SUCCESS; | |
884 | } | |
885 | ||
886 | DEFUN (no_bgp_confederation_identifier, | |
887 | no_bgp_confederation_identifier_cmd, | |
888 | "no bgp confederation identifier", | |
889 | NO_STR | |
890 | "BGP specific commands\n" | |
891 | "AS confederation parameters\n" | |
892 | "AS number\n") | |
893 | { | |
894 | struct bgp *bgp; | |
718e3744 | 895 | |
896 | bgp = vty->index; | |
897 | ||
718e3744 | 898 | bgp_confederation_id_unset (bgp); |
899 | ||
900 | return CMD_SUCCESS; | |
901 | } | |
902 | ||
903 | ALIAS (no_bgp_confederation_identifier, | |
904 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 905 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 906 | NO_STR |
907 | "BGP specific commands\n" | |
908 | "AS confederation parameters\n" | |
909 | "AS number\n" | |
910 | "Set routing domain confederation AS\n") | |
6b0655a2 | 911 | |
718e3744 | 912 | DEFUN (bgp_confederation_peers, |
913 | bgp_confederation_peers_cmd, | |
320da874 | 914 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 915 | "BGP specific commands\n" |
916 | "AS confederation parameters\n" | |
917 | "Peer ASs in BGP confederation\n" | |
918 | AS_STR) | |
919 | { | |
920 | struct bgp *bgp; | |
921 | as_t as; | |
922 | int i; | |
923 | ||
924 | bgp = vty->index; | |
925 | ||
926 | for (i = 0; i < argc; i++) | |
927 | { | |
0b2aa3a0 | 928 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 929 | |
930 | if (bgp->as == as) | |
931 | { | |
932 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
933 | VTY_NEWLINE); | |
934 | continue; | |
935 | } | |
936 | ||
937 | bgp_confederation_peers_add (bgp, as); | |
938 | } | |
939 | return CMD_SUCCESS; | |
940 | } | |
941 | ||
942 | DEFUN (no_bgp_confederation_peers, | |
943 | no_bgp_confederation_peers_cmd, | |
320da874 | 944 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 945 | NO_STR |
946 | "BGP specific commands\n" | |
947 | "AS confederation parameters\n" | |
948 | "Peer ASs in BGP confederation\n" | |
949 | AS_STR) | |
950 | { | |
951 | struct bgp *bgp; | |
952 | as_t as; | |
953 | int i; | |
954 | ||
955 | bgp = vty->index; | |
956 | ||
957 | for (i = 0; i < argc; i++) | |
958 | { | |
0b2aa3a0 PJ |
959 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
960 | ||
718e3744 | 961 | bgp_confederation_peers_remove (bgp, as); |
962 | } | |
963 | return CMD_SUCCESS; | |
964 | } | |
6b0655a2 | 965 | |
5e242b0d DS |
966 | /** |
967 | * Central routine for maximum-paths configuration. | |
968 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
969 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
970 | */ | |
ffd0c037 DS |
971 | static int |
972 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, | |
5e242b0d | 973 | u_int16_t options, int set) |
165b5fff JB |
974 | { |
975 | struct bgp *bgp; | |
ffd0c037 | 976 | u_int16_t maxpaths = 0; |
165b5fff | 977 | int ret; |
5e242b0d DS |
978 | afi_t afi; |
979 | safi_t safi; | |
165b5fff JB |
980 | |
981 | bgp = vty->index; | |
5e242b0d DS |
982 | afi = bgp_node_afi (vty); |
983 | safi = bgp_node_safi (vty); | |
165b5fff | 984 | |
5e242b0d DS |
985 | if (set) |
986 | { | |
73ac8160 DS |
987 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
988 | BGP_MAXIMUM_MAXPATHS); | |
5e242b0d DS |
989 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
990 | options); | |
991 | } | |
992 | else | |
993 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 994 | |
165b5fff JB |
995 | if (ret < 0) |
996 | { | |
997 | vty_out (vty, | |
5e242b0d DS |
998 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
999 | (set == 1) ? "" : "un", | |
1000 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
1001 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
1002 | return CMD_WARNING; |
1003 | } | |
1004 | ||
7aafcaca DS |
1005 | bgp_recalculate_all_bestpaths (bgp); |
1006 | ||
165b5fff JB |
1007 | return CMD_SUCCESS; |
1008 | } | |
1009 | ||
abc920f8 DS |
1010 | DEFUN (bgp_maxmed_admin, |
1011 | bgp_maxmed_admin_cmd, | |
1012 | "bgp max-med administrative ", | |
1013 | BGP_STR | |
1014 | "Advertise routes with max-med\n" | |
1015 | "Administratively applied, for an indefinite period\n") | |
1016 | { | |
1017 | struct bgp *bgp; | |
1018 | ||
1019 | bgp = vty->index; | |
1020 | ||
1021 | bgp->v_maxmed_admin = 1; | |
1022 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1023 | ||
1024 | bgp_maxmed_update(bgp); | |
1025 | ||
1026 | return CMD_SUCCESS; | |
1027 | } | |
1028 | ||
1029 | DEFUN (bgp_maxmed_admin_medv, | |
1030 | bgp_maxmed_admin_medv_cmd, | |
1031 | "bgp max-med administrative <0-4294967294>", | |
1032 | BGP_STR | |
1033 | "Advertise routes with max-med\n" | |
1034 | "Administratively applied, for an indefinite period\n" | |
1035 | "Max MED value to be used\n") | |
1036 | { | |
1037 | struct bgp *bgp; | |
1038 | ||
1039 | bgp = vty->index; | |
1040 | ||
1041 | bgp->v_maxmed_admin = 1; | |
1042 | VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]); | |
1043 | ||
1044 | bgp_maxmed_update(bgp); | |
1045 | ||
1046 | return CMD_SUCCESS; | |
1047 | } | |
1048 | ||
1049 | DEFUN (no_bgp_maxmed_admin, | |
1050 | no_bgp_maxmed_admin_cmd, | |
1051 | "no bgp max-med administrative", | |
1052 | NO_STR | |
1053 | BGP_STR | |
1054 | "Advertise routes with max-med\n" | |
1055 | "Administratively applied, for an indefinite period\n") | |
1056 | { | |
1057 | struct bgp *bgp; | |
1058 | ||
1059 | bgp = vty->index; | |
1060 | ||
1061 | bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED; | |
1062 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1063 | ||
1064 | bgp_maxmed_update(bgp); | |
1065 | ||
1066 | return CMD_SUCCESS; | |
1067 | } | |
1068 | ||
1069 | ALIAS (no_bgp_maxmed_admin, | |
1070 | no_bgp_maxmed_admin_medv_cmd, | |
1071 | "no bgp max-med administrative <0-4294967294>", | |
1072 | NO_STR | |
1073 | BGP_STR | |
1074 | "Advertise routes with max-med\n" | |
1075 | "Administratively applied, for an indefinite period\n" | |
1076 | "Max MED value to be used\n") | |
1077 | ||
1078 | ||
1079 | DEFUN (bgp_maxmed_onstartup, | |
1080 | bgp_maxmed_onstartup_cmd, | |
1081 | "bgp max-med on-startup <5-86400>", | |
1082 | BGP_STR | |
1083 | "Advertise routes with max-med\n" | |
1084 | "Effective on a startup\n" | |
1085 | "Time (seconds) period for max-med\n") | |
1086 | { | |
1087 | struct bgp *bgp; | |
1088 | ||
1089 | bgp = vty->index; | |
1090 | ||
1091 | if (argc != 1) | |
1092 | { | |
1093 | vty_out (vty, "%% Must supply max-med on-startup period"); | |
1094 | return CMD_WARNING; | |
1095 | } | |
1096 | ||
1097 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1098 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1099 | ||
1100 | bgp_maxmed_update(bgp); | |
1101 | ||
1102 | return CMD_SUCCESS; | |
1103 | } | |
1104 | ||
1105 | DEFUN (bgp_maxmed_onstartup_medv, | |
1106 | bgp_maxmed_onstartup_medv_cmd, | |
1107 | "bgp max-med on-startup <5-86400> <0-4294967294>", | |
1108 | BGP_STR | |
1109 | "Advertise routes with max-med\n" | |
1110 | "Effective on a startup\n" | |
1111 | "Time (seconds) period for max-med\n" | |
1112 | "Max MED value to be used\n") | |
1113 | { | |
1114 | struct bgp *bgp; | |
1115 | ||
1116 | bgp = vty->index; | |
1117 | ||
1118 | if (argc != 2) | |
1119 | { | |
1120 | vty_out (vty, "%% Must supply max-med on-startup period and med value"); | |
1121 | return CMD_WARNING; | |
1122 | } | |
1123 | ||
1124 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1125 | VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]); | |
1126 | ||
1127 | bgp_maxmed_update(bgp); | |
1128 | ||
1129 | return CMD_SUCCESS; | |
1130 | } | |
1131 | ||
1132 | DEFUN (no_bgp_maxmed_onstartup, | |
1133 | no_bgp_maxmed_onstartup_cmd, | |
1134 | "no bgp max-med on-startup", | |
1135 | NO_STR | |
1136 | BGP_STR | |
1137 | "Advertise routes with max-med\n" | |
1138 | "Effective on a startup\n") | |
1139 | { | |
1140 | struct bgp *bgp; | |
1141 | ||
1142 | bgp = vty->index; | |
1143 | ||
1144 | /* Cancel max-med onstartup if its on */ | |
1145 | if (bgp->t_maxmed_onstartup) | |
1146 | { | |
1147 | THREAD_TIMER_OFF (bgp->t_maxmed_onstartup); | |
1148 | bgp->maxmed_onstartup_over = 1; | |
1149 | } | |
1150 | ||
1151 | bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED; | |
1152 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1153 | ||
1154 | bgp_maxmed_update(bgp); | |
1155 | ||
1156 | return CMD_SUCCESS; | |
1157 | } | |
1158 | ||
1159 | ALIAS (no_bgp_maxmed_onstartup, | |
1160 | no_bgp_maxmed_onstartup_period_cmd, | |
1161 | "no bgp max-med on-startup <5-86400>", | |
1162 | NO_STR | |
1163 | BGP_STR | |
1164 | "Advertise routes with max-med\n" | |
1165 | "Effective on a startup\n" | |
1166 | "Time (seconds) period for max-med\n") | |
1167 | ||
1168 | ALIAS (no_bgp_maxmed_onstartup, | |
1169 | no_bgp_maxmed_onstartup_period_medv_cmd, | |
1170 | "no bgp max-med on-startup <5-86400> <0-4294967294>", | |
1171 | NO_STR | |
1172 | BGP_STR | |
1173 | "Advertise routes with max-med\n" | |
1174 | "Effective on a startup\n" | |
1175 | "Time (seconds) period for max-med\n" | |
1176 | "Max MED value to be used\n") | |
1177 | ||
f188f2c4 DS |
1178 | static int |
1179 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
1180 | const char *wait) | |
1181 | { | |
1182 | struct bgp *bgp; | |
1183 | u_int16_t update_delay; | |
1184 | u_int16_t establish_wait; | |
1185 | ||
1186 | ||
1187 | bgp = vty->index; | |
1188 | ||
1189 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
1190 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
1191 | ||
1192 | if (!wait) /* update-delay <delay> */ | |
1193 | { | |
1194 | bgp->v_update_delay = update_delay; | |
1195 | bgp->v_establish_wait = bgp->v_update_delay; | |
1196 | return CMD_SUCCESS; | |
1197 | } | |
1198 | ||
1199 | /* update-delay <delay> <establish-wait> */ | |
1200 | establish_wait = atoi (wait); | |
1201 | if (update_delay < establish_wait) | |
1202 | { | |
1203 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
1204 | VTY_NEWLINE); | |
1205 | return CMD_WARNING; | |
1206 | } | |
1207 | ||
1208 | bgp->v_update_delay = update_delay; | |
1209 | bgp->v_establish_wait = establish_wait; | |
1210 | ||
1211 | return CMD_SUCCESS; | |
1212 | } | |
1213 | ||
1214 | static int | |
1215 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
1216 | { | |
1217 | struct bgp *bgp; | |
1218 | ||
1219 | bgp = vty->index; | |
1220 | ||
1221 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
1222 | bgp->v_establish_wait = bgp->v_update_delay; | |
1223 | ||
1224 | return CMD_SUCCESS; | |
1225 | } | |
1226 | ||
1227 | int | |
1228 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
1229 | { | |
1230 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
1231 | { | |
1232 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
1233 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
1234 | vty_out (vty, " %d", bgp->v_establish_wait); | |
1235 | vty_out (vty, "%s", VTY_NEWLINE); | |
1236 | } | |
1237 | ||
1238 | return 0; | |
1239 | } | |
1240 | ||
1241 | ||
1242 | /* Update-delay configuration */ | |
1243 | DEFUN (bgp_update_delay, | |
1244 | bgp_update_delay_cmd, | |
1245 | "update-delay <0-3600>", | |
1246 | "Force initial delay for best-path and updates\n" | |
1247 | "Seconds\n") | |
1248 | { | |
1249 | return bgp_update_delay_config_vty(vty, argv[0], NULL); | |
1250 | } | |
1251 | ||
1252 | DEFUN (bgp_update_delay_establish_wait, | |
1253 | bgp_update_delay_establish_wait_cmd, | |
1254 | "update-delay <0-3600> <1-3600>", | |
1255 | "Force initial delay for best-path and updates\n" | |
1256 | "Seconds\n" | |
1257 | "Wait for peers to be established\n" | |
1258 | "Seconds\n") | |
1259 | { | |
1260 | return bgp_update_delay_config_vty(vty, argv[0], argv[1]); | |
1261 | } | |
1262 | ||
1263 | /* Update-delay deconfiguration */ | |
1264 | DEFUN (no_bgp_update_delay, | |
1265 | no_bgp_update_delay_cmd, | |
1266 | "no update-delay <0-3600>", | |
1267 | "Force initial delay for best-path and updates\n" | |
1268 | "Seconds\n") | |
1269 | { | |
1270 | return bgp_update_delay_deconfig_vty(vty); | |
1271 | } | |
1272 | ||
1273 | ALIAS (no_bgp_update_delay, | |
1274 | no_bgp_update_delay_establish_wait_cmd, | |
1275 | "no update-delay <0-3600> <1-3600>", | |
1276 | "Force initial delay for best-path and updates\n" | |
1277 | "Seconds\n" | |
1278 | "Wait for peers to be established\n" | |
1279 | "Seconds\n") | |
5e242b0d | 1280 | |
ffd0c037 DS |
1281 | static int |
1282 | bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set) | |
cb1faec9 DS |
1283 | { |
1284 | struct bgp *bgp; | |
cb1faec9 DS |
1285 | |
1286 | bgp = vty->index; | |
1287 | ||
1288 | if (set) | |
1289 | VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num, | |
1290 | 1, 4294967295); | |
1291 | else | |
1292 | bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX; | |
1293 | ||
1294 | return CMD_SUCCESS; | |
1295 | } | |
1296 | ||
1297 | int | |
1298 | bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) | |
1299 | { | |
1300 | if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX) | |
1301 | vty_out (vty, " write-quanta %d%s", | |
1302 | bgp->wpkt_quanta, VTY_NEWLINE); | |
1303 | ||
1304 | return 0; | |
1305 | } | |
1306 | ||
1307 | ||
1308 | /* Update-delay configuration */ | |
1309 | DEFUN (bgp_wpkt_quanta, | |
1310 | bgp_wpkt_quanta_cmd, | |
1311 | "write-quanta <1-4294967295>", | |
1312 | "How many packets to write to peer socket per run\n" | |
1313 | "Number of packets\n") | |
1314 | { | |
1315 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 1); | |
1316 | } | |
1317 | ||
1318 | /* Update-delay deconfiguration */ | |
1319 | DEFUN (no_bgp_wpkt_quanta, | |
1320 | no_bgp_wpkt_quanta_cmd, | |
1321 | "no write-quanta <1-4294967295>", | |
1322 | "How many packets to write to peer socket per run\n" | |
1323 | "Number of packets\n") | |
1324 | { | |
1325 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); | |
1326 | } | |
1327 | ||
ffd0c037 | 1328 | static int |
3f9c7369 DS |
1329 | bgp_coalesce_config_vty (struct vty *vty, const char *num, char set) |
1330 | { | |
1331 | struct bgp *bgp; | |
1332 | ||
1333 | bgp = vty->index; | |
1334 | ||
1335 | if (set) | |
1336 | VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num, | |
1337 | 0, 4294967295); | |
1338 | else | |
1339 | bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; | |
1340 | ||
1341 | return CMD_SUCCESS; | |
1342 | } | |
1343 | ||
1344 | int | |
1345 | bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp) | |
1346 | { | |
1347 | if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME) | |
1348 | vty_out (vty, " coalesce-time %d%s", | |
1349 | bgp->coalesce_time, VTY_NEWLINE); | |
1350 | ||
1351 | return 0; | |
1352 | } | |
1353 | ||
1354 | ||
1355 | DEFUN (bgp_coalesce_time, | |
1356 | bgp_coalesce_time_cmd, | |
1357 | "coalesce-time <0-4294967295>", | |
1358 | "Subgroup coalesce timer\n" | |
1359 | "Subgroup coalesce timer value (in ms)\n") | |
1360 | { | |
1361 | return bgp_coalesce_config_vty(vty, argv[0], 1); | |
1362 | } | |
1363 | ||
1364 | DEFUN (no_bgp_coalesce_time, | |
1365 | no_bgp_coalesce_time_cmd, | |
1366 | "no coalesce-time <0-4294967295>", | |
1367 | "Subgroup coalesce timer\n" | |
1368 | "Subgroup coalesce timer value (in ms)\n") | |
1369 | { | |
1370 | return bgp_coalesce_config_vty(vty, argv[0], 0); | |
1371 | } | |
1372 | ||
5e242b0d DS |
1373 | /* Maximum-paths configuration */ |
1374 | DEFUN (bgp_maxpaths, | |
1375 | bgp_maxpaths_cmd, | |
1376 | "maximum-paths <1-255>", | |
1377 | "Forward packets over multiple paths\n" | |
1378 | "Number of paths\n") | |
1379 | { | |
1380 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); | |
1381 | } | |
1382 | ||
165b5fff JB |
1383 | DEFUN (bgp_maxpaths_ibgp, |
1384 | bgp_maxpaths_ibgp_cmd, | |
1385 | "maximum-paths ibgp <1-255>", | |
1386 | "Forward packets over multiple paths\n" | |
1387 | "iBGP-multipath\n" | |
1388 | "Number of paths\n") | |
1389 | { | |
5e242b0d DS |
1390 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); |
1391 | } | |
165b5fff | 1392 | |
5e242b0d DS |
1393 | DEFUN (bgp_maxpaths_ibgp_cluster, |
1394 | bgp_maxpaths_ibgp_cluster_cmd, | |
1395 | "maximum-paths ibgp <1-255> equal-cluster-length", | |
1396 | "Forward packets over multiple paths\n" | |
1397 | "iBGP-multipath\n" | |
1398 | "Number of paths\n" | |
1399 | "Match the cluster length\n") | |
1400 | { | |
1401 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], | |
1402 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); | |
165b5fff JB |
1403 | } |
1404 | ||
1405 | DEFUN (no_bgp_maxpaths, | |
1406 | no_bgp_maxpaths_cmd, | |
1407 | "no maximum-paths", | |
1408 | NO_STR | |
1409 | "Forward packets over multiple paths\n" | |
1410 | "Number of paths\n") | |
1411 | { | |
5e242b0d | 1412 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
1413 | } |
1414 | ||
1415 | ALIAS (no_bgp_maxpaths, | |
1416 | no_bgp_maxpaths_arg_cmd, | |
1417 | "no maximum-paths <1-255>", | |
1418 | NO_STR | |
1419 | "Forward packets over multiple paths\n" | |
1420 | "Number of paths\n") | |
1421 | ||
1422 | DEFUN (no_bgp_maxpaths_ibgp, | |
1423 | no_bgp_maxpaths_ibgp_cmd, | |
1424 | "no maximum-paths ibgp", | |
1425 | NO_STR | |
1426 | "Forward packets over multiple paths\n" | |
1427 | "iBGP-multipath\n" | |
1428 | "Number of paths\n") | |
1429 | { | |
5e242b0d | 1430 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
1431 | } |
1432 | ||
1433 | ALIAS (no_bgp_maxpaths_ibgp, | |
1434 | no_bgp_maxpaths_ibgp_arg_cmd, | |
1435 | "no maximum-paths ibgp <1-255>", | |
1436 | NO_STR | |
1437 | "Forward packets over multiple paths\n" | |
1438 | "iBGP-multipath\n" | |
1439 | "Number of paths\n") | |
1440 | ||
5e242b0d DS |
1441 | ALIAS (no_bgp_maxpaths_ibgp, |
1442 | no_bgp_maxpaths_ibgp_cluster_cmd, | |
1443 | "no maximum-paths ibgp <1-255> equal-cluster-length", | |
1444 | NO_STR | |
1445 | "Forward packets over multiple paths\n" | |
1446 | "iBGP-multipath\n" | |
1447 | "Number of paths\n" | |
1448 | "Match the cluster length\n") | |
1449 | ||
165b5fff JB |
1450 | int |
1451 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
1452 | safi_t safi, int *write) | |
1453 | { | |
1454 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) | |
1455 | { | |
1456 | bgp_config_write_family_header (vty, afi, safi, write); | |
1457 | vty_out (vty, " maximum-paths %d%s", | |
1458 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); | |
1459 | } | |
1460 | ||
1461 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) | |
1462 | { | |
1463 | bgp_config_write_family_header (vty, afi, safi, write); | |
5e242b0d DS |
1464 | vty_out (vty, " maximum-paths ibgp %d", |
1465 | bgp->maxpaths[afi][safi].maxpaths_ibgp); | |
1466 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
1467 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
1468 | vty_out (vty, " equal-cluster-length"); | |
1469 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
1470 | } |
1471 | ||
1472 | return 0; | |
1473 | } | |
6b0655a2 | 1474 | |
718e3744 | 1475 | /* BGP timers. */ |
1476 | ||
1477 | DEFUN (bgp_timers, | |
1478 | bgp_timers_cmd, | |
1479 | "timers bgp <0-65535> <0-65535>", | |
1480 | "Adjust routing timers\n" | |
1481 | "BGP timers\n" | |
1482 | "Keepalive interval\n" | |
1483 | "Holdtime\n") | |
1484 | { | |
1485 | struct bgp *bgp; | |
1486 | unsigned long keepalive = 0; | |
1487 | unsigned long holdtime = 0; | |
1488 | ||
1489 | bgp = vty->index; | |
1490 | ||
1491 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
1492 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
1493 | ||
1494 | /* Holdtime value check. */ | |
1495 | if (holdtime < 3 && holdtime != 0) | |
1496 | { | |
1497 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
1498 | VTY_NEWLINE); | |
1499 | return CMD_WARNING; | |
1500 | } | |
1501 | ||
1502 | bgp_timers_set (bgp, keepalive, holdtime); | |
1503 | ||
1504 | return CMD_SUCCESS; | |
1505 | } | |
1506 | ||
1507 | DEFUN (no_bgp_timers, | |
1508 | no_bgp_timers_cmd, | |
1509 | "no timers bgp", | |
1510 | NO_STR | |
1511 | "Adjust routing timers\n" | |
1512 | "BGP timers\n") | |
1513 | { | |
1514 | struct bgp *bgp; | |
1515 | ||
1516 | bgp = vty->index; | |
1517 | bgp_timers_unset (bgp); | |
1518 | ||
1519 | return CMD_SUCCESS; | |
1520 | } | |
1521 | ||
1522 | ALIAS (no_bgp_timers, | |
1523 | no_bgp_timers_arg_cmd, | |
1524 | "no timers bgp <0-65535> <0-65535>", | |
1525 | NO_STR | |
1526 | "Adjust routing timers\n" | |
1527 | "BGP timers\n" | |
1528 | "Keepalive interval\n" | |
1529 | "Holdtime\n") | |
6b0655a2 | 1530 | |
718e3744 | 1531 | DEFUN (bgp_client_to_client_reflection, |
1532 | bgp_client_to_client_reflection_cmd, | |
1533 | "bgp client-to-client reflection", | |
1534 | "BGP specific commands\n" | |
1535 | "Configure client to client route reflection\n" | |
1536 | "reflection of routes allowed\n") | |
1537 | { | |
1538 | struct bgp *bgp; | |
1539 | ||
1540 | bgp = vty->index; | |
1541 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
7aafcaca DS |
1542 | bgp_clear_star_soft_out (vty); |
1543 | ||
718e3744 | 1544 | return CMD_SUCCESS; |
1545 | } | |
1546 | ||
1547 | DEFUN (no_bgp_client_to_client_reflection, | |
1548 | no_bgp_client_to_client_reflection_cmd, | |
1549 | "no bgp client-to-client reflection", | |
1550 | NO_STR | |
1551 | "BGP specific commands\n" | |
1552 | "Configure client to client route reflection\n" | |
1553 | "reflection of routes allowed\n") | |
1554 | { | |
1555 | struct bgp *bgp; | |
1556 | ||
1557 | bgp = vty->index; | |
1558 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
7aafcaca DS |
1559 | bgp_clear_star_soft_out (vty); |
1560 | ||
718e3744 | 1561 | return CMD_SUCCESS; |
1562 | } | |
1563 | ||
1564 | /* "bgp always-compare-med" configuration. */ | |
1565 | DEFUN (bgp_always_compare_med, | |
1566 | bgp_always_compare_med_cmd, | |
1567 | "bgp always-compare-med", | |
1568 | "BGP specific commands\n" | |
1569 | "Allow comparing MED from different neighbors\n") | |
1570 | { | |
1571 | struct bgp *bgp; | |
1572 | ||
1573 | bgp = vty->index; | |
1574 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1575 | bgp_recalculate_all_bestpaths (bgp); |
1576 | ||
718e3744 | 1577 | return CMD_SUCCESS; |
1578 | } | |
1579 | ||
1580 | DEFUN (no_bgp_always_compare_med, | |
1581 | no_bgp_always_compare_med_cmd, | |
1582 | "no bgp always-compare-med", | |
1583 | NO_STR | |
1584 | "BGP specific commands\n" | |
1585 | "Allow comparing MED from different neighbors\n") | |
1586 | { | |
1587 | struct bgp *bgp; | |
1588 | ||
1589 | bgp = vty->index; | |
1590 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1591 | bgp_recalculate_all_bestpaths (bgp); |
1592 | ||
718e3744 | 1593 | return CMD_SUCCESS; |
1594 | } | |
6b0655a2 | 1595 | |
718e3744 | 1596 | /* "bgp deterministic-med" configuration. */ |
1597 | DEFUN (bgp_deterministic_med, | |
1598 | bgp_deterministic_med_cmd, | |
1599 | "bgp deterministic-med", | |
1600 | "BGP specific commands\n" | |
1601 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1602 | { | |
1603 | struct bgp *bgp; | |
1604 | ||
1605 | bgp = vty->index; | |
1606 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
7aafcaca DS |
1607 | bgp_recalculate_all_bestpaths (bgp); |
1608 | ||
718e3744 | 1609 | return CMD_SUCCESS; |
1610 | } | |
1611 | ||
1612 | DEFUN (no_bgp_deterministic_med, | |
1613 | no_bgp_deterministic_med_cmd, | |
1614 | "no bgp deterministic-med", | |
1615 | NO_STR | |
1616 | "BGP specific commands\n" | |
1617 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1618 | { | |
1619 | struct bgp *bgp; | |
1620 | ||
1621 | bgp = vty->index; | |
1622 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
7aafcaca DS |
1623 | bgp_recalculate_all_bestpaths (bgp); |
1624 | ||
718e3744 | 1625 | return CMD_SUCCESS; |
1626 | } | |
538621f2 | 1627 | |
1628 | /* "bgp graceful-restart" configuration. */ | |
1629 | DEFUN (bgp_graceful_restart, | |
1630 | bgp_graceful_restart_cmd, | |
1631 | "bgp graceful-restart", | |
1632 | "BGP specific commands\n" | |
1633 | "Graceful restart capability parameters\n") | |
1634 | { | |
1635 | struct bgp *bgp; | |
1636 | ||
1637 | bgp = vty->index; | |
1638 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1639 | return CMD_SUCCESS; | |
1640 | } | |
1641 | ||
1642 | DEFUN (no_bgp_graceful_restart, | |
1643 | no_bgp_graceful_restart_cmd, | |
1644 | "no bgp graceful-restart", | |
1645 | NO_STR | |
1646 | "BGP specific commands\n" | |
1647 | "Graceful restart capability parameters\n") | |
1648 | { | |
1649 | struct bgp *bgp; | |
1650 | ||
1651 | bgp = vty->index; | |
1652 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1653 | return CMD_SUCCESS; | |
1654 | } | |
1655 | ||
93406d87 | 1656 | DEFUN (bgp_graceful_restart_stalepath_time, |
1657 | bgp_graceful_restart_stalepath_time_cmd, | |
1658 | "bgp graceful-restart stalepath-time <1-3600>", | |
1659 | "BGP specific commands\n" | |
1660 | "Graceful restart capability parameters\n" | |
1661 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1662 | "Delay value (seconds)\n") | |
1663 | { | |
1664 | struct bgp *bgp; | |
1665 | u_int32_t stalepath; | |
1666 | ||
1667 | bgp = vty->index; | |
1668 | if (! bgp) | |
1669 | return CMD_WARNING; | |
1670 | ||
1671 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
1672 | bgp->stalepath_time = stalepath; | |
1673 | return CMD_SUCCESS; | |
1674 | } | |
1675 | ||
1676 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
1677 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1678 | "no bgp graceful-restart stalepath-time", | |
1679 | NO_STR | |
1680 | "BGP specific commands\n" | |
1681 | "Graceful restart capability parameters\n" | |
1682 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1683 | { | |
1684 | struct bgp *bgp; | |
1685 | ||
1686 | bgp = vty->index; | |
1687 | if (! bgp) | |
1688 | return CMD_WARNING; | |
1689 | ||
1690 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1691 | return CMD_SUCCESS; | |
1692 | } | |
1693 | ||
1694 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
1695 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
1696 | "no bgp graceful-restart stalepath-time <1-3600>", | |
1697 | NO_STR | |
1698 | "BGP specific commands\n" | |
1699 | "Graceful restart capability parameters\n" | |
1700 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1701 | "Delay value (seconds)\n") | |
1702 | ||
718e3744 | 1703 | /* "bgp fast-external-failover" configuration. */ |
1704 | DEFUN (bgp_fast_external_failover, | |
1705 | bgp_fast_external_failover_cmd, | |
1706 | "bgp fast-external-failover", | |
1707 | BGP_STR | |
1708 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1709 | { | |
1710 | struct bgp *bgp; | |
1711 | ||
1712 | bgp = vty->index; | |
1713 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1714 | return CMD_SUCCESS; | |
1715 | } | |
1716 | ||
1717 | DEFUN (no_bgp_fast_external_failover, | |
1718 | no_bgp_fast_external_failover_cmd, | |
1719 | "no bgp fast-external-failover", | |
1720 | NO_STR | |
1721 | BGP_STR | |
1722 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1723 | { | |
1724 | struct bgp *bgp; | |
1725 | ||
1726 | bgp = vty->index; | |
1727 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1728 | return CMD_SUCCESS; | |
1729 | } | |
6b0655a2 | 1730 | |
718e3744 | 1731 | /* "bgp enforce-first-as" configuration. */ |
1732 | DEFUN (bgp_enforce_first_as, | |
1733 | bgp_enforce_first_as_cmd, | |
1734 | "bgp enforce-first-as", | |
1735 | BGP_STR | |
1736 | "Enforce the first AS for EBGP routes\n") | |
1737 | { | |
1738 | struct bgp *bgp; | |
1739 | ||
1740 | bgp = vty->index; | |
1741 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
7aafcaca DS |
1742 | bgp_clear_star_soft_in (vty); |
1743 | ||
718e3744 | 1744 | return CMD_SUCCESS; |
1745 | } | |
1746 | ||
1747 | DEFUN (no_bgp_enforce_first_as, | |
1748 | no_bgp_enforce_first_as_cmd, | |
1749 | "no bgp enforce-first-as", | |
1750 | NO_STR | |
1751 | BGP_STR | |
1752 | "Enforce the first AS for EBGP routes\n") | |
1753 | { | |
1754 | struct bgp *bgp; | |
1755 | ||
1756 | bgp = vty->index; | |
1757 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
7aafcaca DS |
1758 | bgp_clear_star_soft_in (vty); |
1759 | ||
718e3744 | 1760 | return CMD_SUCCESS; |
1761 | } | |
6b0655a2 | 1762 | |
718e3744 | 1763 | /* "bgp bestpath compare-routerid" configuration. */ |
1764 | DEFUN (bgp_bestpath_compare_router_id, | |
1765 | bgp_bestpath_compare_router_id_cmd, | |
1766 | "bgp bestpath compare-routerid", | |
1767 | "BGP specific commands\n" | |
1768 | "Change the default bestpath selection\n" | |
1769 | "Compare router-id for identical EBGP paths\n") | |
1770 | { | |
1771 | struct bgp *bgp; | |
1772 | ||
1773 | bgp = vty->index; | |
1774 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1775 | bgp_recalculate_all_bestpaths (bgp); |
1776 | ||
718e3744 | 1777 | return CMD_SUCCESS; |
1778 | } | |
1779 | ||
1780 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1781 | no_bgp_bestpath_compare_router_id_cmd, | |
1782 | "no bgp bestpath compare-routerid", | |
1783 | NO_STR | |
1784 | "BGP specific commands\n" | |
1785 | "Change the default bestpath selection\n" | |
1786 | "Compare router-id for identical EBGP paths\n") | |
1787 | { | |
1788 | struct bgp *bgp; | |
1789 | ||
1790 | bgp = vty->index; | |
1791 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1792 | bgp_recalculate_all_bestpaths (bgp); |
1793 | ||
718e3744 | 1794 | return CMD_SUCCESS; |
1795 | } | |
6b0655a2 | 1796 | |
718e3744 | 1797 | /* "bgp bestpath as-path ignore" configuration. */ |
1798 | DEFUN (bgp_bestpath_aspath_ignore, | |
1799 | bgp_bestpath_aspath_ignore_cmd, | |
1800 | "bgp bestpath as-path ignore", | |
1801 | "BGP specific commands\n" | |
1802 | "Change the default bestpath selection\n" | |
1803 | "AS-path attribute\n" | |
1804 | "Ignore as-path length in selecting a route\n") | |
1805 | { | |
1806 | struct bgp *bgp; | |
1807 | ||
1808 | bgp = vty->index; | |
1809 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1810 | bgp_recalculate_all_bestpaths (bgp); |
1811 | ||
718e3744 | 1812 | return CMD_SUCCESS; |
1813 | } | |
1814 | ||
1815 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
1816 | no_bgp_bestpath_aspath_ignore_cmd, | |
1817 | "no bgp bestpath as-path ignore", | |
1818 | NO_STR | |
1819 | "BGP specific commands\n" | |
1820 | "Change the default bestpath selection\n" | |
1821 | "AS-path attribute\n" | |
1822 | "Ignore as-path length in selecting a route\n") | |
1823 | { | |
1824 | struct bgp *bgp; | |
1825 | ||
1826 | bgp = vty->index; | |
1827 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1828 | bgp_recalculate_all_bestpaths (bgp); |
1829 | ||
718e3744 | 1830 | return CMD_SUCCESS; |
1831 | } | |
6b0655a2 | 1832 | |
6811845b | 1833 | /* "bgp bestpath as-path confed" configuration. */ |
1834 | DEFUN (bgp_bestpath_aspath_confed, | |
1835 | bgp_bestpath_aspath_confed_cmd, | |
1836 | "bgp bestpath as-path confed", | |
1837 | "BGP specific commands\n" | |
1838 | "Change the default bestpath selection\n" | |
1839 | "AS-path attribute\n" | |
1840 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1841 | { | |
1842 | struct bgp *bgp; | |
1843 | ||
1844 | bgp = vty->index; | |
1845 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1846 | bgp_recalculate_all_bestpaths (bgp); |
1847 | ||
6811845b | 1848 | return CMD_SUCCESS; |
1849 | } | |
1850 | ||
1851 | DEFUN (no_bgp_bestpath_aspath_confed, | |
1852 | no_bgp_bestpath_aspath_confed_cmd, | |
1853 | "no bgp bestpath as-path confed", | |
1854 | NO_STR | |
1855 | "BGP specific commands\n" | |
1856 | "Change the default bestpath selection\n" | |
1857 | "AS-path attribute\n" | |
1858 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1859 | { | |
1860 | struct bgp *bgp; | |
1861 | ||
1862 | bgp = vty->index; | |
1863 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1864 | bgp_recalculate_all_bestpaths (bgp); |
1865 | ||
6811845b | 1866 | return CMD_SUCCESS; |
1867 | } | |
6b0655a2 | 1868 | |
2fdd455c PM |
1869 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
1870 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
1871 | bgp_bestpath_aspath_multipath_relax_cmd, | |
1872 | "bgp bestpath as-path multipath-relax", | |
1873 | "BGP specific commands\n" | |
1874 | "Change the default bestpath selection\n" | |
1875 | "AS-path attribute\n" | |
1876 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1877 | { | |
1878 | struct bgp *bgp; | |
1879 | ||
1880 | bgp = vty->index; | |
1881 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
16fc1eec | 1882 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); |
7aafcaca DS |
1883 | bgp_recalculate_all_bestpaths (bgp); |
1884 | ||
2fdd455c PM |
1885 | return CMD_SUCCESS; |
1886 | } | |
1887 | ||
1888 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, | |
1889 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
1890 | "no bgp bestpath as-path multipath-relax", | |
1891 | NO_STR | |
1892 | "BGP specific commands\n" | |
1893 | "Change the default bestpath selection\n" | |
1894 | "AS-path attribute\n" | |
1895 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1896 | { | |
1897 | struct bgp *bgp; | |
1898 | ||
1899 | bgp = vty->index; | |
1900 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
16fc1eec | 1901 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); |
7aafcaca DS |
1902 | bgp_recalculate_all_bestpaths (bgp); |
1903 | ||
16fc1eec DS |
1904 | return CMD_SUCCESS; |
1905 | } | |
1906 | ||
1907 | /* "bgp bestpath as-path multipath-relax no-as-set" configuration. */ | |
1908 | DEFUN (bgp_bestpath_aspath_multipath_relax_no_as_set, | |
1909 | bgp_bestpath_aspath_multipath_relax_no_as_set_cmd, | |
1910 | "bgp bestpath as-path multipath-relax no-as-set", | |
1911 | "BGP specific commands\n" | |
1912 | "Change the default bestpath selection\n" | |
1913 | "AS-path attribute\n" | |
1914 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
1915 | "Do not generate an AS_SET\n") | |
1916 | { | |
1917 | struct bgp *bgp; | |
1918 | ||
1919 | bgp = vty->index; | |
1920 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1921 | bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); | |
7aafcaca DS |
1922 | bgp_recalculate_all_bestpaths (bgp); |
1923 | ||
16fc1eec DS |
1924 | return CMD_SUCCESS; |
1925 | } | |
1926 | ||
1927 | DEFUN (no_bgp_bestpath_aspath_multipath_relax_no_as_set, | |
1928 | no_bgp_bestpath_aspath_multipath_relax_no_as_set_cmd, | |
1929 | "no bgp bestpath as-path multipath-relax no-as-set", | |
1930 | NO_STR | |
1931 | "BGP specific commands\n" | |
1932 | "Change the default bestpath selection\n" | |
1933 | "AS-path attribute\n" | |
1934 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
1935 | "Do not generate an AS_SET\n") | |
1936 | { | |
1937 | struct bgp *bgp; | |
1938 | ||
1939 | bgp = vty->index; | |
1940 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1941 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); | |
7aafcaca DS |
1942 | bgp_recalculate_all_bestpaths (bgp); |
1943 | ||
2fdd455c PM |
1944 | return CMD_SUCCESS; |
1945 | } | |
6b0655a2 | 1946 | |
848973c7 | 1947 | /* "bgp log-neighbor-changes" configuration. */ |
1948 | DEFUN (bgp_log_neighbor_changes, | |
1949 | bgp_log_neighbor_changes_cmd, | |
1950 | "bgp log-neighbor-changes", | |
1951 | "BGP specific commands\n" | |
1952 | "Log neighbor up/down and reset reason\n") | |
1953 | { | |
1954 | struct bgp *bgp; | |
1955 | ||
1956 | bgp = vty->index; | |
1957 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1958 | return CMD_SUCCESS; | |
1959 | } | |
1960 | ||
1961 | DEFUN (no_bgp_log_neighbor_changes, | |
1962 | no_bgp_log_neighbor_changes_cmd, | |
1963 | "no bgp log-neighbor-changes", | |
1964 | NO_STR | |
1965 | "BGP specific commands\n" | |
1966 | "Log neighbor up/down and reset reason\n") | |
1967 | { | |
1968 | struct bgp *bgp; | |
1969 | ||
1970 | bgp = vty->index; | |
1971 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1972 | return CMD_SUCCESS; | |
1973 | } | |
6b0655a2 | 1974 | |
718e3744 | 1975 | /* "bgp bestpath med" configuration. */ |
1976 | DEFUN (bgp_bestpath_med, | |
1977 | bgp_bestpath_med_cmd, | |
1978 | "bgp bestpath med (confed|missing-as-worst)", | |
1979 | "BGP specific commands\n" | |
1980 | "Change the default bestpath selection\n" | |
1981 | "MED attribute\n" | |
1982 | "Compare MED among confederation paths\n" | |
1983 | "Treat missing MED as the least preferred one\n") | |
1984 | { | |
1985 | struct bgp *bgp; | |
1986 | ||
1987 | bgp = vty->index; | |
1988 | ||
1989 | if (strncmp (argv[0], "confed", 1) == 0) | |
1990 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
1991 | else | |
1992 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1993 | ||
7aafcaca DS |
1994 | bgp_recalculate_all_bestpaths (bgp); |
1995 | ||
718e3744 | 1996 | return CMD_SUCCESS; |
1997 | } | |
1998 | ||
1999 | DEFUN (bgp_bestpath_med2, | |
2000 | bgp_bestpath_med2_cmd, | |
2001 | "bgp bestpath med confed missing-as-worst", | |
2002 | "BGP specific commands\n" | |
2003 | "Change the default bestpath selection\n" | |
2004 | "MED attribute\n" | |
2005 | "Compare MED among confederation paths\n" | |
2006 | "Treat missing MED as the least preferred one\n") | |
2007 | { | |
2008 | struct bgp *bgp; | |
2009 | ||
2010 | bgp = vty->index; | |
2011 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2012 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2013 | bgp_recalculate_all_bestpaths (bgp); |
2014 | ||
718e3744 | 2015 | return CMD_SUCCESS; |
2016 | } | |
2017 | ||
2018 | ALIAS (bgp_bestpath_med2, | |
2019 | bgp_bestpath_med3_cmd, | |
2020 | "bgp bestpath med missing-as-worst confed", | |
2021 | "BGP specific commands\n" | |
2022 | "Change the default bestpath selection\n" | |
2023 | "MED attribute\n" | |
2024 | "Treat missing MED as the least preferred one\n" | |
2025 | "Compare MED among confederation paths\n") | |
2026 | ||
2027 | DEFUN (no_bgp_bestpath_med, | |
2028 | no_bgp_bestpath_med_cmd, | |
2029 | "no bgp bestpath med (confed|missing-as-worst)", | |
2030 | NO_STR | |
2031 | "BGP specific commands\n" | |
2032 | "Change the default bestpath selection\n" | |
2033 | "MED attribute\n" | |
2034 | "Compare MED among confederation paths\n" | |
2035 | "Treat missing MED as the least preferred one\n") | |
2036 | { | |
2037 | struct bgp *bgp; | |
2038 | ||
2039 | bgp = vty->index; | |
2040 | ||
2041 | if (strncmp (argv[0], "confed", 1) == 0) | |
2042 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2043 | else | |
2044 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2045 | ||
7aafcaca DS |
2046 | bgp_recalculate_all_bestpaths (bgp); |
2047 | ||
718e3744 | 2048 | return CMD_SUCCESS; |
2049 | } | |
2050 | ||
2051 | DEFUN (no_bgp_bestpath_med2, | |
2052 | no_bgp_bestpath_med2_cmd, | |
2053 | "no bgp bestpath med confed missing-as-worst", | |
2054 | NO_STR | |
2055 | "BGP specific commands\n" | |
2056 | "Change the default bestpath selection\n" | |
2057 | "MED attribute\n" | |
2058 | "Compare MED among confederation paths\n" | |
2059 | "Treat missing MED as the least preferred one\n") | |
2060 | { | |
2061 | struct bgp *bgp; | |
2062 | ||
2063 | bgp = vty->index; | |
2064 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2065 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2066 | bgp_recalculate_all_bestpaths (bgp); |
2067 | ||
718e3744 | 2068 | return CMD_SUCCESS; |
2069 | } | |
2070 | ||
2071 | ALIAS (no_bgp_bestpath_med2, | |
2072 | no_bgp_bestpath_med3_cmd, | |
2073 | "no bgp bestpath med missing-as-worst confed", | |
2074 | NO_STR | |
2075 | "BGP specific commands\n" | |
2076 | "Change the default bestpath selection\n" | |
2077 | "MED attribute\n" | |
2078 | "Treat missing MED as the least preferred one\n" | |
2079 | "Compare MED among confederation paths\n") | |
6b0655a2 | 2080 | |
718e3744 | 2081 | /* "no bgp default ipv4-unicast". */ |
2082 | DEFUN (no_bgp_default_ipv4_unicast, | |
2083 | no_bgp_default_ipv4_unicast_cmd, | |
2084 | "no bgp default ipv4-unicast", | |
2085 | NO_STR | |
2086 | "BGP specific commands\n" | |
2087 | "Configure BGP defaults\n" | |
2088 | "Activate ipv4-unicast for a peer by default\n") | |
2089 | { | |
2090 | struct bgp *bgp; | |
2091 | ||
2092 | bgp = vty->index; | |
2093 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2094 | return CMD_SUCCESS; | |
2095 | } | |
2096 | ||
2097 | DEFUN (bgp_default_ipv4_unicast, | |
2098 | bgp_default_ipv4_unicast_cmd, | |
2099 | "bgp default ipv4-unicast", | |
2100 | "BGP specific commands\n" | |
2101 | "Configure BGP defaults\n" | |
2102 | "Activate ipv4-unicast for a peer by default\n") | |
2103 | { | |
2104 | struct bgp *bgp; | |
2105 | ||
2106 | bgp = vty->index; | |
2107 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2108 | return CMD_SUCCESS; | |
2109 | } | |
6b0655a2 | 2110 | |
718e3744 | 2111 | /* "bgp import-check" configuration. */ |
2112 | DEFUN (bgp_network_import_check, | |
2113 | bgp_network_import_check_cmd, | |
078430f6 | 2114 | "bgp network import-check {exact}", |
718e3744 | 2115 | "BGP specific commands\n" |
2116 | "BGP network command\n" | |
078430f6 DS |
2117 | "Check BGP network route exists in IGP\n" |
2118 | "Match route precisely") | |
718e3744 | 2119 | { |
2120 | struct bgp *bgp; | |
078430f6 | 2121 | int trigger = 0; |
718e3744 | 2122 | |
2123 | bgp = vty->index; | |
078430f6 DS |
2124 | if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2125 | { | |
2126 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
2127 | trigger = 1; | |
2128 | } | |
2129 | ||
2130 | if (argv[0] != NULL) | |
2131 | { | |
2132 | if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH)) | |
2133 | { | |
2134 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH); | |
2135 | trigger = 1; | |
2136 | } | |
2137 | } | |
2138 | else if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH)) | |
2139 | { | |
2140 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH); | |
2141 | trigger = 1; | |
2142 | } | |
2143 | ||
2144 | if (trigger) | |
2145 | bgp_static_redo_import_check(bgp); | |
2146 | ||
718e3744 | 2147 | return CMD_SUCCESS; |
2148 | } | |
2149 | ||
2150 | DEFUN (no_bgp_network_import_check, | |
2151 | no_bgp_network_import_check_cmd, | |
078430f6 | 2152 | "no bgp network import-check {exact}", |
718e3744 | 2153 | NO_STR |
2154 | "BGP specific commands\n" | |
2155 | "BGP network command\n" | |
2156 | "Check BGP network route exists in IGP\n") | |
2157 | { | |
2158 | struct bgp *bgp; | |
2159 | ||
2160 | bgp = vty->index; | |
078430f6 DS |
2161 | if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2162 | { | |
2163 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
2164 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK_EXACT_MATCH); | |
2165 | bgp_static_redo_import_check(bgp); | |
2166 | } | |
718e3744 | 2167 | return CMD_SUCCESS; |
2168 | } | |
6b0655a2 | 2169 | |
718e3744 | 2170 | DEFUN (bgp_default_local_preference, |
2171 | bgp_default_local_preference_cmd, | |
2172 | "bgp default local-preference <0-4294967295>", | |
2173 | "BGP specific commands\n" | |
2174 | "Configure BGP defaults\n" | |
2175 | "local preference (higher=more preferred)\n" | |
2176 | "Configure default local preference value\n") | |
2177 | { | |
2178 | struct bgp *bgp; | |
2179 | u_int32_t local_pref; | |
2180 | ||
2181 | bgp = vty->index; | |
2182 | ||
2183 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
2184 | ||
2185 | bgp_default_local_preference_set (bgp, local_pref); | |
7aafcaca | 2186 | bgp_clear_star_soft_in (vty); |
718e3744 | 2187 | |
2188 | return CMD_SUCCESS; | |
2189 | } | |
2190 | ||
2191 | DEFUN (no_bgp_default_local_preference, | |
2192 | no_bgp_default_local_preference_cmd, | |
2193 | "no bgp default local-preference", | |
2194 | NO_STR | |
2195 | "BGP specific commands\n" | |
2196 | "Configure BGP defaults\n" | |
2197 | "local preference (higher=more preferred)\n") | |
2198 | { | |
2199 | struct bgp *bgp; | |
2200 | ||
2201 | bgp = vty->index; | |
2202 | bgp_default_local_preference_unset (bgp); | |
7aafcaca DS |
2203 | bgp_clear_star_soft_in (vty); |
2204 | ||
718e3744 | 2205 | return CMD_SUCCESS; |
2206 | } | |
2207 | ||
2208 | ALIAS (no_bgp_default_local_preference, | |
2209 | no_bgp_default_local_preference_val_cmd, | |
2210 | "no bgp default local-preference <0-4294967295>", | |
2211 | NO_STR | |
2212 | "BGP specific commands\n" | |
2213 | "Configure BGP defaults\n" | |
2214 | "local preference (higher=more preferred)\n" | |
2215 | "Configure default local preference value\n") | |
6b0655a2 | 2216 | |
3f9c7369 DS |
2217 | DEFUN (bgp_default_subgroup_pkt_queue_max, |
2218 | bgp_default_subgroup_pkt_queue_max_cmd, | |
2219 | "bgp default subgroup-pkt-queue-max <20-100>", | |
2220 | "BGP specific commands\n" | |
2221 | "Configure BGP defaults\n" | |
2222 | "subgroup-pkt-queue-max\n" | |
2223 | "Configure subgroup packet queue max\n") | |
8bd9d948 | 2224 | { |
3f9c7369 DS |
2225 | struct bgp *bgp; |
2226 | u_int32_t max_size; | |
8bd9d948 | 2227 | |
3f9c7369 DS |
2228 | bgp = vty->index; |
2229 | ||
2230 | VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]); | |
2231 | ||
2232 | bgp_default_subgroup_pkt_queue_max_set (bgp, max_size); | |
2233 | ||
2234 | return CMD_SUCCESS; | |
2235 | } | |
2236 | ||
2237 | DEFUN (no_bgp_default_subgroup_pkt_queue_max, | |
2238 | no_bgp_default_subgroup_pkt_queue_max_cmd, | |
2239 | "no bgp default subgroup-pkt-queue-max", | |
2240 | NO_STR | |
2241 | "BGP specific commands\n" | |
2242 | "Configure BGP defaults\n" | |
2243 | "subgroup-pkt-queue-max\n") | |
2244 | { | |
2245 | struct bgp *bgp; | |
2246 | ||
2247 | bgp = vty->index; | |
2248 | bgp_default_subgroup_pkt_queue_max_unset (bgp); | |
2249 | return CMD_SUCCESS; | |
8bd9d948 DS |
2250 | } |
2251 | ||
2252 | DEFUN (bgp_rr_allow_outbound_policy, | |
2253 | bgp_rr_allow_outbound_policy_cmd, | |
2254 | "bgp route-reflector allow-outbound-policy", | |
2255 | "BGP specific commands\n" | |
2256 | "Allow modifications made by out route-map\n" | |
2257 | "on ibgp neighbors\n") | |
2258 | { | |
2259 | struct bgp *bgp; | |
8bd9d948 DS |
2260 | |
2261 | bgp = vty->index; | |
2262 | ||
2263 | if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2264 | { | |
2265 | bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2266 | update_group_announce_rrclients(bgp); |
7aafcaca | 2267 | bgp_clear_star_soft_out (vty); |
8bd9d948 DS |
2268 | } |
2269 | ||
2270 | return CMD_SUCCESS; | |
2271 | } | |
2272 | ||
2273 | DEFUN (no_bgp_rr_allow_outbound_policy, | |
2274 | no_bgp_rr_allow_outbound_policy_cmd, | |
2275 | "no bgp route-reflector allow-outbound-policy", | |
2276 | NO_STR | |
2277 | "BGP specific commands\n" | |
2278 | "Allow modifications made by out route-map\n" | |
2279 | "on ibgp neighbors\n") | |
2280 | { | |
2281 | struct bgp *bgp; | |
8bd9d948 DS |
2282 | |
2283 | bgp = vty->index; | |
2284 | ||
2285 | if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2286 | { | |
2287 | bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2288 | update_group_announce_rrclients(bgp); |
7aafcaca | 2289 | bgp_clear_star_soft_out (vty); |
8bd9d948 DS |
2290 | } |
2291 | ||
2292 | return CMD_SUCCESS; | |
2293 | } | |
2294 | ||
f14e6fdb DS |
2295 | DEFUN (bgp_listen_limit, |
2296 | bgp_listen_limit_cmd, | |
2297 | "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2298 | "BGP specific commands\n" | |
2299 | "Configure BGP defaults\n" | |
2300 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2301 | "Configure Dynamic Neighbors listen limit value\n") | |
2302 | { | |
2303 | struct bgp *bgp; | |
2304 | int listen_limit; | |
2305 | ||
2306 | bgp = vty->index; | |
2307 | ||
2308 | VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0], | |
2309 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN, | |
2310 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX); | |
2311 | ||
2312 | bgp_listen_limit_set (bgp, listen_limit); | |
2313 | ||
2314 | return CMD_SUCCESS; | |
2315 | } | |
2316 | ||
2317 | DEFUN (no_bgp_listen_limit, | |
2318 | no_bgp_listen_limit_cmd, | |
2319 | "no bgp listen limit", | |
2320 | "BGP specific commands\n" | |
2321 | "Configure BGP defaults\n" | |
2322 | "unset maximum number of BGP Dynamic Neighbors that can be created\n" | |
2323 | "Configure Dynamic Neighbors listen limit value to default\n") | |
2324 | { | |
2325 | struct bgp *bgp; | |
2326 | ||
2327 | bgp = vty->index; | |
2328 | bgp_listen_limit_unset (bgp); | |
2329 | return CMD_SUCCESS; | |
2330 | } | |
2331 | ||
2332 | ||
2333 | DEFUN (bgp_listen_range, | |
2334 | bgp_listen_range_cmd, | |
2335 | LISTEN_RANGE_CMD "peer-group WORD" , | |
2336 | "BGP specific commands\n" | |
2337 | "Configure BGP Dynamic Neighbors\n" | |
2338 | "add a listening range for Dynamic Neighbors\n" | |
2339 | LISTEN_RANGE_ADDR_STR) | |
2340 | { | |
2341 | struct bgp *bgp; | |
2342 | struct prefix range; | |
2343 | struct peer_group *group; | |
2344 | afi_t afi; | |
2345 | int ret; | |
2346 | ||
2347 | bgp = vty->index; | |
2348 | ||
2349 | //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2350 | ||
2351 | /* Convert IP prefix string to struct prefix. */ | |
2352 | ret = str2prefix (argv[0], &range); | |
2353 | if (! ret) | |
2354 | { | |
2355 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2356 | return CMD_WARNING; | |
2357 | } | |
2358 | ||
2359 | afi = family2afi(range.family); | |
2360 | ||
2361 | #ifdef HAVE_IPV6 | |
2362 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2363 | { | |
2364 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2365 | VTY_NEWLINE); | |
2366 | return CMD_WARNING; | |
2367 | } | |
2368 | #endif /* HAVE_IPV6 */ | |
2369 | ||
2370 | apply_mask (&range); | |
2371 | ||
2372 | ||
2373 | group = peer_group_lookup (bgp, argv[1]); | |
2374 | if (! group) | |
2375 | { | |
2376 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2377 | return CMD_WARNING; | |
2378 | } | |
2379 | ||
2380 | ret = peer_group_listen_range_add(group, &range); | |
2381 | return bgp_vty_return (vty, ret); | |
2382 | } | |
2383 | ||
2384 | DEFUN (no_bgp_listen_range, | |
2385 | no_bgp_listen_range_cmd, | |
2386 | "no bgp listen range A.B.C.D/M peer-group WORD" , | |
2387 | "BGP specific commands\n" | |
2388 | "Configure BGP defaults\n" | |
2389 | "delete a listening range for Dynamic Neighbors\n" | |
2390 | "Remove Dynamic Neighbors listening range\n") | |
2391 | { | |
2392 | struct bgp *bgp; | |
2393 | struct prefix range; | |
2394 | struct peer_group *group; | |
2395 | afi_t afi; | |
2396 | int ret; | |
2397 | ||
2398 | bgp = vty->index; | |
2399 | ||
2400 | // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2401 | ||
2402 | /* Convert IP prefix string to struct prefix. */ | |
2403 | ret = str2prefix (argv[0], &range); | |
2404 | if (! ret) | |
2405 | { | |
2406 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2407 | return CMD_WARNING; | |
2408 | } | |
2409 | ||
2410 | afi = family2afi(range.family); | |
2411 | ||
2412 | #ifdef HAVE_IPV6 | |
2413 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2414 | { | |
2415 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2416 | VTY_NEWLINE); | |
2417 | return CMD_WARNING; | |
2418 | } | |
2419 | #endif /* HAVE_IPV6 */ | |
2420 | ||
2421 | apply_mask (&range); | |
2422 | ||
2423 | ||
2424 | group = peer_group_lookup (bgp, argv[1]); | |
2425 | if (! group) | |
2426 | { | |
2427 | vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); | |
2428 | return CMD_WARNING; | |
2429 | } | |
2430 | ||
2431 | ret = peer_group_listen_range_del(group, &range); | |
2432 | return bgp_vty_return (vty, ret); | |
2433 | } | |
2434 | ||
2435 | int | |
2436 | bgp_config_write_listen (struct vty *vty, struct bgp *bgp) | |
2437 | { | |
2438 | struct peer_group *group; | |
2439 | struct listnode *node, *nnode, *rnode, *nrnode; | |
2440 | struct prefix *range; | |
2441 | afi_t afi; | |
2442 | char buf[128]; | |
2443 | ||
2444 | if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT) | |
2445 | vty_out (vty, " bgp listen limit %d%s", | |
2446 | bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
2447 | ||
2448 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2449 | { | |
2450 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
2451 | { | |
2452 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range)) | |
2453 | { | |
2454 | prefix2str(range, buf, sizeof(buf)); | |
2455 | vty_out(vty, " bgp listen range %s peer-group %s%s", | |
2456 | buf, group->name, VTY_NEWLINE); | |
2457 | } | |
2458 | } | |
2459 | } | |
2460 | ||
2461 | return 0; | |
2462 | } | |
2463 | ||
2464 | ||
907f92c8 DS |
2465 | DEFUN (bgp_disable_connected_route_check, |
2466 | bgp_disable_connected_route_check_cmd, | |
2467 | "bgp disable-ebgp-connected-route-check", | |
2468 | "BGP specific commands\n" | |
2469 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2470 | { | |
2471 | struct bgp *bgp; | |
2472 | ||
2473 | bgp = vty->index; | |
2474 | bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
7aafcaca DS |
2475 | bgp_clear_star_soft_in (vty); |
2476 | ||
907f92c8 DS |
2477 | return CMD_SUCCESS; |
2478 | } | |
2479 | ||
2480 | DEFUN (no_bgp_disable_connected_route_check, | |
2481 | no_bgp_disable_connected_route_check_cmd, | |
2482 | "no bgp disable-ebgp-connected-route-check", | |
2483 | NO_STR | |
2484 | "BGP specific commands\n" | |
2485 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2486 | { | |
2487 | struct bgp *bgp; | |
2488 | ||
2489 | bgp = vty->index; | |
2490 | bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
7aafcaca DS |
2491 | bgp_clear_star_soft_in (vty); |
2492 | ||
907f92c8 DS |
2493 | return CMD_SUCCESS; |
2494 | } | |
2495 | ||
2496 | ||
718e3744 | 2497 | static int |
fd79ac91 | 2498 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
2499 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 2500 | { |
2501 | int ret; | |
2502 | struct bgp *bgp; | |
2503 | as_t as; | |
0299c004 | 2504 | int as_type = AS_SPECIFIED; |
718e3744 | 2505 | union sockunion su; |
2506 | ||
2507 | bgp = vty->index; | |
2508 | ||
0299c004 DS |
2509 | if (strncmp(as_str, "internal", strlen("internal")) == 0) |
2510 | { | |
2511 | as = 0; | |
2512 | as_type = AS_INTERNAL; | |
2513 | } | |
2514 | else if (strncmp(as_str, "external", strlen("external")) == 0) | |
2515 | { | |
2516 | as = 0; | |
2517 | as_type = AS_EXTERNAL; | |
2518 | } | |
2519 | else | |
2520 | { | |
2521 | /* Get AS number. */ | |
2522 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); | |
2523 | } | |
718e3744 | 2524 | |
2525 | /* If peer is peer group, call proper function. */ | |
2526 | ret = str2sockunion (peer_str, &su); | |
2527 | if (ret < 0) | |
2528 | { | |
a80beece | 2529 | /* Check for peer by interface */ |
0299c004 | 2530 | ret = peer_remote_as (bgp, NULL, peer_str, &as, as_type, afi, safi); |
718e3744 | 2531 | if (ret < 0) |
a80beece | 2532 | { |
0299c004 | 2533 | ret = peer_group_remote_as (bgp, peer_str, &as, as_type); |
a80beece DS |
2534 | if (ret < 0) |
2535 | { | |
2536 | vty_out (vty, "%% Create the peer-group or interface first%s", | |
2537 | VTY_NEWLINE); | |
2538 | return CMD_WARNING; | |
2539 | } | |
2540 | return CMD_SUCCESS; | |
2541 | } | |
718e3744 | 2542 | } |
a80beece | 2543 | else |
718e3744 | 2544 | { |
a80beece DS |
2545 | if (peer_address_self_check (&su)) |
2546 | { | |
2547 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2548 | VTY_NEWLINE); | |
2549 | return CMD_WARNING; | |
2550 | } | |
0299c004 | 2551 | ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi); |
718e3744 | 2552 | } |
2553 | ||
718e3744 | 2554 | /* This peer belongs to peer group. */ |
2555 | switch (ret) | |
2556 | { | |
2557 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 2558 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 2559 | return CMD_WARNING; |
718e3744 | 2560 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 2561 | 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 | 2562 | return CMD_WARNING; |
718e3744 | 2563 | } |
2564 | return bgp_vty_return (vty, ret); | |
2565 | } | |
2566 | ||
2567 | DEFUN (neighbor_remote_as, | |
2568 | neighbor_remote_as_cmd, | |
0299c004 | 2569 | NEIGHBOR_CMD2 "remote-as (" CMD_AS_RANGE "|external|internal)", |
718e3744 | 2570 | NEIGHBOR_STR |
2571 | NEIGHBOR_ADDR_STR2 | |
2572 | "Specify a BGP neighbor\n" | |
2573 | AS_STR) | |
2574 | { | |
2575 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
2576 | } | |
6b0655a2 | 2577 | |
a80beece DS |
2578 | DEFUN (neighbor_interface_config, |
2579 | neighbor_interface_config_cmd, | |
8ffedcea | 2580 | "neighbor WORD interface {v6only}", |
a80beece DS |
2581 | NEIGHBOR_STR |
2582 | "Interface name or neighbor tag\n" | |
8ffedcea DS |
2583 | "Enable BGP on interface\n" |
2584 | "Enable BGP with v6 link-local only\n") | |
a80beece DS |
2585 | { |
2586 | struct bgp *bgp; | |
2587 | struct peer *peer; | |
2588 | struct peer_group *group; | |
2589 | ||
2590 | bgp = vty->index; | |
2591 | group = peer_group_lookup (bgp, argv[0]); | |
2592 | if (group) | |
2593 | { | |
2594 | vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE); | |
2595 | return CMD_WARNING; | |
2596 | } | |
2597 | ||
8ffedcea DS |
2598 | if (argv[1] != NULL) |
2599 | peer = peer_conf_interface_get (bgp, argv[0], AFI_IP, SAFI_UNICAST, 1); | |
2600 | else | |
2601 | peer = peer_conf_interface_get (bgp, argv[0], AFI_IP, SAFI_UNICAST, 0); | |
a80beece DS |
2602 | if (!peer) |
2603 | return CMD_WARNING; | |
2604 | ||
2605 | return CMD_SUCCESS; | |
2606 | } | |
2607 | ||
2608 | ||
718e3744 | 2609 | DEFUN (neighbor_peer_group, |
2610 | neighbor_peer_group_cmd, | |
2611 | "neighbor WORD peer-group", | |
2612 | NEIGHBOR_STR | |
a80beece | 2613 | "Interface name or neighbor tag\n" |
718e3744 | 2614 | "Configure peer-group\n") |
2615 | { | |
2616 | struct bgp *bgp; | |
a80beece | 2617 | struct peer *peer; |
718e3744 | 2618 | struct peer_group *group; |
2619 | ||
2620 | bgp = vty->index; | |
a80beece DS |
2621 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2622 | if (peer) | |
2623 | { | |
2624 | vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); | |
2625 | return CMD_WARNING; | |
2626 | } | |
718e3744 | 2627 | |
2628 | group = peer_group_get (bgp, argv[0]); | |
2629 | if (! group) | |
2630 | return CMD_WARNING; | |
2631 | ||
2632 | return CMD_SUCCESS; | |
2633 | } | |
2634 | ||
2635 | DEFUN (no_neighbor, | |
2636 | no_neighbor_cmd, | |
2637 | NO_NEIGHBOR_CMD2, | |
2638 | NO_STR | |
2639 | NEIGHBOR_STR | |
2640 | NEIGHBOR_ADDR_STR2) | |
2641 | { | |
2642 | int ret; | |
2643 | union sockunion su; | |
2644 | struct peer_group *group; | |
2645 | struct peer *peer; | |
1ff9a340 | 2646 | struct peer *other; |
718e3744 | 2647 | |
2648 | ret = str2sockunion (argv[0], &su); | |
2649 | if (ret < 0) | |
2650 | { | |
a80beece DS |
2651 | /* look up for neighbor by interface name config. */ |
2652 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2653 | if (peer) | |
2654 | { | |
2655 | peer_delete (peer); | |
2656 | return CMD_SUCCESS; | |
2657 | } | |
2658 | ||
718e3744 | 2659 | group = peer_group_lookup (vty->index, argv[0]); |
2660 | if (group) | |
2661 | peer_group_delete (group); | |
2662 | else | |
2663 | { | |
2664 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2665 | return CMD_WARNING; | |
2666 | } | |
2667 | } | |
2668 | else | |
2669 | { | |
2670 | peer = peer_lookup (vty->index, &su); | |
2671 | if (peer) | |
1ff9a340 | 2672 | { |
f14e6fdb DS |
2673 | if (peer_dynamic_neighbor (peer)) |
2674 | { | |
2675 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
2676 | VTY_NEWLINE); | |
2677 | return CMD_WARNING; | |
2678 | } | |
2679 | ||
1ff9a340 DS |
2680 | other = peer->doppelganger; |
2681 | peer_delete (peer); | |
2682 | if (other && other->status != Deleted) | |
2683 | peer_delete(other); | |
2684 | } | |
718e3744 | 2685 | } |
2686 | ||
2687 | return CMD_SUCCESS; | |
2688 | } | |
2689 | ||
2690 | ALIAS (no_neighbor, | |
2691 | no_neighbor_remote_as_cmd, | |
0299c004 | 2692 | NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 2693 | NO_STR |
2694 | NEIGHBOR_STR | |
2695 | NEIGHBOR_ADDR_STR | |
2696 | "Specify a BGP neighbor\n" | |
2697 | AS_STR) | |
2698 | ||
a80beece DS |
2699 | DEFUN (no_neighbor_interface_config, |
2700 | no_neighbor_interface_config_cmd, | |
2701 | "no neighbor WORD interface", | |
2702 | NO_STR | |
2703 | NEIGHBOR_STR | |
2704 | "Interface name\n" | |
2705 | "Configure BGP on interface\n") | |
2706 | { | |
2707 | struct peer *peer; | |
2708 | ||
2709 | /* look up for neighbor by interface name config. */ | |
2710 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2711 | if (peer) | |
2712 | { | |
2713 | peer_delete (peer); | |
2714 | } | |
2715 | else | |
2716 | { | |
2717 | vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE); | |
2718 | return CMD_WARNING; | |
2719 | } | |
2720 | return CMD_SUCCESS; | |
2721 | } | |
2722 | ||
718e3744 | 2723 | DEFUN (no_neighbor_peer_group, |
2724 | no_neighbor_peer_group_cmd, | |
2725 | "no neighbor WORD peer-group", | |
2726 | NO_STR | |
2727 | NEIGHBOR_STR | |
2728 | "Neighbor tag\n" | |
2729 | "Configure peer-group\n") | |
2730 | { | |
2731 | struct peer_group *group; | |
2732 | ||
2733 | group = peer_group_lookup (vty->index, argv[0]); | |
2734 | if (group) | |
2735 | peer_group_delete (group); | |
2736 | else | |
2737 | { | |
2738 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2739 | return CMD_WARNING; | |
2740 | } | |
2741 | return CMD_SUCCESS; | |
2742 | } | |
2743 | ||
a80beece DS |
2744 | DEFUN (no_neighbor_interface_peer_group_remote_as, |
2745 | no_neighbor_interface_peer_group_remote_as_cmd, | |
0299c004 | 2746 | "no neighbor WORD remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 2747 | NO_STR |
2748 | NEIGHBOR_STR | |
a80beece | 2749 | "Interface name or neighbor tag\n" |
718e3744 | 2750 | "Specify a BGP neighbor\n" |
2751 | AS_STR) | |
2752 | { | |
2753 | struct peer_group *group; | |
a80beece DS |
2754 | struct peer *peer; |
2755 | ||
2756 | /* look up for neighbor by interface name config. */ | |
2757 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2758 | if (peer) | |
2759 | { | |
0299c004 | 2760 | peer_as_change (peer, 0, AS_SPECIFIED); |
a80beece DS |
2761 | return CMD_SUCCESS; |
2762 | } | |
718e3744 | 2763 | |
2764 | group = peer_group_lookup (vty->index, argv[0]); | |
2765 | if (group) | |
2766 | peer_group_remote_as_delete (group); | |
2767 | else | |
2768 | { | |
a80beece | 2769 | vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE); |
718e3744 | 2770 | return CMD_WARNING; |
2771 | } | |
2772 | return CMD_SUCCESS; | |
2773 | } | |
6b0655a2 | 2774 | |
718e3744 | 2775 | DEFUN (neighbor_local_as, |
2776 | neighbor_local_as_cmd, | |
320da874 | 2777 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 2778 | NEIGHBOR_STR |
2779 | NEIGHBOR_ADDR_STR2 | |
2780 | "Specify a local-as number\n" | |
2781 | "AS number used as local AS\n") | |
2782 | { | |
2783 | struct peer *peer; | |
2784 | int ret; | |
2785 | ||
2786 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2787 | if (! peer) | |
2788 | return CMD_WARNING; | |
2789 | ||
9d3f9705 | 2790 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
718e3744 | 2791 | return bgp_vty_return (vty, ret); |
2792 | } | |
2793 | ||
2794 | DEFUN (neighbor_local_as_no_prepend, | |
2795 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 2796 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 2797 | NEIGHBOR_STR |
2798 | NEIGHBOR_ADDR_STR2 | |
2799 | "Specify a local-as number\n" | |
2800 | "AS number used as local AS\n" | |
2801 | "Do not prepend local-as to updates from ebgp peers\n") | |
2802 | { | |
2803 | struct peer *peer; | |
2804 | int ret; | |
2805 | ||
2806 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2807 | if (! peer) | |
2808 | return CMD_WARNING; | |
2809 | ||
9d3f9705 | 2810 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
718e3744 | 2811 | return bgp_vty_return (vty, ret); |
2812 | } | |
2813 | ||
9d3f9705 AC |
2814 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
2815 | neighbor_local_as_no_prepend_replace_as_cmd, | |
2816 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
2817 | NEIGHBOR_STR | |
2818 | NEIGHBOR_ADDR_STR2 | |
2819 | "Specify a local-as number\n" | |
2820 | "AS number used as local AS\n" | |
2821 | "Do not prepend local-as to updates from ebgp peers\n" | |
2822 | "Do not prepend local-as to updates from ibgp peers\n") | |
2823 | { | |
2824 | struct peer *peer; | |
2825 | int ret; | |
2826 | ||
2827 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2828 | if (! peer) | |
2829 | return CMD_WARNING; | |
2830 | ||
2831 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); | |
2832 | return bgp_vty_return (vty, ret); | |
2833 | } | |
2834 | ||
2835 | ||
718e3744 | 2836 | DEFUN (no_neighbor_local_as, |
2837 | no_neighbor_local_as_cmd, | |
2838 | NO_NEIGHBOR_CMD2 "local-as", | |
2839 | NO_STR | |
2840 | NEIGHBOR_STR | |
2841 | NEIGHBOR_ADDR_STR2 | |
2842 | "Specify a local-as number\n") | |
2843 | { | |
2844 | struct peer *peer; | |
2845 | int ret; | |
2846 | ||
2847 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2848 | if (! peer) | |
2849 | return CMD_WARNING; | |
2850 | ||
2851 | ret = peer_local_as_unset (peer); | |
2852 | return bgp_vty_return (vty, ret); | |
2853 | } | |
2854 | ||
2855 | ALIAS (no_neighbor_local_as, | |
2856 | no_neighbor_local_as_val_cmd, | |
320da874 | 2857 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 2858 | NO_STR |
2859 | NEIGHBOR_STR | |
2860 | NEIGHBOR_ADDR_STR2 | |
2861 | "Specify a local-as number\n" | |
2862 | "AS number used as local AS\n") | |
2863 | ||
2864 | ALIAS (no_neighbor_local_as, | |
2865 | no_neighbor_local_as_val2_cmd, | |
320da874 | 2866 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 2867 | NO_STR |
2868 | NEIGHBOR_STR | |
2869 | NEIGHBOR_ADDR_STR2 | |
2870 | "Specify a local-as number\n" | |
2871 | "AS number used as local AS\n" | |
2872 | "Do not prepend local-as to updates from ebgp peers\n") | |
9d3f9705 AC |
2873 | |
2874 | ALIAS (no_neighbor_local_as, | |
2875 | no_neighbor_local_as_val3_cmd, | |
2876 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
2877 | NO_STR | |
2878 | NEIGHBOR_STR | |
2879 | NEIGHBOR_ADDR_STR2 | |
2880 | "Specify a local-as number\n" | |
2881 | "AS number used as local AS\n" | |
2882 | "Do not prepend local-as to updates from ebgp peers\n" | |
2883 | "Do not prepend local-as to updates from ibgp peers\n") | |
6b0655a2 | 2884 | |
3f9c7369 DS |
2885 | DEFUN (neighbor_solo, |
2886 | neighbor_solo_cmd, | |
2887 | NEIGHBOR_CMD2 "solo", | |
2888 | NEIGHBOR_STR | |
2889 | NEIGHBOR_ADDR_STR2 | |
2890 | "Solo peer - part of its own update group\n") | |
2891 | { | |
2892 | struct peer *peer; | |
2893 | int ret; | |
2894 | ||
2895 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2896 | if (! peer) | |
2897 | return CMD_WARNING; | |
2898 | ||
2899 | ret = update_group_adjust_soloness(peer, 1); | |
2900 | return bgp_vty_return (vty, ret); | |
2901 | } | |
2902 | ||
2903 | DEFUN (no_neighbor_solo, | |
2904 | no_neighbor_solo_cmd, | |
2905 | NO_NEIGHBOR_CMD2 "solo", | |
2906 | NO_STR | |
2907 | NEIGHBOR_STR | |
2908 | NEIGHBOR_ADDR_STR2 | |
2909 | "Solo peer - part of its own update group\n") | |
2910 | { | |
2911 | struct peer *peer; | |
2912 | int ret; | |
2913 | ||
2914 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2915 | if (! peer) | |
2916 | return CMD_WARNING; | |
2917 | ||
2918 | ret = update_group_adjust_soloness(peer, 0); | |
2919 | return bgp_vty_return (vty, ret); | |
2920 | } | |
2921 | ||
0df7c91f PJ |
2922 | DEFUN (neighbor_password, |
2923 | neighbor_password_cmd, | |
2924 | NEIGHBOR_CMD2 "password LINE", | |
2925 | NEIGHBOR_STR | |
2926 | NEIGHBOR_ADDR_STR2 | |
2927 | "Set a password\n" | |
2928 | "The password\n") | |
2929 | { | |
2930 | struct peer *peer; | |
2931 | int ret; | |
2932 | ||
2933 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2934 | if (! peer) | |
2935 | return CMD_WARNING; | |
2936 | ||
2937 | ret = peer_password_set (peer, argv[1]); | |
2938 | return bgp_vty_return (vty, ret); | |
2939 | } | |
2940 | ||
2941 | DEFUN (no_neighbor_password, | |
2942 | no_neighbor_password_cmd, | |
2943 | NO_NEIGHBOR_CMD2 "password", | |
2944 | NO_STR | |
2945 | NEIGHBOR_STR | |
2946 | NEIGHBOR_ADDR_STR2 | |
2947 | "Set a password\n") | |
2948 | { | |
2949 | struct peer *peer; | |
2950 | int ret; | |
2951 | ||
2952 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2953 | if (! peer) | |
2954 | return CMD_WARNING; | |
2955 | ||
2956 | ret = peer_password_unset (peer); | |
2957 | return bgp_vty_return (vty, ret); | |
2958 | } | |
6b0655a2 | 2959 | |
718e3744 | 2960 | DEFUN (neighbor_activate, |
2961 | neighbor_activate_cmd, | |
2962 | NEIGHBOR_CMD2 "activate", | |
2963 | NEIGHBOR_STR | |
2964 | NEIGHBOR_ADDR_STR2 | |
2965 | "Enable the Address Family for this Neighbor\n") | |
2966 | { | |
2967 | struct peer *peer; | |
2968 | ||
2969 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2970 | if (! peer) | |
2971 | return CMD_WARNING; | |
2972 | ||
2973 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
2974 | ||
2975 | return CMD_SUCCESS; | |
2976 | } | |
2977 | ||
2978 | DEFUN (no_neighbor_activate, | |
2979 | no_neighbor_activate_cmd, | |
2980 | NO_NEIGHBOR_CMD2 "activate", | |
2981 | NO_STR | |
2982 | NEIGHBOR_STR | |
2983 | NEIGHBOR_ADDR_STR2 | |
2984 | "Enable the Address Family for this Neighbor\n") | |
2985 | { | |
2986 | int ret; | |
2987 | struct peer *peer; | |
2988 | ||
2989 | /* Lookup peer. */ | |
2990 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2991 | if (! peer) | |
2992 | return CMD_WARNING; | |
2993 | ||
2994 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
2995 | ||
2996 | return bgp_vty_return (vty, ret); | |
2997 | } | |
6b0655a2 | 2998 | |
718e3744 | 2999 | DEFUN (neighbor_set_peer_group, |
3000 | neighbor_set_peer_group_cmd, | |
a80beece | 3001 | NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3002 | NEIGHBOR_STR |
a80beece | 3003 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3004 | "Member of the peer-group\n" |
3005 | "peer-group name\n") | |
3006 | { | |
3007 | int ret; | |
3008 | as_t as; | |
3009 | union sockunion su; | |
3010 | struct bgp *bgp; | |
a80beece | 3011 | struct peer *peer; |
718e3744 | 3012 | struct peer_group *group; |
3013 | ||
3014 | bgp = vty->index; | |
a80beece | 3015 | peer = NULL; |
718e3744 | 3016 | |
3017 | ret = str2sockunion (argv[0], &su); | |
3018 | if (ret < 0) | |
3019 | { | |
a80beece DS |
3020 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
3021 | if (!peer) | |
3022 | { | |
3023 | vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); | |
3024 | return CMD_WARNING; | |
3025 | } | |
3026 | } | |
3027 | else | |
3028 | { | |
3029 | if (peer_address_self_check (&su)) | |
3030 | { | |
3031 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
3032 | VTY_NEWLINE); | |
3033 | return CMD_WARNING; | |
3034 | } | |
f14e6fdb DS |
3035 | |
3036 | /* Disallow for dynamic neighbor. */ | |
3037 | peer = peer_lookup (bgp, &su); | |
3038 | if (peer && peer_dynamic_neighbor (peer)) | |
3039 | { | |
3040 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
3041 | VTY_NEWLINE); | |
3042 | return CMD_WARNING; | |
3043 | } | |
718e3744 | 3044 | } |
3045 | ||
3046 | group = peer_group_lookup (bgp, argv[1]); | |
3047 | if (! group) | |
3048 | { | |
3049 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3050 | return CMD_WARNING; | |
3051 | } | |
3052 | ||
a80beece | 3053 | ret = peer_group_bind (bgp, &su, peer, group, bgp_node_afi (vty), |
718e3744 | 3054 | bgp_node_safi (vty), &as); |
3055 | ||
3056 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
3057 | { | |
aea339f7 | 3058 | 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 | 3059 | return CMD_WARNING; |
3060 | } | |
3061 | ||
3062 | return bgp_vty_return (vty, ret); | |
3063 | } | |
3064 | ||
3065 | DEFUN (no_neighbor_set_peer_group, | |
3066 | no_neighbor_set_peer_group_cmd, | |
a80beece | 3067 | NO_NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3068 | NO_STR |
3069 | NEIGHBOR_STR | |
a80beece | 3070 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3071 | "Member of the peer-group\n" |
3072 | "peer-group name\n") | |
3073 | { | |
3074 | int ret; | |
3075 | struct bgp *bgp; | |
3076 | struct peer *peer; | |
3077 | struct peer_group *group; | |
3078 | ||
3079 | bgp = vty->index; | |
3080 | ||
3081 | peer = peer_lookup_vty (vty, argv[0]); | |
3082 | if (! peer) | |
3083 | return CMD_WARNING; | |
3084 | ||
3085 | group = peer_group_lookup (bgp, argv[1]); | |
3086 | if (! group) | |
3087 | { | |
3088 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3089 | return CMD_WARNING; | |
3090 | } | |
3091 | ||
3092 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), | |
3093 | bgp_node_safi (vty)); | |
3094 | ||
3095 | return bgp_vty_return (vty, ret); | |
3096 | } | |
6b0655a2 | 3097 | |
94f2b392 | 3098 | static int |
fd79ac91 | 3099 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
3100 | u_int16_t flag, int set) | |
718e3744 | 3101 | { |
3102 | int ret; | |
3103 | struct peer *peer; | |
3104 | ||
3105 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3106 | if (! peer) | |
3107 | return CMD_WARNING; | |
3108 | ||
3109 | if (set) | |
3110 | ret = peer_flag_set (peer, flag); | |
3111 | else | |
3112 | ret = peer_flag_unset (peer, flag); | |
3113 | ||
3114 | return bgp_vty_return (vty, ret); | |
3115 | } | |
3116 | ||
94f2b392 | 3117 | static int |
fd79ac91 | 3118 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3119 | { |
3120 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
3121 | } | |
3122 | ||
94f2b392 | 3123 | static int |
fd79ac91 | 3124 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3125 | { |
3126 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
3127 | } | |
3128 | ||
3129 | /* neighbor passive. */ | |
3130 | DEFUN (neighbor_passive, | |
3131 | neighbor_passive_cmd, | |
3132 | NEIGHBOR_CMD2 "passive", | |
3133 | NEIGHBOR_STR | |
3134 | NEIGHBOR_ADDR_STR2 | |
3135 | "Don't send open messages to this neighbor\n") | |
3136 | { | |
3137 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3138 | } | |
3139 | ||
3140 | DEFUN (no_neighbor_passive, | |
3141 | no_neighbor_passive_cmd, | |
3142 | NO_NEIGHBOR_CMD2 "passive", | |
3143 | NO_STR | |
3144 | NEIGHBOR_STR | |
3145 | NEIGHBOR_ADDR_STR2 | |
3146 | "Don't send open messages to this neighbor\n") | |
3147 | { | |
3148 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3149 | } | |
6b0655a2 | 3150 | |
718e3744 | 3151 | /* neighbor shutdown. */ |
3152 | DEFUN (neighbor_shutdown, | |
3153 | neighbor_shutdown_cmd, | |
3154 | NEIGHBOR_CMD2 "shutdown", | |
3155 | NEIGHBOR_STR | |
3156 | NEIGHBOR_ADDR_STR2 | |
3157 | "Administratively shut down this neighbor\n") | |
3158 | { | |
3159 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3160 | } | |
3161 | ||
3162 | DEFUN (no_neighbor_shutdown, | |
3163 | no_neighbor_shutdown_cmd, | |
3164 | NO_NEIGHBOR_CMD2 "shutdown", | |
3165 | NO_STR | |
3166 | NEIGHBOR_STR | |
3167 | NEIGHBOR_ADDR_STR2 | |
3168 | "Administratively shut down this neighbor\n") | |
3169 | { | |
3170 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3171 | } | |
6b0655a2 | 3172 | |
c9502438 | 3173 | /* Deprecated neighbor capability route-refresh. */ |
3174 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, | |
3175 | neighbor_capability_route_refresh_cmd, | |
3176 | NEIGHBOR_CMD2 "capability route-refresh", | |
3177 | NEIGHBOR_STR | |
3178 | NEIGHBOR_ADDR_STR2 | |
3179 | "Advertise capability to the peer\n" | |
3180 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 3181 | { |
c9502438 | 3182 | return CMD_SUCCESS; |
718e3744 | 3183 | } |
3184 | ||
c9502438 | 3185 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
3186 | no_neighbor_capability_route_refresh_cmd, | |
3187 | NO_NEIGHBOR_CMD2 "capability route-refresh", | |
3188 | NO_STR | |
3189 | NEIGHBOR_STR | |
3190 | NEIGHBOR_ADDR_STR2 | |
3191 | "Advertise capability to the peer\n" | |
3192 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 3193 | { |
c9502438 | 3194 | return CMD_SUCCESS; |
718e3744 | 3195 | } |
6b0655a2 | 3196 | |
718e3744 | 3197 | /* neighbor capability dynamic. */ |
3198 | DEFUN (neighbor_capability_dynamic, | |
3199 | neighbor_capability_dynamic_cmd, | |
3200 | NEIGHBOR_CMD2 "capability dynamic", | |
3201 | NEIGHBOR_STR | |
3202 | NEIGHBOR_ADDR_STR2 | |
3203 | "Advertise capability to the peer\n" | |
3204 | "Advertise dynamic capability to this neighbor\n") | |
3205 | { | |
3206 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3207 | } | |
3208 | ||
3209 | DEFUN (no_neighbor_capability_dynamic, | |
3210 | no_neighbor_capability_dynamic_cmd, | |
3211 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
3212 | NO_STR | |
3213 | NEIGHBOR_STR | |
3214 | NEIGHBOR_ADDR_STR2 | |
3215 | "Advertise capability to the peer\n" | |
3216 | "Advertise dynamic capability to this neighbor\n") | |
3217 | { | |
3218 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3219 | } | |
6b0655a2 | 3220 | |
718e3744 | 3221 | /* neighbor dont-capability-negotiate */ |
3222 | DEFUN (neighbor_dont_capability_negotiate, | |
3223 | neighbor_dont_capability_negotiate_cmd, | |
3224 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3225 | NEIGHBOR_STR | |
3226 | NEIGHBOR_ADDR_STR2 | |
3227 | "Do not perform capability negotiation\n") | |
3228 | { | |
3229 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3230 | } | |
3231 | ||
3232 | DEFUN (no_neighbor_dont_capability_negotiate, | |
3233 | no_neighbor_dont_capability_negotiate_cmd, | |
3234 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3235 | NO_STR | |
3236 | NEIGHBOR_STR | |
3237 | NEIGHBOR_ADDR_STR2 | |
3238 | "Do not perform capability negotiation\n") | |
3239 | { | |
3240 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3241 | } | |
6b0655a2 | 3242 | |
8a92a8a0 DS |
3243 | /* neighbor capability extended next hop encoding */ |
3244 | DEFUN (neighbor_capability_enhe, | |
3245 | neighbor_capability_enhe_cmd, | |
3246 | NEIGHBOR_CMD2 "capability extended-nexthop", | |
3247 | NEIGHBOR_STR | |
3248 | NEIGHBOR_ADDR_STR2 | |
3249 | "Advertise capability to the peer\n" | |
3250 | "Advertise extended next-hop capability to the peer\n") | |
3251 | { | |
3252 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3253 | } | |
3254 | ||
3255 | DEFUN (no_neighbor_capability_enhe, | |
3256 | no_neighbor_capability_enhe_cmd, | |
3257 | NO_NEIGHBOR_CMD2 "capability extended-nexthop", | |
3258 | NO_STR | |
3259 | NEIGHBOR_STR | |
3260 | NEIGHBOR_ADDR_STR2 | |
3261 | "Advertise capability to the peer\n" | |
3262 | "Advertise extended next-hop capability to the peer\n") | |
3263 | { | |
3264 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3265 | } | |
3266 | ||
94f2b392 | 3267 | static int |
fd79ac91 | 3268 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3269 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 3270 | { |
3271 | int ret; | |
3272 | struct peer *peer; | |
3273 | ||
3274 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3275 | if (! peer) | |
3276 | return CMD_WARNING; | |
3277 | ||
3278 | if (set) | |
3279 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
3280 | else | |
3281 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
3282 | ||
3283 | return bgp_vty_return (vty, ret); | |
3284 | } | |
3285 | ||
94f2b392 | 3286 | static int |
fd79ac91 | 3287 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3288 | safi_t safi, u_int32_t flag) |
718e3744 | 3289 | { |
3290 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
3291 | } | |
3292 | ||
94f2b392 | 3293 | static int |
fd79ac91 | 3294 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3295 | safi_t safi, u_int32_t flag) |
718e3744 | 3296 | { |
3297 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
3298 | } | |
6b0655a2 | 3299 | |
718e3744 | 3300 | /* neighbor capability orf prefix-list. */ |
3301 | DEFUN (neighbor_capability_orf_prefix, | |
3302 | neighbor_capability_orf_prefix_cmd, | |
3303 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3304 | NEIGHBOR_STR | |
3305 | NEIGHBOR_ADDR_STR2 | |
3306 | "Advertise capability to the peer\n" | |
3307 | "Advertise ORF capability to the peer\n" | |
3308 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3309 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3310 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3311 | "Capability to SEND the ORF to this neighbor\n") | |
3312 | { | |
3313 | u_int16_t flag = 0; | |
3314 | ||
3315 | if (strncmp (argv[1], "s", 1) == 0) | |
3316 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3317 | else if (strncmp (argv[1], "r", 1) == 0) | |
3318 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3319 | else if (strncmp (argv[1], "b", 1) == 0) | |
3320 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3321 | else | |
3322 | return CMD_WARNING; | |
3323 | ||
3324 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3325 | bgp_node_safi (vty), flag); | |
3326 | } | |
3327 | ||
3328 | DEFUN (no_neighbor_capability_orf_prefix, | |
3329 | no_neighbor_capability_orf_prefix_cmd, | |
3330 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3331 | NO_STR | |
3332 | NEIGHBOR_STR | |
3333 | NEIGHBOR_ADDR_STR2 | |
3334 | "Advertise capability to the peer\n" | |
3335 | "Advertise ORF capability to the peer\n" | |
3336 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3337 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3338 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3339 | "Capability to SEND the ORF to this neighbor\n") | |
3340 | { | |
3341 | u_int16_t flag = 0; | |
3342 | ||
3343 | if (strncmp (argv[1], "s", 1) == 0) | |
3344 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3345 | else if (strncmp (argv[1], "r", 1) == 0) | |
3346 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3347 | else if (strncmp (argv[1], "b", 1) == 0) | |
3348 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3349 | else | |
3350 | return CMD_WARNING; | |
3351 | ||
3352 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3353 | bgp_node_safi (vty), flag); | |
3354 | } | |
6b0655a2 | 3355 | |
718e3744 | 3356 | /* neighbor next-hop-self. */ |
3357 | DEFUN (neighbor_nexthop_self, | |
3358 | neighbor_nexthop_self_cmd, | |
a538debe | 3359 | NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3360 | NEIGHBOR_STR |
3361 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3362 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3363 | { |
a538debe DS |
3364 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3365 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); | |
3366 | } | |
9e7a53c1 | 3367 | |
a538debe DS |
3368 | /* neighbor next-hop-self. */ |
3369 | DEFUN (neighbor_nexthop_self_force, | |
3370 | neighbor_nexthop_self_force_cmd, | |
3371 | NEIGHBOR_CMD2 "next-hop-self force", | |
3372 | NEIGHBOR_STR | |
3373 | NEIGHBOR_ADDR_STR2 | |
3374 | "Disable the next hop calculation for this neighbor\n" | |
3375 | "Set the next hop to self for reflected routes\n") | |
3376 | { | |
3377 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3378 | bgp_node_safi (vty), | |
3379 | (PEER_FLAG_FORCE_NEXTHOP_SELF | | |
3380 | PEER_FLAG_NEXTHOP_SELF)); | |
718e3744 | 3381 | } |
3382 | ||
3383 | DEFUN (no_neighbor_nexthop_self, | |
3384 | no_neighbor_nexthop_self_cmd, | |
a538debe | 3385 | NO_NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3386 | NO_STR |
3387 | NEIGHBOR_STR | |
3388 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3389 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3390 | { |
3391 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
9e7a53c1 | 3392 | bgp_node_safi (vty), |
a538debe DS |
3393 | (PEER_FLAG_NEXTHOP_SELF | |
3394 | PEER_FLAG_FORCE_NEXTHOP_SELF)); | |
718e3744 | 3395 | } |
6b0655a2 | 3396 | |
a538debe DS |
3397 | ALIAS (no_neighbor_nexthop_self, |
3398 | no_neighbor_nexthop_self_force_cmd, | |
3399 | NO_NEIGHBOR_CMD2 "next-hop-self force", | |
3400 | NO_STR | |
3401 | NEIGHBOR_STR | |
3402 | NEIGHBOR_ADDR_STR2 | |
3403 | "Disable the next hop calculation for this neighbor\n" | |
3404 | "Set the next hop to self for reflected routes\n") | |
3405 | ||
c7122e14 DS |
3406 | /* neighbor as-override */ |
3407 | DEFUN (neighbor_as_override, | |
3408 | neighbor_as_override_cmd, | |
3409 | NEIGHBOR_CMD2 "as-override", | |
3410 | NEIGHBOR_STR | |
3411 | NEIGHBOR_ADDR_STR2 | |
3412 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3413 | { | |
3414 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3415 | bgp_node_safi (vty), | |
3416 | PEER_FLAG_AS_OVERRIDE); | |
3417 | } | |
3418 | ||
3419 | DEFUN (no_neighbor_as_override, | |
3420 | no_neighbor_as_override_cmd, | |
3421 | NO_NEIGHBOR_CMD2 "as-override", | |
3422 | NO_STR | |
3423 | NEIGHBOR_STR | |
3424 | NEIGHBOR_ADDR_STR2 | |
3425 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3426 | { | |
3427 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3428 | bgp_node_safi (vty), | |
3429 | PEER_FLAG_AS_OVERRIDE); | |
3430 | } | |
3431 | ||
718e3744 | 3432 | /* neighbor remove-private-AS. */ |
3433 | DEFUN (neighbor_remove_private_as, | |
3434 | neighbor_remove_private_as_cmd, | |
3435 | NEIGHBOR_CMD2 "remove-private-AS", | |
3436 | NEIGHBOR_STR | |
3437 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3438 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3439 | { |
5000f21c DS |
3440 | peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
3441 | bgp_node_safi (vty), | |
3442 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL| | |
3443 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
718e3744 | 3444 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3445 | bgp_node_safi (vty), | |
3446 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
3447 | } | |
3448 | ||
5000f21c DS |
3449 | DEFUN (neighbor_remove_private_as_all, |
3450 | neighbor_remove_private_as_all_cmd, | |
3451 | NEIGHBOR_CMD2 "remove-private-AS all", | |
3452 | NEIGHBOR_STR | |
3453 | NEIGHBOR_ADDR_STR2 | |
3454 | "Remove private ASNs in outbound updates\n" | |
3455 | "Apply to all AS numbers") | |
3456 | { | |
3457 | peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3458 | bgp_node_safi (vty), | |
3459 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3460 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3461 | bgp_node_safi (vty), | |
3462 | PEER_FLAG_REMOVE_PRIVATE_AS| | |
3463 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3464 | } | |
3465 | ||
3466 | DEFUN (neighbor_remove_private_as_replace_as, | |
3467 | neighbor_remove_private_as_replace_as_cmd, | |
3468 | NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3469 | NEIGHBOR_STR | |
3470 | NEIGHBOR_ADDR_STR2 | |
3471 | "Remove private ASNs in outbound updates\n" | |
3472 | "Replace private ASNs with our ASN in outbound updates\n") | |
3473 | { | |
3474 | peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3475 | bgp_node_safi (vty), | |
3476 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3477 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3478 | bgp_node_safi (vty), | |
3479 | PEER_FLAG_REMOVE_PRIVATE_AS| | |
3480 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3481 | } | |
3482 | ||
3483 | DEFUN (neighbor_remove_private_as_all_replace_as, | |
3484 | neighbor_remove_private_as_all_replace_as_cmd, | |
3485 | NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3486 | NEIGHBOR_STR | |
3487 | NEIGHBOR_ADDR_STR2 | |
3488 | "Remove private ASNs in outbound updates\n" | |
3489 | "Apply to all AS numbers" | |
3490 | "Replace private ASNs with our ASN in outbound updates\n") | |
3491 | { | |
3492 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3493 | bgp_node_safi (vty), | |
3494 | PEER_FLAG_REMOVE_PRIVATE_AS| | |
3495 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL| | |
3496 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3497 | } | |
3498 | ||
718e3744 | 3499 | DEFUN (no_neighbor_remove_private_as, |
3500 | no_neighbor_remove_private_as_cmd, | |
3501 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
3502 | NO_STR | |
3503 | NEIGHBOR_STR | |
3504 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3505 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3506 | { |
3507 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3508 | bgp_node_safi (vty), | |
5000f21c DS |
3509 | PEER_FLAG_REMOVE_PRIVATE_AS| |
3510 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL| | |
3511 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
718e3744 | 3512 | } |
6b0655a2 | 3513 | |
5000f21c DS |
3514 | ALIAS (no_neighbor_remove_private_as, |
3515 | no_neighbor_remove_private_as_all_cmd, | |
3516 | NO_NEIGHBOR_CMD2 "remove-private-AS all", | |
3517 | NO_STR | |
3518 | NEIGHBOR_STR | |
3519 | NEIGHBOR_ADDR_STR2 | |
3520 | "Remove private ASNs in outbound updates\n" | |
3521 | "Apply to all AS numbers") | |
3522 | ||
3523 | ALIAS (no_neighbor_remove_private_as, | |
3524 | no_neighbor_remove_private_as_replace_as_cmd, | |
3525 | NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3526 | NO_STR | |
3527 | NEIGHBOR_STR | |
3528 | NEIGHBOR_ADDR_STR2 | |
3529 | "Remove private ASNs in outbound updates\n" | |
3530 | "Replace private ASNs with our ASN in outbound updates\n") | |
3531 | ||
3532 | ALIAS (no_neighbor_remove_private_as, | |
3533 | no_neighbor_remove_private_as_all_replace_as_cmd, | |
3534 | NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3535 | NO_STR | |
3536 | NEIGHBOR_STR | |
3537 | NEIGHBOR_ADDR_STR2 | |
3538 | "Remove private ASNs in outbound updates\n" | |
3539 | "Apply to all AS numbers" | |
3540 | "Replace private ASNs with our ASN in outbound updates\n") | |
3541 | ||
3542 | ||
718e3744 | 3543 | /* neighbor send-community. */ |
3544 | DEFUN (neighbor_send_community, | |
3545 | neighbor_send_community_cmd, | |
3546 | NEIGHBOR_CMD2 "send-community", | |
3547 | NEIGHBOR_STR | |
3548 | NEIGHBOR_ADDR_STR2 | |
3549 | "Send Community attribute to this neighbor\n") | |
3550 | { | |
3551 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3552 | bgp_node_safi (vty), | |
3553 | PEER_FLAG_SEND_COMMUNITY); | |
3554 | } | |
3555 | ||
3556 | DEFUN (no_neighbor_send_community, | |
3557 | no_neighbor_send_community_cmd, | |
3558 | NO_NEIGHBOR_CMD2 "send-community", | |
3559 | NO_STR | |
3560 | NEIGHBOR_STR | |
3561 | NEIGHBOR_ADDR_STR2 | |
3562 | "Send Community attribute to this neighbor\n") | |
3563 | { | |
3564 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3565 | bgp_node_safi (vty), | |
3566 | PEER_FLAG_SEND_COMMUNITY); | |
3567 | } | |
6b0655a2 | 3568 | |
718e3744 | 3569 | /* neighbor send-community extended. */ |
3570 | DEFUN (neighbor_send_community_type, | |
3571 | neighbor_send_community_type_cmd, | |
3572 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3573 | NEIGHBOR_STR | |
3574 | NEIGHBOR_ADDR_STR2 | |
3575 | "Send Community attribute to this neighbor\n" | |
3576 | "Send Standard and Extended Community attributes\n" | |
3577 | "Send Extended Community attributes\n" | |
3578 | "Send Standard Community attributes\n") | |
3579 | { | |
3580 | if (strncmp (argv[1], "s", 1) == 0) | |
3581 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3582 | bgp_node_safi (vty), | |
3583 | PEER_FLAG_SEND_COMMUNITY); | |
3584 | if (strncmp (argv[1], "e", 1) == 0) | |
3585 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3586 | bgp_node_safi (vty), | |
3587 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3588 | ||
3589 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3590 | bgp_node_safi (vty), | |
3591 | (PEER_FLAG_SEND_COMMUNITY| | |
3592 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3593 | } | |
3594 | ||
3595 | DEFUN (no_neighbor_send_community_type, | |
3596 | no_neighbor_send_community_type_cmd, | |
3597 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3598 | NO_STR | |
3599 | NEIGHBOR_STR | |
3600 | NEIGHBOR_ADDR_STR2 | |
3601 | "Send Community attribute to this neighbor\n" | |
3602 | "Send Standard and Extended Community attributes\n" | |
3603 | "Send Extended Community attributes\n" | |
3604 | "Send Standard Community attributes\n") | |
3605 | { | |
3606 | if (strncmp (argv[1], "s", 1) == 0) | |
3607 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3608 | bgp_node_safi (vty), | |
3609 | PEER_FLAG_SEND_COMMUNITY); | |
3610 | if (strncmp (argv[1], "e", 1) == 0) | |
3611 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3612 | bgp_node_safi (vty), | |
3613 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3614 | ||
3615 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3616 | bgp_node_safi (vty), | |
3617 | (PEER_FLAG_SEND_COMMUNITY | | |
3618 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3619 | } | |
6b0655a2 | 3620 | |
718e3744 | 3621 | /* neighbor soft-reconfig. */ |
3622 | DEFUN (neighbor_soft_reconfiguration, | |
3623 | neighbor_soft_reconfiguration_cmd, | |
3624 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3625 | NEIGHBOR_STR | |
3626 | NEIGHBOR_ADDR_STR2 | |
3627 | "Per neighbor soft reconfiguration\n" | |
3628 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3629 | { | |
3630 | return peer_af_flag_set_vty (vty, argv[0], | |
3631 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3632 | PEER_FLAG_SOFT_RECONFIG); | |
3633 | } | |
3634 | ||
3635 | DEFUN (no_neighbor_soft_reconfiguration, | |
3636 | no_neighbor_soft_reconfiguration_cmd, | |
3637 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3638 | NO_STR | |
3639 | NEIGHBOR_STR | |
3640 | NEIGHBOR_ADDR_STR2 | |
3641 | "Per neighbor soft reconfiguration\n" | |
3642 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3643 | { | |
3644 | return peer_af_flag_unset_vty (vty, argv[0], | |
3645 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3646 | PEER_FLAG_SOFT_RECONFIG); | |
3647 | } | |
6b0655a2 | 3648 | |
718e3744 | 3649 | DEFUN (neighbor_route_reflector_client, |
3650 | neighbor_route_reflector_client_cmd, | |
3651 | NEIGHBOR_CMD2 "route-reflector-client", | |
3652 | NEIGHBOR_STR | |
3653 | NEIGHBOR_ADDR_STR2 | |
3654 | "Configure a neighbor as Route Reflector client\n") | |
3655 | { | |
3656 | struct peer *peer; | |
3657 | ||
3658 | ||
3659 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3660 | if (! peer) | |
3661 | return CMD_WARNING; | |
3662 | ||
3663 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3664 | bgp_node_safi (vty), | |
3665 | PEER_FLAG_REFLECTOR_CLIENT); | |
3666 | } | |
3667 | ||
3668 | DEFUN (no_neighbor_route_reflector_client, | |
3669 | no_neighbor_route_reflector_client_cmd, | |
3670 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
3671 | NO_STR | |
3672 | NEIGHBOR_STR | |
3673 | NEIGHBOR_ADDR_STR2 | |
3674 | "Configure a neighbor as Route Reflector client\n") | |
3675 | { | |
3676 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3677 | bgp_node_safi (vty), | |
3678 | PEER_FLAG_REFLECTOR_CLIENT); | |
3679 | } | |
6b0655a2 | 3680 | |
94f2b392 | 3681 | static int |
fd79ac91 | 3682 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
3683 | int afi, int safi) | |
fee0f4c6 | 3684 | { |
3685 | int ret; | |
3686 | struct bgp *bgp; | |
3687 | struct peer *peer; | |
3688 | struct peer_group *group; | |
1eb8ef25 | 3689 | struct listnode *node, *nnode; |
fee0f4c6 | 3690 | struct bgp_filter *pfilter; |
3691 | struct bgp_filter *gfilter; | |
228da428 | 3692 | int locked_and_added = 0; |
fee0f4c6 | 3693 | |
3694 | bgp = vty->index; | |
3695 | ||
3696 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3697 | if ( ! peer ) | |
3698 | return CMD_WARNING; | |
3699 | ||
3700 | /* If it is already a RS-Client, don't do anything. */ | |
3701 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
3702 | return CMD_SUCCESS; | |
3703 | ||
3704 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 3705 | { |
3706 | peer = peer_lock (peer); /* rsclient peer list reference */ | |
3707 | listnode_add_sort (bgp->rsclient, peer); | |
228da428 | 3708 | locked_and_added = 1; |
200df115 | 3709 | } |
fee0f4c6 | 3710 | |
3711 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3712 | if (ret < 0) | |
228da428 CC |
3713 | { |
3714 | if (locked_and_added) | |
3715 | { | |
3716 | listnode_delete (bgp->rsclient, peer); | |
3717 | peer_unlock (peer); /* rsclient peer list reference */ | |
3718 | } | |
3719 | ||
3720 | return bgp_vty_return (vty, ret); | |
3721 | } | |
fee0f4c6 | 3722 | |
64e580a7 | 3723 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
fee0f4c6 | 3724 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
228da428 CC |
3725 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
3726 | peer->rib[afi][safi]->owner = peer_lock (peer); | |
fee0f4c6 | 3727 | |
3728 | /* Check for existing 'network' and 'redistribute' routes. */ | |
3729 | bgp_check_local_routes_rsclient (peer, afi, safi); | |
3730 | ||
3731 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ | |
3732 | bgp_soft_reconfig_rsclient (peer, afi, safi); | |
3733 | ||
3734 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
3735 | { | |
3736 | group = peer->group; | |
3737 | gfilter = &peer->filter[afi][safi]; | |
3738 | ||
1eb8ef25 | 3739 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 3740 | { |
3741 | pfilter = &peer->filter[afi][safi]; | |
3742 | ||
3743 | /* Members of a non-RS-Client group should not be RS-Clients, as that | |
3744 | is checked when the become part of the peer-group */ | |
3745 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3746 | if (ret < 0) | |
3747 | return bgp_vty_return (vty, ret); | |
3748 | ||
3749 | /* Make peer's RIB point to group's RIB. */ | |
3750 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; | |
3751 | ||
3752 | /* Import policy. */ | |
3753 | if (pfilter->map[RMAP_IMPORT].name) | |
6e919709 | 3754 | XFREE(MTYPE_BGP_FILTER_NAME, pfilter->map[RMAP_IMPORT].name); |
fee0f4c6 | 3755 | if (gfilter->map[RMAP_IMPORT].name) |
3756 | { | |
6e919709 DS |
3757 | pfilter->map[RMAP_IMPORT].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, |
3758 | gfilter->map[RMAP_IMPORT].name); | |
fee0f4c6 | 3759 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; |
3760 | } | |
3761 | else | |
3762 | { | |
3763 | pfilter->map[RMAP_IMPORT].name = NULL; | |
6e919709 | 3764 | pfilter->map[RMAP_IMPORT].map = NULL; |
fee0f4c6 | 3765 | } |
3766 | ||
3767 | /* Export policy. */ | |
3768 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) | |
3769 | { | |
6e919709 DS |
3770 | pfilter->map[RMAP_EXPORT].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, |
3771 | gfilter->map[RMAP_EXPORT].name); | |
fee0f4c6 | 3772 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; |
3773 | } | |
3774 | } | |
3775 | } | |
3776 | return CMD_SUCCESS; | |
3777 | } | |
3778 | ||
94f2b392 | 3779 | static int |
fd79ac91 | 3780 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
3781 | int afi, int safi) | |
fee0f4c6 | 3782 | { |
3783 | int ret; | |
3784 | struct bgp *bgp; | |
3785 | struct peer *peer; | |
3786 | struct peer_group *group; | |
1eb8ef25 | 3787 | struct listnode *node, *nnode; |
fee0f4c6 | 3788 | |
3789 | bgp = vty->index; | |
3790 | ||
3791 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3792 | if ( ! peer ) | |
3793 | return CMD_WARNING; | |
3794 | ||
3795 | /* If it is not a RS-Client, don't do anything. */ | |
3796 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
3797 | return CMD_SUCCESS; | |
3798 | ||
3799 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
3800 | { | |
3801 | group = peer->group; | |
3802 | ||
1eb8ef25 | 3803 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 3804 | { |
3805 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3806 | if (ret < 0) | |
3807 | return bgp_vty_return (vty, ret); | |
3808 | ||
3809 | peer->rib[afi][safi] = NULL; | |
3810 | } | |
3811 | ||
3812 | peer = group->conf; | |
3813 | } | |
3814 | ||
3815 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3816 | if (ret < 0) | |
3817 | return bgp_vty_return (vty, ret); | |
3818 | ||
3819 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 3820 | { |
228da428 | 3821 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
200df115 | 3822 | listnode_delete (bgp->rsclient, peer); |
228da428 | 3823 | peer_unlock (peer); /* peer bgp rsclient reference */ |
200df115 | 3824 | } |
fee0f4c6 | 3825 | |
b608d5b5 | 3826 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
fee0f4c6 | 3827 | |
3828 | return CMD_SUCCESS; | |
3829 | } | |
6b0655a2 | 3830 | |
718e3744 | 3831 | /* neighbor route-server-client. */ |
3832 | DEFUN (neighbor_route_server_client, | |
3833 | neighbor_route_server_client_cmd, | |
3834 | NEIGHBOR_CMD2 "route-server-client", | |
3835 | NEIGHBOR_STR | |
3836 | NEIGHBOR_ADDR_STR2 | |
3837 | "Configure a neighbor as Route Server client\n") | |
3838 | { | |
fee0f4c6 | 3839 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
3840 | bgp_node_safi(vty)); | |
718e3744 | 3841 | } |
3842 | ||
3843 | DEFUN (no_neighbor_route_server_client, | |
3844 | no_neighbor_route_server_client_cmd, | |
3845 | NO_NEIGHBOR_CMD2 "route-server-client", | |
3846 | NO_STR | |
3847 | NEIGHBOR_STR | |
3848 | NEIGHBOR_ADDR_STR2 | |
3849 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 3850 | { |
3851 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), | |
3852 | bgp_node_safi(vty)); | |
3853 | } | |
6b0655a2 | 3854 | |
fee0f4c6 | 3855 | DEFUN (neighbor_nexthop_local_unchanged, |
3856 | neighbor_nexthop_local_unchanged_cmd, | |
3857 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3858 | NEIGHBOR_STR | |
3859 | NEIGHBOR_ADDR_STR2 | |
3860 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
3861 | "Leave link-local nexthop unchanged for this peer\n") | |
3862 | { | |
3863 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3864 | bgp_node_safi (vty), | |
3865 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
3866 | } | |
6b0655a2 | 3867 | |
fee0f4c6 | 3868 | DEFUN (no_neighbor_nexthop_local_unchanged, |
3869 | no_neighbor_nexthop_local_unchanged_cmd, | |
3870 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3871 | NO_STR | |
3872 | NEIGHBOR_STR | |
3873 | NEIGHBOR_ADDR_STR2 | |
3874 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
3875 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 3876 | { |
3877 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3878 | bgp_node_safi (vty), | |
fee0f4c6 | 3879 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 3880 | } |
6b0655a2 | 3881 | |
718e3744 | 3882 | DEFUN (neighbor_attr_unchanged, |
3883 | neighbor_attr_unchanged_cmd, | |
3884 | NEIGHBOR_CMD2 "attribute-unchanged", | |
3885 | NEIGHBOR_STR | |
3886 | NEIGHBOR_ADDR_STR2 | |
3887 | "BGP attribute is propagated unchanged to this neighbor\n") | |
3888 | { | |
3889 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3890 | bgp_node_safi (vty), | |
3891 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
3892 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
3893 | PEER_FLAG_MED_UNCHANGED)); | |
3894 | } | |
3895 | ||
3896 | DEFUN (neighbor_attr_unchanged1, | |
3897 | neighbor_attr_unchanged1_cmd, | |
3898 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
3899 | NEIGHBOR_STR | |
3900 | NEIGHBOR_ADDR_STR2 | |
3901 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3902 | "As-path attribute\n" | |
3903 | "Nexthop attribute\n" | |
3904 | "Med attribute\n") | |
3905 | { | |
3906 | u_int16_t flags = 0; | |
3907 | ||
3908 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3909 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3910 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3911 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3912 | else if (strncmp (argv[1], "med", 1) == 0) | |
3913 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3914 | ||
3915 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3916 | bgp_node_safi (vty), flags); | |
3917 | } | |
3918 | ||
3919 | DEFUN (neighbor_attr_unchanged2, | |
3920 | neighbor_attr_unchanged2_cmd, | |
3921 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
3922 | NEIGHBOR_STR | |
3923 | NEIGHBOR_ADDR_STR2 | |
3924 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3925 | "As-path attribute\n" | |
3926 | "Nexthop attribute\n" | |
3927 | "Med attribute\n") | |
3928 | { | |
3929 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
3930 | ||
3931 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
3932 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3933 | else if (strncmp (argv[1], "med", 1) == 0) | |
3934 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3935 | ||
3936 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3937 | bgp_node_safi (vty), flags); | |
3938 | ||
3939 | } | |
3940 | ||
3941 | DEFUN (neighbor_attr_unchanged3, | |
3942 | neighbor_attr_unchanged3_cmd, | |
3943 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
3944 | NEIGHBOR_STR | |
3945 | NEIGHBOR_ADDR_STR2 | |
3946 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3947 | "Nexthop attribute\n" | |
3948 | "As-path attribute\n" | |
3949 | "Med attribute\n") | |
3950 | { | |
3951 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
3952 | ||
3953 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3954 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3955 | else if (strncmp (argv[1], "med", 1) == 0) | |
3956 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3957 | ||
3958 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3959 | bgp_node_safi (vty), flags); | |
3960 | } | |
3961 | ||
3962 | DEFUN (neighbor_attr_unchanged4, | |
3963 | neighbor_attr_unchanged4_cmd, | |
3964 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
3965 | NEIGHBOR_STR | |
3966 | NEIGHBOR_ADDR_STR2 | |
3967 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3968 | "Med attribute\n" | |
3969 | "As-path attribute\n" | |
3970 | "Nexthop attribute\n") | |
3971 | { | |
3972 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
3973 | ||
3974 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3975 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3976 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3977 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3978 | ||
3979 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3980 | bgp_node_safi (vty), flags); | |
3981 | } | |
3982 | ||
3983 | ALIAS (neighbor_attr_unchanged, | |
3984 | neighbor_attr_unchanged5_cmd, | |
3985 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
3986 | NEIGHBOR_STR | |
3987 | NEIGHBOR_ADDR_STR2 | |
3988 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3989 | "As-path attribute\n" | |
3990 | "Nexthop attribute\n" | |
3991 | "Med attribute\n") | |
3992 | ||
3993 | ALIAS (neighbor_attr_unchanged, | |
3994 | neighbor_attr_unchanged6_cmd, | |
3995 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
3996 | NEIGHBOR_STR | |
3997 | NEIGHBOR_ADDR_STR2 | |
3998 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3999 | "As-path attribute\n" | |
4000 | "Med attribute\n" | |
4001 | "Nexthop attribute\n") | |
4002 | ||
4003 | ALIAS (neighbor_attr_unchanged, | |
4004 | neighbor_attr_unchanged7_cmd, | |
4005 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4006 | NEIGHBOR_STR | |
4007 | NEIGHBOR_ADDR_STR2 | |
4008 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4009 | "Nexthop attribute\n" | |
4010 | "Med attribute\n" | |
4011 | "As-path attribute\n") | |
4012 | ||
4013 | ALIAS (neighbor_attr_unchanged, | |
4014 | neighbor_attr_unchanged8_cmd, | |
4015 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4016 | NEIGHBOR_STR | |
4017 | NEIGHBOR_ADDR_STR2 | |
4018 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4019 | "Nexthop attribute\n" | |
4020 | "As-path attribute\n" | |
4021 | "Med attribute\n") | |
4022 | ||
4023 | ALIAS (neighbor_attr_unchanged, | |
4024 | neighbor_attr_unchanged9_cmd, | |
4025 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4026 | NEIGHBOR_STR | |
4027 | NEIGHBOR_ADDR_STR2 | |
4028 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4029 | "Med attribute\n" | |
4030 | "Nexthop attribute\n" | |
4031 | "As-path attribute\n") | |
4032 | ||
4033 | ALIAS (neighbor_attr_unchanged, | |
4034 | neighbor_attr_unchanged10_cmd, | |
4035 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4036 | NEIGHBOR_STR | |
4037 | NEIGHBOR_ADDR_STR2 | |
4038 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4039 | "Med attribute\n" | |
4040 | "As-path attribute\n" | |
4041 | "Nexthop attribute\n") | |
4042 | ||
4043 | DEFUN (no_neighbor_attr_unchanged, | |
4044 | no_neighbor_attr_unchanged_cmd, | |
4045 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
4046 | NO_STR | |
4047 | NEIGHBOR_STR | |
4048 | NEIGHBOR_ADDR_STR2 | |
4049 | "BGP attribute is propagated unchanged to this neighbor\n") | |
4050 | { | |
4051 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4052 | bgp_node_safi (vty), | |
4053 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4054 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4055 | PEER_FLAG_MED_UNCHANGED)); | |
4056 | } | |
4057 | ||
4058 | DEFUN (no_neighbor_attr_unchanged1, | |
4059 | no_neighbor_attr_unchanged1_cmd, | |
4060 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4061 | NO_STR | |
4062 | NEIGHBOR_STR | |
4063 | NEIGHBOR_ADDR_STR2 | |
4064 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4065 | "As-path attribute\n" | |
4066 | "Nexthop attribute\n" | |
4067 | "Med attribute\n") | |
4068 | { | |
4069 | u_int16_t flags = 0; | |
4070 | ||
4071 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4072 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4073 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4074 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4075 | else if (strncmp (argv[1], "med", 1) == 0) | |
4076 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4077 | ||
4078 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4079 | bgp_node_safi (vty), flags); | |
4080 | } | |
4081 | ||
4082 | DEFUN (no_neighbor_attr_unchanged2, | |
4083 | no_neighbor_attr_unchanged2_cmd, | |
4084 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4085 | NO_STR | |
4086 | NEIGHBOR_STR | |
4087 | NEIGHBOR_ADDR_STR2 | |
4088 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4089 | "As-path attribute\n" | |
4090 | "Nexthop attribute\n" | |
4091 | "Med attribute\n") | |
4092 | { | |
4093 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4094 | ||
4095 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4096 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4097 | else if (strncmp (argv[1], "med", 1) == 0) | |
4098 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4099 | ||
4100 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4101 | bgp_node_safi (vty), flags); | |
4102 | } | |
4103 | ||
4104 | DEFUN (no_neighbor_attr_unchanged3, | |
4105 | no_neighbor_attr_unchanged3_cmd, | |
4106 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4107 | NO_STR | |
4108 | NEIGHBOR_STR | |
4109 | NEIGHBOR_ADDR_STR2 | |
4110 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4111 | "Nexthop attribute\n" | |
4112 | "As-path attribute\n" | |
4113 | "Med attribute\n") | |
4114 | { | |
4115 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4116 | ||
4117 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4118 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4119 | else if (strncmp (argv[1], "med", 1) == 0) | |
4120 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4121 | ||
4122 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4123 | bgp_node_safi (vty), flags); | |
4124 | } | |
4125 | ||
4126 | DEFUN (no_neighbor_attr_unchanged4, | |
4127 | no_neighbor_attr_unchanged4_cmd, | |
4128 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4129 | NO_STR | |
4130 | NEIGHBOR_STR | |
4131 | NEIGHBOR_ADDR_STR2 | |
4132 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4133 | "Med attribute\n" | |
4134 | "As-path attribute\n" | |
4135 | "Nexthop attribute\n") | |
4136 | { | |
4137 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4138 | ||
4139 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4140 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4141 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4142 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4143 | ||
4144 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4145 | bgp_node_safi (vty), flags); | |
4146 | } | |
4147 | ||
4148 | ALIAS (no_neighbor_attr_unchanged, | |
4149 | no_neighbor_attr_unchanged5_cmd, | |
4150 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4151 | NO_STR | |
4152 | NEIGHBOR_STR | |
4153 | NEIGHBOR_ADDR_STR2 | |
4154 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4155 | "As-path attribute\n" | |
4156 | "Nexthop attribute\n" | |
4157 | "Med attribute\n") | |
4158 | ||
4159 | ALIAS (no_neighbor_attr_unchanged, | |
4160 | no_neighbor_attr_unchanged6_cmd, | |
4161 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4162 | NO_STR | |
4163 | NEIGHBOR_STR | |
4164 | NEIGHBOR_ADDR_STR2 | |
4165 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4166 | "As-path attribute\n" | |
4167 | "Med attribute\n" | |
4168 | "Nexthop attribute\n") | |
4169 | ||
4170 | ALIAS (no_neighbor_attr_unchanged, | |
4171 | no_neighbor_attr_unchanged7_cmd, | |
4172 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4173 | NO_STR | |
4174 | NEIGHBOR_STR | |
4175 | NEIGHBOR_ADDR_STR2 | |
4176 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4177 | "Nexthop attribute\n" | |
4178 | "Med attribute\n" | |
4179 | "As-path attribute\n") | |
4180 | ||
4181 | ALIAS (no_neighbor_attr_unchanged, | |
4182 | no_neighbor_attr_unchanged8_cmd, | |
4183 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4184 | NO_STR | |
4185 | NEIGHBOR_STR | |
4186 | NEIGHBOR_ADDR_STR2 | |
4187 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4188 | "Nexthop attribute\n" | |
4189 | "As-path attribute\n" | |
4190 | "Med attribute\n") | |
4191 | ||
4192 | ALIAS (no_neighbor_attr_unchanged, | |
4193 | no_neighbor_attr_unchanged9_cmd, | |
4194 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4195 | NO_STR | |
4196 | NEIGHBOR_STR | |
4197 | NEIGHBOR_ADDR_STR2 | |
4198 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4199 | "Med attribute\n" | |
4200 | "Nexthop attribute\n" | |
4201 | "As-path attribute\n") | |
4202 | ||
4203 | ALIAS (no_neighbor_attr_unchanged, | |
4204 | no_neighbor_attr_unchanged10_cmd, | |
4205 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4206 | NO_STR | |
4207 | NEIGHBOR_STR | |
4208 | NEIGHBOR_ADDR_STR2 | |
4209 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4210 | "Med attribute\n" | |
4211 | "As-path attribute\n" | |
4212 | "Nexthop attribute\n") | |
4213 | ||
4214 | /* For old version Zebra compatibility. */ | |
dd4c593f | 4215 | DEFUN_DEPRECATED (neighbor_transparent_as, |
4216 | neighbor_transparent_as_cmd, | |
4217 | NEIGHBOR_CMD "transparent-as", | |
4218 | NEIGHBOR_STR | |
4219 | NEIGHBOR_ADDR_STR | |
4220 | "Do not append my AS number even peer is EBGP peer\n") | |
718e3744 | 4221 | { |
4222 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4223 | bgp_node_safi (vty), | |
4224 | PEER_FLAG_AS_PATH_UNCHANGED); | |
4225 | } | |
4226 | ||
dd4c593f | 4227 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
4228 | neighbor_transparent_nexthop_cmd, | |
4229 | NEIGHBOR_CMD "transparent-nexthop", | |
4230 | NEIGHBOR_STR | |
4231 | NEIGHBOR_ADDR_STR | |
4232 | "Do not change nexthop even peer is EBGP peer\n") | |
718e3744 | 4233 | { |
4234 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4235 | bgp_node_safi (vty), | |
4236 | PEER_FLAG_NEXTHOP_UNCHANGED); | |
4237 | } | |
6b0655a2 | 4238 | |
718e3744 | 4239 | /* EBGP multihop configuration. */ |
94f2b392 | 4240 | static int |
fd79ac91 | 4241 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
4242 | const char *ttl_str) | |
718e3744 | 4243 | { |
4244 | struct peer *peer; | |
fd79ac91 | 4245 | unsigned int ttl; |
718e3744 | 4246 | |
4247 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4248 | if (! peer) | |
4249 | return CMD_WARNING; | |
4250 | ||
4251 | if (! ttl_str) | |
4252 | ttl = TTL_MAX; | |
4253 | else | |
4254 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); | |
4255 | ||
89b6d1f8 | 4256 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 4257 | } |
4258 | ||
94f2b392 | 4259 | static int |
fd79ac91 | 4260 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4261 | { |
4262 | struct peer *peer; | |
4263 | ||
4264 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4265 | if (! peer) | |
4266 | return CMD_WARNING; | |
4267 | ||
89b6d1f8 | 4268 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 4269 | } |
4270 | ||
4271 | /* neighbor ebgp-multihop. */ | |
4272 | DEFUN (neighbor_ebgp_multihop, | |
4273 | neighbor_ebgp_multihop_cmd, | |
4274 | NEIGHBOR_CMD2 "ebgp-multihop", | |
4275 | NEIGHBOR_STR | |
4276 | NEIGHBOR_ADDR_STR2 | |
4277 | "Allow EBGP neighbors not on directly connected networks\n") | |
4278 | { | |
4279 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
4280 | } | |
4281 | ||
4282 | DEFUN (neighbor_ebgp_multihop_ttl, | |
4283 | neighbor_ebgp_multihop_ttl_cmd, | |
4284 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
4285 | NEIGHBOR_STR | |
4286 | NEIGHBOR_ADDR_STR2 | |
4287 | "Allow EBGP neighbors not on directly connected networks\n" | |
4288 | "maximum hop count\n") | |
4289 | { | |
4290 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
4291 | } | |
4292 | ||
4293 | DEFUN (no_neighbor_ebgp_multihop, | |
4294 | no_neighbor_ebgp_multihop_cmd, | |
4295 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
4296 | NO_STR | |
4297 | NEIGHBOR_STR | |
4298 | NEIGHBOR_ADDR_STR2 | |
4299 | "Allow EBGP neighbors not on directly connected networks\n") | |
4300 | { | |
4301 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
4302 | } | |
4303 | ||
4304 | ALIAS (no_neighbor_ebgp_multihop, | |
4305 | no_neighbor_ebgp_multihop_ttl_cmd, | |
4306 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
4307 | NO_STR | |
4308 | NEIGHBOR_STR | |
4309 | NEIGHBOR_ADDR_STR2 | |
4310 | "Allow EBGP neighbors not on directly connected networks\n" | |
4311 | "maximum hop count\n") | |
6b0655a2 | 4312 | |
6ffd2079 | 4313 | /* disable-connected-check */ |
4314 | DEFUN (neighbor_disable_connected_check, | |
4315 | neighbor_disable_connected_check_cmd, | |
4316 | NEIGHBOR_CMD2 "disable-connected-check", | |
4317 | NEIGHBOR_STR | |
4318 | NEIGHBOR_ADDR_STR2 | |
4319 | "one-hop away EBGP peer using loopback address\n") | |
4320 | { | |
4321 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4322 | } | |
4323 | ||
4324 | DEFUN (no_neighbor_disable_connected_check, | |
4325 | no_neighbor_disable_connected_check_cmd, | |
4326 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
4327 | NO_STR | |
4328 | NEIGHBOR_STR | |
4329 | NEIGHBOR_ADDR_STR2 | |
4330 | "one-hop away EBGP peer using loopback address\n") | |
4331 | { | |
4332 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4333 | } | |
4334 | ||
718e3744 | 4335 | /* Enforce multihop. */ |
6ffd2079 | 4336 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 4337 | neighbor_enforce_multihop_cmd, |
4338 | NEIGHBOR_CMD2 "enforce-multihop", | |
4339 | NEIGHBOR_STR | |
4340 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4341 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 4342 | |
6ffd2079 | 4343 | /* Enforce multihop. */ |
4344 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 4345 | no_neighbor_enforce_multihop_cmd, |
4346 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
4347 | NO_STR | |
4348 | NEIGHBOR_STR | |
4349 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4350 | "Enforce EBGP neighbors perform multihop\n") |
6b0655a2 | 4351 | |
718e3744 | 4352 | DEFUN (neighbor_description, |
4353 | neighbor_description_cmd, | |
4354 | NEIGHBOR_CMD2 "description .LINE", | |
4355 | NEIGHBOR_STR | |
4356 | NEIGHBOR_ADDR_STR2 | |
4357 | "Neighbor specific description\n" | |
4358 | "Up to 80 characters describing this neighbor\n") | |
4359 | { | |
4360 | struct peer *peer; | |
718e3744 | 4361 | char *str; |
718e3744 | 4362 | |
4363 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4364 | if (! peer) | |
4365 | return CMD_WARNING; | |
4366 | ||
4367 | if (argc == 1) | |
4368 | return CMD_SUCCESS; | |
4369 | ||
3b8b1855 | 4370 | str = argv_concat(argv, argc, 1); |
718e3744 | 4371 | |
4372 | peer_description_set (peer, str); | |
4373 | ||
3b8b1855 | 4374 | XFREE (MTYPE_TMP, str); |
718e3744 | 4375 | |
4376 | return CMD_SUCCESS; | |
4377 | } | |
4378 | ||
4379 | DEFUN (no_neighbor_description, | |
4380 | no_neighbor_description_cmd, | |
4381 | NO_NEIGHBOR_CMD2 "description", | |
4382 | NO_STR | |
4383 | NEIGHBOR_STR | |
4384 | NEIGHBOR_ADDR_STR2 | |
4385 | "Neighbor specific description\n") | |
4386 | { | |
4387 | struct peer *peer; | |
4388 | ||
4389 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4390 | if (! peer) | |
4391 | return CMD_WARNING; | |
4392 | ||
4393 | peer_description_unset (peer); | |
4394 | ||
4395 | return CMD_SUCCESS; | |
4396 | } | |
4397 | ||
4398 | ALIAS (no_neighbor_description, | |
4399 | no_neighbor_description_val_cmd, | |
4400 | NO_NEIGHBOR_CMD2 "description .LINE", | |
4401 | NO_STR | |
4402 | NEIGHBOR_STR | |
4403 | NEIGHBOR_ADDR_STR2 | |
4404 | "Neighbor specific description\n" | |
4405 | "Up to 80 characters describing this neighbor\n") | |
6b0655a2 | 4406 | |
718e3744 | 4407 | /* Neighbor update-source. */ |
94f2b392 | 4408 | static int |
fd79ac91 | 4409 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
4410 | const char *source_str) | |
718e3744 | 4411 | { |
4412 | struct peer *peer; | |
718e3744 | 4413 | |
4414 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4415 | if (! peer) | |
4416 | return CMD_WARNING; | |
4417 | ||
a80beece DS |
4418 | if (peer->conf_if) |
4419 | return CMD_WARNING; | |
4420 | ||
718e3744 | 4421 | if (source_str) |
4422 | { | |
c63b83fe JBD |
4423 | union sockunion su; |
4424 | int ret = str2sockunion (source_str, &su); | |
4425 | ||
4426 | if (ret == 0) | |
4427 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 4428 | else |
4429 | peer_update_source_if_set (peer, source_str); | |
4430 | } | |
4431 | else | |
4432 | peer_update_source_unset (peer); | |
4433 | ||
4434 | return CMD_SUCCESS; | |
4435 | } | |
4436 | ||
dcb52bd5 DS |
4437 | #define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD" |
4438 | #define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")" | |
4439 | #define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}" | |
369688c0 PJ |
4440 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
4441 | "IPv4 address\n" \ | |
9a1a331d PJ |
4442 | "IPv6 address\n" \ |
4443 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 4444 | |
718e3744 | 4445 | DEFUN (neighbor_update_source, |
4446 | neighbor_update_source_cmd, | |
dcb52bd5 | 4447 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_REQ_STR, |
718e3744 | 4448 | NEIGHBOR_STR |
4449 | NEIGHBOR_ADDR_STR2 | |
4450 | "Source of routing updates\n" | |
369688c0 | 4451 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 4452 | { |
4453 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
4454 | } | |
4455 | ||
4456 | DEFUN (no_neighbor_update_source, | |
4457 | no_neighbor_update_source_cmd, | |
dcb52bd5 | 4458 | NO_NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_OPT_STR, |
718e3744 | 4459 | NO_STR |
4460 | NEIGHBOR_STR | |
4461 | NEIGHBOR_ADDR_STR2 | |
dcb52bd5 DS |
4462 | "Source of routing updates\n" |
4463 | BGP_UPDATE_SOURCE_HELP_STR) | |
718e3744 | 4464 | { |
4465 | return peer_update_source_vty (vty, argv[0], NULL); | |
4466 | } | |
6b0655a2 | 4467 | |
94f2b392 | 4468 | static int |
fd79ac91 | 4469 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
4470 | afi_t afi, safi_t safi, | |
4471 | const char *rmap, int set) | |
718e3744 | 4472 | { |
4473 | int ret; | |
4474 | struct peer *peer; | |
4475 | ||
4476 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4477 | if (! peer) | |
4478 | return CMD_WARNING; | |
4479 | ||
4480 | if (set) | |
4481 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
4482 | else | |
4483 | ret = peer_default_originate_unset (peer, afi, safi); | |
4484 | ||
4485 | return bgp_vty_return (vty, ret); | |
4486 | } | |
4487 | ||
4488 | /* neighbor default-originate. */ | |
4489 | DEFUN (neighbor_default_originate, | |
4490 | neighbor_default_originate_cmd, | |
4491 | NEIGHBOR_CMD2 "default-originate", | |
4492 | NEIGHBOR_STR | |
4493 | NEIGHBOR_ADDR_STR2 | |
4494 | "Originate default route to this neighbor\n") | |
4495 | { | |
4496 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4497 | bgp_node_safi (vty), NULL, 1); | |
4498 | } | |
4499 | ||
4500 | DEFUN (neighbor_default_originate_rmap, | |
4501 | neighbor_default_originate_rmap_cmd, | |
4502 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4503 | NEIGHBOR_STR | |
4504 | NEIGHBOR_ADDR_STR2 | |
4505 | "Originate default route to this neighbor\n" | |
4506 | "Route-map to specify criteria to originate default\n" | |
4507 | "route-map name\n") | |
4508 | { | |
4509 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4510 | bgp_node_safi (vty), argv[1], 1); | |
4511 | } | |
4512 | ||
4513 | DEFUN (no_neighbor_default_originate, | |
4514 | no_neighbor_default_originate_cmd, | |
4515 | NO_NEIGHBOR_CMD2 "default-originate", | |
4516 | NO_STR | |
4517 | NEIGHBOR_STR | |
4518 | NEIGHBOR_ADDR_STR2 | |
4519 | "Originate default route to this neighbor\n") | |
4520 | { | |
4521 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4522 | bgp_node_safi (vty), NULL, 0); | |
4523 | } | |
4524 | ||
4525 | ALIAS (no_neighbor_default_originate, | |
4526 | no_neighbor_default_originate_rmap_cmd, | |
4527 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4528 | NO_STR | |
4529 | NEIGHBOR_STR | |
4530 | NEIGHBOR_ADDR_STR2 | |
4531 | "Originate default route to this neighbor\n" | |
4532 | "Route-map to specify criteria to originate default\n" | |
4533 | "route-map name\n") | |
6b0655a2 | 4534 | |
718e3744 | 4535 | /* Set neighbor's BGP port. */ |
94f2b392 | 4536 | static int |
fd79ac91 | 4537 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
4538 | const char *port_str) | |
718e3744 | 4539 | { |
4540 | struct peer *peer; | |
4541 | u_int16_t port; | |
4542 | struct servent *sp; | |
4543 | ||
4544 | peer = peer_lookup_vty (vty, ip_str); | |
4545 | if (! peer) | |
4546 | return CMD_WARNING; | |
4547 | ||
4548 | if (! port_str) | |
4549 | { | |
4550 | sp = getservbyname ("bgp", "tcp"); | |
4551 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
4552 | } | |
4553 | else | |
4554 | { | |
4555 | VTY_GET_INTEGER("port", port, port_str); | |
4556 | } | |
4557 | ||
4558 | peer_port_set (peer, port); | |
4559 | ||
4560 | return CMD_SUCCESS; | |
4561 | } | |
4562 | ||
f418446b | 4563 | /* Set specified peer's BGP port. */ |
718e3744 | 4564 | DEFUN (neighbor_port, |
4565 | neighbor_port_cmd, | |
4566 | NEIGHBOR_CMD "port <0-65535>", | |
4567 | NEIGHBOR_STR | |
4568 | NEIGHBOR_ADDR_STR | |
4569 | "Neighbor's BGP port\n" | |
4570 | "TCP port number\n") | |
4571 | { | |
4572 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
4573 | } | |
4574 | ||
4575 | DEFUN (no_neighbor_port, | |
4576 | no_neighbor_port_cmd, | |
4577 | NO_NEIGHBOR_CMD "port", | |
4578 | NO_STR | |
4579 | NEIGHBOR_STR | |
4580 | NEIGHBOR_ADDR_STR | |
4581 | "Neighbor's BGP port\n") | |
4582 | { | |
4583 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
4584 | } | |
4585 | ||
4586 | ALIAS (no_neighbor_port, | |
4587 | no_neighbor_port_val_cmd, | |
4588 | NO_NEIGHBOR_CMD "port <0-65535>", | |
4589 | NO_STR | |
4590 | NEIGHBOR_STR | |
4591 | NEIGHBOR_ADDR_STR | |
4592 | "Neighbor's BGP port\n" | |
4593 | "TCP port number\n") | |
6b0655a2 | 4594 | |
718e3744 | 4595 | /* neighbor weight. */ |
94f2b392 | 4596 | static int |
fd79ac91 | 4597 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
4598 | const char *weight_str) | |
718e3744 | 4599 | { |
718e3744 | 4600 | struct peer *peer; |
4601 | unsigned long weight; | |
4602 | ||
4603 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4604 | if (! peer) | |
4605 | return CMD_WARNING; | |
4606 | ||
4607 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
4608 | ||
ffd0c037 | 4609 | peer_weight_set (peer, weight); |
718e3744 | 4610 | |
4611 | return CMD_SUCCESS; | |
4612 | } | |
4613 | ||
94f2b392 | 4614 | static int |
fd79ac91 | 4615 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4616 | { |
4617 | struct peer *peer; | |
4618 | ||
4619 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4620 | if (! peer) | |
4621 | return CMD_WARNING; | |
4622 | ||
4623 | peer_weight_unset (peer); | |
4624 | ||
4625 | return CMD_SUCCESS; | |
4626 | } | |
4627 | ||
4628 | DEFUN (neighbor_weight, | |
4629 | neighbor_weight_cmd, | |
4630 | NEIGHBOR_CMD2 "weight <0-65535>", | |
4631 | NEIGHBOR_STR | |
4632 | NEIGHBOR_ADDR_STR2 | |
4633 | "Set default weight for routes from this neighbor\n" | |
4634 | "default weight\n") | |
4635 | { | |
4636 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
4637 | } | |
4638 | ||
4639 | DEFUN (no_neighbor_weight, | |
4640 | no_neighbor_weight_cmd, | |
4641 | NO_NEIGHBOR_CMD2 "weight", | |
4642 | NO_STR | |
4643 | NEIGHBOR_STR | |
4644 | NEIGHBOR_ADDR_STR2 | |
4645 | "Set default weight for routes from this neighbor\n") | |
4646 | { | |
4647 | return peer_weight_unset_vty (vty, argv[0]); | |
4648 | } | |
4649 | ||
4650 | ALIAS (no_neighbor_weight, | |
4651 | no_neighbor_weight_val_cmd, | |
4652 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
4653 | NO_STR | |
4654 | NEIGHBOR_STR | |
4655 | NEIGHBOR_ADDR_STR2 | |
4656 | "Set default weight for routes from this neighbor\n" | |
4657 | "default weight\n") | |
6b0655a2 | 4658 | |
718e3744 | 4659 | /* Override capability negotiation. */ |
4660 | DEFUN (neighbor_override_capability, | |
4661 | neighbor_override_capability_cmd, | |
4662 | NEIGHBOR_CMD2 "override-capability", | |
4663 | NEIGHBOR_STR | |
4664 | NEIGHBOR_ADDR_STR2 | |
4665 | "Override capability negotiation result\n") | |
4666 | { | |
4667 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4668 | } | |
4669 | ||
4670 | DEFUN (no_neighbor_override_capability, | |
4671 | no_neighbor_override_capability_cmd, | |
4672 | NO_NEIGHBOR_CMD2 "override-capability", | |
4673 | NO_STR | |
4674 | NEIGHBOR_STR | |
4675 | NEIGHBOR_ADDR_STR2 | |
4676 | "Override capability negotiation result\n") | |
4677 | { | |
4678 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4679 | } | |
6b0655a2 | 4680 | |
718e3744 | 4681 | DEFUN (neighbor_strict_capability, |
4682 | neighbor_strict_capability_cmd, | |
4683 | NEIGHBOR_CMD "strict-capability-match", | |
4684 | NEIGHBOR_STR | |
4685 | NEIGHBOR_ADDR_STR | |
4686 | "Strict capability negotiation match\n") | |
4687 | { | |
4688 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4689 | } | |
4690 | ||
4691 | DEFUN (no_neighbor_strict_capability, | |
4692 | no_neighbor_strict_capability_cmd, | |
4693 | NO_NEIGHBOR_CMD "strict-capability-match", | |
4694 | NO_STR | |
4695 | NEIGHBOR_STR | |
4696 | NEIGHBOR_ADDR_STR | |
4697 | "Strict capability negotiation match\n") | |
4698 | { | |
4699 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4700 | } | |
6b0655a2 | 4701 | |
94f2b392 | 4702 | static int |
fd79ac91 | 4703 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
4704 | const char *keep_str, const char *hold_str) | |
718e3744 | 4705 | { |
4706 | int ret; | |
4707 | struct peer *peer; | |
4708 | u_int32_t keepalive; | |
4709 | u_int32_t holdtime; | |
4710 | ||
4711 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4712 | if (! peer) | |
4713 | return CMD_WARNING; | |
4714 | ||
4715 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
4716 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
4717 | ||
4718 | ret = peer_timers_set (peer, keepalive, holdtime); | |
4719 | ||
4720 | return bgp_vty_return (vty, ret); | |
4721 | } | |
6b0655a2 | 4722 | |
94f2b392 | 4723 | static int |
fd79ac91 | 4724 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4725 | { |
4726 | int ret; | |
4727 | struct peer *peer; | |
4728 | ||
4729 | peer = peer_lookup_vty (vty, ip_str); | |
4730 | if (! peer) | |
4731 | return CMD_WARNING; | |
4732 | ||
4733 | ret = peer_timers_unset (peer); | |
4734 | ||
4735 | return bgp_vty_return (vty, ret); | |
4736 | } | |
4737 | ||
4738 | DEFUN (neighbor_timers, | |
4739 | neighbor_timers_cmd, | |
4740 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4741 | NEIGHBOR_STR | |
4742 | NEIGHBOR_ADDR_STR2 | |
4743 | "BGP per neighbor timers\n" | |
4744 | "Keepalive interval\n" | |
4745 | "Holdtime\n") | |
4746 | { | |
4747 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
4748 | } | |
4749 | ||
4750 | DEFUN (no_neighbor_timers, | |
4751 | no_neighbor_timers_cmd, | |
4752 | NO_NEIGHBOR_CMD2 "timers", | |
4753 | NO_STR | |
4754 | NEIGHBOR_STR | |
4755 | NEIGHBOR_ADDR_STR2 | |
4756 | "BGP per neighbor timers\n") | |
4757 | { | |
4758 | return peer_timers_unset_vty (vty, argv[0]); | |
4759 | } | |
6b0655a2 | 4760 | |
94f2b392 | 4761 | static int |
fd79ac91 | 4762 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
4763 | const char *time_str) | |
718e3744 | 4764 | { |
4765 | int ret; | |
4766 | struct peer *peer; | |
4767 | u_int32_t connect; | |
4768 | ||
966f821c | 4769 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4770 | if (! peer) |
4771 | return CMD_WARNING; | |
4772 | ||
4773 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
4774 | ||
4775 | ret = peer_timers_connect_set (peer, connect); | |
4776 | ||
966f821c | 4777 | return bgp_vty_return (vty, ret); |
718e3744 | 4778 | } |
4779 | ||
94f2b392 | 4780 | static int |
fd79ac91 | 4781 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4782 | { |
4783 | int ret; | |
4784 | struct peer *peer; | |
4785 | ||
4786 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4787 | if (! peer) | |
4788 | return CMD_WARNING; | |
4789 | ||
4790 | ret = peer_timers_connect_unset (peer); | |
4791 | ||
966f821c | 4792 | return bgp_vty_return (vty, ret); |
718e3744 | 4793 | } |
4794 | ||
4795 | DEFUN (neighbor_timers_connect, | |
4796 | neighbor_timers_connect_cmd, | |
966f821c | 4797 | NEIGHBOR_CMD2 "timers connect <0-65535>", |
718e3744 | 4798 | NEIGHBOR_STR |
966f821c | 4799 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4800 | "BGP per neighbor timers\n" |
4801 | "BGP connect timer\n" | |
4802 | "Connect timer\n") | |
4803 | { | |
4804 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
4805 | } | |
4806 | ||
4807 | DEFUN (no_neighbor_timers_connect, | |
4808 | no_neighbor_timers_connect_cmd, | |
966f821c | 4809 | NO_NEIGHBOR_CMD2 "timers connect", |
718e3744 | 4810 | NO_STR |
4811 | NEIGHBOR_STR | |
966f821c | 4812 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4813 | "BGP per neighbor timers\n" |
4814 | "BGP connect timer\n") | |
4815 | { | |
4816 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
4817 | } | |
4818 | ||
4819 | ALIAS (no_neighbor_timers_connect, | |
4820 | no_neighbor_timers_connect_val_cmd, | |
966f821c | 4821 | NO_NEIGHBOR_CMD2 "timers connect <0-65535>", |
718e3744 | 4822 | NO_STR |
4823 | NEIGHBOR_STR | |
966f821c | 4824 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4825 | "BGP per neighbor timers\n" |
4826 | "BGP connect timer\n" | |
4827 | "Connect timer\n") | |
6b0655a2 | 4828 | |
94f2b392 | 4829 | static int |
fd79ac91 | 4830 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
4831 | const char *time_str, int set) | |
718e3744 | 4832 | { |
4833 | int ret; | |
4834 | struct peer *peer; | |
4835 | u_int32_t routeadv = 0; | |
4836 | ||
966f821c | 4837 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4838 | if (! peer) |
4839 | return CMD_WARNING; | |
4840 | ||
4841 | if (time_str) | |
4842 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
4843 | ||
4844 | if (set) | |
4845 | ret = peer_advertise_interval_set (peer, routeadv); | |
4846 | else | |
4847 | ret = peer_advertise_interval_unset (peer); | |
4848 | ||
966f821c | 4849 | return bgp_vty_return (vty, ret); |
718e3744 | 4850 | } |
4851 | ||
4852 | DEFUN (neighbor_advertise_interval, | |
4853 | neighbor_advertise_interval_cmd, | |
966f821c | 4854 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4855 | NEIGHBOR_STR |
966f821c | 4856 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4857 | "Minimum interval between sending BGP routing updates\n" |
4858 | "time in seconds\n") | |
4859 | { | |
4860 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
4861 | } | |
4862 | ||
4863 | DEFUN (no_neighbor_advertise_interval, | |
4864 | no_neighbor_advertise_interval_cmd, | |
966f821c | 4865 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
718e3744 | 4866 | NO_STR |
4867 | NEIGHBOR_STR | |
966f821c | 4868 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4869 | "Minimum interval between sending BGP routing updates\n") |
4870 | { | |
4871 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
4872 | } | |
4873 | ||
4874 | ALIAS (no_neighbor_advertise_interval, | |
4875 | no_neighbor_advertise_interval_val_cmd, | |
966f821c | 4876 | NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4877 | NO_STR |
4878 | NEIGHBOR_STR | |
966f821c | 4879 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4880 | "Minimum interval between sending BGP routing updates\n" |
4881 | "time in seconds\n") | |
6b0655a2 | 4882 | |
518f0eb1 DS |
4883 | /* Time to wait before processing route-map updates */ |
4884 | DEFUN (bgp_set_route_map_delay_timer, | |
4885 | bgp_set_route_map_delay_timer_cmd, | |
4886 | "bgp route-map delay-timer <0-600>", | |
4887 | SET_STR | |
4888 | "BGP route-map delay timer\n" | |
4889 | "Time in secs to wait before processing route-map changes\n" | |
f414725f | 4890 | "0 disables the timer, no route updates happen when route-maps change\n") |
518f0eb1 DS |
4891 | { |
4892 | u_int32_t rmap_delay_timer; | |
4893 | struct bgp *bgp; | |
4894 | ||
4895 | bgp = vty->index; | |
4896 | if (argv[0]) | |
4897 | { | |
4898 | VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); | |
4899 | bgp->rmap_update_timer = rmap_delay_timer; | |
4900 | ||
4901 | /* if the dynamic update handling is being disabled, and a timer is | |
4902 | * running, stop the timer and act as if the timer has already fired. | |
4903 | */ | |
4904 | if (!rmap_delay_timer && bgp->t_rmap_update ) | |
4905 | { | |
4906 | BGP_TIMER_OFF(bgp->t_rmap_update); | |
4907 | thread_execute (bm->master, bgp_route_map_update_timer, &bgp, 0); | |
4908 | } | |
4909 | return CMD_SUCCESS; | |
4910 | } | |
4911 | else | |
ffd0c037 | 4912 | return CMD_WARNING; |
518f0eb1 DS |
4913 | } |
4914 | ||
4915 | DEFUN (no_bgp_set_route_map_delay_timer, | |
4916 | no_bgp_set_route_map_delay_timer_cmd, | |
4917 | "no bgp route-map delay-timer", | |
4918 | NO_STR | |
4919 | "Default BGP route-map delay timer\n" | |
f414725f | 4920 | "Reset to default time to wait for processing route-map changes\n") |
518f0eb1 | 4921 | { |
518f0eb1 DS |
4922 | struct bgp *bgp; |
4923 | ||
4924 | bgp = vty->index; | |
4925 | bgp->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER; | |
4926 | ||
4927 | return CMD_SUCCESS; | |
4928 | } | |
4929 | ||
f414725f DS |
4930 | ALIAS (no_bgp_set_route_map_delay_timer, |
4931 | no_bgp_set_route_map_delay_timer_val_cmd, | |
4932 | "no bgp route-map delay-timer <0-600>", | |
4933 | NO_STR | |
4934 | "Default BGP route-map delay timer\n" | |
4935 | "Reset to default time to wait for processing route-map changes\n" | |
4936 | "0 disables the timer, no route updates happen when route-maps change\n") | |
4937 | ||
718e3744 | 4938 | /* neighbor interface */ |
94f2b392 | 4939 | static int |
fd79ac91 | 4940 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 4941 | { |
718e3744 | 4942 | struct peer *peer; |
4943 | ||
4944 | peer = peer_lookup_vty (vty, ip_str); | |
a80beece | 4945 | if (! peer || peer->conf_if) |
718e3744 | 4946 | return CMD_WARNING; |
4947 | ||
4948 | if (str) | |
ffd0c037 | 4949 | peer_interface_set (peer, str); |
718e3744 | 4950 | else |
ffd0c037 | 4951 | peer_interface_unset (peer); |
718e3744 | 4952 | |
4953 | return CMD_SUCCESS; | |
4954 | } | |
4955 | ||
4956 | DEFUN (neighbor_interface, | |
4957 | neighbor_interface_cmd, | |
4958 | NEIGHBOR_CMD "interface WORD", | |
4959 | NEIGHBOR_STR | |
4960 | NEIGHBOR_ADDR_STR | |
4961 | "Interface\n" | |
4962 | "Interface name\n") | |
4963 | { | |
8ffedcea DS |
4964 | if (argc == 3) |
4965 | return peer_interface_vty (vty, argv[0], argv[1]); | |
4966 | else | |
4967 | return peer_interface_vty (vty, argv[0], argv[1]); | |
718e3744 | 4968 | } |
4969 | ||
4970 | DEFUN (no_neighbor_interface, | |
4971 | no_neighbor_interface_cmd, | |
8ffedcea | 4972 | NO_NEIGHBOR_CMD2 "interface WORD", |
718e3744 | 4973 | NO_STR |
4974 | NEIGHBOR_STR | |
4975 | NEIGHBOR_ADDR_STR | |
4976 | "Interface\n" | |
4977 | "Interface name\n") | |
4978 | { | |
4979 | return peer_interface_vty (vty, argv[0], NULL); | |
4980 | } | |
6b0655a2 | 4981 | |
718e3744 | 4982 | /* Set distribute list to the peer. */ |
94f2b392 | 4983 | static int |
fd79ac91 | 4984 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
4985 | afi_t afi, safi_t safi, | |
4986 | const char *name_str, const char *direct_str) | |
718e3744 | 4987 | { |
4988 | int ret; | |
4989 | struct peer *peer; | |
4990 | int direct = FILTER_IN; | |
4991 | ||
4992 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4993 | if (! peer) | |
4994 | return CMD_WARNING; | |
4995 | ||
4996 | /* Check filter direction. */ | |
4997 | if (strncmp (direct_str, "i", 1) == 0) | |
4998 | direct = FILTER_IN; | |
4999 | else if (strncmp (direct_str, "o", 1) == 0) | |
5000 | direct = FILTER_OUT; | |
5001 | ||
5002 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
5003 | ||
5004 | return bgp_vty_return (vty, ret); | |
5005 | } | |
5006 | ||
94f2b392 | 5007 | static int |
fd79ac91 | 5008 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5009 | safi_t safi, const char *direct_str) | |
718e3744 | 5010 | { |
5011 | int ret; | |
5012 | struct peer *peer; | |
5013 | int direct = FILTER_IN; | |
5014 | ||
5015 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5016 | if (! peer) | |
5017 | return CMD_WARNING; | |
5018 | ||
5019 | /* Check filter direction. */ | |
5020 | if (strncmp (direct_str, "i", 1) == 0) | |
5021 | direct = FILTER_IN; | |
5022 | else if (strncmp (direct_str, "o", 1) == 0) | |
5023 | direct = FILTER_OUT; | |
5024 | ||
5025 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
5026 | ||
5027 | return bgp_vty_return (vty, ret); | |
5028 | } | |
5029 | ||
5030 | DEFUN (neighbor_distribute_list, | |
5031 | neighbor_distribute_list_cmd, | |
5032 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5033 | NEIGHBOR_STR | |
5034 | NEIGHBOR_ADDR_STR2 | |
5035 | "Filter updates to/from this neighbor\n" | |
5036 | "IP access-list number\n" | |
5037 | "IP access-list number (expanded range)\n" | |
5038 | "IP Access-list name\n" | |
5039 | "Filter incoming updates\n" | |
5040 | "Filter outgoing updates\n") | |
5041 | { | |
5042 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5043 | bgp_node_safi (vty), argv[1], argv[2]); | |
5044 | } | |
5045 | ||
5046 | DEFUN (no_neighbor_distribute_list, | |
5047 | no_neighbor_distribute_list_cmd, | |
5048 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5049 | NO_STR | |
5050 | NEIGHBOR_STR | |
5051 | NEIGHBOR_ADDR_STR2 | |
5052 | "Filter updates to/from this neighbor\n" | |
5053 | "IP access-list number\n" | |
5054 | "IP access-list number (expanded range)\n" | |
5055 | "IP Access-list name\n" | |
5056 | "Filter incoming updates\n" | |
5057 | "Filter outgoing updates\n") | |
5058 | { | |
5059 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5060 | bgp_node_safi (vty), argv[2]); | |
5061 | } | |
6b0655a2 | 5062 | |
718e3744 | 5063 | /* Set prefix list to the peer. */ |
94f2b392 | 5064 | static int |
fd79ac91 | 5065 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5066 | safi_t safi, const char *name_str, | |
5067 | const char *direct_str) | |
718e3744 | 5068 | { |
5069 | int ret; | |
5070 | struct peer *peer; | |
5071 | int direct = FILTER_IN; | |
5072 | ||
5073 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5074 | if (! peer) | |
5075 | return CMD_WARNING; | |
5076 | ||
5077 | /* Check filter direction. */ | |
5078 | if (strncmp (direct_str, "i", 1) == 0) | |
5079 | direct = FILTER_IN; | |
5080 | else if (strncmp (direct_str, "o", 1) == 0) | |
5081 | direct = FILTER_OUT; | |
5082 | ||
5083 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
5084 | ||
5085 | return bgp_vty_return (vty, ret); | |
5086 | } | |
5087 | ||
94f2b392 | 5088 | static int |
fd79ac91 | 5089 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5090 | safi_t safi, const char *direct_str) | |
718e3744 | 5091 | { |
5092 | int ret; | |
5093 | struct peer *peer; | |
5094 | int direct = FILTER_IN; | |
5095 | ||
5096 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5097 | if (! peer) | |
5098 | return CMD_WARNING; | |
5099 | ||
5100 | /* Check filter direction. */ | |
5101 | if (strncmp (direct_str, "i", 1) == 0) | |
5102 | direct = FILTER_IN; | |
5103 | else if (strncmp (direct_str, "o", 1) == 0) | |
5104 | direct = FILTER_OUT; | |
5105 | ||
5106 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
5107 | ||
5108 | return bgp_vty_return (vty, ret); | |
5109 | } | |
5110 | ||
5111 | DEFUN (neighbor_prefix_list, | |
5112 | neighbor_prefix_list_cmd, | |
5113 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5114 | NEIGHBOR_STR | |
5115 | NEIGHBOR_ADDR_STR2 | |
5116 | "Filter updates to/from this neighbor\n" | |
5117 | "Name of a prefix list\n" | |
5118 | "Filter incoming updates\n" | |
5119 | "Filter outgoing updates\n") | |
5120 | { | |
5121 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5122 | bgp_node_safi (vty), argv[1], argv[2]); | |
5123 | } | |
5124 | ||
5125 | DEFUN (no_neighbor_prefix_list, | |
5126 | no_neighbor_prefix_list_cmd, | |
5127 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5128 | NO_STR | |
5129 | NEIGHBOR_STR | |
5130 | NEIGHBOR_ADDR_STR2 | |
5131 | "Filter updates to/from this neighbor\n" | |
5132 | "Name of a prefix list\n" | |
5133 | "Filter incoming updates\n" | |
5134 | "Filter outgoing updates\n") | |
5135 | { | |
5136 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5137 | bgp_node_safi (vty), argv[2]); | |
5138 | } | |
6b0655a2 | 5139 | |
94f2b392 | 5140 | static int |
fd79ac91 | 5141 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
5142 | afi_t afi, safi_t safi, | |
5143 | const char *name_str, const char *direct_str) | |
718e3744 | 5144 | { |
5145 | int ret; | |
5146 | struct peer *peer; | |
5147 | int direct = FILTER_IN; | |
5148 | ||
5149 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5150 | if (! peer) | |
5151 | return CMD_WARNING; | |
5152 | ||
5153 | /* Check filter direction. */ | |
5154 | if (strncmp (direct_str, "i", 1) == 0) | |
5155 | direct = FILTER_IN; | |
5156 | else if (strncmp (direct_str, "o", 1) == 0) | |
5157 | direct = FILTER_OUT; | |
5158 | ||
5159 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
5160 | ||
5161 | return bgp_vty_return (vty, ret); | |
5162 | } | |
5163 | ||
94f2b392 | 5164 | static int |
fd79ac91 | 5165 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
5166 | afi_t afi, safi_t safi, | |
5167 | const char *direct_str) | |
718e3744 | 5168 | { |
5169 | int ret; | |
5170 | struct peer *peer; | |
5171 | int direct = FILTER_IN; | |
5172 | ||
5173 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5174 | if (! peer) | |
5175 | return CMD_WARNING; | |
5176 | ||
5177 | /* Check filter direction. */ | |
5178 | if (strncmp (direct_str, "i", 1) == 0) | |
5179 | direct = FILTER_IN; | |
5180 | else if (strncmp (direct_str, "o", 1) == 0) | |
5181 | direct = FILTER_OUT; | |
5182 | ||
5183 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
5184 | ||
5185 | return bgp_vty_return (vty, ret); | |
5186 | } | |
5187 | ||
5188 | DEFUN (neighbor_filter_list, | |
5189 | neighbor_filter_list_cmd, | |
5190 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5191 | NEIGHBOR_STR | |
5192 | NEIGHBOR_ADDR_STR2 | |
5193 | "Establish BGP filters\n" | |
5194 | "AS path access-list name\n" | |
5195 | "Filter incoming routes\n" | |
5196 | "Filter outgoing routes\n") | |
5197 | { | |
5198 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5199 | bgp_node_safi (vty), argv[1], argv[2]); | |
5200 | } | |
5201 | ||
5202 | DEFUN (no_neighbor_filter_list, | |
5203 | no_neighbor_filter_list_cmd, | |
5204 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5205 | NO_STR | |
5206 | NEIGHBOR_STR | |
5207 | NEIGHBOR_ADDR_STR2 | |
5208 | "Establish BGP filters\n" | |
5209 | "AS path access-list name\n" | |
5210 | "Filter incoming routes\n" | |
5211 | "Filter outgoing routes\n") | |
5212 | { | |
5213 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5214 | bgp_node_safi (vty), argv[2]); | |
5215 | } | |
6b0655a2 | 5216 | |
718e3744 | 5217 | /* Set route-map to the peer. */ |
94f2b392 | 5218 | static int |
fd79ac91 | 5219 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
5220 | afi_t afi, safi_t safi, | |
5221 | const char *name_str, const char *direct_str) | |
718e3744 | 5222 | { |
5223 | int ret; | |
5224 | struct peer *peer; | |
fee0f4c6 | 5225 | int direct = RMAP_IN; |
718e3744 | 5226 | |
5227 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5228 | if (! peer) | |
5229 | return CMD_WARNING; | |
5230 | ||
5231 | /* Check filter direction. */ | |
fee0f4c6 | 5232 | if (strncmp (direct_str, "in", 2) == 0) |
5233 | direct = RMAP_IN; | |
718e3744 | 5234 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5235 | direct = RMAP_OUT; |
5236 | else if (strncmp (direct_str, "im", 2) == 0) | |
5237 | direct = RMAP_IMPORT; | |
5238 | else if (strncmp (direct_str, "e", 1) == 0) | |
5239 | direct = RMAP_EXPORT; | |
718e3744 | 5240 | |
5241 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
5242 | ||
5243 | return bgp_vty_return (vty, ret); | |
5244 | } | |
5245 | ||
94f2b392 | 5246 | static int |
fd79ac91 | 5247 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5248 | safi_t safi, const char *direct_str) | |
718e3744 | 5249 | { |
5250 | int ret; | |
5251 | struct peer *peer; | |
fee0f4c6 | 5252 | int direct = RMAP_IN; |
718e3744 | 5253 | |
5254 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5255 | if (! peer) | |
5256 | return CMD_WARNING; | |
5257 | ||
5258 | /* Check filter direction. */ | |
fee0f4c6 | 5259 | if (strncmp (direct_str, "in", 2) == 0) |
5260 | direct = RMAP_IN; | |
718e3744 | 5261 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5262 | direct = RMAP_OUT; |
5263 | else if (strncmp (direct_str, "im", 2) == 0) | |
5264 | direct = RMAP_IMPORT; | |
5265 | else if (strncmp (direct_str, "e", 1) == 0) | |
5266 | direct = RMAP_EXPORT; | |
718e3744 | 5267 | |
5268 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
5269 | ||
5270 | return bgp_vty_return (vty, ret); | |
5271 | } | |
5272 | ||
5273 | DEFUN (neighbor_route_map, | |
5274 | neighbor_route_map_cmd, | |
fee0f4c6 | 5275 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 5276 | NEIGHBOR_STR |
5277 | NEIGHBOR_ADDR_STR2 | |
5278 | "Apply route map to neighbor\n" | |
5279 | "Name of route map\n" | |
5280 | "Apply map to incoming routes\n" | |
fee0f4c6 | 5281 | "Apply map to outbound routes\n" |
5282 | "Apply map to routes going into a Route-Server client's table\n" | |
5283 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 5284 | { |
5285 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5286 | bgp_node_safi (vty), argv[1], argv[2]); | |
5287 | } | |
5288 | ||
5289 | DEFUN (no_neighbor_route_map, | |
5290 | no_neighbor_route_map_cmd, | |
fee0f4c6 | 5291 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 5292 | NO_STR |
5293 | NEIGHBOR_STR | |
5294 | NEIGHBOR_ADDR_STR2 | |
5295 | "Apply route map to neighbor\n" | |
5296 | "Name of route map\n" | |
5297 | "Apply map to incoming routes\n" | |
fee0f4c6 | 5298 | "Apply map to outbound routes\n" |
5299 | "Apply map to routes going into a Route-Server client's table\n" | |
5300 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 5301 | { |
5302 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5303 | bgp_node_safi (vty), argv[2]); | |
5304 | } | |
6b0655a2 | 5305 | |
718e3744 | 5306 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 5307 | static int |
fd79ac91 | 5308 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5309 | safi_t safi, const char *name_str) | |
718e3744 | 5310 | { |
5311 | int ret; | |
5312 | struct peer *peer; | |
5313 | ||
5314 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5315 | if (! peer) | |
5316 | return CMD_WARNING; | |
5317 | ||
5318 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
5319 | ||
5320 | return bgp_vty_return (vty, ret); | |
5321 | } | |
5322 | ||
5323 | /* Unset route-map from the peer. */ | |
94f2b392 | 5324 | static int |
fd79ac91 | 5325 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5326 | safi_t safi) |
5327 | { | |
5328 | int ret; | |
5329 | struct peer *peer; | |
5330 | ||
5331 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5332 | if (! peer) | |
5333 | return CMD_WARNING; | |
5334 | ||
5335 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
5336 | ||
5337 | return bgp_vty_return (vty, ret); | |
5338 | } | |
5339 | ||
5340 | DEFUN (neighbor_unsuppress_map, | |
5341 | neighbor_unsuppress_map_cmd, | |
5342 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5343 | NEIGHBOR_STR | |
5344 | NEIGHBOR_ADDR_STR2 | |
5345 | "Route-map to selectively unsuppress suppressed routes\n" | |
5346 | "Name of route map\n") | |
5347 | { | |
5348 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5349 | bgp_node_safi (vty), argv[1]); | |
5350 | } | |
5351 | ||
5352 | DEFUN (no_neighbor_unsuppress_map, | |
5353 | no_neighbor_unsuppress_map_cmd, | |
5354 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5355 | NO_STR | |
5356 | NEIGHBOR_STR | |
5357 | NEIGHBOR_ADDR_STR2 | |
5358 | "Route-map to selectively unsuppress suppressed routes\n" | |
5359 | "Name of route map\n") | |
5360 | { | |
5361 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5362 | bgp_node_safi (vty)); | |
5363 | } | |
6b0655a2 | 5364 | |
94f2b392 | 5365 | static int |
fd79ac91 | 5366 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5367 | safi_t safi, const char *num_str, | |
0a486e5f | 5368 | const char *threshold_str, int warning, |
5369 | const char *restart_str) | |
718e3744 | 5370 | { |
5371 | int ret; | |
5372 | struct peer *peer; | |
5373 | u_int32_t max; | |
e0701b79 | 5374 | u_char threshold; |
0a486e5f | 5375 | u_int16_t restart; |
718e3744 | 5376 | |
5377 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5378 | if (! peer) | |
5379 | return CMD_WARNING; | |
5380 | ||
e6ec1c36 | 5381 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 5382 | if (threshold_str) |
5383 | threshold = atoi (threshold_str); | |
5384 | else | |
5385 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 5386 | |
0a486e5f | 5387 | if (restart_str) |
5388 | restart = atoi (restart_str); | |
5389 | else | |
5390 | restart = 0; | |
5391 | ||
5392 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 5393 | |
5394 | return bgp_vty_return (vty, ret); | |
5395 | } | |
5396 | ||
94f2b392 | 5397 | static int |
fd79ac91 | 5398 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5399 | safi_t safi) |
5400 | { | |
5401 | int ret; | |
5402 | struct peer *peer; | |
5403 | ||
5404 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5405 | if (! peer) | |
5406 | return CMD_WARNING; | |
5407 | ||
5408 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
5409 | ||
5410 | return bgp_vty_return (vty, ret); | |
5411 | } | |
5412 | ||
5413 | /* Maximum number of prefix configuration. prefix count is different | |
5414 | for each peer configuration. So this configuration can be set for | |
5415 | each peer configuration. */ | |
5416 | DEFUN (neighbor_maximum_prefix, | |
5417 | neighbor_maximum_prefix_cmd, | |
5418 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5419 | NEIGHBOR_STR | |
5420 | NEIGHBOR_ADDR_STR2 | |
5421 | "Maximum number of prefix accept from this peer\n" | |
5422 | "maximum no. of prefix limit\n") | |
5423 | { | |
5424 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5425 | bgp_node_safi (vty), argv[1], NULL, 0, |
5426 | NULL); | |
718e3744 | 5427 | } |
5428 | ||
e0701b79 | 5429 | DEFUN (neighbor_maximum_prefix_threshold, |
5430 | neighbor_maximum_prefix_threshold_cmd, | |
5431 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
5432 | NEIGHBOR_STR | |
5433 | NEIGHBOR_ADDR_STR2 | |
5434 | "Maximum number of prefix accept from this peer\n" | |
5435 | "maximum no. of prefix limit\n" | |
5436 | "Threshold value (%) at which to generate a warning msg\n") | |
5437 | { | |
5438 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5439 | bgp_node_safi (vty), argv[1], argv[2], 0, |
5440 | NULL); | |
5441 | } | |
e0701b79 | 5442 | |
718e3744 | 5443 | DEFUN (neighbor_maximum_prefix_warning, |
5444 | neighbor_maximum_prefix_warning_cmd, | |
5445 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5446 | NEIGHBOR_STR | |
5447 | NEIGHBOR_ADDR_STR2 | |
5448 | "Maximum number of prefix accept from this peer\n" | |
5449 | "maximum no. of prefix limit\n" | |
5450 | "Only give warning message when limit is exceeded\n") | |
5451 | { | |
5452 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5453 | bgp_node_safi (vty), argv[1], NULL, 1, |
5454 | NULL); | |
718e3744 | 5455 | } |
5456 | ||
e0701b79 | 5457 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
5458 | neighbor_maximum_prefix_threshold_warning_cmd, | |
5459 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
5460 | NEIGHBOR_STR | |
5461 | NEIGHBOR_ADDR_STR2 | |
5462 | "Maximum number of prefix accept from this peer\n" | |
5463 | "maximum no. of prefix limit\n" | |
5464 | "Threshold value (%) at which to generate a warning msg\n" | |
5465 | "Only give warning message when limit is exceeded\n") | |
5466 | { | |
5467 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5468 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
5469 | } | |
5470 | ||
5471 | DEFUN (neighbor_maximum_prefix_restart, | |
5472 | neighbor_maximum_prefix_restart_cmd, | |
5473 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
5474 | NEIGHBOR_STR | |
5475 | NEIGHBOR_ADDR_STR2 | |
5476 | "Maximum number of prefix accept from this peer\n" | |
5477 | "maximum no. of prefix limit\n" | |
5478 | "Restart bgp connection after limit is exceeded\n" | |
5479 | "Restart interval in minutes") | |
5480 | { | |
5481 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5482 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
5483 | } | |
5484 | ||
5485 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
5486 | neighbor_maximum_prefix_threshold_restart_cmd, | |
5487 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5488 | NEIGHBOR_STR | |
5489 | NEIGHBOR_ADDR_STR2 | |
5490 | "Maximum number of prefix accept from this peer\n" | |
5491 | "maximum no. of prefix limit\n" | |
5492 | "Threshold value (%) at which to generate a warning msg\n" | |
5493 | "Restart bgp connection after limit is exceeded\n" | |
5494 | "Restart interval in minutes") | |
5495 | { | |
5496 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5497 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
5498 | } | |
e0701b79 | 5499 | |
718e3744 | 5500 | DEFUN (no_neighbor_maximum_prefix, |
5501 | no_neighbor_maximum_prefix_cmd, | |
5502 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
5503 | NO_STR | |
5504 | NEIGHBOR_STR | |
5505 | NEIGHBOR_ADDR_STR2 | |
5506 | "Maximum number of prefix accept from this peer\n") | |
5507 | { | |
5508 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5509 | bgp_node_safi (vty)); | |
5510 | } | |
5511 | ||
5512 | ALIAS (no_neighbor_maximum_prefix, | |
5513 | no_neighbor_maximum_prefix_val_cmd, | |
5514 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5515 | NO_STR | |
5516 | NEIGHBOR_STR | |
5517 | NEIGHBOR_ADDR_STR2 | |
5518 | "Maximum number of prefix accept from this peer\n" | |
5519 | "maximum no. of prefix limit\n") | |
5520 | ||
5521 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5522 | no_neighbor_maximum_prefix_threshold_cmd, |
5523 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5524 | NO_STR | |
5525 | NEIGHBOR_STR | |
5526 | NEIGHBOR_ADDR_STR2 | |
5527 | "Maximum number of prefix accept from this peer\n" | |
5528 | "maximum no. of prefix limit\n" | |
5529 | "Threshold value (%) at which to generate a warning msg\n") | |
5530 | ||
5531 | ALIAS (no_neighbor_maximum_prefix, | |
5532 | no_neighbor_maximum_prefix_warning_cmd, | |
5533 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5534 | NO_STR | |
5535 | NEIGHBOR_STR | |
5536 | NEIGHBOR_ADDR_STR2 | |
5537 | "Maximum number of prefix accept from this peer\n" | |
5538 | "maximum no. of prefix limit\n" | |
e8e1946e | 5539 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 5540 | |
5541 | ALIAS (no_neighbor_maximum_prefix, | |
5542 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 5543 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
5544 | NO_STR | |
5545 | NEIGHBOR_STR | |
5546 | NEIGHBOR_ADDR_STR2 | |
5547 | "Maximum number of prefix accept from this peer\n" | |
5548 | "maximum no. of prefix limit\n" | |
5549 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 5550 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 5551 | |
5552 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5553 | no_neighbor_maximum_prefix_restart_cmd, |
5554 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 5555 | NO_STR |
5556 | NEIGHBOR_STR | |
5557 | NEIGHBOR_ADDR_STR2 | |
5558 | "Maximum number of prefix accept from this peer\n" | |
5559 | "maximum no. of prefix limit\n" | |
0a486e5f | 5560 | "Restart bgp connection after limit is exceeded\n" |
5561 | "Restart interval in minutes") | |
5562 | ||
5563 | ALIAS (no_neighbor_maximum_prefix, | |
5564 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
5565 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5566 | NO_STR | |
5567 | NEIGHBOR_STR | |
5568 | NEIGHBOR_ADDR_STR2 | |
5569 | "Maximum number of prefix accept from this peer\n" | |
5570 | "maximum no. of prefix limit\n" | |
5571 | "Threshold value (%) at which to generate a warning msg\n" | |
5572 | "Restart bgp connection after limit is exceeded\n" | |
5573 | "Restart interval in minutes") | |
6b0655a2 | 5574 | |
718e3744 | 5575 | /* "neighbor allowas-in" */ |
5576 | DEFUN (neighbor_allowas_in, | |
5577 | neighbor_allowas_in_cmd, | |
5578 | NEIGHBOR_CMD2 "allowas-in", | |
5579 | NEIGHBOR_STR | |
5580 | NEIGHBOR_ADDR_STR2 | |
5581 | "Accept as-path with my AS present in it\n") | |
5582 | { | |
5583 | int ret; | |
5584 | struct peer *peer; | |
fd79ac91 | 5585 | unsigned int allow_num; |
718e3744 | 5586 | |
5587 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5588 | if (! peer) | |
5589 | return CMD_WARNING; | |
5590 | ||
5591 | if (argc == 1) | |
5592 | allow_num = 3; | |
5593 | else | |
5594 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
5595 | ||
5596 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
5597 | allow_num); | |
5598 | ||
5599 | return bgp_vty_return (vty, ret); | |
5600 | } | |
5601 | ||
5602 | ALIAS (neighbor_allowas_in, | |
5603 | neighbor_allowas_in_arg_cmd, | |
5604 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5605 | NEIGHBOR_STR | |
5606 | NEIGHBOR_ADDR_STR2 | |
5607 | "Accept as-path with my AS present in it\n" | |
5608 | "Number of occurances of AS number\n") | |
5609 | ||
5610 | DEFUN (no_neighbor_allowas_in, | |
5611 | no_neighbor_allowas_in_cmd, | |
5612 | NO_NEIGHBOR_CMD2 "allowas-in", | |
5613 | NO_STR | |
5614 | NEIGHBOR_STR | |
5615 | NEIGHBOR_ADDR_STR2 | |
5616 | "allow local ASN appears in aspath attribute\n") | |
5617 | { | |
5618 | int ret; | |
5619 | struct peer *peer; | |
5620 | ||
5621 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5622 | if (! peer) | |
5623 | return CMD_WARNING; | |
5624 | ||
5625 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
5626 | ||
5627 | return bgp_vty_return (vty, ret); | |
5628 | } | |
6b0655a2 | 5629 | |
fa411a21 NH |
5630 | DEFUN (neighbor_ttl_security, |
5631 | neighbor_ttl_security_cmd, | |
5632 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5633 | NEIGHBOR_STR | |
5634 | NEIGHBOR_ADDR_STR2 | |
5635 | "Specify the maximum number of hops to the BGP peer\n") | |
5636 | { | |
5637 | struct peer *peer; | |
89b6d1f8 | 5638 | int gtsm_hops; |
fa411a21 NH |
5639 | |
5640 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5641 | if (! peer) | |
5642 | return CMD_WARNING; | |
5643 | ||
5644 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); | |
5645 | ||
89b6d1f8 | 5646 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
5647 | } |
5648 | ||
5649 | DEFUN (no_neighbor_ttl_security, | |
5650 | no_neighbor_ttl_security_cmd, | |
5651 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5652 | NO_STR | |
5653 | NEIGHBOR_STR | |
5654 | NEIGHBOR_ADDR_STR2 | |
5655 | "Specify the maximum number of hops to the BGP peer\n") | |
5656 | { | |
5657 | struct peer *peer; | |
fa411a21 NH |
5658 | |
5659 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5660 | if (! peer) | |
5661 | return CMD_WARNING; | |
5662 | ||
89b6d1f8 | 5663 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 5664 | } |
6b0655a2 | 5665 | |
718e3744 | 5666 | /* Address family configuration. */ |
5667 | DEFUN (address_family_ipv4, | |
5668 | address_family_ipv4_cmd, | |
5669 | "address-family ipv4", | |
5670 | "Enter Address Family command mode\n" | |
5671 | "Address family\n") | |
5672 | { | |
5673 | vty->node = BGP_IPV4_NODE; | |
5674 | return CMD_SUCCESS; | |
5675 | } | |
5676 | ||
5677 | DEFUN (address_family_ipv4_safi, | |
5678 | address_family_ipv4_safi_cmd, | |
5679 | "address-family ipv4 (unicast|multicast)", | |
5680 | "Enter Address Family command mode\n" | |
5681 | "Address family\n" | |
5682 | "Address Family modifier\n" | |
5683 | "Address Family modifier\n") | |
5684 | { | |
5685 | if (strncmp (argv[0], "m", 1) == 0) | |
5686 | vty->node = BGP_IPV4M_NODE; | |
5687 | else | |
5688 | vty->node = BGP_IPV4_NODE; | |
5689 | ||
5690 | return CMD_SUCCESS; | |
5691 | } | |
5692 | ||
25ffbdc1 | 5693 | DEFUN (address_family_ipv6, |
5694 | address_family_ipv6_cmd, | |
5695 | "address-family ipv6", | |
718e3744 | 5696 | "Enter Address Family command mode\n" |
25ffbdc1 | 5697 | "Address family\n") |
718e3744 | 5698 | { |
5699 | vty->node = BGP_IPV6_NODE; | |
5700 | return CMD_SUCCESS; | |
5701 | } | |
5702 | ||
25ffbdc1 | 5703 | DEFUN (address_family_ipv6_safi, |
5704 | address_family_ipv6_safi_cmd, | |
5705 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 5706 | "Enter Address Family command mode\n" |
25ffbdc1 | 5707 | "Address family\n" |
5708 | "Address Family modifier\n" | |
5709 | "Address Family modifier\n") | |
5710 | { | |
5711 | if (strncmp (argv[0], "m", 1) == 0) | |
5712 | vty->node = BGP_IPV6M_NODE; | |
5713 | else | |
5714 | vty->node = BGP_IPV6_NODE; | |
5715 | ||
5716 | return CMD_SUCCESS; | |
5717 | } | |
718e3744 | 5718 | |
5719 | DEFUN (address_family_vpnv4, | |
5720 | address_family_vpnv4_cmd, | |
5721 | "address-family vpnv4", | |
5722 | "Enter Address Family command mode\n" | |
5723 | "Address family\n") | |
5724 | { | |
5725 | vty->node = BGP_VPNV4_NODE; | |
5726 | return CMD_SUCCESS; | |
5727 | } | |
5728 | ||
5729 | ALIAS (address_family_vpnv4, | |
5730 | address_family_vpnv4_unicast_cmd, | |
5731 | "address-family vpnv4 unicast", | |
5732 | "Enter Address Family command mode\n" | |
5733 | "Address family\n" | |
5734 | "Address Family Modifier\n") | |
5735 | ||
5736 | DEFUN (exit_address_family, | |
5737 | exit_address_family_cmd, | |
5738 | "exit-address-family", | |
5739 | "Exit from Address Family configuration mode\n") | |
5740 | { | |
a8a80d53 | 5741 | if (vty->node == BGP_IPV4_NODE |
5742 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 5743 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 5744 | || vty->node == BGP_IPV6_NODE |
5745 | || vty->node == BGP_IPV6M_NODE) | |
718e3744 | 5746 | vty->node = BGP_NODE; |
5747 | return CMD_SUCCESS; | |
5748 | } | |
6b0655a2 | 5749 | |
8ad7271d DS |
5750 | /* Recalculate bestpath and re-advertise a prefix */ |
5751 | static int | |
5752 | bgp_clear_prefix (struct vty *vty, char *view_name, const char *ip_str, | |
5753 | afi_t afi, safi_t safi, struct prefix_rd *prd) | |
5754 | { | |
5755 | int ret; | |
5756 | struct prefix match; | |
5757 | struct bgp_node *rn; | |
5758 | struct bgp_node *rm; | |
8ad7271d DS |
5759 | struct bgp *bgp; |
5760 | struct bgp_table *table; | |
5761 | struct bgp_table *rib; | |
5762 | ||
5763 | /* BGP structure lookup. */ | |
5764 | if (view_name) | |
5765 | { | |
5766 | bgp = bgp_lookup_by_name (view_name); | |
5767 | if (bgp == NULL) | |
5768 | { | |
5769 | vty_out (vty, "%% Can't find BGP view %s%s", view_name, VTY_NEWLINE); | |
5770 | return CMD_WARNING; | |
5771 | } | |
5772 | } | |
5773 | else | |
5774 | { | |
5775 | bgp = bgp_get_default (); | |
5776 | if (bgp == NULL) | |
5777 | { | |
5778 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
5779 | return CMD_WARNING; | |
5780 | } | |
5781 | } | |
5782 | ||
5783 | /* Check IP address argument. */ | |
5784 | ret = str2prefix (ip_str, &match); | |
5785 | if (! ret) | |
5786 | { | |
5787 | vty_out (vty, "%% address is malformed%s", VTY_NEWLINE); | |
5788 | return CMD_WARNING; | |
5789 | } | |
5790 | ||
5791 | match.family = afi2family (afi); | |
5792 | rib = bgp->rib[afi][safi]; | |
5793 | ||
5794 | if (safi == SAFI_MPLS_VPN) | |
5795 | { | |
5796 | for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn)) | |
5797 | { | |
5798 | if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) | |
5799 | continue; | |
5800 | ||
5801 | if ((table = rn->info) != NULL) | |
5802 | { | |
5803 | if ((rm = bgp_node_match (table, &match)) != NULL) | |
5804 | { | |
5805 | if (rm->p.prefixlen == match.prefixlen) | |
5806 | { | |
5807 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5808 | bgp_process (bgp, rm, afi, safi); | |
5809 | } | |
5810 | bgp_unlock_node (rm); | |
5811 | } | |
5812 | } | |
5813 | } | |
5814 | } | |
5815 | else | |
5816 | { | |
5817 | if ((rn = bgp_node_match (rib, &match)) != NULL) | |
5818 | { | |
5819 | if (rn->p.prefixlen == match.prefixlen) | |
5820 | { | |
5821 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5822 | bgp_process (bgp, rn, afi, safi); | |
5823 | } | |
5824 | bgp_unlock_node (rn); | |
5825 | } | |
5826 | } | |
5827 | ||
5828 | return CMD_SUCCESS; | |
5829 | } | |
5830 | ||
718e3744 | 5831 | DEFUN (clear_ip_bgp_all, |
5832 | clear_ip_bgp_all_cmd, | |
5833 | "clear ip bgp *", | |
5834 | CLEAR_STR | |
5835 | IP_STR | |
5836 | BGP_STR | |
5837 | "Clear all peers\n") | |
5838 | { | |
5839 | if (argc == 1) | |
5840 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5841 | ||
5842 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5843 | } | |
5844 | ||
5845 | ALIAS (clear_ip_bgp_all, | |
5846 | clear_bgp_all_cmd, | |
5847 | "clear bgp *", | |
5848 | CLEAR_STR | |
5849 | BGP_STR | |
5850 | "Clear all peers\n") | |
5851 | ||
5852 | ALIAS (clear_ip_bgp_all, | |
5853 | clear_bgp_ipv6_all_cmd, | |
5854 | "clear bgp ipv6 *", | |
5855 | CLEAR_STR | |
5856 | BGP_STR | |
5857 | "Address family\n" | |
5858 | "Clear all peers\n") | |
5859 | ||
5860 | ALIAS (clear_ip_bgp_all, | |
5861 | clear_ip_bgp_instance_all_cmd, | |
5862 | "clear ip bgp view WORD *", | |
5863 | CLEAR_STR | |
5864 | IP_STR | |
5865 | BGP_STR | |
5866 | "BGP view\n" | |
5867 | "view name\n" | |
5868 | "Clear all peers\n") | |
5869 | ||
5870 | ALIAS (clear_ip_bgp_all, | |
5871 | clear_bgp_instance_all_cmd, | |
5872 | "clear bgp view WORD *", | |
5873 | CLEAR_STR | |
5874 | BGP_STR | |
5875 | "BGP view\n" | |
5876 | "view name\n" | |
5877 | "Clear all peers\n") | |
5878 | ||
5879 | DEFUN (clear_ip_bgp_peer, | |
5880 | clear_ip_bgp_peer_cmd, | |
a80beece | 5881 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5882 | CLEAR_STR |
5883 | IP_STR | |
5884 | BGP_STR | |
5885 | "BGP neighbor IP address to clear\n" | |
a80beece DS |
5886 | "BGP IPv6 neighbor to clear\n" |
5887 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5888 | { |
5889 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5890 | } | |
5891 | ||
5892 | ALIAS (clear_ip_bgp_peer, | |
5893 | clear_bgp_peer_cmd, | |
a80beece | 5894 | "clear bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5895 | CLEAR_STR |
5896 | BGP_STR | |
5897 | "BGP neighbor address to clear\n" | |
a80beece DS |
5898 | "BGP IPv6 neighbor to clear\n" |
5899 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5900 | |
5901 | ALIAS (clear_ip_bgp_peer, | |
5902 | clear_bgp_ipv6_peer_cmd, | |
a80beece | 5903 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5904 | CLEAR_STR |
5905 | BGP_STR | |
5906 | "Address family\n" | |
5907 | "BGP neighbor address to clear\n" | |
a80beece DS |
5908 | "BGP IPv6 neighbor to clear\n" |
5909 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5910 | |
5911 | DEFUN (clear_ip_bgp_peer_group, | |
5912 | clear_ip_bgp_peer_group_cmd, | |
5913 | "clear ip bgp peer-group WORD", | |
5914 | CLEAR_STR | |
5915 | IP_STR | |
5916 | BGP_STR | |
5917 | "Clear all members of peer-group\n" | |
5918 | "BGP peer-group name\n") | |
5919 | { | |
5920 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5921 | } | |
5922 | ||
5923 | ALIAS (clear_ip_bgp_peer_group, | |
5924 | clear_bgp_peer_group_cmd, | |
5925 | "clear bgp peer-group WORD", | |
5926 | CLEAR_STR | |
5927 | BGP_STR | |
5928 | "Clear all members of peer-group\n" | |
5929 | "BGP peer-group name\n") | |
5930 | ||
5931 | ALIAS (clear_ip_bgp_peer_group, | |
5932 | clear_bgp_ipv6_peer_group_cmd, | |
5933 | "clear bgp ipv6 peer-group WORD", | |
5934 | CLEAR_STR | |
5935 | BGP_STR | |
5936 | "Address family\n" | |
5937 | "Clear all members of peer-group\n" | |
5938 | "BGP peer-group name\n") | |
5939 | ||
5940 | DEFUN (clear_ip_bgp_external, | |
5941 | clear_ip_bgp_external_cmd, | |
5942 | "clear ip bgp external", | |
5943 | CLEAR_STR | |
5944 | IP_STR | |
5945 | BGP_STR | |
5946 | "Clear all external peers\n") | |
5947 | { | |
5948 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
5949 | } | |
5950 | ||
5951 | ALIAS (clear_ip_bgp_external, | |
5952 | clear_bgp_external_cmd, | |
5953 | "clear bgp external", | |
5954 | CLEAR_STR | |
5955 | BGP_STR | |
5956 | "Clear all external peers\n") | |
5957 | ||
5958 | ALIAS (clear_ip_bgp_external, | |
5959 | clear_bgp_ipv6_external_cmd, | |
5960 | "clear bgp ipv6 external", | |
5961 | CLEAR_STR | |
5962 | BGP_STR | |
5963 | "Address family\n" | |
5964 | "Clear all external peers\n") | |
5965 | ||
8ad7271d DS |
5966 | DEFUN (clear_ip_bgp_prefix, |
5967 | clear_ip_bgp_prefix_cmd, | |
5968 | "clear ip bgp prefix A.B.C.D/M", | |
5969 | CLEAR_STR | |
5970 | IP_STR | |
5971 | BGP_STR | |
5972 | "Clear bestpath and re-advertise\n" | |
5973 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
5974 | { | |
5975 | return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL); | |
5976 | } | |
5977 | ||
5978 | ALIAS (clear_ip_bgp_prefix, | |
5979 | clear_bgp_prefix_cmd, | |
5980 | "clear bgp prefix A.B.C.D/M", | |
5981 | CLEAR_STR | |
5982 | BGP_STR | |
5983 | "Clear bestpath and re-advertise\n" | |
5984 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
5985 | ||
5986 | ||
718e3744 | 5987 | DEFUN (clear_ip_bgp_as, |
5988 | clear_ip_bgp_as_cmd, | |
320da874 | 5989 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 5990 | CLEAR_STR |
5991 | IP_STR | |
5992 | BGP_STR | |
5993 | "Clear peers with the AS number\n") | |
5994 | { | |
5995 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5996 | } | |
5997 | ||
5998 | ALIAS (clear_ip_bgp_as, | |
5999 | clear_bgp_as_cmd, | |
320da874 | 6000 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 6001 | CLEAR_STR |
6002 | BGP_STR | |
6003 | "Clear peers with the AS number\n") | |
6004 | ||
6005 | ALIAS (clear_ip_bgp_as, | |
6006 | clear_bgp_ipv6_as_cmd, | |
320da874 | 6007 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 6008 | CLEAR_STR |
6009 | BGP_STR | |
6010 | "Address family\n" | |
6011 | "Clear peers with the AS number\n") | |
6b0655a2 | 6012 | |
718e3744 | 6013 | /* Outbound soft-reconfiguration */ |
6014 | DEFUN (clear_ip_bgp_all_soft_out, | |
6015 | clear_ip_bgp_all_soft_out_cmd, | |
6016 | "clear ip bgp * soft out", | |
6017 | CLEAR_STR | |
6018 | IP_STR | |
6019 | BGP_STR | |
6020 | "Clear all peers\n" | |
e0bce756 DS |
6021 | BGP_SOFT_STR |
6022 | BGP_SOFT_OUT_STR) | |
718e3744 | 6023 | { |
6024 | if (argc == 1) | |
6025 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6026 | BGP_CLEAR_SOFT_OUT, NULL); | |
6027 | ||
6028 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6029 | BGP_CLEAR_SOFT_OUT, NULL); | |
6030 | } | |
6031 | ||
6032 | ALIAS (clear_ip_bgp_all_soft_out, | |
6033 | clear_ip_bgp_all_out_cmd, | |
6034 | "clear ip bgp * out", | |
6035 | CLEAR_STR | |
6036 | IP_STR | |
6037 | BGP_STR | |
6038 | "Clear all peers\n" | |
e0bce756 | 6039 | BGP_SOFT_OUT_STR) |
718e3744 | 6040 | |
6041 | ALIAS (clear_ip_bgp_all_soft_out, | |
6042 | clear_ip_bgp_instance_all_soft_out_cmd, | |
6043 | "clear ip bgp view WORD * soft out", | |
6044 | CLEAR_STR | |
6045 | IP_STR | |
6046 | BGP_STR | |
6047 | "BGP view\n" | |
6048 | "view name\n" | |
6049 | "Clear all peers\n" | |
e0bce756 DS |
6050 | BGP_SOFT_STR |
6051 | BGP_SOFT_OUT_STR) | |
718e3744 | 6052 | |
6053 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
6054 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
6055 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
6056 | CLEAR_STR | |
6057 | IP_STR | |
6058 | BGP_STR | |
6059 | "Clear all peers\n" | |
6060 | "Address family\n" | |
6061 | "Address Family modifier\n" | |
6062 | "Address Family modifier\n" | |
e0bce756 DS |
6063 | BGP_SOFT_STR |
6064 | BGP_SOFT_OUT_STR) | |
718e3744 | 6065 | { |
6066 | if (strncmp (argv[0], "m", 1) == 0) | |
6067 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6068 | BGP_CLEAR_SOFT_OUT, NULL); | |
6069 | ||
6070 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6071 | BGP_CLEAR_SOFT_OUT, NULL); | |
6072 | } | |
6073 | ||
6074 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, | |
6075 | clear_ip_bgp_all_ipv4_out_cmd, | |
6076 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
6077 | CLEAR_STR | |
6078 | IP_STR | |
6079 | BGP_STR | |
6080 | "Clear all peers\n" | |
6081 | "Address family\n" | |
6082 | "Address Family modifier\n" | |
6083 | "Address Family modifier\n" | |
e0bce756 | 6084 | BGP_SOFT_OUT_STR) |
718e3744 | 6085 | |
6086 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, | |
6087 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
6088 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", | |
6089 | CLEAR_STR | |
6090 | IP_STR | |
6091 | BGP_STR | |
6092 | "BGP view\n" | |
6093 | "view name\n" | |
6094 | "Clear all peers\n" | |
6095 | "Address family\n" | |
6096 | "Address Family modifier\n" | |
6097 | "Address Family modifier\n" | |
e0bce756 | 6098 | BGP_SOFT_OUT_STR) |
718e3744 | 6099 | { |
6100 | if (strncmp (argv[1], "m", 1) == 0) | |
6101 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6102 | BGP_CLEAR_SOFT_OUT, NULL); | |
6103 | ||
6104 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6105 | BGP_CLEAR_SOFT_OUT, NULL); | |
6106 | } | |
6107 | ||
6108 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
6109 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
6110 | "clear ip bgp * vpnv4 unicast soft out", | |
6111 | CLEAR_STR | |
6112 | IP_STR | |
6113 | BGP_STR | |
6114 | "Clear all peers\n" | |
6115 | "Address family\n" | |
6116 | "Address Family Modifier\n" | |
e0bce756 DS |
6117 | BGP_SOFT_STR |
6118 | BGP_SOFT_OUT_STR) | |
718e3744 | 6119 | { |
6120 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6121 | BGP_CLEAR_SOFT_OUT, NULL); | |
6122 | } | |
6123 | ||
6124 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
6125 | clear_ip_bgp_all_vpnv4_out_cmd, | |
6126 | "clear ip bgp * vpnv4 unicast out", | |
6127 | CLEAR_STR | |
6128 | IP_STR | |
6129 | BGP_STR | |
6130 | "Clear all peers\n" | |
6131 | "Address family\n" | |
6132 | "Address Family Modifier\n" | |
e0bce756 | 6133 | BGP_SOFT_OUT_STR) |
718e3744 | 6134 | |
6135 | DEFUN (clear_bgp_all_soft_out, | |
6136 | clear_bgp_all_soft_out_cmd, | |
6137 | "clear bgp * soft out", | |
6138 | CLEAR_STR | |
6139 | BGP_STR | |
6140 | "Clear all peers\n" | |
e0bce756 DS |
6141 | BGP_SOFT_STR |
6142 | BGP_SOFT_OUT_STR) | |
718e3744 | 6143 | { |
6144 | if (argc == 1) | |
6145 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6146 | BGP_CLEAR_SOFT_OUT, NULL); | |
6147 | ||
6148 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6149 | BGP_CLEAR_SOFT_OUT, NULL); | |
6150 | } | |
6151 | ||
6152 | ALIAS (clear_bgp_all_soft_out, | |
6153 | clear_bgp_instance_all_soft_out_cmd, | |
6154 | "clear bgp view WORD * soft out", | |
6155 | CLEAR_STR | |
6156 | BGP_STR | |
6157 | "BGP view\n" | |
6158 | "view name\n" | |
6159 | "Clear all peers\n" | |
e0bce756 DS |
6160 | BGP_SOFT_STR |
6161 | BGP_SOFT_OUT_STR) | |
718e3744 | 6162 | |
6163 | ALIAS (clear_bgp_all_soft_out, | |
6164 | clear_bgp_all_out_cmd, | |
6165 | "clear bgp * out", | |
6166 | CLEAR_STR | |
6167 | BGP_STR | |
6168 | "Clear all peers\n" | |
e0bce756 | 6169 | BGP_SOFT_OUT_STR) |
718e3744 | 6170 | |
6171 | ALIAS (clear_bgp_all_soft_out, | |
6172 | clear_bgp_ipv6_all_soft_out_cmd, | |
6173 | "clear bgp ipv6 * soft out", | |
6174 | CLEAR_STR | |
6175 | BGP_STR | |
6176 | "Address family\n" | |
6177 | "Clear all peers\n" | |
e0bce756 DS |
6178 | BGP_SOFT_STR |
6179 | BGP_SOFT_OUT_STR) | |
718e3744 | 6180 | |
6181 | ALIAS (clear_bgp_all_soft_out, | |
6182 | clear_bgp_ipv6_all_out_cmd, | |
6183 | "clear bgp ipv6 * out", | |
6184 | CLEAR_STR | |
6185 | BGP_STR | |
6186 | "Address family\n" | |
6187 | "Clear all peers\n" | |
e0bce756 | 6188 | BGP_SOFT_OUT_STR) |
718e3744 | 6189 | |
8ad7271d DS |
6190 | DEFUN (clear_bgp_ipv6_safi_prefix, |
6191 | clear_bgp_ipv6_safi_prefix_cmd, | |
6192 | "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6193 | CLEAR_STR | |
6194 | BGP_STR | |
6195 | "Address family\n" | |
6196 | "Address Family Modifier\n" | |
6197 | "Clear bestpath and re-advertise\n" | |
6198 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6199 | { | |
6200 | if (strncmp (argv[0], "m", 1) == 0) | |
6201 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL); | |
6202 | else | |
6203 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL); | |
6204 | } | |
6205 | ||
718e3744 | 6206 | DEFUN (clear_ip_bgp_peer_soft_out, |
6207 | clear_ip_bgp_peer_soft_out_cmd, | |
db64ea86 | 6208 | "clear ip bgp (A.B.C.D|WORD) soft out", |
718e3744 | 6209 | CLEAR_STR |
6210 | IP_STR | |
6211 | BGP_STR | |
6212 | "BGP neighbor address to clear\n" | |
db64ea86 | 6213 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6214 | BGP_SOFT_STR |
6215 | BGP_SOFT_OUT_STR) | |
718e3744 | 6216 | { |
6217 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6218 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6219 | } | |
6220 | ||
6221 | ALIAS (clear_ip_bgp_peer_soft_out, | |
6222 | clear_ip_bgp_peer_out_cmd, | |
db64ea86 | 6223 | "clear ip bgp (A.B.C.D|WORD) out", |
718e3744 | 6224 | CLEAR_STR |
6225 | IP_STR | |
6226 | BGP_STR | |
6227 | "BGP neighbor address to clear\n" | |
db64ea86 | 6228 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6229 | BGP_SOFT_OUT_STR) |
718e3744 | 6230 | |
6231 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, | |
6232 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
db64ea86 | 6233 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", |
718e3744 | 6234 | CLEAR_STR |
6235 | IP_STR | |
6236 | BGP_STR | |
6237 | "BGP neighbor address to clear\n" | |
db64ea86 | 6238 | "BGP neighbor on interface to clear\n" |
718e3744 | 6239 | "Address family\n" |
6240 | "Address Family modifier\n" | |
6241 | "Address Family modifier\n" | |
e0bce756 DS |
6242 | BGP_SOFT_STR |
6243 | BGP_SOFT_OUT_STR) | |
718e3744 | 6244 | { |
6245 | if (strncmp (argv[1], "m", 1) == 0) | |
6246 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6247 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6248 | ||
6249 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6250 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6251 | } | |
6252 | ||
6253 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, | |
6254 | clear_ip_bgp_peer_ipv4_out_cmd, | |
db64ea86 | 6255 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out", |
718e3744 | 6256 | CLEAR_STR |
6257 | IP_STR | |
6258 | BGP_STR | |
6259 | "BGP neighbor address to clear\n" | |
db64ea86 | 6260 | "BGP neighbor on interface to clear\n" |
718e3744 | 6261 | "Address family\n" |
6262 | "Address Family modifier\n" | |
6263 | "Address Family modifier\n" | |
e0bce756 | 6264 | BGP_SOFT_OUT_STR) |
718e3744 | 6265 | |
db64ea86 | 6266 | /* NOTE: WORD peers have not been tested for vpnv4 */ |
718e3744 | 6267 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
6268 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
db64ea86 | 6269 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out", |
718e3744 | 6270 | CLEAR_STR |
6271 | IP_STR | |
6272 | BGP_STR | |
6273 | "BGP neighbor address to clear\n" | |
db64ea86 | 6274 | "BGP neighbor on interface to clear\n" |
718e3744 | 6275 | "Address family\n" |
6276 | "Address Family Modifier\n" | |
e0bce756 DS |
6277 | BGP_SOFT_STR |
6278 | BGP_SOFT_OUT_STR) | |
718e3744 | 6279 | { |
6280 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6281 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6282 | } | |
6283 | ||
6284 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
6285 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
db64ea86 | 6286 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out", |
718e3744 | 6287 | CLEAR_STR |
6288 | IP_STR | |
6289 | BGP_STR | |
6290 | "BGP neighbor address to clear\n" | |
db64ea86 | 6291 | "BGP neighbor on interface to clear\n" |
718e3744 | 6292 | "Address family\n" |
6293 | "Address Family Modifier\n" | |
e0bce756 | 6294 | BGP_SOFT_OUT_STR) |
718e3744 | 6295 | |
6296 | DEFUN (clear_bgp_peer_soft_out, | |
6297 | clear_bgp_peer_soft_out_cmd, | |
a80beece | 6298 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6299 | CLEAR_STR |
6300 | BGP_STR | |
6301 | "BGP neighbor address to clear\n" | |
6302 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6303 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6304 | BGP_SOFT_STR |
6305 | BGP_SOFT_OUT_STR) | |
718e3744 | 6306 | { |
6307 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6308 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6309 | } | |
6310 | ||
6311 | ALIAS (clear_bgp_peer_soft_out, | |
6312 | clear_bgp_ipv6_peer_soft_out_cmd, | |
a80beece | 6313 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6314 | CLEAR_STR |
6315 | BGP_STR | |
6316 | "Address family\n" | |
6317 | "BGP neighbor address to clear\n" | |
6318 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6319 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6320 | BGP_SOFT_STR |
6321 | BGP_SOFT_OUT_STR) | |
718e3744 | 6322 | |
6323 | ALIAS (clear_bgp_peer_soft_out, | |
6324 | clear_bgp_peer_out_cmd, | |
a80beece | 6325 | "clear bgp (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 6326 | CLEAR_STR |
6327 | BGP_STR | |
6328 | "BGP neighbor address to clear\n" | |
6329 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6330 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6331 | BGP_SOFT_OUT_STR) |
718e3744 | 6332 | |
6333 | ALIAS (clear_bgp_peer_soft_out, | |
6334 | clear_bgp_ipv6_peer_out_cmd, | |
a80beece | 6335 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 6336 | CLEAR_STR |
6337 | BGP_STR | |
6338 | "Address family\n" | |
6339 | "BGP neighbor address to clear\n" | |
6340 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6341 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6342 | BGP_SOFT_OUT_STR) |
718e3744 | 6343 | |
6344 | DEFUN (clear_ip_bgp_peer_group_soft_out, | |
6345 | clear_ip_bgp_peer_group_soft_out_cmd, | |
6346 | "clear ip bgp peer-group WORD soft out", | |
6347 | CLEAR_STR | |
6348 | IP_STR | |
6349 | BGP_STR | |
6350 | "Clear all members of peer-group\n" | |
6351 | "BGP peer-group name\n" | |
e0bce756 DS |
6352 | BGP_SOFT_STR |
6353 | BGP_SOFT_OUT_STR) | |
718e3744 | 6354 | { |
6355 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6356 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6357 | } | |
6358 | ||
6359 | ALIAS (clear_ip_bgp_peer_group_soft_out, | |
6360 | clear_ip_bgp_peer_group_out_cmd, | |
6361 | "clear ip bgp peer-group WORD out", | |
6362 | CLEAR_STR | |
6363 | IP_STR | |
6364 | BGP_STR | |
6365 | "Clear all members of peer-group\n" | |
6366 | "BGP peer-group name\n" | |
e0bce756 | 6367 | BGP_SOFT_OUT_STR) |
718e3744 | 6368 | |
6369 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, | |
6370 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
6371 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
6372 | CLEAR_STR | |
6373 | IP_STR | |
6374 | BGP_STR | |
6375 | "Clear all members of peer-group\n" | |
6376 | "BGP peer-group name\n" | |
6377 | "Address family\n" | |
6378 | "Address Family modifier\n" | |
6379 | "Address Family modifier\n" | |
e0bce756 DS |
6380 | BGP_SOFT_STR |
6381 | BGP_SOFT_OUT_STR) | |
718e3744 | 6382 | { |
6383 | if (strncmp (argv[1], "m", 1) == 0) | |
6384 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6385 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6386 | ||
6387 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6388 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6389 | } | |
6390 | ||
6391 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, | |
6392 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
6393 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
6394 | CLEAR_STR | |
6395 | IP_STR | |
6396 | BGP_STR | |
6397 | "Clear all members of peer-group\n" | |
6398 | "BGP peer-group name\n" | |
6399 | "Address family\n" | |
6400 | "Address Family modifier\n" | |
6401 | "Address Family modifier\n" | |
e0bce756 | 6402 | BGP_SOFT_OUT_STR) |
718e3744 | 6403 | |
6404 | DEFUN (clear_bgp_peer_group_soft_out, | |
6405 | clear_bgp_peer_group_soft_out_cmd, | |
6406 | "clear bgp peer-group WORD soft out", | |
6407 | CLEAR_STR | |
6408 | BGP_STR | |
6409 | "Clear all members of peer-group\n" | |
6410 | "BGP peer-group name\n" | |
e0bce756 DS |
6411 | BGP_SOFT_STR |
6412 | BGP_SOFT_OUT_STR) | |
718e3744 | 6413 | { |
6414 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6415 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6416 | } | |
6417 | ||
6418 | ALIAS (clear_bgp_peer_group_soft_out, | |
6419 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
6420 | "clear bgp ipv6 peer-group WORD soft out", | |
6421 | CLEAR_STR | |
6422 | BGP_STR | |
6423 | "Address family\n" | |
6424 | "Clear all members of peer-group\n" | |
6425 | "BGP peer-group name\n" | |
e0bce756 DS |
6426 | BGP_SOFT_STR |
6427 | BGP_SOFT_OUT_STR) | |
718e3744 | 6428 | |
6429 | ALIAS (clear_bgp_peer_group_soft_out, | |
6430 | clear_bgp_peer_group_out_cmd, | |
6431 | "clear bgp peer-group WORD out", | |
6432 | CLEAR_STR | |
6433 | BGP_STR | |
6434 | "Clear all members of peer-group\n" | |
6435 | "BGP peer-group name\n" | |
e0bce756 | 6436 | BGP_SOFT_OUT_STR) |
718e3744 | 6437 | |
6438 | ALIAS (clear_bgp_peer_group_soft_out, | |
6439 | clear_bgp_ipv6_peer_group_out_cmd, | |
6440 | "clear bgp ipv6 peer-group WORD out", | |
6441 | CLEAR_STR | |
6442 | BGP_STR | |
6443 | "Address family\n" | |
6444 | "Clear all members of peer-group\n" | |
6445 | "BGP peer-group name\n" | |
e0bce756 | 6446 | BGP_SOFT_OUT_STR) |
718e3744 | 6447 | |
6448 | DEFUN (clear_ip_bgp_external_soft_out, | |
6449 | clear_ip_bgp_external_soft_out_cmd, | |
6450 | "clear ip bgp external soft out", | |
6451 | CLEAR_STR | |
6452 | IP_STR | |
6453 | BGP_STR | |
6454 | "Clear all external peers\n" | |
e0bce756 DS |
6455 | BGP_SOFT_STR |
6456 | BGP_SOFT_OUT_STR) | |
718e3744 | 6457 | { |
6458 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6459 | BGP_CLEAR_SOFT_OUT, NULL); | |
6460 | } | |
6461 | ||
6462 | ALIAS (clear_ip_bgp_external_soft_out, | |
6463 | clear_ip_bgp_external_out_cmd, | |
6464 | "clear ip bgp external out", | |
6465 | CLEAR_STR | |
6466 | IP_STR | |
6467 | BGP_STR | |
6468 | "Clear all external peers\n" | |
e0bce756 | 6469 | BGP_SOFT_OUT_STR) |
718e3744 | 6470 | |
6471 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
6472 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
6473 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
6474 | CLEAR_STR | |
6475 | IP_STR | |
6476 | BGP_STR | |
6477 | "Clear all external peers\n" | |
6478 | "Address family\n" | |
6479 | "Address Family modifier\n" | |
6480 | "Address Family modifier\n" | |
e0bce756 DS |
6481 | BGP_SOFT_STR |
6482 | BGP_SOFT_OUT_STR) | |
718e3744 | 6483 | { |
6484 | if (strncmp (argv[0], "m", 1) == 0) | |
6485 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6486 | BGP_CLEAR_SOFT_OUT, NULL); | |
6487 | ||
6488 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6489 | BGP_CLEAR_SOFT_OUT, NULL); | |
6490 | } | |
6491 | ||
6492 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, | |
6493 | clear_ip_bgp_external_ipv4_out_cmd, | |
6494 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
6495 | CLEAR_STR | |
6496 | IP_STR | |
6497 | BGP_STR | |
6498 | "Clear all external peers\n" | |
6499 | "Address family\n" | |
6500 | "Address Family modifier\n" | |
6501 | "Address Family modifier\n" | |
e0bce756 | 6502 | BGP_SOFT_OUT_STR) |
718e3744 | 6503 | |
6504 | DEFUN (clear_bgp_external_soft_out, | |
6505 | clear_bgp_external_soft_out_cmd, | |
6506 | "clear bgp external soft out", | |
6507 | CLEAR_STR | |
6508 | BGP_STR | |
6509 | "Clear all external peers\n" | |
e0bce756 DS |
6510 | BGP_SOFT_STR |
6511 | BGP_SOFT_OUT_STR) | |
718e3744 | 6512 | { |
6513 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6514 | BGP_CLEAR_SOFT_OUT, NULL); | |
6515 | } | |
6516 | ||
6517 | ALIAS (clear_bgp_external_soft_out, | |
6518 | clear_bgp_ipv6_external_soft_out_cmd, | |
6519 | "clear bgp ipv6 external soft out", | |
6520 | CLEAR_STR | |
6521 | BGP_STR | |
6522 | "Address family\n" | |
6523 | "Clear all external peers\n" | |
e0bce756 DS |
6524 | BGP_SOFT_STR |
6525 | BGP_SOFT_OUT_STR) | |
718e3744 | 6526 | |
6527 | ALIAS (clear_bgp_external_soft_out, | |
6528 | clear_bgp_external_out_cmd, | |
6529 | "clear bgp external out", | |
6530 | CLEAR_STR | |
6531 | BGP_STR | |
6532 | "Clear all external peers\n" | |
e0bce756 | 6533 | BGP_SOFT_OUT_STR) |
718e3744 | 6534 | |
6535 | ALIAS (clear_bgp_external_soft_out, | |
6536 | clear_bgp_ipv6_external_out_cmd, | |
6537 | "clear bgp ipv6 external WORD out", | |
6538 | CLEAR_STR | |
6539 | BGP_STR | |
6540 | "Address family\n" | |
6541 | "Clear all external peers\n" | |
e0bce756 | 6542 | BGP_SOFT_OUT_STR) |
718e3744 | 6543 | |
6544 | DEFUN (clear_ip_bgp_as_soft_out, | |
6545 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 6546 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 6547 | CLEAR_STR |
6548 | IP_STR | |
6549 | BGP_STR | |
6550 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6551 | BGP_SOFT_STR |
6552 | BGP_SOFT_OUT_STR) | |
718e3744 | 6553 | { |
6554 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6555 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6556 | } | |
6557 | ||
6558 | ALIAS (clear_ip_bgp_as_soft_out, | |
6559 | clear_ip_bgp_as_out_cmd, | |
320da874 | 6560 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 6561 | CLEAR_STR |
6562 | IP_STR | |
6563 | BGP_STR | |
6564 | "Clear peers with the AS number\n" | |
e0bce756 | 6565 | BGP_SOFT_OUT_STR) |
718e3744 | 6566 | |
6567 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, | |
6568 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 6569 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 6570 | CLEAR_STR |
6571 | IP_STR | |
6572 | BGP_STR | |
6573 | "Clear peers with the AS number\n" | |
6574 | "Address family\n" | |
6575 | "Address Family modifier\n" | |
6576 | "Address Family modifier\n" | |
e0bce756 DS |
6577 | BGP_SOFT_STR |
6578 | BGP_SOFT_OUT_STR) | |
718e3744 | 6579 | { |
6580 | if (strncmp (argv[1], "m", 1) == 0) | |
6581 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6582 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6583 | ||
6584 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6585 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6586 | } | |
6587 | ||
6588 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, | |
6589 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 6590 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 6591 | CLEAR_STR |
6592 | IP_STR | |
6593 | BGP_STR | |
6594 | "Clear peers with the AS number\n" | |
6595 | "Address family\n" | |
6596 | "Address Family modifier\n" | |
6597 | "Address Family modifier\n" | |
e0bce756 | 6598 | BGP_SOFT_OUT_STR) |
718e3744 | 6599 | |
6600 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, | |
6601 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 6602 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 6603 | CLEAR_STR |
6604 | IP_STR | |
6605 | BGP_STR | |
6606 | "Clear peers with the AS number\n" | |
6607 | "Address family\n" | |
6608 | "Address Family modifier\n" | |
e0bce756 DS |
6609 | BGP_SOFT_STR |
6610 | BGP_SOFT_OUT_STR) | |
718e3744 | 6611 | { |
6612 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
6613 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6614 | } | |
6615 | ||
6616 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
6617 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 6618 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 6619 | CLEAR_STR |
6620 | IP_STR | |
6621 | BGP_STR | |
6622 | "Clear peers with the AS number\n" | |
6623 | "Address family\n" | |
6624 | "Address Family modifier\n" | |
e0bce756 | 6625 | BGP_SOFT_OUT_STR) |
718e3744 | 6626 | |
6627 | DEFUN (clear_bgp_as_soft_out, | |
6628 | clear_bgp_as_soft_out_cmd, | |
320da874 | 6629 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 6630 | CLEAR_STR |
6631 | BGP_STR | |
6632 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6633 | BGP_SOFT_STR |
6634 | BGP_SOFT_OUT_STR) | |
718e3744 | 6635 | { |
6636 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6637 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6638 | } | |
6639 | ||
6640 | ALIAS (clear_bgp_as_soft_out, | |
6641 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 6642 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 6643 | CLEAR_STR |
6644 | BGP_STR | |
6645 | "Address family\n" | |
6646 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6647 | BGP_SOFT_STR |
6648 | BGP_SOFT_OUT_STR) | |
718e3744 | 6649 | |
6650 | ALIAS (clear_bgp_as_soft_out, | |
6651 | clear_bgp_as_out_cmd, | |
320da874 | 6652 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 6653 | CLEAR_STR |
6654 | BGP_STR | |
6655 | "Clear peers with the AS number\n" | |
e0bce756 | 6656 | BGP_SOFT_OUT_STR) |
718e3744 | 6657 | |
6658 | ALIAS (clear_bgp_as_soft_out, | |
6659 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 6660 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 6661 | CLEAR_STR |
6662 | BGP_STR | |
6663 | "Address family\n" | |
6664 | "Clear peers with the AS number\n" | |
e0bce756 | 6665 | BGP_SOFT_OUT_STR) |
6b0655a2 | 6666 | |
718e3744 | 6667 | /* Inbound soft-reconfiguration */ |
6668 | DEFUN (clear_ip_bgp_all_soft_in, | |
6669 | clear_ip_bgp_all_soft_in_cmd, | |
6670 | "clear ip bgp * soft in", | |
6671 | CLEAR_STR | |
6672 | IP_STR | |
6673 | BGP_STR | |
6674 | "Clear all peers\n" | |
e0bce756 DS |
6675 | BGP_SOFT_STR |
6676 | BGP_SOFT_IN_STR) | |
718e3744 | 6677 | { |
6678 | if (argc == 1) | |
6679 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6680 | BGP_CLEAR_SOFT_IN, NULL); | |
6681 | ||
6682 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6683 | BGP_CLEAR_SOFT_IN, NULL); | |
6684 | } | |
6685 | ||
6686 | ALIAS (clear_ip_bgp_all_soft_in, | |
6687 | clear_ip_bgp_instance_all_soft_in_cmd, | |
6688 | "clear ip bgp view WORD * soft in", | |
6689 | CLEAR_STR | |
6690 | IP_STR | |
6691 | BGP_STR | |
6692 | "BGP view\n" | |
6693 | "view name\n" | |
6694 | "Clear all peers\n" | |
e0bce756 DS |
6695 | BGP_SOFT_STR |
6696 | BGP_SOFT_IN_STR) | |
718e3744 | 6697 | |
6698 | ALIAS (clear_ip_bgp_all_soft_in, | |
6699 | clear_ip_bgp_all_in_cmd, | |
6700 | "clear ip bgp * in", | |
6701 | CLEAR_STR | |
6702 | IP_STR | |
6703 | BGP_STR | |
6704 | "Clear all peers\n" | |
e0bce756 | 6705 | BGP_SOFT_IN_STR) |
718e3744 | 6706 | |
6707 | DEFUN (clear_ip_bgp_all_in_prefix_filter, | |
6708 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
6709 | "clear ip bgp * in prefix-filter", | |
6710 | CLEAR_STR | |
6711 | IP_STR | |
6712 | BGP_STR | |
6713 | "Clear all peers\n" | |
e0bce756 | 6714 | BGP_SOFT_IN_STR |
718e3744 | 6715 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6716 | { | |
6717 | if (argc== 1) | |
6718 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6719 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6720 | ||
6721 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6722 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6723 | } | |
6724 | ||
6725 | ALIAS (clear_ip_bgp_all_in_prefix_filter, | |
6726 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, | |
6727 | "clear ip bgp view WORD * in prefix-filter", | |
6728 | CLEAR_STR | |
6729 | IP_STR | |
6730 | BGP_STR | |
6731 | "BGP view\n" | |
6732 | "view name\n" | |
6733 | "Clear all peers\n" | |
e0bce756 | 6734 | BGP_SOFT_IN_STR |
718e3744 | 6735 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6736 | ||
6737 | ||
6738 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, | |
6739 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
6740 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
6741 | CLEAR_STR | |
6742 | IP_STR | |
6743 | BGP_STR | |
6744 | "Clear all peers\n" | |
6745 | "Address family\n" | |
6746 | "Address Family modifier\n" | |
6747 | "Address Family modifier\n" | |
e0bce756 DS |
6748 | BGP_SOFT_STR |
6749 | BGP_SOFT_IN_STR) | |
718e3744 | 6750 | { |
6751 | if (strncmp (argv[0], "m", 1) == 0) | |
6752 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6753 | BGP_CLEAR_SOFT_IN, NULL); | |
6754 | ||
6755 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6756 | BGP_CLEAR_SOFT_IN, NULL); | |
6757 | } | |
6758 | ||
6759 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, | |
6760 | clear_ip_bgp_all_ipv4_in_cmd, | |
6761 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
6762 | CLEAR_STR | |
6763 | IP_STR | |
6764 | BGP_STR | |
6765 | "Clear all peers\n" | |
6766 | "Address family\n" | |
6767 | "Address Family modifier\n" | |
6768 | "Address Family modifier\n" | |
e0bce756 | 6769 | BGP_SOFT_IN_STR) |
718e3744 | 6770 | |
6771 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, | |
6772 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
6773 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", | |
6774 | CLEAR_STR | |
6775 | IP_STR | |
6776 | BGP_STR | |
6777 | "BGP view\n" | |
6778 | "view name\n" | |
6779 | "Clear all peers\n" | |
6780 | "Address family\n" | |
6781 | "Address Family modifier\n" | |
6782 | "Address Family modifier\n" | |
e0bce756 DS |
6783 | BGP_SOFT_STR |
6784 | BGP_SOFT_IN_STR) | |
718e3744 | 6785 | { |
6786 | if (strncmp (argv[1], "m", 1) == 0) | |
6787 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6788 | BGP_CLEAR_SOFT_IN, NULL); | |
6789 | ||
6790 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6791 | BGP_CLEAR_SOFT_IN, NULL); | |
6792 | } | |
6793 | ||
6794 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, | |
6795 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
6796 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
6797 | CLEAR_STR | |
6798 | IP_STR | |
6799 | BGP_STR | |
6800 | "Clear all peers\n" | |
6801 | "Address family\n" | |
6802 | "Address Family modifier\n" | |
6803 | "Address Family modifier\n" | |
e0bce756 | 6804 | BGP_SOFT_IN_STR |
718e3744 | 6805 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6806 | { | |
6807 | if (strncmp (argv[0], "m", 1) == 0) | |
6808 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6809 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6810 | ||
6811 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6812 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6813 | } | |
6814 | ||
6815 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, | |
6816 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, | |
6817 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", | |
6818 | CLEAR_STR | |
6819 | IP_STR | |
6820 | BGP_STR | |
6821 | "Clear all peers\n" | |
6822 | "Address family\n" | |
6823 | "Address Family modifier\n" | |
6824 | "Address Family modifier\n" | |
e0bce756 | 6825 | BGP_SOFT_IN_STR |
718e3744 | 6826 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6827 | { | |
6828 | if (strncmp (argv[1], "m", 1) == 0) | |
6829 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6830 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6831 | ||
6832 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6833 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6834 | } | |
6835 | ||
6836 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
6837 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
6838 | "clear ip bgp * vpnv4 unicast soft in", | |
6839 | CLEAR_STR | |
6840 | IP_STR | |
6841 | BGP_STR | |
6842 | "Clear all peers\n" | |
6843 | "Address family\n" | |
6844 | "Address Family Modifier\n" | |
e0bce756 DS |
6845 | BGP_SOFT_STR |
6846 | BGP_SOFT_IN_STR) | |
718e3744 | 6847 | { |
6848 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6849 | BGP_CLEAR_SOFT_IN, NULL); | |
6850 | } | |
6851 | ||
6852 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
6853 | clear_ip_bgp_all_vpnv4_in_cmd, | |
6854 | "clear ip bgp * vpnv4 unicast in", | |
6855 | CLEAR_STR | |
6856 | IP_STR | |
6857 | BGP_STR | |
6858 | "Clear all peers\n" | |
6859 | "Address family\n" | |
6860 | "Address Family Modifier\n" | |
e0bce756 | 6861 | BGP_SOFT_IN_STR) |
718e3744 | 6862 | |
6863 | DEFUN (clear_bgp_all_soft_in, | |
6864 | clear_bgp_all_soft_in_cmd, | |
6865 | "clear bgp * soft in", | |
6866 | CLEAR_STR | |
6867 | BGP_STR | |
6868 | "Clear all peers\n" | |
e0bce756 DS |
6869 | BGP_SOFT_STR |
6870 | BGP_SOFT_IN_STR) | |
718e3744 | 6871 | { |
6872 | if (argc == 1) | |
6873 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6874 | BGP_CLEAR_SOFT_IN, NULL); | |
6875 | ||
6876 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6877 | BGP_CLEAR_SOFT_IN, NULL); | |
6878 | } | |
6879 | ||
6880 | ALIAS (clear_bgp_all_soft_in, | |
6881 | clear_bgp_instance_all_soft_in_cmd, | |
6882 | "clear bgp view WORD * soft in", | |
6883 | CLEAR_STR | |
6884 | BGP_STR | |
6885 | "BGP view\n" | |
6886 | "view name\n" | |
6887 | "Clear all peers\n" | |
e0bce756 DS |
6888 | BGP_SOFT_STR |
6889 | BGP_SOFT_IN_STR) | |
718e3744 | 6890 | |
6891 | ALIAS (clear_bgp_all_soft_in, | |
6892 | clear_bgp_ipv6_all_soft_in_cmd, | |
6893 | "clear bgp ipv6 * soft in", | |
6894 | CLEAR_STR | |
6895 | BGP_STR | |
6896 | "Address family\n" | |
6897 | "Clear all peers\n" | |
e0bce756 DS |
6898 | BGP_SOFT_STR |
6899 | BGP_SOFT_IN_STR) | |
718e3744 | 6900 | |
6901 | ALIAS (clear_bgp_all_soft_in, | |
6902 | clear_bgp_all_in_cmd, | |
6903 | "clear bgp * in", | |
6904 | CLEAR_STR | |
6905 | BGP_STR | |
6906 | "Clear all peers\n" | |
e0bce756 | 6907 | BGP_SOFT_IN_STR) |
718e3744 | 6908 | |
6909 | ALIAS (clear_bgp_all_soft_in, | |
6910 | clear_bgp_ipv6_all_in_cmd, | |
6911 | "clear bgp ipv6 * in", | |
6912 | CLEAR_STR | |
6913 | BGP_STR | |
6914 | "Address family\n" | |
6915 | "Clear all peers\n" | |
e0bce756 | 6916 | BGP_SOFT_IN_STR) |
718e3744 | 6917 | |
6918 | DEFUN (clear_bgp_all_in_prefix_filter, | |
6919 | clear_bgp_all_in_prefix_filter_cmd, | |
6920 | "clear bgp * in prefix-filter", | |
6921 | CLEAR_STR | |
6922 | BGP_STR | |
6923 | "Clear all peers\n" | |
e0bce756 | 6924 | BGP_SOFT_IN_STR |
718e3744 | 6925 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6926 | { | |
6927 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6928 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6929 | } | |
6930 | ||
6931 | ALIAS (clear_bgp_all_in_prefix_filter, | |
6932 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
6933 | "clear bgp ipv6 * in prefix-filter", | |
6934 | CLEAR_STR | |
6935 | BGP_STR | |
6936 | "Address family\n" | |
6937 | "Clear all peers\n" | |
e0bce756 | 6938 | BGP_SOFT_IN_STR |
718e3744 | 6939 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6940 | ||
6941 | DEFUN (clear_ip_bgp_peer_soft_in, | |
6942 | clear_ip_bgp_peer_soft_in_cmd, | |
db64ea86 | 6943 | "clear ip bgp (A.B.C.D|WORD) soft in", |
718e3744 | 6944 | CLEAR_STR |
6945 | IP_STR | |
6946 | BGP_STR | |
6947 | "BGP neighbor address to clear\n" | |
db64ea86 | 6948 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6949 | BGP_SOFT_STR |
6950 | BGP_SOFT_IN_STR) | |
718e3744 | 6951 | { |
6952 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6953 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6954 | } | |
6955 | ||
6956 | ALIAS (clear_ip_bgp_peer_soft_in, | |
6957 | clear_ip_bgp_peer_in_cmd, | |
db64ea86 | 6958 | "clear ip bgp (A.B.C.D|WORD) in", |
718e3744 | 6959 | CLEAR_STR |
6960 | IP_STR | |
6961 | BGP_STR | |
6962 | "BGP neighbor address to clear\n" | |
db64ea86 | 6963 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6964 | BGP_SOFT_IN_STR) |
718e3744 | 6965 | |
6966 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, | |
6967 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
db64ea86 | 6968 | "clear ip bgp (A.B.C.D|WORD) in prefix-filter", |
718e3744 | 6969 | CLEAR_STR |
6970 | IP_STR | |
6971 | BGP_STR | |
6972 | "BGP neighbor address to clear\n" | |
db64ea86 | 6973 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6974 | BGP_SOFT_IN_STR |
718e3744 | 6975 | "Push out the existing ORF prefix-list\n") |
6976 | { | |
6977 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6978 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6979 | } | |
6980 | ||
6981 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
6982 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
db64ea86 | 6983 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", |
718e3744 | 6984 | CLEAR_STR |
6985 | IP_STR | |
6986 | BGP_STR | |
6987 | "BGP neighbor address to clear\n" | |
db64ea86 | 6988 | "BGP neighbor on interface to clear\n" |
718e3744 | 6989 | "Address family\n" |
6990 | "Address Family modifier\n" | |
6991 | "Address Family modifier\n" | |
e0bce756 DS |
6992 | BGP_SOFT_STR |
6993 | BGP_SOFT_IN_STR) | |
718e3744 | 6994 | { |
6995 | if (strncmp (argv[1], "m", 1) == 0) | |
6996 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6997 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6998 | ||
6999 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7000 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7001 | } | |
7002 | ||
7003 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, | |
7004 | clear_ip_bgp_peer_ipv4_in_cmd, | |
db64ea86 | 7005 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in", |
718e3744 | 7006 | CLEAR_STR |
7007 | IP_STR | |
7008 | BGP_STR | |
7009 | "BGP neighbor address to clear\n" | |
db64ea86 | 7010 | "BGP neighbor on interface to clear\n" |
718e3744 | 7011 | "Address family\n" |
7012 | "Address Family modifier\n" | |
7013 | "Address Family modifier\n" | |
e0bce756 | 7014 | BGP_SOFT_IN_STR) |
718e3744 | 7015 | |
7016 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, | |
7017 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
db64ea86 | 7018 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 7019 | CLEAR_STR |
7020 | IP_STR | |
7021 | BGP_STR | |
7022 | "BGP neighbor address to clear\n" | |
db64ea86 | 7023 | "BGP neighbor on interface to clear\n" |
718e3744 | 7024 | "Address family\n" |
7025 | "Address Family modifier\n" | |
7026 | "Address Family modifier\n" | |
e0bce756 | 7027 | BGP_SOFT_IN_STR |
718e3744 | 7028 | "Push out the existing ORF prefix-list\n") |
7029 | { | |
7030 | if (strncmp (argv[1], "m", 1) == 0) | |
7031 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
7032 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7033 | ||
7034 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7035 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7036 | } | |
7037 | ||
7038 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
7039 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
db64ea86 | 7040 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in", |
718e3744 | 7041 | CLEAR_STR |
7042 | IP_STR | |
7043 | BGP_STR | |
7044 | "BGP neighbor address to clear\n" | |
db64ea86 | 7045 | "BGP neighbor on interface to clear\n" |
718e3744 | 7046 | "Address family\n" |
7047 | "Address Family Modifier\n" | |
e0bce756 DS |
7048 | BGP_SOFT_STR |
7049 | BGP_SOFT_IN_STR) | |
718e3744 | 7050 | { |
7051 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
7052 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7053 | } | |
7054 | ||
7055 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
7056 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
db64ea86 | 7057 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in", |
718e3744 | 7058 | CLEAR_STR |
7059 | IP_STR | |
7060 | BGP_STR | |
7061 | "BGP neighbor address to clear\n" | |
db64ea86 | 7062 | "BGP neighbor on interface to clear\n" |
718e3744 | 7063 | "Address family\n" |
7064 | "Address Family Modifier\n" | |
e0bce756 | 7065 | BGP_SOFT_IN_STR) |
718e3744 | 7066 | |
7067 | DEFUN (clear_bgp_peer_soft_in, | |
7068 | clear_bgp_peer_soft_in_cmd, | |
a80beece | 7069 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 7070 | CLEAR_STR |
7071 | BGP_STR | |
7072 | "BGP neighbor address to clear\n" | |
7073 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7074 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
7075 | BGP_SOFT_STR |
7076 | BGP_SOFT_IN_STR) | |
718e3744 | 7077 | { |
7078 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7079 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7080 | } | |
7081 | ||
7082 | ALIAS (clear_bgp_peer_soft_in, | |
7083 | clear_bgp_ipv6_peer_soft_in_cmd, | |
a80beece | 7084 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 7085 | CLEAR_STR |
7086 | BGP_STR | |
7087 | "Address family\n" | |
7088 | "BGP neighbor address to clear\n" | |
7089 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7090 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
7091 | BGP_SOFT_STR |
7092 | BGP_SOFT_IN_STR) | |
718e3744 | 7093 | |
7094 | ALIAS (clear_bgp_peer_soft_in, | |
7095 | clear_bgp_peer_in_cmd, | |
a80beece | 7096 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 7097 | CLEAR_STR |
7098 | BGP_STR | |
7099 | "BGP neighbor address to clear\n" | |
7100 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7101 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7102 | BGP_SOFT_IN_STR) |
718e3744 | 7103 | |
7104 | ALIAS (clear_bgp_peer_soft_in, | |
7105 | clear_bgp_ipv6_peer_in_cmd, | |
a80beece | 7106 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 7107 | CLEAR_STR |
7108 | BGP_STR | |
7109 | "Address family\n" | |
7110 | "BGP neighbor address to clear\n" | |
7111 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7112 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7113 | BGP_SOFT_IN_STR) |
718e3744 | 7114 | |
7115 | DEFUN (clear_bgp_peer_in_prefix_filter, | |
7116 | clear_bgp_peer_in_prefix_filter_cmd, | |
a80beece | 7117 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 7118 | CLEAR_STR |
7119 | BGP_STR | |
7120 | "BGP neighbor address to clear\n" | |
7121 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7122 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7123 | BGP_SOFT_IN_STR |
718e3744 | 7124 | "Push out the existing ORF prefix-list\n") |
7125 | { | |
7126 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7127 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7128 | } | |
7129 | ||
7130 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
7131 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
a80beece | 7132 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 7133 | CLEAR_STR |
7134 | BGP_STR | |
7135 | "Address family\n" | |
7136 | "BGP neighbor address to clear\n" | |
7137 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7138 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7139 | BGP_SOFT_IN_STR |
718e3744 | 7140 | "Push out the existing ORF prefix-list\n") |
7141 | ||
7142 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
7143 | clear_ip_bgp_peer_group_soft_in_cmd, | |
7144 | "clear ip bgp peer-group WORD soft in", | |
7145 | CLEAR_STR | |
7146 | IP_STR | |
7147 | BGP_STR | |
7148 | "Clear all members of peer-group\n" | |
7149 | "BGP peer-group name\n" | |
e0bce756 DS |
7150 | BGP_SOFT_STR |
7151 | BGP_SOFT_IN_STR) | |
718e3744 | 7152 | { |
7153 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7154 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7155 | } | |
7156 | ||
7157 | ALIAS (clear_ip_bgp_peer_group_soft_in, | |
7158 | clear_ip_bgp_peer_group_in_cmd, | |
7159 | "clear ip bgp peer-group WORD in", | |
7160 | CLEAR_STR | |
7161 | IP_STR | |
7162 | BGP_STR | |
7163 | "Clear all members of peer-group\n" | |
7164 | "BGP peer-group name\n" | |
e0bce756 | 7165 | BGP_SOFT_IN_STR) |
718e3744 | 7166 | |
7167 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, | |
7168 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
7169 | "clear ip bgp peer-group WORD in prefix-filter", | |
7170 | CLEAR_STR | |
7171 | IP_STR | |
7172 | BGP_STR | |
7173 | "Clear all members of peer-group\n" | |
7174 | "BGP peer-group name\n" | |
e0bce756 | 7175 | BGP_SOFT_IN_STR |
718e3744 | 7176 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7177 | { | |
7178 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7179 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7180 | } | |
7181 | ||
7182 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
7183 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
7184 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
7185 | CLEAR_STR | |
7186 | IP_STR | |
7187 | BGP_STR | |
7188 | "Clear all members of peer-group\n" | |
7189 | "BGP peer-group name\n" | |
7190 | "Address family\n" | |
7191 | "Address Family modifier\n" | |
7192 | "Address Family modifier\n" | |
e0bce756 DS |
7193 | BGP_SOFT_STR |
7194 | BGP_SOFT_IN_STR) | |
718e3744 | 7195 | { |
7196 | if (strncmp (argv[1], "m", 1) == 0) | |
7197 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7198 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7199 | ||
7200 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7201 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7202 | } | |
7203 | ||
7204 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, | |
7205 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
7206 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
7207 | CLEAR_STR | |
7208 | IP_STR | |
7209 | BGP_STR | |
7210 | "Clear all members of peer-group\n" | |
7211 | "BGP peer-group name\n" | |
7212 | "Address family\n" | |
7213 | "Address Family modifier\n" | |
7214 | "Address Family modifier\n" | |
e0bce756 | 7215 | BGP_SOFT_IN_STR) |
718e3744 | 7216 | |
7217 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, | |
7218 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
7219 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
7220 | CLEAR_STR | |
7221 | IP_STR | |
7222 | BGP_STR | |
7223 | "Clear all members of peer-group\n" | |
7224 | "BGP peer-group name\n" | |
7225 | "Address family\n" | |
7226 | "Address Family modifier\n" | |
7227 | "Address Family modifier\n" | |
e0bce756 | 7228 | BGP_SOFT_IN_STR |
718e3744 | 7229 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7230 | { | |
7231 | if (strncmp (argv[1], "m", 1) == 0) | |
7232 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7233 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7234 | ||
7235 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7236 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7237 | } | |
7238 | ||
7239 | DEFUN (clear_bgp_peer_group_soft_in, | |
7240 | clear_bgp_peer_group_soft_in_cmd, | |
7241 | "clear bgp peer-group WORD soft in", | |
7242 | CLEAR_STR | |
7243 | BGP_STR | |
7244 | "Clear all members of peer-group\n" | |
7245 | "BGP peer-group name\n" | |
e0bce756 DS |
7246 | BGP_SOFT_STR |
7247 | BGP_SOFT_IN_STR) | |
718e3744 | 7248 | { |
7249 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7250 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7251 | } | |
7252 | ||
7253 | ALIAS (clear_bgp_peer_group_soft_in, | |
7254 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
7255 | "clear bgp ipv6 peer-group WORD soft in", | |
7256 | CLEAR_STR | |
7257 | BGP_STR | |
7258 | "Address family\n" | |
7259 | "Clear all members of peer-group\n" | |
7260 | "BGP peer-group name\n" | |
e0bce756 DS |
7261 | BGP_SOFT_STR |
7262 | BGP_SOFT_IN_STR) | |
718e3744 | 7263 | |
7264 | ALIAS (clear_bgp_peer_group_soft_in, | |
7265 | clear_bgp_peer_group_in_cmd, | |
7266 | "clear bgp peer-group WORD in", | |
7267 | CLEAR_STR | |
7268 | BGP_STR | |
7269 | "Clear all members of peer-group\n" | |
7270 | "BGP peer-group name\n" | |
e0bce756 | 7271 | BGP_SOFT_IN_STR) |
718e3744 | 7272 | |
7273 | ALIAS (clear_bgp_peer_group_soft_in, | |
7274 | clear_bgp_ipv6_peer_group_in_cmd, | |
7275 | "clear bgp ipv6 peer-group WORD in", | |
7276 | CLEAR_STR | |
7277 | BGP_STR | |
7278 | "Address family\n" | |
7279 | "Clear all members of peer-group\n" | |
7280 | "BGP peer-group name\n" | |
e0bce756 | 7281 | BGP_SOFT_IN_STR) |
718e3744 | 7282 | |
7283 | DEFUN (clear_bgp_peer_group_in_prefix_filter, | |
7284 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
7285 | "clear bgp peer-group WORD in prefix-filter", | |
7286 | CLEAR_STR | |
7287 | BGP_STR | |
7288 | "Clear all members of peer-group\n" | |
7289 | "BGP peer-group name\n" | |
e0bce756 | 7290 | BGP_SOFT_IN_STR |
718e3744 | 7291 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7292 | { | |
7293 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7294 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7295 | } | |
7296 | ||
7297 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
7298 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
7299 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
7300 | CLEAR_STR | |
7301 | BGP_STR | |
7302 | "Address family\n" | |
7303 | "Clear all members of peer-group\n" | |
7304 | "BGP peer-group name\n" | |
e0bce756 | 7305 | BGP_SOFT_IN_STR |
718e3744 | 7306 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7307 | ||
7308 | DEFUN (clear_ip_bgp_external_soft_in, | |
7309 | clear_ip_bgp_external_soft_in_cmd, | |
7310 | "clear ip bgp external soft in", | |
7311 | CLEAR_STR | |
7312 | IP_STR | |
7313 | BGP_STR | |
7314 | "Clear all external peers\n" | |
e0bce756 DS |
7315 | BGP_SOFT_STR |
7316 | BGP_SOFT_IN_STR) | |
718e3744 | 7317 | { |
7318 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7319 | BGP_CLEAR_SOFT_IN, NULL); | |
7320 | } | |
7321 | ||
7322 | ALIAS (clear_ip_bgp_external_soft_in, | |
7323 | clear_ip_bgp_external_in_cmd, | |
7324 | "clear ip bgp external in", | |
7325 | CLEAR_STR | |
7326 | IP_STR | |
7327 | BGP_STR | |
7328 | "Clear all external peers\n" | |
e0bce756 | 7329 | BGP_SOFT_IN_STR) |
718e3744 | 7330 | |
7331 | DEFUN (clear_ip_bgp_external_in_prefix_filter, | |
7332 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
7333 | "clear ip bgp external in prefix-filter", | |
7334 | CLEAR_STR | |
7335 | IP_STR | |
7336 | BGP_STR | |
7337 | "Clear all external peers\n" | |
e0bce756 | 7338 | BGP_SOFT_IN_STR |
718e3744 | 7339 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7340 | { | |
7341 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7342 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7343 | } | |
7344 | ||
7345 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
7346 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
7347 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
7348 | CLEAR_STR | |
7349 | IP_STR | |
7350 | BGP_STR | |
7351 | "Clear all external peers\n" | |
7352 | "Address family\n" | |
7353 | "Address Family modifier\n" | |
7354 | "Address Family modifier\n" | |
e0bce756 DS |
7355 | BGP_SOFT_STR |
7356 | BGP_SOFT_IN_STR) | |
718e3744 | 7357 | { |
7358 | if (strncmp (argv[0], "m", 1) == 0) | |
7359 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7360 | BGP_CLEAR_SOFT_IN, NULL); | |
7361 | ||
7362 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7363 | BGP_CLEAR_SOFT_IN, NULL); | |
7364 | } | |
7365 | ||
7366 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, | |
7367 | clear_ip_bgp_external_ipv4_in_cmd, | |
7368 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
7369 | CLEAR_STR | |
7370 | IP_STR | |
7371 | BGP_STR | |
7372 | "Clear all external peers\n" | |
7373 | "Address family\n" | |
7374 | "Address Family modifier\n" | |
7375 | "Address Family modifier\n" | |
e0bce756 | 7376 | BGP_SOFT_IN_STR) |
718e3744 | 7377 | |
7378 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, | |
7379 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
7380 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
7381 | CLEAR_STR | |
7382 | IP_STR | |
7383 | BGP_STR | |
7384 | "Clear all external peers\n" | |
7385 | "Address family\n" | |
7386 | "Address Family modifier\n" | |
7387 | "Address Family modifier\n" | |
e0bce756 | 7388 | BGP_SOFT_IN_STR |
718e3744 | 7389 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7390 | { | |
7391 | if (strncmp (argv[0], "m", 1) == 0) | |
7392 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7393 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7394 | ||
7395 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7396 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7397 | } | |
7398 | ||
7399 | DEFUN (clear_bgp_external_soft_in, | |
7400 | clear_bgp_external_soft_in_cmd, | |
7401 | "clear bgp external soft in", | |
7402 | CLEAR_STR | |
7403 | BGP_STR | |
7404 | "Clear all external peers\n" | |
e0bce756 DS |
7405 | BGP_SOFT_STR |
7406 | BGP_SOFT_IN_STR) | |
718e3744 | 7407 | { |
7408 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7409 | BGP_CLEAR_SOFT_IN, NULL); | |
7410 | } | |
7411 | ||
7412 | ALIAS (clear_bgp_external_soft_in, | |
7413 | clear_bgp_ipv6_external_soft_in_cmd, | |
7414 | "clear bgp ipv6 external soft in", | |
7415 | CLEAR_STR | |
7416 | BGP_STR | |
7417 | "Address family\n" | |
7418 | "Clear all external peers\n" | |
e0bce756 DS |
7419 | BGP_SOFT_STR |
7420 | BGP_SOFT_IN_STR) | |
718e3744 | 7421 | |
7422 | ALIAS (clear_bgp_external_soft_in, | |
7423 | clear_bgp_external_in_cmd, | |
7424 | "clear bgp external in", | |
7425 | CLEAR_STR | |
7426 | BGP_STR | |
7427 | "Clear all external peers\n" | |
e0bce756 | 7428 | BGP_SOFT_IN_STR) |
718e3744 | 7429 | |
7430 | ALIAS (clear_bgp_external_soft_in, | |
7431 | clear_bgp_ipv6_external_in_cmd, | |
7432 | "clear bgp ipv6 external WORD in", | |
7433 | CLEAR_STR | |
7434 | BGP_STR | |
7435 | "Address family\n" | |
7436 | "Clear all external peers\n" | |
e0bce756 | 7437 | BGP_SOFT_IN_STR) |
718e3744 | 7438 | |
7439 | DEFUN (clear_bgp_external_in_prefix_filter, | |
7440 | clear_bgp_external_in_prefix_filter_cmd, | |
7441 | "clear bgp external in prefix-filter", | |
7442 | CLEAR_STR | |
7443 | BGP_STR | |
7444 | "Clear all external peers\n" | |
e0bce756 | 7445 | BGP_SOFT_IN_STR |
718e3744 | 7446 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7447 | { | |
7448 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7449 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7450 | } | |
7451 | ||
7452 | ALIAS (clear_bgp_external_in_prefix_filter, | |
7453 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
7454 | "clear bgp ipv6 external in prefix-filter", | |
7455 | CLEAR_STR | |
7456 | BGP_STR | |
7457 | "Address family\n" | |
7458 | "Clear all external peers\n" | |
e0bce756 | 7459 | BGP_SOFT_IN_STR |
718e3744 | 7460 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7461 | ||
7462 | DEFUN (clear_ip_bgp_as_soft_in, | |
7463 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 7464 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 7465 | CLEAR_STR |
7466 | IP_STR | |
7467 | BGP_STR | |
7468 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7469 | BGP_SOFT_STR |
7470 | BGP_SOFT_IN_STR) | |
718e3744 | 7471 | { |
7472 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7473 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7474 | } | |
7475 | ||
7476 | ALIAS (clear_ip_bgp_as_soft_in, | |
7477 | clear_ip_bgp_as_in_cmd, | |
320da874 | 7478 | "clear ip bgp " CMD_AS_RANGE " in", |
718e3744 | 7479 | CLEAR_STR |
7480 | IP_STR | |
7481 | BGP_STR | |
7482 | "Clear peers with the AS number\n" | |
e0bce756 | 7483 | BGP_SOFT_IN_STR) |
718e3744 | 7484 | |
7485 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
7486 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 7487 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7488 | CLEAR_STR |
7489 | IP_STR | |
7490 | BGP_STR | |
7491 | "Clear peers with the AS number\n" | |
e0bce756 | 7492 | BGP_SOFT_IN_STR |
718e3744 | 7493 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7494 | { | |
7495 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7496 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7497 | } | |
7498 | ||
7499 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
7500 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 7501 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 7502 | CLEAR_STR |
7503 | IP_STR | |
7504 | BGP_STR | |
7505 | "Clear peers with the AS number\n" | |
7506 | "Address family\n" | |
7507 | "Address Family modifier\n" | |
7508 | "Address Family modifier\n" | |
e0bce756 DS |
7509 | BGP_SOFT_STR |
7510 | BGP_SOFT_IN_STR) | |
718e3744 | 7511 | { |
7512 | if (strncmp (argv[1], "m", 1) == 0) | |
7513 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7514 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7515 | ||
7516 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7517 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7518 | } | |
7519 | ||
7520 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, | |
7521 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 7522 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 7523 | CLEAR_STR |
7524 | IP_STR | |
7525 | BGP_STR | |
7526 | "Clear peers with the AS number\n" | |
7527 | "Address family\n" | |
7528 | "Address Family modifier\n" | |
7529 | "Address Family modifier\n" | |
e0bce756 | 7530 | BGP_SOFT_IN_STR) |
718e3744 | 7531 | |
7532 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, | |
7533 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 7534 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 7535 | CLEAR_STR |
7536 | IP_STR | |
7537 | BGP_STR | |
7538 | "Clear peers with the AS number\n" | |
7539 | "Address family\n" | |
7540 | "Address Family modifier\n" | |
7541 | "Address Family modifier\n" | |
e0bce756 | 7542 | BGP_SOFT_IN_STR |
718e3744 | 7543 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7544 | { | |
7545 | if (strncmp (argv[1], "m", 1) == 0) | |
7546 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7547 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7548 | ||
7549 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7550 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7551 | } | |
7552 | ||
7553 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
7554 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 7555 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 7556 | CLEAR_STR |
7557 | IP_STR | |
7558 | BGP_STR | |
7559 | "Clear peers with the AS number\n" | |
7560 | "Address family\n" | |
7561 | "Address Family modifier\n" | |
e0bce756 DS |
7562 | BGP_SOFT_STR |
7563 | BGP_SOFT_IN_STR) | |
718e3744 | 7564 | { |
7565 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7566 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7567 | } | |
7568 | ||
7569 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
7570 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 7571 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 7572 | CLEAR_STR |
7573 | IP_STR | |
7574 | BGP_STR | |
7575 | "Clear peers with the AS number\n" | |
7576 | "Address family\n" | |
7577 | "Address Family modifier\n" | |
e0bce756 | 7578 | BGP_SOFT_IN_STR) |
718e3744 | 7579 | |
7580 | DEFUN (clear_bgp_as_soft_in, | |
7581 | clear_bgp_as_soft_in_cmd, | |
320da874 | 7582 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 7583 | CLEAR_STR |
7584 | BGP_STR | |
7585 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7586 | BGP_SOFT_STR |
7587 | BGP_SOFT_IN_STR) | |
718e3744 | 7588 | { |
7589 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7590 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7591 | } | |
7592 | ||
7593 | ALIAS (clear_bgp_as_soft_in, | |
7594 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 7595 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 7596 | CLEAR_STR |
7597 | BGP_STR | |
7598 | "Address family\n" | |
7599 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7600 | BGP_SOFT_STR |
7601 | BGP_SOFT_IN_STR) | |
718e3744 | 7602 | |
7603 | ALIAS (clear_bgp_as_soft_in, | |
7604 | clear_bgp_as_in_cmd, | |
320da874 | 7605 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 7606 | CLEAR_STR |
7607 | BGP_STR | |
7608 | "Clear peers with the AS number\n" | |
e0bce756 | 7609 | BGP_SOFT_IN_STR) |
718e3744 | 7610 | |
7611 | ALIAS (clear_bgp_as_soft_in, | |
7612 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 7613 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 7614 | CLEAR_STR |
7615 | BGP_STR | |
7616 | "Address family\n" | |
7617 | "Clear peers with the AS number\n" | |
e0bce756 | 7618 | BGP_SOFT_IN_STR) |
718e3744 | 7619 | |
7620 | DEFUN (clear_bgp_as_in_prefix_filter, | |
7621 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 7622 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7623 | CLEAR_STR |
7624 | BGP_STR | |
7625 | "Clear peers with the AS number\n" | |
e0bce756 | 7626 | BGP_SOFT_IN_STR |
718e3744 | 7627 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7628 | { | |
7629 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7630 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7631 | } | |
7632 | ||
7633 | ALIAS (clear_bgp_as_in_prefix_filter, | |
7634 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 7635 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7636 | CLEAR_STR |
7637 | BGP_STR | |
7638 | "Address family\n" | |
7639 | "Clear peers with the AS number\n" | |
e0bce756 | 7640 | BGP_SOFT_IN_STR |
718e3744 | 7641 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6b0655a2 | 7642 | |
718e3744 | 7643 | /* Both soft-reconfiguration */ |
7644 | DEFUN (clear_ip_bgp_all_soft, | |
7645 | clear_ip_bgp_all_soft_cmd, | |
7646 | "clear ip bgp * soft", | |
7647 | CLEAR_STR | |
7648 | IP_STR | |
7649 | BGP_STR | |
7650 | "Clear all peers\n" | |
e0bce756 | 7651 | BGP_SOFT_STR) |
718e3744 | 7652 | { |
7653 | if (argc == 1) | |
7654 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
7655 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7656 | ||
7657 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7658 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7659 | } | |
7660 | ||
7661 | ALIAS (clear_ip_bgp_all_soft, | |
7662 | clear_ip_bgp_instance_all_soft_cmd, | |
7663 | "clear ip bgp view WORD * soft", | |
7664 | CLEAR_STR | |
7665 | IP_STR | |
7666 | BGP_STR | |
7667 | "BGP view\n" | |
7668 | "view name\n" | |
7669 | "Clear all peers\n" | |
e0bce756 | 7670 | BGP_SOFT_STR) |
718e3744 | 7671 | |
7672 | ||
7673 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
7674 | clear_ip_bgp_all_ipv4_soft_cmd, | |
7675 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
7676 | CLEAR_STR | |
7677 | IP_STR | |
7678 | BGP_STR | |
7679 | "Clear all peers\n" | |
7680 | "Address family\n" | |
7681 | "Address Family Modifier\n" | |
7682 | "Address Family Modifier\n" | |
e0bce756 | 7683 | BGP_SOFT_STR) |
718e3744 | 7684 | { |
7685 | if (strncmp (argv[0], "m", 1) == 0) | |
7686 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7687 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7688 | ||
7689 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7690 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7691 | } | |
7692 | ||
7693 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
7694 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
7695 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", | |
7696 | CLEAR_STR | |
7697 | IP_STR | |
7698 | BGP_STR | |
7699 | "BGP view\n" | |
7700 | "view name\n" | |
7701 | "Clear all peers\n" | |
7702 | "Address family\n" | |
7703 | "Address Family Modifier\n" | |
7704 | "Address Family Modifier\n" | |
e0bce756 | 7705 | BGP_SOFT_STR) |
718e3744 | 7706 | { |
7707 | if (strncmp (argv[1], "m", 1) == 0) | |
7708 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7709 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7710 | ||
7711 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7712 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7713 | } | |
7714 | ||
7715 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
7716 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
7717 | "clear ip bgp * vpnv4 unicast soft", | |
7718 | CLEAR_STR | |
7719 | IP_STR | |
7720 | BGP_STR | |
7721 | "Clear all peers\n" | |
7722 | "Address family\n" | |
7723 | "Address Family Modifier\n" | |
e0bce756 | 7724 | BGP_SOFT_STR) |
718e3744 | 7725 | { |
7726 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
7727 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7728 | } | |
7729 | ||
7730 | DEFUN (clear_bgp_all_soft, | |
7731 | clear_bgp_all_soft_cmd, | |
7732 | "clear bgp * soft", | |
7733 | CLEAR_STR | |
7734 | BGP_STR | |
7735 | "Clear all peers\n" | |
e0bce756 | 7736 | BGP_SOFT_STR) |
718e3744 | 7737 | { |
7738 | if (argc == 1) | |
7739 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
7740 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7741 | ||
7742 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7743 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7744 | } | |
7745 | ||
7746 | ALIAS (clear_bgp_all_soft, | |
7747 | clear_bgp_instance_all_soft_cmd, | |
7748 | "clear bgp view WORD * soft", | |
7749 | CLEAR_STR | |
7750 | BGP_STR | |
7751 | "BGP view\n" | |
7752 | "view name\n" | |
7753 | "Clear all peers\n" | |
e0bce756 | 7754 | BGP_SOFT_STR) |
718e3744 | 7755 | |
7756 | ALIAS (clear_bgp_all_soft, | |
7757 | clear_bgp_ipv6_all_soft_cmd, | |
7758 | "clear bgp ipv6 * soft", | |
7759 | CLEAR_STR | |
7760 | BGP_STR | |
7761 | "Address family\n" | |
7762 | "Clear all peers\n" | |
e0bce756 | 7763 | BGP_SOFT_STR) |
718e3744 | 7764 | |
7765 | DEFUN (clear_ip_bgp_peer_soft, | |
7766 | clear_ip_bgp_peer_soft_cmd, | |
db64ea86 | 7767 | "clear ip bgp (A.B.C.D|WORD) soft", |
718e3744 | 7768 | CLEAR_STR |
7769 | IP_STR | |
7770 | BGP_STR | |
7771 | "BGP neighbor address to clear\n" | |
db64ea86 | 7772 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7773 | BGP_SOFT_STR) |
718e3744 | 7774 | { |
7775 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7776 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7777 | } | |
7778 | ||
7779 | DEFUN (clear_ip_bgp_peer_ipv4_soft, | |
7780 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
db64ea86 | 7781 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", |
718e3744 | 7782 | CLEAR_STR |
7783 | IP_STR | |
7784 | BGP_STR | |
7785 | "BGP neighbor address to clear\n" | |
db64ea86 | 7786 | "BGP neighbor on interface to clear\n" |
718e3744 | 7787 | "Address family\n" |
7788 | "Address Family Modifier\n" | |
7789 | "Address Family Modifier\n" | |
e0bce756 | 7790 | BGP_SOFT_STR) |
718e3744 | 7791 | { |
7792 | if (strncmp (argv[1], "m", 1) == 0) | |
7793 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
7794 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7795 | ||
7796 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7797 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7798 | } | |
7799 | ||
7800 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, | |
7801 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
db64ea86 | 7802 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft", |
718e3744 | 7803 | CLEAR_STR |
7804 | IP_STR | |
7805 | BGP_STR | |
7806 | "BGP neighbor address to clear\n" | |
db64ea86 | 7807 | "BGP neighbor on interface to clear\n" |
718e3744 | 7808 | "Address family\n" |
7809 | "Address Family Modifier\n" | |
e0bce756 | 7810 | BGP_SOFT_STR) |
718e3744 | 7811 | { |
7812 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
7813 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7814 | } | |
7815 | ||
7816 | DEFUN (clear_bgp_peer_soft, | |
7817 | clear_bgp_peer_soft_cmd, | |
a80beece | 7818 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 7819 | CLEAR_STR |
7820 | BGP_STR | |
7821 | "BGP neighbor address to clear\n" | |
7822 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7823 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7824 | BGP_SOFT_STR) |
718e3744 | 7825 | { |
7826 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7827 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7828 | } | |
7829 | ||
7830 | ALIAS (clear_bgp_peer_soft, | |
7831 | clear_bgp_ipv6_peer_soft_cmd, | |
a80beece | 7832 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 7833 | CLEAR_STR |
7834 | BGP_STR | |
7835 | "Address family\n" | |
7836 | "BGP neighbor address to clear\n" | |
7837 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7838 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7839 | BGP_SOFT_STR) |
718e3744 | 7840 | |
7841 | DEFUN (clear_ip_bgp_peer_group_soft, | |
7842 | clear_ip_bgp_peer_group_soft_cmd, | |
7843 | "clear ip bgp peer-group WORD soft", | |
7844 | CLEAR_STR | |
7845 | IP_STR | |
7846 | BGP_STR | |
7847 | "Clear all members of peer-group\n" | |
7848 | "BGP peer-group name\n" | |
e0bce756 | 7849 | BGP_SOFT_STR) |
718e3744 | 7850 | { |
7851 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7852 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7853 | } | |
7854 | ||
7855 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, | |
7856 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
7857 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
7858 | CLEAR_STR | |
7859 | IP_STR | |
7860 | BGP_STR | |
7861 | "Clear all members of peer-group\n" | |
7862 | "BGP peer-group name\n" | |
7863 | "Address family\n" | |
7864 | "Address Family modifier\n" | |
7865 | "Address Family modifier\n" | |
e0bce756 | 7866 | BGP_SOFT_STR) |
718e3744 | 7867 | { |
7868 | if (strncmp (argv[1], "m", 1) == 0) | |
7869 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7870 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7871 | ||
7872 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7873 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7874 | } | |
7875 | ||
7876 | DEFUN (clear_bgp_peer_group_soft, | |
7877 | clear_bgp_peer_group_soft_cmd, | |
7878 | "clear bgp peer-group WORD soft", | |
7879 | CLEAR_STR | |
7880 | BGP_STR | |
7881 | "Clear all members of peer-group\n" | |
7882 | "BGP peer-group name\n" | |
e0bce756 | 7883 | BGP_SOFT_STR) |
718e3744 | 7884 | { |
7885 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7886 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7887 | } | |
7888 | ||
7889 | ALIAS (clear_bgp_peer_group_soft, | |
7890 | clear_bgp_ipv6_peer_group_soft_cmd, | |
7891 | "clear bgp ipv6 peer-group WORD soft", | |
7892 | CLEAR_STR | |
7893 | BGP_STR | |
7894 | "Address family\n" | |
7895 | "Clear all members of peer-group\n" | |
7896 | "BGP peer-group name\n" | |
e0bce756 | 7897 | BGP_SOFT_STR) |
718e3744 | 7898 | |
7899 | DEFUN (clear_ip_bgp_external_soft, | |
7900 | clear_ip_bgp_external_soft_cmd, | |
7901 | "clear ip bgp external soft", | |
7902 | CLEAR_STR | |
7903 | IP_STR | |
7904 | BGP_STR | |
7905 | "Clear all external peers\n" | |
e0bce756 | 7906 | BGP_SOFT_STR) |
718e3744 | 7907 | { |
7908 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7909 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7910 | } | |
7911 | ||
7912 | DEFUN (clear_ip_bgp_external_ipv4_soft, | |
7913 | clear_ip_bgp_external_ipv4_soft_cmd, | |
7914 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
7915 | CLEAR_STR | |
7916 | IP_STR | |
7917 | BGP_STR | |
7918 | "Clear all external peers\n" | |
7919 | "Address family\n" | |
7920 | "Address Family modifier\n" | |
7921 | "Address Family modifier\n" | |
e0bce756 | 7922 | BGP_SOFT_STR) |
718e3744 | 7923 | { |
7924 | if (strncmp (argv[0], "m", 1) == 0) | |
7925 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7926 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7927 | ||
7928 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7929 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7930 | } | |
7931 | ||
7932 | DEFUN (clear_bgp_external_soft, | |
7933 | clear_bgp_external_soft_cmd, | |
7934 | "clear bgp external soft", | |
7935 | CLEAR_STR | |
7936 | BGP_STR | |
7937 | "Clear all external peers\n" | |
e0bce756 | 7938 | BGP_SOFT_STR) |
718e3744 | 7939 | { |
7940 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7941 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7942 | } | |
7943 | ||
7944 | ALIAS (clear_bgp_external_soft, | |
7945 | clear_bgp_ipv6_external_soft_cmd, | |
7946 | "clear bgp ipv6 external soft", | |
7947 | CLEAR_STR | |
7948 | BGP_STR | |
7949 | "Address family\n" | |
7950 | "Clear all external peers\n" | |
e0bce756 | 7951 | BGP_SOFT_STR) |
718e3744 | 7952 | |
7953 | DEFUN (clear_ip_bgp_as_soft, | |
7954 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 7955 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 7956 | CLEAR_STR |
7957 | IP_STR | |
7958 | BGP_STR | |
7959 | "Clear peers with the AS number\n" | |
e0bce756 | 7960 | BGP_SOFT_STR) |
718e3744 | 7961 | { |
7962 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7963 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7964 | } | |
7965 | ||
7966 | DEFUN (clear_ip_bgp_as_ipv4_soft, | |
7967 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 7968 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 7969 | CLEAR_STR |
7970 | IP_STR | |
7971 | BGP_STR | |
7972 | "Clear peers with the AS number\n" | |
7973 | "Address family\n" | |
7974 | "Address Family Modifier\n" | |
7975 | "Address Family Modifier\n" | |
e0bce756 | 7976 | BGP_SOFT_STR) |
718e3744 | 7977 | { |
7978 | if (strncmp (argv[1], "m", 1) == 0) | |
7979 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7980 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7981 | ||
7982 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
7983 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7984 | } | |
7985 | ||
7986 | DEFUN (clear_ip_bgp_as_vpnv4_soft, | |
7987 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 7988 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 7989 | CLEAR_STR |
7990 | IP_STR | |
7991 | BGP_STR | |
7992 | "Clear peers with the AS number\n" | |
7993 | "Address family\n" | |
7994 | "Address Family Modifier\n" | |
e0bce756 | 7995 | BGP_SOFT_STR) |
718e3744 | 7996 | { |
7997 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7998 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7999 | } | |
8000 | ||
8001 | DEFUN (clear_bgp_as_soft, | |
8002 | clear_bgp_as_soft_cmd, | |
320da874 | 8003 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 8004 | CLEAR_STR |
8005 | BGP_STR | |
8006 | "Clear peers with the AS number\n" | |
e0bce756 | 8007 | BGP_SOFT_STR) |
718e3744 | 8008 | { |
8009 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
8010 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
8011 | } | |
8012 | ||
8013 | ALIAS (clear_bgp_as_soft, | |
8014 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 8015 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 8016 | CLEAR_STR |
8017 | BGP_STR | |
8018 | "Address family\n" | |
8019 | "Clear peers with the AS number\n" | |
e0bce756 | 8020 | BGP_SOFT_STR) |
6b0655a2 | 8021 | |
fee0f4c6 | 8022 | /* RS-client soft reconfiguration. */ |
8023 | #ifdef HAVE_IPV6 | |
8024 | DEFUN (clear_bgp_all_rsclient, | |
8025 | clear_bgp_all_rsclient_cmd, | |
8026 | "clear bgp * rsclient", | |
8027 | CLEAR_STR | |
8028 | BGP_STR | |
8029 | "Clear all peers\n" | |
e0bce756 | 8030 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8031 | { |
8032 | if (argc == 1) | |
8033 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
8034 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
8035 | ||
8036 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
8037 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
8038 | } | |
8039 | ||
8040 | ALIAS (clear_bgp_all_rsclient, | |
8041 | clear_bgp_ipv6_all_rsclient_cmd, | |
8042 | "clear bgp ipv6 * rsclient", | |
8043 | CLEAR_STR | |
8044 | BGP_STR | |
8045 | "Address family\n" | |
8046 | "Clear all peers\n" | |
e0bce756 | 8047 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8048 | |
8049 | ALIAS (clear_bgp_all_rsclient, | |
8050 | clear_bgp_instance_all_rsclient_cmd, | |
8051 | "clear bgp view WORD * rsclient", | |
8052 | CLEAR_STR | |
8053 | BGP_STR | |
8054 | "BGP view\n" | |
8055 | "view name\n" | |
8056 | "Clear all peers\n" | |
e0bce756 | 8057 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8058 | |
8059 | ALIAS (clear_bgp_all_rsclient, | |
8060 | clear_bgp_ipv6_instance_all_rsclient_cmd, | |
8061 | "clear bgp ipv6 view WORD * rsclient", | |
8062 | CLEAR_STR | |
8063 | BGP_STR | |
8064 | "Address family\n" | |
8065 | "BGP view\n" | |
8066 | "view name\n" | |
8067 | "Clear all peers\n" | |
e0bce756 | 8068 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8069 | #endif /* HAVE_IPV6 */ |
8070 | ||
8071 | DEFUN (clear_ip_bgp_all_rsclient, | |
8072 | clear_ip_bgp_all_rsclient_cmd, | |
8073 | "clear ip bgp * rsclient", | |
8074 | CLEAR_STR | |
8075 | IP_STR | |
8076 | BGP_STR | |
8077 | "Clear all peers\n" | |
e0bce756 | 8078 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8079 | { |
8080 | if (argc == 1) | |
8081 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
8082 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
8083 | ||
8084 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
8085 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
8086 | } | |
8087 | ||
8088 | ALIAS (clear_ip_bgp_all_rsclient, | |
8089 | clear_ip_bgp_instance_all_rsclient_cmd, | |
8090 | "clear ip bgp view WORD * rsclient", | |
8091 | CLEAR_STR | |
8092 | IP_STR | |
8093 | BGP_STR | |
8094 | "BGP view\n" | |
8095 | "view name\n" | |
8096 | "Clear all peers\n" | |
e0bce756 | 8097 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8098 | |
8099 | #ifdef HAVE_IPV6 | |
8100 | DEFUN (clear_bgp_peer_rsclient, | |
8101 | clear_bgp_peer_rsclient_cmd, | |
a80beece | 8102 | "clear bgp (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8103 | CLEAR_STR |
8104 | BGP_STR | |
8105 | "BGP neighbor IP address to clear\n" | |
8106 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8107 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8108 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8109 | { |
8110 | if (argc == 2) | |
8111 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, | |
8112 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
8113 | ||
8114 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
8115 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
8116 | } | |
8117 | ||
8118 | ALIAS (clear_bgp_peer_rsclient, | |
8119 | clear_bgp_ipv6_peer_rsclient_cmd, | |
a80beece | 8120 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8121 | CLEAR_STR |
8122 | BGP_STR | |
8123 | "Address family\n" | |
8124 | "BGP neighbor IP address to clear\n" | |
8125 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8126 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8127 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8128 | |
8129 | ALIAS (clear_bgp_peer_rsclient, | |
8130 | clear_bgp_instance_peer_rsclient_cmd, | |
a80beece | 8131 | "clear bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8132 | CLEAR_STR |
8133 | BGP_STR | |
8134 | "BGP view\n" | |
8135 | "view name\n" | |
8136 | "BGP neighbor IP address to clear\n" | |
8137 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8138 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8139 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8140 | |
8141 | ALIAS (clear_bgp_peer_rsclient, | |
8142 | clear_bgp_ipv6_instance_peer_rsclient_cmd, | |
a80beece | 8143 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8144 | CLEAR_STR |
8145 | BGP_STR | |
8146 | "Address family\n" | |
8147 | "BGP view\n" | |
8148 | "view name\n" | |
8149 | "BGP neighbor IP address to clear\n" | |
8150 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8151 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8152 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8153 | #endif /* HAVE_IPV6 */ |
8154 | ||
8155 | DEFUN (clear_ip_bgp_peer_rsclient, | |
8156 | clear_ip_bgp_peer_rsclient_cmd, | |
a80beece | 8157 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8158 | CLEAR_STR |
8159 | IP_STR | |
8160 | BGP_STR | |
8161 | "BGP neighbor IP address to clear\n" | |
8162 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8163 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8164 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8165 | { |
8166 | if (argc == 2) | |
8167 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, | |
8168 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
8169 | ||
8170 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8171 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
8172 | } | |
8173 | ||
8174 | ALIAS (clear_ip_bgp_peer_rsclient, | |
8175 | clear_ip_bgp_instance_peer_rsclient_cmd, | |
a80beece | 8176 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8177 | CLEAR_STR |
8178 | IP_STR | |
8179 | BGP_STR | |
8180 | "BGP view\n" | |
8181 | "view name\n" | |
8182 | "BGP neighbor IP address to clear\n" | |
8183 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8184 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8185 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8186 | |
e0081f70 ML |
8187 | DEFUN (show_bgp_views, |
8188 | show_bgp_views_cmd, | |
8189 | "show bgp views", | |
8190 | SHOW_STR | |
8191 | BGP_STR | |
8192 | "Show the defined BGP views\n") | |
8193 | { | |
8194 | struct list *inst = bm->bgp; | |
8195 | struct listnode *node; | |
8196 | struct bgp *bgp; | |
8197 | ||
8198 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
8199 | { | |
8200 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); | |
8201 | return CMD_WARNING; | |
8202 | } | |
8203 | ||
8204 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
8205 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
8206 | vty_out (vty, "\t%s (AS%u)%s", | |
8207 | bgp->name ? bgp->name : "(null)", | |
8208 | bgp->as, VTY_NEWLINE); | |
8209 | ||
8210 | return CMD_SUCCESS; | |
8211 | } | |
8212 | ||
4bf6a362 PJ |
8213 | DEFUN (show_bgp_memory, |
8214 | show_bgp_memory_cmd, | |
8215 | "show bgp memory", | |
8216 | SHOW_STR | |
8217 | BGP_STR | |
8218 | "Global BGP memory statistics\n") | |
8219 | { | |
8220 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
8221 | unsigned long count; | |
8222 | ||
8223 | /* RIB related usage stats */ | |
8224 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
8225 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
8226 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8227 | count * sizeof (struct bgp_node)), | |
8228 | VTY_NEWLINE); | |
8229 | ||
8230 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
8231 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
8232 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8233 | count * sizeof (struct bgp_info)), | |
8234 | VTY_NEWLINE); | |
fb982c25 PJ |
8235 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
8236 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
8237 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8238 | count * sizeof (struct bgp_info_extra)), | |
8239 | VTY_NEWLINE); | |
4bf6a362 PJ |
8240 | |
8241 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
8242 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
8243 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8244 | count * sizeof (struct bgp_static)), | |
8245 | VTY_NEWLINE); | |
3f9c7369 DS |
8246 | |
8247 | if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET))) | |
8248 | vty_out (vty, "%ld Packets, using %s of memory%s", count, | |
8249 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8250 | count * sizeof (struct bpacket)), | |
8251 | VTY_NEWLINE); | |
4bf6a362 PJ |
8252 | |
8253 | /* Adj-In/Out */ | |
8254 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
8255 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
8256 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8257 | count * sizeof (struct bgp_adj_in)), | |
8258 | VTY_NEWLINE); | |
8259 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
8260 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
8261 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8262 | count * sizeof (struct bgp_adj_out)), | |
8263 | VTY_NEWLINE); | |
8264 | ||
8265 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
8266 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
8267 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8268 | count * sizeof (struct bgp_nexthop_cache)), | |
8269 | VTY_NEWLINE); | |
8270 | ||
8271 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
8272 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
8273 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8274 | count * sizeof (struct bgp_damp_info)), | |
8275 | VTY_NEWLINE); | |
8276 | ||
8277 | /* Attributes */ | |
8278 | count = attr_count(); | |
8279 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
8280 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8281 | count * sizeof(struct attr)), | |
8282 | VTY_NEWLINE); | |
fb982c25 PJ |
8283 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
8284 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
8285 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8286 | count * sizeof(struct attr_extra)), | |
8287 | VTY_NEWLINE); | |
4bf6a362 PJ |
8288 | |
8289 | if ((count = attr_unknown_count())) | |
8290 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
8291 | ||
8292 | /* AS_PATH attributes */ | |
8293 | count = aspath_count (); | |
8294 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
8295 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8296 | count * sizeof (struct aspath)), | |
8297 | VTY_NEWLINE); | |
8298 | ||
8299 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
8300 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
8301 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8302 | count * sizeof (struct assegment)), | |
8303 | VTY_NEWLINE); | |
8304 | ||
8305 | /* Other attributes */ | |
8306 | if ((count = community_count ())) | |
8307 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
8308 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8309 | count * sizeof (struct community)), | |
8310 | VTY_NEWLINE); | |
8311 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
8312 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
8313 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8314 | count * sizeof (struct ecommunity)), | |
8315 | VTY_NEWLINE); | |
8316 | ||
8317 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
8318 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
8319 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8320 | count * sizeof (struct cluster_list)), | |
8321 | VTY_NEWLINE); | |
8322 | ||
8323 | /* Peer related usage */ | |
8324 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
8325 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
8326 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8327 | count * sizeof (struct peer)), | |
8328 | VTY_NEWLINE); | |
8329 | ||
6e919709 | 8330 | if ((count = mtype_stats_alloc (MTYPE_BGP_PEER_GROUP))) |
4bf6a362 PJ |
8331 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
8332 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8333 | count * sizeof (struct peer_group)), | |
8334 | VTY_NEWLINE); | |
8335 | ||
8336 | /* Other */ | |
8337 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
8338 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
8339 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8340 | count * sizeof (struct hash)), | |
8341 | VTY_NEWLINE); | |
8342 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
8343 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
8344 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8345 | count * sizeof (struct hash_backet)), | |
8346 | VTY_NEWLINE); | |
8347 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
8348 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
8349 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8350 | count * sizeof (regex_t)), | |
8351 | VTY_NEWLINE); | |
8352 | return CMD_SUCCESS; | |
8353 | } | |
fee0f4c6 | 8354 | |
47fc97cc DS |
8355 | static int |
8356 | bgp_adj_out_count (struct peer *peer, int afi, int safi) | |
8357 | { | |
8358 | struct bgp_table *table; | |
8359 | struct bgp_node *rn; | |
47fc97cc DS |
8360 | int count = 0; |
8361 | ||
8362 | if (!peer) return(0); | |
8363 | ||
8364 | table = peer->bgp->rib[afi][safi]; | |
8365 | if (!table) return(0); | |
8366 | for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) | |
8367 | if (bgp_adj_out_lookup(peer, NULL, afi, safi, rn)) | |
8368 | count++; | |
8369 | return (count); | |
8370 | } | |
8371 | ||
718e3744 | 8372 | /* Show BGP peer's summary information. */ |
94f2b392 | 8373 | static int |
b05a1c8b DS |
8374 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, |
8375 | u_char use_json) | |
718e3744 | 8376 | { |
8377 | struct peer *peer; | |
1eb8ef25 | 8378 | struct listnode *node, *nnode; |
f14e6fdb DS |
8379 | unsigned int count = 0, dn_count = 0; |
8380 | char timebuf[BGP_UPTIME_LEN], dn_flag[2]; | |
718e3744 | 8381 | int len; |
ffd0c037 | 8382 | json_object *json = NULL; |
ffd0c037 DS |
8383 | json_object *json_peer = NULL; |
8384 | json_object *json_peers = NULL; | |
718e3744 | 8385 | |
8386 | /* Header string for each address family. */ | |
8387 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; | |
47fc97cc | 8388 | |
b05a1c8b DS |
8389 | if (use_json) |
8390 | { | |
8391 | json = json_object_new_object(); | |
f1aa5d8a | 8392 | json_peers = json_object_new_object(); |
b05a1c8b DS |
8393 | } |
8394 | ||
1eb8ef25 | 8395 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 8396 | { |
1ff9a340 DS |
8397 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
8398 | continue; | |
8399 | ||
718e3744 | 8400 | if (peer->afc[afi][safi]) |
8401 | { | |
b05a1c8b | 8402 | if (!count) |
4bf6a362 PJ |
8403 | { |
8404 | unsigned long ents; | |
8405 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
b05a1c8b | 8406 | |
4bf6a362 | 8407 | /* Usage summary and header */ |
b05a1c8b DS |
8408 | if (use_json) |
8409 | { | |
62d6dca0 | 8410 | json_object_string_add(json, "routerId", inet_ntoa (bgp->router_id)); |
f1aa5d8a | 8411 | json_object_int_add(json, "as", bgp->as); |
b05a1c8b DS |
8412 | } |
8413 | else | |
8414 | { | |
8415 | vty_out (vty, | |
8416 | "BGP router identifier %s, local AS number %u%s", | |
8417 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); | |
8418 | } | |
8419 | ||
f188f2c4 DS |
8420 | if (bgp_update_delay_configured(bgp)) |
8421 | { | |
b05a1c8b | 8422 | if (use_json) |
f188f2c4 | 8423 | { |
62d6dca0 | 8424 | json_object_int_add(json, "updateDelayLimit", bgp->v_update_delay); |
b05a1c8b DS |
8425 | |
8426 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
62d6dca0 | 8427 | json_object_int_add(json, "updateDelayEstablishWait", bgp->v_establish_wait); |
b05a1c8b DS |
8428 | |
8429 | if (bgp_update_delay_active(bgp)) | |
8430 | { | |
62d6dca0 DS |
8431 | json_object_string_add(json, "updateDelayFirstNeighbor", bgp->update_delay_begin_time); |
8432 | json_object_boolean_true_add(json, "updateDelayInProgress"); | |
b05a1c8b DS |
8433 | } |
8434 | else | |
8435 | { | |
8436 | if (bgp->update_delay_over) | |
8437 | { | |
62d6dca0 | 8438 | json_object_string_add(json, "updateDelayFirstNeighbor", |
f1aa5d8a | 8439 | bgp->update_delay_begin_time); |
62d6dca0 | 8440 | json_object_string_add(json, "updateDelayBestpathResumed", |
f1aa5d8a | 8441 | bgp->update_delay_end_time); |
62d6dca0 | 8442 | json_object_string_add(json, "updateDelayZebraUpdateResume", |
f1aa5d8a | 8443 | bgp->update_delay_zebra_resume_time); |
62d6dca0 | 8444 | json_object_string_add(json, "updateDelayPeerUpdateResume", |
f1aa5d8a | 8445 | bgp->update_delay_peers_resume_time); |
b05a1c8b DS |
8446 | } |
8447 | } | |
f188f2c4 DS |
8448 | } |
8449 | else | |
8450 | { | |
b05a1c8b DS |
8451 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", |
8452 | bgp->v_update_delay, VTY_NEWLINE); | |
8453 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
8454 | vty_out (vty, " Establish wait: %d seconds%s", | |
8455 | bgp->v_establish_wait, VTY_NEWLINE); | |
8456 | ||
8457 | if (bgp_update_delay_active(bgp)) | |
f188f2c4 DS |
8458 | { |
8459 | vty_out (vty, " First neighbor established: %s%s", | |
8460 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
b05a1c8b DS |
8461 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); |
8462 | } | |
8463 | else | |
8464 | { | |
8465 | if (bgp->update_delay_over) | |
8466 | { | |
8467 | vty_out (vty, " First neighbor established: %s%s", | |
8468 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
8469 | vty_out (vty, " Best-paths resumed: %s%s", | |
8470 | bgp->update_delay_end_time, VTY_NEWLINE); | |
8471 | vty_out (vty, " zebra update resumed: %s%s", | |
8472 | bgp->update_delay_zebra_resume_time, VTY_NEWLINE); | |
8473 | vty_out (vty, " peers update resumed: %s%s", | |
8474 | bgp->update_delay_peers_resume_time, VTY_NEWLINE); | |
8475 | } | |
f188f2c4 DS |
8476 | } |
8477 | } | |
8478 | } | |
4bf6a362 | 8479 | |
b05a1c8b DS |
8480 | if (use_json) |
8481 | { | |
8482 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
62d6dca0 | 8483 | json_object_boolean_true_add(json, "maxMedOnStartup"); |
b05a1c8b | 8484 | if (bgp->v_maxmed_admin) |
62d6dca0 | 8485 | json_object_boolean_true_add(json, "maxMedAdministrative"); |
b05a1c8b | 8486 | |
62d6dca0 | 8487 | json_object_int_add(json, "tableVersion", bgp_table_version(bgp->rib[afi][safi])); |
b05a1c8b DS |
8488 | |
8489 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
62d6dca0 DS |
8490 | json_object_int_add(json, "ribCount", ents); |
8491 | json_object_int_add(json, "ribMemory", ents * sizeof (struct bgp_node)); | |
b05a1c8b DS |
8492 | |
8493 | ents = listcount (bgp->peer); | |
62d6dca0 DS |
8494 | json_object_int_add(json, "peerCount", ents); |
8495 | json_object_int_add(json, "peerMemory", ents * sizeof (struct peer)); | |
b05a1c8b DS |
8496 | |
8497 | if ((ents = listcount (bgp->rsclient))) | |
8498 | { | |
62d6dca0 DS |
8499 | json_object_int_add(json, "rsclientCount", ents); |
8500 | json_object_int_add(json, "rsclientMemory", ents * sizeof (struct peer)); | |
b05a1c8b | 8501 | } |
abc920f8 | 8502 | |
b05a1c8b DS |
8503 | if ((ents = listcount (bgp->group))) |
8504 | { | |
62d6dca0 DS |
8505 | json_object_int_add(json, "peerGroupCount", ents); |
8506 | json_object_int_add(json, "peerGroupMemory", ents * sizeof (struct peer_group)); | |
b05a1c8b | 8507 | } |
3f9c7369 | 8508 | |
b05a1c8b | 8509 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
62d6dca0 | 8510 | json_object_boolean_true_add(json, "dampeningEnabled"); |
b05a1c8b DS |
8511 | } |
8512 | else | |
8513 | { | |
8514 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
8515 | vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE); | |
8516 | if (bgp->v_maxmed_admin) | |
8517 | vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE); | |
8518 | ||
ffd0c037 | 8519 | vty_out(vty, "BGP table version %" PRIu64 "%s", |
b05a1c8b DS |
8520 | bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE); |
8521 | ||
8522 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
8523 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
8524 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8525 | ents * sizeof (struct bgp_node)), | |
8526 | VTY_NEWLINE); | |
8527 | ||
8528 | /* Peer related usage */ | |
8529 | ents = listcount (bgp->peer); | |
8530 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
8531 | ents, | |
8532 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8533 | ents * sizeof (struct peer)), | |
8534 | VTY_NEWLINE); | |
8535 | ||
8536 | if ((ents = listcount (bgp->rsclient))) | |
8537 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", | |
8538 | ents, | |
8539 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8540 | ents * sizeof (struct peer)), | |
8541 | VTY_NEWLINE); | |
8542 | ||
8543 | if ((ents = listcount (bgp->group))) | |
8544 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
8545 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8546 | ents * sizeof (struct peer_group)), | |
8547 | VTY_NEWLINE); | |
8548 | ||
8549 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
8550 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
8551 | vty_out (vty, "%s", VTY_NEWLINE); | |
8552 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
8553 | } | |
4bf6a362 PJ |
8554 | } |
8555 | ||
b05a1c8b | 8556 | count++; |
718e3744 | 8557 | |
b05a1c8b DS |
8558 | if (use_json) |
8559 | { | |
8560 | json_peer = json_object_new_object(); | |
f14e6fdb | 8561 | |
b05a1c8b | 8562 | if (peer_dynamic_neighbor(peer)) |
62d6dca0 | 8563 | json_object_boolean_true_add(json_peer, "dynamicPeer"); |
b05a1c8b | 8564 | |
62d6dca0 | 8565 | json_object_int_add(json_peer, "remoteAs", peer->as); |
f1aa5d8a | 8566 | json_object_int_add(json_peer, "version", 4); |
62d6dca0 | 8567 | json_object_int_add(json_peer, "msgRcvd", |
f1aa5d8a DS |
8568 | peer->open_in + peer->update_in + peer->keepalive_in |
8569 | + peer->notify_in + peer->refresh_in | |
8570 | + peer->dynamic_cap_in); | |
62d6dca0 | 8571 | json_object_int_add(json_peer, "msgSent", |
f1aa5d8a DS |
8572 | peer->open_out + peer->update_out + peer->keepalive_out |
8573 | + peer->notify_out + peer->refresh_out | |
8574 | + peer->dynamic_cap_out); | |
8575 | ||
62d6dca0 | 8576 | json_object_int_add(json_peer, "tableVersion", peer->version[afi][safi]); |
f1aa5d8a DS |
8577 | json_object_int_add(json_peer, "outq", peer->obuf->count); |
8578 | json_object_int_add(json_peer, "inq", 0); | |
856ca177 | 8579 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, use_json, json_peer); |
62d6dca0 DS |
8580 | json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][safi]); |
8581 | json_object_int_add(json_peer, "prefixAdvertisedCount", bgp_adj_out_count(peer, afi, safi)); | |
b05a1c8b DS |
8582 | |
8583 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
f1aa5d8a | 8584 | json_object_string_add(json_peer, "state", "Idle (Admin)"); |
b05a1c8b | 8585 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
f1aa5d8a | 8586 | json_object_string_add(json_peer, "state", "Idle (PfxCt)"); |
b05a1c8b | 8587 | else |
f1aa5d8a | 8588 | json_object_string_add(json_peer, "state", LOOKUP(bgp_status_msg, peer->status)); |
b05a1c8b | 8589 | |
f1aa5d8a | 8590 | if (peer->conf_if) |
62d6dca0 | 8591 | json_object_string_add(json_peer, "idType", "interface"); |
f1aa5d8a | 8592 | else if (peer->su.sa.sa_family == AF_INET) |
62d6dca0 | 8593 | json_object_string_add(json_peer, "idType", "ipv4"); |
f1aa5d8a | 8594 | else if (peer->su.sa.sa_family == AF_INET6) |
62d6dca0 | 8595 | json_object_string_add(json_peer, "idType", "ipv6"); |
b05a1c8b | 8596 | |
f1aa5d8a | 8597 | json_object_object_add(json_peers, peer->host, json_peer); |
b05a1c8b DS |
8598 | } |
8599 | else | |
8600 | { | |
8601 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
8602 | if (peer_dynamic_neighbor(peer)) | |
8603 | { | |
8604 | dn_count++; | |
8605 | dn_flag[0] = '*'; | |
8606 | } | |
8607 | ||
c744aa9f | 8608 | len = vty_out (vty, "%s%s", dn_flag, peer->host); |
b05a1c8b DS |
8609 | len = 16 - len; |
8610 | ||
8611 | if (len < 1) | |
8612 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
8613 | else | |
8614 | vty_out (vty, "%*s", len, " "); | |
8615 | ||
8616 | vty_out (vty, "4 "); | |
8617 | ||
ee046671 | 8618 | vty_out (vty, "%5u %7d %7d %8" PRIu64 " %4d %4zd ", |
b05a1c8b DS |
8619 | peer->as, |
8620 | peer->open_in + peer->update_in + peer->keepalive_in | |
8621 | + peer->notify_in + peer->refresh_in | |
8622 | + peer->dynamic_cap_in, | |
8623 | peer->open_out + peer->update_out + peer->keepalive_out | |
8624 | + peer->notify_out + peer->refresh_out | |
8625 | + peer->dynamic_cap_out, | |
8626 | peer->version[afi][safi], | |
8627 | 0, | |
ffd0c037 | 8628 | peer->obuf->count); |
b05a1c8b | 8629 | |
f1aa5d8a | 8630 | vty_out (vty, "%-8s", |
856ca177 | 8631 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); |
b05a1c8b DS |
8632 | |
8633 | if (peer->status == Established) | |
8634 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); | |
8635 | else | |
8636 | { | |
8637 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
8638 | vty_out (vty, " Idle (Admin)"); | |
8639 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
8640 | vty_out (vty, " Idle (PfxCt)"); | |
8641 | else | |
8642 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
8643 | } | |
8644 | vty_out (vty, "%s", VTY_NEWLINE); | |
8645 | } | |
718e3744 | 8646 | } |
8647 | } | |
8648 | ||
b05a1c8b DS |
8649 | if (use_json) |
8650 | { | |
8651 | json_object_object_add(json, "peers", json_peers); | |
14151a32 | 8652 | |
62d6dca0 DS |
8653 | json_object_int_add(json, "totalPeers", count); |
8654 | json_object_int_add(json, "dynamicPeers", dn_count); | |
14151a32 | 8655 | |
b05a1c8b | 8656 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); |
f1aa5d8a | 8657 | json_object_free(json); |
b05a1c8b DS |
8658 | } |
8659 | else | |
f14e6fdb | 8660 | { |
b05a1c8b DS |
8661 | if (count) |
8662 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
8663 | count, VTY_NEWLINE); | |
8664 | else | |
8665 | vty_out (vty, "No %s neighbor is configured%s", | |
8666 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
8667 | ||
8668 | if (dn_count) | |
8669 | { | |
8670 | vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE); | |
8671 | vty_out(vty, | |
8672 | "%d dynamic neighbor(s), limit %d%s", | |
8673 | dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
8674 | } | |
f14e6fdb DS |
8675 | } |
8676 | ||
718e3744 | 8677 | return CMD_SUCCESS; |
8678 | } | |
8679 | ||
47fc97cc DS |
8680 | static int |
8681 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
b05a1c8b | 8682 | afi_t afi, safi_t safi, u_char use_json) |
718e3744 | 8683 | { |
8684 | struct bgp *bgp; | |
8685 | ||
8686 | if (name) | |
8687 | { | |
8688 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 8689 | |
718e3744 | 8690 | if (! bgp) |
8691 | { | |
47fc97cc | 8692 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 8693 | return CMD_WARNING; |
8694 | } | |
8695 | ||
b05a1c8b | 8696 | bgp_show_summary (vty, bgp, afi, safi, use_json); |
718e3744 | 8697 | return CMD_SUCCESS; |
8698 | } | |
47fc97cc | 8699 | |
718e3744 | 8700 | bgp = bgp_get_default (); |
8701 | ||
8702 | if (bgp) | |
b05a1c8b | 8703 | bgp_show_summary (vty, bgp, afi, safi, use_json); |
47fc97cc | 8704 | |
718e3744 | 8705 | return CMD_SUCCESS; |
8706 | } | |
8707 | ||
8708 | /* `show ip bgp summary' commands. */ | |
47fc97cc | 8709 | DEFUN (show_ip_bgp_summary, |
718e3744 | 8710 | show_ip_bgp_summary_cmd, |
b05a1c8b | 8711 | "show ip bgp summary {json}", |
47fc97cc DS |
8712 | SHOW_STR |
8713 | IP_STR | |
8714 | BGP_STR | |
b05a1c8b DS |
8715 | "Summary of BGP neighbor status\n" |
8716 | "JavaScript Object Notation\n") | |
47fc97cc | 8717 | { |
b05a1c8b DS |
8718 | u_char use_json = (argv[0] != NULL); |
8719 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, use_json); | |
718e3744 | 8720 | } |
8721 | ||
8722 | DEFUN (show_ip_bgp_instance_summary, | |
8723 | show_ip_bgp_instance_summary_cmd, | |
b05a1c8b | 8724 | "show ip bgp view WORD summary {json}", |
718e3744 | 8725 | SHOW_STR |
8726 | IP_STR | |
8727 | BGP_STR | |
8728 | "BGP view\n" | |
8729 | "View name\n" | |
b05a1c8b DS |
8730 | "Summary of BGP neighbor status\n" |
8731 | "JavaScript Object Notation\n") | |
718e3744 | 8732 | { |
b05a1c8b DS |
8733 | u_char use_json = (argv[1] != NULL); |
8734 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, use_json); | |
718e3744 | 8735 | } |
8736 | ||
8737 | DEFUN (show_ip_bgp_ipv4_summary, | |
8738 | show_ip_bgp_ipv4_summary_cmd, | |
b05a1c8b | 8739 | "show ip bgp ipv4 (unicast|multicast) summary {json}", |
718e3744 | 8740 | SHOW_STR |
8741 | IP_STR | |
8742 | BGP_STR | |
8743 | "Address family\n" | |
8744 | "Address Family modifier\n" | |
8745 | "Address Family modifier\n" | |
b05a1c8b DS |
8746 | "Summary of BGP neighbor status\n" |
8747 | "JavaScript Object Notation\n") | |
718e3744 | 8748 | { |
b05a1c8b | 8749 | u_char use_json = (argv[1] != NULL); |
718e3744 | 8750 | if (strncmp (argv[0], "m", 1) == 0) |
b05a1c8b | 8751 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, use_json); |
718e3744 | 8752 | |
b05a1c8b | 8753 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, use_json); |
718e3744 | 8754 | } |
8755 | ||
95cbbd2a ML |
8756 | ALIAS (show_ip_bgp_ipv4_summary, |
8757 | show_bgp_ipv4_safi_summary_cmd, | |
b05a1c8b | 8758 | "show bgp ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8759 | SHOW_STR |
8760 | BGP_STR | |
8761 | "Address family\n" | |
8762 | "Address Family modifier\n" | |
8763 | "Address Family modifier\n" | |
8764 | "Summary of BGP neighbor status\n") | |
8765 | ||
718e3744 | 8766 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
8767 | show_ip_bgp_instance_ipv4_summary_cmd, | |
b05a1c8b | 8768 | "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}", |
718e3744 | 8769 | SHOW_STR |
8770 | IP_STR | |
8771 | BGP_STR | |
8772 | "BGP view\n" | |
8773 | "View name\n" | |
8774 | "Address family\n" | |
8775 | "Address Family modifier\n" | |
8776 | "Address Family modifier\n" | |
b05a1c8b DS |
8777 | "Summary of BGP neighbor status\n" |
8778 | "JavaScript Object Notation\n") | |
718e3744 | 8779 | { |
b05a1c8b | 8780 | u_char use_json = (argv[2] != NULL); |
718e3744 | 8781 | if (strncmp (argv[1], "m", 1) == 0) |
b05a1c8b | 8782 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, use_json); |
718e3744 | 8783 | else |
b05a1c8b | 8784 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, use_json); |
718e3744 | 8785 | } |
8786 | ||
95cbbd2a ML |
8787 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
8788 | show_bgp_instance_ipv4_safi_summary_cmd, | |
b05a1c8b | 8789 | "show bgp view WORD ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8790 | SHOW_STR |
8791 | BGP_STR | |
8792 | "BGP view\n" | |
8793 | "View name\n" | |
8794 | "Address family\n" | |
8795 | "Address Family modifier\n" | |
8796 | "Address Family modifier\n" | |
8797 | "Summary of BGP neighbor status\n") | |
8798 | ||
718e3744 | 8799 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
8800 | show_ip_bgp_vpnv4_all_summary_cmd, | |
b05a1c8b | 8801 | "show ip bgp vpnv4 all summary {json}", |
718e3744 | 8802 | SHOW_STR |
8803 | IP_STR | |
8804 | BGP_STR | |
8805 | "Display VPNv4 NLRI specific information\n" | |
8806 | "Display information about all VPNv4 NLRIs\n" | |
b05a1c8b DS |
8807 | "Summary of BGP neighbor status\n" |
8808 | "JavaScript Object Notation\n") | |
718e3744 | 8809 | { |
b05a1c8b DS |
8810 | u_char use_json = (argv[0] != NULL); |
8811 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json); | |
718e3744 | 8812 | } |
8813 | ||
8814 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
8815 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
b05a1c8b | 8816 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}", |
718e3744 | 8817 | SHOW_STR |
8818 | IP_STR | |
8819 | BGP_STR | |
8820 | "Display VPNv4 NLRI specific information\n" | |
8821 | "Display information for a route distinguisher\n" | |
8822 | "VPN Route Distinguisher\n" | |
b05a1c8b DS |
8823 | "Summary of BGP neighbor status\n" |
8824 | "JavaScript Object Notation\n") | |
718e3744 | 8825 | { |
8826 | int ret; | |
8827 | struct prefix_rd prd; | |
b05a1c8b | 8828 | u_char use_json = (argv[1] != NULL); |
718e3744 | 8829 | |
8830 | ret = str2prefix_rd (argv[0], &prd); | |
8831 | if (! ret) | |
8832 | { | |
8833 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
8834 | return CMD_WARNING; | |
8835 | } | |
8836 | ||
b05a1c8b | 8837 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json); |
718e3744 | 8838 | } |
8839 | ||
8840 | #ifdef HAVE_IPV6 | |
47fc97cc | 8841 | DEFUN (show_bgp_summary, |
718e3744 | 8842 | show_bgp_summary_cmd, |
b05a1c8b | 8843 | "show bgp summary {json}", |
718e3744 | 8844 | SHOW_STR |
8845 | BGP_STR | |
b05a1c8b DS |
8846 | "Summary of BGP neighbor status\n" |
8847 | "JavaScript Object Notation\n") | |
718e3744 | 8848 | { |
b05a1c8b DS |
8849 | u_char use_json = (argv[0] != NULL); |
8850 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json); | |
718e3744 | 8851 | } |
8852 | ||
8853 | DEFUN (show_bgp_instance_summary, | |
8854 | show_bgp_instance_summary_cmd, | |
b05a1c8b | 8855 | "show bgp view WORD summary {json}", |
718e3744 | 8856 | SHOW_STR |
8857 | BGP_STR | |
8858 | "BGP view\n" | |
8859 | "View name\n" | |
b05a1c8b DS |
8860 | "Summary of BGP neighbor status\n" |
8861 | "JavaScript Object Notation\n") | |
718e3744 | 8862 | { |
b05a1c8b DS |
8863 | u_char use_json = (argv[1] != NULL); |
8864 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, use_json); | |
718e3744 | 8865 | } |
8866 | ||
8867 | ALIAS (show_bgp_summary, | |
8868 | show_bgp_ipv6_summary_cmd, | |
b05a1c8b | 8869 | "show bgp ipv6 summary {json}", |
718e3744 | 8870 | SHOW_STR |
8871 | BGP_STR | |
8872 | "Address family\n" | |
8873 | "Summary of BGP neighbor status\n") | |
8874 | ||
8875 | ALIAS (show_bgp_instance_summary, | |
8876 | show_bgp_instance_ipv6_summary_cmd, | |
b05a1c8b | 8877 | "show bgp view WORD ipv6 summary {json}", |
718e3744 | 8878 | SHOW_STR |
8879 | BGP_STR | |
8880 | "BGP view\n" | |
8881 | "View name\n" | |
8882 | "Address family\n" | |
8883 | "Summary of BGP neighbor status\n") | |
8884 | ||
95cbbd2a ML |
8885 | DEFUN (show_bgp_ipv6_safi_summary, |
8886 | show_bgp_ipv6_safi_summary_cmd, | |
b05a1c8b | 8887 | "show bgp ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8888 | SHOW_STR |
8889 | BGP_STR | |
8890 | "Address family\n" | |
8891 | "Address Family modifier\n" | |
8892 | "Address Family modifier\n" | |
b05a1c8b DS |
8893 | "Summary of BGP neighbor status\n" |
8894 | "JavaScript Object Notation\n") | |
95cbbd2a | 8895 | { |
b05a1c8b | 8896 | u_char use_json = (argv[1] != NULL); |
95cbbd2a | 8897 | if (strncmp (argv[0], "m", 1) == 0) |
b05a1c8b | 8898 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, use_json); |
95cbbd2a | 8899 | |
b05a1c8b | 8900 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json); |
95cbbd2a ML |
8901 | } |
8902 | ||
8903 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
8904 | show_bgp_instance_ipv6_safi_summary_cmd, | |
b05a1c8b | 8905 | "show bgp view WORD ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8906 | SHOW_STR |
8907 | BGP_STR | |
8908 | "BGP view\n" | |
8909 | "View name\n" | |
8910 | "Address family\n" | |
8911 | "Address Family modifier\n" | |
8912 | "Address Family modifier\n" | |
b05a1c8b DS |
8913 | "Summary of BGP neighbor status\n" |
8914 | "JavaScript Object Notation\n") | |
95cbbd2a | 8915 | { |
b05a1c8b | 8916 | u_char use_json = (argv[2] != NULL); |
95cbbd2a | 8917 | if (strncmp (argv[1], "m", 1) == 0) |
b05a1c8b | 8918 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST, use_json); |
95cbbd2a | 8919 | |
b05a1c8b | 8920 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, use_json); |
95cbbd2a ML |
8921 | } |
8922 | ||
718e3744 | 8923 | /* old command */ |
8924 | DEFUN (show_ipv6_bgp_summary, | |
8925 | show_ipv6_bgp_summary_cmd, | |
b05a1c8b | 8926 | "show ipv6 bgp summary {json}", |
718e3744 | 8927 | SHOW_STR |
8928 | IPV6_STR | |
8929 | BGP_STR | |
b05a1c8b DS |
8930 | "Summary of BGP neighbor status\n" |
8931 | "JavaScript Object Notation\n") | |
718e3744 | 8932 | { |
b05a1c8b DS |
8933 | u_char use_json = (argv[0] != NULL); |
8934 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json); | |
718e3744 | 8935 | } |
8936 | ||
8937 | /* old command */ | |
8938 | DEFUN (show_ipv6_mbgp_summary, | |
8939 | show_ipv6_mbgp_summary_cmd, | |
b05a1c8b | 8940 | "show ipv6 mbgp summary {json}", |
718e3744 | 8941 | SHOW_STR |
8942 | IPV6_STR | |
8943 | MBGP_STR | |
b05a1c8b DS |
8944 | "Summary of BGP neighbor status\n" |
8945 | "JavaScript Object Notation\n") | |
718e3744 | 8946 | { |
b05a1c8b DS |
8947 | u_char use_json = (argv[0] != NULL); |
8948 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, use_json); | |
718e3744 | 8949 | } |
8950 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 8951 | |
fd79ac91 | 8952 | const char * |
538621f2 | 8953 | afi_safi_print (afi_t afi, safi_t safi) |
8954 | { | |
8955 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
8956 | return "IPv4 Unicast"; | |
8957 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
8958 | return "IPv4 Multicast"; | |
8959 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
8960 | return "VPNv4 Unicast"; | |
8961 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) | |
8962 | return "IPv6 Unicast"; | |
8963 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
8964 | return "IPv6 Multicast"; | |
8965 | else | |
8966 | return "Unknown"; | |
8967 | } | |
8968 | ||
718e3744 | 8969 | /* Show BGP peer's information. */ |
8970 | enum show_type | |
8971 | { | |
8972 | show_all, | |
8973 | show_peer | |
8974 | }; | |
8975 | ||
94f2b392 | 8976 | static void |
856ca177 MS |
8977 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
8978 | u_int16_t adv_smcap, u_int16_t adv_rmcap, u_int16_t rcv_smcap, | |
8979 | u_int16_t rcv_rmcap, u_char use_json, json_object *json_pref) | |
718e3744 | 8980 | { |
8981 | /* Send-Mode */ | |
8982 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
8983 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8984 | { | |
856ca177 MS |
8985 | if (use_json) |
8986 | { | |
8987 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8988 | json_object_string_add(json_pref, "sendMode", "advertisedAndReceived"); | |
8989 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
8990 | json_object_string_add(json_pref, "sendMode", "advertised"); | |
8991 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8992 | json_object_string_add(json_pref, "sendMode", "received"); | |
8993 | } | |
8994 | else | |
8995 | { | |
8996 | vty_out (vty, " Send-mode: "); | |
8997 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
8998 | vty_out (vty, "advertised"); | |
8999 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
9000 | vty_out (vty, "%sreceived", | |
9001 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
9002 | ", " : ""); | |
9003 | vty_out (vty, "%s", VTY_NEWLINE); | |
9004 | } | |
718e3744 | 9005 | } |
9006 | ||
9007 | /* Receive-Mode */ | |
9008 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
9009 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
9010 | { | |
856ca177 MS |
9011 | if (use_json) |
9012 | { | |
9013 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
9014 | json_object_string_add(json_pref, "recvMode", "advertisedAndReceived"); | |
9015 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
9016 | json_object_string_add(json_pref, "recvMode", "advertised"); | |
9017 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
9018 | json_object_string_add(json_pref, "recvMode", "received"); | |
9019 | } | |
9020 | else | |
9021 | { | |
9022 | vty_out (vty, " Receive-mode: "); | |
9023 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
9024 | vty_out (vty, "advertised"); | |
9025 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
9026 | vty_out (vty, "%sreceived", | |
9027 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
9028 | ", " : ""); | |
9029 | vty_out (vty, "%s", VTY_NEWLINE); | |
9030 | } | |
718e3744 | 9031 | } |
9032 | } | |
9033 | ||
94f2b392 | 9034 | static void |
856ca177 MS |
9035 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
9036 | u_char use_json, json_object *json_neigh) | |
718e3744 | 9037 | { |
9038 | struct bgp_filter *filter; | |
3f9c7369 | 9039 | struct peer_af *paf; |
718e3744 | 9040 | char orf_pfx_name[BUFSIZ]; |
9041 | int orf_pfx_count; | |
856ca177 MS |
9042 | json_object *json_af = NULL; |
9043 | json_object *json_prefA = NULL; | |
9044 | json_object *json_prefB = NULL; | |
9045 | json_object *json_addr = NULL; | |
718e3744 | 9046 | |
856ca177 MS |
9047 | if (use_json) |
9048 | { | |
9049 | json_addr = json_object_new_object(); | |
9050 | json_af = json_object_new_object(); | |
9051 | json_prefA = json_object_new_object(); | |
9052 | json_prefB = json_object_new_object(); | |
9053 | filter = &p->filter[afi][safi]; | |
718e3744 | 9054 | |
856ca177 MS |
9055 | if (p->af_group[afi][safi]) |
9056 | json_object_string_add(json_addr, "peerGroupMember", p->group->name); | |
538621f2 | 9057 | |
856ca177 MS |
9058 | paf = peer_af_find(p, afi, safi); |
9059 | if (paf && PAF_SUBGRP(paf)) | |
9060 | { | |
9061 | json_object_int_add(json_addr, "updateGroupId", PAF_UPDGRP(paf)->id); | |
9062 | json_object_int_add(json_addr, "subGroupId", PAF_SUBGRP(paf)->id); | |
9063 | json_object_int_add(json_addr, "packetQueueLength", bpacket_queue_virtual_length(paf)); | |
9064 | } | |
9065 | ||
9066 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9067 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
9068 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9069 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
9070 | { | |
9071 | json_object_int_add(json_af, "orfType", ORF_TYPE_PREFIX); | |
9072 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
9073 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
9074 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
9075 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
9076 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, json_prefA); | |
9077 | json_object_object_add(json_af, "orfPrefixList", json_prefA); | |
9078 | } | |
9079 | ||
9080 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9081 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
9082 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9083 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
9084 | { | |
9085 | json_object_int_add(json_af, "orfOldType", ORF_TYPE_PREFIX_OLD); | |
9086 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
9087 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
9088 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
9089 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
9090 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, json_prefB); | |
9091 | json_object_object_add(json_af, "orfOldPrefixList", json_prefB); | |
9092 | } | |
9093 | ||
9094 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9095 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
9096 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
9097 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9098 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
9099 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
9100 | json_object_object_add(json_addr, "afDependentCap", json_af); | |
9101 | ||
9102 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
9103 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
9104 | ||
9105 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
9106 | || orf_pfx_count) | |
9107 | { | |
9108 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
9109 | json_object_boolean_true_add(json_neigh, "orfSent"); | |
9110 | if (orf_pfx_count) | |
9111 | json_object_int_add(json_addr, "orfRecvCounter", orf_pfx_count); | |
9112 | } | |
9113 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
9114 | json_object_string_add(json_addr, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd"); | |
9115 | ||
9116 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
9117 | json_object_boolean_true_add(json_addr, "routeReflectorClient"); | |
9118 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
9119 | json_object_boolean_true_add(json_addr, "routeServerClient"); | |
9120 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
9121 | json_object_boolean_true_add(json_addr, "inboundSoftConfigPermit"); | |
9122 | ||
9123 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
9124 | json_object_boolean_true_add(json_addr, "privateAsNumsReplacedInUpdatesToNbr"); | |
9125 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) | |
9126 | json_object_boolean_true_add(json_addr, "privateAsNumsRemovedInUpdatesToNbr"); | |
9127 | ||
9128 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) | |
9129 | json_object_string_add(json_addr, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs"); | |
9130 | ||
9131 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
9132 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
9133 | json_object_boolean_true_add(json_addr, "routerAlwaysNextHop"); | |
9134 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
9135 | json_object_boolean_true_add(json_addr, "unchangedAsPathPropogatedToNbr"); | |
9136 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
9137 | json_object_boolean_true_add(json_addr, "unchangedNextHopPropogatedToNbr"); | |
9138 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
9139 | json_object_boolean_true_add(json_addr, "unchangedMedPropogatedToNbr"); | |
718e3744 | 9140 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
856ca177 MS |
9141 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
9142 | { | |
9143 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
9144 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9145 | json_object_string_add(json_addr, "commAttriSentToNbr", "extendedAndStandard"); | |
9146 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9147 | json_object_string_add(json_addr, "commAttriSentToNbr", "extended"); | |
9148 | else | |
9149 | json_object_string_add(json_addr, "commAttriSentToNbr", "standard"); | |
9150 | } | |
9151 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
9152 | { | |
9153 | if (p->default_rmap[afi][safi].name) | |
9154 | json_object_string_add(json_addr, "defaultRouteMap", p->default_rmap[afi][safi].name); | |
9155 | ||
9156 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
9157 | json_object_boolean_true_add(json_addr, "defaultSent"); | |
9158 | else | |
9159 | json_object_boolean_true_add(json_addr, "defaultNotSent"); | |
9160 | } | |
9161 | ||
9162 | if (filter->plist[FILTER_IN].name | |
9163 | || filter->dlist[FILTER_IN].name | |
9164 | || filter->aslist[FILTER_IN].name | |
9165 | || filter->map[RMAP_IN].name) | |
9166 | json_object_boolean_true_add(json_addr, "inboundPathPolicyConfig"); | |
9167 | if (filter->plist[FILTER_OUT].name | |
9168 | || filter->dlist[FILTER_OUT].name | |
9169 | || filter->aslist[FILTER_OUT].name | |
9170 | || filter->map[RMAP_OUT].name | |
9171 | || filter->usmap.name) | |
9172 | json_object_boolean_true_add(json_addr, "outboundPathPolicyConfig"); | |
9173 | if (filter->map[RMAP_IMPORT].name) | |
9174 | json_object_boolean_true_add(json_addr, "importPolicyRsClientConfig"); | |
9175 | if (filter->map[RMAP_EXPORT].name) | |
9176 | json_object_boolean_true_add(json_addr, "exportPolicyRsClientConfig"); | |
9177 | ||
9178 | /* prefix-list */ | |
9179 | if (filter->plist[FILTER_IN].name) | |
9180 | json_object_string_add(json_addr, "incomingUpdatePrefixFilterList", filter->plist[FILTER_IN].name); | |
9181 | if (filter->plist[FILTER_OUT].name) | |
9182 | json_object_string_add(json_addr, "outgoingUpdatePrefixFilterList", filter->plist[FILTER_OUT].name); | |
9183 | ||
9184 | /* distribute-list */ | |
9185 | if (filter->dlist[FILTER_IN].name) | |
9186 | json_object_string_add(json_addr, "incomingUpdateNetworkFilterList", filter->dlist[FILTER_IN].name); | |
9187 | if (filter->dlist[FILTER_OUT].name) | |
9188 | json_object_string_add(json_addr, "outgoingUpdateNetworkFilterList", filter->dlist[FILTER_OUT].name); | |
9189 | ||
9190 | /* filter-list. */ | |
9191 | if (filter->aslist[FILTER_IN].name) | |
9192 | json_object_string_add(json_addr, "incomingUpdateAsPathFilterList", filter->aslist[FILTER_IN].name); | |
9193 | if (filter->aslist[FILTER_OUT].name) | |
9194 | json_object_string_add(json_addr, "outgoingUpdateAsPathFilterList", filter->aslist[FILTER_OUT].name); | |
9195 | ||
9196 | /* route-map. */ | |
9197 | if (filter->map[RMAP_IN].name) | |
9198 | json_object_string_add(json_addr, "routeMapForIncomingAdvertisements", filter->map[RMAP_IN].name); | |
9199 | if (filter->map[RMAP_OUT].name) | |
9200 | json_object_string_add(json_addr, "routeMapForOutgoingAdvertisements", filter->map[RMAP_OUT].name); | |
9201 | if (filter->map[RMAP_IMPORT].name) | |
9202 | json_object_string_add(json_addr, "routeMapForAdvertisementsIntoRsClient", filter->map[RMAP_IMPORT].name); | |
9203 | if (filter->map[RMAP_EXPORT].name) | |
9204 | json_object_string_add(json_addr, "routeMapForAdvertisementsFromRsClient", filter->map[RMAP_EXPORT].name); | |
9205 | ||
9206 | /* unsuppress-map */ | |
9207 | if (filter->usmap.name) | |
9208 | json_object_string_add(json_addr, "selectiveUnsuppressRouteMap", filter->usmap.name); | |
9209 | ||
9210 | /* Receive prefix count */ | |
9211 | json_object_int_add(json_addr, "acceptedPrefixCounter", p->pcount[afi][safi]); | |
9212 | ||
9213 | /* Maximum prefix */ | |
9214 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
9215 | { | |
9216 | json_object_int_add(json_addr, "prefixAllowedMax", p->pmax[afi][safi]); | |
9217 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) | |
9218 | json_object_boolean_true_add(json_addr, "prefixAllowedMaxWarning"); | |
9219 | json_object_int_add(json_addr, "prefixAllowedWarningThresh", p->pmax_threshold[afi][safi]); | |
9220 | if (p->pmax_restart[afi][safi]) | |
9221 | json_object_int_add(json_addr, "prefixAllowedRestartIntervalMsecs", p->pmax_restart[afi][safi] * 60000); | |
9222 | } | |
9223 | json_object_object_add(json_neigh, afi_safi_print (afi, safi), json_addr); | |
9224 | ||
9225 | } | |
9226 | else | |
9227 | { | |
9228 | filter = &p->filter[afi][safi]; | |
9229 | ||
9230 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), | |
9231 | VTY_NEWLINE); | |
9232 | ||
9233 | if (p->af_group[afi][safi]) | |
9234 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); | |
9235 | ||
9236 | paf = peer_af_find(p, afi, safi); | |
9237 | if (paf && PAF_SUBGRP(paf)) | |
9238 | { | |
9239 | vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s", | |
9240 | PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE); | |
9241 | vty_out (vty, " Packet Queue length %d%s", | |
9242 | bpacket_queue_virtual_length(paf), VTY_NEWLINE); | |
9243 | } | |
718e3744 | 9244 | else |
856ca177 MS |
9245 | { |
9246 | vty_out(vty, " Not part of any update group%s", VTY_NEWLINE); | |
9247 | } | |
9248 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9249 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
9250 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
9251 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9252 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
9253 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
9254 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
9255 | ||
9256 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9257 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
9258 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9259 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
9260 | { | |
9261 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
9262 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
9263 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
9264 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
9265 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
9266 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
9267 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, NULL); | |
9268 | } | |
9269 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9270 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
9271 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9272 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
9273 | { | |
9274 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
9275 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
9276 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
9277 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
9278 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
9279 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
9280 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, NULL); | |
9281 | } | |
718e3744 | 9282 | |
856ca177 MS |
9283 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
9284 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
718e3744 | 9285 | |
856ca177 MS |
9286 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
9287 | || orf_pfx_count) | |
9288 | { | |
9289 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
9290 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
9291 | vty_out (vty, " sent;"); | |
9292 | if (orf_pfx_count) | |
9293 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
9294 | vty_out (vty, "%s", VTY_NEWLINE); | |
9295 | } | |
9296 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
9297 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
9298 | ||
9299 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
9300 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
9301 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
9302 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
9303 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
9304 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
9305 | ||
9306 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
9307 | vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE); | |
9308 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) | |
9309 | vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE); | |
9310 | ||
9311 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) | |
9312 | vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE); | |
9313 | ||
9314 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
9315 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
9316 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); | |
9317 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
9318 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
9319 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
9320 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
9321 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
9322 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
9323 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
9324 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9325 | { | |
9326 | vty_out (vty, " Community attribute sent to this neighbor"); | |
9327 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
9328 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9329 | vty_out (vty, "(both)%s", VTY_NEWLINE); | |
9330 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9331 | vty_out (vty, "(extended)%s", VTY_NEWLINE); | |
9332 | else | |
9333 | vty_out (vty, "(standard)%s", VTY_NEWLINE); | |
9334 | } | |
9335 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
9336 | { | |
9337 | vty_out (vty, " Default information originate,"); | |
9338 | ||
9339 | if (p->default_rmap[afi][safi].name) | |
9340 | vty_out (vty, " default route-map %s%s,", | |
9341 | p->default_rmap[afi][safi].map ? "*" : "", | |
9342 | p->default_rmap[afi][safi].name); | |
9343 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
9344 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
9345 | else | |
9346 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
9347 | } | |
718e3744 | 9348 | |
856ca177 MS |
9349 | if (filter->plist[FILTER_IN].name |
9350 | || filter->dlist[FILTER_IN].name | |
9351 | || filter->aslist[FILTER_IN].name | |
9352 | || filter->map[RMAP_IN].name) | |
9353 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); | |
9354 | if (filter->plist[FILTER_OUT].name | |
9355 | || filter->dlist[FILTER_OUT].name | |
9356 | || filter->aslist[FILTER_OUT].name | |
9357 | || filter->map[RMAP_OUT].name | |
9358 | || filter->usmap.name) | |
9359 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
9360 | if (filter->map[RMAP_IMPORT].name) | |
9361 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); | |
9362 | if (filter->map[RMAP_EXPORT].name) | |
9363 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); | |
9364 | ||
9365 | /* prefix-list */ | |
9366 | if (filter->plist[FILTER_IN].name) | |
9367 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
9368 | filter->plist[FILTER_IN].plist ? "*" : "", | |
9369 | filter->plist[FILTER_IN].name, | |
9370 | VTY_NEWLINE); | |
9371 | if (filter->plist[FILTER_OUT].name) | |
9372 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
9373 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
9374 | filter->plist[FILTER_OUT].name, | |
9375 | VTY_NEWLINE); | |
9376 | ||
9377 | /* distribute-list */ | |
9378 | if (filter->dlist[FILTER_IN].name) | |
9379 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
9380 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
9381 | filter->dlist[FILTER_IN].name, | |
9382 | VTY_NEWLINE); | |
9383 | if (filter->dlist[FILTER_OUT].name) | |
9384 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
9385 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
9386 | filter->dlist[FILTER_OUT].name, | |
9387 | VTY_NEWLINE); | |
9388 | ||
9389 | /* filter-list. */ | |
9390 | if (filter->aslist[FILTER_IN].name) | |
9391 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
9392 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
9393 | filter->aslist[FILTER_IN].name, | |
9394 | VTY_NEWLINE); | |
9395 | if (filter->aslist[FILTER_OUT].name) | |
9396 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
9397 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
9398 | filter->aslist[FILTER_OUT].name, | |
9399 | VTY_NEWLINE); | |
9400 | ||
9401 | /* route-map. */ | |
9402 | if (filter->map[RMAP_IN].name) | |
9403 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", | |
9404 | filter->map[RMAP_IN].map ? "*" : "", | |
9405 | filter->map[RMAP_IN].name, | |
9406 | VTY_NEWLINE); | |
9407 | if (filter->map[RMAP_OUT].name) | |
9408 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", | |
9409 | filter->map[RMAP_OUT].map ? "*" : "", | |
9410 | filter->map[RMAP_OUT].name, | |
9411 | VTY_NEWLINE); | |
9412 | if (filter->map[RMAP_IMPORT].name) | |
9413 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", | |
9414 | filter->map[RMAP_IMPORT].map ? "*" : "", | |
9415 | filter->map[RMAP_IMPORT].name, | |
9416 | VTY_NEWLINE); | |
9417 | if (filter->map[RMAP_EXPORT].name) | |
9418 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", | |
9419 | filter->map[RMAP_EXPORT].map ? "*" : "", | |
9420 | filter->map[RMAP_EXPORT].name, | |
9421 | VTY_NEWLINE); | |
9422 | ||
9423 | /* unsuppress-map */ | |
9424 | if (filter->usmap.name) | |
9425 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
9426 | filter->usmap.map ? "*" : "", | |
9427 | filter->usmap.name, VTY_NEWLINE); | |
9428 | ||
9429 | /* Receive prefix count */ | |
9430 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); | |
9431 | ||
9432 | /* Maximum prefix */ | |
9433 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
9434 | { | |
9435 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], | |
9436 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) | |
9437 | ? " (warning-only)" : "", VTY_NEWLINE); | |
9438 | vty_out (vty, " Threshold for warning message %d%%", | |
9439 | p->pmax_threshold[afi][safi]); | |
9440 | if (p->pmax_restart[afi][safi]) | |
9441 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
9442 | vty_out (vty, "%s", VTY_NEWLINE); | |
9443 | } | |
718e3744 | 9444 | |
0a486e5f | 9445 | vty_out (vty, "%s", VTY_NEWLINE); |
718e3744 | 9446 | } |
718e3744 | 9447 | } |
9448 | ||
94f2b392 | 9449 | static void |
856ca177 | 9450 | bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *json, json_object *json_neigh) |
718e3744 | 9451 | { |
9452 | struct bgp *bgp; | |
a80beece | 9453 | char buf1[BUFSIZ], buf[SU_ADDRSTRLEN]; |
718e3744 | 9454 | char timebuf[BGP_UPTIME_LEN]; |
f14e6fdb | 9455 | char dn_flag[2]; |
538621f2 | 9456 | afi_t afi; |
9457 | safi_t safi; | |
d6661008 DS |
9458 | u_int16_t i; |
9459 | u_char *msg; | |
718e3744 | 9460 | |
9461 | bgp = p->bgp; | |
9462 | ||
856ca177 | 9463 | if (!use_json) |
f14e6fdb | 9464 | { |
856ca177 MS |
9465 | if (p->conf_if) /* Configured interface name. */ |
9466 | vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if, | |
9467 | BGP_PEER_SU_UNSPEC(p) ? "None" : | |
9468 | sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
9469 | else /* Configured IP address. */ | |
9470 | { | |
9471 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
9472 | if (peer_dynamic_neighbor(p)) | |
9473 | dn_flag[0] = '*'; | |
f14e6fdb | 9474 | |
856ca177 MS |
9475 | vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host); |
9476 | } | |
f14e6fdb DS |
9477 | } |
9478 | ||
856ca177 MS |
9479 | if (use_json) |
9480 | { | |
9481 | if (p->conf_if && BGP_PEER_SU_UNSPEC(p)) | |
9482 | json_object_string_add(json_neigh, "bgpNeighborAddr", "none"); | |
9483 | else if (p->conf_if && !BGP_PEER_SU_UNSPEC(p)) | |
9484 | json_object_string_add(json_neigh, "bgpNeighborAddr", sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
9485 | ||
9486 | json_object_int_add(json_neigh, "remoteAs", p->as); | |
9487 | ||
9488 | if (p->change_local_as) | |
9489 | json_object_int_add(json_neigh, "localAs", p->change_local_as); | |
9490 | else | |
9491 | json_object_int_add(json_neigh, "localAs", p->local_as); | |
9492 | ||
9493 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND)) | |
9494 | json_object_boolean_true_add(json_neigh, "localAsNoPrepend"); | |
66b199b2 | 9495 | |
856ca177 MS |
9496 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS)) |
9497 | json_object_boolean_true_add(json_neigh, "localAsReplaceAs"); | |
9498 | } | |
9499 | else | |
9500 | { | |
9501 | vty_out (vty, "remote AS %u, ", p->as); | |
9502 | vty_out (vty, "local AS %u%s%s, ", | |
9503 | p->change_local_as ? p->change_local_as : p->local_as, | |
9504 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
9505 | " no-prepend" : "", | |
9506 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
9507 | " replace-as" : ""); | |
9508 | } | |
66b199b2 DS |
9509 | /* peer type internal, external, confed-internal or confed-external */ |
9510 | if (p->as == p->local_as) | |
9511 | { | |
856ca177 MS |
9512 | if (use_json) |
9513 | { | |
9514 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
9515 | json_object_boolean_true_add(json_neigh, "nbrConfedInternalLink"); | |
9516 | else | |
9517 | json_object_boolean_true_add(json_neigh, "nbrInternalLink"); | |
9518 | } | |
66b199b2 | 9519 | else |
856ca177 MS |
9520 | { |
9521 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
9522 | vty_out (vty, "confed-internal link%s", VTY_NEWLINE); | |
9523 | else | |
9524 | vty_out (vty, "internal link%s", VTY_NEWLINE); | |
9525 | } | |
66b199b2 DS |
9526 | } |
9527 | else | |
9528 | { | |
856ca177 MS |
9529 | if (use_json) |
9530 | { | |
9531 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
9532 | json_object_boolean_true_add(json_neigh, "nbrConfedExternalLink"); | |
9533 | else | |
9534 | json_object_boolean_true_add(json_neigh, "nbrExternalLink"); | |
9535 | } | |
66b199b2 | 9536 | else |
856ca177 MS |
9537 | { |
9538 | if (bgp_confederation_peers_check(bgp, p->as)) | |
9539 | vty_out (vty, "confed-external link%s", VTY_NEWLINE); | |
9540 | else | |
9541 | vty_out (vty, "external link%s", VTY_NEWLINE); | |
9542 | } | |
66b199b2 | 9543 | } |
718e3744 | 9544 | |
9545 | /* Description. */ | |
9546 | if (p->desc) | |
856ca177 MS |
9547 | { |
9548 | if (use_json) | |
9549 | json_object_string_add(json_neigh, "nbrDesc", p->desc); | |
9550 | else | |
9551 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
9552 | } | |
6410e93a | 9553 | |
c744aa9f | 9554 | /* Peer-group */ |
718e3744 | 9555 | if (p->group) |
f14e6fdb | 9556 | { |
856ca177 MS |
9557 | if (use_json) |
9558 | { | |
9559 | json_object_string_add(json_neigh, "peerGroup", p->group->name); | |
9560 | ||
9561 | if (dn_flag[0]) | |
9562 | { | |
9563 | struct prefix *prefix = NULL, *range = NULL; | |
f14e6fdb | 9564 | |
856ca177 MS |
9565 | prefix = sockunion2hostprefix(&(p->su)); |
9566 | if (prefix) | |
9567 | range = peer_group_lookup_dynamic_neighbor_range (p->group, prefix); | |
9568 | ||
9569 | if (range) | |
9570 | { | |
9571 | prefix2str(range, buf1, sizeof(buf1)); | |
9572 | json_object_string_add(json_neigh, "peerSubnetRangeGroup", buf1); | |
9573 | } | |
9574 | } | |
9575 | } | |
9576 | else | |
f14e6fdb | 9577 | { |
856ca177 MS |
9578 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
9579 | p->group->name, VTY_NEWLINE); | |
f14e6fdb | 9580 | |
856ca177 | 9581 | if (dn_flag[0]) |
f14e6fdb | 9582 | { |
856ca177 MS |
9583 | struct prefix *prefix = NULL, *range = NULL; |
9584 | ||
9585 | prefix = sockunion2hostprefix(&(p->su)); | |
9586 | if (prefix) | |
9587 | range = peer_group_lookup_dynamic_neighbor_range (p->group, prefix); | |
9588 | ||
9589 | if (range) | |
9590 | { | |
9591 | prefix2str(range, buf1, sizeof(buf1)); | |
9592 | vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTY_NEWLINE); | |
9593 | } | |
f14e6fdb DS |
9594 | } |
9595 | } | |
9596 | } | |
718e3744 | 9597 | |
856ca177 MS |
9598 | if (use_json) |
9599 | { | |
9600 | /* Administrative shutdown. */ | |
9601 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
9602 | json_object_boolean_true_add(json_neigh, "adminShutDown"); | |
718e3744 | 9603 | |
856ca177 MS |
9604 | /* BGP Version. */ |
9605 | json_object_int_add(json_neigh, "bgpVersion", 4); | |
9606 | json_object_string_add(json_neigh, "remoteRouterId", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ)); | |
718e3744 | 9607 | |
856ca177 MS |
9608 | /* Confederation */ |
9609 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) && bgp_confederation_peers_check (bgp, p->as)) | |
9610 | json_object_boolean_true_add(json_neigh, "nbrCommonAdmin"); | |
9611 | ||
9612 | /* Status. */ | |
9613 | json_object_string_add(json_neigh, "bgpState", LOOKUP (bgp_status_msg, p->status)); | |
9614 | ||
9615 | if (p->status == Established) | |
9616 | { | |
9617 | time_t uptime; | |
9618 | struct tm *tm; | |
9619 | ||
9620 | uptime = bgp_clock(); | |
9621 | uptime -= p->uptime; | |
9622 | tm = gmtime(&uptime); | |
9623 | ||
9624 | json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
9625 | } | |
9626 | ||
9627 | else if (p->status == Active) | |
9628 | { | |
9629 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
9630 | json_object_string_add(json_neigh, "bgpStateIs", "passive"); | |
9631 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
9632 | json_object_string_add(json_neigh, "bgpStateIs", "passiveNSF"); | |
9633 | } | |
9634 | ||
9635 | /* read timer */ | |
9636 | time_t uptime; | |
9637 | struct tm *tm; | |
9638 | ||
9639 | uptime = bgp_clock(); | |
9640 | uptime -= p->readtime; | |
9641 | tm = gmtime(&uptime); | |
9642 | json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
9643 | ||
9644 | uptime = bgp_clock(); | |
9645 | uptime -= p->last_write; | |
9646 | tm = gmtime(&uptime); | |
9647 | json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
9648 | ||
9649 | /* Configured timer values. */ | |
9650 | json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs", p->v_holdtime * 1000); | |
9651 | json_object_int_add(json_neigh, "bgpTimerKeepAliveIntervalMsecs", p->v_keepalive * 1000); | |
9652 | ||
9653 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
9654 | { | |
9655 | json_object_int_add(json_neigh, "bgpTimerConfiguredHoldTimeMsecs", p->holdtime * 1000); | |
9656 | json_object_int_add(json_neigh, "bgpTimerConfiguredKeepAliveIntervalMsecs", p->keepalive * 1000); | |
9657 | } | |
93406d87 | 9658 | } |
856ca177 MS |
9659 | else |
9660 | { | |
9661 | /* Administrative shutdown. */ | |
9662 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
9663 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
9664 | ||
9665 | /* BGP Version. */ | |
9666 | vty_out (vty, " BGP version 4"); | |
9667 | vty_out (vty, ", remote router ID %s%s", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
9668 | VTY_NEWLINE); | |
9669 | ||
9670 | /* Confederation */ | |
9671 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) | |
9672 | && bgp_confederation_peers_check (bgp, p->as)) | |
9673 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); | |
718e3744 | 9674 | |
856ca177 MS |
9675 | /* Status. */ |
9676 | vty_out (vty, " BGP state = %s", LOOKUP (bgp_status_msg, p->status)); | |
718e3744 | 9677 | |
856ca177 MS |
9678 | if (p->status == Established) |
9679 | vty_out (vty, ", up for %8s", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
9680 | ||
9681 | else if (p->status == Active) | |
9682 | { | |
9683 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
9684 | vty_out (vty, " (passive)"); | |
9685 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
9686 | vty_out (vty, " (NSF passive)"); | |
9687 | } | |
9688 | vty_out (vty, "%s", VTY_NEWLINE); | |
93406d87 | 9689 | |
856ca177 MS |
9690 | /* read timer */ |
9691 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
9692 | vty_out (vty, ", Last write %s%s", | |
9693 | peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTY_NEWLINE); | |
9694 | ||
9695 | /* Configured timer values. */ | |
9696 | vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s", | |
9697 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); | |
9698 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
9699 | { | |
9700 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
9701 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
9702 | p->keepalive, VTY_NEWLINE); | |
9703 | } | |
9704 | } | |
718e3744 | 9705 | /* Capability. */ |
9706 | if (p->status == Established) | |
9707 | { | |
538621f2 | 9708 | if (p->cap |
718e3744 | 9709 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
9710 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
9711 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
9712 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
9713 | #ifdef HAVE_IPV6 | |
9714 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
9715 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
9716 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
9717 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
9718 | #endif /* HAVE_IPV6 */ | |
9719 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] | |
9720 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
9721 | { | |
856ca177 MS |
9722 | if (use_json) |
9723 | { | |
9724 | json_object *json_cap = NULL; | |
9725 | ||
9726 | json_cap = json_object_new_object(); | |
9727 | ||
9728 | /* AS4 */ | |
9729 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
9730 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9731 | { | |
9732 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) && CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
9733 | json_object_string_add(json_cap, "4byteAs", "advertisedAndReceived"); | |
9734 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9735 | json_object_string_add(json_cap, "4byteAs", "advertised"); | |
9736 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
9737 | json_object_string_add(json_cap, "4byteAs", "received"); | |
9738 | } | |
9739 | ||
9740 | /* AddPath */ | |
9741 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
9742 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
9743 | { | |
9744 | json_object *json_add = NULL; | |
9745 | const char *print_store; | |
718e3744 | 9746 | |
856ca177 | 9747 | json_add = json_object_new_object(); |
a82478b9 | 9748 | |
856ca177 MS |
9749 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
9750 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9751 | { | |
9752 | json_object *json_sub = NULL; | |
9753 | json_sub = json_object_new_object(); | |
9754 | print_store = afi_safi_print (afi, safi); | |
9755 | ||
9756 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
9757 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
9758 | { | |
9759 | 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)) | |
9760 | json_object_boolean_true_add(json_sub, "txAdvertisedAndReceived"); | |
9761 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) | |
9762 | json_object_boolean_true_add(json_sub, "txAdvertised"); | |
9763 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
9764 | json_object_boolean_true_add(json_sub, "txReceived"); | |
9765 | } | |
9766 | ||
9767 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
9768 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9769 | { | |
9770 | 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)) | |
9771 | json_object_boolean_true_add(json_sub, "rxAdvertisedAndReceived"); | |
9772 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) | |
9773 | json_object_boolean_true_add(json_sub, "rxAdvertised"); | |
9774 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9775 | json_object_boolean_true_add(json_sub, "rxReceived"); | |
9776 | } | |
9777 | ||
9778 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
9779 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV) || | |
9780 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
9781 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9782 | json_object_object_add(json_add, print_store, json_sub); | |
9783 | } | |
a82478b9 | 9784 | |
856ca177 MS |
9785 | json_object_object_add(json_cap, "addPath", json_add); |
9786 | } | |
9787 | ||
9788 | /* Dynamic */ | |
9789 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
9790 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9791 | { | |
9792 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) && CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
9793 | json_object_string_add(json_cap, "dynamic", "advertisedAndReceived"); | |
9794 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9795 | json_object_string_add(json_cap, "dynamic", "advertised"); | |
9796 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
9797 | json_object_string_add(json_cap, "dynamic", "received"); | |
9798 | } | |
9799 | ||
9800 | /* Extended nexthop */ | |
9801 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
9802 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
9803 | { | |
9804 | json_object *json_nxt = NULL; | |
9805 | const char *print_store; | |
9806 | ||
9807 | json_nxt = json_object_new_object(); | |
9808 | ||
9809 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) && CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
9810 | json_object_string_add(json_cap, "extendedNexthop", "advertisedAndReceived"); | |
9811 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
9812 | json_object_string_add(json_cap, "extendedNexthop", "advertised"); | |
9813 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
9814 | json_object_string_add(json_cap, "extendedNexthop", "received"); | |
9815 | ||
9816 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
9817 | { | |
9818 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9819 | { | |
9820 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
9821 | { | |
9822 | print_store = afi_safi_print (AFI_IP, safi); | |
9823 | json_object_string_add(json_nxt, print_store, "recieved"); | |
9824 | } | |
9825 | } | |
9826 | json_object_object_add(json_cap, "extendedNexthopFamililesByPeer", json_nxt); | |
9827 | } | |
9828 | } | |
9829 | ||
9830 | /* Route Refresh */ | |
9831 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
9832 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
9833 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9834 | { | |
9835 | 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))) | |
9836 | { | |
9837 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) | |
9838 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOldNew"); | |
9839 | else | |
9840 | { | |
9841 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9842 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOld"); | |
9843 | else | |
9844 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedNew"); | |
9845 | } | |
9846 | } | |
9847 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
9848 | json_object_string_add(json_cap, "routeRefresh", "advertised"); | |
9849 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9850 | json_object_string_add(json_cap, "routeRefresh", "received"); | |
9851 | } | |
9852 | ||
9853 | /* Multiprotocol Extensions */ | |
9854 | json_object *json_multi = NULL; | |
9855 | json_multi = json_object_new_object(); | |
9856 | ||
9857 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9858 | { | |
9859 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9860 | { | |
9861 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
9862 | { | |
9863 | json_object *json_exten = NULL; | |
9864 | json_exten = json_object_new_object(); | |
9865 | ||
9866 | if (p->afc_adv[afi][safi] && p->afc_recv[afi][safi]) | |
9867 | json_object_boolean_true_add(json_exten, "advertisedAndReceived"); | |
9868 | else if (p->afc_adv[afi][safi]) | |
9869 | json_object_boolean_true_add(json_exten, "advertised"); | |
9870 | else if (p->afc_recv[afi][safi]) | |
9871 | json_object_boolean_true_add(json_exten, "received"); | |
9872 | ||
9873 | json_object_object_add(json_multi, afi_safi_print (afi, safi), json_exten); | |
9874 | } | |
9875 | } | |
9876 | } | |
9877 | json_object_object_add(json_cap, "multiprotocolExtensions", json_multi); | |
9878 | ||
9879 | /* Gracefull Restart */ | |
9880 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
9881 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
9882 | { | |
9883 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) && CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
9884 | json_object_string_add(json_cap, "gracefulRestart", "advertisedAndReceived"); | |
9885 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
9886 | json_object_string_add(json_cap, "gracefulRestartCapability", "advertised"); | |
9887 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
9888 | json_object_string_add(json_cap, "gracefulRestartCapability", "received"); | |
9889 | ||
9890 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
9891 | { | |
9892 | int restart_af_count = 0; | |
9893 | json_object *json_restart = NULL; | |
9894 | json_restart = json_object_new_object(); | |
9895 | ||
9896 | json_object_int_add(json_cap, "gracefulRestartRemoteTimerMsecs", p->v_gr_restart * 1000); | |
9897 | ||
9898 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9899 | { | |
9900 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9901 | { | |
9902 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
9903 | { | |
9904 | json_object *json_sub = NULL; | |
9905 | json_sub = json_object_new_object(); | |
9906 | ||
9907 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV)) | |
9908 | json_object_boolean_true_add(json_sub, "preserved"); | |
9909 | restart_af_count++; | |
9910 | json_object_object_add(json_restart, afi_safi_print (afi, safi), json_sub); | |
9911 | } | |
9912 | } | |
9913 | } | |
9914 | if (! restart_af_count) | |
9915 | json_object_string_add(json_cap, "addressFamiliesByPeer", "none"); | |
9916 | else | |
9917 | json_object_object_add(json_cap, "addressFamiliesByPeer", json_restart); | |
9918 | } | |
9919 | } | |
9920 | json_object_object_add(json_neigh, "neighborCapabilities", json_cap); | |
9921 | } | |
9922 | else | |
9923 | { | |
9924 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
9925 | ||
9926 | /* AS4 */ | |
9927 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
9928 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9929 | { | |
9930 | vty_out (vty, " 4 Byte AS:"); | |
9931 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9932 | vty_out (vty, " advertised"); | |
9933 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
9934 | vty_out (vty, " %sreceived", | |
9935 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
9936 | vty_out (vty, "%s", VTY_NEWLINE); | |
9937 | } | |
9938 | ||
9939 | /* AddPath */ | |
9940 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
9941 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
9942 | { | |
9943 | vty_out (vty, " AddPath:%s", VTY_NEWLINE); | |
a82478b9 | 9944 | |
856ca177 MS |
9945 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
9946 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
a82478b9 | 9947 | { |
856ca177 MS |
9948 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || |
9949 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
9950 | { | |
9951 | vty_out (vty, " %s: TX ", afi_safi_print (afi, safi)); | |
a82478b9 | 9952 | |
856ca177 MS |
9953 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) |
9954 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 9955 | |
856ca177 MS |
9956 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) |
9957 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" ); | |
a82478b9 | 9958 | |
856ca177 MS |
9959 | vty_out (vty, "%s", VTY_NEWLINE); |
9960 | } | |
a82478b9 | 9961 | |
856ca177 | 9962 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || |
a82478b9 | 9963 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
856ca177 MS |
9964 | { |
9965 | vty_out (vty, " %s: RX ", afi_safi_print (afi, safi)); | |
a82478b9 | 9966 | |
856ca177 MS |
9967 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) |
9968 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 9969 | |
856ca177 MS |
9970 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
9971 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" ); | |
a82478b9 | 9972 | |
856ca177 MS |
9973 | vty_out (vty, "%s", VTY_NEWLINE); |
9974 | } | |
a82478b9 | 9975 | } |
856ca177 | 9976 | } |
a82478b9 | 9977 | |
856ca177 MS |
9978 | /* Dynamic */ |
9979 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
9980 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9981 | { | |
9982 | vty_out (vty, " Dynamic:"); | |
9983 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9984 | vty_out (vty, " advertised"); | |
9985 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
9986 | vty_out (vty, " %sreceived", | |
9987 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
9988 | vty_out (vty, "%s", VTY_NEWLINE); | |
9989 | } | |
9990 | ||
9991 | /* Extended nexthop */ | |
9992 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
9993 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
9994 | { | |
9995 | vty_out (vty, " Extended nexthop:"); | |
9996 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
9997 | vty_out (vty, " advertised"); | |
9998 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
9999 | vty_out (vty, " %sreceived", | |
10000 | CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) ? "and " : ""); | |
10001 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 10002 | |
856ca177 MS |
10003 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) |
10004 | { | |
10005 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
10006 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10007 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
10008 | vty_out (vty, " %s%s", | |
10009 | afi_safi_print (AFI_IP, safi), VTY_NEWLINE); | |
10010 | } | |
10011 | } | |
8a92a8a0 | 10012 | |
856ca177 MS |
10013 | /* Route Refresh */ |
10014 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
10015 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
10016 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
10017 | { | |
10018 | vty_out (vty, " Route refresh:"); | |
10019 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
10020 | vty_out (vty, " advertised"); | |
10021 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
10022 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
10023 | vty_out (vty, " %sreceived(%s)", | |
10024 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
10025 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
10026 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
10027 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
8a92a8a0 | 10028 | |
856ca177 MS |
10029 | vty_out (vty, "%s", VTY_NEWLINE); |
10030 | } | |
718e3744 | 10031 | |
856ca177 MS |
10032 | /* Multiprotocol Extensions */ |
10033 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10034 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10035 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
10036 | { | |
10037 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); | |
10038 | if (p->afc_adv[afi][safi]) | |
10039 | vty_out (vty, " advertised"); | |
10040 | if (p->afc_recv[afi][safi]) | |
10041 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
10042 | vty_out (vty, "%s", VTY_NEWLINE); | |
10043 | } | |
538621f2 | 10044 | |
856ca177 MS |
10045 | /* Gracefull Restart */ |
10046 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
10047 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
10048 | { | |
10049 | vty_out (vty, " Graceful Restart Capabilty:"); | |
10050 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
538621f2 | 10051 | vty_out (vty, " advertised"); |
856ca177 MS |
10052 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
10053 | vty_out (vty, " %sreceived", | |
10054 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
10055 | vty_out (vty, "%s", VTY_NEWLINE); | |
538621f2 | 10056 | |
856ca177 MS |
10057 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
10058 | { | |
10059 | int restart_af_count = 0; | |
10060 | ||
10061 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
10062 | p->v_gr_restart, VTY_NEWLINE); | |
10063 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
10064 | ||
10065 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10066 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10067 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
10068 | { | |
10069 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", | |
10070 | afi_safi_print (afi, safi), | |
10071 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
10072 | "preserved" : "not preserved"); | |
10073 | restart_af_count++; | |
10074 | } | |
10075 | if (! restart_af_count) | |
10076 | vty_out (vty, "none"); | |
10077 | vty_out (vty, "%s", VTY_NEWLINE); | |
10078 | } | |
10079 | } | |
10080 | } | |
718e3744 | 10081 | } |
10082 | } | |
10083 | ||
93406d87 | 10084 | /* graceful restart information */ |
10085 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
10086 | || p->t_gr_restart | |
10087 | || p->t_gr_stale) | |
10088 | { | |
856ca177 MS |
10089 | json_object *json_grace = NULL; |
10090 | json_object *json_grace_send = NULL; | |
10091 | json_object *json_grace_recv = NULL; | |
93406d87 | 10092 | int eor_send_af_count = 0; |
10093 | int eor_receive_af_count = 0; | |
10094 | ||
856ca177 MS |
10095 | if (use_json) |
10096 | { | |
10097 | json_grace = json_object_new_object(); | |
10098 | json_grace_send = json_object_new_object(); | |
10099 | json_grace_recv = json_object_new_object(); | |
10100 | ||
10101 | if (p->status == Established) | |
10102 | { | |
10103 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10104 | { | |
10105 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10106 | { | |
10107 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
10108 | { | |
10109 | json_object_boolean_true_add(json_grace_send, afi_safi_print (afi, safi)); | |
10110 | eor_send_af_count++; | |
10111 | } | |
10112 | } | |
10113 | } | |
10114 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10115 | { | |
10116 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10117 | { | |
10118 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
10119 | { | |
10120 | json_object_boolean_true_add(json_grace_recv, afi_safi_print (afi, safi)); | |
10121 | eor_receive_af_count++; | |
10122 | } | |
10123 | } | |
10124 | } | |
10125 | } | |
10126 | ||
10127 | json_object_object_add(json_grace, "endOfRibSend", json_grace_send); | |
10128 | json_object_object_add(json_grace, "endOfRibRecv", json_grace_recv); | |
10129 | ||
10130 | if (p->t_gr_restart) | |
10131 | json_object_int_add(json_grace, "gracefulRestartTimerMsecs", thread_timer_remain_second (p->t_gr_restart) * 1000); | |
10132 | ||
10133 | if (p->t_gr_stale) | |
10134 | json_object_int_add(json_grace, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p->t_gr_stale) * 1000); | |
10135 | ||
10136 | json_object_object_add(json_neigh, "gracefulRestartInfo", json_grace); | |
10137 | } | |
10138 | else | |
10139 | { | |
10140 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
10141 | if (p->status == Established) | |
10142 | { | |
10143 | vty_out (vty, " End-of-RIB send: "); | |
10144 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10145 | { | |
10146 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10147 | { | |
10148 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
10149 | { | |
10150 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
10151 | afi_safi_print (afi, safi)); | |
10152 | eor_send_af_count++; | |
10153 | } | |
10154 | } | |
10155 | } | |
10156 | vty_out (vty, "%s", VTY_NEWLINE); | |
10157 | vty_out (vty, " End-of-RIB received: "); | |
10158 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10159 | { | |
10160 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10161 | { | |
10162 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
10163 | { | |
10164 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
10165 | afi_safi_print (afi, safi)); | |
10166 | eor_receive_af_count++; | |
10167 | } | |
10168 | } | |
10169 | } | |
10170 | vty_out (vty, "%s", VTY_NEWLINE); | |
10171 | } | |
93406d87 | 10172 | |
856ca177 MS |
10173 | if (p->t_gr_restart) |
10174 | vty_out (vty, " The remaining time of restart timer is %ld%s", | |
10175 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
0b2aa3a0 | 10176 | |
856ca177 MS |
10177 | if (p->t_gr_stale) |
10178 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", | |
10179 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
10180 | } | |
10181 | } | |
10182 | if (use_json) | |
10183 | { | |
10184 | json_object *json_stat = NULL; | |
10185 | json_stat = json_object_new_object(); | |
10186 | /* Packet counts. */ | |
10187 | json_object_int_add(json_stat, "depthInq", 0); | |
10188 | json_object_int_add(json_stat, "depthOutq", (unsigned long) p->obuf->count); | |
10189 | json_object_int_add(json_stat, "opensSent", p->open_out); | |
10190 | json_object_int_add(json_stat, "opensRecv", p->open_in); | |
10191 | json_object_int_add(json_stat, "notificationsSent", p->notify_out); | |
10192 | json_object_int_add(json_stat, "notificationsRecv", p->notify_in); | |
10193 | json_object_int_add(json_stat, "updatesSent", p->update_out); | |
10194 | json_object_int_add(json_stat, "updatesRecv", p->update_in); | |
10195 | json_object_int_add(json_stat, "keepalivesSent", p->keepalive_out); | |
10196 | json_object_int_add(json_stat, "keepalivesRecv", p->keepalive_in); | |
10197 | json_object_int_add(json_stat, "routeRefreshSent", p->refresh_out); | |
10198 | json_object_int_add(json_stat, "routeRefreshRecv", p->refresh_in); | |
10199 | json_object_int_add(json_stat, "capabilitySent", p->dynamic_cap_out); | |
10200 | json_object_int_add(json_stat, "capabilityRecv", p->dynamic_cap_in); | |
10201 | 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); | |
10202 | 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); | |
10203 | json_object_object_add(json_neigh, "messageStats", json_stat); | |
10204 | } | |
10205 | else | |
10206 | { | |
10207 | /* Packet counts. */ | |
10208 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); | |
10209 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
10210 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); | |
10211 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); | |
10212 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
10213 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
10214 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
10215 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
10216 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
10217 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
10218 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
10219 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
10220 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
10221 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 10222 | } |
10223 | ||
856ca177 MS |
10224 | if (use_json) |
10225 | { | |
10226 | /* advertisement-interval */ | |
10227 | json_object_int_add(json_neigh, "minBtwnAdvertisementRunsTimerMsecs", p->v_routeadv * 1000); | |
718e3744 | 10228 | |
856ca177 MS |
10229 | /* Update-source. */ |
10230 | if (p->update_if || p->update_source) | |
10231 | { | |
10232 | if (p->update_if) | |
10233 | json_object_string_add(json_neigh, "updateSource", p->update_if); | |
10234 | else if (p->update_source) | |
10235 | json_object_string_add(json_neigh, "updateSource", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
10236 | } | |
10237 | ||
10238 | /* Default weight */ | |
10239 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
10240 | json_object_int_add(json_neigh, "defaultWeight", p->weight); | |
10241 | ||
10242 | } | |
10243 | else | |
10244 | { | |
10245 | /* advertisement-interval */ | |
10246 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
10247 | p->v_routeadv, VTY_NEWLINE); | |
10248 | ||
10249 | /* Update-source. */ | |
10250 | if (p->update_if || p->update_source) | |
10251 | { | |
10252 | vty_out (vty, " Update source is "); | |
10253 | if (p->update_if) | |
10254 | vty_out (vty, "%s", p->update_if); | |
10255 | else if (p->update_source) | |
10256 | vty_out (vty, "%s", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
10257 | vty_out (vty, "%s", VTY_NEWLINE); | |
10258 | } | |
10259 | ||
10260 | /* Default weight */ | |
10261 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
10262 | vty_out (vty, " Default weight %d%s", p->weight, VTY_NEWLINE); | |
10263 | ||
10264 | vty_out (vty, "%s", VTY_NEWLINE); | |
10265 | } | |
718e3744 | 10266 | |
10267 | /* Address Family Information */ | |
856ca177 MS |
10268 | json_object *json_hold = NULL; |
10269 | ||
10270 | if (use_json) | |
10271 | json_hold = json_object_new_object(); | |
10272 | ||
538621f2 | 10273 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
10274 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10275 | if (p->afc[afi][safi]) | |
856ca177 | 10276 | bgp_show_peer_afi (vty, p, afi, safi, use_json, json_hold); |
718e3744 | 10277 | |
856ca177 MS |
10278 | if (use_json) |
10279 | { | |
10280 | json_object_int_add(json_hold, "connectionsEstablished", p->established); | |
10281 | json_object_int_add(json_hold, "connectionsDropped", p->dropped); | |
10282 | } | |
10283 | else | |
10284 | vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped, | |
10285 | VTY_NEWLINE); | |
718e3744 | 10286 | |
d6661008 | 10287 | if (! p->last_reset) |
856ca177 MS |
10288 | { |
10289 | if (use_json) | |
10290 | json_object_string_add(json_hold, "lastReset", "never"); | |
10291 | else | |
10292 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); | |
10293 | } | |
e0701b79 | 10294 | else |
d6661008 | 10295 | { |
856ca177 MS |
10296 | if (use_json) |
10297 | { | |
10298 | time_t uptime; | |
10299 | struct tm *tm; | |
10300 | ||
10301 | uptime = bgp_clock(); | |
10302 | uptime -= p->resettime; | |
10303 | tm = gmtime(&uptime); | |
10304 | json_object_int_add(json_hold, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
10305 | json_object_string_add(json_hold, "lastResetDueTo", peer_down_str[(int) p->last_reset]); | |
10306 | if (p->last_reset_cause_size) | |
10307 | { | |
10308 | msg = p->last_reset_cause; | |
10309 | char adapter[BUFSIZ]; | |
10310 | sprintf(adapter, "%s", msg); | |
10311 | json_object_string_add(json_hold, "messageReceivedThatCausedBgpNotification", adapter); | |
10312 | } | |
10313 | } | |
10314 | else | |
d6661008 | 10315 | { |
856ca177 MS |
10316 | vty_out (vty, " Last reset %s, due to %s%s", |
10317 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN, 0, NULL), | |
10318 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
10319 | ||
10320 | if (p->last_reset_cause_size) | |
d6661008 | 10321 | { |
856ca177 MS |
10322 | msg = p->last_reset_cause; |
10323 | vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); | |
10324 | for (i = 1; i <= p->last_reset_cause_size; i++) | |
10325 | { | |
10326 | vty_out(vty, "%02X", *msg++); | |
d6661008 | 10327 | |
856ca177 MS |
10328 | if (i != p->last_reset_cause_size) |
10329 | { | |
10330 | if (i % 16 == 0) | |
10331 | { | |
10332 | vty_out(vty, "%s ", VTY_NEWLINE); | |
10333 | } | |
10334 | else if (i % 4 == 0) | |
10335 | { | |
10336 | vty_out(vty, " "); | |
10337 | } | |
10338 | } | |
10339 | } | |
10340 | vty_out(vty, "%s", VTY_NEWLINE); | |
d6661008 | 10341 | } |
d6661008 DS |
10342 | } |
10343 | } | |
848973c7 | 10344 | |
718e3744 | 10345 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
10346 | { | |
856ca177 MS |
10347 | if (use_json) |
10348 | json_object_boolean_true_add(json_hold, "prefixesConfigExceedMax"); | |
10349 | else | |
10350 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 10351 | |
10352 | if (p->t_pmax_restart) | |
856ca177 MS |
10353 | { |
10354 | if (use_json) | |
10355 | { | |
10356 | json_object_string_add(json_hold, "reducePrefixNumFrom", p->host); | |
10357 | json_object_int_add(json_hold, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); | |
10358 | } | |
10359 | else | |
10360 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
10361 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
10362 | VTY_NEWLINE); | |
10363 | } | |
0a486e5f | 10364 | else |
856ca177 MS |
10365 | { |
10366 | if (use_json) | |
10367 | json_object_string_add(json_hold, "reducePrefixNumAndClearIpBgp", p->host); | |
10368 | else | |
10369 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
10370 | p->host, VTY_NEWLINE); | |
10371 | } | |
718e3744 | 10372 | } |
10373 | ||
856ca177 MS |
10374 | if (use_json) |
10375 | json_object_object_add(json_neigh, "addressFamilyInfo", json_hold); | |
10376 | ||
f5a4827d | 10377 | /* EBGP Multihop and GTSM */ |
6d85b15b | 10378 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d | 10379 | { |
856ca177 MS |
10380 | if (use_json) |
10381 | { | |
10382 | if (p->gtsm_hops > 0) | |
10383 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->gtsm_hops); | |
10384 | else if (p->ttl > 1) | |
10385 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->ttl); | |
10386 | } | |
10387 | else | |
10388 | { | |
10389 | if (p->gtsm_hops > 0) | |
10390 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
10391 | p->gtsm_hops, VTY_NEWLINE); | |
10392 | else if (p->ttl > 1) | |
10393 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
10394 | p->ttl, VTY_NEWLINE); | |
10395 | } | |
f5a4827d | 10396 | } |
5d804b43 PM |
10397 | else |
10398 | { | |
10399 | if (p->gtsm_hops > 0) | |
856ca177 MS |
10400 | { |
10401 | if (use_json) | |
10402 | json_object_int_add(json_neigh, "internalBgpNbrMaxHopsAway", p->gtsm_hops); | |
10403 | else | |
10404 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
10405 | p->gtsm_hops, VTY_NEWLINE); | |
10406 | } | |
5d804b43 | 10407 | } |
718e3744 | 10408 | |
10409 | /* Local address. */ | |
10410 | if (p->su_local) | |
10411 | { | |
856ca177 MS |
10412 | if (use_json) |
10413 | { | |
10414 | json_object_string_add(json_neigh, "hostLocal", sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN)); | |
10415 | json_object_int_add(json_neigh, "portLocal", ntohs (p->su_local->sin.sin_port)); | |
10416 | } | |
10417 | else | |
10418 | vty_out (vty, "Local host: %s, Local port: %d%s", | |
10419 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), | |
10420 | ntohs (p->su_local->sin.sin_port), | |
10421 | VTY_NEWLINE); | |
718e3744 | 10422 | } |
10423 | ||
10424 | /* Remote address. */ | |
10425 | if (p->su_remote) | |
10426 | { | |
856ca177 MS |
10427 | if (use_json) |
10428 | { | |
10429 | json_object_string_add(json_neigh, "hostForeign", sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN)); | |
10430 | json_object_int_add(json_neigh, "portForeign", ntohs (p->su_remote->sin.sin_port)); | |
10431 | } | |
10432 | else | |
10433 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
718e3744 | 10434 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
10435 | ntohs (p->su_remote->sin.sin_port), | |
10436 | VTY_NEWLINE); | |
10437 | } | |
10438 | ||
10439 | /* Nexthop display. */ | |
10440 | if (p->su_local) | |
10441 | { | |
856ca177 MS |
10442 | if (use_json) |
10443 | { | |
10444 | json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ)); | |
718e3744 | 10445 | #ifdef HAVE_IPV6 |
856ca177 MS |
10446 | json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ)); |
10447 | json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ)); | |
10448 | if (p->shared_network) | |
10449 | json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork"); | |
10450 | else | |
10451 | json_object_string_add(json_neigh, "bgpConnection", "nonSharedNetwork"); | |
10452 | #endif /* HAVE_IPV6 */ | |
10453 | } | |
10454 | else | |
10455 | { | |
10456 | vty_out (vty, "Nexthop: %s%s", | |
10457 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
10458 | VTY_NEWLINE); | |
10459 | #ifdef HAVE_IPV6 | |
10460 | vty_out (vty, "Nexthop global: %s%s", | |
10461 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
10462 | VTY_NEWLINE); | |
10463 | vty_out (vty, "Nexthop local: %s%s", | |
10464 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
10465 | VTY_NEWLINE); | |
10466 | vty_out (vty, "BGP connection: %s%s", | |
10467 | p->shared_network ? "shared network" : "non shared network", | |
10468 | VTY_NEWLINE); | |
718e3744 | 10469 | #endif /* HAVE_IPV6 */ |
856ca177 | 10470 | } |
718e3744 | 10471 | } |
10472 | ||
10473 | /* Timer information. */ | |
856ca177 MS |
10474 | if (use_json) |
10475 | { | |
10476 | if (p->t_start) | |
10477 | json_object_int_add(json_neigh, "nextStartTimerDueInMsecs", thread_timer_remain_second (p->t_start) * 1000); | |
10478 | if (p->t_connect) | |
10479 | json_object_int_add(json_neigh, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p->t_connect) * 1000); | |
10480 | if (p->t_routeadv) | |
10481 | { | |
10482 | json_object_int_add(json_neigh, "mraiInterval", p->v_routeadv); | |
10483 | json_object_int_add(json_neigh, "mraiTimerExpireInMsecs", thread_timer_remain_second (p->t_routeadv) * 1000); | |
10484 | } | |
cb1faec9 | 10485 | |
856ca177 MS |
10486 | if (p->t_read) |
10487 | json_object_string_add(json_neigh, "readThread", "on"); | |
10488 | else | |
10489 | json_object_string_add(json_neigh, "readThread", "off"); | |
10490 | if (p->t_write) | |
10491 | json_object_string_add(json_neigh, "writeThread", "on"); | |
10492 | else | |
10493 | json_object_string_add(json_neigh, "writeThread", "off"); | |
10494 | } | |
10495 | else | |
10496 | { | |
10497 | if (p->t_start) | |
10498 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
10499 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
10500 | if (p->t_connect) | |
10501 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
10502 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
10503 | if (p->t_routeadv) | |
10504 | vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s", | |
10505 | p->v_routeadv, thread_timer_remain_second (p->t_routeadv), | |
10506 | VTY_NEWLINE); | |
10507 | ||
10508 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
10509 | p->t_read ? "on" : "off", | |
10510 | p->t_write ? "on" : "off", | |
10511 | VTY_NEWLINE); | |
10512 | } | |
718e3744 | 10513 | |
10514 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
10515 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
856ca177 MS |
10516 | bgp_capability_vty_out (vty, p, use_json, json_neigh); |
10517 | ||
10518 | if (!use_json) | |
10519 | vty_out (vty, "%s", VTY_NEWLINE); | |
c43ed2e4 DS |
10520 | |
10521 | /* BFD information. */ | |
856ca177 MS |
10522 | bgp_bfd_show_info(vty, p, use_json, json_neigh); |
10523 | ||
10524 | if (use_json) | |
10525 | { | |
10526 | if (p->conf_if) /* Configured interface name. */ | |
10527 | json_object_object_add(json, p->conf_if, json_neigh); | |
10528 | else /* Configured IP address. */ | |
10529 | json_object_object_add(json, p->host, json_neigh); | |
10530 | } | |
718e3744 | 10531 | } |
10532 | ||
94f2b392 | 10533 | static int |
856ca177 MS |
10534 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type, |
10535 | union sockunion *su, const char *conf_if, u_char use_json, json_object *json) | |
718e3744 | 10536 | { |
1eb8ef25 | 10537 | struct listnode *node, *nnode; |
718e3744 | 10538 | struct peer *peer; |
10539 | int find = 0; | |
856ca177 MS |
10540 | json_object *json_neigh = NULL; |
10541 | ||
10542 | if (use_json) | |
10543 | json_neigh = json_object_new_object(); | |
718e3744 | 10544 | |
1eb8ef25 | 10545 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 10546 | { |
1ff9a340 DS |
10547 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
10548 | continue; | |
10549 | ||
718e3744 | 10550 | switch (type) |
856ca177 MS |
10551 | { |
10552 | case show_all: | |
10553 | bgp_show_peer (vty, peer, use_json, json, json_neigh); | |
10554 | break; | |
10555 | case show_peer: | |
10556 | if (conf_if) | |
10557 | { | |
10558 | if (peer->conf_if && !strcmp(peer->conf_if, conf_if)) | |
10559 | { | |
10560 | find = 1; | |
10561 | bgp_show_peer (vty, peer, use_json, json, json_neigh); | |
10562 | } | |
10563 | } | |
10564 | else | |
10565 | { | |
10566 | if (sockunion_same (&peer->su, su)) | |
10567 | { | |
10568 | find = 1; | |
10569 | bgp_show_peer (vty, peer, use_json, json, json_neigh); | |
10570 | } | |
10571 | } | |
10572 | break; | |
718e3744 | 10573 | } |
10574 | } | |
10575 | ||
10576 | if (type == show_peer && ! find) | |
856ca177 MS |
10577 | { |
10578 | if (use_json) | |
10579 | json_object_boolean_true_add(json, "bgpNoSuchNeighbor"); | |
10580 | else | |
10581 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
10582 | } | |
10583 | ||
10584 | if (use_json) | |
10585 | { | |
10586 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
10587 | json_object_free(json); | |
10588 | } | |
10589 | else | |
10590 | { | |
10591 | vty_out (vty, "%s", VTY_NEWLINE); | |
10592 | } | |
10593 | ||
718e3744 | 10594 | return CMD_SUCCESS; |
10595 | } | |
10596 | ||
94f2b392 | 10597 | static int |
fd79ac91 | 10598 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
856ca177 | 10599 | enum show_type type, const char *ip_str, u_char use_json) |
718e3744 | 10600 | { |
10601 | int ret; | |
10602 | struct bgp *bgp; | |
10603 | union sockunion su; | |
856ca177 MS |
10604 | json_object *json = NULL; |
10605 | ||
10606 | if (use_json) | |
10607 | json = json_object_new_object(); | |
718e3744 | 10608 | |
718e3744 | 10609 | if (name) |
10610 | { | |
10611 | bgp = bgp_lookup_by_name (name); | |
718e3744 | 10612 | if (! bgp) |
10613 | { | |
856ca177 MS |
10614 | if (use_json) |
10615 | { | |
10616 | json_object_boolean_true_add(json, "bgpNoSuchInstance"); | |
10617 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
10618 | json_object_free(json); | |
10619 | } | |
10620 | else | |
10621 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
10622 | ||
718e3744 | 10623 | return CMD_WARNING; |
10624 | } | |
718e3744 | 10625 | } |
a80beece DS |
10626 | else |
10627 | { | |
10628 | bgp = bgp_get_default (); | |
10629 | } | |
718e3744 | 10630 | |
10631 | if (bgp) | |
a80beece DS |
10632 | { |
10633 | if (ip_str) | |
10634 | { | |
10635 | ret = str2sockunion (ip_str, &su); | |
10636 | if (ret < 0) | |
856ca177 | 10637 | bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json); |
a80beece | 10638 | else |
856ca177 | 10639 | bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json); |
a80beece DS |
10640 | } |
10641 | else | |
10642 | { | |
856ca177 | 10643 | bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json); |
a80beece DS |
10644 | } |
10645 | } | |
718e3744 | 10646 | |
10647 | return CMD_SUCCESS; | |
10648 | } | |
10649 | ||
10650 | /* "show ip bgp neighbors" commands. */ | |
10651 | DEFUN (show_ip_bgp_neighbors, | |
10652 | show_ip_bgp_neighbors_cmd, | |
856ca177 | 10653 | "show ip bgp neighbors {json}", |
718e3744 | 10654 | SHOW_STR |
10655 | IP_STR | |
10656 | BGP_STR | |
856ca177 MS |
10657 | "Detailed information on TCP and BGP neighbor connections\n" |
10658 | "JavaScript Object Notation\n") | |
718e3744 | 10659 | { |
856ca177 MS |
10660 | u_char use_json; |
10661 | ||
10662 | if (argv[argc - 1] && strcmp(argv[argc - 1], "json") == 0) | |
10663 | use_json = 1; | |
10664 | else | |
10665 | use_json = 0; | |
10666 | ||
10667 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, use_json); | |
718e3744 | 10668 | } |
10669 | ||
10670 | ALIAS (show_ip_bgp_neighbors, | |
10671 | show_ip_bgp_ipv4_neighbors_cmd, | |
856ca177 | 10672 | "show ip bgp ipv4 (unicast|multicast) neighbors {json}", |
718e3744 | 10673 | SHOW_STR |
10674 | IP_STR | |
10675 | BGP_STR | |
10676 | "Address family\n" | |
10677 | "Address Family modifier\n" | |
10678 | "Address Family modifier\n" | |
856ca177 MS |
10679 | "Detailed information on TCP and BGP neighbor connections\n" |
10680 | "JavaScript Object Notation\n") | |
718e3744 | 10681 | |
10682 | ALIAS (show_ip_bgp_neighbors, | |
10683 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
856ca177 | 10684 | "show ip bgp vpnv4 all neighbors {json}", |
718e3744 | 10685 | SHOW_STR |
10686 | IP_STR | |
10687 | BGP_STR | |
10688 | "Display VPNv4 NLRI specific information\n" | |
10689 | "Display information about all VPNv4 NLRIs\n" | |
856ca177 MS |
10690 | "Detailed information on TCP and BGP neighbor connections\n" |
10691 | "JavaScript Object Notation\n") | |
718e3744 | 10692 | |
10693 | ALIAS (show_ip_bgp_neighbors, | |
10694 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
856ca177 | 10695 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}", |
718e3744 | 10696 | SHOW_STR |
10697 | IP_STR | |
10698 | BGP_STR | |
10699 | "Display VPNv4 NLRI specific information\n" | |
10700 | "Display information for a route distinguisher\n" | |
10701 | "VPN Route Distinguisher\n" | |
856ca177 MS |
10702 | "Detailed information on TCP and BGP neighbor connections\n" |
10703 | "JavaScript Object Notation\n") | |
718e3744 | 10704 | |
10705 | ALIAS (show_ip_bgp_neighbors, | |
10706 | show_bgp_neighbors_cmd, | |
856ca177 | 10707 | "show bgp neighbors {json}", |
718e3744 | 10708 | SHOW_STR |
10709 | BGP_STR | |
856ca177 MS |
10710 | "Detailed information on TCP and BGP neighbor connections\n" |
10711 | "JavaScript Object Notation\n") | |
718e3744 | 10712 | |
10713 | ALIAS (show_ip_bgp_neighbors, | |
10714 | show_bgp_ipv6_neighbors_cmd, | |
856ca177 | 10715 | "show bgp ipv6 neighbors {json}", |
718e3744 | 10716 | SHOW_STR |
10717 | BGP_STR | |
10718 | "Address family\n" | |
856ca177 MS |
10719 | "Detailed information on TCP and BGP neighbor connections\n" |
10720 | "JavaScript Object Notation\n") | |
718e3744 | 10721 | |
10722 | DEFUN (show_ip_bgp_neighbors_peer, | |
10723 | show_ip_bgp_neighbors_peer_cmd, | |
856ca177 | 10724 | "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10725 | SHOW_STR |
10726 | IP_STR | |
10727 | BGP_STR | |
10728 | "Detailed information on TCP and BGP neighbor connections\n" | |
10729 | "Neighbor to display information about\n" | |
a80beece | 10730 | "Neighbor to display information about\n" |
856ca177 MS |
10731 | "Neighbor on bgp configured interface\n" |
10732 | "JavaScript Object Notation\n") | |
718e3744 | 10733 | { |
856ca177 MS |
10734 | u_char use_json; |
10735 | ||
10736 | if (argv[argc - 1] && strcmp(argv[argc - 1], "json") == 0) | |
10737 | use_json = 1; | |
10738 | else | |
10739 | use_json = 0; | |
10740 | ||
10741 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], use_json); | |
718e3744 | 10742 | } |
10743 | ||
10744 | ALIAS (show_ip_bgp_neighbors_peer, | |
10745 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
856ca177 | 10746 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10747 | SHOW_STR |
10748 | IP_STR | |
10749 | BGP_STR | |
10750 | "Address family\n" | |
10751 | "Address Family modifier\n" | |
10752 | "Address Family modifier\n" | |
10753 | "Detailed information on TCP and BGP neighbor connections\n" | |
10754 | "Neighbor to display information about\n" | |
a80beece | 10755 | "Neighbor to display information about\n" |
856ca177 MS |
10756 | "Neighbor on bgp configured interface\n" |
10757 | "JavaScript Object Notation\n") | |
718e3744 | 10758 | |
10759 | ALIAS (show_ip_bgp_neighbors_peer, | |
10760 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
856ca177 | 10761 | "show ip bgp vpnv4 all neighbors A.B.C.D {json}", |
718e3744 | 10762 | SHOW_STR |
10763 | IP_STR | |
10764 | BGP_STR | |
10765 | "Display VPNv4 NLRI specific information\n" | |
10766 | "Display information about all VPNv4 NLRIs\n" | |
10767 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
10768 | "Neighbor to display information about\n" |
10769 | "JavaScript Object Notation\n") | |
718e3744 | 10770 | |
10771 | ALIAS (show_ip_bgp_neighbors_peer, | |
10772 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
856ca177 | 10773 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}", |
718e3744 | 10774 | SHOW_STR |
10775 | IP_STR | |
10776 | BGP_STR | |
10777 | "Display VPNv4 NLRI specific information\n" | |
10778 | "Display information about all VPNv4 NLRIs\n" | |
10779 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
10780 | "Neighbor to display information about\n" |
10781 | "JavaScript Object Notation\n") | |
718e3744 | 10782 | |
10783 | ALIAS (show_ip_bgp_neighbors_peer, | |
10784 | show_bgp_neighbors_peer_cmd, | |
856ca177 | 10785 | "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10786 | SHOW_STR |
10787 | BGP_STR | |
10788 | "Detailed information on TCP and BGP neighbor connections\n" | |
10789 | "Neighbor to display information about\n" | |
a80beece | 10790 | "Neighbor to display information about\n" |
856ca177 MS |
10791 | "Neighbor on bgp configured interface\n" |
10792 | "JavaScript Object Notation\n") | |
718e3744 | 10793 | |
10794 | ALIAS (show_ip_bgp_neighbors_peer, | |
10795 | show_bgp_ipv6_neighbors_peer_cmd, | |
856ca177 | 10796 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10797 | SHOW_STR |
10798 | BGP_STR | |
10799 | "Address family\n" | |
10800 | "Detailed information on TCP and BGP neighbor connections\n" | |
10801 | "Neighbor to display information about\n" | |
a80beece | 10802 | "Neighbor to display information about\n" |
856ca177 MS |
10803 | "Neighbor on bgp configured interface\n" |
10804 | "JavaScript Object Notation\n") | |
718e3744 | 10805 | |
10806 | DEFUN (show_ip_bgp_instance_neighbors, | |
10807 | show_ip_bgp_instance_neighbors_cmd, | |
856ca177 | 10808 | "show ip bgp view WORD neighbors {json}", |
718e3744 | 10809 | SHOW_STR |
10810 | IP_STR | |
10811 | BGP_STR | |
10812 | "BGP view\n" | |
10813 | "View name\n" | |
856ca177 MS |
10814 | "Detailed information on TCP and BGP neighbor connections\n" |
10815 | "JavaScript Object Notation\n") | |
718e3744 | 10816 | { |
856ca177 MS |
10817 | u_char use_json; |
10818 | ||
10819 | if (argv[1] && strcmp(argv[1], "json") == 0) | |
10820 | use_json = 1; | |
10821 | else | |
10822 | use_json = 0; | |
10823 | ||
10824 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL, use_json); | |
718e3744 | 10825 | } |
10826 | ||
bb46e94f | 10827 | ALIAS (show_ip_bgp_instance_neighbors, |
10828 | show_bgp_instance_neighbors_cmd, | |
856ca177 | 10829 | "show bgp view WORD neighbors {json}", |
bb46e94f | 10830 | SHOW_STR |
10831 | BGP_STR | |
10832 | "BGP view\n" | |
10833 | "View name\n" | |
856ca177 MS |
10834 | "Detailed information on TCP and BGP neighbor connections\n" |
10835 | "JavaScript Object Notation\n") | |
bb46e94f | 10836 | |
10837 | ALIAS (show_ip_bgp_instance_neighbors, | |
10838 | show_bgp_instance_ipv6_neighbors_cmd, | |
856ca177 | 10839 | "show bgp view WORD ipv6 neighbors {json}", |
bb46e94f | 10840 | SHOW_STR |
10841 | BGP_STR | |
10842 | "BGP view\n" | |
10843 | "View name\n" | |
10844 | "Address family\n" | |
856ca177 MS |
10845 | "Detailed information on TCP and BGP neighbor connections\n" |
10846 | "JavaScript Object Notation\n") | |
bb46e94f | 10847 | |
718e3744 | 10848 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
10849 | show_ip_bgp_instance_neighbors_peer_cmd, | |
856ca177 | 10850 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10851 | SHOW_STR |
10852 | IP_STR | |
10853 | BGP_STR | |
10854 | "BGP view\n" | |
10855 | "View name\n" | |
10856 | "Detailed information on TCP and BGP neighbor connections\n" | |
10857 | "Neighbor to display information about\n" | |
a80beece | 10858 | "Neighbor to display information about\n" |
856ca177 MS |
10859 | "Neighbor on bgp configured interface\n" |
10860 | "JavaScript Object Notation\n") | |
718e3744 | 10861 | { |
856ca177 MS |
10862 | u_char use_json; |
10863 | ||
10864 | if (argv[2] && strcmp(argv[2], "json") == 0) | |
10865 | use_json = 1; | |
10866 | else | |
10867 | use_json = 0; | |
10868 | ||
10869 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1], use_json); | |
718e3744 | 10870 | } |
bb46e94f | 10871 | |
10872 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
10873 | show_bgp_instance_neighbors_peer_cmd, | |
856ca177 | 10874 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 10875 | SHOW_STR |
10876 | BGP_STR | |
10877 | "BGP view\n" | |
10878 | "View name\n" | |
10879 | "Detailed information on TCP and BGP neighbor connections\n" | |
10880 | "Neighbor to display information about\n" | |
a80beece | 10881 | "Neighbor to display information about\n" |
856ca177 MS |
10882 | "Neighbor on bgp configured interface\n" |
10883 | "JavaScript Object Notation\n") | |
bb46e94f | 10884 | |
10885 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
10886 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
856ca177 | 10887 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 10888 | SHOW_STR |
10889 | BGP_STR | |
10890 | "BGP view\n" | |
10891 | "View name\n" | |
10892 | "Address family\n" | |
10893 | "Detailed information on TCP and BGP neighbor connections\n" | |
10894 | "Neighbor to display information about\n" | |
a80beece | 10895 | "Neighbor to display information about\n" |
856ca177 MS |
10896 | "Neighbor on bgp configured interface\n" |
10897 | "JavaScript Object Notation\n") | |
6b0655a2 | 10898 | |
718e3744 | 10899 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
10900 | paths' and `show ip mbgp paths'. Those functions results are the | |
10901 | same.*/ | |
10902 | DEFUN (show_ip_bgp_paths, | |
10903 | show_ip_bgp_paths_cmd, | |
10904 | "show ip bgp paths", | |
10905 | SHOW_STR | |
10906 | IP_STR | |
10907 | BGP_STR | |
10908 | "Path information\n") | |
10909 | { | |
10910 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
10911 | aspath_print_all_vty (vty); | |
10912 | return CMD_SUCCESS; | |
10913 | } | |
10914 | ||
10915 | DEFUN (show_ip_bgp_ipv4_paths, | |
10916 | show_ip_bgp_ipv4_paths_cmd, | |
10917 | "show ip bgp ipv4 (unicast|multicast) paths", | |
10918 | SHOW_STR | |
10919 | IP_STR | |
10920 | BGP_STR | |
10921 | "Address family\n" | |
10922 | "Address Family modifier\n" | |
10923 | "Address Family modifier\n" | |
10924 | "Path information\n") | |
10925 | { | |
10926 | vty_out (vty, "Address Refcnt Path\r\n"); | |
10927 | aspath_print_all_vty (vty); | |
10928 | ||
10929 | return CMD_SUCCESS; | |
10930 | } | |
6b0655a2 | 10931 | |
718e3744 | 10932 | #include "hash.h" |
10933 | ||
94f2b392 | 10934 | static void |
718e3744 | 10935 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
10936 | { | |
10937 | struct community *com; | |
10938 | ||
10939 | com = (struct community *) backet->data; | |
10940 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, | |
10941 | community_str (com), VTY_NEWLINE); | |
10942 | } | |
10943 | ||
10944 | /* Show BGP's community internal data. */ | |
10945 | DEFUN (show_ip_bgp_community_info, | |
10946 | show_ip_bgp_community_info_cmd, | |
10947 | "show ip bgp community-info", | |
10948 | SHOW_STR | |
10949 | IP_STR | |
10950 | BGP_STR | |
10951 | "List all bgp community information\n") | |
10952 | { | |
10953 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
10954 | ||
10955 | hash_iterate (community_hash (), | |
10956 | (void (*) (struct hash_backet *, void *)) | |
10957 | community_show_all_iterator, | |
10958 | vty); | |
10959 | ||
10960 | return CMD_SUCCESS; | |
10961 | } | |
10962 | ||
10963 | DEFUN (show_ip_bgp_attr_info, | |
10964 | show_ip_bgp_attr_info_cmd, | |
10965 | "show ip bgp attribute-info", | |
10966 | SHOW_STR | |
10967 | IP_STR | |
10968 | BGP_STR | |
10969 | "List all bgp attribute information\n") | |
10970 | { | |
10971 | attr_show_all (vty); | |
10972 | return CMD_SUCCESS; | |
10973 | } | |
6b0655a2 | 10974 | |
94f2b392 | 10975 | static int |
fee0f4c6 | 10976 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
10977 | afi_t afi, safi_t safi) | |
10978 | { | |
10979 | char timebuf[BGP_UPTIME_LEN]; | |
10980 | char rmbuf[14]; | |
fd79ac91 | 10981 | const char *rmname; |
fee0f4c6 | 10982 | struct peer *peer; |
1eb8ef25 | 10983 | struct listnode *node, *nnode; |
fee0f4c6 | 10984 | int len; |
10985 | int count = 0; | |
10986 | ||
10987 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) | |
10988 | { | |
1eb8ef25 | 10989 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
fee0f4c6 | 10990 | { |
10991 | count++; | |
10992 | bgp_write_rsclient_summary (vty, peer, afi, safi); | |
10993 | } | |
10994 | return count; | |
10995 | } | |
10996 | ||
10997 | len = vty_out (vty, "%s", rsclient->host); | |
10998 | len = 16 - len; | |
10999 | ||
11000 | if (len < 1) | |
11001 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
11002 | else | |
11003 | vty_out (vty, "%*s", len, " "); | |
11004 | ||
3d515fd9 | 11005 | vty_out (vty, "4 "); |
fee0f4c6 | 11006 | |
0b2aa3a0 | 11007 | vty_out (vty, "%11d ", rsclient->as); |
fee0f4c6 | 11008 | |
11009 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); | |
11010 | if ( rmname && strlen (rmname) > 13 ) | |
11011 | { | |
11012 | sprintf (rmbuf, "%13s", "..."); | |
11013 | rmname = strncpy (rmbuf, rmname, 10); | |
11014 | } | |
11015 | else if (! rmname) | |
11016 | rmname = "<none>"; | |
11017 | vty_out (vty, " %13s ", rmname); | |
11018 | ||
11019 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); | |
11020 | if ( rmname && strlen (rmname) > 13 ) | |
11021 | { | |
11022 | sprintf (rmbuf, "%13s", "..."); | |
11023 | rmname = strncpy (rmbuf, rmname, 10); | |
11024 | } | |
11025 | else if (! rmname) | |
11026 | rmname = "<none>"; | |
11027 | vty_out (vty, " %13s ", rmname); | |
11028 | ||
856ca177 | 11029 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); |
fee0f4c6 | 11030 | |
11031 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) | |
11032 | vty_out (vty, " Idle (Admin)"); | |
11033 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
11034 | vty_out (vty, " Idle (PfxCt)"); | |
11035 | else | |
11036 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); | |
11037 | ||
11038 | vty_out (vty, "%s", VTY_NEWLINE); | |
11039 | ||
11040 | return 1; | |
11041 | } | |
11042 | ||
94f2b392 | 11043 | static int |
fd79ac91 | 11044 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
11045 | afi_t afi, safi_t safi) | |
fee0f4c6 | 11046 | { |
11047 | struct peer *peer; | |
1eb8ef25 | 11048 | struct listnode *node, *nnode; |
fee0f4c6 | 11049 | int count = 0; |
11050 | ||
11051 | /* Header string for each address family. */ | |
11052 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; | |
11053 | ||
1eb8ef25 | 11054 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
fee0f4c6 | 11055 | { |
11056 | if (peer->afc[afi][safi] && | |
11057 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
11058 | { | |
11059 | if (! count) | |
11060 | { | |
11061 | vty_out (vty, | |
11062 | "Route Server's BGP router identifier %s%s", | |
11063 | inet_ntoa (bgp->router_id), VTY_NEWLINE); | |
11064 | vty_out (vty, | |
aea339f7 | 11065 | "Route Server's local AS number %u%s", bgp->as, |
fee0f4c6 | 11066 | VTY_NEWLINE); |
11067 | ||
11068 | vty_out (vty, "%s", VTY_NEWLINE); | |
11069 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
11070 | } | |
11071 | ||
11072 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); | |
11073 | } | |
11074 | } | |
11075 | ||
11076 | if (count) | |
11077 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, | |
11078 | count, VTY_NEWLINE); | |
11079 | else | |
11080 | vty_out (vty, "No %s Route Server Client is configured%s", | |
11081 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
11082 | ||
11083 | return CMD_SUCCESS; | |
11084 | } | |
11085 | ||
94f2b392 | 11086 | static int |
fd79ac91 | 11087 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
11088 | afi_t afi, safi_t safi) | |
fee0f4c6 | 11089 | { |
11090 | struct bgp *bgp; | |
11091 | ||
11092 | if (name) | |
11093 | { | |
11094 | bgp = bgp_lookup_by_name (name); | |
11095 | ||
11096 | if (! bgp) | |
11097 | { | |
11098 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
11099 | return CMD_WARNING; | |
11100 | } | |
11101 | ||
11102 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
11103 | return CMD_SUCCESS; | |
11104 | } | |
11105 | ||
11106 | bgp = bgp_get_default (); | |
11107 | ||
11108 | if (bgp) | |
11109 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
11110 | ||
11111 | return CMD_SUCCESS; | |
11112 | } | |
11113 | ||
11114 | /* 'show bgp rsclient' commands. */ | |
11115 | DEFUN (show_ip_bgp_rsclient_summary, | |
11116 | show_ip_bgp_rsclient_summary_cmd, | |
11117 | "show ip bgp rsclient summary", | |
11118 | SHOW_STR | |
11119 | IP_STR | |
11120 | BGP_STR | |
11121 | "Information about Route Server Clients\n" | |
11122 | "Summary of all Route Server Clients\n") | |
11123 | { | |
11124 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
11125 | } | |
11126 | ||
11127 | DEFUN (show_ip_bgp_instance_rsclient_summary, | |
11128 | show_ip_bgp_instance_rsclient_summary_cmd, | |
11129 | "show ip bgp view WORD rsclient summary", | |
11130 | SHOW_STR | |
11131 | IP_STR | |
11132 | BGP_STR | |
11133 | "BGP view\n" | |
11134 | "View name\n" | |
11135 | "Information about Route Server Clients\n" | |
11136 | "Summary of all Route Server Clients\n") | |
11137 | { | |
11138 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
11139 | } | |
11140 | ||
11141 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, | |
11142 | show_ip_bgp_ipv4_rsclient_summary_cmd, | |
11143 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", | |
11144 | SHOW_STR | |
11145 | IP_STR | |
11146 | BGP_STR | |
11147 | "Address family\n" | |
11148 | "Address Family modifier\n" | |
11149 | "Address Family modifier\n" | |
11150 | "Information about Route Server Clients\n" | |
11151 | "Summary of all Route Server Clients\n") | |
11152 | { | |
11153 | if (strncmp (argv[0], "m", 1) == 0) | |
11154 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); | |
11155 | ||
11156 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
11157 | } | |
11158 | ||
11159 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, | |
11160 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, | |
11161 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
11162 | SHOW_STR | |
11163 | IP_STR | |
11164 | BGP_STR | |
11165 | "BGP view\n" | |
11166 | "View name\n" | |
11167 | "Address family\n" | |
11168 | "Address Family modifier\n" | |
11169 | "Address Family modifier\n" | |
11170 | "Information about Route Server Clients\n" | |
11171 | "Summary of all Route Server Clients\n") | |
11172 | { | |
11173 | if (strncmp (argv[1], "m", 1) == 0) | |
11174 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); | |
11175 | ||
11176 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
11177 | } | |
11178 | ||
95cbbd2a ML |
11179 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
11180 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, | |
11181 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
11182 | SHOW_STR | |
11183 | BGP_STR | |
11184 | "BGP view\n" | |
11185 | "View name\n" | |
11186 | "Address family\n" | |
11187 | "Address Family modifier\n" | |
11188 | "Address Family modifier\n" | |
11189 | "Information about Route Server Clients\n" | |
11190 | "Summary of all Route Server Clients\n") | |
11191 | { | |
11192 | safi_t safi; | |
11193 | ||
11194 | if (argc == 2) { | |
11195 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
11196 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); | |
11197 | } else { | |
11198 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
11199 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); | |
11200 | } | |
11201 | } | |
11202 | ||
11203 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, | |
11204 | show_bgp_ipv4_safi_rsclient_summary_cmd, | |
11205 | "show bgp ipv4 (unicast|multicast) rsclient summary", | |
11206 | SHOW_STR | |
11207 | BGP_STR | |
11208 | "Address family\n" | |
11209 | "Address Family modifier\n" | |
11210 | "Address Family modifier\n" | |
11211 | "Information about Route Server Clients\n" | |
11212 | "Summary of all Route Server Clients\n") | |
11213 | ||
fee0f4c6 | 11214 | #ifdef HAVE_IPV6 |
11215 | DEFUN (show_bgp_rsclient_summary, | |
11216 | show_bgp_rsclient_summary_cmd, | |
11217 | "show bgp rsclient summary", | |
11218 | SHOW_STR | |
11219 | BGP_STR | |
11220 | "Information about Route Server Clients\n" | |
11221 | "Summary of all Route Server Clients\n") | |
11222 | { | |
11223 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
11224 | } | |
11225 | ||
11226 | DEFUN (show_bgp_instance_rsclient_summary, | |
11227 | show_bgp_instance_rsclient_summary_cmd, | |
11228 | "show bgp view WORD rsclient summary", | |
11229 | SHOW_STR | |
11230 | BGP_STR | |
11231 | "BGP view\n" | |
11232 | "View name\n" | |
11233 | "Information about Route Server Clients\n" | |
11234 | "Summary of all Route Server Clients\n") | |
11235 | { | |
11236 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); | |
11237 | } | |
11238 | ||
11239 | ALIAS (show_bgp_rsclient_summary, | |
11240 | show_bgp_ipv6_rsclient_summary_cmd, | |
11241 | "show bgp ipv6 rsclient summary", | |
11242 | SHOW_STR | |
11243 | BGP_STR | |
11244 | "Address family\n" | |
11245 | "Information about Route Server Clients\n" | |
11246 | "Summary of all Route Server Clients\n") | |
11247 | ||
11248 | ALIAS (show_bgp_instance_rsclient_summary, | |
11249 | show_bgp_instance_ipv6_rsclient_summary_cmd, | |
11250 | "show bgp view WORD ipv6 rsclient summary", | |
11251 | SHOW_STR | |
11252 | BGP_STR | |
11253 | "BGP view\n" | |
11254 | "View name\n" | |
11255 | "Address family\n" | |
11256 | "Information about Route Server Clients\n" | |
11257 | "Summary of all Route Server Clients\n") | |
95cbbd2a ML |
11258 | |
11259 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, | |
11260 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, | |
11261 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", | |
11262 | SHOW_STR | |
11263 | BGP_STR | |
11264 | "BGP view\n" | |
11265 | "View name\n" | |
11266 | "Address family\n" | |
11267 | "Address Family modifier\n" | |
11268 | "Address Family modifier\n" | |
11269 | "Information about Route Server Clients\n" | |
11270 | "Summary of all Route Server Clients\n") | |
11271 | { | |
11272 | safi_t safi; | |
11273 | ||
11274 | if (argc == 2) { | |
11275 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
11276 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); | |
11277 | } else { | |
11278 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
11279 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); | |
11280 | } | |
11281 | } | |
11282 | ||
11283 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, | |
11284 | show_bgp_ipv6_safi_rsclient_summary_cmd, | |
11285 | "show bgp ipv6 (unicast|multicast) rsclient summary", | |
11286 | SHOW_STR | |
11287 | BGP_STR | |
11288 | "Address family\n" | |
11289 | "Address Family modifier\n" | |
11290 | "Address Family modifier\n" | |
11291 | "Information about Route Server Clients\n" | |
11292 | "Summary of all Route Server Clients\n") | |
11293 | ||
fee0f4c6 | 11294 | #endif /* HAVE IPV6 */ |
6b0655a2 | 11295 | |
8fe8a7f6 DS |
11296 | static int bgp_show_update_groups(int afi, int safi, struct vty *vty, |
11297 | u_int64_t subgrp_id) | |
3f9c7369 DS |
11298 | { |
11299 | struct bgp *bgp; | |
11300 | ||
11301 | bgp = bgp_get_default(); | |
11302 | if (bgp) | |
8fe8a7f6 | 11303 | update_group_show(bgp, afi, safi, vty, subgrp_id); |
3f9c7369 DS |
11304 | return CMD_SUCCESS; |
11305 | } | |
11306 | ||
8fe8a7f6 DS |
11307 | DEFUN (show_ip_bgp_updgrps, |
11308 | show_ip_bgp_updgrps_cmd, | |
11309 | "show ip bgp update-groups", | |
11310 | SHOW_STR | |
11311 | IP_STR | |
11312 | BGP_STR | |
11313 | "Detailed info about dynamic update groups\n") | |
11314 | { | |
11315 | return (bgp_show_update_groups(AFI_IP, SAFI_UNICAST, vty, 0)); | |
11316 | } | |
11317 | ||
3f9c7369 DS |
11318 | DEFUN (show_bgp_ipv6_updgrps, |
11319 | show_bgp_ipv6_updgrps_cmd, | |
8fe8a7f6 | 11320 | "show bgp update-groups", |
3f9c7369 DS |
11321 | SHOW_STR |
11322 | BGP_STR | |
8fe8a7f6 | 11323 | "Detailed info about v6 dynamic update groups\n") |
3f9c7369 | 11324 | { |
8fe8a7f6 | 11325 | return (bgp_show_update_groups(AFI_IP6, SAFI_UNICAST, vty, 0)); |
3f9c7369 DS |
11326 | } |
11327 | ||
11328 | DEFUN (show_bgp_updgrps, | |
11329 | show_bgp_updgrps_cmd, | |
8fe8a7f6 | 11330 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups", |
3f9c7369 DS |
11331 | SHOW_STR |
11332 | BGP_STR | |
11333 | "Address family\n" | |
11334 | "Address family\n" | |
11335 | "Address Family modifier\n" | |
11336 | "Address Family modifier\n" | |
8fe8a7f6 | 11337 | "Detailed info about dynamic update groups\n") |
3f9c7369 | 11338 | { |
3f9c7369 DS |
11339 | afi_t afi; |
11340 | safi_t safi; | |
11341 | ||
11342 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
11343 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8fe8a7f6 DS |
11344 | return (bgp_show_update_groups(afi, safi, vty, 0)); |
11345 | } | |
11346 | ||
11347 | DEFUN (show_ip_bgp_updgrps_s, | |
11348 | show_ip_bgp_updgrps_s_cmd, | |
11349 | "show ip bgp update-groups SUBGROUP-ID", | |
11350 | SHOW_STR | |
11351 | IP_STR | |
11352 | BGP_STR | |
11353 | "Detailed info about dynamic update groups\n" | |
11354 | "Specific subgroup to display detailed info for\n") | |
11355 | { | |
11356 | u_int64_t subgrp_id; | |
11357 | ||
11358 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
11359 | return (bgp_show_update_groups(AFI_IP, SAFI_UNICAST, vty, subgrp_id)); | |
11360 | } | |
11361 | ||
11362 | DEFUN (show_bgp_ipv6_updgrps_s, | |
11363 | show_bgp_ipv6_updgrps_s_cmd, | |
11364 | "show bgp update-groups SUBGROUP-ID", | |
11365 | SHOW_STR | |
11366 | BGP_STR | |
11367 | "Detailed info about v6 dynamic update groups\n" | |
11368 | "Specific subgroup to display detailed info for\n") | |
11369 | { | |
11370 | u_int64_t subgrp_id; | |
11371 | ||
11372 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
11373 | return(bgp_show_update_groups(AFI_IP6, SAFI_UNICAST, vty, subgrp_id)); | |
11374 | } | |
11375 | ||
11376 | DEFUN (show_bgp_updgrps_s, | |
11377 | show_bgp_updgrps_s_cmd, | |
11378 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID", | |
11379 | SHOW_STR | |
11380 | BGP_STR | |
11381 | "Address family\n" | |
11382 | "Address family\n" | |
11383 | "Address Family modifier\n" | |
11384 | "Address Family modifier\n" | |
11385 | "Detailed info about v6 dynamic update groups\n" | |
11386 | "Specific subgroup to display detailed info for") | |
11387 | { | |
11388 | afi_t afi; | |
11389 | safi_t safi; | |
11390 | u_int64_t subgrp_id; | |
11391 | ||
11392 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
11393 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
11394 | ||
11395 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
11396 | return(bgp_show_update_groups(afi, safi, vty, subgrp_id)); | |
3f9c7369 DS |
11397 | } |
11398 | ||
11399 | DEFUN (show_bgp_updgrps_stats, | |
11400 | show_bgp_updgrps_stats_cmd, | |
11401 | "show bgp update-groups statistics", | |
11402 | SHOW_STR | |
11403 | BGP_STR | |
11404 | "BGP update groups\n" | |
11405 | "Statistics\n") | |
11406 | { | |
11407 | struct bgp *bgp; | |
11408 | ||
11409 | bgp = bgp_get_default(); | |
11410 | if (bgp) | |
11411 | update_group_show_stats(bgp, vty); | |
11412 | ||
11413 | return CMD_SUCCESS; | |
11414 | } | |
11415 | ||
11416 | static void | |
11417 | show_bgp_updgrps_adj_info_aux (struct vty *vty, afi_t afi, safi_t safi, | |
11418 | const char *what, u_int64_t subgrp_id) | |
11419 | { | |
11420 | struct bgp *bgp; | |
11421 | bgp = bgp_get_default(); | |
11422 | if (bgp) | |
11423 | { | |
11424 | if (!strcmp(what, "advertise-queue")) | |
11425 | update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id); | |
11426 | else if (!strcmp(what, "advertised-routes")) | |
11427 | update_group_show_advertised(bgp, afi, safi, vty, subgrp_id); | |
11428 | else if (!strcmp(what, "packet-queue")) | |
11429 | update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id); | |
11430 | } | |
11431 | } | |
11432 | ||
11433 | DEFUN (show_ip_bgp_updgrps_adj, | |
11434 | show_ip_bgp_updgrps_adj_cmd, | |
11435 | "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
11436 | SHOW_STR | |
11437 | IP_STR | |
11438 | BGP_STR | |
11439 | "BGP update groups\n" | |
11440 | "Advertisement queue\n" | |
11441 | "Announced routes\n" | |
11442 | "Packet queue\n") | |
8fe8a7f6 | 11443 | |
3f9c7369 DS |
11444 | { |
11445 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP, SAFI_UNICAST, argv[0], 0); | |
11446 | return CMD_SUCCESS; | |
11447 | } | |
11448 | ||
11449 | DEFUN (show_bgp_updgrps_afi_adj, | |
11450 | show_bgp_updgrps_afi_adj_cmd, | |
11451 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)", | |
11452 | SHOW_STR | |
11453 | BGP_STR | |
11454 | "Address family\n" | |
11455 | "Address family\n" | |
11456 | "Address Family modifier\n" | |
11457 | "Address Family modifier\n" | |
11458 | "BGP update groups\n" | |
11459 | "Advertisement queue\n" | |
11460 | "Announced routes\n" | |
8fe8a7f6 DS |
11461 | "Packet queue\n" |
11462 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
11463 | { |
11464 | afi_t afi; | |
11465 | safi_t safi; | |
11466 | ||
11467 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
11468 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
11469 | show_bgp_updgrps_adj_info_aux(vty, afi, safi, argv[2], 0); | |
8fe8a7f6 | 11470 | return CMD_SUCCESS; |
3f9c7369 DS |
11471 | } |
11472 | ||
11473 | DEFUN (show_bgp_updgrps_adj, | |
11474 | show_bgp_updgrps_adj_cmd, | |
11475 | "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
11476 | SHOW_STR | |
11477 | BGP_STR | |
11478 | "BGP update groups\n" | |
11479 | "Advertisement queue\n" | |
11480 | "Announced routes\n" | |
11481 | "Packet queue\n") | |
11482 | { | |
11483 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP6, SAFI_UNICAST, argv[0], 0); | |
11484 | return CMD_SUCCESS; | |
11485 | } | |
11486 | ||
11487 | DEFUN (show_ip_bgp_updgrps_adj_s, | |
8fe8a7f6 | 11488 | show_ip_bgp_updgrps_adj_s_cmd, |
3f9c7369 DS |
11489 | "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
11490 | SHOW_STR | |
11491 | IP_STR | |
11492 | BGP_STR | |
11493 | "BGP update groups\n" | |
8fe8a7f6 | 11494 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
11495 | "Advertisement queue\n" |
11496 | "Announced routes\n" | |
11497 | "Packet queue\n") | |
3f9c7369 | 11498 | |
3f9c7369 | 11499 | { |
8fe8a7f6 DS |
11500 | u_int64_t subgrp_id; |
11501 | ||
11502 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
11503 | ||
11504 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id); | |
3f9c7369 DS |
11505 | return CMD_SUCCESS; |
11506 | } | |
11507 | ||
8fe8a7f6 DS |
11508 | DEFUN (show_bgp_updgrps_afi_adj_s, |
11509 | show_bgp_updgrps_afi_adj_s_cmd, | |
3f9c7369 DS |
11510 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
11511 | SHOW_STR | |
11512 | BGP_STR | |
11513 | "Address family\n" | |
11514 | "Address family\n" | |
11515 | "Address Family modifier\n" | |
11516 | "Address Family modifier\n" | |
11517 | "BGP update groups\n" | |
8fe8a7f6 | 11518 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
11519 | "Advertisement queue\n" |
11520 | "Announced routes\n" | |
8fe8a7f6 DS |
11521 | "Packet queue\n" |
11522 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
11523 | { |
11524 | afi_t afi; | |
11525 | safi_t safi; | |
8fe8a7f6 | 11526 | u_int64_t subgrp_id; |
3f9c7369 DS |
11527 | |
11528 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
11529 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8fe8a7f6 DS |
11530 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); |
11531 | ||
11532 | show_bgp_updgrps_adj_info_aux(vty, afi, safi, argv[3], subgrp_id); | |
11533 | return CMD_SUCCESS; | |
3f9c7369 DS |
11534 | } |
11535 | ||
8fe8a7f6 DS |
11536 | DEFUN (show_bgp_updgrps_adj_s, |
11537 | show_bgp_updgrps_adj_s_cmd, | |
11538 | "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
11539 | SHOW_STR | |
11540 | BGP_STR | |
11541 | "BGP update groups\n" | |
11542 | "Specific subgroup to display info for\n" | |
11543 | "Advertisement queue\n" | |
11544 | "Announced routes\n" | |
11545 | "Packet queue\n") | |
11546 | { | |
11547 | u_int64_t subgrp_id; | |
11548 | ||
11549 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
11550 | ||
11551 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id); | |
11552 | return CMD_SUCCESS; | |
11553 | } | |
11554 | ||
11555 | ||
f14e6fdb DS |
11556 | static int |
11557 | bgp_show_one_peer_group (struct vty *vty, struct peer_group *group) | |
11558 | { | |
11559 | struct listnode *node, *nnode; | |
11560 | struct prefix *range; | |
11561 | struct peer *conf; | |
11562 | struct peer *peer; | |
11563 | char buf[128]; | |
11564 | afi_t afi; | |
11565 | safi_t safi; | |
ffd0c037 DS |
11566 | const char *peer_status; |
11567 | const char *af_str; | |
f14e6fdb DS |
11568 | int lr_count; |
11569 | int dynamic; | |
11570 | int af_cfgd; | |
11571 | ||
11572 | conf = group->conf; | |
11573 | ||
0299c004 DS |
11574 | if (conf->as_type == AS_SPECIFIED || |
11575 | conf->as_type == AS_EXTERNAL) { | |
66b199b2 | 11576 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
f14e6fdb | 11577 | VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE); |
0299c004 | 11578 | } else if (conf->as_type == AS_INTERNAL) { |
66b199b2 | 11579 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
0299c004 | 11580 | VTY_NEWLINE, group->name, group->bgp->as, VTY_NEWLINE); |
66b199b2 DS |
11581 | } else { |
11582 | vty_out (vty, "%sBGP peer-group %s%s", | |
11583 | VTY_NEWLINE, group->name, VTY_NEWLINE); | |
0299c004 | 11584 | } |
f14e6fdb | 11585 | |
0299c004 | 11586 | if ((group->bgp->as == conf->as) || (conf->as_type == AS_INTERNAL)) |
f14e6fdb DS |
11587 | vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE); |
11588 | else | |
11589 | vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE); | |
11590 | ||
11591 | /* Display AFs configured. */ | |
11592 | vty_out (vty, " Configured address-families:"); | |
11593 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
11594 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11595 | { | |
11596 | if (conf->afc[afi][safi]) | |
11597 | { | |
11598 | af_cfgd = 1; | |
11599 | vty_out (vty, " %s;", afi_safi_print(afi, safi)); | |
11600 | } | |
11601 | } | |
11602 | if (!af_cfgd) | |
11603 | vty_out (vty, " none%s", VTY_NEWLINE); | |
11604 | else | |
11605 | vty_out (vty, "%s", VTY_NEWLINE); | |
11606 | ||
11607 | /* Display listen ranges (for dynamic neighbors), if any */ | |
11608 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
11609 | { | |
11610 | if (afi == AFI_IP) | |
11611 | af_str = "IPv4"; | |
11612 | else if (afi == AFI_IP6) | |
11613 | af_str = "IPv6"; | |
11614 | lr_count = listcount(group->listen_range[afi]); | |
11615 | if (lr_count) | |
11616 | { | |
11617 | vty_out(vty, | |
11618 | " %d %s listen range(s)%s", | |
11619 | lr_count, af_str, VTY_NEWLINE); | |
11620 | ||
11621 | ||
11622 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node, | |
11623 | nnode, range)) | |
11624 | { | |
11625 | prefix2str(range, buf, sizeof(buf)); | |
11626 | vty_out(vty, " %s%s", buf, VTY_NEWLINE); | |
11627 | } | |
11628 | } | |
11629 | } | |
11630 | ||
11631 | /* Display group members and their status */ | |
11632 | if (listcount(group->peer)) | |
11633 | { | |
11634 | vty_out (vty, " Peer-group members:%s", VTY_NEWLINE); | |
11635 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
11636 | { | |
11637 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
11638 | peer_status = "Idle (Admin)"; | |
11639 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
11640 | peer_status = "Idle (PfxCt)"; | |
11641 | else | |
11642 | peer_status = LOOKUP(bgp_status_msg, peer->status); | |
11643 | ||
11644 | dynamic = peer_dynamic_neighbor(peer); | |
11645 | vty_out (vty, " %s %s %s %s", | |
11646 | peer->host, dynamic ? "(dynamic)" : "", | |
11647 | peer_status, VTY_NEWLINE); | |
11648 | } | |
11649 | } | |
11650 | ||
11651 | return CMD_SUCCESS; | |
11652 | } | |
11653 | ||
11654 | /* Show BGP peer group's information. */ | |
11655 | enum show_group_type | |
11656 | { | |
11657 | show_all_groups, | |
11658 | show_peer_group | |
11659 | }; | |
11660 | ||
11661 | static int | |
11662 | bgp_show_peer_group (struct vty *vty, struct bgp *bgp, | |
11663 | enum show_group_type type, const char *group_name) | |
11664 | { | |
11665 | struct listnode *node, *nnode; | |
11666 | struct peer_group *group; | |
11667 | int find = 0; | |
11668 | ||
11669 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
11670 | { | |
11671 | switch (type) | |
11672 | { | |
11673 | case show_all_groups: | |
11674 | bgp_show_one_peer_group (vty, group); | |
11675 | break; | |
11676 | case show_peer_group: | |
11677 | if (group_name && (strcmp(group->name, group_name) == 0)) | |
11678 | { | |
11679 | find = 1; | |
11680 | bgp_show_one_peer_group (vty, group); | |
11681 | } | |
11682 | break; | |
11683 | } | |
11684 | } | |
11685 | ||
11686 | if (type == show_peer_group && ! find) | |
11687 | vty_out (vty, "%% No such peer-groupr%s", VTY_NEWLINE); | |
11688 | ||
11689 | return CMD_SUCCESS; | |
11690 | } | |
11691 | ||
11692 | static int | |
11693 | bgp_show_peer_group_vty (struct vty *vty, const char *name, | |
11694 | enum show_group_type type, const char *group_name) | |
11695 | { | |
11696 | struct bgp *bgp; | |
11697 | int ret = CMD_SUCCESS; | |
11698 | ||
11699 | if (name) | |
11700 | { | |
11701 | bgp = bgp_lookup_by_name (name); | |
11702 | ||
11703 | if (! bgp) | |
11704 | { | |
11705 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
11706 | return CMD_WARNING; | |
11707 | } | |
11708 | } | |
11709 | ||
11710 | bgp = bgp_get_default (); | |
11711 | ||
11712 | if (bgp) | |
11713 | ret = bgp_show_peer_group (vty, bgp, type, group_name); | |
11714 | ||
11715 | return ret; | |
11716 | } | |
11717 | ||
11718 | DEFUN (show_ip_bgp_peer_groups, | |
11719 | show_ip_bgp_peer_groups_cmd, | |
11720 | "show ip bgp peer-group", | |
11721 | SHOW_STR | |
11722 | IP_STR | |
11723 | BGP_STR | |
11724 | "Detailed information on all BGP peer groups\n") | |
11725 | { | |
11726 | return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL); | |
11727 | } | |
11728 | ||
11729 | DEFUN (show_ip_bgp_instance_peer_groups, | |
11730 | show_ip_bgp_instance_peer_groups_cmd, | |
11731 | "show ip bgp view WORD peer-group", | |
11732 | SHOW_STR | |
11733 | IP_STR | |
11734 | BGP_STR | |
11735 | "BGP View\n" | |
11736 | "Detailed information on all BGP peer groups\n") | |
11737 | { | |
11738 | return bgp_show_peer_group_vty (vty, argv[0], show_all_groups, NULL); | |
11739 | } | |
11740 | ||
11741 | DEFUN (show_ip_bgp_peer_group, | |
11742 | show_ip_bgp_peer_group_cmd, | |
11743 | "show ip bgp peer-group WORD", | |
11744 | SHOW_STR | |
11745 | IP_STR | |
11746 | BGP_STR | |
11747 | "BGP peer-group name\n" | |
11748 | "Detailed information on a BGP peer group\n") | |
11749 | { | |
11750 | return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]); | |
11751 | } | |
11752 | ||
11753 | DEFUN (show_ip_bgp_instance_peer_group, | |
11754 | show_ip_bgp_instance_peer_group_cmd, | |
11755 | "show ip bgp view WORD peer-group WORD", | |
11756 | SHOW_STR | |
11757 | IP_STR | |
11758 | BGP_STR | |
11759 | "BGP View\n" | |
11760 | "BGP peer-group name\n" | |
11761 | "Detailed information on a BGP peer group\n") | |
11762 | { | |
11763 | return bgp_show_peer_group_vty (vty, argv[0], show_peer_group, argv[1]); | |
11764 | } | |
3f9c7369 | 11765 | |
718e3744 | 11766 | /* Redistribute VTY commands. */ |
11767 | ||
718e3744 | 11768 | DEFUN (bgp_redistribute_ipv4, |
11769 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 11770 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 11771 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11772 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 11773 | { |
11774 | int type; | |
11775 | ||
e0ca5fde DL |
11776 | type = proto_redistnum (AFI_IP, argv[0]); |
11777 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11778 | { |
11779 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11780 | return CMD_WARNING; | |
11781 | } | |
7c8ff89e | 11782 | bgp_redist_add(vty->index, AFI_IP, type, 0); |
8bb0831e | 11783 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 11784 | } |
11785 | ||
11786 | DEFUN (bgp_redistribute_ipv4_rmap, | |
11787 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 11788 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 11789 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11790 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11791 | "Route map reference\n" |
11792 | "Pointer to route-map entries\n") | |
11793 | { | |
11794 | int type; | |
7c8ff89e | 11795 | struct bgp_redist *red; |
718e3744 | 11796 | |
e0ca5fde DL |
11797 | type = proto_redistnum (AFI_IP, argv[0]); |
11798 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11799 | { |
11800 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11801 | return CMD_WARNING; | |
11802 | } | |
11803 | ||
7c8ff89e DS |
11804 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
11805 | bgp_redistribute_rmap_set (red, argv[1]); | |
8bb0831e | 11806 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 11807 | } |
11808 | ||
11809 | DEFUN (bgp_redistribute_ipv4_metric, | |
11810 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 11811 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 11812 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11813 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11814 | "Metric for redistributed routes\n" |
11815 | "Default metric\n") | |
11816 | { | |
11817 | int type; | |
11818 | u_int32_t metric; | |
7c8ff89e | 11819 | struct bgp_redist *red; |
718e3744 | 11820 | |
e0ca5fde DL |
11821 | type = proto_redistnum (AFI_IP, argv[0]); |
11822 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11823 | { |
11824 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11825 | return CMD_WARNING; | |
11826 | } | |
11827 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
11828 | ||
7c8ff89e | 11829 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 11830 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
8bb0831e | 11831 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 11832 | } |
11833 | ||
11834 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
11835 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 11836 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 11837 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11838 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11839 | "Route map reference\n" |
11840 | "Pointer to route-map entries\n" | |
11841 | "Metric for redistributed routes\n" | |
11842 | "Default metric\n") | |
11843 | { | |
11844 | int type; | |
11845 | u_int32_t metric; | |
7c8ff89e | 11846 | struct bgp_redist *red; |
718e3744 | 11847 | |
e0ca5fde DL |
11848 | type = proto_redistnum (AFI_IP, argv[0]); |
11849 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11850 | { |
11851 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11852 | return CMD_WARNING; | |
11853 | } | |
11854 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
11855 | ||
7c8ff89e DS |
11856 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
11857 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 11858 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
8bb0831e | 11859 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 11860 | } |
11861 | ||
11862 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
11863 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 11864 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 11865 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11866 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11867 | "Metric for redistributed routes\n" |
11868 | "Default metric\n" | |
11869 | "Route map reference\n" | |
11870 | "Pointer to route-map entries\n") | |
11871 | { | |
11872 | int type; | |
11873 | u_int32_t metric; | |
7c8ff89e | 11874 | struct bgp_redist *red; |
718e3744 | 11875 | |
e0ca5fde DL |
11876 | type = proto_redistnum (AFI_IP, argv[0]); |
11877 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11878 | { |
11879 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11880 | return CMD_WARNING; | |
11881 | } | |
11882 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
11883 | ||
7c8ff89e | 11884 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 11885 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
7c8ff89e | 11886 | bgp_redistribute_rmap_set (red, argv[2]); |
8bb0831e | 11887 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 11888 | } |
11889 | ||
7c8ff89e DS |
11890 | DEFUN (bgp_redistribute_ipv4_ospf, |
11891 | bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 11892 | "redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
11893 | "Redistribute information from another routing protocol\n" |
11894 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11895 | "Non-main Kernel Routing Table\n" |
11896 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
11897 | { |
11898 | u_short instance; | |
7a4bb9c5 | 11899 | u_short protocol; |
7c8ff89e | 11900 | |
7a4bb9c5 DS |
11901 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
11902 | ||
11903 | if (strncmp(argv[0], "o", 1) == 0) | |
11904 | protocol = ZEBRA_ROUTE_OSPF; | |
11905 | else | |
11906 | protocol = ZEBRA_ROUTE_TABLE; | |
11907 | ||
11908 | bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
8bb0831e | 11909 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
11910 | } |
11911 | ||
11912 | DEFUN (bgp_redistribute_ipv4_ospf_rmap, | |
11913 | bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 11914 | "redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
11915 | "Redistribute information from another routing protocol\n" |
11916 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11917 | "Non-main Kernel Routing Table\n" |
11918 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
11919 | "Route map reference\n" |
11920 | "Pointer to route-map entries\n") | |
11921 | { | |
11922 | struct bgp_redist *red; | |
11923 | u_short instance; | |
7a4bb9c5 | 11924 | int protocol; |
7c8ff89e | 11925 | |
7a4bb9c5 DS |
11926 | if (strncmp(argv[0], "o", 1) == 0) |
11927 | protocol = ZEBRA_ROUTE_OSPF; | |
11928 | else | |
11929 | protocol = ZEBRA_ROUTE_TABLE; | |
11930 | ||
11931 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); | |
11932 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
11933 | bgp_redistribute_rmap_set (red, argv[2]); | |
8bb0831e | 11934 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
11935 | } |
11936 | ||
11937 | DEFUN (bgp_redistribute_ipv4_ospf_metric, | |
11938 | bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 11939 | "redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
11940 | "Redistribute information from another routing protocol\n" |
11941 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11942 | "Non-main Kernel Routing Table\n" |
11943 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
11944 | "Metric for redistributed routes\n" |
11945 | "Default metric\n") | |
11946 | { | |
11947 | u_int32_t metric; | |
11948 | struct bgp_redist *red; | |
11949 | u_short instance; | |
7a4bb9c5 | 11950 | int protocol; |
7c8ff89e | 11951 | |
7a4bb9c5 DS |
11952 | if (strncmp(argv[0], "o", 1) == 0) |
11953 | protocol = ZEBRA_ROUTE_OSPF; | |
11954 | else | |
11955 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 11956 | |
7a4bb9c5 DS |
11957 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
11958 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
11959 | ||
11960 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 11961 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
8bb0831e | 11962 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
11963 | } |
11964 | ||
11965 | DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, | |
11966 | bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 11967 | "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
11968 | "Redistribute information from another routing protocol\n" |
11969 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11970 | "Non-main Kernel Routing Table\n" |
11971 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
11972 | "Route map reference\n" |
11973 | "Pointer to route-map entries\n" | |
11974 | "Metric for redistributed routes\n" | |
11975 | "Default metric\n") | |
11976 | { | |
11977 | u_int32_t metric; | |
11978 | struct bgp_redist *red; | |
11979 | u_short instance; | |
7a4bb9c5 | 11980 | int protocol; |
7c8ff89e | 11981 | |
7a4bb9c5 DS |
11982 | if (strncmp(argv[0], "o", 1) == 0) |
11983 | protocol = ZEBRA_ROUTE_OSPF; | |
11984 | else | |
11985 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 11986 | |
7a4bb9c5 DS |
11987 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
11988 | VTY_GET_INTEGER ("metric", metric, argv[3]); | |
11989 | ||
11990 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
11991 | bgp_redistribute_rmap_set (red, argv[2]); | |
caf958b4 | 11992 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
8bb0831e | 11993 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
11994 | } |
11995 | ||
11996 | DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, | |
11997 | bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 11998 | "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
11999 | "Redistribute information from another routing protocol\n" |
12000 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12001 | "Non-main Kernel Routing Table\n" |
12002 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12003 | "Metric for redistributed routes\n" |
12004 | "Default metric\n" | |
12005 | "Route map reference\n" | |
12006 | "Pointer to route-map entries\n") | |
12007 | { | |
12008 | u_int32_t metric; | |
12009 | struct bgp_redist *red; | |
12010 | u_short instance; | |
7a4bb9c5 | 12011 | int protocol; |
7c8ff89e | 12012 | |
7a4bb9c5 DS |
12013 | if (strncmp(argv[0], "o", 1) == 0) |
12014 | protocol = ZEBRA_ROUTE_OSPF; | |
12015 | else | |
12016 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 12017 | |
7a4bb9c5 DS |
12018 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
12019 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
12020 | ||
12021 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 12022 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
7a4bb9c5 | 12023 | bgp_redistribute_rmap_set (red, argv[3]); |
8bb0831e | 12024 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
12025 | } |
12026 | ||
12027 | DEFUN (no_bgp_redistribute_ipv4_ospf, | |
12028 | no_bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 12029 | "no redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
12030 | NO_STR |
12031 | "Redistribute information from another routing protocol\n" | |
12032 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12033 | "Non-main Kernel Routing Table\n" |
12034 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
12035 | { |
12036 | u_short instance; | |
7a4bb9c5 DS |
12037 | int protocol; |
12038 | ||
12039 | if (strncmp(argv[0], "o", 1) == 0) | |
12040 | protocol = ZEBRA_ROUTE_OSPF; | |
12041 | else | |
12042 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 12043 | |
7a4bb9c5 DS |
12044 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
12045 | return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); | |
7c8ff89e DS |
12046 | } |
12047 | ||
12048 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
12049 | no_bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 12050 | "no redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
12051 | NO_STR |
12052 | "Redistribute information from another routing protocol\n" | |
12053 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12054 | "Non-main Kernel Routing Table\n" |
12055 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12056 | "Route map reference\n" |
12057 | "Pointer to route-map entries\n") | |
12058 | ||
12059 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
12060 | no_bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 12061 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
12062 | NO_STR |
12063 | "Redistribute information from another routing protocol\n" | |
12064 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12065 | "Non-main Kernel Routing Table\n" |
12066 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12067 | "Metric for redistributed routes\n" |
12068 | "Default metric\n") | |
12069 | ||
12070 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
12071 | no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 12072 | "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
12073 | NO_STR |
12074 | "Redistribute information from another routing protocol\n" | |
12075 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12076 | "Non-main Kernel Routing Table\n" |
12077 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12078 | "Route map reference\n" |
12079 | "Pointer to route-map entries\n" | |
12080 | "Metric for redistributed routes\n" | |
12081 | "Default metric\n") | |
12082 | ||
12083 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
12084 | no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 12085 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
12086 | NO_STR |
12087 | "Redistribute information from another routing protocol\n" | |
12088 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12089 | "Non-main Kernel Routing Table\n" |
12090 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12091 | "Metric for redistributed routes\n" |
12092 | "Default metric\n" | |
12093 | "Route map reference\n" | |
12094 | "Pointer to route-map entries\n") | |
12095 | ||
718e3744 | 12096 | DEFUN (no_bgp_redistribute_ipv4, |
12097 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 12098 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 12099 | NO_STR |
12100 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12101 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 12102 | { |
12103 | int type; | |
12104 | ||
e0ca5fde DL |
12105 | type = proto_redistnum (AFI_IP, argv[0]); |
12106 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12107 | { |
12108 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12109 | return CMD_WARNING; | |
12110 | } | |
7c8ff89e | 12111 | return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); |
718e3744 | 12112 | } |
12113 | ||
503006bc | 12114 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 12115 | no_bgp_redistribute_ipv4_rmap_cmd, |
e0ca5fde | 12116 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 12117 | NO_STR |
12118 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12119 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 12120 | "Route map reference\n" |
12121 | "Pointer to route-map entries\n") | |
718e3744 | 12122 | |
503006bc | 12123 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 12124 | no_bgp_redistribute_ipv4_metric_cmd, |
e0ca5fde | 12125 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 12126 | NO_STR |
12127 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12128 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 12129 | "Metric for redistributed routes\n" |
12130 | "Default metric\n") | |
718e3744 | 12131 | |
503006bc | 12132 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 12133 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
e0ca5fde | 12134 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 12135 | NO_STR |
12136 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12137 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 12138 | "Route map reference\n" |
12139 | "Pointer to route-map entries\n" | |
12140 | "Metric for redistributed routes\n" | |
12141 | "Default metric\n") | |
718e3744 | 12142 | |
503006bc | 12143 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 12144 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
e0ca5fde | 12145 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 12146 | NO_STR |
12147 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12148 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 12149 | "Metric for redistributed routes\n" |
12150 | "Default metric\n" | |
12151 | "Route map reference\n" | |
12152 | "Pointer to route-map entries\n") | |
6b0655a2 | 12153 | |
718e3744 | 12154 | #ifdef HAVE_IPV6 |
12155 | DEFUN (bgp_redistribute_ipv6, | |
12156 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 12157 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 12158 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 12159 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 12160 | { |
12161 | int type; | |
12162 | ||
e0ca5fde DL |
12163 | type = proto_redistnum (AFI_IP6, argv[0]); |
12164 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12165 | { |
12166 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12167 | return CMD_WARNING; | |
12168 | } | |
12169 | ||
7c8ff89e | 12170 | bgp_redist_add(vty->index, AFI_IP6, type, 0); |
8bb0831e | 12171 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 12172 | } |
12173 | ||
12174 | DEFUN (bgp_redistribute_ipv6_rmap, | |
12175 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 12176 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 12177 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 12178 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12179 | "Route map reference\n" |
12180 | "Pointer to route-map entries\n") | |
12181 | { | |
12182 | int type; | |
7c8ff89e | 12183 | struct bgp_redist *red; |
718e3744 | 12184 | |
e0ca5fde DL |
12185 | type = proto_redistnum (AFI_IP6, argv[0]); |
12186 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12187 | { |
12188 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12189 | return CMD_WARNING; | |
12190 | } | |
12191 | ||
7c8ff89e DS |
12192 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
12193 | bgp_redistribute_rmap_set (red, argv[1]); | |
8bb0831e | 12194 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 12195 | } |
12196 | ||
12197 | DEFUN (bgp_redistribute_ipv6_metric, | |
12198 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 12199 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 12200 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 12201 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12202 | "Metric for redistributed routes\n" |
12203 | "Default metric\n") | |
12204 | { | |
12205 | int type; | |
12206 | u_int32_t metric; | |
7c8ff89e | 12207 | struct bgp_redist *red; |
718e3744 | 12208 | |
e0ca5fde DL |
12209 | type = proto_redistnum (AFI_IP6, argv[0]); |
12210 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12211 | { |
12212 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12213 | return CMD_WARNING; | |
12214 | } | |
12215 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
12216 | ||
7c8ff89e | 12217 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 12218 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
8bb0831e | 12219 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 12220 | } |
12221 | ||
12222 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
12223 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 12224 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 12225 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 12226 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12227 | "Route map reference\n" |
12228 | "Pointer to route-map entries\n" | |
12229 | "Metric for redistributed routes\n" | |
12230 | "Default metric\n") | |
12231 | { | |
12232 | int type; | |
12233 | u_int32_t metric; | |
7c8ff89e | 12234 | struct bgp_redist *red; |
718e3744 | 12235 | |
e0ca5fde DL |
12236 | type = proto_redistnum (AFI_IP6, argv[0]); |
12237 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12238 | { |
12239 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12240 | return CMD_WARNING; | |
12241 | } | |
12242 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
12243 | ||
7c8ff89e DS |
12244 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
12245 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 12246 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
8bb0831e | 12247 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 12248 | } |
12249 | ||
12250 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
12251 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 12252 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 12253 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 12254 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12255 | "Metric for redistributed routes\n" |
12256 | "Default metric\n" | |
12257 | "Route map reference\n" | |
12258 | "Pointer to route-map entries\n") | |
12259 | { | |
12260 | int type; | |
12261 | u_int32_t metric; | |
7c8ff89e | 12262 | struct bgp_redist *red; |
718e3744 | 12263 | |
e0ca5fde DL |
12264 | type = proto_redistnum (AFI_IP6, argv[0]); |
12265 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12266 | { |
12267 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12268 | return CMD_WARNING; | |
12269 | } | |
12270 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
12271 | ||
7c8ff89e | 12272 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 12273 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric); |
7c8ff89e | 12274 | bgp_redistribute_rmap_set (red, argv[2]); |
8bb0831e | 12275 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 12276 | } |
12277 | ||
12278 | DEFUN (no_bgp_redistribute_ipv6, | |
12279 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 12280 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 12281 | NO_STR |
12282 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12283 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 12284 | { |
12285 | int type; | |
12286 | ||
e0ca5fde DL |
12287 | type = proto_redistnum (AFI_IP6, argv[0]); |
12288 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12289 | { |
12290 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12291 | return CMD_WARNING; | |
12292 | } | |
12293 | ||
7c8ff89e | 12294 | return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0); |
718e3744 | 12295 | } |
12296 | ||
503006bc | 12297 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 12298 | no_bgp_redistribute_ipv6_rmap_cmd, |
e0ca5fde | 12299 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 12300 | NO_STR |
12301 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12302 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12303 | "Route map reference\n" |
12304 | "Pointer to route-map entries\n") | |
718e3744 | 12305 | |
503006bc | 12306 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 12307 | no_bgp_redistribute_ipv6_metric_cmd, |
e0ca5fde | 12308 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 12309 | NO_STR |
12310 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12311 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12312 | "Metric for redistributed routes\n" |
12313 | "Default metric\n") | |
718e3744 | 12314 | |
503006bc | 12315 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 12316 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
e0ca5fde | 12317 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 12318 | NO_STR |
12319 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12320 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12321 | "Route map reference\n" |
12322 | "Pointer to route-map entries\n" | |
12323 | "Metric for redistributed routes\n" | |
12324 | "Default metric\n") | |
718e3744 | 12325 | |
503006bc | 12326 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 12327 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
e0ca5fde | 12328 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 12329 | NO_STR |
12330 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12331 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12332 | "Metric for redistributed routes\n" |
12333 | "Default metric\n" | |
12334 | "Route map reference\n" | |
12335 | "Pointer to route-map entries\n") | |
12336 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 12337 | |
718e3744 | 12338 | int |
12339 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
12340 | safi_t safi, int *write) | |
12341 | { | |
12342 | int i; | |
718e3744 | 12343 | |
12344 | /* Unicast redistribution only. */ | |
12345 | if (safi != SAFI_UNICAST) | |
12346 | return 0; | |
12347 | ||
12348 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
12349 | { | |
12350 | /* Redistribute BGP does not make sense. */ | |
7c8ff89e | 12351 | if (i != ZEBRA_ROUTE_BGP) |
718e3744 | 12352 | { |
7c8ff89e DS |
12353 | struct list *red_list; |
12354 | struct listnode *node; | |
12355 | struct bgp_redist *red; | |
718e3744 | 12356 | |
7c8ff89e DS |
12357 | red_list = bgp->redist[afi][i]; |
12358 | if (!red_list) | |
12359 | continue; | |
718e3744 | 12360 | |
7c8ff89e DS |
12361 | for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) |
12362 | { | |
12363 | /* Display "address-family" when it is not yet diplayed. */ | |
12364 | bgp_config_write_family_header (vty, afi, safi, write); | |
12365 | ||
12366 | /* "redistribute" configuration. */ | |
12367 | vty_out (vty, " redistribute %s", zebra_route_string(i)); | |
12368 | if (red->instance) | |
12369 | vty_out (vty, " %d", red->instance); | |
12370 | if (red->redist_metric_flag) | |
12371 | vty_out (vty, " metric %u", red->redist_metric); | |
12372 | if (red->rmap.name) | |
12373 | vty_out (vty, " route-map %s", red->rmap.name); | |
12374 | vty_out (vty, "%s", VTY_NEWLINE); | |
12375 | } | |
718e3744 | 12376 | } |
12377 | } | |
12378 | return *write; | |
12379 | } | |
6b0655a2 | 12380 | |
718e3744 | 12381 | /* BGP node structure. */ |
7fc626de | 12382 | static struct cmd_node bgp_node = |
718e3744 | 12383 | { |
12384 | BGP_NODE, | |
12385 | "%s(config-router)# ", | |
12386 | 1, | |
12387 | }; | |
12388 | ||
7fc626de | 12389 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 12390 | { |
12391 | BGP_IPV4_NODE, | |
12392 | "%s(config-router-af)# ", | |
12393 | 1, | |
12394 | }; | |
12395 | ||
7fc626de | 12396 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 12397 | { |
12398 | BGP_IPV4M_NODE, | |
12399 | "%s(config-router-af)# ", | |
12400 | 1, | |
12401 | }; | |
12402 | ||
7fc626de | 12403 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 12404 | { |
12405 | BGP_IPV6_NODE, | |
12406 | "%s(config-router-af)# ", | |
12407 | 1, | |
12408 | }; | |
12409 | ||
7fc626de | 12410 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 12411 | { |
12412 | BGP_IPV6M_NODE, | |
12413 | "%s(config-router-af)# ", | |
12414 | 1, | |
12415 | }; | |
12416 | ||
7fc626de | 12417 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 12418 | { |
12419 | BGP_VPNV4_NODE, | |
12420 | "%s(config-router-af)# ", | |
12421 | 1 | |
12422 | }; | |
6b0655a2 | 12423 | |
1f8ae70b | 12424 | static void community_list_vty (void); |
12425 | ||
718e3744 | 12426 | void |
94f2b392 | 12427 | bgp_vty_init (void) |
718e3744 | 12428 | { |
718e3744 | 12429 | /* Install bgp top node. */ |
12430 | install_node (&bgp_node, bgp_config_write); | |
12431 | install_node (&bgp_ipv4_unicast_node, NULL); | |
12432 | install_node (&bgp_ipv4_multicast_node, NULL); | |
12433 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 12434 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 12435 | install_node (&bgp_vpnv4_node, NULL); |
12436 | ||
12437 | /* Install default VTY commands to new nodes. */ | |
12438 | install_default (BGP_NODE); | |
12439 | install_default (BGP_IPV4_NODE); | |
12440 | install_default (BGP_IPV4M_NODE); | |
12441 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 12442 | install_default (BGP_IPV6M_NODE); |
718e3744 | 12443 | install_default (BGP_VPNV4_NODE); |
12444 | ||
12445 | /* "bgp multiple-instance" commands. */ | |
12446 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
12447 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
12448 | ||
12449 | /* "bgp config-type" commands. */ | |
12450 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
12451 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); | |
12452 | ||
12453 | /* Dummy commands (Currently not supported) */ | |
12454 | install_element (BGP_NODE, &no_synchronization_cmd); | |
12455 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
12456 | ||
12457 | /* "router bgp" commands. */ | |
12458 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
12459 | install_element (CONFIG_NODE, &router_bgp_view_cmd); | |
12460 | ||
12461 | /* "no router bgp" commands. */ | |
12462 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
12463 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); | |
12464 | ||
12465 | /* "bgp router-id" commands. */ | |
12466 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
12467 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
12468 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
12469 | ||
12470 | /* "bgp cluster-id" commands. */ | |
12471 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
12472 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
12473 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
12474 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); | |
12475 | ||
12476 | /* "bgp confederation" commands. */ | |
12477 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
12478 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
12479 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
12480 | ||
12481 | /* "bgp confederation peers" commands. */ | |
12482 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
12483 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
12484 | ||
abc920f8 DS |
12485 | /* bgp max-med command */ |
12486 | install_element (BGP_NODE, &bgp_maxmed_admin_cmd); | |
12487 | install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd); | |
12488 | install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); | |
12489 | install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd); | |
12490 | install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); | |
12491 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); | |
12492 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd); | |
12493 | install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); | |
12494 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd); | |
12495 | ||
907f92c8 DS |
12496 | /* bgp disable-ebgp-connected-nh-check */ |
12497 | install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd); | |
12498 | install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd); | |
12499 | ||
f188f2c4 DS |
12500 | /* bgp update-delay command */ |
12501 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
12502 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
12503 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
12504 | install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); | |
12505 | ||
cb1faec9 DS |
12506 | install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); |
12507 | install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); | |
12508 | ||
3f9c7369 DS |
12509 | install_element (BGP_NODE, &bgp_coalesce_time_cmd); |
12510 | install_element (BGP_NODE, &no_bgp_coalesce_time_cmd); | |
12511 | ||
165b5fff JB |
12512 | /* "maximum-paths" commands. */ |
12513 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
12514 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
12515 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); | |
12516 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); | |
12517 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
12518 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); | |
431aa9f9 DS |
12519 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
12520 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
12521 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); | |
165b5fff | 12522 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 12523 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff JB |
12524 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
12525 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 12526 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 12527 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 12528 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 12529 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
5e242b0d | 12530 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 12531 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
431aa9f9 | 12532 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 12533 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 DS |
12534 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
12535 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 12536 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 12537 | |
718e3744 | 12538 | /* "timers bgp" commands. */ |
12539 | install_element (BGP_NODE, &bgp_timers_cmd); | |
12540 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
12541 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
12542 | ||
518f0eb1 DS |
12543 | /* route-map delay-timer commands */ |
12544 | install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd); | |
12545 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
f414725f | 12546 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); |
518f0eb1 | 12547 | |
718e3744 | 12548 | /* "bgp client-to-client reflection" commands */ |
12549 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
12550 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
12551 | ||
12552 | /* "bgp always-compare-med" commands */ | |
12553 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
12554 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
12555 | ||
12556 | /* "bgp deterministic-med" commands */ | |
12557 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
12558 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 12559 | |
538621f2 | 12560 | /* "bgp graceful-restart" commands */ |
12561 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
12562 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 12563 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
12564 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
12565 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 12566 | |
12567 | /* "bgp fast-external-failover" commands */ | |
12568 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
12569 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
12570 | ||
12571 | /* "bgp enforce-first-as" commands */ | |
12572 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
12573 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
12574 | ||
12575 | /* "bgp bestpath compare-routerid" commands */ | |
12576 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
12577 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
12578 | ||
12579 | /* "bgp bestpath as-path ignore" commands */ | |
12580 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
12581 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
12582 | ||
6811845b | 12583 | /* "bgp bestpath as-path confed" commands */ |
12584 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
12585 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
12586 | ||
2fdd455c PM |
12587 | /* "bgp bestpath as-path multipath-relax" commands */ |
12588 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
12589 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
12590 | ||
16fc1eec DS |
12591 | /* "bgp bestpath as-path multipath-relax no-as-set" commands */ |
12592 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_no_as_set_cmd); | |
12593 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_no_as_set_cmd); | |
12594 | ||
848973c7 | 12595 | /* "bgp log-neighbor-changes" commands */ |
12596 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
12597 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
12598 | ||
718e3744 | 12599 | /* "bgp bestpath med" commands */ |
12600 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
12601 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
12602 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
12603 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
12604 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
12605 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
12606 | ||
12607 | /* "no bgp default ipv4-unicast" commands. */ | |
12608 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
12609 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
12610 | ||
12611 | /* "bgp network import-check" commands. */ | |
12612 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
12613 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); | |
12614 | ||
12615 | /* "bgp default local-preference" commands. */ | |
12616 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
12617 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
12618 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
12619 | ||
3f9c7369 DS |
12620 | /* "bgp default subgroup-pkt-queue-max" commands. */ |
12621 | install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd); | |
12622 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd); | |
12623 | ||
8bd9d948 DS |
12624 | /* bgp ibgp-allow-policy-mods command */ |
12625 | install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd); | |
12626 | install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd); | |
12627 | ||
f14e6fdb DS |
12628 | /* "bgp listen limit" commands. */ |
12629 | install_element (BGP_NODE, &bgp_listen_limit_cmd); | |
12630 | install_element (BGP_NODE, &no_bgp_listen_limit_cmd); | |
12631 | ||
12632 | /* "bgp listen range" commands. */ | |
12633 | install_element (BGP_NODE, &bgp_listen_range_cmd); | |
12634 | install_element (BGP_NODE, &no_bgp_listen_range_cmd); | |
12635 | ||
718e3744 | 12636 | /* "neighbor remote-as" commands. */ |
12637 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
a80beece | 12638 | install_element (BGP_NODE, &neighbor_interface_config_cmd); |
718e3744 | 12639 | install_element (BGP_NODE, &no_neighbor_cmd); |
12640 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
a80beece | 12641 | install_element (BGP_NODE, &no_neighbor_interface_config_cmd); |
718e3744 | 12642 | |
12643 | /* "neighbor peer-group" commands. */ | |
12644 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
12645 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
a80beece | 12646 | install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd); |
718e3744 | 12647 | |
12648 | /* "neighbor local-as" commands. */ | |
12649 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
12650 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 12651 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 12652 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
12653 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
12654 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
9d3f9705 | 12655 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
718e3744 | 12656 | |
3f9c7369 DS |
12657 | /* "neighbor solo" commands. */ |
12658 | install_element (BGP_NODE, &neighbor_solo_cmd); | |
12659 | install_element (BGP_NODE, &no_neighbor_solo_cmd); | |
12660 | ||
0df7c91f PJ |
12661 | /* "neighbor password" commands. */ |
12662 | install_element (BGP_NODE, &neighbor_password_cmd); | |
12663 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
12664 | ||
718e3744 | 12665 | /* "neighbor activate" commands. */ |
12666 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
12667 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
12668 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
12669 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 12670 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 12671 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
12672 | ||
12673 | /* "no neighbor activate" commands. */ | |
12674 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
12675 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
12676 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
12677 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 12678 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 12679 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
12680 | ||
12681 | /* "neighbor peer-group set" commands. */ | |
12682 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); | |
12683 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
12684 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
12685 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 12686 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 12687 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
12688 | ||
718e3744 | 12689 | /* "no neighbor peer-group unset" commands. */ |
12690 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
12691 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
12692 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
12693 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 12694 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 12695 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
12696 | ||
718e3744 | 12697 | /* "neighbor softreconfiguration inbound" commands.*/ |
12698 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
12699 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
12700 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
12701 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
12702 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
12703 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
12704 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
12705 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 12706 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
12707 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 12708 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
12709 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 12710 | |
12711 | /* "neighbor attribute-unchanged" commands. */ | |
12712 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
12713 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
12714 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
12715 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
12716 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
12717 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
12718 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
12719 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
12720 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
12721 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
12722 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
12723 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
12724 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12725 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12726 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12727 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12728 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12729 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12730 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12731 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12732 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12733 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
12734 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
12735 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
12736 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
12737 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
12738 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
12739 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
12740 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
12741 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
12742 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
12743 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
12744 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
12745 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
12746 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12747 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12748 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12749 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12750 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12751 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12752 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12753 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12754 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12755 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
12756 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
12757 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
12758 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
12759 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
12760 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
12761 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
12762 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
12763 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
12764 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
12765 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
12766 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
12767 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
12768 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12769 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12770 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12771 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12772 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12773 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12774 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12775 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12776 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12777 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
12778 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
12779 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
12780 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
12781 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
12782 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
12783 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
12784 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
12785 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
12786 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
12787 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
12788 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
12789 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
12790 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12791 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12792 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12793 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12794 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12795 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12796 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12797 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12798 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12799 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 12800 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
12801 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
12802 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
12803 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
12804 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
12805 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
12806 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
12807 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
12808 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
12809 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
12810 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
12811 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
12812 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12813 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12814 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12815 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12816 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12817 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12818 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12819 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12820 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12821 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 12822 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
12823 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
12824 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
12825 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
12826 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
12827 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
12828 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
12829 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
12830 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
12831 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
12832 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
12833 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
12834 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12835 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12836 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12837 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12838 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12839 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12840 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12841 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12842 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12843 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
12844 | ||
fee0f4c6 | 12845 | /* "nexthop-local unchanged" commands */ |
12846 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
12847 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
12848 | ||
718e3744 | 12849 | /* "transparent-as" and "transparent-nexthop" for old version |
12850 | compatibility. */ | |
12851 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); | |
12852 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); | |
12853 | ||
12854 | /* "neighbor next-hop-self" commands. */ | |
12855 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
12856 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
12857 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
12858 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
12859 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
12860 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
12861 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
12862 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 12863 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
12864 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 12865 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
12866 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
12867 | ||
a538debe DS |
12868 | /* "neighbor next-hop-self force" commands. */ |
12869 | install_element (BGP_NODE, &neighbor_nexthop_self_force_cmd); | |
12870 | install_element (BGP_NODE, &no_neighbor_nexthop_self_force_cmd); | |
12871 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd); | |
12872 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
12873 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd); | |
12874 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
12875 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd); | |
12876 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
12877 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd); | |
12878 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
12879 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd); | |
12880 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
12881 | ||
c7122e14 DS |
12882 | /* "neighbor as-override" commands. */ |
12883 | install_element (BGP_NODE, &neighbor_as_override_cmd); | |
12884 | install_element (BGP_NODE, &no_neighbor_as_override_cmd); | |
12885 | install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd); | |
12886 | install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd); | |
12887 | install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd); | |
12888 | install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd); | |
12889 | install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd); | |
12890 | install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd); | |
12891 | install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd); | |
12892 | install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd); | |
12893 | install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd); | |
12894 | install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd); | |
12895 | ||
718e3744 | 12896 | /* "neighbor remove-private-AS" commands. */ |
12897 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
12898 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
12899 | install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd); |
12900 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd); | |
12901 | install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
12902 | install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
12903 | install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
12904 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 12905 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
12906 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
12907 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd); |
12908 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
12909 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
12910 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
12911 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
12912 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 12913 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
12914 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
12915 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd); |
12916 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
12917 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
12918 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
12919 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
12920 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 12921 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
12922 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
12923 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd); |
12924 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
12925 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
12926 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
12927 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
12928 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
25ffbdc1 | 12929 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
12930 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
12931 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd); |
12932 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
12933 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
12934 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
12935 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
12936 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 12937 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
12938 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
12939 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd); |
12940 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
12941 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
12942 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
12943 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
12944 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 12945 | |
12946 | /* "neighbor send-community" commands.*/ | |
12947 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
12948 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
12949 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
12950 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
12951 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
12952 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
12953 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
12954 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
12955 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
12956 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
12957 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
12958 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
12959 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
12960 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
12961 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
12962 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 12963 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
12964 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
12965 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
12966 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 12967 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
12968 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
12969 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
12970 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
12971 | ||
12972 | /* "neighbor route-reflector" commands.*/ | |
12973 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
12974 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
12975 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
12976 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
12977 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
12978 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
12979 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
12980 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 12981 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
12982 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 12983 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
12984 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
12985 | ||
12986 | /* "neighbor route-server" commands.*/ | |
12987 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
12988 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
12989 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
12990 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
12991 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
12992 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
12993 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
12994 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 12995 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
12996 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 12997 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
12998 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
12999 | ||
13000 | /* "neighbor passive" commands. */ | |
13001 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
13002 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
13003 | ||
d5a5c8f0 | 13004 | |
718e3744 | 13005 | /* "neighbor shutdown" commands. */ |
13006 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
13007 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
13008 | ||
c9502438 | 13009 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
718e3744 | 13010 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
13011 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); | |
13012 | ||
8a92a8a0 DS |
13013 | /* "neighbor capability extended-nexthop" commands.*/ |
13014 | install_element (BGP_NODE, &neighbor_capability_enhe_cmd); | |
13015 | install_element (BGP_NODE, &no_neighbor_capability_enhe_cmd); | |
13016 | ||
718e3744 | 13017 | /* "neighbor capability orf prefix-list" commands.*/ |
13018 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
13019 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
13020 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
13021 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
13022 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
13023 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
13024 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
13025 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 13026 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
13027 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 13028 | |
13029 | /* "neighbor capability dynamic" commands.*/ | |
13030 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
13031 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
13032 | ||
13033 | /* "neighbor dont-capability-negotiate" commands. */ | |
13034 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
13035 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
13036 | ||
13037 | /* "neighbor ebgp-multihop" commands. */ | |
13038 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
13039 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
13040 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
13041 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
13042 | ||
6ffd2079 | 13043 | /* "neighbor disable-connected-check" commands. */ |
13044 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
13045 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 13046 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
13047 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
13048 | ||
13049 | /* "neighbor description" commands. */ | |
13050 | install_element (BGP_NODE, &neighbor_description_cmd); | |
13051 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
13052 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
13053 | ||
13054 | /* "neighbor update-source" commands. "*/ | |
13055 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
13056 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
13057 | ||
13058 | /* "neighbor default-originate" commands. */ | |
13059 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
13060 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
13061 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
13062 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
13063 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
13064 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
13065 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
13066 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
13067 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
13068 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
13069 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
13070 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
13071 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
13072 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
13073 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
13074 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 13075 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
13076 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
13077 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
13078 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 13079 | |
13080 | /* "neighbor port" commands. */ | |
13081 | install_element (BGP_NODE, &neighbor_port_cmd); | |
13082 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
13083 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
13084 | ||
13085 | /* "neighbor weight" commands. */ | |
13086 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
13087 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
13088 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
13089 | ||
13090 | /* "neighbor override-capability" commands. */ | |
13091 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
13092 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
13093 | ||
13094 | /* "neighbor strict-capability-match" commands. */ | |
13095 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
13096 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
13097 | ||
13098 | /* "neighbor timers" commands. */ | |
13099 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
13100 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
13101 | ||
13102 | /* "neighbor timers connect" commands. */ | |
13103 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
13104 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
13105 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
13106 | ||
13107 | /* "neighbor advertisement-interval" commands. */ | |
13108 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
13109 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
13110 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
13111 | ||
13112 | /* "neighbor version" commands. */ | |
13113 | install_element (BGP_NODE, &neighbor_version_cmd); | |
718e3744 | 13114 | |
13115 | /* "neighbor interface" commands. */ | |
13116 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
13117 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
13118 | ||
13119 | /* "neighbor distribute" commands. */ | |
13120 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
13121 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
13122 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
13123 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
13124 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
13125 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
13126 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
13127 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 13128 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
13129 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 13130 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
13131 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
13132 | ||
13133 | /* "neighbor prefix-list" commands. */ | |
13134 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
13135 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
13136 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
13137 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
13138 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
13139 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
13140 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
13141 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 13142 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
13143 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 13144 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
13145 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
13146 | ||
13147 | /* "neighbor filter-list" commands. */ | |
13148 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
13149 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
13150 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
13151 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
13152 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
13153 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
13154 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
13155 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 13156 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
13157 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 13158 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
13159 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
13160 | ||
13161 | /* "neighbor route-map" commands. */ | |
13162 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
13163 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
13164 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
13165 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
13166 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
13167 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
13168 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
13169 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 13170 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
13171 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 13172 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
13173 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
13174 | ||
13175 | /* "neighbor unsuppress-map" commands. */ | |
13176 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
13177 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
13178 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
13179 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
13180 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
13181 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
13182 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
13183 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 13184 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
13185 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 13186 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
13187 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 13188 | |
13189 | /* "neighbor maximum-prefix" commands. */ | |
13190 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 13191 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 13192 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 13193 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 13194 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
13195 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13196 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
13197 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 13198 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
13199 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
13200 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
13201 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
13202 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13203 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 13204 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 13205 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 13206 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 13207 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
13208 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13209 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
13210 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 13211 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
13212 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
13213 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
13214 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
13215 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13216 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 13217 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 13218 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 13219 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 13220 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
13221 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13222 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
13223 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 13224 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
13225 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
13226 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
13227 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
13228 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13229 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 13230 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 13231 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 13232 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 13233 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
13234 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13235 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
13236 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 13237 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
13238 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
13239 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
13240 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
13241 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 13242 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
13243 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
13244 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
13245 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
13246 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
13247 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
13248 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
13249 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
13250 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
13251 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
13252 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
13253 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
13254 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13255 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 13256 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 13257 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 13258 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 13259 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
13260 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13261 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
13262 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 13263 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
13264 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
13265 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
13266 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
13267 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13268 | |
13269 | /* "neighbor allowas-in" */ | |
13270 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
13271 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
13272 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
13273 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); | |
13274 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
13275 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
13276 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); | |
13277 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
13278 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
13279 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); | |
13280 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
13281 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
25ffbdc1 | 13282 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
13283 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
13284 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
718e3744 | 13285 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
13286 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
13287 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
13288 | ||
13289 | /* address-family commands. */ | |
13290 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
13291 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
13292 | #ifdef HAVE_IPV6 | |
13293 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 13294 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 13295 | #endif /* HAVE_IPV6 */ |
13296 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
13297 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
13298 | ||
13299 | /* "exit-address-family" command. */ | |
13300 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
13301 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
13302 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 13303 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 13304 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
13305 | ||
13306 | /* "clear ip bgp commands" */ | |
13307 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
13308 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
13309 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
13310 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); | |
13311 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); | |
13312 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); | |
13313 | #ifdef HAVE_IPV6 | |
13314 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); | |
13315 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
13316 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
13317 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); | |
13318 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); | |
13319 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); | |
13320 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); | |
13321 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); | |
13322 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); | |
13323 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); | |
13324 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); | |
13325 | #endif /* HAVE_IPV6 */ | |
13326 | ||
13327 | /* "clear ip bgp neighbor soft in" */ | |
13328 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
13329 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
13330 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
13331 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); | |
13332 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); | |
13333 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); | |
13334 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); | |
13335 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); | |
13336 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
13337 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); | |
13338 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); | |
13339 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
13340 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); | |
13341 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); | |
13342 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
13343 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); | |
13344 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); | |
13345 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
13346 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
13347 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
13348 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); | |
13349 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); | |
13350 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); | |
13351 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); | |
13352 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); | |
13353 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
13354 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); | |
13355 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); | |
13356 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
13357 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); | |
13358 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); | |
13359 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
13360 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); | |
13361 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); | |
13362 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
13363 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
13364 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
13365 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
13366 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
13367 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
13368 | #ifdef HAVE_IPV6 | |
13369 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); | |
13370 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
13371 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
13372 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); | |
13373 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
13374 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); | |
13375 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); | |
13376 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
13377 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); | |
13378 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); | |
13379 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
13380 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); | |
13381 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); | |
13382 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
13383 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); | |
13384 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); | |
13385 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
13386 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); | |
13387 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); | |
13388 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
13389 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); | |
13390 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); | |
13391 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
13392 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); | |
13393 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); | |
13394 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
13395 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); | |
13396 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); | |
13397 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
13398 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); | |
13399 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); | |
13400 | #endif /* HAVE_IPV6 */ | |
13401 | ||
8ad7271d DS |
13402 | /* clear ip bgp prefix */ |
13403 | install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); | |
13404 | install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); | |
13405 | ||
718e3744 | 13406 | /* "clear ip bgp neighbor soft out" */ |
13407 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
13408 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
13409 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
13410 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); | |
13411 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); | |
13412 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); | |
13413 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); | |
13414 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); | |
13415 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); | |
13416 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); | |
13417 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); | |
13418 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); | |
13419 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
13420 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
13421 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); | |
13422 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); | |
13423 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); | |
13424 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); | |
13425 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); | |
13426 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); | |
13427 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); | |
13428 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); | |
13429 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); | |
13430 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
13431 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
13432 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
13433 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
13434 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
13435 | #ifdef HAVE_IPV6 | |
13436 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); | |
13437 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
13438 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
13439 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); | |
13440 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); | |
13441 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); | |
13442 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); | |
13443 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); | |
13444 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); | |
13445 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); | |
13446 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); | |
13447 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); | |
13448 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); | |
13449 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); | |
13450 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); | |
13451 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); | |
13452 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); | |
13453 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); | |
13454 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); | |
13455 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); | |
13456 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); | |
13457 | #endif /* HAVE_IPV6 */ | |
13458 | ||
13459 | /* "clear ip bgp neighbor soft" */ | |
13460 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
13461 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
13462 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
13463 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); | |
13464 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); | |
13465 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); | |
13466 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); | |
13467 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
13468 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
13469 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); | |
13470 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); | |
13471 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); | |
13472 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); | |
13473 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
13474 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
13475 | #ifdef HAVE_IPV6 | |
13476 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); | |
13477 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
13478 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
13479 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); | |
13480 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); | |
13481 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); | |
13482 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); | |
13483 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); | |
13484 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); | |
13485 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); | |
13486 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); | |
13487 | #endif /* HAVE_IPV6 */ | |
13488 | ||
fee0f4c6 | 13489 | /* "clear ip bgp neighbor rsclient" */ |
13490 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); | |
13491 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); | |
13492 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); | |
13493 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); | |
13494 | #ifdef HAVE_IPV6 | |
13495 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); | |
13496 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); | |
13497 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); | |
13498 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); | |
13499 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); | |
13500 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); | |
13501 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); | |
13502 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); | |
13503 | #endif /* HAVE_IPV6 */ | |
13504 | ||
718e3744 | 13505 | /* "show ip bgp summary" commands. */ |
13506 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
13507 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); |
13508 | install_element (VIEW_NODE, &show_bgp_updgrps_cmd); | |
13509 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8fe8a7f6 DS |
13510 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd); |
13511 | install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd); | |
13512 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
3f9c7369 DS |
13513 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); |
13514 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd); | |
13515 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
8fe8a7f6 DS |
13516 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
13517 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd); | |
13518 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd); | |
718e3744 | 13519 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
13520 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 13521 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 13522 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 13523 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 13524 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
13525 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
13526 | #ifdef HAVE_IPV6 | |
13527 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
13528 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); | |
13529 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 13530 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 13531 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 13532 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
13533 | #endif /* HAVE_IPV6 */ |
13534 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
13535 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); |
13536 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd); | |
13537 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8fe8a7f6 DS |
13538 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd); |
13539 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd); | |
13540 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
3f9c7369 DS |
13541 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd); |
13542 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd); | |
13543 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
8fe8a7f6 DS |
13544 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
13545 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd); | |
13546 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd); | |
62687ff1 PJ |
13547 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
13548 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 13549 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
62687ff1 | 13550 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 13551 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
62687ff1 PJ |
13552 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
13553 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
13554 | #ifdef HAVE_IPV6 | |
13555 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
13556 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); | |
13557 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 13558 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
62687ff1 | 13559 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 13560 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 13561 | #endif /* HAVE_IPV6 */ |
13562 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
13563 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); |
13564 | install_element (ENABLE_NODE, &show_bgp_updgrps_cmd); | |
13565 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8fe8a7f6 DS |
13566 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd); |
13567 | install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd); | |
13568 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
3f9c7369 DS |
13569 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd); |
13570 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd); | |
13571 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
8fe8a7f6 DS |
13572 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
13573 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd); | |
13574 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd); | |
718e3744 | 13575 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
13576 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 13577 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 13578 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 13579 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 13580 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
13581 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
13582 | #ifdef HAVE_IPV6 | |
13583 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
13584 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); | |
13585 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 13586 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 13587 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 13588 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 13589 | #endif /* HAVE_IPV6 */ |
13590 | ||
13591 | /* "show ip bgp neighbors" commands. */ | |
13592 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
13593 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
13594 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
13595 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
13596 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
13597 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
13598 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
13599 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
13600 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
13601 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
62687ff1 PJ |
13602 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
13603 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
13604 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
13605 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
13606 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 13607 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
13608 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
13609 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
13610 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
13611 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
13612 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
13613 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
13614 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
13615 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
13616 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
13617 | ||
13618 | #ifdef HAVE_IPV6 | |
13619 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
13620 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
13621 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
13622 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 13623 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
13624 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
13625 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
13626 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
13627 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
13628 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
13629 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
13630 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 13631 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
13632 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
13633 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
13634 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 13635 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
13636 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
13637 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
13638 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 13639 | |
13640 | /* Old commands. */ | |
13641 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
13642 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
13643 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
13644 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
13645 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 13646 | |
f14e6fdb DS |
13647 | /* "show ip bgp peer-group" commands. */ |
13648 | install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); | |
13649 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
13650 | install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd); | |
13651 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
13652 | install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd); | |
13653 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
13654 | install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd); | |
13655 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
13656 | ||
fee0f4c6 | 13657 | /* "show ip bgp rsclient" commands. */ |
13658 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); | |
13659 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
13660 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
13661 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
13662 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
13663 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
13664 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
13665 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
13666 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
13667 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
13668 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
13669 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 13670 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
13671 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
13672 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
13673 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
13674 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
13675 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 13676 | |
13677 | #ifdef HAVE_IPV6 | |
13678 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); | |
13679 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
13680 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
13681 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
13682 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
13683 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
13684 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
13685 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
13686 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
13687 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
13688 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
13689 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 13690 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
13691 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
13692 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
13693 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
13694 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
13695 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 13696 | #endif /* HAVE_IPV6 */ |
718e3744 | 13697 | |
13698 | /* "show ip bgp paths" commands. */ | |
13699 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
13700 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
13701 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
13702 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
13703 | ||
13704 | /* "show ip bgp community" commands. */ | |
13705 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
13706 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
13707 | ||
13708 | /* "show ip bgp attribute-info" commands. */ | |
13709 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
13710 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
13711 | ||
13712 | /* "redistribute" commands. */ | |
13713 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
13714 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
13715 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
13716 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
13717 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
13718 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
13719 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
13720 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
13721 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
13722 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
7c8ff89e DS |
13723 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd); |
13724 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
13725 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
13726 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
13727 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
13728 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
13729 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
13730 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
13731 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
13732 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
718e3744 | 13733 | #ifdef HAVE_IPV6 |
13734 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
13735 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
13736 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
13737 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
13738 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
13739 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
13740 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
13741 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
13742 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
13743 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
13744 | #endif /* HAVE_IPV6 */ | |
13745 | ||
fa411a21 NH |
13746 | /* ttl_security commands */ |
13747 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
13748 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
13749 | ||
4bf6a362 PJ |
13750 | /* "show bgp memory" commands. */ |
13751 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 13752 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
13753 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
13754 | ||
e0081f70 ML |
13755 | /* "show bgp views" commands. */ |
13756 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
13757 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
13758 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
13759 | ||
718e3744 | 13760 | /* Community-list. */ |
13761 | community_list_vty (); | |
13762 | } | |
6b0655a2 | 13763 | |
718e3744 | 13764 | #include "memory.h" |
13765 | #include "bgp_regex.h" | |
13766 | #include "bgp_clist.h" | |
13767 | #include "bgp_ecommunity.h" | |
13768 | ||
13769 | /* VTY functions. */ | |
13770 | ||
13771 | /* Direction value to string conversion. */ | |
94f2b392 | 13772 | static const char * |
718e3744 | 13773 | community_direct_str (int direct) |
13774 | { | |
13775 | switch (direct) | |
13776 | { | |
13777 | case COMMUNITY_DENY: | |
13778 | return "deny"; | |
718e3744 | 13779 | case COMMUNITY_PERMIT: |
13780 | return "permit"; | |
718e3744 | 13781 | default: |
13782 | return "unknown"; | |
718e3744 | 13783 | } |
13784 | } | |
13785 | ||
13786 | /* Display error string. */ | |
94f2b392 | 13787 | static void |
718e3744 | 13788 | community_list_perror (struct vty *vty, int ret) |
13789 | { | |
13790 | switch (ret) | |
13791 | { | |
13792 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 13793 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 13794 | break; |
13795 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
13796 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
13797 | break; | |
13798 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
13799 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
13800 | break; | |
13801 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
13802 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
13803 | break; | |
13804 | } | |
13805 | } | |
13806 | ||
13807 | /* VTY interface for community_set() function. */ | |
94f2b392 | 13808 | static int |
fd79ac91 | 13809 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
13810 | int style, int reject_all_digit_name) | |
718e3744 | 13811 | { |
13812 | int ret; | |
13813 | int direct; | |
13814 | char *str; | |
13815 | ||
13816 | /* Check the list type. */ | |
13817 | if (strncmp (argv[1], "p", 1) == 0) | |
13818 | direct = COMMUNITY_PERMIT; | |
13819 | else if (strncmp (argv[1], "d", 1) == 0) | |
13820 | direct = COMMUNITY_DENY; | |
13821 | else | |
13822 | { | |
13823 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
13824 | VTY_NEWLINE); | |
13825 | return CMD_WARNING; | |
13826 | } | |
13827 | ||
13828 | /* All digit name check. */ | |
13829 | if (reject_all_digit_name && all_digit (argv[0])) | |
13830 | { | |
13831 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
13832 | return CMD_WARNING; | |
13833 | } | |
13834 | ||
13835 | /* Concat community string argument. */ | |
13836 | if (argc > 1) | |
13837 | str = argv_concat (argv, argc, 2); | |
13838 | else | |
13839 | str = NULL; | |
13840 | ||
13841 | /* When community_list_set() return nevetive value, it means | |
13842 | malformed community string. */ | |
13843 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
13844 | ||
13845 | /* Free temporary community list string allocated by | |
13846 | argv_concat(). */ | |
13847 | if (str) | |
13848 | XFREE (MTYPE_TMP, str); | |
13849 | ||
13850 | if (ret < 0) | |
13851 | { | |
13852 | /* Display error string. */ | |
13853 | community_list_perror (vty, ret); | |
13854 | return CMD_WARNING; | |
13855 | } | |
13856 | ||
13857 | return CMD_SUCCESS; | |
13858 | } | |
13859 | ||
718e3744 | 13860 | /* Communiyt-list entry delete. */ |
94f2b392 | 13861 | static int |
fee6e4e4 | 13862 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
13863 | int style) | |
718e3744 | 13864 | { |
13865 | int ret; | |
fee6e4e4 | 13866 | int direct = 0; |
13867 | char *str = NULL; | |
718e3744 | 13868 | |
fee6e4e4 | 13869 | if (argc > 1) |
718e3744 | 13870 | { |
fee6e4e4 | 13871 | /* Check the list direct. */ |
13872 | if (strncmp (argv[1], "p", 1) == 0) | |
13873 | direct = COMMUNITY_PERMIT; | |
13874 | else if (strncmp (argv[1], "d", 1) == 0) | |
13875 | direct = COMMUNITY_DENY; | |
13876 | else | |
13877 | { | |
13878 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
13879 | VTY_NEWLINE); | |
13880 | return CMD_WARNING; | |
13881 | } | |
718e3744 | 13882 | |
fee6e4e4 | 13883 | /* Concat community string argument. */ |
13884 | str = argv_concat (argv, argc, 2); | |
13885 | } | |
718e3744 | 13886 | |
13887 | /* Unset community list. */ | |
13888 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); | |
13889 | ||
13890 | /* Free temporary community list string allocated by | |
13891 | argv_concat(). */ | |
fee6e4e4 | 13892 | if (str) |
13893 | XFREE (MTYPE_TMP, str); | |
718e3744 | 13894 | |
13895 | if (ret < 0) | |
13896 | { | |
13897 | community_list_perror (vty, ret); | |
13898 | return CMD_WARNING; | |
13899 | } | |
13900 | ||
13901 | return CMD_SUCCESS; | |
13902 | } | |
13903 | ||
13904 | /* "community-list" keyword help string. */ | |
13905 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
13906 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" | |
13907 | ||
718e3744 | 13908 | DEFUN (ip_community_list_standard, |
13909 | ip_community_list_standard_cmd, | |
13910 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
13911 | IP_STR | |
13912 | COMMUNITY_LIST_STR | |
13913 | "Community list number (standard)\n" | |
13914 | "Specify community to reject\n" | |
13915 | "Specify community to accept\n" | |
13916 | COMMUNITY_VAL_STR) | |
13917 | { | |
13918 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
13919 | } | |
13920 | ||
13921 | ALIAS (ip_community_list_standard, | |
13922 | ip_community_list_standard2_cmd, | |
13923 | "ip community-list <1-99> (deny|permit)", | |
13924 | IP_STR | |
13925 | COMMUNITY_LIST_STR | |
13926 | "Community list number (standard)\n" | |
13927 | "Specify community to reject\n" | |
13928 | "Specify community to accept\n") | |
13929 | ||
13930 | DEFUN (ip_community_list_expanded, | |
13931 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 13932 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 13933 | IP_STR |
13934 | COMMUNITY_LIST_STR | |
13935 | "Community list number (expanded)\n" | |
13936 | "Specify community to reject\n" | |
13937 | "Specify community to accept\n" | |
13938 | "An ordered list as a regular-expression\n") | |
13939 | { | |
13940 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
13941 | } | |
13942 | ||
13943 | DEFUN (ip_community_list_name_standard, | |
13944 | ip_community_list_name_standard_cmd, | |
13945 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
13946 | IP_STR | |
13947 | COMMUNITY_LIST_STR | |
13948 | "Add a standard community-list entry\n" | |
13949 | "Community list name\n" | |
13950 | "Specify community to reject\n" | |
13951 | "Specify community to accept\n" | |
13952 | COMMUNITY_VAL_STR) | |
13953 | { | |
13954 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
13955 | } | |
13956 | ||
13957 | ALIAS (ip_community_list_name_standard, | |
13958 | ip_community_list_name_standard2_cmd, | |
13959 | "ip community-list standard WORD (deny|permit)", | |
13960 | IP_STR | |
13961 | COMMUNITY_LIST_STR | |
13962 | "Add a standard community-list entry\n" | |
13963 | "Community list name\n" | |
13964 | "Specify community to reject\n" | |
13965 | "Specify community to accept\n") | |
13966 | ||
13967 | DEFUN (ip_community_list_name_expanded, | |
13968 | ip_community_list_name_expanded_cmd, | |
13969 | "ip community-list expanded WORD (deny|permit) .LINE", | |
13970 | IP_STR | |
13971 | COMMUNITY_LIST_STR | |
13972 | "Add an expanded community-list entry\n" | |
13973 | "Community list name\n" | |
13974 | "Specify community to reject\n" | |
13975 | "Specify community to accept\n" | |
13976 | "An ordered list as a regular-expression\n") | |
13977 | { | |
13978 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
13979 | } | |
13980 | ||
fee6e4e4 | 13981 | DEFUN (no_ip_community_list_standard_all, |
13982 | no_ip_community_list_standard_all_cmd, | |
13983 | "no ip community-list <1-99>", | |
13984 | NO_STR | |
13985 | IP_STR | |
13986 | COMMUNITY_LIST_STR | |
13987 | "Community list number (standard)\n") | |
13988 | { | |
13989 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
13990 | } | |
13991 | ||
13992 | DEFUN (no_ip_community_list_expanded_all, | |
13993 | no_ip_community_list_expanded_all_cmd, | |
13994 | "no ip community-list <100-500>", | |
718e3744 | 13995 | NO_STR |
13996 | IP_STR | |
13997 | COMMUNITY_LIST_STR | |
718e3744 | 13998 | "Community list number (expanded)\n") |
13999 | { | |
fee6e4e4 | 14000 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 14001 | } |
14002 | ||
fee6e4e4 | 14003 | DEFUN (no_ip_community_list_name_standard_all, |
14004 | no_ip_community_list_name_standard_all_cmd, | |
14005 | "no ip community-list standard WORD", | |
718e3744 | 14006 | NO_STR |
14007 | IP_STR | |
14008 | COMMUNITY_LIST_STR | |
14009 | "Add a standard community-list entry\n" | |
718e3744 | 14010 | "Community list name\n") |
14011 | { | |
fee6e4e4 | 14012 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
718e3744 | 14013 | } |
14014 | ||
fee6e4e4 | 14015 | DEFUN (no_ip_community_list_name_expanded_all, |
14016 | no_ip_community_list_name_expanded_all_cmd, | |
14017 | "no ip community-list expanded WORD", | |
718e3744 | 14018 | NO_STR |
14019 | IP_STR | |
14020 | COMMUNITY_LIST_STR | |
fee6e4e4 | 14021 | "Add an expanded community-list entry\n" |
14022 | "Community list name\n") | |
718e3744 | 14023 | { |
fee6e4e4 | 14024 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 14025 | } |
14026 | ||
14027 | DEFUN (no_ip_community_list_standard, | |
14028 | no_ip_community_list_standard_cmd, | |
14029 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
14030 | NO_STR | |
14031 | IP_STR | |
14032 | COMMUNITY_LIST_STR | |
14033 | "Community list number (standard)\n" | |
14034 | "Specify community to reject\n" | |
14035 | "Specify community to accept\n" | |
14036 | COMMUNITY_VAL_STR) | |
14037 | { | |
14038 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
14039 | } | |
14040 | ||
14041 | DEFUN (no_ip_community_list_expanded, | |
14042 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 14043 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 14044 | NO_STR |
14045 | IP_STR | |
14046 | COMMUNITY_LIST_STR | |
14047 | "Community list number (expanded)\n" | |
14048 | "Specify community to reject\n" | |
14049 | "Specify community to accept\n" | |
14050 | "An ordered list as a regular-expression\n") | |
14051 | { | |
14052 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
14053 | } | |
14054 | ||
14055 | DEFUN (no_ip_community_list_name_standard, | |
14056 | no_ip_community_list_name_standard_cmd, | |
14057 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
14058 | NO_STR | |
14059 | IP_STR | |
14060 | COMMUNITY_LIST_STR | |
14061 | "Specify a standard community-list\n" | |
14062 | "Community list name\n" | |
14063 | "Specify community to reject\n" | |
14064 | "Specify community to accept\n" | |
14065 | COMMUNITY_VAL_STR) | |
14066 | { | |
14067 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
14068 | } | |
14069 | ||
14070 | DEFUN (no_ip_community_list_name_expanded, | |
14071 | no_ip_community_list_name_expanded_cmd, | |
14072 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
14073 | NO_STR | |
14074 | IP_STR | |
14075 | COMMUNITY_LIST_STR | |
14076 | "Specify an expanded community-list\n" | |
14077 | "Community list name\n" | |
14078 | "Specify community to reject\n" | |
14079 | "Specify community to accept\n" | |
14080 | "An ordered list as a regular-expression\n") | |
14081 | { | |
14082 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
14083 | } | |
14084 | ||
94f2b392 | 14085 | static void |
718e3744 | 14086 | community_list_show (struct vty *vty, struct community_list *list) |
14087 | { | |
14088 | struct community_entry *entry; | |
14089 | ||
14090 | for (entry = list->head; entry; entry = entry->next) | |
14091 | { | |
14092 | if (entry == list->head) | |
14093 | { | |
14094 | if (all_digit (list->name)) | |
14095 | vty_out (vty, "Community %s list %s%s", | |
14096 | entry->style == COMMUNITY_LIST_STANDARD ? | |
14097 | "standard" : "(expanded) access", | |
14098 | list->name, VTY_NEWLINE); | |
14099 | else | |
14100 | vty_out (vty, "Named Community %s list %s%s", | |
14101 | entry->style == COMMUNITY_LIST_STANDARD ? | |
14102 | "standard" : "expanded", | |
14103 | list->name, VTY_NEWLINE); | |
14104 | } | |
14105 | if (entry->any) | |
14106 | vty_out (vty, " %s%s", | |
14107 | community_direct_str (entry->direct), VTY_NEWLINE); | |
14108 | else | |
14109 | vty_out (vty, " %s %s%s", | |
14110 | community_direct_str (entry->direct), | |
14111 | entry->style == COMMUNITY_LIST_STANDARD | |
14112 | ? community_str (entry->u.com) : entry->config, | |
14113 | VTY_NEWLINE); | |
14114 | } | |
14115 | } | |
14116 | ||
14117 | DEFUN (show_ip_community_list, | |
14118 | show_ip_community_list_cmd, | |
14119 | "show ip community-list", | |
14120 | SHOW_STR | |
14121 | IP_STR | |
14122 | "List community-list\n") | |
14123 | { | |
14124 | struct community_list *list; | |
14125 | struct community_list_master *cm; | |
14126 | ||
fee6e4e4 | 14127 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 14128 | if (! cm) |
14129 | return CMD_SUCCESS; | |
14130 | ||
14131 | for (list = cm->num.head; list; list = list->next) | |
14132 | community_list_show (vty, list); | |
14133 | ||
14134 | for (list = cm->str.head; list; list = list->next) | |
14135 | community_list_show (vty, list); | |
14136 | ||
14137 | return CMD_SUCCESS; | |
14138 | } | |
14139 | ||
14140 | DEFUN (show_ip_community_list_arg, | |
14141 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 14142 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 14143 | SHOW_STR |
14144 | IP_STR | |
14145 | "List community-list\n" | |
14146 | "Community-list number\n" | |
14147 | "Community-list name\n") | |
14148 | { | |
14149 | struct community_list *list; | |
14150 | ||
fee6e4e4 | 14151 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 14152 | if (! list) |
14153 | { | |
b729294c | 14154 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 14155 | return CMD_WARNING; |
14156 | } | |
14157 | ||
14158 | community_list_show (vty, list); | |
14159 | ||
14160 | return CMD_SUCCESS; | |
14161 | } | |
6b0655a2 | 14162 | |
94f2b392 | 14163 | static int |
fd79ac91 | 14164 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
14165 | int style, int reject_all_digit_name) | |
718e3744 | 14166 | { |
14167 | int ret; | |
14168 | int direct; | |
14169 | char *str; | |
14170 | ||
14171 | /* Check the list type. */ | |
14172 | if (strncmp (argv[1], "p", 1) == 0) | |
14173 | direct = COMMUNITY_PERMIT; | |
14174 | else if (strncmp (argv[1], "d", 1) == 0) | |
14175 | direct = COMMUNITY_DENY; | |
14176 | else | |
14177 | { | |
14178 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
14179 | VTY_NEWLINE); | |
14180 | return CMD_WARNING; | |
14181 | } | |
14182 | ||
14183 | /* All digit name check. */ | |
14184 | if (reject_all_digit_name && all_digit (argv[0])) | |
14185 | { | |
14186 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
14187 | return CMD_WARNING; | |
14188 | } | |
14189 | ||
14190 | /* Concat community string argument. */ | |
14191 | if (argc > 1) | |
14192 | str = argv_concat (argv, argc, 2); | |
14193 | else | |
14194 | str = NULL; | |
14195 | ||
14196 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
14197 | ||
14198 | /* Free temporary community list string allocated by | |
14199 | argv_concat(). */ | |
14200 | if (str) | |
14201 | XFREE (MTYPE_TMP, str); | |
14202 | ||
14203 | if (ret < 0) | |
14204 | { | |
14205 | community_list_perror (vty, ret); | |
14206 | return CMD_WARNING; | |
14207 | } | |
14208 | return CMD_SUCCESS; | |
14209 | } | |
14210 | ||
94f2b392 | 14211 | static int |
fee6e4e4 | 14212 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
14213 | int style) | |
718e3744 | 14214 | { |
14215 | int ret; | |
fee6e4e4 | 14216 | int direct = 0; |
14217 | char *str = NULL; | |
718e3744 | 14218 | |
fee6e4e4 | 14219 | if (argc > 1) |
718e3744 | 14220 | { |
fee6e4e4 | 14221 | /* Check the list direct. */ |
14222 | if (strncmp (argv[1], "p", 1) == 0) | |
14223 | direct = COMMUNITY_PERMIT; | |
14224 | else if (strncmp (argv[1], "d", 1) == 0) | |
14225 | direct = COMMUNITY_DENY; | |
14226 | else | |
14227 | { | |
14228 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
14229 | VTY_NEWLINE); | |
14230 | return CMD_WARNING; | |
14231 | } | |
718e3744 | 14232 | |
fee6e4e4 | 14233 | /* Concat community string argument. */ |
14234 | str = argv_concat (argv, argc, 2); | |
718e3744 | 14235 | } |
14236 | ||
718e3744 | 14237 | /* Unset community list. */ |
14238 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); | |
14239 | ||
14240 | /* Free temporary community list string allocated by | |
14241 | argv_concat(). */ | |
fee6e4e4 | 14242 | if (str) |
14243 | XFREE (MTYPE_TMP, str); | |
718e3744 | 14244 | |
14245 | if (ret < 0) | |
14246 | { | |
14247 | community_list_perror (vty, ret); | |
14248 | return CMD_WARNING; | |
14249 | } | |
14250 | ||
14251 | return CMD_SUCCESS; | |
14252 | } | |
14253 | ||
14254 | /* "extcommunity-list" keyword help string. */ | |
14255 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
14256 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
14257 | ||
14258 | DEFUN (ip_extcommunity_list_standard, | |
14259 | ip_extcommunity_list_standard_cmd, | |
14260 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
14261 | IP_STR | |
14262 | EXTCOMMUNITY_LIST_STR | |
14263 | "Extended Community list number (standard)\n" | |
14264 | "Specify community to reject\n" | |
14265 | "Specify community to accept\n" | |
14266 | EXTCOMMUNITY_VAL_STR) | |
14267 | { | |
14268 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
14269 | } | |
14270 | ||
14271 | ALIAS (ip_extcommunity_list_standard, | |
14272 | ip_extcommunity_list_standard2_cmd, | |
14273 | "ip extcommunity-list <1-99> (deny|permit)", | |
14274 | IP_STR | |
14275 | EXTCOMMUNITY_LIST_STR | |
14276 | "Extended Community list number (standard)\n" | |
14277 | "Specify community to reject\n" | |
14278 | "Specify community to accept\n") | |
14279 | ||
14280 | DEFUN (ip_extcommunity_list_expanded, | |
14281 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 14282 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 14283 | IP_STR |
14284 | EXTCOMMUNITY_LIST_STR | |
14285 | "Extended Community list number (expanded)\n" | |
14286 | "Specify community to reject\n" | |
14287 | "Specify community to accept\n" | |
14288 | "An ordered list as a regular-expression\n") | |
14289 | { | |
14290 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
14291 | } | |
14292 | ||
14293 | DEFUN (ip_extcommunity_list_name_standard, | |
14294 | ip_extcommunity_list_name_standard_cmd, | |
14295 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
14296 | IP_STR | |
14297 | EXTCOMMUNITY_LIST_STR | |
14298 | "Specify standard extcommunity-list\n" | |
14299 | "Extended Community list name\n" | |
14300 | "Specify community to reject\n" | |
14301 | "Specify community to accept\n" | |
14302 | EXTCOMMUNITY_VAL_STR) | |
14303 | { | |
14304 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
14305 | } | |
14306 | ||
14307 | ALIAS (ip_extcommunity_list_name_standard, | |
14308 | ip_extcommunity_list_name_standard2_cmd, | |
14309 | "ip extcommunity-list standard WORD (deny|permit)", | |
14310 | IP_STR | |
14311 | EXTCOMMUNITY_LIST_STR | |
14312 | "Specify standard extcommunity-list\n" | |
14313 | "Extended Community list name\n" | |
14314 | "Specify community to reject\n" | |
14315 | "Specify community to accept\n") | |
14316 | ||
14317 | DEFUN (ip_extcommunity_list_name_expanded, | |
14318 | ip_extcommunity_list_name_expanded_cmd, | |
14319 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
14320 | IP_STR | |
14321 | EXTCOMMUNITY_LIST_STR | |
14322 | "Specify expanded extcommunity-list\n" | |
14323 | "Extended Community list name\n" | |
14324 | "Specify community to reject\n" | |
14325 | "Specify community to accept\n" | |
14326 | "An ordered list as a regular-expression\n") | |
14327 | { | |
14328 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
14329 | } | |
14330 | ||
fee6e4e4 | 14331 | DEFUN (no_ip_extcommunity_list_standard_all, |
14332 | no_ip_extcommunity_list_standard_all_cmd, | |
14333 | "no ip extcommunity-list <1-99>", | |
14334 | NO_STR | |
14335 | IP_STR | |
14336 | EXTCOMMUNITY_LIST_STR | |
14337 | "Extended Community list number (standard)\n") | |
14338 | { | |
14339 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
14340 | } | |
14341 | ||
14342 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
14343 | no_ip_extcommunity_list_expanded_all_cmd, | |
14344 | "no ip extcommunity-list <100-500>", | |
718e3744 | 14345 | NO_STR |
14346 | IP_STR | |
14347 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 14348 | "Extended Community list number (expanded)\n") |
14349 | { | |
fee6e4e4 | 14350 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 14351 | } |
14352 | ||
fee6e4e4 | 14353 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
14354 | no_ip_extcommunity_list_name_standard_all_cmd, | |
14355 | "no ip extcommunity-list standard WORD", | |
718e3744 | 14356 | NO_STR |
14357 | IP_STR | |
14358 | EXTCOMMUNITY_LIST_STR | |
14359 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 14360 | "Extended Community list name\n") |
14361 | { | |
14362 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
14363 | } | |
14364 | ||
14365 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
14366 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
14367 | "no ip extcommunity-list expanded WORD", | |
14368 | NO_STR | |
14369 | IP_STR | |
14370 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 14371 | "Specify expanded extcommunity-list\n" |
14372 | "Extended Community list name\n") | |
14373 | { | |
fee6e4e4 | 14374 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 14375 | } |
14376 | ||
14377 | DEFUN (no_ip_extcommunity_list_standard, | |
14378 | no_ip_extcommunity_list_standard_cmd, | |
14379 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
14380 | NO_STR | |
14381 | IP_STR | |
14382 | EXTCOMMUNITY_LIST_STR | |
14383 | "Extended Community list number (standard)\n" | |
14384 | "Specify community to reject\n" | |
14385 | "Specify community to accept\n" | |
14386 | EXTCOMMUNITY_VAL_STR) | |
14387 | { | |
14388 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
14389 | } | |
14390 | ||
14391 | DEFUN (no_ip_extcommunity_list_expanded, | |
14392 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 14393 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 14394 | NO_STR |
14395 | IP_STR | |
14396 | EXTCOMMUNITY_LIST_STR | |
14397 | "Extended Community list number (expanded)\n" | |
14398 | "Specify community to reject\n" | |
14399 | "Specify community to accept\n" | |
14400 | "An ordered list as a regular-expression\n") | |
14401 | { | |
14402 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
14403 | } | |
14404 | ||
14405 | DEFUN (no_ip_extcommunity_list_name_standard, | |
14406 | no_ip_extcommunity_list_name_standard_cmd, | |
14407 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
14408 | NO_STR | |
14409 | IP_STR | |
14410 | EXTCOMMUNITY_LIST_STR | |
14411 | "Specify standard extcommunity-list\n" | |
14412 | "Extended Community list name\n" | |
14413 | "Specify community to reject\n" | |
14414 | "Specify community to accept\n" | |
14415 | EXTCOMMUNITY_VAL_STR) | |
14416 | { | |
14417 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
14418 | } | |
14419 | ||
14420 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
14421 | no_ip_extcommunity_list_name_expanded_cmd, | |
14422 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
14423 | NO_STR | |
14424 | IP_STR | |
14425 | EXTCOMMUNITY_LIST_STR | |
14426 | "Specify expanded extcommunity-list\n" | |
14427 | "Community list name\n" | |
14428 | "Specify community to reject\n" | |
14429 | "Specify community to accept\n" | |
14430 | "An ordered list as a regular-expression\n") | |
14431 | { | |
14432 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
14433 | } | |
14434 | ||
94f2b392 | 14435 | static void |
718e3744 | 14436 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
14437 | { | |
14438 | struct community_entry *entry; | |
14439 | ||
14440 | for (entry = list->head; entry; entry = entry->next) | |
14441 | { | |
14442 | if (entry == list->head) | |
14443 | { | |
14444 | if (all_digit (list->name)) | |
14445 | vty_out (vty, "Extended community %s list %s%s", | |
14446 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
14447 | "standard" : "(expanded) access", | |
14448 | list->name, VTY_NEWLINE); | |
14449 | else | |
14450 | vty_out (vty, "Named extended community %s list %s%s", | |
14451 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
14452 | "standard" : "expanded", | |
14453 | list->name, VTY_NEWLINE); | |
14454 | } | |
14455 | if (entry->any) | |
14456 | vty_out (vty, " %s%s", | |
14457 | community_direct_str (entry->direct), VTY_NEWLINE); | |
14458 | else | |
14459 | vty_out (vty, " %s %s%s", | |
14460 | community_direct_str (entry->direct), | |
14461 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
14462 | entry->u.ecom->str : entry->config, | |
14463 | VTY_NEWLINE); | |
14464 | } | |
14465 | } | |
14466 | ||
14467 | DEFUN (show_ip_extcommunity_list, | |
14468 | show_ip_extcommunity_list_cmd, | |
14469 | "show ip extcommunity-list", | |
14470 | SHOW_STR | |
14471 | IP_STR | |
14472 | "List extended-community list\n") | |
14473 | { | |
14474 | struct community_list *list; | |
14475 | struct community_list_master *cm; | |
14476 | ||
fee6e4e4 | 14477 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 14478 | if (! cm) |
14479 | return CMD_SUCCESS; | |
14480 | ||
14481 | for (list = cm->num.head; list; list = list->next) | |
14482 | extcommunity_list_show (vty, list); | |
14483 | ||
14484 | for (list = cm->str.head; list; list = list->next) | |
14485 | extcommunity_list_show (vty, list); | |
14486 | ||
14487 | return CMD_SUCCESS; | |
14488 | } | |
14489 | ||
14490 | DEFUN (show_ip_extcommunity_list_arg, | |
14491 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 14492 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 14493 | SHOW_STR |
14494 | IP_STR | |
14495 | "List extended-community list\n" | |
14496 | "Extcommunity-list number\n" | |
14497 | "Extcommunity-list name\n") | |
14498 | { | |
14499 | struct community_list *list; | |
14500 | ||
fee6e4e4 | 14501 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 14502 | if (! list) |
14503 | { | |
b729294c | 14504 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 14505 | return CMD_WARNING; |
14506 | } | |
14507 | ||
14508 | extcommunity_list_show (vty, list); | |
14509 | ||
14510 | return CMD_SUCCESS; | |
14511 | } | |
6b0655a2 | 14512 | |
718e3744 | 14513 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 14514 | static const char * |
718e3744 | 14515 | community_list_config_str (struct community_entry *entry) |
14516 | { | |
fd79ac91 | 14517 | const char *str; |
718e3744 | 14518 | |
14519 | if (entry->any) | |
14520 | str = ""; | |
14521 | else | |
14522 | { | |
14523 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
14524 | str = community_str (entry->u.com); | |
14525 | else | |
14526 | str = entry->config; | |
14527 | } | |
14528 | return str; | |
14529 | } | |
14530 | ||
14531 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 14532 | static int |
718e3744 | 14533 | community_list_config_write (struct vty *vty) |
14534 | { | |
14535 | struct community_list *list; | |
14536 | struct community_entry *entry; | |
14537 | struct community_list_master *cm; | |
14538 | int write = 0; | |
14539 | ||
14540 | /* Community-list. */ | |
fee6e4e4 | 14541 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 14542 | |
14543 | for (list = cm->num.head; list; list = list->next) | |
14544 | for (entry = list->head; entry; entry = entry->next) | |
14545 | { | |
fee6e4e4 | 14546 | vty_out (vty, "ip community-list %s %s %s%s", |
14547 | list->name, community_direct_str (entry->direct), | |
14548 | community_list_config_str (entry), | |
14549 | VTY_NEWLINE); | |
718e3744 | 14550 | write++; |
14551 | } | |
14552 | for (list = cm->str.head; list; list = list->next) | |
14553 | for (entry = list->head; entry; entry = entry->next) | |
14554 | { | |
14555 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
14556 | entry->style == COMMUNITY_LIST_STANDARD | |
14557 | ? "standard" : "expanded", | |
14558 | list->name, community_direct_str (entry->direct), | |
14559 | community_list_config_str (entry), | |
14560 | VTY_NEWLINE); | |
14561 | write++; | |
14562 | } | |
14563 | ||
14564 | /* Extcommunity-list. */ | |
fee6e4e4 | 14565 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 14566 | |
14567 | for (list = cm->num.head; list; list = list->next) | |
14568 | for (entry = list->head; entry; entry = entry->next) | |
14569 | { | |
fee6e4e4 | 14570 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
14571 | list->name, community_direct_str (entry->direct), | |
14572 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 14573 | write++; |
14574 | } | |
14575 | for (list = cm->str.head; list; list = list->next) | |
14576 | for (entry = list->head; entry; entry = entry->next) | |
14577 | { | |
14578 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
14579 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
14580 | ? "standard" : "expanded", | |
14581 | list->name, community_direct_str (entry->direct), | |
14582 | community_list_config_str (entry), VTY_NEWLINE); | |
14583 | write++; | |
14584 | } | |
14585 | return write; | |
14586 | } | |
14587 | ||
7fc626de | 14588 | static struct cmd_node community_list_node = |
718e3744 | 14589 | { |
14590 | COMMUNITY_LIST_NODE, | |
14591 | "", | |
14592 | 1 /* Export to vtysh. */ | |
14593 | }; | |
14594 | ||
94f2b392 | 14595 | static void |
14596 | community_list_vty (void) | |
718e3744 | 14597 | { |
14598 | install_node (&community_list_node, community_list_config_write); | |
14599 | ||
14600 | /* Community-list. */ | |
718e3744 | 14601 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
14602 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
14603 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
14604 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
14605 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
14606 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 14607 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
14608 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); | |
14609 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
14610 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 14611 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
14612 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
14613 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
14614 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); | |
14615 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
14616 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
14617 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
14618 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
14619 | ||
14620 | /* Extcommunity-list. */ | |
14621 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
14622 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
14623 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
14624 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
14625 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
14626 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 14627 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
14628 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); | |
14629 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
14630 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 14631 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
14632 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
14633 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
14634 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); | |
14635 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
14636 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
14637 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
14638 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
14639 | } |