]>
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; | |
219 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: | |
220 | str = "No activate for peergroup can be given only if peer-group has no members"; | |
221 | break; | |
222 | case BGP_ERR_PEER_BELONGS_TO_GROUP: | |
223 | str = "No activate for an individual peer-group member is invalid"; | |
224 | break; | |
225 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: | |
226 | str = "Activate the peer-group for the address family first"; | |
227 | break; | |
228 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: | |
229 | str = "Specify remote-as or peer-group remote AS first"; | |
230 | break; | |
231 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
232 | str = "Cannot change the peer-group. Deconfigure first"; | |
233 | break; | |
234 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
235 | str = "Cannot have different peer-group for the neighbor"; | |
236 | break; | |
237 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
238 | str = "Prefix/distribute list can not co-exist"; | |
239 | break; | |
240 | case BGP_ERR_NOT_INTERNAL_PEER: | |
241 | str = "Invalid command. Not an internal neighbor"; | |
242 | break; | |
243 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
5000f21c | 244 | str = "remove-private-AS cannot be configured for IBGP peers"; |
718e3744 | 245 | break; |
246 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
247 | str = "Local-AS allowed only for EBGP peers"; | |
248 | break; | |
249 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
250 | str = "Cannot have local-as same as BGP AS number"; | |
251 | break; | |
0df7c91f PJ |
252 | case BGP_ERR_TCPSIG_FAILED: |
253 | str = "Error while applying TCP-Sig to session(s)"; | |
254 | break; | |
fa411a21 NH |
255 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
256 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
257 | break; | |
f5a4827d SH |
258 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
259 | str = "ttl-security only allowed for EBGP peers"; | |
260 | break; | |
c7122e14 DS |
261 | case BGP_ERR_AS_OVERRIDE: |
262 | str = "as-override cannot be configured for IBGP peers"; | |
263 | break; | |
f14e6fdb DS |
264 | case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT: |
265 | str = "Invalid limit for number of dynamic neighbors"; | |
266 | break; | |
267 | case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS: | |
268 | str = "Dynamic neighbor listen range already exists"; | |
269 | break; | |
270 | case BGP_ERR_INVALID_FOR_DYNAMIC_PEER: | |
271 | str = "Operation not allowed on a dynamic neighbor"; | |
272 | break; | |
718e3744 | 273 | } |
274 | if (str) | |
275 | { | |
276 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
277 | return CMD_WARNING; | |
278 | } | |
279 | return CMD_SUCCESS; | |
280 | } | |
281 | ||
7aafcaca DS |
282 | /* BGP clear sort. */ |
283 | enum clear_sort | |
284 | { | |
285 | clear_all, | |
286 | clear_peer, | |
287 | clear_group, | |
288 | clear_external, | |
289 | clear_as | |
290 | }; | |
291 | ||
292 | /* Force a bestpath recalculation for all prefixes. This is used | |
293 | * when 'bgp bestpath' commands are entered. | |
294 | */ | |
295 | static void | |
296 | bgp_recalculate_all_bestpaths (struct bgp *bgp) | |
297 | { | |
298 | afi_t afi; | |
299 | safi_t safi; | |
300 | struct bgp_node *rn; | |
301 | ||
302 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
303 | { | |
304 | for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) | |
305 | { | |
306 | for (rn = bgp_table_top (bgp->rib[afi][safi]); rn; rn = bgp_route_next (rn)) | |
307 | { | |
308 | bgp_process (bgp, rn, afi, safi); | |
309 | } | |
310 | } | |
311 | } | |
312 | } | |
313 | ||
314 | static void | |
315 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, | |
316 | safi_t safi, int error) | |
317 | { | |
318 | switch (error) | |
319 | { | |
320 | case BGP_ERR_AF_UNCONFIGURED: | |
321 | vty_out (vty, | |
322 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
323 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
324 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
325 | peer->host, VTY_NEWLINE); | |
326 | break; | |
327 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
328 | 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); | |
329 | break; | |
330 | default: | |
331 | break; | |
332 | } | |
333 | } | |
334 | ||
335 | /* `clear ip bgp' functions. */ | |
336 | static int | |
337 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, | |
338 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) | |
339 | { | |
340 | int ret; | |
341 | struct peer *peer; | |
342 | struct listnode *node, *nnode; | |
343 | ||
344 | /* Clear all neighbors. */ | |
345 | /* | |
346 | * Pass along pointer to next node to peer_clear() when walking all nodes | |
347 | * on the BGP instance as that may get freed if it is a doppelganger | |
348 | */ | |
349 | if (sort == clear_all) | |
350 | { | |
351 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
352 | { | |
353 | if (stype == BGP_CLEAR_SOFT_NONE) | |
354 | ret = peer_clear (peer, &nnode); | |
355 | else if (peer->afc[afi][safi]) | |
356 | ret = peer_clear_soft (peer, afi, safi, stype); | |
357 | else | |
358 | ret = 0; | |
359 | ||
360 | if (ret < 0) | |
361 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
362 | } | |
363 | ||
364 | /* This is to apply read-only mode on this clear. */ | |
365 | if (stype == BGP_CLEAR_SOFT_NONE) | |
366 | bgp->update_delay_over = 0; | |
367 | ||
368 | return CMD_SUCCESS; | |
369 | } | |
370 | ||
371 | /* Clear specified neighbors. */ | |
372 | if (sort == clear_peer) | |
373 | { | |
374 | union sockunion su; | |
375 | int ret; | |
376 | ||
377 | /* Make sockunion for lookup. */ | |
378 | ret = str2sockunion (arg, &su); | |
379 | if (ret < 0) | |
380 | { | |
381 | peer = peer_lookup_by_conf_if (bgp, arg); | |
382 | if (!peer) | |
383 | { | |
04b6bdc0 DW |
384 | peer = peer_lookup_by_hostname(bgp, arg); |
385 | if (!peer) | |
386 | { | |
387 | vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE); | |
388 | return CMD_WARNING; | |
389 | } | |
7aafcaca DS |
390 | } |
391 | } | |
392 | else | |
393 | { | |
394 | peer = peer_lookup (bgp, &su); | |
395 | if (! peer) | |
396 | { | |
397 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
398 | return CMD_WARNING; | |
399 | } | |
400 | } | |
401 | ||
402 | if (stype == BGP_CLEAR_SOFT_NONE) | |
403 | ret = peer_clear (peer, NULL); | |
404 | else | |
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 | /* Clear all peer-group members. */ | |
414 | if (sort == clear_group) | |
415 | { | |
416 | struct peer_group *group; | |
417 | ||
418 | group = peer_group_lookup (bgp, arg); | |
419 | if (! group) | |
420 | { | |
421 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
422 | return CMD_WARNING; | |
423 | } | |
424 | ||
425 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
426 | { | |
427 | if (stype == BGP_CLEAR_SOFT_NONE) | |
428 | { | |
429 | ret = peer_clear (peer, NULL); | |
430 | continue; | |
431 | } | |
432 | ||
433 | if (! peer->af_group[afi][safi]) | |
434 | continue; | |
435 | ||
436 | ret = peer_clear_soft (peer, afi, safi, stype); | |
437 | ||
438 | if (ret < 0) | |
439 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
440 | } | |
441 | return CMD_SUCCESS; | |
442 | } | |
443 | ||
444 | if (sort == clear_external) | |
445 | { | |
446 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
447 | { | |
448 | if (peer->sort == BGP_PEER_IBGP) | |
449 | continue; | |
450 | ||
451 | if (stype == BGP_CLEAR_SOFT_NONE) | |
452 | ret = peer_clear (peer, &nnode); | |
453 | else | |
454 | ret = peer_clear_soft (peer, afi, safi, stype); | |
455 | ||
456 | if (ret < 0) | |
457 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
458 | } | |
459 | return CMD_SUCCESS; | |
460 | } | |
461 | ||
462 | if (sort == clear_as) | |
463 | { | |
464 | as_t as; | |
465 | int find = 0; | |
466 | ||
467 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); | |
468 | ||
469 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
470 | { | |
471 | if (peer->as != as) | |
472 | continue; | |
473 | ||
474 | find = 1; | |
475 | if (stype == BGP_CLEAR_SOFT_NONE) | |
476 | ret = peer_clear (peer, &nnode); | |
477 | else | |
478 | ret = peer_clear_soft (peer, afi, safi, stype); | |
479 | ||
480 | if (ret < 0) | |
481 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
482 | } | |
483 | if (! find) | |
484 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
485 | VTY_NEWLINE); | |
486 | return CMD_SUCCESS; | |
487 | } | |
488 | ||
489 | return CMD_SUCCESS; | |
490 | } | |
491 | ||
492 | static int | |
493 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, | |
494 | enum clear_sort sort, enum bgp_clear_type stype, | |
495 | const char *arg) | |
496 | { | |
497 | struct bgp *bgp; | |
498 | ||
499 | /* BGP structure lookup. */ | |
500 | if (name) | |
501 | { | |
502 | bgp = bgp_lookup_by_name (name); | |
503 | if (bgp == NULL) | |
504 | { | |
505 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); | |
506 | return CMD_WARNING; | |
507 | } | |
508 | } | |
509 | else | |
510 | { | |
511 | bgp = bgp_get_default (); | |
512 | if (bgp == NULL) | |
513 | { | |
514 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
515 | return CMD_WARNING; | |
516 | } | |
517 | } | |
518 | ||
519 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); | |
520 | } | |
521 | ||
522 | /* clear soft inbound */ | |
523 | static void | |
524 | bgp_clear_star_soft_in (struct vty *vty) | |
525 | { | |
526 | bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
527 | BGP_CLEAR_SOFT_IN, NULL); | |
528 | #ifdef HAVE_IPV6 | |
529 | bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
530 | BGP_CLEAR_SOFT_IN, NULL); | |
531 | #endif /* HAVE_IPV6 */ | |
532 | } | |
533 | ||
534 | /* clear soft outbound */ | |
535 | static void | |
536 | bgp_clear_star_soft_out (struct vty *vty) | |
537 | { | |
538 | bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
539 | BGP_CLEAR_SOFT_OUT, NULL); | |
540 | #ifdef HAVE_IPV6 | |
541 | bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
542 | BGP_CLEAR_SOFT_OUT, NULL); | |
543 | #endif /* HAVE_IPV6 */ | |
544 | } | |
545 | ||
546 | ||
718e3744 | 547 | /* BGP global configuration. */ |
548 | ||
549 | DEFUN (bgp_multiple_instance_func, | |
550 | bgp_multiple_instance_cmd, | |
551 | "bgp multiple-instance", | |
552 | BGP_STR | |
553 | "Enable bgp multiple instance\n") | |
554 | { | |
555 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
556 | return CMD_SUCCESS; | |
557 | } | |
558 | ||
559 | DEFUN (no_bgp_multiple_instance, | |
560 | no_bgp_multiple_instance_cmd, | |
561 | "no bgp multiple-instance", | |
562 | NO_STR | |
563 | BGP_STR | |
564 | "BGP multiple instance\n") | |
565 | { | |
566 | int ret; | |
567 | ||
568 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
569 | if (ret < 0) | |
570 | { | |
571 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
572 | return CMD_WARNING; | |
573 | } | |
574 | return CMD_SUCCESS; | |
575 | } | |
576 | ||
577 | DEFUN (bgp_config_type, | |
578 | bgp_config_type_cmd, | |
579 | "bgp config-type (cisco|zebra)", | |
580 | BGP_STR | |
581 | "Configuration type\n" | |
582 | "cisco\n" | |
583 | "zebra\n") | |
584 | { | |
585 | if (strncmp (argv[0], "c", 1) == 0) | |
586 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
587 | else | |
588 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
589 | ||
590 | return CMD_SUCCESS; | |
591 | } | |
592 | ||
593 | DEFUN (no_bgp_config_type, | |
594 | no_bgp_config_type_cmd, | |
595 | "no bgp config-type", | |
596 | NO_STR | |
597 | BGP_STR | |
598 | "Display configuration type\n") | |
599 | { | |
600 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
601 | return CMD_SUCCESS; | |
602 | } | |
603 | ||
604 | DEFUN (no_synchronization, | |
605 | no_synchronization_cmd, | |
606 | "no synchronization", | |
607 | NO_STR | |
608 | "Perform IGP synchronization\n") | |
609 | { | |
610 | return CMD_SUCCESS; | |
611 | } | |
612 | ||
613 | DEFUN (no_auto_summary, | |
614 | no_auto_summary_cmd, | |
615 | "no auto-summary", | |
616 | NO_STR | |
617 | "Enable automatic network number summarization\n") | |
618 | { | |
619 | return CMD_SUCCESS; | |
620 | } | |
3d515fd9 | 621 | |
622 | DEFUN_DEPRECATED (neighbor_version, | |
623 | neighbor_version_cmd, | |
624 | NEIGHBOR_CMD "version (4|4-)", | |
625 | NEIGHBOR_STR | |
626 | NEIGHBOR_ADDR_STR | |
627 | "Set the BGP version to match a neighbor\n" | |
628 | "Neighbor's BGP version\n") | |
629 | { | |
630 | return CMD_SUCCESS; | |
631 | } | |
6b0655a2 | 632 | |
718e3744 | 633 | /* "router bgp" commands. */ |
634 | DEFUN (router_bgp, | |
635 | router_bgp_cmd, | |
320da874 | 636 | "router bgp " CMD_AS_RANGE, |
718e3744 | 637 | ROUTER_STR |
638 | BGP_STR | |
639 | AS_STR) | |
640 | { | |
641 | int ret; | |
642 | as_t as; | |
643 | struct bgp *bgp; | |
fd79ac91 | 644 | const char *name = NULL; |
718e3744 | 645 | |
2385a876 DW |
646 | // "router bgp" without an ASN |
647 | if (argc < 1) | |
648 | { | |
649 | bgp = bgp_get_default(); | |
718e3744 | 650 | |
2385a876 DW |
651 | if (bgp == NULL) |
652 | { | |
653 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
654 | return CMD_WARNING; | |
655 | } | |
718e3744 | 656 | |
2385a876 DW |
657 | if (listcount(bm->bgp) > 1) |
658 | { | |
659 | vty_out (vty, "%% Multiple BGP processes are configured%s", VTY_NEWLINE); | |
660 | return CMD_WARNING; | |
661 | } | |
662 | } | |
663 | ||
664 | // "router bgp X" | |
665 | else | |
718e3744 | 666 | { |
2385a876 DW |
667 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
668 | ||
669 | if (argc == 2) | |
670 | name = argv[1]; | |
671 | ||
672 | ret = bgp_get (&bgp, &as, name); | |
673 | switch (ret) | |
674 | { | |
675 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
676 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
677 | VTY_NEWLINE); | |
678 | return CMD_WARNING; | |
679 | case BGP_ERR_AS_MISMATCH: | |
680 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); | |
681 | return CMD_WARNING; | |
682 | case BGP_ERR_INSTANCE_MISMATCH: | |
683 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); | |
684 | vty_out (vty, "BGP instance is already running; AS is %u%s", | |
685 | as, VTY_NEWLINE); | |
686 | return CMD_WARNING; | |
687 | } | |
718e3744 | 688 | } |
689 | ||
690 | vty->node = BGP_NODE; | |
691 | vty->index = bgp; | |
692 | ||
693 | return CMD_SUCCESS; | |
694 | } | |
695 | ||
696 | ALIAS (router_bgp, | |
697 | router_bgp_view_cmd, | |
320da874 | 698 | "router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 699 | ROUTER_STR |
700 | BGP_STR | |
701 | AS_STR | |
702 | "BGP view\n" | |
703 | "view name\n") | |
6b0655a2 | 704 | |
2385a876 DW |
705 | ALIAS (router_bgp, |
706 | router_bgp_noasn_cmd, | |
707 | "router bgp", | |
708 | ROUTER_STR | |
709 | BGP_STR) | |
710 | ||
718e3744 | 711 | /* "no router bgp" commands. */ |
712 | DEFUN (no_router_bgp, | |
713 | no_router_bgp_cmd, | |
320da874 | 714 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 715 | NO_STR |
716 | ROUTER_STR | |
717 | BGP_STR | |
718 | AS_STR) | |
719 | { | |
720 | as_t as; | |
721 | struct bgp *bgp; | |
fd79ac91 | 722 | const char *name = NULL; |
718e3744 | 723 | |
0b2aa3a0 | 724 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 725 | |
726 | if (argc == 2) | |
727 | name = argv[1]; | |
728 | ||
729 | /* Lookup bgp structure. */ | |
730 | bgp = bgp_lookup (as, name); | |
731 | if (! bgp) | |
732 | { | |
733 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
734 | return CMD_WARNING; | |
735 | } | |
736 | ||
737 | bgp_delete (bgp); | |
738 | ||
739 | return CMD_SUCCESS; | |
740 | } | |
741 | ||
742 | ALIAS (no_router_bgp, | |
743 | no_router_bgp_view_cmd, | |
320da874 | 744 | "no router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 745 | NO_STR |
746 | ROUTER_STR | |
747 | BGP_STR | |
748 | AS_STR | |
749 | "BGP view\n" | |
750 | "view name\n") | |
6b0655a2 | 751 | |
718e3744 | 752 | /* BGP router-id. */ |
753 | ||
754 | DEFUN (bgp_router_id, | |
755 | bgp_router_id_cmd, | |
756 | "bgp router-id A.B.C.D", | |
757 | BGP_STR | |
758 | "Override configured router identifier\n" | |
759 | "Manually configured router identifier\n") | |
760 | { | |
761 | int ret; | |
762 | struct in_addr id; | |
763 | struct bgp *bgp; | |
764 | ||
765 | bgp = vty->index; | |
766 | ||
767 | ret = inet_aton (argv[0], &id); | |
768 | if (! ret) | |
769 | { | |
770 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
771 | return CMD_WARNING; | |
772 | } | |
773 | ||
18a6dce6 | 774 | bgp->router_id_static = id; |
718e3744 | 775 | bgp_router_id_set (bgp, &id); |
776 | ||
777 | return CMD_SUCCESS; | |
778 | } | |
779 | ||
780 | DEFUN (no_bgp_router_id, | |
781 | no_bgp_router_id_cmd, | |
782 | "no bgp router-id", | |
783 | NO_STR | |
784 | BGP_STR | |
785 | "Override configured router identifier\n") | |
786 | { | |
787 | int ret; | |
788 | struct in_addr id; | |
789 | struct bgp *bgp; | |
790 | ||
791 | bgp = vty->index; | |
792 | ||
793 | if (argc == 1) | |
794 | { | |
795 | ret = inet_aton (argv[0], &id); | |
796 | if (! ret) | |
797 | { | |
798 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
799 | return CMD_WARNING; | |
800 | } | |
801 | ||
18a6dce6 | 802 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
718e3744 | 803 | { |
804 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
805 | return CMD_WARNING; | |
806 | } | |
807 | } | |
808 | ||
18a6dce6 | 809 | bgp->router_id_static.s_addr = 0; |
810 | bgp_router_id_set (bgp, &router_id_zebra); | |
718e3744 | 811 | |
812 | return CMD_SUCCESS; | |
813 | } | |
814 | ||
815 | ALIAS (no_bgp_router_id, | |
816 | no_bgp_router_id_val_cmd, | |
817 | "no bgp router-id A.B.C.D", | |
818 | NO_STR | |
819 | BGP_STR | |
820 | "Override configured router identifier\n" | |
821 | "Manually configured router identifier\n") | |
6b0655a2 | 822 | |
718e3744 | 823 | /* BGP Cluster ID. */ |
824 | ||
825 | DEFUN (bgp_cluster_id, | |
826 | bgp_cluster_id_cmd, | |
827 | "bgp cluster-id A.B.C.D", | |
828 | BGP_STR | |
829 | "Configure Route-Reflector Cluster-id\n" | |
830 | "Route-Reflector Cluster-id in IP address format\n") | |
831 | { | |
832 | int ret; | |
833 | struct bgp *bgp; | |
834 | struct in_addr cluster; | |
835 | ||
836 | bgp = vty->index; | |
837 | ||
838 | ret = inet_aton (argv[0], &cluster); | |
839 | if (! ret) | |
840 | { | |
841 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
842 | return CMD_WARNING; | |
843 | } | |
844 | ||
845 | bgp_cluster_id_set (bgp, &cluster); | |
7aafcaca | 846 | bgp_clear_star_soft_out (vty); |
718e3744 | 847 | |
848 | return CMD_SUCCESS; | |
849 | } | |
850 | ||
851 | ALIAS (bgp_cluster_id, | |
852 | bgp_cluster_id32_cmd, | |
853 | "bgp cluster-id <1-4294967295>", | |
854 | BGP_STR | |
855 | "Configure Route-Reflector Cluster-id\n" | |
856 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
857 | ||
858 | DEFUN (no_bgp_cluster_id, | |
859 | no_bgp_cluster_id_cmd, | |
860 | "no bgp cluster-id", | |
861 | NO_STR | |
862 | BGP_STR | |
863 | "Configure Route-Reflector Cluster-id\n") | |
864 | { | |
865 | int ret; | |
866 | struct bgp *bgp; | |
867 | struct in_addr cluster; | |
868 | ||
869 | bgp = vty->index; | |
870 | ||
871 | if (argc == 1) | |
872 | { | |
873 | ret = inet_aton (argv[0], &cluster); | |
874 | if (! ret) | |
875 | { | |
876 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
877 | return CMD_WARNING; | |
878 | } | |
879 | } | |
880 | ||
881 | bgp_cluster_id_unset (bgp); | |
7aafcaca | 882 | bgp_clear_star_soft_out (vty); |
718e3744 | 883 | |
884 | return CMD_SUCCESS; | |
885 | } | |
886 | ||
887 | ALIAS (no_bgp_cluster_id, | |
888 | no_bgp_cluster_id_arg_cmd, | |
889 | "no bgp cluster-id A.B.C.D", | |
890 | NO_STR | |
891 | BGP_STR | |
892 | "Configure Route-Reflector Cluster-id\n" | |
893 | "Route-Reflector Cluster-id in IP address format\n") | |
6b0655a2 | 894 | |
718e3744 | 895 | DEFUN (bgp_confederation_identifier, |
896 | bgp_confederation_identifier_cmd, | |
320da874 | 897 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 898 | "BGP specific commands\n" |
899 | "AS confederation parameters\n" | |
900 | "AS number\n" | |
901 | "Set routing domain confederation AS\n") | |
902 | { | |
903 | struct bgp *bgp; | |
904 | as_t as; | |
905 | ||
906 | bgp = vty->index; | |
907 | ||
0b2aa3a0 | 908 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 909 | |
910 | bgp_confederation_id_set (bgp, as); | |
911 | ||
912 | return CMD_SUCCESS; | |
913 | } | |
914 | ||
915 | DEFUN (no_bgp_confederation_identifier, | |
916 | no_bgp_confederation_identifier_cmd, | |
917 | "no bgp confederation identifier", | |
918 | NO_STR | |
919 | "BGP specific commands\n" | |
920 | "AS confederation parameters\n" | |
921 | "AS number\n") | |
922 | { | |
923 | struct bgp *bgp; | |
718e3744 | 924 | |
925 | bgp = vty->index; | |
926 | ||
718e3744 | 927 | bgp_confederation_id_unset (bgp); |
928 | ||
929 | return CMD_SUCCESS; | |
930 | } | |
931 | ||
932 | ALIAS (no_bgp_confederation_identifier, | |
933 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 934 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 935 | NO_STR |
936 | "BGP specific commands\n" | |
937 | "AS confederation parameters\n" | |
938 | "AS number\n" | |
939 | "Set routing domain confederation AS\n") | |
6b0655a2 | 940 | |
718e3744 | 941 | DEFUN (bgp_confederation_peers, |
942 | bgp_confederation_peers_cmd, | |
320da874 | 943 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 944 | "BGP specific commands\n" |
945 | "AS confederation parameters\n" | |
946 | "Peer ASs in BGP confederation\n" | |
947 | AS_STR) | |
948 | { | |
949 | struct bgp *bgp; | |
950 | as_t as; | |
951 | int i; | |
952 | ||
953 | bgp = vty->index; | |
954 | ||
955 | for (i = 0; i < argc; i++) | |
956 | { | |
0b2aa3a0 | 957 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 958 | |
959 | if (bgp->as == as) | |
960 | { | |
961 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
962 | VTY_NEWLINE); | |
963 | continue; | |
964 | } | |
965 | ||
966 | bgp_confederation_peers_add (bgp, as); | |
967 | } | |
968 | return CMD_SUCCESS; | |
969 | } | |
970 | ||
971 | DEFUN (no_bgp_confederation_peers, | |
972 | no_bgp_confederation_peers_cmd, | |
320da874 | 973 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 974 | NO_STR |
975 | "BGP specific commands\n" | |
976 | "AS confederation parameters\n" | |
977 | "Peer ASs in BGP confederation\n" | |
978 | AS_STR) | |
979 | { | |
980 | struct bgp *bgp; | |
981 | as_t as; | |
982 | int i; | |
983 | ||
984 | bgp = vty->index; | |
985 | ||
986 | for (i = 0; i < argc; i++) | |
987 | { | |
0b2aa3a0 PJ |
988 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
989 | ||
718e3744 | 990 | bgp_confederation_peers_remove (bgp, as); |
991 | } | |
992 | return CMD_SUCCESS; | |
993 | } | |
6b0655a2 | 994 | |
5e242b0d DS |
995 | /** |
996 | * Central routine for maximum-paths configuration. | |
997 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
998 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
999 | */ | |
ffd0c037 DS |
1000 | static int |
1001 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, | |
5e242b0d | 1002 | u_int16_t options, int set) |
165b5fff JB |
1003 | { |
1004 | struct bgp *bgp; | |
ffd0c037 | 1005 | u_int16_t maxpaths = 0; |
165b5fff | 1006 | int ret; |
5e242b0d DS |
1007 | afi_t afi; |
1008 | safi_t safi; | |
165b5fff JB |
1009 | |
1010 | bgp = vty->index; | |
5e242b0d DS |
1011 | afi = bgp_node_afi (vty); |
1012 | safi = bgp_node_safi (vty); | |
165b5fff | 1013 | |
5e242b0d DS |
1014 | if (set) |
1015 | { | |
73ac8160 DS |
1016 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
1017 | BGP_MAXIMUM_MAXPATHS); | |
5e242b0d DS |
1018 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
1019 | options); | |
1020 | } | |
1021 | else | |
1022 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 1023 | |
165b5fff JB |
1024 | if (ret < 0) |
1025 | { | |
1026 | vty_out (vty, | |
5e242b0d DS |
1027 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
1028 | (set == 1) ? "" : "un", | |
1029 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
1030 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
1031 | return CMD_WARNING; |
1032 | } | |
1033 | ||
7aafcaca DS |
1034 | bgp_recalculate_all_bestpaths (bgp); |
1035 | ||
6878b9db DS |
1036 | if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM)) |
1037 | vty_out (vty, | |
1038 | "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s", | |
1039 | maxpaths, MULTIPATH_NUM, VTY_NEWLINE); | |
1040 | ||
165b5fff JB |
1041 | return CMD_SUCCESS; |
1042 | } | |
1043 | ||
abc920f8 DS |
1044 | DEFUN (bgp_maxmed_admin, |
1045 | bgp_maxmed_admin_cmd, | |
1046 | "bgp max-med administrative ", | |
1047 | BGP_STR | |
1048 | "Advertise routes with max-med\n" | |
1049 | "Administratively applied, for an indefinite period\n") | |
1050 | { | |
1051 | struct bgp *bgp; | |
1052 | ||
1053 | bgp = vty->index; | |
1054 | ||
1055 | bgp->v_maxmed_admin = 1; | |
1056 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1057 | ||
1058 | bgp_maxmed_update(bgp); | |
1059 | ||
1060 | return CMD_SUCCESS; | |
1061 | } | |
1062 | ||
1063 | DEFUN (bgp_maxmed_admin_medv, | |
1064 | bgp_maxmed_admin_medv_cmd, | |
1065 | "bgp max-med administrative <0-4294967294>", | |
1066 | BGP_STR | |
1067 | "Advertise routes with max-med\n" | |
1068 | "Administratively applied, for an indefinite period\n" | |
1069 | "Max MED value to be used\n") | |
1070 | { | |
1071 | struct bgp *bgp; | |
1072 | ||
1073 | bgp = vty->index; | |
1074 | ||
1075 | bgp->v_maxmed_admin = 1; | |
1076 | VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]); | |
1077 | ||
1078 | bgp_maxmed_update(bgp); | |
1079 | ||
1080 | return CMD_SUCCESS; | |
1081 | } | |
1082 | ||
1083 | DEFUN (no_bgp_maxmed_admin, | |
1084 | no_bgp_maxmed_admin_cmd, | |
1085 | "no bgp max-med administrative", | |
1086 | NO_STR | |
1087 | BGP_STR | |
1088 | "Advertise routes with max-med\n" | |
1089 | "Administratively applied, for an indefinite period\n") | |
1090 | { | |
1091 | struct bgp *bgp; | |
1092 | ||
1093 | bgp = vty->index; | |
1094 | ||
1095 | bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED; | |
1096 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1097 | ||
1098 | bgp_maxmed_update(bgp); | |
1099 | ||
1100 | return CMD_SUCCESS; | |
1101 | } | |
1102 | ||
1103 | ALIAS (no_bgp_maxmed_admin, | |
1104 | no_bgp_maxmed_admin_medv_cmd, | |
1105 | "no bgp max-med administrative <0-4294967294>", | |
1106 | NO_STR | |
1107 | BGP_STR | |
1108 | "Advertise routes with max-med\n" | |
1109 | "Administratively applied, for an indefinite period\n" | |
1110 | "Max MED value to be used\n") | |
1111 | ||
1112 | ||
1113 | DEFUN (bgp_maxmed_onstartup, | |
1114 | bgp_maxmed_onstartup_cmd, | |
1115 | "bgp max-med on-startup <5-86400>", | |
1116 | BGP_STR | |
1117 | "Advertise routes with max-med\n" | |
1118 | "Effective on a startup\n" | |
1119 | "Time (seconds) period for max-med\n") | |
1120 | { | |
1121 | struct bgp *bgp; | |
1122 | ||
1123 | bgp = vty->index; | |
1124 | ||
1125 | if (argc != 1) | |
1126 | { | |
1127 | vty_out (vty, "%% Must supply max-med on-startup period"); | |
1128 | return CMD_WARNING; | |
1129 | } | |
1130 | ||
1131 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1132 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1133 | ||
1134 | bgp_maxmed_update(bgp); | |
1135 | ||
1136 | return CMD_SUCCESS; | |
1137 | } | |
1138 | ||
1139 | DEFUN (bgp_maxmed_onstartup_medv, | |
1140 | bgp_maxmed_onstartup_medv_cmd, | |
1141 | "bgp max-med on-startup <5-86400> <0-4294967294>", | |
1142 | BGP_STR | |
1143 | "Advertise routes with max-med\n" | |
1144 | "Effective on a startup\n" | |
1145 | "Time (seconds) period for max-med\n" | |
1146 | "Max MED value to be used\n") | |
1147 | { | |
1148 | struct bgp *bgp; | |
1149 | ||
1150 | bgp = vty->index; | |
1151 | ||
1152 | if (argc != 2) | |
1153 | { | |
1154 | vty_out (vty, "%% Must supply max-med on-startup period and med value"); | |
1155 | return CMD_WARNING; | |
1156 | } | |
1157 | ||
1158 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1159 | VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]); | |
1160 | ||
1161 | bgp_maxmed_update(bgp); | |
1162 | ||
1163 | return CMD_SUCCESS; | |
1164 | } | |
1165 | ||
1166 | DEFUN (no_bgp_maxmed_onstartup, | |
1167 | no_bgp_maxmed_onstartup_cmd, | |
1168 | "no bgp max-med on-startup", | |
1169 | NO_STR | |
1170 | BGP_STR | |
1171 | "Advertise routes with max-med\n" | |
1172 | "Effective on a startup\n") | |
1173 | { | |
1174 | struct bgp *bgp; | |
1175 | ||
1176 | bgp = vty->index; | |
1177 | ||
1178 | /* Cancel max-med onstartup if its on */ | |
1179 | if (bgp->t_maxmed_onstartup) | |
1180 | { | |
1181 | THREAD_TIMER_OFF (bgp->t_maxmed_onstartup); | |
1182 | bgp->maxmed_onstartup_over = 1; | |
1183 | } | |
1184 | ||
1185 | bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED; | |
1186 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1187 | ||
1188 | bgp_maxmed_update(bgp); | |
1189 | ||
1190 | return CMD_SUCCESS; | |
1191 | } | |
1192 | ||
1193 | ALIAS (no_bgp_maxmed_onstartup, | |
1194 | no_bgp_maxmed_onstartup_period_cmd, | |
1195 | "no bgp max-med on-startup <5-86400>", | |
1196 | NO_STR | |
1197 | BGP_STR | |
1198 | "Advertise routes with max-med\n" | |
1199 | "Effective on a startup\n" | |
1200 | "Time (seconds) period for max-med\n") | |
1201 | ||
1202 | ALIAS (no_bgp_maxmed_onstartup, | |
1203 | no_bgp_maxmed_onstartup_period_medv_cmd, | |
1204 | "no bgp max-med on-startup <5-86400> <0-4294967294>", | |
1205 | NO_STR | |
1206 | BGP_STR | |
1207 | "Advertise routes with max-med\n" | |
1208 | "Effective on a startup\n" | |
1209 | "Time (seconds) period for max-med\n" | |
1210 | "Max MED value to be used\n") | |
1211 | ||
f188f2c4 DS |
1212 | static int |
1213 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
1214 | const char *wait) | |
1215 | { | |
1216 | struct bgp *bgp; | |
1217 | u_int16_t update_delay; | |
1218 | u_int16_t establish_wait; | |
1219 | ||
1220 | ||
1221 | bgp = vty->index; | |
1222 | ||
1223 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
1224 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
1225 | ||
1226 | if (!wait) /* update-delay <delay> */ | |
1227 | { | |
1228 | bgp->v_update_delay = update_delay; | |
1229 | bgp->v_establish_wait = bgp->v_update_delay; | |
1230 | return CMD_SUCCESS; | |
1231 | } | |
1232 | ||
1233 | /* update-delay <delay> <establish-wait> */ | |
1234 | establish_wait = atoi (wait); | |
1235 | if (update_delay < establish_wait) | |
1236 | { | |
1237 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
1238 | VTY_NEWLINE); | |
1239 | return CMD_WARNING; | |
1240 | } | |
1241 | ||
1242 | bgp->v_update_delay = update_delay; | |
1243 | bgp->v_establish_wait = establish_wait; | |
1244 | ||
1245 | return CMD_SUCCESS; | |
1246 | } | |
1247 | ||
1248 | static int | |
1249 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
1250 | { | |
1251 | struct bgp *bgp; | |
1252 | ||
1253 | bgp = vty->index; | |
1254 | ||
1255 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
1256 | bgp->v_establish_wait = bgp->v_update_delay; | |
1257 | ||
1258 | return CMD_SUCCESS; | |
1259 | } | |
1260 | ||
1261 | int | |
1262 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
1263 | { | |
1264 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
1265 | { | |
1266 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
1267 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
1268 | vty_out (vty, " %d", bgp->v_establish_wait); | |
1269 | vty_out (vty, "%s", VTY_NEWLINE); | |
1270 | } | |
1271 | ||
1272 | return 0; | |
1273 | } | |
1274 | ||
1275 | ||
1276 | /* Update-delay configuration */ | |
1277 | DEFUN (bgp_update_delay, | |
1278 | bgp_update_delay_cmd, | |
1279 | "update-delay <0-3600>", | |
1280 | "Force initial delay for best-path and updates\n" | |
1281 | "Seconds\n") | |
1282 | { | |
1283 | return bgp_update_delay_config_vty(vty, argv[0], NULL); | |
1284 | } | |
1285 | ||
1286 | DEFUN (bgp_update_delay_establish_wait, | |
1287 | bgp_update_delay_establish_wait_cmd, | |
1288 | "update-delay <0-3600> <1-3600>", | |
1289 | "Force initial delay for best-path and updates\n" | |
1290 | "Seconds\n" | |
1291 | "Wait for peers to be established\n" | |
1292 | "Seconds\n") | |
1293 | { | |
1294 | return bgp_update_delay_config_vty(vty, argv[0], argv[1]); | |
1295 | } | |
1296 | ||
1297 | /* Update-delay deconfiguration */ | |
1298 | DEFUN (no_bgp_update_delay, | |
1299 | no_bgp_update_delay_cmd, | |
1300 | "no update-delay <0-3600>", | |
1301 | "Force initial delay for best-path and updates\n" | |
1302 | "Seconds\n") | |
1303 | { | |
1304 | return bgp_update_delay_deconfig_vty(vty); | |
1305 | } | |
1306 | ||
1307 | ALIAS (no_bgp_update_delay, | |
1308 | no_bgp_update_delay_establish_wait_cmd, | |
1309 | "no update-delay <0-3600> <1-3600>", | |
1310 | "Force initial delay for best-path and updates\n" | |
1311 | "Seconds\n" | |
1312 | "Wait for peers to be established\n" | |
1313 | "Seconds\n") | |
5e242b0d | 1314 | |
ffd0c037 DS |
1315 | static int |
1316 | bgp_wpkt_quanta_config_vty (struct vty *vty, const char *num, char set) | |
cb1faec9 DS |
1317 | { |
1318 | struct bgp *bgp; | |
cb1faec9 DS |
1319 | |
1320 | bgp = vty->index; | |
1321 | ||
1322 | if (set) | |
1323 | VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num, | |
1324 | 1, 4294967295); | |
1325 | else | |
1326 | bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX; | |
1327 | ||
1328 | return CMD_SUCCESS; | |
1329 | } | |
1330 | ||
1331 | int | |
1332 | bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) | |
1333 | { | |
1334 | if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX) | |
1335 | vty_out (vty, " write-quanta %d%s", | |
1336 | bgp->wpkt_quanta, VTY_NEWLINE); | |
1337 | ||
1338 | return 0; | |
1339 | } | |
1340 | ||
1341 | ||
1342 | /* Update-delay configuration */ | |
1343 | DEFUN (bgp_wpkt_quanta, | |
1344 | bgp_wpkt_quanta_cmd, | |
1345 | "write-quanta <1-4294967295>", | |
1346 | "How many packets to write to peer socket per run\n" | |
1347 | "Number of packets\n") | |
1348 | { | |
1349 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 1); | |
1350 | } | |
1351 | ||
1352 | /* Update-delay deconfiguration */ | |
1353 | DEFUN (no_bgp_wpkt_quanta, | |
1354 | no_bgp_wpkt_quanta_cmd, | |
1355 | "no write-quanta <1-4294967295>", | |
1356 | "How many packets to write to peer socket per run\n" | |
1357 | "Number of packets\n") | |
1358 | { | |
1359 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); | |
1360 | } | |
1361 | ||
ffd0c037 | 1362 | static int |
3f9c7369 DS |
1363 | bgp_coalesce_config_vty (struct vty *vty, const char *num, char set) |
1364 | { | |
1365 | struct bgp *bgp; | |
1366 | ||
1367 | bgp = vty->index; | |
1368 | ||
1369 | if (set) | |
1370 | VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num, | |
1371 | 0, 4294967295); | |
1372 | else | |
1373 | bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; | |
1374 | ||
1375 | return CMD_SUCCESS; | |
1376 | } | |
1377 | ||
1378 | int | |
1379 | bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp) | |
1380 | { | |
1381 | if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME) | |
1382 | vty_out (vty, " coalesce-time %d%s", | |
1383 | bgp->coalesce_time, VTY_NEWLINE); | |
1384 | ||
1385 | return 0; | |
1386 | } | |
1387 | ||
1388 | ||
1389 | DEFUN (bgp_coalesce_time, | |
1390 | bgp_coalesce_time_cmd, | |
1391 | "coalesce-time <0-4294967295>", | |
1392 | "Subgroup coalesce timer\n" | |
1393 | "Subgroup coalesce timer value (in ms)\n") | |
1394 | { | |
1395 | return bgp_coalesce_config_vty(vty, argv[0], 1); | |
1396 | } | |
1397 | ||
1398 | DEFUN (no_bgp_coalesce_time, | |
1399 | no_bgp_coalesce_time_cmd, | |
1400 | "no coalesce-time <0-4294967295>", | |
1401 | "Subgroup coalesce timer\n" | |
1402 | "Subgroup coalesce timer value (in ms)\n") | |
1403 | { | |
1404 | return bgp_coalesce_config_vty(vty, argv[0], 0); | |
1405 | } | |
1406 | ||
5e242b0d DS |
1407 | /* Maximum-paths configuration */ |
1408 | DEFUN (bgp_maxpaths, | |
1409 | bgp_maxpaths_cmd, | |
1410 | "maximum-paths <1-255>", | |
1411 | "Forward packets over multiple paths\n" | |
1412 | "Number of paths\n") | |
1413 | { | |
1414 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); | |
1415 | } | |
1416 | ||
165b5fff JB |
1417 | DEFUN (bgp_maxpaths_ibgp, |
1418 | bgp_maxpaths_ibgp_cmd, | |
1419 | "maximum-paths ibgp <1-255>", | |
1420 | "Forward packets over multiple paths\n" | |
1421 | "iBGP-multipath\n" | |
1422 | "Number of paths\n") | |
1423 | { | |
5e242b0d DS |
1424 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); |
1425 | } | |
165b5fff | 1426 | |
5e242b0d DS |
1427 | DEFUN (bgp_maxpaths_ibgp_cluster, |
1428 | bgp_maxpaths_ibgp_cluster_cmd, | |
1429 | "maximum-paths ibgp <1-255> equal-cluster-length", | |
1430 | "Forward packets over multiple paths\n" | |
1431 | "iBGP-multipath\n" | |
1432 | "Number of paths\n" | |
1433 | "Match the cluster length\n") | |
1434 | { | |
1435 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], | |
1436 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); | |
165b5fff JB |
1437 | } |
1438 | ||
1439 | DEFUN (no_bgp_maxpaths, | |
1440 | no_bgp_maxpaths_cmd, | |
1441 | "no maximum-paths", | |
1442 | NO_STR | |
1443 | "Forward packets over multiple paths\n" | |
1444 | "Number of paths\n") | |
1445 | { | |
5e242b0d | 1446 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
1447 | } |
1448 | ||
1449 | ALIAS (no_bgp_maxpaths, | |
1450 | no_bgp_maxpaths_arg_cmd, | |
1451 | "no maximum-paths <1-255>", | |
1452 | NO_STR | |
1453 | "Forward packets over multiple paths\n" | |
1454 | "Number of paths\n") | |
1455 | ||
1456 | DEFUN (no_bgp_maxpaths_ibgp, | |
1457 | no_bgp_maxpaths_ibgp_cmd, | |
1458 | "no maximum-paths ibgp", | |
1459 | NO_STR | |
1460 | "Forward packets over multiple paths\n" | |
1461 | "iBGP-multipath\n" | |
1462 | "Number of paths\n") | |
1463 | { | |
5e242b0d | 1464 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
1465 | } |
1466 | ||
1467 | ALIAS (no_bgp_maxpaths_ibgp, | |
1468 | no_bgp_maxpaths_ibgp_arg_cmd, | |
1469 | "no maximum-paths ibgp <1-255>", | |
1470 | NO_STR | |
1471 | "Forward packets over multiple paths\n" | |
1472 | "iBGP-multipath\n" | |
1473 | "Number of paths\n") | |
1474 | ||
5e242b0d DS |
1475 | ALIAS (no_bgp_maxpaths_ibgp, |
1476 | no_bgp_maxpaths_ibgp_cluster_cmd, | |
1477 | "no maximum-paths ibgp <1-255> equal-cluster-length", | |
1478 | NO_STR | |
1479 | "Forward packets over multiple paths\n" | |
1480 | "iBGP-multipath\n" | |
1481 | "Number of paths\n" | |
1482 | "Match the cluster length\n") | |
1483 | ||
165b5fff JB |
1484 | int |
1485 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
1486 | safi_t safi, int *write) | |
1487 | { | |
1488 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) | |
1489 | { | |
1490 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1491 | vty_out (vty, " maximum-paths %d%s", |
165b5fff JB |
1492 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); |
1493 | } | |
1494 | ||
1495 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) | |
1496 | { | |
1497 | bgp_config_write_family_header (vty, afi, safi, write); | |
0b960b4d | 1498 | vty_out (vty, " maximum-paths ibgp %d", |
5e242b0d DS |
1499 | bgp->maxpaths[afi][safi].maxpaths_ibgp); |
1500 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
1501 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
1502 | vty_out (vty, " equal-cluster-length"); | |
1503 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
1504 | } |
1505 | ||
1506 | return 0; | |
1507 | } | |
6b0655a2 | 1508 | |
718e3744 | 1509 | /* BGP timers. */ |
1510 | ||
1511 | DEFUN (bgp_timers, | |
1512 | bgp_timers_cmd, | |
1513 | "timers bgp <0-65535> <0-65535>", | |
1514 | "Adjust routing timers\n" | |
1515 | "BGP timers\n" | |
1516 | "Keepalive interval\n" | |
1517 | "Holdtime\n") | |
1518 | { | |
1519 | struct bgp *bgp; | |
1520 | unsigned long keepalive = 0; | |
1521 | unsigned long holdtime = 0; | |
1522 | ||
1523 | bgp = vty->index; | |
1524 | ||
1525 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
1526 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
1527 | ||
1528 | /* Holdtime value check. */ | |
1529 | if (holdtime < 3 && holdtime != 0) | |
1530 | { | |
1531 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
1532 | VTY_NEWLINE); | |
1533 | return CMD_WARNING; | |
1534 | } | |
1535 | ||
1536 | bgp_timers_set (bgp, keepalive, holdtime); | |
1537 | ||
1538 | return CMD_SUCCESS; | |
1539 | } | |
1540 | ||
1541 | DEFUN (no_bgp_timers, | |
1542 | no_bgp_timers_cmd, | |
1543 | "no timers bgp", | |
1544 | NO_STR | |
1545 | "Adjust routing timers\n" | |
1546 | "BGP timers\n") | |
1547 | { | |
1548 | struct bgp *bgp; | |
1549 | ||
1550 | bgp = vty->index; | |
1551 | bgp_timers_unset (bgp); | |
1552 | ||
1553 | return CMD_SUCCESS; | |
1554 | } | |
1555 | ||
1556 | ALIAS (no_bgp_timers, | |
1557 | no_bgp_timers_arg_cmd, | |
1558 | "no timers bgp <0-65535> <0-65535>", | |
1559 | NO_STR | |
1560 | "Adjust routing timers\n" | |
1561 | "BGP timers\n" | |
1562 | "Keepalive interval\n" | |
1563 | "Holdtime\n") | |
6b0655a2 | 1564 | |
718e3744 | 1565 | DEFUN (bgp_client_to_client_reflection, |
1566 | bgp_client_to_client_reflection_cmd, | |
1567 | "bgp client-to-client reflection", | |
1568 | "BGP specific commands\n" | |
1569 | "Configure client to client route reflection\n" | |
1570 | "reflection of routes allowed\n") | |
1571 | { | |
1572 | struct bgp *bgp; | |
1573 | ||
1574 | bgp = vty->index; | |
1575 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
7aafcaca DS |
1576 | bgp_clear_star_soft_out (vty); |
1577 | ||
718e3744 | 1578 | return CMD_SUCCESS; |
1579 | } | |
1580 | ||
1581 | DEFUN (no_bgp_client_to_client_reflection, | |
1582 | no_bgp_client_to_client_reflection_cmd, | |
1583 | "no bgp client-to-client reflection", | |
1584 | NO_STR | |
1585 | "BGP specific commands\n" | |
1586 | "Configure client to client route reflection\n" | |
1587 | "reflection of routes allowed\n") | |
1588 | { | |
1589 | struct bgp *bgp; | |
1590 | ||
1591 | bgp = vty->index; | |
1592 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
7aafcaca DS |
1593 | bgp_clear_star_soft_out (vty); |
1594 | ||
718e3744 | 1595 | return CMD_SUCCESS; |
1596 | } | |
1597 | ||
1598 | /* "bgp always-compare-med" configuration. */ | |
1599 | DEFUN (bgp_always_compare_med, | |
1600 | bgp_always_compare_med_cmd, | |
1601 | "bgp always-compare-med", | |
1602 | "BGP specific commands\n" | |
1603 | "Allow comparing MED from different neighbors\n") | |
1604 | { | |
1605 | struct bgp *bgp; | |
1606 | ||
1607 | bgp = vty->index; | |
1608 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1609 | bgp_recalculate_all_bestpaths (bgp); |
1610 | ||
718e3744 | 1611 | return CMD_SUCCESS; |
1612 | } | |
1613 | ||
1614 | DEFUN (no_bgp_always_compare_med, | |
1615 | no_bgp_always_compare_med_cmd, | |
1616 | "no bgp always-compare-med", | |
1617 | NO_STR | |
1618 | "BGP specific commands\n" | |
1619 | "Allow comparing MED from different neighbors\n") | |
1620 | { | |
1621 | struct bgp *bgp; | |
1622 | ||
1623 | bgp = vty->index; | |
1624 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1625 | bgp_recalculate_all_bestpaths (bgp); |
1626 | ||
718e3744 | 1627 | return CMD_SUCCESS; |
1628 | } | |
6b0655a2 | 1629 | |
718e3744 | 1630 | /* "bgp deterministic-med" configuration. */ |
1631 | DEFUN (bgp_deterministic_med, | |
1632 | bgp_deterministic_med_cmd, | |
1633 | "bgp deterministic-med", | |
1634 | "BGP specific commands\n" | |
1635 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1636 | { | |
1637 | struct bgp *bgp; | |
1638 | ||
1639 | bgp = vty->index; | |
1475ac87 DW |
1640 | |
1641 | if (!bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1642 | { | |
1643 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1644 | bgp_recalculate_all_bestpaths (bgp); | |
1645 | } | |
7aafcaca | 1646 | |
718e3744 | 1647 | return CMD_SUCCESS; |
1648 | } | |
1649 | ||
1650 | DEFUN (no_bgp_deterministic_med, | |
1651 | no_bgp_deterministic_med_cmd, | |
1652 | "no bgp deterministic-med", | |
1653 | NO_STR | |
1654 | "BGP specific commands\n" | |
1655 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1656 | { | |
1657 | struct bgp *bgp; | |
1658 | ||
1659 | bgp = vty->index; | |
1475ac87 DW |
1660 | |
1661 | if (bgp_flag_check(bgp, BGP_FLAG_DETERMINISTIC_MED)) | |
1662 | { | |
1663 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1664 | bgp_recalculate_all_bestpaths (bgp); | |
1665 | } | |
7aafcaca | 1666 | |
718e3744 | 1667 | return CMD_SUCCESS; |
1668 | } | |
538621f2 | 1669 | |
1670 | /* "bgp graceful-restart" configuration. */ | |
1671 | DEFUN (bgp_graceful_restart, | |
1672 | bgp_graceful_restart_cmd, | |
1673 | "bgp graceful-restart", | |
1674 | "BGP specific commands\n" | |
1675 | "Graceful restart capability parameters\n") | |
1676 | { | |
1677 | struct bgp *bgp; | |
1678 | ||
1679 | bgp = vty->index; | |
1680 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1681 | return CMD_SUCCESS; | |
1682 | } | |
1683 | ||
1684 | DEFUN (no_bgp_graceful_restart, | |
1685 | no_bgp_graceful_restart_cmd, | |
1686 | "no bgp graceful-restart", | |
1687 | NO_STR | |
1688 | "BGP specific commands\n" | |
1689 | "Graceful restart capability parameters\n") | |
1690 | { | |
1691 | struct bgp *bgp; | |
1692 | ||
1693 | bgp = vty->index; | |
1694 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1695 | return CMD_SUCCESS; | |
1696 | } | |
1697 | ||
93406d87 | 1698 | DEFUN (bgp_graceful_restart_stalepath_time, |
1699 | bgp_graceful_restart_stalepath_time_cmd, | |
1700 | "bgp graceful-restart stalepath-time <1-3600>", | |
1701 | "BGP specific commands\n" | |
1702 | "Graceful restart capability parameters\n" | |
1703 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1704 | "Delay value (seconds)\n") | |
1705 | { | |
1706 | struct bgp *bgp; | |
1707 | u_int32_t stalepath; | |
1708 | ||
1709 | bgp = vty->index; | |
1710 | if (! bgp) | |
1711 | return CMD_WARNING; | |
1712 | ||
1713 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
1714 | bgp->stalepath_time = stalepath; | |
1715 | return CMD_SUCCESS; | |
1716 | } | |
1717 | ||
1718 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
1719 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1720 | "no bgp graceful-restart stalepath-time", | |
1721 | NO_STR | |
1722 | "BGP specific commands\n" | |
1723 | "Graceful restart capability parameters\n" | |
1724 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1725 | { | |
1726 | struct bgp *bgp; | |
1727 | ||
1728 | bgp = vty->index; | |
1729 | if (! bgp) | |
1730 | return CMD_WARNING; | |
1731 | ||
1732 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1733 | return CMD_SUCCESS; | |
1734 | } | |
1735 | ||
1736 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
1737 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
1738 | "no bgp graceful-restart stalepath-time <1-3600>", | |
1739 | NO_STR | |
1740 | "BGP specific commands\n" | |
1741 | "Graceful restart capability parameters\n" | |
1742 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1743 | "Delay value (seconds)\n") | |
1744 | ||
718e3744 | 1745 | /* "bgp fast-external-failover" configuration. */ |
1746 | DEFUN (bgp_fast_external_failover, | |
1747 | bgp_fast_external_failover_cmd, | |
1748 | "bgp fast-external-failover", | |
1749 | BGP_STR | |
1750 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1751 | { | |
1752 | struct bgp *bgp; | |
1753 | ||
1754 | bgp = vty->index; | |
1755 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1756 | return CMD_SUCCESS; | |
1757 | } | |
1758 | ||
1759 | DEFUN (no_bgp_fast_external_failover, | |
1760 | no_bgp_fast_external_failover_cmd, | |
1761 | "no bgp fast-external-failover", | |
1762 | NO_STR | |
1763 | BGP_STR | |
1764 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1765 | { | |
1766 | struct bgp *bgp; | |
1767 | ||
1768 | bgp = vty->index; | |
1769 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1770 | return CMD_SUCCESS; | |
1771 | } | |
6b0655a2 | 1772 | |
718e3744 | 1773 | /* "bgp enforce-first-as" configuration. */ |
1774 | DEFUN (bgp_enforce_first_as, | |
1775 | bgp_enforce_first_as_cmd, | |
1776 | "bgp enforce-first-as", | |
1777 | BGP_STR | |
1778 | "Enforce the first AS for EBGP routes\n") | |
1779 | { | |
1780 | struct bgp *bgp; | |
1781 | ||
1782 | bgp = vty->index; | |
1783 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
7aafcaca DS |
1784 | bgp_clear_star_soft_in (vty); |
1785 | ||
718e3744 | 1786 | return CMD_SUCCESS; |
1787 | } | |
1788 | ||
1789 | DEFUN (no_bgp_enforce_first_as, | |
1790 | no_bgp_enforce_first_as_cmd, | |
1791 | "no bgp enforce-first-as", | |
1792 | NO_STR | |
1793 | BGP_STR | |
1794 | "Enforce the first AS for EBGP routes\n") | |
1795 | { | |
1796 | struct bgp *bgp; | |
1797 | ||
1798 | bgp = vty->index; | |
1799 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
7aafcaca DS |
1800 | bgp_clear_star_soft_in (vty); |
1801 | ||
718e3744 | 1802 | return CMD_SUCCESS; |
1803 | } | |
6b0655a2 | 1804 | |
718e3744 | 1805 | /* "bgp bestpath compare-routerid" configuration. */ |
1806 | DEFUN (bgp_bestpath_compare_router_id, | |
1807 | bgp_bestpath_compare_router_id_cmd, | |
1808 | "bgp bestpath compare-routerid", | |
1809 | "BGP specific commands\n" | |
1810 | "Change the default bestpath selection\n" | |
1811 | "Compare router-id for identical EBGP paths\n") | |
1812 | { | |
1813 | struct bgp *bgp; | |
1814 | ||
1815 | bgp = vty->index; | |
1816 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1817 | bgp_recalculate_all_bestpaths (bgp); |
1818 | ||
718e3744 | 1819 | return CMD_SUCCESS; |
1820 | } | |
1821 | ||
1822 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1823 | no_bgp_bestpath_compare_router_id_cmd, | |
1824 | "no bgp bestpath compare-routerid", | |
1825 | NO_STR | |
1826 | "BGP specific commands\n" | |
1827 | "Change the default bestpath selection\n" | |
1828 | "Compare router-id for identical EBGP paths\n") | |
1829 | { | |
1830 | struct bgp *bgp; | |
1831 | ||
1832 | bgp = vty->index; | |
1833 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1834 | bgp_recalculate_all_bestpaths (bgp); |
1835 | ||
718e3744 | 1836 | return CMD_SUCCESS; |
1837 | } | |
6b0655a2 | 1838 | |
718e3744 | 1839 | /* "bgp bestpath as-path ignore" configuration. */ |
1840 | DEFUN (bgp_bestpath_aspath_ignore, | |
1841 | bgp_bestpath_aspath_ignore_cmd, | |
1842 | "bgp bestpath as-path ignore", | |
1843 | "BGP specific commands\n" | |
1844 | "Change the default bestpath selection\n" | |
1845 | "AS-path attribute\n" | |
1846 | "Ignore as-path length in selecting a route\n") | |
1847 | { | |
1848 | struct bgp *bgp; | |
1849 | ||
1850 | bgp = vty->index; | |
1851 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1852 | bgp_recalculate_all_bestpaths (bgp); |
1853 | ||
718e3744 | 1854 | return CMD_SUCCESS; |
1855 | } | |
1856 | ||
1857 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
1858 | no_bgp_bestpath_aspath_ignore_cmd, | |
1859 | "no bgp bestpath as-path ignore", | |
1860 | NO_STR | |
1861 | "BGP specific commands\n" | |
1862 | "Change the default bestpath selection\n" | |
1863 | "AS-path attribute\n" | |
1864 | "Ignore as-path length in selecting a route\n") | |
1865 | { | |
1866 | struct bgp *bgp; | |
1867 | ||
1868 | bgp = vty->index; | |
1869 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1870 | bgp_recalculate_all_bestpaths (bgp); |
1871 | ||
718e3744 | 1872 | return CMD_SUCCESS; |
1873 | } | |
6b0655a2 | 1874 | |
6811845b | 1875 | /* "bgp bestpath as-path confed" configuration. */ |
1876 | DEFUN (bgp_bestpath_aspath_confed, | |
1877 | bgp_bestpath_aspath_confed_cmd, | |
1878 | "bgp bestpath as-path confed", | |
1879 | "BGP specific commands\n" | |
1880 | "Change the default bestpath selection\n" | |
1881 | "AS-path attribute\n" | |
1882 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1883 | { | |
1884 | struct bgp *bgp; | |
1885 | ||
1886 | bgp = vty->index; | |
1887 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1888 | bgp_recalculate_all_bestpaths (bgp); |
1889 | ||
6811845b | 1890 | return CMD_SUCCESS; |
1891 | } | |
1892 | ||
1893 | DEFUN (no_bgp_bestpath_aspath_confed, | |
1894 | no_bgp_bestpath_aspath_confed_cmd, | |
1895 | "no bgp bestpath as-path confed", | |
1896 | NO_STR | |
1897 | "BGP specific commands\n" | |
1898 | "Change the default bestpath selection\n" | |
1899 | "AS-path attribute\n" | |
1900 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1901 | { | |
1902 | struct bgp *bgp; | |
1903 | ||
1904 | bgp = vty->index; | |
1905 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1906 | bgp_recalculate_all_bestpaths (bgp); |
1907 | ||
6811845b | 1908 | return CMD_SUCCESS; |
1909 | } | |
6b0655a2 | 1910 | |
2fdd455c PM |
1911 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
1912 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
1913 | bgp_bestpath_aspath_multipath_relax_cmd, | |
1914 | "bgp bestpath as-path multipath-relax", | |
1915 | "BGP specific commands\n" | |
1916 | "Change the default bestpath selection\n" | |
1917 | "AS-path attribute\n" | |
1918 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1919 | { | |
1920 | struct bgp *bgp; | |
1921 | ||
1922 | bgp = vty->index; | |
1923 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
16fc1eec | 1924 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); |
7aafcaca DS |
1925 | bgp_recalculate_all_bestpaths (bgp); |
1926 | ||
2fdd455c PM |
1927 | return CMD_SUCCESS; |
1928 | } | |
1929 | ||
1930 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, | |
1931 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
1932 | "no bgp bestpath as-path multipath-relax", | |
1933 | NO_STR | |
1934 | "BGP specific commands\n" | |
1935 | "Change the default bestpath selection\n" | |
1936 | "AS-path attribute\n" | |
1937 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1938 | { | |
1939 | struct bgp *bgp; | |
1940 | ||
1941 | bgp = vty->index; | |
1942 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
16fc1eec | 1943 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); |
7aafcaca DS |
1944 | bgp_recalculate_all_bestpaths (bgp); |
1945 | ||
16fc1eec DS |
1946 | return CMD_SUCCESS; |
1947 | } | |
1948 | ||
1949 | /* "bgp bestpath as-path multipath-relax no-as-set" configuration. */ | |
1950 | DEFUN (bgp_bestpath_aspath_multipath_relax_no_as_set, | |
1951 | bgp_bestpath_aspath_multipath_relax_no_as_set_cmd, | |
1952 | "bgp bestpath as-path multipath-relax no-as-set", | |
1953 | "BGP specific commands\n" | |
1954 | "Change the default bestpath selection\n" | |
1955 | "AS-path attribute\n" | |
1956 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
1957 | "Do not generate an AS_SET\n") | |
1958 | { | |
1959 | struct bgp *bgp; | |
1960 | ||
1961 | bgp = vty->index; | |
1962 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1963 | bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); | |
7aafcaca DS |
1964 | bgp_recalculate_all_bestpaths (bgp); |
1965 | ||
16fc1eec DS |
1966 | return CMD_SUCCESS; |
1967 | } | |
1968 | ||
1969 | DEFUN (no_bgp_bestpath_aspath_multipath_relax_no_as_set, | |
1970 | no_bgp_bestpath_aspath_multipath_relax_no_as_set_cmd, | |
1971 | "no bgp bestpath as-path multipath-relax no-as-set", | |
1972 | NO_STR | |
1973 | "BGP specific commands\n" | |
1974 | "Change the default bestpath selection\n" | |
1975 | "AS-path attribute\n" | |
1976 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
1977 | "Do not generate an AS_SET\n") | |
1978 | { | |
1979 | struct bgp *bgp; | |
1980 | ||
1981 | bgp = vty->index; | |
1982 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1983 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); | |
7aafcaca DS |
1984 | bgp_recalculate_all_bestpaths (bgp); |
1985 | ||
2fdd455c PM |
1986 | return CMD_SUCCESS; |
1987 | } | |
6b0655a2 | 1988 | |
848973c7 | 1989 | /* "bgp log-neighbor-changes" configuration. */ |
1990 | DEFUN (bgp_log_neighbor_changes, | |
1991 | bgp_log_neighbor_changes_cmd, | |
1992 | "bgp log-neighbor-changes", | |
1993 | "BGP specific commands\n" | |
1994 | "Log neighbor up/down and reset reason\n") | |
1995 | { | |
1996 | struct bgp *bgp; | |
1997 | ||
1998 | bgp = vty->index; | |
1999 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
2000 | return CMD_SUCCESS; | |
2001 | } | |
2002 | ||
2003 | DEFUN (no_bgp_log_neighbor_changes, | |
2004 | no_bgp_log_neighbor_changes_cmd, | |
2005 | "no bgp log-neighbor-changes", | |
2006 | NO_STR | |
2007 | "BGP specific commands\n" | |
2008 | "Log neighbor up/down and reset reason\n") | |
2009 | { | |
2010 | struct bgp *bgp; | |
2011 | ||
2012 | bgp = vty->index; | |
2013 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
2014 | return CMD_SUCCESS; | |
2015 | } | |
6b0655a2 | 2016 | |
718e3744 | 2017 | /* "bgp bestpath med" configuration. */ |
2018 | DEFUN (bgp_bestpath_med, | |
2019 | bgp_bestpath_med_cmd, | |
2020 | "bgp bestpath med (confed|missing-as-worst)", | |
2021 | "BGP specific commands\n" | |
2022 | "Change the default bestpath selection\n" | |
2023 | "MED attribute\n" | |
2024 | "Compare MED among confederation paths\n" | |
2025 | "Treat missing MED as the least preferred one\n") | |
2026 | { | |
2027 | struct bgp *bgp; | |
2028 | ||
2029 | bgp = vty->index; | |
2030 | ||
2031 | if (strncmp (argv[0], "confed", 1) == 0) | |
2032 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2033 | else | |
2034 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2035 | ||
7aafcaca DS |
2036 | bgp_recalculate_all_bestpaths (bgp); |
2037 | ||
718e3744 | 2038 | return CMD_SUCCESS; |
2039 | } | |
2040 | ||
2041 | DEFUN (bgp_bestpath_med2, | |
2042 | bgp_bestpath_med2_cmd, | |
2043 | "bgp bestpath med confed missing-as-worst", | |
2044 | "BGP specific commands\n" | |
2045 | "Change the default bestpath selection\n" | |
2046 | "MED attribute\n" | |
2047 | "Compare MED among confederation paths\n" | |
2048 | "Treat missing MED as the least preferred one\n") | |
2049 | { | |
2050 | struct bgp *bgp; | |
2051 | ||
2052 | bgp = vty->index; | |
2053 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2054 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2055 | bgp_recalculate_all_bestpaths (bgp); |
2056 | ||
718e3744 | 2057 | return CMD_SUCCESS; |
2058 | } | |
2059 | ||
2060 | ALIAS (bgp_bestpath_med2, | |
2061 | bgp_bestpath_med3_cmd, | |
2062 | "bgp bestpath med missing-as-worst confed", | |
2063 | "BGP specific commands\n" | |
2064 | "Change the default bestpath selection\n" | |
2065 | "MED attribute\n" | |
2066 | "Treat missing MED as the least preferred one\n" | |
2067 | "Compare MED among confederation paths\n") | |
2068 | ||
2069 | DEFUN (no_bgp_bestpath_med, | |
2070 | no_bgp_bestpath_med_cmd, | |
2071 | "no bgp bestpath med (confed|missing-as-worst)", | |
2072 | NO_STR | |
2073 | "BGP specific commands\n" | |
2074 | "Change the default bestpath selection\n" | |
2075 | "MED attribute\n" | |
2076 | "Compare MED among confederation paths\n" | |
2077 | "Treat missing MED as the least preferred one\n") | |
2078 | { | |
2079 | struct bgp *bgp; | |
2080 | ||
2081 | bgp = vty->index; | |
2082 | ||
2083 | if (strncmp (argv[0], "confed", 1) == 0) | |
2084 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2085 | else | |
2086 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2087 | ||
7aafcaca DS |
2088 | bgp_recalculate_all_bestpaths (bgp); |
2089 | ||
718e3744 | 2090 | return CMD_SUCCESS; |
2091 | } | |
2092 | ||
2093 | DEFUN (no_bgp_bestpath_med2, | |
2094 | no_bgp_bestpath_med2_cmd, | |
2095 | "no bgp bestpath med confed missing-as-worst", | |
2096 | NO_STR | |
2097 | "BGP specific commands\n" | |
2098 | "Change the default bestpath selection\n" | |
2099 | "MED attribute\n" | |
2100 | "Compare MED among confederation paths\n" | |
2101 | "Treat missing MED as the least preferred one\n") | |
2102 | { | |
2103 | struct bgp *bgp; | |
2104 | ||
2105 | bgp = vty->index; | |
2106 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2107 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2108 | bgp_recalculate_all_bestpaths (bgp); |
2109 | ||
718e3744 | 2110 | return CMD_SUCCESS; |
2111 | } | |
2112 | ||
2113 | ALIAS (no_bgp_bestpath_med2, | |
2114 | no_bgp_bestpath_med3_cmd, | |
2115 | "no bgp bestpath med missing-as-worst confed", | |
2116 | NO_STR | |
2117 | "BGP specific commands\n" | |
2118 | "Change the default bestpath selection\n" | |
2119 | "MED attribute\n" | |
2120 | "Treat missing MED as the least preferred one\n" | |
2121 | "Compare MED among confederation paths\n") | |
6b0655a2 | 2122 | |
718e3744 | 2123 | /* "no bgp default ipv4-unicast". */ |
2124 | DEFUN (no_bgp_default_ipv4_unicast, | |
2125 | no_bgp_default_ipv4_unicast_cmd, | |
2126 | "no bgp default ipv4-unicast", | |
2127 | NO_STR | |
2128 | "BGP specific commands\n" | |
2129 | "Configure BGP defaults\n" | |
2130 | "Activate ipv4-unicast for a peer by default\n") | |
2131 | { | |
2132 | struct bgp *bgp; | |
2133 | ||
2134 | bgp = vty->index; | |
2135 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2136 | return CMD_SUCCESS; | |
2137 | } | |
2138 | ||
2139 | DEFUN (bgp_default_ipv4_unicast, | |
2140 | bgp_default_ipv4_unicast_cmd, | |
2141 | "bgp default ipv4-unicast", | |
2142 | "BGP specific commands\n" | |
2143 | "Configure BGP defaults\n" | |
2144 | "Activate ipv4-unicast for a peer by default\n") | |
2145 | { | |
2146 | struct bgp *bgp; | |
2147 | ||
2148 | bgp = vty->index; | |
2149 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2150 | return CMD_SUCCESS; | |
2151 | } | |
6b0655a2 | 2152 | |
04b6bdc0 DW |
2153 | /* Display hostname in certain command outputs */ |
2154 | DEFUN (bgp_default_show_hostname, | |
2155 | bgp_default_show_hostname_cmd, | |
2156 | "bgp default show-hostname", | |
2157 | "BGP specific commands\n" | |
2158 | "Configure BGP defaults\n" | |
2159 | "Show hostname in certain command ouputs\n") | |
2160 | { | |
2161 | struct bgp *bgp; | |
2162 | ||
2163 | bgp = vty->index; | |
2164 | bgp_flag_set (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2165 | return CMD_SUCCESS; | |
2166 | } | |
2167 | ||
2168 | DEFUN (no_bgp_default_show_hostname, | |
2169 | no_bgp_default_show_hostname_cmd, | |
2170 | "no bgp default show-hostname", | |
2171 | NO_STR | |
2172 | "BGP specific commands\n" | |
2173 | "Configure BGP defaults\n" | |
2174 | "Show hostname in certain command ouputs\n") | |
2175 | { | |
2176 | struct bgp *bgp; | |
2177 | ||
2178 | bgp = vty->index; | |
2179 | bgp_flag_unset (bgp, BGP_FLAG_SHOW_HOSTNAME); | |
2180 | return CMD_SUCCESS; | |
2181 | } | |
2182 | ||
718e3744 | 2183 | /* "bgp import-check" configuration. */ |
2184 | DEFUN (bgp_network_import_check, | |
2185 | bgp_network_import_check_cmd, | |
5623e905 | 2186 | "bgp network import-check", |
718e3744 | 2187 | "BGP specific commands\n" |
2188 | "BGP network command\n" | |
5623e905 | 2189 | "Check BGP network route exists in IGP\n") |
718e3744 | 2190 | { |
2191 | struct bgp *bgp; | |
2192 | ||
2193 | bgp = vty->index; | |
078430f6 DS |
2194 | if (!bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2195 | { | |
2196 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
5623e905 | 2197 | bgp_static_redo_import_check(bgp); |
078430f6 DS |
2198 | } |
2199 | ||
718e3744 | 2200 | return CMD_SUCCESS; |
2201 | } | |
2202 | ||
2203 | DEFUN (no_bgp_network_import_check, | |
2204 | no_bgp_network_import_check_cmd, | |
5623e905 | 2205 | "no bgp network import-check", |
718e3744 | 2206 | NO_STR |
2207 | "BGP specific commands\n" | |
2208 | "BGP network command\n" | |
2209 | "Check BGP network route exists in IGP\n") | |
2210 | { | |
2211 | struct bgp *bgp; | |
2212 | ||
2213 | bgp = vty->index; | |
078430f6 DS |
2214 | if (bgp_flag_check(bgp, BGP_FLAG_IMPORT_CHECK)) |
2215 | { | |
2216 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
078430f6 DS |
2217 | bgp_static_redo_import_check(bgp); |
2218 | } | |
5623e905 | 2219 | |
718e3744 | 2220 | return CMD_SUCCESS; |
2221 | } | |
6b0655a2 | 2222 | |
718e3744 | 2223 | DEFUN (bgp_default_local_preference, |
2224 | bgp_default_local_preference_cmd, | |
2225 | "bgp default local-preference <0-4294967295>", | |
2226 | "BGP specific commands\n" | |
2227 | "Configure BGP defaults\n" | |
2228 | "local preference (higher=more preferred)\n" | |
2229 | "Configure default local preference value\n") | |
2230 | { | |
2231 | struct bgp *bgp; | |
2232 | u_int32_t local_pref; | |
2233 | ||
2234 | bgp = vty->index; | |
2235 | ||
2236 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
2237 | ||
2238 | bgp_default_local_preference_set (bgp, local_pref); | |
7aafcaca | 2239 | bgp_clear_star_soft_in (vty); |
718e3744 | 2240 | |
2241 | return CMD_SUCCESS; | |
2242 | } | |
2243 | ||
2244 | DEFUN (no_bgp_default_local_preference, | |
2245 | no_bgp_default_local_preference_cmd, | |
2246 | "no bgp default local-preference", | |
2247 | NO_STR | |
2248 | "BGP specific commands\n" | |
2249 | "Configure BGP defaults\n" | |
2250 | "local preference (higher=more preferred)\n") | |
2251 | { | |
2252 | struct bgp *bgp; | |
2253 | ||
2254 | bgp = vty->index; | |
2255 | bgp_default_local_preference_unset (bgp); | |
7aafcaca DS |
2256 | bgp_clear_star_soft_in (vty); |
2257 | ||
718e3744 | 2258 | return CMD_SUCCESS; |
2259 | } | |
2260 | ||
2261 | ALIAS (no_bgp_default_local_preference, | |
2262 | no_bgp_default_local_preference_val_cmd, | |
2263 | "no bgp default local-preference <0-4294967295>", | |
2264 | NO_STR | |
2265 | "BGP specific commands\n" | |
2266 | "Configure BGP defaults\n" | |
2267 | "local preference (higher=more preferred)\n" | |
2268 | "Configure default local preference value\n") | |
6b0655a2 | 2269 | |
3f9c7369 DS |
2270 | DEFUN (bgp_default_subgroup_pkt_queue_max, |
2271 | bgp_default_subgroup_pkt_queue_max_cmd, | |
2272 | "bgp default subgroup-pkt-queue-max <20-100>", | |
2273 | "BGP specific commands\n" | |
2274 | "Configure BGP defaults\n" | |
2275 | "subgroup-pkt-queue-max\n" | |
2276 | "Configure subgroup packet queue max\n") | |
8bd9d948 | 2277 | { |
3f9c7369 DS |
2278 | struct bgp *bgp; |
2279 | u_int32_t max_size; | |
8bd9d948 | 2280 | |
3f9c7369 DS |
2281 | bgp = vty->index; |
2282 | ||
2283 | VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]); | |
2284 | ||
2285 | bgp_default_subgroup_pkt_queue_max_set (bgp, max_size); | |
2286 | ||
2287 | return CMD_SUCCESS; | |
2288 | } | |
2289 | ||
2290 | DEFUN (no_bgp_default_subgroup_pkt_queue_max, | |
2291 | no_bgp_default_subgroup_pkt_queue_max_cmd, | |
2292 | "no bgp default subgroup-pkt-queue-max", | |
2293 | NO_STR | |
2294 | "BGP specific commands\n" | |
2295 | "Configure BGP defaults\n" | |
2296 | "subgroup-pkt-queue-max\n") | |
2297 | { | |
2298 | struct bgp *bgp; | |
2299 | ||
2300 | bgp = vty->index; | |
2301 | bgp_default_subgroup_pkt_queue_max_unset (bgp); | |
2302 | return CMD_SUCCESS; | |
8bd9d948 DS |
2303 | } |
2304 | ||
2305 | DEFUN (bgp_rr_allow_outbound_policy, | |
2306 | bgp_rr_allow_outbound_policy_cmd, | |
2307 | "bgp route-reflector allow-outbound-policy", | |
2308 | "BGP specific commands\n" | |
2309 | "Allow modifications made by out route-map\n" | |
2310 | "on ibgp neighbors\n") | |
2311 | { | |
2312 | struct bgp *bgp; | |
8bd9d948 DS |
2313 | |
2314 | bgp = vty->index; | |
2315 | ||
2316 | if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2317 | { | |
2318 | bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2319 | update_group_announce_rrclients(bgp); |
7aafcaca | 2320 | bgp_clear_star_soft_out (vty); |
8bd9d948 DS |
2321 | } |
2322 | ||
2323 | return CMD_SUCCESS; | |
2324 | } | |
2325 | ||
2326 | DEFUN (no_bgp_rr_allow_outbound_policy, | |
2327 | no_bgp_rr_allow_outbound_policy_cmd, | |
2328 | "no bgp route-reflector allow-outbound-policy", | |
2329 | NO_STR | |
2330 | "BGP specific commands\n" | |
2331 | "Allow modifications made by out route-map\n" | |
2332 | "on ibgp neighbors\n") | |
2333 | { | |
2334 | struct bgp *bgp; | |
8bd9d948 DS |
2335 | |
2336 | bgp = vty->index; | |
2337 | ||
2338 | if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2339 | { | |
2340 | bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2341 | update_group_announce_rrclients(bgp); |
7aafcaca | 2342 | bgp_clear_star_soft_out (vty); |
8bd9d948 DS |
2343 | } |
2344 | ||
2345 | return CMD_SUCCESS; | |
2346 | } | |
2347 | ||
f14e6fdb DS |
2348 | DEFUN (bgp_listen_limit, |
2349 | bgp_listen_limit_cmd, | |
2350 | "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2351 | "BGP specific commands\n" | |
2352 | "Configure BGP defaults\n" | |
2353 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2354 | "Configure Dynamic Neighbors listen limit value\n") | |
2355 | { | |
2356 | struct bgp *bgp; | |
2357 | int listen_limit; | |
2358 | ||
2359 | bgp = vty->index; | |
2360 | ||
2361 | VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0], | |
2362 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN, | |
2363 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX); | |
2364 | ||
2365 | bgp_listen_limit_set (bgp, listen_limit); | |
2366 | ||
2367 | return CMD_SUCCESS; | |
2368 | } | |
2369 | ||
2370 | DEFUN (no_bgp_listen_limit, | |
2371 | no_bgp_listen_limit_cmd, | |
2372 | "no bgp listen limit", | |
2373 | "BGP specific commands\n" | |
2374 | "Configure BGP defaults\n" | |
2375 | "unset maximum number of BGP Dynamic Neighbors that can be created\n" | |
2376 | "Configure Dynamic Neighbors listen limit value to default\n") | |
2377 | { | |
2378 | struct bgp *bgp; | |
2379 | ||
2380 | bgp = vty->index; | |
2381 | bgp_listen_limit_unset (bgp); | |
2382 | return CMD_SUCCESS; | |
2383 | } | |
2384 | ||
2385 | ||
20eb8864 | 2386 | /* |
2387 | * Check if this listen range is already configured. Check for exact | |
2388 | * match or overlap based on input. | |
2389 | */ | |
2390 | static struct peer_group * | |
2391 | listen_range_exists (struct bgp *bgp, struct prefix *range, int exact) | |
2392 | { | |
2393 | struct listnode *node, *nnode; | |
2394 | struct listnode *node1, *nnode1; | |
2395 | struct peer_group *group; | |
2396 | struct prefix *lr; | |
2397 | afi_t afi; | |
2398 | int match; | |
2399 | ||
2400 | afi = family2afi(range->family); | |
2401 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2402 | { | |
2403 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node1, | |
2404 | nnode1, lr)) | |
2405 | { | |
2406 | if (exact) | |
2407 | match = prefix_same (range, lr); | |
2408 | else | |
2409 | match = (prefix_match (range, lr) || prefix_match (lr, range)); | |
2410 | if (match) | |
2411 | return group; | |
2412 | } | |
2413 | } | |
2414 | ||
2415 | return NULL; | |
2416 | } | |
2417 | ||
f14e6fdb DS |
2418 | DEFUN (bgp_listen_range, |
2419 | bgp_listen_range_cmd, | |
2420 | LISTEN_RANGE_CMD "peer-group WORD" , | |
2421 | "BGP specific commands\n" | |
2422 | "Configure BGP Dynamic Neighbors\n" | |
2423 | "add a listening range for Dynamic Neighbors\n" | |
2424 | LISTEN_RANGE_ADDR_STR) | |
2425 | { | |
2426 | struct bgp *bgp; | |
2427 | struct prefix range; | |
20eb8864 | 2428 | struct peer_group *group, *existing_group; |
f14e6fdb DS |
2429 | afi_t afi; |
2430 | int ret; | |
2431 | ||
2432 | bgp = vty->index; | |
2433 | ||
2434 | //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2435 | ||
2436 | /* Convert IP prefix string to struct prefix. */ | |
2437 | ret = str2prefix (argv[0], &range); | |
2438 | if (! ret) | |
2439 | { | |
2440 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2441 | return CMD_WARNING; | |
2442 | } | |
2443 | ||
2444 | afi = family2afi(range.family); | |
2445 | ||
2446 | #ifdef HAVE_IPV6 | |
2447 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2448 | { | |
2449 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2450 | VTY_NEWLINE); | |
2451 | return CMD_WARNING; | |
2452 | } | |
2453 | #endif /* HAVE_IPV6 */ | |
2454 | ||
2455 | apply_mask (&range); | |
2456 | ||
20eb8864 | 2457 | /* Check if same listen range is already configured. */ |
2458 | existing_group = listen_range_exists (bgp, &range, 1); | |
2459 | if (existing_group) | |
2460 | { | |
2461 | if (strcmp (existing_group->name, argv[1]) == 0) | |
2462 | return CMD_SUCCESS; | |
2463 | else | |
2464 | { | |
2465 | vty_out (vty, "%% Same listen range is attached to peer-group %s%s", | |
2466 | existing_group->name, VTY_NEWLINE); | |
2467 | return CMD_WARNING; | |
2468 | } | |
2469 | } | |
2470 | ||
2471 | /* Check if an overlapping listen range exists. */ | |
2472 | if (listen_range_exists (bgp, &range, 0)) | |
2473 | { | |
2474 | vty_out (vty, "%% Listen range overlaps with existing listen range%s", | |
2475 | VTY_NEWLINE); | |
2476 | return CMD_WARNING; | |
2477 | } | |
f14e6fdb DS |
2478 | |
2479 | group = peer_group_lookup (bgp, argv[1]); | |
2480 | if (! group) | |
2481 | { | |
2482 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2483 | return CMD_WARNING; | |
2484 | } | |
2485 | ||
2486 | ret = peer_group_listen_range_add(group, &range); | |
2487 | return bgp_vty_return (vty, ret); | |
2488 | } | |
2489 | ||
2490 | DEFUN (no_bgp_listen_range, | |
2491 | no_bgp_listen_range_cmd, | |
2492 | "no bgp listen range A.B.C.D/M peer-group WORD" , | |
2493 | "BGP specific commands\n" | |
2494 | "Configure BGP defaults\n" | |
2495 | "delete a listening range for Dynamic Neighbors\n" | |
2496 | "Remove Dynamic Neighbors listening range\n") | |
2497 | { | |
2498 | struct bgp *bgp; | |
2499 | struct prefix range; | |
2500 | struct peer_group *group; | |
2501 | afi_t afi; | |
2502 | int ret; | |
2503 | ||
2504 | bgp = vty->index; | |
2505 | ||
2506 | // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2507 | ||
2508 | /* Convert IP prefix string to struct prefix. */ | |
2509 | ret = str2prefix (argv[0], &range); | |
2510 | if (! ret) | |
2511 | { | |
2512 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2513 | return CMD_WARNING; | |
2514 | } | |
2515 | ||
2516 | afi = family2afi(range.family); | |
2517 | ||
2518 | #ifdef HAVE_IPV6 | |
2519 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2520 | { | |
2521 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2522 | VTY_NEWLINE); | |
2523 | return CMD_WARNING; | |
2524 | } | |
2525 | #endif /* HAVE_IPV6 */ | |
2526 | ||
2527 | apply_mask (&range); | |
2528 | ||
2529 | ||
2530 | group = peer_group_lookup (bgp, argv[1]); | |
2531 | if (! group) | |
2532 | { | |
2533 | vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); | |
2534 | return CMD_WARNING; | |
2535 | } | |
2536 | ||
2537 | ret = peer_group_listen_range_del(group, &range); | |
2538 | return bgp_vty_return (vty, ret); | |
2539 | } | |
2540 | ||
2541 | int | |
2542 | bgp_config_write_listen (struct vty *vty, struct bgp *bgp) | |
2543 | { | |
2544 | struct peer_group *group; | |
2545 | struct listnode *node, *nnode, *rnode, *nrnode; | |
2546 | struct prefix *range; | |
2547 | afi_t afi; | |
2548 | char buf[128]; | |
2549 | ||
2550 | if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT) | |
2551 | vty_out (vty, " bgp listen limit %d%s", | |
2552 | bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
2553 | ||
2554 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2555 | { | |
2556 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
2557 | { | |
2558 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range)) | |
2559 | { | |
2560 | prefix2str(range, buf, sizeof(buf)); | |
2561 | vty_out(vty, " bgp listen range %s peer-group %s%s", | |
2562 | buf, group->name, VTY_NEWLINE); | |
2563 | } | |
2564 | } | |
2565 | } | |
2566 | ||
2567 | return 0; | |
2568 | } | |
2569 | ||
2570 | ||
907f92c8 DS |
2571 | DEFUN (bgp_disable_connected_route_check, |
2572 | bgp_disable_connected_route_check_cmd, | |
2573 | "bgp disable-ebgp-connected-route-check", | |
2574 | "BGP specific commands\n" | |
2575 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2576 | { | |
2577 | struct bgp *bgp; | |
2578 | ||
2579 | bgp = vty->index; | |
2580 | bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
7aafcaca DS |
2581 | bgp_clear_star_soft_in (vty); |
2582 | ||
907f92c8 DS |
2583 | return CMD_SUCCESS; |
2584 | } | |
2585 | ||
2586 | DEFUN (no_bgp_disable_connected_route_check, | |
2587 | no_bgp_disable_connected_route_check_cmd, | |
2588 | "no bgp disable-ebgp-connected-route-check", | |
2589 | NO_STR | |
2590 | "BGP specific commands\n" | |
2591 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2592 | { | |
2593 | struct bgp *bgp; | |
2594 | ||
2595 | bgp = vty->index; | |
2596 | bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
7aafcaca DS |
2597 | bgp_clear_star_soft_in (vty); |
2598 | ||
907f92c8 DS |
2599 | return CMD_SUCCESS; |
2600 | } | |
2601 | ||
2602 | ||
718e3744 | 2603 | static int |
fd79ac91 | 2604 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
2605 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 2606 | { |
2607 | int ret; | |
2608 | struct bgp *bgp; | |
2609 | as_t as; | |
0299c004 | 2610 | int as_type = AS_SPECIFIED; |
718e3744 | 2611 | union sockunion su; |
2612 | ||
2613 | bgp = vty->index; | |
2614 | ||
0299c004 DS |
2615 | if (strncmp(as_str, "internal", strlen("internal")) == 0) |
2616 | { | |
2617 | as = 0; | |
2618 | as_type = AS_INTERNAL; | |
2619 | } | |
2620 | else if (strncmp(as_str, "external", strlen("external")) == 0) | |
2621 | { | |
2622 | as = 0; | |
2623 | as_type = AS_EXTERNAL; | |
2624 | } | |
2625 | else | |
2626 | { | |
2627 | /* Get AS number. */ | |
2628 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); | |
2629 | } | |
718e3744 | 2630 | |
2631 | /* If peer is peer group, call proper function. */ | |
2632 | ret = str2sockunion (peer_str, &su); | |
2633 | if (ret < 0) | |
2634 | { | |
a80beece | 2635 | /* Check for peer by interface */ |
0299c004 | 2636 | ret = peer_remote_as (bgp, NULL, peer_str, &as, as_type, afi, safi); |
718e3744 | 2637 | if (ret < 0) |
a80beece | 2638 | { |
0299c004 | 2639 | ret = peer_group_remote_as (bgp, peer_str, &as, as_type); |
a80beece DS |
2640 | if (ret < 0) |
2641 | { | |
2642 | vty_out (vty, "%% Create the peer-group or interface first%s", | |
2643 | VTY_NEWLINE); | |
2644 | return CMD_WARNING; | |
2645 | } | |
2646 | return CMD_SUCCESS; | |
2647 | } | |
718e3744 | 2648 | } |
a80beece | 2649 | else |
718e3744 | 2650 | { |
a80beece DS |
2651 | if (peer_address_self_check (&su)) |
2652 | { | |
2653 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2654 | VTY_NEWLINE); | |
2655 | return CMD_WARNING; | |
2656 | } | |
0299c004 | 2657 | ret = peer_remote_as (bgp, &su, NULL, &as, as_type, afi, safi); |
718e3744 | 2658 | } |
2659 | ||
718e3744 | 2660 | /* This peer belongs to peer group. */ |
2661 | switch (ret) | |
2662 | { | |
2663 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 2664 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 2665 | return CMD_WARNING; |
718e3744 | 2666 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 2667 | 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 | 2668 | return CMD_WARNING; |
718e3744 | 2669 | } |
2670 | return bgp_vty_return (vty, ret); | |
2671 | } | |
2672 | ||
2673 | DEFUN (neighbor_remote_as, | |
2674 | neighbor_remote_as_cmd, | |
0299c004 | 2675 | NEIGHBOR_CMD2 "remote-as (" CMD_AS_RANGE "|external|internal)", |
718e3744 | 2676 | NEIGHBOR_STR |
2677 | NEIGHBOR_ADDR_STR2 | |
2678 | "Specify a BGP neighbor\n" | |
2679 | AS_STR) | |
2680 | { | |
2681 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
2682 | } | |
6b0655a2 | 2683 | |
a80beece DS |
2684 | DEFUN (neighbor_interface_config, |
2685 | neighbor_interface_config_cmd, | |
8ffedcea | 2686 | "neighbor WORD interface {v6only}", |
a80beece DS |
2687 | NEIGHBOR_STR |
2688 | "Interface name or neighbor tag\n" | |
8ffedcea DS |
2689 | "Enable BGP on interface\n" |
2690 | "Enable BGP with v6 link-local only\n") | |
a80beece DS |
2691 | { |
2692 | struct bgp *bgp; | |
2693 | struct peer *peer; | |
2694 | struct peer_group *group; | |
2695 | ||
2696 | bgp = vty->index; | |
2697 | group = peer_group_lookup (bgp, argv[0]); | |
2698 | if (group) | |
2699 | { | |
2700 | vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE); | |
2701 | return CMD_WARNING; | |
2702 | } | |
2703 | ||
8ffedcea DS |
2704 | if (argv[1] != NULL) |
2705 | peer = peer_conf_interface_get (bgp, argv[0], AFI_IP, SAFI_UNICAST, 1); | |
2706 | else | |
2707 | peer = peer_conf_interface_get (bgp, argv[0], AFI_IP, SAFI_UNICAST, 0); | |
a80beece DS |
2708 | if (!peer) |
2709 | return CMD_WARNING; | |
2710 | ||
2711 | return CMD_SUCCESS; | |
2712 | } | |
2713 | ||
2714 | ||
718e3744 | 2715 | DEFUN (neighbor_peer_group, |
2716 | neighbor_peer_group_cmd, | |
2717 | "neighbor WORD peer-group", | |
2718 | NEIGHBOR_STR | |
a80beece | 2719 | "Interface name or neighbor tag\n" |
718e3744 | 2720 | "Configure peer-group\n") |
2721 | { | |
2722 | struct bgp *bgp; | |
a80beece | 2723 | struct peer *peer; |
718e3744 | 2724 | struct peer_group *group; |
2725 | ||
2726 | bgp = vty->index; | |
a80beece DS |
2727 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2728 | if (peer) | |
2729 | { | |
2730 | vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); | |
2731 | return CMD_WARNING; | |
2732 | } | |
718e3744 | 2733 | |
2734 | group = peer_group_get (bgp, argv[0]); | |
2735 | if (! group) | |
2736 | return CMD_WARNING; | |
2737 | ||
2738 | return CMD_SUCCESS; | |
2739 | } | |
2740 | ||
2741 | DEFUN (no_neighbor, | |
2742 | no_neighbor_cmd, | |
2743 | NO_NEIGHBOR_CMD2, | |
2744 | NO_STR | |
2745 | NEIGHBOR_STR | |
2746 | NEIGHBOR_ADDR_STR2) | |
2747 | { | |
2748 | int ret; | |
2749 | union sockunion su; | |
2750 | struct peer_group *group; | |
2751 | struct peer *peer; | |
1ff9a340 | 2752 | struct peer *other; |
718e3744 | 2753 | |
2754 | ret = str2sockunion (argv[0], &su); | |
2755 | if (ret < 0) | |
2756 | { | |
a80beece DS |
2757 | /* look up for neighbor by interface name config. */ |
2758 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2759 | if (peer) | |
2760 | { | |
2761 | peer_delete (peer); | |
2762 | return CMD_SUCCESS; | |
2763 | } | |
2764 | ||
718e3744 | 2765 | group = peer_group_lookup (vty->index, argv[0]); |
2766 | if (group) | |
2767 | peer_group_delete (group); | |
2768 | else | |
2769 | { | |
2770 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2771 | return CMD_WARNING; | |
2772 | } | |
2773 | } | |
2774 | else | |
2775 | { | |
2776 | peer = peer_lookup (vty->index, &su); | |
2777 | if (peer) | |
1ff9a340 | 2778 | { |
f14e6fdb DS |
2779 | if (peer_dynamic_neighbor (peer)) |
2780 | { | |
2781 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
2782 | VTY_NEWLINE); | |
2783 | return CMD_WARNING; | |
2784 | } | |
2785 | ||
1ff9a340 DS |
2786 | other = peer->doppelganger; |
2787 | peer_delete (peer); | |
2788 | if (other && other->status != Deleted) | |
2789 | peer_delete(other); | |
2790 | } | |
718e3744 | 2791 | } |
2792 | ||
2793 | return CMD_SUCCESS; | |
2794 | } | |
2795 | ||
2796 | ALIAS (no_neighbor, | |
2797 | no_neighbor_remote_as_cmd, | |
0299c004 | 2798 | NO_NEIGHBOR_CMD "remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 2799 | NO_STR |
2800 | NEIGHBOR_STR | |
2801 | NEIGHBOR_ADDR_STR | |
2802 | "Specify a BGP neighbor\n" | |
2803 | AS_STR) | |
2804 | ||
a80beece DS |
2805 | DEFUN (no_neighbor_interface_config, |
2806 | no_neighbor_interface_config_cmd, | |
c8a96aef | 2807 | "no neighbor WORD interface {v6only}", |
a80beece DS |
2808 | NO_STR |
2809 | NEIGHBOR_STR | |
2810 | "Interface name\n" | |
2811 | "Configure BGP on interface\n") | |
2812 | { | |
2813 | struct peer *peer; | |
2814 | ||
2815 | /* look up for neighbor by interface name config. */ | |
2816 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2817 | if (peer) | |
2818 | { | |
2819 | peer_delete (peer); | |
2820 | } | |
2821 | else | |
2822 | { | |
2823 | vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE); | |
2824 | return CMD_WARNING; | |
2825 | } | |
2826 | return CMD_SUCCESS; | |
2827 | } | |
2828 | ||
718e3744 | 2829 | DEFUN (no_neighbor_peer_group, |
2830 | no_neighbor_peer_group_cmd, | |
2831 | "no neighbor WORD peer-group", | |
2832 | NO_STR | |
2833 | NEIGHBOR_STR | |
2834 | "Neighbor tag\n" | |
2835 | "Configure peer-group\n") | |
2836 | { | |
2837 | struct peer_group *group; | |
2838 | ||
2839 | group = peer_group_lookup (vty->index, argv[0]); | |
2840 | if (group) | |
2841 | peer_group_delete (group); | |
2842 | else | |
2843 | { | |
2844 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2845 | return CMD_WARNING; | |
2846 | } | |
2847 | return CMD_SUCCESS; | |
2848 | } | |
2849 | ||
a80beece DS |
2850 | DEFUN (no_neighbor_interface_peer_group_remote_as, |
2851 | no_neighbor_interface_peer_group_remote_as_cmd, | |
0299c004 | 2852 | "no neighbor WORD remote-as (" CMD_AS_RANGE "|internal|external)", |
718e3744 | 2853 | NO_STR |
2854 | NEIGHBOR_STR | |
a80beece | 2855 | "Interface name or neighbor tag\n" |
718e3744 | 2856 | "Specify a BGP neighbor\n" |
2857 | AS_STR) | |
2858 | { | |
2859 | struct peer_group *group; | |
a80beece DS |
2860 | struct peer *peer; |
2861 | ||
2862 | /* look up for neighbor by interface name config. */ | |
2863 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2864 | if (peer) | |
2865 | { | |
0299c004 | 2866 | peer_as_change (peer, 0, AS_SPECIFIED); |
a80beece DS |
2867 | return CMD_SUCCESS; |
2868 | } | |
718e3744 | 2869 | |
2870 | group = peer_group_lookup (vty->index, argv[0]); | |
2871 | if (group) | |
2872 | peer_group_remote_as_delete (group); | |
2873 | else | |
2874 | { | |
a80beece | 2875 | vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE); |
718e3744 | 2876 | return CMD_WARNING; |
2877 | } | |
2878 | return CMD_SUCCESS; | |
2879 | } | |
6b0655a2 | 2880 | |
718e3744 | 2881 | DEFUN (neighbor_local_as, |
2882 | neighbor_local_as_cmd, | |
320da874 | 2883 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 2884 | NEIGHBOR_STR |
2885 | NEIGHBOR_ADDR_STR2 | |
2886 | "Specify a local-as number\n" | |
2887 | "AS number used as local AS\n") | |
2888 | { | |
2889 | struct peer *peer; | |
2890 | int ret; | |
2891 | ||
2892 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2893 | if (! peer) | |
2894 | return CMD_WARNING; | |
2895 | ||
9d3f9705 | 2896 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
718e3744 | 2897 | return bgp_vty_return (vty, ret); |
2898 | } | |
2899 | ||
2900 | DEFUN (neighbor_local_as_no_prepend, | |
2901 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 2902 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 2903 | NEIGHBOR_STR |
2904 | NEIGHBOR_ADDR_STR2 | |
2905 | "Specify a local-as number\n" | |
2906 | "AS number used as local AS\n" | |
2907 | "Do not prepend local-as to updates from ebgp peers\n") | |
2908 | { | |
2909 | struct peer *peer; | |
2910 | int ret; | |
2911 | ||
2912 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2913 | if (! peer) | |
2914 | return CMD_WARNING; | |
2915 | ||
9d3f9705 | 2916 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
718e3744 | 2917 | return bgp_vty_return (vty, ret); |
2918 | } | |
2919 | ||
9d3f9705 AC |
2920 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
2921 | neighbor_local_as_no_prepend_replace_as_cmd, | |
2922 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
2923 | NEIGHBOR_STR | |
2924 | NEIGHBOR_ADDR_STR2 | |
2925 | "Specify a local-as number\n" | |
2926 | "AS number used as local AS\n" | |
2927 | "Do not prepend local-as to updates from ebgp peers\n" | |
2928 | "Do not prepend local-as to updates from ibgp peers\n") | |
2929 | { | |
2930 | struct peer *peer; | |
2931 | int ret; | |
2932 | ||
2933 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2934 | if (! peer) | |
2935 | return CMD_WARNING; | |
2936 | ||
2937 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); | |
2938 | return bgp_vty_return (vty, ret); | |
2939 | } | |
2940 | ||
2941 | ||
718e3744 | 2942 | DEFUN (no_neighbor_local_as, |
2943 | no_neighbor_local_as_cmd, | |
2944 | NO_NEIGHBOR_CMD2 "local-as", | |
2945 | NO_STR | |
2946 | NEIGHBOR_STR | |
2947 | NEIGHBOR_ADDR_STR2 | |
2948 | "Specify a local-as number\n") | |
2949 | { | |
2950 | struct peer *peer; | |
2951 | int ret; | |
2952 | ||
2953 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2954 | if (! peer) | |
2955 | return CMD_WARNING; | |
2956 | ||
2957 | ret = peer_local_as_unset (peer); | |
2958 | return bgp_vty_return (vty, ret); | |
2959 | } | |
2960 | ||
2961 | ALIAS (no_neighbor_local_as, | |
2962 | no_neighbor_local_as_val_cmd, | |
320da874 | 2963 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 2964 | NO_STR |
2965 | NEIGHBOR_STR | |
2966 | NEIGHBOR_ADDR_STR2 | |
2967 | "Specify a local-as number\n" | |
2968 | "AS number used as local AS\n") | |
2969 | ||
2970 | ALIAS (no_neighbor_local_as, | |
2971 | no_neighbor_local_as_val2_cmd, | |
320da874 | 2972 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 2973 | NO_STR |
2974 | NEIGHBOR_STR | |
2975 | NEIGHBOR_ADDR_STR2 | |
2976 | "Specify a local-as number\n" | |
2977 | "AS number used as local AS\n" | |
2978 | "Do not prepend local-as to updates from ebgp peers\n") | |
9d3f9705 AC |
2979 | |
2980 | ALIAS (no_neighbor_local_as, | |
2981 | no_neighbor_local_as_val3_cmd, | |
2982 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
2983 | NO_STR | |
2984 | NEIGHBOR_STR | |
2985 | NEIGHBOR_ADDR_STR2 | |
2986 | "Specify a local-as number\n" | |
2987 | "AS number used as local AS\n" | |
2988 | "Do not prepend local-as to updates from ebgp peers\n" | |
2989 | "Do not prepend local-as to updates from ibgp peers\n") | |
6b0655a2 | 2990 | |
3f9c7369 DS |
2991 | DEFUN (neighbor_solo, |
2992 | neighbor_solo_cmd, | |
2993 | NEIGHBOR_CMD2 "solo", | |
2994 | NEIGHBOR_STR | |
2995 | NEIGHBOR_ADDR_STR2 | |
2996 | "Solo peer - part of its own update group\n") | |
2997 | { | |
2998 | struct peer *peer; | |
2999 | int ret; | |
3000 | ||
3001 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3002 | if (! peer) | |
3003 | return CMD_WARNING; | |
3004 | ||
3005 | ret = update_group_adjust_soloness(peer, 1); | |
3006 | return bgp_vty_return (vty, ret); | |
3007 | } | |
3008 | ||
3009 | DEFUN (no_neighbor_solo, | |
3010 | no_neighbor_solo_cmd, | |
3011 | NO_NEIGHBOR_CMD2 "solo", | |
3012 | NO_STR | |
3013 | NEIGHBOR_STR | |
3014 | NEIGHBOR_ADDR_STR2 | |
3015 | "Solo peer - part of its own update group\n") | |
3016 | { | |
3017 | struct peer *peer; | |
3018 | int ret; | |
3019 | ||
3020 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3021 | if (! peer) | |
3022 | return CMD_WARNING; | |
3023 | ||
3024 | ret = update_group_adjust_soloness(peer, 0); | |
3025 | return bgp_vty_return (vty, ret); | |
3026 | } | |
3027 | ||
0df7c91f PJ |
3028 | DEFUN (neighbor_password, |
3029 | neighbor_password_cmd, | |
3030 | NEIGHBOR_CMD2 "password LINE", | |
3031 | NEIGHBOR_STR | |
3032 | NEIGHBOR_ADDR_STR2 | |
3033 | "Set a password\n" | |
3034 | "The password\n") | |
3035 | { | |
3036 | struct peer *peer; | |
3037 | int ret; | |
3038 | ||
3039 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3040 | if (! peer) | |
3041 | return CMD_WARNING; | |
3042 | ||
3043 | ret = peer_password_set (peer, argv[1]); | |
3044 | return bgp_vty_return (vty, ret); | |
3045 | } | |
3046 | ||
3047 | DEFUN (no_neighbor_password, | |
3048 | no_neighbor_password_cmd, | |
3049 | NO_NEIGHBOR_CMD2 "password", | |
3050 | NO_STR | |
3051 | NEIGHBOR_STR | |
3052 | NEIGHBOR_ADDR_STR2 | |
3053 | "Set a password\n") | |
3054 | { | |
3055 | struct peer *peer; | |
3056 | int ret; | |
3057 | ||
3058 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3059 | if (! peer) | |
3060 | return CMD_WARNING; | |
3061 | ||
3062 | ret = peer_password_unset (peer); | |
3063 | return bgp_vty_return (vty, ret); | |
3064 | } | |
6b0655a2 | 3065 | |
718e3744 | 3066 | DEFUN (neighbor_activate, |
3067 | neighbor_activate_cmd, | |
3068 | NEIGHBOR_CMD2 "activate", | |
3069 | NEIGHBOR_STR | |
3070 | NEIGHBOR_ADDR_STR2 | |
3071 | "Enable the Address Family for this Neighbor\n") | |
3072 | { | |
3073 | struct peer *peer; | |
3074 | ||
3075 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3076 | if (! peer) | |
3077 | return CMD_WARNING; | |
3078 | ||
3079 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
3080 | ||
3081 | return CMD_SUCCESS; | |
3082 | } | |
3083 | ||
3084 | DEFUN (no_neighbor_activate, | |
3085 | no_neighbor_activate_cmd, | |
3086 | NO_NEIGHBOR_CMD2 "activate", | |
3087 | NO_STR | |
3088 | NEIGHBOR_STR | |
3089 | NEIGHBOR_ADDR_STR2 | |
3090 | "Enable the Address Family for this Neighbor\n") | |
3091 | { | |
3092 | int ret; | |
3093 | struct peer *peer; | |
3094 | ||
3095 | /* Lookup peer. */ | |
3096 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3097 | if (! peer) | |
3098 | return CMD_WARNING; | |
3099 | ||
3100 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
3101 | ||
3102 | return bgp_vty_return (vty, ret); | |
3103 | } | |
6b0655a2 | 3104 | |
718e3744 | 3105 | DEFUN (neighbor_set_peer_group, |
3106 | neighbor_set_peer_group_cmd, | |
a80beece | 3107 | NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3108 | NEIGHBOR_STR |
a80beece | 3109 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3110 | "Member of the peer-group\n" |
3111 | "peer-group name\n") | |
3112 | { | |
3113 | int ret; | |
3114 | as_t as; | |
3115 | union sockunion su; | |
3116 | struct bgp *bgp; | |
a80beece | 3117 | struct peer *peer; |
718e3744 | 3118 | struct peer_group *group; |
3119 | ||
3120 | bgp = vty->index; | |
a80beece | 3121 | peer = NULL; |
718e3744 | 3122 | |
3123 | ret = str2sockunion (argv[0], &su); | |
3124 | if (ret < 0) | |
3125 | { | |
a80beece DS |
3126 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
3127 | if (!peer) | |
3128 | { | |
3129 | vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); | |
3130 | return CMD_WARNING; | |
3131 | } | |
3132 | } | |
3133 | else | |
3134 | { | |
3135 | if (peer_address_self_check (&su)) | |
3136 | { | |
3137 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
3138 | VTY_NEWLINE); | |
3139 | return CMD_WARNING; | |
3140 | } | |
f14e6fdb DS |
3141 | |
3142 | /* Disallow for dynamic neighbor. */ | |
3143 | peer = peer_lookup (bgp, &su); | |
3144 | if (peer && peer_dynamic_neighbor (peer)) | |
3145 | { | |
3146 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
3147 | VTY_NEWLINE); | |
3148 | return CMD_WARNING; | |
3149 | } | |
718e3744 | 3150 | } |
3151 | ||
3152 | group = peer_group_lookup (bgp, argv[1]); | |
3153 | if (! group) | |
3154 | { | |
3155 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3156 | return CMD_WARNING; | |
3157 | } | |
3158 | ||
a80beece | 3159 | ret = peer_group_bind (bgp, &su, peer, group, bgp_node_afi (vty), |
718e3744 | 3160 | bgp_node_safi (vty), &as); |
3161 | ||
3162 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
3163 | { | |
aea339f7 | 3164 | 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 | 3165 | return CMD_WARNING; |
3166 | } | |
3167 | ||
3168 | return bgp_vty_return (vty, ret); | |
3169 | } | |
3170 | ||
3171 | DEFUN (no_neighbor_set_peer_group, | |
3172 | no_neighbor_set_peer_group_cmd, | |
a80beece | 3173 | NO_NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3174 | NO_STR |
3175 | NEIGHBOR_STR | |
a80beece | 3176 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3177 | "Member of the peer-group\n" |
3178 | "peer-group name\n") | |
3179 | { | |
3180 | int ret; | |
3181 | struct bgp *bgp; | |
3182 | struct peer *peer; | |
3183 | struct peer_group *group; | |
3184 | ||
3185 | bgp = vty->index; | |
3186 | ||
3187 | peer = peer_lookup_vty (vty, argv[0]); | |
3188 | if (! peer) | |
3189 | return CMD_WARNING; | |
3190 | ||
3191 | group = peer_group_lookup (bgp, argv[1]); | |
3192 | if (! group) | |
3193 | { | |
3194 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3195 | return CMD_WARNING; | |
3196 | } | |
3197 | ||
3198 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), | |
3199 | bgp_node_safi (vty)); | |
3200 | ||
3201 | return bgp_vty_return (vty, ret); | |
3202 | } | |
6b0655a2 | 3203 | |
94f2b392 | 3204 | static int |
fd79ac91 | 3205 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
3206 | u_int16_t flag, int set) | |
718e3744 | 3207 | { |
3208 | int ret; | |
3209 | struct peer *peer; | |
3210 | ||
3211 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3212 | if (! peer) | |
3213 | return CMD_WARNING; | |
3214 | ||
3215 | if (set) | |
3216 | ret = peer_flag_set (peer, flag); | |
3217 | else | |
3218 | ret = peer_flag_unset (peer, flag); | |
3219 | ||
3220 | return bgp_vty_return (vty, ret); | |
3221 | } | |
3222 | ||
94f2b392 | 3223 | static int |
fd79ac91 | 3224 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3225 | { |
3226 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
3227 | } | |
3228 | ||
94f2b392 | 3229 | static int |
fd79ac91 | 3230 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3231 | { |
3232 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
3233 | } | |
3234 | ||
3235 | /* neighbor passive. */ | |
3236 | DEFUN (neighbor_passive, | |
3237 | neighbor_passive_cmd, | |
3238 | NEIGHBOR_CMD2 "passive", | |
3239 | NEIGHBOR_STR | |
3240 | NEIGHBOR_ADDR_STR2 | |
3241 | "Don't send open messages to this neighbor\n") | |
3242 | { | |
3243 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3244 | } | |
3245 | ||
3246 | DEFUN (no_neighbor_passive, | |
3247 | no_neighbor_passive_cmd, | |
3248 | NO_NEIGHBOR_CMD2 "passive", | |
3249 | NO_STR | |
3250 | NEIGHBOR_STR | |
3251 | NEIGHBOR_ADDR_STR2 | |
3252 | "Don't send open messages to this neighbor\n") | |
3253 | { | |
3254 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3255 | } | |
6b0655a2 | 3256 | |
718e3744 | 3257 | /* neighbor shutdown. */ |
3258 | DEFUN (neighbor_shutdown, | |
3259 | neighbor_shutdown_cmd, | |
3260 | NEIGHBOR_CMD2 "shutdown", | |
3261 | NEIGHBOR_STR | |
3262 | NEIGHBOR_ADDR_STR2 | |
3263 | "Administratively shut down this neighbor\n") | |
3264 | { | |
3265 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3266 | } | |
3267 | ||
3268 | DEFUN (no_neighbor_shutdown, | |
3269 | no_neighbor_shutdown_cmd, | |
3270 | NO_NEIGHBOR_CMD2 "shutdown", | |
3271 | NO_STR | |
3272 | NEIGHBOR_STR | |
3273 | NEIGHBOR_ADDR_STR2 | |
3274 | "Administratively shut down this neighbor\n") | |
3275 | { | |
3276 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3277 | } | |
6b0655a2 | 3278 | |
c9502438 | 3279 | /* Deprecated neighbor capability route-refresh. */ |
3280 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, | |
3281 | neighbor_capability_route_refresh_cmd, | |
3282 | NEIGHBOR_CMD2 "capability route-refresh", | |
3283 | NEIGHBOR_STR | |
3284 | NEIGHBOR_ADDR_STR2 | |
3285 | "Advertise capability to the peer\n" | |
3286 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 3287 | { |
c9502438 | 3288 | return CMD_SUCCESS; |
718e3744 | 3289 | } |
3290 | ||
c9502438 | 3291 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
3292 | no_neighbor_capability_route_refresh_cmd, | |
3293 | NO_NEIGHBOR_CMD2 "capability route-refresh", | |
3294 | NO_STR | |
3295 | NEIGHBOR_STR | |
3296 | NEIGHBOR_ADDR_STR2 | |
3297 | "Advertise capability to the peer\n" | |
3298 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 3299 | { |
c9502438 | 3300 | return CMD_SUCCESS; |
718e3744 | 3301 | } |
6b0655a2 | 3302 | |
718e3744 | 3303 | /* neighbor capability dynamic. */ |
3304 | DEFUN (neighbor_capability_dynamic, | |
3305 | neighbor_capability_dynamic_cmd, | |
3306 | NEIGHBOR_CMD2 "capability dynamic", | |
3307 | NEIGHBOR_STR | |
3308 | NEIGHBOR_ADDR_STR2 | |
3309 | "Advertise capability to the peer\n" | |
3310 | "Advertise dynamic capability to this neighbor\n") | |
3311 | { | |
3312 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3313 | } | |
3314 | ||
3315 | DEFUN (no_neighbor_capability_dynamic, | |
3316 | no_neighbor_capability_dynamic_cmd, | |
3317 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
3318 | NO_STR | |
3319 | NEIGHBOR_STR | |
3320 | NEIGHBOR_ADDR_STR2 | |
3321 | "Advertise capability to the peer\n" | |
3322 | "Advertise dynamic capability to this neighbor\n") | |
3323 | { | |
3324 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3325 | } | |
6b0655a2 | 3326 | |
718e3744 | 3327 | /* neighbor dont-capability-negotiate */ |
3328 | DEFUN (neighbor_dont_capability_negotiate, | |
3329 | neighbor_dont_capability_negotiate_cmd, | |
3330 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3331 | NEIGHBOR_STR | |
3332 | NEIGHBOR_ADDR_STR2 | |
3333 | "Do not perform capability negotiation\n") | |
3334 | { | |
3335 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3336 | } | |
3337 | ||
3338 | DEFUN (no_neighbor_dont_capability_negotiate, | |
3339 | no_neighbor_dont_capability_negotiate_cmd, | |
3340 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3341 | NO_STR | |
3342 | NEIGHBOR_STR | |
3343 | NEIGHBOR_ADDR_STR2 | |
3344 | "Do not perform capability negotiation\n") | |
3345 | { | |
3346 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3347 | } | |
6b0655a2 | 3348 | |
8a92a8a0 DS |
3349 | /* neighbor capability extended next hop encoding */ |
3350 | DEFUN (neighbor_capability_enhe, | |
3351 | neighbor_capability_enhe_cmd, | |
3352 | NEIGHBOR_CMD2 "capability extended-nexthop", | |
3353 | NEIGHBOR_STR | |
3354 | NEIGHBOR_ADDR_STR2 | |
3355 | "Advertise capability to the peer\n" | |
3356 | "Advertise extended next-hop capability to the peer\n") | |
3357 | { | |
3358 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3359 | } | |
3360 | ||
3361 | DEFUN (no_neighbor_capability_enhe, | |
3362 | no_neighbor_capability_enhe_cmd, | |
3363 | NO_NEIGHBOR_CMD2 "capability extended-nexthop", | |
3364 | NO_STR | |
3365 | NEIGHBOR_STR | |
3366 | NEIGHBOR_ADDR_STR2 | |
3367 | "Advertise capability to the peer\n" | |
3368 | "Advertise extended next-hop capability to the peer\n") | |
3369 | { | |
3370 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_CAPABILITY_ENHE); | |
3371 | } | |
3372 | ||
94f2b392 | 3373 | static int |
fd79ac91 | 3374 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3375 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 3376 | { |
3377 | int ret; | |
3378 | struct peer *peer; | |
3379 | ||
3380 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3381 | if (! peer) | |
3382 | return CMD_WARNING; | |
3383 | ||
3384 | if (set) | |
3385 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
3386 | else | |
3387 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
3388 | ||
3389 | return bgp_vty_return (vty, ret); | |
3390 | } | |
3391 | ||
94f2b392 | 3392 | static int |
fd79ac91 | 3393 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3394 | safi_t safi, u_int32_t flag) |
718e3744 | 3395 | { |
3396 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
3397 | } | |
3398 | ||
94f2b392 | 3399 | static int |
fd79ac91 | 3400 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3401 | safi_t safi, u_int32_t flag) |
718e3744 | 3402 | { |
3403 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
3404 | } | |
6b0655a2 | 3405 | |
718e3744 | 3406 | /* neighbor capability orf prefix-list. */ |
3407 | DEFUN (neighbor_capability_orf_prefix, | |
3408 | neighbor_capability_orf_prefix_cmd, | |
3409 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3410 | NEIGHBOR_STR | |
3411 | NEIGHBOR_ADDR_STR2 | |
3412 | "Advertise capability to the peer\n" | |
3413 | "Advertise ORF capability to the peer\n" | |
3414 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3415 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3416 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3417 | "Capability to SEND the ORF to this neighbor\n") | |
3418 | { | |
3419 | u_int16_t flag = 0; | |
3420 | ||
3421 | if (strncmp (argv[1], "s", 1) == 0) | |
3422 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3423 | else if (strncmp (argv[1], "r", 1) == 0) | |
3424 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3425 | else if (strncmp (argv[1], "b", 1) == 0) | |
3426 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3427 | else | |
3428 | return CMD_WARNING; | |
3429 | ||
3430 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3431 | bgp_node_safi (vty), flag); | |
3432 | } | |
3433 | ||
3434 | DEFUN (no_neighbor_capability_orf_prefix, | |
3435 | no_neighbor_capability_orf_prefix_cmd, | |
3436 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3437 | NO_STR | |
3438 | NEIGHBOR_STR | |
3439 | NEIGHBOR_ADDR_STR2 | |
3440 | "Advertise capability to the peer\n" | |
3441 | "Advertise ORF capability to the peer\n" | |
3442 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3443 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3444 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3445 | "Capability to SEND the ORF to this neighbor\n") | |
3446 | { | |
3447 | u_int16_t flag = 0; | |
3448 | ||
3449 | if (strncmp (argv[1], "s", 1) == 0) | |
3450 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3451 | else if (strncmp (argv[1], "r", 1) == 0) | |
3452 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3453 | else if (strncmp (argv[1], "b", 1) == 0) | |
3454 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3455 | else | |
3456 | return CMD_WARNING; | |
3457 | ||
3458 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3459 | bgp_node_safi (vty), flag); | |
3460 | } | |
6b0655a2 | 3461 | |
718e3744 | 3462 | /* neighbor next-hop-self. */ |
3463 | DEFUN (neighbor_nexthop_self, | |
3464 | neighbor_nexthop_self_cmd, | |
a538debe | 3465 | NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3466 | NEIGHBOR_STR |
3467 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3468 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3469 | { |
a538debe DS |
3470 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3471 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); | |
3472 | } | |
9e7a53c1 | 3473 | |
a538debe DS |
3474 | /* neighbor next-hop-self. */ |
3475 | DEFUN (neighbor_nexthop_self_force, | |
3476 | neighbor_nexthop_self_force_cmd, | |
3477 | NEIGHBOR_CMD2 "next-hop-self force", | |
3478 | NEIGHBOR_STR | |
3479 | NEIGHBOR_ADDR_STR2 | |
3480 | "Disable the next hop calculation for this neighbor\n" | |
3481 | "Set the next hop to self for reflected routes\n") | |
3482 | { | |
3483 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3484 | bgp_node_safi (vty), | |
88b8ed8d | 3485 | PEER_FLAG_FORCE_NEXTHOP_SELF); |
718e3744 | 3486 | } |
3487 | ||
3488 | DEFUN (no_neighbor_nexthop_self, | |
3489 | no_neighbor_nexthop_self_cmd, | |
a538debe | 3490 | NO_NEIGHBOR_CMD2 "next-hop-self", |
718e3744 | 3491 | NO_STR |
3492 | NEIGHBOR_STR | |
3493 | NEIGHBOR_ADDR_STR2 | |
a538debe | 3494 | "Disable the next hop calculation for this neighbor\n") |
718e3744 | 3495 | { |
3496 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
9e7a53c1 | 3497 | bgp_node_safi (vty), |
88b8ed8d | 3498 | PEER_FLAG_NEXTHOP_SELF); |
718e3744 | 3499 | } |
6b0655a2 | 3500 | |
88b8ed8d | 3501 | DEFUN (no_neighbor_nexthop_self_force, |
a538debe DS |
3502 | no_neighbor_nexthop_self_force_cmd, |
3503 | NO_NEIGHBOR_CMD2 "next-hop-self force", | |
3504 | NO_STR | |
3505 | NEIGHBOR_STR | |
3506 | NEIGHBOR_ADDR_STR2 | |
3507 | "Disable the next hop calculation for this neighbor\n" | |
3508 | "Set the next hop to self for reflected routes\n") | |
88b8ed8d DW |
3509 | { |
3510 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3511 | bgp_node_safi (vty), | |
3512 | PEER_FLAG_FORCE_NEXTHOP_SELF); | |
3513 | } | |
a538debe | 3514 | |
c7122e14 DS |
3515 | /* neighbor as-override */ |
3516 | DEFUN (neighbor_as_override, | |
3517 | neighbor_as_override_cmd, | |
3518 | NEIGHBOR_CMD2 "as-override", | |
3519 | NEIGHBOR_STR | |
3520 | NEIGHBOR_ADDR_STR2 | |
3521 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3522 | { | |
3523 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3524 | bgp_node_safi (vty), | |
3525 | PEER_FLAG_AS_OVERRIDE); | |
3526 | } | |
3527 | ||
3528 | DEFUN (no_neighbor_as_override, | |
3529 | no_neighbor_as_override_cmd, | |
3530 | NO_NEIGHBOR_CMD2 "as-override", | |
3531 | NO_STR | |
3532 | NEIGHBOR_STR | |
3533 | NEIGHBOR_ADDR_STR2 | |
3534 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3535 | { | |
3536 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3537 | bgp_node_safi (vty), | |
3538 | PEER_FLAG_AS_OVERRIDE); | |
3539 | } | |
3540 | ||
718e3744 | 3541 | /* neighbor remove-private-AS. */ |
3542 | DEFUN (neighbor_remove_private_as, | |
3543 | neighbor_remove_private_as_cmd, | |
3544 | NEIGHBOR_CMD2 "remove-private-AS", | |
3545 | NEIGHBOR_STR | |
3546 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3547 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3548 | { |
3549 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3550 | bgp_node_safi (vty), | |
3551 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
3552 | } | |
3553 | ||
5000f21c DS |
3554 | DEFUN (neighbor_remove_private_as_all, |
3555 | neighbor_remove_private_as_all_cmd, | |
3556 | NEIGHBOR_CMD2 "remove-private-AS all", | |
3557 | NEIGHBOR_STR | |
3558 | NEIGHBOR_ADDR_STR2 | |
3559 | "Remove private ASNs in outbound updates\n" | |
3560 | "Apply to all AS numbers") | |
3561 | { | |
5000f21c DS |
3562 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3563 | bgp_node_safi (vty), | |
5000f21c DS |
3564 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); |
3565 | } | |
3566 | ||
3567 | DEFUN (neighbor_remove_private_as_replace_as, | |
3568 | neighbor_remove_private_as_replace_as_cmd, | |
3569 | NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3570 | NEIGHBOR_STR | |
3571 | NEIGHBOR_ADDR_STR2 | |
3572 | "Remove private ASNs in outbound updates\n" | |
3573 | "Replace private ASNs with our ASN in outbound updates\n") | |
3574 | { | |
5000f21c DS |
3575 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3576 | bgp_node_safi (vty), | |
5000f21c DS |
3577 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); |
3578 | } | |
3579 | ||
3580 | DEFUN (neighbor_remove_private_as_all_replace_as, | |
3581 | neighbor_remove_private_as_all_replace_as_cmd, | |
3582 | NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3583 | NEIGHBOR_STR | |
3584 | NEIGHBOR_ADDR_STR2 | |
3585 | "Remove private ASNs in outbound updates\n" | |
3586 | "Apply to all AS numbers" | |
3587 | "Replace private ASNs with our ASN in outbound updates\n") | |
3588 | { | |
3589 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3590 | bgp_node_safi (vty), | |
88b8ed8d | 3591 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); |
5000f21c DS |
3592 | } |
3593 | ||
718e3744 | 3594 | DEFUN (no_neighbor_remove_private_as, |
3595 | no_neighbor_remove_private_as_cmd, | |
3596 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
3597 | NO_STR | |
3598 | NEIGHBOR_STR | |
3599 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3600 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3601 | { |
3602 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3603 | bgp_node_safi (vty), | |
88b8ed8d | 3604 | PEER_FLAG_REMOVE_PRIVATE_AS); |
718e3744 | 3605 | } |
6b0655a2 | 3606 | |
88b8ed8d | 3607 | DEFUN (no_neighbor_remove_private_as_all, |
5000f21c DS |
3608 | no_neighbor_remove_private_as_all_cmd, |
3609 | NO_NEIGHBOR_CMD2 "remove-private-AS all", | |
3610 | NO_STR | |
3611 | NEIGHBOR_STR | |
3612 | NEIGHBOR_ADDR_STR2 | |
3613 | "Remove private ASNs in outbound updates\n" | |
3614 | "Apply to all AS numbers") | |
88b8ed8d DW |
3615 | { |
3616 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3617 | bgp_node_safi (vty), | |
3618 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3619 | } | |
5000f21c | 3620 | |
88b8ed8d | 3621 | DEFUN (no_neighbor_remove_private_as_replace_as, |
5000f21c DS |
3622 | no_neighbor_remove_private_as_replace_as_cmd, |
3623 | NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3624 | NO_STR | |
3625 | NEIGHBOR_STR | |
3626 | NEIGHBOR_ADDR_STR2 | |
3627 | "Remove private ASNs in outbound updates\n" | |
3628 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d DW |
3629 | { |
3630 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3631 | bgp_node_safi (vty), | |
3632 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3633 | } | |
5000f21c | 3634 | |
88b8ed8d | 3635 | DEFUN (no_neighbor_remove_private_as_all_replace_as, |
5000f21c DS |
3636 | no_neighbor_remove_private_as_all_replace_as_cmd, |
3637 | NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3638 | NO_STR | |
3639 | NEIGHBOR_STR | |
3640 | NEIGHBOR_ADDR_STR2 | |
3641 | "Remove private ASNs in outbound updates\n" | |
3642 | "Apply to all AS numbers" | |
3643 | "Replace private ASNs with our ASN in outbound updates\n") | |
88b8ed8d DW |
3644 | { |
3645 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3646 | bgp_node_safi (vty), | |
3647 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE); | |
3648 | } | |
5000f21c DS |
3649 | |
3650 | ||
718e3744 | 3651 | /* neighbor send-community. */ |
3652 | DEFUN (neighbor_send_community, | |
3653 | neighbor_send_community_cmd, | |
3654 | NEIGHBOR_CMD2 "send-community", | |
3655 | NEIGHBOR_STR | |
3656 | NEIGHBOR_ADDR_STR2 | |
3657 | "Send Community attribute to this neighbor\n") | |
3658 | { | |
3659 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3660 | bgp_node_safi (vty), | |
3661 | PEER_FLAG_SEND_COMMUNITY); | |
3662 | } | |
3663 | ||
3664 | DEFUN (no_neighbor_send_community, | |
3665 | no_neighbor_send_community_cmd, | |
3666 | NO_NEIGHBOR_CMD2 "send-community", | |
3667 | NO_STR | |
3668 | NEIGHBOR_STR | |
3669 | NEIGHBOR_ADDR_STR2 | |
3670 | "Send Community attribute to this neighbor\n") | |
3671 | { | |
3672 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3673 | bgp_node_safi (vty), | |
3674 | PEER_FLAG_SEND_COMMUNITY); | |
3675 | } | |
6b0655a2 | 3676 | |
718e3744 | 3677 | /* neighbor send-community extended. */ |
3678 | DEFUN (neighbor_send_community_type, | |
3679 | neighbor_send_community_type_cmd, | |
3680 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3681 | NEIGHBOR_STR | |
3682 | NEIGHBOR_ADDR_STR2 | |
3683 | "Send Community attribute to this neighbor\n" | |
3684 | "Send Standard and Extended Community attributes\n" | |
3685 | "Send Extended Community attributes\n" | |
3686 | "Send Standard Community attributes\n") | |
3687 | { | |
3688 | if (strncmp (argv[1], "s", 1) == 0) | |
3689 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3690 | bgp_node_safi (vty), | |
3691 | PEER_FLAG_SEND_COMMUNITY); | |
3692 | if (strncmp (argv[1], "e", 1) == 0) | |
3693 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3694 | bgp_node_safi (vty), | |
3695 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3696 | ||
3697 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3698 | bgp_node_safi (vty), | |
3699 | (PEER_FLAG_SEND_COMMUNITY| | |
3700 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3701 | } | |
3702 | ||
3703 | DEFUN (no_neighbor_send_community_type, | |
3704 | no_neighbor_send_community_type_cmd, | |
3705 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3706 | NO_STR | |
3707 | NEIGHBOR_STR | |
3708 | NEIGHBOR_ADDR_STR2 | |
3709 | "Send Community attribute to this neighbor\n" | |
3710 | "Send Standard and Extended Community attributes\n" | |
3711 | "Send Extended Community attributes\n" | |
3712 | "Send Standard Community attributes\n") | |
3713 | { | |
3714 | if (strncmp (argv[1], "s", 1) == 0) | |
3715 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3716 | bgp_node_safi (vty), | |
3717 | PEER_FLAG_SEND_COMMUNITY); | |
3718 | if (strncmp (argv[1], "e", 1) == 0) | |
3719 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3720 | bgp_node_safi (vty), | |
3721 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3722 | ||
3723 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3724 | bgp_node_safi (vty), | |
3725 | (PEER_FLAG_SEND_COMMUNITY | | |
3726 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3727 | } | |
6b0655a2 | 3728 | |
718e3744 | 3729 | /* neighbor soft-reconfig. */ |
3730 | DEFUN (neighbor_soft_reconfiguration, | |
3731 | neighbor_soft_reconfiguration_cmd, | |
3732 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3733 | NEIGHBOR_STR | |
3734 | NEIGHBOR_ADDR_STR2 | |
3735 | "Per neighbor soft reconfiguration\n" | |
3736 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3737 | { | |
3738 | return peer_af_flag_set_vty (vty, argv[0], | |
3739 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3740 | PEER_FLAG_SOFT_RECONFIG); | |
3741 | } | |
3742 | ||
3743 | DEFUN (no_neighbor_soft_reconfiguration, | |
3744 | no_neighbor_soft_reconfiguration_cmd, | |
3745 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3746 | NO_STR | |
3747 | NEIGHBOR_STR | |
3748 | NEIGHBOR_ADDR_STR2 | |
3749 | "Per neighbor soft reconfiguration\n" | |
3750 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3751 | { | |
3752 | return peer_af_flag_unset_vty (vty, argv[0], | |
3753 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3754 | PEER_FLAG_SOFT_RECONFIG); | |
3755 | } | |
6b0655a2 | 3756 | |
718e3744 | 3757 | DEFUN (neighbor_route_reflector_client, |
3758 | neighbor_route_reflector_client_cmd, | |
3759 | NEIGHBOR_CMD2 "route-reflector-client", | |
3760 | NEIGHBOR_STR | |
3761 | NEIGHBOR_ADDR_STR2 | |
3762 | "Configure a neighbor as Route Reflector client\n") | |
3763 | { | |
3764 | struct peer *peer; | |
3765 | ||
3766 | ||
3767 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3768 | if (! peer) | |
3769 | return CMD_WARNING; | |
3770 | ||
3771 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3772 | bgp_node_safi (vty), | |
3773 | PEER_FLAG_REFLECTOR_CLIENT); | |
3774 | } | |
3775 | ||
3776 | DEFUN (no_neighbor_route_reflector_client, | |
3777 | no_neighbor_route_reflector_client_cmd, | |
3778 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
3779 | NO_STR | |
3780 | NEIGHBOR_STR | |
3781 | NEIGHBOR_ADDR_STR2 | |
3782 | "Configure a neighbor as Route Reflector client\n") | |
3783 | { | |
3784 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3785 | bgp_node_safi (vty), | |
3786 | PEER_FLAG_REFLECTOR_CLIENT); | |
3787 | } | |
6b0655a2 | 3788 | |
94f2b392 | 3789 | static int |
fd79ac91 | 3790 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
3791 | int afi, int safi) | |
fee0f4c6 | 3792 | { |
3793 | int ret; | |
3794 | struct bgp *bgp; | |
3795 | struct peer *peer; | |
3796 | struct peer_group *group; | |
1eb8ef25 | 3797 | struct listnode *node, *nnode; |
fee0f4c6 | 3798 | struct bgp_filter *pfilter; |
3799 | struct bgp_filter *gfilter; | |
228da428 | 3800 | int locked_and_added = 0; |
fee0f4c6 | 3801 | |
3802 | bgp = vty->index; | |
3803 | ||
3804 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3805 | if ( ! peer ) | |
3806 | return CMD_WARNING; | |
3807 | ||
3808 | /* If it is already a RS-Client, don't do anything. */ | |
3809 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
3810 | return CMD_SUCCESS; | |
3811 | ||
3812 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 3813 | { |
3814 | peer = peer_lock (peer); /* rsclient peer list reference */ | |
3815 | listnode_add_sort (bgp->rsclient, peer); | |
228da428 | 3816 | locked_and_added = 1; |
200df115 | 3817 | } |
fee0f4c6 | 3818 | |
3819 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3820 | if (ret < 0) | |
228da428 CC |
3821 | { |
3822 | if (locked_and_added) | |
3823 | { | |
3824 | listnode_delete (bgp->rsclient, peer); | |
3825 | peer_unlock (peer); /* rsclient peer list reference */ | |
3826 | } | |
3827 | ||
3828 | return bgp_vty_return (vty, ret); | |
3829 | } | |
fee0f4c6 | 3830 | |
64e580a7 | 3831 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
fee0f4c6 | 3832 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
228da428 CC |
3833 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
3834 | peer->rib[afi][safi]->owner = peer_lock (peer); | |
fee0f4c6 | 3835 | |
3836 | /* Check for existing 'network' and 'redistribute' routes. */ | |
3837 | bgp_check_local_routes_rsclient (peer, afi, safi); | |
3838 | ||
3839 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ | |
3840 | bgp_soft_reconfig_rsclient (peer, afi, safi); | |
3841 | ||
3842 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
3843 | { | |
3844 | group = peer->group; | |
3845 | gfilter = &peer->filter[afi][safi]; | |
3846 | ||
1eb8ef25 | 3847 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 3848 | { |
3849 | pfilter = &peer->filter[afi][safi]; | |
3850 | ||
3851 | /* Members of a non-RS-Client group should not be RS-Clients, as that | |
3852 | is checked when the become part of the peer-group */ | |
3853 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3854 | if (ret < 0) | |
3855 | return bgp_vty_return (vty, ret); | |
3856 | ||
3857 | /* Make peer's RIB point to group's RIB. */ | |
3858 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; | |
3859 | ||
3860 | /* Import policy. */ | |
3861 | if (pfilter->map[RMAP_IMPORT].name) | |
6e919709 | 3862 | XFREE(MTYPE_BGP_FILTER_NAME, pfilter->map[RMAP_IMPORT].name); |
fee0f4c6 | 3863 | if (gfilter->map[RMAP_IMPORT].name) |
3864 | { | |
6e919709 DS |
3865 | pfilter->map[RMAP_IMPORT].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, |
3866 | gfilter->map[RMAP_IMPORT].name); | |
fee0f4c6 | 3867 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; |
3868 | } | |
3869 | else | |
3870 | { | |
3871 | pfilter->map[RMAP_IMPORT].name = NULL; | |
6e919709 | 3872 | pfilter->map[RMAP_IMPORT].map = NULL; |
fee0f4c6 | 3873 | } |
3874 | ||
3875 | /* Export policy. */ | |
3876 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) | |
3877 | { | |
6e919709 DS |
3878 | pfilter->map[RMAP_EXPORT].name = XSTRDUP(MTYPE_BGP_FILTER_NAME, |
3879 | gfilter->map[RMAP_EXPORT].name); | |
fee0f4c6 | 3880 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; |
3881 | } | |
3882 | } | |
3883 | } | |
3884 | return CMD_SUCCESS; | |
3885 | } | |
3886 | ||
94f2b392 | 3887 | static int |
fd79ac91 | 3888 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
3889 | int afi, int safi) | |
fee0f4c6 | 3890 | { |
3891 | int ret; | |
3892 | struct bgp *bgp; | |
3893 | struct peer *peer; | |
3894 | struct peer_group *group; | |
1eb8ef25 | 3895 | struct listnode *node, *nnode; |
fee0f4c6 | 3896 | |
3897 | bgp = vty->index; | |
3898 | ||
3899 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3900 | if ( ! peer ) | |
3901 | return CMD_WARNING; | |
3902 | ||
3903 | /* If it is not a RS-Client, don't do anything. */ | |
3904 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
3905 | return CMD_SUCCESS; | |
3906 | ||
3907 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
3908 | { | |
3909 | group = peer->group; | |
3910 | ||
1eb8ef25 | 3911 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 3912 | { |
3913 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3914 | if (ret < 0) | |
3915 | return bgp_vty_return (vty, ret); | |
3916 | ||
3917 | peer->rib[afi][safi] = NULL; | |
3918 | } | |
3919 | ||
3920 | peer = group->conf; | |
3921 | } | |
3922 | ||
3923 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3924 | if (ret < 0) | |
3925 | return bgp_vty_return (vty, ret); | |
3926 | ||
3927 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 3928 | { |
228da428 | 3929 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
200df115 | 3930 | listnode_delete (bgp->rsclient, peer); |
228da428 | 3931 | peer_unlock (peer); /* peer bgp rsclient reference */ |
200df115 | 3932 | } |
fee0f4c6 | 3933 | |
b608d5b5 | 3934 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
fee0f4c6 | 3935 | |
3936 | return CMD_SUCCESS; | |
3937 | } | |
6b0655a2 | 3938 | |
718e3744 | 3939 | /* neighbor route-server-client. */ |
3940 | DEFUN (neighbor_route_server_client, | |
3941 | neighbor_route_server_client_cmd, | |
3942 | NEIGHBOR_CMD2 "route-server-client", | |
3943 | NEIGHBOR_STR | |
3944 | NEIGHBOR_ADDR_STR2 | |
3945 | "Configure a neighbor as Route Server client\n") | |
3946 | { | |
fee0f4c6 | 3947 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
3948 | bgp_node_safi(vty)); | |
718e3744 | 3949 | } |
3950 | ||
3951 | DEFUN (no_neighbor_route_server_client, | |
3952 | no_neighbor_route_server_client_cmd, | |
3953 | NO_NEIGHBOR_CMD2 "route-server-client", | |
3954 | NO_STR | |
3955 | NEIGHBOR_STR | |
3956 | NEIGHBOR_ADDR_STR2 | |
3957 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 3958 | { |
3959 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), | |
3960 | bgp_node_safi(vty)); | |
3961 | } | |
6b0655a2 | 3962 | |
fee0f4c6 | 3963 | DEFUN (neighbor_nexthop_local_unchanged, |
3964 | neighbor_nexthop_local_unchanged_cmd, | |
3965 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3966 | NEIGHBOR_STR | |
3967 | NEIGHBOR_ADDR_STR2 | |
3968 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
3969 | "Leave link-local nexthop unchanged for this peer\n") | |
3970 | { | |
3971 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3972 | bgp_node_safi (vty), | |
3973 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
3974 | } | |
6b0655a2 | 3975 | |
fee0f4c6 | 3976 | DEFUN (no_neighbor_nexthop_local_unchanged, |
3977 | no_neighbor_nexthop_local_unchanged_cmd, | |
3978 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3979 | NO_STR | |
3980 | NEIGHBOR_STR | |
3981 | NEIGHBOR_ADDR_STR2 | |
3982 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
3983 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 3984 | { |
3985 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3986 | bgp_node_safi (vty), | |
fee0f4c6 | 3987 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 3988 | } |
6b0655a2 | 3989 | |
718e3744 | 3990 | DEFUN (neighbor_attr_unchanged, |
3991 | neighbor_attr_unchanged_cmd, | |
3992 | NEIGHBOR_CMD2 "attribute-unchanged", | |
3993 | NEIGHBOR_STR | |
3994 | NEIGHBOR_ADDR_STR2 | |
3995 | "BGP attribute is propagated unchanged to this neighbor\n") | |
3996 | { | |
3997 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3998 | bgp_node_safi (vty), | |
3999 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4000 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4001 | PEER_FLAG_MED_UNCHANGED)); | |
4002 | } | |
4003 | ||
4004 | DEFUN (neighbor_attr_unchanged1, | |
4005 | neighbor_attr_unchanged1_cmd, | |
4006 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4007 | NEIGHBOR_STR | |
4008 | NEIGHBOR_ADDR_STR2 | |
4009 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4010 | "As-path attribute\n" | |
4011 | "Nexthop attribute\n" | |
4012 | "Med attribute\n") | |
4013 | { | |
4014 | u_int16_t flags = 0; | |
4015 | ||
4016 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4017 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4018 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4019 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4020 | else if (strncmp (argv[1], "med", 1) == 0) | |
4021 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4022 | ||
4023 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4024 | bgp_node_safi (vty), flags); | |
4025 | } | |
4026 | ||
4027 | DEFUN (neighbor_attr_unchanged2, | |
4028 | neighbor_attr_unchanged2_cmd, | |
4029 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4030 | NEIGHBOR_STR | |
4031 | NEIGHBOR_ADDR_STR2 | |
4032 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4033 | "As-path attribute\n" | |
4034 | "Nexthop attribute\n" | |
4035 | "Med attribute\n") | |
4036 | { | |
4037 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4038 | ||
4039 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4040 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4041 | else if (strncmp (argv[1], "med", 1) == 0) | |
4042 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4043 | ||
4044 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4045 | bgp_node_safi (vty), flags); | |
4046 | ||
4047 | } | |
4048 | ||
4049 | DEFUN (neighbor_attr_unchanged3, | |
4050 | neighbor_attr_unchanged3_cmd, | |
4051 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4052 | NEIGHBOR_STR | |
4053 | NEIGHBOR_ADDR_STR2 | |
4054 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4055 | "Nexthop attribute\n" | |
4056 | "As-path attribute\n" | |
4057 | "Med attribute\n") | |
4058 | { | |
4059 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4060 | ||
4061 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4062 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4063 | else if (strncmp (argv[1], "med", 1) == 0) | |
4064 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4065 | ||
4066 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4067 | bgp_node_safi (vty), flags); | |
4068 | } | |
4069 | ||
4070 | DEFUN (neighbor_attr_unchanged4, | |
4071 | neighbor_attr_unchanged4_cmd, | |
4072 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4073 | NEIGHBOR_STR | |
4074 | NEIGHBOR_ADDR_STR2 | |
4075 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4076 | "Med attribute\n" | |
4077 | "As-path attribute\n" | |
4078 | "Nexthop attribute\n") | |
4079 | { | |
4080 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4081 | ||
4082 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4083 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4084 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4085 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4086 | ||
4087 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4088 | bgp_node_safi (vty), flags); | |
4089 | } | |
4090 | ||
4091 | ALIAS (neighbor_attr_unchanged, | |
4092 | neighbor_attr_unchanged5_cmd, | |
4093 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4094 | NEIGHBOR_STR | |
4095 | NEIGHBOR_ADDR_STR2 | |
4096 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4097 | "As-path attribute\n" | |
4098 | "Nexthop attribute\n" | |
4099 | "Med attribute\n") | |
4100 | ||
4101 | ALIAS (neighbor_attr_unchanged, | |
4102 | neighbor_attr_unchanged6_cmd, | |
4103 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4104 | NEIGHBOR_STR | |
4105 | NEIGHBOR_ADDR_STR2 | |
4106 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4107 | "As-path attribute\n" | |
4108 | "Med attribute\n" | |
4109 | "Nexthop attribute\n") | |
4110 | ||
4111 | ALIAS (neighbor_attr_unchanged, | |
4112 | neighbor_attr_unchanged7_cmd, | |
4113 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4114 | NEIGHBOR_STR | |
4115 | NEIGHBOR_ADDR_STR2 | |
4116 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4117 | "Nexthop attribute\n" | |
4118 | "Med attribute\n" | |
4119 | "As-path attribute\n") | |
4120 | ||
4121 | ALIAS (neighbor_attr_unchanged, | |
4122 | neighbor_attr_unchanged8_cmd, | |
4123 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4124 | NEIGHBOR_STR | |
4125 | NEIGHBOR_ADDR_STR2 | |
4126 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4127 | "Nexthop attribute\n" | |
4128 | "As-path attribute\n" | |
4129 | "Med attribute\n") | |
4130 | ||
4131 | ALIAS (neighbor_attr_unchanged, | |
4132 | neighbor_attr_unchanged9_cmd, | |
4133 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4134 | NEIGHBOR_STR | |
4135 | NEIGHBOR_ADDR_STR2 | |
4136 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4137 | "Med attribute\n" | |
4138 | "Nexthop attribute\n" | |
4139 | "As-path attribute\n") | |
4140 | ||
4141 | ALIAS (neighbor_attr_unchanged, | |
4142 | neighbor_attr_unchanged10_cmd, | |
4143 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4144 | NEIGHBOR_STR | |
4145 | NEIGHBOR_ADDR_STR2 | |
4146 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4147 | "Med attribute\n" | |
4148 | "As-path attribute\n" | |
4149 | "Nexthop attribute\n") | |
4150 | ||
4151 | DEFUN (no_neighbor_attr_unchanged, | |
4152 | no_neighbor_attr_unchanged_cmd, | |
4153 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
4154 | NO_STR | |
4155 | NEIGHBOR_STR | |
4156 | NEIGHBOR_ADDR_STR2 | |
4157 | "BGP attribute is propagated unchanged to this neighbor\n") | |
4158 | { | |
4159 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4160 | bgp_node_safi (vty), | |
4161 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
4162 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4163 | PEER_FLAG_MED_UNCHANGED)); | |
4164 | } | |
4165 | ||
4166 | DEFUN (no_neighbor_attr_unchanged1, | |
4167 | no_neighbor_attr_unchanged1_cmd, | |
4168 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4169 | NO_STR | |
4170 | NEIGHBOR_STR | |
4171 | NEIGHBOR_ADDR_STR2 | |
4172 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4173 | "As-path attribute\n" | |
4174 | "Nexthop attribute\n" | |
4175 | "Med attribute\n") | |
4176 | { | |
4177 | u_int16_t flags = 0; | |
4178 | ||
4179 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4180 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4181 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4182 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4183 | else if (strncmp (argv[1], "med", 1) == 0) | |
4184 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4185 | ||
4186 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4187 | bgp_node_safi (vty), flags); | |
4188 | } | |
4189 | ||
4190 | DEFUN (no_neighbor_attr_unchanged2, | |
4191 | no_neighbor_attr_unchanged2_cmd, | |
4192 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4193 | NO_STR | |
4194 | NEIGHBOR_STR | |
4195 | NEIGHBOR_ADDR_STR2 | |
4196 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4197 | "As-path attribute\n" | |
4198 | "Nexthop attribute\n" | |
4199 | "Med attribute\n") | |
4200 | { | |
4201 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4202 | ||
4203 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4204 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4205 | else if (strncmp (argv[1], "med", 1) == 0) | |
4206 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4207 | ||
4208 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4209 | bgp_node_safi (vty), flags); | |
4210 | } | |
4211 | ||
4212 | DEFUN (no_neighbor_attr_unchanged3, | |
4213 | no_neighbor_attr_unchanged3_cmd, | |
4214 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4215 | NO_STR | |
4216 | NEIGHBOR_STR | |
4217 | NEIGHBOR_ADDR_STR2 | |
4218 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4219 | "Nexthop attribute\n" | |
4220 | "As-path attribute\n" | |
4221 | "Med attribute\n") | |
4222 | { | |
4223 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4224 | ||
4225 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4226 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4227 | else if (strncmp (argv[1], "med", 1) == 0) | |
4228 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4229 | ||
4230 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4231 | bgp_node_safi (vty), flags); | |
4232 | } | |
4233 | ||
4234 | DEFUN (no_neighbor_attr_unchanged4, | |
4235 | no_neighbor_attr_unchanged4_cmd, | |
4236 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4237 | NO_STR | |
4238 | NEIGHBOR_STR | |
4239 | NEIGHBOR_ADDR_STR2 | |
4240 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4241 | "Med attribute\n" | |
4242 | "As-path attribute\n" | |
4243 | "Nexthop attribute\n") | |
4244 | { | |
4245 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4246 | ||
4247 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4248 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4249 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4250 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4251 | ||
4252 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4253 | bgp_node_safi (vty), flags); | |
4254 | } | |
4255 | ||
4256 | ALIAS (no_neighbor_attr_unchanged, | |
4257 | no_neighbor_attr_unchanged5_cmd, | |
4258 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4259 | NO_STR | |
4260 | NEIGHBOR_STR | |
4261 | NEIGHBOR_ADDR_STR2 | |
4262 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4263 | "As-path attribute\n" | |
4264 | "Nexthop attribute\n" | |
4265 | "Med attribute\n") | |
4266 | ||
4267 | ALIAS (no_neighbor_attr_unchanged, | |
4268 | no_neighbor_attr_unchanged6_cmd, | |
4269 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4270 | NO_STR | |
4271 | NEIGHBOR_STR | |
4272 | NEIGHBOR_ADDR_STR2 | |
4273 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4274 | "As-path attribute\n" | |
4275 | "Med attribute\n" | |
4276 | "Nexthop attribute\n") | |
4277 | ||
4278 | ALIAS (no_neighbor_attr_unchanged, | |
4279 | no_neighbor_attr_unchanged7_cmd, | |
4280 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4281 | NO_STR | |
4282 | NEIGHBOR_STR | |
4283 | NEIGHBOR_ADDR_STR2 | |
4284 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4285 | "Nexthop attribute\n" | |
4286 | "Med attribute\n" | |
4287 | "As-path attribute\n") | |
4288 | ||
4289 | ALIAS (no_neighbor_attr_unchanged, | |
4290 | no_neighbor_attr_unchanged8_cmd, | |
4291 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4292 | NO_STR | |
4293 | NEIGHBOR_STR | |
4294 | NEIGHBOR_ADDR_STR2 | |
4295 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4296 | "Nexthop attribute\n" | |
4297 | "As-path attribute\n" | |
4298 | "Med attribute\n") | |
4299 | ||
4300 | ALIAS (no_neighbor_attr_unchanged, | |
4301 | no_neighbor_attr_unchanged9_cmd, | |
4302 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4303 | NO_STR | |
4304 | NEIGHBOR_STR | |
4305 | NEIGHBOR_ADDR_STR2 | |
4306 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4307 | "Med attribute\n" | |
4308 | "Nexthop attribute\n" | |
4309 | "As-path attribute\n") | |
4310 | ||
4311 | ALIAS (no_neighbor_attr_unchanged, | |
4312 | no_neighbor_attr_unchanged10_cmd, | |
4313 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4314 | NO_STR | |
4315 | NEIGHBOR_STR | |
4316 | NEIGHBOR_ADDR_STR2 | |
4317 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4318 | "Med attribute\n" | |
4319 | "As-path attribute\n" | |
4320 | "Nexthop attribute\n") | |
4321 | ||
4322 | /* For old version Zebra compatibility. */ | |
dd4c593f | 4323 | DEFUN_DEPRECATED (neighbor_transparent_as, |
4324 | neighbor_transparent_as_cmd, | |
4325 | NEIGHBOR_CMD "transparent-as", | |
4326 | NEIGHBOR_STR | |
4327 | NEIGHBOR_ADDR_STR | |
4328 | "Do not append my AS number even peer is EBGP peer\n") | |
718e3744 | 4329 | { |
4330 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4331 | bgp_node_safi (vty), | |
4332 | PEER_FLAG_AS_PATH_UNCHANGED); | |
4333 | } | |
4334 | ||
dd4c593f | 4335 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
4336 | neighbor_transparent_nexthop_cmd, | |
4337 | NEIGHBOR_CMD "transparent-nexthop", | |
4338 | NEIGHBOR_STR | |
4339 | NEIGHBOR_ADDR_STR | |
4340 | "Do not change nexthop even peer is EBGP peer\n") | |
718e3744 | 4341 | { |
4342 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4343 | bgp_node_safi (vty), | |
4344 | PEER_FLAG_NEXTHOP_UNCHANGED); | |
4345 | } | |
6b0655a2 | 4346 | |
718e3744 | 4347 | /* EBGP multihop configuration. */ |
94f2b392 | 4348 | static int |
fd79ac91 | 4349 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
4350 | const char *ttl_str) | |
718e3744 | 4351 | { |
4352 | struct peer *peer; | |
fd79ac91 | 4353 | unsigned int ttl; |
718e3744 | 4354 | |
4355 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4356 | if (! peer) | |
4357 | return CMD_WARNING; | |
4358 | ||
4359 | if (! ttl_str) | |
4360 | ttl = TTL_MAX; | |
4361 | else | |
4362 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); | |
4363 | ||
89b6d1f8 | 4364 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 4365 | } |
4366 | ||
94f2b392 | 4367 | static int |
fd79ac91 | 4368 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4369 | { |
4370 | struct peer *peer; | |
4371 | ||
4372 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4373 | if (! peer) | |
4374 | return CMD_WARNING; | |
4375 | ||
89b6d1f8 | 4376 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 4377 | } |
4378 | ||
4379 | /* neighbor ebgp-multihop. */ | |
4380 | DEFUN (neighbor_ebgp_multihop, | |
4381 | neighbor_ebgp_multihop_cmd, | |
4382 | NEIGHBOR_CMD2 "ebgp-multihop", | |
4383 | NEIGHBOR_STR | |
4384 | NEIGHBOR_ADDR_STR2 | |
4385 | "Allow EBGP neighbors not on directly connected networks\n") | |
4386 | { | |
4387 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
4388 | } | |
4389 | ||
4390 | DEFUN (neighbor_ebgp_multihop_ttl, | |
4391 | neighbor_ebgp_multihop_ttl_cmd, | |
4392 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
4393 | NEIGHBOR_STR | |
4394 | NEIGHBOR_ADDR_STR2 | |
4395 | "Allow EBGP neighbors not on directly connected networks\n" | |
4396 | "maximum hop count\n") | |
4397 | { | |
4398 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
4399 | } | |
4400 | ||
4401 | DEFUN (no_neighbor_ebgp_multihop, | |
4402 | no_neighbor_ebgp_multihop_cmd, | |
4403 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
4404 | NO_STR | |
4405 | NEIGHBOR_STR | |
4406 | NEIGHBOR_ADDR_STR2 | |
4407 | "Allow EBGP neighbors not on directly connected networks\n") | |
4408 | { | |
4409 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
4410 | } | |
4411 | ||
4412 | ALIAS (no_neighbor_ebgp_multihop, | |
4413 | no_neighbor_ebgp_multihop_ttl_cmd, | |
4414 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
4415 | NO_STR | |
4416 | NEIGHBOR_STR | |
4417 | NEIGHBOR_ADDR_STR2 | |
4418 | "Allow EBGP neighbors not on directly connected networks\n" | |
4419 | "maximum hop count\n") | |
6b0655a2 | 4420 | |
6ffd2079 | 4421 | /* disable-connected-check */ |
4422 | DEFUN (neighbor_disable_connected_check, | |
4423 | neighbor_disable_connected_check_cmd, | |
4424 | NEIGHBOR_CMD2 "disable-connected-check", | |
4425 | NEIGHBOR_STR | |
4426 | NEIGHBOR_ADDR_STR2 | |
4427 | "one-hop away EBGP peer using loopback address\n") | |
4428 | { | |
4429 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4430 | } | |
4431 | ||
4432 | DEFUN (no_neighbor_disable_connected_check, | |
4433 | no_neighbor_disable_connected_check_cmd, | |
4434 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
4435 | NO_STR | |
4436 | NEIGHBOR_STR | |
4437 | NEIGHBOR_ADDR_STR2 | |
4438 | "one-hop away EBGP peer using loopback address\n") | |
4439 | { | |
4440 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4441 | } | |
4442 | ||
718e3744 | 4443 | /* Enforce multihop. */ |
6ffd2079 | 4444 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 4445 | neighbor_enforce_multihop_cmd, |
4446 | NEIGHBOR_CMD2 "enforce-multihop", | |
4447 | NEIGHBOR_STR | |
4448 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4449 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 4450 | |
6ffd2079 | 4451 | /* Enforce multihop. */ |
4452 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 4453 | no_neighbor_enforce_multihop_cmd, |
4454 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
4455 | NO_STR | |
4456 | NEIGHBOR_STR | |
4457 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4458 | "Enforce EBGP neighbors perform multihop\n") |
6b0655a2 | 4459 | |
718e3744 | 4460 | DEFUN (neighbor_description, |
4461 | neighbor_description_cmd, | |
4462 | NEIGHBOR_CMD2 "description .LINE", | |
4463 | NEIGHBOR_STR | |
4464 | NEIGHBOR_ADDR_STR2 | |
4465 | "Neighbor specific description\n" | |
4466 | "Up to 80 characters describing this neighbor\n") | |
4467 | { | |
4468 | struct peer *peer; | |
718e3744 | 4469 | char *str; |
718e3744 | 4470 | |
4471 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4472 | if (! peer) | |
4473 | return CMD_WARNING; | |
4474 | ||
4475 | if (argc == 1) | |
4476 | return CMD_SUCCESS; | |
4477 | ||
3b8b1855 | 4478 | str = argv_concat(argv, argc, 1); |
718e3744 | 4479 | |
4480 | peer_description_set (peer, str); | |
4481 | ||
3b8b1855 | 4482 | XFREE (MTYPE_TMP, str); |
718e3744 | 4483 | |
4484 | return CMD_SUCCESS; | |
4485 | } | |
4486 | ||
4487 | DEFUN (no_neighbor_description, | |
4488 | no_neighbor_description_cmd, | |
4489 | NO_NEIGHBOR_CMD2 "description", | |
4490 | NO_STR | |
4491 | NEIGHBOR_STR | |
4492 | NEIGHBOR_ADDR_STR2 | |
4493 | "Neighbor specific description\n") | |
4494 | { | |
4495 | struct peer *peer; | |
4496 | ||
4497 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4498 | if (! peer) | |
4499 | return CMD_WARNING; | |
4500 | ||
4501 | peer_description_unset (peer); | |
4502 | ||
4503 | return CMD_SUCCESS; | |
4504 | } | |
4505 | ||
4506 | ALIAS (no_neighbor_description, | |
4507 | no_neighbor_description_val_cmd, | |
4508 | NO_NEIGHBOR_CMD2 "description .LINE", | |
4509 | NO_STR | |
4510 | NEIGHBOR_STR | |
4511 | NEIGHBOR_ADDR_STR2 | |
4512 | "Neighbor specific description\n" | |
4513 | "Up to 80 characters describing this neighbor\n") | |
6b0655a2 | 4514 | |
718e3744 | 4515 | /* Neighbor update-source. */ |
94f2b392 | 4516 | static int |
fd79ac91 | 4517 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
4518 | const char *source_str) | |
718e3744 | 4519 | { |
4520 | struct peer *peer; | |
718e3744 | 4521 | |
4522 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4523 | if (! peer) | |
4524 | return CMD_WARNING; | |
4525 | ||
a80beece DS |
4526 | if (peer->conf_if) |
4527 | return CMD_WARNING; | |
4528 | ||
718e3744 | 4529 | if (source_str) |
4530 | { | |
c63b83fe JBD |
4531 | union sockunion su; |
4532 | int ret = str2sockunion (source_str, &su); | |
4533 | ||
4534 | if (ret == 0) | |
4535 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 4536 | else |
4537 | peer_update_source_if_set (peer, source_str); | |
4538 | } | |
4539 | else | |
4540 | peer_update_source_unset (peer); | |
4541 | ||
4542 | return CMD_SUCCESS; | |
4543 | } | |
4544 | ||
dcb52bd5 DS |
4545 | #define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD" |
4546 | #define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")" | |
4547 | #define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}" | |
369688c0 PJ |
4548 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
4549 | "IPv4 address\n" \ | |
9a1a331d PJ |
4550 | "IPv6 address\n" \ |
4551 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 4552 | |
718e3744 | 4553 | DEFUN (neighbor_update_source, |
4554 | neighbor_update_source_cmd, | |
dcb52bd5 | 4555 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_REQ_STR, |
718e3744 | 4556 | NEIGHBOR_STR |
4557 | NEIGHBOR_ADDR_STR2 | |
4558 | "Source of routing updates\n" | |
369688c0 | 4559 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 4560 | { |
4561 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
4562 | } | |
4563 | ||
4564 | DEFUN (no_neighbor_update_source, | |
4565 | no_neighbor_update_source_cmd, | |
dcb52bd5 | 4566 | NO_NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_OPT_STR, |
718e3744 | 4567 | NO_STR |
4568 | NEIGHBOR_STR | |
4569 | NEIGHBOR_ADDR_STR2 | |
dcb52bd5 DS |
4570 | "Source of routing updates\n" |
4571 | BGP_UPDATE_SOURCE_HELP_STR) | |
718e3744 | 4572 | { |
4573 | return peer_update_source_vty (vty, argv[0], NULL); | |
4574 | } | |
6b0655a2 | 4575 | |
94f2b392 | 4576 | static int |
fd79ac91 | 4577 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
4578 | afi_t afi, safi_t safi, | |
4579 | const char *rmap, int set) | |
718e3744 | 4580 | { |
4581 | int ret; | |
4582 | struct peer *peer; | |
4583 | ||
4584 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4585 | if (! peer) | |
4586 | return CMD_WARNING; | |
4587 | ||
4588 | if (set) | |
4589 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
4590 | else | |
4591 | ret = peer_default_originate_unset (peer, afi, safi); | |
4592 | ||
4593 | return bgp_vty_return (vty, ret); | |
4594 | } | |
4595 | ||
4596 | /* neighbor default-originate. */ | |
4597 | DEFUN (neighbor_default_originate, | |
4598 | neighbor_default_originate_cmd, | |
4599 | NEIGHBOR_CMD2 "default-originate", | |
4600 | NEIGHBOR_STR | |
4601 | NEIGHBOR_ADDR_STR2 | |
4602 | "Originate default route to this neighbor\n") | |
4603 | { | |
4604 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4605 | bgp_node_safi (vty), NULL, 1); | |
4606 | } | |
4607 | ||
4608 | DEFUN (neighbor_default_originate_rmap, | |
4609 | neighbor_default_originate_rmap_cmd, | |
4610 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4611 | NEIGHBOR_STR | |
4612 | NEIGHBOR_ADDR_STR2 | |
4613 | "Originate default route to this neighbor\n" | |
4614 | "Route-map to specify criteria to originate default\n" | |
4615 | "route-map name\n") | |
4616 | { | |
4617 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4618 | bgp_node_safi (vty), argv[1], 1); | |
4619 | } | |
4620 | ||
4621 | DEFUN (no_neighbor_default_originate, | |
4622 | no_neighbor_default_originate_cmd, | |
4623 | NO_NEIGHBOR_CMD2 "default-originate", | |
4624 | NO_STR | |
4625 | NEIGHBOR_STR | |
4626 | NEIGHBOR_ADDR_STR2 | |
4627 | "Originate default route to this neighbor\n") | |
4628 | { | |
4629 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4630 | bgp_node_safi (vty), NULL, 0); | |
4631 | } | |
4632 | ||
4633 | ALIAS (no_neighbor_default_originate, | |
4634 | no_neighbor_default_originate_rmap_cmd, | |
4635 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4636 | NO_STR | |
4637 | NEIGHBOR_STR | |
4638 | NEIGHBOR_ADDR_STR2 | |
4639 | "Originate default route to this neighbor\n" | |
4640 | "Route-map to specify criteria to originate default\n" | |
4641 | "route-map name\n") | |
6b0655a2 | 4642 | |
718e3744 | 4643 | /* Set neighbor's BGP port. */ |
94f2b392 | 4644 | static int |
fd79ac91 | 4645 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
4646 | const char *port_str) | |
718e3744 | 4647 | { |
4648 | struct peer *peer; | |
4649 | u_int16_t port; | |
4650 | struct servent *sp; | |
4651 | ||
4652 | peer = peer_lookup_vty (vty, ip_str); | |
4653 | if (! peer) | |
4654 | return CMD_WARNING; | |
4655 | ||
4656 | if (! port_str) | |
4657 | { | |
4658 | sp = getservbyname ("bgp", "tcp"); | |
4659 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
4660 | } | |
4661 | else | |
4662 | { | |
4663 | VTY_GET_INTEGER("port", port, port_str); | |
4664 | } | |
4665 | ||
4666 | peer_port_set (peer, port); | |
4667 | ||
4668 | return CMD_SUCCESS; | |
4669 | } | |
4670 | ||
f418446b | 4671 | /* Set specified peer's BGP port. */ |
718e3744 | 4672 | DEFUN (neighbor_port, |
4673 | neighbor_port_cmd, | |
4674 | NEIGHBOR_CMD "port <0-65535>", | |
4675 | NEIGHBOR_STR | |
4676 | NEIGHBOR_ADDR_STR | |
4677 | "Neighbor's BGP port\n" | |
4678 | "TCP port number\n") | |
4679 | { | |
4680 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
4681 | } | |
4682 | ||
4683 | DEFUN (no_neighbor_port, | |
4684 | no_neighbor_port_cmd, | |
4685 | NO_NEIGHBOR_CMD "port", | |
4686 | NO_STR | |
4687 | NEIGHBOR_STR | |
4688 | NEIGHBOR_ADDR_STR | |
4689 | "Neighbor's BGP port\n") | |
4690 | { | |
4691 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
4692 | } | |
4693 | ||
4694 | ALIAS (no_neighbor_port, | |
4695 | no_neighbor_port_val_cmd, | |
4696 | NO_NEIGHBOR_CMD "port <0-65535>", | |
4697 | NO_STR | |
4698 | NEIGHBOR_STR | |
4699 | NEIGHBOR_ADDR_STR | |
4700 | "Neighbor's BGP port\n" | |
4701 | "TCP port number\n") | |
6b0655a2 | 4702 | |
718e3744 | 4703 | /* neighbor weight. */ |
94f2b392 | 4704 | static int |
fd79ac91 | 4705 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
4706 | const char *weight_str) | |
718e3744 | 4707 | { |
718e3744 | 4708 | struct peer *peer; |
4709 | unsigned long weight; | |
4710 | ||
4711 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4712 | if (! peer) | |
4713 | return CMD_WARNING; | |
4714 | ||
4715 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
4716 | ||
ffd0c037 | 4717 | peer_weight_set (peer, weight); |
718e3744 | 4718 | |
4719 | return CMD_SUCCESS; | |
4720 | } | |
4721 | ||
94f2b392 | 4722 | static int |
fd79ac91 | 4723 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4724 | { |
4725 | struct peer *peer; | |
4726 | ||
4727 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4728 | if (! peer) | |
4729 | return CMD_WARNING; | |
4730 | ||
4731 | peer_weight_unset (peer); | |
4732 | ||
4733 | return CMD_SUCCESS; | |
4734 | } | |
4735 | ||
4736 | DEFUN (neighbor_weight, | |
4737 | neighbor_weight_cmd, | |
4738 | NEIGHBOR_CMD2 "weight <0-65535>", | |
4739 | NEIGHBOR_STR | |
4740 | NEIGHBOR_ADDR_STR2 | |
4741 | "Set default weight for routes from this neighbor\n" | |
4742 | "default weight\n") | |
4743 | { | |
4744 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
4745 | } | |
4746 | ||
4747 | DEFUN (no_neighbor_weight, | |
4748 | no_neighbor_weight_cmd, | |
4749 | NO_NEIGHBOR_CMD2 "weight", | |
4750 | NO_STR | |
4751 | NEIGHBOR_STR | |
4752 | NEIGHBOR_ADDR_STR2 | |
4753 | "Set default weight for routes from this neighbor\n") | |
4754 | { | |
4755 | return peer_weight_unset_vty (vty, argv[0]); | |
4756 | } | |
4757 | ||
4758 | ALIAS (no_neighbor_weight, | |
4759 | no_neighbor_weight_val_cmd, | |
4760 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
4761 | NO_STR | |
4762 | NEIGHBOR_STR | |
4763 | NEIGHBOR_ADDR_STR2 | |
4764 | "Set default weight for routes from this neighbor\n" | |
4765 | "default weight\n") | |
6b0655a2 | 4766 | |
718e3744 | 4767 | /* Override capability negotiation. */ |
4768 | DEFUN (neighbor_override_capability, | |
4769 | neighbor_override_capability_cmd, | |
4770 | NEIGHBOR_CMD2 "override-capability", | |
4771 | NEIGHBOR_STR | |
4772 | NEIGHBOR_ADDR_STR2 | |
4773 | "Override capability negotiation result\n") | |
4774 | { | |
4775 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4776 | } | |
4777 | ||
4778 | DEFUN (no_neighbor_override_capability, | |
4779 | no_neighbor_override_capability_cmd, | |
4780 | NO_NEIGHBOR_CMD2 "override-capability", | |
4781 | NO_STR | |
4782 | NEIGHBOR_STR | |
4783 | NEIGHBOR_ADDR_STR2 | |
4784 | "Override capability negotiation result\n") | |
4785 | { | |
4786 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4787 | } | |
6b0655a2 | 4788 | |
718e3744 | 4789 | DEFUN (neighbor_strict_capability, |
4790 | neighbor_strict_capability_cmd, | |
4791 | NEIGHBOR_CMD "strict-capability-match", | |
4792 | NEIGHBOR_STR | |
4793 | NEIGHBOR_ADDR_STR | |
4794 | "Strict capability negotiation match\n") | |
4795 | { | |
4796 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4797 | } | |
4798 | ||
4799 | DEFUN (no_neighbor_strict_capability, | |
4800 | no_neighbor_strict_capability_cmd, | |
4801 | NO_NEIGHBOR_CMD "strict-capability-match", | |
4802 | NO_STR | |
4803 | NEIGHBOR_STR | |
4804 | NEIGHBOR_ADDR_STR | |
4805 | "Strict capability negotiation match\n") | |
4806 | { | |
4807 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4808 | } | |
6b0655a2 | 4809 | |
94f2b392 | 4810 | static int |
fd79ac91 | 4811 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
4812 | const char *keep_str, const char *hold_str) | |
718e3744 | 4813 | { |
4814 | int ret; | |
4815 | struct peer *peer; | |
4816 | u_int32_t keepalive; | |
4817 | u_int32_t holdtime; | |
4818 | ||
4819 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4820 | if (! peer) | |
4821 | return CMD_WARNING; | |
4822 | ||
4823 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
4824 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
4825 | ||
4826 | ret = peer_timers_set (peer, keepalive, holdtime); | |
4827 | ||
4828 | return bgp_vty_return (vty, ret); | |
4829 | } | |
6b0655a2 | 4830 | |
94f2b392 | 4831 | static int |
fd79ac91 | 4832 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4833 | { |
4834 | int ret; | |
4835 | struct peer *peer; | |
4836 | ||
4837 | peer = peer_lookup_vty (vty, ip_str); | |
4838 | if (! peer) | |
4839 | return CMD_WARNING; | |
4840 | ||
4841 | ret = peer_timers_unset (peer); | |
4842 | ||
4843 | return bgp_vty_return (vty, ret); | |
4844 | } | |
4845 | ||
4846 | DEFUN (neighbor_timers, | |
4847 | neighbor_timers_cmd, | |
4848 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4849 | NEIGHBOR_STR | |
4850 | NEIGHBOR_ADDR_STR2 | |
4851 | "BGP per neighbor timers\n" | |
4852 | "Keepalive interval\n" | |
4853 | "Holdtime\n") | |
4854 | { | |
4855 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
4856 | } | |
4857 | ||
4858 | DEFUN (no_neighbor_timers, | |
4859 | no_neighbor_timers_cmd, | |
4860 | NO_NEIGHBOR_CMD2 "timers", | |
4861 | NO_STR | |
4862 | NEIGHBOR_STR | |
4863 | NEIGHBOR_ADDR_STR2 | |
4864 | "BGP per neighbor timers\n") | |
4865 | { | |
4866 | return peer_timers_unset_vty (vty, argv[0]); | |
4867 | } | |
6b0655a2 | 4868 | |
94f2b392 | 4869 | static int |
fd79ac91 | 4870 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
4871 | const char *time_str) | |
718e3744 | 4872 | { |
4873 | int ret; | |
4874 | struct peer *peer; | |
4875 | u_int32_t connect; | |
4876 | ||
966f821c | 4877 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4878 | if (! peer) |
4879 | return CMD_WARNING; | |
4880 | ||
4881 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
4882 | ||
4883 | ret = peer_timers_connect_set (peer, connect); | |
4884 | ||
966f821c | 4885 | return bgp_vty_return (vty, ret); |
718e3744 | 4886 | } |
4887 | ||
94f2b392 | 4888 | static int |
fd79ac91 | 4889 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4890 | { |
4891 | int ret; | |
4892 | struct peer *peer; | |
4893 | ||
4894 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4895 | if (! peer) | |
4896 | return CMD_WARNING; | |
4897 | ||
4898 | ret = peer_timers_connect_unset (peer); | |
4899 | ||
966f821c | 4900 | return bgp_vty_return (vty, ret); |
718e3744 | 4901 | } |
4902 | ||
4903 | DEFUN (neighbor_timers_connect, | |
4904 | neighbor_timers_connect_cmd, | |
8e0d0089 | 4905 | NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 4906 | NEIGHBOR_STR |
966f821c | 4907 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4908 | "BGP per neighbor timers\n" |
4909 | "BGP connect timer\n" | |
4910 | "Connect timer\n") | |
4911 | { | |
4912 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
4913 | } | |
4914 | ||
4915 | DEFUN (no_neighbor_timers_connect, | |
4916 | no_neighbor_timers_connect_cmd, | |
966f821c | 4917 | NO_NEIGHBOR_CMD2 "timers connect", |
718e3744 | 4918 | NO_STR |
4919 | NEIGHBOR_STR | |
966f821c | 4920 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4921 | "BGP per neighbor timers\n" |
4922 | "BGP connect timer\n") | |
4923 | { | |
4924 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
4925 | } | |
4926 | ||
4927 | ALIAS (no_neighbor_timers_connect, | |
4928 | no_neighbor_timers_connect_val_cmd, | |
8e0d0089 | 4929 | NO_NEIGHBOR_CMD2 "timers connect <1-65535>", |
718e3744 | 4930 | NO_STR |
4931 | NEIGHBOR_STR | |
966f821c | 4932 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4933 | "BGP per neighbor timers\n" |
4934 | "BGP connect timer\n" | |
4935 | "Connect timer\n") | |
6b0655a2 | 4936 | |
94f2b392 | 4937 | static int |
fd79ac91 | 4938 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
4939 | const char *time_str, int set) | |
718e3744 | 4940 | { |
4941 | int ret; | |
4942 | struct peer *peer; | |
4943 | u_int32_t routeadv = 0; | |
4944 | ||
966f821c | 4945 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4946 | if (! peer) |
4947 | return CMD_WARNING; | |
4948 | ||
4949 | if (time_str) | |
4950 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
4951 | ||
4952 | if (set) | |
4953 | ret = peer_advertise_interval_set (peer, routeadv); | |
4954 | else | |
4955 | ret = peer_advertise_interval_unset (peer); | |
4956 | ||
966f821c | 4957 | return bgp_vty_return (vty, ret); |
718e3744 | 4958 | } |
4959 | ||
4960 | DEFUN (neighbor_advertise_interval, | |
4961 | neighbor_advertise_interval_cmd, | |
966f821c | 4962 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4963 | NEIGHBOR_STR |
966f821c | 4964 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4965 | "Minimum interval between sending BGP routing updates\n" |
4966 | "time in seconds\n") | |
4967 | { | |
4968 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
4969 | } | |
4970 | ||
4971 | DEFUN (no_neighbor_advertise_interval, | |
4972 | no_neighbor_advertise_interval_cmd, | |
966f821c | 4973 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
718e3744 | 4974 | NO_STR |
4975 | NEIGHBOR_STR | |
966f821c | 4976 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4977 | "Minimum interval between sending BGP routing updates\n") |
4978 | { | |
4979 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
4980 | } | |
4981 | ||
4982 | ALIAS (no_neighbor_advertise_interval, | |
4983 | no_neighbor_advertise_interval_val_cmd, | |
966f821c | 4984 | NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4985 | NO_STR |
4986 | NEIGHBOR_STR | |
966f821c | 4987 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4988 | "Minimum interval between sending BGP routing updates\n" |
4989 | "time in seconds\n") | |
6b0655a2 | 4990 | |
518f0eb1 DS |
4991 | /* Time to wait before processing route-map updates */ |
4992 | DEFUN (bgp_set_route_map_delay_timer, | |
4993 | bgp_set_route_map_delay_timer_cmd, | |
4994 | "bgp route-map delay-timer <0-600>", | |
4995 | SET_STR | |
4996 | "BGP route-map delay timer\n" | |
4997 | "Time in secs to wait before processing route-map changes\n" | |
f414725f | 4998 | "0 disables the timer, no route updates happen when route-maps change\n") |
518f0eb1 DS |
4999 | { |
5000 | u_int32_t rmap_delay_timer; | |
5001 | struct bgp *bgp; | |
5002 | ||
5003 | bgp = vty->index; | |
5004 | if (argv[0]) | |
5005 | { | |
5006 | VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); | |
5007 | bgp->rmap_update_timer = rmap_delay_timer; | |
5008 | ||
5009 | /* if the dynamic update handling is being disabled, and a timer is | |
5010 | * running, stop the timer and act as if the timer has already fired. | |
5011 | */ | |
5012 | if (!rmap_delay_timer && bgp->t_rmap_update ) | |
5013 | { | |
5014 | BGP_TIMER_OFF(bgp->t_rmap_update); | |
87d4a781 | 5015 | thread_execute (bm->master, bgp_route_map_update_timer, &bgp, 0); |
518f0eb1 DS |
5016 | } |
5017 | return CMD_SUCCESS; | |
5018 | } | |
5019 | else | |
ffd0c037 | 5020 | return CMD_WARNING; |
518f0eb1 DS |
5021 | } |
5022 | ||
5023 | DEFUN (no_bgp_set_route_map_delay_timer, | |
5024 | no_bgp_set_route_map_delay_timer_cmd, | |
5025 | "no bgp route-map delay-timer", | |
5026 | NO_STR | |
5027 | "Default BGP route-map delay timer\n" | |
f414725f | 5028 | "Reset to default time to wait for processing route-map changes\n") |
518f0eb1 | 5029 | { |
518f0eb1 DS |
5030 | struct bgp *bgp; |
5031 | ||
5032 | bgp = vty->index; | |
5033 | bgp->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER; | |
5034 | ||
5035 | return CMD_SUCCESS; | |
5036 | } | |
5037 | ||
f414725f DS |
5038 | ALIAS (no_bgp_set_route_map_delay_timer, |
5039 | no_bgp_set_route_map_delay_timer_val_cmd, | |
5040 | "no bgp route-map delay-timer <0-600>", | |
5041 | NO_STR | |
5042 | "Default BGP route-map delay timer\n" | |
5043 | "Reset to default time to wait for processing route-map changes\n" | |
5044 | "0 disables the timer, no route updates happen when route-maps change\n") | |
5045 | ||
718e3744 | 5046 | /* neighbor interface */ |
94f2b392 | 5047 | static int |
fd79ac91 | 5048 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 5049 | { |
718e3744 | 5050 | struct peer *peer; |
5051 | ||
5052 | peer = peer_lookup_vty (vty, ip_str); | |
a80beece | 5053 | if (! peer || peer->conf_if) |
718e3744 | 5054 | return CMD_WARNING; |
5055 | ||
5056 | if (str) | |
ffd0c037 | 5057 | peer_interface_set (peer, str); |
718e3744 | 5058 | else |
ffd0c037 | 5059 | peer_interface_unset (peer); |
718e3744 | 5060 | |
5061 | return CMD_SUCCESS; | |
5062 | } | |
5063 | ||
5064 | DEFUN (neighbor_interface, | |
5065 | neighbor_interface_cmd, | |
5066 | NEIGHBOR_CMD "interface WORD", | |
5067 | NEIGHBOR_STR | |
5068 | NEIGHBOR_ADDR_STR | |
5069 | "Interface\n" | |
5070 | "Interface name\n") | |
5071 | { | |
8ffedcea DS |
5072 | if (argc == 3) |
5073 | return peer_interface_vty (vty, argv[0], argv[1]); | |
5074 | else | |
5075 | return peer_interface_vty (vty, argv[0], argv[1]); | |
718e3744 | 5076 | } |
5077 | ||
5078 | DEFUN (no_neighbor_interface, | |
5079 | no_neighbor_interface_cmd, | |
8ffedcea | 5080 | NO_NEIGHBOR_CMD2 "interface WORD", |
718e3744 | 5081 | NO_STR |
5082 | NEIGHBOR_STR | |
5083 | NEIGHBOR_ADDR_STR | |
5084 | "Interface\n" | |
5085 | "Interface name\n") | |
5086 | { | |
5087 | return peer_interface_vty (vty, argv[0], NULL); | |
5088 | } | |
6b0655a2 | 5089 | |
718e3744 | 5090 | /* Set distribute list to the peer. */ |
94f2b392 | 5091 | static int |
fd79ac91 | 5092 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
5093 | afi_t afi, safi_t safi, | |
5094 | const char *name_str, const char *direct_str) | |
718e3744 | 5095 | { |
5096 | int ret; | |
5097 | struct peer *peer; | |
5098 | int direct = FILTER_IN; | |
5099 | ||
5100 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5101 | if (! peer) | |
5102 | return CMD_WARNING; | |
5103 | ||
5104 | /* Check filter direction. */ | |
5105 | if (strncmp (direct_str, "i", 1) == 0) | |
5106 | direct = FILTER_IN; | |
5107 | else if (strncmp (direct_str, "o", 1) == 0) | |
5108 | direct = FILTER_OUT; | |
5109 | ||
5110 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
5111 | ||
5112 | return bgp_vty_return (vty, ret); | |
5113 | } | |
5114 | ||
94f2b392 | 5115 | static int |
fd79ac91 | 5116 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5117 | safi_t safi, const char *direct_str) | |
718e3744 | 5118 | { |
5119 | int ret; | |
5120 | struct peer *peer; | |
5121 | int direct = FILTER_IN; | |
5122 | ||
5123 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5124 | if (! peer) | |
5125 | return CMD_WARNING; | |
5126 | ||
5127 | /* Check filter direction. */ | |
5128 | if (strncmp (direct_str, "i", 1) == 0) | |
5129 | direct = FILTER_IN; | |
5130 | else if (strncmp (direct_str, "o", 1) == 0) | |
5131 | direct = FILTER_OUT; | |
5132 | ||
5133 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
5134 | ||
5135 | return bgp_vty_return (vty, ret); | |
5136 | } | |
5137 | ||
5138 | DEFUN (neighbor_distribute_list, | |
5139 | neighbor_distribute_list_cmd, | |
5140 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5141 | NEIGHBOR_STR | |
5142 | NEIGHBOR_ADDR_STR2 | |
5143 | "Filter updates to/from this neighbor\n" | |
5144 | "IP access-list number\n" | |
5145 | "IP access-list number (expanded range)\n" | |
5146 | "IP Access-list name\n" | |
5147 | "Filter incoming updates\n" | |
5148 | "Filter outgoing updates\n") | |
5149 | { | |
5150 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5151 | bgp_node_safi (vty), argv[1], argv[2]); | |
5152 | } | |
5153 | ||
5154 | DEFUN (no_neighbor_distribute_list, | |
5155 | no_neighbor_distribute_list_cmd, | |
5156 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
5157 | NO_STR | |
5158 | NEIGHBOR_STR | |
5159 | NEIGHBOR_ADDR_STR2 | |
5160 | "Filter updates to/from this neighbor\n" | |
5161 | "IP access-list number\n" | |
5162 | "IP access-list number (expanded range)\n" | |
5163 | "IP Access-list name\n" | |
5164 | "Filter incoming updates\n" | |
5165 | "Filter outgoing updates\n") | |
5166 | { | |
5167 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5168 | bgp_node_safi (vty), argv[2]); | |
5169 | } | |
6b0655a2 | 5170 | |
718e3744 | 5171 | /* Set prefix list to the peer. */ |
94f2b392 | 5172 | static int |
fd79ac91 | 5173 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5174 | safi_t safi, const char *name_str, | |
5175 | const char *direct_str) | |
718e3744 | 5176 | { |
5177 | int ret; | |
5178 | struct peer *peer; | |
5179 | int direct = FILTER_IN; | |
5180 | ||
5181 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5182 | if (! peer) | |
5183 | return CMD_WARNING; | |
5184 | ||
5185 | /* Check filter direction. */ | |
5186 | if (strncmp (direct_str, "i", 1) == 0) | |
5187 | direct = FILTER_IN; | |
5188 | else if (strncmp (direct_str, "o", 1) == 0) | |
5189 | direct = FILTER_OUT; | |
5190 | ||
5191 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
5192 | ||
5193 | return bgp_vty_return (vty, ret); | |
5194 | } | |
5195 | ||
94f2b392 | 5196 | static int |
fd79ac91 | 5197 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5198 | safi_t safi, const char *direct_str) | |
718e3744 | 5199 | { |
5200 | int ret; | |
5201 | struct peer *peer; | |
5202 | int direct = FILTER_IN; | |
5203 | ||
5204 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5205 | if (! peer) | |
5206 | return CMD_WARNING; | |
5207 | ||
5208 | /* Check filter direction. */ | |
5209 | if (strncmp (direct_str, "i", 1) == 0) | |
5210 | direct = FILTER_IN; | |
5211 | else if (strncmp (direct_str, "o", 1) == 0) | |
5212 | direct = FILTER_OUT; | |
5213 | ||
5214 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
5215 | ||
5216 | return bgp_vty_return (vty, ret); | |
5217 | } | |
5218 | ||
5219 | DEFUN (neighbor_prefix_list, | |
5220 | neighbor_prefix_list_cmd, | |
5221 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5222 | NEIGHBOR_STR | |
5223 | NEIGHBOR_ADDR_STR2 | |
5224 | "Filter updates to/from this neighbor\n" | |
5225 | "Name of a prefix list\n" | |
5226 | "Filter incoming updates\n" | |
5227 | "Filter outgoing updates\n") | |
5228 | { | |
5229 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5230 | bgp_node_safi (vty), argv[1], argv[2]); | |
5231 | } | |
5232 | ||
5233 | DEFUN (no_neighbor_prefix_list, | |
5234 | no_neighbor_prefix_list_cmd, | |
5235 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5236 | NO_STR | |
5237 | NEIGHBOR_STR | |
5238 | NEIGHBOR_ADDR_STR2 | |
5239 | "Filter updates to/from this neighbor\n" | |
5240 | "Name of a prefix list\n" | |
5241 | "Filter incoming updates\n" | |
5242 | "Filter outgoing updates\n") | |
5243 | { | |
5244 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5245 | bgp_node_safi (vty), argv[2]); | |
5246 | } | |
6b0655a2 | 5247 | |
94f2b392 | 5248 | static int |
fd79ac91 | 5249 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
5250 | afi_t afi, safi_t safi, | |
5251 | const char *name_str, const char *direct_str) | |
718e3744 | 5252 | { |
5253 | int ret; | |
5254 | struct peer *peer; | |
5255 | int direct = FILTER_IN; | |
5256 | ||
5257 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5258 | if (! peer) | |
5259 | return CMD_WARNING; | |
5260 | ||
5261 | /* Check filter direction. */ | |
5262 | if (strncmp (direct_str, "i", 1) == 0) | |
5263 | direct = FILTER_IN; | |
5264 | else if (strncmp (direct_str, "o", 1) == 0) | |
5265 | direct = FILTER_OUT; | |
5266 | ||
5267 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
5268 | ||
5269 | return bgp_vty_return (vty, ret); | |
5270 | } | |
5271 | ||
94f2b392 | 5272 | static int |
fd79ac91 | 5273 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
5274 | afi_t afi, safi_t safi, | |
5275 | const char *direct_str) | |
718e3744 | 5276 | { |
5277 | int ret; | |
5278 | struct peer *peer; | |
5279 | int direct = FILTER_IN; | |
5280 | ||
5281 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5282 | if (! peer) | |
5283 | return CMD_WARNING; | |
5284 | ||
5285 | /* Check filter direction. */ | |
5286 | if (strncmp (direct_str, "i", 1) == 0) | |
5287 | direct = FILTER_IN; | |
5288 | else if (strncmp (direct_str, "o", 1) == 0) | |
5289 | direct = FILTER_OUT; | |
5290 | ||
5291 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
5292 | ||
5293 | return bgp_vty_return (vty, ret); | |
5294 | } | |
5295 | ||
5296 | DEFUN (neighbor_filter_list, | |
5297 | neighbor_filter_list_cmd, | |
5298 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5299 | NEIGHBOR_STR | |
5300 | NEIGHBOR_ADDR_STR2 | |
5301 | "Establish BGP filters\n" | |
5302 | "AS path access-list name\n" | |
5303 | "Filter incoming routes\n" | |
5304 | "Filter outgoing routes\n") | |
5305 | { | |
5306 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5307 | bgp_node_safi (vty), argv[1], argv[2]); | |
5308 | } | |
5309 | ||
5310 | DEFUN (no_neighbor_filter_list, | |
5311 | no_neighbor_filter_list_cmd, | |
5312 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5313 | NO_STR | |
5314 | NEIGHBOR_STR | |
5315 | NEIGHBOR_ADDR_STR2 | |
5316 | "Establish BGP filters\n" | |
5317 | "AS path access-list name\n" | |
5318 | "Filter incoming routes\n" | |
5319 | "Filter outgoing routes\n") | |
5320 | { | |
5321 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5322 | bgp_node_safi (vty), argv[2]); | |
5323 | } | |
6b0655a2 | 5324 | |
718e3744 | 5325 | /* Set route-map to the peer. */ |
94f2b392 | 5326 | static int |
fd79ac91 | 5327 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
5328 | afi_t afi, safi_t safi, | |
5329 | const char *name_str, const char *direct_str) | |
718e3744 | 5330 | { |
5331 | int ret; | |
5332 | struct peer *peer; | |
fee0f4c6 | 5333 | int direct = RMAP_IN; |
718e3744 | 5334 | |
5335 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5336 | if (! peer) | |
5337 | return CMD_WARNING; | |
5338 | ||
5339 | /* Check filter direction. */ | |
fee0f4c6 | 5340 | if (strncmp (direct_str, "in", 2) == 0) |
5341 | direct = RMAP_IN; | |
718e3744 | 5342 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5343 | direct = RMAP_OUT; |
5344 | else if (strncmp (direct_str, "im", 2) == 0) | |
5345 | direct = RMAP_IMPORT; | |
5346 | else if (strncmp (direct_str, "e", 1) == 0) | |
5347 | direct = RMAP_EXPORT; | |
718e3744 | 5348 | |
5349 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
5350 | ||
5351 | return bgp_vty_return (vty, ret); | |
5352 | } | |
5353 | ||
94f2b392 | 5354 | static int |
fd79ac91 | 5355 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5356 | safi_t safi, const char *direct_str) | |
718e3744 | 5357 | { |
5358 | int ret; | |
5359 | struct peer *peer; | |
fee0f4c6 | 5360 | int direct = RMAP_IN; |
718e3744 | 5361 | |
5362 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5363 | if (! peer) | |
5364 | return CMD_WARNING; | |
5365 | ||
5366 | /* Check filter direction. */ | |
fee0f4c6 | 5367 | if (strncmp (direct_str, "in", 2) == 0) |
5368 | direct = RMAP_IN; | |
718e3744 | 5369 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5370 | direct = RMAP_OUT; |
5371 | else if (strncmp (direct_str, "im", 2) == 0) | |
5372 | direct = RMAP_IMPORT; | |
5373 | else if (strncmp (direct_str, "e", 1) == 0) | |
5374 | direct = RMAP_EXPORT; | |
718e3744 | 5375 | |
5376 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
5377 | ||
5378 | return bgp_vty_return (vty, ret); | |
5379 | } | |
5380 | ||
5381 | DEFUN (neighbor_route_map, | |
5382 | neighbor_route_map_cmd, | |
fee0f4c6 | 5383 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 5384 | NEIGHBOR_STR |
5385 | NEIGHBOR_ADDR_STR2 | |
5386 | "Apply route map to neighbor\n" | |
5387 | "Name of route map\n" | |
5388 | "Apply map to incoming routes\n" | |
fee0f4c6 | 5389 | "Apply map to outbound routes\n" |
5390 | "Apply map to routes going into a Route-Server client's table\n" | |
5391 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 5392 | { |
5393 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5394 | bgp_node_safi (vty), argv[1], argv[2]); | |
5395 | } | |
5396 | ||
5397 | DEFUN (no_neighbor_route_map, | |
5398 | no_neighbor_route_map_cmd, | |
fee0f4c6 | 5399 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 5400 | NO_STR |
5401 | NEIGHBOR_STR | |
5402 | NEIGHBOR_ADDR_STR2 | |
5403 | "Apply route map to neighbor\n" | |
5404 | "Name of route map\n" | |
5405 | "Apply map to incoming routes\n" | |
fee0f4c6 | 5406 | "Apply map to outbound routes\n" |
5407 | "Apply map to routes going into a Route-Server client's table\n" | |
5408 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 5409 | { |
5410 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5411 | bgp_node_safi (vty), argv[2]); | |
5412 | } | |
6b0655a2 | 5413 | |
718e3744 | 5414 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 5415 | static int |
fd79ac91 | 5416 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5417 | safi_t safi, const char *name_str) | |
718e3744 | 5418 | { |
5419 | int ret; | |
5420 | struct peer *peer; | |
5421 | ||
5422 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5423 | if (! peer) | |
5424 | return CMD_WARNING; | |
5425 | ||
5426 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
5427 | ||
5428 | return bgp_vty_return (vty, ret); | |
5429 | } | |
5430 | ||
5431 | /* Unset route-map from the peer. */ | |
94f2b392 | 5432 | static int |
fd79ac91 | 5433 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5434 | safi_t safi) |
5435 | { | |
5436 | int ret; | |
5437 | struct peer *peer; | |
5438 | ||
5439 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5440 | if (! peer) | |
5441 | return CMD_WARNING; | |
5442 | ||
5443 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
5444 | ||
5445 | return bgp_vty_return (vty, ret); | |
5446 | } | |
5447 | ||
5448 | DEFUN (neighbor_unsuppress_map, | |
5449 | neighbor_unsuppress_map_cmd, | |
5450 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5451 | NEIGHBOR_STR | |
5452 | NEIGHBOR_ADDR_STR2 | |
5453 | "Route-map to selectively unsuppress suppressed routes\n" | |
5454 | "Name of route map\n") | |
5455 | { | |
5456 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5457 | bgp_node_safi (vty), argv[1]); | |
5458 | } | |
5459 | ||
5460 | DEFUN (no_neighbor_unsuppress_map, | |
5461 | no_neighbor_unsuppress_map_cmd, | |
5462 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5463 | NO_STR | |
5464 | NEIGHBOR_STR | |
5465 | NEIGHBOR_ADDR_STR2 | |
5466 | "Route-map to selectively unsuppress suppressed routes\n" | |
5467 | "Name of route map\n") | |
5468 | { | |
5469 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5470 | bgp_node_safi (vty)); | |
5471 | } | |
6b0655a2 | 5472 | |
94f2b392 | 5473 | static int |
fd79ac91 | 5474 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5475 | safi_t safi, const char *num_str, | |
0a486e5f | 5476 | const char *threshold_str, int warning, |
5477 | const char *restart_str) | |
718e3744 | 5478 | { |
5479 | int ret; | |
5480 | struct peer *peer; | |
5481 | u_int32_t max; | |
e0701b79 | 5482 | u_char threshold; |
0a486e5f | 5483 | u_int16_t restart; |
718e3744 | 5484 | |
5485 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5486 | if (! peer) | |
5487 | return CMD_WARNING; | |
5488 | ||
e6ec1c36 | 5489 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 5490 | if (threshold_str) |
5491 | threshold = atoi (threshold_str); | |
5492 | else | |
5493 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 5494 | |
0a486e5f | 5495 | if (restart_str) |
5496 | restart = atoi (restart_str); | |
5497 | else | |
5498 | restart = 0; | |
5499 | ||
5500 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 5501 | |
5502 | return bgp_vty_return (vty, ret); | |
5503 | } | |
5504 | ||
94f2b392 | 5505 | static int |
fd79ac91 | 5506 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5507 | safi_t safi) |
5508 | { | |
5509 | int ret; | |
5510 | struct peer *peer; | |
5511 | ||
5512 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5513 | if (! peer) | |
5514 | return CMD_WARNING; | |
5515 | ||
5516 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
5517 | ||
5518 | return bgp_vty_return (vty, ret); | |
5519 | } | |
5520 | ||
5521 | /* Maximum number of prefix configuration. prefix count is different | |
5522 | for each peer configuration. So this configuration can be set for | |
5523 | each peer configuration. */ | |
5524 | DEFUN (neighbor_maximum_prefix, | |
5525 | neighbor_maximum_prefix_cmd, | |
5526 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5527 | NEIGHBOR_STR | |
5528 | NEIGHBOR_ADDR_STR2 | |
5529 | "Maximum number of prefix accept from this peer\n" | |
5530 | "maximum no. of prefix limit\n") | |
5531 | { | |
5532 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5533 | bgp_node_safi (vty), argv[1], NULL, 0, |
5534 | NULL); | |
718e3744 | 5535 | } |
5536 | ||
e0701b79 | 5537 | DEFUN (neighbor_maximum_prefix_threshold, |
5538 | neighbor_maximum_prefix_threshold_cmd, | |
5539 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
5540 | NEIGHBOR_STR | |
5541 | NEIGHBOR_ADDR_STR2 | |
5542 | "Maximum number of prefix accept from this peer\n" | |
5543 | "maximum no. of prefix limit\n" | |
5544 | "Threshold value (%) at which to generate a warning msg\n") | |
5545 | { | |
5546 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5547 | bgp_node_safi (vty), argv[1], argv[2], 0, |
5548 | NULL); | |
5549 | } | |
e0701b79 | 5550 | |
718e3744 | 5551 | DEFUN (neighbor_maximum_prefix_warning, |
5552 | neighbor_maximum_prefix_warning_cmd, | |
5553 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5554 | NEIGHBOR_STR | |
5555 | NEIGHBOR_ADDR_STR2 | |
5556 | "Maximum number of prefix accept from this peer\n" | |
5557 | "maximum no. of prefix limit\n" | |
5558 | "Only give warning message when limit is exceeded\n") | |
5559 | { | |
5560 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5561 | bgp_node_safi (vty), argv[1], NULL, 1, |
5562 | NULL); | |
718e3744 | 5563 | } |
5564 | ||
e0701b79 | 5565 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
5566 | neighbor_maximum_prefix_threshold_warning_cmd, | |
5567 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
5568 | NEIGHBOR_STR | |
5569 | NEIGHBOR_ADDR_STR2 | |
5570 | "Maximum number of prefix accept from this peer\n" | |
5571 | "maximum no. of prefix limit\n" | |
5572 | "Threshold value (%) at which to generate a warning msg\n" | |
5573 | "Only give warning message when limit is exceeded\n") | |
5574 | { | |
5575 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5576 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
5577 | } | |
5578 | ||
5579 | DEFUN (neighbor_maximum_prefix_restart, | |
5580 | neighbor_maximum_prefix_restart_cmd, | |
5581 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
5582 | NEIGHBOR_STR | |
5583 | NEIGHBOR_ADDR_STR2 | |
5584 | "Maximum number of prefix accept from this peer\n" | |
5585 | "maximum no. of prefix limit\n" | |
5586 | "Restart bgp connection after limit is exceeded\n" | |
5587 | "Restart interval in minutes") | |
5588 | { | |
5589 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5590 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
5591 | } | |
5592 | ||
5593 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
5594 | neighbor_maximum_prefix_threshold_restart_cmd, | |
5595 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5596 | NEIGHBOR_STR | |
5597 | NEIGHBOR_ADDR_STR2 | |
5598 | "Maximum number of prefix accept from this peer\n" | |
5599 | "maximum no. of prefix limit\n" | |
5600 | "Threshold value (%) at which to generate a warning msg\n" | |
5601 | "Restart bgp connection after limit is exceeded\n" | |
5602 | "Restart interval in minutes") | |
5603 | { | |
5604 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5605 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
5606 | } | |
e0701b79 | 5607 | |
718e3744 | 5608 | DEFUN (no_neighbor_maximum_prefix, |
5609 | no_neighbor_maximum_prefix_cmd, | |
5610 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
5611 | NO_STR | |
5612 | NEIGHBOR_STR | |
5613 | NEIGHBOR_ADDR_STR2 | |
5614 | "Maximum number of prefix accept from this peer\n") | |
5615 | { | |
5616 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5617 | bgp_node_safi (vty)); | |
5618 | } | |
5619 | ||
5620 | ALIAS (no_neighbor_maximum_prefix, | |
5621 | no_neighbor_maximum_prefix_val_cmd, | |
5622 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5623 | NO_STR | |
5624 | NEIGHBOR_STR | |
5625 | NEIGHBOR_ADDR_STR2 | |
5626 | "Maximum number of prefix accept from this peer\n" | |
5627 | "maximum no. of prefix limit\n") | |
5628 | ||
5629 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5630 | no_neighbor_maximum_prefix_threshold_cmd, |
5631 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5632 | NO_STR | |
5633 | NEIGHBOR_STR | |
5634 | NEIGHBOR_ADDR_STR2 | |
5635 | "Maximum number of prefix accept from this peer\n" | |
5636 | "maximum no. of prefix limit\n" | |
5637 | "Threshold value (%) at which to generate a warning msg\n") | |
5638 | ||
5639 | ALIAS (no_neighbor_maximum_prefix, | |
5640 | no_neighbor_maximum_prefix_warning_cmd, | |
5641 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5642 | NO_STR | |
5643 | NEIGHBOR_STR | |
5644 | NEIGHBOR_ADDR_STR2 | |
5645 | "Maximum number of prefix accept from this peer\n" | |
5646 | "maximum no. of prefix limit\n" | |
e8e1946e | 5647 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 5648 | |
5649 | ALIAS (no_neighbor_maximum_prefix, | |
5650 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 5651 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
5652 | NO_STR | |
5653 | NEIGHBOR_STR | |
5654 | NEIGHBOR_ADDR_STR2 | |
5655 | "Maximum number of prefix accept from this peer\n" | |
5656 | "maximum no. of prefix limit\n" | |
5657 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 5658 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 5659 | |
5660 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5661 | no_neighbor_maximum_prefix_restart_cmd, |
5662 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 5663 | NO_STR |
5664 | NEIGHBOR_STR | |
5665 | NEIGHBOR_ADDR_STR2 | |
5666 | "Maximum number of prefix accept from this peer\n" | |
5667 | "maximum no. of prefix limit\n" | |
0a486e5f | 5668 | "Restart bgp connection after limit is exceeded\n" |
5669 | "Restart interval in minutes") | |
5670 | ||
5671 | ALIAS (no_neighbor_maximum_prefix, | |
5672 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
5673 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5674 | NO_STR | |
5675 | NEIGHBOR_STR | |
5676 | NEIGHBOR_ADDR_STR2 | |
5677 | "Maximum number of prefix accept from this peer\n" | |
5678 | "maximum no. of prefix limit\n" | |
5679 | "Threshold value (%) at which to generate a warning msg\n" | |
5680 | "Restart bgp connection after limit is exceeded\n" | |
5681 | "Restart interval in minutes") | |
6b0655a2 | 5682 | |
718e3744 | 5683 | /* "neighbor allowas-in" */ |
5684 | DEFUN (neighbor_allowas_in, | |
5685 | neighbor_allowas_in_cmd, | |
5686 | NEIGHBOR_CMD2 "allowas-in", | |
5687 | NEIGHBOR_STR | |
5688 | NEIGHBOR_ADDR_STR2 | |
5689 | "Accept as-path with my AS present in it\n") | |
5690 | { | |
5691 | int ret; | |
5692 | struct peer *peer; | |
fd79ac91 | 5693 | unsigned int allow_num; |
718e3744 | 5694 | |
5695 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5696 | if (! peer) | |
5697 | return CMD_WARNING; | |
5698 | ||
5699 | if (argc == 1) | |
5700 | allow_num = 3; | |
5701 | else | |
5702 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
5703 | ||
5704 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
5705 | allow_num); | |
5706 | ||
5707 | return bgp_vty_return (vty, ret); | |
5708 | } | |
5709 | ||
5710 | ALIAS (neighbor_allowas_in, | |
5711 | neighbor_allowas_in_arg_cmd, | |
5712 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5713 | NEIGHBOR_STR | |
5714 | NEIGHBOR_ADDR_STR2 | |
5715 | "Accept as-path with my AS present in it\n" | |
5716 | "Number of occurances of AS number\n") | |
5717 | ||
5718 | DEFUN (no_neighbor_allowas_in, | |
5719 | no_neighbor_allowas_in_cmd, | |
5720 | NO_NEIGHBOR_CMD2 "allowas-in", | |
5721 | NO_STR | |
5722 | NEIGHBOR_STR | |
5723 | NEIGHBOR_ADDR_STR2 | |
5724 | "allow local ASN appears in aspath attribute\n") | |
5725 | { | |
5726 | int ret; | |
5727 | struct peer *peer; | |
5728 | ||
5729 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5730 | if (! peer) | |
5731 | return CMD_WARNING; | |
5732 | ||
5733 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
5734 | ||
5735 | return bgp_vty_return (vty, ret); | |
5736 | } | |
6b0655a2 | 5737 | |
fa411a21 NH |
5738 | DEFUN (neighbor_ttl_security, |
5739 | neighbor_ttl_security_cmd, | |
5740 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5741 | NEIGHBOR_STR | |
5742 | NEIGHBOR_ADDR_STR2 | |
5743 | "Specify the maximum number of hops to the BGP peer\n") | |
5744 | { | |
5745 | struct peer *peer; | |
89b6d1f8 | 5746 | int gtsm_hops; |
fa411a21 NH |
5747 | |
5748 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5749 | if (! peer) | |
5750 | return CMD_WARNING; | |
5751 | ||
5752 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); | |
5753 | ||
89b6d1f8 | 5754 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
5755 | } |
5756 | ||
5757 | DEFUN (no_neighbor_ttl_security, | |
5758 | no_neighbor_ttl_security_cmd, | |
5759 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5760 | NO_STR | |
5761 | NEIGHBOR_STR | |
5762 | NEIGHBOR_ADDR_STR2 | |
5763 | "Specify the maximum number of hops to the BGP peer\n") | |
5764 | { | |
5765 | struct peer *peer; | |
fa411a21 NH |
5766 | |
5767 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5768 | if (! peer) | |
5769 | return CMD_WARNING; | |
5770 | ||
89b6d1f8 | 5771 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 5772 | } |
6b0655a2 | 5773 | |
718e3744 | 5774 | /* Address family configuration. */ |
5775 | DEFUN (address_family_ipv4, | |
5776 | address_family_ipv4_cmd, | |
5777 | "address-family ipv4", | |
5778 | "Enter Address Family command mode\n" | |
5779 | "Address family\n") | |
5780 | { | |
5781 | vty->node = BGP_IPV4_NODE; | |
5782 | return CMD_SUCCESS; | |
5783 | } | |
5784 | ||
5785 | DEFUN (address_family_ipv4_safi, | |
5786 | address_family_ipv4_safi_cmd, | |
5787 | "address-family ipv4 (unicast|multicast)", | |
5788 | "Enter Address Family command mode\n" | |
5789 | "Address family\n" | |
5790 | "Address Family modifier\n" | |
5791 | "Address Family modifier\n") | |
5792 | { | |
5793 | if (strncmp (argv[0], "m", 1) == 0) | |
5794 | vty->node = BGP_IPV4M_NODE; | |
5795 | else | |
5796 | vty->node = BGP_IPV4_NODE; | |
5797 | ||
5798 | return CMD_SUCCESS; | |
5799 | } | |
5800 | ||
25ffbdc1 | 5801 | DEFUN (address_family_ipv6, |
5802 | address_family_ipv6_cmd, | |
5803 | "address-family ipv6", | |
718e3744 | 5804 | "Enter Address Family command mode\n" |
25ffbdc1 | 5805 | "Address family\n") |
718e3744 | 5806 | { |
5807 | vty->node = BGP_IPV6_NODE; | |
5808 | return CMD_SUCCESS; | |
5809 | } | |
5810 | ||
25ffbdc1 | 5811 | DEFUN (address_family_ipv6_safi, |
5812 | address_family_ipv6_safi_cmd, | |
5813 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 5814 | "Enter Address Family command mode\n" |
25ffbdc1 | 5815 | "Address family\n" |
5816 | "Address Family modifier\n" | |
5817 | "Address Family modifier\n") | |
5818 | { | |
5819 | if (strncmp (argv[0], "m", 1) == 0) | |
5820 | vty->node = BGP_IPV6M_NODE; | |
5821 | else | |
5822 | vty->node = BGP_IPV6_NODE; | |
5823 | ||
5824 | return CMD_SUCCESS; | |
5825 | } | |
718e3744 | 5826 | |
5827 | DEFUN (address_family_vpnv4, | |
5828 | address_family_vpnv4_cmd, | |
5829 | "address-family vpnv4", | |
5830 | "Enter Address Family command mode\n" | |
5831 | "Address family\n") | |
5832 | { | |
5833 | vty->node = BGP_VPNV4_NODE; | |
5834 | return CMD_SUCCESS; | |
5835 | } | |
5836 | ||
5837 | ALIAS (address_family_vpnv4, | |
5838 | address_family_vpnv4_unicast_cmd, | |
5839 | "address-family vpnv4 unicast", | |
5840 | "Enter Address Family command mode\n" | |
5841 | "Address family\n" | |
5842 | "Address Family Modifier\n") | |
5843 | ||
5844 | DEFUN (exit_address_family, | |
5845 | exit_address_family_cmd, | |
5846 | "exit-address-family", | |
5847 | "Exit from Address Family configuration mode\n") | |
5848 | { | |
a8a80d53 | 5849 | if (vty->node == BGP_IPV4_NODE |
5850 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 5851 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 5852 | || vty->node == BGP_IPV6_NODE |
5853 | || vty->node == BGP_IPV6M_NODE) | |
718e3744 | 5854 | vty->node = BGP_NODE; |
5855 | return CMD_SUCCESS; | |
5856 | } | |
6b0655a2 | 5857 | |
8ad7271d DS |
5858 | /* Recalculate bestpath and re-advertise a prefix */ |
5859 | static int | |
5860 | bgp_clear_prefix (struct vty *vty, char *view_name, const char *ip_str, | |
5861 | afi_t afi, safi_t safi, struct prefix_rd *prd) | |
5862 | { | |
5863 | int ret; | |
5864 | struct prefix match; | |
5865 | struct bgp_node *rn; | |
5866 | struct bgp_node *rm; | |
8ad7271d DS |
5867 | struct bgp *bgp; |
5868 | struct bgp_table *table; | |
5869 | struct bgp_table *rib; | |
5870 | ||
5871 | /* BGP structure lookup. */ | |
5872 | if (view_name) | |
5873 | { | |
5874 | bgp = bgp_lookup_by_name (view_name); | |
5875 | if (bgp == NULL) | |
5876 | { | |
5877 | vty_out (vty, "%% Can't find BGP view %s%s", view_name, VTY_NEWLINE); | |
5878 | return CMD_WARNING; | |
5879 | } | |
5880 | } | |
5881 | else | |
5882 | { | |
5883 | bgp = bgp_get_default (); | |
5884 | if (bgp == NULL) | |
5885 | { | |
5886 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
5887 | return CMD_WARNING; | |
5888 | } | |
5889 | } | |
5890 | ||
5891 | /* Check IP address argument. */ | |
5892 | ret = str2prefix (ip_str, &match); | |
5893 | if (! ret) | |
5894 | { | |
5895 | vty_out (vty, "%% address is malformed%s", VTY_NEWLINE); | |
5896 | return CMD_WARNING; | |
5897 | } | |
5898 | ||
5899 | match.family = afi2family (afi); | |
5900 | rib = bgp->rib[afi][safi]; | |
5901 | ||
5902 | if (safi == SAFI_MPLS_VPN) | |
5903 | { | |
5904 | for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn)) | |
5905 | { | |
5906 | if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) | |
5907 | continue; | |
5908 | ||
5909 | if ((table = rn->info) != NULL) | |
5910 | { | |
5911 | if ((rm = bgp_node_match (table, &match)) != NULL) | |
5912 | { | |
5913 | if (rm->p.prefixlen == match.prefixlen) | |
5914 | { | |
5915 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5916 | bgp_process (bgp, rm, afi, safi); | |
5917 | } | |
5918 | bgp_unlock_node (rm); | |
5919 | } | |
5920 | } | |
5921 | } | |
5922 | } | |
5923 | else | |
5924 | { | |
5925 | if ((rn = bgp_node_match (rib, &match)) != NULL) | |
5926 | { | |
5927 | if (rn->p.prefixlen == match.prefixlen) | |
5928 | { | |
5929 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5930 | bgp_process (bgp, rn, afi, safi); | |
5931 | } | |
5932 | bgp_unlock_node (rn); | |
5933 | } | |
5934 | } | |
5935 | ||
5936 | return CMD_SUCCESS; | |
5937 | } | |
5938 | ||
718e3744 | 5939 | DEFUN (clear_ip_bgp_all, |
5940 | clear_ip_bgp_all_cmd, | |
5941 | "clear ip bgp *", | |
5942 | CLEAR_STR | |
5943 | IP_STR | |
5944 | BGP_STR | |
5945 | "Clear all peers\n") | |
5946 | { | |
5947 | if (argc == 1) | |
5948 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5949 | ||
5950 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5951 | } | |
5952 | ||
5953 | ALIAS (clear_ip_bgp_all, | |
5954 | clear_bgp_all_cmd, | |
5955 | "clear bgp *", | |
5956 | CLEAR_STR | |
5957 | BGP_STR | |
5958 | "Clear all peers\n") | |
5959 | ||
5960 | ALIAS (clear_ip_bgp_all, | |
5961 | clear_bgp_ipv6_all_cmd, | |
5962 | "clear bgp ipv6 *", | |
5963 | CLEAR_STR | |
5964 | BGP_STR | |
5965 | "Address family\n" | |
5966 | "Clear all peers\n") | |
5967 | ||
5968 | ALIAS (clear_ip_bgp_all, | |
5969 | clear_ip_bgp_instance_all_cmd, | |
5970 | "clear ip bgp view WORD *", | |
5971 | CLEAR_STR | |
5972 | IP_STR | |
5973 | BGP_STR | |
5974 | "BGP view\n" | |
5975 | "view name\n" | |
5976 | "Clear all peers\n") | |
5977 | ||
5978 | ALIAS (clear_ip_bgp_all, | |
5979 | clear_bgp_instance_all_cmd, | |
5980 | "clear bgp view WORD *", | |
5981 | CLEAR_STR | |
5982 | BGP_STR | |
5983 | "BGP view\n" | |
5984 | "view name\n" | |
5985 | "Clear all peers\n") | |
5986 | ||
5987 | DEFUN (clear_ip_bgp_peer, | |
5988 | clear_ip_bgp_peer_cmd, | |
a80beece | 5989 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5990 | CLEAR_STR |
5991 | IP_STR | |
5992 | BGP_STR | |
5993 | "BGP neighbor IP address to clear\n" | |
a80beece DS |
5994 | "BGP IPv6 neighbor to clear\n" |
5995 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5996 | { |
5997 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5998 | } | |
5999 | ||
6000 | ALIAS (clear_ip_bgp_peer, | |
6001 | clear_bgp_peer_cmd, | |
a80beece | 6002 | "clear bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6003 | CLEAR_STR |
6004 | BGP_STR | |
6005 | "BGP neighbor address to clear\n" | |
a80beece DS |
6006 | "BGP IPv6 neighbor to clear\n" |
6007 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6008 | |
6009 | ALIAS (clear_ip_bgp_peer, | |
6010 | clear_bgp_ipv6_peer_cmd, | |
a80beece | 6011 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 6012 | CLEAR_STR |
6013 | BGP_STR | |
6014 | "Address family\n" | |
6015 | "BGP neighbor address to clear\n" | |
a80beece DS |
6016 | "BGP IPv6 neighbor to clear\n" |
6017 | "BGP neighbor on interface to clear\n") | |
718e3744 | 6018 | |
6019 | DEFUN (clear_ip_bgp_peer_group, | |
6020 | clear_ip_bgp_peer_group_cmd, | |
6021 | "clear ip bgp peer-group WORD", | |
6022 | CLEAR_STR | |
6023 | IP_STR | |
6024 | BGP_STR | |
6025 | "Clear all members of peer-group\n" | |
6026 | "BGP peer-group name\n") | |
6027 | { | |
6028 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); | |
6029 | } | |
6030 | ||
6031 | ALIAS (clear_ip_bgp_peer_group, | |
6032 | clear_bgp_peer_group_cmd, | |
6033 | "clear bgp peer-group WORD", | |
6034 | CLEAR_STR | |
6035 | BGP_STR | |
6036 | "Clear all members of peer-group\n" | |
6037 | "BGP peer-group name\n") | |
6038 | ||
6039 | ALIAS (clear_ip_bgp_peer_group, | |
6040 | clear_bgp_ipv6_peer_group_cmd, | |
6041 | "clear bgp ipv6 peer-group WORD", | |
6042 | CLEAR_STR | |
6043 | BGP_STR | |
6044 | "Address family\n" | |
6045 | "Clear all members of peer-group\n" | |
6046 | "BGP peer-group name\n") | |
6047 | ||
6048 | DEFUN (clear_ip_bgp_external, | |
6049 | clear_ip_bgp_external_cmd, | |
6050 | "clear ip bgp external", | |
6051 | CLEAR_STR | |
6052 | IP_STR | |
6053 | BGP_STR | |
6054 | "Clear all external peers\n") | |
6055 | { | |
6056 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
6057 | } | |
6058 | ||
6059 | ALIAS (clear_ip_bgp_external, | |
6060 | clear_bgp_external_cmd, | |
6061 | "clear bgp external", | |
6062 | CLEAR_STR | |
6063 | BGP_STR | |
6064 | "Clear all external peers\n") | |
6065 | ||
6066 | ALIAS (clear_ip_bgp_external, | |
6067 | clear_bgp_ipv6_external_cmd, | |
6068 | "clear bgp ipv6 external", | |
6069 | CLEAR_STR | |
6070 | BGP_STR | |
6071 | "Address family\n" | |
6072 | "Clear all external peers\n") | |
6073 | ||
8ad7271d DS |
6074 | DEFUN (clear_ip_bgp_prefix, |
6075 | clear_ip_bgp_prefix_cmd, | |
6076 | "clear ip bgp prefix A.B.C.D/M", | |
6077 | CLEAR_STR | |
6078 | IP_STR | |
6079 | BGP_STR | |
6080 | "Clear bestpath and re-advertise\n" | |
6081 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6082 | { | |
6083 | return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL); | |
6084 | } | |
6085 | ||
6086 | ALIAS (clear_ip_bgp_prefix, | |
6087 | clear_bgp_prefix_cmd, | |
6088 | "clear bgp prefix A.B.C.D/M", | |
6089 | CLEAR_STR | |
6090 | BGP_STR | |
6091 | "Clear bestpath and re-advertise\n" | |
6092 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
6093 | ||
6094 | ||
718e3744 | 6095 | DEFUN (clear_ip_bgp_as, |
6096 | clear_ip_bgp_as_cmd, | |
320da874 | 6097 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 6098 | CLEAR_STR |
6099 | IP_STR | |
6100 | BGP_STR | |
6101 | "Clear peers with the AS number\n") | |
6102 | { | |
6103 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); | |
6104 | } | |
6105 | ||
6106 | ALIAS (clear_ip_bgp_as, | |
6107 | clear_bgp_as_cmd, | |
320da874 | 6108 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 6109 | CLEAR_STR |
6110 | BGP_STR | |
6111 | "Clear peers with the AS number\n") | |
6112 | ||
6113 | ALIAS (clear_ip_bgp_as, | |
6114 | clear_bgp_ipv6_as_cmd, | |
320da874 | 6115 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 6116 | CLEAR_STR |
6117 | BGP_STR | |
6118 | "Address family\n" | |
6119 | "Clear peers with the AS number\n") | |
6b0655a2 | 6120 | |
718e3744 | 6121 | /* Outbound soft-reconfiguration */ |
6122 | DEFUN (clear_ip_bgp_all_soft_out, | |
6123 | clear_ip_bgp_all_soft_out_cmd, | |
6124 | "clear ip bgp * soft out", | |
6125 | CLEAR_STR | |
6126 | IP_STR | |
6127 | BGP_STR | |
6128 | "Clear all peers\n" | |
e0bce756 DS |
6129 | BGP_SOFT_STR |
6130 | BGP_SOFT_OUT_STR) | |
718e3744 | 6131 | { |
6132 | if (argc == 1) | |
6133 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6134 | BGP_CLEAR_SOFT_OUT, NULL); | |
6135 | ||
6136 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6137 | BGP_CLEAR_SOFT_OUT, NULL); | |
6138 | } | |
6139 | ||
6140 | ALIAS (clear_ip_bgp_all_soft_out, | |
6141 | clear_ip_bgp_all_out_cmd, | |
6142 | "clear ip bgp * out", | |
6143 | CLEAR_STR | |
6144 | IP_STR | |
6145 | BGP_STR | |
6146 | "Clear all peers\n" | |
e0bce756 | 6147 | BGP_SOFT_OUT_STR) |
718e3744 | 6148 | |
6149 | ALIAS (clear_ip_bgp_all_soft_out, | |
6150 | clear_ip_bgp_instance_all_soft_out_cmd, | |
6151 | "clear ip bgp view WORD * soft out", | |
6152 | CLEAR_STR | |
6153 | IP_STR | |
6154 | BGP_STR | |
6155 | "BGP view\n" | |
6156 | "view name\n" | |
6157 | "Clear all peers\n" | |
e0bce756 DS |
6158 | BGP_SOFT_STR |
6159 | BGP_SOFT_OUT_STR) | |
718e3744 | 6160 | |
6161 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
6162 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
6163 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
6164 | CLEAR_STR | |
6165 | IP_STR | |
6166 | BGP_STR | |
6167 | "Clear all peers\n" | |
6168 | "Address family\n" | |
6169 | "Address Family modifier\n" | |
6170 | "Address Family modifier\n" | |
e0bce756 DS |
6171 | BGP_SOFT_STR |
6172 | BGP_SOFT_OUT_STR) | |
718e3744 | 6173 | { |
6174 | if (strncmp (argv[0], "m", 1) == 0) | |
6175 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6176 | BGP_CLEAR_SOFT_OUT, NULL); | |
6177 | ||
6178 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6179 | BGP_CLEAR_SOFT_OUT, NULL); | |
6180 | } | |
6181 | ||
6182 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, | |
6183 | clear_ip_bgp_all_ipv4_out_cmd, | |
6184 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
6185 | CLEAR_STR | |
6186 | IP_STR | |
6187 | BGP_STR | |
6188 | "Clear all peers\n" | |
6189 | "Address family\n" | |
6190 | "Address Family modifier\n" | |
6191 | "Address Family modifier\n" | |
e0bce756 | 6192 | BGP_SOFT_OUT_STR) |
718e3744 | 6193 | |
6194 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, | |
6195 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
6196 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", | |
6197 | CLEAR_STR | |
6198 | IP_STR | |
6199 | BGP_STR | |
6200 | "BGP view\n" | |
6201 | "view name\n" | |
6202 | "Clear all peers\n" | |
6203 | "Address family\n" | |
6204 | "Address Family modifier\n" | |
6205 | "Address Family modifier\n" | |
e0bce756 | 6206 | BGP_SOFT_OUT_STR) |
718e3744 | 6207 | { |
6208 | if (strncmp (argv[1], "m", 1) == 0) | |
6209 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6210 | BGP_CLEAR_SOFT_OUT, NULL); | |
6211 | ||
6212 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6213 | BGP_CLEAR_SOFT_OUT, NULL); | |
6214 | } | |
6215 | ||
6216 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
6217 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
6218 | "clear ip bgp * vpnv4 unicast soft out", | |
6219 | CLEAR_STR | |
6220 | IP_STR | |
6221 | BGP_STR | |
6222 | "Clear all peers\n" | |
6223 | "Address family\n" | |
6224 | "Address Family Modifier\n" | |
e0bce756 DS |
6225 | BGP_SOFT_STR |
6226 | BGP_SOFT_OUT_STR) | |
718e3744 | 6227 | { |
6228 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6229 | BGP_CLEAR_SOFT_OUT, NULL); | |
6230 | } | |
6231 | ||
6232 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
6233 | clear_ip_bgp_all_vpnv4_out_cmd, | |
6234 | "clear ip bgp * vpnv4 unicast out", | |
6235 | CLEAR_STR | |
6236 | IP_STR | |
6237 | BGP_STR | |
6238 | "Clear all peers\n" | |
6239 | "Address family\n" | |
6240 | "Address Family Modifier\n" | |
e0bce756 | 6241 | BGP_SOFT_OUT_STR) |
718e3744 | 6242 | |
6243 | DEFUN (clear_bgp_all_soft_out, | |
6244 | clear_bgp_all_soft_out_cmd, | |
6245 | "clear bgp * soft out", | |
6246 | CLEAR_STR | |
6247 | BGP_STR | |
6248 | "Clear all peers\n" | |
e0bce756 DS |
6249 | BGP_SOFT_STR |
6250 | BGP_SOFT_OUT_STR) | |
718e3744 | 6251 | { |
6252 | if (argc == 1) | |
6253 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6254 | BGP_CLEAR_SOFT_OUT, NULL); | |
6255 | ||
6256 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6257 | BGP_CLEAR_SOFT_OUT, NULL); | |
6258 | } | |
6259 | ||
6260 | ALIAS (clear_bgp_all_soft_out, | |
6261 | clear_bgp_instance_all_soft_out_cmd, | |
6262 | "clear bgp view WORD * soft out", | |
6263 | CLEAR_STR | |
6264 | BGP_STR | |
6265 | "BGP view\n" | |
6266 | "view name\n" | |
6267 | "Clear all peers\n" | |
e0bce756 DS |
6268 | BGP_SOFT_STR |
6269 | BGP_SOFT_OUT_STR) | |
718e3744 | 6270 | |
6271 | ALIAS (clear_bgp_all_soft_out, | |
6272 | clear_bgp_all_out_cmd, | |
6273 | "clear bgp * out", | |
6274 | CLEAR_STR | |
6275 | BGP_STR | |
6276 | "Clear all peers\n" | |
e0bce756 | 6277 | BGP_SOFT_OUT_STR) |
718e3744 | 6278 | |
6279 | ALIAS (clear_bgp_all_soft_out, | |
6280 | clear_bgp_ipv6_all_soft_out_cmd, | |
6281 | "clear bgp ipv6 * soft out", | |
6282 | CLEAR_STR | |
6283 | BGP_STR | |
6284 | "Address family\n" | |
6285 | "Clear all peers\n" | |
e0bce756 DS |
6286 | BGP_SOFT_STR |
6287 | BGP_SOFT_OUT_STR) | |
718e3744 | 6288 | |
6289 | ALIAS (clear_bgp_all_soft_out, | |
6290 | clear_bgp_ipv6_all_out_cmd, | |
6291 | "clear bgp ipv6 * out", | |
6292 | CLEAR_STR | |
6293 | BGP_STR | |
6294 | "Address family\n" | |
6295 | "Clear all peers\n" | |
e0bce756 | 6296 | BGP_SOFT_OUT_STR) |
718e3744 | 6297 | |
8ad7271d DS |
6298 | DEFUN (clear_bgp_ipv6_safi_prefix, |
6299 | clear_bgp_ipv6_safi_prefix_cmd, | |
6300 | "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6301 | CLEAR_STR | |
6302 | BGP_STR | |
6303 | "Address family\n" | |
6304 | "Address Family Modifier\n" | |
6305 | "Clear bestpath and re-advertise\n" | |
6306 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6307 | { | |
6308 | if (strncmp (argv[0], "m", 1) == 0) | |
6309 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL); | |
6310 | else | |
6311 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL); | |
6312 | } | |
6313 | ||
718e3744 | 6314 | DEFUN (clear_ip_bgp_peer_soft_out, |
6315 | clear_ip_bgp_peer_soft_out_cmd, | |
db64ea86 | 6316 | "clear ip bgp (A.B.C.D|WORD) soft out", |
718e3744 | 6317 | CLEAR_STR |
6318 | IP_STR | |
6319 | BGP_STR | |
6320 | "BGP neighbor address to clear\n" | |
db64ea86 | 6321 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6322 | BGP_SOFT_STR |
6323 | BGP_SOFT_OUT_STR) | |
718e3744 | 6324 | { |
6325 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6326 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6327 | } | |
6328 | ||
6329 | ALIAS (clear_ip_bgp_peer_soft_out, | |
6330 | clear_ip_bgp_peer_out_cmd, | |
db64ea86 | 6331 | "clear ip bgp (A.B.C.D|WORD) out", |
718e3744 | 6332 | CLEAR_STR |
6333 | IP_STR | |
6334 | BGP_STR | |
6335 | "BGP neighbor address to clear\n" | |
db64ea86 | 6336 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6337 | BGP_SOFT_OUT_STR) |
718e3744 | 6338 | |
6339 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, | |
6340 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
db64ea86 | 6341 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out", |
718e3744 | 6342 | CLEAR_STR |
6343 | IP_STR | |
6344 | BGP_STR | |
6345 | "BGP neighbor address to clear\n" | |
db64ea86 | 6346 | "BGP neighbor on interface to clear\n" |
718e3744 | 6347 | "Address family\n" |
6348 | "Address Family modifier\n" | |
6349 | "Address Family modifier\n" | |
e0bce756 DS |
6350 | BGP_SOFT_STR |
6351 | BGP_SOFT_OUT_STR) | |
718e3744 | 6352 | { |
6353 | if (strncmp (argv[1], "m", 1) == 0) | |
6354 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6355 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6356 | ||
6357 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6358 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6359 | } | |
6360 | ||
6361 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, | |
6362 | clear_ip_bgp_peer_ipv4_out_cmd, | |
db64ea86 | 6363 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out", |
718e3744 | 6364 | CLEAR_STR |
6365 | IP_STR | |
6366 | BGP_STR | |
6367 | "BGP neighbor address to clear\n" | |
db64ea86 | 6368 | "BGP neighbor on interface to clear\n" |
718e3744 | 6369 | "Address family\n" |
6370 | "Address Family modifier\n" | |
6371 | "Address Family modifier\n" | |
e0bce756 | 6372 | BGP_SOFT_OUT_STR) |
718e3744 | 6373 | |
db64ea86 | 6374 | /* NOTE: WORD peers have not been tested for vpnv4 */ |
718e3744 | 6375 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, |
6376 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
db64ea86 | 6377 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out", |
718e3744 | 6378 | CLEAR_STR |
6379 | IP_STR | |
6380 | BGP_STR | |
6381 | "BGP neighbor address to clear\n" | |
db64ea86 | 6382 | "BGP neighbor on interface to clear\n" |
718e3744 | 6383 | "Address family\n" |
6384 | "Address Family Modifier\n" | |
e0bce756 DS |
6385 | BGP_SOFT_STR |
6386 | BGP_SOFT_OUT_STR) | |
718e3744 | 6387 | { |
6388 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6389 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6390 | } | |
6391 | ||
6392 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
6393 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
db64ea86 | 6394 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out", |
718e3744 | 6395 | CLEAR_STR |
6396 | IP_STR | |
6397 | BGP_STR | |
6398 | "BGP neighbor address to clear\n" | |
db64ea86 | 6399 | "BGP neighbor on interface to clear\n" |
718e3744 | 6400 | "Address family\n" |
6401 | "Address Family Modifier\n" | |
e0bce756 | 6402 | BGP_SOFT_OUT_STR) |
718e3744 | 6403 | |
6404 | DEFUN (clear_bgp_peer_soft_out, | |
6405 | clear_bgp_peer_soft_out_cmd, | |
a80beece | 6406 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6407 | CLEAR_STR |
6408 | BGP_STR | |
6409 | "BGP neighbor address to clear\n" | |
6410 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6411 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6412 | BGP_SOFT_STR |
6413 | BGP_SOFT_OUT_STR) | |
718e3744 | 6414 | { |
6415 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6416 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6417 | } | |
6418 | ||
6419 | ALIAS (clear_bgp_peer_soft_out, | |
6420 | clear_bgp_ipv6_peer_soft_out_cmd, | |
a80beece | 6421 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6422 | CLEAR_STR |
6423 | BGP_STR | |
6424 | "Address family\n" | |
6425 | "BGP neighbor address to clear\n" | |
6426 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6427 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6428 | BGP_SOFT_STR |
6429 | BGP_SOFT_OUT_STR) | |
718e3744 | 6430 | |
6431 | ALIAS (clear_bgp_peer_soft_out, | |
6432 | clear_bgp_peer_out_cmd, | |
a80beece | 6433 | "clear bgp (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 6434 | CLEAR_STR |
6435 | BGP_STR | |
6436 | "BGP neighbor address to clear\n" | |
6437 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6438 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6439 | BGP_SOFT_OUT_STR) |
718e3744 | 6440 | |
6441 | ALIAS (clear_bgp_peer_soft_out, | |
6442 | clear_bgp_ipv6_peer_out_cmd, | |
a80beece | 6443 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 6444 | CLEAR_STR |
6445 | BGP_STR | |
6446 | "Address family\n" | |
6447 | "BGP neighbor address to clear\n" | |
6448 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6449 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6450 | BGP_SOFT_OUT_STR) |
718e3744 | 6451 | |
6452 | DEFUN (clear_ip_bgp_peer_group_soft_out, | |
6453 | clear_ip_bgp_peer_group_soft_out_cmd, | |
6454 | "clear ip bgp peer-group WORD soft out", | |
6455 | CLEAR_STR | |
6456 | IP_STR | |
6457 | BGP_STR | |
6458 | "Clear all members of peer-group\n" | |
6459 | "BGP peer-group name\n" | |
e0bce756 DS |
6460 | BGP_SOFT_STR |
6461 | BGP_SOFT_OUT_STR) | |
718e3744 | 6462 | { |
6463 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6464 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6465 | } | |
6466 | ||
6467 | ALIAS (clear_ip_bgp_peer_group_soft_out, | |
6468 | clear_ip_bgp_peer_group_out_cmd, | |
6469 | "clear ip bgp peer-group WORD out", | |
6470 | CLEAR_STR | |
6471 | IP_STR | |
6472 | BGP_STR | |
6473 | "Clear all members of peer-group\n" | |
6474 | "BGP peer-group name\n" | |
e0bce756 | 6475 | BGP_SOFT_OUT_STR) |
718e3744 | 6476 | |
6477 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, | |
6478 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
6479 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
6480 | CLEAR_STR | |
6481 | IP_STR | |
6482 | BGP_STR | |
6483 | "Clear all members of peer-group\n" | |
6484 | "BGP peer-group name\n" | |
6485 | "Address family\n" | |
6486 | "Address Family modifier\n" | |
6487 | "Address Family modifier\n" | |
e0bce756 DS |
6488 | BGP_SOFT_STR |
6489 | BGP_SOFT_OUT_STR) | |
718e3744 | 6490 | { |
6491 | if (strncmp (argv[1], "m", 1) == 0) | |
6492 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6493 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6494 | ||
6495 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6496 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6497 | } | |
6498 | ||
6499 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, | |
6500 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
6501 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
6502 | CLEAR_STR | |
6503 | IP_STR | |
6504 | BGP_STR | |
6505 | "Clear all members of peer-group\n" | |
6506 | "BGP peer-group name\n" | |
6507 | "Address family\n" | |
6508 | "Address Family modifier\n" | |
6509 | "Address Family modifier\n" | |
e0bce756 | 6510 | BGP_SOFT_OUT_STR) |
718e3744 | 6511 | |
6512 | DEFUN (clear_bgp_peer_group_soft_out, | |
6513 | clear_bgp_peer_group_soft_out_cmd, | |
6514 | "clear bgp peer-group WORD soft out", | |
6515 | CLEAR_STR | |
6516 | BGP_STR | |
6517 | "Clear all members of peer-group\n" | |
6518 | "BGP peer-group name\n" | |
e0bce756 DS |
6519 | BGP_SOFT_STR |
6520 | BGP_SOFT_OUT_STR) | |
718e3744 | 6521 | { |
6522 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6523 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6524 | } | |
6525 | ||
6526 | ALIAS (clear_bgp_peer_group_soft_out, | |
6527 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
6528 | "clear bgp ipv6 peer-group WORD soft out", | |
6529 | CLEAR_STR | |
6530 | BGP_STR | |
6531 | "Address family\n" | |
6532 | "Clear all members of peer-group\n" | |
6533 | "BGP peer-group name\n" | |
e0bce756 DS |
6534 | BGP_SOFT_STR |
6535 | BGP_SOFT_OUT_STR) | |
718e3744 | 6536 | |
6537 | ALIAS (clear_bgp_peer_group_soft_out, | |
6538 | clear_bgp_peer_group_out_cmd, | |
6539 | "clear bgp peer-group WORD out", | |
6540 | CLEAR_STR | |
6541 | BGP_STR | |
6542 | "Clear all members of peer-group\n" | |
6543 | "BGP peer-group name\n" | |
e0bce756 | 6544 | BGP_SOFT_OUT_STR) |
718e3744 | 6545 | |
6546 | ALIAS (clear_bgp_peer_group_soft_out, | |
6547 | clear_bgp_ipv6_peer_group_out_cmd, | |
6548 | "clear bgp ipv6 peer-group WORD out", | |
6549 | CLEAR_STR | |
6550 | BGP_STR | |
6551 | "Address family\n" | |
6552 | "Clear all members of peer-group\n" | |
6553 | "BGP peer-group name\n" | |
e0bce756 | 6554 | BGP_SOFT_OUT_STR) |
718e3744 | 6555 | |
6556 | DEFUN (clear_ip_bgp_external_soft_out, | |
6557 | clear_ip_bgp_external_soft_out_cmd, | |
6558 | "clear ip bgp external soft out", | |
6559 | CLEAR_STR | |
6560 | IP_STR | |
6561 | BGP_STR | |
6562 | "Clear all external peers\n" | |
e0bce756 DS |
6563 | BGP_SOFT_STR |
6564 | BGP_SOFT_OUT_STR) | |
718e3744 | 6565 | { |
6566 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6567 | BGP_CLEAR_SOFT_OUT, NULL); | |
6568 | } | |
6569 | ||
6570 | ALIAS (clear_ip_bgp_external_soft_out, | |
6571 | clear_ip_bgp_external_out_cmd, | |
6572 | "clear ip bgp external out", | |
6573 | CLEAR_STR | |
6574 | IP_STR | |
6575 | BGP_STR | |
6576 | "Clear all external peers\n" | |
e0bce756 | 6577 | BGP_SOFT_OUT_STR) |
718e3744 | 6578 | |
6579 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
6580 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
6581 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
6582 | CLEAR_STR | |
6583 | IP_STR | |
6584 | BGP_STR | |
6585 | "Clear all external peers\n" | |
6586 | "Address family\n" | |
6587 | "Address Family modifier\n" | |
6588 | "Address Family modifier\n" | |
e0bce756 DS |
6589 | BGP_SOFT_STR |
6590 | BGP_SOFT_OUT_STR) | |
718e3744 | 6591 | { |
6592 | if (strncmp (argv[0], "m", 1) == 0) | |
6593 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6594 | BGP_CLEAR_SOFT_OUT, NULL); | |
6595 | ||
6596 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6597 | BGP_CLEAR_SOFT_OUT, NULL); | |
6598 | } | |
6599 | ||
6600 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, | |
6601 | clear_ip_bgp_external_ipv4_out_cmd, | |
6602 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
6603 | CLEAR_STR | |
6604 | IP_STR | |
6605 | BGP_STR | |
6606 | "Clear all external peers\n" | |
6607 | "Address family\n" | |
6608 | "Address Family modifier\n" | |
6609 | "Address Family modifier\n" | |
e0bce756 | 6610 | BGP_SOFT_OUT_STR) |
718e3744 | 6611 | |
6612 | DEFUN (clear_bgp_external_soft_out, | |
6613 | clear_bgp_external_soft_out_cmd, | |
6614 | "clear bgp external soft out", | |
6615 | CLEAR_STR | |
6616 | BGP_STR | |
6617 | "Clear all external peers\n" | |
e0bce756 DS |
6618 | BGP_SOFT_STR |
6619 | BGP_SOFT_OUT_STR) | |
718e3744 | 6620 | { |
6621 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6622 | BGP_CLEAR_SOFT_OUT, NULL); | |
6623 | } | |
6624 | ||
6625 | ALIAS (clear_bgp_external_soft_out, | |
6626 | clear_bgp_ipv6_external_soft_out_cmd, | |
6627 | "clear bgp ipv6 external soft out", | |
6628 | CLEAR_STR | |
6629 | BGP_STR | |
6630 | "Address family\n" | |
6631 | "Clear all external peers\n" | |
e0bce756 DS |
6632 | BGP_SOFT_STR |
6633 | BGP_SOFT_OUT_STR) | |
718e3744 | 6634 | |
6635 | ALIAS (clear_bgp_external_soft_out, | |
6636 | clear_bgp_external_out_cmd, | |
6637 | "clear bgp external out", | |
6638 | CLEAR_STR | |
6639 | BGP_STR | |
6640 | "Clear all external peers\n" | |
e0bce756 | 6641 | BGP_SOFT_OUT_STR) |
718e3744 | 6642 | |
6643 | ALIAS (clear_bgp_external_soft_out, | |
6644 | clear_bgp_ipv6_external_out_cmd, | |
6645 | "clear bgp ipv6 external WORD out", | |
6646 | CLEAR_STR | |
6647 | BGP_STR | |
6648 | "Address family\n" | |
6649 | "Clear all external peers\n" | |
e0bce756 | 6650 | BGP_SOFT_OUT_STR) |
718e3744 | 6651 | |
6652 | DEFUN (clear_ip_bgp_as_soft_out, | |
6653 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 6654 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 6655 | CLEAR_STR |
6656 | IP_STR | |
6657 | BGP_STR | |
6658 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6659 | BGP_SOFT_STR |
6660 | BGP_SOFT_OUT_STR) | |
718e3744 | 6661 | { |
6662 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6663 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6664 | } | |
6665 | ||
6666 | ALIAS (clear_ip_bgp_as_soft_out, | |
6667 | clear_ip_bgp_as_out_cmd, | |
320da874 | 6668 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 6669 | CLEAR_STR |
6670 | IP_STR | |
6671 | BGP_STR | |
6672 | "Clear peers with the AS number\n" | |
e0bce756 | 6673 | BGP_SOFT_OUT_STR) |
718e3744 | 6674 | |
6675 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, | |
6676 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 6677 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 6678 | CLEAR_STR |
6679 | IP_STR | |
6680 | BGP_STR | |
6681 | "Clear peers with the AS number\n" | |
6682 | "Address family\n" | |
6683 | "Address Family modifier\n" | |
6684 | "Address Family modifier\n" | |
e0bce756 DS |
6685 | BGP_SOFT_STR |
6686 | BGP_SOFT_OUT_STR) | |
718e3744 | 6687 | { |
6688 | if (strncmp (argv[1], "m", 1) == 0) | |
6689 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6690 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6691 | ||
6692 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6693 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6694 | } | |
6695 | ||
6696 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, | |
6697 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 6698 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 6699 | CLEAR_STR |
6700 | IP_STR | |
6701 | BGP_STR | |
6702 | "Clear peers with the AS number\n" | |
6703 | "Address family\n" | |
6704 | "Address Family modifier\n" | |
6705 | "Address Family modifier\n" | |
e0bce756 | 6706 | BGP_SOFT_OUT_STR) |
718e3744 | 6707 | |
6708 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, | |
6709 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 6710 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 6711 | CLEAR_STR |
6712 | IP_STR | |
6713 | BGP_STR | |
6714 | "Clear peers with the AS number\n" | |
6715 | "Address family\n" | |
6716 | "Address Family modifier\n" | |
e0bce756 DS |
6717 | BGP_SOFT_STR |
6718 | BGP_SOFT_OUT_STR) | |
718e3744 | 6719 | { |
6720 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
6721 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6722 | } | |
6723 | ||
6724 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
6725 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 6726 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 6727 | CLEAR_STR |
6728 | IP_STR | |
6729 | BGP_STR | |
6730 | "Clear peers with the AS number\n" | |
6731 | "Address family\n" | |
6732 | "Address Family modifier\n" | |
e0bce756 | 6733 | BGP_SOFT_OUT_STR) |
718e3744 | 6734 | |
6735 | DEFUN (clear_bgp_as_soft_out, | |
6736 | clear_bgp_as_soft_out_cmd, | |
320da874 | 6737 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 6738 | CLEAR_STR |
6739 | BGP_STR | |
6740 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6741 | BGP_SOFT_STR |
6742 | BGP_SOFT_OUT_STR) | |
718e3744 | 6743 | { |
6744 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6745 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6746 | } | |
6747 | ||
6748 | ALIAS (clear_bgp_as_soft_out, | |
6749 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 6750 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 6751 | CLEAR_STR |
6752 | BGP_STR | |
6753 | "Address family\n" | |
6754 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6755 | BGP_SOFT_STR |
6756 | BGP_SOFT_OUT_STR) | |
718e3744 | 6757 | |
6758 | ALIAS (clear_bgp_as_soft_out, | |
6759 | clear_bgp_as_out_cmd, | |
320da874 | 6760 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 6761 | CLEAR_STR |
6762 | BGP_STR | |
6763 | "Clear peers with the AS number\n" | |
e0bce756 | 6764 | BGP_SOFT_OUT_STR) |
718e3744 | 6765 | |
6766 | ALIAS (clear_bgp_as_soft_out, | |
6767 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 6768 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 6769 | CLEAR_STR |
6770 | BGP_STR | |
6771 | "Address family\n" | |
6772 | "Clear peers with the AS number\n" | |
e0bce756 | 6773 | BGP_SOFT_OUT_STR) |
6b0655a2 | 6774 | |
718e3744 | 6775 | /* Inbound soft-reconfiguration */ |
6776 | DEFUN (clear_ip_bgp_all_soft_in, | |
6777 | clear_ip_bgp_all_soft_in_cmd, | |
6778 | "clear ip bgp * soft in", | |
6779 | CLEAR_STR | |
6780 | IP_STR | |
6781 | BGP_STR | |
6782 | "Clear all peers\n" | |
e0bce756 DS |
6783 | BGP_SOFT_STR |
6784 | BGP_SOFT_IN_STR) | |
718e3744 | 6785 | { |
6786 | if (argc == 1) | |
6787 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6788 | BGP_CLEAR_SOFT_IN, NULL); | |
6789 | ||
6790 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6791 | BGP_CLEAR_SOFT_IN, NULL); | |
6792 | } | |
6793 | ||
6794 | ALIAS (clear_ip_bgp_all_soft_in, | |
6795 | clear_ip_bgp_instance_all_soft_in_cmd, | |
6796 | "clear ip bgp view WORD * soft in", | |
6797 | CLEAR_STR | |
6798 | IP_STR | |
6799 | BGP_STR | |
6800 | "BGP view\n" | |
6801 | "view name\n" | |
6802 | "Clear all peers\n" | |
e0bce756 DS |
6803 | BGP_SOFT_STR |
6804 | BGP_SOFT_IN_STR) | |
718e3744 | 6805 | |
6806 | ALIAS (clear_ip_bgp_all_soft_in, | |
6807 | clear_ip_bgp_all_in_cmd, | |
6808 | "clear ip bgp * in", | |
6809 | CLEAR_STR | |
6810 | IP_STR | |
6811 | BGP_STR | |
6812 | "Clear all peers\n" | |
e0bce756 | 6813 | BGP_SOFT_IN_STR) |
718e3744 | 6814 | |
6815 | DEFUN (clear_ip_bgp_all_in_prefix_filter, | |
6816 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
6817 | "clear ip bgp * in prefix-filter", | |
6818 | CLEAR_STR | |
6819 | IP_STR | |
6820 | BGP_STR | |
6821 | "Clear all peers\n" | |
e0bce756 | 6822 | BGP_SOFT_IN_STR |
718e3744 | 6823 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6824 | { | |
6825 | if (argc== 1) | |
6826 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6827 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6828 | ||
6829 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6830 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6831 | } | |
6832 | ||
6833 | ALIAS (clear_ip_bgp_all_in_prefix_filter, | |
6834 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, | |
6835 | "clear ip bgp view WORD * in prefix-filter", | |
6836 | CLEAR_STR | |
6837 | IP_STR | |
6838 | BGP_STR | |
6839 | "BGP view\n" | |
6840 | "view name\n" | |
6841 | "Clear all peers\n" | |
e0bce756 | 6842 | BGP_SOFT_IN_STR |
718e3744 | 6843 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6844 | ||
6845 | ||
6846 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, | |
6847 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
6848 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
6849 | CLEAR_STR | |
6850 | IP_STR | |
6851 | BGP_STR | |
6852 | "Clear all peers\n" | |
6853 | "Address family\n" | |
6854 | "Address Family modifier\n" | |
6855 | "Address Family modifier\n" | |
e0bce756 DS |
6856 | BGP_SOFT_STR |
6857 | BGP_SOFT_IN_STR) | |
718e3744 | 6858 | { |
6859 | if (strncmp (argv[0], "m", 1) == 0) | |
6860 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6861 | BGP_CLEAR_SOFT_IN, NULL); | |
6862 | ||
6863 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6864 | BGP_CLEAR_SOFT_IN, NULL); | |
6865 | } | |
6866 | ||
6867 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, | |
6868 | clear_ip_bgp_all_ipv4_in_cmd, | |
6869 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
6870 | CLEAR_STR | |
6871 | IP_STR | |
6872 | BGP_STR | |
6873 | "Clear all peers\n" | |
6874 | "Address family\n" | |
6875 | "Address Family modifier\n" | |
6876 | "Address Family modifier\n" | |
e0bce756 | 6877 | BGP_SOFT_IN_STR) |
718e3744 | 6878 | |
6879 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, | |
6880 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
6881 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", | |
6882 | CLEAR_STR | |
6883 | IP_STR | |
6884 | BGP_STR | |
6885 | "BGP view\n" | |
6886 | "view name\n" | |
6887 | "Clear all peers\n" | |
6888 | "Address family\n" | |
6889 | "Address Family modifier\n" | |
6890 | "Address Family modifier\n" | |
e0bce756 DS |
6891 | BGP_SOFT_STR |
6892 | BGP_SOFT_IN_STR) | |
718e3744 | 6893 | { |
6894 | if (strncmp (argv[1], "m", 1) == 0) | |
6895 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6896 | BGP_CLEAR_SOFT_IN, NULL); | |
6897 | ||
6898 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6899 | BGP_CLEAR_SOFT_IN, NULL); | |
6900 | } | |
6901 | ||
6902 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, | |
6903 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
6904 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
6905 | CLEAR_STR | |
6906 | IP_STR | |
6907 | BGP_STR | |
6908 | "Clear all peers\n" | |
6909 | "Address family\n" | |
6910 | "Address Family modifier\n" | |
6911 | "Address Family modifier\n" | |
e0bce756 | 6912 | BGP_SOFT_IN_STR |
718e3744 | 6913 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6914 | { | |
6915 | if (strncmp (argv[0], "m", 1) == 0) | |
6916 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6917 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6918 | ||
6919 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6920 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6921 | } | |
6922 | ||
6923 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, | |
6924 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, | |
6925 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", | |
6926 | CLEAR_STR | |
6927 | IP_STR | |
6928 | BGP_STR | |
6929 | "Clear all peers\n" | |
6930 | "Address family\n" | |
6931 | "Address Family modifier\n" | |
6932 | "Address Family modifier\n" | |
e0bce756 | 6933 | BGP_SOFT_IN_STR |
718e3744 | 6934 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6935 | { | |
6936 | if (strncmp (argv[1], "m", 1) == 0) | |
6937 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6938 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6939 | ||
6940 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6941 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6942 | } | |
6943 | ||
6944 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
6945 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
6946 | "clear ip bgp * vpnv4 unicast soft in", | |
6947 | CLEAR_STR | |
6948 | IP_STR | |
6949 | BGP_STR | |
6950 | "Clear all peers\n" | |
6951 | "Address family\n" | |
6952 | "Address Family Modifier\n" | |
e0bce756 DS |
6953 | BGP_SOFT_STR |
6954 | BGP_SOFT_IN_STR) | |
718e3744 | 6955 | { |
6956 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6957 | BGP_CLEAR_SOFT_IN, NULL); | |
6958 | } | |
6959 | ||
6960 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
6961 | clear_ip_bgp_all_vpnv4_in_cmd, | |
6962 | "clear ip bgp * vpnv4 unicast in", | |
6963 | CLEAR_STR | |
6964 | IP_STR | |
6965 | BGP_STR | |
6966 | "Clear all peers\n" | |
6967 | "Address family\n" | |
6968 | "Address Family Modifier\n" | |
e0bce756 | 6969 | BGP_SOFT_IN_STR) |
718e3744 | 6970 | |
6971 | DEFUN (clear_bgp_all_soft_in, | |
6972 | clear_bgp_all_soft_in_cmd, | |
6973 | "clear bgp * soft in", | |
6974 | CLEAR_STR | |
6975 | BGP_STR | |
6976 | "Clear all peers\n" | |
e0bce756 DS |
6977 | BGP_SOFT_STR |
6978 | BGP_SOFT_IN_STR) | |
718e3744 | 6979 | { |
6980 | if (argc == 1) | |
6981 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6982 | BGP_CLEAR_SOFT_IN, NULL); | |
6983 | ||
6984 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6985 | BGP_CLEAR_SOFT_IN, NULL); | |
6986 | } | |
6987 | ||
6988 | ALIAS (clear_bgp_all_soft_in, | |
6989 | clear_bgp_instance_all_soft_in_cmd, | |
6990 | "clear bgp view WORD * soft in", | |
6991 | CLEAR_STR | |
6992 | BGP_STR | |
6993 | "BGP view\n" | |
6994 | "view name\n" | |
6995 | "Clear all peers\n" | |
e0bce756 DS |
6996 | BGP_SOFT_STR |
6997 | BGP_SOFT_IN_STR) | |
718e3744 | 6998 | |
6999 | ALIAS (clear_bgp_all_soft_in, | |
7000 | clear_bgp_ipv6_all_soft_in_cmd, | |
7001 | "clear bgp ipv6 * soft in", | |
7002 | CLEAR_STR | |
7003 | BGP_STR | |
7004 | "Address family\n" | |
7005 | "Clear all peers\n" | |
e0bce756 DS |
7006 | BGP_SOFT_STR |
7007 | BGP_SOFT_IN_STR) | |
718e3744 | 7008 | |
7009 | ALIAS (clear_bgp_all_soft_in, | |
7010 | clear_bgp_all_in_cmd, | |
7011 | "clear bgp * in", | |
7012 | CLEAR_STR | |
7013 | BGP_STR | |
7014 | "Clear all peers\n" | |
e0bce756 | 7015 | BGP_SOFT_IN_STR) |
718e3744 | 7016 | |
7017 | ALIAS (clear_bgp_all_soft_in, | |
7018 | clear_bgp_ipv6_all_in_cmd, | |
7019 | "clear bgp ipv6 * in", | |
7020 | CLEAR_STR | |
7021 | BGP_STR | |
7022 | "Address family\n" | |
7023 | "Clear all peers\n" | |
e0bce756 | 7024 | BGP_SOFT_IN_STR) |
718e3744 | 7025 | |
7026 | DEFUN (clear_bgp_all_in_prefix_filter, | |
7027 | clear_bgp_all_in_prefix_filter_cmd, | |
7028 | "clear bgp * in prefix-filter", | |
7029 | CLEAR_STR | |
7030 | BGP_STR | |
7031 | "Clear all peers\n" | |
e0bce756 | 7032 | BGP_SOFT_IN_STR |
718e3744 | 7033 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7034 | { | |
7035 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7036 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7037 | } | |
7038 | ||
7039 | ALIAS (clear_bgp_all_in_prefix_filter, | |
7040 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
7041 | "clear bgp ipv6 * in prefix-filter", | |
7042 | CLEAR_STR | |
7043 | BGP_STR | |
7044 | "Address family\n" | |
7045 | "Clear all peers\n" | |
e0bce756 | 7046 | BGP_SOFT_IN_STR |
718e3744 | 7047 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7048 | ||
7049 | DEFUN (clear_ip_bgp_peer_soft_in, | |
7050 | clear_ip_bgp_peer_soft_in_cmd, | |
db64ea86 | 7051 | "clear ip bgp (A.B.C.D|WORD) soft 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" |
e0bce756 DS |
7057 | BGP_SOFT_STR |
7058 | BGP_SOFT_IN_STR) | |
718e3744 | 7059 | { |
7060 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7061 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7062 | } | |
7063 | ||
7064 | ALIAS (clear_ip_bgp_peer_soft_in, | |
7065 | clear_ip_bgp_peer_in_cmd, | |
db64ea86 | 7066 | "clear ip bgp (A.B.C.D|WORD) in", |
718e3744 | 7067 | CLEAR_STR |
7068 | IP_STR | |
7069 | BGP_STR | |
7070 | "BGP neighbor address to clear\n" | |
db64ea86 | 7071 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7072 | BGP_SOFT_IN_STR) |
718e3744 | 7073 | |
7074 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, | |
7075 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
db64ea86 | 7076 | "clear ip bgp (A.B.C.D|WORD) in prefix-filter", |
718e3744 | 7077 | CLEAR_STR |
7078 | IP_STR | |
7079 | BGP_STR | |
7080 | "BGP neighbor address to clear\n" | |
db64ea86 | 7081 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7082 | BGP_SOFT_IN_STR |
718e3744 | 7083 | "Push out the existing ORF prefix-list\n") |
7084 | { | |
7085 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7086 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7087 | } | |
7088 | ||
7089 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
7090 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
db64ea86 | 7091 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in", |
718e3744 | 7092 | CLEAR_STR |
7093 | IP_STR | |
7094 | BGP_STR | |
7095 | "BGP neighbor address to clear\n" | |
db64ea86 | 7096 | "BGP neighbor on interface to clear\n" |
718e3744 | 7097 | "Address family\n" |
7098 | "Address Family modifier\n" | |
7099 | "Address Family modifier\n" | |
e0bce756 DS |
7100 | BGP_SOFT_STR |
7101 | BGP_SOFT_IN_STR) | |
718e3744 | 7102 | { |
7103 | if (strncmp (argv[1], "m", 1) == 0) | |
7104 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
7105 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7106 | ||
7107 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7108 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7109 | } | |
7110 | ||
7111 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, | |
7112 | clear_ip_bgp_peer_ipv4_in_cmd, | |
db64ea86 | 7113 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in", |
718e3744 | 7114 | CLEAR_STR |
7115 | IP_STR | |
7116 | BGP_STR | |
7117 | "BGP neighbor address to clear\n" | |
db64ea86 | 7118 | "BGP neighbor on interface to clear\n" |
718e3744 | 7119 | "Address family\n" |
7120 | "Address Family modifier\n" | |
7121 | "Address Family modifier\n" | |
e0bce756 | 7122 | BGP_SOFT_IN_STR) |
718e3744 | 7123 | |
7124 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, | |
7125 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
db64ea86 | 7126 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 7127 | CLEAR_STR |
7128 | IP_STR | |
7129 | BGP_STR | |
7130 | "BGP neighbor address to clear\n" | |
db64ea86 | 7131 | "BGP neighbor on interface to clear\n" |
718e3744 | 7132 | "Address family\n" |
7133 | "Address Family modifier\n" | |
7134 | "Address Family modifier\n" | |
e0bce756 | 7135 | BGP_SOFT_IN_STR |
718e3744 | 7136 | "Push out the existing ORF prefix-list\n") |
7137 | { | |
7138 | if (strncmp (argv[1], "m", 1) == 0) | |
7139 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
7140 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7141 | ||
7142 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7143 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7144 | } | |
7145 | ||
7146 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
7147 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
db64ea86 | 7148 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in", |
718e3744 | 7149 | CLEAR_STR |
7150 | IP_STR | |
7151 | BGP_STR | |
7152 | "BGP neighbor address to clear\n" | |
db64ea86 | 7153 | "BGP neighbor on interface to clear\n" |
718e3744 | 7154 | "Address family\n" |
7155 | "Address Family Modifier\n" | |
e0bce756 DS |
7156 | BGP_SOFT_STR |
7157 | BGP_SOFT_IN_STR) | |
718e3744 | 7158 | { |
7159 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
7160 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7161 | } | |
7162 | ||
7163 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
7164 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
db64ea86 | 7165 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in", |
718e3744 | 7166 | CLEAR_STR |
7167 | IP_STR | |
7168 | BGP_STR | |
7169 | "BGP neighbor address to clear\n" | |
db64ea86 | 7170 | "BGP neighbor on interface to clear\n" |
718e3744 | 7171 | "Address family\n" |
7172 | "Address Family Modifier\n" | |
e0bce756 | 7173 | BGP_SOFT_IN_STR) |
718e3744 | 7174 | |
7175 | DEFUN (clear_bgp_peer_soft_in, | |
7176 | clear_bgp_peer_soft_in_cmd, | |
a80beece | 7177 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 7178 | CLEAR_STR |
7179 | BGP_STR | |
7180 | "BGP neighbor address to clear\n" | |
7181 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7182 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
7183 | BGP_SOFT_STR |
7184 | BGP_SOFT_IN_STR) | |
718e3744 | 7185 | { |
7186 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7187 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7188 | } | |
7189 | ||
7190 | ALIAS (clear_bgp_peer_soft_in, | |
7191 | clear_bgp_ipv6_peer_soft_in_cmd, | |
a80beece | 7192 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 7193 | CLEAR_STR |
7194 | BGP_STR | |
7195 | "Address family\n" | |
7196 | "BGP neighbor address to clear\n" | |
7197 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7198 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
7199 | BGP_SOFT_STR |
7200 | BGP_SOFT_IN_STR) | |
718e3744 | 7201 | |
7202 | ALIAS (clear_bgp_peer_soft_in, | |
7203 | clear_bgp_peer_in_cmd, | |
a80beece | 7204 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 7205 | CLEAR_STR |
7206 | BGP_STR | |
7207 | "BGP neighbor address to clear\n" | |
7208 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7209 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7210 | BGP_SOFT_IN_STR) |
718e3744 | 7211 | |
7212 | ALIAS (clear_bgp_peer_soft_in, | |
7213 | clear_bgp_ipv6_peer_in_cmd, | |
a80beece | 7214 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 7215 | CLEAR_STR |
7216 | BGP_STR | |
7217 | "Address family\n" | |
7218 | "BGP neighbor address to clear\n" | |
7219 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7220 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7221 | BGP_SOFT_IN_STR) |
718e3744 | 7222 | |
7223 | DEFUN (clear_bgp_peer_in_prefix_filter, | |
7224 | clear_bgp_peer_in_prefix_filter_cmd, | |
a80beece | 7225 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 7226 | CLEAR_STR |
7227 | BGP_STR | |
7228 | "BGP neighbor address to clear\n" | |
7229 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7230 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7231 | BGP_SOFT_IN_STR |
718e3744 | 7232 | "Push out the existing ORF prefix-list\n") |
7233 | { | |
7234 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7235 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7236 | } | |
7237 | ||
7238 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
7239 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
a80beece | 7240 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 7241 | CLEAR_STR |
7242 | BGP_STR | |
7243 | "Address family\n" | |
7244 | "BGP neighbor address to clear\n" | |
7245 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7246 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7247 | BGP_SOFT_IN_STR |
718e3744 | 7248 | "Push out the existing ORF prefix-list\n") |
7249 | ||
7250 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
7251 | clear_ip_bgp_peer_group_soft_in_cmd, | |
7252 | "clear ip bgp peer-group WORD soft in", | |
7253 | CLEAR_STR | |
7254 | IP_STR | |
7255 | BGP_STR | |
7256 | "Clear all members of peer-group\n" | |
7257 | "BGP peer-group name\n" | |
e0bce756 DS |
7258 | BGP_SOFT_STR |
7259 | BGP_SOFT_IN_STR) | |
718e3744 | 7260 | { |
7261 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7262 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7263 | } | |
7264 | ||
7265 | ALIAS (clear_ip_bgp_peer_group_soft_in, | |
7266 | clear_ip_bgp_peer_group_in_cmd, | |
7267 | "clear ip bgp peer-group WORD in", | |
7268 | CLEAR_STR | |
7269 | IP_STR | |
7270 | BGP_STR | |
7271 | "Clear all members of peer-group\n" | |
7272 | "BGP peer-group name\n" | |
e0bce756 | 7273 | BGP_SOFT_IN_STR) |
718e3744 | 7274 | |
7275 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, | |
7276 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
7277 | "clear ip bgp peer-group WORD in prefix-filter", | |
7278 | CLEAR_STR | |
7279 | IP_STR | |
7280 | BGP_STR | |
7281 | "Clear all members of peer-group\n" | |
7282 | "BGP peer-group name\n" | |
e0bce756 | 7283 | BGP_SOFT_IN_STR |
718e3744 | 7284 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7285 | { | |
7286 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7287 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7288 | } | |
7289 | ||
7290 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
7291 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
7292 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
7293 | CLEAR_STR | |
7294 | IP_STR | |
7295 | BGP_STR | |
7296 | "Clear all members of peer-group\n" | |
7297 | "BGP peer-group name\n" | |
7298 | "Address family\n" | |
7299 | "Address Family modifier\n" | |
7300 | "Address Family modifier\n" | |
e0bce756 DS |
7301 | BGP_SOFT_STR |
7302 | BGP_SOFT_IN_STR) | |
718e3744 | 7303 | { |
7304 | if (strncmp (argv[1], "m", 1) == 0) | |
7305 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7306 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7307 | ||
7308 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7309 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7310 | } | |
7311 | ||
7312 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, | |
7313 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
7314 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
7315 | CLEAR_STR | |
7316 | IP_STR | |
7317 | BGP_STR | |
7318 | "Clear all members of peer-group\n" | |
7319 | "BGP peer-group name\n" | |
7320 | "Address family\n" | |
7321 | "Address Family modifier\n" | |
7322 | "Address Family modifier\n" | |
e0bce756 | 7323 | BGP_SOFT_IN_STR) |
718e3744 | 7324 | |
7325 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, | |
7326 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
7327 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
7328 | CLEAR_STR | |
7329 | IP_STR | |
7330 | BGP_STR | |
7331 | "Clear all members of peer-group\n" | |
7332 | "BGP peer-group name\n" | |
7333 | "Address family\n" | |
7334 | "Address Family modifier\n" | |
7335 | "Address Family modifier\n" | |
e0bce756 | 7336 | BGP_SOFT_IN_STR |
718e3744 | 7337 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7338 | { | |
7339 | if (strncmp (argv[1], "m", 1) == 0) | |
7340 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7341 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7342 | ||
7343 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7344 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7345 | } | |
7346 | ||
7347 | DEFUN (clear_bgp_peer_group_soft_in, | |
7348 | clear_bgp_peer_group_soft_in_cmd, | |
7349 | "clear bgp peer-group WORD soft in", | |
7350 | CLEAR_STR | |
7351 | BGP_STR | |
7352 | "Clear all members of peer-group\n" | |
7353 | "BGP peer-group name\n" | |
e0bce756 DS |
7354 | BGP_SOFT_STR |
7355 | BGP_SOFT_IN_STR) | |
718e3744 | 7356 | { |
7357 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7358 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7359 | } | |
7360 | ||
7361 | ALIAS (clear_bgp_peer_group_soft_in, | |
7362 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
7363 | "clear bgp ipv6 peer-group WORD soft in", | |
7364 | CLEAR_STR | |
7365 | BGP_STR | |
7366 | "Address family\n" | |
7367 | "Clear all members of peer-group\n" | |
7368 | "BGP peer-group name\n" | |
e0bce756 DS |
7369 | BGP_SOFT_STR |
7370 | BGP_SOFT_IN_STR) | |
718e3744 | 7371 | |
7372 | ALIAS (clear_bgp_peer_group_soft_in, | |
7373 | clear_bgp_peer_group_in_cmd, | |
7374 | "clear bgp peer-group WORD in", | |
7375 | CLEAR_STR | |
7376 | BGP_STR | |
7377 | "Clear all members of peer-group\n" | |
7378 | "BGP peer-group name\n" | |
e0bce756 | 7379 | BGP_SOFT_IN_STR) |
718e3744 | 7380 | |
7381 | ALIAS (clear_bgp_peer_group_soft_in, | |
7382 | clear_bgp_ipv6_peer_group_in_cmd, | |
7383 | "clear bgp ipv6 peer-group WORD in", | |
7384 | CLEAR_STR | |
7385 | BGP_STR | |
7386 | "Address family\n" | |
7387 | "Clear all members of peer-group\n" | |
7388 | "BGP peer-group name\n" | |
e0bce756 | 7389 | BGP_SOFT_IN_STR) |
718e3744 | 7390 | |
7391 | DEFUN (clear_bgp_peer_group_in_prefix_filter, | |
7392 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
7393 | "clear bgp peer-group WORD in prefix-filter", | |
7394 | CLEAR_STR | |
7395 | BGP_STR | |
7396 | "Clear all members of peer-group\n" | |
7397 | "BGP peer-group name\n" | |
e0bce756 | 7398 | BGP_SOFT_IN_STR |
718e3744 | 7399 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7400 | { | |
7401 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7402 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7403 | } | |
7404 | ||
7405 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
7406 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
7407 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
7408 | CLEAR_STR | |
7409 | BGP_STR | |
7410 | "Address family\n" | |
7411 | "Clear all members of peer-group\n" | |
7412 | "BGP peer-group name\n" | |
e0bce756 | 7413 | BGP_SOFT_IN_STR |
718e3744 | 7414 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7415 | ||
7416 | DEFUN (clear_ip_bgp_external_soft_in, | |
7417 | clear_ip_bgp_external_soft_in_cmd, | |
7418 | "clear ip bgp external soft in", | |
7419 | CLEAR_STR | |
7420 | IP_STR | |
7421 | BGP_STR | |
7422 | "Clear all external peers\n" | |
e0bce756 DS |
7423 | BGP_SOFT_STR |
7424 | BGP_SOFT_IN_STR) | |
718e3744 | 7425 | { |
7426 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7427 | BGP_CLEAR_SOFT_IN, NULL); | |
7428 | } | |
7429 | ||
7430 | ALIAS (clear_ip_bgp_external_soft_in, | |
7431 | clear_ip_bgp_external_in_cmd, | |
7432 | "clear ip bgp external in", | |
7433 | CLEAR_STR | |
7434 | IP_STR | |
7435 | BGP_STR | |
7436 | "Clear all external peers\n" | |
e0bce756 | 7437 | BGP_SOFT_IN_STR) |
718e3744 | 7438 | |
7439 | DEFUN (clear_ip_bgp_external_in_prefix_filter, | |
7440 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
7441 | "clear ip bgp external in prefix-filter", | |
7442 | CLEAR_STR | |
7443 | IP_STR | |
7444 | BGP_STR | |
7445 | "Clear all external peers\n" | |
e0bce756 | 7446 | BGP_SOFT_IN_STR |
718e3744 | 7447 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7448 | { | |
7449 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7450 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7451 | } | |
7452 | ||
7453 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
7454 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
7455 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
7456 | CLEAR_STR | |
7457 | IP_STR | |
7458 | BGP_STR | |
7459 | "Clear all external peers\n" | |
7460 | "Address family\n" | |
7461 | "Address Family modifier\n" | |
7462 | "Address Family modifier\n" | |
e0bce756 DS |
7463 | BGP_SOFT_STR |
7464 | BGP_SOFT_IN_STR) | |
718e3744 | 7465 | { |
7466 | if (strncmp (argv[0], "m", 1) == 0) | |
7467 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7468 | BGP_CLEAR_SOFT_IN, NULL); | |
7469 | ||
7470 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7471 | BGP_CLEAR_SOFT_IN, NULL); | |
7472 | } | |
7473 | ||
7474 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, | |
7475 | clear_ip_bgp_external_ipv4_in_cmd, | |
7476 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
7477 | CLEAR_STR | |
7478 | IP_STR | |
7479 | BGP_STR | |
7480 | "Clear all external peers\n" | |
7481 | "Address family\n" | |
7482 | "Address Family modifier\n" | |
7483 | "Address Family modifier\n" | |
e0bce756 | 7484 | BGP_SOFT_IN_STR) |
718e3744 | 7485 | |
7486 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, | |
7487 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
7488 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
7489 | CLEAR_STR | |
7490 | IP_STR | |
7491 | BGP_STR | |
7492 | "Clear all external peers\n" | |
7493 | "Address family\n" | |
7494 | "Address Family modifier\n" | |
7495 | "Address Family modifier\n" | |
e0bce756 | 7496 | BGP_SOFT_IN_STR |
718e3744 | 7497 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7498 | { | |
7499 | if (strncmp (argv[0], "m", 1) == 0) | |
7500 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7501 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7502 | ||
7503 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7504 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7505 | } | |
7506 | ||
7507 | DEFUN (clear_bgp_external_soft_in, | |
7508 | clear_bgp_external_soft_in_cmd, | |
7509 | "clear bgp external soft in", | |
7510 | CLEAR_STR | |
7511 | BGP_STR | |
7512 | "Clear all external peers\n" | |
e0bce756 DS |
7513 | BGP_SOFT_STR |
7514 | BGP_SOFT_IN_STR) | |
718e3744 | 7515 | { |
7516 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7517 | BGP_CLEAR_SOFT_IN, NULL); | |
7518 | } | |
7519 | ||
7520 | ALIAS (clear_bgp_external_soft_in, | |
7521 | clear_bgp_ipv6_external_soft_in_cmd, | |
7522 | "clear bgp ipv6 external soft in", | |
7523 | CLEAR_STR | |
7524 | BGP_STR | |
7525 | "Address family\n" | |
7526 | "Clear all external peers\n" | |
e0bce756 DS |
7527 | BGP_SOFT_STR |
7528 | BGP_SOFT_IN_STR) | |
718e3744 | 7529 | |
7530 | ALIAS (clear_bgp_external_soft_in, | |
7531 | clear_bgp_external_in_cmd, | |
7532 | "clear bgp external in", | |
7533 | CLEAR_STR | |
7534 | BGP_STR | |
7535 | "Clear all external peers\n" | |
e0bce756 | 7536 | BGP_SOFT_IN_STR) |
718e3744 | 7537 | |
7538 | ALIAS (clear_bgp_external_soft_in, | |
7539 | clear_bgp_ipv6_external_in_cmd, | |
7540 | "clear bgp ipv6 external WORD in", | |
7541 | CLEAR_STR | |
7542 | BGP_STR | |
7543 | "Address family\n" | |
7544 | "Clear all external peers\n" | |
e0bce756 | 7545 | BGP_SOFT_IN_STR) |
718e3744 | 7546 | |
7547 | DEFUN (clear_bgp_external_in_prefix_filter, | |
7548 | clear_bgp_external_in_prefix_filter_cmd, | |
7549 | "clear bgp external in prefix-filter", | |
7550 | CLEAR_STR | |
7551 | BGP_STR | |
7552 | "Clear all external peers\n" | |
e0bce756 | 7553 | BGP_SOFT_IN_STR |
718e3744 | 7554 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7555 | { | |
7556 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7557 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7558 | } | |
7559 | ||
7560 | ALIAS (clear_bgp_external_in_prefix_filter, | |
7561 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
7562 | "clear bgp ipv6 external in prefix-filter", | |
7563 | CLEAR_STR | |
7564 | BGP_STR | |
7565 | "Address family\n" | |
7566 | "Clear all external peers\n" | |
e0bce756 | 7567 | BGP_SOFT_IN_STR |
718e3744 | 7568 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7569 | ||
7570 | DEFUN (clear_ip_bgp_as_soft_in, | |
7571 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 7572 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 7573 | CLEAR_STR |
7574 | IP_STR | |
7575 | BGP_STR | |
7576 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7577 | BGP_SOFT_STR |
7578 | BGP_SOFT_IN_STR) | |
718e3744 | 7579 | { |
7580 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7581 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7582 | } | |
7583 | ||
7584 | ALIAS (clear_ip_bgp_as_soft_in, | |
7585 | clear_ip_bgp_as_in_cmd, | |
320da874 | 7586 | "clear ip bgp " CMD_AS_RANGE " in", |
718e3744 | 7587 | CLEAR_STR |
7588 | IP_STR | |
7589 | BGP_STR | |
7590 | "Clear peers with the AS number\n" | |
e0bce756 | 7591 | BGP_SOFT_IN_STR) |
718e3744 | 7592 | |
7593 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
7594 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 7595 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7596 | CLEAR_STR |
7597 | IP_STR | |
7598 | BGP_STR | |
7599 | "Clear peers with the AS number\n" | |
e0bce756 | 7600 | BGP_SOFT_IN_STR |
718e3744 | 7601 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7602 | { | |
7603 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7604 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7605 | } | |
7606 | ||
7607 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
7608 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 7609 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 7610 | CLEAR_STR |
7611 | IP_STR | |
7612 | BGP_STR | |
7613 | "Clear peers with the AS number\n" | |
7614 | "Address family\n" | |
7615 | "Address Family modifier\n" | |
7616 | "Address Family modifier\n" | |
e0bce756 DS |
7617 | BGP_SOFT_STR |
7618 | BGP_SOFT_IN_STR) | |
718e3744 | 7619 | { |
7620 | if (strncmp (argv[1], "m", 1) == 0) | |
7621 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7622 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7623 | ||
7624 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7625 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7626 | } | |
7627 | ||
7628 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, | |
7629 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 7630 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 7631 | CLEAR_STR |
7632 | IP_STR | |
7633 | BGP_STR | |
7634 | "Clear peers with the AS number\n" | |
7635 | "Address family\n" | |
7636 | "Address Family modifier\n" | |
7637 | "Address Family modifier\n" | |
e0bce756 | 7638 | BGP_SOFT_IN_STR) |
718e3744 | 7639 | |
7640 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, | |
7641 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 7642 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 7643 | CLEAR_STR |
7644 | IP_STR | |
7645 | BGP_STR | |
7646 | "Clear peers with the AS number\n" | |
7647 | "Address family\n" | |
7648 | "Address Family modifier\n" | |
7649 | "Address Family modifier\n" | |
e0bce756 | 7650 | BGP_SOFT_IN_STR |
718e3744 | 7651 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7652 | { | |
7653 | if (strncmp (argv[1], "m", 1) == 0) | |
7654 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7655 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7656 | ||
7657 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7658 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7659 | } | |
7660 | ||
7661 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
7662 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 7663 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 7664 | CLEAR_STR |
7665 | IP_STR | |
7666 | BGP_STR | |
7667 | "Clear peers with the AS number\n" | |
7668 | "Address family\n" | |
7669 | "Address Family modifier\n" | |
e0bce756 DS |
7670 | BGP_SOFT_STR |
7671 | BGP_SOFT_IN_STR) | |
718e3744 | 7672 | { |
7673 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7674 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7675 | } | |
7676 | ||
7677 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
7678 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 7679 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 7680 | CLEAR_STR |
7681 | IP_STR | |
7682 | BGP_STR | |
7683 | "Clear peers with the AS number\n" | |
7684 | "Address family\n" | |
7685 | "Address Family modifier\n" | |
e0bce756 | 7686 | BGP_SOFT_IN_STR) |
718e3744 | 7687 | |
7688 | DEFUN (clear_bgp_as_soft_in, | |
7689 | clear_bgp_as_soft_in_cmd, | |
320da874 | 7690 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 7691 | CLEAR_STR |
7692 | BGP_STR | |
7693 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7694 | BGP_SOFT_STR |
7695 | BGP_SOFT_IN_STR) | |
718e3744 | 7696 | { |
7697 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7698 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7699 | } | |
7700 | ||
7701 | ALIAS (clear_bgp_as_soft_in, | |
7702 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 7703 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 7704 | CLEAR_STR |
7705 | BGP_STR | |
7706 | "Address family\n" | |
7707 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7708 | BGP_SOFT_STR |
7709 | BGP_SOFT_IN_STR) | |
718e3744 | 7710 | |
7711 | ALIAS (clear_bgp_as_soft_in, | |
7712 | clear_bgp_as_in_cmd, | |
320da874 | 7713 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 7714 | CLEAR_STR |
7715 | BGP_STR | |
7716 | "Clear peers with the AS number\n" | |
e0bce756 | 7717 | BGP_SOFT_IN_STR) |
718e3744 | 7718 | |
7719 | ALIAS (clear_bgp_as_soft_in, | |
7720 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 7721 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 7722 | CLEAR_STR |
7723 | BGP_STR | |
7724 | "Address family\n" | |
7725 | "Clear peers with the AS number\n" | |
e0bce756 | 7726 | BGP_SOFT_IN_STR) |
718e3744 | 7727 | |
7728 | DEFUN (clear_bgp_as_in_prefix_filter, | |
7729 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 7730 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7731 | CLEAR_STR |
7732 | BGP_STR | |
7733 | "Clear peers with the AS number\n" | |
e0bce756 | 7734 | BGP_SOFT_IN_STR |
718e3744 | 7735 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7736 | { | |
7737 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7738 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7739 | } | |
7740 | ||
7741 | ALIAS (clear_bgp_as_in_prefix_filter, | |
7742 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 7743 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7744 | CLEAR_STR |
7745 | BGP_STR | |
7746 | "Address family\n" | |
7747 | "Clear peers with the AS number\n" | |
e0bce756 | 7748 | BGP_SOFT_IN_STR |
718e3744 | 7749 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6b0655a2 | 7750 | |
718e3744 | 7751 | /* Both soft-reconfiguration */ |
7752 | DEFUN (clear_ip_bgp_all_soft, | |
7753 | clear_ip_bgp_all_soft_cmd, | |
7754 | "clear ip bgp * soft", | |
7755 | CLEAR_STR | |
7756 | IP_STR | |
7757 | BGP_STR | |
7758 | "Clear all peers\n" | |
e0bce756 | 7759 | BGP_SOFT_STR) |
718e3744 | 7760 | { |
7761 | if (argc == 1) | |
7762 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
7763 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7764 | ||
7765 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7766 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7767 | } | |
7768 | ||
7769 | ALIAS (clear_ip_bgp_all_soft, | |
7770 | clear_ip_bgp_instance_all_soft_cmd, | |
7771 | "clear ip bgp view WORD * soft", | |
7772 | CLEAR_STR | |
7773 | IP_STR | |
7774 | BGP_STR | |
7775 | "BGP view\n" | |
7776 | "view name\n" | |
7777 | "Clear all peers\n" | |
e0bce756 | 7778 | BGP_SOFT_STR) |
718e3744 | 7779 | |
7780 | ||
7781 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
7782 | clear_ip_bgp_all_ipv4_soft_cmd, | |
7783 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
7784 | CLEAR_STR | |
7785 | IP_STR | |
7786 | BGP_STR | |
7787 | "Clear all peers\n" | |
7788 | "Address family\n" | |
7789 | "Address Family Modifier\n" | |
7790 | "Address Family Modifier\n" | |
e0bce756 | 7791 | BGP_SOFT_STR) |
718e3744 | 7792 | { |
7793 | if (strncmp (argv[0], "m", 1) == 0) | |
7794 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7795 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7796 | ||
7797 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7798 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7799 | } | |
7800 | ||
7801 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
7802 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
7803 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", | |
7804 | CLEAR_STR | |
7805 | IP_STR | |
7806 | BGP_STR | |
7807 | "BGP view\n" | |
7808 | "view name\n" | |
7809 | "Clear all peers\n" | |
7810 | "Address family\n" | |
7811 | "Address Family Modifier\n" | |
7812 | "Address Family Modifier\n" | |
e0bce756 | 7813 | BGP_SOFT_STR) |
718e3744 | 7814 | { |
7815 | if (strncmp (argv[1], "m", 1) == 0) | |
7816 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7817 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7818 | ||
7819 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7820 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7821 | } | |
7822 | ||
7823 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
7824 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
7825 | "clear ip bgp * vpnv4 unicast soft", | |
7826 | CLEAR_STR | |
7827 | IP_STR | |
7828 | BGP_STR | |
7829 | "Clear all peers\n" | |
7830 | "Address family\n" | |
7831 | "Address Family Modifier\n" | |
e0bce756 | 7832 | BGP_SOFT_STR) |
718e3744 | 7833 | { |
7834 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
7835 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7836 | } | |
7837 | ||
7838 | DEFUN (clear_bgp_all_soft, | |
7839 | clear_bgp_all_soft_cmd, | |
7840 | "clear bgp * soft", | |
7841 | CLEAR_STR | |
7842 | BGP_STR | |
7843 | "Clear all peers\n" | |
e0bce756 | 7844 | BGP_SOFT_STR) |
718e3744 | 7845 | { |
7846 | if (argc == 1) | |
7847 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
7848 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7849 | ||
7850 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7851 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7852 | } | |
7853 | ||
7854 | ALIAS (clear_bgp_all_soft, | |
7855 | clear_bgp_instance_all_soft_cmd, | |
7856 | "clear bgp view WORD * soft", | |
7857 | CLEAR_STR | |
7858 | BGP_STR | |
7859 | "BGP view\n" | |
7860 | "view name\n" | |
7861 | "Clear all peers\n" | |
e0bce756 | 7862 | BGP_SOFT_STR) |
718e3744 | 7863 | |
7864 | ALIAS (clear_bgp_all_soft, | |
7865 | clear_bgp_ipv6_all_soft_cmd, | |
7866 | "clear bgp ipv6 * soft", | |
7867 | CLEAR_STR | |
7868 | BGP_STR | |
7869 | "Address family\n" | |
7870 | "Clear all peers\n" | |
e0bce756 | 7871 | BGP_SOFT_STR) |
718e3744 | 7872 | |
7873 | DEFUN (clear_ip_bgp_peer_soft, | |
7874 | clear_ip_bgp_peer_soft_cmd, | |
db64ea86 | 7875 | "clear ip bgp (A.B.C.D|WORD) soft", |
718e3744 | 7876 | CLEAR_STR |
7877 | IP_STR | |
7878 | BGP_STR | |
7879 | "BGP neighbor address to clear\n" | |
db64ea86 | 7880 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7881 | BGP_SOFT_STR) |
718e3744 | 7882 | { |
7883 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7884 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7885 | } | |
7886 | ||
7887 | DEFUN (clear_ip_bgp_peer_ipv4_soft, | |
7888 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
db64ea86 | 7889 | "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft", |
718e3744 | 7890 | CLEAR_STR |
7891 | IP_STR | |
7892 | BGP_STR | |
7893 | "BGP neighbor address to clear\n" | |
db64ea86 | 7894 | "BGP neighbor on interface to clear\n" |
718e3744 | 7895 | "Address family\n" |
7896 | "Address Family Modifier\n" | |
7897 | "Address Family Modifier\n" | |
e0bce756 | 7898 | BGP_SOFT_STR) |
718e3744 | 7899 | { |
7900 | if (strncmp (argv[1], "m", 1) == 0) | |
7901 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
7902 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7903 | ||
7904 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7905 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7906 | } | |
7907 | ||
7908 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, | |
7909 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
db64ea86 | 7910 | "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft", |
718e3744 | 7911 | CLEAR_STR |
7912 | IP_STR | |
7913 | BGP_STR | |
7914 | "BGP neighbor address to clear\n" | |
db64ea86 | 7915 | "BGP neighbor on interface to clear\n" |
718e3744 | 7916 | "Address family\n" |
7917 | "Address Family Modifier\n" | |
e0bce756 | 7918 | BGP_SOFT_STR) |
718e3744 | 7919 | { |
7920 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
7921 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7922 | } | |
7923 | ||
7924 | DEFUN (clear_bgp_peer_soft, | |
7925 | clear_bgp_peer_soft_cmd, | |
a80beece | 7926 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 7927 | CLEAR_STR |
7928 | BGP_STR | |
7929 | "BGP neighbor address to clear\n" | |
7930 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7931 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7932 | BGP_SOFT_STR) |
718e3744 | 7933 | { |
7934 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7935 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7936 | } | |
7937 | ||
7938 | ALIAS (clear_bgp_peer_soft, | |
7939 | clear_bgp_ipv6_peer_soft_cmd, | |
a80beece | 7940 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 7941 | CLEAR_STR |
7942 | BGP_STR | |
7943 | "Address family\n" | |
7944 | "BGP neighbor address to clear\n" | |
7945 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7946 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7947 | BGP_SOFT_STR) |
718e3744 | 7948 | |
7949 | DEFUN (clear_ip_bgp_peer_group_soft, | |
7950 | clear_ip_bgp_peer_group_soft_cmd, | |
7951 | "clear ip bgp peer-group WORD soft", | |
7952 | CLEAR_STR | |
7953 | IP_STR | |
7954 | BGP_STR | |
7955 | "Clear all members of peer-group\n" | |
7956 | "BGP peer-group name\n" | |
e0bce756 | 7957 | BGP_SOFT_STR) |
718e3744 | 7958 | { |
7959 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7960 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7961 | } | |
7962 | ||
7963 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, | |
7964 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
7965 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
7966 | CLEAR_STR | |
7967 | IP_STR | |
7968 | BGP_STR | |
7969 | "Clear all members of peer-group\n" | |
7970 | "BGP peer-group name\n" | |
7971 | "Address family\n" | |
7972 | "Address Family modifier\n" | |
7973 | "Address Family modifier\n" | |
e0bce756 | 7974 | BGP_SOFT_STR) |
718e3744 | 7975 | { |
7976 | if (strncmp (argv[1], "m", 1) == 0) | |
7977 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7978 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7979 | ||
7980 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7981 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7982 | } | |
7983 | ||
7984 | DEFUN (clear_bgp_peer_group_soft, | |
7985 | clear_bgp_peer_group_soft_cmd, | |
7986 | "clear bgp peer-group WORD soft", | |
7987 | CLEAR_STR | |
7988 | BGP_STR | |
7989 | "Clear all members of peer-group\n" | |
7990 | "BGP peer-group name\n" | |
e0bce756 | 7991 | BGP_SOFT_STR) |
718e3744 | 7992 | { |
7993 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7994 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7995 | } | |
7996 | ||
7997 | ALIAS (clear_bgp_peer_group_soft, | |
7998 | clear_bgp_ipv6_peer_group_soft_cmd, | |
7999 | "clear bgp ipv6 peer-group WORD soft", | |
8000 | CLEAR_STR | |
8001 | BGP_STR | |
8002 | "Address family\n" | |
8003 | "Clear all members of peer-group\n" | |
8004 | "BGP peer-group name\n" | |
e0bce756 | 8005 | BGP_SOFT_STR) |
718e3744 | 8006 | |
8007 | DEFUN (clear_ip_bgp_external_soft, | |
8008 | clear_ip_bgp_external_soft_cmd, | |
8009 | "clear ip bgp external soft", | |
8010 | CLEAR_STR | |
8011 | IP_STR | |
8012 | BGP_STR | |
8013 | "Clear all external peers\n" | |
e0bce756 | 8014 | BGP_SOFT_STR) |
718e3744 | 8015 | { |
8016 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8017 | BGP_CLEAR_SOFT_BOTH, NULL); | |
8018 | } | |
8019 | ||
8020 | DEFUN (clear_ip_bgp_external_ipv4_soft, | |
8021 | clear_ip_bgp_external_ipv4_soft_cmd, | |
8022 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
8023 | CLEAR_STR | |
8024 | IP_STR | |
8025 | BGP_STR | |
8026 | "Clear all external peers\n" | |
8027 | "Address family\n" | |
8028 | "Address Family modifier\n" | |
8029 | "Address Family modifier\n" | |
e0bce756 | 8030 | BGP_SOFT_STR) |
718e3744 | 8031 | { |
8032 | if (strncmp (argv[0], "m", 1) == 0) | |
8033 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
8034 | BGP_CLEAR_SOFT_BOTH, NULL); | |
8035 | ||
8036 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
8037 | BGP_CLEAR_SOFT_BOTH, NULL); | |
8038 | } | |
8039 | ||
8040 | DEFUN (clear_bgp_external_soft, | |
8041 | clear_bgp_external_soft_cmd, | |
8042 | "clear bgp external soft", | |
8043 | CLEAR_STR | |
8044 | BGP_STR | |
8045 | "Clear all external peers\n" | |
e0bce756 | 8046 | BGP_SOFT_STR) |
718e3744 | 8047 | { |
8048 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
8049 | BGP_CLEAR_SOFT_BOTH, NULL); | |
8050 | } | |
8051 | ||
8052 | ALIAS (clear_bgp_external_soft, | |
8053 | clear_bgp_ipv6_external_soft_cmd, | |
8054 | "clear bgp ipv6 external soft", | |
8055 | CLEAR_STR | |
8056 | BGP_STR | |
8057 | "Address family\n" | |
8058 | "Clear all external peers\n" | |
e0bce756 | 8059 | BGP_SOFT_STR) |
718e3744 | 8060 | |
8061 | DEFUN (clear_ip_bgp_as_soft, | |
8062 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 8063 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 8064 | CLEAR_STR |
8065 | IP_STR | |
8066 | BGP_STR | |
8067 | "Clear peers with the AS number\n" | |
e0bce756 | 8068 | BGP_SOFT_STR) |
718e3744 | 8069 | { |
8070 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
8071 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
8072 | } | |
8073 | ||
8074 | DEFUN (clear_ip_bgp_as_ipv4_soft, | |
8075 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 8076 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 8077 | CLEAR_STR |
8078 | IP_STR | |
8079 | BGP_STR | |
8080 | "Clear peers with the AS number\n" | |
8081 | "Address family\n" | |
8082 | "Address Family Modifier\n" | |
8083 | "Address Family Modifier\n" | |
e0bce756 | 8084 | BGP_SOFT_STR) |
718e3744 | 8085 | { |
8086 | if (strncmp (argv[1], "m", 1) == 0) | |
8087 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
8088 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
8089 | ||
8090 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
8091 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
8092 | } | |
8093 | ||
8094 | DEFUN (clear_ip_bgp_as_vpnv4_soft, | |
8095 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 8096 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 8097 | CLEAR_STR |
8098 | IP_STR | |
8099 | BGP_STR | |
8100 | "Clear peers with the AS number\n" | |
8101 | "Address family\n" | |
8102 | "Address Family Modifier\n" | |
e0bce756 | 8103 | BGP_SOFT_STR) |
718e3744 | 8104 | { |
8105 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
8106 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
8107 | } | |
8108 | ||
8109 | DEFUN (clear_bgp_as_soft, | |
8110 | clear_bgp_as_soft_cmd, | |
320da874 | 8111 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 8112 | CLEAR_STR |
8113 | BGP_STR | |
8114 | "Clear peers with the AS number\n" | |
e0bce756 | 8115 | BGP_SOFT_STR) |
718e3744 | 8116 | { |
8117 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
8118 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
8119 | } | |
8120 | ||
8121 | ALIAS (clear_bgp_as_soft, | |
8122 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 8123 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 8124 | CLEAR_STR |
8125 | BGP_STR | |
8126 | "Address family\n" | |
8127 | "Clear peers with the AS number\n" | |
e0bce756 | 8128 | BGP_SOFT_STR) |
6b0655a2 | 8129 | |
fee0f4c6 | 8130 | /* RS-client soft reconfiguration. */ |
8131 | #ifdef HAVE_IPV6 | |
8132 | DEFUN (clear_bgp_all_rsclient, | |
8133 | clear_bgp_all_rsclient_cmd, | |
8134 | "clear bgp * rsclient", | |
8135 | CLEAR_STR | |
8136 | BGP_STR | |
8137 | "Clear all peers\n" | |
e0bce756 | 8138 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8139 | { |
8140 | if (argc == 1) | |
8141 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
8142 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
8143 | ||
8144 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
8145 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
8146 | } | |
8147 | ||
8148 | ALIAS (clear_bgp_all_rsclient, | |
8149 | clear_bgp_ipv6_all_rsclient_cmd, | |
8150 | "clear bgp ipv6 * rsclient", | |
8151 | CLEAR_STR | |
8152 | BGP_STR | |
8153 | "Address family\n" | |
8154 | "Clear all peers\n" | |
e0bce756 | 8155 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8156 | |
8157 | ALIAS (clear_bgp_all_rsclient, | |
8158 | clear_bgp_instance_all_rsclient_cmd, | |
8159 | "clear bgp view WORD * rsclient", | |
8160 | CLEAR_STR | |
8161 | BGP_STR | |
8162 | "BGP view\n" | |
8163 | "view name\n" | |
8164 | "Clear all peers\n" | |
e0bce756 | 8165 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8166 | |
8167 | ALIAS (clear_bgp_all_rsclient, | |
8168 | clear_bgp_ipv6_instance_all_rsclient_cmd, | |
8169 | "clear bgp ipv6 view WORD * rsclient", | |
8170 | CLEAR_STR | |
8171 | BGP_STR | |
8172 | "Address family\n" | |
8173 | "BGP view\n" | |
8174 | "view name\n" | |
8175 | "Clear all peers\n" | |
e0bce756 | 8176 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8177 | #endif /* HAVE_IPV6 */ |
8178 | ||
8179 | DEFUN (clear_ip_bgp_all_rsclient, | |
8180 | clear_ip_bgp_all_rsclient_cmd, | |
8181 | "clear ip bgp * rsclient", | |
8182 | CLEAR_STR | |
8183 | IP_STR | |
8184 | BGP_STR | |
8185 | "Clear all peers\n" | |
e0bce756 | 8186 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8187 | { |
8188 | if (argc == 1) | |
8189 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
8190 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
8191 | ||
8192 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
8193 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
8194 | } | |
8195 | ||
8196 | ALIAS (clear_ip_bgp_all_rsclient, | |
8197 | clear_ip_bgp_instance_all_rsclient_cmd, | |
8198 | "clear ip bgp view WORD * rsclient", | |
8199 | CLEAR_STR | |
8200 | IP_STR | |
8201 | BGP_STR | |
8202 | "BGP view\n" | |
8203 | "view name\n" | |
8204 | "Clear all peers\n" | |
e0bce756 | 8205 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8206 | |
8207 | #ifdef HAVE_IPV6 | |
8208 | DEFUN (clear_bgp_peer_rsclient, | |
8209 | clear_bgp_peer_rsclient_cmd, | |
a80beece | 8210 | "clear bgp (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8211 | CLEAR_STR |
8212 | BGP_STR | |
8213 | "BGP neighbor IP address to clear\n" | |
8214 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8215 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8216 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8217 | { |
8218 | if (argc == 2) | |
8219 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, | |
8220 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
8221 | ||
8222 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
8223 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
8224 | } | |
8225 | ||
8226 | ALIAS (clear_bgp_peer_rsclient, | |
8227 | clear_bgp_ipv6_peer_rsclient_cmd, | |
a80beece | 8228 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8229 | CLEAR_STR |
8230 | BGP_STR | |
8231 | "Address family\n" | |
8232 | "BGP neighbor IP address to clear\n" | |
8233 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8234 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8235 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8236 | |
8237 | ALIAS (clear_bgp_peer_rsclient, | |
8238 | clear_bgp_instance_peer_rsclient_cmd, | |
a80beece | 8239 | "clear bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8240 | CLEAR_STR |
8241 | BGP_STR | |
8242 | "BGP view\n" | |
8243 | "view name\n" | |
8244 | "BGP neighbor IP address to clear\n" | |
8245 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8246 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8247 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8248 | |
8249 | ALIAS (clear_bgp_peer_rsclient, | |
8250 | clear_bgp_ipv6_instance_peer_rsclient_cmd, | |
a80beece | 8251 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8252 | CLEAR_STR |
8253 | BGP_STR | |
8254 | "Address family\n" | |
8255 | "BGP view\n" | |
8256 | "view name\n" | |
8257 | "BGP neighbor IP address to clear\n" | |
8258 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8259 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8260 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8261 | #endif /* HAVE_IPV6 */ |
8262 | ||
8263 | DEFUN (clear_ip_bgp_peer_rsclient, | |
8264 | clear_ip_bgp_peer_rsclient_cmd, | |
a80beece | 8265 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8266 | CLEAR_STR |
8267 | IP_STR | |
8268 | BGP_STR | |
8269 | "BGP neighbor IP address to clear\n" | |
8270 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8271 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8272 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8273 | { |
8274 | if (argc == 2) | |
8275 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, | |
8276 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
8277 | ||
8278 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8279 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
8280 | } | |
8281 | ||
8282 | ALIAS (clear_ip_bgp_peer_rsclient, | |
8283 | clear_ip_bgp_instance_peer_rsclient_cmd, | |
a80beece | 8284 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8285 | CLEAR_STR |
8286 | IP_STR | |
8287 | BGP_STR | |
8288 | "BGP view\n" | |
8289 | "view name\n" | |
8290 | "BGP neighbor IP address to clear\n" | |
8291 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8292 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8293 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8294 | |
e0081f70 ML |
8295 | DEFUN (show_bgp_views, |
8296 | show_bgp_views_cmd, | |
8297 | "show bgp views", | |
8298 | SHOW_STR | |
8299 | BGP_STR | |
8300 | "Show the defined BGP views\n") | |
8301 | { | |
8302 | struct list *inst = bm->bgp; | |
8303 | struct listnode *node; | |
8304 | struct bgp *bgp; | |
8305 | ||
8306 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
8307 | { | |
8308 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); | |
8309 | return CMD_WARNING; | |
8310 | } | |
8311 | ||
8312 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
8313 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
8314 | vty_out (vty, "\t%s (AS%u)%s", | |
8315 | bgp->name ? bgp->name : "(null)", | |
8316 | bgp->as, VTY_NEWLINE); | |
8317 | ||
8318 | return CMD_SUCCESS; | |
8319 | } | |
8320 | ||
4bf6a362 PJ |
8321 | DEFUN (show_bgp_memory, |
8322 | show_bgp_memory_cmd, | |
8323 | "show bgp memory", | |
8324 | SHOW_STR | |
8325 | BGP_STR | |
8326 | "Global BGP memory statistics\n") | |
8327 | { | |
8328 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
8329 | unsigned long count; | |
8330 | ||
8331 | /* RIB related usage stats */ | |
8332 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
8333 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
8334 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8335 | count * sizeof (struct bgp_node)), | |
8336 | VTY_NEWLINE); | |
8337 | ||
8338 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
8339 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
8340 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8341 | count * sizeof (struct bgp_info)), | |
8342 | VTY_NEWLINE); | |
fb982c25 PJ |
8343 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
8344 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
8345 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8346 | count * sizeof (struct bgp_info_extra)), | |
8347 | VTY_NEWLINE); | |
4bf6a362 PJ |
8348 | |
8349 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
8350 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
8351 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8352 | count * sizeof (struct bgp_static)), | |
8353 | VTY_NEWLINE); | |
3f9c7369 DS |
8354 | |
8355 | if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET))) | |
8356 | vty_out (vty, "%ld Packets, using %s of memory%s", count, | |
8357 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8358 | count * sizeof (struct bpacket)), | |
8359 | VTY_NEWLINE); | |
4bf6a362 PJ |
8360 | |
8361 | /* Adj-In/Out */ | |
8362 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
8363 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
8364 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8365 | count * sizeof (struct bgp_adj_in)), | |
8366 | VTY_NEWLINE); | |
8367 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
8368 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
8369 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8370 | count * sizeof (struct bgp_adj_out)), | |
8371 | VTY_NEWLINE); | |
8372 | ||
8373 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
8374 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
8375 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8376 | count * sizeof (struct bgp_nexthop_cache)), | |
8377 | VTY_NEWLINE); | |
8378 | ||
8379 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
8380 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
8381 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8382 | count * sizeof (struct bgp_damp_info)), | |
8383 | VTY_NEWLINE); | |
8384 | ||
8385 | /* Attributes */ | |
8386 | count = attr_count(); | |
8387 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
8388 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8389 | count * sizeof(struct attr)), | |
8390 | VTY_NEWLINE); | |
fb982c25 PJ |
8391 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
8392 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
8393 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8394 | count * sizeof(struct attr_extra)), | |
8395 | VTY_NEWLINE); | |
4bf6a362 PJ |
8396 | |
8397 | if ((count = attr_unknown_count())) | |
8398 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
8399 | ||
8400 | /* AS_PATH attributes */ | |
8401 | count = aspath_count (); | |
8402 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
8403 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8404 | count * sizeof (struct aspath)), | |
8405 | VTY_NEWLINE); | |
8406 | ||
8407 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
8408 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
8409 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8410 | count * sizeof (struct assegment)), | |
8411 | VTY_NEWLINE); | |
8412 | ||
8413 | /* Other attributes */ | |
8414 | if ((count = community_count ())) | |
8415 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
8416 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8417 | count * sizeof (struct community)), | |
8418 | VTY_NEWLINE); | |
8419 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
8420 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
8421 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8422 | count * sizeof (struct ecommunity)), | |
8423 | VTY_NEWLINE); | |
8424 | ||
8425 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
8426 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
8427 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8428 | count * sizeof (struct cluster_list)), | |
8429 | VTY_NEWLINE); | |
8430 | ||
8431 | /* Peer related usage */ | |
8432 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
8433 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
8434 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8435 | count * sizeof (struct peer)), | |
8436 | VTY_NEWLINE); | |
8437 | ||
6e919709 | 8438 | if ((count = mtype_stats_alloc (MTYPE_BGP_PEER_GROUP))) |
4bf6a362 PJ |
8439 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, |
8440 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8441 | count * sizeof (struct peer_group)), | |
8442 | VTY_NEWLINE); | |
8443 | ||
8444 | /* Other */ | |
8445 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
8446 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
8447 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8448 | count * sizeof (struct hash)), | |
8449 | VTY_NEWLINE); | |
8450 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
8451 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
8452 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8453 | count * sizeof (struct hash_backet)), | |
8454 | VTY_NEWLINE); | |
8455 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
8456 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
8457 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8458 | count * sizeof (regex_t)), | |
8459 | VTY_NEWLINE); | |
8460 | return CMD_SUCCESS; | |
8461 | } | |
fee0f4c6 | 8462 | |
47fc97cc DS |
8463 | static int |
8464 | bgp_adj_out_count (struct peer *peer, int afi, int safi) | |
8465 | { | |
8466 | struct bgp_table *table; | |
8467 | struct bgp_node *rn; | |
47fc97cc DS |
8468 | int count = 0; |
8469 | ||
8470 | if (!peer) return(0); | |
8471 | ||
8472 | table = peer->bgp->rib[afi][safi]; | |
8473 | if (!table) return(0); | |
8474 | for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) | |
8475 | if (bgp_adj_out_lookup(peer, NULL, afi, safi, rn)) | |
8476 | count++; | |
8477 | return (count); | |
8478 | } | |
8479 | ||
718e3744 | 8480 | /* Show BGP peer's summary information. */ |
94f2b392 | 8481 | static int |
b05a1c8b DS |
8482 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, |
8483 | u_char use_json) | |
718e3744 | 8484 | { |
8485 | struct peer *peer; | |
1eb8ef25 | 8486 | struct listnode *node, *nnode; |
f14e6fdb DS |
8487 | unsigned int count = 0, dn_count = 0; |
8488 | char timebuf[BGP_UPTIME_LEN], dn_flag[2]; | |
718e3744 | 8489 | int len; |
ffd0c037 | 8490 | json_object *json = NULL; |
ffd0c037 DS |
8491 | json_object *json_peer = NULL; |
8492 | json_object *json_peers = NULL; | |
718e3744 | 8493 | |
8494 | /* Header string for each address family. */ | |
8495 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; | |
47fc97cc | 8496 | |
b05a1c8b DS |
8497 | if (use_json) |
8498 | { | |
8499 | json = json_object_new_object(); | |
f1aa5d8a | 8500 | json_peers = json_object_new_object(); |
b05a1c8b DS |
8501 | } |
8502 | ||
1eb8ef25 | 8503 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 8504 | { |
1ff9a340 DS |
8505 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
8506 | continue; | |
8507 | ||
718e3744 | 8508 | if (peer->afc[afi][safi]) |
8509 | { | |
b05a1c8b | 8510 | if (!count) |
4bf6a362 PJ |
8511 | { |
8512 | unsigned long ents; | |
8513 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
b05a1c8b | 8514 | |
4bf6a362 | 8515 | /* Usage summary and header */ |
b05a1c8b DS |
8516 | if (use_json) |
8517 | { | |
62d6dca0 | 8518 | json_object_string_add(json, "routerId", inet_ntoa (bgp->router_id)); |
f1aa5d8a | 8519 | json_object_int_add(json, "as", bgp->as); |
b05a1c8b DS |
8520 | } |
8521 | else | |
8522 | { | |
8523 | vty_out (vty, | |
8524 | "BGP router identifier %s, local AS number %u%s", | |
8525 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); | |
8526 | } | |
8527 | ||
f188f2c4 DS |
8528 | if (bgp_update_delay_configured(bgp)) |
8529 | { | |
b05a1c8b | 8530 | if (use_json) |
f188f2c4 | 8531 | { |
62d6dca0 | 8532 | json_object_int_add(json, "updateDelayLimit", bgp->v_update_delay); |
b05a1c8b DS |
8533 | |
8534 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
62d6dca0 | 8535 | json_object_int_add(json, "updateDelayEstablishWait", bgp->v_establish_wait); |
b05a1c8b DS |
8536 | |
8537 | if (bgp_update_delay_active(bgp)) | |
8538 | { | |
62d6dca0 DS |
8539 | json_object_string_add(json, "updateDelayFirstNeighbor", bgp->update_delay_begin_time); |
8540 | json_object_boolean_true_add(json, "updateDelayInProgress"); | |
b05a1c8b DS |
8541 | } |
8542 | else | |
8543 | { | |
8544 | if (bgp->update_delay_over) | |
8545 | { | |
62d6dca0 | 8546 | json_object_string_add(json, "updateDelayFirstNeighbor", |
f1aa5d8a | 8547 | bgp->update_delay_begin_time); |
62d6dca0 | 8548 | json_object_string_add(json, "updateDelayBestpathResumed", |
f1aa5d8a | 8549 | bgp->update_delay_end_time); |
62d6dca0 | 8550 | json_object_string_add(json, "updateDelayZebraUpdateResume", |
f1aa5d8a | 8551 | bgp->update_delay_zebra_resume_time); |
62d6dca0 | 8552 | json_object_string_add(json, "updateDelayPeerUpdateResume", |
f1aa5d8a | 8553 | bgp->update_delay_peers_resume_time); |
b05a1c8b DS |
8554 | } |
8555 | } | |
f188f2c4 DS |
8556 | } |
8557 | else | |
8558 | { | |
b05a1c8b DS |
8559 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", |
8560 | bgp->v_update_delay, VTY_NEWLINE); | |
8561 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
8562 | vty_out (vty, " Establish wait: %d seconds%s", | |
8563 | bgp->v_establish_wait, VTY_NEWLINE); | |
8564 | ||
8565 | if (bgp_update_delay_active(bgp)) | |
f188f2c4 DS |
8566 | { |
8567 | vty_out (vty, " First neighbor established: %s%s", | |
8568 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
b05a1c8b DS |
8569 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); |
8570 | } | |
8571 | else | |
8572 | { | |
8573 | if (bgp->update_delay_over) | |
8574 | { | |
8575 | vty_out (vty, " First neighbor established: %s%s", | |
8576 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
8577 | vty_out (vty, " Best-paths resumed: %s%s", | |
8578 | bgp->update_delay_end_time, VTY_NEWLINE); | |
8579 | vty_out (vty, " zebra update resumed: %s%s", | |
8580 | bgp->update_delay_zebra_resume_time, VTY_NEWLINE); | |
8581 | vty_out (vty, " peers update resumed: %s%s", | |
8582 | bgp->update_delay_peers_resume_time, VTY_NEWLINE); | |
8583 | } | |
f188f2c4 DS |
8584 | } |
8585 | } | |
8586 | } | |
4bf6a362 | 8587 | |
b05a1c8b DS |
8588 | if (use_json) |
8589 | { | |
8590 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
62d6dca0 | 8591 | json_object_boolean_true_add(json, "maxMedOnStartup"); |
b05a1c8b | 8592 | if (bgp->v_maxmed_admin) |
62d6dca0 | 8593 | json_object_boolean_true_add(json, "maxMedAdministrative"); |
b05a1c8b | 8594 | |
62d6dca0 | 8595 | json_object_int_add(json, "tableVersion", bgp_table_version(bgp->rib[afi][safi])); |
b05a1c8b DS |
8596 | |
8597 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
62d6dca0 DS |
8598 | json_object_int_add(json, "ribCount", ents); |
8599 | json_object_int_add(json, "ribMemory", ents * sizeof (struct bgp_node)); | |
b05a1c8b DS |
8600 | |
8601 | ents = listcount (bgp->peer); | |
62d6dca0 DS |
8602 | json_object_int_add(json, "peerCount", ents); |
8603 | json_object_int_add(json, "peerMemory", ents * sizeof (struct peer)); | |
b05a1c8b DS |
8604 | |
8605 | if ((ents = listcount (bgp->rsclient))) | |
8606 | { | |
62d6dca0 DS |
8607 | json_object_int_add(json, "rsclientCount", ents); |
8608 | json_object_int_add(json, "rsclientMemory", ents * sizeof (struct peer)); | |
b05a1c8b | 8609 | } |
abc920f8 | 8610 | |
b05a1c8b DS |
8611 | if ((ents = listcount (bgp->group))) |
8612 | { | |
62d6dca0 DS |
8613 | json_object_int_add(json, "peerGroupCount", ents); |
8614 | json_object_int_add(json, "peerGroupMemory", ents * sizeof (struct peer_group)); | |
b05a1c8b | 8615 | } |
3f9c7369 | 8616 | |
b05a1c8b | 8617 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
62d6dca0 | 8618 | json_object_boolean_true_add(json, "dampeningEnabled"); |
b05a1c8b DS |
8619 | } |
8620 | else | |
8621 | { | |
8622 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
8623 | vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE); | |
8624 | if (bgp->v_maxmed_admin) | |
8625 | vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE); | |
8626 | ||
ffd0c037 | 8627 | vty_out(vty, "BGP table version %" PRIu64 "%s", |
b05a1c8b DS |
8628 | bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE); |
8629 | ||
8630 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
8631 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
8632 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8633 | ents * sizeof (struct bgp_node)), | |
8634 | VTY_NEWLINE); | |
8635 | ||
8636 | /* Peer related usage */ | |
8637 | ents = listcount (bgp->peer); | |
8638 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
8639 | ents, | |
8640 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8641 | ents * sizeof (struct peer)), | |
8642 | VTY_NEWLINE); | |
8643 | ||
8644 | if ((ents = listcount (bgp->rsclient))) | |
8645 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", | |
8646 | ents, | |
8647 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8648 | ents * sizeof (struct peer)), | |
8649 | VTY_NEWLINE); | |
8650 | ||
8651 | if ((ents = listcount (bgp->group))) | |
8652 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
8653 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8654 | ents * sizeof (struct peer_group)), | |
8655 | VTY_NEWLINE); | |
8656 | ||
8657 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
8658 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
8659 | vty_out (vty, "%s", VTY_NEWLINE); | |
8660 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
8661 | } | |
4bf6a362 PJ |
8662 | } |
8663 | ||
b05a1c8b | 8664 | count++; |
718e3744 | 8665 | |
b05a1c8b DS |
8666 | if (use_json) |
8667 | { | |
8668 | json_peer = json_object_new_object(); | |
f14e6fdb | 8669 | |
b05a1c8b | 8670 | if (peer_dynamic_neighbor(peer)) |
62d6dca0 | 8671 | json_object_boolean_true_add(json_peer, "dynamicPeer"); |
b05a1c8b | 8672 | |
04b6bdc0 DW |
8673 | if (peer->hostname) |
8674 | json_object_string_add(json_peer, "hostname", peer->hostname); | |
8675 | ||
8676 | if (peer->domainname) | |
8677 | json_object_string_add(json_peer, "domainname", peer->domainname); | |
8678 | ||
62d6dca0 | 8679 | json_object_int_add(json_peer, "remoteAs", peer->as); |
f1aa5d8a | 8680 | json_object_int_add(json_peer, "version", 4); |
62d6dca0 | 8681 | json_object_int_add(json_peer, "msgRcvd", |
f1aa5d8a DS |
8682 | peer->open_in + peer->update_in + peer->keepalive_in |
8683 | + peer->notify_in + peer->refresh_in | |
8684 | + peer->dynamic_cap_in); | |
62d6dca0 | 8685 | json_object_int_add(json_peer, "msgSent", |
f1aa5d8a DS |
8686 | peer->open_out + peer->update_out + peer->keepalive_out |
8687 | + peer->notify_out + peer->refresh_out | |
8688 | + peer->dynamic_cap_out); | |
8689 | ||
62d6dca0 | 8690 | json_object_int_add(json_peer, "tableVersion", peer->version[afi][safi]); |
f1aa5d8a DS |
8691 | json_object_int_add(json_peer, "outq", peer->obuf->count); |
8692 | json_object_int_add(json_peer, "inq", 0); | |
856ca177 | 8693 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, use_json, json_peer); |
62d6dca0 DS |
8694 | json_object_int_add(json_peer, "prefixReceivedCount", peer->pcount[afi][safi]); |
8695 | json_object_int_add(json_peer, "prefixAdvertisedCount", bgp_adj_out_count(peer, afi, safi)); | |
b05a1c8b DS |
8696 | |
8697 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
f1aa5d8a | 8698 | json_object_string_add(json_peer, "state", "Idle (Admin)"); |
b05a1c8b | 8699 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
f1aa5d8a | 8700 | json_object_string_add(json_peer, "state", "Idle (PfxCt)"); |
b05a1c8b | 8701 | else |
f1aa5d8a | 8702 | json_object_string_add(json_peer, "state", LOOKUP(bgp_status_msg, peer->status)); |
b05a1c8b | 8703 | |
f1aa5d8a | 8704 | if (peer->conf_if) |
62d6dca0 | 8705 | json_object_string_add(json_peer, "idType", "interface"); |
f1aa5d8a | 8706 | else if (peer->su.sa.sa_family == AF_INET) |
62d6dca0 | 8707 | json_object_string_add(json_peer, "idType", "ipv4"); |
f1aa5d8a | 8708 | else if (peer->su.sa.sa_family == AF_INET6) |
62d6dca0 | 8709 | json_object_string_add(json_peer, "idType", "ipv6"); |
b05a1c8b | 8710 | |
f1aa5d8a | 8711 | json_object_object_add(json_peers, peer->host, json_peer); |
b05a1c8b DS |
8712 | } |
8713 | else | |
8714 | { | |
8715 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
8716 | if (peer_dynamic_neighbor(peer)) | |
8717 | { | |
8718 | dn_count++; | |
8719 | dn_flag[0] = '*'; | |
8720 | } | |
8721 | ||
04b6bdc0 DW |
8722 | if (peer->hostname && bgp_flag_check(bgp, BGP_FLAG_SHOW_HOSTNAME)) |
8723 | len = vty_out (vty, "%s%s(%s)", dn_flag, peer->hostname, | |
8724 | peer->host); | |
8725 | else | |
8726 | len = vty_out (vty, "%s%s", dn_flag, peer->host); | |
b05a1c8b DS |
8727 | len = 16 - len; |
8728 | ||
8729 | if (len < 1) | |
8730 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
8731 | else | |
8732 | vty_out (vty, "%*s", len, " "); | |
8733 | ||
8734 | vty_out (vty, "4 "); | |
8735 | ||
ee046671 | 8736 | vty_out (vty, "%5u %7d %7d %8" PRIu64 " %4d %4zd ", |
b05a1c8b DS |
8737 | peer->as, |
8738 | peer->open_in + peer->update_in + peer->keepalive_in | |
8739 | + peer->notify_in + peer->refresh_in | |
8740 | + peer->dynamic_cap_in, | |
8741 | peer->open_out + peer->update_out + peer->keepalive_out | |
8742 | + peer->notify_out + peer->refresh_out | |
8743 | + peer->dynamic_cap_out, | |
8744 | peer->version[afi][safi], | |
8745 | 0, | |
ffd0c037 | 8746 | peer->obuf->count); |
b05a1c8b | 8747 | |
f1aa5d8a | 8748 | vty_out (vty, "%-8s", |
856ca177 | 8749 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); |
b05a1c8b DS |
8750 | |
8751 | if (peer->status == Established) | |
8752 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); | |
8753 | else | |
8754 | { | |
8755 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
8756 | vty_out (vty, " Idle (Admin)"); | |
8757 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
8758 | vty_out (vty, " Idle (PfxCt)"); | |
8759 | else | |
8760 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
8761 | } | |
8762 | vty_out (vty, "%s", VTY_NEWLINE); | |
8763 | } | |
718e3744 | 8764 | } |
8765 | } | |
8766 | ||
b05a1c8b DS |
8767 | if (use_json) |
8768 | { | |
8769 | json_object_object_add(json, "peers", json_peers); | |
14151a32 | 8770 | |
62d6dca0 DS |
8771 | json_object_int_add(json, "totalPeers", count); |
8772 | json_object_int_add(json, "dynamicPeers", dn_count); | |
14151a32 | 8773 | |
b05a1c8b | 8774 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); |
f1aa5d8a | 8775 | json_object_free(json); |
b05a1c8b DS |
8776 | } |
8777 | else | |
f14e6fdb | 8778 | { |
b05a1c8b DS |
8779 | if (count) |
8780 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
8781 | count, VTY_NEWLINE); | |
8782 | else | |
8783 | vty_out (vty, "No %s neighbor is configured%s", | |
8784 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
8785 | ||
8786 | if (dn_count) | |
8787 | { | |
8788 | vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE); | |
8789 | vty_out(vty, | |
8790 | "%d dynamic neighbor(s), limit %d%s", | |
8791 | dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
8792 | } | |
f14e6fdb DS |
8793 | } |
8794 | ||
718e3744 | 8795 | return CMD_SUCCESS; |
8796 | } | |
8797 | ||
47fc97cc DS |
8798 | static int |
8799 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
b05a1c8b | 8800 | afi_t afi, safi_t safi, u_char use_json) |
718e3744 | 8801 | { |
8802 | struct bgp *bgp; | |
8803 | ||
8804 | if (name) | |
8805 | { | |
8806 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 8807 | |
718e3744 | 8808 | if (! bgp) |
8809 | { | |
47fc97cc | 8810 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 8811 | return CMD_WARNING; |
8812 | } | |
8813 | ||
b05a1c8b | 8814 | bgp_show_summary (vty, bgp, afi, safi, use_json); |
718e3744 | 8815 | return CMD_SUCCESS; |
8816 | } | |
47fc97cc | 8817 | |
718e3744 | 8818 | bgp = bgp_get_default (); |
8819 | ||
8820 | if (bgp) | |
b05a1c8b | 8821 | bgp_show_summary (vty, bgp, afi, safi, use_json); |
47fc97cc | 8822 | |
718e3744 | 8823 | return CMD_SUCCESS; |
8824 | } | |
8825 | ||
8826 | /* `show ip bgp summary' commands. */ | |
47fc97cc | 8827 | DEFUN (show_ip_bgp_summary, |
718e3744 | 8828 | show_ip_bgp_summary_cmd, |
b05a1c8b | 8829 | "show ip bgp summary {json}", |
47fc97cc DS |
8830 | SHOW_STR |
8831 | IP_STR | |
8832 | BGP_STR | |
b05a1c8b DS |
8833 | "Summary of BGP neighbor status\n" |
8834 | "JavaScript Object Notation\n") | |
47fc97cc | 8835 | { |
b05a1c8b DS |
8836 | u_char use_json = (argv[0] != NULL); |
8837 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, use_json); | |
718e3744 | 8838 | } |
8839 | ||
8840 | DEFUN (show_ip_bgp_instance_summary, | |
8841 | show_ip_bgp_instance_summary_cmd, | |
b05a1c8b | 8842 | "show ip bgp view WORD summary {json}", |
718e3744 | 8843 | SHOW_STR |
8844 | IP_STR | |
8845 | BGP_STR | |
8846 | "BGP view\n" | |
8847 | "View name\n" | |
b05a1c8b DS |
8848 | "Summary of BGP neighbor status\n" |
8849 | "JavaScript Object Notation\n") | |
718e3744 | 8850 | { |
b05a1c8b DS |
8851 | u_char use_json = (argv[1] != NULL); |
8852 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, use_json); | |
718e3744 | 8853 | } |
8854 | ||
8855 | DEFUN (show_ip_bgp_ipv4_summary, | |
8856 | show_ip_bgp_ipv4_summary_cmd, | |
b05a1c8b | 8857 | "show ip bgp ipv4 (unicast|multicast) summary {json}", |
718e3744 | 8858 | SHOW_STR |
8859 | IP_STR | |
8860 | BGP_STR | |
8861 | "Address family\n" | |
8862 | "Address Family modifier\n" | |
8863 | "Address Family modifier\n" | |
b05a1c8b DS |
8864 | "Summary of BGP neighbor status\n" |
8865 | "JavaScript Object Notation\n") | |
718e3744 | 8866 | { |
b05a1c8b | 8867 | u_char use_json = (argv[1] != NULL); |
718e3744 | 8868 | if (strncmp (argv[0], "m", 1) == 0) |
b05a1c8b | 8869 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, use_json); |
718e3744 | 8870 | |
b05a1c8b | 8871 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, use_json); |
718e3744 | 8872 | } |
8873 | ||
95cbbd2a ML |
8874 | ALIAS (show_ip_bgp_ipv4_summary, |
8875 | show_bgp_ipv4_safi_summary_cmd, | |
b05a1c8b | 8876 | "show bgp ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8877 | SHOW_STR |
8878 | BGP_STR | |
8879 | "Address family\n" | |
8880 | "Address Family modifier\n" | |
8881 | "Address Family modifier\n" | |
8882 | "Summary of BGP neighbor status\n") | |
8883 | ||
718e3744 | 8884 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
8885 | show_ip_bgp_instance_ipv4_summary_cmd, | |
b05a1c8b | 8886 | "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}", |
718e3744 | 8887 | SHOW_STR |
8888 | IP_STR | |
8889 | BGP_STR | |
8890 | "BGP view\n" | |
8891 | "View name\n" | |
8892 | "Address family\n" | |
8893 | "Address Family modifier\n" | |
8894 | "Address Family modifier\n" | |
b05a1c8b DS |
8895 | "Summary of BGP neighbor status\n" |
8896 | "JavaScript Object Notation\n") | |
718e3744 | 8897 | { |
b05a1c8b | 8898 | u_char use_json = (argv[2] != NULL); |
718e3744 | 8899 | if (strncmp (argv[1], "m", 1) == 0) |
b05a1c8b | 8900 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, use_json); |
718e3744 | 8901 | else |
b05a1c8b | 8902 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, use_json); |
718e3744 | 8903 | } |
8904 | ||
95cbbd2a ML |
8905 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
8906 | show_bgp_instance_ipv4_safi_summary_cmd, | |
b05a1c8b | 8907 | "show bgp view WORD ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8908 | SHOW_STR |
8909 | BGP_STR | |
8910 | "BGP view\n" | |
8911 | "View name\n" | |
8912 | "Address family\n" | |
8913 | "Address Family modifier\n" | |
8914 | "Address Family modifier\n" | |
8915 | "Summary of BGP neighbor status\n") | |
8916 | ||
718e3744 | 8917 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
8918 | show_ip_bgp_vpnv4_all_summary_cmd, | |
b05a1c8b | 8919 | "show ip bgp vpnv4 all summary {json}", |
718e3744 | 8920 | SHOW_STR |
8921 | IP_STR | |
8922 | BGP_STR | |
8923 | "Display VPNv4 NLRI specific information\n" | |
8924 | "Display information about all VPNv4 NLRIs\n" | |
b05a1c8b DS |
8925 | "Summary of BGP neighbor status\n" |
8926 | "JavaScript Object Notation\n") | |
718e3744 | 8927 | { |
b05a1c8b DS |
8928 | u_char use_json = (argv[0] != NULL); |
8929 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json); | |
718e3744 | 8930 | } |
8931 | ||
8932 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
8933 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
b05a1c8b | 8934 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}", |
718e3744 | 8935 | SHOW_STR |
8936 | IP_STR | |
8937 | BGP_STR | |
8938 | "Display VPNv4 NLRI specific information\n" | |
8939 | "Display information for a route distinguisher\n" | |
8940 | "VPN Route Distinguisher\n" | |
b05a1c8b DS |
8941 | "Summary of BGP neighbor status\n" |
8942 | "JavaScript Object Notation\n") | |
718e3744 | 8943 | { |
8944 | int ret; | |
8945 | struct prefix_rd prd; | |
b05a1c8b | 8946 | u_char use_json = (argv[1] != NULL); |
718e3744 | 8947 | |
8948 | ret = str2prefix_rd (argv[0], &prd); | |
8949 | if (! ret) | |
8950 | { | |
8951 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
8952 | return CMD_WARNING; | |
8953 | } | |
8954 | ||
b05a1c8b | 8955 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json); |
718e3744 | 8956 | } |
8957 | ||
8958 | #ifdef HAVE_IPV6 | |
47fc97cc | 8959 | DEFUN (show_bgp_summary, |
718e3744 | 8960 | show_bgp_summary_cmd, |
b05a1c8b | 8961 | "show bgp summary {json}", |
718e3744 | 8962 | SHOW_STR |
8963 | BGP_STR | |
b05a1c8b DS |
8964 | "Summary of BGP neighbor status\n" |
8965 | "JavaScript Object Notation\n") | |
718e3744 | 8966 | { |
b05a1c8b DS |
8967 | u_char use_json = (argv[0] != NULL); |
8968 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json); | |
718e3744 | 8969 | } |
8970 | ||
8971 | DEFUN (show_bgp_instance_summary, | |
8972 | show_bgp_instance_summary_cmd, | |
b05a1c8b | 8973 | "show bgp view WORD summary {json}", |
718e3744 | 8974 | SHOW_STR |
8975 | BGP_STR | |
8976 | "BGP view\n" | |
8977 | "View name\n" | |
b05a1c8b DS |
8978 | "Summary of BGP neighbor status\n" |
8979 | "JavaScript Object Notation\n") | |
718e3744 | 8980 | { |
b05a1c8b DS |
8981 | u_char use_json = (argv[1] != NULL); |
8982 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, use_json); | |
718e3744 | 8983 | } |
8984 | ||
8985 | ALIAS (show_bgp_summary, | |
8986 | show_bgp_ipv6_summary_cmd, | |
b05a1c8b | 8987 | "show bgp ipv6 summary {json}", |
718e3744 | 8988 | SHOW_STR |
8989 | BGP_STR | |
8990 | "Address family\n" | |
8991 | "Summary of BGP neighbor status\n") | |
8992 | ||
8993 | ALIAS (show_bgp_instance_summary, | |
8994 | show_bgp_instance_ipv6_summary_cmd, | |
b05a1c8b | 8995 | "show bgp view WORD ipv6 summary {json}", |
718e3744 | 8996 | SHOW_STR |
8997 | BGP_STR | |
8998 | "BGP view\n" | |
8999 | "View name\n" | |
9000 | "Address family\n" | |
9001 | "Summary of BGP neighbor status\n") | |
9002 | ||
95cbbd2a ML |
9003 | DEFUN (show_bgp_ipv6_safi_summary, |
9004 | show_bgp_ipv6_safi_summary_cmd, | |
b05a1c8b | 9005 | "show bgp ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
9006 | SHOW_STR |
9007 | BGP_STR | |
9008 | "Address family\n" | |
9009 | "Address Family modifier\n" | |
9010 | "Address Family modifier\n" | |
b05a1c8b DS |
9011 | "Summary of BGP neighbor status\n" |
9012 | "JavaScript Object Notation\n") | |
95cbbd2a | 9013 | { |
b05a1c8b | 9014 | u_char use_json = (argv[1] != NULL); |
95cbbd2a | 9015 | if (strncmp (argv[0], "m", 1) == 0) |
b05a1c8b | 9016 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, use_json); |
95cbbd2a | 9017 | |
b05a1c8b | 9018 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json); |
95cbbd2a ML |
9019 | } |
9020 | ||
9021 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
9022 | show_bgp_instance_ipv6_safi_summary_cmd, | |
b05a1c8b | 9023 | "show bgp view WORD ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
9024 | SHOW_STR |
9025 | BGP_STR | |
9026 | "BGP view\n" | |
9027 | "View name\n" | |
9028 | "Address family\n" | |
9029 | "Address Family modifier\n" | |
9030 | "Address Family modifier\n" | |
b05a1c8b DS |
9031 | "Summary of BGP neighbor status\n" |
9032 | "JavaScript Object Notation\n") | |
95cbbd2a | 9033 | { |
b05a1c8b | 9034 | u_char use_json = (argv[2] != NULL); |
95cbbd2a | 9035 | if (strncmp (argv[1], "m", 1) == 0) |
b05a1c8b | 9036 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST, use_json); |
95cbbd2a | 9037 | |
b05a1c8b | 9038 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, use_json); |
95cbbd2a ML |
9039 | } |
9040 | ||
718e3744 | 9041 | /* old command */ |
9042 | DEFUN (show_ipv6_bgp_summary, | |
9043 | show_ipv6_bgp_summary_cmd, | |
b05a1c8b | 9044 | "show ipv6 bgp summary {json}", |
718e3744 | 9045 | SHOW_STR |
9046 | IPV6_STR | |
9047 | BGP_STR | |
b05a1c8b DS |
9048 | "Summary of BGP neighbor status\n" |
9049 | "JavaScript Object Notation\n") | |
718e3744 | 9050 | { |
b05a1c8b DS |
9051 | u_char use_json = (argv[0] != NULL); |
9052 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json); | |
718e3744 | 9053 | } |
9054 | ||
9055 | /* old command */ | |
9056 | DEFUN (show_ipv6_mbgp_summary, | |
9057 | show_ipv6_mbgp_summary_cmd, | |
b05a1c8b | 9058 | "show ipv6 mbgp summary {json}", |
718e3744 | 9059 | SHOW_STR |
9060 | IPV6_STR | |
9061 | MBGP_STR | |
b05a1c8b DS |
9062 | "Summary of BGP neighbor status\n" |
9063 | "JavaScript Object Notation\n") | |
718e3744 | 9064 | { |
b05a1c8b DS |
9065 | u_char use_json = (argv[0] != NULL); |
9066 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, use_json); | |
718e3744 | 9067 | } |
9068 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 9069 | |
fd79ac91 | 9070 | const char * |
538621f2 | 9071 | afi_safi_print (afi_t afi, safi_t safi) |
9072 | { | |
9073 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
9074 | return "IPv4 Unicast"; | |
9075 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
9076 | return "IPv4 Multicast"; | |
9077 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
9078 | return "VPNv4 Unicast"; | |
9079 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) | |
9080 | return "IPv6 Unicast"; | |
9081 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
9082 | return "IPv6 Multicast"; | |
9083 | else | |
9084 | return "Unknown"; | |
9085 | } | |
9086 | ||
718e3744 | 9087 | /* Show BGP peer's information. */ |
9088 | enum show_type | |
9089 | { | |
9090 | show_all, | |
9091 | show_peer | |
9092 | }; | |
9093 | ||
94f2b392 | 9094 | static void |
856ca177 MS |
9095 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
9096 | u_int16_t adv_smcap, u_int16_t adv_rmcap, u_int16_t rcv_smcap, | |
9097 | u_int16_t rcv_rmcap, u_char use_json, json_object *json_pref) | |
718e3744 | 9098 | { |
9099 | /* Send-Mode */ | |
9100 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
9101 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
9102 | { | |
856ca177 MS |
9103 | if (use_json) |
9104 | { | |
9105 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
9106 | json_object_string_add(json_pref, "sendMode", "advertisedAndReceived"); | |
9107 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
9108 | json_object_string_add(json_pref, "sendMode", "advertised"); | |
9109 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
9110 | json_object_string_add(json_pref, "sendMode", "received"); | |
9111 | } | |
9112 | else | |
9113 | { | |
9114 | vty_out (vty, " Send-mode: "); | |
9115 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
9116 | vty_out (vty, "advertised"); | |
9117 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
9118 | vty_out (vty, "%sreceived", | |
9119 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
9120 | ", " : ""); | |
9121 | vty_out (vty, "%s", VTY_NEWLINE); | |
9122 | } | |
718e3744 | 9123 | } |
9124 | ||
9125 | /* Receive-Mode */ | |
9126 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
9127 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
9128 | { | |
856ca177 MS |
9129 | if (use_json) |
9130 | { | |
9131 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) && CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
9132 | json_object_string_add(json_pref, "recvMode", "advertisedAndReceived"); | |
9133 | else if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
9134 | json_object_string_add(json_pref, "recvMode", "advertised"); | |
9135 | else if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
9136 | json_object_string_add(json_pref, "recvMode", "received"); | |
9137 | } | |
9138 | else | |
9139 | { | |
9140 | vty_out (vty, " Receive-mode: "); | |
9141 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
9142 | vty_out (vty, "advertised"); | |
9143 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
9144 | vty_out (vty, "%sreceived", | |
9145 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
9146 | ", " : ""); | |
9147 | vty_out (vty, "%s", VTY_NEWLINE); | |
9148 | } | |
718e3744 | 9149 | } |
9150 | } | |
9151 | ||
94f2b392 | 9152 | static void |
856ca177 MS |
9153 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi, |
9154 | u_char use_json, json_object *json_neigh) | |
718e3744 | 9155 | { |
9156 | struct bgp_filter *filter; | |
3f9c7369 | 9157 | struct peer_af *paf; |
718e3744 | 9158 | char orf_pfx_name[BUFSIZ]; |
9159 | int orf_pfx_count; | |
856ca177 MS |
9160 | json_object *json_af = NULL; |
9161 | json_object *json_prefA = NULL; | |
9162 | json_object *json_prefB = NULL; | |
9163 | json_object *json_addr = NULL; | |
718e3744 | 9164 | |
856ca177 MS |
9165 | if (use_json) |
9166 | { | |
9167 | json_addr = json_object_new_object(); | |
9168 | json_af = json_object_new_object(); | |
9169 | json_prefA = json_object_new_object(); | |
9170 | json_prefB = json_object_new_object(); | |
9171 | filter = &p->filter[afi][safi]; | |
718e3744 | 9172 | |
856ca177 MS |
9173 | if (p->af_group[afi][safi]) |
9174 | json_object_string_add(json_addr, "peerGroupMember", p->group->name); | |
538621f2 | 9175 | |
856ca177 MS |
9176 | paf = peer_af_find(p, afi, safi); |
9177 | if (paf && PAF_SUBGRP(paf)) | |
9178 | { | |
9179 | json_object_int_add(json_addr, "updateGroupId", PAF_UPDGRP(paf)->id); | |
9180 | json_object_int_add(json_addr, "subGroupId", PAF_SUBGRP(paf)->id); | |
9181 | json_object_int_add(json_addr, "packetQueueLength", bpacket_queue_virtual_length(paf)); | |
9182 | } | |
9183 | ||
9184 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9185 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
9186 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9187 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
9188 | { | |
9189 | json_object_int_add(json_af, "orfType", ORF_TYPE_PREFIX); | |
9190 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
9191 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
9192 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
9193 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
9194 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, json_prefA); | |
9195 | json_object_object_add(json_af, "orfPrefixList", json_prefA); | |
9196 | } | |
9197 | ||
9198 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9199 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
9200 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9201 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
9202 | { | |
9203 | json_object_int_add(json_af, "orfOldType", ORF_TYPE_PREFIX_OLD); | |
9204 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
9205 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
9206 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
9207 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
9208 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, json_prefB); | |
9209 | json_object_object_add(json_af, "orfOldPrefixList", json_prefB); | |
9210 | } | |
9211 | ||
9212 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9213 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
9214 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
9215 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9216 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
9217 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
9218 | json_object_object_add(json_addr, "afDependentCap", json_af); | |
9219 | ||
9220 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
9221 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
9222 | ||
9223 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
9224 | || orf_pfx_count) | |
9225 | { | |
9226 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
9227 | json_object_boolean_true_add(json_neigh, "orfSent"); | |
9228 | if (orf_pfx_count) | |
9229 | json_object_int_add(json_addr, "orfRecvCounter", orf_pfx_count); | |
9230 | } | |
9231 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
9232 | json_object_string_add(json_addr, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd"); | |
9233 | ||
9234 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
9235 | json_object_boolean_true_add(json_addr, "routeReflectorClient"); | |
9236 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
9237 | json_object_boolean_true_add(json_addr, "routeServerClient"); | |
9238 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
9239 | json_object_boolean_true_add(json_addr, "inboundSoftConfigPermit"); | |
9240 | ||
88b8ed8d DW |
9241 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
9242 | json_object_boolean_true_add(json_addr, "privateAsNumsAllReplacedInUpdatesToNbr"); | |
9243 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 9244 | json_object_boolean_true_add(json_addr, "privateAsNumsReplacedInUpdatesToNbr"); |
88b8ed8d DW |
9245 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
9246 | json_object_boolean_true_add(json_addr, "privateAsNumsAllRemovedInUpdatesToNbr"); | |
856ca177 MS |
9247 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
9248 | json_object_boolean_true_add(json_addr, "privateAsNumsRemovedInUpdatesToNbr"); | |
9249 | ||
9250 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) | |
9251 | json_object_string_add(json_addr, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs"); | |
9252 | ||
9253 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
9254 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
9255 | json_object_boolean_true_add(json_addr, "routerAlwaysNextHop"); | |
9256 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
9257 | json_object_boolean_true_add(json_addr, "unchangedAsPathPropogatedToNbr"); | |
9258 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
9259 | json_object_boolean_true_add(json_addr, "unchangedNextHopPropogatedToNbr"); | |
9260 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
9261 | json_object_boolean_true_add(json_addr, "unchangedMedPropogatedToNbr"); | |
718e3744 | 9262 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) |
856ca177 MS |
9263 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
9264 | { | |
9265 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
9266 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9267 | json_object_string_add(json_addr, "commAttriSentToNbr", "extendedAndStandard"); | |
9268 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9269 | json_object_string_add(json_addr, "commAttriSentToNbr", "extended"); | |
9270 | else | |
9271 | json_object_string_add(json_addr, "commAttriSentToNbr", "standard"); | |
9272 | } | |
9273 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
9274 | { | |
9275 | if (p->default_rmap[afi][safi].name) | |
9276 | json_object_string_add(json_addr, "defaultRouteMap", p->default_rmap[afi][safi].name); | |
9277 | ||
9278 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
9279 | json_object_boolean_true_add(json_addr, "defaultSent"); | |
9280 | else | |
9281 | json_object_boolean_true_add(json_addr, "defaultNotSent"); | |
9282 | } | |
9283 | ||
9284 | if (filter->plist[FILTER_IN].name | |
9285 | || filter->dlist[FILTER_IN].name | |
9286 | || filter->aslist[FILTER_IN].name | |
9287 | || filter->map[RMAP_IN].name) | |
9288 | json_object_boolean_true_add(json_addr, "inboundPathPolicyConfig"); | |
9289 | if (filter->plist[FILTER_OUT].name | |
9290 | || filter->dlist[FILTER_OUT].name | |
9291 | || filter->aslist[FILTER_OUT].name | |
9292 | || filter->map[RMAP_OUT].name | |
9293 | || filter->usmap.name) | |
9294 | json_object_boolean_true_add(json_addr, "outboundPathPolicyConfig"); | |
9295 | if (filter->map[RMAP_IMPORT].name) | |
9296 | json_object_boolean_true_add(json_addr, "importPolicyRsClientConfig"); | |
9297 | if (filter->map[RMAP_EXPORT].name) | |
9298 | json_object_boolean_true_add(json_addr, "exportPolicyRsClientConfig"); | |
9299 | ||
9300 | /* prefix-list */ | |
9301 | if (filter->plist[FILTER_IN].name) | |
9302 | json_object_string_add(json_addr, "incomingUpdatePrefixFilterList", filter->plist[FILTER_IN].name); | |
9303 | if (filter->plist[FILTER_OUT].name) | |
9304 | json_object_string_add(json_addr, "outgoingUpdatePrefixFilterList", filter->plist[FILTER_OUT].name); | |
9305 | ||
9306 | /* distribute-list */ | |
9307 | if (filter->dlist[FILTER_IN].name) | |
9308 | json_object_string_add(json_addr, "incomingUpdateNetworkFilterList", filter->dlist[FILTER_IN].name); | |
9309 | if (filter->dlist[FILTER_OUT].name) | |
9310 | json_object_string_add(json_addr, "outgoingUpdateNetworkFilterList", filter->dlist[FILTER_OUT].name); | |
9311 | ||
9312 | /* filter-list. */ | |
9313 | if (filter->aslist[FILTER_IN].name) | |
9314 | json_object_string_add(json_addr, "incomingUpdateAsPathFilterList", filter->aslist[FILTER_IN].name); | |
9315 | if (filter->aslist[FILTER_OUT].name) | |
9316 | json_object_string_add(json_addr, "outgoingUpdateAsPathFilterList", filter->aslist[FILTER_OUT].name); | |
9317 | ||
9318 | /* route-map. */ | |
9319 | if (filter->map[RMAP_IN].name) | |
9320 | json_object_string_add(json_addr, "routeMapForIncomingAdvertisements", filter->map[RMAP_IN].name); | |
9321 | if (filter->map[RMAP_OUT].name) | |
9322 | json_object_string_add(json_addr, "routeMapForOutgoingAdvertisements", filter->map[RMAP_OUT].name); | |
9323 | if (filter->map[RMAP_IMPORT].name) | |
9324 | json_object_string_add(json_addr, "routeMapForAdvertisementsIntoRsClient", filter->map[RMAP_IMPORT].name); | |
9325 | if (filter->map[RMAP_EXPORT].name) | |
9326 | json_object_string_add(json_addr, "routeMapForAdvertisementsFromRsClient", filter->map[RMAP_EXPORT].name); | |
9327 | ||
9328 | /* unsuppress-map */ | |
9329 | if (filter->usmap.name) | |
9330 | json_object_string_add(json_addr, "selectiveUnsuppressRouteMap", filter->usmap.name); | |
9331 | ||
9332 | /* Receive prefix count */ | |
9333 | json_object_int_add(json_addr, "acceptedPrefixCounter", p->pcount[afi][safi]); | |
9334 | ||
9335 | /* Maximum prefix */ | |
9336 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
9337 | { | |
9338 | json_object_int_add(json_addr, "prefixAllowedMax", p->pmax[afi][safi]); | |
9339 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) | |
9340 | json_object_boolean_true_add(json_addr, "prefixAllowedMaxWarning"); | |
9341 | json_object_int_add(json_addr, "prefixAllowedWarningThresh", p->pmax_threshold[afi][safi]); | |
9342 | if (p->pmax_restart[afi][safi]) | |
9343 | json_object_int_add(json_addr, "prefixAllowedRestartIntervalMsecs", p->pmax_restart[afi][safi] * 60000); | |
9344 | } | |
9345 | json_object_object_add(json_neigh, afi_safi_print (afi, safi), json_addr); | |
9346 | ||
9347 | } | |
9348 | else | |
9349 | { | |
9350 | filter = &p->filter[afi][safi]; | |
9351 | ||
9352 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), | |
9353 | VTY_NEWLINE); | |
9354 | ||
9355 | if (p->af_group[afi][safi]) | |
9356 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); | |
9357 | ||
9358 | paf = peer_af_find(p, afi, safi); | |
9359 | if (paf && PAF_SUBGRP(paf)) | |
9360 | { | |
9361 | vty_out (vty, " Update group %" PRIu64 ", subgroup %" PRIu64 "%s", | |
9362 | PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE); | |
9363 | vty_out (vty, " Packet Queue length %d%s", | |
9364 | bpacket_queue_virtual_length(paf), VTY_NEWLINE); | |
9365 | } | |
718e3744 | 9366 | else |
856ca177 MS |
9367 | { |
9368 | vty_out(vty, " Not part of any update group%s", VTY_NEWLINE); | |
9369 | } | |
9370 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9371 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
9372 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
9373 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9374 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
9375 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
9376 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
9377 | ||
9378 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9379 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
9380 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9381 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
9382 | { | |
9383 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
9384 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
9385 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
9386 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
9387 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
9388 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
9389 | PEER_CAP_ORF_PREFIX_RM_RCV, use_json, NULL); | |
9390 | } | |
9391 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9392 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
9393 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9394 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
9395 | { | |
9396 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
9397 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
9398 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
9399 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
9400 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
9401 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
9402 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV, use_json, NULL); | |
9403 | } | |
718e3744 | 9404 | |
856ca177 MS |
9405 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); |
9406 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name, use_json); | |
718e3744 | 9407 | |
856ca177 MS |
9408 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) |
9409 | || orf_pfx_count) | |
9410 | { | |
9411 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
9412 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
9413 | vty_out (vty, " sent;"); | |
9414 | if (orf_pfx_count) | |
9415 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
9416 | vty_out (vty, "%s", VTY_NEWLINE); | |
9417 | } | |
9418 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
9419 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
9420 | ||
9421 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
9422 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
9423 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
9424 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
9425 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
9426 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
9427 | ||
88b8ed8d DW |
9428 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE)) |
9429 | vty_out (vty, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE); | |
9430 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) | |
856ca177 | 9431 | vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE); |
88b8ed8d DW |
9432 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_ALL)) |
9433 | vty_out (vty, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE); | |
856ca177 MS |
9434 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) |
9435 | vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE); | |
9436 | ||
9437 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) | |
9438 | vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE); | |
9439 | ||
9440 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || | |
9441 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_FORCE_NEXTHOP_SELF)) | |
9442 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); | |
9443 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
9444 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
9445 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
9446 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
9447 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
9448 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
9449 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
9450 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9451 | { | |
9452 | vty_out (vty, " Community attribute sent to this neighbor"); | |
9453 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
9454 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9455 | vty_out (vty, "(both)%s", VTY_NEWLINE); | |
9456 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9457 | vty_out (vty, "(extended)%s", VTY_NEWLINE); | |
9458 | else | |
9459 | vty_out (vty, "(standard)%s", VTY_NEWLINE); | |
9460 | } | |
9461 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
9462 | { | |
9463 | vty_out (vty, " Default information originate,"); | |
9464 | ||
9465 | if (p->default_rmap[afi][safi].name) | |
9466 | vty_out (vty, " default route-map %s%s,", | |
9467 | p->default_rmap[afi][safi].map ? "*" : "", | |
9468 | p->default_rmap[afi][safi].name); | |
9469 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
9470 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
9471 | else | |
9472 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
9473 | } | |
718e3744 | 9474 | |
856ca177 MS |
9475 | if (filter->plist[FILTER_IN].name |
9476 | || filter->dlist[FILTER_IN].name | |
9477 | || filter->aslist[FILTER_IN].name | |
9478 | || filter->map[RMAP_IN].name) | |
9479 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); | |
9480 | if (filter->plist[FILTER_OUT].name | |
9481 | || filter->dlist[FILTER_OUT].name | |
9482 | || filter->aslist[FILTER_OUT].name | |
9483 | || filter->map[RMAP_OUT].name | |
9484 | || filter->usmap.name) | |
9485 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
9486 | if (filter->map[RMAP_IMPORT].name) | |
9487 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); | |
9488 | if (filter->map[RMAP_EXPORT].name) | |
9489 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); | |
9490 | ||
9491 | /* prefix-list */ | |
9492 | if (filter->plist[FILTER_IN].name) | |
9493 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
9494 | filter->plist[FILTER_IN].plist ? "*" : "", | |
9495 | filter->plist[FILTER_IN].name, | |
9496 | VTY_NEWLINE); | |
9497 | if (filter->plist[FILTER_OUT].name) | |
9498 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
9499 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
9500 | filter->plist[FILTER_OUT].name, | |
9501 | VTY_NEWLINE); | |
9502 | ||
9503 | /* distribute-list */ | |
9504 | if (filter->dlist[FILTER_IN].name) | |
9505 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
9506 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
9507 | filter->dlist[FILTER_IN].name, | |
9508 | VTY_NEWLINE); | |
9509 | if (filter->dlist[FILTER_OUT].name) | |
9510 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
9511 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
9512 | filter->dlist[FILTER_OUT].name, | |
9513 | VTY_NEWLINE); | |
9514 | ||
9515 | /* filter-list. */ | |
9516 | if (filter->aslist[FILTER_IN].name) | |
9517 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
9518 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
9519 | filter->aslist[FILTER_IN].name, | |
9520 | VTY_NEWLINE); | |
9521 | if (filter->aslist[FILTER_OUT].name) | |
9522 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
9523 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
9524 | filter->aslist[FILTER_OUT].name, | |
9525 | VTY_NEWLINE); | |
9526 | ||
9527 | /* route-map. */ | |
9528 | if (filter->map[RMAP_IN].name) | |
9529 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", | |
9530 | filter->map[RMAP_IN].map ? "*" : "", | |
9531 | filter->map[RMAP_IN].name, | |
9532 | VTY_NEWLINE); | |
9533 | if (filter->map[RMAP_OUT].name) | |
9534 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", | |
9535 | filter->map[RMAP_OUT].map ? "*" : "", | |
9536 | filter->map[RMAP_OUT].name, | |
9537 | VTY_NEWLINE); | |
9538 | if (filter->map[RMAP_IMPORT].name) | |
9539 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", | |
9540 | filter->map[RMAP_IMPORT].map ? "*" : "", | |
9541 | filter->map[RMAP_IMPORT].name, | |
9542 | VTY_NEWLINE); | |
9543 | if (filter->map[RMAP_EXPORT].name) | |
9544 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", | |
9545 | filter->map[RMAP_EXPORT].map ? "*" : "", | |
9546 | filter->map[RMAP_EXPORT].name, | |
9547 | VTY_NEWLINE); | |
9548 | ||
9549 | /* unsuppress-map */ | |
9550 | if (filter->usmap.name) | |
9551 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
9552 | filter->usmap.map ? "*" : "", | |
9553 | filter->usmap.name, VTY_NEWLINE); | |
9554 | ||
9555 | /* Receive prefix count */ | |
9556 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); | |
9557 | ||
9558 | /* Maximum prefix */ | |
9559 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
9560 | { | |
9561 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], | |
9562 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) | |
9563 | ? " (warning-only)" : "", VTY_NEWLINE); | |
9564 | vty_out (vty, " Threshold for warning message %d%%", | |
9565 | p->pmax_threshold[afi][safi]); | |
9566 | if (p->pmax_restart[afi][safi]) | |
9567 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
9568 | vty_out (vty, "%s", VTY_NEWLINE); | |
9569 | } | |
718e3744 | 9570 | |
0a486e5f | 9571 | vty_out (vty, "%s", VTY_NEWLINE); |
718e3744 | 9572 | } |
718e3744 | 9573 | } |
9574 | ||
94f2b392 | 9575 | static void |
856ca177 | 9576 | bgp_show_peer (struct vty *vty, struct peer *p, u_char use_json, json_object *json, json_object *json_neigh) |
718e3744 | 9577 | { |
9578 | struct bgp *bgp; | |
a80beece | 9579 | char buf1[BUFSIZ], buf[SU_ADDRSTRLEN]; |
718e3744 | 9580 | char timebuf[BGP_UPTIME_LEN]; |
f14e6fdb | 9581 | char dn_flag[2]; |
3a8c7ba1 DW |
9582 | const char *subcode_str; |
9583 | const char *code_str; | |
538621f2 | 9584 | afi_t afi; |
9585 | safi_t safi; | |
d6661008 DS |
9586 | u_int16_t i; |
9587 | u_char *msg; | |
718e3744 | 9588 | |
9589 | bgp = p->bgp; | |
9590 | ||
856ca177 | 9591 | if (!use_json) |
f14e6fdb | 9592 | { |
856ca177 MS |
9593 | if (p->conf_if) /* Configured interface name. */ |
9594 | vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if, | |
9595 | BGP_PEER_SU_UNSPEC(p) ? "None" : | |
9596 | sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
9597 | else /* Configured IP address. */ | |
9598 | { | |
9599 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
9600 | if (peer_dynamic_neighbor(p)) | |
9601 | dn_flag[0] = '*'; | |
f14e6fdb | 9602 | |
856ca177 MS |
9603 | vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host); |
9604 | } | |
f14e6fdb DS |
9605 | } |
9606 | ||
856ca177 MS |
9607 | if (use_json) |
9608 | { | |
9609 | if (p->conf_if && BGP_PEER_SU_UNSPEC(p)) | |
9610 | json_object_string_add(json_neigh, "bgpNeighborAddr", "none"); | |
9611 | else if (p->conf_if && !BGP_PEER_SU_UNSPEC(p)) | |
9612 | json_object_string_add(json_neigh, "bgpNeighborAddr", sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
9613 | ||
9614 | json_object_int_add(json_neigh, "remoteAs", p->as); | |
9615 | ||
9616 | if (p->change_local_as) | |
9617 | json_object_int_add(json_neigh, "localAs", p->change_local_as); | |
9618 | else | |
9619 | json_object_int_add(json_neigh, "localAs", p->local_as); | |
9620 | ||
9621 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND)) | |
9622 | json_object_boolean_true_add(json_neigh, "localAsNoPrepend"); | |
66b199b2 | 9623 | |
856ca177 MS |
9624 | if (CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS)) |
9625 | json_object_boolean_true_add(json_neigh, "localAsReplaceAs"); | |
9626 | } | |
9627 | else | |
9628 | { | |
f8cfafda DS |
9629 | if ((p->as_type == AS_SPECIFIED) || |
9630 | (p->as_type == AS_EXTERNAL) || | |
9631 | (p->as_type == AS_INTERNAL)) | |
9632 | vty_out (vty, "remote AS %u, ", p->as); | |
9633 | else | |
9634 | vty_out (vty, "remote AS Unspecified, "); | |
856ca177 MS |
9635 | vty_out (vty, "local AS %u%s%s, ", |
9636 | p->change_local_as ? p->change_local_as : p->local_as, | |
9637 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
9638 | " no-prepend" : "", | |
9639 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
9640 | " replace-as" : ""); | |
9641 | } | |
66b199b2 DS |
9642 | /* peer type internal, external, confed-internal or confed-external */ |
9643 | if (p->as == p->local_as) | |
9644 | { | |
856ca177 MS |
9645 | if (use_json) |
9646 | { | |
9647 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
9648 | json_object_boolean_true_add(json_neigh, "nbrConfedInternalLink"); | |
9649 | else | |
9650 | json_object_boolean_true_add(json_neigh, "nbrInternalLink"); | |
9651 | } | |
66b199b2 | 9652 | else |
856ca177 MS |
9653 | { |
9654 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
9655 | vty_out (vty, "confed-internal link%s", VTY_NEWLINE); | |
9656 | else | |
9657 | vty_out (vty, "internal link%s", VTY_NEWLINE); | |
9658 | } | |
66b199b2 DS |
9659 | } |
9660 | else | |
9661 | { | |
856ca177 MS |
9662 | if (use_json) |
9663 | { | |
9664 | if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)) | |
9665 | json_object_boolean_true_add(json_neigh, "nbrConfedExternalLink"); | |
9666 | else | |
9667 | json_object_boolean_true_add(json_neigh, "nbrExternalLink"); | |
9668 | } | |
66b199b2 | 9669 | else |
856ca177 MS |
9670 | { |
9671 | if (bgp_confederation_peers_check(bgp, p->as)) | |
9672 | vty_out (vty, "confed-external link%s", VTY_NEWLINE); | |
9673 | else | |
9674 | vty_out (vty, "external link%s", VTY_NEWLINE); | |
9675 | } | |
66b199b2 | 9676 | } |
718e3744 | 9677 | |
9678 | /* Description. */ | |
9679 | if (p->desc) | |
856ca177 MS |
9680 | { |
9681 | if (use_json) | |
9682 | json_object_string_add(json_neigh, "nbrDesc", p->desc); | |
9683 | else | |
9684 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
9685 | } | |
6410e93a | 9686 | |
04b6bdc0 DW |
9687 | if (p->hostname) |
9688 | { | |
9689 | if (p->domainname && (p->domainname[0] != '\0')) | |
9690 | vty_out(vty, "Hostname: %s.%s%s", p->hostname, p->domainname, | |
9691 | VTY_NEWLINE); | |
9692 | else | |
9693 | vty_out(vty, "Hostname: %s%s", p->hostname, VTY_NEWLINE); | |
9694 | } | |
9695 | ||
c744aa9f | 9696 | /* Peer-group */ |
718e3744 | 9697 | if (p->group) |
f14e6fdb | 9698 | { |
856ca177 MS |
9699 | if (use_json) |
9700 | { | |
9701 | json_object_string_add(json_neigh, "peerGroup", p->group->name); | |
9702 | ||
9703 | if (dn_flag[0]) | |
9704 | { | |
9705 | struct prefix *prefix = NULL, *range = NULL; | |
f14e6fdb | 9706 | |
856ca177 MS |
9707 | prefix = sockunion2hostprefix(&(p->su)); |
9708 | if (prefix) | |
9709 | range = peer_group_lookup_dynamic_neighbor_range (p->group, prefix); | |
9710 | ||
9711 | if (range) | |
9712 | { | |
9713 | prefix2str(range, buf1, sizeof(buf1)); | |
9714 | json_object_string_add(json_neigh, "peerSubnetRangeGroup", buf1); | |
9715 | } | |
9716 | } | |
9717 | } | |
9718 | else | |
f14e6fdb | 9719 | { |
856ca177 MS |
9720 | vty_out (vty, " Member of peer-group %s for session parameters%s", |
9721 | p->group->name, VTY_NEWLINE); | |
f14e6fdb | 9722 | |
856ca177 | 9723 | if (dn_flag[0]) |
f14e6fdb | 9724 | { |
856ca177 MS |
9725 | struct prefix *prefix = NULL, *range = NULL; |
9726 | ||
9727 | prefix = sockunion2hostprefix(&(p->su)); | |
9728 | if (prefix) | |
9729 | range = peer_group_lookup_dynamic_neighbor_range (p->group, prefix); | |
9730 | ||
9731 | if (range) | |
9732 | { | |
9733 | prefix2str(range, buf1, sizeof(buf1)); | |
9734 | vty_out (vty, " Belongs to the subnet range group: %s%s", buf1, VTY_NEWLINE); | |
9735 | } | |
f14e6fdb DS |
9736 | } |
9737 | } | |
9738 | } | |
718e3744 | 9739 | |
856ca177 MS |
9740 | if (use_json) |
9741 | { | |
9742 | /* Administrative shutdown. */ | |
9743 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
9744 | json_object_boolean_true_add(json_neigh, "adminShutDown"); | |
718e3744 | 9745 | |
856ca177 MS |
9746 | /* BGP Version. */ |
9747 | json_object_int_add(json_neigh, "bgpVersion", 4); | |
9748 | json_object_string_add(json_neigh, "remoteRouterId", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ)); | |
718e3744 | 9749 | |
856ca177 MS |
9750 | /* Confederation */ |
9751 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) && bgp_confederation_peers_check (bgp, p->as)) | |
9752 | json_object_boolean_true_add(json_neigh, "nbrCommonAdmin"); | |
9753 | ||
9754 | /* Status. */ | |
9755 | json_object_string_add(json_neigh, "bgpState", LOOKUP (bgp_status_msg, p->status)); | |
9756 | ||
9757 | if (p->status == Established) | |
9758 | { | |
9759 | time_t uptime; | |
9760 | struct tm *tm; | |
9761 | ||
9762 | uptime = bgp_clock(); | |
9763 | uptime -= p->uptime; | |
9764 | tm = gmtime(&uptime); | |
9765 | ||
9766 | json_object_int_add(json_neigh, "bgpTimerUp", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
9767 | } | |
9768 | ||
9769 | else if (p->status == Active) | |
9770 | { | |
9771 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
9772 | json_object_string_add(json_neigh, "bgpStateIs", "passive"); | |
9773 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
9774 | json_object_string_add(json_neigh, "bgpStateIs", "passiveNSF"); | |
9775 | } | |
9776 | ||
9777 | /* read timer */ | |
9778 | time_t uptime; | |
9779 | struct tm *tm; | |
9780 | ||
9781 | uptime = bgp_clock(); | |
9782 | uptime -= p->readtime; | |
9783 | tm = gmtime(&uptime); | |
9784 | json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
9785 | ||
9786 | uptime = bgp_clock(); | |
9787 | uptime -= p->last_write; | |
9788 | tm = gmtime(&uptime); | |
9789 | json_object_int_add(json_neigh, "bgpTimerLastRead", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
9790 | ||
9791 | /* Configured timer values. */ | |
9792 | json_object_int_add(json_neigh, "bgpTimerHoldTimeMsecs", p->v_holdtime * 1000); | |
9793 | json_object_int_add(json_neigh, "bgpTimerKeepAliveIntervalMsecs", p->v_keepalive * 1000); | |
9794 | ||
9795 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
9796 | { | |
9797 | json_object_int_add(json_neigh, "bgpTimerConfiguredHoldTimeMsecs", p->holdtime * 1000); | |
9798 | json_object_int_add(json_neigh, "bgpTimerConfiguredKeepAliveIntervalMsecs", p->keepalive * 1000); | |
9799 | } | |
93406d87 | 9800 | } |
856ca177 MS |
9801 | else |
9802 | { | |
9803 | /* Administrative shutdown. */ | |
9804 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
9805 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
9806 | ||
9807 | /* BGP Version. */ | |
9808 | vty_out (vty, " BGP version 4"); | |
9809 | vty_out (vty, ", remote router ID %s%s", inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
9810 | VTY_NEWLINE); | |
9811 | ||
9812 | /* Confederation */ | |
9813 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) | |
9814 | && bgp_confederation_peers_check (bgp, p->as)) | |
9815 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); | |
718e3744 | 9816 | |
856ca177 MS |
9817 | /* Status. */ |
9818 | vty_out (vty, " BGP state = %s", LOOKUP (bgp_status_msg, p->status)); | |
718e3744 | 9819 | |
856ca177 MS |
9820 | if (p->status == Established) |
9821 | vty_out (vty, ", up for %8s", peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
9822 | ||
9823 | else if (p->status == Active) | |
9824 | { | |
9825 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
9826 | vty_out (vty, " (passive)"); | |
9827 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
9828 | vty_out (vty, " (NSF passive)"); | |
9829 | } | |
9830 | vty_out (vty, "%s", VTY_NEWLINE); | |
93406d87 | 9831 | |
856ca177 MS |
9832 | /* read timer */ |
9833 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
9834 | vty_out (vty, ", Last write %s%s", | |
9835 | peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN, 0, NULL), VTY_NEWLINE); | |
9836 | ||
9837 | /* Configured timer values. */ | |
9838 | vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s", | |
9839 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); | |
9840 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
9841 | { | |
9842 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
9843 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
9844 | p->keepalive, VTY_NEWLINE); | |
9845 | } | |
9846 | } | |
718e3744 | 9847 | /* Capability. */ |
9848 | if (p->status == Established) | |
9849 | { | |
538621f2 | 9850 | if (p->cap |
718e3744 | 9851 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
9852 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
9853 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
9854 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
9855 | #ifdef HAVE_IPV6 | |
9856 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
9857 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
9858 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
9859 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
9860 | #endif /* HAVE_IPV6 */ | |
9861 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] | |
9862 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
9863 | { | |
856ca177 MS |
9864 | if (use_json) |
9865 | { | |
9866 | json_object *json_cap = NULL; | |
9867 | ||
9868 | json_cap = json_object_new_object(); | |
9869 | ||
9870 | /* AS4 */ | |
9871 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
9872 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9873 | { | |
9874 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) && CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
9875 | json_object_string_add(json_cap, "4byteAs", "advertisedAndReceived"); | |
9876 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9877 | json_object_string_add(json_cap, "4byteAs", "advertised"); | |
9878 | else if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
9879 | json_object_string_add(json_cap, "4byteAs", "received"); | |
9880 | } | |
9881 | ||
9882 | /* AddPath */ | |
9883 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
9884 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
9885 | { | |
9886 | json_object *json_add = NULL; | |
9887 | const char *print_store; | |
718e3744 | 9888 | |
856ca177 | 9889 | json_add = json_object_new_object(); |
a82478b9 | 9890 | |
856ca177 MS |
9891 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
9892 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9893 | { | |
9894 | json_object *json_sub = NULL; | |
9895 | json_sub = json_object_new_object(); | |
9896 | print_store = afi_safi_print (afi, safi); | |
9897 | ||
9898 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
9899 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
9900 | { | |
9901 | 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)) | |
9902 | json_object_boolean_true_add(json_sub, "txAdvertisedAndReceived"); | |
9903 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) | |
9904 | json_object_boolean_true_add(json_sub, "txAdvertised"); | |
9905 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
9906 | json_object_boolean_true_add(json_sub, "txReceived"); | |
9907 | } | |
9908 | ||
9909 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
9910 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9911 | { | |
9912 | 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)) | |
9913 | json_object_boolean_true_add(json_sub, "rxAdvertisedAndReceived"); | |
9914 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) | |
9915 | json_object_boolean_true_add(json_sub, "rxAdvertised"); | |
9916 | else if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9917 | json_object_boolean_true_add(json_sub, "rxReceived"); | |
9918 | } | |
9919 | ||
9920 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
9921 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV) || | |
9922 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
9923 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9924 | json_object_object_add(json_add, print_store, json_sub); | |
9925 | } | |
a82478b9 | 9926 | |
856ca177 MS |
9927 | json_object_object_add(json_cap, "addPath", json_add); |
9928 | } | |
9929 | ||
9930 | /* Dynamic */ | |
9931 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
9932 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9933 | { | |
9934 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) && CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
9935 | json_object_string_add(json_cap, "dynamic", "advertisedAndReceived"); | |
9936 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9937 | json_object_string_add(json_cap, "dynamic", "advertised"); | |
9938 | else if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
9939 | json_object_string_add(json_cap, "dynamic", "received"); | |
9940 | } | |
9941 | ||
9942 | /* Extended nexthop */ | |
9943 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
9944 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
9945 | { | |
9946 | json_object *json_nxt = NULL; | |
9947 | const char *print_store; | |
9948 | ||
9949 | json_nxt = json_object_new_object(); | |
9950 | ||
9951 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) && CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
9952 | json_object_string_add(json_cap, "extendedNexthop", "advertisedAndReceived"); | |
9953 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
9954 | json_object_string_add(json_cap, "extendedNexthop", "advertised"); | |
9955 | else if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
9956 | json_object_string_add(json_cap, "extendedNexthop", "received"); | |
9957 | ||
9958 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
9959 | { | |
9960 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9961 | { | |
9962 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
9963 | { | |
9964 | print_store = afi_safi_print (AFI_IP, safi); | |
9965 | json_object_string_add(json_nxt, print_store, "recieved"); | |
9966 | } | |
9967 | } | |
9968 | json_object_object_add(json_cap, "extendedNexthopFamililesByPeer", json_nxt); | |
9969 | } | |
9970 | } | |
9971 | ||
9972 | /* Route Refresh */ | |
9973 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
9974 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
9975 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9976 | { | |
9977 | 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))) | |
9978 | { | |
9979 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) | |
9980 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOldNew"); | |
9981 | else | |
9982 | { | |
9983 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9984 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedOld"); | |
9985 | else | |
9986 | json_object_string_add(json_cap, "routeRefresh", "advertisedAndReceivedNew"); | |
9987 | } | |
9988 | } | |
9989 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
9990 | json_object_string_add(json_cap, "routeRefresh", "advertised"); | |
9991 | else if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9992 | json_object_string_add(json_cap, "routeRefresh", "received"); | |
9993 | } | |
9994 | ||
9995 | /* Multiprotocol Extensions */ | |
9996 | json_object *json_multi = NULL; | |
9997 | json_multi = json_object_new_object(); | |
9998 | ||
9999 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10000 | { | |
10001 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10002 | { | |
10003 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
10004 | { | |
10005 | json_object *json_exten = NULL; | |
10006 | json_exten = json_object_new_object(); | |
10007 | ||
10008 | if (p->afc_adv[afi][safi] && p->afc_recv[afi][safi]) | |
10009 | json_object_boolean_true_add(json_exten, "advertisedAndReceived"); | |
10010 | else if (p->afc_adv[afi][safi]) | |
10011 | json_object_boolean_true_add(json_exten, "advertised"); | |
10012 | else if (p->afc_recv[afi][safi]) | |
10013 | json_object_boolean_true_add(json_exten, "received"); | |
10014 | ||
10015 | json_object_object_add(json_multi, afi_safi_print (afi, safi), json_exten); | |
10016 | } | |
10017 | } | |
10018 | } | |
10019 | json_object_object_add(json_cap, "multiprotocolExtensions", json_multi); | |
10020 | ||
10021 | /* Gracefull Restart */ | |
10022 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
10023 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
10024 | { | |
10025 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) && CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
10026 | json_object_string_add(json_cap, "gracefulRestart", "advertisedAndReceived"); | |
10027 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
10028 | json_object_string_add(json_cap, "gracefulRestartCapability", "advertised"); | |
10029 | else if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
10030 | json_object_string_add(json_cap, "gracefulRestartCapability", "received"); | |
10031 | ||
10032 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
10033 | { | |
10034 | int restart_af_count = 0; | |
10035 | json_object *json_restart = NULL; | |
10036 | json_restart = json_object_new_object(); | |
10037 | ||
10038 | json_object_int_add(json_cap, "gracefulRestartRemoteTimerMsecs", p->v_gr_restart * 1000); | |
10039 | ||
10040 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10041 | { | |
10042 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10043 | { | |
10044 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
10045 | { | |
10046 | json_object *json_sub = NULL; | |
10047 | json_sub = json_object_new_object(); | |
10048 | ||
10049 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV)) | |
10050 | json_object_boolean_true_add(json_sub, "preserved"); | |
10051 | restart_af_count++; | |
10052 | json_object_object_add(json_restart, afi_safi_print (afi, safi), json_sub); | |
10053 | } | |
10054 | } | |
10055 | } | |
10056 | if (! restart_af_count) | |
10057 | json_object_string_add(json_cap, "addressFamiliesByPeer", "none"); | |
10058 | else | |
10059 | json_object_object_add(json_cap, "addressFamiliesByPeer", json_restart); | |
10060 | } | |
10061 | } | |
10062 | json_object_object_add(json_neigh, "neighborCapabilities", json_cap); | |
10063 | } | |
10064 | else | |
10065 | { | |
10066 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
10067 | ||
10068 | /* AS4 */ | |
10069 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
10070 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
10071 | { | |
10072 | vty_out (vty, " 4 Byte AS:"); | |
10073 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
10074 | vty_out (vty, " advertised"); | |
10075 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
10076 | vty_out (vty, " %sreceived", | |
10077 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
10078 | vty_out (vty, "%s", VTY_NEWLINE); | |
10079 | } | |
10080 | ||
10081 | /* AddPath */ | |
10082 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
10083 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
10084 | { | |
10085 | vty_out (vty, " AddPath:%s", VTY_NEWLINE); | |
a82478b9 | 10086 | |
856ca177 MS |
10087 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
10088 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
a82478b9 | 10089 | { |
856ca177 MS |
10090 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || |
10091 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
10092 | { | |
10093 | vty_out (vty, " %s: TX ", afi_safi_print (afi, safi)); | |
a82478b9 | 10094 | |
856ca177 MS |
10095 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) |
10096 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 10097 | |
856ca177 MS |
10098 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) |
10099 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" ); | |
a82478b9 | 10100 | |
856ca177 MS |
10101 | vty_out (vty, "%s", VTY_NEWLINE); |
10102 | } | |
a82478b9 | 10103 | |
856ca177 | 10104 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || |
a82478b9 | 10105 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
856ca177 MS |
10106 | { |
10107 | vty_out (vty, " %s: RX ", afi_safi_print (afi, safi)); | |
a82478b9 | 10108 | |
856ca177 MS |
10109 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) |
10110 | vty_out (vty, "advertised %s", afi_safi_print (afi, safi)); | |
a82478b9 | 10111 | |
856ca177 MS |
10112 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) |
10113 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" ); | |
a82478b9 | 10114 | |
856ca177 MS |
10115 | vty_out (vty, "%s", VTY_NEWLINE); |
10116 | } | |
a82478b9 | 10117 | } |
856ca177 | 10118 | } |
a82478b9 | 10119 | |
856ca177 MS |
10120 | /* Dynamic */ |
10121 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
10122 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
10123 | { | |
10124 | vty_out (vty, " Dynamic:"); | |
10125 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
10126 | vty_out (vty, " advertised"); | |
10127 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
10128 | vty_out (vty, " %sreceived", | |
10129 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
10130 | vty_out (vty, "%s", VTY_NEWLINE); | |
10131 | } | |
10132 | ||
10133 | /* Extended nexthop */ | |
10134 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV) | |
10135 | || CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
10136 | { | |
10137 | vty_out (vty, " Extended nexthop:"); | |
10138 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV)) | |
10139 | vty_out (vty, " advertised"); | |
10140 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) | |
10141 | vty_out (vty, " %sreceived", | |
10142 | CHECK_FLAG (p->cap, PEER_CAP_ENHE_ADV) ? "and " : ""); | |
10143 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 10144 | |
856ca177 MS |
10145 | if (CHECK_FLAG (p->cap, PEER_CAP_ENHE_RCV)) |
10146 | { | |
10147 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
10148 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10149 | if (CHECK_FLAG (p->af_cap[AFI_IP][safi], PEER_CAP_ENHE_AF_RCV)) | |
10150 | vty_out (vty, " %s%s", | |
10151 | afi_safi_print (AFI_IP, safi), VTY_NEWLINE); | |
10152 | } | |
10153 | } | |
8a92a8a0 | 10154 | |
856ca177 MS |
10155 | /* Route Refresh */ |
10156 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
10157 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
10158 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
10159 | { | |
10160 | vty_out (vty, " Route refresh:"); | |
10161 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
10162 | vty_out (vty, " advertised"); | |
10163 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
10164 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
10165 | vty_out (vty, " %sreceived(%s)", | |
10166 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
10167 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
10168 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
10169 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
8a92a8a0 | 10170 | |
856ca177 MS |
10171 | vty_out (vty, "%s", VTY_NEWLINE); |
10172 | } | |
718e3744 | 10173 | |
856ca177 MS |
10174 | /* Multiprotocol Extensions */ |
10175 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10176 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10177 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
10178 | { | |
10179 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); | |
10180 | if (p->afc_adv[afi][safi]) | |
10181 | vty_out (vty, " advertised"); | |
10182 | if (p->afc_recv[afi][safi]) | |
10183 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
10184 | vty_out (vty, "%s", VTY_NEWLINE); | |
10185 | } | |
538621f2 | 10186 | |
04b6bdc0 DW |
10187 | /* Hostname capability */ |
10188 | if (CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_ADV) || | |
10189 | CHECK_FLAG(p->cap, PEER_CAP_HOSTNAME_RCV)) | |
10190 | { | |
10191 | vty_out (vty, " Hostname Capability:"); | |
10192 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV)) | |
10193 | vty_out (vty, " advertised"); | |
10194 | if (CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_RCV)) | |
10195 | vty_out (vty, " %sreceived", | |
10196 | CHECK_FLAG (p->cap, PEER_CAP_HOSTNAME_ADV) ? "and " : ""); | |
10197 | vty_out (vty, "%s", VTY_NEWLINE); | |
10198 | } | |
10199 | ||
856ca177 MS |
10200 | /* Gracefull Restart */ |
10201 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
10202 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
10203 | { | |
10204 | vty_out (vty, " Graceful Restart Capabilty:"); | |
10205 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
538621f2 | 10206 | vty_out (vty, " advertised"); |
856ca177 MS |
10207 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
10208 | vty_out (vty, " %sreceived", | |
10209 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
10210 | vty_out (vty, "%s", VTY_NEWLINE); | |
538621f2 | 10211 | |
856ca177 MS |
10212 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
10213 | { | |
10214 | int restart_af_count = 0; | |
10215 | ||
10216 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
10217 | p->v_gr_restart, VTY_NEWLINE); | |
10218 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
10219 | ||
10220 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10221 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10222 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
10223 | { | |
10224 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", | |
10225 | afi_safi_print (afi, safi), | |
10226 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
10227 | "preserved" : "not preserved"); | |
10228 | restart_af_count++; | |
10229 | } | |
10230 | if (! restart_af_count) | |
10231 | vty_out (vty, "none"); | |
10232 | vty_out (vty, "%s", VTY_NEWLINE); | |
10233 | } | |
10234 | } | |
10235 | } | |
718e3744 | 10236 | } |
10237 | } | |
10238 | ||
93406d87 | 10239 | /* graceful restart information */ |
10240 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
10241 | || p->t_gr_restart | |
10242 | || p->t_gr_stale) | |
10243 | { | |
856ca177 MS |
10244 | json_object *json_grace = NULL; |
10245 | json_object *json_grace_send = NULL; | |
10246 | json_object *json_grace_recv = NULL; | |
93406d87 | 10247 | int eor_send_af_count = 0; |
10248 | int eor_receive_af_count = 0; | |
10249 | ||
856ca177 MS |
10250 | if (use_json) |
10251 | { | |
10252 | json_grace = json_object_new_object(); | |
10253 | json_grace_send = json_object_new_object(); | |
10254 | json_grace_recv = json_object_new_object(); | |
10255 | ||
10256 | if (p->status == Established) | |
10257 | { | |
10258 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10259 | { | |
10260 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10261 | { | |
10262 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
10263 | { | |
10264 | json_object_boolean_true_add(json_grace_send, afi_safi_print (afi, safi)); | |
10265 | eor_send_af_count++; | |
10266 | } | |
10267 | } | |
10268 | } | |
10269 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10270 | { | |
10271 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10272 | { | |
10273 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
10274 | { | |
10275 | json_object_boolean_true_add(json_grace_recv, afi_safi_print (afi, safi)); | |
10276 | eor_receive_af_count++; | |
10277 | } | |
10278 | } | |
10279 | } | |
10280 | } | |
10281 | ||
10282 | json_object_object_add(json_grace, "endOfRibSend", json_grace_send); | |
10283 | json_object_object_add(json_grace, "endOfRibRecv", json_grace_recv); | |
10284 | ||
10285 | if (p->t_gr_restart) | |
10286 | json_object_int_add(json_grace, "gracefulRestartTimerMsecs", thread_timer_remain_second (p->t_gr_restart) * 1000); | |
10287 | ||
10288 | if (p->t_gr_stale) | |
10289 | json_object_int_add(json_grace, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p->t_gr_stale) * 1000); | |
10290 | ||
10291 | json_object_object_add(json_neigh, "gracefulRestartInfo", json_grace); | |
10292 | } | |
10293 | else | |
10294 | { | |
10295 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
10296 | if (p->status == Established) | |
10297 | { | |
10298 | vty_out (vty, " End-of-RIB send: "); | |
10299 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10300 | { | |
10301 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10302 | { | |
10303 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
10304 | { | |
10305 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
10306 | afi_safi_print (afi, safi)); | |
10307 | eor_send_af_count++; | |
10308 | } | |
10309 | } | |
10310 | } | |
10311 | vty_out (vty, "%s", VTY_NEWLINE); | |
10312 | vty_out (vty, " End-of-RIB received: "); | |
10313 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
10314 | { | |
10315 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10316 | { | |
10317 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
10318 | { | |
10319 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
10320 | afi_safi_print (afi, safi)); | |
10321 | eor_receive_af_count++; | |
10322 | } | |
10323 | } | |
10324 | } | |
10325 | vty_out (vty, "%s", VTY_NEWLINE); | |
10326 | } | |
93406d87 | 10327 | |
856ca177 MS |
10328 | if (p->t_gr_restart) |
10329 | vty_out (vty, " The remaining time of restart timer is %ld%s", | |
10330 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
0b2aa3a0 | 10331 | |
856ca177 MS |
10332 | if (p->t_gr_stale) |
10333 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", | |
10334 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
10335 | } | |
10336 | } | |
10337 | if (use_json) | |
10338 | { | |
10339 | json_object *json_stat = NULL; | |
10340 | json_stat = json_object_new_object(); | |
10341 | /* Packet counts. */ | |
10342 | json_object_int_add(json_stat, "depthInq", 0); | |
10343 | json_object_int_add(json_stat, "depthOutq", (unsigned long) p->obuf->count); | |
10344 | json_object_int_add(json_stat, "opensSent", p->open_out); | |
10345 | json_object_int_add(json_stat, "opensRecv", p->open_in); | |
10346 | json_object_int_add(json_stat, "notificationsSent", p->notify_out); | |
10347 | json_object_int_add(json_stat, "notificationsRecv", p->notify_in); | |
10348 | json_object_int_add(json_stat, "updatesSent", p->update_out); | |
10349 | json_object_int_add(json_stat, "updatesRecv", p->update_in); | |
10350 | json_object_int_add(json_stat, "keepalivesSent", p->keepalive_out); | |
10351 | json_object_int_add(json_stat, "keepalivesRecv", p->keepalive_in); | |
10352 | json_object_int_add(json_stat, "routeRefreshSent", p->refresh_out); | |
10353 | json_object_int_add(json_stat, "routeRefreshRecv", p->refresh_in); | |
10354 | json_object_int_add(json_stat, "capabilitySent", p->dynamic_cap_out); | |
10355 | json_object_int_add(json_stat, "capabilityRecv", p->dynamic_cap_in); | |
10356 | 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); | |
10357 | 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); | |
10358 | json_object_object_add(json_neigh, "messageStats", json_stat); | |
10359 | } | |
10360 | else | |
10361 | { | |
10362 | /* Packet counts. */ | |
10363 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); | |
10364 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
10365 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); | |
10366 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); | |
10367 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
10368 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
10369 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
10370 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
10371 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
10372 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
10373 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
10374 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
10375 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
10376 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 10377 | } |
10378 | ||
856ca177 MS |
10379 | if (use_json) |
10380 | { | |
10381 | /* advertisement-interval */ | |
10382 | json_object_int_add(json_neigh, "minBtwnAdvertisementRunsTimerMsecs", p->v_routeadv * 1000); | |
718e3744 | 10383 | |
856ca177 MS |
10384 | /* Update-source. */ |
10385 | if (p->update_if || p->update_source) | |
10386 | { | |
10387 | if (p->update_if) | |
10388 | json_object_string_add(json_neigh, "updateSource", p->update_if); | |
10389 | else if (p->update_source) | |
10390 | json_object_string_add(json_neigh, "updateSource", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
10391 | } | |
10392 | ||
10393 | /* Default weight */ | |
10394 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
10395 | json_object_int_add(json_neigh, "defaultWeight", p->weight); | |
10396 | ||
10397 | } | |
10398 | else | |
10399 | { | |
10400 | /* advertisement-interval */ | |
10401 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
10402 | p->v_routeadv, VTY_NEWLINE); | |
10403 | ||
10404 | /* Update-source. */ | |
10405 | if (p->update_if || p->update_source) | |
10406 | { | |
10407 | vty_out (vty, " Update source is "); | |
10408 | if (p->update_if) | |
10409 | vty_out (vty, "%s", p->update_if); | |
10410 | else if (p->update_source) | |
10411 | vty_out (vty, "%s", sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
10412 | vty_out (vty, "%s", VTY_NEWLINE); | |
10413 | } | |
10414 | ||
10415 | /* Default weight */ | |
10416 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
10417 | vty_out (vty, " Default weight %d%s", p->weight, VTY_NEWLINE); | |
10418 | ||
10419 | vty_out (vty, "%s", VTY_NEWLINE); | |
10420 | } | |
718e3744 | 10421 | |
10422 | /* Address Family Information */ | |
856ca177 MS |
10423 | json_object *json_hold = NULL; |
10424 | ||
10425 | if (use_json) | |
10426 | json_hold = json_object_new_object(); | |
10427 | ||
538621f2 | 10428 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
10429 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10430 | if (p->afc[afi][safi]) | |
856ca177 | 10431 | bgp_show_peer_afi (vty, p, afi, safi, use_json, json_hold); |
718e3744 | 10432 | |
856ca177 MS |
10433 | if (use_json) |
10434 | { | |
10435 | json_object_int_add(json_hold, "connectionsEstablished", p->established); | |
10436 | json_object_int_add(json_hold, "connectionsDropped", p->dropped); | |
10437 | } | |
10438 | else | |
10439 | vty_out (vty, " Connections established %d; dropped %d%s", p->established, p->dropped, | |
10440 | VTY_NEWLINE); | |
718e3744 | 10441 | |
d6661008 | 10442 | if (! p->last_reset) |
856ca177 MS |
10443 | { |
10444 | if (use_json) | |
10445 | json_object_string_add(json_hold, "lastReset", "never"); | |
10446 | else | |
10447 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); | |
10448 | } | |
e0701b79 | 10449 | else |
d6661008 | 10450 | { |
856ca177 MS |
10451 | if (use_json) |
10452 | { | |
10453 | time_t uptime; | |
10454 | struct tm *tm; | |
10455 | ||
10456 | uptime = bgp_clock(); | |
10457 | uptime -= p->resettime; | |
10458 | tm = gmtime(&uptime); | |
10459 | json_object_int_add(json_hold, "lastResetTimerMsecs", (tm->tm_sec * 1000) + (tm->tm_min * 60000) + (tm->tm_hour * 3600000)); | |
10460 | json_object_string_add(json_hold, "lastResetDueTo", peer_down_str[(int) p->last_reset]); | |
10461 | if (p->last_reset_cause_size) | |
10462 | { | |
10463 | msg = p->last_reset_cause; | |
10464 | char adapter[BUFSIZ]; | |
10465 | sprintf(adapter, "%s", msg); | |
10466 | json_object_string_add(json_hold, "messageReceivedThatCausedBgpNotification", adapter); | |
10467 | } | |
10468 | } | |
10469 | else | |
d6661008 | 10470 | { |
3a8c7ba1 DW |
10471 | vty_out (vty, " Last reset %s, ", |
10472 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN, 0, NULL)); | |
10473 | ||
10474 | if (p->last_reset == PEER_DOWN_NOTIFY_SEND || | |
10475 | p->last_reset == PEER_DOWN_NOTIFY_RECEIVED) | |
10476 | { | |
10477 | code_str = bgp_notify_code_str(p->notify.code); | |
10478 | subcode_str = bgp_notify_subcode_str(p->notify.code, p->notify.subcode); | |
10479 | vty_out (vty, "due to NOTIFICATION %s (%s%s)%s", | |
10480 | p->last_reset == PEER_DOWN_NOTIFY_SEND ? "sent" : "received", | |
10481 | code_str, subcode_str, VTY_NEWLINE); | |
10482 | } | |
10483 | else | |
10484 | { | |
10485 | vty_out (vty, "due to %s%s", | |
10486 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
10487 | } | |
856ca177 MS |
10488 | |
10489 | if (p->last_reset_cause_size) | |
d6661008 | 10490 | { |
856ca177 MS |
10491 | msg = p->last_reset_cause; |
10492 | vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); | |
10493 | for (i = 1; i <= p->last_reset_cause_size; i++) | |
10494 | { | |
10495 | vty_out(vty, "%02X", *msg++); | |
d6661008 | 10496 | |
856ca177 MS |
10497 | if (i != p->last_reset_cause_size) |
10498 | { | |
10499 | if (i % 16 == 0) | |
10500 | { | |
10501 | vty_out(vty, "%s ", VTY_NEWLINE); | |
10502 | } | |
10503 | else if (i % 4 == 0) | |
10504 | { | |
10505 | vty_out(vty, " "); | |
10506 | } | |
10507 | } | |
10508 | } | |
10509 | vty_out(vty, "%s", VTY_NEWLINE); | |
d6661008 | 10510 | } |
d6661008 DS |
10511 | } |
10512 | } | |
848973c7 | 10513 | |
718e3744 | 10514 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
10515 | { | |
856ca177 MS |
10516 | if (use_json) |
10517 | json_object_boolean_true_add(json_hold, "prefixesConfigExceedMax"); | |
10518 | else | |
10519 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 10520 | |
10521 | if (p->t_pmax_restart) | |
856ca177 MS |
10522 | { |
10523 | if (use_json) | |
10524 | { | |
10525 | json_object_string_add(json_hold, "reducePrefixNumFrom", p->host); | |
10526 | json_object_int_add(json_hold, "restartInTimerMsec", thread_timer_remain_second (p->t_pmax_restart) * 1000); | |
10527 | } | |
10528 | else | |
10529 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
10530 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
10531 | VTY_NEWLINE); | |
10532 | } | |
0a486e5f | 10533 | else |
856ca177 MS |
10534 | { |
10535 | if (use_json) | |
10536 | json_object_string_add(json_hold, "reducePrefixNumAndClearIpBgp", p->host); | |
10537 | else | |
10538 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
10539 | p->host, VTY_NEWLINE); | |
10540 | } | |
718e3744 | 10541 | } |
10542 | ||
856ca177 MS |
10543 | if (use_json) |
10544 | json_object_object_add(json_neigh, "addressFamilyInfo", json_hold); | |
10545 | ||
f5a4827d | 10546 | /* EBGP Multihop and GTSM */ |
6d85b15b | 10547 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d | 10548 | { |
856ca177 MS |
10549 | if (use_json) |
10550 | { | |
10551 | if (p->gtsm_hops > 0) | |
10552 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->gtsm_hops); | |
10553 | else if (p->ttl > 1) | |
10554 | json_object_int_add(json_neigh, "externalBgpNbrMaxHopsAway", p->ttl); | |
10555 | } | |
10556 | else | |
10557 | { | |
10558 | if (p->gtsm_hops > 0) | |
10559 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
10560 | p->gtsm_hops, VTY_NEWLINE); | |
10561 | else if (p->ttl > 1) | |
10562 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
10563 | p->ttl, VTY_NEWLINE); | |
10564 | } | |
f5a4827d | 10565 | } |
5d804b43 PM |
10566 | else |
10567 | { | |
10568 | if (p->gtsm_hops > 0) | |
856ca177 MS |
10569 | { |
10570 | if (use_json) | |
10571 | json_object_int_add(json_neigh, "internalBgpNbrMaxHopsAway", p->gtsm_hops); | |
10572 | else | |
10573 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
10574 | p->gtsm_hops, VTY_NEWLINE); | |
10575 | } | |
5d804b43 | 10576 | } |
718e3744 | 10577 | |
10578 | /* Local address. */ | |
10579 | if (p->su_local) | |
10580 | { | |
856ca177 MS |
10581 | if (use_json) |
10582 | { | |
10583 | json_object_string_add(json_neigh, "hostLocal", sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN)); | |
10584 | json_object_int_add(json_neigh, "portLocal", ntohs (p->su_local->sin.sin_port)); | |
10585 | } | |
10586 | else | |
10587 | vty_out (vty, "Local host: %s, Local port: %d%s", | |
10588 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), | |
10589 | ntohs (p->su_local->sin.sin_port), | |
10590 | VTY_NEWLINE); | |
718e3744 | 10591 | } |
10592 | ||
10593 | /* Remote address. */ | |
10594 | if (p->su_remote) | |
10595 | { | |
856ca177 MS |
10596 | if (use_json) |
10597 | { | |
10598 | json_object_string_add(json_neigh, "hostForeign", sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN)); | |
10599 | json_object_int_add(json_neigh, "portForeign", ntohs (p->su_remote->sin.sin_port)); | |
10600 | } | |
10601 | else | |
10602 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
718e3744 | 10603 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), |
10604 | ntohs (p->su_remote->sin.sin_port), | |
10605 | VTY_NEWLINE); | |
10606 | } | |
10607 | ||
10608 | /* Nexthop display. */ | |
10609 | if (p->su_local) | |
10610 | { | |
856ca177 MS |
10611 | if (use_json) |
10612 | { | |
10613 | json_object_string_add(json_neigh, "nexthop", inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ)); | |
718e3744 | 10614 | #ifdef HAVE_IPV6 |
856ca177 MS |
10615 | json_object_string_add(json_neigh, "nexthopGlobal", inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ)); |
10616 | json_object_string_add(json_neigh, "nexthopLocal", inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ)); | |
10617 | if (p->shared_network) | |
10618 | json_object_string_add(json_neigh, "bgpConnection", "sharedNetwork"); | |
10619 | else | |
10620 | json_object_string_add(json_neigh, "bgpConnection", "nonSharedNetwork"); | |
10621 | #endif /* HAVE_IPV6 */ | |
10622 | } | |
10623 | else | |
10624 | { | |
10625 | vty_out (vty, "Nexthop: %s%s", | |
10626 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
10627 | VTY_NEWLINE); | |
10628 | #ifdef HAVE_IPV6 | |
10629 | vty_out (vty, "Nexthop global: %s%s", | |
10630 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
10631 | VTY_NEWLINE); | |
10632 | vty_out (vty, "Nexthop local: %s%s", | |
10633 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
10634 | VTY_NEWLINE); | |
10635 | vty_out (vty, "BGP connection: %s%s", | |
10636 | p->shared_network ? "shared network" : "non shared network", | |
10637 | VTY_NEWLINE); | |
718e3744 | 10638 | #endif /* HAVE_IPV6 */ |
856ca177 | 10639 | } |
718e3744 | 10640 | } |
10641 | ||
10642 | /* Timer information. */ | |
856ca177 MS |
10643 | if (use_json) |
10644 | { | |
10645 | if (p->t_start) | |
10646 | json_object_int_add(json_neigh, "nextStartTimerDueInMsecs", thread_timer_remain_second (p->t_start) * 1000); | |
10647 | if (p->t_connect) | |
10648 | json_object_int_add(json_neigh, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p->t_connect) * 1000); | |
10649 | if (p->t_routeadv) | |
10650 | { | |
10651 | json_object_int_add(json_neigh, "mraiInterval", p->v_routeadv); | |
10652 | json_object_int_add(json_neigh, "mraiTimerExpireInMsecs", thread_timer_remain_second (p->t_routeadv) * 1000); | |
10653 | } | |
cb1faec9 | 10654 | |
856ca177 MS |
10655 | if (p->t_read) |
10656 | json_object_string_add(json_neigh, "readThread", "on"); | |
10657 | else | |
10658 | json_object_string_add(json_neigh, "readThread", "off"); | |
10659 | if (p->t_write) | |
10660 | json_object_string_add(json_neigh, "writeThread", "on"); | |
10661 | else | |
10662 | json_object_string_add(json_neigh, "writeThread", "off"); | |
10663 | } | |
10664 | else | |
10665 | { | |
10666 | if (p->t_start) | |
10667 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
10668 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
10669 | if (p->t_connect) | |
10670 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
10671 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
10672 | if (p->t_routeadv) | |
10673 | vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s", | |
10674 | p->v_routeadv, thread_timer_remain_second (p->t_routeadv), | |
10675 | VTY_NEWLINE); | |
10676 | ||
10677 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
10678 | p->t_read ? "on" : "off", | |
10679 | p->t_write ? "on" : "off", | |
10680 | VTY_NEWLINE); | |
10681 | } | |
718e3744 | 10682 | |
10683 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
10684 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
856ca177 MS |
10685 | bgp_capability_vty_out (vty, p, use_json, json_neigh); |
10686 | ||
10687 | if (!use_json) | |
10688 | vty_out (vty, "%s", VTY_NEWLINE); | |
c43ed2e4 DS |
10689 | |
10690 | /* BFD information. */ | |
856ca177 MS |
10691 | bgp_bfd_show_info(vty, p, use_json, json_neigh); |
10692 | ||
10693 | if (use_json) | |
10694 | { | |
10695 | if (p->conf_if) /* Configured interface name. */ | |
10696 | json_object_object_add(json, p->conf_if, json_neigh); | |
10697 | else /* Configured IP address. */ | |
10698 | json_object_object_add(json, p->host, json_neigh); | |
10699 | } | |
718e3744 | 10700 | } |
10701 | ||
94f2b392 | 10702 | static int |
856ca177 MS |
10703 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, enum show_type type, |
10704 | union sockunion *su, const char *conf_if, u_char use_json, json_object *json) | |
718e3744 | 10705 | { |
1eb8ef25 | 10706 | struct listnode *node, *nnode; |
718e3744 | 10707 | struct peer *peer; |
10708 | int find = 0; | |
856ca177 MS |
10709 | json_object *json_neigh = NULL; |
10710 | ||
10711 | if (use_json) | |
10712 | json_neigh = json_object_new_object(); | |
718e3744 | 10713 | |
1eb8ef25 | 10714 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 10715 | { |
1ff9a340 DS |
10716 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
10717 | continue; | |
10718 | ||
718e3744 | 10719 | switch (type) |
856ca177 MS |
10720 | { |
10721 | case show_all: | |
10722 | bgp_show_peer (vty, peer, use_json, json, json_neigh); | |
10723 | break; | |
10724 | case show_peer: | |
10725 | if (conf_if) | |
10726 | { | |
10727 | if (peer->conf_if && !strcmp(peer->conf_if, conf_if)) | |
10728 | { | |
10729 | find = 1; | |
10730 | bgp_show_peer (vty, peer, use_json, json, json_neigh); | |
10731 | } | |
10732 | } | |
10733 | else | |
10734 | { | |
10735 | if (sockunion_same (&peer->su, su)) | |
10736 | { | |
10737 | find = 1; | |
10738 | bgp_show_peer (vty, peer, use_json, json, json_neigh); | |
10739 | } | |
10740 | } | |
10741 | break; | |
718e3744 | 10742 | } |
10743 | } | |
10744 | ||
10745 | if (type == show_peer && ! find) | |
856ca177 MS |
10746 | { |
10747 | if (use_json) | |
10748 | json_object_boolean_true_add(json, "bgpNoSuchNeighbor"); | |
10749 | else | |
10750 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
10751 | } | |
10752 | ||
10753 | if (use_json) | |
10754 | { | |
10755 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
10756 | json_object_free(json); | |
10757 | } | |
10758 | else | |
10759 | { | |
10760 | vty_out (vty, "%s", VTY_NEWLINE); | |
10761 | } | |
10762 | ||
718e3744 | 10763 | return CMD_SUCCESS; |
10764 | } | |
10765 | ||
94f2b392 | 10766 | static int |
fd79ac91 | 10767 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
856ca177 | 10768 | enum show_type type, const char *ip_str, u_char use_json) |
718e3744 | 10769 | { |
10770 | int ret; | |
10771 | struct bgp *bgp; | |
10772 | union sockunion su; | |
856ca177 MS |
10773 | json_object *json = NULL; |
10774 | ||
10775 | if (use_json) | |
10776 | json = json_object_new_object(); | |
718e3744 | 10777 | |
718e3744 | 10778 | if (name) |
10779 | { | |
10780 | bgp = bgp_lookup_by_name (name); | |
718e3744 | 10781 | if (! bgp) |
10782 | { | |
856ca177 MS |
10783 | if (use_json) |
10784 | { | |
10785 | json_object_boolean_true_add(json, "bgpNoSuchInstance"); | |
10786 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
10787 | json_object_free(json); | |
10788 | } | |
10789 | else | |
10790 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
10791 | ||
718e3744 | 10792 | return CMD_WARNING; |
10793 | } | |
718e3744 | 10794 | } |
a80beece DS |
10795 | else |
10796 | { | |
10797 | bgp = bgp_get_default (); | |
10798 | } | |
718e3744 | 10799 | |
10800 | if (bgp) | |
a80beece DS |
10801 | { |
10802 | if (ip_str) | |
10803 | { | |
10804 | ret = str2sockunion (ip_str, &su); | |
10805 | if (ret < 0) | |
856ca177 | 10806 | bgp_show_neighbor (vty, bgp, type, NULL, ip_str, use_json, json); |
a80beece | 10807 | else |
856ca177 | 10808 | bgp_show_neighbor (vty, bgp, type, &su, NULL, use_json, json); |
a80beece DS |
10809 | } |
10810 | else | |
10811 | { | |
856ca177 | 10812 | bgp_show_neighbor (vty, bgp, type, NULL, NULL, use_json, json); |
a80beece DS |
10813 | } |
10814 | } | |
718e3744 | 10815 | |
10816 | return CMD_SUCCESS; | |
10817 | } | |
10818 | ||
10819 | /* "show ip bgp neighbors" commands. */ | |
10820 | DEFUN (show_ip_bgp_neighbors, | |
10821 | show_ip_bgp_neighbors_cmd, | |
856ca177 | 10822 | "show ip bgp neighbors {json}", |
718e3744 | 10823 | SHOW_STR |
10824 | IP_STR | |
10825 | BGP_STR | |
856ca177 MS |
10826 | "Detailed information on TCP and BGP neighbor connections\n" |
10827 | "JavaScript Object Notation\n") | |
718e3744 | 10828 | { |
856ca177 MS |
10829 | u_char use_json; |
10830 | ||
10831 | if (argv[argc - 1] && strcmp(argv[argc - 1], "json") == 0) | |
10832 | use_json = 1; | |
10833 | else | |
10834 | use_json = 0; | |
10835 | ||
10836 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL, use_json); | |
718e3744 | 10837 | } |
10838 | ||
10839 | ALIAS (show_ip_bgp_neighbors, | |
10840 | show_ip_bgp_ipv4_neighbors_cmd, | |
856ca177 | 10841 | "show ip bgp ipv4 (unicast|multicast) neighbors {json}", |
718e3744 | 10842 | SHOW_STR |
10843 | IP_STR | |
10844 | BGP_STR | |
10845 | "Address family\n" | |
10846 | "Address Family modifier\n" | |
10847 | "Address Family modifier\n" | |
856ca177 MS |
10848 | "Detailed information on TCP and BGP neighbor connections\n" |
10849 | "JavaScript Object Notation\n") | |
718e3744 | 10850 | |
10851 | ALIAS (show_ip_bgp_neighbors, | |
10852 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
856ca177 | 10853 | "show ip bgp vpnv4 all neighbors {json}", |
718e3744 | 10854 | SHOW_STR |
10855 | IP_STR | |
10856 | BGP_STR | |
10857 | "Display VPNv4 NLRI specific information\n" | |
10858 | "Display information about all VPNv4 NLRIs\n" | |
856ca177 MS |
10859 | "Detailed information on TCP and BGP neighbor connections\n" |
10860 | "JavaScript Object Notation\n") | |
718e3744 | 10861 | |
10862 | ALIAS (show_ip_bgp_neighbors, | |
10863 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
856ca177 | 10864 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}", |
718e3744 | 10865 | SHOW_STR |
10866 | IP_STR | |
10867 | BGP_STR | |
10868 | "Display VPNv4 NLRI specific information\n" | |
10869 | "Display information for a route distinguisher\n" | |
10870 | "VPN Route Distinguisher\n" | |
856ca177 MS |
10871 | "Detailed information on TCP and BGP neighbor connections\n" |
10872 | "JavaScript Object Notation\n") | |
718e3744 | 10873 | |
10874 | ALIAS (show_ip_bgp_neighbors, | |
10875 | show_bgp_neighbors_cmd, | |
856ca177 | 10876 | "show bgp neighbors {json}", |
718e3744 | 10877 | SHOW_STR |
10878 | BGP_STR | |
856ca177 MS |
10879 | "Detailed information on TCP and BGP neighbor connections\n" |
10880 | "JavaScript Object Notation\n") | |
718e3744 | 10881 | |
10882 | ALIAS (show_ip_bgp_neighbors, | |
10883 | show_bgp_ipv6_neighbors_cmd, | |
856ca177 | 10884 | "show bgp ipv6 neighbors {json}", |
718e3744 | 10885 | SHOW_STR |
10886 | BGP_STR | |
10887 | "Address family\n" | |
856ca177 MS |
10888 | "Detailed information on TCP and BGP neighbor connections\n" |
10889 | "JavaScript Object Notation\n") | |
718e3744 | 10890 | |
10891 | DEFUN (show_ip_bgp_neighbors_peer, | |
10892 | show_ip_bgp_neighbors_peer_cmd, | |
856ca177 | 10893 | "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10894 | SHOW_STR |
10895 | IP_STR | |
10896 | BGP_STR | |
10897 | "Detailed information on TCP and BGP neighbor connections\n" | |
10898 | "Neighbor to display information about\n" | |
a80beece | 10899 | "Neighbor to display information about\n" |
856ca177 MS |
10900 | "Neighbor on bgp configured interface\n" |
10901 | "JavaScript Object Notation\n") | |
718e3744 | 10902 | { |
856ca177 MS |
10903 | u_char use_json; |
10904 | ||
10905 | if (argv[argc - 1] && strcmp(argv[argc - 1], "json") == 0) | |
10906 | use_json = 1; | |
10907 | else | |
10908 | use_json = 0; | |
10909 | ||
10910 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 2], use_json); | |
718e3744 | 10911 | } |
10912 | ||
10913 | ALIAS (show_ip_bgp_neighbors_peer, | |
10914 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
856ca177 | 10915 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10916 | SHOW_STR |
10917 | IP_STR | |
10918 | BGP_STR | |
10919 | "Address family\n" | |
10920 | "Address Family modifier\n" | |
10921 | "Address Family modifier\n" | |
10922 | "Detailed information on TCP and BGP neighbor connections\n" | |
10923 | "Neighbor to display information about\n" | |
a80beece | 10924 | "Neighbor to display information about\n" |
856ca177 MS |
10925 | "Neighbor on bgp configured interface\n" |
10926 | "JavaScript Object Notation\n") | |
718e3744 | 10927 | |
10928 | ALIAS (show_ip_bgp_neighbors_peer, | |
10929 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
856ca177 | 10930 | "show ip bgp vpnv4 all neighbors A.B.C.D {json}", |
718e3744 | 10931 | SHOW_STR |
10932 | IP_STR | |
10933 | BGP_STR | |
10934 | "Display VPNv4 NLRI specific information\n" | |
10935 | "Display information about all VPNv4 NLRIs\n" | |
10936 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
10937 | "Neighbor to display information about\n" |
10938 | "JavaScript Object Notation\n") | |
718e3744 | 10939 | |
10940 | ALIAS (show_ip_bgp_neighbors_peer, | |
10941 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
856ca177 | 10942 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}", |
718e3744 | 10943 | SHOW_STR |
10944 | IP_STR | |
10945 | BGP_STR | |
10946 | "Display VPNv4 NLRI specific information\n" | |
10947 | "Display information about all VPNv4 NLRIs\n" | |
10948 | "Detailed information on TCP and BGP neighbor connections\n" | |
856ca177 MS |
10949 | "Neighbor to display information about\n" |
10950 | "JavaScript Object Notation\n") | |
718e3744 | 10951 | |
10952 | ALIAS (show_ip_bgp_neighbors_peer, | |
10953 | show_bgp_neighbors_peer_cmd, | |
856ca177 | 10954 | "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10955 | SHOW_STR |
10956 | BGP_STR | |
10957 | "Detailed information on TCP and BGP neighbor connections\n" | |
10958 | "Neighbor to display information about\n" | |
a80beece | 10959 | "Neighbor to display information about\n" |
856ca177 MS |
10960 | "Neighbor on bgp configured interface\n" |
10961 | "JavaScript Object Notation\n") | |
718e3744 | 10962 | |
10963 | ALIAS (show_ip_bgp_neighbors_peer, | |
10964 | show_bgp_ipv6_neighbors_peer_cmd, | |
856ca177 | 10965 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 10966 | SHOW_STR |
10967 | BGP_STR | |
10968 | "Address family\n" | |
10969 | "Detailed information on TCP and BGP neighbor connections\n" | |
10970 | "Neighbor to display information about\n" | |
a80beece | 10971 | "Neighbor to display information about\n" |
856ca177 MS |
10972 | "Neighbor on bgp configured interface\n" |
10973 | "JavaScript Object Notation\n") | |
718e3744 | 10974 | |
10975 | DEFUN (show_ip_bgp_instance_neighbors, | |
10976 | show_ip_bgp_instance_neighbors_cmd, | |
856ca177 | 10977 | "show ip bgp view WORD neighbors {json}", |
718e3744 | 10978 | SHOW_STR |
10979 | IP_STR | |
10980 | BGP_STR | |
10981 | "BGP view\n" | |
10982 | "View name\n" | |
856ca177 MS |
10983 | "Detailed information on TCP and BGP neighbor connections\n" |
10984 | "JavaScript Object Notation\n") | |
718e3744 | 10985 | { |
856ca177 MS |
10986 | u_char use_json; |
10987 | ||
10988 | if (argv[1] && strcmp(argv[1], "json") == 0) | |
10989 | use_json = 1; | |
10990 | else | |
10991 | use_json = 0; | |
10992 | ||
10993 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL, use_json); | |
718e3744 | 10994 | } |
10995 | ||
bb46e94f | 10996 | ALIAS (show_ip_bgp_instance_neighbors, |
10997 | show_bgp_instance_neighbors_cmd, | |
856ca177 | 10998 | "show bgp view WORD neighbors {json}", |
bb46e94f | 10999 | SHOW_STR |
11000 | BGP_STR | |
11001 | "BGP view\n" | |
11002 | "View name\n" | |
856ca177 MS |
11003 | "Detailed information on TCP and BGP neighbor connections\n" |
11004 | "JavaScript Object Notation\n") | |
bb46e94f | 11005 | |
11006 | ALIAS (show_ip_bgp_instance_neighbors, | |
11007 | show_bgp_instance_ipv6_neighbors_cmd, | |
856ca177 | 11008 | "show bgp view WORD ipv6 neighbors {json}", |
bb46e94f | 11009 | SHOW_STR |
11010 | BGP_STR | |
11011 | "BGP view\n" | |
11012 | "View name\n" | |
11013 | "Address family\n" | |
856ca177 MS |
11014 | "Detailed information on TCP and BGP neighbor connections\n" |
11015 | "JavaScript Object Notation\n") | |
bb46e94f | 11016 | |
718e3744 | 11017 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
11018 | show_ip_bgp_instance_neighbors_peer_cmd, | |
856ca177 | 11019 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
718e3744 | 11020 | SHOW_STR |
11021 | IP_STR | |
11022 | BGP_STR | |
11023 | "BGP view\n" | |
11024 | "View name\n" | |
11025 | "Detailed information on TCP and BGP neighbor connections\n" | |
11026 | "Neighbor to display information about\n" | |
a80beece | 11027 | "Neighbor to display information about\n" |
856ca177 MS |
11028 | "Neighbor on bgp configured interface\n" |
11029 | "JavaScript Object Notation\n") | |
718e3744 | 11030 | { |
856ca177 MS |
11031 | u_char use_json; |
11032 | ||
11033 | if (argv[2] && strcmp(argv[2], "json") == 0) | |
11034 | use_json = 1; | |
11035 | else | |
11036 | use_json = 0; | |
11037 | ||
11038 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1], use_json); | |
718e3744 | 11039 | } |
bb46e94f | 11040 | |
11041 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
11042 | show_bgp_instance_neighbors_peer_cmd, | |
856ca177 | 11043 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 11044 | SHOW_STR |
11045 | BGP_STR | |
11046 | "BGP view\n" | |
11047 | "View name\n" | |
11048 | "Detailed information on TCP and BGP neighbor connections\n" | |
11049 | "Neighbor to display information about\n" | |
a80beece | 11050 | "Neighbor to display information about\n" |
856ca177 MS |
11051 | "Neighbor on bgp configured interface\n" |
11052 | "JavaScript Object Notation\n") | |
bb46e94f | 11053 | |
11054 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
11055 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
856ca177 | 11056 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}", |
bb46e94f | 11057 | SHOW_STR |
11058 | BGP_STR | |
11059 | "BGP view\n" | |
11060 | "View name\n" | |
11061 | "Address family\n" | |
11062 | "Detailed information on TCP and BGP neighbor connections\n" | |
11063 | "Neighbor to display information about\n" | |
a80beece | 11064 | "Neighbor to display information about\n" |
856ca177 MS |
11065 | "Neighbor on bgp configured interface\n" |
11066 | "JavaScript Object Notation\n") | |
6b0655a2 | 11067 | |
718e3744 | 11068 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
11069 | paths' and `show ip mbgp paths'. Those functions results are the | |
11070 | same.*/ | |
11071 | DEFUN (show_ip_bgp_paths, | |
11072 | show_ip_bgp_paths_cmd, | |
11073 | "show ip bgp paths", | |
11074 | SHOW_STR | |
11075 | IP_STR | |
11076 | BGP_STR | |
11077 | "Path information\n") | |
11078 | { | |
11079 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
11080 | aspath_print_all_vty (vty); | |
11081 | return CMD_SUCCESS; | |
11082 | } | |
11083 | ||
11084 | DEFUN (show_ip_bgp_ipv4_paths, | |
11085 | show_ip_bgp_ipv4_paths_cmd, | |
11086 | "show ip bgp ipv4 (unicast|multicast) paths", | |
11087 | SHOW_STR | |
11088 | IP_STR | |
11089 | BGP_STR | |
11090 | "Address family\n" | |
11091 | "Address Family modifier\n" | |
11092 | "Address Family modifier\n" | |
11093 | "Path information\n") | |
11094 | { | |
11095 | vty_out (vty, "Address Refcnt Path\r\n"); | |
11096 | aspath_print_all_vty (vty); | |
11097 | ||
11098 | return CMD_SUCCESS; | |
11099 | } | |
6b0655a2 | 11100 | |
718e3744 | 11101 | #include "hash.h" |
11102 | ||
94f2b392 | 11103 | static void |
718e3744 | 11104 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
11105 | { | |
11106 | struct community *com; | |
11107 | ||
11108 | com = (struct community *) backet->data; | |
11109 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, | |
11110 | community_str (com), VTY_NEWLINE); | |
11111 | } | |
11112 | ||
11113 | /* Show BGP's community internal data. */ | |
11114 | DEFUN (show_ip_bgp_community_info, | |
11115 | show_ip_bgp_community_info_cmd, | |
11116 | "show ip bgp community-info", | |
11117 | SHOW_STR | |
11118 | IP_STR | |
11119 | BGP_STR | |
11120 | "List all bgp community information\n") | |
11121 | { | |
11122 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
11123 | ||
11124 | hash_iterate (community_hash (), | |
11125 | (void (*) (struct hash_backet *, void *)) | |
11126 | community_show_all_iterator, | |
11127 | vty); | |
11128 | ||
11129 | return CMD_SUCCESS; | |
11130 | } | |
11131 | ||
11132 | DEFUN (show_ip_bgp_attr_info, | |
11133 | show_ip_bgp_attr_info_cmd, | |
11134 | "show ip bgp attribute-info", | |
11135 | SHOW_STR | |
11136 | IP_STR | |
11137 | BGP_STR | |
11138 | "List all bgp attribute information\n") | |
11139 | { | |
11140 | attr_show_all (vty); | |
11141 | return CMD_SUCCESS; | |
11142 | } | |
6b0655a2 | 11143 | |
94f2b392 | 11144 | static int |
fee0f4c6 | 11145 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
11146 | afi_t afi, safi_t safi) | |
11147 | { | |
11148 | char timebuf[BGP_UPTIME_LEN]; | |
11149 | char rmbuf[14]; | |
fd79ac91 | 11150 | const char *rmname; |
fee0f4c6 | 11151 | struct peer *peer; |
1eb8ef25 | 11152 | struct listnode *node, *nnode; |
fee0f4c6 | 11153 | int len; |
11154 | int count = 0; | |
11155 | ||
11156 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) | |
11157 | { | |
1eb8ef25 | 11158 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
fee0f4c6 | 11159 | { |
11160 | count++; | |
11161 | bgp_write_rsclient_summary (vty, peer, afi, safi); | |
11162 | } | |
11163 | return count; | |
11164 | } | |
11165 | ||
11166 | len = vty_out (vty, "%s", rsclient->host); | |
11167 | len = 16 - len; | |
11168 | ||
11169 | if (len < 1) | |
11170 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
11171 | else | |
11172 | vty_out (vty, "%*s", len, " "); | |
11173 | ||
3d515fd9 | 11174 | vty_out (vty, "4 "); |
fee0f4c6 | 11175 | |
0b2aa3a0 | 11176 | vty_out (vty, "%11d ", rsclient->as); |
fee0f4c6 | 11177 | |
11178 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); | |
11179 | if ( rmname && strlen (rmname) > 13 ) | |
11180 | { | |
11181 | sprintf (rmbuf, "%13s", "..."); | |
11182 | rmname = strncpy (rmbuf, rmname, 10); | |
11183 | } | |
11184 | else if (! rmname) | |
11185 | rmname = "<none>"; | |
11186 | vty_out (vty, " %13s ", rmname); | |
11187 | ||
11188 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); | |
11189 | if ( rmname && strlen (rmname) > 13 ) | |
11190 | { | |
11191 | sprintf (rmbuf, "%13s", "..."); | |
11192 | rmname = strncpy (rmbuf, rmname, 10); | |
11193 | } | |
11194 | else if (! rmname) | |
11195 | rmname = "<none>"; | |
11196 | vty_out (vty, " %13s ", rmname); | |
11197 | ||
856ca177 | 11198 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN, 0, NULL)); |
fee0f4c6 | 11199 | |
11200 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) | |
11201 | vty_out (vty, " Idle (Admin)"); | |
11202 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
11203 | vty_out (vty, " Idle (PfxCt)"); | |
11204 | else | |
11205 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); | |
11206 | ||
11207 | vty_out (vty, "%s", VTY_NEWLINE); | |
11208 | ||
11209 | return 1; | |
11210 | } | |
11211 | ||
94f2b392 | 11212 | static int |
fd79ac91 | 11213 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
11214 | afi_t afi, safi_t safi) | |
fee0f4c6 | 11215 | { |
11216 | struct peer *peer; | |
1eb8ef25 | 11217 | struct listnode *node, *nnode; |
fee0f4c6 | 11218 | int count = 0; |
11219 | ||
11220 | /* Header string for each address family. */ | |
11221 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; | |
11222 | ||
1eb8ef25 | 11223 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
fee0f4c6 | 11224 | { |
11225 | if (peer->afc[afi][safi] && | |
11226 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
11227 | { | |
11228 | if (! count) | |
11229 | { | |
11230 | vty_out (vty, | |
11231 | "Route Server's BGP router identifier %s%s", | |
11232 | inet_ntoa (bgp->router_id), VTY_NEWLINE); | |
11233 | vty_out (vty, | |
aea339f7 | 11234 | "Route Server's local AS number %u%s", bgp->as, |
fee0f4c6 | 11235 | VTY_NEWLINE); |
11236 | ||
11237 | vty_out (vty, "%s", VTY_NEWLINE); | |
11238 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
11239 | } | |
11240 | ||
11241 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); | |
11242 | } | |
11243 | } | |
11244 | ||
11245 | if (count) | |
11246 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, | |
11247 | count, VTY_NEWLINE); | |
11248 | else | |
11249 | vty_out (vty, "No %s Route Server Client is configured%s", | |
11250 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
11251 | ||
11252 | return CMD_SUCCESS; | |
11253 | } | |
11254 | ||
94f2b392 | 11255 | static int |
fd79ac91 | 11256 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
11257 | afi_t afi, safi_t safi) | |
fee0f4c6 | 11258 | { |
11259 | struct bgp *bgp; | |
11260 | ||
11261 | if (name) | |
11262 | { | |
11263 | bgp = bgp_lookup_by_name (name); | |
11264 | ||
11265 | if (! bgp) | |
11266 | { | |
11267 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
11268 | return CMD_WARNING; | |
11269 | } | |
11270 | ||
11271 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
11272 | return CMD_SUCCESS; | |
11273 | } | |
11274 | ||
11275 | bgp = bgp_get_default (); | |
11276 | ||
11277 | if (bgp) | |
11278 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
11279 | ||
11280 | return CMD_SUCCESS; | |
11281 | } | |
11282 | ||
11283 | /* 'show bgp rsclient' commands. */ | |
11284 | DEFUN (show_ip_bgp_rsclient_summary, | |
11285 | show_ip_bgp_rsclient_summary_cmd, | |
11286 | "show ip bgp rsclient summary", | |
11287 | SHOW_STR | |
11288 | IP_STR | |
11289 | BGP_STR | |
11290 | "Information about Route Server Clients\n" | |
11291 | "Summary of all Route Server Clients\n") | |
11292 | { | |
11293 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
11294 | } | |
11295 | ||
11296 | DEFUN (show_ip_bgp_instance_rsclient_summary, | |
11297 | show_ip_bgp_instance_rsclient_summary_cmd, | |
11298 | "show ip bgp view WORD rsclient summary", | |
11299 | SHOW_STR | |
11300 | IP_STR | |
11301 | BGP_STR | |
11302 | "BGP view\n" | |
11303 | "View name\n" | |
11304 | "Information about Route Server Clients\n" | |
11305 | "Summary of all Route Server Clients\n") | |
11306 | { | |
11307 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
11308 | } | |
11309 | ||
11310 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, | |
11311 | show_ip_bgp_ipv4_rsclient_summary_cmd, | |
11312 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", | |
11313 | SHOW_STR | |
11314 | IP_STR | |
11315 | BGP_STR | |
11316 | "Address family\n" | |
11317 | "Address Family modifier\n" | |
11318 | "Address Family modifier\n" | |
11319 | "Information about Route Server Clients\n" | |
11320 | "Summary of all Route Server Clients\n") | |
11321 | { | |
11322 | if (strncmp (argv[0], "m", 1) == 0) | |
11323 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); | |
11324 | ||
11325 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
11326 | } | |
11327 | ||
11328 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, | |
11329 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, | |
11330 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
11331 | SHOW_STR | |
11332 | IP_STR | |
11333 | BGP_STR | |
11334 | "BGP view\n" | |
11335 | "View name\n" | |
11336 | "Address family\n" | |
11337 | "Address Family modifier\n" | |
11338 | "Address Family modifier\n" | |
11339 | "Information about Route Server Clients\n" | |
11340 | "Summary of all Route Server Clients\n") | |
11341 | { | |
11342 | if (strncmp (argv[1], "m", 1) == 0) | |
11343 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); | |
11344 | ||
11345 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
11346 | } | |
11347 | ||
95cbbd2a ML |
11348 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
11349 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, | |
11350 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
11351 | SHOW_STR | |
11352 | BGP_STR | |
11353 | "BGP view\n" | |
11354 | "View name\n" | |
11355 | "Address family\n" | |
11356 | "Address Family modifier\n" | |
11357 | "Address Family modifier\n" | |
11358 | "Information about Route Server Clients\n" | |
11359 | "Summary of all Route Server Clients\n") | |
11360 | { | |
11361 | safi_t safi; | |
11362 | ||
11363 | if (argc == 2) { | |
11364 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
11365 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); | |
11366 | } else { | |
11367 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
11368 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); | |
11369 | } | |
11370 | } | |
11371 | ||
11372 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, | |
11373 | show_bgp_ipv4_safi_rsclient_summary_cmd, | |
11374 | "show bgp ipv4 (unicast|multicast) rsclient summary", | |
11375 | SHOW_STR | |
11376 | BGP_STR | |
11377 | "Address family\n" | |
11378 | "Address Family modifier\n" | |
11379 | "Address Family modifier\n" | |
11380 | "Information about Route Server Clients\n" | |
11381 | "Summary of all Route Server Clients\n") | |
11382 | ||
fee0f4c6 | 11383 | #ifdef HAVE_IPV6 |
11384 | DEFUN (show_bgp_rsclient_summary, | |
11385 | show_bgp_rsclient_summary_cmd, | |
11386 | "show bgp rsclient summary", | |
11387 | SHOW_STR | |
11388 | BGP_STR | |
11389 | "Information about Route Server Clients\n" | |
11390 | "Summary of all Route Server Clients\n") | |
11391 | { | |
11392 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
11393 | } | |
11394 | ||
11395 | DEFUN (show_bgp_instance_rsclient_summary, | |
11396 | show_bgp_instance_rsclient_summary_cmd, | |
11397 | "show bgp view WORD rsclient summary", | |
11398 | SHOW_STR | |
11399 | BGP_STR | |
11400 | "BGP view\n" | |
11401 | "View name\n" | |
11402 | "Information about Route Server Clients\n" | |
11403 | "Summary of all Route Server Clients\n") | |
11404 | { | |
11405 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); | |
11406 | } | |
11407 | ||
11408 | ALIAS (show_bgp_rsclient_summary, | |
11409 | show_bgp_ipv6_rsclient_summary_cmd, | |
11410 | "show bgp ipv6 rsclient summary", | |
11411 | SHOW_STR | |
11412 | BGP_STR | |
11413 | "Address family\n" | |
11414 | "Information about Route Server Clients\n" | |
11415 | "Summary of all Route Server Clients\n") | |
11416 | ||
11417 | ALIAS (show_bgp_instance_rsclient_summary, | |
11418 | show_bgp_instance_ipv6_rsclient_summary_cmd, | |
11419 | "show bgp view WORD ipv6 rsclient summary", | |
11420 | SHOW_STR | |
11421 | BGP_STR | |
11422 | "BGP view\n" | |
11423 | "View name\n" | |
11424 | "Address family\n" | |
11425 | "Information about Route Server Clients\n" | |
11426 | "Summary of all Route Server Clients\n") | |
95cbbd2a ML |
11427 | |
11428 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, | |
11429 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, | |
11430 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", | |
11431 | SHOW_STR | |
11432 | BGP_STR | |
11433 | "BGP view\n" | |
11434 | "View name\n" | |
11435 | "Address family\n" | |
11436 | "Address Family modifier\n" | |
11437 | "Address Family modifier\n" | |
11438 | "Information about Route Server Clients\n" | |
11439 | "Summary of all Route Server Clients\n") | |
11440 | { | |
11441 | safi_t safi; | |
11442 | ||
11443 | if (argc == 2) { | |
11444 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
11445 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); | |
11446 | } else { | |
11447 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
11448 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); | |
11449 | } | |
11450 | } | |
11451 | ||
11452 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, | |
11453 | show_bgp_ipv6_safi_rsclient_summary_cmd, | |
11454 | "show bgp ipv6 (unicast|multicast) rsclient summary", | |
11455 | SHOW_STR | |
11456 | BGP_STR | |
11457 | "Address family\n" | |
11458 | "Address Family modifier\n" | |
11459 | "Address Family modifier\n" | |
11460 | "Information about Route Server Clients\n" | |
11461 | "Summary of all Route Server Clients\n") | |
11462 | ||
fee0f4c6 | 11463 | #endif /* HAVE IPV6 */ |
6b0655a2 | 11464 | |
8fe8a7f6 DS |
11465 | static int bgp_show_update_groups(int afi, int safi, struct vty *vty, |
11466 | u_int64_t subgrp_id) | |
3f9c7369 DS |
11467 | { |
11468 | struct bgp *bgp; | |
11469 | ||
11470 | bgp = bgp_get_default(); | |
11471 | if (bgp) | |
8fe8a7f6 | 11472 | update_group_show(bgp, afi, safi, vty, subgrp_id); |
3f9c7369 DS |
11473 | return CMD_SUCCESS; |
11474 | } | |
11475 | ||
8fe8a7f6 DS |
11476 | DEFUN (show_ip_bgp_updgrps, |
11477 | show_ip_bgp_updgrps_cmd, | |
11478 | "show ip bgp update-groups", | |
11479 | SHOW_STR | |
11480 | IP_STR | |
11481 | BGP_STR | |
11482 | "Detailed info about dynamic update groups\n") | |
11483 | { | |
11484 | return (bgp_show_update_groups(AFI_IP, SAFI_UNICAST, vty, 0)); | |
11485 | } | |
11486 | ||
3f9c7369 DS |
11487 | DEFUN (show_bgp_ipv6_updgrps, |
11488 | show_bgp_ipv6_updgrps_cmd, | |
8fe8a7f6 | 11489 | "show bgp update-groups", |
3f9c7369 DS |
11490 | SHOW_STR |
11491 | BGP_STR | |
8fe8a7f6 | 11492 | "Detailed info about v6 dynamic update groups\n") |
3f9c7369 | 11493 | { |
8fe8a7f6 | 11494 | return (bgp_show_update_groups(AFI_IP6, SAFI_UNICAST, vty, 0)); |
3f9c7369 DS |
11495 | } |
11496 | ||
11497 | DEFUN (show_bgp_updgrps, | |
11498 | show_bgp_updgrps_cmd, | |
8fe8a7f6 | 11499 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups", |
3f9c7369 DS |
11500 | SHOW_STR |
11501 | BGP_STR | |
11502 | "Address family\n" | |
11503 | "Address family\n" | |
11504 | "Address Family modifier\n" | |
11505 | "Address Family modifier\n" | |
8fe8a7f6 | 11506 | "Detailed info about dynamic update groups\n") |
3f9c7369 | 11507 | { |
3f9c7369 DS |
11508 | afi_t afi; |
11509 | safi_t safi; | |
11510 | ||
11511 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
11512 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8fe8a7f6 DS |
11513 | return (bgp_show_update_groups(afi, safi, vty, 0)); |
11514 | } | |
11515 | ||
11516 | DEFUN (show_ip_bgp_updgrps_s, | |
11517 | show_ip_bgp_updgrps_s_cmd, | |
11518 | "show ip bgp update-groups SUBGROUP-ID", | |
11519 | SHOW_STR | |
11520 | IP_STR | |
11521 | BGP_STR | |
11522 | "Detailed info about dynamic update groups\n" | |
11523 | "Specific subgroup to display detailed info for\n") | |
11524 | { | |
11525 | u_int64_t subgrp_id; | |
11526 | ||
11527 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
11528 | return (bgp_show_update_groups(AFI_IP, SAFI_UNICAST, vty, subgrp_id)); | |
11529 | } | |
11530 | ||
11531 | DEFUN (show_bgp_ipv6_updgrps_s, | |
11532 | show_bgp_ipv6_updgrps_s_cmd, | |
11533 | "show bgp update-groups SUBGROUP-ID", | |
11534 | SHOW_STR | |
11535 | BGP_STR | |
11536 | "Detailed info about v6 dynamic update groups\n" | |
11537 | "Specific subgroup to display detailed info for\n") | |
11538 | { | |
11539 | u_int64_t subgrp_id; | |
11540 | ||
11541 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
11542 | return(bgp_show_update_groups(AFI_IP6, SAFI_UNICAST, vty, subgrp_id)); | |
11543 | } | |
11544 | ||
11545 | DEFUN (show_bgp_updgrps_s, | |
11546 | show_bgp_updgrps_s_cmd, | |
11547 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID", | |
11548 | SHOW_STR | |
11549 | BGP_STR | |
11550 | "Address family\n" | |
11551 | "Address family\n" | |
11552 | "Address Family modifier\n" | |
11553 | "Address Family modifier\n" | |
11554 | "Detailed info about v6 dynamic update groups\n" | |
11555 | "Specific subgroup to display detailed info for") | |
11556 | { | |
11557 | afi_t afi; | |
11558 | safi_t safi; | |
11559 | u_int64_t subgrp_id; | |
11560 | ||
11561 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
11562 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
11563 | ||
11564 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); | |
11565 | return(bgp_show_update_groups(afi, safi, vty, subgrp_id)); | |
3f9c7369 DS |
11566 | } |
11567 | ||
11568 | DEFUN (show_bgp_updgrps_stats, | |
11569 | show_bgp_updgrps_stats_cmd, | |
11570 | "show bgp update-groups statistics", | |
11571 | SHOW_STR | |
11572 | BGP_STR | |
11573 | "BGP update groups\n" | |
11574 | "Statistics\n") | |
11575 | { | |
11576 | struct bgp *bgp; | |
11577 | ||
11578 | bgp = bgp_get_default(); | |
11579 | if (bgp) | |
11580 | update_group_show_stats(bgp, vty); | |
11581 | ||
11582 | return CMD_SUCCESS; | |
11583 | } | |
11584 | ||
11585 | static void | |
11586 | show_bgp_updgrps_adj_info_aux (struct vty *vty, afi_t afi, safi_t safi, | |
11587 | const char *what, u_int64_t subgrp_id) | |
11588 | { | |
11589 | struct bgp *bgp; | |
11590 | bgp = bgp_get_default(); | |
11591 | if (bgp) | |
11592 | { | |
11593 | if (!strcmp(what, "advertise-queue")) | |
11594 | update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id); | |
11595 | else if (!strcmp(what, "advertised-routes")) | |
11596 | update_group_show_advertised(bgp, afi, safi, vty, subgrp_id); | |
11597 | else if (!strcmp(what, "packet-queue")) | |
11598 | update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id); | |
11599 | } | |
11600 | } | |
11601 | ||
11602 | DEFUN (show_ip_bgp_updgrps_adj, | |
11603 | show_ip_bgp_updgrps_adj_cmd, | |
11604 | "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
11605 | SHOW_STR | |
11606 | IP_STR | |
11607 | BGP_STR | |
11608 | "BGP update groups\n" | |
11609 | "Advertisement queue\n" | |
11610 | "Announced routes\n" | |
11611 | "Packet queue\n") | |
8fe8a7f6 | 11612 | |
3f9c7369 DS |
11613 | { |
11614 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP, SAFI_UNICAST, argv[0], 0); | |
11615 | return CMD_SUCCESS; | |
11616 | } | |
11617 | ||
11618 | DEFUN (show_bgp_updgrps_afi_adj, | |
11619 | show_bgp_updgrps_afi_adj_cmd, | |
11620 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)", | |
11621 | SHOW_STR | |
11622 | BGP_STR | |
11623 | "Address family\n" | |
11624 | "Address family\n" | |
11625 | "Address Family modifier\n" | |
11626 | "Address Family modifier\n" | |
11627 | "BGP update groups\n" | |
11628 | "Advertisement queue\n" | |
11629 | "Announced routes\n" | |
8fe8a7f6 DS |
11630 | "Packet queue\n" |
11631 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
11632 | { |
11633 | afi_t afi; | |
11634 | safi_t safi; | |
11635 | ||
11636 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
11637 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
11638 | show_bgp_updgrps_adj_info_aux(vty, afi, safi, argv[2], 0); | |
8fe8a7f6 | 11639 | return CMD_SUCCESS; |
3f9c7369 DS |
11640 | } |
11641 | ||
11642 | DEFUN (show_bgp_updgrps_adj, | |
11643 | show_bgp_updgrps_adj_cmd, | |
11644 | "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
11645 | SHOW_STR | |
11646 | BGP_STR | |
11647 | "BGP update groups\n" | |
11648 | "Advertisement queue\n" | |
11649 | "Announced routes\n" | |
11650 | "Packet queue\n") | |
11651 | { | |
11652 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP6, SAFI_UNICAST, argv[0], 0); | |
11653 | return CMD_SUCCESS; | |
11654 | } | |
11655 | ||
11656 | DEFUN (show_ip_bgp_updgrps_adj_s, | |
8fe8a7f6 | 11657 | show_ip_bgp_updgrps_adj_s_cmd, |
3f9c7369 DS |
11658 | "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
11659 | SHOW_STR | |
11660 | IP_STR | |
11661 | BGP_STR | |
11662 | "BGP update groups\n" | |
8fe8a7f6 | 11663 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
11664 | "Advertisement queue\n" |
11665 | "Announced routes\n" | |
11666 | "Packet queue\n") | |
3f9c7369 | 11667 | |
3f9c7369 | 11668 | { |
8fe8a7f6 DS |
11669 | u_int64_t subgrp_id; |
11670 | ||
11671 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
11672 | ||
11673 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP, SAFI_UNICAST, argv[1], subgrp_id); | |
3f9c7369 DS |
11674 | return CMD_SUCCESS; |
11675 | } | |
11676 | ||
8fe8a7f6 DS |
11677 | DEFUN (show_bgp_updgrps_afi_adj_s, |
11678 | show_bgp_updgrps_afi_adj_s_cmd, | |
3f9c7369 DS |
11679 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", |
11680 | SHOW_STR | |
11681 | BGP_STR | |
11682 | "Address family\n" | |
11683 | "Address family\n" | |
11684 | "Address Family modifier\n" | |
11685 | "Address Family modifier\n" | |
11686 | "BGP update groups\n" | |
8fe8a7f6 | 11687 | "Specific subgroup to display info for\n" |
3f9c7369 DS |
11688 | "Advertisement queue\n" |
11689 | "Announced routes\n" | |
8fe8a7f6 DS |
11690 | "Packet queue\n" |
11691 | "Specific subgroup info wanted for\n") | |
3f9c7369 DS |
11692 | { |
11693 | afi_t afi; | |
11694 | safi_t safi; | |
8fe8a7f6 | 11695 | u_int64_t subgrp_id; |
3f9c7369 DS |
11696 | |
11697 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
11698 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8fe8a7f6 DS |
11699 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[2]); |
11700 | ||
11701 | show_bgp_updgrps_adj_info_aux(vty, afi, safi, argv[3], subgrp_id); | |
11702 | return CMD_SUCCESS; | |
3f9c7369 DS |
11703 | } |
11704 | ||
8fe8a7f6 DS |
11705 | DEFUN (show_bgp_updgrps_adj_s, |
11706 | show_bgp_updgrps_adj_s_cmd, | |
11707 | "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
11708 | SHOW_STR | |
11709 | BGP_STR | |
11710 | "BGP update groups\n" | |
11711 | "Specific subgroup to display info for\n" | |
11712 | "Advertisement queue\n" | |
11713 | "Announced routes\n" | |
11714 | "Packet queue\n") | |
11715 | { | |
11716 | u_int64_t subgrp_id; | |
11717 | ||
11718 | VTY_GET_ULL("subgroup-id", subgrp_id, argv[0]); | |
11719 | ||
11720 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP6, SAFI_UNICAST, argv[1], subgrp_id); | |
11721 | return CMD_SUCCESS; | |
11722 | } | |
11723 | ||
11724 | ||
f14e6fdb DS |
11725 | static int |
11726 | bgp_show_one_peer_group (struct vty *vty, struct peer_group *group) | |
11727 | { | |
11728 | struct listnode *node, *nnode; | |
11729 | struct prefix *range; | |
11730 | struct peer *conf; | |
11731 | struct peer *peer; | |
11732 | char buf[128]; | |
11733 | afi_t afi; | |
11734 | safi_t safi; | |
ffd0c037 DS |
11735 | const char *peer_status; |
11736 | const char *af_str; | |
f14e6fdb DS |
11737 | int lr_count; |
11738 | int dynamic; | |
11739 | int af_cfgd; | |
11740 | ||
11741 | conf = group->conf; | |
11742 | ||
0299c004 DS |
11743 | if (conf->as_type == AS_SPECIFIED || |
11744 | conf->as_type == AS_EXTERNAL) { | |
66b199b2 | 11745 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
f14e6fdb | 11746 | VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE); |
0299c004 | 11747 | } else if (conf->as_type == AS_INTERNAL) { |
66b199b2 | 11748 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", |
0299c004 | 11749 | VTY_NEWLINE, group->name, group->bgp->as, VTY_NEWLINE); |
66b199b2 DS |
11750 | } else { |
11751 | vty_out (vty, "%sBGP peer-group %s%s", | |
11752 | VTY_NEWLINE, group->name, VTY_NEWLINE); | |
0299c004 | 11753 | } |
f14e6fdb | 11754 | |
0299c004 | 11755 | if ((group->bgp->as == conf->as) || (conf->as_type == AS_INTERNAL)) |
f14e6fdb DS |
11756 | vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE); |
11757 | else | |
11758 | vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE); | |
11759 | ||
11760 | /* Display AFs configured. */ | |
11761 | vty_out (vty, " Configured address-families:"); | |
11762 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
11763 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
11764 | { | |
11765 | if (conf->afc[afi][safi]) | |
11766 | { | |
11767 | af_cfgd = 1; | |
11768 | vty_out (vty, " %s;", afi_safi_print(afi, safi)); | |
11769 | } | |
11770 | } | |
11771 | if (!af_cfgd) | |
11772 | vty_out (vty, " none%s", VTY_NEWLINE); | |
11773 | else | |
11774 | vty_out (vty, "%s", VTY_NEWLINE); | |
11775 | ||
11776 | /* Display listen ranges (for dynamic neighbors), if any */ | |
11777 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
11778 | { | |
11779 | if (afi == AFI_IP) | |
11780 | af_str = "IPv4"; | |
11781 | else if (afi == AFI_IP6) | |
11782 | af_str = "IPv6"; | |
11783 | lr_count = listcount(group->listen_range[afi]); | |
11784 | if (lr_count) | |
11785 | { | |
11786 | vty_out(vty, | |
11787 | " %d %s listen range(s)%s", | |
11788 | lr_count, af_str, VTY_NEWLINE); | |
11789 | ||
11790 | ||
11791 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node, | |
11792 | nnode, range)) | |
11793 | { | |
11794 | prefix2str(range, buf, sizeof(buf)); | |
11795 | vty_out(vty, " %s%s", buf, VTY_NEWLINE); | |
11796 | } | |
11797 | } | |
11798 | } | |
11799 | ||
11800 | /* Display group members and their status */ | |
11801 | if (listcount(group->peer)) | |
11802 | { | |
11803 | vty_out (vty, " Peer-group members:%s", VTY_NEWLINE); | |
11804 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
11805 | { | |
11806 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
11807 | peer_status = "Idle (Admin)"; | |
11808 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
11809 | peer_status = "Idle (PfxCt)"; | |
11810 | else | |
11811 | peer_status = LOOKUP(bgp_status_msg, peer->status); | |
11812 | ||
11813 | dynamic = peer_dynamic_neighbor(peer); | |
11814 | vty_out (vty, " %s %s %s %s", | |
11815 | peer->host, dynamic ? "(dynamic)" : "", | |
11816 | peer_status, VTY_NEWLINE); | |
11817 | } | |
11818 | } | |
11819 | ||
11820 | return CMD_SUCCESS; | |
11821 | } | |
11822 | ||
11823 | /* Show BGP peer group's information. */ | |
11824 | enum show_group_type | |
11825 | { | |
11826 | show_all_groups, | |
11827 | show_peer_group | |
11828 | }; | |
11829 | ||
11830 | static int | |
11831 | bgp_show_peer_group (struct vty *vty, struct bgp *bgp, | |
11832 | enum show_group_type type, const char *group_name) | |
11833 | { | |
11834 | struct listnode *node, *nnode; | |
11835 | struct peer_group *group; | |
11836 | int find = 0; | |
11837 | ||
11838 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
11839 | { | |
11840 | switch (type) | |
11841 | { | |
11842 | case show_all_groups: | |
11843 | bgp_show_one_peer_group (vty, group); | |
11844 | break; | |
11845 | case show_peer_group: | |
11846 | if (group_name && (strcmp(group->name, group_name) == 0)) | |
11847 | { | |
11848 | find = 1; | |
11849 | bgp_show_one_peer_group (vty, group); | |
11850 | } | |
11851 | break; | |
11852 | } | |
11853 | } | |
11854 | ||
11855 | if (type == show_peer_group && ! find) | |
11856 | vty_out (vty, "%% No such peer-groupr%s", VTY_NEWLINE); | |
11857 | ||
11858 | return CMD_SUCCESS; | |
11859 | } | |
11860 | ||
11861 | static int | |
11862 | bgp_show_peer_group_vty (struct vty *vty, const char *name, | |
11863 | enum show_group_type type, const char *group_name) | |
11864 | { | |
11865 | struct bgp *bgp; | |
11866 | int ret = CMD_SUCCESS; | |
11867 | ||
11868 | if (name) | |
11869 | { | |
11870 | bgp = bgp_lookup_by_name (name); | |
11871 | ||
11872 | if (! bgp) | |
11873 | { | |
11874 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
11875 | return CMD_WARNING; | |
11876 | } | |
11877 | } | |
11878 | ||
11879 | bgp = bgp_get_default (); | |
11880 | ||
11881 | if (bgp) | |
11882 | ret = bgp_show_peer_group (vty, bgp, type, group_name); | |
11883 | ||
11884 | return ret; | |
11885 | } | |
11886 | ||
11887 | DEFUN (show_ip_bgp_peer_groups, | |
11888 | show_ip_bgp_peer_groups_cmd, | |
11889 | "show ip bgp peer-group", | |
11890 | SHOW_STR | |
11891 | IP_STR | |
11892 | BGP_STR | |
11893 | "Detailed information on all BGP peer groups\n") | |
11894 | { | |
11895 | return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL); | |
11896 | } | |
11897 | ||
11898 | DEFUN (show_ip_bgp_instance_peer_groups, | |
11899 | show_ip_bgp_instance_peer_groups_cmd, | |
11900 | "show ip bgp view WORD peer-group", | |
11901 | SHOW_STR | |
11902 | IP_STR | |
11903 | BGP_STR | |
11904 | "BGP View\n" | |
11905 | "Detailed information on all BGP peer groups\n") | |
11906 | { | |
11907 | return bgp_show_peer_group_vty (vty, argv[0], show_all_groups, NULL); | |
11908 | } | |
11909 | ||
11910 | DEFUN (show_ip_bgp_peer_group, | |
11911 | show_ip_bgp_peer_group_cmd, | |
11912 | "show ip bgp peer-group WORD", | |
11913 | SHOW_STR | |
11914 | IP_STR | |
11915 | BGP_STR | |
11916 | "BGP peer-group name\n" | |
11917 | "Detailed information on a BGP peer group\n") | |
11918 | { | |
11919 | return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]); | |
11920 | } | |
11921 | ||
11922 | DEFUN (show_ip_bgp_instance_peer_group, | |
11923 | show_ip_bgp_instance_peer_group_cmd, | |
11924 | "show ip bgp view WORD peer-group WORD", | |
11925 | SHOW_STR | |
11926 | IP_STR | |
11927 | BGP_STR | |
11928 | "BGP View\n" | |
11929 | "BGP peer-group name\n" | |
11930 | "Detailed information on a BGP peer group\n") | |
11931 | { | |
11932 | return bgp_show_peer_group_vty (vty, argv[0], show_peer_group, argv[1]); | |
11933 | } | |
3f9c7369 | 11934 | |
718e3744 | 11935 | /* Redistribute VTY commands. */ |
11936 | ||
718e3744 | 11937 | DEFUN (bgp_redistribute_ipv4, |
11938 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 11939 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 11940 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11941 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 11942 | { |
11943 | int type; | |
11944 | ||
e0ca5fde DL |
11945 | type = proto_redistnum (AFI_IP, argv[0]); |
11946 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11947 | { |
11948 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11949 | return CMD_WARNING; | |
11950 | } | |
7c8ff89e | 11951 | bgp_redist_add(vty->index, AFI_IP, type, 0); |
8bb0831e | 11952 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 11953 | } |
11954 | ||
11955 | DEFUN (bgp_redistribute_ipv4_rmap, | |
11956 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 11957 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 11958 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11959 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11960 | "Route map reference\n" |
11961 | "Pointer to route-map entries\n") | |
11962 | { | |
11963 | int type; | |
7c8ff89e | 11964 | struct bgp_redist *red; |
718e3744 | 11965 | |
e0ca5fde DL |
11966 | type = proto_redistnum (AFI_IP, argv[0]); |
11967 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11968 | { |
11969 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11970 | return CMD_WARNING; | |
11971 | } | |
11972 | ||
7c8ff89e DS |
11973 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
11974 | bgp_redistribute_rmap_set (red, argv[1]); | |
8bb0831e | 11975 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 11976 | } |
11977 | ||
11978 | DEFUN (bgp_redistribute_ipv4_metric, | |
11979 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 11980 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 11981 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11982 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11983 | "Metric for redistributed routes\n" |
11984 | "Default metric\n") | |
11985 | { | |
11986 | int type; | |
11987 | u_int32_t metric; | |
7c8ff89e | 11988 | struct bgp_redist *red; |
718e3744 | 11989 | |
e0ca5fde DL |
11990 | type = proto_redistnum (AFI_IP, argv[0]); |
11991 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11992 | { |
11993 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11994 | return CMD_WARNING; | |
11995 | } | |
11996 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
11997 | ||
7c8ff89e | 11998 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 11999 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
8bb0831e | 12000 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 12001 | } |
12002 | ||
12003 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
12004 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 12005 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 12006 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 12007 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 12008 | "Route map reference\n" |
12009 | "Pointer to route-map entries\n" | |
12010 | "Metric for redistributed routes\n" | |
12011 | "Default metric\n") | |
12012 | { | |
12013 | int type; | |
12014 | u_int32_t metric; | |
7c8ff89e | 12015 | struct bgp_redist *red; |
718e3744 | 12016 | |
e0ca5fde DL |
12017 | type = proto_redistnum (AFI_IP, argv[0]); |
12018 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12019 | { |
12020 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12021 | return CMD_WARNING; | |
12022 | } | |
12023 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
12024 | ||
7c8ff89e DS |
12025 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
12026 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 12027 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
8bb0831e | 12028 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 12029 | } |
12030 | ||
12031 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
12032 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 12033 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 12034 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 12035 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 12036 | "Metric for redistributed routes\n" |
12037 | "Default metric\n" | |
12038 | "Route map reference\n" | |
12039 | "Pointer to route-map entries\n") | |
12040 | { | |
12041 | int type; | |
12042 | u_int32_t metric; | |
7c8ff89e | 12043 | struct bgp_redist *red; |
718e3744 | 12044 | |
e0ca5fde DL |
12045 | type = proto_redistnum (AFI_IP, argv[0]); |
12046 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12047 | { |
12048 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12049 | return CMD_WARNING; | |
12050 | } | |
12051 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
12052 | ||
7c8ff89e | 12053 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
caf958b4 | 12054 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, type, metric); |
7c8ff89e | 12055 | bgp_redistribute_rmap_set (red, argv[2]); |
8bb0831e | 12056 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 12057 | } |
12058 | ||
7c8ff89e DS |
12059 | DEFUN (bgp_redistribute_ipv4_ospf, |
12060 | bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 12061 | "redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
12062 | "Redistribute information from another routing protocol\n" |
12063 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12064 | "Non-main Kernel Routing Table\n" |
12065 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
12066 | { |
12067 | u_short instance; | |
7a4bb9c5 | 12068 | u_short protocol; |
7c8ff89e | 12069 | |
7a4bb9c5 DS |
12070 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
12071 | ||
12072 | if (strncmp(argv[0], "o", 1) == 0) | |
12073 | protocol = ZEBRA_ROUTE_OSPF; | |
12074 | else | |
12075 | protocol = ZEBRA_ROUTE_TABLE; | |
12076 | ||
12077 | bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
8bb0831e | 12078 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
12079 | } |
12080 | ||
12081 | DEFUN (bgp_redistribute_ipv4_ospf_rmap, | |
12082 | bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 12083 | "redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
12084 | "Redistribute information from another routing protocol\n" |
12085 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12086 | "Non-main Kernel Routing Table\n" |
12087 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12088 | "Route map reference\n" |
12089 | "Pointer to route-map entries\n") | |
12090 | { | |
12091 | struct bgp_redist *red; | |
12092 | u_short instance; | |
7a4bb9c5 | 12093 | int protocol; |
7c8ff89e | 12094 | |
7a4bb9c5 DS |
12095 | if (strncmp(argv[0], "o", 1) == 0) |
12096 | protocol = ZEBRA_ROUTE_OSPF; | |
12097 | else | |
12098 | protocol = ZEBRA_ROUTE_TABLE; | |
12099 | ||
12100 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); | |
12101 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
12102 | bgp_redistribute_rmap_set (red, argv[2]); | |
8bb0831e | 12103 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
12104 | } |
12105 | ||
12106 | DEFUN (bgp_redistribute_ipv4_ospf_metric, | |
12107 | bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 12108 | "redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
12109 | "Redistribute information from another routing protocol\n" |
12110 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12111 | "Non-main Kernel Routing Table\n" |
12112 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12113 | "Metric for redistributed routes\n" |
12114 | "Default metric\n") | |
12115 | { | |
12116 | u_int32_t metric; | |
12117 | struct bgp_redist *red; | |
12118 | u_short instance; | |
7a4bb9c5 | 12119 | int protocol; |
7c8ff89e | 12120 | |
7a4bb9c5 DS |
12121 | if (strncmp(argv[0], "o", 1) == 0) |
12122 | protocol = ZEBRA_ROUTE_OSPF; | |
12123 | else | |
12124 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 12125 | |
7a4bb9c5 DS |
12126 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
12127 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
12128 | ||
12129 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 12130 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
8bb0831e | 12131 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
12132 | } |
12133 | ||
12134 | DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, | |
12135 | bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 12136 | "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
12137 | "Redistribute information from another routing protocol\n" |
12138 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12139 | "Non-main Kernel Routing Table\n" |
12140 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12141 | "Route map reference\n" |
12142 | "Pointer to route-map entries\n" | |
12143 | "Metric for redistributed routes\n" | |
12144 | "Default metric\n") | |
12145 | { | |
12146 | u_int32_t metric; | |
12147 | struct bgp_redist *red; | |
12148 | u_short instance; | |
7a4bb9c5 | 12149 | int protocol; |
7c8ff89e | 12150 | |
7a4bb9c5 DS |
12151 | if (strncmp(argv[0], "o", 1) == 0) |
12152 | protocol = ZEBRA_ROUTE_OSPF; | |
12153 | else | |
12154 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 12155 | |
7a4bb9c5 DS |
12156 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
12157 | VTY_GET_INTEGER ("metric", metric, argv[3]); | |
12158 | ||
12159 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
12160 | bgp_redistribute_rmap_set (red, argv[2]); | |
caf958b4 | 12161 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
8bb0831e | 12162 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
12163 | } |
12164 | ||
12165 | DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, | |
12166 | bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 12167 | "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
12168 | "Redistribute information from another routing protocol\n" |
12169 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12170 | "Non-main Kernel Routing Table\n" |
12171 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12172 | "Metric for redistributed routes\n" |
12173 | "Default metric\n" | |
12174 | "Route map reference\n" | |
12175 | "Pointer to route-map entries\n") | |
12176 | { | |
12177 | u_int32_t metric; | |
12178 | struct bgp_redist *red; | |
12179 | u_short instance; | |
7a4bb9c5 | 12180 | int protocol; |
7c8ff89e | 12181 | |
7a4bb9c5 DS |
12182 | if (strncmp(argv[0], "o", 1) == 0) |
12183 | protocol = ZEBRA_ROUTE_OSPF; | |
12184 | else | |
12185 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 12186 | |
7a4bb9c5 DS |
12187 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
12188 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
12189 | ||
12190 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
caf958b4 | 12191 | bgp_redistribute_metric_set(vty->index, red, AFI_IP, protocol, metric); |
7a4bb9c5 | 12192 | bgp_redistribute_rmap_set (red, argv[3]); |
8bb0831e | 12193 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
12194 | } |
12195 | ||
12196 | DEFUN (no_bgp_redistribute_ipv4_ospf, | |
12197 | no_bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 12198 | "no redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
12199 | NO_STR |
12200 | "Redistribute information from another routing protocol\n" | |
12201 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12202 | "Non-main Kernel Routing Table\n" |
12203 | "Instance ID/Table ID\n") | |
7c8ff89e DS |
12204 | { |
12205 | u_short instance; | |
7a4bb9c5 DS |
12206 | int protocol; |
12207 | ||
12208 | if (strncmp(argv[0], "o", 1) == 0) | |
12209 | protocol = ZEBRA_ROUTE_OSPF; | |
12210 | else | |
12211 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 12212 | |
7a4bb9c5 DS |
12213 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
12214 | return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); | |
7c8ff89e DS |
12215 | } |
12216 | ||
12217 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
12218 | no_bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 12219 | "no redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
12220 | NO_STR |
12221 | "Redistribute information from another routing protocol\n" | |
12222 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12223 | "Non-main Kernel Routing Table\n" |
12224 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12225 | "Route map reference\n" |
12226 | "Pointer to route-map entries\n") | |
12227 | ||
12228 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
12229 | no_bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 12230 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
12231 | NO_STR |
12232 | "Redistribute information from another routing protocol\n" | |
12233 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12234 | "Non-main Kernel Routing Table\n" |
12235 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12236 | "Metric for redistributed routes\n" |
12237 | "Default metric\n") | |
12238 | ||
12239 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
12240 | no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 12241 | "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
12242 | NO_STR |
12243 | "Redistribute information from another routing protocol\n" | |
12244 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12245 | "Non-main Kernel Routing Table\n" |
12246 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12247 | "Route map reference\n" |
12248 | "Pointer to route-map entries\n" | |
12249 | "Metric for redistributed routes\n" | |
12250 | "Default metric\n") | |
12251 | ||
12252 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
12253 | no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 12254 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
12255 | NO_STR |
12256 | "Redistribute information from another routing protocol\n" | |
12257 | "Open Shortest Path First (OSPFv2)\n" | |
2d627ff5 DS |
12258 | "Non-main Kernel Routing Table\n" |
12259 | "Instance ID/Table ID\n" | |
7c8ff89e DS |
12260 | "Metric for redistributed routes\n" |
12261 | "Default metric\n" | |
12262 | "Route map reference\n" | |
12263 | "Pointer to route-map entries\n") | |
12264 | ||
718e3744 | 12265 | DEFUN (no_bgp_redistribute_ipv4, |
12266 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 12267 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 12268 | NO_STR |
12269 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12270 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 12271 | { |
12272 | int type; | |
12273 | ||
e0ca5fde DL |
12274 | type = proto_redistnum (AFI_IP, argv[0]); |
12275 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12276 | { |
12277 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12278 | return CMD_WARNING; | |
12279 | } | |
7c8ff89e | 12280 | return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); |
718e3744 | 12281 | } |
12282 | ||
503006bc | 12283 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 12284 | no_bgp_redistribute_ipv4_rmap_cmd, |
e0ca5fde | 12285 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 12286 | NO_STR |
12287 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12288 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 12289 | "Route map reference\n" |
12290 | "Pointer to route-map entries\n") | |
718e3744 | 12291 | |
503006bc | 12292 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 12293 | no_bgp_redistribute_ipv4_metric_cmd, |
e0ca5fde | 12294 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 12295 | NO_STR |
12296 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12297 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 12298 | "Metric for redistributed routes\n" |
12299 | "Default metric\n") | |
718e3744 | 12300 | |
503006bc | 12301 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 12302 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
e0ca5fde | 12303 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 12304 | NO_STR |
12305 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12306 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 12307 | "Route map reference\n" |
12308 | "Pointer to route-map entries\n" | |
12309 | "Metric for redistributed routes\n" | |
12310 | "Default metric\n") | |
718e3744 | 12311 | |
503006bc | 12312 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 12313 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
e0ca5fde | 12314 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 12315 | NO_STR |
12316 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12317 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 12318 | "Metric for redistributed routes\n" |
12319 | "Default metric\n" | |
12320 | "Route map reference\n" | |
12321 | "Pointer to route-map entries\n") | |
6b0655a2 | 12322 | |
718e3744 | 12323 | #ifdef HAVE_IPV6 |
12324 | DEFUN (bgp_redistribute_ipv6, | |
12325 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 12326 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 12327 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 12328 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 12329 | { |
12330 | int type; | |
12331 | ||
e0ca5fde DL |
12332 | type = proto_redistnum (AFI_IP6, argv[0]); |
12333 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12334 | { |
12335 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12336 | return CMD_WARNING; | |
12337 | } | |
12338 | ||
7c8ff89e | 12339 | bgp_redist_add(vty->index, AFI_IP6, type, 0); |
8bb0831e | 12340 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 12341 | } |
12342 | ||
12343 | DEFUN (bgp_redistribute_ipv6_rmap, | |
12344 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 12345 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 12346 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 12347 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12348 | "Route map reference\n" |
12349 | "Pointer to route-map entries\n") | |
12350 | { | |
12351 | int type; | |
7c8ff89e | 12352 | struct bgp_redist *red; |
718e3744 | 12353 | |
e0ca5fde DL |
12354 | type = proto_redistnum (AFI_IP6, argv[0]); |
12355 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12356 | { |
12357 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12358 | return CMD_WARNING; | |
12359 | } | |
12360 | ||
7c8ff89e DS |
12361 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
12362 | bgp_redistribute_rmap_set (red, argv[1]); | |
8bb0831e | 12363 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 12364 | } |
12365 | ||
12366 | DEFUN (bgp_redistribute_ipv6_metric, | |
12367 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 12368 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 12369 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 12370 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12371 | "Metric for redistributed routes\n" |
12372 | "Default metric\n") | |
12373 | { | |
12374 | int type; | |
12375 | u_int32_t metric; | |
7c8ff89e | 12376 | struct bgp_redist *red; |
718e3744 | 12377 | |
e0ca5fde DL |
12378 | type = proto_redistnum (AFI_IP6, argv[0]); |
12379 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12380 | { |
12381 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12382 | return CMD_WARNING; | |
12383 | } | |
12384 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
12385 | ||
7c8ff89e | 12386 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 12387 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
8bb0831e | 12388 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 12389 | } |
12390 | ||
12391 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
12392 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 12393 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 12394 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 12395 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12396 | "Route map reference\n" |
12397 | "Pointer to route-map entries\n" | |
12398 | "Metric for redistributed routes\n" | |
12399 | "Default metric\n") | |
12400 | { | |
12401 | int type; | |
12402 | u_int32_t metric; | |
7c8ff89e | 12403 | struct bgp_redist *red; |
718e3744 | 12404 | |
e0ca5fde DL |
12405 | type = proto_redistnum (AFI_IP6, argv[0]); |
12406 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12407 | { |
12408 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12409 | return CMD_WARNING; | |
12410 | } | |
12411 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
12412 | ||
7c8ff89e DS |
12413 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
12414 | bgp_redistribute_rmap_set (red, argv[1]); | |
caf958b4 | 12415 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, type, metric); |
8bb0831e | 12416 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 12417 | } |
12418 | ||
12419 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
12420 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 12421 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 12422 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 12423 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12424 | "Metric for redistributed routes\n" |
12425 | "Default metric\n" | |
12426 | "Route map reference\n" | |
12427 | "Pointer to route-map entries\n") | |
12428 | { | |
12429 | int type; | |
12430 | u_int32_t metric; | |
7c8ff89e | 12431 | struct bgp_redist *red; |
718e3744 | 12432 | |
e0ca5fde DL |
12433 | type = proto_redistnum (AFI_IP6, argv[0]); |
12434 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12435 | { |
12436 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12437 | return CMD_WARNING; | |
12438 | } | |
12439 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
12440 | ||
7c8ff89e | 12441 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
caf958b4 | 12442 | bgp_redistribute_metric_set(vty->index, red, AFI_IP6, SAFI_UNICAST, metric); |
7c8ff89e | 12443 | bgp_redistribute_rmap_set (red, argv[2]); |
8bb0831e | 12444 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 12445 | } |
12446 | ||
12447 | DEFUN (no_bgp_redistribute_ipv6, | |
12448 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 12449 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 12450 | NO_STR |
12451 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12452 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 12453 | { |
12454 | int type; | |
12455 | ||
e0ca5fde DL |
12456 | type = proto_redistnum (AFI_IP6, argv[0]); |
12457 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 12458 | { |
12459 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
12460 | return CMD_WARNING; | |
12461 | } | |
12462 | ||
7c8ff89e | 12463 | return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0); |
718e3744 | 12464 | } |
12465 | ||
503006bc | 12466 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 12467 | no_bgp_redistribute_ipv6_rmap_cmd, |
e0ca5fde | 12468 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 12469 | NO_STR |
12470 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12471 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12472 | "Route map reference\n" |
12473 | "Pointer to route-map entries\n") | |
718e3744 | 12474 | |
503006bc | 12475 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 12476 | no_bgp_redistribute_ipv6_metric_cmd, |
e0ca5fde | 12477 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 12478 | NO_STR |
12479 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12480 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12481 | "Metric for redistributed routes\n" |
12482 | "Default metric\n") | |
718e3744 | 12483 | |
503006bc | 12484 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 12485 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
e0ca5fde | 12486 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 12487 | NO_STR |
12488 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12489 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12490 | "Route map reference\n" |
12491 | "Pointer to route-map entries\n" | |
12492 | "Metric for redistributed routes\n" | |
12493 | "Default metric\n") | |
718e3744 | 12494 | |
503006bc | 12495 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 12496 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
e0ca5fde | 12497 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 12498 | NO_STR |
12499 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 12500 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 12501 | "Metric for redistributed routes\n" |
12502 | "Default metric\n" | |
12503 | "Route map reference\n" | |
12504 | "Pointer to route-map entries\n") | |
12505 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 12506 | |
718e3744 | 12507 | int |
12508 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
12509 | safi_t safi, int *write) | |
12510 | { | |
12511 | int i; | |
718e3744 | 12512 | |
12513 | /* Unicast redistribution only. */ | |
12514 | if (safi != SAFI_UNICAST) | |
12515 | return 0; | |
12516 | ||
12517 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
12518 | { | |
12519 | /* Redistribute BGP does not make sense. */ | |
7c8ff89e | 12520 | if (i != ZEBRA_ROUTE_BGP) |
718e3744 | 12521 | { |
7c8ff89e DS |
12522 | struct list *red_list; |
12523 | struct listnode *node; | |
12524 | struct bgp_redist *red; | |
718e3744 | 12525 | |
7c8ff89e DS |
12526 | red_list = bgp->redist[afi][i]; |
12527 | if (!red_list) | |
12528 | continue; | |
718e3744 | 12529 | |
7c8ff89e DS |
12530 | for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) |
12531 | { | |
12532 | /* Display "address-family" when it is not yet diplayed. */ | |
12533 | bgp_config_write_family_header (vty, afi, safi, write); | |
12534 | ||
12535 | /* "redistribute" configuration. */ | |
0b960b4d | 12536 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
7c8ff89e DS |
12537 | if (red->instance) |
12538 | vty_out (vty, " %d", red->instance); | |
12539 | if (red->redist_metric_flag) | |
12540 | vty_out (vty, " metric %u", red->redist_metric); | |
12541 | if (red->rmap.name) | |
12542 | vty_out (vty, " route-map %s", red->rmap.name); | |
12543 | vty_out (vty, "%s", VTY_NEWLINE); | |
12544 | } | |
718e3744 | 12545 | } |
12546 | } | |
12547 | return *write; | |
12548 | } | |
6b0655a2 | 12549 | |
718e3744 | 12550 | /* BGP node structure. */ |
7fc626de | 12551 | static struct cmd_node bgp_node = |
718e3744 | 12552 | { |
12553 | BGP_NODE, | |
12554 | "%s(config-router)# ", | |
12555 | 1, | |
12556 | }; | |
12557 | ||
7fc626de | 12558 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 12559 | { |
12560 | BGP_IPV4_NODE, | |
12561 | "%s(config-router-af)# ", | |
12562 | 1, | |
12563 | }; | |
12564 | ||
7fc626de | 12565 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 12566 | { |
12567 | BGP_IPV4M_NODE, | |
12568 | "%s(config-router-af)# ", | |
12569 | 1, | |
12570 | }; | |
12571 | ||
7fc626de | 12572 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 12573 | { |
12574 | BGP_IPV6_NODE, | |
12575 | "%s(config-router-af)# ", | |
12576 | 1, | |
12577 | }; | |
12578 | ||
7fc626de | 12579 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 12580 | { |
12581 | BGP_IPV6M_NODE, | |
12582 | "%s(config-router-af)# ", | |
12583 | 1, | |
12584 | }; | |
12585 | ||
7fc626de | 12586 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 12587 | { |
12588 | BGP_VPNV4_NODE, | |
12589 | "%s(config-router-af)# ", | |
12590 | 1 | |
12591 | }; | |
6b0655a2 | 12592 | |
1f8ae70b | 12593 | static void community_list_vty (void); |
12594 | ||
718e3744 | 12595 | void |
94f2b392 | 12596 | bgp_vty_init (void) |
718e3744 | 12597 | { |
718e3744 | 12598 | /* Install bgp top node. */ |
12599 | install_node (&bgp_node, bgp_config_write); | |
12600 | install_node (&bgp_ipv4_unicast_node, NULL); | |
12601 | install_node (&bgp_ipv4_multicast_node, NULL); | |
12602 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 12603 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 12604 | install_node (&bgp_vpnv4_node, NULL); |
12605 | ||
12606 | /* Install default VTY commands to new nodes. */ | |
12607 | install_default (BGP_NODE); | |
12608 | install_default (BGP_IPV4_NODE); | |
12609 | install_default (BGP_IPV4M_NODE); | |
12610 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 12611 | install_default (BGP_IPV6M_NODE); |
718e3744 | 12612 | install_default (BGP_VPNV4_NODE); |
12613 | ||
12614 | /* "bgp multiple-instance" commands. */ | |
12615 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
12616 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
12617 | ||
12618 | /* "bgp config-type" commands. */ | |
12619 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
12620 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); | |
12621 | ||
12622 | /* Dummy commands (Currently not supported) */ | |
12623 | install_element (BGP_NODE, &no_synchronization_cmd); | |
12624 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
12625 | ||
12626 | /* "router bgp" commands. */ | |
12627 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
12628 | install_element (CONFIG_NODE, &router_bgp_view_cmd); | |
2385a876 | 12629 | install_element (CONFIG_NODE, &router_bgp_noasn_cmd); |
718e3744 | 12630 | |
12631 | /* "no router bgp" commands. */ | |
12632 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
12633 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); | |
12634 | ||
12635 | /* "bgp router-id" commands. */ | |
12636 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
12637 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
12638 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
12639 | ||
12640 | /* "bgp cluster-id" commands. */ | |
12641 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
12642 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
12643 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
12644 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); | |
12645 | ||
12646 | /* "bgp confederation" commands. */ | |
12647 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
12648 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
12649 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
12650 | ||
12651 | /* "bgp confederation peers" commands. */ | |
12652 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
12653 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
12654 | ||
abc920f8 DS |
12655 | /* bgp max-med command */ |
12656 | install_element (BGP_NODE, &bgp_maxmed_admin_cmd); | |
12657 | install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd); | |
12658 | install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); | |
12659 | install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd); | |
12660 | install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); | |
12661 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); | |
12662 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd); | |
12663 | install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); | |
12664 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd); | |
12665 | ||
907f92c8 DS |
12666 | /* bgp disable-ebgp-connected-nh-check */ |
12667 | install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd); | |
12668 | install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd); | |
12669 | ||
f188f2c4 DS |
12670 | /* bgp update-delay command */ |
12671 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
12672 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
12673 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
12674 | install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); | |
12675 | ||
cb1faec9 DS |
12676 | install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); |
12677 | install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); | |
12678 | ||
3f9c7369 DS |
12679 | install_element (BGP_NODE, &bgp_coalesce_time_cmd); |
12680 | install_element (BGP_NODE, &no_bgp_coalesce_time_cmd); | |
12681 | ||
165b5fff JB |
12682 | /* "maximum-paths" commands. */ |
12683 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
12684 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
12685 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); | |
12686 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); | |
12687 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
12688 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); | |
431aa9f9 DS |
12689 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
12690 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
12691 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); | |
165b5fff | 12692 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 12693 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff JB |
12694 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
12695 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 12696 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 12697 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 12698 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 12699 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
5e242b0d | 12700 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 12701 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
431aa9f9 | 12702 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 12703 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 DS |
12704 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
12705 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 12706 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 12707 | |
718e3744 | 12708 | /* "timers bgp" commands. */ |
12709 | install_element (BGP_NODE, &bgp_timers_cmd); | |
12710 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
12711 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
12712 | ||
518f0eb1 DS |
12713 | /* route-map delay-timer commands */ |
12714 | install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd); | |
12715 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
f414725f | 12716 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_val_cmd); |
518f0eb1 | 12717 | |
718e3744 | 12718 | /* "bgp client-to-client reflection" commands */ |
12719 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
12720 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
12721 | ||
12722 | /* "bgp always-compare-med" commands */ | |
12723 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
12724 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
12725 | ||
12726 | /* "bgp deterministic-med" commands */ | |
12727 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
12728 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 12729 | |
538621f2 | 12730 | /* "bgp graceful-restart" commands */ |
12731 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
12732 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 12733 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
12734 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
12735 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 12736 | |
12737 | /* "bgp fast-external-failover" commands */ | |
12738 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
12739 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
12740 | ||
12741 | /* "bgp enforce-first-as" commands */ | |
12742 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
12743 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
12744 | ||
12745 | /* "bgp bestpath compare-routerid" commands */ | |
12746 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
12747 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
12748 | ||
12749 | /* "bgp bestpath as-path ignore" commands */ | |
12750 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
12751 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
12752 | ||
6811845b | 12753 | /* "bgp bestpath as-path confed" commands */ |
12754 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
12755 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
12756 | ||
2fdd455c PM |
12757 | /* "bgp bestpath as-path multipath-relax" commands */ |
12758 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
12759 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
12760 | ||
16fc1eec DS |
12761 | /* "bgp bestpath as-path multipath-relax no-as-set" commands */ |
12762 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_no_as_set_cmd); | |
12763 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_no_as_set_cmd); | |
12764 | ||
848973c7 | 12765 | /* "bgp log-neighbor-changes" commands */ |
12766 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
12767 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
12768 | ||
718e3744 | 12769 | /* "bgp bestpath med" commands */ |
12770 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
12771 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
12772 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
12773 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
12774 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
12775 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
12776 | ||
12777 | /* "no bgp default ipv4-unicast" commands. */ | |
12778 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
12779 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
12780 | ||
12781 | /* "bgp network import-check" commands. */ | |
12782 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
12783 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); | |
12784 | ||
12785 | /* "bgp default local-preference" commands. */ | |
12786 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
12787 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
12788 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
12789 | ||
04b6bdc0 DW |
12790 | /* bgp default show-hostname */ |
12791 | install_element (BGP_NODE, &bgp_default_show_hostname_cmd); | |
12792 | install_element (BGP_NODE, &no_bgp_default_show_hostname_cmd); | |
12793 | ||
3f9c7369 DS |
12794 | /* "bgp default subgroup-pkt-queue-max" commands. */ |
12795 | install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd); | |
12796 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd); | |
12797 | ||
8bd9d948 DS |
12798 | /* bgp ibgp-allow-policy-mods command */ |
12799 | install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd); | |
12800 | install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd); | |
12801 | ||
f14e6fdb DS |
12802 | /* "bgp listen limit" commands. */ |
12803 | install_element (BGP_NODE, &bgp_listen_limit_cmd); | |
12804 | install_element (BGP_NODE, &no_bgp_listen_limit_cmd); | |
12805 | ||
12806 | /* "bgp listen range" commands. */ | |
12807 | install_element (BGP_NODE, &bgp_listen_range_cmd); | |
12808 | install_element (BGP_NODE, &no_bgp_listen_range_cmd); | |
12809 | ||
718e3744 | 12810 | /* "neighbor remote-as" commands. */ |
12811 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
a80beece | 12812 | install_element (BGP_NODE, &neighbor_interface_config_cmd); |
718e3744 | 12813 | install_element (BGP_NODE, &no_neighbor_cmd); |
12814 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
a80beece | 12815 | install_element (BGP_NODE, &no_neighbor_interface_config_cmd); |
718e3744 | 12816 | |
12817 | /* "neighbor peer-group" commands. */ | |
12818 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
12819 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
a80beece | 12820 | install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd); |
718e3744 | 12821 | |
12822 | /* "neighbor local-as" commands. */ | |
12823 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
12824 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 12825 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 12826 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
12827 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
12828 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
9d3f9705 | 12829 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
718e3744 | 12830 | |
3f9c7369 DS |
12831 | /* "neighbor solo" commands. */ |
12832 | install_element (BGP_NODE, &neighbor_solo_cmd); | |
12833 | install_element (BGP_NODE, &no_neighbor_solo_cmd); | |
12834 | ||
0df7c91f PJ |
12835 | /* "neighbor password" commands. */ |
12836 | install_element (BGP_NODE, &neighbor_password_cmd); | |
12837 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
12838 | ||
718e3744 | 12839 | /* "neighbor activate" commands. */ |
12840 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
12841 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
12842 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
12843 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 12844 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 12845 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
12846 | ||
12847 | /* "no neighbor activate" commands. */ | |
12848 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
12849 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
12850 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
12851 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 12852 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 12853 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
12854 | ||
12855 | /* "neighbor peer-group set" commands. */ | |
12856 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); | |
12857 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
12858 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
12859 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 12860 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 12861 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
12862 | ||
718e3744 | 12863 | /* "no neighbor peer-group unset" commands. */ |
12864 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
12865 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
12866 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
12867 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 12868 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 12869 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
12870 | ||
718e3744 | 12871 | /* "neighbor softreconfiguration inbound" commands.*/ |
12872 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
12873 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
12874 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
12875 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
12876 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
12877 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
12878 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
12879 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 12880 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
12881 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 12882 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
12883 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 12884 | |
12885 | /* "neighbor attribute-unchanged" commands. */ | |
12886 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
12887 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
12888 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
12889 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
12890 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
12891 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
12892 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
12893 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
12894 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
12895 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
12896 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
12897 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
12898 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12899 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12900 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12901 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12902 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12903 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12904 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12905 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12906 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12907 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
12908 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
12909 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
12910 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
12911 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
12912 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
12913 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
12914 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
12915 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
12916 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
12917 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
12918 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
12919 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
12920 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12921 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12922 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12923 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12924 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12925 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12926 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12927 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12928 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12929 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
12930 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
12931 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
12932 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
12933 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
12934 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
12935 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
12936 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
12937 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
12938 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
12939 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
12940 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
12941 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
12942 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12943 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12944 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12945 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12946 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12947 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12948 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12949 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12950 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12951 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
12952 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
12953 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
12954 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
12955 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
12956 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
12957 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
12958 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
12959 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
12960 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
12961 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
12962 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
12963 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
12964 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12965 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12966 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12967 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12968 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12969 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12970 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12971 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12972 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12973 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 12974 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
12975 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
12976 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
12977 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
12978 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
12979 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
12980 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
12981 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
12982 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
12983 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
12984 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
12985 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
12986 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
12987 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
12988 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
12989 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
12990 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
12991 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
12992 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
12993 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
12994 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
12995 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 12996 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
12997 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
12998 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
12999 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
13000 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
13001 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
13002 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
13003 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
13004 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
13005 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
13006 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
13007 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
13008 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
13009 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
13010 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
13011 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
13012 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
13013 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
13014 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
13015 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
13016 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
13017 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
13018 | ||
fee0f4c6 | 13019 | /* "nexthop-local unchanged" commands */ |
13020 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
13021 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
13022 | ||
718e3744 | 13023 | /* "transparent-as" and "transparent-nexthop" for old version |
13024 | compatibility. */ | |
13025 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); | |
13026 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); | |
13027 | ||
13028 | /* "neighbor next-hop-self" commands. */ | |
13029 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
13030 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
13031 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
13032 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
13033 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
13034 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
13035 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
13036 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 13037 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
13038 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 13039 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
13040 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
13041 | ||
a538debe DS |
13042 | /* "neighbor next-hop-self force" commands. */ |
13043 | install_element (BGP_NODE, &neighbor_nexthop_self_force_cmd); | |
13044 | install_element (BGP_NODE, &no_neighbor_nexthop_self_force_cmd); | |
13045 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_force_cmd); | |
13046 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
13047 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_force_cmd); | |
13048 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
13049 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_force_cmd); | |
13050 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_force_cmd); | |
13051 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_force_cmd); | |
13052 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_force_cmd); | |
13053 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_force_cmd); | |
13054 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_force_cmd); | |
13055 | ||
c7122e14 DS |
13056 | /* "neighbor as-override" commands. */ |
13057 | install_element (BGP_NODE, &neighbor_as_override_cmd); | |
13058 | install_element (BGP_NODE, &no_neighbor_as_override_cmd); | |
13059 | install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd); | |
13060 | install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd); | |
13061 | install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd); | |
13062 | install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd); | |
13063 | install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd); | |
13064 | install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd); | |
13065 | install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd); | |
13066 | install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd); | |
13067 | install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd); | |
13068 | install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd); | |
13069 | ||
718e3744 | 13070 | /* "neighbor remove-private-AS" commands. */ |
13071 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
13072 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
13073 | install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd); |
13074 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd); | |
13075 | install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
13076 | install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
13077 | install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
13078 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 13079 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
13080 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
13081 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd); |
13082 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
13083 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
13084 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
13085 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
13086 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 13087 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
13088 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
13089 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd); |
13090 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
13091 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
13092 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
13093 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
13094 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 13095 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
13096 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
13097 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd); |
13098 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
13099 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
13100 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
13101 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
13102 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
25ffbdc1 | 13103 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
13104 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
13105 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd); |
13106 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
13107 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
13108 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
13109 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
13110 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 13111 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
13112 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
13113 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd); |
13114 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
13115 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
13116 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
13117 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
13118 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 13119 | |
13120 | /* "neighbor send-community" commands.*/ | |
13121 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
13122 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
13123 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
13124 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
13125 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
13126 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
13127 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
13128 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
13129 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
13130 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
13131 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
13132 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
13133 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
13134 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
13135 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
13136 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 13137 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
13138 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
13139 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
13140 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 13141 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
13142 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
13143 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
13144 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
13145 | ||
13146 | /* "neighbor route-reflector" commands.*/ | |
13147 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
13148 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
13149 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
13150 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
13151 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
13152 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
13153 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
13154 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 13155 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
13156 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 13157 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
13158 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
13159 | ||
13160 | /* "neighbor route-server" commands.*/ | |
13161 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
13162 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
13163 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
13164 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
13165 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
13166 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
13167 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
13168 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 13169 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
13170 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 13171 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
13172 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
13173 | ||
13174 | /* "neighbor passive" commands. */ | |
13175 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
13176 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
13177 | ||
d5a5c8f0 | 13178 | |
718e3744 | 13179 | /* "neighbor shutdown" commands. */ |
13180 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
13181 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
13182 | ||
c9502438 | 13183 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
718e3744 | 13184 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
13185 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); | |
13186 | ||
8a92a8a0 DS |
13187 | /* "neighbor capability extended-nexthop" commands.*/ |
13188 | install_element (BGP_NODE, &neighbor_capability_enhe_cmd); | |
13189 | install_element (BGP_NODE, &no_neighbor_capability_enhe_cmd); | |
13190 | ||
718e3744 | 13191 | /* "neighbor capability orf prefix-list" commands.*/ |
13192 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
13193 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
13194 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
13195 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
13196 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
13197 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
13198 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
13199 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 13200 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
13201 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 13202 | |
13203 | /* "neighbor capability dynamic" commands.*/ | |
13204 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
13205 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
13206 | ||
13207 | /* "neighbor dont-capability-negotiate" commands. */ | |
13208 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
13209 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
13210 | ||
13211 | /* "neighbor ebgp-multihop" commands. */ | |
13212 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
13213 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
13214 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
13215 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
13216 | ||
6ffd2079 | 13217 | /* "neighbor disable-connected-check" commands. */ |
13218 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
13219 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 13220 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
13221 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
13222 | ||
13223 | /* "neighbor description" commands. */ | |
13224 | install_element (BGP_NODE, &neighbor_description_cmd); | |
13225 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
13226 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
13227 | ||
13228 | /* "neighbor update-source" commands. "*/ | |
13229 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
13230 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
13231 | ||
13232 | /* "neighbor default-originate" commands. */ | |
13233 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
13234 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
13235 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
13236 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
13237 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
13238 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
13239 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
13240 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
13241 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
13242 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
13243 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
13244 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
13245 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
13246 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
13247 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
13248 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 13249 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
13250 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
13251 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
13252 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 13253 | |
13254 | /* "neighbor port" commands. */ | |
13255 | install_element (BGP_NODE, &neighbor_port_cmd); | |
13256 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
13257 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
13258 | ||
13259 | /* "neighbor weight" commands. */ | |
13260 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
13261 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
13262 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
13263 | ||
13264 | /* "neighbor override-capability" commands. */ | |
13265 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
13266 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
13267 | ||
13268 | /* "neighbor strict-capability-match" commands. */ | |
13269 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
13270 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
13271 | ||
13272 | /* "neighbor timers" commands. */ | |
13273 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
13274 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
13275 | ||
13276 | /* "neighbor timers connect" commands. */ | |
13277 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
13278 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
13279 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
13280 | ||
13281 | /* "neighbor advertisement-interval" commands. */ | |
13282 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
13283 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
13284 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
13285 | ||
13286 | /* "neighbor version" commands. */ | |
13287 | install_element (BGP_NODE, &neighbor_version_cmd); | |
718e3744 | 13288 | |
13289 | /* "neighbor interface" commands. */ | |
13290 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
13291 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
13292 | ||
13293 | /* "neighbor distribute" commands. */ | |
13294 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
13295 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
13296 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
13297 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
13298 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
13299 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
13300 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
13301 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 13302 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
13303 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 13304 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
13305 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
13306 | ||
13307 | /* "neighbor prefix-list" commands. */ | |
13308 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
13309 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
13310 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
13311 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
13312 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
13313 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
13314 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
13315 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 13316 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
13317 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 13318 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
13319 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
13320 | ||
13321 | /* "neighbor filter-list" commands. */ | |
13322 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
13323 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
13324 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
13325 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
13326 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
13327 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
13328 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
13329 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 13330 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
13331 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 13332 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
13333 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
13334 | ||
13335 | /* "neighbor route-map" commands. */ | |
13336 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
13337 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
13338 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
13339 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
13340 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
13341 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
13342 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
13343 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 13344 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
13345 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 13346 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
13347 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
13348 | ||
13349 | /* "neighbor unsuppress-map" commands. */ | |
13350 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
13351 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
13352 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
13353 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
13354 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
13355 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
13356 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
13357 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 13358 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
13359 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 13360 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
13361 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 13362 | |
13363 | /* "neighbor maximum-prefix" commands. */ | |
13364 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 13365 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 13366 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 13367 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 13368 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
13369 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13370 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
13371 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 13372 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
13373 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
13374 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
13375 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
13376 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13377 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 13378 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 13379 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 13380 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 13381 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
13382 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13383 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
13384 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 13385 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
13386 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
13387 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
13388 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
13389 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13390 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 13391 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 13392 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 13393 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 13394 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
13395 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13396 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
13397 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 13398 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
13399 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
13400 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
13401 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
13402 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13403 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 13404 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 13405 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 13406 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 13407 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
13408 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13409 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
13410 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 13411 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
13412 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
13413 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
13414 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
13415 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 13416 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
13417 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
13418 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
13419 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
13420 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
13421 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
13422 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
13423 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
13424 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
13425 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
13426 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
13427 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
13428 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13429 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 13430 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 13431 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 13432 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 13433 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
13434 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13435 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
13436 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 13437 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
13438 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
13439 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
13440 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
13441 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 13442 | |
13443 | /* "neighbor allowas-in" */ | |
13444 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
13445 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
13446 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
13447 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); | |
13448 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
13449 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
13450 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); | |
13451 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
13452 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
13453 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); | |
13454 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
13455 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
25ffbdc1 | 13456 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
13457 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
13458 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
718e3744 | 13459 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
13460 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
13461 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
13462 | ||
13463 | /* address-family commands. */ | |
13464 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
13465 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
13466 | #ifdef HAVE_IPV6 | |
13467 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 13468 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 13469 | #endif /* HAVE_IPV6 */ |
13470 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
13471 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
13472 | ||
13473 | /* "exit-address-family" command. */ | |
13474 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
13475 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
13476 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 13477 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 13478 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
13479 | ||
13480 | /* "clear ip bgp commands" */ | |
13481 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
13482 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
13483 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
13484 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); | |
13485 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); | |
13486 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); | |
13487 | #ifdef HAVE_IPV6 | |
13488 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); | |
13489 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
13490 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
13491 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); | |
13492 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); | |
13493 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); | |
13494 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); | |
13495 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); | |
13496 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); | |
13497 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); | |
13498 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); | |
13499 | #endif /* HAVE_IPV6 */ | |
13500 | ||
13501 | /* "clear ip bgp neighbor soft in" */ | |
13502 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
13503 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
13504 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
13505 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); | |
13506 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); | |
13507 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); | |
13508 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); | |
13509 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); | |
13510 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
13511 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); | |
13512 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); | |
13513 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
13514 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); | |
13515 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); | |
13516 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
13517 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); | |
13518 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); | |
13519 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
13520 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
13521 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
13522 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); | |
13523 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); | |
13524 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); | |
13525 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); | |
13526 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); | |
13527 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
13528 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); | |
13529 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); | |
13530 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
13531 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); | |
13532 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); | |
13533 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
13534 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); | |
13535 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); | |
13536 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
13537 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
13538 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
13539 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
13540 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
13541 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
13542 | #ifdef HAVE_IPV6 | |
13543 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); | |
13544 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
13545 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
13546 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); | |
13547 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
13548 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); | |
13549 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); | |
13550 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
13551 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); | |
13552 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); | |
13553 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
13554 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); | |
13555 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); | |
13556 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
13557 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); | |
13558 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); | |
13559 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
13560 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); | |
13561 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); | |
13562 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
13563 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); | |
13564 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); | |
13565 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
13566 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); | |
13567 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); | |
13568 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
13569 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); | |
13570 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); | |
13571 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
13572 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); | |
13573 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); | |
13574 | #endif /* HAVE_IPV6 */ | |
13575 | ||
8ad7271d DS |
13576 | /* clear ip bgp prefix */ |
13577 | install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); | |
13578 | install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); | |
13579 | ||
718e3744 | 13580 | /* "clear ip bgp neighbor soft out" */ |
13581 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
13582 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
13583 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
13584 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); | |
13585 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); | |
13586 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); | |
13587 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); | |
13588 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); | |
13589 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); | |
13590 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); | |
13591 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); | |
13592 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); | |
13593 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
13594 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
13595 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); | |
13596 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); | |
13597 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); | |
13598 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); | |
13599 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); | |
13600 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); | |
13601 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); | |
13602 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); | |
13603 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); | |
13604 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
13605 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
13606 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
13607 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
13608 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
13609 | #ifdef HAVE_IPV6 | |
13610 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); | |
13611 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
13612 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
13613 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); | |
13614 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); | |
13615 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); | |
13616 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); | |
13617 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); | |
13618 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); | |
13619 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); | |
13620 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); | |
13621 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); | |
13622 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); | |
13623 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); | |
13624 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); | |
13625 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); | |
13626 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); | |
13627 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); | |
13628 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); | |
13629 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); | |
13630 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); | |
13631 | #endif /* HAVE_IPV6 */ | |
13632 | ||
13633 | /* "clear ip bgp neighbor soft" */ | |
13634 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
13635 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
13636 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
13637 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); | |
13638 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); | |
13639 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); | |
13640 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); | |
13641 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
13642 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
13643 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); | |
13644 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); | |
13645 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); | |
13646 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); | |
13647 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
13648 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
13649 | #ifdef HAVE_IPV6 | |
13650 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); | |
13651 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
13652 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
13653 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); | |
13654 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); | |
13655 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); | |
13656 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); | |
13657 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); | |
13658 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); | |
13659 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); | |
13660 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); | |
13661 | #endif /* HAVE_IPV6 */ | |
13662 | ||
fee0f4c6 | 13663 | /* "clear ip bgp neighbor rsclient" */ |
13664 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); | |
13665 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); | |
13666 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); | |
13667 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); | |
13668 | #ifdef HAVE_IPV6 | |
13669 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); | |
13670 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); | |
13671 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); | |
13672 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); | |
13673 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); | |
13674 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); | |
13675 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); | |
13676 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); | |
13677 | #endif /* HAVE_IPV6 */ | |
13678 | ||
718e3744 | 13679 | /* "show ip bgp summary" commands. */ |
13680 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
13681 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); |
13682 | install_element (VIEW_NODE, &show_bgp_updgrps_cmd); | |
13683 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8fe8a7f6 DS |
13684 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_s_cmd); |
13685 | install_element (VIEW_NODE, &show_bgp_updgrps_s_cmd); | |
13686 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
3f9c7369 DS |
13687 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); |
13688 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd); | |
13689 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
8fe8a7f6 DS |
13690 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
13691 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd); | |
13692 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd); | |
718e3744 | 13693 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
13694 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 13695 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 13696 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 13697 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 13698 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
13699 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
13700 | #ifdef HAVE_IPV6 | |
13701 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
13702 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); | |
13703 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 13704 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 13705 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 13706 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
13707 | #endif /* HAVE_IPV6 */ |
13708 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
13709 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); |
13710 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd); | |
13711 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8fe8a7f6 DS |
13712 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_s_cmd); |
13713 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_s_cmd); | |
13714 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
3f9c7369 DS |
13715 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd); |
13716 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd); | |
13717 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
8fe8a7f6 DS |
13718 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
13719 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_s_cmd); | |
13720 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_s_cmd); | |
62687ff1 PJ |
13721 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
13722 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 13723 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
62687ff1 | 13724 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 13725 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
62687ff1 PJ |
13726 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
13727 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
13728 | #ifdef HAVE_IPV6 | |
13729 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
13730 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); | |
13731 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 13732 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
62687ff1 | 13733 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 13734 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 13735 | #endif /* HAVE_IPV6 */ |
13736 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
13737 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); |
13738 | install_element (ENABLE_NODE, &show_bgp_updgrps_cmd); | |
13739 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd); | |
8fe8a7f6 DS |
13740 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_s_cmd); |
13741 | install_element (ENABLE_NODE, &show_bgp_updgrps_s_cmd); | |
13742 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_s_cmd); | |
3f9c7369 DS |
13743 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd); |
13744 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd); | |
13745 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
8fe8a7f6 DS |
13746 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_s_cmd); |
13747 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_s_cmd); | |
13748 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_s_cmd); | |
718e3744 | 13749 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
13750 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 13751 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 13752 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 13753 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 13754 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
13755 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
13756 | #ifdef HAVE_IPV6 | |
13757 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
13758 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); | |
13759 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 13760 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 13761 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 13762 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 13763 | #endif /* HAVE_IPV6 */ |
13764 | ||
13765 | /* "show ip bgp neighbors" commands. */ | |
13766 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
13767 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
13768 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
13769 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
13770 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
13771 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
13772 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
13773 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
13774 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
13775 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
62687ff1 PJ |
13776 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
13777 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
13778 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
13779 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
13780 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 13781 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
13782 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
13783 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
13784 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
13785 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
13786 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
13787 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
13788 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
13789 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
13790 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
13791 | ||
13792 | #ifdef HAVE_IPV6 | |
13793 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
13794 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
13795 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
13796 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 13797 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
13798 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
13799 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
13800 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
13801 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
13802 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
13803 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
13804 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 13805 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
13806 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
13807 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
13808 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 13809 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
13810 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
13811 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
13812 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 13813 | |
13814 | /* Old commands. */ | |
13815 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
13816 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
13817 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
13818 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
13819 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 13820 | |
f14e6fdb DS |
13821 | /* "show ip bgp peer-group" commands. */ |
13822 | install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); | |
13823 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
13824 | install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd); | |
13825 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
13826 | install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd); | |
13827 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
13828 | install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd); | |
13829 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
13830 | ||
fee0f4c6 | 13831 | /* "show ip bgp rsclient" commands. */ |
13832 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); | |
13833 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
13834 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
13835 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
13836 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
13837 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
13838 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
13839 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
13840 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
13841 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
13842 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
13843 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 13844 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
13845 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
13846 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
13847 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
13848 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
13849 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 13850 | |
13851 | #ifdef HAVE_IPV6 | |
13852 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); | |
13853 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
13854 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
13855 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
13856 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
13857 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
13858 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
13859 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
13860 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
13861 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
13862 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
13863 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 13864 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
13865 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
13866 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
13867 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
13868 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
13869 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 13870 | #endif /* HAVE_IPV6 */ |
718e3744 | 13871 | |
13872 | /* "show ip bgp paths" commands. */ | |
13873 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
13874 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
13875 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
13876 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
13877 | ||
13878 | /* "show ip bgp community" commands. */ | |
13879 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
13880 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
13881 | ||
13882 | /* "show ip bgp attribute-info" commands. */ | |
13883 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
13884 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
13885 | ||
13886 | /* "redistribute" commands. */ | |
13887 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
13888 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
13889 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
13890 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
13891 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
13892 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
13893 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
13894 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
13895 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
13896 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
7c8ff89e DS |
13897 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd); |
13898 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
13899 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
13900 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
13901 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
13902 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
13903 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
13904 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
13905 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
13906 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
718e3744 | 13907 | #ifdef HAVE_IPV6 |
13908 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
13909 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
13910 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
13911 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
13912 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
13913 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
13914 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
13915 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
13916 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
13917 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
13918 | #endif /* HAVE_IPV6 */ | |
13919 | ||
fa411a21 NH |
13920 | /* ttl_security commands */ |
13921 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
13922 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
13923 | ||
4bf6a362 PJ |
13924 | /* "show bgp memory" commands. */ |
13925 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 13926 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
13927 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
13928 | ||
e0081f70 ML |
13929 | /* "show bgp views" commands. */ |
13930 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
13931 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
13932 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
13933 | ||
718e3744 | 13934 | /* Community-list. */ |
13935 | community_list_vty (); | |
13936 | } | |
6b0655a2 | 13937 | |
718e3744 | 13938 | #include "memory.h" |
13939 | #include "bgp_regex.h" | |
13940 | #include "bgp_clist.h" | |
13941 | #include "bgp_ecommunity.h" | |
13942 | ||
13943 | /* VTY functions. */ | |
13944 | ||
13945 | /* Direction value to string conversion. */ | |
94f2b392 | 13946 | static const char * |
718e3744 | 13947 | community_direct_str (int direct) |
13948 | { | |
13949 | switch (direct) | |
13950 | { | |
13951 | case COMMUNITY_DENY: | |
13952 | return "deny"; | |
718e3744 | 13953 | case COMMUNITY_PERMIT: |
13954 | return "permit"; | |
718e3744 | 13955 | default: |
13956 | return "unknown"; | |
718e3744 | 13957 | } |
13958 | } | |
13959 | ||
13960 | /* Display error string. */ | |
94f2b392 | 13961 | static void |
718e3744 | 13962 | community_list_perror (struct vty *vty, int ret) |
13963 | { | |
13964 | switch (ret) | |
13965 | { | |
13966 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 13967 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 13968 | break; |
13969 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
13970 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
13971 | break; | |
13972 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
13973 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
13974 | break; | |
13975 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
13976 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
13977 | break; | |
13978 | } | |
13979 | } | |
13980 | ||
13981 | /* VTY interface for community_set() function. */ | |
94f2b392 | 13982 | static int |
fd79ac91 | 13983 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
13984 | int style, int reject_all_digit_name) | |
718e3744 | 13985 | { |
13986 | int ret; | |
13987 | int direct; | |
13988 | char *str; | |
13989 | ||
13990 | /* Check the list type. */ | |
13991 | if (strncmp (argv[1], "p", 1) == 0) | |
13992 | direct = COMMUNITY_PERMIT; | |
13993 | else if (strncmp (argv[1], "d", 1) == 0) | |
13994 | direct = COMMUNITY_DENY; | |
13995 | else | |
13996 | { | |
13997 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
13998 | VTY_NEWLINE); | |
13999 | return CMD_WARNING; | |
14000 | } | |
14001 | ||
14002 | /* All digit name check. */ | |
14003 | if (reject_all_digit_name && all_digit (argv[0])) | |
14004 | { | |
14005 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
14006 | return CMD_WARNING; | |
14007 | } | |
14008 | ||
14009 | /* Concat community string argument. */ | |
14010 | if (argc > 1) | |
14011 | str = argv_concat (argv, argc, 2); | |
14012 | else | |
14013 | str = NULL; | |
14014 | ||
14015 | /* When community_list_set() return nevetive value, it means | |
14016 | malformed community string. */ | |
14017 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
14018 | ||
14019 | /* Free temporary community list string allocated by | |
14020 | argv_concat(). */ | |
14021 | if (str) | |
14022 | XFREE (MTYPE_TMP, str); | |
14023 | ||
14024 | if (ret < 0) | |
14025 | { | |
14026 | /* Display error string. */ | |
14027 | community_list_perror (vty, ret); | |
14028 | return CMD_WARNING; | |
14029 | } | |
14030 | ||
14031 | return CMD_SUCCESS; | |
14032 | } | |
14033 | ||
718e3744 | 14034 | /* Communiyt-list entry delete. */ |
94f2b392 | 14035 | static int |
fee6e4e4 | 14036 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
14037 | int style) | |
718e3744 | 14038 | { |
14039 | int ret; | |
fee6e4e4 | 14040 | int direct = 0; |
14041 | char *str = NULL; | |
718e3744 | 14042 | |
fee6e4e4 | 14043 | if (argc > 1) |
718e3744 | 14044 | { |
fee6e4e4 | 14045 | /* Check the list direct. */ |
14046 | if (strncmp (argv[1], "p", 1) == 0) | |
14047 | direct = COMMUNITY_PERMIT; | |
14048 | else if (strncmp (argv[1], "d", 1) == 0) | |
14049 | direct = COMMUNITY_DENY; | |
14050 | else | |
14051 | { | |
14052 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
14053 | VTY_NEWLINE); | |
14054 | return CMD_WARNING; | |
14055 | } | |
718e3744 | 14056 | |
fee6e4e4 | 14057 | /* Concat community string argument. */ |
14058 | str = argv_concat (argv, argc, 2); | |
14059 | } | |
718e3744 | 14060 | |
14061 | /* Unset community list. */ | |
14062 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); | |
14063 | ||
14064 | /* Free temporary community list string allocated by | |
14065 | argv_concat(). */ | |
fee6e4e4 | 14066 | if (str) |
14067 | XFREE (MTYPE_TMP, str); | |
718e3744 | 14068 | |
14069 | if (ret < 0) | |
14070 | { | |
14071 | community_list_perror (vty, ret); | |
14072 | return CMD_WARNING; | |
14073 | } | |
14074 | ||
14075 | return CMD_SUCCESS; | |
14076 | } | |
14077 | ||
14078 | /* "community-list" keyword help string. */ | |
14079 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
14080 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" | |
14081 | ||
718e3744 | 14082 | DEFUN (ip_community_list_standard, |
14083 | ip_community_list_standard_cmd, | |
14084 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
14085 | IP_STR | |
14086 | COMMUNITY_LIST_STR | |
14087 | "Community list number (standard)\n" | |
14088 | "Specify community to reject\n" | |
14089 | "Specify community to accept\n" | |
14090 | COMMUNITY_VAL_STR) | |
14091 | { | |
14092 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
14093 | } | |
14094 | ||
14095 | ALIAS (ip_community_list_standard, | |
14096 | ip_community_list_standard2_cmd, | |
14097 | "ip community-list <1-99> (deny|permit)", | |
14098 | IP_STR | |
14099 | COMMUNITY_LIST_STR | |
14100 | "Community list number (standard)\n" | |
14101 | "Specify community to reject\n" | |
14102 | "Specify community to accept\n") | |
14103 | ||
14104 | DEFUN (ip_community_list_expanded, | |
14105 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 14106 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 14107 | IP_STR |
14108 | COMMUNITY_LIST_STR | |
14109 | "Community list number (expanded)\n" | |
14110 | "Specify community to reject\n" | |
14111 | "Specify community to accept\n" | |
14112 | "An ordered list as a regular-expression\n") | |
14113 | { | |
14114 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
14115 | } | |
14116 | ||
14117 | DEFUN (ip_community_list_name_standard, | |
14118 | ip_community_list_name_standard_cmd, | |
14119 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
14120 | IP_STR | |
14121 | COMMUNITY_LIST_STR | |
14122 | "Add a standard community-list entry\n" | |
14123 | "Community list name\n" | |
14124 | "Specify community to reject\n" | |
14125 | "Specify community to accept\n" | |
14126 | COMMUNITY_VAL_STR) | |
14127 | { | |
14128 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
14129 | } | |
14130 | ||
14131 | ALIAS (ip_community_list_name_standard, | |
14132 | ip_community_list_name_standard2_cmd, | |
14133 | "ip community-list standard WORD (deny|permit)", | |
14134 | IP_STR | |
14135 | COMMUNITY_LIST_STR | |
14136 | "Add a standard community-list entry\n" | |
14137 | "Community list name\n" | |
14138 | "Specify community to reject\n" | |
14139 | "Specify community to accept\n") | |
14140 | ||
14141 | DEFUN (ip_community_list_name_expanded, | |
14142 | ip_community_list_name_expanded_cmd, | |
14143 | "ip community-list expanded WORD (deny|permit) .LINE", | |
14144 | IP_STR | |
14145 | COMMUNITY_LIST_STR | |
14146 | "Add an expanded community-list entry\n" | |
14147 | "Community list name\n" | |
14148 | "Specify community to reject\n" | |
14149 | "Specify community to accept\n" | |
14150 | "An ordered list as a regular-expression\n") | |
14151 | { | |
14152 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
14153 | } | |
14154 | ||
fee6e4e4 | 14155 | DEFUN (no_ip_community_list_standard_all, |
14156 | no_ip_community_list_standard_all_cmd, | |
14157 | "no ip community-list <1-99>", | |
14158 | NO_STR | |
14159 | IP_STR | |
14160 | COMMUNITY_LIST_STR | |
14161 | "Community list number (standard)\n") | |
14162 | { | |
14163 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
14164 | } | |
14165 | ||
14166 | DEFUN (no_ip_community_list_expanded_all, | |
14167 | no_ip_community_list_expanded_all_cmd, | |
14168 | "no ip community-list <100-500>", | |
718e3744 | 14169 | NO_STR |
14170 | IP_STR | |
14171 | COMMUNITY_LIST_STR | |
718e3744 | 14172 | "Community list number (expanded)\n") |
14173 | { | |
fee6e4e4 | 14174 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 14175 | } |
14176 | ||
fee6e4e4 | 14177 | DEFUN (no_ip_community_list_name_standard_all, |
14178 | no_ip_community_list_name_standard_all_cmd, | |
14179 | "no ip community-list standard WORD", | |
718e3744 | 14180 | NO_STR |
14181 | IP_STR | |
14182 | COMMUNITY_LIST_STR | |
14183 | "Add a standard community-list entry\n" | |
718e3744 | 14184 | "Community list name\n") |
14185 | { | |
fee6e4e4 | 14186 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
718e3744 | 14187 | } |
14188 | ||
fee6e4e4 | 14189 | DEFUN (no_ip_community_list_name_expanded_all, |
14190 | no_ip_community_list_name_expanded_all_cmd, | |
14191 | "no ip community-list expanded WORD", | |
718e3744 | 14192 | NO_STR |
14193 | IP_STR | |
14194 | COMMUNITY_LIST_STR | |
fee6e4e4 | 14195 | "Add an expanded community-list entry\n" |
14196 | "Community list name\n") | |
718e3744 | 14197 | { |
fee6e4e4 | 14198 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 14199 | } |
14200 | ||
14201 | DEFUN (no_ip_community_list_standard, | |
14202 | no_ip_community_list_standard_cmd, | |
14203 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
14204 | NO_STR | |
14205 | IP_STR | |
14206 | COMMUNITY_LIST_STR | |
14207 | "Community list number (standard)\n" | |
14208 | "Specify community to reject\n" | |
14209 | "Specify community to accept\n" | |
14210 | COMMUNITY_VAL_STR) | |
14211 | { | |
14212 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
14213 | } | |
14214 | ||
14215 | DEFUN (no_ip_community_list_expanded, | |
14216 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 14217 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 14218 | NO_STR |
14219 | IP_STR | |
14220 | COMMUNITY_LIST_STR | |
14221 | "Community list number (expanded)\n" | |
14222 | "Specify community to reject\n" | |
14223 | "Specify community to accept\n" | |
14224 | "An ordered list as a regular-expression\n") | |
14225 | { | |
14226 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
14227 | } | |
14228 | ||
14229 | DEFUN (no_ip_community_list_name_standard, | |
14230 | no_ip_community_list_name_standard_cmd, | |
14231 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
14232 | NO_STR | |
14233 | IP_STR | |
14234 | COMMUNITY_LIST_STR | |
14235 | "Specify a standard community-list\n" | |
14236 | "Community list name\n" | |
14237 | "Specify community to reject\n" | |
14238 | "Specify community to accept\n" | |
14239 | COMMUNITY_VAL_STR) | |
14240 | { | |
14241 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
14242 | } | |
14243 | ||
14244 | DEFUN (no_ip_community_list_name_expanded, | |
14245 | no_ip_community_list_name_expanded_cmd, | |
14246 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
14247 | NO_STR | |
14248 | IP_STR | |
14249 | COMMUNITY_LIST_STR | |
14250 | "Specify an expanded community-list\n" | |
14251 | "Community list name\n" | |
14252 | "Specify community to reject\n" | |
14253 | "Specify community to accept\n" | |
14254 | "An ordered list as a regular-expression\n") | |
14255 | { | |
14256 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
14257 | } | |
14258 | ||
94f2b392 | 14259 | static void |
718e3744 | 14260 | community_list_show (struct vty *vty, struct community_list *list) |
14261 | { | |
14262 | struct community_entry *entry; | |
14263 | ||
14264 | for (entry = list->head; entry; entry = entry->next) | |
14265 | { | |
14266 | if (entry == list->head) | |
14267 | { | |
14268 | if (all_digit (list->name)) | |
14269 | vty_out (vty, "Community %s list %s%s", | |
14270 | entry->style == COMMUNITY_LIST_STANDARD ? | |
14271 | "standard" : "(expanded) access", | |
14272 | list->name, VTY_NEWLINE); | |
14273 | else | |
14274 | vty_out (vty, "Named Community %s list %s%s", | |
14275 | entry->style == COMMUNITY_LIST_STANDARD ? | |
14276 | "standard" : "expanded", | |
14277 | list->name, VTY_NEWLINE); | |
14278 | } | |
14279 | if (entry->any) | |
14280 | vty_out (vty, " %s%s", | |
14281 | community_direct_str (entry->direct), VTY_NEWLINE); | |
14282 | else | |
14283 | vty_out (vty, " %s %s%s", | |
14284 | community_direct_str (entry->direct), | |
14285 | entry->style == COMMUNITY_LIST_STANDARD | |
14286 | ? community_str (entry->u.com) : entry->config, | |
14287 | VTY_NEWLINE); | |
14288 | } | |
14289 | } | |
14290 | ||
14291 | DEFUN (show_ip_community_list, | |
14292 | show_ip_community_list_cmd, | |
14293 | "show ip community-list", | |
14294 | SHOW_STR | |
14295 | IP_STR | |
14296 | "List community-list\n") | |
14297 | { | |
14298 | struct community_list *list; | |
14299 | struct community_list_master *cm; | |
14300 | ||
fee6e4e4 | 14301 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 14302 | if (! cm) |
14303 | return CMD_SUCCESS; | |
14304 | ||
14305 | for (list = cm->num.head; list; list = list->next) | |
14306 | community_list_show (vty, list); | |
14307 | ||
14308 | for (list = cm->str.head; list; list = list->next) | |
14309 | community_list_show (vty, list); | |
14310 | ||
14311 | return CMD_SUCCESS; | |
14312 | } | |
14313 | ||
14314 | DEFUN (show_ip_community_list_arg, | |
14315 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 14316 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 14317 | SHOW_STR |
14318 | IP_STR | |
14319 | "List community-list\n" | |
14320 | "Community-list number\n" | |
14321 | "Community-list name\n") | |
14322 | { | |
14323 | struct community_list *list; | |
14324 | ||
fee6e4e4 | 14325 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 14326 | if (! list) |
14327 | { | |
b729294c | 14328 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 14329 | return CMD_WARNING; |
14330 | } | |
14331 | ||
14332 | community_list_show (vty, list); | |
14333 | ||
14334 | return CMD_SUCCESS; | |
14335 | } | |
6b0655a2 | 14336 | |
94f2b392 | 14337 | static int |
fd79ac91 | 14338 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
14339 | int style, int reject_all_digit_name) | |
718e3744 | 14340 | { |
14341 | int ret; | |
14342 | int direct; | |
14343 | char *str; | |
14344 | ||
14345 | /* Check the list type. */ | |
14346 | if (strncmp (argv[1], "p", 1) == 0) | |
14347 | direct = COMMUNITY_PERMIT; | |
14348 | else if (strncmp (argv[1], "d", 1) == 0) | |
14349 | direct = COMMUNITY_DENY; | |
14350 | else | |
14351 | { | |
14352 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
14353 | VTY_NEWLINE); | |
14354 | return CMD_WARNING; | |
14355 | } | |
14356 | ||
14357 | /* All digit name check. */ | |
14358 | if (reject_all_digit_name && all_digit (argv[0])) | |
14359 | { | |
14360 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
14361 | return CMD_WARNING; | |
14362 | } | |
14363 | ||
14364 | /* Concat community string argument. */ | |
14365 | if (argc > 1) | |
14366 | str = argv_concat (argv, argc, 2); | |
14367 | else | |
14368 | str = NULL; | |
14369 | ||
14370 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
14371 | ||
14372 | /* Free temporary community list string allocated by | |
14373 | argv_concat(). */ | |
14374 | if (str) | |
14375 | XFREE (MTYPE_TMP, str); | |
14376 | ||
14377 | if (ret < 0) | |
14378 | { | |
14379 | community_list_perror (vty, ret); | |
14380 | return CMD_WARNING; | |
14381 | } | |
14382 | return CMD_SUCCESS; | |
14383 | } | |
14384 | ||
94f2b392 | 14385 | static int |
fee6e4e4 | 14386 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
14387 | int style) | |
718e3744 | 14388 | { |
14389 | int ret; | |
fee6e4e4 | 14390 | int direct = 0; |
14391 | char *str = NULL; | |
718e3744 | 14392 | |
fee6e4e4 | 14393 | if (argc > 1) |
718e3744 | 14394 | { |
fee6e4e4 | 14395 | /* Check the list direct. */ |
14396 | if (strncmp (argv[1], "p", 1) == 0) | |
14397 | direct = COMMUNITY_PERMIT; | |
14398 | else if (strncmp (argv[1], "d", 1) == 0) | |
14399 | direct = COMMUNITY_DENY; | |
14400 | else | |
14401 | { | |
14402 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
14403 | VTY_NEWLINE); | |
14404 | return CMD_WARNING; | |
14405 | } | |
718e3744 | 14406 | |
fee6e4e4 | 14407 | /* Concat community string argument. */ |
14408 | str = argv_concat (argv, argc, 2); | |
718e3744 | 14409 | } |
14410 | ||
718e3744 | 14411 | /* Unset community list. */ |
14412 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); | |
14413 | ||
14414 | /* Free temporary community list string allocated by | |
14415 | argv_concat(). */ | |
fee6e4e4 | 14416 | if (str) |
14417 | XFREE (MTYPE_TMP, str); | |
718e3744 | 14418 | |
14419 | if (ret < 0) | |
14420 | { | |
14421 | community_list_perror (vty, ret); | |
14422 | return CMD_WARNING; | |
14423 | } | |
14424 | ||
14425 | return CMD_SUCCESS; | |
14426 | } | |
14427 | ||
14428 | /* "extcommunity-list" keyword help string. */ | |
14429 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
14430 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
14431 | ||
14432 | DEFUN (ip_extcommunity_list_standard, | |
14433 | ip_extcommunity_list_standard_cmd, | |
14434 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
14435 | IP_STR | |
14436 | EXTCOMMUNITY_LIST_STR | |
14437 | "Extended Community list number (standard)\n" | |
14438 | "Specify community to reject\n" | |
14439 | "Specify community to accept\n" | |
14440 | EXTCOMMUNITY_VAL_STR) | |
14441 | { | |
14442 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
14443 | } | |
14444 | ||
14445 | ALIAS (ip_extcommunity_list_standard, | |
14446 | ip_extcommunity_list_standard2_cmd, | |
14447 | "ip extcommunity-list <1-99> (deny|permit)", | |
14448 | IP_STR | |
14449 | EXTCOMMUNITY_LIST_STR | |
14450 | "Extended Community list number (standard)\n" | |
14451 | "Specify community to reject\n" | |
14452 | "Specify community to accept\n") | |
14453 | ||
14454 | DEFUN (ip_extcommunity_list_expanded, | |
14455 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 14456 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 14457 | IP_STR |
14458 | EXTCOMMUNITY_LIST_STR | |
14459 | "Extended Community list number (expanded)\n" | |
14460 | "Specify community to reject\n" | |
14461 | "Specify community to accept\n" | |
14462 | "An ordered list as a regular-expression\n") | |
14463 | { | |
14464 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
14465 | } | |
14466 | ||
14467 | DEFUN (ip_extcommunity_list_name_standard, | |
14468 | ip_extcommunity_list_name_standard_cmd, | |
14469 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
14470 | IP_STR | |
14471 | EXTCOMMUNITY_LIST_STR | |
14472 | "Specify standard extcommunity-list\n" | |
14473 | "Extended Community list name\n" | |
14474 | "Specify community to reject\n" | |
14475 | "Specify community to accept\n" | |
14476 | EXTCOMMUNITY_VAL_STR) | |
14477 | { | |
14478 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
14479 | } | |
14480 | ||
14481 | ALIAS (ip_extcommunity_list_name_standard, | |
14482 | ip_extcommunity_list_name_standard2_cmd, | |
14483 | "ip extcommunity-list standard WORD (deny|permit)", | |
14484 | IP_STR | |
14485 | EXTCOMMUNITY_LIST_STR | |
14486 | "Specify standard extcommunity-list\n" | |
14487 | "Extended Community list name\n" | |
14488 | "Specify community to reject\n" | |
14489 | "Specify community to accept\n") | |
14490 | ||
14491 | DEFUN (ip_extcommunity_list_name_expanded, | |
14492 | ip_extcommunity_list_name_expanded_cmd, | |
14493 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
14494 | IP_STR | |
14495 | EXTCOMMUNITY_LIST_STR | |
14496 | "Specify expanded extcommunity-list\n" | |
14497 | "Extended Community list name\n" | |
14498 | "Specify community to reject\n" | |
14499 | "Specify community to accept\n" | |
14500 | "An ordered list as a regular-expression\n") | |
14501 | { | |
14502 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
14503 | } | |
14504 | ||
fee6e4e4 | 14505 | DEFUN (no_ip_extcommunity_list_standard_all, |
14506 | no_ip_extcommunity_list_standard_all_cmd, | |
14507 | "no ip extcommunity-list <1-99>", | |
14508 | NO_STR | |
14509 | IP_STR | |
14510 | EXTCOMMUNITY_LIST_STR | |
14511 | "Extended Community list number (standard)\n") | |
14512 | { | |
14513 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
14514 | } | |
14515 | ||
14516 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
14517 | no_ip_extcommunity_list_expanded_all_cmd, | |
14518 | "no ip extcommunity-list <100-500>", | |
718e3744 | 14519 | NO_STR |
14520 | IP_STR | |
14521 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 14522 | "Extended Community list number (expanded)\n") |
14523 | { | |
fee6e4e4 | 14524 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 14525 | } |
14526 | ||
fee6e4e4 | 14527 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
14528 | no_ip_extcommunity_list_name_standard_all_cmd, | |
14529 | "no ip extcommunity-list standard WORD", | |
718e3744 | 14530 | NO_STR |
14531 | IP_STR | |
14532 | EXTCOMMUNITY_LIST_STR | |
14533 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 14534 | "Extended Community list name\n") |
14535 | { | |
14536 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
14537 | } | |
14538 | ||
14539 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
14540 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
14541 | "no ip extcommunity-list expanded WORD", | |
14542 | NO_STR | |
14543 | IP_STR | |
14544 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 14545 | "Specify expanded extcommunity-list\n" |
14546 | "Extended Community list name\n") | |
14547 | { | |
fee6e4e4 | 14548 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 14549 | } |
14550 | ||
14551 | DEFUN (no_ip_extcommunity_list_standard, | |
14552 | no_ip_extcommunity_list_standard_cmd, | |
14553 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
14554 | NO_STR | |
14555 | IP_STR | |
14556 | EXTCOMMUNITY_LIST_STR | |
14557 | "Extended Community list number (standard)\n" | |
14558 | "Specify community to reject\n" | |
14559 | "Specify community to accept\n" | |
14560 | EXTCOMMUNITY_VAL_STR) | |
14561 | { | |
14562 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
14563 | } | |
14564 | ||
14565 | DEFUN (no_ip_extcommunity_list_expanded, | |
14566 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 14567 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 14568 | NO_STR |
14569 | IP_STR | |
14570 | EXTCOMMUNITY_LIST_STR | |
14571 | "Extended Community list number (expanded)\n" | |
14572 | "Specify community to reject\n" | |
14573 | "Specify community to accept\n" | |
14574 | "An ordered list as a regular-expression\n") | |
14575 | { | |
14576 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
14577 | } | |
14578 | ||
14579 | DEFUN (no_ip_extcommunity_list_name_standard, | |
14580 | no_ip_extcommunity_list_name_standard_cmd, | |
14581 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
14582 | NO_STR | |
14583 | IP_STR | |
14584 | EXTCOMMUNITY_LIST_STR | |
14585 | "Specify standard extcommunity-list\n" | |
14586 | "Extended Community list name\n" | |
14587 | "Specify community to reject\n" | |
14588 | "Specify community to accept\n" | |
14589 | EXTCOMMUNITY_VAL_STR) | |
14590 | { | |
14591 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
14592 | } | |
14593 | ||
14594 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
14595 | no_ip_extcommunity_list_name_expanded_cmd, | |
14596 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
14597 | NO_STR | |
14598 | IP_STR | |
14599 | EXTCOMMUNITY_LIST_STR | |
14600 | "Specify expanded extcommunity-list\n" | |
14601 | "Community list name\n" | |
14602 | "Specify community to reject\n" | |
14603 | "Specify community to accept\n" | |
14604 | "An ordered list as a regular-expression\n") | |
14605 | { | |
14606 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
14607 | } | |
14608 | ||
94f2b392 | 14609 | static void |
718e3744 | 14610 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
14611 | { | |
14612 | struct community_entry *entry; | |
14613 | ||
14614 | for (entry = list->head; entry; entry = entry->next) | |
14615 | { | |
14616 | if (entry == list->head) | |
14617 | { | |
14618 | if (all_digit (list->name)) | |
14619 | vty_out (vty, "Extended community %s list %s%s", | |
14620 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
14621 | "standard" : "(expanded) access", | |
14622 | list->name, VTY_NEWLINE); | |
14623 | else | |
14624 | vty_out (vty, "Named extended community %s list %s%s", | |
14625 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
14626 | "standard" : "expanded", | |
14627 | list->name, VTY_NEWLINE); | |
14628 | } | |
14629 | if (entry->any) | |
14630 | vty_out (vty, " %s%s", | |
14631 | community_direct_str (entry->direct), VTY_NEWLINE); | |
14632 | else | |
14633 | vty_out (vty, " %s %s%s", | |
14634 | community_direct_str (entry->direct), | |
14635 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
14636 | entry->u.ecom->str : entry->config, | |
14637 | VTY_NEWLINE); | |
14638 | } | |
14639 | } | |
14640 | ||
14641 | DEFUN (show_ip_extcommunity_list, | |
14642 | show_ip_extcommunity_list_cmd, | |
14643 | "show ip extcommunity-list", | |
14644 | SHOW_STR | |
14645 | IP_STR | |
14646 | "List extended-community list\n") | |
14647 | { | |
14648 | struct community_list *list; | |
14649 | struct community_list_master *cm; | |
14650 | ||
fee6e4e4 | 14651 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 14652 | if (! cm) |
14653 | return CMD_SUCCESS; | |
14654 | ||
14655 | for (list = cm->num.head; list; list = list->next) | |
14656 | extcommunity_list_show (vty, list); | |
14657 | ||
14658 | for (list = cm->str.head; list; list = list->next) | |
14659 | extcommunity_list_show (vty, list); | |
14660 | ||
14661 | return CMD_SUCCESS; | |
14662 | } | |
14663 | ||
14664 | DEFUN (show_ip_extcommunity_list_arg, | |
14665 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 14666 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 14667 | SHOW_STR |
14668 | IP_STR | |
14669 | "List extended-community list\n" | |
14670 | "Extcommunity-list number\n" | |
14671 | "Extcommunity-list name\n") | |
14672 | { | |
14673 | struct community_list *list; | |
14674 | ||
fee6e4e4 | 14675 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 14676 | if (! list) |
14677 | { | |
b729294c | 14678 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 14679 | return CMD_WARNING; |
14680 | } | |
14681 | ||
14682 | extcommunity_list_show (vty, list); | |
14683 | ||
14684 | return CMD_SUCCESS; | |
14685 | } | |
6b0655a2 | 14686 | |
718e3744 | 14687 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 14688 | static const char * |
718e3744 | 14689 | community_list_config_str (struct community_entry *entry) |
14690 | { | |
fd79ac91 | 14691 | const char *str; |
718e3744 | 14692 | |
14693 | if (entry->any) | |
14694 | str = ""; | |
14695 | else | |
14696 | { | |
14697 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
14698 | str = community_str (entry->u.com); | |
14699 | else | |
14700 | str = entry->config; | |
14701 | } | |
14702 | return str; | |
14703 | } | |
14704 | ||
14705 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 14706 | static int |
718e3744 | 14707 | community_list_config_write (struct vty *vty) |
14708 | { | |
14709 | struct community_list *list; | |
14710 | struct community_entry *entry; | |
14711 | struct community_list_master *cm; | |
14712 | int write = 0; | |
14713 | ||
14714 | /* Community-list. */ | |
fee6e4e4 | 14715 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 14716 | |
14717 | for (list = cm->num.head; list; list = list->next) | |
14718 | for (entry = list->head; entry; entry = entry->next) | |
14719 | { | |
fee6e4e4 | 14720 | vty_out (vty, "ip community-list %s %s %s%s", |
14721 | list->name, community_direct_str (entry->direct), | |
14722 | community_list_config_str (entry), | |
14723 | VTY_NEWLINE); | |
718e3744 | 14724 | write++; |
14725 | } | |
14726 | for (list = cm->str.head; list; list = list->next) | |
14727 | for (entry = list->head; entry; entry = entry->next) | |
14728 | { | |
14729 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
14730 | entry->style == COMMUNITY_LIST_STANDARD | |
14731 | ? "standard" : "expanded", | |
14732 | list->name, community_direct_str (entry->direct), | |
14733 | community_list_config_str (entry), | |
14734 | VTY_NEWLINE); | |
14735 | write++; | |
14736 | } | |
14737 | ||
14738 | /* Extcommunity-list. */ | |
fee6e4e4 | 14739 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 14740 | |
14741 | for (list = cm->num.head; list; list = list->next) | |
14742 | for (entry = list->head; entry; entry = entry->next) | |
14743 | { | |
fee6e4e4 | 14744 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
14745 | list->name, community_direct_str (entry->direct), | |
14746 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 14747 | write++; |
14748 | } | |
14749 | for (list = cm->str.head; list; list = list->next) | |
14750 | for (entry = list->head; entry; entry = entry->next) | |
14751 | { | |
14752 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
14753 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
14754 | ? "standard" : "expanded", | |
14755 | list->name, community_direct_str (entry->direct), | |
14756 | community_list_config_str (entry), VTY_NEWLINE); | |
14757 | write++; | |
14758 | } | |
14759 | return write; | |
14760 | } | |
14761 | ||
7fc626de | 14762 | static struct cmd_node community_list_node = |
718e3744 | 14763 | { |
14764 | COMMUNITY_LIST_NODE, | |
14765 | "", | |
14766 | 1 /* Export to vtysh. */ | |
14767 | }; | |
14768 | ||
94f2b392 | 14769 | static void |
14770 | community_list_vty (void) | |
718e3744 | 14771 | { |
14772 | install_node (&community_list_node, community_list_config_write); | |
14773 | ||
14774 | /* Community-list. */ | |
718e3744 | 14775 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
14776 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
14777 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
14778 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
14779 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
14780 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 14781 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
14782 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); | |
14783 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
14784 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 14785 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
14786 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
14787 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
14788 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); | |
14789 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
14790 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
14791 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
14792 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
14793 | ||
14794 | /* Extcommunity-list. */ | |
14795 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
14796 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
14797 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
14798 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
14799 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
14800 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 14801 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
14802 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); | |
14803 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
14804 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 14805 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
14806 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
14807 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
14808 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); | |
14809 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
14810 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
14811 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
14812 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
14813 | } |