]>
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 | ||
20eb8864 | 60 | static struct peer_group * |
61 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact); | |
62 | ||
718e3744 | 63 | /* Utility function to get address family from current node. */ |
64 | afi_t | |
65 | bgp_node_afi (struct vty *vty) | |
66 | { | |
25ffbdc1 | 67 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 68 | return AFI_IP6; |
69 | return AFI_IP; | |
70 | } | |
71 | ||
72 | /* Utility function to get subsequent address family from current | |
73 | node. */ | |
74 | safi_t | |
75 | bgp_node_safi (struct vty *vty) | |
76 | { | |
77 | if (vty->node == BGP_VPNV4_NODE) | |
78 | return SAFI_MPLS_VPN; | |
25ffbdc1 | 79 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 80 | return SAFI_MULTICAST; |
81 | return SAFI_UNICAST; | |
82 | } | |
83 | ||
94f2b392 | 84 | static int |
718e3744 | 85 | peer_address_self_check (union sockunion *su) |
86 | { | |
87 | struct interface *ifp = NULL; | |
88 | ||
89 | if (su->sa.sa_family == AF_INET) | |
90 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); | |
91 | #ifdef HAVE_IPV6 | |
92 | else if (su->sa.sa_family == AF_INET6) | |
f2345335 DS |
93 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr, |
94 | su->sin6.sin6_scope_id); | |
718e3744 | 95 | #endif /* HAVE IPV6 */ |
96 | ||
97 | if (ifp) | |
98 | return 1; | |
99 | ||
100 | return 0; | |
101 | } | |
102 | ||
103 | /* Utility function for looking up peer from VTY. */ | |
f14e6fdb DS |
104 | /* This is used only for configuration, so disallow if attempted on |
105 | * a dynamic neighbor. | |
106 | */ | |
94f2b392 | 107 | static struct peer * |
fd79ac91 | 108 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 109 | { |
110 | int ret; | |
111 | struct bgp *bgp; | |
112 | union sockunion su; | |
113 | struct peer *peer; | |
114 | ||
115 | bgp = vty->index; | |
116 | ||
117 | ret = str2sockunion (ip_str, &su); | |
118 | if (ret < 0) | |
119 | { | |
a80beece DS |
120 | peer = peer_lookup_by_conf_if (bgp, ip_str); |
121 | if (!peer) | |
122 | { | |
04b6bdc0 DW |
123 | if ((peer = peer_lookup_by_hostname(bgp, ip_str)) == NULL) |
124 | { | |
125 | vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE); | |
126 | return NULL; | |
127 | } | |
a80beece | 128 | } |
718e3744 | 129 | } |
a80beece | 130 | else |
718e3744 | 131 | { |
a80beece DS |
132 | peer = peer_lookup (bgp, &su); |
133 | if (! peer) | |
134 | { | |
135 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
136 | VTY_NEWLINE); | |
137 | return NULL; | |
138 | } | |
f14e6fdb DS |
139 | if (peer_dynamic_neighbor (peer)) |
140 | { | |
141 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
142 | VTY_NEWLINE); | |
143 | return NULL; | |
144 | } | |
145 | ||
718e3744 | 146 | } |
147 | return peer; | |
148 | } | |
149 | ||
150 | /* Utility function for looking up peer or peer group. */ | |
f14e6fdb DS |
151 | /* This is used only for configuration, so disallow if attempted on |
152 | * a dynamic neighbor. | |
153 | */ | |
c43ed2e4 | 154 | struct peer * |
fd79ac91 | 155 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 156 | { |
157 | int ret; | |
158 | struct bgp *bgp; | |
159 | union sockunion su; | |
f14e6fdb DS |
160 | struct peer *peer = NULL; |
161 | struct peer_group *group = NULL; | |
718e3744 | 162 | |
163 | bgp = vty->index; | |
164 | ||
165 | ret = str2sockunion (peer_str, &su); | |
166 | if (ret == 0) | |
167 | { | |
f14e6fdb | 168 | /* IP address, locate peer. */ |
718e3744 | 169 | peer = peer_lookup (bgp, &su); |
718e3744 | 170 | } |
171 | else | |
172 | { | |
f14e6fdb | 173 | /* Not IP, could match either peer configured on interface or a group. */ |
a80beece | 174 | peer = peer_lookup_by_conf_if (bgp, peer_str); |
f14e6fdb DS |
175 | if (!peer) |
176 | group = peer_group_lookup (bgp, peer_str); | |
177 | } | |
a80beece | 178 | |
f14e6fdb DS |
179 | if (peer) |
180 | { | |
181 | if (peer_dynamic_neighbor (peer)) | |
182 | { | |
183 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
184 | VTY_NEWLINE); | |
185 | return NULL; | |
186 | } | |
187 | ||
188 | return peer; | |
718e3744 | 189 | } |
190 | ||
f14e6fdb DS |
191 | if (group) |
192 | return group->conf; | |
193 | ||
718e3744 | 194 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
195 | VTY_NEWLINE); | |
196 | ||
197 | return NULL; | |
198 | } | |
199 | ||
c43ed2e4 | 200 | int |
718e3744 | 201 | bgp_vty_return (struct vty *vty, int ret) |
202 | { | |
fd79ac91 | 203 | const char *str = NULL; |
718e3744 | 204 | |
205 | switch (ret) | |
206 | { | |
207 | case BGP_ERR_INVALID_VALUE: | |
208 | str = "Invalid value"; | |
209 | break; | |
210 | case BGP_ERR_INVALID_FLAG: | |
211 | str = "Invalid flag"; | |
212 | break; | |
718e3744 | 213 | case BGP_ERR_PEER_GROUP_SHUTDOWN: |
214 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
215 | break; | |
718e3744 | 216 | case BGP_ERR_PEER_FLAG_CONFLICT: |
217 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
218 | break; | |
718e3744 | 219 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: |
220 | str = "Specify remote-as or peer-group remote AS first"; | |
221 | break; | |
222 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
223 | str = "Cannot change the peer-group. Deconfigure first"; | |
224 | break; | |
225 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
226 | str = "Cannot have different peer-group for the neighbor"; | |
227 | break; | |
228 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
229 | str = "Prefix/distribute list can not co-exist"; | |
230 | break; | |
231 | case BGP_ERR_NOT_INTERNAL_PEER: | |
232 | str = "Invalid command. Not an internal neighbor"; | |
233 | break; | |
234 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
5000f21c | 235 | str = "remove-private-AS cannot be configured for IBGP peers"; |
718e3744 | 236 | break; |
237 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
238 | str = "Local-AS allowed only for EBGP peers"; | |
239 | break; | |
240 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
241 | str = "Cannot have local-as same as BGP AS number"; | |
242 | break; | |
0df7c91f PJ |
243 | case BGP_ERR_TCPSIG_FAILED: |
244 | str = "Error while applying TCP-Sig to session(s)"; | |
245 | break; | |
fa411a21 NH |
246 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
247 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
248 | break; | |
f5a4827d SH |
249 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
250 | str = "ttl-security only allowed for EBGP peers"; | |
251 | break; | |
c7122e14 DS |
252 | case BGP_ERR_AS_OVERRIDE: |
253 | str = "as-override cannot be configured for IBGP peers"; | |
254 | break; | |
f14e6fdb DS |
255 | case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT: |
256 | str = "Invalid limit for number of dynamic neighbors"; | |
257 | break; | |
258 | case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS: | |
259 | str = "Dynamic neighbor listen range already exists"; | |
260 | break; | |
261 | case BGP_ERR_INVALID_FOR_DYNAMIC_PEER: | |
262 | str = "Operation not allowed on a dynamic neighbor"; | |
263 | break; | |
718e3744 | 264 | } |
265 | if (str) | |
266 | { | |
267 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
268 | return CMD_WARNING; | |
269 | } | |
270 | return CMD_SUCCESS; | |
271 | } | |
272 | ||
7aafcaca DS |
273 | /* BGP clear sort. */ |
274 | enum clear_sort | |
275 | { | |
276 | clear_all, | |
277 | clear_peer, | |
278 | clear_group, | |
279 | clear_external, | |
280 | clear_as | |
281 | }; | |
282 | ||
7aafcaca DS |
283 | static void |
284 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, | |
285 | safi_t safi, int error) | |
286 | { | |
287 | switch (error) | |
288 | { | |
289 | case BGP_ERR_AF_UNCONFIGURED: | |
290 | vty_out (vty, | |
291 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
292 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
293 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
294 | peer->host, VTY_NEWLINE); | |
295 | break; | |
296 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
297 | vty_out (vty, "%%BGP: Inbound soft reconfig for %s not possible as it%s has neither refresh capability, nor inbound soft reconfig%s", peer->host, VTY_NEWLINE, VTY_NEWLINE); | |
298 | break; | |
299 | default: | |
300 | break; | |
301 | } | |
302 | } | |
303 | ||
304 | /* `clear ip bgp' functions. */ | |
305 | static int | |
306 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, | |
307 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) | |
308 | { | |
309 | int ret; | |
310 | struct peer *peer; | |
311 | struct listnode *node, *nnode; | |
312 | ||
313 | /* Clear all neighbors. */ | |
314 | /* | |
315 | * Pass along pointer to next node to peer_clear() when walking all nodes | |
316 | * on the BGP instance as that may get freed if it is a doppelganger | |
317 | */ | |
318 | if (sort == clear_all) | |
319 | { | |
320 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
321 | { | |
322 | if (stype == BGP_CLEAR_SOFT_NONE) | |
323 | ret = peer_clear (peer, &nnode); | |
324 | else if (peer->afc[afi][safi]) | |
325 | ret = peer_clear_soft (peer, afi, safi, stype); | |
326 | else | |
327 | ret = 0; | |
328 | ||
329 | if (ret < 0) | |
330 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
331 | } | |
332 | ||
333 | /* This is to apply read-only mode on this clear. */ | |
334 | if (stype == BGP_CLEAR_SOFT_NONE) | |
335 | bgp->update_delay_over = 0; | |
336 | ||
337 | return CMD_SUCCESS; | |
338 | } | |
339 | ||
340 | /* Clear specified neighbors. */ | |
341 | if (sort == clear_peer) | |
342 | { | |
343 | union sockunion su; | |
344 | int ret; | |
345 | ||
346 | /* Make sockunion for lookup. */ | |
347 | ret = str2sockunion (arg, &su); | |
348 | if (ret < 0) | |
349 | { | |
350 | peer = peer_lookup_by_conf_if (bgp, arg); | |
351 | if (!peer) | |
352 | { | |
04b6bdc0 DW |
353 | peer = peer_lookup_by_hostname(bgp, arg); |
354 | if (!peer) | |
355 | { | |
356 | vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE); | |
357 | return CMD_WARNING; | |
358 | } | |
7aafcaca DS |
359 | } |
360 | } | |
361 | else | |
362 | { | |
363 | peer = peer_lookup (bgp, &su); | |
364 | if (! peer) | |
365 | { | |
366 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
367 | return CMD_WARNING; | |
368 | } | |
369 | } | |
370 | ||
371 | if (stype == BGP_CLEAR_SOFT_NONE) | |
372 | ret = peer_clear (peer, NULL); | |
373 | else | |
374 | ret = peer_clear_soft (peer, afi, safi, stype); | |
375 | ||
376 | if (ret < 0) | |
377 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
378 | ||
379 | return CMD_SUCCESS; | |
380 | } | |
381 | ||
382 | /* Clear all peer-group members. */ | |
383 | if (sort == clear_group) | |
384 | { | |
385 | struct peer_group *group; | |
386 | ||
387 | group = peer_group_lookup (bgp, arg); | |
388 | if (! group) | |
389 | { | |
390 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
391 | return CMD_WARNING; | |
392 | } | |
393 | ||
394 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
395 | { | |
396 | if (stype == BGP_CLEAR_SOFT_NONE) | |
397 | { | |
398 | ret = peer_clear (peer, NULL); | |
399 | continue; | |
400 | } | |
401 | ||
c8560b44 | 402 | if (! peer->afc[afi][safi]) |
7aafcaca DS |
403 | continue; |
404 | ||
405 | ret = peer_clear_soft (peer, afi, safi, stype); | |
406 | ||
407 | if (ret < 0) | |
408 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
409 | } | |
410 | return CMD_SUCCESS; | |
411 | } | |
412 | ||
413 | if (sort == clear_external) | |
414 | { | |
415 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
416 | { | |
417 | if (peer->sort == BGP_PEER_IBGP) | |
418 | continue; | |
419 | ||
420 | if (stype == BGP_CLEAR_SOFT_NONE) | |
421 | ret = peer_clear (peer, &nnode); | |
422 | else | |
423 | ret = peer_clear_soft (peer, afi, safi, stype); | |
424 | ||
425 | if (ret < 0) | |
426 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
427 | } | |
428 | return CMD_SUCCESS; | |
429 | } | |
430 | ||
431 | if (sort == clear_as) | |
432 | { | |
433 | as_t as; | |
434 | int find = 0; | |
435 | ||
436 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); | |
437 | ||
438 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
439 | { | |
440 | if (peer->as != as) | |
441 | continue; | |
442 | ||
443 | find = 1; | |
444 | if (stype == BGP_CLEAR_SOFT_NONE) | |
445 | ret = peer_clear (peer, &nnode); | |
446 | else | |
447 | ret = peer_clear_soft (peer, afi, safi, stype); | |
448 | ||
449 | if (ret < 0) | |
450 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
451 | } | |
452 | if (! find) | |
453 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
454 | VTY_NEWLINE); | |
455 | return CMD_SUCCESS; | |
456 | } | |
457 | ||
458 | return CMD_SUCCESS; | |
459 | } | |
460 | ||
461 | static int | |
462 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, | |
463 | enum clear_sort sort, enum bgp_clear_type stype, | |
464 | const char *arg) | |
465 | { | |
466 | struct bgp *bgp; | |
467 | ||
468 | /* BGP structure lookup. */ | |
469 | if (name) | |
470 | { | |
471 | bgp = bgp_lookup_by_name (name); | |
472 | if (bgp == NULL) | |
473 | { | |
474 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); | |
475 | return CMD_WARNING; | |
476 | } | |
477 | } | |
478 | else | |
479 | { | |
480 | bgp = bgp_get_default (); | |
481 | if (bgp == NULL) | |
482 | { | |
483 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
484 | return CMD_WARNING; | |
485 | } | |
486 | } | |
487 | ||
488 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); | |
489 | } | |
490 | ||
491 | /* clear soft inbound */ | |
492 | static void | |
493 | bgp_clear_star_soft_in (struct vty *vty) | |
494 | { | |
495 | bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
496 | BGP_CLEAR_SOFT_IN, NULL); | |
497 | #ifdef HAVE_IPV6 | |
498 | bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
499 | BGP_CLEAR_SOFT_IN, NULL); | |
500 | #endif /* HAVE_IPV6 */ | |
501 | } | |
502 | ||
503 | /* clear soft outbound */ | |
504 | static void | |
505 | bgp_clear_star_soft_out (struct vty *vty) | |
506 | { | |
507 | bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
508 | BGP_CLEAR_SOFT_OUT, NULL); | |
509 | #ifdef HAVE_IPV6 | |
510 | bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
511 | BGP_CLEAR_SOFT_OUT, NULL); | |
512 | #endif /* HAVE_IPV6 */ | |
513 | } | |
514 | ||
515 | ||
718e3744 | 516 | /* BGP global configuration. */ |
517 | ||
518 | DEFUN (bgp_multiple_instance_func, | |
519 | bgp_multiple_instance_cmd, | |
520 | "bgp multiple-instance", | |
521 | BGP_STR | |
522 | "Enable bgp multiple instance\n") | |
523 | { | |
524 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
525 | return CMD_SUCCESS; | |
526 | } | |
527 | ||
528 | DEFUN (no_bgp_multiple_instance, | |
529 | no_bgp_multiple_instance_cmd, | |
530 | "no bgp multiple-instance", | |
531 | NO_STR | |
532 | BGP_STR | |
533 | "BGP multiple instance\n") | |
534 | { | |
535 | int ret; | |
536 | ||
537 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
538 | if (ret < 0) | |
539 | { | |
540 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
541 | return CMD_WARNING; | |
542 | } | |
543 | return CMD_SUCCESS; | |
544 | } | |
545 | ||
546 | DEFUN (bgp_config_type, | |
547 | bgp_config_type_cmd, | |
548 | "bgp config-type (cisco|zebra)", | |
549 | BGP_STR | |
550 | "Configuration type\n" | |
551 | "cisco\n" | |
552 | "zebra\n") | |
553 | { | |
554 | if (strncmp (argv[0], "c", 1) == 0) | |
555 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
556 | else | |
557 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
558 | ||
559 | return CMD_SUCCESS; | |
560 | } | |
561 | ||
562 | DEFUN (no_bgp_config_type, | |
563 | no_bgp_config_type_cmd, | |
564 | "no bgp config-type", | |
565 | NO_STR | |
566 | BGP_STR | |
567 | "Display configuration type\n") | |
568 | { | |
569 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
570 | return CMD_SUCCESS; | |
571 | } | |
572 | ||
813d4307 DW |
573 | ALIAS (no_bgp_config_type, |
574 | no_bgp_config_type_val_cmd, | |
575 | "no bgp config-type (cisco|zebra)", | |
576 | NO_STR | |
577 | BGP_STR | |
578 | "Configuration type\n" | |
579 | "cisco\n" | |
580 | "zebra\n") | |
581 | ||
718e3744 | 582 | DEFUN (no_synchronization, |
583 | no_synchronization_cmd, | |
584 | "no synchronization", | |
585 | NO_STR | |
586 | "Perform IGP synchronization\n") | |
587 | { | |
588 | return CMD_SUCCESS; | |
589 | } | |
590 | ||
591 | DEFUN (no_auto_summary, | |
592 | no_auto_summary_cmd, | |
593 | "no auto-summary", | |
594 | NO_STR | |
595 | "Enable automatic network number summarization\n") | |
596 | { | |
597 | return CMD_SUCCESS; | |
598 | } | |
3d515fd9 | 599 | |
718e3744 | 600 | /* "router bgp" commands. */ |
601 | DEFUN (router_bgp, | |
602 | router_bgp_cmd, | |
320da874 | 603 | "router bgp " CMD_AS_RANGE, |
718e3744 | 604 | ROUTER_STR |
605 | BGP_STR | |
606 | AS_STR) | |
607 | { | |
608 | int ret; | |
609 | as_t as; | |
610 | struct bgp *bgp; | |
fd79ac91 | 611 | const char *name = NULL; |
718e3744 | 612 | |
2385a876 DW |
613 | // "router bgp" without an ASN |
614 | if (argc < 1) | |
615 | { | |
616 | bgp = bgp_get_default(); | |
718e3744 | 617 | |
2385a876 DW |
618 | if (bgp == NULL) |
619 | { | |
620 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
621 | return CMD_WARNING; | |
622 | } | |
718e3744 | 623 | |
2385a876 DW |
624 | if (listcount(bm->bgp) > 1) |
625 | { | |
626 | vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE); | |
627 | return CMD_WARNING; | |
628 | } | |
629 | } | |
630 | ||
631 | // "router bgp X" | |
632 | else | |
718e3744 | 633 | { |
2385a876 DW |
634 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
635 | ||
636 | if (argc == 2) | |
637 | name = argv[1]; | |
638 | ||
639 | ret = bgp_get (&bgp, &as, name); | |
640 | switch (ret) | |
641 | { | |
642 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
643 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
644 | VTY_NEWLINE); | |
645 | return CMD_WARNING; | |
646 | case BGP_ERR_AS_MISMATCH: | |
647 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); | |
648 | return CMD_WARNING; | |
649 | case BGP_ERR_INSTANCE_MISMATCH: | |
650 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); | |
651 | vty_out (vty, "BGP instance is already running; AS is %u%s", | |
652 | as, VTY_NEWLINE); | |
653 | return CMD_WARNING; | |
654 | } | |
718e3744 | 655 | } |
656 | ||
657 | vty->node = BGP_NODE; | |
658 | vty->index = bgp; | |
659 | ||
660 | return CMD_SUCCESS; | |
661 | } | |
662 | ||
663 | ALIAS (router_bgp, | |
664 | router_bgp_view_cmd, | |
320da874 | 665 | "router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 666 | ROUTER_STR |
667 | BGP_STR | |
668 | AS_STR | |
669 | "BGP view\n" | |
670 | "view name\n") | |
6b0655a2 | 671 | |
2385a876 DW |
672 | ALIAS (router_bgp, |
673 | router_bgp_noasn_cmd, | |
674 | "router bgp", | |
675 | ROUTER_STR | |
676 | BGP_STR) | |
677 | ||
718e3744 | 678 | /* "no router bgp" commands. */ |
679 | DEFUN (no_router_bgp, | |
680 | no_router_bgp_cmd, | |
320da874 | 681 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 682 | NO_STR |
683 | ROUTER_STR | |
684 | BGP_STR | |
685 | AS_STR) | |
686 | { | |
687 | as_t as; | |
688 | struct bgp *bgp; | |
fd79ac91 | 689 | const char *name = NULL; |
718e3744 | 690 | |
0b2aa3a0 | 691 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 692 | |
693 | if (argc == 2) | |
694 | name = argv[1]; | |
695 | ||
696 | /* Lookup bgp structure. */ | |
697 | bgp = bgp_lookup (as, name); | |
698 | if (! bgp) | |
699 | { | |
700 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
701 | return CMD_WARNING; | |
702 | } | |
703 | ||
704 | bgp_delete (bgp); | |
705 | ||
706 | return CMD_SUCCESS; | |
707 | } | |
708 | ||
709 | ALIAS (no_router_bgp, | |
710 | no_router_bgp_view_cmd, | |
320da874 | 711 | "no router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 712 | NO_STR |
713 | ROUTER_STR | |
714 | BGP_STR | |
715 | AS_STR | |
716 | "BGP view\n" | |
717 | "view name\n") | |
6b0655a2 | 718 | |
718e3744 | 719 | /* BGP router-id. */ |
720 | ||
721 | DEFUN (bgp_router_id, | |
722 | bgp_router_id_cmd, | |
723 | "bgp router-id A.B.C.D", | |
724 | BGP_STR | |
725 | "Override configured router identifier\n" | |
726 | "Manually configured router identifier\n") | |
727 | { | |
728 | int ret; | |
729 | struct in_addr id; | |
730 | struct bgp *bgp; | |
731 | ||
732 | bgp = vty->index; | |
733 | ||
734 | ret = inet_aton (argv[0], &id); | |
735 | if (! ret) | |
736 | { | |
737 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
738 | return CMD_WARNING; | |
739 | } | |
740 | ||
c2d58d6d | 741 | if (IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
742 | return CMD_SUCCESS; | |
743 | ||
18a6dce6 | 744 | bgp->router_id_static = id; |
718e3744 | 745 | bgp_router_id_set (bgp, &id); |
746 | ||
747 | return CMD_SUCCESS; | |
748 | } | |
749 | ||
750 | DEFUN (no_bgp_router_id, | |
751 | no_bgp_router_id_cmd, | |
752 | "no bgp router-id", | |
753 | NO_STR | |
754 | BGP_STR | |
755 | "Override configured router identifier\n") | |
756 | { | |
757 | int ret; | |
758 | struct in_addr id; | |
759 | struct bgp *bgp; | |
760 | ||
761 | bgp = vty->index; | |
762 | ||
763 | if (argc == 1) | |
764 | { | |
765 | ret = inet_aton (argv[0], &id); | |
766 | if (! ret) | |
767 | { | |
768 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
769 | return CMD_WARNING; | |
770 | } | |
771 | ||
18a6dce6 | 772 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
718e3744 | 773 | { |
774 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
775 | return CMD_WARNING; | |
776 | } | |
777 | } | |
778 | ||
18a6dce6 | 779 | bgp->router_id_static.s_addr = 0; |
780 | bgp_router_id_set (bgp, &router_id_zebra); | |
718e3744 | 781 | |
782 | return CMD_SUCCESS; | |
783 | } | |
784 | ||
785 | ALIAS (no_bgp_router_id, | |
786 | no_bgp_router_id_val_cmd, | |
787 | "no bgp router-id A.B.C.D", | |
788 | NO_STR | |
789 | BGP_STR | |
790 | "Override configured router identifier\n" | |
791 | "Manually configured router identifier\n") | |
6b0655a2 | 792 | |
718e3744 | 793 | /* BGP Cluster ID. */ |
794 | ||
795 | DEFUN (bgp_cluster_id, | |
796 | bgp_cluster_id_cmd, | |
797 | "bgp cluster-id A.B.C.D", | |
798 | BGP_STR | |
799 | "Configure Route-Reflector Cluster-id\n" | |
800 | "Route-Reflector Cluster-id in IP address format\n") | |
801 | { | |
802 | int ret; | |
803 | struct bgp *bgp; | |
804 | struct in_addr cluster; | |
805 | ||
806 | bgp = vty->index; | |
807 | ||
808 | ret = inet_aton (argv[0], &cluster); | |
809 | if (! ret) | |
810 | { | |
811 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
812 | return CMD_WARNING; | |
813 | } | |
814 | ||
815 | bgp_cluster_id_set (bgp, &cluster); | |
7aafcaca | 816 | bgp_clear_star_soft_out (vty); |
718e3744 | 817 | |
818 | return CMD_SUCCESS; | |
819 | } | |
820 | ||
821 | ALIAS (bgp_cluster_id, | |
822 | bgp_cluster_id32_cmd, | |
823 | "bgp cluster-id <1-4294967295>", | |
824 | BGP_STR | |
825 | "Configure Route-Reflector Cluster-id\n" | |
826 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
827 | ||
828 | DEFUN (no_bgp_cluster_id, | |
829 | no_bgp_cluster_id_cmd, | |
830 | "no bgp cluster-id", | |
831 | NO_STR | |
832 | BGP_STR | |
833 | "Configure Route-Reflector Cluster-id\n") | |
834 | { | |
835 | int ret; | |
836 | struct bgp *bgp; | |
837 | struct in_addr cluster; | |
838 | ||
839 | bgp = vty->index; | |
840 | ||
841 | if (argc == 1) | |
842 | { | |
843 | ret = inet_aton (argv[0], &cluster); | |
844 | if (! ret) | |
845 | { | |
846 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
847 | return CMD_WARNING; | |
848 | } | |
849 | } | |
850 | ||
851 | bgp_cluster_id_unset (bgp); | |
7aafcaca | 852 | bgp_clear_star_soft_out (vty); |
718e3744 | 853 | |
854 | return CMD_SUCCESS; | |
855 | } | |
856 | ||
857 | ALIAS (no_bgp_cluster_id, | |
813d4307 | 858 | no_bgp_cluster_id_ip_cmd, |
718e3744 | 859 | "no bgp cluster-id A.B.C.D", |
860 | NO_STR | |
861 | BGP_STR | |
862 | "Configure Route-Reflector Cluster-id\n" | |
863 | "Route-Reflector Cluster-id in IP address format\n") | |
6b0655a2 | 864 | |
813d4307 DW |
865 | ALIAS (no_bgp_cluster_id, |
866 | no_bgp_cluster_id_decimal_cmd, | |
867 | "no bgp cluster-id <1-4294967295>", | |
868 | NO_STR | |
869 | BGP_STR | |
870 | "Configure Route-Reflector Cluster-id\n" | |
871 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
872 | ||
718e3744 | 873 | DEFUN (bgp_confederation_identifier, |
874 | bgp_confederation_identifier_cmd, | |
320da874 | 875 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 876 | "BGP specific commands\n" |
877 | "AS confederation parameters\n" | |
878 | "AS number\n" | |
879 | "Set routing domain confederation AS\n") | |
880 | { | |
881 | struct bgp *bgp; | |
882 | as_t as; | |
883 | ||
884 | bgp = vty->index; | |
885 | ||
0b2aa3a0 | 886 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 887 | |
888 | bgp_confederation_id_set (bgp, as); | |
889 | ||
890 | return CMD_SUCCESS; | |
891 | } | |
892 | ||
893 | DEFUN (no_bgp_confederation_identifier, | |
894 | no_bgp_confederation_identifier_cmd, | |
895 | "no bgp confederation identifier", | |
896 | NO_STR | |
897 | "BGP specific commands\n" | |
898 | "AS confederation parameters\n" | |
899 | "AS number\n") | |
900 | { | |
901 | struct bgp *bgp; | |
718e3744 | 902 | |
903 | bgp = vty->index; | |
904 | ||
718e3744 | 905 | bgp_confederation_id_unset (bgp); |
906 | ||
907 | return CMD_SUCCESS; | |
908 | } | |
909 | ||
910 | ALIAS (no_bgp_confederation_identifier, | |
911 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 912 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 913 | NO_STR |
914 | "BGP specific commands\n" | |
915 | "AS confederation parameters\n" | |
916 | "AS number\n" | |
917 | "Set routing domain confederation AS\n") | |
6b0655a2 | 918 | |
718e3744 | 919 | DEFUN (bgp_confederation_peers, |
920 | bgp_confederation_peers_cmd, | |
320da874 | 921 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 922 | "BGP specific commands\n" |
923 | "AS confederation parameters\n" | |
924 | "Peer ASs in BGP confederation\n" | |
925 | AS_STR) | |
926 | { | |
927 | struct bgp *bgp; | |
928 | as_t as; | |
929 | int i; | |
930 | ||
931 | bgp = vty->index; | |
932 | ||
933 | for (i = 0; i < argc; i++) | |
934 | { | |
0b2aa3a0 | 935 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 936 | |
937 | if (bgp->as == as) | |
938 | { | |
939 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
940 | VTY_NEWLINE); | |
941 | continue; | |
942 | } | |
943 | ||
944 | bgp_confederation_peers_add (bgp, as); | |
945 | } | |
946 | return CMD_SUCCESS; | |
947 | } | |
948 | ||
949 | DEFUN (no_bgp_confederation_peers, | |
950 | no_bgp_confederation_peers_cmd, | |
320da874 | 951 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 952 | NO_STR |
953 | "BGP specific commands\n" | |
954 | "AS confederation parameters\n" | |
955 | "Peer ASs in BGP confederation\n" | |
956 | AS_STR) | |
957 | { | |
958 | struct bgp *bgp; | |
959 | as_t as; | |
960 | int i; | |
961 | ||
962 | bgp = vty->index; | |
963 | ||
964 | for (i = 0; i < argc; i++) | |
965 | { | |
0b2aa3a0 PJ |
966 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
967 | ||
718e3744 | 968 | bgp_confederation_peers_remove (bgp, as); |
969 | } | |
970 | return CMD_SUCCESS; | |
971 | } | |
6b0655a2 | 972 | |
5e242b0d DS |
973 | /** |
974 | * Central routine for maximum-paths configuration. | |
975 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
976 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
977 | */ | |
ffd0c037 DS |
978 | static int |
979 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, | |
5e242b0d | 980 | u_int16_t options, int set) |
165b5fff JB |
981 | { |
982 | struct bgp *bgp; | |
ffd0c037 | 983 | u_int16_t maxpaths = 0; |
165b5fff | 984 | int ret; |
5e242b0d DS |
985 | afi_t afi; |
986 | safi_t safi; | |
165b5fff JB |
987 | |
988 | bgp = vty->index; | |
5e242b0d DS |
989 | afi = bgp_node_afi (vty); |
990 | safi = bgp_node_safi (vty); | |
165b5fff | 991 | |
5e242b0d DS |
992 | if (set) |
993 | { | |
73ac8160 DS |
994 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
995 | BGP_MAXIMUM_MAXPATHS); | |
5e242b0d DS |
996 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
997 | options); | |
998 | } | |
999 | else | |
1000 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 1001 | |
165b5fff JB |
1002 | if (ret < 0) |
1003 | { | |
1004 | vty_out (vty, | |
5e242b0d DS |
1005 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
1006 | (set == 1) ? "" : "un", | |
1007 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
1008 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
1009 | return CMD_WARNING; |
1010 | } | |
1011 | ||
7aafcaca DS |
1012 | bgp_recalculate_all_bestpaths (bgp); |
1013 | ||
7c5d2b76 | 1014 | if (maxpaths > MULTIPATH_NUM) |
6878b9db DS |
1015 | vty_out (vty, |
1016 | "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s", | |
1017 | maxpaths, MULTIPATH_NUM, VTY_NEWLINE); | |
1018 | ||
165b5fff JB |
1019 | return CMD_SUCCESS; |
1020 | } | |
1021 | ||
abc920f8 DS |
1022 | DEFUN (bgp_maxmed_admin, |
1023 | bgp_maxmed_admin_cmd, | |
1024 | "bgp max-med administrative ", | |
1025 | BGP_STR | |
1026 | "Advertise routes with max-med\n" | |
1027 | "Administratively applied, for an indefinite period\n") | |
1028 | { | |
1029 | struct bgp *bgp; | |
1030 | ||
1031 | bgp = vty->index; | |
1032 | ||
1033 | bgp->v_maxmed_admin = 1; | |
1034 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1035 | ||
1036 | bgp_maxmed_update(bgp); | |
1037 | ||
1038 | return CMD_SUCCESS; | |
1039 | } | |
1040 | ||
1041 | DEFUN (bgp_maxmed_admin_medv, | |
1042 | bgp_maxmed_admin_medv_cmd, | |
1043 | "bgp max-med administrative <0-4294967294>", | |
1044 | BGP_STR | |
1045 | "Advertise routes with max-med\n" | |
1046 | "Administratively applied, for an indefinite period\n" | |
1047 | "Max MED value to be used\n") | |
1048 | { | |
1049 | struct bgp *bgp; | |
1050 | ||
1051 | bgp = vty->index; | |
1052 | ||
1053 | bgp->v_maxmed_admin = 1; | |
1054 | VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]); | |
1055 | ||
1056 | bgp_maxmed_update(bgp); | |
1057 | ||
1058 | return CMD_SUCCESS; | |
1059 | } | |
1060 | ||
1061 | DEFUN (no_bgp_maxmed_admin, | |
1062 | no_bgp_maxmed_admin_cmd, | |
1063 | "no bgp max-med administrative", | |
1064 | NO_STR | |
1065 | BGP_STR | |
1066 | "Advertise routes with max-med\n" | |
1067 | "Administratively applied, for an indefinite period\n") | |
1068 | { | |
1069 | struct bgp *bgp; | |
1070 | ||
1071 | bgp = vty->index; | |
1072 | ||
1073 | bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED; | |
1074 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1075 | ||
1076 | bgp_maxmed_update(bgp); | |
1077 | ||
1078 | return CMD_SUCCESS; | |
1079 | } | |
1080 | ||
1081 | ALIAS (no_bgp_maxmed_admin, | |
1082 | no_bgp_maxmed_admin_medv_cmd, | |
1083 | "no bgp max-med administrative <0-4294967294>", | |
1084 | NO_STR | |
1085 | BGP_STR | |
1086 | "Advertise routes with max-med\n" | |
1087 | "Administratively applied, for an indefinite period\n" | |
1088 | "Max MED value to be used\n") | |
1089 | ||
1090 | ||
1091 | DEFUN (bgp_maxmed_onstartup, | |
1092 | bgp_maxmed_onstartup_cmd, | |
1093 | "bgp max-med on-startup <5-86400>", | |
1094 | BGP_STR | |
1095 | "Advertise routes with max-med\n" | |
1096 | "Effective on a startup\n" | |
1097 | "Time (seconds) period for max-med\n") | |
1098 | { | |
1099 | struct bgp *bgp; | |
1100 | ||
1101 | bgp = vty->index; | |
1102 | ||
1103 | if (argc != 1) | |
1104 | { | |
1105 | vty_out (vty, "%% Must supply max-med on-startup period"); | |
1106 | return CMD_WARNING; | |
1107 | } | |
1108 | ||
1109 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1110 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1111 | ||
1112 | bgp_maxmed_update(bgp); | |
1113 | ||
1114 | return CMD_SUCCESS; | |
1115 | } | |
1116 | ||
1117 | DEFUN (bgp_maxmed_onstartup_medv, | |
1118 | bgp_maxmed_onstartup_medv_cmd, | |
1119 | "bgp max-med on-startup <5-86400> <0-4294967294>", | |
1120 | BGP_STR | |
1121 | "Advertise routes with max-med\n" | |
1122 | "Effective on a startup\n" | |
1123 | "Time (seconds) period for max-med\n" | |
1124 | "Max MED value to be used\n") | |
1125 | { | |
1126 | struct bgp *bgp; | |
1127 | ||
1128 | bgp = vty->index; | |
1129 | ||
1130 | if (argc != 2) | |
1131 | { | |
1132 | vty_out (vty, "%% Must supply max-med on-startup period and med value"); | |
1133 | return CMD_WARNING; | |
1134 | } | |
1135 | ||
1136 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1137 | VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]); | |
1138 | ||
1139 | bgp_maxmed_update(bgp); | |
1140 | ||
1141 | return CMD_SUCCESS; | |
1142 | } | |
1143 | ||
1144 | DEFUN (no_bgp_maxmed_onstartup, | |
1145 | no_bgp_maxmed_onstartup_cmd, | |
1146 | "no bgp max-med on-startup", | |
1147 | NO_STR | |
1148 | BGP_STR | |
1149 | "Advertise routes with max-med\n" | |
1150 | "Effective on a startup\n") | |
1151 | { | |
1152 | struct bgp *bgp; | |
1153 | ||
1154 | bgp = vty->index; | |
1155 | ||
1156 | /* Cancel max-med onstartup if its on */ | |
1157 | if (bgp->t_maxmed_onstartup) | |
1158 | { | |
1159 | THREAD_TIMER_OFF (bgp->t_maxmed_onstartup); | |
1160 | bgp->maxmed_onstartup_over = 1; | |
1161 | } | |
1162 | ||
1163 | bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED; | |
1164 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1165 | ||
1166 | bgp_maxmed_update(bgp); | |
1167 | ||
1168 | return CMD_SUCCESS; | |
1169 | } | |
1170 | ||
1171 | ALIAS (no_bgp_maxmed_onstartup, | |
1172 | no_bgp_maxmed_onstartup_period_cmd, | |
1173 | "no bgp max-med on-startup <5-86400>", | |
1174 | NO_STR | |
1175 | BGP_STR | |
1176 | "Advertise routes with max-med\n" | |
1177 | "Effective on a startup\n" | |
1178 | "Time (seconds) period for max-med\n") | |
1179 | ||
1180 | ALIAS (no_bgp_maxmed_onstartup, | |
1181 | no_bgp_maxmed_onstartup_period_medv_cmd, | |
1182 | "no bgp max-med on-startup <5-86400> <0-4294967294>", | |
1183 | NO_STR | |
1184 | BGP_STR | |
1185 | "Advertise routes with max-med\n" | |
1186 | "Effective on a startup\n" | |
1187 | "Time (seconds) period for max-med\n" | |
1188 | "Max MED value to be used\n") | |
1189 | ||
f188f2c4 DS |
1190 | static int |
1191 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
1192 | const char *wait) | |
1193 | { | |
1194 | struct bgp *bgp; | |
1195 | u_int16_t update_delay; | |
1196 | u_int16_t establish_wait; | |
1197 | ||
1198 | ||
1199 | bgp = vty->index; | |
1200 | ||
1201 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
1202 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
1203 | ||
1204 | if (!wait) /* update-delay <delay> */ | |
1205 | { | |
1206 | bgp->v_update_delay = update_delay; | |
1207 | bgp->v_establish_wait = bgp->v_update_delay; | |
1208 | return CMD_SUCCESS; | |
1209 | } | |
1210 | ||
1211 | /* update-delay <delay> <establish-wait> */ | |
1212 | establish_wait = atoi (wait); | |
1213 | if (update_delay < establish_wait) | |
1214 | { | |
1215 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
1216 | VTY_NEWLINE); | |
1217 | return CMD_WARNING; | |
1218 | } | |
1219 | ||
1220 | bgp->v_update_delay = update_delay; | |
1221 | bgp->v_establish_wait = establish_wait; | |
1222 | ||
1223 | return CMD_SUCCESS; | |
1224 | } | |
1225 | ||
1226 | static int | |
1227 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
1228 | { | |
1229 | struct bgp *bgp; | |
1230 | ||
1231 | bgp = vty->index; | |
1232 | ||
1233 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
1234 | bgp->v_establish_wait = bgp->v_update_delay; | |
1235 | ||
1236 | return CMD_SUCCESS; | |
1237 | } | |
1238 | ||
1239 | int | |
1240 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
1241 | { | |
1242 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
1243 | { | |
1244 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
1245 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
1246 | vty_out (vty, " %d", bgp->v_establish_wait); | |
1247 | vty_out (vty, "%s", VTY_NEWLINE); | |
1248 | } | |
1249 | ||
1250 | return 0; | |
1251 | } | |
1252 | ||
1253 | ||
1254 | /* Update-delay configuration */ | |
1255 | DEFUN (bgp_update_delay, | |
1256 | bgp_update_delay_cmd, | |
1257 | "update-delay <0-3600>", | |
1258 | "Force initial delay for best-path and updates\n" | |
1259 | "Seconds\n") | |
1260 | { | |
1261 | return bgp_update_delay_config_vty(vty, argv[0], NULL); | |
1262 | } | |
1263 | ||
1264 | DEFUN (bgp_update_delay_establish_wait, | |
1265 | bgp_update_delay_establish_wait_cmd, | |
1266 | "update-delay <0-3600> <1-3600>", | |
1267 | "Force initial delay for best-path and updates\n" | |
1268 | "Seconds\n" | |
1269 | "Wait for peers to be established\n" | |
1270 | "Seconds\n") | |
1271 | { | |
1272 | return bgp_update_delay_config_vty(vty, argv[0], argv[1]); | |
1273 | } | |
1274 | ||
1275 | /* Update-delay deconfiguration */ | |
1276 | DEFUN (no_bgp_update_delay, | |
1277 | no_bgp_update_delay_cmd, | |
1278 | "no update-delay <0-3600>", | |
1279 | "Force initial delay for best-path and updates\n" | |
1280 | "Seconds\n") | |
1281 | { | |
1282 | return bgp_update_delay_deconfig_vty(vty); | |
1283 | } | |
1284 | ||
1285 | ALIAS (no_bgp_update_delay, | |
1286 | no_bgp_update_delay_establish_wait_cmd, | |
1287 | "no update-delay <0-3600> <1-3600>", | |
1288 | "Force initial delay for best-path and updates\n" | |
1289 | "Seconds\n" | |
1290 | "Wait for peers to be established\n" | |
1291 | "Seconds\n") | |
5e242b0d | 1292 | |
ffd0c037 DS |
1293 | static int |
1294 | bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set) | |
cb1faec9 DS |
1295 | { |
1296 | struct bgp *bgp; | |
cb1faec9 DS |
1297 | |
1298 | bgp = vty->index; | |
1299 | ||
1300 | if (set) | |
1301 | VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num, | |
1302 | 1, 4294967295); | |
1303 | else | |
1304 | bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX; | |
1305 | ||
1306 | return CMD_SUCCESS; | |
1307 | } | |
1308 | ||
1309 | int | |
1310 | bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) | |
1311 | { | |
1312 | if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX) | |
1313 | vty_out (vty, " write-quanta %d%s", | |
1314 | bgp->wpkt_quanta, VTY_NEWLINE); | |
1315 | ||
1316 | return 0; | |
1317 | } | |
1318 | ||
1319 | ||
1320 | /* Update-delay configuration */ | |
1321 | DEFUN (bgp_wpkt_quanta, | |
1322 | bgp_wpkt_quanta_cmd, | |
1323 | "write-quanta <1-4294967295>", | |
1324 | "How many packets to write to peer socket per run\n" | |
1325 | "Number of packets\n") | |
1326 | { | |
1327 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 1); | |
1328 | } | |
1329 | ||
1330 | /* Update-delay deconfiguration */ | |
1331 | DEFUN (no_bgp_wpkt_quanta, | |
1332 | no_bgp_wpkt_quanta_cmd, | |
1333 | "no write-quanta <1-4294967295>", | |
1334 | "How many packets to write to peer socket per run\n" | |
1335 | "Number of packets\n") | |
1336 | { | |
1337 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); | |
1338 | } | |
1339 | ||
ffd0c037 | 1340 | static int |
3f9c7369 DS |
1341 | bgp_coalesce_config_vty (struct vty *vty, const char *num, char set) |
1342 | { | |
1343 | struct bgp *bgp; | |
1344 | ||
1345 | bgp = vty->index; | |
1346 | ||
1347 | if (set) | |
1348 | VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num, | |
1349 | 0, 4294967295); | |
1350 | else | |
1351 | bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; | |
1352 | ||
1353 | return CMD_SUCCESS; | |
1354 | } | |
1355 | ||
1356 | int | |
1357 | bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp) | |
1358 | { | |
1359 | if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME) | |
1360 | vty_out (vty, " coalesce-time %d%s", | |
1361 | bgp->coalesce_time, VTY_NEWLINE); | |
1362 | ||
1363 | return 0; | |
1364 | } | |
1365 | ||
1366 | ||
1367 | DEFUN (bgp_coalesce_time, | |
1368 | bgp_coalesce_time_cmd, | |
1369 | "coalesce-time <0-4294967295>", | |
1370 | "Subgroup coalesce timer\n" | |
1371 | "Subgroup coalesce timer value (in ms)\n") | |
1372 | { | |
1373 | return bgp_coalesce_config_vty(vty, argv[0], 1); | |
1374 | } | |
1375 | ||
1376 | DEFUN (no_bgp_coalesce_time, | |
1377 | no_bgp_coalesce_time_cmd, | |
1378 | "no coalesce-time <0-4294967295>", | |
1379 | "Subgroup coalesce timer\n" | |
1380 | "Subgroup coalesce timer value (in ms)\n") | |
1381 | { | |
1382 | return bgp_coalesce_config_vty(vty, argv[0], 0); | |
1383 | } | |
1384 | ||
5e242b0d DS |
1385 | /* Maximum-paths configuration */ |
1386 | DEFUN (bgp_maxpaths, | |
1387 | bgp_maxpaths_cmd, | |
1388 | "maximum-paths <1-255>", | |
1389 | "Forward packets over multiple paths\n" | |
1390 | "Number of paths\n") | |
1391 | { | |
1392 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); | |
1393 | } | |
1394 | ||
165b5fff JB |
1395 | DEFUN (bgp_maxpaths_ibgp, |
1396 | bgp_maxpaths_ibgp_cmd, | |
1397 | "maximum-paths ibgp <1-255>", | |
1398 | "Forward packets over multiple paths\n" | |
1399 | "iBGP-multipath\n" | |
1400 | "Number of paths\n") | |
1401 | { | |
5e242b0d DS |
1402 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); |
1403 | } | |
165b5fff | 1404 | |
5e242b0d DS |
1405 | DEFUN (bgp_maxpaths_ibgp_cluster, |
1406 | bgp_maxpaths_ibgp_cluster_cmd, | |
1407 | "maximum-paths ibgp <1-255> equal-cluster-length", | |
1408 | "Forward packets over multiple paths\n" | |
1409 | "iBGP-multipath\n" | |
1410 | "Number of paths\n" | |
1411 | "Match the cluster length\n") | |
1412 | { | |
1413 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], | |
1414 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); | |
165b5fff JB |
1415 | } |
1416 | ||
1417 | DEFUN (no_bgp_maxpaths, | |
1418 | no_bgp_maxpaths_cmd, | |
1419 | "no maximum-paths", | |
1420 | NO_STR | |
1421 | "Forward packets over multiple paths\n" | |
1422 | "Number of paths\n") | |
1423 | { | |
5e242b0d | 1424 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
1425 | } |
1426 | ||
1427 | ALIAS (no_bgp_maxpaths, | |
1428 | no_bgp_maxpaths_arg_cmd, | |
1429 | "no maximum-paths <1-255>", | |
1430 | NO_STR | |
1431 | "Forward packets over multiple paths\n" | |
1432 | "Number of paths\n") | |
1433 | ||
1434 | DEFUN (no_bgp_maxpaths_ibgp, | |
1435 | no_bgp_maxpaths_ibgp_cmd, | |
1436 | "no maximum-paths ibgp", | |
1437 | NO_STR | |
1438 | "Forward packets over multiple paths\n" | |
1439 | "iBGP-multipath\n" | |
1440 | "Number of paths\n") | |
1441 | { | |
5e242b0d | 1442 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
1443 | } |
1444 | ||
1445 | ALIAS (no_bgp_maxpaths_ibgp, | |
1446 | no_bgp_maxpaths_ibgp_arg_cmd, | |
1447 | "no maximum-paths ibgp <1-255>", | |
1448 | NO_STR | |
1449 | "Forward packets over multiple paths\n" | |
1450 | "iBGP-multipath\n" | |
1451 | "Number of paths\n") | |
1452 | ||
5e242b0d DS |
1453 | ALIAS (no_bgp_maxpaths_ibgp, |
1454 | no_bgp_maxpaths_ibgp_cluster_cmd, | |
1455 | "no maximum-paths ibgp <1-255> equal-cluster-length", | |
1456 | NO_STR | |
1457 | "Forward packets over multiple paths\n" | |
1458 | "iBGP-multipath\n" | |
1459 | "Number of paths\n" | |
1460 | "Match the cluster length\n") | |
1461 | ||
165b5fff JB |
1462 | int |
1463 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
1464 | safi_t safi, int *write) | |
1465 | { | |
1466 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) | |
1467 | { | |
1468 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1469 | vty_out (vty, " maximum-paths %d%s", |
165b5fff JB |
1470 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); |
1471 | } | |
1472 | ||
1473 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) | |
1474 | { | |
1475 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1476 | vty_out (vty, " maximum-paths ibgp %d", |
5e242b0d DS |
1477 | bgp->maxpaths[afi][safi].maxpaths_ibgp); |
1478 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
1479 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
1480 | vty_out (vty, " equal-cluster-length"); | |
1481 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
1482 | } |
1483 | ||
1484 | return 0; | |
1485 | } | |
6b0655a2 | 1486 | |
718e3744 | 1487 | /* BGP timers. */ |
1488 | ||
1489 | DEFUN (bgp_timers, | |
1490 | bgp_timers_cmd, | |
1491 | "timers bgp <0-65535> <0-65535>", | |
1492 | "Adjust routing timers\n" | |
1493 | "BGP timers\n" | |
1494 | "Keepalive interval\n" | |
1495 | "Holdtime\n") | |
1496 | { | |
1497 | struct bgp *bgp; | |
1498 | unsigned long keepalive = 0; | |
1499 | unsigned long holdtime = 0; | |
1500 | ||
1501 | bgp = vty->index; | |
1502 | ||
1503 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
1504 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
1505 | ||
1506 | /* Holdtime value check. */ | |
1507 | if (holdtime < 3 && holdtime != 0) | |
1508 | { | |
1509 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
1510 | VTY_NEWLINE); | |
1511 | return CMD_WARNING; | |
1512 | } | |
1513 | ||
1514 | bgp_timers_set (bgp, keepalive, holdtime); | |
1515 | ||
1516 | return CMD_SUCCESS; | |
1517 | } | |
1518 | ||
1519 | DEFUN (no_bgp_timers, | |
1520 | no_bgp_timers_cmd, | |
1521 | "no timers bgp", | |
1522 | NO_STR | |
1523 | "Adjust routing timers\n" | |
1524 | "BGP timers\n") | |
1525 | { | |
1526 | struct bgp *bgp; | |
1527 | ||
1528 | bgp = vty->index; | |
1529 | bgp_timers_unset (bgp); | |
1530 | ||
1531 | return CMD_SUCCESS; | |
1532 | } | |
1533 | ||
1534 | ALIAS (no_bgp_timers, | |
1535 | no_bgp_timers_arg_cmd, | |
1536 | "no timers bgp <0-65535> <0-65535>", | |
1537 | NO_STR | |
1538 | "Adjust routing timers\n" | |
1539 | "BGP timers\n" | |
1540 | "Keepalive interval\n" | |
1541 | "Holdtime\n") | |
6b0655a2 | 1542 | |
718e3744 | 1543 | DEFUN (bgp_client_to_client_reflection, |
1544 | bgp_client_to_client_reflection_cmd, | |
1545 | "bgp client-to-client reflection", | |
1546 | "BGP specific commands\n" | |
1547 | "Configure client to client route reflection\n" | |
1548 | "reflection of routes allowed\n") | |
1549 | { | |
1550 | struct bgp *bgp; | |
1551 | ||
1552 | bgp = vty->index; | |
1553 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
7aafcaca DS |
1554 | bgp_clear_star_soft_out (vty); |
1555 | ||
718e3744 | 1556 | return CMD_SUCCESS; |
1557 | } | |
1558 | ||
1559 | DEFUN (no_bgp_client_to_client_reflection, | |
1560 | no_bgp_client_to_client_reflection_cmd, | |
1561 | "no bgp client-to-client reflection", | |
1562 | NO_STR | |
1563 | "BGP specific commands\n" | |
1564 | "Configure client to client route reflection\n" | |
1565 | "reflection of routes allowed\n") | |
1566 | { | |
1567 | struct bgp *bgp; | |
1568 | ||
1569 | bgp = vty->index; | |
1570 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
7aafcaca DS |
1571 | bgp_clear_star_soft_out (vty); |
1572 | ||
718e3744 | 1573 | return CMD_SUCCESS; |
1574 | } | |
1575 | ||
1576 | /* "bgp always-compare-med" configuration. */ | |
1577 | DEFUN (bgp_always_compare_med, | |
1578 | bgp_always_compare_med_cmd, | |
1579 | "bgp always-compare-med", | |
1580 | "BGP specific commands\n" | |
1581 | "Allow comparing MED from different neighbors\n") | |
1582 | { | |
1583 | struct bgp *bgp; | |
1584 | ||
1585 | bgp = vty->index; | |
1586 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1587 | bgp_recalculate_all_bestpaths (bgp); |
1588 | ||
718e3744 | 1589 | return CMD_SUCCESS; |
1590 | } | |
1591 | ||
1592 | DEFUN (no_bgp_always_compare_med, | |
1593 | no_bgp_always_compare_med_cmd, | |
1594 | "no bgp always-compare-med", | |
1595 | NO_STR | |
1596 | "BGP specific commands\n" | |
1597 | "Allow comparing MED from different neighbors\n") | |
1598 | { | |
1599 | struct bgp *bgp; | |
1600 | ||
1601 | bgp = vty->index; | |
1602 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1603 | bgp_recalculate_all_bestpaths (bgp); |
1604 | ||
718e3744 | 1605 | return CMD_SUCCESS; |
1606 | } | |
6b0655a2 | 1607 | |
718e3744 | 1608 | /* "bgp deterministic-med" configuration. */ |
1609 | DEFUN (bgp_deterministic_med, | |
1610 | bgp_deterministic_med_cmd, | |
1611 | "bgp deterministic-med", | |
1612 | "BGP specific commands\n" | |
1613 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1614 | { | |
1615 | struct bgp *bgp; | |
1616 | ||
1617 | bgp = vty->index; | |
1475ac87 DW |
1618 | |
1619 | if (!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1620 | { | |
1621 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1622 | bgp_recalculate_all_bestpaths (bgp); | |
1623 | } | |
7aafcaca | 1624 | |
718e3744 | 1625 | return CMD_SUCCESS; |
1626 | } | |
1627 | ||
1628 | DEFUN (no_bgp_deterministic_med, | |
1629 | no_bgp_deterministic_med_cmd, | |
1630 | "no bgp deterministic-med", | |
1631 | NO_STR | |
1632 | "BGP specific commands\n" | |
1633 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1634 | { | |
1635 | struct bgp *bgp; | |
06370dac DW |
1636 | int bestpath_per_as_used; |
1637 | afi_t afi; | |
1638 | safi_t safi; | |
1639 | struct peer *peer; | |
1640 | struct listnode *node, *nnode; | |
718e3744 | 1641 | |
1642 | bgp = vty->index; | |
1475ac87 DW |
1643 | |
1644 | if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1645 | { | |
06370dac DW |
1646 | bestpath_per_as_used = 0; |
1647 | ||
1648 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
1649 | { | |
1650 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
1651 | for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) | |
1652 | if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) | |
1653 | { | |
1654 | bestpath_per_as_used = 1; | |
1655 | break; | |
1656 | } | |
1657 | ||
1658 | if (bestpath_per_as_used) | |
1659 | break; | |
1660 | } | |
1661 | ||
1662 | if (bestpath_per_as_used) | |
1663 | { | |
1664 | vty_out (vty, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s", | |
1665 | VTY_NEWLINE); | |
1666 | return CMD_WARNING; | |
1667 | } | |
1668 | else | |
1669 | { | |
1670 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1671 | bgp_recalculate_all_bestpaths (bgp); | |
1672 | } | |
1475ac87 | 1673 | } |
7aafcaca | 1674 | |
718e3744 | 1675 | return CMD_SUCCESS; |
1676 | } | |
538621f2 | 1677 | |
1678 | /* "bgp graceful-restart" configuration. */ | |
1679 | DEFUN (bgp_graceful_restart, | |
1680 | bgp_graceful_restart_cmd, | |
1681 | "bgp graceful-restart", | |
1682 | "BGP specific commands\n" | |
1683 | "Graceful restart capability parameters\n") | |
1684 | { | |
1685 | struct bgp *bgp; | |
1686 | ||
1687 | bgp = vty->index; | |
1688 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1689 | return CMD_SUCCESS; | |
1690 | } | |
1691 | ||
1692 | DEFUN (no_bgp_graceful_restart, | |
1693 | no_bgp_graceful_restart_cmd, | |
1694 | "no bgp graceful-restart", | |
1695 | NO_STR | |
1696 | "BGP specific commands\n" | |
1697 | "Graceful restart capability parameters\n") | |
1698 | { | |
1699 | struct bgp *bgp; | |
1700 | ||
1701 | bgp = vty->index; | |
1702 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1703 | return CMD_SUCCESS; | |
1704 | } | |
1705 | ||
93406d87 | 1706 | DEFUN (bgp_graceful_restart_stalepath_time, |
1707 | bgp_graceful_restart_stalepath_time_cmd, | |
1708 | "bgp graceful-restart stalepath-time <1-3600>", | |
1709 | "BGP specific commands\n" | |
1710 | "Graceful restart capability parameters\n" | |
1711 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1712 | "Delay value (seconds)\n") | |
1713 | { | |
1714 | struct bgp *bgp; | |
1715 | u_int32_t stalepath; | |
1716 | ||
1717 | bgp = vty->index; | |
1718 | if (! bgp) | |
1719 | return CMD_WARNING; | |
1720 | ||
1721 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
1722 | bgp->stalepath_time = stalepath; | |
1723 | return CMD_SUCCESS; | |
1724 | } | |
1725 | ||
1726 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
1727 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1728 | "no bgp graceful-restart stalepath-time", | |
1729 | NO_STR | |
1730 | "BGP specific commands\n" | |
1731 | "Graceful restart capability parameters\n" | |
1732 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1733 | { | |
1734 | struct bgp *bgp; | |
1735 | ||
1736 | bgp = vty->index; | |
1737 | if (! bgp) | |
1738 | return CMD_WARNING; | |
1739 | ||
1740 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1741 | return CMD_SUCCESS; | |
1742 | } | |
1743 | ||
1744 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
1745 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
1746 | "no bgp graceful-restart stalepath-time <1-3600>", | |
1747 | NO_STR | |
1748 | "BGP specific commands\n" | |
1749 | "Graceful restart capability parameters\n" | |
1750 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1751 | "Delay value (seconds)\n") | |
1752 | ||
718e3744 | 1753 | /* "bgp fast-external-failover" configuration. */ |
1754 | DEFUN (bgp_fast_external_failover, | |
1755 | bgp_fast_external_failover_cmd, | |
1756 | "bgp fast-external-failover", | |
1757 | BGP_STR | |
1758 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1759 | { | |
1760 | struct bgp *bgp; | |
1761 | ||
1762 | bgp = vty->index; | |
1763 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1764 | return CMD_SUCCESS; | |
1765 | } | |
1766 | ||
1767 | DEFUN (no_bgp_fast_external_failover, | |
1768 | no_bgp_fast_external_failover_cmd, | |
1769 | "no bgp fast-external-failover", | |
1770 | NO_STR | |
1771 | BGP_STR | |
1772 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1773 | { | |
1774 | struct bgp *bgp; | |
1775 | ||
1776 | bgp = vty->index; | |
1777 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1778 | return CMD_SUCCESS; | |
1779 | } | |
6b0655a2 | 1780 | |
718e3744 | 1781 | /* "bgp enforce-first-as" configuration. */ |
1782 | DEFUN (bgp_enforce_first_as, | |
1783 | bgp_enforce_first_as_cmd, | |
1784 | "bgp enforce-first-as", | |
1785 | BGP_STR | |
1786 | "Enforce the first AS for EBGP routes\n") | |
1787 | { | |
1788 | struct bgp *bgp; | |
1789 | ||
1790 | bgp = vty->index; | |
1791 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
7aafcaca DS |
1792 | bgp_clear_star_soft_in (vty); |
1793 | ||
718e3744 | 1794 | return CMD_SUCCESS; |
1795 | } | |
1796 | ||
1797 | DEFUN (no_bgp_enforce_first_as, | |
1798 | no_bgp_enforce_first_as_cmd, | |
1799 | "no bgp enforce-first-as", | |
1800 | NO_STR | |
1801 | BGP_STR | |
1802 | "Enforce the first AS for EBGP routes\n") | |
1803 | { | |
1804 | struct bgp *bgp; | |
1805 | ||
1806 | bgp = vty->index; | |
1807 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
7aafcaca DS |
1808 | bgp_clear_star_soft_in (vty); |
1809 | ||
718e3744 | 1810 | return CMD_SUCCESS; |
1811 | } | |
6b0655a2 | 1812 | |
718e3744 | 1813 | /* "bgp bestpath compare-routerid" configuration. */ |
1814 | DEFUN (bgp_bestpath_compare_router_id, | |
1815 | bgp_bestpath_compare_router_id_cmd, | |
1816 | "bgp bestpath compare-routerid", | |
1817 | "BGP specific commands\n" | |
1818 | "Change the default bestpath selection\n" | |
1819 | "Compare router-id for identical EBGP paths\n") | |
1820 | { | |
1821 | struct bgp *bgp; | |
1822 | ||
1823 | bgp = vty->index; | |
1824 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1825 | bgp_recalculate_all_bestpaths (bgp); |
1826 | ||
718e3744 | 1827 | return CMD_SUCCESS; |
1828 | } | |
1829 | ||
1830 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1831 | no_bgp_bestpath_compare_router_id_cmd, | |
1832 | "no bgp bestpath compare-routerid", | |
1833 | NO_STR | |
1834 | "BGP specific commands\n" | |
1835 | "Change the default bestpath selection\n" | |
1836 | "Compare router-id for identical EBGP paths\n") | |
1837 | { | |
1838 | struct bgp *bgp; | |
1839 | ||
1840 | bgp = vty->index; | |
1841 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1842 | bgp_recalculate_all_bestpaths (bgp); |
1843 | ||
718e3744 | 1844 | return CMD_SUCCESS; |
1845 | } | |
6b0655a2 | 1846 | |
718e3744 | 1847 | /* "bgp bestpath as-path ignore" configuration. */ |
1848 | DEFUN (bgp_bestpath_aspath_ignore, | |
1849 | bgp_bestpath_aspath_ignore_cmd, | |
1850 | "bgp bestpath as-path ignore", | |
1851 | "BGP specific commands\n" | |
1852 | "Change the default bestpath selection\n" | |
1853 | "AS-path attribute\n" | |
1854 | "Ignore as-path length in selecting a route\n") | |
1855 | { | |
1856 | struct bgp *bgp; | |
1857 | ||
1858 | bgp = vty->index; | |
1859 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1860 | bgp_recalculate_all_bestpaths (bgp); |
1861 | ||
718e3744 | 1862 | return CMD_SUCCESS; |
1863 | } | |
1864 | ||
1865 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
1866 | no_bgp_bestpath_aspath_ignore_cmd, | |
1867 | "no bgp bestpath as-path ignore", | |
1868 | NO_STR | |
1869 | "BGP specific commands\n" | |
1870 | "Change the default bestpath selection\n" | |
1871 | "AS-path attribute\n" | |
1872 | "Ignore as-path length in selecting a route\n") | |
1873 | { | |
1874 | struct bgp *bgp; | |
1875 | ||
1876 | bgp = vty->index; | |
1877 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1878 | bgp_recalculate_all_bestpaths (bgp); |
1879 | ||
718e3744 | 1880 | return CMD_SUCCESS; |
1881 | } | |
6b0655a2 | 1882 | |
6811845b | 1883 | /* "bgp bestpath as-path confed" configuration. */ |
1884 | DEFUN (bgp_bestpath_aspath_confed, | |
1885 | bgp_bestpath_aspath_confed_cmd, | |
1886 | "bgp bestpath as-path confed", | |
1887 | "BGP specific commands\n" | |
1888 | "Change the default bestpath selection\n" | |
1889 | "AS-path attribute\n" | |
1890 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1891 | { | |
1892 | struct bgp *bgp; | |
1893 | ||
1894 | bgp = vty->index; | |
1895 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1896 | bgp_recalculate_all_bestpaths (bgp); |
1897 | ||
6811845b | 1898 | return CMD_SUCCESS; |
1899 | } | |
1900 | ||
1901 | DEFUN (no_bgp_bestpath_aspath_confed, | |
1902 | no_bgp_bestpath_aspath_confed_cmd, | |
1903 | "no bgp bestpath as-path confed", | |
1904 | NO_STR | |
1905 | "BGP specific commands\n" | |
1906 | "Change the default bestpath selection\n" | |
1907 | "AS-path attribute\n" | |
1908 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1909 | { | |
1910 | struct bgp *bgp; | |
1911 | ||
1912 | bgp = vty->index; | |
1913 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1914 | bgp_recalculate_all_bestpaths (bgp); |
1915 | ||
6811845b | 1916 | return CMD_SUCCESS; |
1917 | } | |
6b0655a2 | 1918 | |
2fdd455c PM |
1919 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
1920 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
1921 | bgp_bestpath_aspath_multipath_relax_cmd, | |
219178b6 | 1922 | "bgp bestpath as-path multipath-relax {as-set|no-as-set}", |
16fc1eec DS |
1923 | "BGP specific commands\n" |
1924 | "Change the default bestpath selection\n" | |
1925 | "AS-path attribute\n" | |
1926 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
219178b6 | 1927 | "Generate an AS_SET\n" |
16fc1eec DS |
1928 | "Do not generate an AS_SET\n") |
1929 | { | |
1930 | struct bgp *bgp; | |
1931 | ||
1932 | bgp = vty->index; | |
1933 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
219178b6 DW |
1934 | |
1935 | /* no-as-set is now the default behavior so we can silently | |
1936 | * ignore it */ | |
1937 | if (argv[0] != NULL && strncmp (argv[0], "a", 1) == 0) | |
1938 | bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); | |
1939 | else | |
1940 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ; | |
1941 | ||
7aafcaca DS |
1942 | bgp_recalculate_all_bestpaths (bgp); |
1943 | ||
16fc1eec DS |
1944 | return CMD_SUCCESS; |
1945 | } | |
1946 | ||
219178b6 DW |
1947 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, |
1948 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
1949 | "no bgp bestpath as-path multipath-relax {as-set|no-as-set}", | |
16fc1eec DS |
1950 | NO_STR |
1951 | "BGP specific commands\n" | |
1952 | "Change the default bestpath selection\n" | |
1953 | "AS-path attribute\n" | |
1954 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
219178b6 | 1955 | "Generate an AS_SET\n" |
16fc1eec DS |
1956 | "Do not generate an AS_SET\n") |
1957 | { | |
1958 | struct bgp *bgp; | |
1959 | ||
1960 | bgp = vty->index; | |
1961 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
219178b6 | 1962 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); |
7aafcaca DS |
1963 | bgp_recalculate_all_bestpaths (bgp); |
1964 | ||
2fdd455c PM |
1965 | return CMD_SUCCESS; |
1966 | } | |
6b0655a2 | 1967 | |
848973c7 | 1968 | /* "bgp log-neighbor-changes" configuration. */ |
1969 | DEFUN (bgp_log_neighbor_changes, | |
1970 | bgp_log_neighbor_changes_cmd, | |
1971 | "bgp log-neighbor-changes", | |
1972 | "BGP specific commands\n" | |
1973 | "Log neighbor up/down and reset reason\n") | |
1974 | { | |
1975 | struct bgp *bgp; | |
1976 | ||
1977 | bgp = vty->index; | |
1978 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1979 | return CMD_SUCCESS; | |
1980 | } | |
1981 | ||
1982 | DEFUN (no_bgp_log_neighbor_changes, | |
1983 | no_bgp_log_neighbor_changes_cmd, | |
1984 | "no bgp log-neighbor-changes", | |
1985 | NO_STR | |
1986 | "BGP specific commands\n" | |
1987 | "Log neighbor up/down and reset reason\n") | |
1988 | { | |
1989 | struct bgp *bgp; | |
1990 | ||
1991 | bgp = vty->index; | |
1992 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1993 | return CMD_SUCCESS; | |
1994 | } | |
6b0655a2 | 1995 | |
718e3744 | 1996 | /* "bgp bestpath med" configuration. */ |
1997 | DEFUN (bgp_bestpath_med, | |
1998 | bgp_bestpath_med_cmd, | |
1999 | "bgp bestpath med (confed|missing-as-worst)", | |
2000 | "BGP specific commands\n" | |
2001 | "Change the default bestpath selection\n" | |
2002 | "MED attribute\n" | |
2003 | "Compare MED among confederation paths\n" | |
2004 | "Treat missing MED as the least preferred one\n") | |
2005 | { | |
2006 | struct bgp *bgp; | |
2007 | ||
2008 | bgp = vty->index; | |
2009 | ||
2010 | if (strncmp (argv[0], "confed", 1) == 0) | |
2011 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2012 | else | |
2013 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2014 | ||
7aafcaca DS |
2015 | bgp_recalculate_all_bestpaths (bgp); |
2016 | ||
718e3744 | 2017 | return CMD_SUCCESS; |
2018 | } | |
2019 | ||
2020 | DEFUN (bgp_bestpath_med2, | |
2021 | bgp_bestpath_med2_cmd, | |
2022 | "bgp bestpath med confed missing-as-worst", | |
2023 | "BGP specific commands\n" | |
2024 | "Change the default bestpath selection\n" | |
2025 | "MED attribute\n" | |
2026 | "Compare MED among confederation paths\n" | |
2027 | "Treat missing MED as the least preferred one\n") | |
2028 | { | |
2029 | struct bgp *bgp; | |
2030 | ||
2031 | bgp = vty->index; | |
2032 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2033 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2034 | bgp_recalculate_all_bestpaths (bgp); |
2035 | ||
718e3744 | 2036 | return CMD_SUCCESS; |
2037 | } | |
2038 | ||
2039 | ALIAS (bgp_bestpath_med2, | |
2040 | bgp_bestpath_med3_cmd, | |
2041 | "bgp bestpath med missing-as-worst confed", | |
2042 | "BGP specific commands\n" | |
2043 | "Change the default bestpath selection\n" | |
2044 | "MED attribute\n" | |
2045 | "Treat missing MED as the least preferred one\n" | |
2046 | "Compare MED among confederation paths\n") | |
2047 | ||
2048 | DEFUN (no_bgp_bestpath_med, | |
2049 | no_bgp_bestpath_med_cmd, | |
2050 | "no bgp bestpath med (confed|missing-as-worst)", | |
2051 | NO_STR | |
2052 | "BGP specific commands\n" | |
2053 | "Change the default bestpath selection\n" | |
2054 | "MED attribute\n" | |
2055 | "Compare MED among confederation paths\n" | |
2056 | "Treat missing MED as the least preferred one\n") | |
2057 | { | |
2058 | struct bgp *bgp; | |
2059 | ||
2060 | bgp = vty->index; | |
2061 | ||
2062 | if (strncmp (argv[0], "confed", 1) == 0) | |
2063 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2064 | else | |
2065 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2066 | ||
7aafcaca DS |
2067 | bgp_recalculate_all_bestpaths (bgp); |
2068 | ||
718e3744 | 2069 | return CMD_SUCCESS; |
2070 | } | |
2071 | ||
2072 | DEFUN (no_bgp_bestpath_med2, | |
2073 | no_bgp_bestpath_med2_cmd, | |
2074 | "no bgp bestpath med confed missing-as-worst", | |
2075 | NO_STR | |
2076 | "BGP specific commands\n" | |
2077 | "Change the default bestpath selection\n" | |
2078 | "MED attribute\n" | |
2079 | "Compare MED among confederation paths\n" | |
2080 | "Treat missing MED as the least preferred one\n") | |
2081 | { | |
2082 | struct bgp *bgp; | |
2083 | ||
2084 | bgp = vty->index; | |
2085 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2086 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2087 | bgp_recalculate_all_bestpaths (bgp); |
2088 | ||
718e3744 | 2089 | return CMD_SUCCESS; |
2090 | } | |
2091 | ||
2092 | ALIAS (no_bgp_bestpath_med2, | |
2093 | no_bgp_bestpath_med3_cmd, | |
2094 | "no bgp bestpath med missing-as-worst confed", | |
2095 | NO_STR | |
2096 | "BGP specific commands\n" | |
2097 | "Change the default bestpath selection\n" | |
2098 | "MED attribute\n" | |
2099 | "Treat missing MED as the least preferred one\n" | |
2100 | "Compare MED among confederation paths\n") | |
6b0655a2 | 2101 | |
718e3744 | 2102 | /* "no bgp default ipv4-unicast". */ |
2103 | DEFUN (no_bgp_default_ipv4_unicast, | |
2104 | no_bgp_default_ipv4_unicast_cmd, | |
2105 | "no bgp default ipv4-unicast", | |
2106 | NO_STR | |
2107 | "BGP specific commands\n" | |
2108 | "Configure BGP defaults\n" | |
2109 | "Activate ipv4-unicast for a peer by default\n") | |
2110 | { | |
2111 | struct bgp *bgp; | |
2112 | ||
2113 | bgp = vty->index; | |
2114 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2115 | return CMD_SUCCESS; | |
2116 | } | |
2117 | ||
2118 | DEFUN (bgp_default_ipv4_unicast, | |
2119 | bgp_default_ipv4_unicast_cmd, | |
2120 | "bgp default ipv4-unicast", | |
2121 | "BGP specific commands\n" | |
2122 | "Configure BGP defaults\n" | |
2123 | "Activate ipv4-unicast for a peer by default\n") | |
2124 | { | |
2125 | struct bgp *bgp; | |
2126 | ||
2127 | bgp = vty->index; | |
2128 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2129 | return CMD_SUCCESS; | |
2130 | } | |
6b0655a2 | 2131 | |
04b6bdc0 DW |
2132 | /* Display hostname in certain command outputs */ |
2133 | DEFUN (bgp_default_show_hostname, | |
2134 | bgp_default_show_hostname_cmd, | |
2135 | "bgp default show-hostname", | |
2136 | "BGP specific commands\n" | |
2137 | "Configure BGP defaults\n" | |
2138 | "Show hostname in certain command ouputs\n") | |
2139 | { | |
2140 | struct bgp *bgp; | |
2141 | ||
2142 | bgp = vty->index; | |
2143 | bgp_flag_set (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2144 | return CMD_SUCCESS; | |
2145 | } | |
2146 | ||
2147 | DEFUN (no_bgp_default_show_hostname, | |
2148 | no_bgp_default_show_hostname_cmd, | |
2149 | "no bgp default show-hostname", | |
2150 | NO_STR | |
2151 | "BGP specific commands\n" | |
2152 | "Configure BGP defaults\n" | |
2153 | "Show hostname in certain command ouputs\n") | |
2154 | { | |
2155 | struct bgp *bgp; | |
2156 | ||
2157 | bgp = vty->index; | |
2158 | bgp_flag_unset (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2159 | return CMD_SUCCESS; | |
2160 | } | |
2161 | ||
718e3744 | 2162 | /* "bgp import-check" configuration. */ |
2163 | DEFUN (bgp_network_import_check, | |
2164 | bgp_network_import_check_cmd, | |
5623e905 | 2165 | "bgp network import-check", |
718e3744 | 2166 | "BGP specific commands\n" |
2167 | "BGP network command\n" | |
5623e905 | 2168 | "Check BGP network route exists in IGP\n") |
718e3744 | 2169 | { |
2170 | struct bgp *bgp; | |
2171 | ||
2172 | bgp = vty->index; | |
078430f6 DS |
2173 | if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2174 | { | |
2175 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
5623e905 | 2176 | bgp_static_redo_import_check(bgp); |
078430f6 DS |
2177 | } |
2178 | ||
718e3744 | 2179 | return CMD_SUCCESS; |
2180 | } | |
2181 | ||
2182 | DEFUN (no_bgp_network_import_check, | |
2183 | no_bgp_network_import_check_cmd, | |
5623e905 | 2184 | "no bgp network import-check", |
718e3744 | 2185 | NO_STR |
2186 | "BGP specific commands\n" | |
2187 | "BGP network command\n" | |
2188 | "Check BGP network route exists in IGP\n") | |
2189 | { | |
2190 | struct bgp *bgp; | |
2191 | ||
2192 | bgp = vty->index; | |
078430f6 DS |
2193 | if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2194 | { | |
2195 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
078430f6 DS |
2196 | bgp_static_redo_import_check(bgp); |
2197 | } | |
5623e905 | 2198 | |
718e3744 | 2199 | return CMD_SUCCESS; |
2200 | } | |
6b0655a2 | 2201 | |
718e3744 | 2202 | DEFUN (bgp_default_local_preference, |
2203 | bgp_default_local_preference_cmd, | |
2204 | "bgp default local-preference <0-4294967295>", | |
2205 | "BGP specific commands\n" | |
2206 | "Configure BGP defaults\n" | |
2207 | "local preference (higher=more preferred)\n" | |
2208 | "Configure default local preference value\n") | |
2209 | { | |
2210 | struct bgp *bgp; | |
2211 | u_int32_t local_pref; | |
2212 | ||
2213 | bgp = vty->index; | |
2214 | ||
2215 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
2216 | ||
2217 | bgp_default_local_preference_set (bgp, local_pref); | |
7aafcaca | 2218 | bgp_clear_star_soft_in (vty); |
718e3744 | 2219 | |
2220 | return CMD_SUCCESS; | |
2221 | } | |
2222 | ||
2223 | DEFUN (no_bgp_default_local_preference, | |
2224 | no_bgp_default_local_preference_cmd, | |
2225 | "no bgp default local-preference", | |
2226 | NO_STR | |
2227 | "BGP specific commands\n" | |
2228 | "Configure BGP defaults\n" | |
2229 | "local preference (higher=more preferred)\n") | |
2230 | { | |
2231 | struct bgp *bgp; | |
2232 | ||
2233 | bgp = vty->index; | |
2234 | bgp_default_local_preference_unset (bgp); | |
7aafcaca DS |
2235 | bgp_clear_star_soft_in (vty); |
2236 | ||
718e3744 | 2237 | return CMD_SUCCESS; |
2238 | } | |
2239 | ||
2240 | ALIAS (no_bgp_default_local_preference, | |
2241 | no_bgp_default_local_preference_val_cmd, | |
2242 | "no bgp default local-preference <0-4294967295>", | |
2243 | NO_STR | |
2244 | "BGP specific commands\n" | |
2245 | "Configure BGP defaults\n" | |
2246 | "local preference (higher=more preferred)\n" | |
2247 | "Configure default local preference value\n") | |
6b0655a2 | 2248 | |
3f9c7369 DS |
2249 | DEFUN (bgp_default_subgroup_pkt_queue_max, |
2250 | bgp_default_subgroup_pkt_queue_max_cmd, | |
2251 | "bgp default subgroup-pkt-queue-max <20-100>", | |
2252 | "BGP specific commands\n" | |
2253 | "Configure BGP defaults\n" | |
2254 | "subgroup-pkt-queue-max\n" | |
2255 | "Configure subgroup packet queue max\n") | |
8bd9d948 | 2256 | { |
3f9c7369 DS |
2257 | struct bgp *bgp; |
2258 | u_int32_t max_size; | |
8bd9d948 | 2259 | |
3f9c7369 DS |
2260 | bgp = vty->index; |
2261 | ||
2262 | VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]); | |
2263 | ||
2264 | bgp_default_subgroup_pkt_queue_max_set (bgp, max_size); | |
2265 | ||
2266 | return CMD_SUCCESS; | |
2267 | } | |
2268 | ||
2269 | DEFUN (no_bgp_default_subgroup_pkt_queue_max, | |
2270 | no_bgp_default_subgroup_pkt_queue_max_cmd, | |
2271 | "no bgp default subgroup-pkt-queue-max", | |
2272 | NO_STR | |
2273 | "BGP specific commands\n" | |
2274 | "Configure BGP defaults\n" | |
2275 | "subgroup-pkt-queue-max\n") | |
2276 | { | |
2277 | struct bgp *bgp; | |
2278 | ||
2279 | bgp = vty->index; | |
2280 | bgp_default_subgroup_pkt_queue_max_unset (bgp); | |
2281 | return CMD_SUCCESS; | |
8bd9d948 DS |
2282 | } |
2283 | ||
813d4307 DW |
2284 | ALIAS (no_bgp_default_subgroup_pkt_queue_max, |
2285 | no_bgp_default_subgroup_pkt_queue_max_val_cmd, | |
2286 | "no bgp default subgroup-pkt-queue-max <20-100>", | |
2287 | NO_STR | |
2288 | "BGP specific commands\n" | |
2289 | "Configure BGP defaults\n" | |
2290 | "subgroup-pkt-queue-max\n" | |
2291 | "Configure subgroup packet queue max\n") | |
2292 | ||
8bd9d948 DS |
2293 | DEFUN (bgp_rr_allow_outbound_policy, |
2294 | bgp_rr_allow_outbound_policy_cmd, | |
2295 | "bgp route-reflector allow-outbound-policy", | |
2296 | "BGP specific commands\n" | |
2297 | "Allow modifications made by out route-map\n" | |
2298 | "on ibgp neighbors\n") | |
2299 | { | |
2300 | struct bgp *bgp; | |
8bd9d948 DS |
2301 | |
2302 | bgp = vty->index; | |
2303 | ||
2304 | if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2305 | { | |
2306 | bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2307 | update_group_announce_rrclients(bgp); |
7aafcaca | 2308 | bgp_clear_star_soft_out (vty); |
8bd9d948 DS |
2309 | } |
2310 | ||
2311 | return CMD_SUCCESS; | |
2312 | } | |
2313 | ||
2314 | DEFUN (no_bgp_rr_allow_outbound_policy, | |
2315 | no_bgp_rr_allow_outbound_policy_cmd, | |
2316 | "no bgp route-reflector allow-outbound-policy", | |
2317 | NO_STR | |
2318 | "BGP specific commands\n" | |
2319 | "Allow modifications made by out route-map\n" | |
2320 | "on ibgp neighbors\n") | |
2321 | { | |
2322 | struct bgp *bgp; | |
8bd9d948 DS |
2323 | |
2324 | bgp = vty->index; | |
2325 | ||
2326 | if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2327 | { | |
2328 | bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2329 | update_group_announce_rrclients(bgp); |
7aafcaca | 2330 | bgp_clear_star_soft_out (vty); |
8bd9d948 DS |
2331 | } |
2332 | ||
2333 | return CMD_SUCCESS; | |
2334 | } | |
2335 | ||
f14e6fdb DS |
2336 | DEFUN (bgp_listen_limit, |
2337 | bgp_listen_limit_cmd, | |
2338 | "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2339 | "BGP specific commands\n" | |
2340 | "Configure BGP defaults\n" | |
2341 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2342 | "Configure Dynamic Neighbors listen limit value\n") | |
2343 | { | |
2344 | struct bgp *bgp; | |
2345 | int listen_limit; | |
2346 | ||
2347 | bgp = vty->index; | |
2348 | ||
2349 | VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0], | |
2350 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN, | |
2351 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX); | |
2352 | ||
2353 | bgp_listen_limit_set (bgp, listen_limit); | |
2354 | ||
2355 | return CMD_SUCCESS; | |
2356 | } | |
2357 | ||
2358 | DEFUN (no_bgp_listen_limit, | |
2359 | no_bgp_listen_limit_cmd, | |
2360 | "no bgp listen limit", | |
2361 | "BGP specific commands\n" | |
2362 | "Configure BGP defaults\n" | |
2363 | "unset maximum number of BGP Dynamic Neighbors that can be created\n" | |
2364 | "Configure Dynamic Neighbors listen limit value to default\n") | |
2365 | { | |
2366 | struct bgp *bgp; | |
2367 | ||
2368 | bgp = vty->index; | |
2369 | bgp_listen_limit_unset (bgp); | |
2370 | return CMD_SUCCESS; | |
2371 | } | |
2372 | ||
813d4307 DW |
2373 | ALIAS (no_bgp_listen_limit, |
2374 | no_bgp_listen_limit_val_cmd, | |
2375 | "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2376 | NO_STR | |
2377 | "BGP specific commands\n" | |
2378 | "Configure BGP defaults\n" | |
2379 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2380 | "Configure Dynamic Neighbors listen limit value\n") | |
f14e6fdb | 2381 | |
20eb8864 | 2382 | /* |
2383 | * Check if this listen range is already configured. Check for exact | |
2384 | * match or overlap based on input. | |
2385 | */ | |
2386 | static struct peer_group * | |
2387 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact) | |
2388 | { | |
2389 | struct listnode *node, *nnode; | |
2390 | struct listnode *node1, *nnode1; | |
2391 | struct peer_group *group; | |
2392 | struct prefix *lr; | |
2393 | afi_t afi; | |
2394 | int match; | |
2395 | ||
2396 | afi = family2afi(range->family); | |
2397 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2398 | { | |
2399 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node1, | |
2400 | nnode1, lr)) | |
2401 | { | |
2402 | if (exact) | |
2403 | match = prefix_same (range, lr); | |
2404 | else | |
2405 | match = (prefix_match (range, lr) || prefix_match (lr, range)); | |
2406 | if (match) | |
2407 | return group; | |
2408 | } | |
2409 | } | |
2410 | ||
2411 | return NULL; | |
2412 | } | |
2413 | ||
f14e6fdb DS |
2414 | DEFUN (bgp_listen_range, |
2415 | bgp_listen_range_cmd, | |
2416 | LISTEN_RANGE_CMD "peer-group WORD" , | |
2417 | "BGP specific commands\n" | |
2418 | "Configure BGP Dynamic Neighbors\n" | |
2419 | "add a listening range for Dynamic Neighbors\n" | |
2420 | LISTEN_RANGE_ADDR_STR) | |
2421 | { | |
2422 | struct bgp *bgp; | |
2423 | struct prefix range; | |
20eb8864 | 2424 | struct peer_group *group, *existing_group; |
f14e6fdb DS |
2425 | afi_t afi; |
2426 | int ret; | |
2427 | ||
2428 | bgp = vty->index; | |
2429 | ||
2430 | //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2431 | ||
2432 | /* Convert IP prefix string to struct prefix. */ | |
2433 | ret = str2prefix (argv[0], &range); | |
2434 | if (! ret) | |
2435 | { | |
2436 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2437 | return CMD_WARNING; | |
2438 | } | |
2439 | ||
2440 | afi = family2afi(range.family); | |
2441 | ||
2442 | #ifdef HAVE_IPV6 | |
2443 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2444 | { | |
2445 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2446 | VTY_NEWLINE); | |
2447 | return CMD_WARNING; | |
2448 | } | |
2449 | #endif /* HAVE_IPV6 */ | |
2450 | ||
2451 | apply_mask (&range); | |
2452 | ||
20eb8864 | 2453 | /* Check if same listen range is already configured. */ |
2454 | existing_group = listen_range_exists (bgp, &range, 1); | |
2455 | if (existing_group) | |
2456 | { | |
2457 | if (strcmp (existing_group->name, argv[1]) == 0) | |
2458 | return CMD_SUCCESS; | |
2459 | else | |
2460 | { | |
2461 | vty_out (vty, "%% Same listen range is attached to peer-group %s%s", | |
2462 | existing_group->name, VTY_NEWLINE); | |
2463 | return CMD_WARNING; | |
2464 | } | |
2465 | } | |
2466 | ||
2467 | /* Check if an overlapping listen range exists. */ | |
2468 | if (listen_range_exists (bgp, &range, 0)) | |
2469 | { | |
2470 | vty_out (vty, "%% Listen range overlaps with existing listen range%s", | |
2471 | VTY_NEWLINE); | |
2472 | return CMD_WARNING; | |
2473 | } | |
f14e6fdb DS |
2474 | |
2475 | group = peer_group_lookup (bgp, argv[1]); | |
2476 | if (! group) | |
2477 | { | |
2478 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2479 | return CMD_WARNING; | |
2480 | } | |
2481 | ||
2482 | ret = peer_group_listen_range_add(group, &range); | |
2483 | return bgp_vty_return (vty, ret); | |
2484 | } | |
2485 | ||
2486 | DEFUN (no_bgp_listen_range, | |
2487 | no_bgp_listen_range_cmd, | |
2488 | "no bgp listen range A.B.C.D/M peer-group WORD" , | |
2489 | "BGP specific commands\n" | |
2490 | "Configure BGP defaults\n" | |
2491 | "delete a listening range for Dynamic Neighbors\n" | |
2492 | "Remove Dynamic Neighbors listening range\n") | |
2493 | { | |
2494 | struct bgp *bgp; | |
2495 | struct prefix range; | |
2496 | struct peer_group *group; | |
2497 | afi_t afi; | |
2498 | int ret; | |
2499 | ||
2500 | bgp = vty->index; | |
2501 | ||
2502 | // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2503 | ||
2504 | /* Convert IP prefix string to struct prefix. */ | |
2505 | ret = str2prefix (argv[0], &range); | |
2506 | if (! ret) | |
2507 | { | |
2508 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2509 | return CMD_WARNING; | |
2510 | } | |
2511 | ||
2512 | afi = family2afi(range.family); | |
2513 | ||
2514 | #ifdef HAVE_IPV6 | |
2515 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2516 | { | |
2517 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2518 | VTY_NEWLINE); | |
2519 | return CMD_WARNING; | |
2520 | } | |
2521 | #endif /* HAVE_IPV6 */ | |
2522 | ||
2523 | apply_mask (&range); | |
2524 | ||
2525 | ||
2526 | group = peer_group_lookup (bgp, argv[1]); | |
2527 | if (! group) | |
2528 | { | |
2529 | vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); | |
2530 | return CMD_WARNING; | |
2531 | } | |
2532 | ||
2533 | ret = peer_group_listen_range_del(group, &range); | |
2534 | return bgp_vty_return (vty, ret); | |
2535 | } | |
2536 | ||
2537 | int | |
2538 | bgp_config_write_listen (struct vty *vty, struct bgp *bgp) | |
2539 | { | |
2540 | struct peer_group *group; | |
2541 | struct listnode *node, *nnode, *rnode, *nrnode; | |
2542 | struct prefix *range; | |
2543 | afi_t afi; | |
4690c7d7 | 2544 | char buf[PREFIX2STR_BUFFER]; |
f14e6fdb DS |
2545 | |
2546 | if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT) | |
2547 | vty_out (vty, " bgp listen limit %d%s", | |
2548 | bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
2549 | ||
2550 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2551 | { | |
2552 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
2553 | { | |
2554 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range)) | |
2555 | { | |
2556 | prefix2str(range, buf, sizeof(buf)); | |
2557 | vty_out(vty, " bgp listen range %s peer-group %s%s", | |
2558 | buf, group->name, VTY_NEWLINE); | |
2559 | } | |
2560 | } | |
2561 | } | |
2562 | ||
2563 | return 0; | |
2564 | } | |
2565 | ||
2566 | ||
907f92c8 DS |
2567 | DEFUN (bgp_disable_connected_route_check, |
2568 | bgp_disable_connected_route_check_cmd, | |
2569 | "bgp disable-ebgp-connected-route-check", | |
2570 | "BGP specific commands\n" | |
2571 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2572 | { | |
2573 | struct bgp *bgp; | |
2574 | ||
2575 | bgp = vty->index; | |
2576 | bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
7aafcaca DS |
2577 | bgp_clear_star_soft_in (vty); |
2578 | ||
907f92c8 DS |
2579 | return CMD_SUCCESS; |
2580 | } | |
2581 | ||
2582 | DEFUN (no_bgp_disable_connected_route_check, | |
2583 | no_bgp_disable_connected_route_check_cmd, | |
2584 | "no bgp disable-ebgp-connected-route-check", | |
2585 | NO_STR | |
2586 | "BGP specific commands\n" | |
2587 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2588 | { | |
2589 | struct bgp *bgp; | |
2590 | ||
2591 | bgp = vty->index; | |
2592 | bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
7aafcaca DS |
2593 | bgp_clear_star_soft_in (vty); |
2594 | ||
907f92c8 DS |
2595 | return CMD_SUCCESS; |
2596 | } | |
2597 | ||
2598 | ||
718e3744 | 2599 | static int |
fd79ac91 | 2600 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
2601 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 2602 | { |
2603 | int ret; | |
2604 | struct bgp *bgp; | |
2605 | as_t as; | |
0299c004 | 2606 | int as_type = AS_SPECIFIED; |
718e3744 | 2607 | union sockunion su; |
2608 | ||
2609 | bgp = vty->index; | |
2610 | ||
0299c004 DS |
2611 | if (strncmp(as_str, "internal", strlen("internal")) == 0) |
2612 | { | |
2613 | as = 0; | |
2614 | as_type = AS_INTERNAL; | |
2615 | } | |
2616 | else if (strncmp(as_str, "external", strlen("external")) == 0) | |
2617 | { | |
2618 | as = 0; | |
2619 | as_type = AS_EXTERNAL; | |
2620 | } | |
2621 | else | |
2622 | { | |
2623 | /* Get AS number. */ | |
2624 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); | |
2625 | } | |
718e3744 | 2626 | |
2627 | /* If peer is peer group, call proper function. */ | |
2628 | ret = str2sockunion (peer_str, &su); | |
2629 | if (ret < 0) | |
2630 | { | |
a80beece | 2631 | /* Check for peer by interface */ |
0299c004 | 2632 | ret = peer_remote_as (bgp, NULL, peer_str, &as, as_type, afi, safi); |
718e3744 | 2633 | if (ret < 0) |
a80beece | 2634 | { |
0299c004 | 2635 | ret = peer_group_remote_as (bgp, peer_str, &as, as_type); |
a80beece DS |
2636 | if (ret < 0) |
2637 | { | |
2638 | vty_out (vty, "%% Create the peer-group or interface first%s", | |
2639 | VTY_NEWLINE); | |
2640 | return CMD_WARNING; | |
2641 | } | |
2642 | return CMD_SUCCESS; | |
2643 | } | |
718e3744 | 2644 | } |
a80beece | 2645 | else |
718e3744 | 2646 | { |
a80beece DS |
2647 | if (peer_address_self_check (&su)) |
2648 | { | |
2649 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2650 | VTY_NEWLINE); | |
2651 | return CMD_WARNING; | |
2652 | } | |
0299c004 | 2653 | ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi); |
718e3744 | 2654 | } |
2655 | ||
718e3744 | 2656 | /* This peer belongs to peer group. */ |
2657 | switch (ret) | |
2658 | { | |
2659 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 2660 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 2661 | return CMD_WARNING; |
718e3744 | 2662 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 2663 | 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 | 2664 | return CMD_WARNING; |
718e3744 | 2665 | } |
2666 | return bgp_vty_return (vty, ret); | |
2667 | } | |
2668 | ||
2669 | DEFUN (neighbor_remote_as, | |
2670 | neighbor_remote_as_cmd, | |
0299c004 | 2671 | NEIGHBOR_CMD2 "remote-as (" CMD_AS_RANGE "|external|internal)", |
718e3744 | 2672 | NEIGHBOR_STR |
2673 | NEIGHBOR_ADDR_STR2 | |
2674 | "Specify a BGP neighbor\n" | |
2675 | AS_STR) | |
2676 | { | |
2677 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
2678 | } | |
6b0655a2 | 2679 | |
a80beece DS |
2680 | DEFUN (neighbor_interface_config, |
2681 | neighbor_interface_config_cmd, | |
8ffedcea | 2682 | "neighbor WORD interface {v6only}", |
a80beece DS |
2683 | NEIGHBOR_STR |
2684 | "Interface name or neighbor tag\n" | |
8ffedcea DS |
2685 | "Enable BGP on interface\n" |
2686 | "Enable BGP with v6 link-local only\n") | |
a80beece DS |
2687 | { |
2688 | struct bgp *bgp; | |
2689 | struct peer *peer; | |
2690 | struct peer_group *group; | |
2691 | ||
2692 | bgp = vty->index; | |
2693 | group = peer_group_lookup (bgp, argv[0]); | |
2694 | if (group) | |
2695 | { | |
2696 | vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE); | |
2697 | return CMD_WARNING; | |
2698 | } | |
2699 | ||
8ffedcea DS |
2700 | if (argv[1] != NULL) |
2701 | peer = peer_conf_interface_get (bgp, argv[0], AFI_IP, SAFI_UNICAST, 1); | |
2702 | else | |
2703 | peer = peer_conf_interface_get (bgp, argv[0], AFI_IP, SAFI_UNICAST, 0); | |
a80beece DS |
2704 | if (!peer) |
2705 | return CMD_WARNING; | |
2706 | ||
2707 | return CMD_SUCCESS; | |
2708 | } | |
2709 | ||
2710 | ||
718e3744 | 2711 | DEFUN (neighbor_peer_group, |
2712 | neighbor_peer_group_cmd, | |
2713 | "neighbor WORD peer-group", | |
2714 | NEIGHBOR_STR | |
a80beece | 2715 | "Interface name or neighbor tag\n" |
718e3744 | 2716 | "Configure peer-group\n") |
2717 | { | |
2718 | struct bgp *bgp; | |
a80beece | 2719 | struct peer *peer; |
718e3744 | 2720 | struct peer_group *group; |
2721 | ||
2722 | bgp = vty->index; | |
a80beece DS |
2723 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2724 | if (peer) | |
2725 | { | |
2726 | vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); | |
2727 | return CMD_WARNING; | |
2728 | } | |
718e3744 | 2729 | |
2730 | group = peer_group_get (bgp, argv[0]); | |
2731 | if (! group) | |
2732 | return CMD_WARNING; | |
2733 | ||
2734 | return CMD_SUCCESS; | |
2735 | } | |
2736 | ||
2737 | DEFUN (no_neighbor, | |
2738 | no_neighbor_cmd, | |
2739 | NO_NEIGHBOR_CMD2, | |
2740 | NO_STR | |
2741 | NEIGHBOR_STR | |
2742 | NEIGHBOR_ADDR_STR2) | |
2743 | { | |
2744 | int ret; | |
2745 | union sockunion su; | |
2746 | struct peer_group *group; | |
2747 | struct peer *peer; | |
1ff9a340 | 2748 | struct peer *other; |
718e3744 | 2749 | |
2750 | ret = str2sockunion (argv[0], &su); | |
2751 | if (ret < 0) | |
2752 | { | |
a80beece DS |
2753 | /* look up for neighbor by interface name config. */ |
2754 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2755 | if (peer) | |
2756 | { | |
2757 | peer_delete (peer); | |
2758 | return CMD_SUCCESS; | |
2759 | } | |
2760 | ||
718e3744 | 2761 | group = peer_group_lookup (vty->index, argv[0]); |
2762 | if (group) | |
2763 | peer_group_delete (group); | |
2764 | else | |
2765 | { | |
2766 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2767 | return CMD_WARNING; | |
2768 | } | |
2769 | } | |
2770 | else | |
2771 | { | |
2772 | peer = peer_lookup (vty->index, &su); | |
2773 | if (peer) | |
1ff9a340 | 2774 | { |
f14e6fdb DS |
2775 | if (peer_dynamic_neighbor (peer)) |
2776 | { | |
2777 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
2778 | VTY_NEWLINE); | |
2779 | return CMD_WARNING; | |
2780 | } | |
2781 | ||
1ff9a340 DS |
2782 | other = peer->doppelganger; |
2783 | peer_delete (peer); | |
2784 | if (other && other->status != Deleted) | |
2785 | peer_delete(other); | |
2786 | } | |
718e3744 | 2787 | } |
2788 | ||
2789 | return CMD_SUCCESS; | |
2790 | } | |
2791 | ||
2792 | ALIAS (no_neighbor, | |
2793 | no_neighbor_remote_as_cmd, | |
0299c004 | 2794 | NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 2795 | NO_STR |
2796 | NEIGHBOR_STR | |
2797 | NEIGHBOR_ADDR_STR | |
2798 | "Specify a BGP neighbor\n" | |
2799 | AS_STR) | |
2800 | ||
a80beece DS |
2801 | DEFUN (no_neighbor_interface_config, |
2802 | no_neighbor_interface_config_cmd, | |
c8a96aef | 2803 | "no neighbor WORD interface {v6only}", |
a80beece DS |
2804 | NO_STR |
2805 | NEIGHBOR_STR | |
2806 | "Interface name\n" | |
2807 | "Configure BGP on interface\n") | |
2808 | { | |
2809 | struct peer *peer; | |
2810 | ||
2811 | /* look up for neighbor by interface name config. */ | |
2812 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2813 | if (peer) | |
2814 | { | |
2815 | peer_delete (peer); | |
2816 | } | |
2817 | else | |
2818 | { | |
2819 | vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE); | |
2820 | return CMD_WARNING; | |
2821 | } | |
2822 | return CMD_SUCCESS; | |
2823 | } | |
2824 | ||
718e3744 | 2825 | DEFUN (no_neighbor_peer_group, |
2826 | no_neighbor_peer_group_cmd, | |
2827 | "no neighbor WORD peer-group", | |
2828 | NO_STR | |
2829 | NEIGHBOR_STR | |
2830 | "Neighbor tag\n" | |
2831 | "Configure peer-group\n") | |
2832 | { | |
2833 | struct peer_group *group; | |
2834 | ||
2835 | group = peer_group_lookup (vty->index, argv[0]); | |
2836 | if (group) | |
2837 | peer_group_delete (group); | |
2838 | else | |
2839 | { | |
2840 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2841 | return CMD_WARNING; | |
2842 | } | |
2843 | return CMD_SUCCESS; | |
2844 | } | |
2845 | ||
a80beece DS |
2846 | DEFUN (no_neighbor_interface_peer_group_remote_as, |
2847 | no_neighbor_interface_peer_group_remote_as_cmd, | |
0299c004 | 2848 | "no neighbor WORD remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 2849 | NO_STR |
2850 | NEIGHBOR_STR | |
a80beece | 2851 | "Interface name or neighbor tag\n" |
718e3744 | 2852 | "Specify a BGP neighbor\n" |
2853 | AS_STR) | |
2854 | { | |
2855 | struct peer_group *group; | |
a80beece DS |
2856 | struct peer *peer; |
2857 | ||
2858 | /* look up for neighbor by interface name config. */ | |
2859 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2860 | if (peer) | |
2861 | { | |
0299c004 | 2862 | peer_as_change (peer, 0, AS_SPECIFIED); |
a80beece DS |
2863 | return CMD_SUCCESS; |
2864 | } | |
718e3744 | 2865 | |
2866 | group = peer_group_lookup (vty->index, argv[0]); | |
2867 | if (group) | |
2868 | peer_group_remote_as_delete (group); | |
2869 | else | |
2870 | { | |
a80beece | 2871 | vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE); |
718e3744 | 2872 | return CMD_WARNING; |
2873 | } | |
2874 | return CMD_SUCCESS; | |
2875 | } | |
6b0655a2 | 2876 | |
718e3744 | 2877 | DEFUN (neighbor_local_as, |
2878 | neighbor_local_as_cmd, | |
320da874 | 2879 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 2880 | NEIGHBOR_STR |
2881 | NEIGHBOR_ADDR_STR2 | |
2882 | "Specify a local-as number\n" | |
2883 | "AS number used as local AS\n") | |
2884 | { | |
2885 | struct peer *peer; | |
2886 | int ret; | |
2887 | ||
2888 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2889 | if (! peer) | |
2890 | return CMD_WARNING; | |
2891 | ||
9d3f9705 | 2892 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
718e3744 | 2893 | return bgp_vty_return (vty, ret); |
2894 | } | |
2895 | ||
2896 | DEFUN (neighbor_local_as_no_prepend, | |
2897 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 2898 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 2899 | NEIGHBOR_STR |
2900 | NEIGHBOR_ADDR_STR2 | |
2901 | "Specify a local-as number\n" | |
2902 | "AS number used as local AS\n" | |
2903 | "Do not prepend local-as to updates from ebgp peers\n") | |
2904 | { | |
2905 | struct peer *peer; | |
2906 | int ret; | |
2907 | ||
2908 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2909 | if (! peer) | |
2910 | return CMD_WARNING; | |
2911 | ||
9d3f9705 | 2912 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
718e3744 | 2913 | return bgp_vty_return (vty, ret); |
2914 | } | |
2915 | ||
9d3f9705 AC |
2916 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
2917 | neighbor_local_as_no_prepend_replace_as_cmd, | |
2918 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
2919 | NEIGHBOR_STR | |
2920 | NEIGHBOR_ADDR_STR2 | |
2921 | "Specify a local-as number\n" | |
2922 | "AS number used as local AS\n" | |
2923 | "Do not prepend local-as to updates from ebgp peers\n" | |
2924 | "Do not prepend local-as to updates from ibgp peers\n") | |
2925 | { | |
2926 | struct peer *peer; | |
2927 | int ret; | |
2928 | ||
2929 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2930 | if (! peer) | |
2931 | return CMD_WARNING; | |
2932 | ||
2933 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); | |
2934 | return bgp_vty_return (vty, ret); | |
2935 | } | |
2936 | ||
2937 | ||
718e3744 | 2938 | DEFUN (no_neighbor_local_as, |
2939 | no_neighbor_local_as_cmd, | |
2940 | NO_NEIGHBOR_CMD2 "local-as", | |
2941 | NO_STR | |
2942 | NEIGHBOR_STR | |
2943 | NEIGHBOR_ADDR_STR2 | |
2944 | "Specify a local-as number\n") | |
2945 | { | |
2946 | struct peer *peer; | |
2947 | int ret; | |
2948 | ||
2949 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2950 | if (! peer) | |
2951 | return CMD_WARNING; | |
2952 | ||
2953 | ret = peer_local_as_unset (peer); | |
2954 | return bgp_vty_return (vty, ret); | |
2955 | } | |
2956 | ||
2957 | ALIAS (no_neighbor_local_as, | |
2958 | no_neighbor_local_as_val_cmd, | |
320da874 | 2959 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 2960 | NO_STR |
2961 | NEIGHBOR_STR | |
2962 | NEIGHBOR_ADDR_STR2 | |
2963 | "Specify a local-as number\n" | |
2964 | "AS number used as local AS\n") | |
2965 | ||
2966 | ALIAS (no_neighbor_local_as, | |
2967 | no_neighbor_local_as_val2_cmd, | |
320da874 | 2968 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 2969 | NO_STR |
2970 | NEIGHBOR_STR | |
2971 | NEIGHBOR_ADDR_STR2 | |
2972 | "Specify a local-as number\n" | |
2973 | "AS number used as local AS\n" | |
2974 | "Do not prepend local-as to updates from ebgp peers\n") | |
9d3f9705 AC |
2975 | |
2976 | ALIAS (no_neighbor_local_as, | |
2977 | no_neighbor_local_as_val3_cmd, | |
2978 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
2979 | NO_STR | |
2980 | NEIGHBOR_STR | |
2981 | NEIGHBOR_ADDR_STR2 | |
2982 | "Specify a local-as number\n" | |
2983 | "AS number used as local AS\n" | |
2984 | "Do not prepend local-as to updates from ebgp peers\n" | |
2985 | "Do not prepend local-as to updates from ibgp peers\n") | |
6b0655a2 | 2986 | |
3f9c7369 DS |
2987 | DEFUN (neighbor_solo, |
2988 | neighbor_solo_cmd, | |
2989 | NEIGHBOR_CMD2 "solo", | |
2990 | NEIGHBOR_STR | |
2991 | NEIGHBOR_ADDR_STR2 | |
2992 | "Solo peer - part of its own update group\n") | |
2993 | { | |
2994 | struct peer *peer; | |
2995 | int ret; | |
2996 | ||
2997 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2998 | if (! peer) | |
2999 | return CMD_WARNING; | |
3000 | ||
3001 | ret = update_group_adjust_soloness(peer, 1); | |
3002 | return bgp_vty_return (vty, ret); | |
3003 | } | |
3004 | ||
3005 | DEFUN (no_neighbor_solo, | |
3006 | no_neighbor_solo_cmd, | |
3007 | NO_NEIGHBOR_CMD2 "solo", | |
3008 | NO_STR | |
3009 | NEIGHBOR_STR | |
3010 | NEIGHBOR_ADDR_STR2 | |
3011 | "Solo peer - part of its own update group\n") | |
3012 | { | |
3013 | struct peer *peer; | |
3014 | int ret; | |
3015 | ||
3016 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3017 | if (! peer) | |
3018 | return CMD_WARNING; | |
3019 | ||
3020 | ret = update_group_adjust_soloness(peer, 0); | |
3021 | return bgp_vty_return (vty, ret); | |
3022 | } | |
3023 | ||
0df7c91f PJ |
3024 | DEFUN (neighbor_password, |
3025 | neighbor_password_cmd, | |
3026 | NEIGHBOR_CMD2 "password LINE", | |
3027 | NEIGHBOR_STR | |
3028 | NEIGHBOR_ADDR_STR2 | |
3029 | "Set a password\n" | |
3030 | "The password\n") | |
3031 | { | |
3032 | struct peer *peer; | |
3033 | int ret; | |
3034 | ||
3035 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3036 | if (! peer) | |
3037 | return CMD_WARNING; | |
3038 | ||
3039 | ret = peer_password_set (peer, argv[1]); | |
3040 | return bgp_vty_return (vty, ret); | |
3041 | } | |
3042 | ||
3043 | DEFUN (no_neighbor_password, | |
3044 | no_neighbor_password_cmd, | |
3045 | NO_NEIGHBOR_CMD2 "password", | |
3046 | NO_STR | |
3047 | NEIGHBOR_STR | |
3048 | NEIGHBOR_ADDR_STR2 | |
3049 | "Set a password\n") | |
3050 | { | |
3051 | struct peer *peer; | |
3052 | int ret; | |
3053 | ||
3054 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3055 | if (! peer) | |
3056 | return CMD_WARNING; | |
3057 | ||
3058 | ret = peer_password_unset (peer); | |
3059 | return bgp_vty_return (vty, ret); | |
3060 | } | |
6b0655a2 | 3061 | |
813d4307 DW |
3062 | ALIAS (no_neighbor_password, |
3063 | no_neighbor_password_val_cmd, | |
3064 | NO_NEIGHBOR_CMD2 "password LINE", | |
3065 | NO_STR | |
3066 | NEIGHBOR_STR | |
3067 | NEIGHBOR_ADDR_STR2 | |
3068 | "Set a password\n" | |
3069 | "The password\n") | |
3070 | ||
718e3744 | 3071 | DEFUN (neighbor_activate, |
3072 | neighbor_activate_cmd, | |
3073 | NEIGHBOR_CMD2 "activate", | |
3074 | NEIGHBOR_STR | |
3075 | NEIGHBOR_ADDR_STR2 | |
3076 | "Enable the Address Family for this Neighbor\n") | |
3077 | { | |
c8560b44 | 3078 | int ret; |
718e3744 | 3079 | struct peer *peer; |
3080 | ||
3081 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3082 | if (! peer) | |
3083 | return CMD_WARNING; | |
3084 | ||
c8560b44 | 3085 | ret = peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); |
718e3744 | 3086 | |
c8560b44 DW |
3087 | if (ret) |
3088 | return CMD_WARNING; | |
718e3744 | 3089 | return CMD_SUCCESS; |
3090 | } | |
3091 | ||
3092 | DEFUN (no_neighbor_activate, | |
3093 | no_neighbor_activate_cmd, | |
3094 | NO_NEIGHBOR_CMD2 "activate", | |
3095 | NO_STR | |
3096 | NEIGHBOR_STR | |
3097 | NEIGHBOR_ADDR_STR2 | |
3098 | "Enable the Address Family for this Neighbor\n") | |
3099 | { | |
3100 | int ret; | |
3101 | struct peer *peer; | |
3102 | ||
3103 | /* Lookup peer. */ | |
3104 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3105 | if (! peer) | |
3106 | return CMD_WARNING; | |
3107 | ||
3108 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
3109 | ||
c8560b44 DW |
3110 | if (ret) |
3111 | return CMD_WARNING; | |
3112 | return CMD_SUCCESS; | |
718e3744 | 3113 | } |
6b0655a2 | 3114 | |
718e3744 | 3115 | DEFUN (neighbor_set_peer_group, |
3116 | neighbor_set_peer_group_cmd, | |
a80beece | 3117 | NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3118 | NEIGHBOR_STR |
a80beece | 3119 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3120 | "Member of the peer-group\n" |
3121 | "peer-group name\n") | |
3122 | { | |
3123 | int ret; | |
3124 | as_t as; | |
3125 | union sockunion su; | |
3126 | struct bgp *bgp; | |
a80beece | 3127 | struct peer *peer; |
718e3744 | 3128 | struct peer_group *group; |
3129 | ||
3130 | bgp = vty->index; | |
a80beece | 3131 | peer = NULL; |
718e3744 | 3132 | |
3133 | ret = str2sockunion (argv[0], &su); | |
3134 | if (ret < 0) | |
3135 | { | |
a80beece DS |
3136 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
3137 | if (!peer) | |
3138 | { | |
3139 | vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); | |
3140 | return CMD_WARNING; | |
3141 | } | |
3142 | } | |
3143 | else | |
3144 | { | |
3145 | if (peer_address_self_check (&su)) | |
3146 | { | |
3147 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
3148 | VTY_NEWLINE); | |
3149 | return CMD_WARNING; | |
3150 | } | |
f14e6fdb DS |
3151 | |
3152 | /* Disallow for dynamic neighbor. */ | |
3153 | peer = peer_lookup (bgp, &su); | |
3154 | if (peer && peer_dynamic_neighbor (peer)) | |
3155 | { | |
3156 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
3157 | VTY_NEWLINE); | |
3158 | return CMD_WARNING; | |
3159 | } | |
718e3744 | 3160 | } |
3161 | ||
3162 | group = peer_group_lookup (bgp, argv[1]); | |
3163 | if (! group) | |
3164 | { | |
3165 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3166 | return CMD_WARNING; | |
3167 | } | |
3168 | ||
c8560b44 | 3169 | ret = peer_group_bind (bgp, &su, peer, group, &as); |
718e3744 | 3170 | |
3171 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
3172 | { | |
aea339f7 | 3173 | 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 | 3174 | return CMD_WARNING; |
3175 | } | |
3176 | ||
3177 | return bgp_vty_return (vty, ret); | |
3178 | } | |
3179 | ||
3180 | DEFUN (no_neighbor_set_peer_group, | |
3181 | no_neighbor_set_peer_group_cmd, | |
a80beece | 3182 | NO_NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3183 | NO_STR |
3184 | NEIGHBOR_STR | |
a80beece | 3185 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3186 | "Member of the peer-group\n" |
3187 | "peer-group name\n") | |
3188 | { | |
3189 | int ret; | |
3190 | struct bgp *bgp; | |
3191 | struct peer *peer; | |
3192 | struct peer_group *group; | |
3193 | ||
3194 | bgp = vty->index; | |
3195 | ||
3196 | peer = peer_lookup_vty (vty, argv[0]); | |
3197 | if (! peer) | |
3198 | return CMD_WARNING; | |
3199 | ||
3200 | group = peer_group_lookup (bgp, argv[1]); | |
3201 | if (! group) | |
3202 | { | |
3203 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3204 | return CMD_WARNING; | |
3205 | } | |
3206 | ||
c8560b44 | 3207 | ret = peer_group_unbind (bgp, peer, group); |
718e3744 | 3208 | |
3209 | return bgp_vty_return (vty, ret); | |
3210 | } | |
6b0655a2 | 3211 | |
94f2b392 | 3212 | static int |
fd79ac91 | 3213 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
3214 | u_int16_t flag, int set) | |
718e3744 | 3215 | { |
3216 | int ret; | |
3217 | struct peer *peer; | |
3218 | ||
3219 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3220 | if (! peer) | |
3221 | return CMD_WARNING; | |
3222 | ||
3223 | if (set) | |
3224 | ret = peer_flag_set (peer, flag); | |
3225 | else | |
3226 | ret = peer_flag_unset (peer, flag); | |
3227 | ||
3228 | return bgp_vty_return (vty, ret); | |
3229 | } | |
3230 | ||
94f2b392 | 3231 | static int |
fd79ac91 | 3232 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3233 | { |
3234 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
3235 | } | |
3236 | ||
94f2b392 | 3237 | static int |
fd79ac91 | 3238 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3239 | { |
3240 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
3241 | } | |
3242 | ||
3243 | /* neighbor passive. */ | |
3244 | DEFUN (neighbor_passive, | |
3245 | neighbor_passive_cmd, | |
3246 | NEIGHBOR_CMD2 "passive", | |
3247 | NEIGHBOR_STR | |
3248 | NEIGHBOR_ADDR_STR2 | |
3249 | "Don't send open messages to this neighbor\n") | |
3250 | { | |
3251 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3252 | } | |
3253 | ||
3254 | DEFUN (no_neighbor_passive, | |
3255 | no_neighbor_passive_cmd, | |
3256 | NO_NEIGHBOR_CMD2 "passive", | |
3257 | NO_STR | |
3258 | NEIGHBOR_STR | |
3259 | NEIGHBOR_ADDR_STR2 | |
3260 | "Don't send open messages to this neighbor\n") | |
3261 | { | |
3262 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3263 | } | |
6b0655a2 | 3264 | |
718e3744 | 3265 | /* neighbor shutdown. */ |
3266 | DEFUN (neighbor_shutdown, | |
3267 | neighbor_shutdown_cmd, | |
3268 | NEIGHBOR_CMD2 "shutdown", | |
3269 | NEIGHBOR_STR | |
3270 | NEIGHBOR_ADDR_STR2 | |
3271 | "Administratively shut down this neighbor\n") | |
3272 | { | |
3273 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3274 | } | |
3275 | ||
3276 | DEFUN (no_neighbor_shutdown, | |
3277 | no_neighbor_shutdown_cmd, | |
3278 | NO_NEIGHBOR_CMD2 "shutdown", | |
3279 | NO_STR | |
3280 | NEIGHBOR_STR | |
3281 | NEIGHBOR_ADDR_STR2 | |
3282 | "Administratively shut down this neighbor\n") | |
3283 | { | |
3284 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3285 | } | |
6b0655a2 | 3286 | |
718e3744 | 3287 | /* neighbor capability dynamic. */ |
3288 | DEFUN (neighbor_capability_dynamic, | |
3289 | neighbor_capability_dynamic_cmd, | |
3290 | NEIGHBOR_CMD2 "capability dynamic", | |
3291 | NEIGHBOR_STR | |
3292 | NEIGHBOR_ADDR_STR2 | |
3293 | "Advertise capability to the peer\n" | |
3294 | "Advertise dynamic capability to this neighbor\n") | |
3295 | { | |
3296 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3297 | } | |
3298 | ||
3299 | DEFUN (no_neighbor_capability_dynamic, | |
3300 | no_neighbor_capability_dynamic_cmd, | |
3301 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
3302 | NO_STR | |
3303 | NEIGHBOR_STR | |
3304 | NEIGHBOR_ADDR_STR2 | |
3305 | "Advertise capability to the peer\n" | |
3306 | "Advertise dynamic capability to this neighbor\n") | |
3307 | { | |
3308 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3309 | } | |
6b0655a2 | 3310 | |
718e3744 | 3311 | /* neighbor dont-capability-negotiate */ |
3312 | DEFUN (neighbor_dont_capability_negotiate, | |
3313 | neighbor_dont_capability_negotiate_cmd, | |
3314 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3315 | NEIGHBOR_STR | |
3316 | NEIGHBOR_ADDR_STR2 | |
3317 | "Do not perform capability negotiation\n") | |
3318 | { | |
3319 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3320 | } | |
3321 | ||
3322 | DEFUN (no_neighbor_dont_capability_negotiate, | |
3323 | no_neighbor_dont_capability_negotiate_cmd, | |
3324 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3325 | NO_STR | |
3326 | NEIGHBOR_STR | |
3327 | NEIGHBOR_ADDR_STR2 | |
3328 | "Do not perform capability negotiation\n") | |
3329 | { | |
3330 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3331 | } | |
6b0655a2 | 3332 | |
8a92a8a0 DS |
3333 | /* neighbor capability extended next hop encoding */ |
3334 | DEFUN (neighbor_capability_enhe, | |
3335 | neighbor_capability_enhe_cmd, | |
3336 | NEIGHBOR_CMD2 "capability extended-nexthop", | |
3337 | NEIGHBOR_STR | |
3338 | NEIGHBOR_ADDR_STR2 | |
3339 | "Advertise capability to the peer\n" | |
3340 | "Advertise extended next-hop capability to the peer\n") | |
3341 | { | |
3342 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3343 | } | |
3344 | ||
3345 | DEFUN (no_neighbor_capability_enhe, | |
3346 | no_neighbor_capability_enhe_cmd, | |
3347 | NO_NEIGHBOR_CMD2 "capability extended-nexthop", | |
3348 | NO_STR | |
3349 | NEIGHBOR_STR | |
3350 | NEIGHBOR_ADDR_STR2 | |
3351 | "Advertise capability to the peer\n" | |
3352 | "Advertise extended next-hop capability to the peer\n") | |
3353 | { | |
3354 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3355 | } | |
3356 | ||
94f2b392 | 3357 | static int |
fd79ac91 | 3358 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3359 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 3360 | { |
3361 | int ret; | |
3362 | struct peer *peer; | |
3363 | ||
3364 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3365 | if (! peer) | |
3366 | return CMD_WARNING; | |
3367 | ||
3368 | if (set) | |
3369 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
3370 | else | |
3371 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
3372 | ||
3373 | return bgp_vty_return (vty, ret); | |
3374 | } | |
3375 | ||
94f2b392 | 3376 | static int |
fd79ac91 | 3377 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3378 | safi_t safi, u_int32_t flag) |
718e3744 | 3379 | { |
3380 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
3381 | } | |
3382 | ||
94f2b392 | 3383 | static int |
fd79ac91 | 3384 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3385 | safi_t safi, u_int32_t flag) |
718e3744 | 3386 | { |
3387 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
3388 | } | |
6b0655a2 | 3389 | |
718e3744 | 3390 | /* neighbor capability orf prefix-list. */ |
3391 | DEFUN (neighbor_capability_orf_prefix, | |
3392 | neighbor_capability_orf_prefix_cmd, | |
3393 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3394 | NEIGHBOR_STR | |
3395 | NEIGHBOR_ADDR_STR2 | |
3396 | "Advertise capability to the peer\n" | |
3397 | "Advertise ORF capability to the peer\n" | |
3398 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3399 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3400 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3401 | "Capability to SEND the ORF to this neighbor\n") | |
3402 | { | |
3403 | u_int16_t flag = 0; | |
3404 | ||
3405 | if (strncmp (argv[1], "s", 1) == 0) | |
3406 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3407 | else if (strncmp (argv[1], "r", 1) == 0) | |
3408 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3409 | else if (strncmp (argv[1], "b", 1) == 0) | |
3410 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3411 | else | |
3412 | return CMD_WARNING; | |
3413 | ||
3414 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3415 | bgp_node_safi (vty), flag); | |
3416 | } | |
3417 | ||
3418 | DEFUN (no_neighbor_capability_orf_prefix, | |
3419 | no_neighbor_capability_orf_prefix_cmd, | |
3420 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3421 | NO_STR | |
3422 | NEIGHBOR_STR | |
3423 | NEIGHBOR_ADDR_STR2 | |
3424 | "Advertise capability to the peer\n" | |
3425 | "Advertise ORF capability to the peer\n" | |
3426 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3427 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3428 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3429 | "Capability to SEND the ORF to this neighbor\n") | |
3430 | { | |
3431 | u_int16_t flag = 0; | |
3432 | ||
3433 | if (strncmp (argv[1], "s", 1) == 0) | |
3434 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3435 | else if (strncmp (argv[1], "r", 1) == 0) | |
3436 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3437 | else if (strncmp (argv[1], "b", 1) == 0) | |
3438 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3439 | else | |
3440 | return CMD_WARNING; | |
3441 | ||
3442 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3443 | bgp_node_safi (vty), flag); | |
3444 | } | |
6b0655a2 | 3445 | |
718e3744 | 3446 | /* neighbor next-hop-self. */ |
3447 | DEFUN (neighbor_nexthop_self, | |
3448 | neighbor_nexthop_self_cmd, | |
a538debe | 3449 | NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3450 | NEIGHBOR_STR |
3451 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3452 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3453 | { |
a538debe DS |
3454 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3455 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); | |
3456 | } | |
9e7a53c1 | 3457 | |
a538debe DS |
3458 | /* neighbor next-hop-self. */ |
3459 | DEFUN (neighbor_nexthop_self_force, | |
3460 | neighbor_nexthop_self_force_cmd, | |
3461 | NEIGHBOR_CMD2 "next-hop-self force", | |
3462 | NEIGHBOR_STR | |
3463 | NEIGHBOR_ADDR_STR2 | |
3464 | "Disable the next hop calculation for this neighbor\n" | |
3465 | "Set the next hop to self for reflected routes\n") | |
3466 | { | |
3467 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3468 | bgp_node_safi (vty), | |
88b8ed8d | 3469 | PEER_FLAG_FORCE_NEXTHOP_SELF); |
718e3744 | 3470 | } |
3471 | ||
3472 | DEFUN (no_neighbor_nexthop_self, | |
3473 | no_neighbor_nexthop_self_cmd, | |
a538debe | 3474 | NO_NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3475 | NO_STR |
3476 | NEIGHBOR_STR | |
3477 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3478 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3479 | { |
3480 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
9e7a53c1 | 3481 | bgp_node_safi (vty), |
88b8ed8d | 3482 | PEER_FLAG_NEXTHOP_SELF); |
718e3744 | 3483 | } |
6b0655a2 | 3484 | |
88b8ed8d | 3485 | DEFUN (no_neighbor_nexthop_self_force, |
a538debe DS |
3486 | no_neighbor_nexthop_self_force_cmd, |
3487 | NO_NEIGHBOR_CMD2 "next-hop-self force", | |
3488 | NO_STR | |
3489 | NEIGHBOR_STR | |
3490 | NEIGHBOR_ADDR_STR2 | |
3491 | "Disable the next hop calculation for this neighbor\n" | |
3492 | "Set the next hop to self for reflected routes\n") | |
88b8ed8d DW |
3493 | { |
3494 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3495 | bgp_node_safi (vty), | |
3496 | PEER_FLAG_FORCE_NEXTHOP_SELF); | |
3497 | } | |
a538debe | 3498 | |
c7122e14 DS |
3499 | /* neighbor as-override */ |
3500 | DEFUN (neighbor_as_override, | |
3501 | neighbor_as_override_cmd, | |
3502 | NEIGHBOR_CMD2 "as-override", | |
3503 | NEIGHBOR_STR | |
3504 | NEIGHBOR_ADDR_STR2 | |
3505 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3506 | { | |
3507 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3508 | bgp_node_safi (vty), | |
3509 | PEER_FLAG_AS_OVERRIDE); | |
3510 | } | |
3511 | ||
3512 | DEFUN (no_neighbor_as_override, | |
3513 | no_neighbor_as_override_cmd, | |
3514 | NO_NEIGHBOR_CMD2 "as-override", | |
3515 | NO_STR | |
3516 | NEIGHBOR_STR | |
3517 | NEIGHBOR_ADDR_STR2 | |
3518 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3519 | { | |
3520 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3521 | bgp_node_safi (vty), | |
3522 | PEER_FLAG_AS_OVERRIDE); | |
3523 | } | |
3524 | ||
718e3744 | 3525 | /* neighbor remove-private-AS. */ |
3526 | DEFUN (neighbor_remove_private_as, | |
3527 | neighbor_remove_private_as_cmd, | |
3528 | NEIGHBOR_CMD2 "remove-private-AS", | |
3529 | NEIGHBOR_STR | |
3530 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3531 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3532 | { |
3533 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3534 | bgp_node_safi (vty), | |
3535 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
3536 | } | |
3537 | ||
5000f21c DS |
3538 | DEFUN (neighbor_remove_private_as_all, |
3539 | neighbor_remove_private_as_all_cmd, | |
3540 | NEIGHBOR_CMD2 "remove-private-AS all", | |
3541 | NEIGHBOR_STR | |
3542 | NEIGHBOR_ADDR_STR2 | |
3543 | "Remove private ASNs in outbound updates\n" | |
3544 | "Apply to all AS numbers") | |
3545 | { | |
5000f21c DS |
3546 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3547 | bgp_node_safi (vty), | |
5000f21c DS |
3548 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); |
3549 | } | |
3550 | ||
3551 | DEFUN (neighbor_remove_private_as_replace_as, | |
3552 | neighbor_remove_private_as_replace_as_cmd, | |
3553 | NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3554 | NEIGHBOR_STR | |
3555 | NEIGHBOR_ADDR_STR2 | |
3556 | "Remove private ASNs in outbound updates\n" | |
3557 | "Replace private ASNs with our ASN in outbound updates\n") | |
3558 | { | |
5000f21c DS |
3559 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3560 | bgp_node_safi (vty), | |
5000f21c DS |
3561 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); |
3562 | } | |
3563 | ||
3564 | DEFUN (neighbor_remove_private_as_all_replace_as, | |
3565 | neighbor_remove_private_as_all_replace_as_cmd, | |
3566 | NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3567 | NEIGHBOR_STR | |
3568 | NEIGHBOR_ADDR_STR2 | |
3569 | "Remove private ASNs in outbound updates\n" | |
3570 | "Apply to all AS numbers" | |
3571 | "Replace private ASNs with our ASN in outbound updates\n") | |
3572 | { | |
3573 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3574 | bgp_node_safi (vty), | |
88b8ed8d | 3575 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); |
5000f21c DS |
3576 | } |
3577 | ||
718e3744 | 3578 | DEFUN (no_neighbor_remove_private_as, |
3579 | no_neighbor_remove_private_as_cmd, | |
3580 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
3581 | NO_STR | |
3582 | NEIGHBOR_STR | |
3583 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3584 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3585 | { |
3586 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3587 | bgp_node_safi (vty), | |
88b8ed8d | 3588 | PEER_FLAG_REMOVE_PRIVATE_AS); |
718e3744 | 3589 | } |
6b0655a2 | 3590 | |
88b8ed8d | 3591 | DEFUN (no_neighbor_remove_private_as_all, |
5000f21c DS |
3592 | no_neighbor_remove_private_as_all_cmd, |
3593 | NO_NEIGHBOR_CMD2 "remove-private-AS all", | |
3594 | NO_STR | |
3595 | NEIGHBOR_STR | |
3596 | NEIGHBOR_ADDR_STR2 | |
3597 | "Remove private ASNs in outbound updates\n" | |
3598 | "Apply to all AS numbers") | |
88b8ed8d DW |
3599 | { |
3600 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3601 | bgp_node_safi (vty), | |
3602 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3603 | } | |
5000f21c | 3604 | |
88b8ed8d | 3605 | DEFUN (no_neighbor_remove_private_as_replace_as, |
5000f21c DS |
3606 | no_neighbor_remove_private_as_replace_as_cmd, |
3607 | NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3608 | NO_STR | |
3609 | NEIGHBOR_STR | |
3610 | NEIGHBOR_ADDR_STR2 | |
3611 | "Remove private ASNs in outbound updates\n" | |
3612 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d DW |
3613 | { |
3614 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3615 | bgp_node_safi (vty), | |
3616 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3617 | } | |
5000f21c | 3618 | |
88b8ed8d | 3619 | DEFUN (no_neighbor_remove_private_as_all_replace_as, |
5000f21c DS |
3620 | no_neighbor_remove_private_as_all_replace_as_cmd, |
3621 | NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3622 | NO_STR | |
3623 | NEIGHBOR_STR | |
3624 | NEIGHBOR_ADDR_STR2 | |
3625 | "Remove private ASNs in outbound updates\n" | |
3626 | "Apply to all AS numbers" | |
3627 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d DW |
3628 | { |
3629 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3630 | bgp_node_safi (vty), | |
3631 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); | |
3632 | } | |
5000f21c DS |
3633 | |
3634 | ||
718e3744 | 3635 | /* neighbor send-community. */ |
3636 | DEFUN (neighbor_send_community, | |
3637 | neighbor_send_community_cmd, | |
3638 | NEIGHBOR_CMD2 "send-community", | |
3639 | NEIGHBOR_STR | |
3640 | NEIGHBOR_ADDR_STR2 | |
3641 | "Send Community attribute to this neighbor\n") | |
3642 | { | |
3643 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3644 | bgp_node_safi (vty), | |
3645 | PEER_FLAG_SEND_COMMUNITY); | |
3646 | } | |
3647 | ||
3648 | DEFUN (no_neighbor_send_community, | |
3649 | no_neighbor_send_community_cmd, | |
3650 | NO_NEIGHBOR_CMD2 "send-community", | |
3651 | NO_STR | |
3652 | NEIGHBOR_STR | |
3653 | NEIGHBOR_ADDR_STR2 | |
3654 | "Send Community attribute to this neighbor\n") | |
3655 | { | |
3656 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3657 | bgp_node_safi (vty), | |
3658 | PEER_FLAG_SEND_COMMUNITY); | |
3659 | } | |
6b0655a2 | 3660 | |
718e3744 | 3661 | /* neighbor send-community extended. */ |
3662 | DEFUN (neighbor_send_community_type, | |
3663 | neighbor_send_community_type_cmd, | |
3664 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3665 | NEIGHBOR_STR | |
3666 | NEIGHBOR_ADDR_STR2 | |
3667 | "Send Community attribute to this neighbor\n" | |
3668 | "Send Standard and Extended Community attributes\n" | |
3669 | "Send Extended Community attributes\n" | |
3670 | "Send Standard Community attributes\n") | |
3671 | { | |
3672 | if (strncmp (argv[1], "s", 1) == 0) | |
3673 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3674 | bgp_node_safi (vty), | |
3675 | PEER_FLAG_SEND_COMMUNITY); | |
3676 | if (strncmp (argv[1], "e", 1) == 0) | |
3677 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3678 | bgp_node_safi (vty), | |
3679 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3680 | ||
3681 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3682 | bgp_node_safi (vty), | |
3683 | (PEER_FLAG_SEND_COMMUNITY| | |
3684 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3685 | } | |
3686 | ||
3687 | DEFUN (no_neighbor_send_community_type, | |
3688 | no_neighbor_send_community_type_cmd, | |
3689 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3690 | NO_STR | |
3691 | NEIGHBOR_STR | |
3692 | NEIGHBOR_ADDR_STR2 | |
3693 | "Send Community attribute to this neighbor\n" | |
3694 | "Send Standard and Extended Community attributes\n" | |
3695 | "Send Extended Community attributes\n" | |
3696 | "Send Standard Community attributes\n") | |
3697 | { | |
3698 | if (strncmp (argv[1], "s", 1) == 0) | |
3699 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3700 | bgp_node_safi (vty), | |
3701 | PEER_FLAG_SEND_COMMUNITY); | |
3702 | if (strncmp (argv[1], "e", 1) == 0) | |
3703 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3704 | bgp_node_safi (vty), | |
3705 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3706 | ||
3707 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3708 | bgp_node_safi (vty), | |
3709 | (PEER_FLAG_SEND_COMMUNITY | | |
3710 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3711 | } | |
6b0655a2 | 3712 | |
718e3744 | 3713 | /* neighbor soft-reconfig. */ |
3714 | DEFUN (neighbor_soft_reconfiguration, | |
3715 | neighbor_soft_reconfiguration_cmd, | |
3716 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3717 | NEIGHBOR_STR | |
3718 | NEIGHBOR_ADDR_STR2 | |
3719 | "Per neighbor soft reconfiguration\n" | |
3720 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3721 | { | |
3722 | return peer_af_flag_set_vty (vty, argv[0], | |
3723 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3724 | PEER_FLAG_SOFT_RECONFIG); | |
3725 | } | |
3726 | ||
3727 | DEFUN (no_neighbor_soft_reconfiguration, | |
3728 | no_neighbor_soft_reconfiguration_cmd, | |
3729 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3730 | NO_STR | |
3731 | NEIGHBOR_STR | |
3732 | NEIGHBOR_ADDR_STR2 | |
3733 | "Per neighbor soft reconfiguration\n" | |
3734 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3735 | { | |
3736 | return peer_af_flag_unset_vty (vty, argv[0], | |
3737 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3738 | PEER_FLAG_SOFT_RECONFIG); | |
3739 | } | |
6b0655a2 | 3740 | |
718e3744 | 3741 | DEFUN (neighbor_route_reflector_client, |
3742 | neighbor_route_reflector_client_cmd, | |
3743 | NEIGHBOR_CMD2 "route-reflector-client", | |
3744 | NEIGHBOR_STR | |
3745 | NEIGHBOR_ADDR_STR2 | |
3746 | "Configure a neighbor as Route Reflector client\n") | |
3747 | { | |
3748 | struct peer *peer; | |
3749 | ||
3750 | ||
3751 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3752 | if (! peer) | |
3753 | return CMD_WARNING; | |
3754 | ||
3755 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3756 | bgp_node_safi (vty), | |
3757 | PEER_FLAG_REFLECTOR_CLIENT); | |
3758 | } | |
3759 | ||
3760 | DEFUN (no_neighbor_route_reflector_client, | |
3761 | no_neighbor_route_reflector_client_cmd, | |
3762 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
3763 | NO_STR | |
3764 | NEIGHBOR_STR | |
3765 | NEIGHBOR_ADDR_STR2 | |
3766 | "Configure a neighbor as Route Reflector client\n") | |
3767 | { | |
3768 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3769 | bgp_node_safi (vty), | |
3770 | PEER_FLAG_REFLECTOR_CLIENT); | |
3771 | } | |
6b0655a2 | 3772 | |
718e3744 | 3773 | /* neighbor route-server-client. */ |
3774 | DEFUN (neighbor_route_server_client, | |
3775 | neighbor_route_server_client_cmd, | |
3776 | NEIGHBOR_CMD2 "route-server-client", | |
3777 | NEIGHBOR_STR | |
3778 | NEIGHBOR_ADDR_STR2 | |
3779 | "Configure a neighbor as Route Server client\n") | |
3780 | { | |
2a3d5731 DW |
3781 | struct peer *peer; |
3782 | ||
3783 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3784 | if (! peer) | |
3785 | return CMD_WARNING; | |
3786 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3787 | bgp_node_safi (vty), | |
3788 | PEER_FLAG_RSERVER_CLIENT); | |
718e3744 | 3789 | } |
3790 | ||
3791 | DEFUN (no_neighbor_route_server_client, | |
3792 | no_neighbor_route_server_client_cmd, | |
3793 | NO_NEIGHBOR_CMD2 "route-server-client", | |
3794 | NO_STR | |
3795 | NEIGHBOR_STR | |
3796 | NEIGHBOR_ADDR_STR2 | |
3797 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 3798 | { |
2a3d5731 DW |
3799 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
3800 | bgp_node_safi (vty), | |
3801 | PEER_FLAG_RSERVER_CLIENT); | |
fee0f4c6 | 3802 | } |
6b0655a2 | 3803 | |
fee0f4c6 | 3804 | DEFUN (neighbor_nexthop_local_unchanged, |
3805 | neighbor_nexthop_local_unchanged_cmd, | |
3806 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3807 | NEIGHBOR_STR | |
3808 | NEIGHBOR_ADDR_STR2 | |
3809 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
3810 | "Leave link-local nexthop unchanged for this peer\n") | |
3811 | { | |
3812 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3813 | bgp_node_safi (vty), | |
3814 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
3815 | } | |
6b0655a2 | 3816 | |
fee0f4c6 | 3817 | DEFUN (no_neighbor_nexthop_local_unchanged, |
3818 | no_neighbor_nexthop_local_unchanged_cmd, | |
3819 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3820 | NO_STR | |
3821 | NEIGHBOR_STR | |
3822 | NEIGHBOR_ADDR_STR2 | |
3823 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
3824 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 3825 | { |
3826 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3827 | bgp_node_safi (vty), | |
fee0f4c6 | 3828 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 3829 | } |
6b0655a2 | 3830 | |
718e3744 | 3831 | DEFUN (neighbor_attr_unchanged, |
3832 | neighbor_attr_unchanged_cmd, | |
3833 | NEIGHBOR_CMD2 "attribute-unchanged", | |
3834 | NEIGHBOR_STR | |
3835 | NEIGHBOR_ADDR_STR2 | |
3836 | "BGP attribute is propagated unchanged to this neighbor\n") | |
3837 | { | |
3838 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3839 | bgp_node_safi (vty), | |
3840 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
3841 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
3842 | PEER_FLAG_MED_UNCHANGED)); | |
3843 | } | |
3844 | ||
3845 | DEFUN (neighbor_attr_unchanged1, | |
3846 | neighbor_attr_unchanged1_cmd, | |
3847 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
3848 | NEIGHBOR_STR | |
3849 | NEIGHBOR_ADDR_STR2 | |
3850 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3851 | "As-path attribute\n" | |
3852 | "Nexthop attribute\n" | |
3853 | "Med attribute\n") | |
3854 | { | |
3855 | u_int16_t flags = 0; | |
3856 | ||
3857 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3858 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3859 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3860 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3861 | else if (strncmp (argv[1], "med", 1) == 0) | |
3862 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3863 | ||
3864 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3865 | bgp_node_safi (vty), flags); | |
3866 | } | |
3867 | ||
3868 | DEFUN (neighbor_attr_unchanged2, | |
3869 | neighbor_attr_unchanged2_cmd, | |
3870 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
3871 | NEIGHBOR_STR | |
3872 | NEIGHBOR_ADDR_STR2 | |
3873 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3874 | "As-path attribute\n" | |
3875 | "Nexthop attribute\n" | |
3876 | "Med attribute\n") | |
3877 | { | |
3878 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
3879 | ||
3880 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
3881 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3882 | else if (strncmp (argv[1], "med", 1) == 0) | |
3883 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3884 | ||
3885 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3886 | bgp_node_safi (vty), flags); | |
3887 | ||
3888 | } | |
3889 | ||
3890 | DEFUN (neighbor_attr_unchanged3, | |
3891 | neighbor_attr_unchanged3_cmd, | |
3892 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
3893 | NEIGHBOR_STR | |
3894 | NEIGHBOR_ADDR_STR2 | |
3895 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3896 | "Nexthop attribute\n" | |
3897 | "As-path attribute\n" | |
3898 | "Med attribute\n") | |
3899 | { | |
3900 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
3901 | ||
3902 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3903 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3904 | else if (strncmp (argv[1], "med", 1) == 0) | |
3905 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3906 | ||
3907 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3908 | bgp_node_safi (vty), flags); | |
3909 | } | |
3910 | ||
3911 | DEFUN (neighbor_attr_unchanged4, | |
3912 | neighbor_attr_unchanged4_cmd, | |
3913 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
3914 | NEIGHBOR_STR | |
3915 | NEIGHBOR_ADDR_STR2 | |
3916 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3917 | "Med attribute\n" | |
3918 | "As-path attribute\n" | |
3919 | "Nexthop attribute\n") | |
3920 | { | |
3921 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
3922 | ||
3923 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3924 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3925 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3926 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3927 | ||
3928 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3929 | bgp_node_safi (vty), flags); | |
3930 | } | |
3931 | ||
3932 | ALIAS (neighbor_attr_unchanged, | |
3933 | neighbor_attr_unchanged5_cmd, | |
3934 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
3935 | NEIGHBOR_STR | |
3936 | NEIGHBOR_ADDR_STR2 | |
3937 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3938 | "As-path attribute\n" | |
3939 | "Nexthop attribute\n" | |
3940 | "Med attribute\n") | |
3941 | ||
3942 | ALIAS (neighbor_attr_unchanged, | |
3943 | neighbor_attr_unchanged6_cmd, | |
3944 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
3945 | NEIGHBOR_STR | |
3946 | NEIGHBOR_ADDR_STR2 | |
3947 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3948 | "As-path attribute\n" | |
3949 | "Med attribute\n" | |
3950 | "Nexthop attribute\n") | |
3951 | ||
3952 | ALIAS (neighbor_attr_unchanged, | |
3953 | neighbor_attr_unchanged7_cmd, | |
3954 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
3955 | NEIGHBOR_STR | |
3956 | NEIGHBOR_ADDR_STR2 | |
3957 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3958 | "Nexthop attribute\n" | |
3959 | "Med attribute\n" | |
3960 | "As-path attribute\n") | |
3961 | ||
3962 | ALIAS (neighbor_attr_unchanged, | |
3963 | neighbor_attr_unchanged8_cmd, | |
3964 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
3965 | NEIGHBOR_STR | |
3966 | NEIGHBOR_ADDR_STR2 | |
3967 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3968 | "Nexthop attribute\n" | |
3969 | "As-path attribute\n" | |
3970 | "Med attribute\n") | |
3971 | ||
3972 | ALIAS (neighbor_attr_unchanged, | |
3973 | neighbor_attr_unchanged9_cmd, | |
3974 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
3975 | NEIGHBOR_STR | |
3976 | NEIGHBOR_ADDR_STR2 | |
3977 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3978 | "Med attribute\n" | |
3979 | "Nexthop attribute\n" | |
3980 | "As-path attribute\n") | |
3981 | ||
3982 | ALIAS (neighbor_attr_unchanged, | |
3983 | neighbor_attr_unchanged10_cmd, | |
3984 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
3985 | NEIGHBOR_STR | |
3986 | NEIGHBOR_ADDR_STR2 | |
3987 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3988 | "Med attribute\n" | |
3989 | "As-path attribute\n" | |
3990 | "Nexthop attribute\n") | |
3991 | ||
3992 | DEFUN (no_neighbor_attr_unchanged, | |
3993 | no_neighbor_attr_unchanged_cmd, | |
3994 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
3995 | NO_STR | |
3996 | NEIGHBOR_STR | |
3997 | NEIGHBOR_ADDR_STR2 | |
3998 | "BGP attribute is propagated unchanged to this neighbor\n") | |
3999 | { | |
4000 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4001 | bgp_node_safi (vty), | |
4002 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4003 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4004 | PEER_FLAG_MED_UNCHANGED)); | |
4005 | } | |
4006 | ||
4007 | DEFUN (no_neighbor_attr_unchanged1, | |
4008 | no_neighbor_attr_unchanged1_cmd, | |
4009 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4010 | NO_STR | |
4011 | NEIGHBOR_STR | |
4012 | NEIGHBOR_ADDR_STR2 | |
4013 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4014 | "As-path attribute\n" | |
4015 | "Nexthop attribute\n" | |
4016 | "Med attribute\n") | |
4017 | { | |
4018 | u_int16_t flags = 0; | |
4019 | ||
4020 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4021 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4022 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4023 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4024 | else if (strncmp (argv[1], "med", 1) == 0) | |
4025 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4026 | ||
4027 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4028 | bgp_node_safi (vty), flags); | |
4029 | } | |
4030 | ||
4031 | DEFUN (no_neighbor_attr_unchanged2, | |
4032 | no_neighbor_attr_unchanged2_cmd, | |
4033 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4034 | NO_STR | |
4035 | NEIGHBOR_STR | |
4036 | NEIGHBOR_ADDR_STR2 | |
4037 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4038 | "As-path attribute\n" | |
4039 | "Nexthop attribute\n" | |
4040 | "Med attribute\n") | |
4041 | { | |
4042 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4043 | ||
4044 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4045 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4046 | else if (strncmp (argv[1], "med", 1) == 0) | |
4047 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4048 | ||
4049 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4050 | bgp_node_safi (vty), flags); | |
4051 | } | |
4052 | ||
4053 | DEFUN (no_neighbor_attr_unchanged3, | |
4054 | no_neighbor_attr_unchanged3_cmd, | |
4055 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4056 | NO_STR | |
4057 | NEIGHBOR_STR | |
4058 | NEIGHBOR_ADDR_STR2 | |
4059 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4060 | "Nexthop attribute\n" | |
4061 | "As-path attribute\n" | |
4062 | "Med attribute\n") | |
4063 | { | |
4064 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4065 | ||
4066 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4067 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4068 | else if (strncmp (argv[1], "med", 1) == 0) | |
4069 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4070 | ||
4071 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4072 | bgp_node_safi (vty), flags); | |
4073 | } | |
4074 | ||
4075 | DEFUN (no_neighbor_attr_unchanged4, | |
4076 | no_neighbor_attr_unchanged4_cmd, | |
4077 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4078 | NO_STR | |
4079 | NEIGHBOR_STR | |
4080 | NEIGHBOR_ADDR_STR2 | |
4081 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4082 | "Med attribute\n" | |
4083 | "As-path attribute\n" | |
4084 | "Nexthop attribute\n") | |
4085 | { | |
4086 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4087 | ||
4088 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4089 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4090 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4091 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4092 | ||
4093 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4094 | bgp_node_safi (vty), flags); | |
4095 | } | |
4096 | ||
4097 | ALIAS (no_neighbor_attr_unchanged, | |
4098 | no_neighbor_attr_unchanged5_cmd, | |
4099 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4100 | NO_STR | |
4101 | NEIGHBOR_STR | |
4102 | NEIGHBOR_ADDR_STR2 | |
4103 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4104 | "As-path attribute\n" | |
4105 | "Nexthop attribute\n" | |
4106 | "Med attribute\n") | |
4107 | ||
4108 | ALIAS (no_neighbor_attr_unchanged, | |
4109 | no_neighbor_attr_unchanged6_cmd, | |
4110 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4111 | NO_STR | |
4112 | NEIGHBOR_STR | |
4113 | NEIGHBOR_ADDR_STR2 | |
4114 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4115 | "As-path attribute\n" | |
4116 | "Med attribute\n" | |
4117 | "Nexthop attribute\n") | |
4118 | ||
4119 | ALIAS (no_neighbor_attr_unchanged, | |
4120 | no_neighbor_attr_unchanged7_cmd, | |
4121 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4122 | NO_STR | |
4123 | NEIGHBOR_STR | |
4124 | NEIGHBOR_ADDR_STR2 | |
4125 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4126 | "Nexthop attribute\n" | |
4127 | "Med attribute\n" | |
4128 | "As-path attribute\n") | |
4129 | ||
4130 | ALIAS (no_neighbor_attr_unchanged, | |
4131 | no_neighbor_attr_unchanged8_cmd, | |
4132 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4133 | NO_STR | |
4134 | NEIGHBOR_STR | |
4135 | NEIGHBOR_ADDR_STR2 | |
4136 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4137 | "Nexthop attribute\n" | |
4138 | "As-path attribute\n" | |
4139 | "Med attribute\n") | |
4140 | ||
4141 | ALIAS (no_neighbor_attr_unchanged, | |
4142 | no_neighbor_attr_unchanged9_cmd, | |
4143 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4144 | NO_STR | |
4145 | NEIGHBOR_STR | |
4146 | NEIGHBOR_ADDR_STR2 | |
4147 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4148 | "Med attribute\n" | |
4149 | "Nexthop attribute\n" | |
4150 | "As-path attribute\n") | |
4151 | ||
4152 | ALIAS (no_neighbor_attr_unchanged, | |
4153 | no_neighbor_attr_unchanged10_cmd, | |
4154 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4155 | NO_STR | |
4156 | NEIGHBOR_STR | |
4157 | NEIGHBOR_ADDR_STR2 | |
4158 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4159 | "Med attribute\n" | |
4160 | "As-path attribute\n" | |
4161 | "Nexthop attribute\n") | |
4162 | ||
718e3744 | 4163 | /* EBGP multihop configuration. */ |
94f2b392 | 4164 | static int |
fd79ac91 | 4165 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
4166 | const char *ttl_str) | |
718e3744 | 4167 | { |
4168 | struct peer *peer; | |
fd79ac91 | 4169 | unsigned int ttl; |
718e3744 | 4170 | |
4171 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4172 | if (! peer) | |
4173 | return CMD_WARNING; | |
4174 | ||
4175 | if (! ttl_str) | |
4176 | ttl = TTL_MAX; | |
4177 | else | |
4178 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); | |
4179 | ||
89b6d1f8 | 4180 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 4181 | } |
4182 | ||
94f2b392 | 4183 | static int |
fd79ac91 | 4184 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4185 | { |
4186 | struct peer *peer; | |
4187 | ||
4188 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4189 | if (! peer) | |
4190 | return CMD_WARNING; | |
4191 | ||
89b6d1f8 | 4192 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 4193 | } |
4194 | ||
4195 | /* neighbor ebgp-multihop. */ | |
4196 | DEFUN (neighbor_ebgp_multihop, | |
4197 | neighbor_ebgp_multihop_cmd, | |
4198 | NEIGHBOR_CMD2 "ebgp-multihop", | |
4199 | NEIGHBOR_STR | |
4200 | NEIGHBOR_ADDR_STR2 | |
4201 | "Allow EBGP neighbors not on directly connected networks\n") | |
4202 | { | |
4203 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
4204 | } | |
4205 | ||
4206 | DEFUN (neighbor_ebgp_multihop_ttl, | |
4207 | neighbor_ebgp_multihop_ttl_cmd, | |
4208 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
4209 | NEIGHBOR_STR | |
4210 | NEIGHBOR_ADDR_STR2 | |
4211 | "Allow EBGP neighbors not on directly connected networks\n" | |
4212 | "maximum hop count\n") | |
4213 | { | |
4214 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
4215 | } | |
4216 | ||
4217 | DEFUN (no_neighbor_ebgp_multihop, | |
4218 | no_neighbor_ebgp_multihop_cmd, | |
4219 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
4220 | NO_STR | |
4221 | NEIGHBOR_STR | |
4222 | NEIGHBOR_ADDR_STR2 | |
4223 | "Allow EBGP neighbors not on directly connected networks\n") | |
4224 | { | |
4225 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
4226 | } | |
4227 | ||
4228 | ALIAS (no_neighbor_ebgp_multihop, | |
4229 | no_neighbor_ebgp_multihop_ttl_cmd, | |
4230 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
4231 | NO_STR | |
4232 | NEIGHBOR_STR | |
4233 | NEIGHBOR_ADDR_STR2 | |
4234 | "Allow EBGP neighbors not on directly connected networks\n" | |
4235 | "maximum hop count\n") | |
6b0655a2 | 4236 | |
6ffd2079 | 4237 | /* disable-connected-check */ |
4238 | DEFUN (neighbor_disable_connected_check, | |
4239 | neighbor_disable_connected_check_cmd, | |
4240 | NEIGHBOR_CMD2 "disable-connected-check", | |
4241 | NEIGHBOR_STR | |
4242 | NEIGHBOR_ADDR_STR2 | |
4243 | "one-hop away EBGP peer using loopback address\n") | |
4244 | { | |
4245 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4246 | } | |
4247 | ||
4248 | DEFUN (no_neighbor_disable_connected_check, | |
4249 | no_neighbor_disable_connected_check_cmd, | |
4250 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
4251 | NO_STR | |
4252 | NEIGHBOR_STR | |
4253 | NEIGHBOR_ADDR_STR2 | |
4254 | "one-hop away EBGP peer using loopback address\n") | |
4255 | { | |
4256 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4257 | } | |
4258 | ||
718e3744 | 4259 | /* Enforce multihop. */ |
6ffd2079 | 4260 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 4261 | neighbor_enforce_multihop_cmd, |
4262 | NEIGHBOR_CMD2 "enforce-multihop", | |
4263 | NEIGHBOR_STR | |
4264 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4265 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 4266 | |
6ffd2079 | 4267 | /* Enforce multihop. */ |
4268 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 4269 | no_neighbor_enforce_multihop_cmd, |
4270 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
4271 | NO_STR | |
4272 | NEIGHBOR_STR | |
4273 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4274 | "Enforce EBGP neighbors perform multihop\n") |
6b0655a2 | 4275 | |
718e3744 | 4276 | DEFUN (neighbor_description, |
4277 | neighbor_description_cmd, | |
4278 | NEIGHBOR_CMD2 "description .LINE", | |
4279 | NEIGHBOR_STR | |
4280 | NEIGHBOR_ADDR_STR2 | |
4281 | "Neighbor specific description\n" | |
4282 | "Up to 80 characters describing this neighbor\n") | |
4283 | { | |
4284 | struct peer *peer; | |
718e3744 | 4285 | char *str; |
718e3744 | 4286 | |
4287 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4288 | if (! peer) | |
4289 | return CMD_WARNING; | |
4290 | ||
4291 | if (argc == 1) | |
4292 | return CMD_SUCCESS; | |
4293 | ||
3b8b1855 | 4294 | str = argv_concat(argv, argc, 1); |
718e3744 | 4295 | |
4296 | peer_description_set (peer, str); | |
4297 | ||
3b8b1855 | 4298 | XFREE (MTYPE_TMP, str); |
718e3744 | 4299 | |
4300 | return CMD_SUCCESS; | |
4301 | } | |
4302 | ||
4303 | DEFUN (no_neighbor_description, | |
4304 | no_neighbor_description_cmd, | |
4305 | NO_NEIGHBOR_CMD2 "description", | |
4306 | NO_STR | |
4307 | NEIGHBOR_STR | |
4308 | NEIGHBOR_ADDR_STR2 | |
4309 | "Neighbor specific description\n") | |
4310 | { | |
4311 | struct peer *peer; | |
4312 | ||
4313 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4314 | if (! peer) | |
4315 | return CMD_WARNING; | |
4316 | ||
4317 | peer_description_unset (peer); | |
4318 | ||
4319 | return CMD_SUCCESS; | |
4320 | } | |
4321 | ||
4322 | ALIAS (no_neighbor_description, | |
4323 | no_neighbor_description_val_cmd, | |
4324 | NO_NEIGHBOR_CMD2 "description .LINE", | |
4325 | NO_STR | |
4326 | NEIGHBOR_STR | |
4327 | NEIGHBOR_ADDR_STR2 | |
4328 | "Neighbor specific description\n" | |
4329 | "Up to 80 characters describing this neighbor\n") | |
6b0655a2 | 4330 | |
718e3744 | 4331 | /* Neighbor update-source. */ |
94f2b392 | 4332 | static int |
fd79ac91 | 4333 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
4334 | const char *source_str) | |
718e3744 | 4335 | { |
4336 | struct peer *peer; | |
718e3744 | 4337 | |
4338 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4339 | if (! peer) | |
4340 | return CMD_WARNING; | |
4341 | ||
a80beece DS |
4342 | if (peer->conf_if) |
4343 | return CMD_WARNING; | |
4344 | ||
718e3744 | 4345 | if (source_str) |
4346 | { | |
c63b83fe JBD |
4347 | union sockunion su; |
4348 | int ret = str2sockunion (source_str, &su); | |
4349 | ||
4350 | if (ret == 0) | |
4351 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 4352 | else |
4353 | peer_update_source_if_set (peer, source_str); | |
4354 | } | |
4355 | else | |
4356 | peer_update_source_unset (peer); | |
4357 | ||
4358 | return CMD_SUCCESS; | |
4359 | } | |
4360 | ||
dcb52bd5 DS |
4361 | #define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD" |
4362 | #define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")" | |
4363 | #define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}" | |
369688c0 PJ |
4364 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
4365 | "IPv4 address\n" \ | |
9a1a331d PJ |
4366 | "IPv6 address\n" \ |
4367 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 4368 | |
718e3744 | 4369 | DEFUN (neighbor_update_source, |
4370 | neighbor_update_source_cmd, | |
dcb52bd5 | 4371 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_REQ_STR, |
718e3744 | 4372 | NEIGHBOR_STR |
4373 | NEIGHBOR_ADDR_STR2 | |
4374 | "Source of routing updates\n" | |
369688c0 | 4375 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 4376 | { |
4377 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
4378 | } | |
4379 | ||
4380 | DEFUN (no_neighbor_update_source, | |
4381 | no_neighbor_update_source_cmd, | |
dcb52bd5 | 4382 | NO_NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_OPT_STR, |
718e3744 | 4383 | NO_STR |
4384 | NEIGHBOR_STR | |
4385 | NEIGHBOR_ADDR_STR2 | |
dcb52bd5 DS |
4386 | "Source of routing updates\n" |
4387 | BGP_UPDATE_SOURCE_HELP_STR) | |
718e3744 | 4388 | { |
4389 | return peer_update_source_vty (vty, argv[0], NULL); | |
4390 | } | |
6b0655a2 | 4391 | |
94f2b392 | 4392 | static int |
fd79ac91 | 4393 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
4394 | afi_t afi, safi_t safi, | |
4395 | const char *rmap, int set) | |
718e3744 | 4396 | { |
4397 | int ret; | |
4398 | struct peer *peer; | |
4399 | ||
4400 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4401 | if (! peer) | |
4402 | return CMD_WARNING; | |
4403 | ||
4404 | if (set) | |
4405 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
4406 | else | |
4407 | ret = peer_default_originate_unset (peer, afi, safi); | |
4408 | ||
4409 | return bgp_vty_return (vty, ret); | |
4410 | } | |
4411 | ||
4412 | /* neighbor default-originate. */ | |
4413 | DEFUN (neighbor_default_originate, | |
4414 | neighbor_default_originate_cmd, | |
4415 | NEIGHBOR_CMD2 "default-originate", | |
4416 | NEIGHBOR_STR | |
4417 | NEIGHBOR_ADDR_STR2 | |
4418 | "Originate default route to this neighbor\n") | |
4419 | { | |
4420 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4421 | bgp_node_safi (vty), NULL, 1); | |
4422 | } | |
4423 | ||
4424 | DEFUN (neighbor_default_originate_rmap, | |
4425 | neighbor_default_originate_rmap_cmd, | |
4426 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4427 | NEIGHBOR_STR | |
4428 | NEIGHBOR_ADDR_STR2 | |
4429 | "Originate default route to this neighbor\n" | |
4430 | "Route-map to specify criteria to originate default\n" | |
4431 | "route-map name\n") | |
4432 | { | |
4433 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4434 | bgp_node_safi (vty), argv[1], 1); | |
4435 | } | |
4436 | ||
4437 | DEFUN (no_neighbor_default_originate, | |
4438 | no_neighbor_default_originate_cmd, | |
4439 | NO_NEIGHBOR_CMD2 "default-originate", | |
4440 | NO_STR | |
4441 | NEIGHBOR_STR | |
4442 | NEIGHBOR_ADDR_STR2 | |
4443 | "Originate default route to this neighbor\n") | |
4444 | { | |
4445 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4446 | bgp_node_safi (vty), NULL, 0); | |
4447 | } | |
4448 | ||
4449 | ALIAS (no_neighbor_default_originate, | |
4450 | no_neighbor_default_originate_rmap_cmd, | |
4451 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4452 | NO_STR | |
4453 | NEIGHBOR_STR | |
4454 | NEIGHBOR_ADDR_STR2 | |
4455 | "Originate default route to this neighbor\n" | |
4456 | "Route-map to specify criteria to originate default\n" | |
4457 | "route-map name\n") | |
6b0655a2 | 4458 | |
718e3744 | 4459 | /* Set neighbor's BGP port. */ |
94f2b392 | 4460 | static int |
fd79ac91 | 4461 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
4462 | const char *port_str) | |
718e3744 | 4463 | { |
4464 | struct peer *peer; | |
4465 | u_int16_t port; | |
4466 | struct servent *sp; | |
4467 | ||
4468 | peer = peer_lookup_vty (vty, ip_str); | |
4469 | if (! peer) | |
4470 | return CMD_WARNING; | |
4471 | ||
4472 | if (! port_str) | |
4473 | { | |
4474 | sp = getservbyname ("bgp", "tcp"); | |
4475 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
4476 | } | |
4477 | else | |
4478 | { | |
4479 | VTY_GET_INTEGER("port", port, port_str); | |
4480 | } | |
4481 | ||
4482 | peer_port_set (peer, port); | |
4483 | ||
4484 | return CMD_SUCCESS; | |
4485 | } | |
4486 | ||
f418446b | 4487 | /* Set specified peer's BGP port. */ |
718e3744 | 4488 | DEFUN (neighbor_port, |
4489 | neighbor_port_cmd, | |
4490 | NEIGHBOR_CMD "port <0-65535>", | |
4491 | NEIGHBOR_STR | |
4492 | NEIGHBOR_ADDR_STR | |
4493 | "Neighbor's BGP port\n" | |
4494 | "TCP port number\n") | |
4495 | { | |
4496 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
4497 | } | |
4498 | ||
4499 | DEFUN (no_neighbor_port, | |
4500 | no_neighbor_port_cmd, | |
4501 | NO_NEIGHBOR_CMD "port", | |
4502 | NO_STR | |
4503 | NEIGHBOR_STR | |
4504 | NEIGHBOR_ADDR_STR | |
4505 | "Neighbor's BGP port\n") | |
4506 | { | |
4507 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
4508 | } | |
4509 | ||
4510 | ALIAS (no_neighbor_port, | |
4511 | no_neighbor_port_val_cmd, | |
4512 | NO_NEIGHBOR_CMD "port <0-65535>", | |
4513 | NO_STR | |
4514 | NEIGHBOR_STR | |
4515 | NEIGHBOR_ADDR_STR | |
4516 | "Neighbor's BGP port\n" | |
4517 | "TCP port number\n") | |
6b0655a2 | 4518 | |
718e3744 | 4519 | /* neighbor weight. */ |
94f2b392 | 4520 | static int |
fd79ac91 | 4521 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
4522 | const char *weight_str) | |
718e3744 | 4523 | { |
718e3744 | 4524 | struct peer *peer; |
4525 | unsigned long weight; | |
4526 | ||
4527 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4528 | if (! peer) | |
4529 | return CMD_WARNING; | |
4530 | ||
4531 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
4532 | ||
ffd0c037 | 4533 | peer_weight_set (peer, weight); |
718e3744 | 4534 | |
4535 | return CMD_SUCCESS; | |
4536 | } | |
4537 | ||
94f2b392 | 4538 | static int |
fd79ac91 | 4539 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4540 | { |
4541 | struct peer *peer; | |
4542 | ||
4543 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4544 | if (! peer) | |
4545 | return CMD_WARNING; | |
4546 | ||
4547 | peer_weight_unset (peer); | |
4548 | ||
4549 | return CMD_SUCCESS; | |
4550 | } | |
4551 | ||
4552 | DEFUN (neighbor_weight, | |
4553 | neighbor_weight_cmd, | |
4554 | NEIGHBOR_CMD2 "weight <0-65535>", | |
4555 | NEIGHBOR_STR | |
4556 | NEIGHBOR_ADDR_STR2 | |
4557 | "Set default weight for routes from this neighbor\n" | |
4558 | "default weight\n") | |
4559 | { | |
4560 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
4561 | } | |
4562 | ||
4563 | DEFUN (no_neighbor_weight, | |
4564 | no_neighbor_weight_cmd, | |
4565 | NO_NEIGHBOR_CMD2 "weight", | |
4566 | NO_STR | |
4567 | NEIGHBOR_STR | |
4568 | NEIGHBOR_ADDR_STR2 | |
4569 | "Set default weight for routes from this neighbor\n") | |
4570 | { | |
4571 | return peer_weight_unset_vty (vty, argv[0]); | |
4572 | } | |
4573 | ||
4574 | ALIAS (no_neighbor_weight, | |
4575 | no_neighbor_weight_val_cmd, | |
4576 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
4577 | NO_STR | |
4578 | NEIGHBOR_STR | |
4579 | NEIGHBOR_ADDR_STR2 | |
4580 | "Set default weight for routes from this neighbor\n" | |
4581 | "default weight\n") | |
6b0655a2 | 4582 | |
718e3744 | 4583 | /* Override capability negotiation. */ |
4584 | DEFUN (neighbor_override_capability, | |
4585 | neighbor_override_capability_cmd, | |
4586 | NEIGHBOR_CMD2 "override-capability", | |
4587 | NEIGHBOR_STR | |
4588 | NEIGHBOR_ADDR_STR2 | |
4589 | "Override capability negotiation result\n") | |
4590 | { | |
4591 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4592 | } | |
4593 | ||
4594 | DEFUN (no_neighbor_override_capability, | |
4595 | no_neighbor_override_capability_cmd, | |
4596 | NO_NEIGHBOR_CMD2 "override-capability", | |
4597 | NO_STR | |
4598 | NEIGHBOR_STR | |
4599 | NEIGHBOR_ADDR_STR2 | |
4600 | "Override capability negotiation result\n") | |
4601 | { | |
4602 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4603 | } | |
6b0655a2 | 4604 | |
718e3744 | 4605 | DEFUN (neighbor_strict_capability, |
4606 | neighbor_strict_capability_cmd, | |
4607 | NEIGHBOR_CMD "strict-capability-match", | |
4608 | NEIGHBOR_STR | |
4609 | NEIGHBOR_ADDR_STR | |
4610 | "Strict capability negotiation match\n") | |
4611 | { | |
4612 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4613 | } | |
4614 | ||
4615 | DEFUN (no_neighbor_strict_capability, | |
4616 | no_neighbor_strict_capability_cmd, | |
4617 | NO_NEIGHBOR_CMD "strict-capability-match", | |
4618 | NO_STR | |
4619 | NEIGHBOR_STR | |
4620 | NEIGHBOR_ADDR_STR | |
4621 | "Strict capability negotiation match\n") | |
4622 | { | |
4623 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4624 | } | |
6b0655a2 | 4625 | |
94f2b392 | 4626 | static int |
fd79ac91 | 4627 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
4628 | const char *keep_str, const char *hold_str) | |
718e3744 | 4629 | { |
4630 | int ret; | |
4631 | struct peer *peer; | |
4632 | u_int32_t keepalive; | |
4633 | u_int32_t holdtime; | |
4634 | ||
4635 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4636 | if (! peer) | |
4637 | return CMD_WARNING; | |
4638 | ||
4639 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
4640 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
4641 | ||
4642 | ret = peer_timers_set (peer, keepalive, holdtime); | |
4643 | ||
4644 | return bgp_vty_return (vty, ret); | |
4645 | } | |
6b0655a2 | 4646 | |
94f2b392 | 4647 | static int |
fd79ac91 | 4648 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4649 | { |
4650 | int ret; | |
4651 | struct peer *peer; | |
4652 | ||
4653 | peer = peer_lookup_vty (vty, ip_str); | |
4654 | if (! peer) | |
4655 | return CMD_WARNING; | |
4656 | ||
4657 | ret = peer_timers_unset (peer); | |
4658 | ||
4659 | return bgp_vty_return (vty, ret); | |
4660 | } | |
4661 | ||
4662 | DEFUN (neighbor_timers, | |
4663 | neighbor_timers_cmd, | |
4664 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4665 | NEIGHBOR_STR | |
4666 | NEIGHBOR_ADDR_STR2 | |
4667 | "BGP per neighbor timers\n" | |
4668 | "Keepalive interval\n" | |
4669 | "Holdtime\n") | |
4670 | { | |
4671 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
4672 | } | |
4673 | ||
4674 | DEFUN (no_neighbor_timers, | |
4675 | no_neighbor_timers_cmd, | |
4676 | NO_NEIGHBOR_CMD2 "timers", | |
4677 | NO_STR | |
4678 | NEIGHBOR_STR | |
4679 | NEIGHBOR_ADDR_STR2 | |
4680 | "BGP per neighbor timers\n") | |
4681 | { | |
4682 | return peer_timers_unset_vty (vty, argv[0]); | |
4683 | } | |
6b0655a2 | 4684 | |
813d4307 DW |
4685 | ALIAS (no_neighbor_timers, |
4686 | no_neighbor_timers_val_cmd, | |
4687 | NO_NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4688 | NO_STR | |
4689 | NEIGHBOR_STR | |
4690 | NEIGHBOR_ADDR_STR2 | |
4691 | "BGP per neighbor timers\n" | |
4692 | "Keepalive interval\n" | |
4693 | "Holdtime\n") | |
4694 | ||
94f2b392 | 4695 | static int |
fd79ac91 | 4696 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
4697 | const char *time_str) | |
718e3744 | 4698 | { |
4699 | int ret; | |
4700 | struct peer *peer; | |
4701 | u_int32_t connect; | |
4702 | ||
966f821c | 4703 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4704 | if (! peer) |
4705 | return CMD_WARNING; | |
4706 | ||
4707 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
4708 | ||
4709 | ret = peer_timers_connect_set (peer, connect); | |
4710 | ||
966f821c | 4711 | return bgp_vty_return (vty, ret); |
718e3744 | 4712 | } |
4713 | ||
94f2b392 | 4714 | static int |
fd79ac91 | 4715 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4716 | { |
4717 | int ret; | |
4718 | struct peer *peer; | |
4719 | ||
4720 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4721 | if (! peer) | |
4722 | return CMD_WARNING; | |
4723 | ||
4724 | ret = peer_timers_connect_unset (peer); | |
4725 | ||
966f821c | 4726 | return bgp_vty_return (vty, ret); |
718e3744 | 4727 | } |
4728 | ||
4729 | DEFUN (neighbor_timers_connect, | |
4730 | neighbor_timers_connect_cmd, | |
8e0d0089 | 4731 | NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 4732 | NEIGHBOR_STR |
966f821c | 4733 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4734 | "BGP per neighbor timers\n" |
4735 | "BGP connect timer\n" | |
4736 | "Connect timer\n") | |
4737 | { | |
4738 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
4739 | } | |
4740 | ||
4741 | DEFUN (no_neighbor_timers_connect, | |
4742 | no_neighbor_timers_connect_cmd, | |
966f821c | 4743 | NO_NEIGHBOR_CMD2 "timers connect", |
718e3744 | 4744 | NO_STR |
4745 | NEIGHBOR_STR | |
966f821c | 4746 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4747 | "BGP per neighbor timers\n" |
4748 | "BGP connect timer\n") | |
4749 | { | |
4750 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
4751 | } | |
4752 | ||
4753 | ALIAS (no_neighbor_timers_connect, | |
4754 | no_neighbor_timers_connect_val_cmd, | |
8e0d0089 | 4755 | NO_NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 4756 | NO_STR |
4757 | NEIGHBOR_STR | |
966f821c | 4758 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4759 | "BGP per neighbor timers\n" |
4760 | "BGP connect timer\n" | |
4761 | "Connect timer\n") | |
6b0655a2 | 4762 | |
94f2b392 | 4763 | static int |
fd79ac91 | 4764 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
4765 | const char *time_str, int set) | |
718e3744 | 4766 | { |
4767 | int ret; | |
4768 | struct peer *peer; | |
4769 | u_int32_t routeadv = 0; | |
4770 | ||
966f821c | 4771 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4772 | if (! peer) |
4773 | return CMD_WARNING; | |
4774 | ||
4775 | if (time_str) | |
4776 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
4777 | ||
4778 | if (set) | |
4779 | ret = peer_advertise_interval_set (peer, routeadv); | |
4780 | else | |
4781 | ret = peer_advertise_interval_unset (peer); | |
4782 | ||
966f821c | 4783 | return bgp_vty_return (vty, ret); |
718e3744 | 4784 | } |
4785 | ||
4786 | DEFUN (neighbor_advertise_interval, | |
4787 | neighbor_advertise_interval_cmd, | |
966f821c | 4788 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4789 | NEIGHBOR_STR |
966f821c | 4790 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4791 | "Minimum interval between sending BGP routing updates\n" |
4792 | "time in seconds\n") | |
4793 | { | |
4794 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
4795 | } | |
4796 | ||
4797 | DEFUN (no_neighbor_advertise_interval, | |
4798 | no_neighbor_advertise_interval_cmd, | |
966f821c | 4799 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
718e3744 | 4800 | NO_STR |
4801 | NEIGHBOR_STR | |
966f821c | 4802 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4803 | "Minimum interval between sending BGP routing updates\n") |
4804 | { | |
4805 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
4806 | } | |
4807 | ||
4808 | ALIAS (no_neighbor_advertise_interval, | |
4809 | no_neighbor_advertise_interval_val_cmd, | |
966f821c | 4810 | NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4811 | NO_STR |
4812 | NEIGHBOR_STR | |
966f821c | 4813 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4814 | "Minimum interval between sending BGP routing updates\n" |
4815 | "time in seconds\n") | |
6b0655a2 | 4816 | |
518f0eb1 DS |
4817 | /* Time to wait before processing route-map updates */ |
4818 | DEFUN (bgp_set_route_map_delay_timer, | |
4819 | bgp_set_route_map_delay_timer_cmd, | |
4820 | "bgp route-map delay-timer <0-600>", | |
4821 | SET_STR | |
4822 | "BGP route-map delay timer\n" | |
4823 | "Time in secs to wait before processing route-map changes\n" | |
f414725f | 4824 | "0 disables the timer, no route updates happen when route-maps change\n") |
518f0eb1 DS |
4825 | { |
4826 | u_int32_t rmap_delay_timer; | |
4827 | struct bgp *bgp; | |
4828 | ||
4829 | bgp = vty->index; | |
4830 | if (argv[0]) | |
4831 | { | |
4832 | VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); | |
4833 | bgp->rmap_update_timer = rmap_delay_timer; | |
4834 | ||
4835 | /* if the dynamic update handling is being disabled, and a timer is | |
4836 | * running, stop the timer and act as if the timer has already fired. | |
4837 | */ | |
4838 | if (!rmap_delay_timer && bgp->t_rmap_update ) | |
4839 | { | |
4840 | BGP_TIMER_OFF(bgp->t_rmap_update); | |
87d4a781 | 4841 | thread_execute (bm->master, bgp_route_map_update_timer, &bgp, 0); |
518f0eb1 DS |
4842 | } |
4843 | return CMD_SUCCESS; | |
4844 | } | |
4845 | else | |
ffd0c037 | 4846 | return CMD_WARNING; |
518f0eb1 DS |
4847 | } |
4848 | ||
4849 | DEFUN (no_bgp_set_route_map_delay_timer, | |
4850 | no_bgp_set_route_map_delay_timer_cmd, | |
4851 | "no bgp route-map delay-timer", | |
4852 | NO_STR | |
4853 | "Default BGP route-map delay timer\n" | |
f414725f | 4854 | "Reset to default time to wait for processing route-map changes\n") |
518f0eb1 | 4855 | { |
518f0eb1 DS |
4856 | struct bgp *bgp; |
4857 | ||
4858 | bgp = vty->index; | |
4859 | bgp->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER; | |
4860 | ||
4861 | return CMD_SUCCESS; | |
4862 | } | |
4863 | ||
f414725f DS |
4864 | ALIAS (no_bgp_set_route_map_delay_timer, |
4865 | no_bgp_set_route_map_delay_timer_val_cmd, | |
4866 | "no bgp route-map delay-timer <0-600>", | |
4867 | NO_STR | |
4868 | "Default BGP route-map delay timer\n" | |
4869 | "Reset to default time to wait for processing route-map changes\n" | |
4870 | "0 disables the timer, no route updates happen when route-maps change\n") | |
4871 | ||
718e3744 | 4872 | /* neighbor interface */ |
94f2b392 | 4873 | static int |
fd79ac91 | 4874 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 4875 | { |
718e3744 | 4876 | struct peer *peer; |
4877 | ||
4878 | peer = peer_lookup_vty (vty, ip_str); | |
a80beece | 4879 | if (! peer || peer->conf_if) |
718e3744 | 4880 | return CMD_WARNING; |
4881 | ||
4882 | if (str) | |
ffd0c037 | 4883 | peer_interface_set (peer, str); |
718e3744 | 4884 | else |
ffd0c037 | 4885 | peer_interface_unset (peer); |
718e3744 | 4886 | |
4887 | return CMD_SUCCESS; | |
4888 | } | |
4889 | ||
4890 | DEFUN (neighbor_interface, | |
4891 | neighbor_interface_cmd, | |
4892 | NEIGHBOR_CMD "interface WORD", | |
4893 | NEIGHBOR_STR | |
4894 | NEIGHBOR_ADDR_STR | |
4895 | "Interface\n" | |
4896 | "Interface name\n") | |
4897 | { | |
8ffedcea DS |
4898 | if (argc == 3) |
4899 | return peer_interface_vty (vty, argv[0], argv[1]); | |
4900 | else | |
4901 | return peer_interface_vty (vty, argv[0], argv[1]); | |
718e3744 | 4902 | } |
4903 | ||
4904 | DEFUN (no_neighbor_interface, | |
4905 | no_neighbor_interface_cmd, | |
8ffedcea | 4906 | NO_NEIGHBOR_CMD2 "interface WORD", |
718e3744 | 4907 | NO_STR |
4908 | NEIGHBOR_STR | |
4909 | NEIGHBOR_ADDR_STR | |
4910 | "Interface\n" | |
4911 | "Interface name\n") | |
4912 | { | |
4913 | return peer_interface_vty (vty, argv[0], NULL); | |
4914 | } | |
6b0655a2 | 4915 | |
718e3744 | 4916 | /* Set distribute list to the peer. */ |
94f2b392 | 4917 | static int |
fd79ac91 | 4918 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
4919 | afi_t afi, safi_t safi, | |
4920 | const char *name_str, const char *direct_str) | |
718e3744 | 4921 | { |
4922 | int ret; | |
4923 | struct peer *peer; | |
4924 | int direct = FILTER_IN; | |
4925 | ||
4926 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4927 | if (! peer) | |
4928 | return CMD_WARNING; | |
4929 | ||
4930 | /* Check filter direction. */ | |
4931 | if (strncmp (direct_str, "i", 1) == 0) | |
4932 | direct = FILTER_IN; | |
4933 | else if (strncmp (direct_str, "o", 1) == 0) | |
4934 | direct = FILTER_OUT; | |
4935 | ||
4936 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
4937 | ||
4938 | return bgp_vty_return (vty, ret); | |
4939 | } | |
4940 | ||
94f2b392 | 4941 | static int |
fd79ac91 | 4942 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4943 | safi_t safi, const char *direct_str) | |
718e3744 | 4944 | { |
4945 | int ret; | |
4946 | struct peer *peer; | |
4947 | int direct = FILTER_IN; | |
4948 | ||
4949 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4950 | if (! peer) | |
4951 | return CMD_WARNING; | |
4952 | ||
4953 | /* Check filter direction. */ | |
4954 | if (strncmp (direct_str, "i", 1) == 0) | |
4955 | direct = FILTER_IN; | |
4956 | else if (strncmp (direct_str, "o", 1) == 0) | |
4957 | direct = FILTER_OUT; | |
4958 | ||
4959 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
4960 | ||
4961 | return bgp_vty_return (vty, ret); | |
4962 | } | |
4963 | ||
4964 | DEFUN (neighbor_distribute_list, | |
4965 | neighbor_distribute_list_cmd, | |
4966 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
4967 | NEIGHBOR_STR | |
4968 | NEIGHBOR_ADDR_STR2 | |
4969 | "Filter updates to/from this neighbor\n" | |
4970 | "IP access-list number\n" | |
4971 | "IP access-list number (expanded range)\n" | |
4972 | "IP Access-list name\n" | |
4973 | "Filter incoming updates\n" | |
4974 | "Filter outgoing updates\n") | |
4975 | { | |
4976 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4977 | bgp_node_safi (vty), argv[1], argv[2]); | |
4978 | } | |
4979 | ||
4980 | DEFUN (no_neighbor_distribute_list, | |
4981 | no_neighbor_distribute_list_cmd, | |
4982 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
4983 | NO_STR | |
4984 | NEIGHBOR_STR | |
4985 | NEIGHBOR_ADDR_STR2 | |
4986 | "Filter updates to/from this neighbor\n" | |
4987 | "IP access-list number\n" | |
4988 | "IP access-list number (expanded range)\n" | |
4989 | "IP Access-list name\n" | |
4990 | "Filter incoming updates\n" | |
4991 | "Filter outgoing updates\n") | |
4992 | { | |
4993 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4994 | bgp_node_safi (vty), argv[2]); | |
4995 | } | |
6b0655a2 | 4996 | |
718e3744 | 4997 | /* Set prefix list to the peer. */ |
94f2b392 | 4998 | static int |
fd79ac91 | 4999 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5000 | safi_t safi, const char *name_str, | |
5001 | const char *direct_str) | |
718e3744 | 5002 | { |
5003 | int ret; | |
5004 | struct peer *peer; | |
5005 | int direct = FILTER_IN; | |
5006 | ||
5007 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5008 | if (! peer) | |
5009 | return CMD_WARNING; | |
5010 | ||
5011 | /* Check filter direction. */ | |
5012 | if (strncmp (direct_str, "i", 1) == 0) | |
5013 | direct = FILTER_IN; | |
5014 | else if (strncmp (direct_str, "o", 1) == 0) | |
5015 | direct = FILTER_OUT; | |
5016 | ||
5017 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
5018 | ||
5019 | return bgp_vty_return (vty, ret); | |
5020 | } | |
5021 | ||
94f2b392 | 5022 | static int |
fd79ac91 | 5023 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5024 | safi_t safi, const char *direct_str) | |
718e3744 | 5025 | { |
5026 | int ret; | |
5027 | struct peer *peer; | |
5028 | int direct = FILTER_IN; | |
5029 | ||
5030 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5031 | if (! peer) | |
5032 | return CMD_WARNING; | |
5033 | ||
5034 | /* Check filter direction. */ | |
5035 | if (strncmp (direct_str, "i", 1) == 0) | |
5036 | direct = FILTER_IN; | |
5037 | else if (strncmp (direct_str, "o", 1) == 0) | |
5038 | direct = FILTER_OUT; | |
5039 | ||
5040 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
5041 | ||
5042 | return bgp_vty_return (vty, ret); | |
5043 | } | |
5044 | ||
5045 | DEFUN (neighbor_prefix_list, | |
5046 | neighbor_prefix_list_cmd, | |
5047 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5048 | NEIGHBOR_STR | |
5049 | NEIGHBOR_ADDR_STR2 | |
5050 | "Filter updates to/from this neighbor\n" | |
5051 | "Name of a prefix list\n" | |
5052 | "Filter incoming updates\n" | |
5053 | "Filter outgoing updates\n") | |
5054 | { | |
5055 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5056 | bgp_node_safi (vty), argv[1], argv[2]); | |
5057 | } | |
5058 | ||
5059 | DEFUN (no_neighbor_prefix_list, | |
5060 | no_neighbor_prefix_list_cmd, | |
5061 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5062 | NO_STR | |
5063 | NEIGHBOR_STR | |
5064 | NEIGHBOR_ADDR_STR2 | |
5065 | "Filter updates to/from this neighbor\n" | |
5066 | "Name of a prefix list\n" | |
5067 | "Filter incoming updates\n" | |
5068 | "Filter outgoing updates\n") | |
5069 | { | |
5070 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5071 | bgp_node_safi (vty), argv[2]); | |
5072 | } | |
6b0655a2 | 5073 | |
94f2b392 | 5074 | static int |
fd79ac91 | 5075 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
5076 | afi_t afi, safi_t safi, | |
5077 | const char *name_str, const char *direct_str) | |
718e3744 | 5078 | { |
5079 | int ret; | |
5080 | struct peer *peer; | |
5081 | int direct = FILTER_IN; | |
5082 | ||
5083 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5084 | if (! peer) | |
5085 | return CMD_WARNING; | |
5086 | ||
5087 | /* Check filter direction. */ | |
5088 | if (strncmp (direct_str, "i", 1) == 0) | |
5089 | direct = FILTER_IN; | |
5090 | else if (strncmp (direct_str, "o", 1) == 0) | |
5091 | direct = FILTER_OUT; | |
5092 | ||
5093 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
5094 | ||
5095 | return bgp_vty_return (vty, ret); | |
5096 | } | |
5097 | ||
94f2b392 | 5098 | static int |
fd79ac91 | 5099 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
5100 | afi_t afi, safi_t safi, | |
5101 | const char *direct_str) | |
718e3744 | 5102 | { |
5103 | int ret; | |
5104 | struct peer *peer; | |
5105 | int direct = FILTER_IN; | |
5106 | ||
5107 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5108 | if (! peer) | |
5109 | return CMD_WARNING; | |
5110 | ||
5111 | /* Check filter direction. */ | |
5112 | if (strncmp (direct_str, "i", 1) == 0) | |
5113 | direct = FILTER_IN; | |
5114 | else if (strncmp (direct_str, "o", 1) == 0) | |
5115 | direct = FILTER_OUT; | |
5116 | ||
5117 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
5118 | ||
5119 | return bgp_vty_return (vty, ret); | |
5120 | } | |
5121 | ||
5122 | DEFUN (neighbor_filter_list, | |
5123 | neighbor_filter_list_cmd, | |
5124 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5125 | NEIGHBOR_STR | |
5126 | NEIGHBOR_ADDR_STR2 | |
5127 | "Establish BGP filters\n" | |
5128 | "AS path access-list name\n" | |
5129 | "Filter incoming routes\n" | |
5130 | "Filter outgoing routes\n") | |
5131 | { | |
5132 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5133 | bgp_node_safi (vty), argv[1], argv[2]); | |
5134 | } | |
5135 | ||
5136 | DEFUN (no_neighbor_filter_list, | |
5137 | no_neighbor_filter_list_cmd, | |
5138 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5139 | NO_STR | |
5140 | NEIGHBOR_STR | |
5141 | NEIGHBOR_ADDR_STR2 | |
5142 | "Establish BGP filters\n" | |
5143 | "AS path access-list name\n" | |
5144 | "Filter incoming routes\n" | |
5145 | "Filter outgoing routes\n") | |
5146 | { | |
5147 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5148 | bgp_node_safi (vty), argv[2]); | |
5149 | } | |
6b0655a2 | 5150 | |
718e3744 | 5151 | /* Set route-map to the peer. */ |
94f2b392 | 5152 | static int |
fd79ac91 | 5153 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
5154 | afi_t afi, safi_t safi, | |
5155 | const char *name_str, const char *direct_str) | |
718e3744 | 5156 | { |
5157 | int ret; | |
5158 | struct peer *peer; | |
fee0f4c6 | 5159 | int direct = RMAP_IN; |
718e3744 | 5160 | |
5161 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5162 | if (! peer) | |
5163 | return CMD_WARNING; | |
5164 | ||
5165 | /* Check filter direction. */ | |
fee0f4c6 | 5166 | if (strncmp (direct_str, "in", 2) == 0) |
5167 | direct = RMAP_IN; | |
718e3744 | 5168 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5169 | direct = RMAP_OUT; |
718e3744 | 5170 | |
5171 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
5172 | ||
5173 | return bgp_vty_return (vty, ret); | |
5174 | } | |
5175 | ||
94f2b392 | 5176 | static int |
fd79ac91 | 5177 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5178 | safi_t safi, const char *direct_str) | |
718e3744 | 5179 | { |
5180 | int ret; | |
5181 | struct peer *peer; | |
fee0f4c6 | 5182 | int direct = RMAP_IN; |
718e3744 | 5183 | |
5184 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5185 | if (! peer) | |
5186 | return CMD_WARNING; | |
5187 | ||
5188 | /* Check filter direction. */ | |
fee0f4c6 | 5189 | if (strncmp (direct_str, "in", 2) == 0) |
5190 | direct = RMAP_IN; | |
718e3744 | 5191 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5192 | direct = RMAP_OUT; |
718e3744 | 5193 | |
5194 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
5195 | ||
5196 | return bgp_vty_return (vty, ret); | |
5197 | } | |
5198 | ||
5199 | DEFUN (neighbor_route_map, | |
5200 | neighbor_route_map_cmd, | |
2a3d5731 | 5201 | NEIGHBOR_CMD2 "route-map WORD (in|out)", |
718e3744 | 5202 | NEIGHBOR_STR |
5203 | NEIGHBOR_ADDR_STR2 | |
5204 | "Apply route map to neighbor\n" | |
5205 | "Name of route map\n" | |
5206 | "Apply map to incoming routes\n" | |
2a3d5731 | 5207 | "Apply map to outbound routes\n") |
718e3744 | 5208 | { |
5209 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5210 | bgp_node_safi (vty), argv[1], argv[2]); | |
5211 | } | |
5212 | ||
5213 | DEFUN (no_neighbor_route_map, | |
5214 | no_neighbor_route_map_cmd, | |
2a3d5731 | 5215 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out)", |
718e3744 | 5216 | NO_STR |
5217 | NEIGHBOR_STR | |
5218 | NEIGHBOR_ADDR_STR2 | |
5219 | "Apply route map to neighbor\n" | |
5220 | "Name of route map\n" | |
5221 | "Apply map to incoming routes\n" | |
2a3d5731 | 5222 | "Apply map to outbound routes\n") |
718e3744 | 5223 | { |
5224 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5225 | bgp_node_safi (vty), argv[2]); | |
5226 | } | |
6b0655a2 | 5227 | |
718e3744 | 5228 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 5229 | static int |
fd79ac91 | 5230 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5231 | safi_t safi, const char *name_str) | |
718e3744 | 5232 | { |
5233 | int ret; | |
5234 | struct peer *peer; | |
5235 | ||
5236 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5237 | if (! peer) | |
5238 | return CMD_WARNING; | |
5239 | ||
5240 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
5241 | ||
5242 | return bgp_vty_return (vty, ret); | |
5243 | } | |
5244 | ||
5245 | /* Unset route-map from the peer. */ | |
94f2b392 | 5246 | static int |
fd79ac91 | 5247 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5248 | safi_t safi) |
5249 | { | |
5250 | int ret; | |
5251 | struct peer *peer; | |
5252 | ||
5253 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5254 | if (! peer) | |
5255 | return CMD_WARNING; | |
5256 | ||
5257 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
5258 | ||
5259 | return bgp_vty_return (vty, ret); | |
5260 | } | |
5261 | ||
5262 | DEFUN (neighbor_unsuppress_map, | |
5263 | neighbor_unsuppress_map_cmd, | |
5264 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5265 | NEIGHBOR_STR | |
5266 | NEIGHBOR_ADDR_STR2 | |
5267 | "Route-map to selectively unsuppress suppressed routes\n" | |
5268 | "Name of route map\n") | |
5269 | { | |
5270 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5271 | bgp_node_safi (vty), argv[1]); | |
5272 | } | |
5273 | ||
5274 | DEFUN (no_neighbor_unsuppress_map, | |
5275 | no_neighbor_unsuppress_map_cmd, | |
5276 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5277 | NO_STR | |
5278 | NEIGHBOR_STR | |
5279 | NEIGHBOR_ADDR_STR2 | |
5280 | "Route-map to selectively unsuppress suppressed routes\n" | |
5281 | "Name of route map\n") | |
5282 | { | |
5283 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5284 | bgp_node_safi (vty)); | |
5285 | } | |
6b0655a2 | 5286 | |
94f2b392 | 5287 | static int |
fd79ac91 | 5288 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5289 | safi_t safi, const char *num_str, | |
0a486e5f | 5290 | const char *threshold_str, int warning, |
5291 | const char *restart_str) | |
718e3744 | 5292 | { |
5293 | int ret; | |
5294 | struct peer *peer; | |
5295 | u_int32_t max; | |
e0701b79 | 5296 | u_char threshold; |
0a486e5f | 5297 | u_int16_t restart; |
718e3744 | 5298 | |
5299 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5300 | if (! peer) | |
5301 | return CMD_WARNING; | |
5302 | ||
e6ec1c36 | 5303 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 5304 | if (threshold_str) |
5305 | threshold = atoi (threshold_str); | |
5306 | else | |
5307 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 5308 | |
0a486e5f | 5309 | if (restart_str) |
5310 | restart = atoi (restart_str); | |
5311 | else | |
5312 | restart = 0; | |
5313 | ||
5314 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 5315 | |
5316 | return bgp_vty_return (vty, ret); | |
5317 | } | |
5318 | ||
94f2b392 | 5319 | static int |
fd79ac91 | 5320 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5321 | safi_t safi) |
5322 | { | |
5323 | int ret; | |
5324 | struct peer *peer; | |
5325 | ||
5326 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5327 | if (! peer) | |
5328 | return CMD_WARNING; | |
5329 | ||
5330 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
5331 | ||
5332 | return bgp_vty_return (vty, ret); | |
5333 | } | |
5334 | ||
5335 | /* Maximum number of prefix configuration. prefix count is different | |
5336 | for each peer configuration. So this configuration can be set for | |
5337 | each peer configuration. */ | |
5338 | DEFUN (neighbor_maximum_prefix, | |
5339 | neighbor_maximum_prefix_cmd, | |
5340 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5341 | NEIGHBOR_STR | |
5342 | NEIGHBOR_ADDR_STR2 | |
5343 | "Maximum number of prefix accept from this peer\n" | |
5344 | "maximum no. of prefix limit\n") | |
5345 | { | |
5346 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5347 | bgp_node_safi (vty), argv[1], NULL, 0, |
5348 | NULL); | |
718e3744 | 5349 | } |
5350 | ||
e0701b79 | 5351 | DEFUN (neighbor_maximum_prefix_threshold, |
5352 | neighbor_maximum_prefix_threshold_cmd, | |
5353 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
5354 | NEIGHBOR_STR | |
5355 | NEIGHBOR_ADDR_STR2 | |
5356 | "Maximum number of prefix accept from this peer\n" | |
5357 | "maximum no. of prefix limit\n" | |
5358 | "Threshold value (%) at which to generate a warning msg\n") | |
5359 | { | |
5360 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5361 | bgp_node_safi (vty), argv[1], argv[2], 0, |
5362 | NULL); | |
5363 | } | |
e0701b79 | 5364 | |
718e3744 | 5365 | DEFUN (neighbor_maximum_prefix_warning, |
5366 | neighbor_maximum_prefix_warning_cmd, | |
5367 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5368 | NEIGHBOR_STR | |
5369 | NEIGHBOR_ADDR_STR2 | |
5370 | "Maximum number of prefix accept from this peer\n" | |
5371 | "maximum no. of prefix limit\n" | |
5372 | "Only give warning message when limit is exceeded\n") | |
5373 | { | |
5374 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5375 | bgp_node_safi (vty), argv[1], NULL, 1, |
5376 | NULL); | |
718e3744 | 5377 | } |
5378 | ||
e0701b79 | 5379 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
5380 | neighbor_maximum_prefix_threshold_warning_cmd, | |
5381 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
5382 | NEIGHBOR_STR | |
5383 | NEIGHBOR_ADDR_STR2 | |
5384 | "Maximum number of prefix accept from this peer\n" | |
5385 | "maximum no. of prefix limit\n" | |
5386 | "Threshold value (%) at which to generate a warning msg\n" | |
5387 | "Only give warning message when limit is exceeded\n") | |
5388 | { | |
5389 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5390 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
5391 | } | |
5392 | ||
5393 | DEFUN (neighbor_maximum_prefix_restart, | |
5394 | neighbor_maximum_prefix_restart_cmd, | |
5395 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
5396 | NEIGHBOR_STR | |
5397 | NEIGHBOR_ADDR_STR2 | |
5398 | "Maximum number of prefix accept from this peer\n" | |
5399 | "maximum no. of prefix limit\n" | |
5400 | "Restart bgp connection after limit is exceeded\n" | |
5401 | "Restart interval in minutes") | |
5402 | { | |
5403 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5404 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
5405 | } | |
5406 | ||
5407 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
5408 | neighbor_maximum_prefix_threshold_restart_cmd, | |
5409 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5410 | NEIGHBOR_STR | |
5411 | NEIGHBOR_ADDR_STR2 | |
5412 | "Maximum number of prefix accept from this peer\n" | |
5413 | "maximum no. of prefix limit\n" | |
5414 | "Threshold value (%) at which to generate a warning msg\n" | |
5415 | "Restart bgp connection after limit is exceeded\n" | |
5416 | "Restart interval in minutes") | |
5417 | { | |
5418 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5419 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
5420 | } | |
e0701b79 | 5421 | |
718e3744 | 5422 | DEFUN (no_neighbor_maximum_prefix, |
5423 | no_neighbor_maximum_prefix_cmd, | |
5424 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
5425 | NO_STR | |
5426 | NEIGHBOR_STR | |
5427 | NEIGHBOR_ADDR_STR2 | |
5428 | "Maximum number of prefix accept from this peer\n") | |
5429 | { | |
5430 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5431 | bgp_node_safi (vty)); | |
5432 | } | |
5433 | ||
5434 | ALIAS (no_neighbor_maximum_prefix, | |
5435 | no_neighbor_maximum_prefix_val_cmd, | |
5436 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5437 | NO_STR | |
5438 | NEIGHBOR_STR | |
5439 | NEIGHBOR_ADDR_STR2 | |
5440 | "Maximum number of prefix accept from this peer\n" | |
5441 | "maximum no. of prefix limit\n") | |
5442 | ||
5443 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5444 | no_neighbor_maximum_prefix_threshold_cmd, |
813d4307 | 5445 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", |
0a486e5f | 5446 | NO_STR |
5447 | NEIGHBOR_STR | |
5448 | NEIGHBOR_ADDR_STR2 | |
5449 | "Maximum number of prefix accept from this peer\n" | |
5450 | "maximum no. of prefix limit\n" | |
5451 | "Threshold value (%) at which to generate a warning msg\n") | |
5452 | ||
5453 | ALIAS (no_neighbor_maximum_prefix, | |
5454 | no_neighbor_maximum_prefix_warning_cmd, | |
5455 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5456 | NO_STR | |
5457 | NEIGHBOR_STR | |
5458 | NEIGHBOR_ADDR_STR2 | |
5459 | "Maximum number of prefix accept from this peer\n" | |
5460 | "maximum no. of prefix limit\n" | |
e8e1946e | 5461 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 5462 | |
5463 | ALIAS (no_neighbor_maximum_prefix, | |
5464 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 5465 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
5466 | NO_STR | |
5467 | NEIGHBOR_STR | |
5468 | NEIGHBOR_ADDR_STR2 | |
5469 | "Maximum number of prefix accept from this peer\n" | |
5470 | "maximum no. of prefix limit\n" | |
5471 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 5472 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 5473 | |
5474 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5475 | no_neighbor_maximum_prefix_restart_cmd, |
5476 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 5477 | NO_STR |
5478 | NEIGHBOR_STR | |
5479 | NEIGHBOR_ADDR_STR2 | |
5480 | "Maximum number of prefix accept from this peer\n" | |
5481 | "maximum no. of prefix limit\n" | |
0a486e5f | 5482 | "Restart bgp connection after limit is exceeded\n" |
5483 | "Restart interval in minutes") | |
5484 | ||
5485 | ALIAS (no_neighbor_maximum_prefix, | |
5486 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
5487 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5488 | NO_STR | |
5489 | NEIGHBOR_STR | |
5490 | NEIGHBOR_ADDR_STR2 | |
5491 | "Maximum number of prefix accept from this peer\n" | |
5492 | "maximum no. of prefix limit\n" | |
5493 | "Threshold value (%) at which to generate a warning msg\n" | |
5494 | "Restart bgp connection after limit is exceeded\n" | |
5495 | "Restart interval in minutes") | |
6b0655a2 | 5496 | |
718e3744 | 5497 | /* "neighbor allowas-in" */ |
5498 | DEFUN (neighbor_allowas_in, | |
5499 | neighbor_allowas_in_cmd, | |
5500 | NEIGHBOR_CMD2 "allowas-in", | |
5501 | NEIGHBOR_STR | |
5502 | NEIGHBOR_ADDR_STR2 | |
5503 | "Accept as-path with my AS present in it\n") | |
5504 | { | |
5505 | int ret; | |
5506 | struct peer *peer; | |
fd79ac91 | 5507 | unsigned int allow_num; |
718e3744 | 5508 | |
5509 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5510 | if (! peer) | |
5511 | return CMD_WARNING; | |
5512 | ||
5513 | if (argc == 1) | |
5514 | allow_num = 3; | |
5515 | else | |
5516 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
5517 | ||
5518 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
5519 | allow_num); | |
5520 | ||
5521 | return bgp_vty_return (vty, ret); | |
5522 | } | |
5523 | ||
5524 | ALIAS (neighbor_allowas_in, | |
5525 | neighbor_allowas_in_arg_cmd, | |
5526 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5527 | NEIGHBOR_STR | |
5528 | NEIGHBOR_ADDR_STR2 | |
5529 | "Accept as-path with my AS present in it\n" | |
5530 | "Number of occurances of AS number\n") | |
5531 | ||
5532 | DEFUN (no_neighbor_allowas_in, | |
5533 | no_neighbor_allowas_in_cmd, | |
5534 | NO_NEIGHBOR_CMD2 "allowas-in", | |
5535 | NO_STR | |
5536 | NEIGHBOR_STR | |
5537 | NEIGHBOR_ADDR_STR2 | |
5538 | "allow local ASN appears in aspath attribute\n") | |
5539 | { | |
5540 | int ret; | |
5541 | struct peer *peer; | |
5542 | ||
5543 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5544 | if (! peer) | |
5545 | return CMD_WARNING; | |
5546 | ||
5547 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
5548 | ||
5549 | return bgp_vty_return (vty, ret); | |
5550 | } | |
6b0655a2 | 5551 | |
813d4307 DW |
5552 | ALIAS (no_neighbor_allowas_in, |
5553 | no_neighbor_allowas_in_val_cmd, | |
5554 | NO_NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5555 | NO_STR | |
5556 | NEIGHBOR_STR | |
5557 | NEIGHBOR_ADDR_STR2 | |
5558 | "allow local ASN appears in aspath attribute\n" | |
5559 | "Number of occurances of AS number\n") | |
5560 | ||
fa411a21 NH |
5561 | DEFUN (neighbor_ttl_security, |
5562 | neighbor_ttl_security_cmd, | |
5563 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5564 | NEIGHBOR_STR | |
5565 | NEIGHBOR_ADDR_STR2 | |
5566 | "Specify the maximum number of hops to the BGP peer\n") | |
5567 | { | |
5568 | struct peer *peer; | |
89b6d1f8 | 5569 | int gtsm_hops; |
fa411a21 NH |
5570 | |
5571 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5572 | if (! peer) | |
5573 | return CMD_WARNING; | |
5574 | ||
5575 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); | |
5576 | ||
89b6d1f8 | 5577 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
5578 | } |
5579 | ||
5580 | DEFUN (no_neighbor_ttl_security, | |
5581 | no_neighbor_ttl_security_cmd, | |
5582 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5583 | NO_STR | |
5584 | NEIGHBOR_STR | |
5585 | NEIGHBOR_ADDR_STR2 | |
5586 | "Specify the maximum number of hops to the BGP peer\n") | |
5587 | { | |
5588 | struct peer *peer; | |
fa411a21 NH |
5589 | |
5590 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5591 | if (! peer) | |
5592 | return CMD_WARNING; | |
5593 | ||
89b6d1f8 | 5594 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 5595 | } |
6b0655a2 | 5596 | |
adbac85e DW |
5597 | DEFUN (neighbor_addpath_tx_all_paths, |
5598 | neighbor_addpath_tx_all_paths_cmd, | |
5599 | NEIGHBOR_CMD2 "addpath-tx-all-paths", | |
5600 | NEIGHBOR_STR | |
5601 | NEIGHBOR_ADDR_STR2 | |
5602 | "Use addpath to advertise all paths to a neighbor\n") | |
5603 | { | |
5604 | struct peer *peer; | |
5605 | ||
adbac85e DW |
5606 | peer = peer_and_group_lookup_vty (vty, argv[0]); |
5607 | if (! peer) | |
5608 | return CMD_WARNING; | |
5609 | ||
5610 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5611 | bgp_node_safi (vty), | |
5612 | PEER_FLAG_ADDPATH_TX_ALL_PATHS); | |
5613 | } | |
5614 | ||
5615 | DEFUN (no_neighbor_addpath_tx_all_paths, | |
5616 | no_neighbor_addpath_tx_all_paths_cmd, | |
5617 | NO_NEIGHBOR_CMD2 "addpath-tx-all-paths", | |
5618 | NO_STR | |
5619 | NEIGHBOR_STR | |
5620 | NEIGHBOR_ADDR_STR2 | |
5621 | "Use addpath to advertise all paths to a neighbor\n") | |
5622 | { | |
5623 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5624 | bgp_node_safi (vty), | |
5625 | PEER_FLAG_ADDPATH_TX_ALL_PATHS); | |
5626 | } | |
5627 | ||
06370dac DW |
5628 | DEFUN (neighbor_addpath_tx_bestpath_per_as, |
5629 | neighbor_addpath_tx_bestpath_per_as_cmd, | |
5630 | NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", | |
5631 | NEIGHBOR_STR | |
5632 | NEIGHBOR_ADDR_STR2 | |
5633 | "Use addpath to advertise the bestpath per each neighboring AS\n") | |
5634 | { | |
5635 | struct peer *peer; | |
5636 | ||
5637 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5638 | if (! peer) | |
5639 | return CMD_WARNING; | |
5640 | ||
5641 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5642 | bgp_node_safi (vty), | |
5643 | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); | |
5644 | } | |
5645 | ||
5646 | DEFUN (no_neighbor_addpath_tx_bestpath_per_as, | |
5647 | no_neighbor_addpath_tx_bestpath_per_as_cmd, | |
5648 | NO_NEIGHBOR_CMD2 "addpath-tx-bestpath-per-AS", | |
5649 | NO_STR | |
5650 | NEIGHBOR_STR | |
5651 | NEIGHBOR_ADDR_STR2 | |
5652 | "Use addpath to advertise the bestpath per each neighboring AS\n") | |
5653 | { | |
5654 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5655 | bgp_node_safi (vty), | |
5656 | PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS); | |
5657 | } | |
5658 | ||
5659 | ||
718e3744 | 5660 | /* Address family configuration. */ |
5661 | DEFUN (address_family_ipv4, | |
5662 | address_family_ipv4_cmd, | |
5663 | "address-family ipv4", | |
5664 | "Enter Address Family command mode\n" | |
5665 | "Address family\n") | |
5666 | { | |
5667 | vty->node = BGP_IPV4_NODE; | |
5668 | return CMD_SUCCESS; | |
5669 | } | |
5670 | ||
5671 | DEFUN (address_family_ipv4_safi, | |
5672 | address_family_ipv4_safi_cmd, | |
5673 | "address-family ipv4 (unicast|multicast)", | |
5674 | "Enter Address Family command mode\n" | |
5675 | "Address family\n" | |
5676 | "Address Family modifier\n" | |
5677 | "Address Family modifier\n") | |
5678 | { | |
5679 | if (strncmp (argv[0], "m", 1) == 0) | |
5680 | vty->node = BGP_IPV4M_NODE; | |
5681 | else | |
5682 | vty->node = BGP_IPV4_NODE; | |
5683 | ||
5684 | return CMD_SUCCESS; | |
5685 | } | |
5686 | ||
25ffbdc1 | 5687 | DEFUN (address_family_ipv6, |
5688 | address_family_ipv6_cmd, | |
5689 | "address-family ipv6", | |
718e3744 | 5690 | "Enter Address Family command mode\n" |
25ffbdc1 | 5691 | "Address family\n") |
718e3744 | 5692 | { |
5693 | vty->node = BGP_IPV6_NODE; | |
5694 | return CMD_SUCCESS; | |
5695 | } | |
5696 | ||
25ffbdc1 | 5697 | DEFUN (address_family_ipv6_safi, |
5698 | address_family_ipv6_safi_cmd, | |
5699 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 5700 | "Enter Address Family command mode\n" |
25ffbdc1 | 5701 | "Address family\n" |
5702 | "Address Family modifier\n" | |
5703 | "Address Family modifier\n") | |
5704 | { | |
5705 | if (strncmp (argv[0], "m", 1) == 0) | |
5706 | vty->node = BGP_IPV6M_NODE; | |
5707 | else | |
5708 | vty->node = BGP_IPV6_NODE; | |
5709 | ||
5710 | return CMD_SUCCESS; | |
5711 | } | |
718e3744 | 5712 | |
5713 | DEFUN (address_family_vpnv4, | |
5714 | address_family_vpnv4_cmd, | |
5715 | "address-family vpnv4", | |
5716 | "Enter Address Family command mode\n" | |
5717 | "Address family\n") | |
5718 | { | |
5719 | vty->node = BGP_VPNV4_NODE; | |
5720 | return CMD_SUCCESS; | |
5721 | } | |
5722 | ||
5723 | ALIAS (address_family_vpnv4, | |
5724 | address_family_vpnv4_unicast_cmd, | |
5725 | "address-family vpnv4 unicast", | |
5726 | "Enter Address Family command mode\n" | |
5727 | "Address family\n" | |
5728 | "Address Family Modifier\n") | |
5729 | ||
5730 | DEFUN (exit_address_family, | |
5731 | exit_address_family_cmd, | |
5732 | "exit-address-family", | |
5733 | "Exit from Address Family configuration mode\n") | |
5734 | { | |
a8a80d53 | 5735 | if (vty->node == BGP_IPV4_NODE |
5736 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 5737 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 5738 | || vty->node == BGP_IPV6_NODE |
5739 | || vty->node == BGP_IPV6M_NODE) | |
718e3744 | 5740 | vty->node = BGP_NODE; |
5741 | return CMD_SUCCESS; | |
5742 | } | |
6b0655a2 | 5743 | |
8ad7271d DS |
5744 | /* Recalculate bestpath and re-advertise a prefix */ |
5745 | static int | |
5746 | bgp_clear_prefix (struct vty *vty, char *view_name, const char *ip_str, | |
5747 | afi_t afi, safi_t safi, struct prefix_rd *prd) | |
5748 | { | |
5749 | int ret; | |
5750 | struct prefix match; | |
5751 | struct bgp_node *rn; | |
5752 | struct bgp_node *rm; | |
8ad7271d DS |
5753 | struct bgp *bgp; |
5754 | struct bgp_table *table; | |
5755 | struct bgp_table *rib; | |
5756 | ||
5757 | /* BGP structure lookup. */ | |
5758 | if (view_name) | |
5759 | { | |
5760 | bgp = bgp_lookup_by_name (view_name); | |
5761 | if (bgp == NULL) | |
5762 | { | |
5763 | vty_out (vty, "%% Can't find BGP view %s%s", view_name, VTY_NEWLINE); | |
5764 | return CMD_WARNING; | |
5765 | } | |
5766 | } | |
5767 | else | |
5768 | { | |
5769 | bgp = bgp_get_default (); | |
5770 | if (bgp == NULL) | |
5771 | { | |
5772 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
5773 | return CMD_WARNING; | |
5774 | } | |
5775 | } | |
5776 | ||
5777 | /* Check IP address argument. */ | |
5778 | ret = str2prefix (ip_str, &match); | |
5779 | if (! ret) | |
5780 | { | |
5781 | vty_out (vty, "%% address is malformed%s", VTY_NEWLINE); | |
5782 | return CMD_WARNING; | |
5783 | } | |
5784 | ||
5785 | match.family = afi2family (afi); | |
5786 | rib = bgp->rib[afi][safi]; | |
5787 | ||
5788 | if (safi == SAFI_MPLS_VPN) | |
5789 | { | |
5790 | for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn)) | |
5791 | { | |
5792 | if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) | |
5793 | continue; | |
5794 | ||
5795 | if ((table = rn->info) != NULL) | |
5796 | { | |
5797 | if ((rm = bgp_node_match (table, &match)) != NULL) | |
5798 | { | |
5799 | if (rm->p.prefixlen == match.prefixlen) | |
5800 | { | |
5801 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5802 | bgp_process (bgp, rm, afi, safi); | |
5803 | } | |
5804 | bgp_unlock_node (rm); | |
5805 | } | |
5806 | } | |
5807 | } | |
5808 | } | |
5809 | else | |
5810 | { | |
5811 | if ((rn = bgp_node_match (rib, &match)) != NULL) | |
5812 | { | |
5813 | if (rn->p.prefixlen == match.prefixlen) | |
5814 | { | |
5815 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5816 | bgp_process (bgp, rn, afi, safi); | |
5817 | } | |
5818 | bgp_unlock_node (rn); | |
5819 | } | |
5820 | } | |
5821 | ||
5822 | return CMD_SUCCESS; | |
5823 | } | |
5824 | ||
718e3744 | 5825 | DEFUN (clear_ip_bgp_all, |
5826 | clear_ip_bgp_all_cmd, | |
5827 | "clear ip bgp *", | |
5828 | CLEAR_STR | |
5829 | IP_STR | |
5830 | BGP_STR | |
5831 | "Clear all peers\n") | |
5832 | { | |
5833 | if (argc == 1) | |
5834 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5835 | ||
5836 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5837 | } | |
5838 | ||
5839 | ALIAS (clear_ip_bgp_all, | |
5840 | clear_bgp_all_cmd, | |
5841 | "clear bgp *", | |
5842 | CLEAR_STR | |
5843 | BGP_STR | |
5844 | "Clear all peers\n") | |
5845 | ||
5846 | ALIAS (clear_ip_bgp_all, | |
5847 | clear_bgp_ipv6_all_cmd, | |
5848 | "clear bgp ipv6 *", | |
5849 | CLEAR_STR | |
5850 | BGP_STR | |
5851 | "Address family\n" | |
5852 | "Clear all peers\n") | |
5853 | ||
5854 | ALIAS (clear_ip_bgp_all, | |
5855 | clear_ip_bgp_instance_all_cmd, | |
5856 | "clear ip bgp view WORD *", | |
5857 | CLEAR_STR | |
5858 | IP_STR | |
5859 | BGP_STR | |
5860 | "BGP view\n" | |
5861 | "view name\n" | |
5862 | "Clear all peers\n") | |
5863 | ||
5864 | ALIAS (clear_ip_bgp_all, | |
5865 | clear_bgp_instance_all_cmd, | |
5866 | "clear bgp view WORD *", | |
5867 | CLEAR_STR | |
5868 | BGP_STR | |
5869 | "BGP view\n" | |
5870 | "view name\n" | |
5871 | "Clear all peers\n") | |
5872 | ||
5873 | DEFUN (clear_ip_bgp_peer, | |
5874 | clear_ip_bgp_peer_cmd, | |
a80beece | 5875 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5876 | CLEAR_STR |
5877 | IP_STR | |
5878 | BGP_STR | |
5879 | "BGP neighbor IP address to clear\n" | |
a80beece DS |
5880 | "BGP IPv6 neighbor to clear\n" |
5881 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5882 | { |
5883 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5884 | } | |
5885 | ||
5886 | ALIAS (clear_ip_bgp_peer, | |
5887 | clear_bgp_peer_cmd, | |
a80beece | 5888 | "clear bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5889 | CLEAR_STR |
5890 | BGP_STR | |
5891 | "BGP neighbor address to clear\n" | |
a80beece DS |
5892 | "BGP IPv6 neighbor to clear\n" |
5893 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5894 | |
5895 | ALIAS (clear_ip_bgp_peer, | |
5896 | clear_bgp_ipv6_peer_cmd, | |
a80beece | 5897 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5898 | CLEAR_STR |
5899 | BGP_STR | |
5900 | "Address family\n" | |
5901 | "BGP neighbor address to clear\n" | |
a80beece DS |
5902 | "BGP IPv6 neighbor to clear\n" |
5903 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5904 | |
5905 | DEFUN (clear_ip_bgp_peer_group, | |
5906 | clear_ip_bgp_peer_group_cmd, | |
5907 | "clear ip bgp peer-group WORD", | |
5908 | CLEAR_STR | |
5909 | IP_STR | |
5910 | BGP_STR | |
5911 | "Clear all members of peer-group\n" | |
5912 | "BGP peer-group name\n") | |
5913 | { | |
5914 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5915 | } | |
5916 | ||
5917 | ALIAS (clear_ip_bgp_peer_group, | |
5918 | clear_bgp_peer_group_cmd, | |
5919 | "clear bgp peer-group WORD", | |
5920 | CLEAR_STR | |
5921 | BGP_STR | |
5922 | "Clear all members of peer-group\n" | |
5923 | "BGP peer-group name\n") | |
5924 | ||
5925 | ALIAS (clear_ip_bgp_peer_group, | |
5926 | clear_bgp_ipv6_peer_group_cmd, | |
5927 | "clear bgp ipv6 peer-group WORD", | |
5928 | CLEAR_STR | |
5929 | BGP_STR | |
5930 | "Address family\n" | |
5931 | "Clear all members of peer-group\n" | |
5932 | "BGP peer-group name\n") | |
5933 | ||
5934 | DEFUN (clear_ip_bgp_external, | |
5935 | clear_ip_bgp_external_cmd, | |
5936 | "clear ip bgp external", | |
5937 | CLEAR_STR | |
5938 | IP_STR | |
5939 | BGP_STR | |
5940 | "Clear all external peers\n") | |
5941 | { | |
5942 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
5943 | } | |
5944 | ||
5945 | ALIAS (clear_ip_bgp_external, | |
5946 | clear_bgp_external_cmd, | |
5947 | "clear bgp external", | |
5948 | CLEAR_STR | |
5949 | BGP_STR | |
5950 | "Clear all external peers\n") | |
5951 | ||
5952 | ALIAS (clear_ip_bgp_external, | |
5953 | clear_bgp_ipv6_external_cmd, | |
5954 | "clear bgp ipv6 external", | |
5955 | CLEAR_STR | |
5956 | BGP_STR | |
5957 | "Address family\n" | |
5958 | "Clear all external peers\n") | |
5959 | ||
8ad7271d DS |
5960 | DEFUN (clear_ip_bgp_prefix, |
5961 | clear_ip_bgp_prefix_cmd, | |
5962 | "clear ip bgp prefix A.B.C.D/M", | |
5963 | CLEAR_STR | |
5964 | IP_STR | |
5965 | BGP_STR | |
5966 | "Clear bestpath and re-advertise\n" | |
5967 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
5968 | { | |
5969 | return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL); | |
5970 | } | |
5971 | ||
5972 | ALIAS (clear_ip_bgp_prefix, | |
5973 | clear_bgp_prefix_cmd, | |
5974 | "clear bgp prefix A.B.C.D/M", | |
5975 | CLEAR_STR | |
5976 | BGP_STR | |
5977 | "Clear bestpath and re-advertise\n" | |
5978 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
5979 | ||
5980 | ||
718e3744 | 5981 | DEFUN (clear_ip_bgp_as, |
5982 | clear_ip_bgp_as_cmd, | |
320da874 | 5983 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 5984 | CLEAR_STR |
5985 | IP_STR | |
5986 | BGP_STR | |
5987 | "Clear peers with the AS number\n") | |
5988 | { | |
5989 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5990 | } | |
5991 | ||
5992 | ALIAS (clear_ip_bgp_as, | |
5993 | clear_bgp_as_cmd, | |
320da874 | 5994 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 5995 | CLEAR_STR |
5996 | BGP_STR | |
5997 | "Clear peers with the AS number\n") | |
5998 | ||
5999 | ALIAS (clear_ip_bgp_as, | |
6000 | clear_bgp_ipv6_as_cmd, | |
320da874 | 6001 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 6002 | CLEAR_STR |
6003 | BGP_STR | |
6004 | "Address family\n" | |
6005 | "Clear peers with the AS number\n") | |
6b0655a2 | 6006 | |
718e3744 | 6007 | /* Outbound soft-reconfiguration */ |
6008 | DEFUN (clear_ip_bgp_all_soft_out, | |
6009 | clear_ip_bgp_all_soft_out_cmd, | |
6010 | "clear ip bgp * soft out", | |
6011 | CLEAR_STR | |
6012 | IP_STR | |
6013 | BGP_STR | |
6014 | "Clear all peers\n" | |
e0bce756 DS |
6015 | BGP_SOFT_STR |
6016 | BGP_SOFT_OUT_STR) | |
718e3744 | 6017 | { |
6018 | if (argc == 1) | |
6019 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6020 | BGP_CLEAR_SOFT_OUT, NULL); | |
6021 | ||
6022 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6023 | BGP_CLEAR_SOFT_OUT, NULL); | |
6024 | } | |
6025 | ||
6026 | ALIAS (clear_ip_bgp_all_soft_out, | |
6027 | clear_ip_bgp_all_out_cmd, | |
6028 | "clear ip bgp * out", | |
6029 | CLEAR_STR | |
6030 | IP_STR | |
6031 | BGP_STR | |
6032 | "Clear all peers\n" | |
e0bce756 | 6033 | BGP_SOFT_OUT_STR) |
718e3744 | 6034 | |
6035 | ALIAS (clear_ip_bgp_all_soft_out, | |
6036 | clear_ip_bgp_instance_all_soft_out_cmd, | |
6037 | "clear ip bgp view WORD * soft out", | |
6038 | CLEAR_STR | |
6039 | IP_STR | |
6040 | BGP_STR | |
6041 | "BGP view\n" | |
6042 | "view name\n" | |
6043 | "Clear all peers\n" | |
e0bce756 DS |
6044 | BGP_SOFT_STR |
6045 | BGP_SOFT_OUT_STR) | |
718e3744 | 6046 | |
6047 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
6048 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
6049 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
6050 | CLEAR_STR | |
6051 | IP_STR | |
6052 | BGP_STR | |
6053 | "Clear all peers\n" | |
6054 | "Address family\n" | |
6055 | "Address Family modifier\n" | |
6056 | "Address Family modifier\n" | |
e0bce756 DS |
6057 | BGP_SOFT_STR |
6058 | BGP_SOFT_OUT_STR) | |
718e3744 | 6059 | { |
6060 | if (strncmp (argv[0], "m", 1) == 0) | |
6061 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6062 | BGP_CLEAR_SOFT_OUT, NULL); | |
6063 | ||
6064 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6065 | BGP_CLEAR_SOFT_OUT, NULL); | |
6066 | } | |
6067 | ||
6068 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, | |
6069 | clear_ip_bgp_all_ipv4_out_cmd, | |
6070 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
6071 | CLEAR_STR | |
6072 | IP_STR | |
6073 | BGP_STR | |
6074 | "Clear all peers\n" | |
6075 | "Address family\n" | |
6076 | "Address Family modifier\n" | |
6077 | "Address Family modifier\n" | |
e0bce756 | 6078 | BGP_SOFT_OUT_STR) |
718e3744 | 6079 | |
6080 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, | |
6081 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
6082 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", | |
6083 | CLEAR_STR | |
6084 | IP_STR | |
6085 | BGP_STR | |
6086 | "BGP view\n" | |
6087 | "view name\n" | |
6088 | "Clear all peers\n" | |
6089 | "Address family\n" | |
6090 | "Address Family modifier\n" | |
6091 | "Address Family modifier\n" | |
e0bce756 | 6092 | BGP_SOFT_OUT_STR) |
718e3744 | 6093 | { |
6094 | if (strncmp (argv[1], "m", 1) == 0) | |
6095 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6096 | BGP_CLEAR_SOFT_OUT, NULL); | |
6097 | ||
6098 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6099 | BGP_CLEAR_SOFT_OUT, NULL); | |
6100 | } | |
6101 | ||
6102 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
6103 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
6104 | "clear ip bgp * vpnv4 unicast soft out", | |
6105 | CLEAR_STR | |
6106 | IP_STR | |
6107 | BGP_STR | |
6108 | "Clear all peers\n" | |
6109 | "Address family\n" | |
6110 | "Address Family Modifier\n" | |
e0bce756 DS |
6111 | BGP_SOFT_STR |
6112 | BGP_SOFT_OUT_STR) | |
718e3744 | 6113 | { |
6114 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6115 | BGP_CLEAR_SOFT_OUT, NULL); | |
6116 | } | |
6117 | ||
6118 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
6119 | clear_ip_bgp_all_vpnv4_out_cmd, | |
6120 | "clear ip bgp * vpnv4 unicast out", | |
6121 | CLEAR_STR | |
6122 | IP_STR | |
6123 | BGP_STR | |
6124 | "Clear all peers\n" | |
6125 | "Address family\n" | |
6126 | "Address Family Modifier\n" | |
e0bce756 | 6127 | BGP_SOFT_OUT_STR) |
718e3744 | 6128 | |
6129 | DEFUN (clear_bgp_all_soft_out, | |
6130 | clear_bgp_all_soft_out_cmd, | |
6131 | "clear bgp * soft out", | |
6132 | CLEAR_STR | |
6133 | BGP_STR | |
6134 | "Clear all peers\n" | |
e0bce756 DS |
6135 | BGP_SOFT_STR |
6136 | BGP_SOFT_OUT_STR) | |
718e3744 | 6137 | { |
6138 | if (argc == 1) | |
6139 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6140 | BGP_CLEAR_SOFT_OUT, NULL); | |
6141 | ||
6142 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6143 | BGP_CLEAR_SOFT_OUT, NULL); | |
6144 | } | |
6145 | ||
6146 | ALIAS (clear_bgp_all_soft_out, | |
6147 | clear_bgp_instance_all_soft_out_cmd, | |
6148 | "clear bgp view WORD * soft out", | |
6149 | CLEAR_STR | |
6150 | BGP_STR | |
6151 | "BGP view\n" | |
6152 | "view name\n" | |
6153 | "Clear all peers\n" | |
e0bce756 DS |
6154 | BGP_SOFT_STR |
6155 | BGP_SOFT_OUT_STR) | |
718e3744 | 6156 | |
6157 | ALIAS (clear_bgp_all_soft_out, | |
6158 | clear_bgp_all_out_cmd, | |
6159 | "clear bgp * out", | |
6160 | CLEAR_STR | |
6161 | BGP_STR | |
6162 | "Clear all peers\n" | |
e0bce756 | 6163 | BGP_SOFT_OUT_STR) |
718e3744 | 6164 | |
6165 | ALIAS (clear_bgp_all_soft_out, | |
6166 | clear_bgp_ipv6_all_soft_out_cmd, | |
6167 | "clear bgp ipv6 * soft out", | |
6168 | CLEAR_STR | |
6169 | BGP_STR | |
6170 | "Address family\n" | |
6171 | "Clear all peers\n" | |
e0bce756 DS |
6172 | BGP_SOFT_STR |
6173 | BGP_SOFT_OUT_STR) | |
718e3744 | 6174 | |
6175 | ALIAS (clear_bgp_all_soft_out, | |
6176 | clear_bgp_ipv6_all_out_cmd, | |
6177 | "clear bgp ipv6 * out", | |
6178 | CLEAR_STR | |
6179 | BGP_STR | |
6180 | "Address family\n" | |
6181 | "Clear all peers\n" | |
e0bce756 | 6182 | BGP_SOFT_OUT_STR) |
718e3744 | 6183 | |
8ad7271d DS |
6184 | DEFUN (clear_bgp_ipv6_safi_prefix, |
6185 | clear_bgp_ipv6_safi_prefix_cmd, | |
6186 | "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6187 | CLEAR_STR | |
6188 | BGP_STR | |
6189 | "Address family\n" | |
6190 | "Address Family Modifier\n" | |
6191 | "Clear bestpath and re-advertise\n" | |
6192 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6193 | { | |
6194 | if (strncmp (argv[0], "m", 1) == 0) | |
6195 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL); | |
6196 | else | |
6197 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL); | |
6198 | } | |
6199 | ||
718e3744 | 6200 | DEFUN (clear_ip_bgp_peer_soft_out, |
6201 | clear_ip_bgp_peer_soft_out_cmd, | |
db64ea86 | 6202 | "clear ip bgp (A.B.C.D|WORD) soft out", |
718e3744 | 6203 | CLEAR_STR |
6204 | IP_STR | |
6205 | BGP_STR | |
6206 | "BGP neighbor address to clear\n" | |
db64ea86 | 6207 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6208 | BGP_SOFT_STR |
6209 | BGP_SOFT_OUT_STR) | |
718e3744 | 6210 | { |
6211 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6212 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6213 | } | |
6214 | ||
6215 | ALIAS (clear_ip_bgp_peer_soft_out, | |
6216 | clear_ip_bgp_peer_out_cmd, | |
db64ea86 | 6217 | "clear ip bgp (A.B.C.D|WORD) out", |
718e3744 | 6218 | CLEAR_STR |
6219 | IP_STR | |
6220 | BGP_STR | |
6221 | "BGP neighbor address to clear\n" | |
db64ea86 | 6222 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6223 | BGP_SOFT_OUT_STR) |
718e3744 | 6224 | |
6225 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, | |
6226 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
db64ea86 | 6227 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", |
718e3744 | 6228 | CLEAR_STR |
6229 | IP_STR | |
6230 | BGP_STR | |
6231 | "BGP neighbor address to clear\n" | |
db64ea86 | 6232 | "BGP neighbor on interface to clear\n" |
718e3744 | 6233 | "Address family\n" |
6234 | "Address Family modifier\n" | |
6235 | "Address Family modifier\n" | |
e0bce756 DS |
6236 | BGP_SOFT_STR |
6237 | BGP_SOFT_OUT_STR) | |
718e3744 | 6238 | { |
6239 | if (strncmp (argv[1], "m", 1) == 0) | |
6240 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6241 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6242 | ||
6243 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6244 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6245 | } | |
6246 | ||
6247 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, | |
6248 | clear_ip_bgp_peer_ipv4_out_cmd, | |
db64ea86 | 6249 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out", |
718e3744 | 6250 | CLEAR_STR |
6251 | IP_STR | |
6252 | BGP_STR | |
6253 | "BGP neighbor address to clear\n" | |
db64ea86 | 6254 | "BGP neighbor on interface to clear\n" |
718e3744 | 6255 | "Address family\n" |
6256 | "Address Family modifier\n" | |
6257 | "Address Family modifier\n" | |
e0bce756 | 6258 | BGP_SOFT_OUT_STR) |
718e3744 | 6259 | |
db64ea86 | 6260 | /* NOTE: WORD peers have not been tested for vpnv4 */ |
718e3744 | 6261 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
6262 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
db64ea86 | 6263 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out", |
718e3744 | 6264 | CLEAR_STR |
6265 | IP_STR | |
6266 | BGP_STR | |
6267 | "BGP neighbor address to clear\n" | |
db64ea86 | 6268 | "BGP neighbor on interface to clear\n" |
718e3744 | 6269 | "Address family\n" |
6270 | "Address Family Modifier\n" | |
e0bce756 DS |
6271 | BGP_SOFT_STR |
6272 | BGP_SOFT_OUT_STR) | |
718e3744 | 6273 | { |
6274 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6275 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6276 | } | |
6277 | ||
6278 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
6279 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
db64ea86 | 6280 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out", |
718e3744 | 6281 | CLEAR_STR |
6282 | IP_STR | |
6283 | BGP_STR | |
6284 | "BGP neighbor address to clear\n" | |
db64ea86 | 6285 | "BGP neighbor on interface to clear\n" |
718e3744 | 6286 | "Address family\n" |
6287 | "Address Family Modifier\n" | |
e0bce756 | 6288 | BGP_SOFT_OUT_STR) |
718e3744 | 6289 | |
6290 | DEFUN (clear_bgp_peer_soft_out, | |
6291 | clear_bgp_peer_soft_out_cmd, | |
a80beece | 6292 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6293 | CLEAR_STR |
6294 | BGP_STR | |
6295 | "BGP neighbor address to clear\n" | |
6296 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6297 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6298 | BGP_SOFT_STR |
6299 | BGP_SOFT_OUT_STR) | |
718e3744 | 6300 | { |
6301 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6302 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6303 | } | |
6304 | ||
6305 | ALIAS (clear_bgp_peer_soft_out, | |
6306 | clear_bgp_ipv6_peer_soft_out_cmd, | |
a80beece | 6307 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6308 | CLEAR_STR |
6309 | BGP_STR | |
6310 | "Address family\n" | |
6311 | "BGP neighbor address to clear\n" | |
6312 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6313 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6314 | BGP_SOFT_STR |
6315 | BGP_SOFT_OUT_STR) | |
718e3744 | 6316 | |
6317 | ALIAS (clear_bgp_peer_soft_out, | |
6318 | clear_bgp_peer_out_cmd, | |
a80beece | 6319 | "clear bgp (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 6320 | CLEAR_STR |
6321 | BGP_STR | |
6322 | "BGP neighbor address to clear\n" | |
6323 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6324 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6325 | BGP_SOFT_OUT_STR) |
718e3744 | 6326 | |
6327 | ALIAS (clear_bgp_peer_soft_out, | |
6328 | clear_bgp_ipv6_peer_out_cmd, | |
a80beece | 6329 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 6330 | CLEAR_STR |
6331 | BGP_STR | |
6332 | "Address family\n" | |
6333 | "BGP neighbor address to clear\n" | |
6334 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6335 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6336 | BGP_SOFT_OUT_STR) |
718e3744 | 6337 | |
6338 | DEFUN (clear_ip_bgp_peer_group_soft_out, | |
6339 | clear_ip_bgp_peer_group_soft_out_cmd, | |
6340 | "clear ip bgp peer-group WORD soft out", | |
6341 | CLEAR_STR | |
6342 | IP_STR | |
6343 | BGP_STR | |
6344 | "Clear all members of peer-group\n" | |
6345 | "BGP peer-group name\n" | |
e0bce756 DS |
6346 | BGP_SOFT_STR |
6347 | BGP_SOFT_OUT_STR) | |
718e3744 | 6348 | { |
6349 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6350 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6351 | } | |
6352 | ||
6353 | ALIAS (clear_ip_bgp_peer_group_soft_out, | |
6354 | clear_ip_bgp_peer_group_out_cmd, | |
6355 | "clear ip bgp peer-group WORD out", | |
6356 | CLEAR_STR | |
6357 | IP_STR | |
6358 | BGP_STR | |
6359 | "Clear all members of peer-group\n" | |
6360 | "BGP peer-group name\n" | |
e0bce756 | 6361 | BGP_SOFT_OUT_STR) |
718e3744 | 6362 | |
6363 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, | |
6364 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
6365 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
6366 | CLEAR_STR | |
6367 | IP_STR | |
6368 | BGP_STR | |
6369 | "Clear all members of peer-group\n" | |
6370 | "BGP peer-group name\n" | |
6371 | "Address family\n" | |
6372 | "Address Family modifier\n" | |
6373 | "Address Family modifier\n" | |
e0bce756 DS |
6374 | BGP_SOFT_STR |
6375 | BGP_SOFT_OUT_STR) | |
718e3744 | 6376 | { |
6377 | if (strncmp (argv[1], "m", 1) == 0) | |
6378 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6379 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6380 | ||
6381 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6382 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6383 | } | |
6384 | ||
6385 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, | |
6386 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
6387 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
6388 | CLEAR_STR | |
6389 | IP_STR | |
6390 | BGP_STR | |
6391 | "Clear all members of peer-group\n" | |
6392 | "BGP peer-group name\n" | |
6393 | "Address family\n" | |
6394 | "Address Family modifier\n" | |
6395 | "Address Family modifier\n" | |
e0bce756 | 6396 | BGP_SOFT_OUT_STR) |
718e3744 | 6397 | |
6398 | DEFUN (clear_bgp_peer_group_soft_out, | |
6399 | clear_bgp_peer_group_soft_out_cmd, | |
6400 | "clear bgp peer-group WORD soft out", | |
6401 | CLEAR_STR | |
6402 | BGP_STR | |
6403 | "Clear all members of peer-group\n" | |
6404 | "BGP peer-group name\n" | |
e0bce756 DS |
6405 | BGP_SOFT_STR |
6406 | BGP_SOFT_OUT_STR) | |
718e3744 | 6407 | { |
6408 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6409 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6410 | } | |
6411 | ||
6412 | ALIAS (clear_bgp_peer_group_soft_out, | |
6413 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
6414 | "clear bgp ipv6 peer-group WORD soft out", | |
6415 | CLEAR_STR | |
6416 | BGP_STR | |
6417 | "Address family\n" | |
6418 | "Clear all members of peer-group\n" | |
6419 | "BGP peer-group name\n" | |
e0bce756 DS |
6420 | BGP_SOFT_STR |
6421 | BGP_SOFT_OUT_STR) | |
718e3744 | 6422 | |
6423 | ALIAS (clear_bgp_peer_group_soft_out, | |
6424 | clear_bgp_peer_group_out_cmd, | |
6425 | "clear bgp peer-group WORD out", | |
6426 | CLEAR_STR | |
6427 | BGP_STR | |
6428 | "Clear all members of peer-group\n" | |
6429 | "BGP peer-group name\n" | |
e0bce756 | 6430 | BGP_SOFT_OUT_STR) |
718e3744 | 6431 | |
6432 | ALIAS (clear_bgp_peer_group_soft_out, | |
6433 | clear_bgp_ipv6_peer_group_out_cmd, | |
6434 | "clear bgp ipv6 peer-group WORD out", | |
6435 | CLEAR_STR | |
6436 | BGP_STR | |
6437 | "Address family\n" | |
6438 | "Clear all members of peer-group\n" | |
6439 | "BGP peer-group name\n" | |
e0bce756 | 6440 | BGP_SOFT_OUT_STR) |
718e3744 | 6441 | |
6442 | DEFUN (clear_ip_bgp_external_soft_out, | |
6443 | clear_ip_bgp_external_soft_out_cmd, | |
6444 | "clear ip bgp external soft out", | |
6445 | CLEAR_STR | |
6446 | IP_STR | |
6447 | BGP_STR | |
6448 | "Clear all external peers\n" | |
e0bce756 DS |
6449 | BGP_SOFT_STR |
6450 | BGP_SOFT_OUT_STR) | |
718e3744 | 6451 | { |
6452 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6453 | BGP_CLEAR_SOFT_OUT, NULL); | |
6454 | } | |
6455 | ||
6456 | ALIAS (clear_ip_bgp_external_soft_out, | |
6457 | clear_ip_bgp_external_out_cmd, | |
6458 | "clear ip bgp external out", | |
6459 | CLEAR_STR | |
6460 | IP_STR | |
6461 | BGP_STR | |
6462 | "Clear all external peers\n" | |
e0bce756 | 6463 | BGP_SOFT_OUT_STR) |
718e3744 | 6464 | |
6465 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
6466 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
6467 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
6468 | CLEAR_STR | |
6469 | IP_STR | |
6470 | BGP_STR | |
6471 | "Clear all external peers\n" | |
6472 | "Address family\n" | |
6473 | "Address Family modifier\n" | |
6474 | "Address Family modifier\n" | |
e0bce756 DS |
6475 | BGP_SOFT_STR |
6476 | BGP_SOFT_OUT_STR) | |
718e3744 | 6477 | { |
6478 | if (strncmp (argv[0], "m", 1) == 0) | |
6479 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6480 | BGP_CLEAR_SOFT_OUT, NULL); | |
6481 | ||
6482 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6483 | BGP_CLEAR_SOFT_OUT, NULL); | |
6484 | } | |
6485 | ||
6486 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, | |
6487 | clear_ip_bgp_external_ipv4_out_cmd, | |
6488 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
6489 | CLEAR_STR | |
6490 | IP_STR | |
6491 | BGP_STR | |
6492 | "Clear all external peers\n" | |
6493 | "Address family\n" | |
6494 | "Address Family modifier\n" | |
6495 | "Address Family modifier\n" | |
e0bce756 | 6496 | BGP_SOFT_OUT_STR) |
718e3744 | 6497 | |
6498 | DEFUN (clear_bgp_external_soft_out, | |
6499 | clear_bgp_external_soft_out_cmd, | |
6500 | "clear bgp external soft out", | |
6501 | CLEAR_STR | |
6502 | BGP_STR | |
6503 | "Clear all external peers\n" | |
e0bce756 DS |
6504 | BGP_SOFT_STR |
6505 | BGP_SOFT_OUT_STR) | |
718e3744 | 6506 | { |
6507 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6508 | BGP_CLEAR_SOFT_OUT, NULL); | |
6509 | } | |
6510 | ||
6511 | ALIAS (clear_bgp_external_soft_out, | |
6512 | clear_bgp_ipv6_external_soft_out_cmd, | |
6513 | "clear bgp ipv6 external soft out", | |
6514 | CLEAR_STR | |
6515 | BGP_STR | |
6516 | "Address family\n" | |
6517 | "Clear all external peers\n" | |
e0bce756 DS |
6518 | BGP_SOFT_STR |
6519 | BGP_SOFT_OUT_STR) | |
718e3744 | 6520 | |
6521 | ALIAS (clear_bgp_external_soft_out, | |
6522 | clear_bgp_external_out_cmd, | |
6523 | "clear bgp external out", | |
6524 | CLEAR_STR | |
6525 | BGP_STR | |
6526 | "Clear all external peers\n" | |
e0bce756 | 6527 | BGP_SOFT_OUT_STR) |
718e3744 | 6528 | |
6529 | ALIAS (clear_bgp_external_soft_out, | |
6530 | clear_bgp_ipv6_external_out_cmd, | |
6531 | "clear bgp ipv6 external WORD out", | |
6532 | CLEAR_STR | |
6533 | BGP_STR | |
6534 | "Address family\n" | |
6535 | "Clear all external peers\n" | |
e0bce756 | 6536 | BGP_SOFT_OUT_STR) |
718e3744 | 6537 | |
6538 | DEFUN (clear_ip_bgp_as_soft_out, | |
6539 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 6540 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 6541 | CLEAR_STR |
6542 | IP_STR | |
6543 | BGP_STR | |
6544 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6545 | BGP_SOFT_STR |
6546 | BGP_SOFT_OUT_STR) | |
718e3744 | 6547 | { |
6548 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6549 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6550 | } | |
6551 | ||
6552 | ALIAS (clear_ip_bgp_as_soft_out, | |
6553 | clear_ip_bgp_as_out_cmd, | |
320da874 | 6554 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 6555 | CLEAR_STR |
6556 | IP_STR | |
6557 | BGP_STR | |
6558 | "Clear peers with the AS number\n" | |
e0bce756 | 6559 | BGP_SOFT_OUT_STR) |
718e3744 | 6560 | |
6561 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, | |
6562 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 6563 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 6564 | CLEAR_STR |
6565 | IP_STR | |
6566 | BGP_STR | |
6567 | "Clear peers with the AS number\n" | |
6568 | "Address family\n" | |
6569 | "Address Family modifier\n" | |
6570 | "Address Family modifier\n" | |
e0bce756 DS |
6571 | BGP_SOFT_STR |
6572 | BGP_SOFT_OUT_STR) | |
718e3744 | 6573 | { |
6574 | if (strncmp (argv[1], "m", 1) == 0) | |
6575 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6576 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6577 | ||
6578 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6579 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6580 | } | |
6581 | ||
6582 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, | |
6583 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 6584 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 6585 | CLEAR_STR |
6586 | IP_STR | |
6587 | BGP_STR | |
6588 | "Clear peers with the AS number\n" | |
6589 | "Address family\n" | |
6590 | "Address Family modifier\n" | |
6591 | "Address Family modifier\n" | |
e0bce756 | 6592 | BGP_SOFT_OUT_STR) |
718e3744 | 6593 | |
6594 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, | |
6595 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 6596 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 6597 | CLEAR_STR |
6598 | IP_STR | |
6599 | BGP_STR | |
6600 | "Clear peers with the AS number\n" | |
6601 | "Address family\n" | |
6602 | "Address Family modifier\n" | |
e0bce756 DS |
6603 | BGP_SOFT_STR |
6604 | BGP_SOFT_OUT_STR) | |
718e3744 | 6605 | { |
6606 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
6607 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6608 | } | |
6609 | ||
6610 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
6611 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 6612 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 6613 | CLEAR_STR |
6614 | IP_STR | |
6615 | BGP_STR | |
6616 | "Clear peers with the AS number\n" | |
6617 | "Address family\n" | |
6618 | "Address Family modifier\n" | |
e0bce756 | 6619 | BGP_SOFT_OUT_STR) |
718e3744 | 6620 | |
6621 | DEFUN (clear_bgp_as_soft_out, | |
6622 | clear_bgp_as_soft_out_cmd, | |
320da874 | 6623 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 6624 | CLEAR_STR |
6625 | BGP_STR | |
6626 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6627 | BGP_SOFT_STR |
6628 | BGP_SOFT_OUT_STR) | |
718e3744 | 6629 | { |
6630 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6631 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6632 | } | |
6633 | ||
6634 | ALIAS (clear_bgp_as_soft_out, | |
6635 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 6636 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 6637 | CLEAR_STR |
6638 | BGP_STR | |
6639 | "Address family\n" | |
6640 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6641 | BGP_SOFT_STR |
6642 | BGP_SOFT_OUT_STR) | |
718e3744 | 6643 | |
6644 | ALIAS (clear_bgp_as_soft_out, | |
6645 | clear_bgp_as_out_cmd, | |
320da874 | 6646 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 6647 | CLEAR_STR |
6648 | BGP_STR | |
6649 | "Clear peers with the AS number\n" | |
e0bce756 | 6650 | BGP_SOFT_OUT_STR) |
718e3744 | 6651 | |
6652 | ALIAS (clear_bgp_as_soft_out, | |
6653 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 6654 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 6655 | CLEAR_STR |
6656 | BGP_STR | |
6657 | "Address family\n" | |
6658 | "Clear peers with the AS number\n" | |
e0bce756 | 6659 | BGP_SOFT_OUT_STR) |
6b0655a2 | 6660 | |
718e3744 | 6661 | /* Inbound soft-reconfiguration */ |
6662 | DEFUN (clear_ip_bgp_all_soft_in, | |
6663 | clear_ip_bgp_all_soft_in_cmd, | |
6664 | "clear ip bgp * soft in", | |
6665 | CLEAR_STR | |
6666 | IP_STR | |
6667 | BGP_STR | |
6668 | "Clear all peers\n" | |
e0bce756 DS |
6669 | BGP_SOFT_STR |
6670 | BGP_SOFT_IN_STR) | |
718e3744 | 6671 | { |
6672 | if (argc == 1) | |
6673 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6674 | BGP_CLEAR_SOFT_IN, NULL); | |
6675 | ||
6676 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6677 | BGP_CLEAR_SOFT_IN, NULL); | |
6678 | } | |
6679 | ||
6680 | ALIAS (clear_ip_bgp_all_soft_in, | |
6681 | clear_ip_bgp_instance_all_soft_in_cmd, | |
6682 | "clear ip bgp view WORD * soft in", | |
6683 | CLEAR_STR | |
6684 | IP_STR | |
6685 | BGP_STR | |
6686 | "BGP view\n" | |
6687 | "view name\n" | |
6688 | "Clear all peers\n" | |
e0bce756 DS |
6689 | BGP_SOFT_STR |
6690 | BGP_SOFT_IN_STR) | |
718e3744 | 6691 | |
6692 | ALIAS (clear_ip_bgp_all_soft_in, | |
6693 | clear_ip_bgp_all_in_cmd, | |
6694 | "clear ip bgp * in", | |
6695 | CLEAR_STR | |
6696 | IP_STR | |
6697 | BGP_STR | |
6698 | "Clear all peers\n" | |
e0bce756 | 6699 | BGP_SOFT_IN_STR) |
718e3744 | 6700 | |
6701 | DEFUN (clear_ip_bgp_all_in_prefix_filter, | |
6702 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
6703 | "clear ip bgp * in prefix-filter", | |
6704 | CLEAR_STR | |
6705 | IP_STR | |
6706 | BGP_STR | |
6707 | "Clear all peers\n" | |
e0bce756 | 6708 | BGP_SOFT_IN_STR |
718e3744 | 6709 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6710 | { | |
6711 | if (argc== 1) | |
6712 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6713 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6714 | ||
6715 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6716 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6717 | } | |
6718 | ||
6719 | ALIAS (clear_ip_bgp_all_in_prefix_filter, | |
6720 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, | |
6721 | "clear ip bgp view WORD * in prefix-filter", | |
6722 | CLEAR_STR | |
6723 | IP_STR | |
6724 | BGP_STR | |
6725 | "BGP view\n" | |
6726 | "view name\n" | |
6727 | "Clear all peers\n" | |
e0bce756 | 6728 | BGP_SOFT_IN_STR |
718e3744 | 6729 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6730 | ||
6731 | ||
6732 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, | |
6733 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
6734 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
6735 | CLEAR_STR | |
6736 | IP_STR | |
6737 | BGP_STR | |
6738 | "Clear all peers\n" | |
6739 | "Address family\n" | |
6740 | "Address Family modifier\n" | |
6741 | "Address Family modifier\n" | |
e0bce756 DS |
6742 | BGP_SOFT_STR |
6743 | BGP_SOFT_IN_STR) | |
718e3744 | 6744 | { |
6745 | if (strncmp (argv[0], "m", 1) == 0) | |
6746 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6747 | BGP_CLEAR_SOFT_IN, NULL); | |
6748 | ||
6749 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6750 | BGP_CLEAR_SOFT_IN, NULL); | |
6751 | } | |
6752 | ||
6753 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, | |
6754 | clear_ip_bgp_all_ipv4_in_cmd, | |
6755 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
6756 | CLEAR_STR | |
6757 | IP_STR | |
6758 | BGP_STR | |
6759 | "Clear all peers\n" | |
6760 | "Address family\n" | |
6761 | "Address Family modifier\n" | |
6762 | "Address Family modifier\n" | |
e0bce756 | 6763 | BGP_SOFT_IN_STR) |
718e3744 | 6764 | |
6765 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, | |
6766 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
6767 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", | |
6768 | CLEAR_STR | |
6769 | IP_STR | |
6770 | BGP_STR | |
6771 | "BGP view\n" | |
6772 | "view name\n" | |
6773 | "Clear all peers\n" | |
6774 | "Address family\n" | |
6775 | "Address Family modifier\n" | |
6776 | "Address Family modifier\n" | |
e0bce756 DS |
6777 | BGP_SOFT_STR |
6778 | BGP_SOFT_IN_STR) | |
718e3744 | 6779 | { |
6780 | if (strncmp (argv[1], "m", 1) == 0) | |
6781 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6782 | BGP_CLEAR_SOFT_IN, NULL); | |
6783 | ||
6784 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6785 | BGP_CLEAR_SOFT_IN, NULL); | |
6786 | } | |
6787 | ||
6788 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, | |
6789 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
6790 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
6791 | CLEAR_STR | |
6792 | IP_STR | |
6793 | BGP_STR | |
6794 | "Clear all peers\n" | |
6795 | "Address family\n" | |
6796 | "Address Family modifier\n" | |
6797 | "Address Family modifier\n" | |
e0bce756 | 6798 | BGP_SOFT_IN_STR |
718e3744 | 6799 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6800 | { | |
6801 | if (strncmp (argv[0], "m", 1) == 0) | |
6802 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6803 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6804 | ||
6805 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6806 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6807 | } | |
6808 | ||
6809 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, | |
6810 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, | |
6811 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", | |
6812 | CLEAR_STR | |
6813 | IP_STR | |
6814 | BGP_STR | |
6815 | "Clear all peers\n" | |
6816 | "Address family\n" | |
6817 | "Address Family modifier\n" | |
6818 | "Address Family modifier\n" | |
e0bce756 | 6819 | BGP_SOFT_IN_STR |
718e3744 | 6820 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6821 | { | |
6822 | if (strncmp (argv[1], "m", 1) == 0) | |
6823 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6824 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6825 | ||
6826 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6827 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6828 | } | |
6829 | ||
6830 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
6831 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
6832 | "clear ip bgp * vpnv4 unicast soft in", | |
6833 | CLEAR_STR | |
6834 | IP_STR | |
6835 | BGP_STR | |
6836 | "Clear all peers\n" | |
6837 | "Address family\n" | |
6838 | "Address Family Modifier\n" | |
e0bce756 DS |
6839 | BGP_SOFT_STR |
6840 | BGP_SOFT_IN_STR) | |
718e3744 | 6841 | { |
6842 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6843 | BGP_CLEAR_SOFT_IN, NULL); | |
6844 | } | |
6845 | ||
6846 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
6847 | clear_ip_bgp_all_vpnv4_in_cmd, | |
6848 | "clear ip bgp * vpnv4 unicast in", | |
6849 | CLEAR_STR | |
6850 | IP_STR | |
6851 | BGP_STR | |
6852 | "Clear all peers\n" | |
6853 | "Address family\n" | |
6854 | "Address Family Modifier\n" | |
e0bce756 | 6855 | BGP_SOFT_IN_STR) |
718e3744 | 6856 | |
6857 | DEFUN (clear_bgp_all_soft_in, | |
6858 | clear_bgp_all_soft_in_cmd, | |
6859 | "clear bgp * soft in", | |
6860 | CLEAR_STR | |
6861 | BGP_STR | |
6862 | "Clear all peers\n" | |
e0bce756 DS |
6863 | BGP_SOFT_STR |
6864 | BGP_SOFT_IN_STR) | |
718e3744 | 6865 | { |
6866 | if (argc == 1) | |
6867 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6868 | BGP_CLEAR_SOFT_IN, NULL); | |
6869 | ||
6870 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6871 | BGP_CLEAR_SOFT_IN, NULL); | |
6872 | } | |
6873 | ||
6874 | ALIAS (clear_bgp_all_soft_in, | |
6875 | clear_bgp_instance_all_soft_in_cmd, | |
6876 | "clear bgp view WORD * soft in", | |
6877 | CLEAR_STR | |
6878 | BGP_STR | |
6879 | "BGP view\n" | |
6880 | "view name\n" | |
6881 | "Clear all peers\n" | |
e0bce756 DS |
6882 | BGP_SOFT_STR |
6883 | BGP_SOFT_IN_STR) | |
718e3744 | 6884 | |
6885 | ALIAS (clear_bgp_all_soft_in, | |
6886 | clear_bgp_ipv6_all_soft_in_cmd, | |
6887 | "clear bgp ipv6 * soft in", | |
6888 | CLEAR_STR | |
6889 | BGP_STR | |
6890 | "Address family\n" | |
6891 | "Clear all peers\n" | |
e0bce756 DS |
6892 | BGP_SOFT_STR |
6893 | BGP_SOFT_IN_STR) | |
718e3744 | 6894 | |
6895 | ALIAS (clear_bgp_all_soft_in, | |
6896 | clear_bgp_all_in_cmd, | |
6897 | "clear bgp * in", | |
6898 | CLEAR_STR | |
6899 | BGP_STR | |
6900 | "Clear all peers\n" | |
e0bce756 | 6901 | BGP_SOFT_IN_STR) |
718e3744 | 6902 | |
6903 | ALIAS (clear_bgp_all_soft_in, | |
6904 | clear_bgp_ipv6_all_in_cmd, | |
6905 | "clear bgp ipv6 * in", | |
6906 | CLEAR_STR | |
6907 | BGP_STR | |
6908 | "Address family\n" | |
6909 | "Clear all peers\n" | |
e0bce756 | 6910 | BGP_SOFT_IN_STR) |
718e3744 | 6911 | |
6912 | DEFUN (clear_bgp_all_in_prefix_filter, | |
6913 | clear_bgp_all_in_prefix_filter_cmd, | |
6914 | "clear bgp * in prefix-filter", | |
6915 | CLEAR_STR | |
6916 | BGP_STR | |
6917 | "Clear all peers\n" | |
e0bce756 | 6918 | BGP_SOFT_IN_STR |
718e3744 | 6919 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6920 | { | |
6921 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6922 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6923 | } | |
6924 | ||
6925 | ALIAS (clear_bgp_all_in_prefix_filter, | |
6926 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
6927 | "clear bgp ipv6 * in prefix-filter", | |
6928 | CLEAR_STR | |
6929 | BGP_STR | |
6930 | "Address family\n" | |
6931 | "Clear all peers\n" | |
e0bce756 | 6932 | BGP_SOFT_IN_STR |
718e3744 | 6933 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6934 | ||
6935 | DEFUN (clear_ip_bgp_peer_soft_in, | |
6936 | clear_ip_bgp_peer_soft_in_cmd, | |
db64ea86 | 6937 | "clear ip bgp (A.B.C.D|WORD) soft in", |
718e3744 | 6938 | CLEAR_STR |
6939 | IP_STR | |
6940 | BGP_STR | |
6941 | "BGP neighbor address to clear\n" | |
db64ea86 | 6942 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6943 | BGP_SOFT_STR |
6944 | BGP_SOFT_IN_STR) | |
718e3744 | 6945 | { |
6946 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6947 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6948 | } | |
6949 | ||
6950 | ALIAS (clear_ip_bgp_peer_soft_in, | |
6951 | clear_ip_bgp_peer_in_cmd, | |
db64ea86 | 6952 | "clear ip bgp (A.B.C.D|WORD) in", |
718e3744 | 6953 | CLEAR_STR |
6954 | IP_STR | |
6955 | BGP_STR | |
6956 | "BGP neighbor address to clear\n" | |
db64ea86 | 6957 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6958 | BGP_SOFT_IN_STR) |
718e3744 | 6959 | |
6960 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, | |
6961 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
db64ea86 | 6962 | "clear ip bgp (A.B.C.D|WORD) in prefix-filter", |
718e3744 | 6963 | CLEAR_STR |
6964 | IP_STR | |
6965 | BGP_STR | |
6966 | "BGP neighbor address to clear\n" | |
db64ea86 | 6967 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6968 | BGP_SOFT_IN_STR |
718e3744 | 6969 | "Push out the existing ORF prefix-list\n") |
6970 | { | |
6971 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6972 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6973 | } | |
6974 | ||
6975 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
6976 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
db64ea86 | 6977 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", |
718e3744 | 6978 | CLEAR_STR |
6979 | IP_STR | |
6980 | BGP_STR | |
6981 | "BGP neighbor address to clear\n" | |
db64ea86 | 6982 | "BGP neighbor on interface to clear\n" |
718e3744 | 6983 | "Address family\n" |
6984 | "Address Family modifier\n" | |
6985 | "Address Family modifier\n" | |
e0bce756 DS |
6986 | BGP_SOFT_STR |
6987 | BGP_SOFT_IN_STR) | |
718e3744 | 6988 | { |
6989 | if (strncmp (argv[1], "m", 1) == 0) | |
6990 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6991 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6992 | ||
6993 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6994 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6995 | } | |
6996 | ||
6997 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, | |
6998 | clear_ip_bgp_peer_ipv4_in_cmd, | |
db64ea86 | 6999 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in", |
718e3744 | 7000 | CLEAR_STR |
7001 | IP_STR | |
7002 | BGP_STR | |
7003 | "BGP neighbor address to clear\n" | |
db64ea86 | 7004 | "BGP neighbor on interface to clear\n" |
718e3744 | 7005 | "Address family\n" |
7006 | "Address Family modifier\n" | |
7007 | "Address Family modifier\n" | |
e0bce756 | 7008 | BGP_SOFT_IN_STR) |
718e3744 | 7009 | |
7010 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, | |
7011 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
db64ea86 | 7012 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 7013 | CLEAR_STR |
7014 | IP_STR | |
7015 | BGP_STR | |
7016 | "BGP neighbor address to clear\n" | |
db64ea86 | 7017 | "BGP neighbor on interface to clear\n" |
718e3744 | 7018 | "Address family\n" |
7019 | "Address Family modifier\n" | |
7020 | "Address Family modifier\n" | |
e0bce756 | 7021 | BGP_SOFT_IN_STR |
718e3744 | 7022 | "Push out the existing ORF prefix-list\n") |
7023 | { | |
7024 | if (strncmp (argv[1], "m", 1) == 0) | |
7025 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
7026 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7027 | ||
7028 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7029 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7030 | } | |
7031 | ||
7032 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
7033 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
db64ea86 | 7034 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in", |
718e3744 | 7035 | CLEAR_STR |
7036 | IP_STR | |
7037 | BGP_STR | |
7038 | "BGP neighbor address to clear\n" | |
db64ea86 | 7039 | "BGP neighbor on interface to clear\n" |
718e3744 | 7040 | "Address family\n" |
7041 | "Address Family Modifier\n" | |
e0bce756 DS |
7042 | BGP_SOFT_STR |
7043 | BGP_SOFT_IN_STR) | |
718e3744 | 7044 | { |
7045 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
7046 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7047 | } | |
7048 | ||
7049 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
7050 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
db64ea86 | 7051 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in", |
718e3744 | 7052 | CLEAR_STR |
7053 | IP_STR | |
7054 | BGP_STR | |
7055 | "BGP neighbor address to clear\n" | |
db64ea86 | 7056 | "BGP neighbor on interface to clear\n" |
718e3744 | 7057 | "Address family\n" |
7058 | "Address Family Modifier\n" | |
e0bce756 | 7059 | BGP_SOFT_IN_STR) |
718e3744 | 7060 | |
7061 | DEFUN (clear_bgp_peer_soft_in, | |
7062 | clear_bgp_peer_soft_in_cmd, | |
a80beece | 7063 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 7064 | CLEAR_STR |
7065 | BGP_STR | |
7066 | "BGP neighbor address to clear\n" | |
7067 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7068 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
7069 | BGP_SOFT_STR |
7070 | BGP_SOFT_IN_STR) | |
718e3744 | 7071 | { |
7072 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7073 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7074 | } | |
7075 | ||
7076 | ALIAS (clear_bgp_peer_soft_in, | |
7077 | clear_bgp_ipv6_peer_soft_in_cmd, | |
a80beece | 7078 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 7079 | CLEAR_STR |
7080 | BGP_STR | |
7081 | "Address family\n" | |
7082 | "BGP neighbor address to clear\n" | |
7083 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7084 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
7085 | BGP_SOFT_STR |
7086 | BGP_SOFT_IN_STR) | |
718e3744 | 7087 | |
7088 | ALIAS (clear_bgp_peer_soft_in, | |
7089 | clear_bgp_peer_in_cmd, | |
a80beece | 7090 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 7091 | CLEAR_STR |
7092 | BGP_STR | |
7093 | "BGP neighbor address to clear\n" | |
7094 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7095 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7096 | BGP_SOFT_IN_STR) |
718e3744 | 7097 | |
7098 | ALIAS (clear_bgp_peer_soft_in, | |
7099 | clear_bgp_ipv6_peer_in_cmd, | |
a80beece | 7100 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 7101 | CLEAR_STR |
7102 | BGP_STR | |
7103 | "Address family\n" | |
7104 | "BGP neighbor address to clear\n" | |
7105 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7106 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7107 | BGP_SOFT_IN_STR) |
718e3744 | 7108 | |
7109 | DEFUN (clear_bgp_peer_in_prefix_filter, | |
7110 | clear_bgp_peer_in_prefix_filter_cmd, | |
a80beece | 7111 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 7112 | CLEAR_STR |
7113 | BGP_STR | |
7114 | "BGP neighbor address to clear\n" | |
7115 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7116 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7117 | BGP_SOFT_IN_STR |
718e3744 | 7118 | "Push out the existing ORF prefix-list\n") |
7119 | { | |
7120 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7121 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7122 | } | |
7123 | ||
7124 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
7125 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
a80beece | 7126 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 7127 | CLEAR_STR |
7128 | BGP_STR | |
7129 | "Address family\n" | |
7130 | "BGP neighbor address to clear\n" | |
7131 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7132 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7133 | BGP_SOFT_IN_STR |
718e3744 | 7134 | "Push out the existing ORF prefix-list\n") |
7135 | ||
7136 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
7137 | clear_ip_bgp_peer_group_soft_in_cmd, | |
7138 | "clear ip bgp peer-group WORD soft in", | |
7139 | CLEAR_STR | |
7140 | IP_STR | |
7141 | BGP_STR | |
7142 | "Clear all members of peer-group\n" | |
7143 | "BGP peer-group name\n" | |
e0bce756 DS |
7144 | BGP_SOFT_STR |
7145 | BGP_SOFT_IN_STR) | |
718e3744 | 7146 | { |
7147 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7148 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7149 | } | |
7150 | ||
7151 | ALIAS (clear_ip_bgp_peer_group_soft_in, | |
7152 | clear_ip_bgp_peer_group_in_cmd, | |
7153 | "clear ip bgp peer-group WORD in", | |
7154 | CLEAR_STR | |
7155 | IP_STR | |
7156 | BGP_STR | |
7157 | "Clear all members of peer-group\n" | |
7158 | "BGP peer-group name\n" | |
e0bce756 | 7159 | BGP_SOFT_IN_STR) |
718e3744 | 7160 | |
7161 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, | |
7162 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
7163 | "clear ip bgp peer-group WORD in prefix-filter", | |
7164 | CLEAR_STR | |
7165 | IP_STR | |
7166 | BGP_STR | |
7167 | "Clear all members of peer-group\n" | |
7168 | "BGP peer-group name\n" | |
e0bce756 | 7169 | BGP_SOFT_IN_STR |
718e3744 | 7170 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7171 | { | |
7172 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7173 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7174 | } | |
7175 | ||
7176 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
7177 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
7178 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
7179 | CLEAR_STR | |
7180 | IP_STR | |
7181 | BGP_STR | |
7182 | "Clear all members of peer-group\n" | |
7183 | "BGP peer-group name\n" | |
7184 | "Address family\n" | |
7185 | "Address Family modifier\n" | |
7186 | "Address Family modifier\n" | |
e0bce756 DS |
7187 | BGP_SOFT_STR |
7188 | BGP_SOFT_IN_STR) | |
718e3744 | 7189 | { |
7190 | if (strncmp (argv[1], "m", 1) == 0) | |
7191 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7192 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7193 | ||
7194 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7195 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7196 | } | |
7197 | ||
7198 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, | |
7199 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
7200 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
7201 | CLEAR_STR | |
7202 | IP_STR | |
7203 | BGP_STR | |
7204 | "Clear all members of peer-group\n" | |
7205 | "BGP peer-group name\n" | |
7206 | "Address family\n" | |
7207 | "Address Family modifier\n" | |
7208 | "Address Family modifier\n" | |
e0bce756 | 7209 | BGP_SOFT_IN_STR) |
718e3744 | 7210 | |
7211 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, | |
7212 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
7213 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
7214 | CLEAR_STR | |
7215 | IP_STR | |
7216 | BGP_STR | |
7217 | "Clear all members of peer-group\n" | |
7218 | "BGP peer-group name\n" | |
7219 | "Address family\n" | |
7220 | "Address Family modifier\n" | |
7221 | "Address Family modifier\n" | |
e0bce756 | 7222 | BGP_SOFT_IN_STR |
718e3744 | 7223 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7224 | { | |
7225 | if (strncmp (argv[1], "m", 1) == 0) | |
7226 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7227 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7228 | ||
7229 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7230 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7231 | } | |
7232 | ||
7233 | DEFUN (clear_bgp_peer_group_soft_in, | |
7234 | clear_bgp_peer_group_soft_in_cmd, | |
7235 | "clear bgp peer-group WORD soft in", | |
7236 | CLEAR_STR | |
7237 | BGP_STR | |
7238 | "Clear all members of peer-group\n" | |
7239 | "BGP peer-group name\n" | |
e0bce756 DS |
7240 | BGP_SOFT_STR |
7241 | BGP_SOFT_IN_STR) | |
718e3744 | 7242 | { |
7243 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7244 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7245 | } | |
7246 | ||
7247 | ALIAS (clear_bgp_peer_group_soft_in, | |
7248 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
7249 | "clear bgp ipv6 peer-group WORD soft in", | |
7250 | CLEAR_STR | |
7251 | BGP_STR | |
7252 | "Address family\n" | |
7253 | "Clear all members of peer-group\n" | |
7254 | "BGP peer-group name\n" | |
e0bce756 DS |
7255 | BGP_SOFT_STR |
7256 | BGP_SOFT_IN_STR) | |
718e3744 | 7257 | |
7258 | ALIAS (clear_bgp_peer_group_soft_in, | |
7259 | clear_bgp_peer_group_in_cmd, | |
7260 | "clear bgp peer-group WORD in", | |
7261 | CLEAR_STR | |
7262 | BGP_STR | |
7263 | "Clear all members of peer-group\n" | |
7264 | "BGP peer-group name\n" | |
e0bce756 | 7265 | BGP_SOFT_IN_STR) |
718e3744 | 7266 | |
7267 | ALIAS (clear_bgp_peer_group_soft_in, | |
7268 | clear_bgp_ipv6_peer_group_in_cmd, | |
7269 | "clear bgp ipv6 peer-group WORD in", | |
7270 | CLEAR_STR | |
7271 | BGP_STR | |
7272 | "Address family\n" | |
7273 | "Clear all members of peer-group\n" | |
7274 | "BGP peer-group name\n" | |
e0bce756 | 7275 | BGP_SOFT_IN_STR) |
718e3744 | 7276 | |
7277 | DEFUN (clear_bgp_peer_group_in_prefix_filter, | |
7278 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
7279 | "clear bgp peer-group WORD in prefix-filter", | |
7280 | CLEAR_STR | |
7281 | BGP_STR | |
7282 | "Clear all members of peer-group\n" | |
7283 | "BGP peer-group name\n" | |
e0bce756 | 7284 | BGP_SOFT_IN_STR |
718e3744 | 7285 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7286 | { | |
7287 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7288 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7289 | } | |
7290 | ||
7291 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
7292 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
7293 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
7294 | CLEAR_STR | |
7295 | BGP_STR | |
7296 | "Address family\n" | |
7297 | "Clear all members of peer-group\n" | |
7298 | "BGP peer-group name\n" | |
e0bce756 | 7299 | BGP_SOFT_IN_STR |
718e3744 | 7300 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7301 | ||
7302 | DEFUN (clear_ip_bgp_external_soft_in, | |
7303 | clear_ip_bgp_external_soft_in_cmd, | |
7304 | "clear ip bgp external soft in", | |
7305 | CLEAR_STR | |
7306 | IP_STR | |
7307 | BGP_STR | |
7308 | "Clear all external peers\n" | |
e0bce756 DS |
7309 | BGP_SOFT_STR |
7310 | BGP_SOFT_IN_STR) | |
718e3744 | 7311 | { |
7312 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7313 | BGP_CLEAR_SOFT_IN, NULL); | |
7314 | } | |
7315 | ||
7316 | ALIAS (clear_ip_bgp_external_soft_in, | |
7317 | clear_ip_bgp_external_in_cmd, | |
7318 | "clear ip bgp external in", | |
7319 | CLEAR_STR | |
7320 | IP_STR | |
7321 | BGP_STR | |
7322 | "Clear all external peers\n" | |
e0bce756 | 7323 | BGP_SOFT_IN_STR) |
718e3744 | 7324 | |
7325 | DEFUN (clear_ip_bgp_external_in_prefix_filter, | |
7326 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
7327 | "clear ip bgp external in prefix-filter", | |
7328 | CLEAR_STR | |
7329 | IP_STR | |
7330 | BGP_STR | |
7331 | "Clear all external peers\n" | |
e0bce756 | 7332 | BGP_SOFT_IN_STR |
718e3744 | 7333 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7334 | { | |
7335 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7336 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7337 | } | |
7338 | ||
7339 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
7340 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
7341 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
7342 | CLEAR_STR | |
7343 | IP_STR | |
7344 | BGP_STR | |
7345 | "Clear all external peers\n" | |
7346 | "Address family\n" | |
7347 | "Address Family modifier\n" | |
7348 | "Address Family modifier\n" | |
e0bce756 DS |
7349 | BGP_SOFT_STR |
7350 | BGP_SOFT_IN_STR) | |
718e3744 | 7351 | { |
7352 | if (strncmp (argv[0], "m", 1) == 0) | |
7353 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7354 | BGP_CLEAR_SOFT_IN, NULL); | |
7355 | ||
7356 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7357 | BGP_CLEAR_SOFT_IN, NULL); | |
7358 | } | |
7359 | ||
7360 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, | |
7361 | clear_ip_bgp_external_ipv4_in_cmd, | |
7362 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
7363 | CLEAR_STR | |
7364 | IP_STR | |
7365 | BGP_STR | |
7366 | "Clear all external peers\n" | |
7367 | "Address family\n" | |
7368 | "Address Family modifier\n" | |
7369 | "Address Family modifier\n" | |
e0bce756 | 7370 | BGP_SOFT_IN_STR) |
718e3744 | 7371 | |
7372 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, | |
7373 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
7374 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
7375 | CLEAR_STR | |
7376 | IP_STR | |
7377 | BGP_STR | |
7378 | "Clear all external peers\n" | |
7379 | "Address family\n" | |
7380 | "Address Family modifier\n" | |
7381 | "Address Family modifier\n" | |
e0bce756 | 7382 | BGP_SOFT_IN_STR |
718e3744 | 7383 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7384 | { | |
7385 | if (strncmp (argv[0], "m", 1) == 0) | |
7386 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7387 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7388 | ||
7389 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7390 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7391 | } | |
7392 | ||
7393 | DEFUN (clear_bgp_external_soft_in, | |
7394 | clear_bgp_external_soft_in_cmd, | |
7395 | "clear bgp external soft in", | |
7396 | CLEAR_STR | |
7397 | BGP_STR | |
7398 | "Clear all external peers\n" | |
e0bce756 DS |
7399 | BGP_SOFT_STR |
7400 | BGP_SOFT_IN_STR) | |
718e3744 | 7401 | { |
7402 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7403 | BGP_CLEAR_SOFT_IN, NULL); | |
7404 | } | |
7405 | ||
7406 | ALIAS (clear_bgp_external_soft_in, | |
7407 | clear_bgp_ipv6_external_soft_in_cmd, | |
7408 | "clear bgp ipv6 external soft in", | |
7409 | CLEAR_STR | |
7410 | BGP_STR | |
7411 | "Address family\n" | |
7412 | "Clear all external peers\n" | |
e0bce756 DS |
7413 | BGP_SOFT_STR |
7414 | BGP_SOFT_IN_STR) | |
718e3744 | 7415 | |
7416 | ALIAS (clear_bgp_external_soft_in, | |
7417 | clear_bgp_external_in_cmd, | |
7418 | "clear bgp external in", | |
7419 | CLEAR_STR | |
7420 | BGP_STR | |
7421 | "Clear all external peers\n" | |
e0bce756 | 7422 | BGP_SOFT_IN_STR) |
718e3744 | 7423 | |
7424 | ALIAS (clear_bgp_external_soft_in, | |
7425 | clear_bgp_ipv6_external_in_cmd, | |
7426 | "clear bgp ipv6 external WORD in", | |
7427 | CLEAR_STR | |
7428 | BGP_STR | |
7429 | "Address family\n" | |
7430 | "Clear all external peers\n" | |
e0bce756 | 7431 | BGP_SOFT_IN_STR) |
718e3744 | 7432 | |
7433 | DEFUN (clear_bgp_external_in_prefix_filter, | |
7434 | clear_bgp_external_in_prefix_filter_cmd, | |
7435 | "clear bgp external in prefix-filter", | |
7436 | CLEAR_STR | |
7437 | BGP_STR | |
7438 | "Clear all external peers\n" | |
e0bce756 | 7439 | BGP_SOFT_IN_STR |
718e3744 | 7440 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7441 | { | |
7442 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7443 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7444 | } | |
7445 | ||
7446 | ALIAS (clear_bgp_external_in_prefix_filter, | |
7447 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
7448 | "clear bgp ipv6 external in prefix-filter", | |
7449 | CLEAR_STR | |
7450 | BGP_STR | |
7451 | "Address family\n" | |
7452 | "Clear all external peers\n" | |
e0bce756 | 7453 | BGP_SOFT_IN_STR |
718e3744 | 7454 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7455 | ||
7456 | DEFUN (clear_ip_bgp_as_soft_in, | |
7457 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 7458 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 7459 | CLEAR_STR |
7460 | IP_STR | |
7461 | BGP_STR | |
7462 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7463 | BGP_SOFT_STR |
7464 | BGP_SOFT_IN_STR) | |
718e3744 | 7465 | { |
7466 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7467 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7468 | } | |
7469 | ||
7470 | ALIAS (clear_ip_bgp_as_soft_in, | |
7471 | clear_ip_bgp_as_in_cmd, | |
320da874 | 7472 | "clear ip bgp " CMD_AS_RANGE " in", |
718e3744 | 7473 | CLEAR_STR |
7474 | IP_STR | |
7475 | BGP_STR | |
7476 | "Clear peers with the AS number\n" | |
e0bce756 | 7477 | BGP_SOFT_IN_STR) |
718e3744 | 7478 | |
7479 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
7480 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 7481 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7482 | CLEAR_STR |
7483 | IP_STR | |
7484 | BGP_STR | |
7485 | "Clear peers with the AS number\n" | |
e0bce756 | 7486 | BGP_SOFT_IN_STR |
718e3744 | 7487 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7488 | { | |
7489 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7490 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7491 | } | |
7492 | ||
7493 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
7494 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 7495 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 7496 | CLEAR_STR |
7497 | IP_STR | |
7498 | BGP_STR | |
7499 | "Clear peers with the AS number\n" | |
7500 | "Address family\n" | |
7501 | "Address Family modifier\n" | |
7502 | "Address Family modifier\n" | |
e0bce756 DS |
7503 | BGP_SOFT_STR |
7504 | BGP_SOFT_IN_STR) | |
718e3744 | 7505 | { |
7506 | if (strncmp (argv[1], "m", 1) == 0) | |
7507 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7508 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7509 | ||
7510 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7511 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7512 | } | |
7513 | ||
7514 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, | |
7515 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 7516 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 7517 | CLEAR_STR |
7518 | IP_STR | |
7519 | BGP_STR | |
7520 | "Clear peers with the AS number\n" | |
7521 | "Address family\n" | |
7522 | "Address Family modifier\n" | |
7523 | "Address Family modifier\n" | |
e0bce756 | 7524 | BGP_SOFT_IN_STR) |
718e3744 | 7525 | |
7526 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, | |
7527 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 7528 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 7529 | CLEAR_STR |
7530 | IP_STR | |
7531 | BGP_STR | |
7532 | "Clear peers with the AS number\n" | |
7533 | "Address family\n" | |
7534 | "Address Family modifier\n" | |
7535 | "Address Family modifier\n" | |
e0bce756 | 7536 | BGP_SOFT_IN_STR |
718e3744 | 7537 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7538 | { | |
7539 | if (strncmp (argv[1], "m", 1) == 0) | |
7540 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7541 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7542 | ||
7543 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7544 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7545 | } | |
7546 | ||
7547 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
7548 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 7549 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 7550 | CLEAR_STR |
7551 | IP_STR | |
7552 | BGP_STR | |
7553 | "Clear peers with the AS number\n" | |
7554 | "Address family\n" | |
7555 | "Address Family modifier\n" | |
e0bce756 DS |
7556 | BGP_SOFT_STR |
7557 | BGP_SOFT_IN_STR) | |
718e3744 | 7558 | { |
7559 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7560 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7561 | } | |
7562 | ||
7563 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
7564 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 7565 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 7566 | CLEAR_STR |
7567 | IP_STR | |
7568 | BGP_STR | |
7569 | "Clear peers with the AS number\n" | |
7570 | "Address family\n" | |
7571 | "Address Family modifier\n" | |
e0bce756 | 7572 | BGP_SOFT_IN_STR) |
718e3744 | 7573 | |
7574 | DEFUN (clear_bgp_as_soft_in, | |
7575 | clear_bgp_as_soft_in_cmd, | |
320da874 | 7576 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 7577 | CLEAR_STR |
7578 | BGP_STR | |
7579 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7580 | BGP_SOFT_STR |
7581 | BGP_SOFT_IN_STR) | |
718e3744 | 7582 | { |
7583 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7584 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7585 | } | |
7586 | ||
7587 | ALIAS (clear_bgp_as_soft_in, | |
7588 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 7589 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 7590 | CLEAR_STR |
7591 | BGP_STR | |
7592 | "Address family\n" | |
7593 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7594 | BGP_SOFT_STR |
7595 | BGP_SOFT_IN_STR) | |
718e3744 | 7596 | |
7597 | ALIAS (clear_bgp_as_soft_in, | |
7598 | clear_bgp_as_in_cmd, | |
320da874 | 7599 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 7600 | CLEAR_STR |
7601 | BGP_STR | |
7602 | "Clear peers with the AS number\n" | |
e0bce756 | 7603 | BGP_SOFT_IN_STR) |
718e3744 | 7604 | |
7605 | ALIAS (clear_bgp_as_soft_in, | |
7606 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 7607 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 7608 | CLEAR_STR |
7609 | BGP_STR | |
7610 | "Address family\n" | |
7611 | "Clear peers with the AS number\n" | |
e0bce756 | 7612 | BGP_SOFT_IN_STR) |
718e3744 | 7613 | |
7614 | DEFUN (clear_bgp_as_in_prefix_filter, | |
7615 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 7616 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7617 | CLEAR_STR |
7618 | BGP_STR | |
7619 | "Clear peers with the AS number\n" | |
e0bce756 | 7620 | BGP_SOFT_IN_STR |
718e3744 | 7621 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7622 | { | |
7623 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7624 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7625 | } | |
7626 | ||
7627 | ALIAS (clear_bgp_as_in_prefix_filter, | |
7628 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 7629 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7630 | CLEAR_STR |
7631 | BGP_STR | |
7632 | "Address family\n" | |
7633 | "Clear peers with the AS number\n" | |
e0bce756 | 7634 | BGP_SOFT_IN_STR |
718e3744 | 7635 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6b0655a2 | 7636 | |
718e3744 | 7637 | /* Both soft-reconfiguration */ |
7638 | DEFUN (clear_ip_bgp_all_soft, | |
7639 | clear_ip_bgp_all_soft_cmd, | |
7640 | "clear ip bgp * soft", | |
7641 | CLEAR_STR | |
7642 | IP_STR | |
7643 | BGP_STR | |
7644 | "Clear all peers\n" | |
e0bce756 | 7645 | BGP_SOFT_STR) |
718e3744 | 7646 | { |
7647 | if (argc == 1) | |
7648 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
7649 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7650 | ||
7651 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7652 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7653 | } | |
7654 | ||
7655 | ALIAS (clear_ip_bgp_all_soft, | |
7656 | clear_ip_bgp_instance_all_soft_cmd, | |
7657 | "clear ip bgp view WORD * soft", | |
7658 | CLEAR_STR | |
7659 | IP_STR | |
7660 | BGP_STR | |
7661 | "BGP view\n" | |
7662 | "view name\n" | |
7663 | "Clear all peers\n" | |
e0bce756 | 7664 | BGP_SOFT_STR) |
718e3744 | 7665 | |
7666 | ||
7667 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
7668 | clear_ip_bgp_all_ipv4_soft_cmd, | |
7669 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
7670 | CLEAR_STR | |
7671 | IP_STR | |
7672 | BGP_STR | |
7673 | "Clear all peers\n" | |
7674 | "Address family\n" | |
7675 | "Address Family Modifier\n" | |
7676 | "Address Family Modifier\n" | |
e0bce756 | 7677 | BGP_SOFT_STR) |
718e3744 | 7678 | { |
7679 | if (strncmp (argv[0], "m", 1) == 0) | |
7680 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7681 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7682 | ||
7683 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7684 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7685 | } | |
7686 | ||
7687 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
7688 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
7689 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", | |
7690 | CLEAR_STR | |
7691 | IP_STR | |
7692 | BGP_STR | |
7693 | "BGP view\n" | |
7694 | "view name\n" | |
7695 | "Clear all peers\n" | |
7696 | "Address family\n" | |
7697 | "Address Family Modifier\n" | |
7698 | "Address Family Modifier\n" | |
e0bce756 | 7699 | BGP_SOFT_STR) |
718e3744 | 7700 | { |
7701 | if (strncmp (argv[1], "m", 1) == 0) | |
7702 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7703 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7704 | ||
7705 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7706 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7707 | } | |
7708 | ||
7709 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
7710 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
7711 | "clear ip bgp * vpnv4 unicast soft", | |
7712 | CLEAR_STR | |
7713 | IP_STR | |
7714 | BGP_STR | |
7715 | "Clear all peers\n" | |
7716 | "Address family\n" | |
7717 | "Address Family Modifier\n" | |
e0bce756 | 7718 | BGP_SOFT_STR) |
718e3744 | 7719 | { |
7720 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
7721 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7722 | } | |
7723 | ||
7724 | DEFUN (clear_bgp_all_soft, | |
7725 | clear_bgp_all_soft_cmd, | |
7726 | "clear bgp * soft", | |
7727 | CLEAR_STR | |
7728 | BGP_STR | |
7729 | "Clear all peers\n" | |
e0bce756 | 7730 | BGP_SOFT_STR) |
718e3744 | 7731 | { |
7732 | if (argc == 1) | |
7733 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
7734 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7735 | ||
7736 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7737 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7738 | } | |
7739 | ||
7740 | ALIAS (clear_bgp_all_soft, | |
7741 | clear_bgp_instance_all_soft_cmd, | |
7742 | "clear bgp view WORD * soft", | |
7743 | CLEAR_STR | |
7744 | BGP_STR | |
7745 | "BGP view\n" | |
7746 | "view name\n" | |
7747 | "Clear all peers\n" | |
e0bce756 | 7748 | BGP_SOFT_STR) |
718e3744 | 7749 | |
7750 | ALIAS (clear_bgp_all_soft, | |
7751 | clear_bgp_ipv6_all_soft_cmd, | |
7752 | "clear bgp ipv6 * soft", | |
7753 | CLEAR_STR | |
7754 | BGP_STR | |
7755 | "Address family\n" | |
7756 | "Clear all peers\n" | |
e0bce756 | 7757 | BGP_SOFT_STR) |
718e3744 | 7758 | |
7759 | DEFUN (clear_ip_bgp_peer_soft, | |
7760 | clear_ip_bgp_peer_soft_cmd, | |
db64ea86 | 7761 | "clear ip bgp (A.B.C.D|WORD) soft", |
718e3744 | 7762 | CLEAR_STR |
7763 | IP_STR | |
7764 | BGP_STR | |
7765 | "BGP neighbor address to clear\n" | |
db64ea86 | 7766 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7767 | BGP_SOFT_STR) |
718e3744 | 7768 | { |
7769 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7770 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7771 | } | |
7772 | ||
7773 | DEFUN (clear_ip_bgp_peer_ipv4_soft, | |
7774 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
db64ea86 | 7775 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", |
718e3744 | 7776 | CLEAR_STR |
7777 | IP_STR | |
7778 | BGP_STR | |
7779 | "BGP neighbor address to clear\n" | |
db64ea86 | 7780 | "BGP neighbor on interface to clear\n" |
718e3744 | 7781 | "Address family\n" |
7782 | "Address Family Modifier\n" | |
7783 | "Address Family Modifier\n" | |
e0bce756 | 7784 | BGP_SOFT_STR) |
718e3744 | 7785 | { |
7786 | if (strncmp (argv[1], "m", 1) == 0) | |
7787 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
7788 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7789 | ||
7790 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7791 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7792 | } | |
7793 | ||
7794 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, | |
7795 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
db64ea86 | 7796 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft", |
718e3744 | 7797 | CLEAR_STR |
7798 | IP_STR | |
7799 | BGP_STR | |
7800 | "BGP neighbor address to clear\n" | |
db64ea86 | 7801 | "BGP neighbor on interface to clear\n" |
718e3744 | 7802 | "Address family\n" |
7803 | "Address Family Modifier\n" | |
e0bce756 | 7804 | BGP_SOFT_STR) |
718e3744 | 7805 | { |
7806 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
7807 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7808 | } | |
7809 | ||
7810 | DEFUN (clear_bgp_peer_soft, | |
7811 | clear_bgp_peer_soft_cmd, | |
a80beece | 7812 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 7813 | CLEAR_STR |
7814 | BGP_STR | |
7815 | "BGP neighbor address to clear\n" | |
7816 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7817 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7818 | BGP_SOFT_STR) |
718e3744 | 7819 | { |
7820 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7821 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7822 | } | |
7823 | ||
7824 | ALIAS (clear_bgp_peer_soft, | |
7825 | clear_bgp_ipv6_peer_soft_cmd, | |
a80beece | 7826 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 7827 | CLEAR_STR |
7828 | BGP_STR | |
7829 | "Address family\n" | |
7830 | "BGP neighbor address to clear\n" | |
7831 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7832 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7833 | BGP_SOFT_STR) |
718e3744 | 7834 | |
7835 | DEFUN (clear_ip_bgp_peer_group_soft, | |
7836 | clear_ip_bgp_peer_group_soft_cmd, | |
7837 | "clear ip bgp peer-group WORD soft", | |
7838 | CLEAR_STR | |
7839 | IP_STR | |
7840 | BGP_STR | |
7841 | "Clear all members of peer-group\n" | |
7842 | "BGP peer-group name\n" | |
e0bce756 | 7843 | BGP_SOFT_STR) |
718e3744 | 7844 | { |
7845 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7846 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7847 | } | |
7848 | ||
7849 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, | |
7850 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
7851 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
7852 | CLEAR_STR | |
7853 | IP_STR | |
7854 | BGP_STR | |
7855 | "Clear all members of peer-group\n" | |
7856 | "BGP peer-group name\n" | |
7857 | "Address family\n" | |
7858 | "Address Family modifier\n" | |
7859 | "Address Family modifier\n" | |
e0bce756 | 7860 | BGP_SOFT_STR) |
718e3744 | 7861 | { |
7862 | if (strncmp (argv[1], "m", 1) == 0) | |
7863 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7864 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7865 | ||
7866 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7867 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7868 | } | |
7869 | ||
7870 | DEFUN (clear_bgp_peer_group_soft, | |
7871 | clear_bgp_peer_group_soft_cmd, | |
7872 | "clear bgp peer-group WORD soft", | |
7873 | CLEAR_STR | |
7874 | BGP_STR | |
7875 | "Clear all members of peer-group\n" | |
7876 | "BGP peer-group name\n" | |
e0bce756 | 7877 | BGP_SOFT_STR) |
718e3744 | 7878 | { |
7879 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7880 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7881 | } | |
7882 | ||
7883 | ALIAS (clear_bgp_peer_group_soft, | |
7884 | clear_bgp_ipv6_peer_group_soft_cmd, | |
7885 | "clear bgp ipv6 peer-group WORD soft", | |
7886 | CLEAR_STR | |
7887 | BGP_STR | |
7888 | "Address family\n" | |
7889 | "Clear all members of peer-group\n" | |
7890 | "BGP peer-group name\n" | |
e0bce756 | 7891 | BGP_SOFT_STR) |
718e3744 | 7892 | |
7893 | DEFUN (clear_ip_bgp_external_soft, | |
7894 | clear_ip_bgp_external_soft_cmd, | |
7895 | "clear ip bgp external soft", | |
7896 | CLEAR_STR | |
7897 | IP_STR | |
7898 | BGP_STR | |
7899 | "Clear all external peers\n" | |
e0bce756 | 7900 | BGP_SOFT_STR) |
718e3744 | 7901 | { |
7902 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7903 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7904 | } | |
7905 | ||
7906 | DEFUN (clear_ip_bgp_external_ipv4_soft, | |
7907 | clear_ip_bgp_external_ipv4_soft_cmd, | |
7908 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
7909 | CLEAR_STR | |
7910 | IP_STR | |
7911 | BGP_STR | |
7912 | "Clear all external peers\n" | |
7913 | "Address family\n" | |
7914 | "Address Family modifier\n" | |
7915 | "Address Family modifier\n" | |
e0bce756 | 7916 | BGP_SOFT_STR) |
718e3744 | 7917 | { |
7918 | if (strncmp (argv[0], "m", 1) == 0) | |
7919 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7920 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7921 | ||
7922 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7923 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7924 | } | |
7925 | ||
7926 | DEFUN (clear_bgp_external_soft, | |
7927 | clear_bgp_external_soft_cmd, | |
7928 | "clear bgp external soft", | |
7929 | CLEAR_STR | |
7930 | BGP_STR | |
7931 | "Clear all external peers\n" | |
e0bce756 | 7932 | BGP_SOFT_STR) |
718e3744 | 7933 | { |
7934 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7935 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7936 | } | |
7937 | ||
7938 | ALIAS (clear_bgp_external_soft, | |
7939 | clear_bgp_ipv6_external_soft_cmd, | |
7940 | "clear bgp ipv6 external soft", | |
7941 | CLEAR_STR | |
7942 | BGP_STR | |
7943 | "Address family\n" | |
7944 | "Clear all external peers\n" | |
e0bce756 | 7945 | BGP_SOFT_STR) |
718e3744 | 7946 | |
7947 | DEFUN (clear_ip_bgp_as_soft, | |
7948 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 7949 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 7950 | CLEAR_STR |
7951 | IP_STR | |
7952 | BGP_STR | |
7953 | "Clear peers with the AS number\n" | |
e0bce756 | 7954 | BGP_SOFT_STR) |
718e3744 | 7955 | { |
7956 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7957 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7958 | } | |
7959 | ||
7960 | DEFUN (clear_ip_bgp_as_ipv4_soft, | |
7961 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 7962 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 7963 | CLEAR_STR |
7964 | IP_STR | |
7965 | BGP_STR | |
7966 | "Clear peers with the AS number\n" | |
7967 | "Address family\n" | |
7968 | "Address Family Modifier\n" | |
7969 | "Address Family Modifier\n" | |
e0bce756 | 7970 | BGP_SOFT_STR) |
718e3744 | 7971 | { |
7972 | if (strncmp (argv[1], "m", 1) == 0) | |
7973 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7974 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7975 | ||
7976 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
7977 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7978 | } | |
7979 | ||
7980 | DEFUN (clear_ip_bgp_as_vpnv4_soft, | |
7981 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 7982 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 7983 | CLEAR_STR |
7984 | IP_STR | |
7985 | BGP_STR | |
7986 | "Clear peers with the AS number\n" | |
7987 | "Address family\n" | |
7988 | "Address Family Modifier\n" | |
e0bce756 | 7989 | BGP_SOFT_STR) |
718e3744 | 7990 | { |
7991 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7992 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7993 | } | |
7994 | ||
7995 | DEFUN (clear_bgp_as_soft, | |
7996 | clear_bgp_as_soft_cmd, | |
320da874 | 7997 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 7998 | CLEAR_STR |
7999 | BGP_STR | |
8000 | "Clear peers with the AS number\n" | |
e0bce756 | 8001 | BGP_SOFT_STR) |
718e3744 | 8002 | { |
8003 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
8004 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
8005 | } | |
8006 | ||
8007 | ALIAS (clear_bgp_as_soft, | |
8008 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 8009 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 8010 | CLEAR_STR |
8011 | BGP_STR | |
8012 | "Address family\n" | |
8013 | "Clear peers with the AS number\n" | |
e0bce756 | 8014 | BGP_SOFT_STR) |
6b0655a2 | 8015 | |
e0081f70 ML |
8016 | DEFUN (show_bgp_views, |
8017 | show_bgp_views_cmd, | |
8018 | "show bgp views", | |
8019 | SHOW_STR | |
8020 | BGP_STR | |
8021 | "Show the defined BGP views\n") | |
8022 | { | |
8023 | struct list *inst = bm->bgp; | |
8024 | struct listnode *node; | |
8025 | struct bgp *bgp; | |
8026 | ||
8027 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
8028 | { | |
8029 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); | |
8030 | return CMD_WARNING; | |
8031 | } | |
8032 | ||
8033 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
8034 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
8035 | vty_out (vty, "\t%s (AS%u)%s", | |
8036 | bgp->name ? bgp->name : "(null)", | |
8037 | bgp->as, VTY_NEWLINE); | |
8038 | ||
8039 | return CMD_SUCCESS; | |
8040 | } | |
8041 | ||
4bf6a362 PJ |
8042 | DEFUN (show_bgp_memory, |
8043 | show_bgp_memory_cmd, | |
8044 | "show bgp memory", | |
8045 | SHOW_STR | |
8046 | BGP_STR | |
8047 | "Global BGP memory statistics\n") | |
8048 | { | |
8049 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
8050 | unsigned long count; | |
8051 | ||
8052 | /* RIB related usage stats */ | |
8053 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
8054 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
8055 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8056 | count * sizeof (struct bgp_node)), | |
8057 | VTY_NEWLINE); | |
8058 | ||
8059 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
8060 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
8061 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8062 | count * sizeof (struct bgp_info)), | |
8063 | VTY_NEWLINE); | |
fb982c25 PJ |
8064 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
8065 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
8066 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8067 | count * sizeof (struct bgp_info_extra)), | |
8068 | VTY_NEWLINE); | |
4bf6a362 PJ |
8069 | |
8070 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
8071 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
8072 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8073 | count * sizeof (struct bgp_static)), | |
8074 | VTY_NEWLINE); | |
3f9c7369 DS |
8075 | |
8076 | if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET))) | |
8077 | vty_out (vty, "%ld Packets, using %s of memory%s", count, | |
8078 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8079 | count * sizeof (struct bpacket)), | |
8080 | VTY_NEWLINE); | |
4bf6a362 PJ |
8081 | |
8082 | /* Adj-In/Out */ | |
8083 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
8084 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
8085 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8086 | count * sizeof (struct bgp_adj_in)), | |
8087 | VTY_NEWLINE); | |
8088 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
8089 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
8090 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8091 | count * sizeof (struct bgp_adj_out)), | |
8092 | VTY_NEWLINE); | |
8093 | ||
8094 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
8095 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
8096 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8097 | count * sizeof (struct bgp_nexthop_cache)), | |
8098 | VTY_NEWLINE); | |
8099 | ||
8100 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
8101 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
8102 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8103 | count * sizeof (struct bgp_damp_info)), | |
8104 | VTY_NEWLINE); | |
8105 | ||
8106 | /* Attributes */ | |
8107 | count = attr_count(); | |
8108 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
8109 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8110 | count * sizeof(struct attr)), | |
8111 | VTY_NEWLINE); | |
fb982c25 PJ |
8112 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
8113 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
8114 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8115 | count * sizeof(struct attr_extra)), | |
8116 | VTY_NEWLINE); | |
4bf6a362 PJ |
8117 | |
8118 | if ((count = attr_unknown_count())) | |
8119 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
8120 | ||
8121 | /* AS_PATH attributes */ | |
8122 | count = aspath_count (); | |
8123 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
8124 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8125 | count * sizeof (struct aspath)), | |
8126 | VTY_NEWLINE); | |
8127 | ||
8128 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
8129 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
8130 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8131 | count * sizeof (struct assegment)), | |
8132 | VTY_NEWLINE); | |
8133 | ||
8134 | /* Other attributes */ | |
8135 | if ((count = community_count ())) | |
8136 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
8137 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8138 | count * sizeof (struct community)), | |
8139 | VTY_NEWLINE); | |
8140 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
8141 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
8142 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8143 | count * sizeof (struct ecommunity)), | |
8144 | VTY_NEWLINE); | |
8145 | ||
8146 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
8147 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
8148 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8149 | count * sizeof (struct cluster_list)), | |
8150 | VTY_NEWLINE); | |
8151 | ||
8152 | /* Peer related usage */ | |
8153 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
8154 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
8155 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8156 | count * sizeof (struct peer)), | |
8157 | VTY_NEWLINE); | |
8158 | ||
6e919709 | 8159 | if ((count = mtype_stats_alloc (MTYPE_BGP_PEER_GROUP))) |
4bf6a362 PJ |
8160 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
8161 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8162 | count * sizeof (struct peer_group)), | |
8163 | VTY_NEWLINE); | |
8164 | ||
8165 | /* Other */ | |
8166 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
8167 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
8168 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8169 | count * sizeof (struct hash)), | |
8170 | VTY_NEWLINE); | |
8171 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
8172 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
8173 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8174 | count * sizeof (struct hash_backet)), | |
8175 | VTY_NEWLINE); | |
8176 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
8177 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
8178 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8179 | count * sizeof (regex_t)), | |
8180 | VTY_NEWLINE); | |
8181 | return CMD_SUCCESS; | |
8182 | } | |
fee0f4c6 | 8183 | |
47fc97cc DS |
8184 | static int |
8185 | bgp_adj_out_count (struct peer *peer, int afi, int safi) | |
8186 | { | |
8187 | struct bgp_table *table; | |
8188 | struct bgp_node *rn; | |
47fc97cc DS |
8189 | int count = 0; |
8190 | ||
8191 | if (!peer) return(0); | |
8192 | ||
8193 | table = peer->bgp->rib[afi][safi]; | |
8194 | if (!table) return(0); | |
8195 | for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) | |
adbac85e | 8196 | if (bgp_adj_out_lookup(peer, rn, 0)) |
47fc97cc DS |
8197 | count++; |
8198 | return (count); | |
8199 | } | |
8200 | ||
718e3744 | 8201 | /* Show BGP peer's summary information. */ |
94f2b392 | 8202 | static int |
b05a1c8b DS |
8203 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, |
8204 | u_char use_json) | |
718e3744 | 8205 | { |
8206 | struct peer *peer; | |
1eb8ef25 | 8207 | struct listnode *node, *nnode; |
f14e6fdb DS |
8208 | unsigned int count = 0, dn_count = 0; |
8209 | char timebuf[BGP_UPTIME_LEN], dn_flag[2]; | |
718e3744 | 8210 | int len; |
ffd0c037 | 8211 | json_object *json = NULL; |
ffd0c037 DS |
8212 | json_object *json_peer = NULL; |
8213 | json_object *json_peers = NULL; | |
718e3744 | 8214 | |
8215 | /* Header string for each address family. */ | |
8216 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; | |
47fc97cc | 8217 | |
b05a1c8b DS |
8218 | if (use_json) |
8219 | { | |
8220 | json = json_object_new_object(); | |
f1aa5d8a | 8221 | json_peers = json_object_new_object(); |
b05a1c8b DS |
8222 | } |
8223 | ||
1eb8ef25 | 8224 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 8225 | { |
1ff9a340 DS |
8226 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
8227 | continue; | |
8228 | ||
718e3744 | 8229 | if (peer->afc[afi][safi]) |
8230 | { | |
b05a1c8b | 8231 | if (!count) |
4bf6a362 PJ |
8232 | { |
8233 | unsigned long ents; | |
8234 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
b05a1c8b | 8235 | |
4bf6a362 | 8236 | /* Usage summary and header */ |
b05a1c8b DS |
8237 | if (use_json) |
8238 | { | |
62d6dca0 | 8239 | json_object_string_add(json, "routerId", inet_ntoa (bgp->router_id)); |
f1aa5d8a | 8240 | json_object_int_add(json, "as", bgp->as); |
b05a1c8b DS |
8241 | } |
8242 | else | |
8243 | { | |
8244 | vty_out (vty, | |
8245 | "BGP router identifier %s, local AS number %u%s", | |
8246 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); | |
8247 | } | |
8248 | ||
f188f2c4 DS |
8249 | if (bgp_update_delay_configured(bgp)) |
8250 | { | |
b05a1c8b | 8251 | if (use_json) |
f188f2c4 | 8252 | { |
62d6dca0 | 8253 | json_object_int_add(json, "updateDelayLimit", bgp->v_update_delay); |
b05a1c8b DS |
8254 | |
8255 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
62d6dca0 | 8256 | json_object_int_add(json, "updateDelayEstablishWait", bgp->v_establish_wait); |
b05a1c8b DS |
8257 | |
8258 | if (bgp_update_delay_active(bgp)) | |
8259 | { | |
62d6dca0 DS |
8260 | json_object_string_add(json, "updateDelayFirstNeighbor", bgp->update_delay_begin_time); |
8261 | json_object_boolean_true_add(json, "updateDelayInProgress"); | |
b05a1c8b DS |
8262 | } |
8263 | else | |
8264 | { | |
8265 | if (bgp->update_delay_over) | |
8266 | { | |
62d6dca0 | 8267 | json_object_string_add(json, "updateDelayFirstNeighbor", |
f1aa5d8a | 8268 | bgp->update_delay_begin_time); |
62d6dca0 | 8269 | json_object_string_add(json, "updateDelayBestpathResumed", |
f1aa5d8a | 8270 | bgp->update_delay_end_time); |
62d6dca0 | 8271 | json_object_string_add(json, "updateDelayZebraUpdateResume", |
f1aa5d8a | 8272 | bgp->update_delay_zebra_resume_time); |
62d6dca0 | 8273 | json_object_string_add(json, "updateDelayPeerUpdateResume", |
f1aa5d8a | 8274 | bgp->update_delay_peers_resume_time); |
b05a1c8b DS |
8275 | } |
8276 | } | |
f188f2c4 DS |
8277 | } |
8278 | else | |
8279 | { | |
b05a1c8b DS |
8280 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", |
8281 | bgp->v_update_delay, VTY_NEWLINE); | |
8282 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
8283 | vty_out (vty, " Establish wait: %d seconds%s", | |
8284 | bgp->v_establish_wait, VTY_NEWLINE); | |
8285 | ||
8286 | if (bgp_update_delay_active(bgp)) | |
f188f2c4 DS |
8287 | { |
8288 | vty_out (vty, " First neighbor established: %s%s", | |
8289 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
b05a1c8b DS |
8290 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); |
8291 | } | |
8292 | else | |
8293 | { | |
8294 | if (bgp->update_delay_over) | |
8295 | { | |
8296 | vty_out (vty, " First neighbor established: %s%s", | |
8297 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
8298 | vty_out (vty, " Best-paths resumed: %s%s", | |
8299 | bgp->update_delay_end_time, VTY_NEWLINE); | |
8300 | vty_out (vty, " zebra update resumed: %s%s", | |
8301 | bgp->update_delay_zebra_resume_time, VTY_NEWLINE); | |
8302 | vty_out (vty, " peers update resumed: %s%s", | |
8303 | bgp->update_delay_peers_resume_time, VTY_NEWLINE); | |
8304 | } | |
f188f2c4 DS |
8305 | } |
8306 | } | |
8307 | } | |
4bf6a362 | 8308 | |
b05a1c8b DS |
8309 | if (use_json) |
8310 | { | |
8311 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
62d6dca0 | 8312 | json_object_boolean_true_add(json, "maxMedOnStartup"); |
b05a1c8b | 8313 | if (bgp->v_maxmed_admin) |
62d6dca0 | 8314 | json_object_boolean_true_add(json, "maxMedAdministrative"); |
b05a1c8b | 8315 | |
62d6dca0 | 8316 | json_object_int_add(json, "tableVersion", bgp_table_version(bgp->rib[afi][safi])); |
b05a1c8b DS |
8317 | |
8318 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
62d6dca0 DS |
8319 | json_object_int_add(json, "ribCount", ents); |
8320 | json_object_int_add(json, "ribMemory", ents * sizeof (struct bgp_node)); | |
b05a1c8b DS |
8321 | |
8322 | ents = listcount (bgp->peer); | |
62d6dca0 DS |
8323 | json_object_int_add(json, "peerCount", ents); |
8324 | json_object_int_add(json, "peerMemory", ents * sizeof (struct peer)); | |
b05a1c8b | 8325 | |
b05a1c8b DS |
8326 | if ((ents = listcount (bgp->group))) |
8327 | { | |
62d6dca0 DS |
8328 | json_object_int_add(json, "peerGroupCount", ents); |
8329 | json_object_int_add(json, "peerGroupMemory", ents * sizeof (struct peer_group)); | |
b05a1c8b | 8330 | } |
3f9c7369 | 8331 | |
b05a1c8b | 8332 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
62d6dca0 | 8333 | json_object_boolean_true_add(json, "dampeningEnabled"); |
b05a1c8b DS |
8334 | } |
8335 | else | |
8336 | { | |
8337 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
8338 | vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE); | |
8339 | if (bgp->v_maxmed_admin) | |
8340 | vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE); | |
8341 | ||
ffd0c037 | 8342 | vty_out(vty, "BGP table version %" PRIu64 "%s", |
b05a1c8b DS |
8343 | bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE); |
8344 | ||
8345 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
8346 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
8347 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8348 | ents * sizeof (struct bgp_node)), | |
8349 | VTY_NEWLINE); | |
8350 | ||
8351 | /* Peer related usage */ | |
8352 | ents = listcount (bgp->peer); | |
8353 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
8354 | ents, | |
8355 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8356 | ents * sizeof (struct peer)), | |
8357 | VTY_NEWLINE); | |
8358 | ||
b05a1c8b DS |
8359 | if ((ents = listcount (bgp->group))) |
8360 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
8361 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8362 | ents * sizeof (struct peer_group)), | |
8363 | VTY_NEWLINE); | |
8364 | ||
8365 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
8366 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
8367 | vty_out (vty, "%s", VTY_NEWLINE); | |
8368 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
8369 | } | |
4bf6a362 PJ |
8370 | } |
8371 | ||
b05a1c8b | 8372 | count++; |
718e3744 | 8373 | |
b05a1c8b DS |
8374 | if (use_json) |
8375 | { | |
8376 | json_peer = json_object_new_object(); | |
f14e6fdb | 8377 | |
b05a1c8b | 8378 | if (peer_dynamic_neighbor(peer)) |
62d6dca0 | 8379 | json_object_boolean_true_add(json_peer, "dynamicPeer"); |
b05a1c8b | 8380 | |
04b6bdc0 DW |
8381 | if (peer->hostname) |
8382 | json_object_string_add(json_peer, "hostname", peer->hostname); | |
8383 | ||
8384 | if (peer->domainname) | |
8385 | json_object_string_add(json_peer, "domainname", peer->domainname); | |
8386 | ||
62d6dca0 | 8387 | json_object_int_add(json_peer, "remoteAs", peer->as); |
f1aa5d8a | 8388 | json_object_int_add(json_peer, "version", 4); |
62d6dca0 | 8389 | json_object_int_add(json_peer, "msgRcvd", |
f1aa5d8a DS |
8390 | peer->open_in + peer->update_in + peer->keepalive_in |
8391 | + peer->notify_in + peer->refresh_in | |
8392 | + peer->dynamic_cap_in); | |
62d6dca0 | 8393 | json_object_int_add(json_peer, "msgSent", |
f1aa5d8a DS |
8394 | peer->open_out + peer->update_out + peer->keepalive_out |
8395 | + peer->notify_out + peer->refresh_out | |
8396 | + peer->dynamic_cap_out); | |
8397 | ||
62d6dca0 | 8398 | json_object_int_add(json_peer, "tableVersion", peer->version[afi][safi]); |
f1aa5d8a DS |
8399 | json_object_int_add(json_peer, "outq", peer->obuf->count); |
8400 | json_object_int_add(json_peer, "inq", 0); | |
856ca177 | 8401 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, use_json, json_peer); |
62d6dca0 DS |
8402 | json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][safi]); |
8403 | json_object_int_add(json_peer, "prefixAdvertisedCount", bgp_adj_out_count(peer, afi, safi)); | |
b05a1c8b DS |
8404 | |
8405 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
f1aa5d8a | 8406 | json_object_string_add(json_peer, "state", "Idle (Admin)"); |
b05a1c8b | 8407 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
f1aa5d8a | 8408 | json_object_string_add(json_peer, "state", "Idle (PfxCt)"); |
b05a1c8b | 8409 | else |
f1aa5d8a | 8410 | json_object_string_add(json_peer, "state", LOOKUP(bgp_status_msg, peer->status)); |
b05a1c8b | 8411 | |
f1aa5d8a | 8412 | if (peer->conf_if) |
62d6dca0 | 8413 | json_object_string_add(json_peer, "idType", "interface"); |
f1aa5d8a | 8414 | else if (peer->su.sa.sa_family == AF_INET) |
62d6dca0 | 8415 | json_object_string_add(json_peer, "idType", "ipv4"); |
f1aa5d8a | 8416 | else if (peer->su.sa.sa_family == AF_INET6) |
62d6dca0 | 8417 | json_object_string_add(json_peer, "idType", "ipv6"); |
b05a1c8b | 8418 | |
f1aa5d8a | 8419 | json_object_object_add(json_peers, peer->host, json_peer); |
b05a1c8b DS |
8420 | } |
8421 | else | |
8422 | { | |
8423 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
8424 | if (peer_dynamic_neighbor(peer)) | |
8425 | { | |
8426 | dn_count++; | |
8427 | dn_flag[0] = '*'; | |
8428 | } | |
8429 | ||
04b6bdc0 DW |
8430 | if (peer->hostname && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME)) |
8431 | len = vty_out (vty, "%s%s(%s)", dn_flag, peer->hostname, | |
8432 | peer->host); | |
8433 | else | |
8434 | len = vty_out (vty, "%s%s", dn_flag, peer->host); | |
b05a1c8b DS |
8435 | len = 16 - len; |
8436 | ||
8437 | if (len < 1) | |
8438 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
8439 | else | |
8440 | vty_out (vty, "%*s", len, " "); | |
8441 | ||
8442 | vty_out (vty, "4 "); | |
8443 | ||
ee046671 | 8444 | vty_out (vty, "%5u %7d %7d %8" PRIu64 " %4d %4zd ", |
b05a1c8b DS |
8445 | peer->as, |
8446 | peer->open_in + peer->update_in + peer->keepalive_in | |
8447 | + peer->notify_in + peer->refresh_in | |
8448 | + peer->dynamic_cap_in, | |
8449 | peer->open_out + peer->update_out + peer->keepalive_out | |
8450 | + peer->notify_out + peer->refresh_out | |
8451 | + peer->dynamic_cap_out, | |
8452 | peer->version[afi][safi], | |
8453 | 0, | |
ffd0c037 | 8454 | peer->obuf->count); |
b05a1c8b | 8455 | |
f1aa5d8a | 8456 | vty_out (vty, "%-8s", |
856ca177 | 8457 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); |
b05a1c8b DS |
8458 | |
8459 | if (peer->status == Established) | |
8460 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); | |
8461 | else | |
8462 | { | |
8463 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
8464 | vty_out (vty, " Idle (Admin)"); | |
8465 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
8466 | vty_out (vty, " Idle (PfxCt)"); | |
8467 | else | |
8468 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
8469 | } | |
8470 | vty_out (vty, "%s", VTY_NEWLINE); | |
8471 | } | |
718e3744 | 8472 | } |
8473 | } | |
8474 | ||
b05a1c8b DS |
8475 | if (use_json) |
8476 | { | |
8477 | json_object_object_add(json, "peers", json_peers); | |
14151a32 | 8478 | |
62d6dca0 DS |
8479 | json_object_int_add(json, "totalPeers", count); |
8480 | json_object_int_add(json, "dynamicPeers", dn_count); | |
14151a32 | 8481 | |
b05a1c8b | 8482 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); |
f1aa5d8a | 8483 | json_object_free(json); |
b05a1c8b DS |
8484 | } |
8485 | else | |
f14e6fdb | 8486 | { |
b05a1c8b DS |
8487 | if (count) |
8488 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
8489 | count, VTY_NEWLINE); | |
8490 | else | |
8491 | vty_out (vty, "No %s neighbor is configured%s", | |
8492 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
8493 | ||
8494 | if (dn_count) | |
8495 | { | |
8496 | vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE); | |
8497 | vty_out(vty, | |
8498 | "%d dynamic neighbor(s), limit %d%s", | |
8499 | dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
8500 | } | |
f14e6fdb DS |
8501 | } |
8502 | ||
718e3744 | 8503 | return CMD_SUCCESS; |
8504 | } | |
8505 | ||
47fc97cc DS |
8506 | static int |
8507 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
b05a1c8b | 8508 | afi_t afi, safi_t safi, u_char use_json) |
718e3744 | 8509 | { |
8510 | struct bgp *bgp; | |
8511 | ||
8512 | if (name) | |
8513 | { | |
8514 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 8515 | |
718e3744 | 8516 | if (! bgp) |
8517 | { | |
47fc97cc | 8518 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 8519 | return CMD_WARNING; |
8520 | } | |
8521 | ||
b05a1c8b | 8522 | bgp_show_summary (vty, bgp, afi, safi, use_json); |
718e3744 | 8523 | return CMD_SUCCESS; |
8524 | } | |
47fc97cc | 8525 | |
718e3744 | 8526 | bgp = bgp_get_default (); |
8527 | ||
8528 | if (bgp) | |
b05a1c8b | 8529 | bgp_show_summary (vty, bgp, afi, safi, use_json); |
47fc97cc | 8530 | |
718e3744 | 8531 | return CMD_SUCCESS; |
8532 | } | |
8533 | ||
8534 | /* `show ip bgp summary' commands. */ | |
47fc97cc | 8535 | DEFUN (show_ip_bgp_summary, |
718e3744 | 8536 | show_ip_bgp_summary_cmd, |
b05a1c8b | 8537 | "show ip bgp summary {json}", |
47fc97cc DS |
8538 | SHOW_STR |
8539 | IP_STR | |
8540 | BGP_STR | |
b05a1c8b DS |
8541 | "Summary of BGP neighbor status\n" |
8542 | "JavaScript Object Notation\n") | |
47fc97cc | 8543 | { |
db7c8528 DS |
8544 | u_char uj = use_json(argc, argv); |
8545 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); | |
718e3744 | 8546 | } |
8547 | ||
8548 | DEFUN (show_ip_bgp_instance_summary, | |
8549 | show_ip_bgp_instance_summary_cmd, | |
b05a1c8b | 8550 | "show ip bgp view WORD summary {json}", |
718e3744 | 8551 | SHOW_STR |
8552 | IP_STR | |
8553 | BGP_STR | |
8554 | "BGP view\n" | |
8555 | "View name\n" | |
b05a1c8b DS |
8556 | "Summary of BGP neighbor status\n" |
8557 | "JavaScript Object Notation\n") | |
718e3744 | 8558 | { |
db7c8528 DS |
8559 | u_char uj = use_json(argc, argv); |
8560 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj); | |
718e3744 | 8561 | } |
8562 | ||
8563 | DEFUN (show_ip_bgp_ipv4_summary, | |
8564 | show_ip_bgp_ipv4_summary_cmd, | |
b05a1c8b | 8565 | "show ip bgp ipv4 (unicast|multicast) summary {json}", |
718e3744 | 8566 | SHOW_STR |
8567 | IP_STR | |
8568 | BGP_STR | |
8569 | "Address family\n" | |
8570 | "Address Family modifier\n" | |
8571 | "Address Family modifier\n" | |
b05a1c8b DS |
8572 | "Summary of BGP neighbor status\n" |
8573 | "JavaScript Object Notation\n") | |
718e3744 | 8574 | { |
db7c8528 | 8575 | u_char uj = use_json(argc, argv); |
718e3744 | 8576 | if (strncmp (argv[0], "m", 1) == 0) |
db7c8528 | 8577 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, uj); |
718e3744 | 8578 | |
db7c8528 | 8579 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 8580 | } |
8581 | ||
95cbbd2a ML |
8582 | ALIAS (show_ip_bgp_ipv4_summary, |
8583 | show_bgp_ipv4_safi_summary_cmd, | |
b05a1c8b | 8584 | "show bgp ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8585 | SHOW_STR |
8586 | BGP_STR | |
8587 | "Address family\n" | |
8588 | "Address Family modifier\n" | |
8589 | "Address Family modifier\n" | |
8590 | "Summary of BGP neighbor status\n") | |
8591 | ||
718e3744 | 8592 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
8593 | show_ip_bgp_instance_ipv4_summary_cmd, | |
b05a1c8b | 8594 | "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}", |
718e3744 | 8595 | SHOW_STR |
8596 | IP_STR | |
8597 | BGP_STR | |
8598 | "BGP view\n" | |
8599 | "View name\n" | |
8600 | "Address family\n" | |
8601 | "Address Family modifier\n" | |
8602 | "Address Family modifier\n" | |
b05a1c8b DS |
8603 | "Summary of BGP neighbor status\n" |
8604 | "JavaScript Object Notation\n") | |
718e3744 | 8605 | { |
db7c8528 | 8606 | u_char uj = use_json(argc, argv); |
718e3744 | 8607 | if (strncmp (argv[1], "m", 1) == 0) |
db7c8528 | 8608 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, uj); |
718e3744 | 8609 | else |
db7c8528 | 8610 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, uj); |
718e3744 | 8611 | } |
8612 | ||
95cbbd2a ML |
8613 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
8614 | show_bgp_instance_ipv4_safi_summary_cmd, | |
b05a1c8b | 8615 | "show bgp view WORD ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8616 | SHOW_STR |
8617 | BGP_STR | |
8618 | "BGP view\n" | |
8619 | "View name\n" | |
8620 | "Address family\n" | |
8621 | "Address Family modifier\n" | |
8622 | "Address Family modifier\n" | |
8623 | "Summary of BGP neighbor status\n") | |
8624 | ||
718e3744 | 8625 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
8626 | show_ip_bgp_vpnv4_all_summary_cmd, | |
b05a1c8b | 8627 | "show ip bgp vpnv4 all summary {json}", |
718e3744 | 8628 | SHOW_STR |
8629 | IP_STR | |
8630 | BGP_STR | |
8631 | "Display VPNv4 NLRI specific information\n" | |
8632 | "Display information about all VPNv4 NLRIs\n" | |
b05a1c8b DS |
8633 | "Summary of BGP neighbor status\n" |
8634 | "JavaScript Object Notation\n") | |
718e3744 | 8635 | { |
db7c8528 DS |
8636 | u_char uj = use_json(argc, argv); |
8637 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); | |
718e3744 | 8638 | } |
8639 | ||
8640 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
8641 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
b05a1c8b | 8642 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}", |
718e3744 | 8643 | SHOW_STR |
8644 | IP_STR | |
8645 | BGP_STR | |
8646 | "Display VPNv4 NLRI specific information\n" | |
8647 | "Display information for a route distinguisher\n" | |
8648 | "VPN Route Distinguisher\n" | |
b05a1c8b DS |
8649 | "Summary of BGP neighbor status\n" |
8650 | "JavaScript Object Notation\n") | |
718e3744 | 8651 | { |
8652 | int ret; | |
8653 | struct prefix_rd prd; | |
db7c8528 | 8654 | u_char uj = use_json(argc, argv); |
718e3744 | 8655 | |
8656 | ret = str2prefix_rd (argv[0], &prd); | |
8657 | if (! ret) | |
8658 | { | |
8659 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
8660 | return CMD_WARNING; | |
8661 | } | |
8662 | ||
db7c8528 | 8663 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, uj); |
718e3744 | 8664 | } |
8665 | ||
8666 | #ifdef HAVE_IPV6 | |
47fc97cc | 8667 | DEFUN (show_bgp_summary, |
718e3744 | 8668 | show_bgp_summary_cmd, |
b05a1c8b | 8669 | "show bgp summary {json}", |
718e3744 | 8670 | SHOW_STR |
8671 | BGP_STR | |
b05a1c8b DS |
8672 | "Summary of BGP neighbor status\n" |
8673 | "JavaScript Object Notation\n") | |
718e3744 | 8674 | { |
db7c8528 | 8675 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); |
718e3744 | 8676 | } |
8677 | ||
8678 | DEFUN (show_bgp_instance_summary, | |
8679 | show_bgp_instance_summary_cmd, | |
b05a1c8b | 8680 | "show bgp view WORD summary {json}", |
718e3744 | 8681 | SHOW_STR |
8682 | BGP_STR | |
8683 | "BGP view\n" | |
8684 | "View name\n" | |
b05a1c8b DS |
8685 | "Summary of BGP neighbor status\n" |
8686 | "JavaScript Object Notation\n") | |
718e3744 | 8687 | { |
db7c8528 | 8688 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, use_json(argc, argv)); |
718e3744 | 8689 | } |
8690 | ||
8691 | ALIAS (show_bgp_summary, | |
8692 | show_bgp_ipv6_summary_cmd, | |
b05a1c8b | 8693 | "show bgp ipv6 summary {json}", |
718e3744 | 8694 | SHOW_STR |
8695 | BGP_STR | |
8696 | "Address family\n" | |
8697 | "Summary of BGP neighbor status\n") | |
8698 | ||
8699 | ALIAS (show_bgp_instance_summary, | |
8700 | show_bgp_instance_ipv6_summary_cmd, | |
b05a1c8b | 8701 | "show bgp view WORD ipv6 summary {json}", |
718e3744 | 8702 | SHOW_STR |
8703 | BGP_STR | |
8704 | "BGP view\n" | |
8705 | "View name\n" | |
8706 | "Address family\n" | |
8707 | "Summary of BGP neighbor status\n") | |
8708 | ||
95cbbd2a ML |
8709 | DEFUN (show_bgp_ipv6_safi_summary, |
8710 | show_bgp_ipv6_safi_summary_cmd, | |
b05a1c8b | 8711 | "show bgp ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8712 | SHOW_STR |
8713 | BGP_STR | |
8714 | "Address family\n" | |
8715 | "Address Family modifier\n" | |
8716 | "Address Family modifier\n" | |
b05a1c8b DS |
8717 | "Summary of BGP neighbor status\n" |
8718 | "JavaScript Object Notation\n") | |
95cbbd2a | 8719 | { |
db7c8528 | 8720 | u_char uj = use_json(argc, argv); |
95cbbd2a | 8721 | if (strncmp (argv[0], "m", 1) == 0) |
db7c8528 | 8722 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); |
95cbbd2a | 8723 | |
db7c8528 | 8724 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); |
95cbbd2a ML |
8725 | } |
8726 | ||
8727 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
8728 | show_bgp_instance_ipv6_safi_summary_cmd, | |
b05a1c8b | 8729 | "show bgp view WORD ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8730 | SHOW_STR |
8731 | BGP_STR | |
8732 | "BGP view\n" | |
8733 | "View name\n" | |
8734 | "Address family\n" | |
8735 | "Address Family modifier\n" | |
8736 | "Address Family modifier\n" | |
b05a1c8b DS |
8737 | "Summary of BGP neighbor status\n" |
8738 | "JavaScript Object Notation\n") | |
95cbbd2a | 8739 | { |
db7c8528 | 8740 | u_char uj = use_json(argc, argv); |
95cbbd2a | 8741 | if (strncmp (argv[1], "m", 1) == 0) |
db7c8528 | 8742 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST, uj); |
95cbbd2a | 8743 | |
db7c8528 | 8744 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, uj); |
95cbbd2a ML |
8745 | } |
8746 | ||
718e3744 | 8747 | /* old command */ |
8748 | DEFUN (show_ipv6_bgp_summary, | |
8749 | show_ipv6_bgp_summary_cmd, | |
b05a1c8b | 8750 | "show ipv6 bgp summary {json}", |
718e3744 | 8751 | SHOW_STR |
8752 | IPV6_STR | |
8753 | BGP_STR | |
b05a1c8b DS |
8754 | "Summary of BGP neighbor status\n" |
8755 | "JavaScript Object Notation\n") | |
718e3744 | 8756 | { |
db7c8528 DS |
8757 | u_char uj = use_json(argc, argv); |
8758 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, uj); | |
718e3744 | 8759 | } |
8760 | ||
8761 | /* old command */ | |
8762 | DEFUN (show_ipv6_mbgp_summary, | |
8763 | show_ipv6_mbgp_summary_cmd, | |
b05a1c8b | 8764 | "show ipv6 mbgp summary {json}", |
718e3744 | 8765 | SHOW_STR |
8766 | IPV6_STR | |
8767 | MBGP_STR | |
b05a1c8b DS |
8768 | "Summary of BGP neighbor status\n" |
8769 | "JavaScript Object Notation\n") | |
718e3744 | 8770 | { |
db7c8528 DS |
8771 | u_char uj = use_json(argc, argv); |
8772 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, uj); | |
718e3744 | 8773 | } |
8774 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 8775 | |
fd79ac91 | 8776 | const char * |
538621f2 | 8777 | afi_safi_print (afi_t afi, safi_t safi) |
8778 | { | |
8779 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
8780 | return "IPv4 Unicast"; | |
8781 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
8782 | return "IPv4 Multicast"; | |
8783 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
8784 | return "VPNv4 Unicast"; | |
8785 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) | |
8786 | return "IPv6 Unicast"; | |
8787 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
8788 | return "IPv6 Multicast"; | |
8789 | else | |
8790 | return "Unknown"; | |
8791 | } | |
8792 | ||
718e3744 | 8793 | /* Show BGP peer's information. */ |
8794 | enum show_type | |
8795 | { | |
8796 | show_all, | |
8797 | show_peer | |
8798 | }; | |
8799 | ||
94f2b392 | 8800 | static void |
856ca177 MS |
8801 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
8802 | u_int16_t adv_smcap, u_int16_t adv_rmcap, u_int16_t rcv_smcap, | |
8803 | u_int16_t rcv_rmcap, u_char use_json, json_object *json_pref) | |
718e3744 | 8804 | { |
8805 | /* Send-Mode */ | |
8806 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
8807 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8808 | { | |
856ca177 MS |
8809 | if (use_json) |
8810 | { | |
8811 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8812 | json_object_string_add(json_pref, "sendMode", "advertisedAndReceived"); | |
8813 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
8814 | json_object_string_add(json_pref, "sendMode", "advertised"); | |
8815 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8816 | json_object_string_add(json_pref, "sendMode", "received"); | |
8817 | } | |
8818 | else | |
8819 | { | |
8820 | vty_out (vty, " Send-mode: "); | |
8821 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
8822 | vty_out (vty, "advertised"); | |
8823 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8824 | vty_out (vty, "%sreceived", | |
8825 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
8826 | ", " : ""); | |
8827 | vty_out (vty, "%s", VTY_NEWLINE); | |
8828 | } | |
718e3744 | 8829 | } |
8830 | ||
8831 | /* Receive-Mode */ | |
8832 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
8833 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
8834 | { | |
856ca177 MS |
8835 | if (use_json) |
8836 | { | |
8837 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
8838 | json_object_string_add(json_pref, "recvMode", "advertisedAndReceived"); | |
8839 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
8840 | json_object_string_add(json_pref, "recvMode", "advertised"); | |
8841 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
8842 | json_object_string_add(json_pref, "recvMode", "received"); | |
8843 | } | |
8844 | else | |
8845 | { | |
8846 | vty_out (vty, " Receive-mode: "); | |
8847 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
8848 | vty_out (vty, "advertised"); | |
8849 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
8850 | vty_out (vty, "%sreceived", | |
8851 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
8852 | ", " : ""); | |
8853 | vty_out (vty, "%s", VTY_NEWLINE); | |
8854 | } | |
718e3744 | 8855 | } |
8856 | } | |
8857 | ||
94f2b392 | 8858 | static void |
856ca177 MS |
8859 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
8860 | u_char use_json, json_object *json_neigh) | |
718e3744 | 8861 | { |
8862 | struct bgp_filter *filter; | |
3f9c7369 | 8863 | struct peer_af *paf; |
718e3744 | 8864 | char orf_pfx_name[BUFSIZ]; |
8865 | int orf_pfx_count; | |
856ca177 MS |
8866 | json_object *json_af = NULL; |
8867 | json_object *json_prefA = NULL; | |
8868 | json_object *json_prefB = NULL; | |
8869 | json_object *json_addr = NULL; | |
718e3744 | 8870 | |
856ca177 MS |
8871 | if (use_json) |
8872 | { | |
8873 | json_addr = json_object_new_object(); | |
8874 | json_af = json_object_new_object(); | |
8875 | json_prefA = json_object_new_object(); | |
8876 | json_prefB = json_object_new_object(); | |
8877 | filter = &p->filter[afi][safi]; | |
718e3744 | 8878 | |
c8560b44 | 8879 | if (peer_group_active(p)) |
856ca177 | 8880 | json_object_string_add(json_addr, "peerGroupMember", p->group->name); |
538621f2 | 8881 | |
856ca177 MS |
8882 | paf = peer_af_find(p, afi, safi); |
8883 | if (paf && PAF_SUBGRP(paf)) | |
8884 | { | |
8885 | json_object_int_add(json_addr, "updateGroupId", PAF_UPDGRP(paf)->id); | |
8886 | json_object_int_add(json_addr, "subGroupId", PAF_SUBGRP(paf)->id); | |
8887 | json_object_int_add(json_addr, "packetQueueLength", bpacket_queue_virtual_length(paf)); | |
8888 | } | |
8889 | ||
8890 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
8891 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
8892 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
8893 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
8894 | { | |
8895 | json_object_int_add(json_af, "orfType", ORF_TYPE_PREFIX); | |
8896 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
8897 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
8898 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
8899 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
8900 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, json_prefA); | |
8901 | json_object_object_add(json_af, "orfPrefixList", json_prefA); | |
8902 | } | |
8903 | ||
8904 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
8905 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
8906 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
8907 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
8908 | { | |
8909 | json_object_int_add(json_af, "orfOldType", ORF_TYPE_PREFIX_OLD); | |
8910 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
8911 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
8912 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
8913 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
8914 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, json_prefB); | |
8915 | json_object_object_add(json_af, "orfOldPrefixList", json_prefB); | |
8916 | } | |
8917 | ||
8918 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
8919 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
8920 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
8921 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
8922 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
8923 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
8924 | json_object_object_add(json_addr, "afDependentCap", json_af); | |
8925 | ||
8926 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
8927 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
8928 | ||
8929 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
8930 | || orf_pfx_count) | |
8931 | { | |
8932 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
8933 | json_object_boolean_true_add(json_neigh, "orfSent"); | |
8934 | if (orf_pfx_count) | |
8935 | json_object_int_add(json_addr, "orfRecvCounter", orf_pfx_count); | |
8936 | } | |
8937 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
8938 | json_object_string_add(json_addr, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd"); | |
8939 | ||
8940 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
8941 | json_object_boolean_true_add(json_addr, "routeReflectorClient"); | |
8942 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
8943 | json_object_boolean_true_add(json_addr, "routeServerClient"); | |
8944 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
8945 | json_object_boolean_true_add(json_addr, "inboundSoftConfigPermit"); | |
8946 | ||
88b8ed8d DW |
8947 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
8948 | json_object_boolean_true_add(json_addr, "privateAsNumsAllReplacedInUpdatesToNbr"); | |
8949 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 8950 | json_object_boolean_true_add(json_addr, "privateAsNumsReplacedInUpdatesToNbr"); |
88b8ed8d DW |
8951 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
8952 | json_object_boolean_true_add(json_addr, "privateAsNumsAllRemovedInUpdatesToNbr"); | |
856ca177 MS |
8953 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
8954 | json_object_boolean_true_add(json_addr, "privateAsNumsRemovedInUpdatesToNbr"); | |
8955 | ||
adbac85e DW |
8956 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) |
8957 | json_object_boolean_true_add(json_addr, "addpathTxAllPaths"); | |
8958 | ||
06370dac DW |
8959 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) |
8960 | json_object_boolean_true_add(json_addr, "addpathTxBestpathPerAS"); | |
8961 | ||
856ca177 MS |
8962 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
8963 | json_object_string_add(json_addr, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs"); | |
8964 | ||
8965 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
8966 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
8967 | json_object_boolean_true_add(json_addr, "routerAlwaysNextHop"); | |
8968 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
8969 | json_object_boolean_true_add(json_addr, "unchangedAsPathPropogatedToNbr"); | |
8970 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
8971 | json_object_boolean_true_add(json_addr, "unchangedNextHopPropogatedToNbr"); | |
8972 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
8973 | json_object_boolean_true_add(json_addr, "unchangedMedPropogatedToNbr"); | |
718e3744 | 8974 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
856ca177 MS |
8975 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
8976 | { | |
8977 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
8978 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
8979 | json_object_string_add(json_addr, "commAttriSentToNbr", "extendedAndStandard"); | |
8980 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
8981 | json_object_string_add(json_addr, "commAttriSentToNbr", "extended"); | |
8982 | else | |
8983 | json_object_string_add(json_addr, "commAttriSentToNbr", "standard"); | |
8984 | } | |
8985 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
8986 | { | |
8987 | if (p->default_rmap[afi][safi].name) | |
8988 | json_object_string_add(json_addr, "defaultRouteMap", p->default_rmap[afi][safi].name); | |
8989 | ||
8990 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
8991 | json_object_boolean_true_add(json_addr, "defaultSent"); | |
8992 | else | |
8993 | json_object_boolean_true_add(json_addr, "defaultNotSent"); | |
8994 | } | |
8995 | ||
8996 | if (filter->plist[FILTER_IN].name | |
8997 | || filter->dlist[FILTER_IN].name | |
8998 | || filter->aslist[FILTER_IN].name | |
8999 | || filter->map[RMAP_IN].name) | |
9000 | json_object_boolean_true_add(json_addr, "inboundPathPolicyConfig"); | |
9001 | if (filter->plist[FILTER_OUT].name | |
9002 | || filter->dlist[FILTER_OUT].name | |
9003 | || filter->aslist[FILTER_OUT].name | |
9004 | || filter->map[RMAP_OUT].name | |
9005 | || filter->usmap.name) | |
9006 | json_object_boolean_true_add(json_addr, "outboundPathPolicyConfig"); | |
856ca177 MS |
9007 | |
9008 | /* prefix-list */ | |
9009 | if (filter->plist[FILTER_IN].name) | |
9010 | json_object_string_add(json_addr, "incomingUpdatePrefixFilterList", filter->plist[FILTER_IN].name); | |
9011 | if (filter->plist[FILTER_OUT].name) | |
9012 | json_object_string_add(json_addr, "outgoingUpdatePrefixFilterList", filter->plist[FILTER_OUT].name); | |
9013 | ||
9014 | /* distribute-list */ | |
9015 | if (filter->dlist[FILTER_IN].name) | |
9016 | json_object_string_add(json_addr, "incomingUpdateNetworkFilterList", filter->dlist[FILTER_IN].name); | |
9017 | if (filter->dlist[FILTER_OUT].name) | |
9018 | json_object_string_add(json_addr, "outgoingUpdateNetworkFilterList", filter->dlist[FILTER_OUT].name); | |
9019 | ||
9020 | /* filter-list. */ | |
9021 | if (filter->aslist[FILTER_IN].name) | |
9022 | json_object_string_add(json_addr, "incomingUpdateAsPathFilterList", filter->aslist[FILTER_IN].name); | |
9023 | if (filter->aslist[FILTER_OUT].name) | |
9024 | json_object_string_add(json_addr, "outgoingUpdateAsPathFilterList", filter->aslist[FILTER_OUT].name); | |
9025 | ||
9026 | /* route-map. */ | |
9027 | if (filter->map[RMAP_IN].name) | |
9028 | json_object_string_add(json_addr, "routeMapForIncomingAdvertisements", filter->map[RMAP_IN].name); | |
9029 | if (filter->map[RMAP_OUT].name) | |
9030 | json_object_string_add(json_addr, "routeMapForOutgoingAdvertisements", filter->map[RMAP_OUT].name); | |
856ca177 MS |
9031 | |
9032 | /* unsuppress-map */ | |
9033 | if (filter->usmap.name) | |
9034 | json_object_string_add(json_addr, "selectiveUnsuppressRouteMap", filter->usmap.name); | |
9035 | ||
9036 | /* Receive prefix count */ | |
9037 | json_object_int_add(json_addr, "acceptedPrefixCounter", p->pcount[afi][safi]); | |
9038 | ||
9039 | /* Maximum prefix */ | |
9040 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
9041 | { | |
9042 | json_object_int_add(json_addr, "prefixAllowedMax", p->pmax[afi][safi]); | |
9043 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) | |
9044 | json_object_boolean_true_add(json_addr, "prefixAllowedMaxWarning"); | |
9045 | json_object_int_add(json_addr, "prefixAllowedWarningThresh", p->pmax_threshold[afi][safi]); | |
9046 | if (p->pmax_restart[afi][safi]) | |
9047 | json_object_int_add(json_addr, "prefixAllowedRestartIntervalMsecs", p->pmax_restart[afi][safi] * 60000); | |
9048 | } | |
9049 | json_object_object_add(json_neigh, afi_safi_print (afi, safi), json_addr); | |
9050 | ||
9051 | } | |
9052 | else | |
9053 | { | |
9054 | filter = &p->filter[afi][safi]; | |
9055 | ||
9056 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), | |
9057 | VTY_NEWLINE); | |
9058 | ||
c8560b44 | 9059 | if (peer_group_active(p)) |
856ca177 MS |
9060 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); |
9061 | ||
9062 | paf = peer_af_find(p, afi, safi); | |
9063 | if (paf && PAF_SUBGRP(paf)) | |
9064 | { | |
9065 | vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s", | |
9066 | PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE); | |
9067 | vty_out (vty, " Packet Queue length %d%s", | |
9068 | bpacket_queue_virtual_length(paf), VTY_NEWLINE); | |
9069 | } | |
718e3744 | 9070 | else |
856ca177 MS |
9071 | { |
9072 | vty_out(vty, " Not part of any update group%s", VTY_NEWLINE); | |
9073 | } | |
9074 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9075 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
9076 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
9077 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9078 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
9079 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
9080 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
9081 | ||
9082 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9083 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
9084 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9085 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
9086 | { | |
9087 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
9088 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
9089 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
9090 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
9091 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
9092 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
9093 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, NULL); | |
9094 | } | |
9095 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
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_OLD_RCV)) | |
9099 | { | |
9100 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
9101 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
9102 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
9103 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
9104 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
9105 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
9106 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, NULL); | |
9107 | } | |
718e3744 | 9108 | |
856ca177 MS |
9109 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
9110 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
718e3744 | 9111 | |
856ca177 MS |
9112 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
9113 | || orf_pfx_count) | |
9114 | { | |
9115 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
9116 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
9117 | vty_out (vty, " sent;"); | |
9118 | if (orf_pfx_count) | |
9119 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
9120 | vty_out (vty, "%s", VTY_NEWLINE); | |
9121 | } | |
9122 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
9123 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
9124 | ||
9125 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
9126 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
9127 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
9128 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
9129 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
9130 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
9131 | ||
88b8ed8d DW |
9132 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
9133 | vty_out (vty, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE); | |
9134 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 9135 | vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE); |
88b8ed8d DW |
9136 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
9137 | vty_out (vty, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE); | |
856ca177 MS |
9138 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
9139 | vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE); | |
9140 | ||
adbac85e DW |
9141 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_ALL_PATHS)) |
9142 | vty_out (vty, " Advertise all paths via addpath%s", VTY_NEWLINE); | |
9143 | ||
06370dac DW |
9144 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS)) |
9145 | vty_out (vty, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE); | |
9146 | ||
856ca177 MS |
9147 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
9148 | vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE); | |
9149 | ||
9150 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
9151 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
9152 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); | |
9153 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
9154 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
9155 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
9156 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
9157 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
9158 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
9159 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
9160 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9161 | { | |
9162 | vty_out (vty, " Community attribute sent to this neighbor"); | |
9163 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
9164 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9165 | vty_out (vty, "(both)%s", VTY_NEWLINE); | |
9166 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9167 | vty_out (vty, "(extended)%s", VTY_NEWLINE); | |
9168 | else | |
9169 | vty_out (vty, "(standard)%s", VTY_NEWLINE); | |
9170 | } | |
9171 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
9172 | { | |
9173 | vty_out (vty, " Default information originate,"); | |
9174 | ||
9175 | if (p->default_rmap[afi][safi].name) | |
9176 | vty_out (vty, " default route-map %s%s,", | |
9177 | p->default_rmap[afi][safi].map ? "*" : "", | |
9178 | p->default_rmap[afi][safi].name); | |
9179 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
9180 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
9181 | else | |
9182 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
9183 | } | |
718e3744 | 9184 | |
856ca177 MS |
9185 | if (filter->plist[FILTER_IN].name |
9186 | || filter->dlist[FILTER_IN].name | |
9187 | || filter->aslist[FILTER_IN].name | |
9188 | || filter->map[RMAP_IN].name) | |
9189 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); | |
9190 | if (filter->plist[FILTER_OUT].name | |
9191 | || filter->dlist[FILTER_OUT].name | |
9192 | || filter->aslist[FILTER_OUT].name | |
9193 | || filter->map[RMAP_OUT].name | |
9194 | || filter->usmap.name) | |
9195 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
856ca177 MS |
9196 | |
9197 | /* prefix-list */ | |
9198 | if (filter->plist[FILTER_IN].name) | |
9199 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
9200 | filter->plist[FILTER_IN].plist ? "*" : "", | |
9201 | filter->plist[FILTER_IN].name, | |
9202 | VTY_NEWLINE); | |
9203 | if (filter->plist[FILTER_OUT].name) | |
9204 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
9205 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
9206 | filter->plist[FILTER_OUT].name, | |
9207 | VTY_NEWLINE); | |
9208 | ||
9209 | /* distribute-list */ | |
9210 | if (filter->dlist[FILTER_IN].name) | |
9211 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
9212 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
9213 | filter->dlist[FILTER_IN].name, | |
9214 | VTY_NEWLINE); | |
9215 | if (filter->dlist[FILTER_OUT].name) | |
9216 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
9217 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
9218 | filter->dlist[FILTER_OUT].name, | |
9219 | VTY_NEWLINE); | |
9220 | ||
9221 | /* filter-list. */ | |
9222 | if (filter->aslist[FILTER_IN].name) | |
9223 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
9224 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
9225 | filter->aslist[FILTER_IN].name, | |
9226 | VTY_NEWLINE); | |
9227 | if (filter->aslist[FILTER_OUT].name) | |
9228 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
9229 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
9230 | filter->aslist[FILTER_OUT].name, | |
9231 | VTY_NEWLINE); | |
9232 | ||
9233 | /* route-map. */ | |
9234 | if (filter->map[RMAP_IN].name) | |
9235 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", | |
9236 | filter->map[RMAP_IN].map ? "*" : "", | |
9237 | filter->map[RMAP_IN].name, | |
9238 | VTY_NEWLINE); | |
9239 | if (filter->map[RMAP_OUT].name) | |
9240 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", | |
9241 | filter->map[RMAP_OUT].map ? "*" : "", | |
9242 | filter->map[RMAP_OUT].name, | |
9243 | VTY_NEWLINE); | |
856ca177 MS |
9244 | |
9245 | /* unsuppress-map */ | |
9246 | if (filter->usmap.name) | |
9247 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
9248 | filter->usmap.map ? "*" : "", | |
9249 | filter->usmap.name, VTY_NEWLINE); | |
9250 | ||
9251 | /* Receive prefix count */ | |
9252 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); | |
9253 | ||
9254 | /* Maximum prefix */ | |
9255 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
9256 | { | |
9257 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], | |
9258 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) | |
9259 | ? " (warning-only)" : "", VTY_NEWLINE); | |
9260 | vty_out (vty, " Threshold for warning message %d%%", | |
9261 | p->pmax_threshold[afi][safi]); | |
9262 | if (p->pmax_restart[afi][safi]) | |
9263 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
9264 | vty_out (vty, "%s", VTY_NEWLINE); | |
9265 | } | |
718e3744 | 9266 | |
0a486e5f | 9267 | vty_out (vty, "%s", VTY_NEWLINE); |
718e3744 | 9268 | } |
718e3744 | 9269 | } |
9270 | ||
94f2b392 | 9271 | static void |
856ca177 | 9272 | bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *json, json_object *json_neigh) |
718e3744 | 9273 | { |
9274 | struct bgp *bgp; | |
4690c7d7 | 9275 | char buf1[PREFIX2STR_BUFFER], buf[SU_ADDRSTRLEN]; |
718e3744 | 9276 | char timebuf[BGP_UPTIME_LEN]; |
f14e6fdb | 9277 | char dn_flag[2]; |
3a8c7ba1 DW |
9278 | const char *subcode_str; |
9279 | const char *code_str; | |
538621f2 | 9280 | afi_t afi; |
9281 | safi_t safi; | |
d6661008 DS |
9282 | u_int16_t i; |
9283 | u_char *msg; | |
718e3744 | 9284 | |
9285 | bgp = p->bgp; | |
9286 | ||
856ca177 | 9287 | if (!use_json) |
f14e6fdb | 9288 | { |
856ca177 MS |
9289 | if (p->conf_if) /* Configured interface name. */ |
9290 | vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if, | |
9291 | BGP_PEER_SU_UNSPEC(p) ? "None" : | |
9292 | sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
9293 | else /* Configured IP address. */ | |
9294 | { | |
9295 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
9296 | if (peer_dynamic_neighbor(p)) | |
9297 | dn_flag[0] = '*'; | |
f14e6fdb | 9298 | |
856ca177 MS |
9299 | vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host); |
9300 | } | |
f14e6fdb DS |
9301 | } |
9302 | ||
856ca177 MS |
9303 | if (use_json) |
9304 | { | |
9305 | if (p->conf_if && BGP_PEER_SU_UNSPEC(p)) | |
9306 | json_object_string_add(json_neigh, "bgpNeighborAddr", "none"); | |
9307 | else if (p->conf_if && !BGP_PEER_SU_UNSPEC(p)) | |
9308 | json_object_string_add(json_neigh, "bgpNeighborAddr", sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
9309 | ||
9310 | json_object_int_add(json_neigh, "remoteAs", p->as); | |
9311 | ||
9312 | if (p->change_local_as) | |
9313 | json_object_int_add(json_neigh, "localAs", p->change_local_as); | |
9314 | else | |
9315 | json_object_int_add(json_neigh, "localAs", p->local_as); | |
9316 | ||
9317 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND)) | |
9318 | json_object_boolean_true_add(json_neigh, "localAsNoPrepend"); | |
66b199b2 | 9319 | |
856ca177 MS |
9320 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS)) |
9321 | json_object_boolean_true_add(json_neigh, "localAsReplaceAs"); | |
9322 | } | |
9323 | else | |
9324 | { | |
f8cfafda DS |
9325 | if ((p->as_type == AS_SPECIFIED) || |
9326 | (p->as_type == AS_EXTERNAL) || | |
9327 | (p->as_type == AS_INTERNAL)) | |
9328 | vty_out (vty, "remote AS %u, ", p->as); | |
9329 | else | |
9330 | vty_out (vty, "remote AS Unspecified, "); | |
856ca177 MS |
9331 | vty_out (vty, "local AS %u%s%s, ", |
9332 | p->change_local_as ? p->change_local_as : p->local_as, | |
9333 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
9334 | " no-prepend" : "", | |
9335 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
9336 | " replace-as" : ""); | |
9337 | } | |
66b199b2 DS |
9338 | /* peer type internal, external, confed-internal or confed-external */ |
9339 | if (p->as == p->local_as) | |
9340 | { | |
856ca177 MS |
9341 | if (use_json) |
9342 | { | |
9343 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
9344 | json_object_boolean_true_add(json_neigh, "nbrConfedInternalLink"); | |
9345 | else | |
9346 | json_object_boolean_true_add(json_neigh, "nbrInternalLink"); | |
9347 | } | |
66b199b2 | 9348 | else |
856ca177 MS |
9349 | { |
9350 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
9351 | vty_out (vty, "confed-internal link%s", VTY_NEWLINE); | |
9352 | else | |
9353 | vty_out (vty, "internal link%s", VTY_NEWLINE); | |
9354 | } | |
66b199b2 DS |
9355 | } |
9356 | else | |
9357 | { | |
856ca177 MS |
9358 | if (use_json) |
9359 | { | |
9360 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
9361 | json_object_boolean_true_add(json_neigh, "nbrConfedExternalLink"); | |
9362 | else | |
9363 | json_object_boolean_true_add(json_neigh, "nbrExternalLink"); | |
9364 | } | |
66b199b2 | 9365 | else |
856ca177 MS |
9366 | { |
9367 | if (bgp_confederation_peers_check(bgp, p->as)) | |
9368 | vty_out (vty, "confed-external link%s", VTY_NEWLINE); | |
9369 | else | |
9370 | vty_out (vty, "external link%s", VTY_NEWLINE); | |
9371 | } | |
66b199b2 | 9372 | } |
718e3744 | 9373 | |
9374 | /* Description. */ | |
9375 | if (p->desc) | |
856ca177 MS |
9376 | { |
9377 | if (use_json) | |
9378 | json_object_string_add(json_neigh, "nbrDesc", p->desc); | |
9379 | else | |
9380 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
9381 | } | |
6410e93a | 9382 | |
04b6bdc0 DW |
9383 | if (p->hostname) |
9384 | { | |
9385 | if (p->domainname && (p->domainname[0] != '\0')) | |
9386 | vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname, | |
9387 | VTY_NEWLINE); | |
9388 | else | |
9389 | vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE); | |
9390 | } | |
9391 | ||
c744aa9f | 9392 | /* Peer-group */ |
718e3744 | 9393 | if (p->group) |
f14e6fdb | 9394 | { |
856ca177 MS |
9395 | if (use_json) |
9396 | { | |
9397 | json_object_string_add(json_neigh, "peerGroup", p->group->name); | |
9398 | ||
9399 | if (dn_flag[0]) | |
9400 | { | |
9401 | struct prefix *prefix = NULL, *range = NULL; | |
f14e6fdb | 9402 | |
856ca177 MS |
9403 | prefix = sockunion2hostprefix(&(p->su)); |
9404 | if (prefix) | |
9405 | range = peer_group_lookup_dynamic_neighbor_range (p->group, prefix); | |
9406 | ||
9407 | if (range) | |
9408 | { | |
9409 | prefix2str(range, buf1, sizeof(buf1)); | |
9410 | json_object_string_add(json_neigh, "peerSubnetRangeGroup", buf1); | |
9411 | } | |
9412 | } | |
9413 | } | |
9414 | else | |
f14e6fdb | 9415 | { |
856ca177 MS |
9416 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
9417 | p->group->name, VTY_NEWLINE); | |
f14e6fdb | 9418 | |
856ca177 | 9419 | if (dn_flag[0]) |
f14e6fdb | 9420 | { |
856ca177 MS |
9421 | struct prefix *prefix = NULL, *range = NULL; |
9422 | ||
9423 | prefix = sockunion2hostprefix(&(p->su)); | |
9424 | if (prefix) | |
9425 | range = peer_group_lookup_dynamic_neighbor_range (p->group, prefix); | |
9426 | ||
9427 | if (range) | |
9428 | { | |
9429 | prefix2str(range, buf1, sizeof(buf1)); | |
9430 | vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTY_NEWLINE); | |
9431 | } | |
f14e6fdb DS |
9432 | } |
9433 | } | |
9434 | } | |
718e3744 | 9435 | |
856ca177 MS |
9436 | if (use_json) |
9437 | { | |
9438 | /* Administrative shutdown. */ | |
9439 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
9440 | json_object_boolean_true_add(json_neigh, "adminShutDown"); | |
718e3744 | 9441 | |
856ca177 MS |
9442 | /* BGP Version. */ |
9443 | json_object_int_add(json_neigh, "bgpVersion", 4); | |
9444 | json_object_string_add(json_neigh, "remoteRouterId", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ)); | |
718e3744 | 9445 | |
856ca177 MS |
9446 | /* Confederation */ |
9447 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) && bgp_confederation_peers_check (bgp, p->as)) | |
9448 | json_object_boolean_true_add(json_neigh, "nbrCommonAdmin"); | |
9449 | ||
9450 | /* Status. */ | |
9451 | json_object_string_add(json_neigh, "bgpState", LOOKUP (bgp_status_msg, p->status)); | |
9452 | ||
9453 | if (p->status == Established) | |
9454 | { | |
9455 | time_t uptime; | |
9456 | struct tm *tm; | |
9457 | ||
9458 | uptime = bgp_clock(); | |
9459 | uptime -= p->uptime; | |
9460 | tm = gmtime(&uptime); | |
9461 | ||
9462 | json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
9463 | } | |
9464 | ||
9465 | else if (p->status == Active) | |
9466 | { | |
9467 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
9468 | json_object_string_add(json_neigh, "bgpStateIs", "passive"); | |
9469 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
9470 | json_object_string_add(json_neigh, "bgpStateIs", "passiveNSF"); | |
9471 | } | |
9472 | ||
9473 | /* read timer */ | |
9474 | time_t uptime; | |
9475 | struct tm *tm; | |
9476 | ||
9477 | uptime = bgp_clock(); | |
9478 | uptime -= p->readtime; | |
9479 | tm = gmtime(&uptime); | |
9480 | json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
9481 | ||
9482 | uptime = bgp_clock(); | |
9483 | uptime -= p->last_write; | |
9484 | tm = gmtime(&uptime); | |
9485 | json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
9486 | ||
9487 | /* Configured timer values. */ | |
9488 | json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs", p->v_holdtime * 1000); | |
9489 | json_object_int_add(json_neigh, "bgpTimerKeepAliveIntervalMsecs", p->v_keepalive * 1000); | |
9490 | ||
9491 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
9492 | { | |
9493 | json_object_int_add(json_neigh, "bgpTimerConfiguredHoldTimeMsecs", p->holdtime * 1000); | |
9494 | json_object_int_add(json_neigh, "bgpTimerConfiguredKeepAliveIntervalMsecs", p->keepalive * 1000); | |
9495 | } | |
93406d87 | 9496 | } |
856ca177 MS |
9497 | else |
9498 | { | |
9499 | /* Administrative shutdown. */ | |
9500 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
9501 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
9502 | ||
9503 | /* BGP Version. */ | |
9504 | vty_out (vty, " BGP version 4"); | |
9505 | vty_out (vty, ", remote router ID %s%s", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
9506 | VTY_NEWLINE); | |
9507 | ||
9508 | /* Confederation */ | |
9509 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) | |
9510 | && bgp_confederation_peers_check (bgp, p->as)) | |
9511 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); | |
718e3744 | 9512 | |
856ca177 MS |
9513 | /* Status. */ |
9514 | vty_out (vty, " BGP state = %s", LOOKUP (bgp_status_msg, p->status)); | |
718e3744 | 9515 | |
856ca177 MS |
9516 | if (p->status == Established) |
9517 | vty_out (vty, ", up for %8s", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
9518 | ||
9519 | else if (p->status == Active) | |
9520 | { | |
9521 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
9522 | vty_out (vty, " (passive)"); | |
9523 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
9524 | vty_out (vty, " (NSF passive)"); | |
9525 | } | |
9526 | vty_out (vty, "%s", VTY_NEWLINE); | |
93406d87 | 9527 | |
856ca177 MS |
9528 | /* read timer */ |
9529 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
9530 | vty_out (vty, ", Last write %s%s", | |
9531 | peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTY_NEWLINE); | |
9532 | ||
9533 | /* Configured timer values. */ | |
9534 | vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s", | |
9535 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); | |
9536 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
9537 | { | |
9538 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
9539 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
9540 | p->keepalive, VTY_NEWLINE); | |
9541 | } | |
9542 | } | |
718e3744 | 9543 | /* Capability. */ |
9544 | if (p->status == Established) | |
9545 | { | |
538621f2 | 9546 | if (p->cap |
718e3744 | 9547 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
9548 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
9549 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
9550 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
9551 | #ifdef HAVE_IPV6 | |
9552 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
9553 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
9554 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
9555 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
9556 | #endif /* HAVE_IPV6 */ | |
9557 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] | |
9558 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
9559 | { | |
856ca177 MS |
9560 | if (use_json) |
9561 | { | |
9562 | json_object *json_cap = NULL; | |
9563 | ||
9564 | json_cap = json_object_new_object(); | |
9565 | ||
9566 | /* AS4 */ | |
9567 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
9568 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9569 | { | |
9570 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) && CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
9571 | json_object_string_add(json_cap, "4byteAs", "advertisedAndReceived"); | |
9572 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9573 | json_object_string_add(json_cap, "4byteAs", "advertised"); | |
9574 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
9575 | json_object_string_add(json_cap, "4byteAs", "received"); | |
9576 | } | |
9577 | ||
9578 | /* AddPath */ | |
9579 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
9580 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
9581 | { | |
9582 | json_object *json_add = NULL; | |
9583 | const char *print_store; | |
718e3744 | 9584 | |
856ca177 | 9585 | json_add = json_object_new_object(); |
a82478b9 | 9586 | |
856ca177 MS |
9587 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
9588 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9589 | { | |
9590 | json_object *json_sub = NULL; | |
9591 | json_sub = json_object_new_object(); | |
9592 | print_store = afi_safi_print (afi, safi); | |
9593 | ||
9594 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
9595 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
9596 | { | |
9597 | 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)) | |
9598 | json_object_boolean_true_add(json_sub, "txAdvertisedAndReceived"); | |
9599 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) | |
9600 | json_object_boolean_true_add(json_sub, "txAdvertised"); | |
9601 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
9602 | json_object_boolean_true_add(json_sub, "txReceived"); | |
9603 | } | |
9604 | ||
9605 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
9606 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9607 | { | |
9608 | 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)) | |
9609 | json_object_boolean_true_add(json_sub, "rxAdvertisedAndReceived"); | |
9610 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) | |
9611 | json_object_boolean_true_add(json_sub, "rxAdvertised"); | |
9612 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9613 | json_object_boolean_true_add(json_sub, "rxReceived"); | |
9614 | } | |
9615 | ||
9616 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
9617 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV) || | |
9618 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
9619 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9620 | json_object_object_add(json_add, print_store, json_sub); | |
9621 | } | |
a82478b9 | 9622 | |
856ca177 MS |
9623 | json_object_object_add(json_cap, "addPath", json_add); |
9624 | } | |
9625 | ||
9626 | /* Dynamic */ | |
9627 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
9628 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9629 | { | |
9630 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) && CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
9631 | json_object_string_add(json_cap, "dynamic", "advertisedAndReceived"); | |
9632 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9633 | json_object_string_add(json_cap, "dynamic", "advertised"); | |
9634 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
9635 | json_object_string_add(json_cap, "dynamic", "received"); | |
9636 | } | |
9637 | ||
9638 | /* Extended nexthop */ | |
9639 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
9640 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
9641 | { | |
9642 | json_object *json_nxt = NULL; | |
9643 | const char *print_store; | |
9644 | ||
9645 | json_nxt = json_object_new_object(); | |
9646 | ||
9647 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) && CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
9648 | json_object_string_add(json_cap, "extendedNexthop", "advertisedAndReceived"); | |
9649 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
9650 | json_object_string_add(json_cap, "extendedNexthop", "advertised"); | |
9651 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
9652 | json_object_string_add(json_cap, "extendedNexthop", "received"); | |
9653 | ||
9654 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
9655 | { | |
9656 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9657 | { | |
9658 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
9659 | { | |
9660 | print_store = afi_safi_print (AFI_IP, safi); | |
9661 | json_object_string_add(json_nxt, print_store, "recieved"); | |
9662 | } | |
9663 | } | |
9664 | json_object_object_add(json_cap, "extendedNexthopFamililesByPeer", json_nxt); | |
9665 | } | |
9666 | } | |
9667 | ||
9668 | /* Route Refresh */ | |
9669 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
9670 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
9671 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9672 | { | |
9673 | 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))) | |
9674 | { | |
9675 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) | |
9676 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOldNew"); | |
9677 | else | |
9678 | { | |
9679 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9680 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOld"); | |
9681 | else | |
9682 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedNew"); | |
9683 | } | |
9684 | } | |
9685 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
9686 | json_object_string_add(json_cap, "routeRefresh", "advertised"); | |
9687 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9688 | json_object_string_add(json_cap, "routeRefresh", "received"); | |
9689 | } | |
9690 | ||
9691 | /* Multiprotocol Extensions */ | |
9692 | json_object *json_multi = NULL; | |
9693 | json_multi = json_object_new_object(); | |
9694 | ||
9695 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9696 | { | |
9697 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9698 | { | |
9699 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
9700 | { | |
9701 | json_object *json_exten = NULL; | |
9702 | json_exten = json_object_new_object(); | |
9703 | ||
9704 | if (p->afc_adv[afi][safi] && p->afc_recv[afi][safi]) | |
9705 | json_object_boolean_true_add(json_exten, "advertisedAndReceived"); | |
9706 | else if (p->afc_adv[afi][safi]) | |
9707 | json_object_boolean_true_add(json_exten, "advertised"); | |
9708 | else if (p->afc_recv[afi][safi]) | |
9709 | json_object_boolean_true_add(json_exten, "received"); | |
9710 | ||
9711 | json_object_object_add(json_multi, afi_safi_print (afi, safi), json_exten); | |
9712 | } | |
9713 | } | |
9714 | } | |
9715 | json_object_object_add(json_cap, "multiprotocolExtensions", json_multi); | |
9716 | ||
9717 | /* Gracefull Restart */ | |
9718 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
9719 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
9720 | { | |
9721 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) && CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
9722 | json_object_string_add(json_cap, "gracefulRestart", "advertisedAndReceived"); | |
9723 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
9724 | json_object_string_add(json_cap, "gracefulRestartCapability", "advertised"); | |
9725 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
9726 | json_object_string_add(json_cap, "gracefulRestartCapability", "received"); | |
9727 | ||
9728 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
9729 | { | |
9730 | int restart_af_count = 0; | |
9731 | json_object *json_restart = NULL; | |
9732 | json_restart = json_object_new_object(); | |
9733 | ||
9734 | json_object_int_add(json_cap, "gracefulRestartRemoteTimerMsecs", p->v_gr_restart * 1000); | |
9735 | ||
9736 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9737 | { | |
9738 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9739 | { | |
9740 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
9741 | { | |
9742 | json_object *json_sub = NULL; | |
9743 | json_sub = json_object_new_object(); | |
9744 | ||
9745 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV)) | |
9746 | json_object_boolean_true_add(json_sub, "preserved"); | |
9747 | restart_af_count++; | |
9748 | json_object_object_add(json_restart, afi_safi_print (afi, safi), json_sub); | |
9749 | } | |
9750 | } | |
9751 | } | |
9752 | if (! restart_af_count) | |
9753 | json_object_string_add(json_cap, "addressFamiliesByPeer", "none"); | |
9754 | else | |
9755 | json_object_object_add(json_cap, "addressFamiliesByPeer", json_restart); | |
9756 | } | |
9757 | } | |
9758 | json_object_object_add(json_neigh, "neighborCapabilities", json_cap); | |
9759 | } | |
9760 | else | |
9761 | { | |
9762 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
9763 | ||
9764 | /* AS4 */ | |
9765 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
9766 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9767 | { | |
9768 | vty_out (vty, " 4 Byte AS:"); | |
9769 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9770 | vty_out (vty, " advertised"); | |
9771 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
9772 | vty_out (vty, " %sreceived", | |
9773 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
9774 | vty_out (vty, "%s", VTY_NEWLINE); | |
9775 | } | |
9776 | ||
9777 | /* AddPath */ | |
9778 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
9779 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
9780 | { | |
9781 | vty_out (vty, " AddPath:%s", VTY_NEWLINE); | |
a82478b9 | 9782 | |
856ca177 MS |
9783 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
9784 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
a82478b9 | 9785 | { |
856ca177 MS |
9786 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || |
9787 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
9788 | { | |
9789 | vty_out (vty, " %s: TX ", afi_safi_print (afi, safi)); | |
a82478b9 | 9790 | |
856ca177 MS |
9791 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) |
9792 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 9793 | |
856ca177 MS |
9794 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) |
9795 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" ); | |
a82478b9 | 9796 | |
856ca177 MS |
9797 | vty_out (vty, "%s", VTY_NEWLINE); |
9798 | } | |
a82478b9 | 9799 | |
856ca177 | 9800 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || |
a82478b9 | 9801 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
856ca177 MS |
9802 | { |
9803 | vty_out (vty, " %s: RX ", afi_safi_print (afi, safi)); | |
a82478b9 | 9804 | |
856ca177 MS |
9805 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) |
9806 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 9807 | |
856ca177 MS |
9808 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
9809 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" ); | |
a82478b9 | 9810 | |
856ca177 MS |
9811 | vty_out (vty, "%s", VTY_NEWLINE); |
9812 | } | |
a82478b9 | 9813 | } |
856ca177 | 9814 | } |
a82478b9 | 9815 | |
856ca177 MS |
9816 | /* Dynamic */ |
9817 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
9818 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9819 | { | |
9820 | vty_out (vty, " Dynamic:"); | |
9821 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9822 | vty_out (vty, " advertised"); | |
9823 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
9824 | vty_out (vty, " %sreceived", | |
9825 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
9826 | vty_out (vty, "%s", VTY_NEWLINE); | |
9827 | } | |
9828 | ||
9829 | /* Extended nexthop */ | |
9830 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
9831 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
9832 | { | |
9833 | vty_out (vty, " Extended nexthop:"); | |
9834 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
9835 | vty_out (vty, " advertised"); | |
9836 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
9837 | vty_out (vty, " %sreceived", | |
9838 | CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) ? "and " : ""); | |
9839 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 9840 | |
856ca177 MS |
9841 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) |
9842 | { | |
9843 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
9844 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9845 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
9846 | vty_out (vty, " %s%s", | |
9847 | afi_safi_print (AFI_IP, safi), VTY_NEWLINE); | |
9848 | } | |
9849 | } | |
8a92a8a0 | 9850 | |
856ca177 MS |
9851 | /* Route Refresh */ |
9852 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
9853 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
9854 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9855 | { | |
9856 | vty_out (vty, " Route refresh:"); | |
9857 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
9858 | vty_out (vty, " advertised"); | |
9859 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
9860 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9861 | vty_out (vty, " %sreceived(%s)", | |
9862 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
9863 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
9864 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
9865 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
8a92a8a0 | 9866 | |
856ca177 MS |
9867 | vty_out (vty, "%s", VTY_NEWLINE); |
9868 | } | |
718e3744 | 9869 | |
856ca177 MS |
9870 | /* Multiprotocol Extensions */ |
9871 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9872 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9873 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
9874 | { | |
9875 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); | |
9876 | if (p->afc_adv[afi][safi]) | |
9877 | vty_out (vty, " advertised"); | |
9878 | if (p->afc_recv[afi][safi]) | |
9879 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
9880 | vty_out (vty, "%s", VTY_NEWLINE); | |
9881 | } | |
538621f2 | 9882 | |
04b6bdc0 DW |
9883 | /* Hostname capability */ |
9884 | if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV) || | |
9885 | CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) | |
9886 | { | |
9887 | vty_out (vty, " Hostname Capability:"); | |
9888 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV)) | |
9889 | vty_out (vty, " advertised"); | |
9890 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_RCV)) | |
9891 | vty_out (vty, " %sreceived", | |
9892 | CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV) ? "and " : ""); | |
9893 | vty_out (vty, "%s", VTY_NEWLINE); | |
9894 | } | |
9895 | ||
856ca177 MS |
9896 | /* Gracefull Restart */ |
9897 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
9898 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
9899 | { | |
9900 | vty_out (vty, " Graceful Restart Capabilty:"); | |
9901 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
538621f2 | 9902 | vty_out (vty, " advertised"); |
856ca177 MS |
9903 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
9904 | vty_out (vty, " %sreceived", | |
9905 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
9906 | vty_out (vty, "%s", VTY_NEWLINE); | |
538621f2 | 9907 | |
856ca177 MS |
9908 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
9909 | { | |
9910 | int restart_af_count = 0; | |
9911 | ||
9912 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
9913 | p->v_gr_restart, VTY_NEWLINE); | |
9914 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
9915 | ||
9916 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9917 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9918 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
9919 | { | |
9920 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", | |
9921 | afi_safi_print (afi, safi), | |
9922 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
9923 | "preserved" : "not preserved"); | |
9924 | restart_af_count++; | |
9925 | } | |
9926 | if (! restart_af_count) | |
9927 | vty_out (vty, "none"); | |
9928 | vty_out (vty, "%s", VTY_NEWLINE); | |
9929 | } | |
9930 | } | |
9931 | } | |
718e3744 | 9932 | } |
9933 | } | |
9934 | ||
93406d87 | 9935 | /* graceful restart information */ |
9936 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
9937 | || p->t_gr_restart | |
9938 | || p->t_gr_stale) | |
9939 | { | |
856ca177 MS |
9940 | json_object *json_grace = NULL; |
9941 | json_object *json_grace_send = NULL; | |
9942 | json_object *json_grace_recv = NULL; | |
93406d87 | 9943 | int eor_send_af_count = 0; |
9944 | int eor_receive_af_count = 0; | |
9945 | ||
856ca177 MS |
9946 | if (use_json) |
9947 | { | |
9948 | json_grace = json_object_new_object(); | |
9949 | json_grace_send = json_object_new_object(); | |
9950 | json_grace_recv = json_object_new_object(); | |
9951 | ||
9952 | if (p->status == Established) | |
9953 | { | |
9954 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9955 | { | |
9956 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9957 | { | |
9958 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
9959 | { | |
9960 | json_object_boolean_true_add(json_grace_send, afi_safi_print (afi, safi)); | |
9961 | eor_send_af_count++; | |
9962 | } | |
9963 | } | |
9964 | } | |
9965 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9966 | { | |
9967 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9968 | { | |
9969 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
9970 | { | |
9971 | json_object_boolean_true_add(json_grace_recv, afi_safi_print (afi, safi)); | |
9972 | eor_receive_af_count++; | |
9973 | } | |
9974 | } | |
9975 | } | |
9976 | } | |
9977 | ||
9978 | json_object_object_add(json_grace, "endOfRibSend", json_grace_send); | |
9979 | json_object_object_add(json_grace, "endOfRibRecv", json_grace_recv); | |
9980 | ||
9981 | if (p->t_gr_restart) | |
9982 | json_object_int_add(json_grace, "gracefulRestartTimerMsecs", thread_timer_remain_second (p->t_gr_restart) * 1000); | |
9983 | ||
9984 | if (p->t_gr_stale) | |
9985 | json_object_int_add(json_grace, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p->t_gr_stale) * 1000); | |
9986 | ||
9987 | json_object_object_add(json_neigh, "gracefulRestartInfo", json_grace); | |
9988 | } | |
9989 | else | |
9990 | { | |
9991 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
9992 | if (p->status == Established) | |
9993 | { | |
9994 | vty_out (vty, " End-of-RIB send: "); | |
9995 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9996 | { | |
9997 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9998 | { | |
9999 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
10000 | { | |
10001 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
10002 | afi_safi_print (afi, safi)); | |
10003 | eor_send_af_count++; | |
10004 | } | |
10005 | } | |
10006 | } | |
10007 | vty_out (vty, "%s", VTY_NEWLINE); | |
10008 | vty_out (vty, " End-of-RIB received: "); | |
10009 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10010 | { | |
10011 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10012 | { | |
10013 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
10014 | { | |
10015 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
10016 | afi_safi_print (afi, safi)); | |
10017 | eor_receive_af_count++; | |
10018 | } | |
10019 | } | |
10020 | } | |
10021 | vty_out (vty, "%s", VTY_NEWLINE); | |
10022 | } | |
93406d87 | 10023 | |
856ca177 MS |
10024 | if (p->t_gr_restart) |
10025 | vty_out (vty, " The remaining time of restart timer is %ld%s", | |
10026 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
0b2aa3a0 | 10027 | |
856ca177 MS |
10028 | if (p->t_gr_stale) |
10029 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", | |
10030 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
10031 | } | |
10032 | } | |
10033 | if (use_json) | |
10034 | { | |
10035 | json_object *json_stat = NULL; | |
10036 | json_stat = json_object_new_object(); | |
10037 | /* Packet counts. */ | |
10038 | json_object_int_add(json_stat, "depthInq", 0); | |
10039 | json_object_int_add(json_stat, "depthOutq", (unsigned long) p->obuf->count); | |
10040 | json_object_int_add(json_stat, "opensSent", p->open_out); | |
10041 | json_object_int_add(json_stat, "opensRecv", p->open_in); | |
10042 | json_object_int_add(json_stat, "notificationsSent", p->notify_out); | |
10043 | json_object_int_add(json_stat, "notificationsRecv", p->notify_in); | |
10044 | json_object_int_add(json_stat, "updatesSent", p->update_out); | |
10045 | json_object_int_add(json_stat, "updatesRecv", p->update_in); | |
10046 | json_object_int_add(json_stat, "keepalivesSent", p->keepalive_out); | |
10047 | json_object_int_add(json_stat, "keepalivesRecv", p->keepalive_in); | |
10048 | json_object_int_add(json_stat, "routeRefreshSent", p->refresh_out); | |
10049 | json_object_int_add(json_stat, "routeRefreshRecv", p->refresh_in); | |
10050 | json_object_int_add(json_stat, "capabilitySent", p->dynamic_cap_out); | |
10051 | json_object_int_add(json_stat, "capabilityRecv", p->dynamic_cap_in); | |
10052 | 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); | |
10053 | 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); | |
10054 | json_object_object_add(json_neigh, "messageStats", json_stat); | |
10055 | } | |
10056 | else | |
10057 | { | |
10058 | /* Packet counts. */ | |
10059 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); | |
10060 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
10061 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); | |
10062 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); | |
10063 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
10064 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
10065 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
10066 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
10067 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
10068 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
10069 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
10070 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
10071 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
10072 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 10073 | } |
10074 | ||
856ca177 MS |
10075 | if (use_json) |
10076 | { | |
10077 | /* advertisement-interval */ | |
10078 | json_object_int_add(json_neigh, "minBtwnAdvertisementRunsTimerMsecs", p->v_routeadv * 1000); | |
718e3744 | 10079 | |
856ca177 MS |
10080 | /* Update-source. */ |
10081 | if (p->update_if || p->update_source) | |
10082 | { | |
10083 | if (p->update_if) | |
10084 | json_object_string_add(json_neigh, "updateSource", p->update_if); | |
10085 | else if (p->update_source) | |
10086 | json_object_string_add(json_neigh, "updateSource", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
10087 | } | |
10088 | ||
10089 | /* Default weight */ | |
10090 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
10091 | json_object_int_add(json_neigh, "defaultWeight", p->weight); | |
10092 | ||
10093 | } | |
10094 | else | |
10095 | { | |
10096 | /* advertisement-interval */ | |
10097 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
10098 | p->v_routeadv, VTY_NEWLINE); | |
10099 | ||
10100 | /* Update-source. */ | |
10101 | if (p->update_if || p->update_source) | |
10102 | { | |
10103 | vty_out (vty, " Update source is "); | |
10104 | if (p->update_if) | |
10105 | vty_out (vty, "%s", p->update_if); | |
10106 | else if (p->update_source) | |
10107 | vty_out (vty, "%s", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
10108 | vty_out (vty, "%s", VTY_NEWLINE); | |
10109 | } | |
10110 | ||
10111 | /* Default weight */ | |
10112 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
10113 | vty_out (vty, " Default weight %d%s", p->weight, VTY_NEWLINE); | |
10114 | ||
10115 | vty_out (vty, "%s", VTY_NEWLINE); | |
10116 | } | |
718e3744 | 10117 | |
10118 | /* Address Family Information */ | |
856ca177 MS |
10119 | json_object *json_hold = NULL; |
10120 | ||
10121 | if (use_json) | |
10122 | json_hold = json_object_new_object(); | |
10123 | ||
538621f2 | 10124 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
10125 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10126 | if (p->afc[afi][safi]) | |
856ca177 | 10127 | bgp_show_peer_afi (vty, p, afi, safi, use_json, json_hold); |
718e3744 | 10128 | |
856ca177 MS |
10129 | if (use_json) |
10130 | { | |
10131 | json_object_int_add(json_hold, "connectionsEstablished", p->established); | |
10132 | json_object_int_add(json_hold, "connectionsDropped", p->dropped); | |
10133 | } | |
10134 | else | |
10135 | vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped, | |
10136 | VTY_NEWLINE); | |
718e3744 | 10137 | |
d6661008 | 10138 | if (! p->last_reset) |
856ca177 MS |
10139 | { |
10140 | if (use_json) | |
10141 | json_object_string_add(json_hold, "lastReset", "never"); | |
10142 | else | |
10143 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); | |
10144 | } | |
e0701b79 | 10145 | else |
d6661008 | 10146 | { |
856ca177 MS |
10147 | if (use_json) |
10148 | { | |
10149 | time_t uptime; | |
10150 | struct tm *tm; | |
10151 | ||
10152 | uptime = bgp_clock(); | |
10153 | uptime -= p->resettime; | |
10154 | tm = gmtime(&uptime); | |
10155 | json_object_int_add(json_hold, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
10156 | json_object_string_add(json_hold, "lastResetDueTo", peer_down_str[(int) p->last_reset]); | |
10157 | if (p->last_reset_cause_size) | |
10158 | { | |
10159 | msg = p->last_reset_cause; | |
10160 | char adapter[BUFSIZ]; | |
10161 | sprintf(adapter, "%s", msg); | |
10162 | json_object_string_add(json_hold, "messageReceivedThatCausedBgpNotification", adapter); | |
10163 | } | |
10164 | } | |
10165 | else | |
d6661008 | 10166 | { |
3a8c7ba1 DW |
10167 | vty_out (vty, " Last reset %s, ", |
10168 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
10169 | ||
10170 | if (p->last_reset == PEER_DOWN_NOTIFY_SEND || | |
10171 | p->last_reset == PEER_DOWN_NOTIFY_RECEIVED) | |
10172 | { | |
10173 | code_str = bgp_notify_code_str(p->notify.code); | |
10174 | subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode); | |
10175 | vty_out (vty, "due to NOTIFICATION %s (%s%s)%s", | |
10176 | p->last_reset == PEER_DOWN_NOTIFY_SEND ? "sent" : "received", | |
10177 | code_str, subcode_str, VTY_NEWLINE); | |
10178 | } | |
10179 | else | |
10180 | { | |
10181 | vty_out (vty, "due to %s%s", | |
10182 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
10183 | } | |
856ca177 MS |
10184 | |
10185 | if (p->last_reset_cause_size) | |
d6661008 | 10186 | { |
856ca177 MS |
10187 | msg = p->last_reset_cause; |
10188 | vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); | |
10189 | for (i = 1; i <= p->last_reset_cause_size; i++) | |
10190 | { | |
10191 | vty_out(vty, "%02X", *msg++); | |
d6661008 | 10192 | |
856ca177 MS |
10193 | if (i != p->last_reset_cause_size) |
10194 | { | |
10195 | if (i % 16 == 0) | |
10196 | { | |
10197 | vty_out(vty, "%s ", VTY_NEWLINE); | |
10198 | } | |
10199 | else if (i % 4 == 0) | |
10200 | { | |
10201 | vty_out(vty, " "); | |
10202 | } | |
10203 | } | |
10204 | } | |
10205 | vty_out(vty, "%s", VTY_NEWLINE); | |
d6661008 | 10206 | } |
d6661008 DS |
10207 | } |
10208 | } | |
848973c7 | 10209 | |
718e3744 | 10210 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
10211 | { | |
856ca177 MS |
10212 | if (use_json) |
10213 | json_object_boolean_true_add(json_hold, "prefixesConfigExceedMax"); | |
10214 | else | |
10215 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 10216 | |
10217 | if (p->t_pmax_restart) | |
856ca177 MS |
10218 | { |
10219 | if (use_json) | |
10220 | { | |
10221 | json_object_string_add(json_hold, "reducePrefixNumFrom", p->host); | |
10222 | json_object_int_add(json_hold, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); | |
10223 | } | |
10224 | else | |
10225 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
10226 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
10227 | VTY_NEWLINE); | |
10228 | } | |
0a486e5f | 10229 | else |
856ca177 MS |
10230 | { |
10231 | if (use_json) | |
10232 | json_object_string_add(json_hold, "reducePrefixNumAndClearIpBgp", p->host); | |
10233 | else | |
10234 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
10235 | p->host, VTY_NEWLINE); | |
10236 | } | |
718e3744 | 10237 | } |
10238 | ||
856ca177 MS |
10239 | if (use_json) |
10240 | json_object_object_add(json_neigh, "addressFamilyInfo", json_hold); | |
10241 | ||
f5a4827d | 10242 | /* EBGP Multihop and GTSM */ |
6d85b15b | 10243 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d | 10244 | { |
856ca177 MS |
10245 | if (use_json) |
10246 | { | |
10247 | if (p->gtsm_hops > 0) | |
10248 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->gtsm_hops); | |
10249 | else if (p->ttl > 1) | |
10250 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->ttl); | |
10251 | } | |
10252 | else | |
10253 | { | |
10254 | if (p->gtsm_hops > 0) | |
10255 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
10256 | p->gtsm_hops, VTY_NEWLINE); | |
10257 | else if (p->ttl > 1) | |
10258 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
10259 | p->ttl, VTY_NEWLINE); | |
10260 | } | |
f5a4827d | 10261 | } |
5d804b43 PM |
10262 | else |
10263 | { | |
10264 | if (p->gtsm_hops > 0) | |
856ca177 MS |
10265 | { |
10266 | if (use_json) | |
10267 | json_object_int_add(json_neigh, "internalBgpNbrMaxHopsAway", p->gtsm_hops); | |
10268 | else | |
10269 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
10270 | p->gtsm_hops, VTY_NEWLINE); | |
10271 | } | |
5d804b43 | 10272 | } |
718e3744 | 10273 | |
10274 | /* Local address. */ | |
10275 | if (p->su_local) | |
10276 | { | |
856ca177 MS |
10277 | if (use_json) |
10278 | { | |
10279 | json_object_string_add(json_neigh, "hostLocal", sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN)); | |
10280 | json_object_int_add(json_neigh, "portLocal", ntohs (p->su_local->sin.sin_port)); | |
10281 | } | |
10282 | else | |
10283 | vty_out (vty, "Local host: %s, Local port: %d%s", | |
10284 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), | |
10285 | ntohs (p->su_local->sin.sin_port), | |
10286 | VTY_NEWLINE); | |
718e3744 | 10287 | } |
10288 | ||
10289 | /* Remote address. */ | |
10290 | if (p->su_remote) | |
10291 | { | |
856ca177 MS |
10292 | if (use_json) |
10293 | { | |
10294 | json_object_string_add(json_neigh, "hostForeign", sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN)); | |
10295 | json_object_int_add(json_neigh, "portForeign", ntohs (p->su_remote->sin.sin_port)); | |
10296 | } | |
10297 | else | |
10298 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
718e3744 | 10299 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
10300 | ntohs (p->su_remote->sin.sin_port), | |
10301 | VTY_NEWLINE); | |
10302 | } | |
10303 | ||
10304 | /* Nexthop display. */ | |
10305 | if (p->su_local) | |
10306 | { | |
856ca177 MS |
10307 | if (use_json) |
10308 | { | |
10309 | json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ)); | |
718e3744 | 10310 | #ifdef HAVE_IPV6 |
856ca177 MS |
10311 | json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ)); |
10312 | json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ)); | |
10313 | if (p->shared_network) | |
10314 | json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork"); | |
10315 | else | |
10316 | json_object_string_add(json_neigh, "bgpConnection", "nonSharedNetwork"); | |
10317 | #endif /* HAVE_IPV6 */ | |
10318 | } | |
10319 | else | |
10320 | { | |
10321 | vty_out (vty, "Nexthop: %s%s", | |
10322 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
10323 | VTY_NEWLINE); | |
10324 | #ifdef HAVE_IPV6 | |
10325 | vty_out (vty, "Nexthop global: %s%s", | |
10326 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
10327 | VTY_NEWLINE); | |
10328 | vty_out (vty, "Nexthop local: %s%s", | |
10329 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
10330 | VTY_NEWLINE); | |
10331 | vty_out (vty, "BGP connection: %s%s", | |
10332 | p->shared_network ? "shared network" : "non shared network", | |
10333 | VTY_NEWLINE); | |
718e3744 | 10334 | #endif /* HAVE_IPV6 */ |
856ca177 | 10335 | } |
718e3744 | 10336 | } |
10337 | ||
10338 | /* Timer information. */ | |
856ca177 MS |
10339 | if (use_json) |
10340 | { | |
10341 | if (p->t_start) | |
10342 | json_object_int_add(json_neigh, "nextStartTimerDueInMsecs", thread_timer_remain_second (p->t_start) * 1000); | |
10343 | if (p->t_connect) | |
10344 | json_object_int_add(json_neigh, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p->t_connect) * 1000); | |
10345 | if (p->t_routeadv) | |
10346 | { | |
10347 | json_object_int_add(json_neigh, "mraiInterval", p->v_routeadv); | |
10348 | json_object_int_add(json_neigh, "mraiTimerExpireInMsecs", thread_timer_remain_second (p->t_routeadv) * 1000); | |
10349 | } | |
cb1faec9 | 10350 | |
856ca177 MS |
10351 | if (p->t_read) |
10352 | json_object_string_add(json_neigh, "readThread", "on"); | |
10353 | else | |
10354 | json_object_string_add(json_neigh, "readThread", "off"); | |
10355 | if (p->t_write) | |
10356 | json_object_string_add(json_neigh, "writeThread", "on"); | |
10357 | else | |
10358 | json_object_string_add(json_neigh, "writeThread", "off"); | |
10359 | } | |
10360 | else | |
10361 | { | |
10362 | if (p->t_start) | |
10363 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
10364 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
10365 | if (p->t_connect) | |
10366 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
10367 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
10368 | if (p->t_routeadv) | |
10369 | vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s", | |
10370 | p->v_routeadv, thread_timer_remain_second (p->t_routeadv), | |
10371 | VTY_NEWLINE); | |
10372 | ||
10373 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
10374 | p->t_read ? "on" : "off", | |
10375 | p->t_write ? "on" : "off", | |
10376 | VTY_NEWLINE); | |
10377 | } | |
718e3744 | 10378 | |
10379 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
10380 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
856ca177 MS |
10381 | bgp_capability_vty_out (vty, p, use_json, json_neigh); |
10382 | ||
10383 | if (!use_json) | |
10384 | vty_out (vty, "%s", VTY_NEWLINE); | |
c43ed2e4 DS |
10385 | |
10386 | /* BFD information. */ | |
856ca177 MS |
10387 | bgp_bfd_show_info(vty, p, use_json, json_neigh); |
10388 | ||
10389 | if (use_json) | |
10390 | { | |
10391 | if (p->conf_if) /* Configured interface name. */ | |
10392 | json_object_object_add(json, p->conf_if, json_neigh); | |
10393 | else /* Configured IP address. */ | |
10394 | json_object_object_add(json, p->host, json_neigh); | |
10395 | } | |
718e3744 | 10396 | } |
10397 | ||
94f2b392 | 10398 | static int |
856ca177 MS |
10399 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type, |
10400 | union sockunion *su, const char *conf_if, u_char use_json, json_object *json) | |
718e3744 | 10401 | { |
1eb8ef25 | 10402 | struct listnode *node, *nnode; |
718e3744 | 10403 | struct peer *peer; |
10404 | int find = 0; | |
856ca177 MS |
10405 | json_object *json_neigh = NULL; |
10406 | ||
10407 | if (use_json) | |
10408 | json_neigh = json_object_new_object(); | |
718e3744 | 10409 | |
1eb8ef25 | 10410 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 10411 | { |
1ff9a340 DS |
10412 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
10413 | continue; | |
10414 | ||
718e3744 | 10415 | switch (type) |
856ca177 MS |
10416 | { |
10417 | case show_all: | |
10418 | bgp_show_peer (vty, peer, use_json, json, json_neigh); | |
10419 | break; | |
10420 | case show_peer: | |
10421 | if (conf_if) | |
10422 | { | |
10423 | if (peer->conf_if && !strcmp(peer->conf_if, conf_if)) | |
10424 | { | |
10425 | find = 1; | |
10426 | bgp_show_peer (vty, peer, use_json, json, json_neigh); | |
10427 | } | |
10428 | } | |
10429 | else | |
10430 | { | |
10431 | if (sockunion_same (&peer->su, su)) | |
10432 | { | |
10433 | find = 1; | |
10434 | bgp_show_peer (vty, peer, use_json, json, json_neigh); | |
10435 | } | |
10436 | } | |
10437 | break; | |
718e3744 | 10438 | } |
10439 | } | |
10440 | ||
10441 | if (type == show_peer && ! find) | |
856ca177 MS |
10442 | { |
10443 | if (use_json) | |
10444 | json_object_boolean_true_add(json, "bgpNoSuchNeighbor"); | |
10445 | else | |
10446 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
10447 | } | |
10448 | ||
10449 | if (use_json) | |
10450 | { | |
10451 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
10452 | json_object_free(json); | |
10453 | } | |
10454 | else | |
10455 | { | |
10456 | vty_out (vty, "%s", VTY_NEWLINE); | |
10457 | } | |
10458 | ||
718e3744 | 10459 | return CMD_SUCCESS; |
10460 | } | |
10461 | ||
94f2b392 | 10462 | static int |
fd79ac91 | 10463 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
856ca177 | 10464 | enum show_type type, const char *ip_str, u_char use_json) |
718e3744 | 10465 | { |
10466 | int ret; | |
10467 | struct bgp *bgp; | |
10468 | union sockunion su; | |
856ca177 MS |
10469 | json_object *json = NULL; |
10470 | ||
10471 | if (use_json) | |
10472 | json = json_object_new_object(); | |
718e3744 | 10473 | |
718e3744 | 10474 | if (name) |
10475 | { | |
10476 | bgp = bgp_lookup_by_name (name); | |
718e3744 | 10477 | if (! bgp) |
10478 | { | |
856ca177 MS |
10479 | if (use_json) |
10480 | { | |
10481 | json_object_boolean_true_add(json, "bgpNoSuchInstance"); | |
10482 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
10483 | json_object_free(json); | |
10484 | } | |
10485 | else | |
10486 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
10487 | ||
718e3744 | 10488 | return CMD_WARNING; |
10489 | } | |
718e3744 | 10490 | } |
a80beece DS |
10491 | else |
10492 | { | |
10493 | bgp = bgp_get_default (); | |
10494 | } | |
718e3744 | 10495 | |
10496 | if (bgp) | |
a80beece DS |
10497 | { |
10498 | if (ip_str) | |
10499 | { | |
10500 | ret = str2sockunion (ip_str, &su); | |
10501 | if (ret < 0) | |
856ca177 | 10502 | bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json); |
a80beece | 10503 | else |
856ca177 | 10504 | bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json); |
a80beece DS |
10505 | } |
10506 | else | |
10507 | { | |
856ca177 | 10508 | bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json); |
a80beece DS |
10509 | } |
10510 | } | |
718e3744 | 10511 | |
10512 | return CMD_SUCCESS; | |
10513 | } | |
10514 | ||
10515 | /* "show ip bgp neighbors" commands. */ | |
10516 | DEFUN (show_ip_bgp_neighbors, | |
10517 | show_ip_bgp_neighbors_cmd, | |
856ca177 | 10518 | "show ip bgp neighbors {json}", |
718e3744 | 10519 | SHOW_STR |
10520 | IP_STR | |
10521 | BGP_STR | |
856ca177 MS |
10522 | "Detailed information on TCP and BGP neighbor connections\n" |
10523 | "JavaScript Object Notation\n") | |
718e3744 | 10524 | { |
db7c8528 | 10525 | u_char uj = use_json(argc, argv); |
856ca177 | 10526 | |
db7c8528 | 10527 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, uj); |
718e3744 | 10528 | } |
10529 | ||
10530 | ALIAS (show_ip_bgp_neighbors, | |
10531 | show_ip_bgp_ipv4_neighbors_cmd, | |
856ca177 | 10532 | "show ip bgp ipv4 (unicast|multicast) neighbors {json}", |
718e3744 | 10533 | SHOW_STR |
10534 | IP_STR | |
10535 | BGP_STR | |
10536 | "Address family\n" | |
10537 | "Address Family modifier\n" | |
10538 | "Address Family modifier\n" | |
856ca177 MS |
10539 | "Detailed information on TCP and BGP neighbor connections\n" |
10540 | "JavaScript Object Notation\n") | |
718e3744 | 10541 | |
10542 | ALIAS (show_ip_bgp_neighbors, | |
10543 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
856ca177 | 10544 | "show ip bgp vpnv4 all neighbors {json}", |
718e3744 | 10545 | SHOW_STR |
10546 | IP_STR | |
10547 | BGP_STR | |
10548 | "Display VPNv4 NLRI specific information\n" | |
10549 | "Display information about all VPNv4 NLRIs\n" | |
856ca177 MS |
10550 | "Detailed information on TCP and BGP neighbor connections\n" |
10551 | "JavaScript Object Notation\n") | |
718e3744 | 10552 | |
10553 | ALIAS (show_ip_bgp_neighbors, | |
10554 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
856ca177 | 10555 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}", |
718e3744 | 10556 | SHOW_STR |
10557 | IP_STR | |
10558 | BGP_STR | |
10559 | "Display VPNv4 NLRI specific information\n" | |
10560 | "Display information for a route distinguisher\n" | |
10561 | "VPN Route Distinguisher\n" | |
856ca177 MS |
10562 | "Detailed information on TCP and BGP neighbor connections\n" |
10563 | "JavaScript Object Notation\n") | |
718e3744 | 10564 | |
10565 | ALIAS (show_ip_bgp_neighbors, | |
10566 | show_bgp_neighbors_cmd, | |
856ca177 | 10567 | "show bgp neighbors {json}", |
718e3744 | 10568 | SHOW_STR |
10569 | BGP_STR | |
856ca177 MS |
10570 | "Detailed information on TCP and BGP neighbor connections\n" |
10571 | "JavaScript Object Notation\n") | |
718e3744 | 10572 | |
10573 | ALIAS (show_ip_bgp_neighbors, | |
10574 | show_bgp_ipv6_neighbors_cmd, | |
856ca177 | 10575 | "show bgp ipv6 neighbors {json}", |
718e3744 | 10576 | SHOW_STR |
10577 | BGP_STR | |
10578 | "Address family\n" | |
856ca177 MS |
10579 | "Detailed information on TCP and BGP neighbor connections\n" |
10580 | "JavaScript Object Notation\n") | |
718e3744 | 10581 | |
10582 | DEFUN (show_ip_bgp_neighbors_peer, | |
10583 | show_ip_bgp_neighbors_peer_cmd, | |
856ca177 | 10584 | "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10585 | SHOW_STR |
10586 | IP_STR | |
10587 | BGP_STR | |
10588 | "Detailed information on TCP and BGP neighbor connections\n" | |
10589 | "Neighbor to display information about\n" | |
a80beece | 10590 | "Neighbor to display information about\n" |
856ca177 MS |
10591 | "Neighbor on bgp configured interface\n" |
10592 | "JavaScript Object Notation\n") | |
718e3744 | 10593 | { |
db7c8528 | 10594 | u_char uj = use_json(argc, argv); |
856ca177 | 10595 | |
db7c8528 | 10596 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], uj); |
718e3744 | 10597 | } |
10598 | ||
10599 | ALIAS (show_ip_bgp_neighbors_peer, | |
10600 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
856ca177 | 10601 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10602 | SHOW_STR |
10603 | IP_STR | |
10604 | BGP_STR | |
10605 | "Address family\n" | |
10606 | "Address Family modifier\n" | |
10607 | "Address Family modifier\n" | |
10608 | "Detailed information on TCP and BGP neighbor connections\n" | |
10609 | "Neighbor to display information about\n" | |
a80beece | 10610 | "Neighbor to display information about\n" |
856ca177 MS |
10611 | "Neighbor on bgp configured interface\n" |
10612 | "JavaScript Object Notation\n") | |
718e3744 | 10613 | |
10614 | ALIAS (show_ip_bgp_neighbors_peer, | |
10615 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
856ca177 | 10616 | "show ip bgp vpnv4 all neighbors A.B.C.D {json}", |
718e3744 | 10617 | SHOW_STR |
10618 | IP_STR | |
10619 | BGP_STR | |
10620 | "Display VPNv4 NLRI specific information\n" | |
10621 | "Display information about all VPNv4 NLRIs\n" | |
10622 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
10623 | "Neighbor to display information about\n" |
10624 | "JavaScript Object Notation\n") | |
718e3744 | 10625 | |
10626 | ALIAS (show_ip_bgp_neighbors_peer, | |
10627 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
856ca177 | 10628 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}", |
718e3744 | 10629 | SHOW_STR |
10630 | IP_STR | |
10631 | BGP_STR | |
10632 | "Display VPNv4 NLRI specific information\n" | |
10633 | "Display information about all VPNv4 NLRIs\n" | |
10634 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
10635 | "Neighbor to display information about\n" |
10636 | "JavaScript Object Notation\n") | |
718e3744 | 10637 | |
10638 | ALIAS (show_ip_bgp_neighbors_peer, | |
10639 | show_bgp_neighbors_peer_cmd, | |
856ca177 | 10640 | "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10641 | SHOW_STR |
10642 | BGP_STR | |
10643 | "Detailed information on TCP and BGP neighbor connections\n" | |
10644 | "Neighbor to display information about\n" | |
a80beece | 10645 | "Neighbor to display information about\n" |
856ca177 MS |
10646 | "Neighbor on bgp configured interface\n" |
10647 | "JavaScript Object Notation\n") | |
718e3744 | 10648 | |
10649 | ALIAS (show_ip_bgp_neighbors_peer, | |
10650 | show_bgp_ipv6_neighbors_peer_cmd, | |
856ca177 | 10651 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10652 | SHOW_STR |
10653 | BGP_STR | |
10654 | "Address family\n" | |
10655 | "Detailed information on TCP and BGP neighbor connections\n" | |
10656 | "Neighbor to display information about\n" | |
a80beece | 10657 | "Neighbor to display information about\n" |
856ca177 MS |
10658 | "Neighbor on bgp configured interface\n" |
10659 | "JavaScript Object Notation\n") | |
718e3744 | 10660 | |
10661 | DEFUN (show_ip_bgp_instance_neighbors, | |
10662 | show_ip_bgp_instance_neighbors_cmd, | |
856ca177 | 10663 | "show ip bgp view WORD neighbors {json}", |
718e3744 | 10664 | SHOW_STR |
10665 | IP_STR | |
10666 | BGP_STR | |
10667 | "BGP view\n" | |
10668 | "View name\n" | |
856ca177 MS |
10669 | "Detailed information on TCP and BGP neighbor connections\n" |
10670 | "JavaScript Object Notation\n") | |
718e3744 | 10671 | { |
db7c8528 | 10672 | u_char uj = use_json(argc, argv); |
856ca177 | 10673 | |
db7c8528 | 10674 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL, uj); |
718e3744 | 10675 | } |
10676 | ||
bb46e94f | 10677 | ALIAS (show_ip_bgp_instance_neighbors, |
10678 | show_bgp_instance_neighbors_cmd, | |
856ca177 | 10679 | "show bgp view WORD neighbors {json}", |
bb46e94f | 10680 | SHOW_STR |
10681 | BGP_STR | |
10682 | "BGP view\n" | |
10683 | "View name\n" | |
856ca177 MS |
10684 | "Detailed information on TCP and BGP neighbor connections\n" |
10685 | "JavaScript Object Notation\n") | |
bb46e94f | 10686 | |
10687 | ALIAS (show_ip_bgp_instance_neighbors, | |
10688 | show_bgp_instance_ipv6_neighbors_cmd, | |
856ca177 | 10689 | "show bgp view WORD ipv6 neighbors {json}", |
bb46e94f | 10690 | SHOW_STR |
10691 | BGP_STR | |
10692 | "BGP view\n" | |
10693 | "View name\n" | |
10694 | "Address family\n" | |
856ca177 MS |
10695 | "Detailed information on TCP and BGP neighbor connections\n" |
10696 | "JavaScript Object Notation\n") | |
bb46e94f | 10697 | |
718e3744 | 10698 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
10699 | show_ip_bgp_instance_neighbors_peer_cmd, | |
856ca177 | 10700 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10701 | SHOW_STR |
10702 | IP_STR | |
10703 | BGP_STR | |
10704 | "BGP view\n" | |
10705 | "View name\n" | |
10706 | "Detailed information on TCP and BGP neighbor connections\n" | |
10707 | "Neighbor to display information about\n" | |
a80beece | 10708 | "Neighbor to display information about\n" |
856ca177 MS |
10709 | "Neighbor on bgp configured interface\n" |
10710 | "JavaScript Object Notation\n") | |
718e3744 | 10711 | { |
db7c8528 | 10712 | u_char uj = use_json(argc, argv); |
856ca177 | 10713 | |
db7c8528 | 10714 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1], uj); |
718e3744 | 10715 | } |
bb46e94f | 10716 | |
10717 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
10718 | show_bgp_instance_neighbors_peer_cmd, | |
856ca177 | 10719 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 10720 | SHOW_STR |
10721 | BGP_STR | |
10722 | "BGP view\n" | |
10723 | "View name\n" | |
10724 | "Detailed information on TCP and BGP neighbor connections\n" | |
10725 | "Neighbor to display information about\n" | |
a80beece | 10726 | "Neighbor to display information about\n" |
856ca177 MS |
10727 | "Neighbor on bgp configured interface\n" |
10728 | "JavaScript Object Notation\n") | |
bb46e94f | 10729 | |
10730 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
10731 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
856ca177 | 10732 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 10733 | SHOW_STR |
10734 | BGP_STR | |
10735 | "BGP view\n" | |
10736 | "View name\n" | |
10737 | "Address family\n" | |
10738 | "Detailed information on TCP and BGP neighbor connections\n" | |
10739 | "Neighbor to display information about\n" | |
a80beece | 10740 | "Neighbor to display information about\n" |
856ca177 MS |
10741 | "Neighbor on bgp configured interface\n" |
10742 | "JavaScript Object Notation\n") | |
6b0655a2 | 10743 | |
718e3744 | 10744 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
10745 | paths' and `show ip mbgp paths'. Those functions results are the | |
10746 | same.*/ | |
10747 | DEFUN (show_ip_bgp_paths, | |
10748 | show_ip_bgp_paths_cmd, | |
10749 | "show ip bgp paths", | |
10750 | SHOW_STR | |
10751 | IP_STR | |
10752 | BGP_STR | |
10753 | "Path information\n") | |
10754 | { | |
10755 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
10756 | aspath_print_all_vty (vty); | |
10757 | return CMD_SUCCESS; | |
10758 | } | |
10759 | ||
10760 | DEFUN (show_ip_bgp_ipv4_paths, | |
10761 | show_ip_bgp_ipv4_paths_cmd, | |
10762 | "show ip bgp ipv4 (unicast|multicast) paths", | |
10763 | SHOW_STR | |
10764 | IP_STR | |
10765 | BGP_STR | |
10766 | "Address family\n" | |
10767 | "Address Family modifier\n" | |
10768 | "Address Family modifier\n" | |
10769 | "Path information\n") | |
10770 | { | |
10771 | vty_out (vty, "Address Refcnt Path\r\n"); | |
10772 | aspath_print_all_vty (vty); | |
10773 | ||
10774 | return CMD_SUCCESS; | |
10775 | } | |
6b0655a2 | 10776 | |
718e3744 | 10777 | #include "hash.h" |
10778 | ||
94f2b392 | 10779 | static void |
718e3744 | 10780 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
10781 | { | |
10782 | struct community *com; | |
10783 | ||
10784 | com = (struct community *) backet->data; | |
10785 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, | |
10786 | community_str (com), VTY_NEWLINE); | |
10787 | } | |
10788 | ||
10789 | /* Show BGP's community internal data. */ | |
10790 | DEFUN (show_ip_bgp_community_info, | |
10791 | show_ip_bgp_community_info_cmd, | |
10792 | "show ip bgp community-info", | |
10793 | SHOW_STR | |
10794 | IP_STR | |
10795 | BGP_STR | |
10796 | "List all bgp community information\n") | |
10797 | { | |
10798 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
10799 | ||
10800 | hash_iterate (community_hash (), | |
10801 | (void (*) (struct hash_backet *, void *)) | |
10802 | community_show_all_iterator, | |
10803 | vty); | |
10804 | ||
10805 | return CMD_SUCCESS; | |
10806 | } | |
10807 | ||
10808 | DEFUN (show_ip_bgp_attr_info, | |
10809 | show_ip_bgp_attr_info_cmd, | |
10810 | "show ip bgp attribute-info", | |
10811 | SHOW_STR | |
10812 | IP_STR | |
10813 | BGP_STR | |
10814 | "List all bgp attribute information\n") | |
10815 | { | |
10816 | attr_show_all (vty); | |
10817 | return CMD_SUCCESS; | |
10818 | } | |
6b0655a2 | 10819 | |
8fe8a7f6 DS |
10820 | static int bgp_show_update_groups(int afi, int safi, struct vty *vty, |
10821 | u_int64_t subgrp_id) | |
3f9c7369 DS |
10822 | { |
10823 | struct bgp *bgp; | |
10824 | ||
10825 | bgp = bgp_get_default(); | |
10826 | if (bgp) | |
8fe8a7f6 | 10827 | update_group_show(bgp, afi, safi, vty, subgrp_id); |
3f9c7369 DS |
10828 | return CMD_SUCCESS; |
10829 | } | |
10830 | ||
8fe8a7f6 DS |
10831 | DEFUN (show_ip_bgp_updgrps, |
10832 | show_ip_bgp_updgrps_cmd, | |
10833 | "show ip bgp update-groups", | |
10834 | SHOW_STR | |
10835 | IP_STR | |
10836 | BGP_STR | |
10837 | "Detailed info about dynamic update groups\n") | |
10838 | { | |
10839 | return (bgp_show_update_groups(AFI_IP, SAFI_UNICAST, vty, 0)); | |
10840 | } | |
10841 | ||
3f9c7369 DS |
10842 | DEFUN (show_bgp_ipv6_updgrps, |
10843 | show_bgp_ipv6_updgrps_cmd, | |
8fe8a7f6 | 10844 | "show bgp update-groups", |
3f9c7369 DS |
10845 | SHOW_STR |
10846 | BGP_STR | |
8fe8a7f6 | 10847 | "Detailed info about v6 dynamic update groups\n") |
3f9c7369 | 10848 | { |
8fe8a7f6 | 10849 | return (bgp_show_update_groups(AFI_IP6, SAFI_UNICAST, vty, 0)); |
3f9c7369 DS |
10850 | } |
10851 | ||
10852 | DEFUN (show_bgp_updgrps, | |
10853 | show_bgp_updgrps_cmd, | |
8fe8a7f6 | 10854 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups", |
3f9c7369 DS |
10855 | SHOW_STR |
10856 | BGP_STR | |
10857 | "Address family\n" | |
10858 | "Address family\n" | |
10859 | "Address Family modifier\n" | |
10860 | "Address Family modifier\n" | |
8fe8a7f6 | 10861 | "Detailed info about dynamic update groups\n") |
3f9c7369 | 10862 | { |
3f9c7369 DS |
10863 | afi_t afi; |
10864 | safi_t safi; | |
10865 | ||
10866 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
10867 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8fe8a7f6 DS |
10868 | return (bgp_show_update_groups(afi, safi, vty, 0)); |
10869 | } | |
10870 | ||
10871 | DEFUN (show_ip_bgp_updgrps_s, | |
10872 | show_ip_bgp_updgrps_s_cmd, | |
10873 | "show ip bgp update-groups SUBGROUP-ID", | |
10874 | SHOW_STR | |
10875 | IP_STR | |
10876 | BGP_STR | |
10877 | "Detailed info about dynamic update groups\n" | |
10878 | "Specific subgroup to display detailed info for\n") | |
10879 | { | |
10880 | u_int64_t subgrp_id; | |
10881 | ||
10882 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
10883 | return (bgp_show_update_groups(AFI_IP, SAFI_UNICAST, vty, subgrp_id)); | |
10884 | } | |
10885 | ||
10886 | DEFUN (show_bgp_ipv6_updgrps_s, | |
10887 | show_bgp_ipv6_updgrps_s_cmd, | |
10888 | "show bgp update-groups SUBGROUP-ID", | |
10889 | SHOW_STR | |
10890 | BGP_STR | |
10891 | "Detailed info about v6 dynamic update groups\n" | |
10892 | "Specific subgroup to display detailed info for\n") | |
10893 | { | |
10894 | u_int64_t subgrp_id; | |
10895 | ||
10896 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
10897 | return(bgp_show_update_groups(AFI_IP6, SAFI_UNICAST, vty, subgrp_id)); | |
10898 | } | |
10899 | ||
10900 | DEFUN (show_bgp_updgrps_s, | |
10901 | show_bgp_updgrps_s_cmd, | |
10902 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID", | |
10903 | SHOW_STR | |
10904 | BGP_STR | |
10905 | "Address family\n" | |
10906 | "Address family\n" | |
10907 | "Address Family modifier\n" | |
10908 | "Address Family modifier\n" | |
10909 | "Detailed info about v6 dynamic update groups\n" | |
10910 | "Specific subgroup to display detailed info for") | |
10911 | { | |
10912 | afi_t afi; | |
10913 | safi_t safi; | |
10914 | u_int64_t subgrp_id; | |
10915 | ||
10916 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
10917 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10918 | ||
10919 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
10920 | return(bgp_show_update_groups(afi, safi, vty, subgrp_id)); | |
3f9c7369 DS |
10921 | } |
10922 | ||
10923 | DEFUN (show_bgp_updgrps_stats, | |
10924 | show_bgp_updgrps_stats_cmd, | |
10925 | "show bgp update-groups statistics", | |
10926 | SHOW_STR | |
10927 | BGP_STR | |
10928 | "BGP update groups\n" | |
10929 | "Statistics\n") | |
10930 | { | |
10931 | struct bgp *bgp; | |
10932 | ||
10933 | bgp = bgp_get_default(); | |
10934 | if (bgp) | |
10935 | update_group_show_stats(bgp, vty); | |
10936 | ||
10937 | return CMD_SUCCESS; | |
10938 | } | |
10939 | ||
10940 | static void | |
10941 | show_bgp_updgrps_adj_info_aux (struct vty *vty, afi_t afi, safi_t safi, | |
10942 | const char *what, u_int64_t subgrp_id) | |
10943 | { | |
10944 | struct bgp *bgp; | |
10945 | bgp = bgp_get_default(); | |
10946 | if (bgp) | |
10947 | { | |
10948 | if (!strcmp(what, "advertise-queue")) | |
10949 | update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id); | |
10950 | else if (!strcmp(what, "advertised-routes")) | |
10951 | update_group_show_advertised(bgp, afi, safi, vty, subgrp_id); | |
10952 | else if (!strcmp(what, "packet-queue")) | |
10953 | update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id); | |
10954 | } | |
10955 | } | |
10956 | ||
10957 | DEFUN (show_ip_bgp_updgrps_adj, | |
10958 | show_ip_bgp_updgrps_adj_cmd, | |
10959 | "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
10960 | SHOW_STR | |
10961 | IP_STR | |
10962 | BGP_STR | |
10963 | "BGP update groups\n" | |
10964 | "Advertisement queue\n" | |
10965 | "Announced routes\n" | |
10966 | "Packet queue\n") | |
8fe8a7f6 | 10967 | |
3f9c7369 DS |
10968 | { |
10969 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP, SAFI_UNICAST, argv[0], 0); | |
10970 | return CMD_SUCCESS; | |
10971 | } | |
10972 | ||
10973 | DEFUN (show_bgp_updgrps_afi_adj, | |
10974 | show_bgp_updgrps_afi_adj_cmd, | |
10975 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)", | |
10976 | SHOW_STR | |
10977 | BGP_STR | |
10978 | "Address family\n" | |
10979 | "Address family\n" | |
10980 | "Address Family modifier\n" | |
10981 | "Address Family modifier\n" | |
10982 | "BGP update groups\n" | |
10983 | "Advertisement queue\n" | |
10984 | "Announced routes\n" | |
8fe8a7f6 DS |
10985 | "Packet queue\n" |
10986 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
10987 | { |
10988 | afi_t afi; | |
10989 | safi_t safi; | |
10990 | ||
10991 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
10992 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10993 | show_bgp_updgrps_adj_info_aux(vty, afi, safi, argv[2], 0); | |
8fe8a7f6 | 10994 | return CMD_SUCCESS; |
3f9c7369 DS |
10995 | } |
10996 | ||
10997 | DEFUN (show_bgp_updgrps_adj, | |
10998 | show_bgp_updgrps_adj_cmd, | |
10999 | "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
11000 | SHOW_STR | |
11001 | BGP_STR | |
11002 | "BGP update groups\n" | |
11003 | "Advertisement queue\n" | |
11004 | "Announced routes\n" | |
11005 | "Packet queue\n") | |
11006 | { | |
11007 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP6, SAFI_UNICAST, argv[0], 0); | |
11008 | return CMD_SUCCESS; | |
11009 | } | |
11010 | ||
11011 | DEFUN (show_ip_bgp_updgrps_adj_s, | |
8fe8a7f6 | 11012 | show_ip_bgp_updgrps_adj_s_cmd, |
3f9c7369 DS |
11013 | "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
11014 | SHOW_STR | |
11015 | IP_STR | |
11016 | BGP_STR | |
11017 | "BGP update groups\n" | |
8fe8a7f6 | 11018 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
11019 | "Advertisement queue\n" |
11020 | "Announced routes\n" | |
11021 | "Packet queue\n") | |
3f9c7369 | 11022 | |
3f9c7369 | 11023 | { |
8fe8a7f6 DS |
11024 | u_int64_t subgrp_id; |
11025 | ||
11026 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
11027 | ||
11028 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id); | |
3f9c7369 DS |
11029 | return CMD_SUCCESS; |
11030 | } | |
11031 | ||
8fe8a7f6 DS |
11032 | DEFUN (show_bgp_updgrps_afi_adj_s, |
11033 | show_bgp_updgrps_afi_adj_s_cmd, | |
3f9c7369 DS |
11034 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
11035 | SHOW_STR | |
11036 | BGP_STR | |
11037 | "Address family\n" | |
11038 | "Address family\n" | |
11039 | "Address Family modifier\n" | |
11040 | "Address Family modifier\n" | |
11041 | "BGP update groups\n" | |
8fe8a7f6 | 11042 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
11043 | "Advertisement queue\n" |
11044 | "Announced routes\n" | |
8fe8a7f6 DS |
11045 | "Packet queue\n" |
11046 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
11047 | { |
11048 | afi_t afi; | |
11049 | safi_t safi; | |
8fe8a7f6 | 11050 | u_int64_t subgrp_id; |
3f9c7369 DS |
11051 | |
11052 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
11053 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8fe8a7f6 DS |
11054 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); |
11055 | ||
11056 | show_bgp_updgrps_adj_info_aux(vty, afi, safi, argv[3], subgrp_id); | |
11057 | return CMD_SUCCESS; | |
3f9c7369 DS |
11058 | } |
11059 | ||
8fe8a7f6 DS |
11060 | DEFUN (show_bgp_updgrps_adj_s, |
11061 | show_bgp_updgrps_adj_s_cmd, | |
11062 | "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
11063 | SHOW_STR | |
11064 | BGP_STR | |
11065 | "BGP update groups\n" | |
11066 | "Specific subgroup to display info for\n" | |
11067 | "Advertisement queue\n" | |
11068 | "Announced routes\n" | |
11069 | "Packet queue\n") | |
11070 | { | |
11071 | u_int64_t subgrp_id; | |
11072 | ||
11073 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
11074 | ||
11075 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id); | |
11076 | return CMD_SUCCESS; | |
11077 | } | |
11078 | ||
11079 | ||
f14e6fdb DS |
11080 | static int |
11081 | bgp_show_one_peer_group (struct vty *vty, struct peer_group *group) | |
11082 | { | |
11083 | struct listnode *node, *nnode; | |
11084 | struct prefix *range; | |
11085 | struct peer *conf; | |
11086 | struct peer *peer; | |
4690c7d7 | 11087 | char buf[PREFIX2STR_BUFFER]; |
f14e6fdb DS |
11088 | afi_t afi; |
11089 | safi_t safi; | |
ffd0c037 DS |
11090 | const char *peer_status; |
11091 | const char *af_str; | |
f14e6fdb DS |
11092 | int lr_count; |
11093 | int dynamic; | |
11094 | int af_cfgd; | |
11095 | ||
11096 | conf = group->conf; | |
11097 | ||
0299c004 DS |
11098 | if (conf->as_type == AS_SPECIFIED || |
11099 | conf->as_type == AS_EXTERNAL) { | |
66b199b2 | 11100 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
f14e6fdb | 11101 | VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE); |
0299c004 | 11102 | } else if (conf->as_type == AS_INTERNAL) { |
66b199b2 | 11103 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
0299c004 | 11104 | VTY_NEWLINE, group->name, group->bgp->as, VTY_NEWLINE); |
66b199b2 DS |
11105 | } else { |
11106 | vty_out (vty, "%sBGP peer-group %s%s", | |
11107 | VTY_NEWLINE, group->name, VTY_NEWLINE); | |
0299c004 | 11108 | } |
f14e6fdb | 11109 | |
0299c004 | 11110 | if ((group->bgp->as == conf->as) || (conf->as_type == AS_INTERNAL)) |
f14e6fdb DS |
11111 | vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE); |
11112 | else | |
11113 | vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE); | |
11114 | ||
11115 | /* Display AFs configured. */ | |
11116 | vty_out (vty, " Configured address-families:"); | |
11117 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
11118 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11119 | { | |
11120 | if (conf->afc[afi][safi]) | |
11121 | { | |
11122 | af_cfgd = 1; | |
11123 | vty_out (vty, " %s;", afi_safi_print(afi, safi)); | |
11124 | } | |
11125 | } | |
11126 | if (!af_cfgd) | |
11127 | vty_out (vty, " none%s", VTY_NEWLINE); | |
11128 | else | |
11129 | vty_out (vty, "%s", VTY_NEWLINE); | |
11130 | ||
11131 | /* Display listen ranges (for dynamic neighbors), if any */ | |
11132 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
11133 | { | |
11134 | if (afi == AFI_IP) | |
11135 | af_str = "IPv4"; | |
11136 | else if (afi == AFI_IP6) | |
11137 | af_str = "IPv6"; | |
11138 | lr_count = listcount(group->listen_range[afi]); | |
11139 | if (lr_count) | |
11140 | { | |
11141 | vty_out(vty, | |
11142 | " %d %s listen range(s)%s", | |
11143 | lr_count, af_str, VTY_NEWLINE); | |
11144 | ||
11145 | ||
11146 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node, | |
11147 | nnode, range)) | |
11148 | { | |
11149 | prefix2str(range, buf, sizeof(buf)); | |
11150 | vty_out(vty, " %s%s", buf, VTY_NEWLINE); | |
11151 | } | |
11152 | } | |
11153 | } | |
11154 | ||
11155 | /* Display group members and their status */ | |
11156 | if (listcount(group->peer)) | |
11157 | { | |
11158 | vty_out (vty, " Peer-group members:%s", VTY_NEWLINE); | |
11159 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
11160 | { | |
11161 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
11162 | peer_status = "Idle (Admin)"; | |
11163 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
11164 | peer_status = "Idle (PfxCt)"; | |
11165 | else | |
11166 | peer_status = LOOKUP(bgp_status_msg, peer->status); | |
11167 | ||
11168 | dynamic = peer_dynamic_neighbor(peer); | |
11169 | vty_out (vty, " %s %s %s %s", | |
11170 | peer->host, dynamic ? "(dynamic)" : "", | |
11171 | peer_status, VTY_NEWLINE); | |
11172 | } | |
11173 | } | |
11174 | ||
11175 | return CMD_SUCCESS; | |
11176 | } | |
11177 | ||
11178 | /* Show BGP peer group's information. */ | |
11179 | enum show_group_type | |
11180 | { | |
11181 | show_all_groups, | |
11182 | show_peer_group | |
11183 | }; | |
11184 | ||
11185 | static int | |
11186 | bgp_show_peer_group (struct vty *vty, struct bgp *bgp, | |
11187 | enum show_group_type type, const char *group_name) | |
11188 | { | |
11189 | struct listnode *node, *nnode; | |
11190 | struct peer_group *group; | |
11191 | int find = 0; | |
11192 | ||
11193 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
11194 | { | |
11195 | switch (type) | |
11196 | { | |
11197 | case show_all_groups: | |
11198 | bgp_show_one_peer_group (vty, group); | |
11199 | break; | |
11200 | case show_peer_group: | |
11201 | if (group_name && (strcmp(group->name, group_name) == 0)) | |
11202 | { | |
11203 | find = 1; | |
11204 | bgp_show_one_peer_group (vty, group); | |
11205 | } | |
11206 | break; | |
11207 | } | |
11208 | } | |
11209 | ||
11210 | if (type == show_peer_group && ! find) | |
11211 | vty_out (vty, "%% No such peer-groupr%s", VTY_NEWLINE); | |
11212 | ||
11213 | return CMD_SUCCESS; | |
11214 | } | |
11215 | ||
11216 | static int | |
11217 | bgp_show_peer_group_vty (struct vty *vty, const char *name, | |
11218 | enum show_group_type type, const char *group_name) | |
11219 | { | |
11220 | struct bgp *bgp; | |
11221 | int ret = CMD_SUCCESS; | |
11222 | ||
11223 | if (name) | |
11224 | { | |
11225 | bgp = bgp_lookup_by_name (name); | |
11226 | ||
11227 | if (! bgp) | |
11228 | { | |
11229 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
11230 | return CMD_WARNING; | |
11231 | } | |
11232 | } | |
11233 | ||
11234 | bgp = bgp_get_default (); | |
11235 | ||
11236 | if (bgp) | |
11237 | ret = bgp_show_peer_group (vty, bgp, type, group_name); | |
11238 | ||
11239 | return ret; | |
11240 | } | |
11241 | ||
11242 | DEFUN (show_ip_bgp_peer_groups, | |
11243 | show_ip_bgp_peer_groups_cmd, | |
11244 | "show ip bgp peer-group", | |
11245 | SHOW_STR | |
11246 | IP_STR | |
11247 | BGP_STR | |
11248 | "Detailed information on all BGP peer groups\n") | |
11249 | { | |
11250 | return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL); | |
11251 | } | |
11252 | ||
11253 | DEFUN (show_ip_bgp_instance_peer_groups, | |
11254 | show_ip_bgp_instance_peer_groups_cmd, | |
11255 | "show ip bgp view WORD peer-group", | |
11256 | SHOW_STR | |
11257 | IP_STR | |
11258 | BGP_STR | |
11259 | "BGP View\n" | |
11260 | "Detailed information on all BGP peer groups\n") | |
11261 | { | |
11262 | return bgp_show_peer_group_vty (vty, argv[0], show_all_groups, NULL); | |
11263 | } | |
11264 | ||
11265 | DEFUN (show_ip_bgp_peer_group, | |
11266 | show_ip_bgp_peer_group_cmd, | |
11267 | "show ip bgp peer-group WORD", | |
11268 | SHOW_STR | |
11269 | IP_STR | |
11270 | BGP_STR | |
11271 | "BGP peer-group name\n" | |
11272 | "Detailed information on a BGP peer group\n") | |
11273 | { | |
11274 | return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]); | |
11275 | } | |
11276 | ||
11277 | DEFUN (show_ip_bgp_instance_peer_group, | |
11278 | show_ip_bgp_instance_peer_group_cmd, | |
11279 | "show ip bgp view WORD peer-group WORD", | |
11280 | SHOW_STR | |
11281 | IP_STR | |
11282 | BGP_STR | |
11283 | "BGP View\n" | |
11284 | "BGP peer-group name\n" | |
11285 | "Detailed information on a BGP peer group\n") | |
11286 | { | |
11287 | return bgp_show_peer_group_vty (vty, argv[0], show_peer_group, argv[1]); | |
11288 | } | |
3f9c7369 | 11289 | |
718e3744 | 11290 | /* Redistribute VTY commands. */ |
11291 | ||
718e3744 | 11292 | DEFUN (bgp_redistribute_ipv4, |
11293 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 11294 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 11295 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11296 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 11297 | { |
11298 | int type; | |
11299 | ||
e0ca5fde DL |
11300 | type = proto_redistnum (AFI_IP, argv[0]); |
11301 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11302 | { |
11303 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11304 | return CMD_WARNING; | |
11305 | } | |
7c8ff89e | 11306 | bgp_redist_add(vty->index, AFI_IP, type, 0); |
8bb0831e | 11307 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 11308 | } |
11309 | ||
11310 | DEFUN (bgp_redistribute_ipv4_rmap, | |
11311 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 11312 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 11313 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11314 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11315 | "Route map reference\n" |
11316 | "Pointer to route-map entries\n") | |
11317 | { | |
11318 | int type; | |
7c8ff89e | 11319 | struct bgp_redist *red; |
718e3744 | 11320 | |
e0ca5fde DL |
11321 | type = proto_redistnum (AFI_IP, argv[0]); |
11322 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11323 | { |
11324 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11325 | return CMD_WARNING; | |
11326 | } | |
11327 | ||
7c8ff89e DS |
11328 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
11329 | bgp_redistribute_rmap_set (red, argv[1]); | |
8bb0831e | 11330 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 11331 | } |
11332 | ||
11333 | DEFUN (bgp_redistribute_ipv4_metric, | |
11334 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 11335 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 11336 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11337 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11338 | "Metric for redistributed routes\n" |
11339 | "Default metric\n") | |
11340 | { | |
11341 | int type; | |
11342 | u_int32_t metric; | |
7c8ff89e | 11343 | struct bgp_redist *red; |
718e3744 | 11344 | |
e0ca5fde DL |
11345 | type = proto_redistnum (AFI_IP, argv[0]); |
11346 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11347 | { |
11348 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11349 | return CMD_WARNING; | |
11350 | } | |
11351 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
11352 | ||
7c8ff89e | 11353 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 11354 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
8bb0831e | 11355 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 11356 | } |
11357 | ||
11358 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
11359 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 11360 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 11361 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11362 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11363 | "Route map reference\n" |
11364 | "Pointer to route-map entries\n" | |
11365 | "Metric for redistributed routes\n" | |
11366 | "Default metric\n") | |
11367 | { | |
11368 | int type; | |
11369 | u_int32_t metric; | |
7c8ff89e | 11370 | struct bgp_redist *red; |
718e3744 | 11371 | |
e0ca5fde DL |
11372 | type = proto_redistnum (AFI_IP, argv[0]); |
11373 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11374 | { |
11375 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11376 | return CMD_WARNING; | |
11377 | } | |
11378 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
11379 | ||
7c8ff89e DS |
11380 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
11381 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 11382 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
8bb0831e | 11383 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 11384 | } |
11385 | ||
11386 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
11387 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 11388 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 11389 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11390 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11391 | "Metric for redistributed routes\n" |
11392 | "Default metric\n" | |
11393 | "Route map reference\n" | |
11394 | "Pointer to route-map entries\n") | |
11395 | { | |
11396 | int type; | |
11397 | u_int32_t metric; | |
7c8ff89e | 11398 | struct bgp_redist *red; |
718e3744 | 11399 | |
e0ca5fde DL |
11400 | type = proto_redistnum (AFI_IP, argv[0]); |
11401 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11402 | { |
11403 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11404 | return CMD_WARNING; | |
11405 | } | |
11406 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
11407 | ||
7c8ff89e | 11408 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 11409 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
7c8ff89e | 11410 | bgp_redistribute_rmap_set (red, argv[2]); |
8bb0831e | 11411 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 11412 | } |
11413 | ||
7c8ff89e DS |
11414 | DEFUN (bgp_redistribute_ipv4_ospf, |
11415 | bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 11416 | "redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
11417 | "Redistribute information from another routing protocol\n" |
11418 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11419 | "Non-main Kernel Routing Table\n" |
11420 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
11421 | { |
11422 | u_short instance; | |
7a4bb9c5 | 11423 | u_short protocol; |
7c8ff89e | 11424 | |
7a4bb9c5 DS |
11425 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
11426 | ||
11427 | if (strncmp(argv[0], "o", 1) == 0) | |
11428 | protocol = ZEBRA_ROUTE_OSPF; | |
11429 | else | |
11430 | protocol = ZEBRA_ROUTE_TABLE; | |
11431 | ||
11432 | bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
8bb0831e | 11433 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
11434 | } |
11435 | ||
11436 | DEFUN (bgp_redistribute_ipv4_ospf_rmap, | |
11437 | bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 11438 | "redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
11439 | "Redistribute information from another routing protocol\n" |
11440 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11441 | "Non-main Kernel Routing Table\n" |
11442 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
11443 | "Route map reference\n" |
11444 | "Pointer to route-map entries\n") | |
11445 | { | |
11446 | struct bgp_redist *red; | |
11447 | u_short instance; | |
7a4bb9c5 | 11448 | int protocol; |
7c8ff89e | 11449 | |
7a4bb9c5 DS |
11450 | if (strncmp(argv[0], "o", 1) == 0) |
11451 | protocol = ZEBRA_ROUTE_OSPF; | |
11452 | else | |
11453 | protocol = ZEBRA_ROUTE_TABLE; | |
11454 | ||
11455 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); | |
11456 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
11457 | bgp_redistribute_rmap_set (red, argv[2]); | |
8bb0831e | 11458 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
11459 | } |
11460 | ||
11461 | DEFUN (bgp_redistribute_ipv4_ospf_metric, | |
11462 | bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 11463 | "redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
11464 | "Redistribute information from another routing protocol\n" |
11465 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11466 | "Non-main Kernel Routing Table\n" |
11467 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
11468 | "Metric for redistributed routes\n" |
11469 | "Default metric\n") | |
11470 | { | |
11471 | u_int32_t metric; | |
11472 | struct bgp_redist *red; | |
11473 | u_short instance; | |
7a4bb9c5 | 11474 | int protocol; |
7c8ff89e | 11475 | |
7a4bb9c5 DS |
11476 | if (strncmp(argv[0], "o", 1) == 0) |
11477 | protocol = ZEBRA_ROUTE_OSPF; | |
11478 | else | |
11479 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 11480 | |
7a4bb9c5 DS |
11481 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
11482 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
11483 | ||
11484 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 11485 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
8bb0831e | 11486 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
11487 | } |
11488 | ||
11489 | DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, | |
11490 | bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 11491 | "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
11492 | "Redistribute information from another routing protocol\n" |
11493 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11494 | "Non-main Kernel Routing Table\n" |
11495 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
11496 | "Route map reference\n" |
11497 | "Pointer to route-map entries\n" | |
11498 | "Metric for redistributed routes\n" | |
11499 | "Default metric\n") | |
11500 | { | |
11501 | u_int32_t metric; | |
11502 | struct bgp_redist *red; | |
11503 | u_short instance; | |
7a4bb9c5 | 11504 | int protocol; |
7c8ff89e | 11505 | |
7a4bb9c5 DS |
11506 | if (strncmp(argv[0], "o", 1) == 0) |
11507 | protocol = ZEBRA_ROUTE_OSPF; | |
11508 | else | |
11509 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 11510 | |
7a4bb9c5 DS |
11511 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
11512 | VTY_GET_INTEGER ("metric", metric, argv[3]); | |
11513 | ||
11514 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
11515 | bgp_redistribute_rmap_set (red, argv[2]); | |
caf958b4 | 11516 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
8bb0831e | 11517 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
11518 | } |
11519 | ||
11520 | DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, | |
11521 | bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 11522 | "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
11523 | "Redistribute information from another routing protocol\n" |
11524 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11525 | "Non-main Kernel Routing Table\n" |
11526 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
11527 | "Metric for redistributed routes\n" |
11528 | "Default metric\n" | |
11529 | "Route map reference\n" | |
11530 | "Pointer to route-map entries\n") | |
11531 | { | |
11532 | u_int32_t metric; | |
11533 | struct bgp_redist *red; | |
11534 | u_short instance; | |
7a4bb9c5 | 11535 | int protocol; |
7c8ff89e | 11536 | |
7a4bb9c5 DS |
11537 | if (strncmp(argv[0], "o", 1) == 0) |
11538 | protocol = ZEBRA_ROUTE_OSPF; | |
11539 | else | |
11540 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 11541 | |
7a4bb9c5 DS |
11542 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
11543 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
11544 | ||
11545 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 11546 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
7a4bb9c5 | 11547 | bgp_redistribute_rmap_set (red, argv[3]); |
8bb0831e | 11548 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
11549 | } |
11550 | ||
11551 | DEFUN (no_bgp_redistribute_ipv4_ospf, | |
11552 | no_bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 11553 | "no redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
11554 | NO_STR |
11555 | "Redistribute information from another routing protocol\n" | |
11556 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11557 | "Non-main Kernel Routing Table\n" |
11558 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
11559 | { |
11560 | u_short instance; | |
7a4bb9c5 DS |
11561 | int protocol; |
11562 | ||
11563 | if (strncmp(argv[0], "o", 1) == 0) | |
11564 | protocol = ZEBRA_ROUTE_OSPF; | |
11565 | else | |
11566 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 11567 | |
7a4bb9c5 DS |
11568 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
11569 | return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); | |
7c8ff89e DS |
11570 | } |
11571 | ||
11572 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
11573 | no_bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 11574 | "no redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
11575 | NO_STR |
11576 | "Redistribute information from another routing protocol\n" | |
11577 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11578 | "Non-main Kernel Routing Table\n" |
11579 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
11580 | "Route map reference\n" |
11581 | "Pointer to route-map entries\n") | |
11582 | ||
11583 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
11584 | no_bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 11585 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
11586 | NO_STR |
11587 | "Redistribute information from another routing protocol\n" | |
11588 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11589 | "Non-main Kernel Routing Table\n" |
11590 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
11591 | "Metric for redistributed routes\n" |
11592 | "Default metric\n") | |
11593 | ||
11594 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
11595 | no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 11596 | "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
11597 | NO_STR |
11598 | "Redistribute information from another routing protocol\n" | |
11599 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11600 | "Non-main Kernel Routing Table\n" |
11601 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
11602 | "Route map reference\n" |
11603 | "Pointer to route-map entries\n" | |
11604 | "Metric for redistributed routes\n" | |
11605 | "Default metric\n") | |
11606 | ||
11607 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
11608 | no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 11609 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
11610 | NO_STR |
11611 | "Redistribute information from another routing protocol\n" | |
11612 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
11613 | "Non-main Kernel Routing Table\n" |
11614 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
11615 | "Metric for redistributed routes\n" |
11616 | "Default metric\n" | |
11617 | "Route map reference\n" | |
11618 | "Pointer to route-map entries\n") | |
11619 | ||
718e3744 | 11620 | DEFUN (no_bgp_redistribute_ipv4, |
11621 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 11622 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 11623 | NO_STR |
11624 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11625 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 11626 | { |
11627 | int type; | |
11628 | ||
e0ca5fde DL |
11629 | type = proto_redistnum (AFI_IP, argv[0]); |
11630 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11631 | { |
11632 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11633 | return CMD_WARNING; | |
11634 | } | |
7c8ff89e | 11635 | return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); |
718e3744 | 11636 | } |
11637 | ||
503006bc | 11638 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 11639 | no_bgp_redistribute_ipv4_rmap_cmd, |
e0ca5fde | 11640 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 11641 | NO_STR |
11642 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11643 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11644 | "Route map reference\n" |
11645 | "Pointer to route-map entries\n") | |
718e3744 | 11646 | |
503006bc | 11647 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 11648 | no_bgp_redistribute_ipv4_metric_cmd, |
e0ca5fde | 11649 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 11650 | NO_STR |
11651 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11652 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11653 | "Metric for redistributed routes\n" |
11654 | "Default metric\n") | |
718e3744 | 11655 | |
503006bc | 11656 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 11657 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
e0ca5fde | 11658 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 11659 | NO_STR |
11660 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11661 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11662 | "Route map reference\n" |
11663 | "Pointer to route-map entries\n" | |
11664 | "Metric for redistributed routes\n" | |
11665 | "Default metric\n") | |
718e3744 | 11666 | |
503006bc | 11667 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 11668 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
e0ca5fde | 11669 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 11670 | NO_STR |
11671 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11672 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11673 | "Metric for redistributed routes\n" |
11674 | "Default metric\n" | |
11675 | "Route map reference\n" | |
11676 | "Pointer to route-map entries\n") | |
6b0655a2 | 11677 | |
718e3744 | 11678 | #ifdef HAVE_IPV6 |
11679 | DEFUN (bgp_redistribute_ipv6, | |
11680 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 11681 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 11682 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11683 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 11684 | { |
11685 | int type; | |
11686 | ||
e0ca5fde DL |
11687 | type = proto_redistnum (AFI_IP6, argv[0]); |
11688 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11689 | { |
11690 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11691 | return CMD_WARNING; | |
11692 | } | |
11693 | ||
7c8ff89e | 11694 | bgp_redist_add(vty->index, AFI_IP6, type, 0); |
8bb0831e | 11695 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11696 | } |
11697 | ||
11698 | DEFUN (bgp_redistribute_ipv6_rmap, | |
11699 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 11700 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 11701 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11702 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11703 | "Route map reference\n" |
11704 | "Pointer to route-map entries\n") | |
11705 | { | |
11706 | int type; | |
7c8ff89e | 11707 | struct bgp_redist *red; |
718e3744 | 11708 | |
e0ca5fde DL |
11709 | type = proto_redistnum (AFI_IP6, argv[0]); |
11710 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11711 | { |
11712 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11713 | return CMD_WARNING; | |
11714 | } | |
11715 | ||
7c8ff89e DS |
11716 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
11717 | bgp_redistribute_rmap_set (red, argv[1]); | |
8bb0831e | 11718 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11719 | } |
11720 | ||
11721 | DEFUN (bgp_redistribute_ipv6_metric, | |
11722 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 11723 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 11724 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11725 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11726 | "Metric for redistributed routes\n" |
11727 | "Default metric\n") | |
11728 | { | |
11729 | int type; | |
11730 | u_int32_t metric; | |
7c8ff89e | 11731 | struct bgp_redist *red; |
718e3744 | 11732 | |
e0ca5fde DL |
11733 | type = proto_redistnum (AFI_IP6, argv[0]); |
11734 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11735 | { |
11736 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11737 | return CMD_WARNING; | |
11738 | } | |
11739 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
11740 | ||
7c8ff89e | 11741 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 11742 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
8bb0831e | 11743 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11744 | } |
11745 | ||
11746 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
11747 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 11748 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 11749 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11750 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11751 | "Route map reference\n" |
11752 | "Pointer to route-map entries\n" | |
11753 | "Metric for redistributed routes\n" | |
11754 | "Default metric\n") | |
11755 | { | |
11756 | int type; | |
11757 | u_int32_t metric; | |
7c8ff89e | 11758 | struct bgp_redist *red; |
718e3744 | 11759 | |
e0ca5fde DL |
11760 | type = proto_redistnum (AFI_IP6, argv[0]); |
11761 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11762 | { |
11763 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11764 | return CMD_WARNING; | |
11765 | } | |
11766 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
11767 | ||
7c8ff89e DS |
11768 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
11769 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 11770 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
8bb0831e | 11771 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11772 | } |
11773 | ||
11774 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
11775 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 11776 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 11777 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11778 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11779 | "Metric for redistributed routes\n" |
11780 | "Default metric\n" | |
11781 | "Route map reference\n" | |
11782 | "Pointer to route-map entries\n") | |
11783 | { | |
11784 | int type; | |
11785 | u_int32_t metric; | |
7c8ff89e | 11786 | struct bgp_redist *red; |
718e3744 | 11787 | |
e0ca5fde DL |
11788 | type = proto_redistnum (AFI_IP6, argv[0]); |
11789 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11790 | { |
11791 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11792 | return CMD_WARNING; | |
11793 | } | |
11794 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
11795 | ||
7c8ff89e | 11796 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 11797 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric); |
7c8ff89e | 11798 | bgp_redistribute_rmap_set (red, argv[2]); |
8bb0831e | 11799 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11800 | } |
11801 | ||
11802 | DEFUN (no_bgp_redistribute_ipv6, | |
11803 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 11804 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 11805 | NO_STR |
11806 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11807 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 11808 | { |
11809 | int type; | |
11810 | ||
e0ca5fde DL |
11811 | type = proto_redistnum (AFI_IP6, argv[0]); |
11812 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11813 | { |
11814 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11815 | return CMD_WARNING; | |
11816 | } | |
11817 | ||
7c8ff89e | 11818 | return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0); |
718e3744 | 11819 | } |
11820 | ||
503006bc | 11821 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 11822 | no_bgp_redistribute_ipv6_rmap_cmd, |
e0ca5fde | 11823 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 11824 | NO_STR |
11825 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11826 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11827 | "Route map reference\n" |
11828 | "Pointer to route-map entries\n") | |
718e3744 | 11829 | |
503006bc | 11830 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 11831 | no_bgp_redistribute_ipv6_metric_cmd, |
e0ca5fde | 11832 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 11833 | NO_STR |
11834 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11835 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11836 | "Metric for redistributed routes\n" |
11837 | "Default metric\n") | |
718e3744 | 11838 | |
503006bc | 11839 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 11840 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
e0ca5fde | 11841 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 11842 | NO_STR |
11843 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11844 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11845 | "Route map reference\n" |
11846 | "Pointer to route-map entries\n" | |
11847 | "Metric for redistributed routes\n" | |
11848 | "Default metric\n") | |
718e3744 | 11849 | |
503006bc | 11850 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 11851 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
e0ca5fde | 11852 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 11853 | NO_STR |
11854 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11855 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11856 | "Metric for redistributed routes\n" |
11857 | "Default metric\n" | |
11858 | "Route map reference\n" | |
11859 | "Pointer to route-map entries\n") | |
11860 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 11861 | |
718e3744 | 11862 | int |
11863 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
11864 | safi_t safi, int *write) | |
11865 | { | |
11866 | int i; | |
718e3744 | 11867 | |
11868 | /* Unicast redistribution only. */ | |
11869 | if (safi != SAFI_UNICAST) | |
11870 | return 0; | |
11871 | ||
11872 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
11873 | { | |
11874 | /* Redistribute BGP does not make sense. */ | |
7c8ff89e | 11875 | if (i != ZEBRA_ROUTE_BGP) |
718e3744 | 11876 | { |
7c8ff89e DS |
11877 | struct list *red_list; |
11878 | struct listnode *node; | |
11879 | struct bgp_redist *red; | |
718e3744 | 11880 | |
7c8ff89e DS |
11881 | red_list = bgp->redist[afi][i]; |
11882 | if (!red_list) | |
11883 | continue; | |
718e3744 | 11884 | |
7c8ff89e DS |
11885 | for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) |
11886 | { | |
11887 | /* Display "address-family" when it is not yet diplayed. */ | |
11888 | bgp_config_write_family_header (vty, afi, safi, write); | |
11889 | ||
11890 | /* "redistribute" configuration. */ | |
0b960b4d | 11891 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
7c8ff89e DS |
11892 | if (red->instance) |
11893 | vty_out (vty, " %d", red->instance); | |
11894 | if (red->redist_metric_flag) | |
11895 | vty_out (vty, " metric %u", red->redist_metric); | |
11896 | if (red->rmap.name) | |
11897 | vty_out (vty, " route-map %s", red->rmap.name); | |
11898 | vty_out (vty, "%s", VTY_NEWLINE); | |
11899 | } | |
718e3744 | 11900 | } |
11901 | } | |
11902 | return *write; | |
11903 | } | |
6b0655a2 | 11904 | |
718e3744 | 11905 | /* BGP node structure. */ |
7fc626de | 11906 | static struct cmd_node bgp_node = |
718e3744 | 11907 | { |
11908 | BGP_NODE, | |
11909 | "%s(config-router)# ", | |
11910 | 1, | |
11911 | }; | |
11912 | ||
7fc626de | 11913 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 11914 | { |
11915 | BGP_IPV4_NODE, | |
11916 | "%s(config-router-af)# ", | |
11917 | 1, | |
11918 | }; | |
11919 | ||
7fc626de | 11920 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 11921 | { |
11922 | BGP_IPV4M_NODE, | |
11923 | "%s(config-router-af)# ", | |
11924 | 1, | |
11925 | }; | |
11926 | ||
7fc626de | 11927 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 11928 | { |
11929 | BGP_IPV6_NODE, | |
11930 | "%s(config-router-af)# ", | |
11931 | 1, | |
11932 | }; | |
11933 | ||
7fc626de | 11934 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 11935 | { |
11936 | BGP_IPV6M_NODE, | |
11937 | "%s(config-router-af)# ", | |
11938 | 1, | |
11939 | }; | |
11940 | ||
7fc626de | 11941 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 11942 | { |
11943 | BGP_VPNV4_NODE, | |
11944 | "%s(config-router-af)# ", | |
11945 | 1 | |
11946 | }; | |
6b0655a2 | 11947 | |
1f8ae70b | 11948 | static void community_list_vty (void); |
11949 | ||
718e3744 | 11950 | void |
94f2b392 | 11951 | bgp_vty_init (void) |
718e3744 | 11952 | { |
718e3744 | 11953 | /* Install bgp top node. */ |
11954 | install_node (&bgp_node, bgp_config_write); | |
11955 | install_node (&bgp_ipv4_unicast_node, NULL); | |
11956 | install_node (&bgp_ipv4_multicast_node, NULL); | |
11957 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 11958 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 11959 | install_node (&bgp_vpnv4_node, NULL); |
11960 | ||
11961 | /* Install default VTY commands to new nodes. */ | |
11962 | install_default (BGP_NODE); | |
11963 | install_default (BGP_IPV4_NODE); | |
11964 | install_default (BGP_IPV4M_NODE); | |
11965 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 11966 | install_default (BGP_IPV6M_NODE); |
718e3744 | 11967 | install_default (BGP_VPNV4_NODE); |
11968 | ||
11969 | /* "bgp multiple-instance" commands. */ | |
11970 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
11971 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
11972 | ||
11973 | /* "bgp config-type" commands. */ | |
11974 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
813d4307 | 11975 | install_element (CONFIG_NODE, &no_bgp_config_type_val_cmd); |
718e3744 | 11976 | |
11977 | /* Dummy commands (Currently not supported) */ | |
11978 | install_element (BGP_NODE, &no_synchronization_cmd); | |
11979 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
11980 | ||
11981 | /* "router bgp" commands. */ | |
11982 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
11983 | install_element (CONFIG_NODE, &router_bgp_view_cmd); | |
2385a876 | 11984 | install_element (CONFIG_NODE, &router_bgp_noasn_cmd); |
718e3744 | 11985 | |
11986 | /* "no router bgp" commands. */ | |
11987 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
11988 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); | |
11989 | ||
11990 | /* "bgp router-id" commands. */ | |
11991 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
11992 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
11993 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
11994 | ||
11995 | /* "bgp cluster-id" commands. */ | |
11996 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
11997 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
11998 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
813d4307 DW |
11999 | install_element (BGP_NODE, &no_bgp_cluster_id_ip_cmd); |
12000 | install_element (BGP_NODE, &no_bgp_cluster_id_decimal_cmd); | |
718e3744 | 12001 | |
12002 | /* "bgp confederation" commands. */ | |
12003 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
12004 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
12005 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
12006 | ||
12007 | /* "bgp confederation peers" commands. */ | |
12008 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
12009 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
12010 | ||
abc920f8 DS |
12011 | /* bgp max-med command */ |
12012 | install_element (BGP_NODE, &bgp_maxmed_admin_cmd); | |
12013 | install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd); | |
12014 | install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); | |
12015 | install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd); | |
12016 | install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); | |
12017 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); | |
12018 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd); | |
12019 | install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); | |
12020 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd); | |
12021 | ||
907f92c8 DS |
12022 | /* bgp disable-ebgp-connected-nh-check */ |
12023 | install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd); | |
12024 | install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd); | |
12025 | ||
f188f2c4 DS |
12026 | /* bgp update-delay command */ |
12027 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
12028 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
12029 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
12030 | install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); | |
12031 | ||
cb1faec9 DS |
12032 | install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); |
12033 | install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); | |
12034 | ||
3f9c7369 DS |
12035 | install_element (BGP_NODE, &bgp_coalesce_time_cmd); |
12036 | install_element (BGP_NODE, &no_bgp_coalesce_time_cmd); | |
12037 | ||
165b5fff JB |
12038 | /* "maximum-paths" commands. */ |
12039 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
12040 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
12041 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); | |
12042 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); | |
12043 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
12044 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); | |
431aa9f9 DS |
12045 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
12046 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
12047 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); | |
165b5fff | 12048 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 12049 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff JB |
12050 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
12051 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 12052 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 12053 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 12054 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 12055 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
5e242b0d | 12056 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 12057 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
431aa9f9 | 12058 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 12059 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 DS |
12060 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
12061 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 12062 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 12063 | |
718e3744 | 12064 | /* "timers bgp" commands. */ |
12065 | install_element (BGP_NODE, &bgp_timers_cmd); | |
12066 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
12067 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
12068 | ||
518f0eb1 DS |
12069 | /* route-map delay-timer commands */ |
12070 | install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd); | |
12071 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
f414725f | 12072 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); |
518f0eb1 | 12073 | |
718e3744 | 12074 | /* "bgp client-to-client reflection" commands */ |
12075 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
12076 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
12077 | ||
12078 | /* "bgp always-compare-med" commands */ | |
12079 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
12080 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
12081 | ||
12082 | /* "bgp deterministic-med" commands */ | |
12083 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
12084 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 12085 | |
538621f2 | 12086 | /* "bgp graceful-restart" commands */ |
12087 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
12088 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 12089 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
12090 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
12091 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 12092 | |
12093 | /* "bgp fast-external-failover" commands */ | |
12094 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
12095 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
12096 | ||
12097 | /* "bgp enforce-first-as" commands */ | |
12098 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
12099 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
12100 | ||
12101 | /* "bgp bestpath compare-routerid" commands */ | |
12102 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
12103 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
12104 | ||
12105 | /* "bgp bestpath as-path ignore" commands */ | |
12106 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
12107 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
12108 | ||
6811845b | 12109 | /* "bgp bestpath as-path confed" commands */ |
12110 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
12111 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
12112 | ||
2fdd455c PM |
12113 | /* "bgp bestpath as-path multipath-relax" commands */ |
12114 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
12115 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
12116 | ||
848973c7 | 12117 | /* "bgp log-neighbor-changes" commands */ |
12118 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
12119 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
12120 | ||
718e3744 | 12121 | /* "bgp bestpath med" commands */ |
12122 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
12123 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
12124 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
12125 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
12126 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
12127 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
12128 | ||
12129 | /* "no bgp default ipv4-unicast" commands. */ | |
12130 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
12131 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
12132 | ||
12133 | /* "bgp network import-check" commands. */ | |
12134 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
12135 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); | |
12136 | ||
12137 | /* "bgp default local-preference" commands. */ | |
12138 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
12139 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
12140 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
12141 | ||
04b6bdc0 DW |
12142 | /* bgp default show-hostname */ |
12143 | install_element (BGP_NODE, &bgp_default_show_hostname_cmd); | |
12144 | install_element (BGP_NODE, &no_bgp_default_show_hostname_cmd); | |
12145 | ||
3f9c7369 DS |
12146 | /* "bgp default subgroup-pkt-queue-max" commands. */ |
12147 | install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd); | |
12148 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd); | |
813d4307 | 12149 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_val_cmd); |
3f9c7369 | 12150 | |
8bd9d948 DS |
12151 | /* bgp ibgp-allow-policy-mods command */ |
12152 | install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd); | |
12153 | install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd); | |
12154 | ||
f14e6fdb DS |
12155 | /* "bgp listen limit" commands. */ |
12156 | install_element (BGP_NODE, &bgp_listen_limit_cmd); | |
12157 | install_element (BGP_NODE, &no_bgp_listen_limit_cmd); | |
813d4307 | 12158 | install_element (BGP_NODE, &no_bgp_listen_limit_val_cmd); |
f14e6fdb DS |
12159 | |
12160 | /* "bgp listen range" commands. */ | |
12161 | install_element (BGP_NODE, &bgp_listen_range_cmd); | |
12162 | install_element (BGP_NODE, &no_bgp_listen_range_cmd); | |
12163 | ||
718e3744 | 12164 | /* "neighbor remote-as" commands. */ |
12165 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
a80beece | 12166 | install_element (BGP_NODE, &neighbor_interface_config_cmd); |
718e3744 | 12167 | install_element (BGP_NODE, &no_neighbor_cmd); |
12168 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
a80beece | 12169 | install_element (BGP_NODE, &no_neighbor_interface_config_cmd); |
718e3744 | 12170 | |
12171 | /* "neighbor peer-group" commands. */ | |
12172 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
12173 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
a80beece | 12174 | install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd); |
718e3744 | 12175 | |
12176 | /* "neighbor local-as" commands. */ | |
12177 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
12178 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 12179 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 12180 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
12181 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
12182 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
9d3f9705 | 12183 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
718e3744 | 12184 | |
3f9c7369 DS |
12185 | /* "neighbor solo" commands. */ |
12186 | install_element (BGP_NODE, &neighbor_solo_cmd); | |
12187 | install_element (BGP_NODE, &no_neighbor_solo_cmd); | |
12188 | ||
0df7c91f PJ |
12189 | /* "neighbor password" commands. */ |
12190 | install_element (BGP_NODE, &neighbor_password_cmd); | |
12191 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
813d4307 | 12192 | install_element (BGP_NODE, &no_neighbor_password_val_cmd); |
0df7c91f | 12193 | |
718e3744 | 12194 | /* "neighbor activate" commands. */ |
12195 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
12196 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
12197 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
12198 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 12199 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 12200 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
12201 | ||
12202 | /* "no neighbor activate" commands. */ | |
12203 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
12204 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
12205 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
12206 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 12207 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 12208 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
12209 | ||
c8560b44 DW |
12210 | /* "neighbor peer-group" set commands. |
12211 | * Long term we should only accept this command under BGP_NODE and not all of | |
12212 | * the afi/safi sub-contexts. For now though we need to accept it for backwards | |
12213 | * compatibility. This changed when we stopped requiring that peers be assigned | |
12214 | * to their peer-group under each address-family sub-context. | |
12215 | */ | |
718e3744 | 12216 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); |
12217 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
12218 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
12219 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 12220 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 12221 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
c8560b44 | 12222 | |
718e3744 | 12223 | /* "no neighbor peer-group unset" commands. */ |
12224 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
12225 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
12226 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
12227 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 12228 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 12229 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
12230 | ||
718e3744 | 12231 | /* "neighbor softreconfiguration inbound" commands.*/ |
12232 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
12233 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
12234 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
12235 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
12236 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
12237 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
12238 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
12239 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 12240 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
12241 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 12242 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
12243 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 12244 | |
12245 | /* "neighbor attribute-unchanged" commands. */ | |
12246 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
12247 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
12248 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
12249 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
12250 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
12251 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
12252 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
12253 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
12254 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
12255 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
12256 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
12257 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
12258 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12259 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12260 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12261 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12262 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12263 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12264 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12265 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12266 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12267 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
12268 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
12269 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
12270 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
12271 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
12272 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
12273 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
12274 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
12275 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
12276 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
12277 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
12278 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
12279 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
12280 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12281 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12282 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12283 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12284 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12285 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12286 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12287 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12288 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12289 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
12290 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
12291 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
12292 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
12293 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
12294 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
12295 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
12296 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
12297 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
12298 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
12299 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
12300 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
12301 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
12302 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12303 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12304 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12305 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12306 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12307 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12308 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12309 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12310 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12311 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
12312 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
12313 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
12314 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
12315 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
12316 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
12317 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
12318 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
12319 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
12320 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
12321 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
12322 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
12323 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
12324 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12325 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12326 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12327 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12328 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12329 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12330 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12331 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12332 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12333 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 12334 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
12335 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
12336 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
12337 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
12338 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
12339 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
12340 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
12341 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
12342 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
12343 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
12344 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
12345 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
12346 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12347 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12348 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12349 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12350 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12351 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12352 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12353 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12354 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12355 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 12356 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
12357 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
12358 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
12359 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
12360 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
12361 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
12362 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
12363 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
12364 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
12365 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
12366 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
12367 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
12368 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12369 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12370 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12371 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12372 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12373 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12374 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12375 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12376 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12377 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
12378 | ||
fee0f4c6 | 12379 | /* "nexthop-local unchanged" commands */ |
12380 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
12381 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
12382 | ||
718e3744 | 12383 | /* "neighbor next-hop-self" commands. */ |
12384 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
12385 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
12386 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
12387 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
12388 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
12389 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
12390 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
12391 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 12392 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
12393 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 12394 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
12395 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
12396 | ||
a538debe DS |
12397 | /* "neighbor next-hop-self force" commands. */ |
12398 | install_element (BGP_NODE, &neighbor_nexthop_self_force_cmd); | |
12399 | install_element (BGP_NODE, &no_neighbor_nexthop_self_force_cmd); | |
12400 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd); | |
12401 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
12402 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd); | |
12403 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
12404 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd); | |
12405 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
12406 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd); | |
12407 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
12408 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd); | |
12409 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
12410 | ||
c7122e14 DS |
12411 | /* "neighbor as-override" commands. */ |
12412 | install_element (BGP_NODE, &neighbor_as_override_cmd); | |
12413 | install_element (BGP_NODE, &no_neighbor_as_override_cmd); | |
12414 | install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd); | |
12415 | install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd); | |
12416 | install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd); | |
12417 | install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd); | |
12418 | install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd); | |
12419 | install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd); | |
12420 | install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd); | |
12421 | install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd); | |
12422 | install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd); | |
12423 | install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd); | |
12424 | ||
718e3744 | 12425 | /* "neighbor remove-private-AS" commands. */ |
12426 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
12427 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
12428 | install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd); |
12429 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd); | |
12430 | install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
12431 | install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
12432 | install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
12433 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 12434 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
12435 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
12436 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd); |
12437 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
12438 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
12439 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
12440 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
12441 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 12442 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
12443 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
12444 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd); |
12445 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
12446 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
12447 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
12448 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
12449 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 12450 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
12451 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
12452 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd); |
12453 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
12454 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
12455 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
12456 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
12457 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
25ffbdc1 | 12458 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
12459 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
12460 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd); |
12461 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
12462 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
12463 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
12464 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
12465 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 12466 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
12467 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
12468 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd); |
12469 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
12470 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
12471 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
12472 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
12473 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 12474 | |
12475 | /* "neighbor send-community" commands.*/ | |
12476 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
12477 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
12478 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
12479 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
12480 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
12481 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
12482 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
12483 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
12484 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
12485 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
12486 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
12487 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
12488 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
12489 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
12490 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
12491 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 12492 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
12493 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
12494 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
12495 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 12496 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
12497 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
12498 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
12499 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
12500 | ||
12501 | /* "neighbor route-reflector" commands.*/ | |
12502 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
12503 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
12504 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
12505 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
12506 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
12507 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
12508 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
12509 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 12510 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
12511 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 12512 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
12513 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
12514 | ||
12515 | /* "neighbor route-server" commands.*/ | |
12516 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
12517 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
12518 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
12519 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
12520 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
12521 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
12522 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
12523 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 12524 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
12525 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 12526 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
12527 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
12528 | ||
adbac85e DW |
12529 | /* "neighbor addpath-tx-all-paths" commands.*/ |
12530 | install_element (BGP_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
12531 | install_element (BGP_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
12532 | install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
12533 | install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
12534 | install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
12535 | install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
12536 | install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
12537 | install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
12538 | install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
12539 | install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
12540 | install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_all_paths_cmd); | |
12541 | install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_all_paths_cmd); | |
12542 | ||
06370dac DW |
12543 | /* "neighbor addpath-tx-bestpath-per-AS" commands.*/ |
12544 | install_element (BGP_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
12545 | install_element (BGP_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
12546 | install_element (BGP_IPV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
12547 | install_element (BGP_IPV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
12548 | install_element (BGP_IPV4M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
12549 | install_element (BGP_IPV4M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
12550 | install_element (BGP_IPV6_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
12551 | install_element (BGP_IPV6_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
12552 | install_element (BGP_IPV6M_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
12553 | install_element (BGP_IPV6M_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
12554 | install_element (BGP_VPNV4_NODE, &neighbor_addpath_tx_bestpath_per_as_cmd); | |
12555 | install_element (BGP_VPNV4_NODE, &no_neighbor_addpath_tx_bestpath_per_as_cmd); | |
12556 | ||
718e3744 | 12557 | /* "neighbor passive" commands. */ |
12558 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
12559 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
12560 | ||
d5a5c8f0 | 12561 | |
718e3744 | 12562 | /* "neighbor shutdown" commands. */ |
12563 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
12564 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
12565 | ||
8a92a8a0 DS |
12566 | /* "neighbor capability extended-nexthop" commands.*/ |
12567 | install_element (BGP_NODE, &neighbor_capability_enhe_cmd); | |
12568 | install_element (BGP_NODE, &no_neighbor_capability_enhe_cmd); | |
12569 | ||
718e3744 | 12570 | /* "neighbor capability orf prefix-list" commands.*/ |
12571 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
12572 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
12573 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
12574 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
12575 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
12576 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
12577 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
12578 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 12579 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
12580 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 12581 | |
12582 | /* "neighbor capability dynamic" commands.*/ | |
12583 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
12584 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
12585 | ||
12586 | /* "neighbor dont-capability-negotiate" commands. */ | |
12587 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
12588 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
12589 | ||
12590 | /* "neighbor ebgp-multihop" commands. */ | |
12591 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
12592 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
12593 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
12594 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
12595 | ||
6ffd2079 | 12596 | /* "neighbor disable-connected-check" commands. */ |
12597 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
12598 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 12599 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
12600 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
12601 | ||
12602 | /* "neighbor description" commands. */ | |
12603 | install_element (BGP_NODE, &neighbor_description_cmd); | |
12604 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
12605 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
12606 | ||
12607 | /* "neighbor update-source" commands. "*/ | |
12608 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
12609 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
12610 | ||
12611 | /* "neighbor default-originate" commands. */ | |
12612 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
12613 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
12614 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
12615 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
12616 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
12617 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
12618 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
12619 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
12620 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
12621 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
12622 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
12623 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
12624 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
12625 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
12626 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
12627 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 12628 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
12629 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
12630 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
12631 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 12632 | |
12633 | /* "neighbor port" commands. */ | |
12634 | install_element (BGP_NODE, &neighbor_port_cmd); | |
12635 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
12636 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
12637 | ||
12638 | /* "neighbor weight" commands. */ | |
12639 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
12640 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
12641 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
12642 | ||
12643 | /* "neighbor override-capability" commands. */ | |
12644 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
12645 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
12646 | ||
12647 | /* "neighbor strict-capability-match" commands. */ | |
12648 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
12649 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
12650 | ||
12651 | /* "neighbor timers" commands. */ | |
12652 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
12653 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
813d4307 | 12654 | install_element (BGP_NODE, &no_neighbor_timers_val_cmd); |
718e3744 | 12655 | |
12656 | /* "neighbor timers connect" commands. */ | |
12657 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
12658 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
12659 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
12660 | ||
12661 | /* "neighbor advertisement-interval" commands. */ | |
12662 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
12663 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
12664 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
12665 | ||
718e3744 | 12666 | /* "neighbor interface" commands. */ |
12667 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
12668 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
12669 | ||
12670 | /* "neighbor distribute" commands. */ | |
12671 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
12672 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
12673 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
12674 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
12675 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
12676 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
12677 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
12678 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 12679 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
12680 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 12681 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
12682 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
12683 | ||
12684 | /* "neighbor prefix-list" commands. */ | |
12685 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
12686 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
12687 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
12688 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
12689 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
12690 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
12691 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
12692 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 12693 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
12694 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 12695 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
12696 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
12697 | ||
12698 | /* "neighbor filter-list" commands. */ | |
12699 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
12700 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
12701 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
12702 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
12703 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
12704 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
12705 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
12706 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 12707 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
12708 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 12709 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
12710 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
12711 | ||
12712 | /* "neighbor route-map" commands. */ | |
12713 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
12714 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
12715 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
12716 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
12717 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
12718 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
12719 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
12720 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 12721 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
12722 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 12723 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
12724 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
12725 | ||
12726 | /* "neighbor unsuppress-map" commands. */ | |
12727 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
12728 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
12729 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
12730 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
12731 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
12732 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
12733 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
12734 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 12735 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
12736 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 12737 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
12738 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 12739 | |
12740 | /* "neighbor maximum-prefix" commands. */ | |
12741 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 12742 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12743 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12744 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12745 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
12746 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12747 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
12748 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12749 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12750 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12751 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12752 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12753 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12754 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 12755 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12756 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12757 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12758 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
12759 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12760 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
12761 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12762 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12763 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12764 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12765 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12766 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12767 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 12768 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12769 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12770 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12771 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
12772 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12773 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
12774 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12775 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12776 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12777 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12778 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12779 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12780 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 12781 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12782 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12783 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12784 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
12785 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12786 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
12787 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12788 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12789 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12790 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12791 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12792 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 12793 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
12794 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
12795 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
12796 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
12797 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
12798 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
12799 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
12800 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
12801 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
12802 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12803 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12804 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12805 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12806 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 12807 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12808 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12809 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12810 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
12811 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12812 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
12813 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12814 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12815 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12816 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12817 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12818 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12819 | |
12820 | /* "neighbor allowas-in" */ | |
12821 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
12822 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
12823 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 12824 | install_element (BGP_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 12825 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); |
12826 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
12827 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 12828 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 12829 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); |
12830 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
12831 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 12832 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 12833 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); |
12834 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
12835 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 12836 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_val_cmd); |
25ffbdc1 | 12837 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
12838 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
12839 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 12840 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 12841 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
12842 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
12843 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
813d4307 | 12844 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_val_cmd); |
718e3744 | 12845 | |
12846 | /* address-family commands. */ | |
12847 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
12848 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
12849 | #ifdef HAVE_IPV6 | |
12850 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 12851 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 12852 | #endif /* HAVE_IPV6 */ |
12853 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
12854 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
12855 | ||
12856 | /* "exit-address-family" command. */ | |
12857 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
12858 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
12859 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 12860 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 12861 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
12862 | ||
12863 | /* "clear ip bgp commands" */ | |
12864 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
12865 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
12866 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
12867 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); | |
12868 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); | |
12869 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); | |
12870 | #ifdef HAVE_IPV6 | |
12871 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); | |
12872 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
12873 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
12874 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); | |
12875 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); | |
12876 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); | |
12877 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); | |
12878 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); | |
12879 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); | |
12880 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); | |
12881 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); | |
12882 | #endif /* HAVE_IPV6 */ | |
12883 | ||
12884 | /* "clear ip bgp neighbor soft in" */ | |
12885 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
12886 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
12887 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
12888 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); | |
12889 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); | |
12890 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); | |
12891 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); | |
12892 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); | |
12893 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
12894 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); | |
12895 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); | |
12896 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
12897 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); | |
12898 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); | |
12899 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
12900 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); | |
12901 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); | |
12902 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
12903 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
12904 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
12905 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); | |
12906 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); | |
12907 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); | |
12908 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); | |
12909 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); | |
12910 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
12911 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); | |
12912 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); | |
12913 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
12914 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); | |
12915 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); | |
12916 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
12917 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); | |
12918 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); | |
12919 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
12920 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
12921 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
12922 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
12923 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
12924 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
12925 | #ifdef HAVE_IPV6 | |
12926 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); | |
12927 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
12928 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
12929 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); | |
12930 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
12931 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); | |
12932 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); | |
12933 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
12934 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); | |
12935 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); | |
12936 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
12937 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); | |
12938 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); | |
12939 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
12940 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); | |
12941 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); | |
12942 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
12943 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); | |
12944 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); | |
12945 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
12946 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); | |
12947 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); | |
12948 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
12949 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); | |
12950 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); | |
12951 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
12952 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); | |
12953 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); | |
12954 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
12955 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); | |
12956 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); | |
12957 | #endif /* HAVE_IPV6 */ | |
12958 | ||
8ad7271d DS |
12959 | /* clear ip bgp prefix */ |
12960 | install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); | |
12961 | install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); | |
12962 | ||
718e3744 | 12963 | /* "clear ip bgp neighbor soft out" */ |
12964 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
12965 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
12966 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
12967 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); | |
12968 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); | |
12969 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); | |
12970 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); | |
12971 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); | |
12972 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); | |
12973 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); | |
12974 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); | |
12975 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); | |
12976 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
12977 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
12978 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); | |
12979 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); | |
12980 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); | |
12981 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); | |
12982 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); | |
12983 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); | |
12984 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); | |
12985 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); | |
12986 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); | |
12987 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
12988 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
12989 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
12990 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
12991 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
12992 | #ifdef HAVE_IPV6 | |
12993 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); | |
12994 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
12995 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
12996 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); | |
12997 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); | |
12998 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); | |
12999 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); | |
13000 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); | |
13001 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); | |
13002 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); | |
13003 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); | |
13004 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); | |
13005 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); | |
13006 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); | |
13007 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); | |
13008 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); | |
13009 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); | |
13010 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); | |
13011 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); | |
13012 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); | |
13013 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); | |
13014 | #endif /* HAVE_IPV6 */ | |
13015 | ||
13016 | /* "clear ip bgp neighbor soft" */ | |
13017 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
13018 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
13019 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
13020 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); | |
13021 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); | |
13022 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); | |
13023 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); | |
13024 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
13025 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
13026 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); | |
13027 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); | |
13028 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); | |
13029 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); | |
13030 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
13031 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
13032 | #ifdef HAVE_IPV6 | |
13033 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); | |
13034 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
13035 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
13036 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); | |
13037 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); | |
13038 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); | |
13039 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); | |
13040 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); | |
13041 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); | |
13042 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); | |
13043 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); | |
13044 | #endif /* HAVE_IPV6 */ | |
13045 | ||
13046 | /* "show ip bgp summary" commands. */ | |
13047 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
13048 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); |
13049 | install_element (VIEW_NODE, &show_bgp_updgrps_cmd); | |
13050 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8fe8a7f6 DS |
13051 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd); |
13052 | install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd); | |
13053 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
3f9c7369 DS |
13054 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); |
13055 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd); | |
13056 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
8fe8a7f6 DS |
13057 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
13058 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd); | |
13059 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd); | |
718e3744 | 13060 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
13061 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 13062 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 13063 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 13064 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 13065 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
13066 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
13067 | #ifdef HAVE_IPV6 | |
13068 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
13069 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); | |
13070 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 13071 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 13072 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 13073 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
13074 | #endif /* HAVE_IPV6 */ |
13075 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
13076 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); |
13077 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd); | |
13078 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8fe8a7f6 DS |
13079 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd); |
13080 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd); | |
13081 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
3f9c7369 DS |
13082 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd); |
13083 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd); | |
13084 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
8fe8a7f6 DS |
13085 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
13086 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd); | |
13087 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd); | |
62687ff1 PJ |
13088 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
13089 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 13090 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
62687ff1 | 13091 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 13092 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
62687ff1 PJ |
13093 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
13094 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
13095 | #ifdef HAVE_IPV6 | |
13096 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
13097 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); | |
13098 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 13099 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
62687ff1 | 13100 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 13101 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 13102 | #endif /* HAVE_IPV6 */ |
13103 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
13104 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); |
13105 | install_element (ENABLE_NODE, &show_bgp_updgrps_cmd); | |
13106 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8fe8a7f6 DS |
13107 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd); |
13108 | install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd); | |
13109 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
3f9c7369 DS |
13110 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd); |
13111 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd); | |
13112 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
8fe8a7f6 DS |
13113 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
13114 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd); | |
13115 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd); | |
718e3744 | 13116 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
13117 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 13118 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 13119 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 13120 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 13121 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
13122 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
13123 | #ifdef HAVE_IPV6 | |
13124 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
13125 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); | |
13126 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 13127 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 13128 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 13129 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 13130 | #endif /* HAVE_IPV6 */ |
13131 | ||
13132 | /* "show ip bgp neighbors" commands. */ | |
13133 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
13134 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
13135 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
13136 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
13137 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
13138 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
13139 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
13140 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
13141 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
13142 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
62687ff1 PJ |
13143 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
13144 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
13145 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
13146 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
13147 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 13148 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
13149 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
13150 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
13151 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
13152 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
13153 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
13154 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
13155 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
13156 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
13157 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
13158 | ||
13159 | #ifdef HAVE_IPV6 | |
13160 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
13161 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
13162 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
13163 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 13164 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
13165 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
13166 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
13167 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
13168 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
13169 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
13170 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
13171 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 13172 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
13173 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
13174 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
13175 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 13176 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
13177 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
13178 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
13179 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 13180 | |
13181 | /* Old commands. */ | |
13182 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
13183 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
13184 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
13185 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
13186 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 13187 | |
f14e6fdb DS |
13188 | /* "show ip bgp peer-group" commands. */ |
13189 | install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); | |
13190 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
13191 | install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd); | |
13192 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
13193 | install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd); | |
13194 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
13195 | install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd); | |
13196 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
13197 | ||
718e3744 | 13198 | /* "show ip bgp paths" commands. */ |
13199 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
13200 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
13201 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
13202 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
13203 | ||
13204 | /* "show ip bgp community" commands. */ | |
13205 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
13206 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
13207 | ||
13208 | /* "show ip bgp attribute-info" commands. */ | |
13209 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
13210 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
13211 | ||
13212 | /* "redistribute" commands. */ | |
13213 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
13214 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
13215 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
13216 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
13217 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
13218 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
13219 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
13220 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
13221 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
13222 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
7c8ff89e DS |
13223 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd); |
13224 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
13225 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
13226 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
13227 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
13228 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
13229 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
13230 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
13231 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
13232 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
919e0666 DW |
13233 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_cmd); |
13234 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_cmd); | |
13235 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
13236 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
13237 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
13238 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
13239 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
13240 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
13241 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
13242 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
13243 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_cmd); | |
13244 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
13245 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
13246 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
13247 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
13248 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
13249 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
13250 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
13251 | install_element (BGP_IPV4_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
13252 | install_element (BGP_IPV4_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
718e3744 | 13253 | #ifdef HAVE_IPV6 |
13254 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
13255 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
13256 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
13257 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
13258 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
13259 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
13260 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
13261 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
13262 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
13263 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
13264 | #endif /* HAVE_IPV6 */ | |
13265 | ||
fa411a21 NH |
13266 | /* ttl_security commands */ |
13267 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
13268 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
13269 | ||
4bf6a362 PJ |
13270 | /* "show bgp memory" commands. */ |
13271 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 13272 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
13273 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
13274 | ||
e0081f70 ML |
13275 | /* "show bgp views" commands. */ |
13276 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
13277 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
13278 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
13279 | ||
718e3744 | 13280 | /* Community-list. */ |
13281 | community_list_vty (); | |
13282 | } | |
6b0655a2 | 13283 | |
718e3744 | 13284 | #include "memory.h" |
13285 | #include "bgp_regex.h" | |
13286 | #include "bgp_clist.h" | |
13287 | #include "bgp_ecommunity.h" | |
13288 | ||
13289 | /* VTY functions. */ | |
13290 | ||
13291 | /* Direction value to string conversion. */ | |
94f2b392 | 13292 | static const char * |
718e3744 | 13293 | community_direct_str (int direct) |
13294 | { | |
13295 | switch (direct) | |
13296 | { | |
13297 | case COMMUNITY_DENY: | |
13298 | return "deny"; | |
718e3744 | 13299 | case COMMUNITY_PERMIT: |
13300 | return "permit"; | |
718e3744 | 13301 | default: |
13302 | return "unknown"; | |
718e3744 | 13303 | } |
13304 | } | |
13305 | ||
13306 | /* Display error string. */ | |
94f2b392 | 13307 | static void |
718e3744 | 13308 | community_list_perror (struct vty *vty, int ret) |
13309 | { | |
13310 | switch (ret) | |
13311 | { | |
13312 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 13313 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 13314 | break; |
13315 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
13316 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
13317 | break; | |
13318 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
13319 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
13320 | break; | |
13321 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
13322 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
13323 | break; | |
13324 | } | |
13325 | } | |
13326 | ||
13327 | /* VTY interface for community_set() function. */ | |
94f2b392 | 13328 | static int |
fd79ac91 | 13329 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
13330 | int style, int reject_all_digit_name) | |
718e3744 | 13331 | { |
13332 | int ret; | |
13333 | int direct; | |
13334 | char *str; | |
13335 | ||
13336 | /* Check the list type. */ | |
13337 | if (strncmp (argv[1], "p", 1) == 0) | |
13338 | direct = COMMUNITY_PERMIT; | |
13339 | else if (strncmp (argv[1], "d", 1) == 0) | |
13340 | direct = COMMUNITY_DENY; | |
13341 | else | |
13342 | { | |
13343 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
13344 | VTY_NEWLINE); | |
13345 | return CMD_WARNING; | |
13346 | } | |
13347 | ||
13348 | /* All digit name check. */ | |
13349 | if (reject_all_digit_name && all_digit (argv[0])) | |
13350 | { | |
13351 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
13352 | return CMD_WARNING; | |
13353 | } | |
13354 | ||
13355 | /* Concat community string argument. */ | |
13356 | if (argc > 1) | |
13357 | str = argv_concat (argv, argc, 2); | |
13358 | else | |
13359 | str = NULL; | |
13360 | ||
13361 | /* When community_list_set() return nevetive value, it means | |
13362 | malformed community string. */ | |
13363 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
13364 | ||
13365 | /* Free temporary community list string allocated by | |
13366 | argv_concat(). */ | |
13367 | if (str) | |
13368 | XFREE (MTYPE_TMP, str); | |
13369 | ||
13370 | if (ret < 0) | |
13371 | { | |
13372 | /* Display error string. */ | |
13373 | community_list_perror (vty, ret); | |
13374 | return CMD_WARNING; | |
13375 | } | |
13376 | ||
13377 | return CMD_SUCCESS; | |
13378 | } | |
13379 | ||
718e3744 | 13380 | /* Communiyt-list entry delete. */ |
94f2b392 | 13381 | static int |
fee6e4e4 | 13382 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
813d4307 | 13383 | int style, int delete_all) |
718e3744 | 13384 | { |
13385 | int ret; | |
fee6e4e4 | 13386 | int direct = 0; |
13387 | char *str = NULL; | |
718e3744 | 13388 | |
fee6e4e4 | 13389 | if (argc > 1) |
718e3744 | 13390 | { |
fee6e4e4 | 13391 | /* Check the list direct. */ |
13392 | if (strncmp (argv[1], "p", 1) == 0) | |
13393 | direct = COMMUNITY_PERMIT; | |
13394 | else if (strncmp (argv[1], "d", 1) == 0) | |
13395 | direct = COMMUNITY_DENY; | |
13396 | else | |
13397 | { | |
13398 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
13399 | VTY_NEWLINE); | |
13400 | return CMD_WARNING; | |
13401 | } | |
718e3744 | 13402 | |
fee6e4e4 | 13403 | /* Concat community string argument. */ |
13404 | str = argv_concat (argv, argc, 2); | |
13405 | } | |
718e3744 | 13406 | |
13407 | /* Unset community list. */ | |
813d4307 | 13408 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); |
718e3744 | 13409 | |
13410 | /* Free temporary community list string allocated by | |
13411 | argv_concat(). */ | |
fee6e4e4 | 13412 | if (str) |
13413 | XFREE (MTYPE_TMP, str); | |
718e3744 | 13414 | |
13415 | if (ret < 0) | |
13416 | { | |
13417 | community_list_perror (vty, ret); | |
13418 | return CMD_WARNING; | |
13419 | } | |
13420 | ||
13421 | return CMD_SUCCESS; | |
13422 | } | |
13423 | ||
13424 | /* "community-list" keyword help string. */ | |
13425 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
13426 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" | |
13427 | ||
718e3744 | 13428 | DEFUN (ip_community_list_standard, |
13429 | ip_community_list_standard_cmd, | |
13430 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
13431 | IP_STR | |
13432 | COMMUNITY_LIST_STR | |
13433 | "Community list number (standard)\n" | |
13434 | "Specify community to reject\n" | |
13435 | "Specify community to accept\n" | |
13436 | COMMUNITY_VAL_STR) | |
13437 | { | |
13438 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
13439 | } | |
13440 | ||
13441 | ALIAS (ip_community_list_standard, | |
13442 | ip_community_list_standard2_cmd, | |
13443 | "ip community-list <1-99> (deny|permit)", | |
13444 | IP_STR | |
13445 | COMMUNITY_LIST_STR | |
13446 | "Community list number (standard)\n" | |
13447 | "Specify community to reject\n" | |
13448 | "Specify community to accept\n") | |
13449 | ||
13450 | DEFUN (ip_community_list_expanded, | |
13451 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 13452 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 13453 | IP_STR |
13454 | COMMUNITY_LIST_STR | |
13455 | "Community list number (expanded)\n" | |
13456 | "Specify community to reject\n" | |
13457 | "Specify community to accept\n" | |
13458 | "An ordered list as a regular-expression\n") | |
13459 | { | |
13460 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
13461 | } | |
13462 | ||
13463 | DEFUN (ip_community_list_name_standard, | |
13464 | ip_community_list_name_standard_cmd, | |
13465 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
13466 | IP_STR | |
13467 | COMMUNITY_LIST_STR | |
13468 | "Add a standard community-list entry\n" | |
13469 | "Community list name\n" | |
13470 | "Specify community to reject\n" | |
13471 | "Specify community to accept\n" | |
13472 | COMMUNITY_VAL_STR) | |
13473 | { | |
13474 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
13475 | } | |
13476 | ||
13477 | ALIAS (ip_community_list_name_standard, | |
13478 | ip_community_list_name_standard2_cmd, | |
13479 | "ip community-list standard WORD (deny|permit)", | |
13480 | IP_STR | |
13481 | COMMUNITY_LIST_STR | |
13482 | "Add a standard community-list entry\n" | |
13483 | "Community list name\n" | |
13484 | "Specify community to reject\n" | |
13485 | "Specify community to accept\n") | |
13486 | ||
13487 | DEFUN (ip_community_list_name_expanded, | |
13488 | ip_community_list_name_expanded_cmd, | |
13489 | "ip community-list expanded WORD (deny|permit) .LINE", | |
13490 | IP_STR | |
13491 | COMMUNITY_LIST_STR | |
13492 | "Add an expanded community-list entry\n" | |
13493 | "Community list name\n" | |
13494 | "Specify community to reject\n" | |
13495 | "Specify community to accept\n" | |
13496 | "An ordered list as a regular-expression\n") | |
13497 | { | |
13498 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
13499 | } | |
13500 | ||
fee6e4e4 | 13501 | DEFUN (no_ip_community_list_standard_all, |
13502 | no_ip_community_list_standard_all_cmd, | |
13503 | "no ip community-list <1-99>", | |
13504 | NO_STR | |
13505 | IP_STR | |
13506 | COMMUNITY_LIST_STR | |
13507 | "Community list number (standard)\n") | |
13508 | { | |
813d4307 DW |
13509 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
13510 | } | |
13511 | ||
13512 | DEFUN (no_ip_community_list_standard_direction, | |
13513 | no_ip_community_list_standard_direction_cmd, | |
13514 | "no ip community-list <1-99> (deny|permit)", | |
13515 | NO_STR | |
13516 | IP_STR | |
13517 | COMMUNITY_LIST_STR | |
13518 | "Community list number (standard)\n" | |
13519 | "Specify community to reject\n" | |
13520 | "Specify community to accept\n") | |
13521 | { | |
13522 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
fee6e4e4 | 13523 | } |
13524 | ||
813d4307 | 13525 | |
fee6e4e4 | 13526 | DEFUN (no_ip_community_list_expanded_all, |
13527 | no_ip_community_list_expanded_all_cmd, | |
13528 | "no ip community-list <100-500>", | |
718e3744 | 13529 | NO_STR |
13530 | IP_STR | |
13531 | COMMUNITY_LIST_STR | |
718e3744 | 13532 | "Community list number (expanded)\n") |
13533 | { | |
813d4307 | 13534 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 13535 | } |
13536 | ||
fee6e4e4 | 13537 | DEFUN (no_ip_community_list_name_standard_all, |
13538 | no_ip_community_list_name_standard_all_cmd, | |
13539 | "no ip community-list standard WORD", | |
718e3744 | 13540 | NO_STR |
13541 | IP_STR | |
13542 | COMMUNITY_LIST_STR | |
13543 | "Add a standard community-list entry\n" | |
718e3744 | 13544 | "Community list name\n") |
13545 | { | |
813d4307 | 13546 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); |
718e3744 | 13547 | } |
13548 | ||
fee6e4e4 | 13549 | DEFUN (no_ip_community_list_name_expanded_all, |
13550 | no_ip_community_list_name_expanded_all_cmd, | |
13551 | "no ip community-list expanded WORD", | |
718e3744 | 13552 | NO_STR |
13553 | IP_STR | |
13554 | COMMUNITY_LIST_STR | |
fee6e4e4 | 13555 | "Add an expanded community-list entry\n" |
13556 | "Community list name\n") | |
718e3744 | 13557 | { |
813d4307 | 13558 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 13559 | } |
13560 | ||
13561 | DEFUN (no_ip_community_list_standard, | |
13562 | no_ip_community_list_standard_cmd, | |
13563 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
13564 | NO_STR | |
13565 | IP_STR | |
13566 | COMMUNITY_LIST_STR | |
13567 | "Community list number (standard)\n" | |
13568 | "Specify community to reject\n" | |
13569 | "Specify community to accept\n" | |
13570 | COMMUNITY_VAL_STR) | |
13571 | { | |
813d4307 | 13572 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
718e3744 | 13573 | } |
13574 | ||
13575 | DEFUN (no_ip_community_list_expanded, | |
13576 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 13577 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 13578 | NO_STR |
13579 | IP_STR | |
13580 | COMMUNITY_LIST_STR | |
13581 | "Community list number (expanded)\n" | |
13582 | "Specify community to reject\n" | |
13583 | "Specify community to accept\n" | |
13584 | "An ordered list as a regular-expression\n") | |
13585 | { | |
813d4307 | 13586 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 13587 | } |
13588 | ||
13589 | DEFUN (no_ip_community_list_name_standard, | |
13590 | no_ip_community_list_name_standard_cmd, | |
13591 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
13592 | NO_STR | |
13593 | IP_STR | |
13594 | COMMUNITY_LIST_STR | |
13595 | "Specify a standard community-list\n" | |
13596 | "Community list name\n" | |
13597 | "Specify community to reject\n" | |
13598 | "Specify community to accept\n" | |
13599 | COMMUNITY_VAL_STR) | |
13600 | { | |
813d4307 DW |
13601 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); |
13602 | } | |
13603 | ||
13604 | DEFUN (no_ip_community_list_name_standard_brief, | |
13605 | no_ip_community_list_name_standard_brief_cmd, | |
13606 | "no ip community-list standard WORD (deny|permit)", | |
13607 | NO_STR | |
13608 | IP_STR | |
13609 | COMMUNITY_LIST_STR | |
13610 | "Specify a standard community-list\n" | |
13611 | "Community list name\n" | |
13612 | "Specify community to reject\n" | |
13613 | "Specify community to accept\n") | |
13614 | { | |
13615 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
718e3744 | 13616 | } |
13617 | ||
13618 | DEFUN (no_ip_community_list_name_expanded, | |
13619 | no_ip_community_list_name_expanded_cmd, | |
13620 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
13621 | NO_STR | |
13622 | IP_STR | |
13623 | COMMUNITY_LIST_STR | |
13624 | "Specify an expanded community-list\n" | |
13625 | "Community list name\n" | |
13626 | "Specify community to reject\n" | |
13627 | "Specify community to accept\n" | |
13628 | "An ordered list as a regular-expression\n") | |
13629 | { | |
813d4307 | 13630 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 13631 | } |
13632 | ||
94f2b392 | 13633 | static void |
718e3744 | 13634 | community_list_show (struct vty *vty, struct community_list *list) |
13635 | { | |
13636 | struct community_entry *entry; | |
13637 | ||
13638 | for (entry = list->head; entry; entry = entry->next) | |
13639 | { | |
13640 | if (entry == list->head) | |
13641 | { | |
13642 | if (all_digit (list->name)) | |
13643 | vty_out (vty, "Community %s list %s%s", | |
13644 | entry->style == COMMUNITY_LIST_STANDARD ? | |
13645 | "standard" : "(expanded) access", | |
13646 | list->name, VTY_NEWLINE); | |
13647 | else | |
13648 | vty_out (vty, "Named Community %s list %s%s", | |
13649 | entry->style == COMMUNITY_LIST_STANDARD ? | |
13650 | "standard" : "expanded", | |
13651 | list->name, VTY_NEWLINE); | |
13652 | } | |
13653 | if (entry->any) | |
13654 | vty_out (vty, " %s%s", | |
13655 | community_direct_str (entry->direct), VTY_NEWLINE); | |
13656 | else | |
13657 | vty_out (vty, " %s %s%s", | |
13658 | community_direct_str (entry->direct), | |
13659 | entry->style == COMMUNITY_LIST_STANDARD | |
13660 | ? community_str (entry->u.com) : entry->config, | |
13661 | VTY_NEWLINE); | |
13662 | } | |
13663 | } | |
13664 | ||
13665 | DEFUN (show_ip_community_list, | |
13666 | show_ip_community_list_cmd, | |
13667 | "show ip community-list", | |
13668 | SHOW_STR | |
13669 | IP_STR | |
13670 | "List community-list\n") | |
13671 | { | |
13672 | struct community_list *list; | |
13673 | struct community_list_master *cm; | |
13674 | ||
fee6e4e4 | 13675 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 13676 | if (! cm) |
13677 | return CMD_SUCCESS; | |
13678 | ||
13679 | for (list = cm->num.head; list; list = list->next) | |
13680 | community_list_show (vty, list); | |
13681 | ||
13682 | for (list = cm->str.head; list; list = list->next) | |
13683 | community_list_show (vty, list); | |
13684 | ||
13685 | return CMD_SUCCESS; | |
13686 | } | |
13687 | ||
13688 | DEFUN (show_ip_community_list_arg, | |
13689 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 13690 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 13691 | SHOW_STR |
13692 | IP_STR | |
13693 | "List community-list\n" | |
13694 | "Community-list number\n" | |
13695 | "Community-list name\n") | |
13696 | { | |
13697 | struct community_list *list; | |
13698 | ||
fee6e4e4 | 13699 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 13700 | if (! list) |
13701 | { | |
b729294c | 13702 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 13703 | return CMD_WARNING; |
13704 | } | |
13705 | ||
13706 | community_list_show (vty, list); | |
13707 | ||
13708 | return CMD_SUCCESS; | |
13709 | } | |
6b0655a2 | 13710 | |
94f2b392 | 13711 | static int |
fd79ac91 | 13712 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
13713 | int style, int reject_all_digit_name) | |
718e3744 | 13714 | { |
13715 | int ret; | |
13716 | int direct; | |
13717 | char *str; | |
13718 | ||
13719 | /* Check the list type. */ | |
13720 | if (strncmp (argv[1], "p", 1) == 0) | |
13721 | direct = COMMUNITY_PERMIT; | |
13722 | else if (strncmp (argv[1], "d", 1) == 0) | |
13723 | direct = COMMUNITY_DENY; | |
13724 | else | |
13725 | { | |
13726 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
13727 | VTY_NEWLINE); | |
13728 | return CMD_WARNING; | |
13729 | } | |
13730 | ||
13731 | /* All digit name check. */ | |
13732 | if (reject_all_digit_name && all_digit (argv[0])) | |
13733 | { | |
13734 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
13735 | return CMD_WARNING; | |
13736 | } | |
13737 | ||
13738 | /* Concat community string argument. */ | |
13739 | if (argc > 1) | |
13740 | str = argv_concat (argv, argc, 2); | |
13741 | else | |
13742 | str = NULL; | |
13743 | ||
13744 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
13745 | ||
13746 | /* Free temporary community list string allocated by | |
13747 | argv_concat(). */ | |
13748 | if (str) | |
13749 | XFREE (MTYPE_TMP, str); | |
13750 | ||
13751 | if (ret < 0) | |
13752 | { | |
13753 | community_list_perror (vty, ret); | |
13754 | return CMD_WARNING; | |
13755 | } | |
13756 | return CMD_SUCCESS; | |
13757 | } | |
13758 | ||
94f2b392 | 13759 | static int |
fee6e4e4 | 13760 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
813d4307 | 13761 | int style, int delete_all) |
718e3744 | 13762 | { |
13763 | int ret; | |
fee6e4e4 | 13764 | int direct = 0; |
13765 | char *str = NULL; | |
718e3744 | 13766 | |
fee6e4e4 | 13767 | if (argc > 1) |
718e3744 | 13768 | { |
fee6e4e4 | 13769 | /* Check the list direct. */ |
13770 | if (strncmp (argv[1], "p", 1) == 0) | |
13771 | direct = COMMUNITY_PERMIT; | |
13772 | else if (strncmp (argv[1], "d", 1) == 0) | |
13773 | direct = COMMUNITY_DENY; | |
13774 | else | |
13775 | { | |
13776 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
13777 | VTY_NEWLINE); | |
13778 | return CMD_WARNING; | |
13779 | } | |
718e3744 | 13780 | |
fee6e4e4 | 13781 | /* Concat community string argument. */ |
13782 | str = argv_concat (argv, argc, 2); | |
718e3744 | 13783 | } |
13784 | ||
718e3744 | 13785 | /* Unset community list. */ |
813d4307 | 13786 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style, delete_all); |
718e3744 | 13787 | |
13788 | /* Free temporary community list string allocated by | |
13789 | argv_concat(). */ | |
fee6e4e4 | 13790 | if (str) |
13791 | XFREE (MTYPE_TMP, str); | |
718e3744 | 13792 | |
13793 | if (ret < 0) | |
13794 | { | |
13795 | community_list_perror (vty, ret); | |
13796 | return CMD_WARNING; | |
13797 | } | |
13798 | ||
13799 | return CMD_SUCCESS; | |
13800 | } | |
13801 | ||
13802 | /* "extcommunity-list" keyword help string. */ | |
13803 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
13804 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
13805 | ||
13806 | DEFUN (ip_extcommunity_list_standard, | |
13807 | ip_extcommunity_list_standard_cmd, | |
13808 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
13809 | IP_STR | |
13810 | EXTCOMMUNITY_LIST_STR | |
13811 | "Extended Community list number (standard)\n" | |
13812 | "Specify community to reject\n" | |
13813 | "Specify community to accept\n" | |
13814 | EXTCOMMUNITY_VAL_STR) | |
13815 | { | |
13816 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
13817 | } | |
13818 | ||
13819 | ALIAS (ip_extcommunity_list_standard, | |
13820 | ip_extcommunity_list_standard2_cmd, | |
13821 | "ip extcommunity-list <1-99> (deny|permit)", | |
13822 | IP_STR | |
13823 | EXTCOMMUNITY_LIST_STR | |
13824 | "Extended Community list number (standard)\n" | |
13825 | "Specify community to reject\n" | |
13826 | "Specify community to accept\n") | |
13827 | ||
13828 | DEFUN (ip_extcommunity_list_expanded, | |
13829 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 13830 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 13831 | IP_STR |
13832 | EXTCOMMUNITY_LIST_STR | |
13833 | "Extended Community list number (expanded)\n" | |
13834 | "Specify community to reject\n" | |
13835 | "Specify community to accept\n" | |
13836 | "An ordered list as a regular-expression\n") | |
13837 | { | |
13838 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
13839 | } | |
13840 | ||
13841 | DEFUN (ip_extcommunity_list_name_standard, | |
13842 | ip_extcommunity_list_name_standard_cmd, | |
13843 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
13844 | IP_STR | |
13845 | EXTCOMMUNITY_LIST_STR | |
13846 | "Specify standard extcommunity-list\n" | |
13847 | "Extended Community list name\n" | |
13848 | "Specify community to reject\n" | |
13849 | "Specify community to accept\n" | |
13850 | EXTCOMMUNITY_VAL_STR) | |
13851 | { | |
13852 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
13853 | } | |
13854 | ||
13855 | ALIAS (ip_extcommunity_list_name_standard, | |
13856 | ip_extcommunity_list_name_standard2_cmd, | |
13857 | "ip extcommunity-list standard WORD (deny|permit)", | |
13858 | IP_STR | |
13859 | EXTCOMMUNITY_LIST_STR | |
13860 | "Specify standard extcommunity-list\n" | |
13861 | "Extended Community list name\n" | |
13862 | "Specify community to reject\n" | |
13863 | "Specify community to accept\n") | |
13864 | ||
13865 | DEFUN (ip_extcommunity_list_name_expanded, | |
13866 | ip_extcommunity_list_name_expanded_cmd, | |
13867 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
13868 | IP_STR | |
13869 | EXTCOMMUNITY_LIST_STR | |
13870 | "Specify expanded extcommunity-list\n" | |
13871 | "Extended Community list name\n" | |
13872 | "Specify community to reject\n" | |
13873 | "Specify community to accept\n" | |
13874 | "An ordered list as a regular-expression\n") | |
13875 | { | |
13876 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
13877 | } | |
13878 | ||
fee6e4e4 | 13879 | DEFUN (no_ip_extcommunity_list_standard_all, |
13880 | no_ip_extcommunity_list_standard_all_cmd, | |
13881 | "no ip extcommunity-list <1-99>", | |
13882 | NO_STR | |
13883 | IP_STR | |
13884 | EXTCOMMUNITY_LIST_STR | |
13885 | "Extended Community list number (standard)\n") | |
13886 | { | |
813d4307 DW |
13887 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
13888 | } | |
13889 | ||
13890 | DEFUN (no_ip_extcommunity_list_standard_direction, | |
13891 | no_ip_extcommunity_list_standard_direction_cmd, | |
13892 | "no ip extcommunity-list <1-99> (deny|permit)", | |
13893 | NO_STR | |
13894 | IP_STR | |
13895 | EXTCOMMUNITY_LIST_STR | |
13896 | "Extended Community list number (standard)\n" | |
13897 | "Specify community to reject\n" | |
13898 | "Specify community to accept\n") | |
13899 | { | |
13900 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
fee6e4e4 | 13901 | } |
13902 | ||
13903 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
13904 | no_ip_extcommunity_list_expanded_all_cmd, | |
13905 | "no ip extcommunity-list <100-500>", | |
718e3744 | 13906 | NO_STR |
13907 | IP_STR | |
13908 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 13909 | "Extended Community list number (expanded)\n") |
13910 | { | |
813d4307 | 13911 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 13912 | } |
13913 | ||
fee6e4e4 | 13914 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
13915 | no_ip_extcommunity_list_name_standard_all_cmd, | |
13916 | "no ip extcommunity-list standard WORD", | |
718e3744 | 13917 | NO_STR |
13918 | IP_STR | |
13919 | EXTCOMMUNITY_LIST_STR | |
13920 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 13921 | "Extended Community list name\n") |
13922 | { | |
813d4307 | 13923 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); |
fee6e4e4 | 13924 | } |
13925 | ||
13926 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
13927 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
13928 | "no ip extcommunity-list expanded WORD", | |
13929 | NO_STR | |
13930 | IP_STR | |
13931 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 13932 | "Specify expanded extcommunity-list\n" |
13933 | "Extended Community list name\n") | |
13934 | { | |
813d4307 | 13935 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); |
718e3744 | 13936 | } |
13937 | ||
13938 | DEFUN (no_ip_extcommunity_list_standard, | |
13939 | no_ip_extcommunity_list_standard_cmd, | |
13940 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
13941 | NO_STR | |
13942 | IP_STR | |
13943 | EXTCOMMUNITY_LIST_STR | |
13944 | "Extended Community list number (standard)\n" | |
13945 | "Specify community to reject\n" | |
13946 | "Specify community to accept\n" | |
13947 | EXTCOMMUNITY_VAL_STR) | |
13948 | { | |
813d4307 | 13949 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
718e3744 | 13950 | } |
13951 | ||
13952 | DEFUN (no_ip_extcommunity_list_expanded, | |
13953 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 13954 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 13955 | NO_STR |
13956 | IP_STR | |
13957 | EXTCOMMUNITY_LIST_STR | |
13958 | "Extended Community list number (expanded)\n" | |
13959 | "Specify community to reject\n" | |
13960 | "Specify community to accept\n" | |
13961 | "An ordered list as a regular-expression\n") | |
13962 | { | |
813d4307 | 13963 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 13964 | } |
13965 | ||
13966 | DEFUN (no_ip_extcommunity_list_name_standard, | |
13967 | no_ip_extcommunity_list_name_standard_cmd, | |
13968 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
13969 | NO_STR | |
13970 | IP_STR | |
13971 | EXTCOMMUNITY_LIST_STR | |
13972 | "Specify standard extcommunity-list\n" | |
13973 | "Extended Community list name\n" | |
13974 | "Specify community to reject\n" | |
13975 | "Specify community to accept\n" | |
13976 | EXTCOMMUNITY_VAL_STR) | |
13977 | { | |
813d4307 DW |
13978 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); |
13979 | } | |
13980 | ||
13981 | DEFUN (no_ip_extcommunity_list_name_standard_brief, | |
13982 | no_ip_extcommunity_list_name_standard_brief_cmd, | |
13983 | "no ip extcommunity-list standard WORD (deny|permit)", | |
13984 | NO_STR | |
13985 | IP_STR | |
13986 | EXTCOMMUNITY_LIST_STR | |
13987 | "Specify standard extcommunity-list\n" | |
13988 | "Extended Community list name\n" | |
13989 | "Specify community to reject\n" | |
13990 | "Specify community to accept\n") | |
13991 | { | |
13992 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
718e3744 | 13993 | } |
13994 | ||
13995 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
13996 | no_ip_extcommunity_list_name_expanded_cmd, | |
13997 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
13998 | NO_STR | |
13999 | IP_STR | |
14000 | EXTCOMMUNITY_LIST_STR | |
14001 | "Specify expanded extcommunity-list\n" | |
14002 | "Community list name\n" | |
14003 | "Specify community to reject\n" | |
14004 | "Specify community to accept\n" | |
14005 | "An ordered list as a regular-expression\n") | |
14006 | { | |
813d4307 | 14007 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); |
718e3744 | 14008 | } |
14009 | ||
94f2b392 | 14010 | static void |
718e3744 | 14011 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
14012 | { | |
14013 | struct community_entry *entry; | |
14014 | ||
14015 | for (entry = list->head; entry; entry = entry->next) | |
14016 | { | |
14017 | if (entry == list->head) | |
14018 | { | |
14019 | if (all_digit (list->name)) | |
14020 | vty_out (vty, "Extended community %s list %s%s", | |
14021 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
14022 | "standard" : "(expanded) access", | |
14023 | list->name, VTY_NEWLINE); | |
14024 | else | |
14025 | vty_out (vty, "Named extended community %s list %s%s", | |
14026 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
14027 | "standard" : "expanded", | |
14028 | list->name, VTY_NEWLINE); | |
14029 | } | |
14030 | if (entry->any) | |
14031 | vty_out (vty, " %s%s", | |
14032 | community_direct_str (entry->direct), VTY_NEWLINE); | |
14033 | else | |
14034 | vty_out (vty, " %s %s%s", | |
14035 | community_direct_str (entry->direct), | |
14036 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
14037 | entry->u.ecom->str : entry->config, | |
14038 | VTY_NEWLINE); | |
14039 | } | |
14040 | } | |
14041 | ||
14042 | DEFUN (show_ip_extcommunity_list, | |
14043 | show_ip_extcommunity_list_cmd, | |
14044 | "show ip extcommunity-list", | |
14045 | SHOW_STR | |
14046 | IP_STR | |
14047 | "List extended-community list\n") | |
14048 | { | |
14049 | struct community_list *list; | |
14050 | struct community_list_master *cm; | |
14051 | ||
fee6e4e4 | 14052 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 14053 | if (! cm) |
14054 | return CMD_SUCCESS; | |
14055 | ||
14056 | for (list = cm->num.head; list; list = list->next) | |
14057 | extcommunity_list_show (vty, list); | |
14058 | ||
14059 | for (list = cm->str.head; list; list = list->next) | |
14060 | extcommunity_list_show (vty, list); | |
14061 | ||
14062 | return CMD_SUCCESS; | |
14063 | } | |
14064 | ||
14065 | DEFUN (show_ip_extcommunity_list_arg, | |
14066 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 14067 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 14068 | SHOW_STR |
14069 | IP_STR | |
14070 | "List extended-community list\n" | |
14071 | "Extcommunity-list number\n" | |
14072 | "Extcommunity-list name\n") | |
14073 | { | |
14074 | struct community_list *list; | |
14075 | ||
fee6e4e4 | 14076 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 14077 | if (! list) |
14078 | { | |
b729294c | 14079 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 14080 | return CMD_WARNING; |
14081 | } | |
14082 | ||
14083 | extcommunity_list_show (vty, list); | |
14084 | ||
14085 | return CMD_SUCCESS; | |
14086 | } | |
6b0655a2 | 14087 | |
718e3744 | 14088 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 14089 | static const char * |
718e3744 | 14090 | community_list_config_str (struct community_entry *entry) |
14091 | { | |
fd79ac91 | 14092 | const char *str; |
718e3744 | 14093 | |
14094 | if (entry->any) | |
14095 | str = ""; | |
14096 | else | |
14097 | { | |
14098 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
14099 | str = community_str (entry->u.com); | |
14100 | else | |
14101 | str = entry->config; | |
14102 | } | |
14103 | return str; | |
14104 | } | |
14105 | ||
14106 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 14107 | static int |
718e3744 | 14108 | community_list_config_write (struct vty *vty) |
14109 | { | |
14110 | struct community_list *list; | |
14111 | struct community_entry *entry; | |
14112 | struct community_list_master *cm; | |
14113 | int write = 0; | |
14114 | ||
14115 | /* Community-list. */ | |
fee6e4e4 | 14116 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 14117 | |
14118 | for (list = cm->num.head; list; list = list->next) | |
14119 | for (entry = list->head; entry; entry = entry->next) | |
14120 | { | |
fee6e4e4 | 14121 | vty_out (vty, "ip community-list %s %s %s%s", |
14122 | list->name, community_direct_str (entry->direct), | |
14123 | community_list_config_str (entry), | |
14124 | VTY_NEWLINE); | |
718e3744 | 14125 | write++; |
14126 | } | |
14127 | for (list = cm->str.head; list; list = list->next) | |
14128 | for (entry = list->head; entry; entry = entry->next) | |
14129 | { | |
14130 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
14131 | entry->style == COMMUNITY_LIST_STANDARD | |
14132 | ? "standard" : "expanded", | |
14133 | list->name, community_direct_str (entry->direct), | |
14134 | community_list_config_str (entry), | |
14135 | VTY_NEWLINE); | |
14136 | write++; | |
14137 | } | |
14138 | ||
14139 | /* Extcommunity-list. */ | |
fee6e4e4 | 14140 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 14141 | |
14142 | for (list = cm->num.head; list; list = list->next) | |
14143 | for (entry = list->head; entry; entry = entry->next) | |
14144 | { | |
fee6e4e4 | 14145 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
14146 | list->name, community_direct_str (entry->direct), | |
14147 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 14148 | write++; |
14149 | } | |
14150 | for (list = cm->str.head; list; list = list->next) | |
14151 | for (entry = list->head; entry; entry = entry->next) | |
14152 | { | |
14153 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
14154 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
14155 | ? "standard" : "expanded", | |
14156 | list->name, community_direct_str (entry->direct), | |
14157 | community_list_config_str (entry), VTY_NEWLINE); | |
14158 | write++; | |
14159 | } | |
14160 | return write; | |
14161 | } | |
14162 | ||
7fc626de | 14163 | static struct cmd_node community_list_node = |
718e3744 | 14164 | { |
14165 | COMMUNITY_LIST_NODE, | |
14166 | "", | |
14167 | 1 /* Export to vtysh. */ | |
14168 | }; | |
14169 | ||
94f2b392 | 14170 | static void |
14171 | community_list_vty (void) | |
718e3744 | 14172 | { |
14173 | install_node (&community_list_node, community_list_config_write); | |
14174 | ||
14175 | /* Community-list. */ | |
718e3744 | 14176 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
14177 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
14178 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
14179 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
14180 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
14181 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 14182 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
813d4307 | 14183 | install_element (CONFIG_NODE, &no_ip_community_list_standard_direction_cmd); |
fee6e4e4 | 14184 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); |
14185 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
14186 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 14187 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
14188 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
14189 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
813d4307 | 14190 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_brief_cmd); |
718e3744 | 14191 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); |
14192 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
14193 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
14194 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
14195 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
14196 | ||
14197 | /* Extcommunity-list. */ | |
14198 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
14199 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
14200 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
14201 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
14202 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
14203 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 14204 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
813d4307 | 14205 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_direction_cmd); |
fee6e4e4 | 14206 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); |
14207 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
14208 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 14209 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
14210 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
14211 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
813d4307 | 14212 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_brief_cmd); |
718e3744 | 14213 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); |
14214 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
14215 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
14216 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
14217 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
14218 | } |