]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* BGP VTY interface. |
2 | Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro | |
3 | ||
4 | This file is part of GNU Zebra. | |
5 | ||
6 | GNU Zebra is free software; you can redistribute it and/or modify it | |
7 | under the terms of the GNU General Public License as published by the | |
8 | Free Software Foundation; either version 2, or (at your option) any | |
9 | later version. | |
10 | ||
11 | GNU Zebra is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU Zebra; see the file COPYING. If not, write to the Free | |
18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
19 | 02111-1307, USA. */ | |
20 | ||
21 | #include <zebra.h> | |
22 | ||
23 | #include "command.h" | |
24 | #include "prefix.h" | |
25 | #include "plist.h" | |
26 | #include "buffer.h" | |
27 | #include "linklist.h" | |
28 | #include "stream.h" | |
29 | #include "thread.h" | |
30 | #include "log.h" | |
3b8b1855 | 31 | #include "memory.h" |
4bf6a362 | 32 | #include "hash.h" |
3f9c7369 | 33 | #include "queue.h" |
718e3744 | 34 | |
35 | #include "bgpd/bgpd.h" | |
4bf6a362 | 36 | #include "bgpd/bgp_advertise.h" |
718e3744 | 37 | #include "bgpd/bgp_attr.h" |
38 | #include "bgpd/bgp_aspath.h" | |
39 | #include "bgpd/bgp_community.h" | |
4bf6a362 PJ |
40 | #include "bgpd/bgp_ecommunity.h" |
41 | #include "bgpd/bgp_damp.h" | |
718e3744 | 42 | #include "bgpd/bgp_debug.h" |
e0701b79 | 43 | #include "bgpd/bgp_fsm.h" |
718e3744 | 44 | #include "bgpd/bgp_mplsvpn.h" |
4bf6a362 | 45 | #include "bgpd/bgp_nexthop.h" |
718e3744 | 46 | #include "bgpd/bgp_open.h" |
4bf6a362 | 47 | #include "bgpd/bgp_regex.h" |
718e3744 | 48 | #include "bgpd/bgp_route.h" |
49 | #include "bgpd/bgp_zebra.h" | |
fee0f4c6 | 50 | #include "bgpd/bgp_table.h" |
94f2b392 | 51 | #include "bgpd/bgp_vty.h" |
165b5fff | 52 | #include "bgpd/bgp_mpath.h" |
cb1faec9 | 53 | #include "bgpd/bgp_packet.h" |
3f9c7369 | 54 | #include "bgpd/bgp_updgrp.h" |
718e3744 | 55 | |
18a6dce6 | 56 | extern struct in_addr router_id_zebra; |
57 | ||
718e3744 | 58 | /* Utility function to get address family from current node. */ |
59 | afi_t | |
60 | bgp_node_afi (struct vty *vty) | |
61 | { | |
25ffbdc1 | 62 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 63 | return AFI_IP6; |
64 | return AFI_IP; | |
65 | } | |
66 | ||
67 | /* Utility function to get subsequent address family from current | |
68 | node. */ | |
69 | safi_t | |
70 | bgp_node_safi (struct vty *vty) | |
71 | { | |
72 | if (vty->node == BGP_VPNV4_NODE) | |
73 | return SAFI_MPLS_VPN; | |
25ffbdc1 | 74 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 75 | return SAFI_MULTICAST; |
76 | return SAFI_UNICAST; | |
77 | } | |
78 | ||
94f2b392 | 79 | static int |
718e3744 | 80 | peer_address_self_check (union sockunion *su) |
81 | { | |
82 | struct interface *ifp = NULL; | |
83 | ||
84 | if (su->sa.sa_family == AF_INET) | |
85 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); | |
86 | #ifdef HAVE_IPV6 | |
87 | else if (su->sa.sa_family == AF_INET6) | |
f2345335 DS |
88 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr, |
89 | su->sin6.sin6_scope_id); | |
718e3744 | 90 | #endif /* HAVE IPV6 */ |
91 | ||
92 | if (ifp) | |
93 | return 1; | |
94 | ||
95 | return 0; | |
96 | } | |
97 | ||
98 | /* Utility function for looking up peer from VTY. */ | |
f14e6fdb DS |
99 | /* This is used only for configuration, so disallow if attempted on |
100 | * a dynamic neighbor. | |
101 | */ | |
94f2b392 | 102 | static struct peer * |
fd79ac91 | 103 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 104 | { |
105 | int ret; | |
106 | struct bgp *bgp; | |
107 | union sockunion su; | |
108 | struct peer *peer; | |
109 | ||
110 | bgp = vty->index; | |
111 | ||
112 | ret = str2sockunion (ip_str, &su); | |
113 | if (ret < 0) | |
114 | { | |
a80beece DS |
115 | peer = peer_lookup_by_conf_if (bgp, ip_str); |
116 | if (!peer) | |
117 | { | |
118 | vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE); | |
119 | return NULL; | |
120 | } | |
718e3744 | 121 | } |
a80beece | 122 | else |
718e3744 | 123 | { |
a80beece DS |
124 | peer = peer_lookup (bgp, &su); |
125 | if (! peer) | |
126 | { | |
127 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
128 | VTY_NEWLINE); | |
129 | return NULL; | |
130 | } | |
f14e6fdb DS |
131 | if (peer_dynamic_neighbor (peer)) |
132 | { | |
133 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
134 | VTY_NEWLINE); | |
135 | return NULL; | |
136 | } | |
137 | ||
718e3744 | 138 | } |
139 | return peer; | |
140 | } | |
141 | ||
142 | /* Utility function for looking up peer or peer group. */ | |
f14e6fdb DS |
143 | /* This is used only for configuration, so disallow if attempted on |
144 | * a dynamic neighbor. | |
145 | */ | |
94f2b392 | 146 | static struct peer * |
fd79ac91 | 147 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 148 | { |
149 | int ret; | |
150 | struct bgp *bgp; | |
151 | union sockunion su; | |
f14e6fdb DS |
152 | struct peer *peer = NULL; |
153 | struct peer_group *group = NULL; | |
718e3744 | 154 | |
155 | bgp = vty->index; | |
156 | ||
157 | ret = str2sockunion (peer_str, &su); | |
158 | if (ret == 0) | |
159 | { | |
f14e6fdb | 160 | /* IP address, locate peer. */ |
718e3744 | 161 | peer = peer_lookup (bgp, &su); |
718e3744 | 162 | } |
163 | else | |
164 | { | |
f14e6fdb | 165 | /* Not IP, could match either peer configured on interface or a group. */ |
a80beece | 166 | peer = peer_lookup_by_conf_if (bgp, peer_str); |
f14e6fdb DS |
167 | if (!peer) |
168 | group = peer_group_lookup (bgp, peer_str); | |
169 | } | |
a80beece | 170 | |
f14e6fdb DS |
171 | if (peer) |
172 | { | |
173 | if (peer_dynamic_neighbor (peer)) | |
174 | { | |
175 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
176 | VTY_NEWLINE); | |
177 | return NULL; | |
178 | } | |
179 | ||
180 | return peer; | |
718e3744 | 181 | } |
182 | ||
f14e6fdb DS |
183 | if (group) |
184 | return group->conf; | |
185 | ||
718e3744 | 186 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", |
187 | VTY_NEWLINE); | |
188 | ||
189 | return NULL; | |
190 | } | |
191 | ||
94f2b392 | 192 | static int |
718e3744 | 193 | bgp_vty_return (struct vty *vty, int ret) |
194 | { | |
fd79ac91 | 195 | const char *str = NULL; |
718e3744 | 196 | |
197 | switch (ret) | |
198 | { | |
199 | case BGP_ERR_INVALID_VALUE: | |
200 | str = "Invalid value"; | |
201 | break; | |
202 | case BGP_ERR_INVALID_FLAG: | |
203 | str = "Invalid flag"; | |
204 | break; | |
205 | case BGP_ERR_PEER_INACTIVE: | |
206 | str = "Activate the neighbor for the address family first"; | |
207 | break; | |
208 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: | |
209 | str = "Invalid command for a peer-group member"; | |
210 | break; | |
211 | case BGP_ERR_PEER_GROUP_SHUTDOWN: | |
212 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
213 | break; | |
214 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: | |
215 | str = "This peer is a peer-group member. Please change peer-group configuration"; | |
216 | break; | |
217 | case BGP_ERR_PEER_FLAG_CONFLICT: | |
218 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
219 | break; | |
220 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: | |
221 | str = "No activate for peergroup can be given only if peer-group has no members"; | |
222 | break; | |
223 | case BGP_ERR_PEER_BELONGS_TO_GROUP: | |
224 | str = "No activate for an individual peer-group member is invalid"; | |
225 | break; | |
226 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: | |
227 | str = "Activate the peer-group for the address family first"; | |
228 | break; | |
229 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: | |
230 | str = "Specify remote-as or peer-group remote AS first"; | |
231 | break; | |
232 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
233 | str = "Cannot change the peer-group. Deconfigure first"; | |
234 | break; | |
235 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
236 | str = "Cannot have different peer-group for the neighbor"; | |
237 | break; | |
238 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
239 | str = "Prefix/distribute list can not co-exist"; | |
240 | break; | |
241 | case BGP_ERR_NOT_INTERNAL_PEER: | |
242 | str = "Invalid command. Not an internal neighbor"; | |
243 | break; | |
244 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
5000f21c | 245 | str = "remove-private-AS cannot be configured for IBGP peers"; |
718e3744 | 246 | break; |
247 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
248 | str = "Local-AS allowed only for EBGP peers"; | |
249 | break; | |
250 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
251 | str = "Cannot have local-as same as BGP AS number"; | |
252 | break; | |
0df7c91f PJ |
253 | case BGP_ERR_TCPSIG_FAILED: |
254 | str = "Error while applying TCP-Sig to session(s)"; | |
255 | break; | |
fa411a21 NH |
256 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
257 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
258 | break; | |
f5a4827d SH |
259 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
260 | str = "ttl-security only allowed for EBGP peers"; | |
261 | break; | |
c7122e14 DS |
262 | case BGP_ERR_AS_OVERRIDE: |
263 | str = "as-override cannot be configured for IBGP peers"; | |
264 | break; | |
f14e6fdb DS |
265 | case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT: |
266 | str = "Invalid limit for number of dynamic neighbors"; | |
267 | break; | |
268 | case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS: | |
269 | str = "Dynamic neighbor listen range already exists"; | |
270 | break; | |
271 | case BGP_ERR_INVALID_FOR_DYNAMIC_PEER: | |
272 | str = "Operation not allowed on a dynamic neighbor"; | |
273 | break; | |
718e3744 | 274 | } |
275 | if (str) | |
276 | { | |
277 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
278 | return CMD_WARNING; | |
279 | } | |
280 | return CMD_SUCCESS; | |
281 | } | |
282 | ||
7aafcaca DS |
283 | /* BGP clear sort. */ |
284 | enum clear_sort | |
285 | { | |
286 | clear_all, | |
287 | clear_peer, | |
288 | clear_group, | |
289 | clear_external, | |
290 | clear_as | |
291 | }; | |
292 | ||
293 | /* Force a bestpath recalculation for all prefixes. This is used | |
294 | * when 'bgp bestpath' commands are entered. | |
295 | */ | |
296 | static void | |
297 | bgp_recalculate_all_bestpaths (struct bgp *bgp) | |
298 | { | |
299 | afi_t afi; | |
300 | safi_t safi; | |
301 | struct bgp_node *rn; | |
302 | ||
303 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
304 | { | |
305 | for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) | |
306 | { | |
307 | for (rn = bgp_table_top (bgp->rib[afi][safi]); rn; rn = bgp_route_next (rn)) | |
308 | { | |
309 | bgp_process (bgp, rn, afi, safi); | |
310 | } | |
311 | } | |
312 | } | |
313 | } | |
314 | ||
315 | static void | |
316 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, | |
317 | safi_t safi, int error) | |
318 | { | |
319 | switch (error) | |
320 | { | |
321 | case BGP_ERR_AF_UNCONFIGURED: | |
322 | vty_out (vty, | |
323 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
324 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
325 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
326 | peer->host, VTY_NEWLINE); | |
327 | break; | |
328 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
329 | 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); | |
330 | break; | |
331 | default: | |
332 | break; | |
333 | } | |
334 | } | |
335 | ||
336 | /* `clear ip bgp' functions. */ | |
337 | static int | |
338 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, | |
339 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) | |
340 | { | |
341 | int ret; | |
342 | struct peer *peer; | |
343 | struct listnode *node, *nnode; | |
344 | ||
345 | /* Clear all neighbors. */ | |
346 | /* | |
347 | * Pass along pointer to next node to peer_clear() when walking all nodes | |
348 | * on the BGP instance as that may get freed if it is a doppelganger | |
349 | */ | |
350 | if (sort == clear_all) | |
351 | { | |
352 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
353 | { | |
354 | if (stype == BGP_CLEAR_SOFT_NONE) | |
355 | ret = peer_clear (peer, &nnode); | |
356 | else if (peer->afc[afi][safi]) | |
357 | ret = peer_clear_soft (peer, afi, safi, stype); | |
358 | else | |
359 | ret = 0; | |
360 | ||
361 | if (ret < 0) | |
362 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
363 | } | |
364 | ||
365 | /* This is to apply read-only mode on this clear. */ | |
366 | if (stype == BGP_CLEAR_SOFT_NONE) | |
367 | bgp->update_delay_over = 0; | |
368 | ||
369 | return CMD_SUCCESS; | |
370 | } | |
371 | ||
372 | /* Clear specified neighbors. */ | |
373 | if (sort == clear_peer) | |
374 | { | |
375 | union sockunion su; | |
376 | int ret; | |
377 | ||
378 | /* Make sockunion for lookup. */ | |
379 | ret = str2sockunion (arg, &su); | |
380 | if (ret < 0) | |
381 | { | |
382 | peer = peer_lookup_by_conf_if (bgp, arg); | |
383 | if (!peer) | |
384 | { | |
385 | vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE); | |
386 | return CMD_WARNING; | |
387 | } | |
388 | } | |
389 | else | |
390 | { | |
391 | peer = peer_lookup (bgp, &su); | |
392 | if (! peer) | |
393 | { | |
394 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
395 | return CMD_WARNING; | |
396 | } | |
397 | } | |
398 | ||
399 | if (stype == BGP_CLEAR_SOFT_NONE) | |
400 | ret = peer_clear (peer, NULL); | |
401 | else | |
402 | ret = peer_clear_soft (peer, afi, safi, stype); | |
403 | ||
404 | if (ret < 0) | |
405 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
406 | ||
407 | return CMD_SUCCESS; | |
408 | } | |
409 | ||
410 | /* Clear all peer-group members. */ | |
411 | if (sort == clear_group) | |
412 | { | |
413 | struct peer_group *group; | |
414 | ||
415 | group = peer_group_lookup (bgp, arg); | |
416 | if (! group) | |
417 | { | |
418 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
419 | return CMD_WARNING; | |
420 | } | |
421 | ||
422 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
423 | { | |
424 | if (stype == BGP_CLEAR_SOFT_NONE) | |
425 | { | |
426 | ret = peer_clear (peer, NULL); | |
427 | continue; | |
428 | } | |
429 | ||
430 | if (! peer->af_group[afi][safi]) | |
431 | continue; | |
432 | ||
433 | ret = peer_clear_soft (peer, afi, safi, stype); | |
434 | ||
435 | if (ret < 0) | |
436 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
437 | } | |
438 | return CMD_SUCCESS; | |
439 | } | |
440 | ||
441 | if (sort == clear_external) | |
442 | { | |
443 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
444 | { | |
445 | if (peer->sort == BGP_PEER_IBGP) | |
446 | continue; | |
447 | ||
448 | if (stype == BGP_CLEAR_SOFT_NONE) | |
449 | ret = peer_clear (peer, &nnode); | |
450 | else | |
451 | ret = peer_clear_soft (peer, afi, safi, stype); | |
452 | ||
453 | if (ret < 0) | |
454 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
455 | } | |
456 | return CMD_SUCCESS; | |
457 | } | |
458 | ||
459 | if (sort == clear_as) | |
460 | { | |
461 | as_t as; | |
462 | int find = 0; | |
463 | ||
464 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); | |
465 | ||
466 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) | |
467 | { | |
468 | if (peer->as != as) | |
469 | continue; | |
470 | ||
471 | find = 1; | |
472 | if (stype == BGP_CLEAR_SOFT_NONE) | |
473 | ret = peer_clear (peer, &nnode); | |
474 | else | |
475 | ret = peer_clear_soft (peer, afi, safi, stype); | |
476 | ||
477 | if (ret < 0) | |
478 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
479 | } | |
480 | if (! find) | |
481 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
482 | VTY_NEWLINE); | |
483 | return CMD_SUCCESS; | |
484 | } | |
485 | ||
486 | return CMD_SUCCESS; | |
487 | } | |
488 | ||
489 | static int | |
490 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, | |
491 | enum clear_sort sort, enum bgp_clear_type stype, | |
492 | const char *arg) | |
493 | { | |
494 | struct bgp *bgp; | |
495 | ||
496 | /* BGP structure lookup. */ | |
497 | if (name) | |
498 | { | |
499 | bgp = bgp_lookup_by_name (name); | |
500 | if (bgp == NULL) | |
501 | { | |
502 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); | |
503 | return CMD_WARNING; | |
504 | } | |
505 | } | |
506 | else | |
507 | { | |
508 | bgp = bgp_get_default (); | |
509 | if (bgp == NULL) | |
510 | { | |
511 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
512 | return CMD_WARNING; | |
513 | } | |
514 | } | |
515 | ||
516 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); | |
517 | } | |
518 | ||
519 | /* clear soft inbound */ | |
520 | static void | |
521 | bgp_clear_star_soft_in (struct vty *vty) | |
522 | { | |
523 | bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
524 | BGP_CLEAR_SOFT_IN, NULL); | |
525 | #ifdef HAVE_IPV6 | |
526 | bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
527 | BGP_CLEAR_SOFT_IN, NULL); | |
528 | #endif /* HAVE_IPV6 */ | |
529 | } | |
530 | ||
531 | /* clear soft outbound */ | |
532 | static void | |
533 | bgp_clear_star_soft_out (struct vty *vty) | |
534 | { | |
535 | bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
536 | BGP_CLEAR_SOFT_OUT, NULL); | |
537 | #ifdef HAVE_IPV6 | |
538 | bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
539 | BGP_CLEAR_SOFT_OUT, NULL); | |
540 | #endif /* HAVE_IPV6 */ | |
541 | } | |
542 | ||
543 | ||
718e3744 | 544 | /* BGP global configuration. */ |
545 | ||
546 | DEFUN (bgp_multiple_instance_func, | |
547 | bgp_multiple_instance_cmd, | |
548 | "bgp multiple-instance", | |
549 | BGP_STR | |
550 | "Enable bgp multiple instance\n") | |
551 | { | |
552 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
553 | return CMD_SUCCESS; | |
554 | } | |
555 | ||
556 | DEFUN (no_bgp_multiple_instance, | |
557 | no_bgp_multiple_instance_cmd, | |
558 | "no bgp multiple-instance", | |
559 | NO_STR | |
560 | BGP_STR | |
561 | "BGP multiple instance\n") | |
562 | { | |
563 | int ret; | |
564 | ||
565 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
566 | if (ret < 0) | |
567 | { | |
568 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
569 | return CMD_WARNING; | |
570 | } | |
571 | return CMD_SUCCESS; | |
572 | } | |
573 | ||
574 | DEFUN (bgp_config_type, | |
575 | bgp_config_type_cmd, | |
576 | "bgp config-type (cisco|zebra)", | |
577 | BGP_STR | |
578 | "Configuration type\n" | |
579 | "cisco\n" | |
580 | "zebra\n") | |
581 | { | |
582 | if (strncmp (argv[0], "c", 1) == 0) | |
583 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
584 | else | |
585 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
586 | ||
587 | return CMD_SUCCESS; | |
588 | } | |
589 | ||
590 | DEFUN (no_bgp_config_type, | |
591 | no_bgp_config_type_cmd, | |
592 | "no bgp config-type", | |
593 | NO_STR | |
594 | BGP_STR | |
595 | "Display configuration type\n") | |
596 | { | |
597 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
598 | return CMD_SUCCESS; | |
599 | } | |
600 | ||
601 | DEFUN (no_synchronization, | |
602 | no_synchronization_cmd, | |
603 | "no synchronization", | |
604 | NO_STR | |
605 | "Perform IGP synchronization\n") | |
606 | { | |
607 | return CMD_SUCCESS; | |
608 | } | |
609 | ||
610 | DEFUN (no_auto_summary, | |
611 | no_auto_summary_cmd, | |
612 | "no auto-summary", | |
613 | NO_STR | |
614 | "Enable automatic network number summarization\n") | |
615 | { | |
616 | return CMD_SUCCESS; | |
617 | } | |
3d515fd9 | 618 | |
619 | DEFUN_DEPRECATED (neighbor_version, | |
620 | neighbor_version_cmd, | |
621 | NEIGHBOR_CMD "version (4|4-)", | |
622 | NEIGHBOR_STR | |
623 | NEIGHBOR_ADDR_STR | |
624 | "Set the BGP version to match a neighbor\n" | |
625 | "Neighbor's BGP version\n") | |
626 | { | |
627 | return CMD_SUCCESS; | |
628 | } | |
6b0655a2 | 629 | |
718e3744 | 630 | /* "router bgp" commands. */ |
631 | DEFUN (router_bgp, | |
632 | router_bgp_cmd, | |
320da874 | 633 | "router bgp " CMD_AS_RANGE, |
718e3744 | 634 | ROUTER_STR |
635 | BGP_STR | |
636 | AS_STR) | |
637 | { | |
638 | int ret; | |
639 | as_t as; | |
640 | struct bgp *bgp; | |
fd79ac91 | 641 | const char *name = NULL; |
718e3744 | 642 | |
0b2aa3a0 | 643 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 644 | |
645 | if (argc == 2) | |
646 | name = argv[1]; | |
647 | ||
648 | ret = bgp_get (&bgp, &as, name); | |
649 | switch (ret) | |
650 | { | |
651 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
652 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
653 | VTY_NEWLINE); | |
654 | return CMD_WARNING; | |
718e3744 | 655 | case BGP_ERR_AS_MISMATCH: |
aea339f7 | 656 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); |
718e3744 | 657 | return CMD_WARNING; |
718e3744 | 658 | case BGP_ERR_INSTANCE_MISMATCH: |
659 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); | |
aea339f7 | 660 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
718e3744 | 661 | as, VTY_NEWLINE); |
662 | return CMD_WARNING; | |
718e3744 | 663 | } |
664 | ||
665 | vty->node = BGP_NODE; | |
666 | vty->index = bgp; | |
667 | ||
668 | return CMD_SUCCESS; | |
669 | } | |
670 | ||
671 | ALIAS (router_bgp, | |
672 | router_bgp_view_cmd, | |
320da874 | 673 | "router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 674 | ROUTER_STR |
675 | BGP_STR | |
676 | AS_STR | |
677 | "BGP view\n" | |
678 | "view name\n") | |
6b0655a2 | 679 | |
718e3744 | 680 | /* "no router bgp" commands. */ |
681 | DEFUN (no_router_bgp, | |
682 | no_router_bgp_cmd, | |
320da874 | 683 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 684 | NO_STR |
685 | ROUTER_STR | |
686 | BGP_STR | |
687 | AS_STR) | |
688 | { | |
689 | as_t as; | |
690 | struct bgp *bgp; | |
fd79ac91 | 691 | const char *name = NULL; |
718e3744 | 692 | |
0b2aa3a0 | 693 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 694 | |
695 | if (argc == 2) | |
696 | name = argv[1]; | |
697 | ||
698 | /* Lookup bgp structure. */ | |
699 | bgp = bgp_lookup (as, name); | |
700 | if (! bgp) | |
701 | { | |
702 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
703 | return CMD_WARNING; | |
704 | } | |
705 | ||
706 | bgp_delete (bgp); | |
707 | ||
708 | return CMD_SUCCESS; | |
709 | } | |
710 | ||
711 | ALIAS (no_router_bgp, | |
712 | no_router_bgp_view_cmd, | |
320da874 | 713 | "no router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 714 | NO_STR |
715 | ROUTER_STR | |
716 | BGP_STR | |
717 | AS_STR | |
718 | "BGP view\n" | |
719 | "view name\n") | |
6b0655a2 | 720 | |
718e3744 | 721 | /* BGP router-id. */ |
722 | ||
723 | DEFUN (bgp_router_id, | |
724 | bgp_router_id_cmd, | |
725 | "bgp router-id A.B.C.D", | |
726 | BGP_STR | |
727 | "Override configured router identifier\n" | |
728 | "Manually configured router identifier\n") | |
729 | { | |
730 | int ret; | |
731 | struct in_addr id; | |
732 | struct bgp *bgp; | |
733 | ||
734 | bgp = vty->index; | |
735 | ||
736 | ret = inet_aton (argv[0], &id); | |
737 | if (! ret) | |
738 | { | |
739 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
740 | return CMD_WARNING; | |
741 | } | |
742 | ||
18a6dce6 | 743 | bgp->router_id_static = id; |
718e3744 | 744 | bgp_router_id_set (bgp, &id); |
745 | ||
746 | return CMD_SUCCESS; | |
747 | } | |
748 | ||
749 | DEFUN (no_bgp_router_id, | |
750 | no_bgp_router_id_cmd, | |
751 | "no bgp router-id", | |
752 | NO_STR | |
753 | BGP_STR | |
754 | "Override configured router identifier\n") | |
755 | { | |
756 | int ret; | |
757 | struct in_addr id; | |
758 | struct bgp *bgp; | |
759 | ||
760 | bgp = vty->index; | |
761 | ||
762 | if (argc == 1) | |
763 | { | |
764 | ret = inet_aton (argv[0], &id); | |
765 | if (! ret) | |
766 | { | |
767 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
768 | return CMD_WARNING; | |
769 | } | |
770 | ||
18a6dce6 | 771 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
718e3744 | 772 | { |
773 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
774 | return CMD_WARNING; | |
775 | } | |
776 | } | |
777 | ||
18a6dce6 | 778 | bgp->router_id_static.s_addr = 0; |
779 | bgp_router_id_set (bgp, &router_id_zebra); | |
718e3744 | 780 | |
781 | return CMD_SUCCESS; | |
782 | } | |
783 | ||
784 | ALIAS (no_bgp_router_id, | |
785 | no_bgp_router_id_val_cmd, | |
786 | "no bgp router-id A.B.C.D", | |
787 | NO_STR | |
788 | BGP_STR | |
789 | "Override configured router identifier\n" | |
790 | "Manually configured router identifier\n") | |
6b0655a2 | 791 | |
718e3744 | 792 | /* BGP Cluster ID. */ |
793 | ||
794 | DEFUN (bgp_cluster_id, | |
795 | bgp_cluster_id_cmd, | |
796 | "bgp cluster-id A.B.C.D", | |
797 | BGP_STR | |
798 | "Configure Route-Reflector Cluster-id\n" | |
799 | "Route-Reflector Cluster-id in IP address format\n") | |
800 | { | |
801 | int ret; | |
802 | struct bgp *bgp; | |
803 | struct in_addr cluster; | |
804 | ||
805 | bgp = vty->index; | |
806 | ||
807 | ret = inet_aton (argv[0], &cluster); | |
808 | if (! ret) | |
809 | { | |
810 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
811 | return CMD_WARNING; | |
812 | } | |
813 | ||
814 | bgp_cluster_id_set (bgp, &cluster); | |
7aafcaca | 815 | bgp_clear_star_soft_out (vty); |
718e3744 | 816 | |
817 | return CMD_SUCCESS; | |
818 | } | |
819 | ||
820 | ALIAS (bgp_cluster_id, | |
821 | bgp_cluster_id32_cmd, | |
822 | "bgp cluster-id <1-4294967295>", | |
823 | BGP_STR | |
824 | "Configure Route-Reflector Cluster-id\n" | |
825 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
826 | ||
827 | DEFUN (no_bgp_cluster_id, | |
828 | no_bgp_cluster_id_cmd, | |
829 | "no bgp cluster-id", | |
830 | NO_STR | |
831 | BGP_STR | |
832 | "Configure Route-Reflector Cluster-id\n") | |
833 | { | |
834 | int ret; | |
835 | struct bgp *bgp; | |
836 | struct in_addr cluster; | |
837 | ||
838 | bgp = vty->index; | |
839 | ||
840 | if (argc == 1) | |
841 | { | |
842 | ret = inet_aton (argv[0], &cluster); | |
843 | if (! ret) | |
844 | { | |
845 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
846 | return CMD_WARNING; | |
847 | } | |
848 | } | |
849 | ||
850 | bgp_cluster_id_unset (bgp); | |
7aafcaca | 851 | bgp_clear_star_soft_out (vty); |
718e3744 | 852 | |
853 | return CMD_SUCCESS; | |
854 | } | |
855 | ||
856 | ALIAS (no_bgp_cluster_id, | |
857 | no_bgp_cluster_id_arg_cmd, | |
858 | "no bgp cluster-id A.B.C.D", | |
859 | NO_STR | |
860 | BGP_STR | |
861 | "Configure Route-Reflector Cluster-id\n" | |
862 | "Route-Reflector Cluster-id in IP address format\n") | |
6b0655a2 | 863 | |
718e3744 | 864 | DEFUN (bgp_confederation_identifier, |
865 | bgp_confederation_identifier_cmd, | |
320da874 | 866 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 867 | "BGP specific commands\n" |
868 | "AS confederation parameters\n" | |
869 | "AS number\n" | |
870 | "Set routing domain confederation AS\n") | |
871 | { | |
872 | struct bgp *bgp; | |
873 | as_t as; | |
874 | ||
875 | bgp = vty->index; | |
876 | ||
0b2aa3a0 | 877 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 878 | |
879 | bgp_confederation_id_set (bgp, as); | |
880 | ||
881 | return CMD_SUCCESS; | |
882 | } | |
883 | ||
884 | DEFUN (no_bgp_confederation_identifier, | |
885 | no_bgp_confederation_identifier_cmd, | |
886 | "no bgp confederation identifier", | |
887 | NO_STR | |
888 | "BGP specific commands\n" | |
889 | "AS confederation parameters\n" | |
890 | "AS number\n") | |
891 | { | |
892 | struct bgp *bgp; | |
893 | as_t as; | |
894 | ||
895 | bgp = vty->index; | |
896 | ||
897 | if (argc == 1) | |
0b2aa3a0 | 898 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 899 | |
900 | bgp_confederation_id_unset (bgp); | |
901 | ||
902 | return CMD_SUCCESS; | |
903 | } | |
904 | ||
905 | ALIAS (no_bgp_confederation_identifier, | |
906 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 907 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 908 | NO_STR |
909 | "BGP specific commands\n" | |
910 | "AS confederation parameters\n" | |
911 | "AS number\n" | |
912 | "Set routing domain confederation AS\n") | |
6b0655a2 | 913 | |
718e3744 | 914 | DEFUN (bgp_confederation_peers, |
915 | bgp_confederation_peers_cmd, | |
320da874 | 916 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 917 | "BGP specific commands\n" |
918 | "AS confederation parameters\n" | |
919 | "Peer ASs in BGP confederation\n" | |
920 | AS_STR) | |
921 | { | |
922 | struct bgp *bgp; | |
923 | as_t as; | |
924 | int i; | |
925 | ||
926 | bgp = vty->index; | |
927 | ||
928 | for (i = 0; i < argc; i++) | |
929 | { | |
0b2aa3a0 | 930 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 931 | |
932 | if (bgp->as == as) | |
933 | { | |
934 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
935 | VTY_NEWLINE); | |
936 | continue; | |
937 | } | |
938 | ||
939 | bgp_confederation_peers_add (bgp, as); | |
940 | } | |
941 | return CMD_SUCCESS; | |
942 | } | |
943 | ||
944 | DEFUN (no_bgp_confederation_peers, | |
945 | no_bgp_confederation_peers_cmd, | |
320da874 | 946 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 947 | NO_STR |
948 | "BGP specific commands\n" | |
949 | "AS confederation parameters\n" | |
950 | "Peer ASs in BGP confederation\n" | |
951 | AS_STR) | |
952 | { | |
953 | struct bgp *bgp; | |
954 | as_t as; | |
955 | int i; | |
956 | ||
957 | bgp = vty->index; | |
958 | ||
959 | for (i = 0; i < argc; i++) | |
960 | { | |
0b2aa3a0 PJ |
961 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
962 | ||
718e3744 | 963 | bgp_confederation_peers_remove (bgp, as); |
964 | } | |
965 | return CMD_SUCCESS; | |
966 | } | |
6b0655a2 | 967 | |
5e242b0d DS |
968 | /** |
969 | * Central routine for maximum-paths configuration. | |
970 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
971 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
972 | */ | |
973 | int | |
974 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, char *mpaths, | |
975 | u_int16_t options, int set) | |
165b5fff JB |
976 | { |
977 | struct bgp *bgp; | |
978 | u_int16_t maxpaths; | |
979 | int ret; | |
5e242b0d DS |
980 | afi_t afi; |
981 | safi_t safi; | |
165b5fff JB |
982 | |
983 | bgp = vty->index; | |
5e242b0d DS |
984 | afi = bgp_node_afi (vty); |
985 | safi = bgp_node_safi (vty); | |
165b5fff | 986 | |
5e242b0d DS |
987 | if (set) |
988 | { | |
73ac8160 DS |
989 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
990 | BGP_MAXIMUM_MAXPATHS); | |
5e242b0d DS |
991 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
992 | options); | |
993 | } | |
994 | else | |
995 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 996 | |
165b5fff JB |
997 | if (ret < 0) |
998 | { | |
999 | vty_out (vty, | |
5e242b0d DS |
1000 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
1001 | (set == 1) ? "" : "un", | |
1002 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
1003 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
1004 | return CMD_WARNING; |
1005 | } | |
1006 | ||
7aafcaca DS |
1007 | bgp_recalculate_all_bestpaths (bgp); |
1008 | ||
165b5fff JB |
1009 | return CMD_SUCCESS; |
1010 | } | |
1011 | ||
abc920f8 DS |
1012 | DEFUN (bgp_maxmed_admin, |
1013 | bgp_maxmed_admin_cmd, | |
1014 | "bgp max-med administrative ", | |
1015 | BGP_STR | |
1016 | "Advertise routes with max-med\n" | |
1017 | "Administratively applied, for an indefinite period\n") | |
1018 | { | |
1019 | struct bgp *bgp; | |
1020 | ||
1021 | bgp = vty->index; | |
1022 | ||
1023 | bgp->v_maxmed_admin = 1; | |
1024 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1025 | ||
1026 | bgp_maxmed_update(bgp); | |
1027 | ||
1028 | return CMD_SUCCESS; | |
1029 | } | |
1030 | ||
1031 | DEFUN (bgp_maxmed_admin_medv, | |
1032 | bgp_maxmed_admin_medv_cmd, | |
1033 | "bgp max-med administrative <0-4294967294>", | |
1034 | BGP_STR | |
1035 | "Advertise routes with max-med\n" | |
1036 | "Administratively applied, for an indefinite period\n" | |
1037 | "Max MED value to be used\n") | |
1038 | { | |
1039 | struct bgp *bgp; | |
1040 | ||
1041 | bgp = vty->index; | |
1042 | ||
1043 | bgp->v_maxmed_admin = 1; | |
1044 | VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[0]); | |
1045 | ||
1046 | bgp_maxmed_update(bgp); | |
1047 | ||
1048 | return CMD_SUCCESS; | |
1049 | } | |
1050 | ||
1051 | DEFUN (no_bgp_maxmed_admin, | |
1052 | no_bgp_maxmed_admin_cmd, | |
1053 | "no bgp max-med administrative", | |
1054 | NO_STR | |
1055 | BGP_STR | |
1056 | "Advertise routes with max-med\n" | |
1057 | "Administratively applied, for an indefinite period\n") | |
1058 | { | |
1059 | struct bgp *bgp; | |
1060 | ||
1061 | bgp = vty->index; | |
1062 | ||
1063 | bgp->v_maxmed_admin = BGP_MAXMED_ADMIN_UNCONFIGURED; | |
1064 | bgp->maxmed_admin_value = BGP_MAXMED_VALUE_DEFAULT; | |
1065 | ||
1066 | bgp_maxmed_update(bgp); | |
1067 | ||
1068 | return CMD_SUCCESS; | |
1069 | } | |
1070 | ||
1071 | ALIAS (no_bgp_maxmed_admin, | |
1072 | no_bgp_maxmed_admin_medv_cmd, | |
1073 | "no bgp max-med administrative <0-4294967294>", | |
1074 | NO_STR | |
1075 | BGP_STR | |
1076 | "Advertise routes with max-med\n" | |
1077 | "Administratively applied, for an indefinite period\n" | |
1078 | "Max MED value to be used\n") | |
1079 | ||
1080 | ||
1081 | DEFUN (bgp_maxmed_onstartup, | |
1082 | bgp_maxmed_onstartup_cmd, | |
1083 | "bgp max-med on-startup <5-86400>", | |
1084 | BGP_STR | |
1085 | "Advertise routes with max-med\n" | |
1086 | "Effective on a startup\n" | |
1087 | "Time (seconds) period for max-med\n") | |
1088 | { | |
1089 | struct bgp *bgp; | |
1090 | ||
1091 | bgp = vty->index; | |
1092 | ||
1093 | if (argc != 1) | |
1094 | { | |
1095 | vty_out (vty, "%% Must supply max-med on-startup period"); | |
1096 | return CMD_WARNING; | |
1097 | } | |
1098 | ||
1099 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1100 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1101 | ||
1102 | bgp_maxmed_update(bgp); | |
1103 | ||
1104 | return CMD_SUCCESS; | |
1105 | } | |
1106 | ||
1107 | DEFUN (bgp_maxmed_onstartup_medv, | |
1108 | bgp_maxmed_onstartup_medv_cmd, | |
1109 | "bgp max-med on-startup <5-86400> <0-4294967294>", | |
1110 | BGP_STR | |
1111 | "Advertise routes with max-med\n" | |
1112 | "Effective on a startup\n" | |
1113 | "Time (seconds) period for max-med\n" | |
1114 | "Max MED value to be used\n") | |
1115 | { | |
1116 | struct bgp *bgp; | |
1117 | ||
1118 | bgp = vty->index; | |
1119 | ||
1120 | if (argc != 2) | |
1121 | { | |
1122 | vty_out (vty, "%% Must supply max-med on-startup period and med value"); | |
1123 | return CMD_WARNING; | |
1124 | } | |
1125 | ||
1126 | VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[0]); | |
1127 | VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[1]); | |
1128 | ||
1129 | bgp_maxmed_update(bgp); | |
1130 | ||
1131 | return CMD_SUCCESS; | |
1132 | } | |
1133 | ||
1134 | DEFUN (no_bgp_maxmed_onstartup, | |
1135 | no_bgp_maxmed_onstartup_cmd, | |
1136 | "no bgp max-med on-startup", | |
1137 | NO_STR | |
1138 | BGP_STR | |
1139 | "Advertise routes with max-med\n" | |
1140 | "Effective on a startup\n") | |
1141 | { | |
1142 | struct bgp *bgp; | |
1143 | ||
1144 | bgp = vty->index; | |
1145 | ||
1146 | /* Cancel max-med onstartup if its on */ | |
1147 | if (bgp->t_maxmed_onstartup) | |
1148 | { | |
1149 | THREAD_TIMER_OFF (bgp->t_maxmed_onstartup); | |
1150 | bgp->maxmed_onstartup_over = 1; | |
1151 | } | |
1152 | ||
1153 | bgp->v_maxmed_onstartup = BGP_MAXMED_ONSTARTUP_UNCONFIGURED; | |
1154 | bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; | |
1155 | ||
1156 | bgp_maxmed_update(bgp); | |
1157 | ||
1158 | return CMD_SUCCESS; | |
1159 | } | |
1160 | ||
1161 | ALIAS (no_bgp_maxmed_onstartup, | |
1162 | no_bgp_maxmed_onstartup_period_cmd, | |
1163 | "no bgp max-med on-startup <5-86400>", | |
1164 | NO_STR | |
1165 | BGP_STR | |
1166 | "Advertise routes with max-med\n" | |
1167 | "Effective on a startup\n" | |
1168 | "Time (seconds) period for max-med\n") | |
1169 | ||
1170 | ALIAS (no_bgp_maxmed_onstartup, | |
1171 | no_bgp_maxmed_onstartup_period_medv_cmd, | |
1172 | "no bgp max-med on-startup <5-86400> <0-4294967294>", | |
1173 | NO_STR | |
1174 | BGP_STR | |
1175 | "Advertise routes with max-med\n" | |
1176 | "Effective on a startup\n" | |
1177 | "Time (seconds) period for max-med\n" | |
1178 | "Max MED value to be used\n") | |
1179 | ||
f188f2c4 DS |
1180 | static int |
1181 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
1182 | const char *wait) | |
1183 | { | |
1184 | struct bgp *bgp; | |
1185 | u_int16_t update_delay; | |
1186 | u_int16_t establish_wait; | |
1187 | ||
1188 | ||
1189 | bgp = vty->index; | |
1190 | ||
1191 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
1192 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
1193 | ||
1194 | if (!wait) /* update-delay <delay> */ | |
1195 | { | |
1196 | bgp->v_update_delay = update_delay; | |
1197 | bgp->v_establish_wait = bgp->v_update_delay; | |
1198 | return CMD_SUCCESS; | |
1199 | } | |
1200 | ||
1201 | /* update-delay <delay> <establish-wait> */ | |
1202 | establish_wait = atoi (wait); | |
1203 | if (update_delay < establish_wait) | |
1204 | { | |
1205 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
1206 | VTY_NEWLINE); | |
1207 | return CMD_WARNING; | |
1208 | } | |
1209 | ||
1210 | bgp->v_update_delay = update_delay; | |
1211 | bgp->v_establish_wait = establish_wait; | |
1212 | ||
1213 | return CMD_SUCCESS; | |
1214 | } | |
1215 | ||
1216 | static int | |
1217 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
1218 | { | |
1219 | struct bgp *bgp; | |
1220 | ||
1221 | bgp = vty->index; | |
1222 | ||
1223 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
1224 | bgp->v_establish_wait = bgp->v_update_delay; | |
1225 | ||
1226 | return CMD_SUCCESS; | |
1227 | } | |
1228 | ||
1229 | int | |
1230 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
1231 | { | |
1232 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
1233 | { | |
1234 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
1235 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
1236 | vty_out (vty, " %d", bgp->v_establish_wait); | |
1237 | vty_out (vty, "%s", VTY_NEWLINE); | |
1238 | } | |
1239 | ||
1240 | return 0; | |
1241 | } | |
1242 | ||
1243 | ||
1244 | /* Update-delay configuration */ | |
1245 | DEFUN (bgp_update_delay, | |
1246 | bgp_update_delay_cmd, | |
1247 | "update-delay <0-3600>", | |
1248 | "Force initial delay for best-path and updates\n" | |
1249 | "Seconds\n") | |
1250 | { | |
1251 | return bgp_update_delay_config_vty(vty, argv[0], NULL); | |
1252 | } | |
1253 | ||
1254 | DEFUN (bgp_update_delay_establish_wait, | |
1255 | bgp_update_delay_establish_wait_cmd, | |
1256 | "update-delay <0-3600> <1-3600>", | |
1257 | "Force initial delay for best-path and updates\n" | |
1258 | "Seconds\n" | |
1259 | "Wait for peers to be established\n" | |
1260 | "Seconds\n") | |
1261 | { | |
1262 | return bgp_update_delay_config_vty(vty, argv[0], argv[1]); | |
1263 | } | |
1264 | ||
1265 | /* Update-delay deconfiguration */ | |
1266 | DEFUN (no_bgp_update_delay, | |
1267 | no_bgp_update_delay_cmd, | |
1268 | "no update-delay <0-3600>", | |
1269 | "Force initial delay for best-path and updates\n" | |
1270 | "Seconds\n") | |
1271 | { | |
1272 | return bgp_update_delay_deconfig_vty(vty); | |
1273 | } | |
1274 | ||
1275 | ALIAS (no_bgp_update_delay, | |
1276 | no_bgp_update_delay_establish_wait_cmd, | |
1277 | "no update-delay <0-3600> <1-3600>", | |
1278 | "Force initial delay for best-path and updates\n" | |
1279 | "Seconds\n" | |
1280 | "Wait for peers to be established\n" | |
1281 | "Seconds\n") | |
5e242b0d | 1282 | |
cb1faec9 DS |
1283 | int |
1284 | bgp_wpkt_quanta_config_vty (struct vty *vty, char *num, char set) | |
1285 | { | |
1286 | struct bgp *bgp; | |
1287 | u_int16_t update_delay; | |
1288 | ||
1289 | bgp = vty->index; | |
1290 | ||
1291 | if (set) | |
1292 | VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num, | |
1293 | 1, 4294967295); | |
1294 | else | |
1295 | bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX; | |
1296 | ||
1297 | return CMD_SUCCESS; | |
1298 | } | |
1299 | ||
1300 | int | |
1301 | bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) | |
1302 | { | |
1303 | if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX) | |
1304 | vty_out (vty, " write-quanta %d%s", | |
1305 | bgp->wpkt_quanta, VTY_NEWLINE); | |
1306 | ||
1307 | return 0; | |
1308 | } | |
1309 | ||
1310 | ||
1311 | /* Update-delay configuration */ | |
1312 | DEFUN (bgp_wpkt_quanta, | |
1313 | bgp_wpkt_quanta_cmd, | |
1314 | "write-quanta <1-4294967295>", | |
1315 | "How many packets to write to peer socket per run\n" | |
1316 | "Number of packets\n") | |
1317 | { | |
1318 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 1); | |
1319 | } | |
1320 | ||
1321 | /* Update-delay deconfiguration */ | |
1322 | DEFUN (no_bgp_wpkt_quanta, | |
1323 | no_bgp_wpkt_quanta_cmd, | |
1324 | "no write-quanta <1-4294967295>", | |
1325 | "How many packets to write to peer socket per run\n" | |
1326 | "Number of packets\n") | |
1327 | { | |
1328 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); | |
1329 | } | |
1330 | ||
3f9c7369 DS |
1331 | int |
1332 | bgp_coalesce_config_vty (struct vty *vty, const char *num, char set) | |
1333 | { | |
1334 | struct bgp *bgp; | |
1335 | ||
1336 | bgp = vty->index; | |
1337 | ||
1338 | if (set) | |
1339 | VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num, | |
1340 | 0, 4294967295); | |
1341 | else | |
1342 | bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; | |
1343 | ||
1344 | return CMD_SUCCESS; | |
1345 | } | |
1346 | ||
1347 | int | |
1348 | bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp) | |
1349 | { | |
1350 | if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME) | |
1351 | vty_out (vty, " coalesce-time %d%s", | |
1352 | bgp->coalesce_time, VTY_NEWLINE); | |
1353 | ||
1354 | return 0; | |
1355 | } | |
1356 | ||
1357 | ||
1358 | DEFUN (bgp_coalesce_time, | |
1359 | bgp_coalesce_time_cmd, | |
1360 | "coalesce-time <0-4294967295>", | |
1361 | "Subgroup coalesce timer\n" | |
1362 | "Subgroup coalesce timer value (in ms)\n") | |
1363 | { | |
1364 | return bgp_coalesce_config_vty(vty, argv[0], 1); | |
1365 | } | |
1366 | ||
1367 | DEFUN (no_bgp_coalesce_time, | |
1368 | no_bgp_coalesce_time_cmd, | |
1369 | "no coalesce-time <0-4294967295>", | |
1370 | "Subgroup coalesce timer\n" | |
1371 | "Subgroup coalesce timer value (in ms)\n") | |
1372 | { | |
1373 | return bgp_coalesce_config_vty(vty, argv[0], 0); | |
1374 | } | |
1375 | ||
5e242b0d DS |
1376 | /* Maximum-paths configuration */ |
1377 | DEFUN (bgp_maxpaths, | |
1378 | bgp_maxpaths_cmd, | |
1379 | "maximum-paths <1-255>", | |
1380 | "Forward packets over multiple paths\n" | |
1381 | "Number of paths\n") | |
1382 | { | |
1383 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); | |
1384 | } | |
1385 | ||
165b5fff JB |
1386 | DEFUN (bgp_maxpaths_ibgp, |
1387 | bgp_maxpaths_ibgp_cmd, | |
1388 | "maximum-paths ibgp <1-255>", | |
1389 | "Forward packets over multiple paths\n" | |
1390 | "iBGP-multipath\n" | |
1391 | "Number of paths\n") | |
1392 | { | |
5e242b0d DS |
1393 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); |
1394 | } | |
165b5fff | 1395 | |
5e242b0d DS |
1396 | DEFUN (bgp_maxpaths_ibgp_cluster, |
1397 | bgp_maxpaths_ibgp_cluster_cmd, | |
1398 | "maximum-paths ibgp <1-255> equal-cluster-length", | |
1399 | "Forward packets over multiple paths\n" | |
1400 | "iBGP-multipath\n" | |
1401 | "Number of paths\n" | |
1402 | "Match the cluster length\n") | |
1403 | { | |
1404 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], | |
1405 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); | |
165b5fff JB |
1406 | } |
1407 | ||
1408 | DEFUN (no_bgp_maxpaths, | |
1409 | no_bgp_maxpaths_cmd, | |
1410 | "no maximum-paths", | |
1411 | NO_STR | |
1412 | "Forward packets over multiple paths\n" | |
1413 | "Number of paths\n") | |
1414 | { | |
5e242b0d | 1415 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
1416 | } |
1417 | ||
1418 | ALIAS (no_bgp_maxpaths, | |
1419 | no_bgp_maxpaths_arg_cmd, | |
1420 | "no maximum-paths <1-255>", | |
1421 | NO_STR | |
1422 | "Forward packets over multiple paths\n" | |
1423 | "Number of paths\n") | |
1424 | ||
1425 | DEFUN (no_bgp_maxpaths_ibgp, | |
1426 | no_bgp_maxpaths_ibgp_cmd, | |
1427 | "no maximum-paths ibgp", | |
1428 | NO_STR | |
1429 | "Forward packets over multiple paths\n" | |
1430 | "iBGP-multipath\n" | |
1431 | "Number of paths\n") | |
1432 | { | |
5e242b0d | 1433 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
1434 | } |
1435 | ||
1436 | ALIAS (no_bgp_maxpaths_ibgp, | |
1437 | no_bgp_maxpaths_ibgp_arg_cmd, | |
1438 | "no maximum-paths ibgp <1-255>", | |
1439 | NO_STR | |
1440 | "Forward packets over multiple paths\n" | |
1441 | "iBGP-multipath\n" | |
1442 | "Number of paths\n") | |
1443 | ||
5e242b0d DS |
1444 | ALIAS (no_bgp_maxpaths_ibgp, |
1445 | no_bgp_maxpaths_ibgp_cluster_cmd, | |
1446 | "no maximum-paths ibgp <1-255> equal-cluster-length", | |
1447 | NO_STR | |
1448 | "Forward packets over multiple paths\n" | |
1449 | "iBGP-multipath\n" | |
1450 | "Number of paths\n" | |
1451 | "Match the cluster length\n") | |
1452 | ||
165b5fff JB |
1453 | int |
1454 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
1455 | safi_t safi, int *write) | |
1456 | { | |
1457 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) | |
1458 | { | |
1459 | bgp_config_write_family_header (vty, afi, safi, write); | |
1460 | vty_out (vty, " maximum-paths %d%s", | |
1461 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); | |
1462 | } | |
1463 | ||
1464 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) | |
1465 | { | |
1466 | bgp_config_write_family_header (vty, afi, safi, write); | |
5e242b0d DS |
1467 | vty_out (vty, " maximum-paths ibgp %d", |
1468 | bgp->maxpaths[afi][safi].maxpaths_ibgp); | |
1469 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
1470 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
1471 | vty_out (vty, " equal-cluster-length"); | |
1472 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
1473 | } |
1474 | ||
1475 | return 0; | |
1476 | } | |
6b0655a2 | 1477 | |
718e3744 | 1478 | /* BGP timers. */ |
1479 | ||
1480 | DEFUN (bgp_timers, | |
1481 | bgp_timers_cmd, | |
1482 | "timers bgp <0-65535> <0-65535>", | |
1483 | "Adjust routing timers\n" | |
1484 | "BGP timers\n" | |
1485 | "Keepalive interval\n" | |
1486 | "Holdtime\n") | |
1487 | { | |
1488 | struct bgp *bgp; | |
1489 | unsigned long keepalive = 0; | |
1490 | unsigned long holdtime = 0; | |
1491 | ||
1492 | bgp = vty->index; | |
1493 | ||
1494 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
1495 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
1496 | ||
1497 | /* Holdtime value check. */ | |
1498 | if (holdtime < 3 && holdtime != 0) | |
1499 | { | |
1500 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
1501 | VTY_NEWLINE); | |
1502 | return CMD_WARNING; | |
1503 | } | |
1504 | ||
1505 | bgp_timers_set (bgp, keepalive, holdtime); | |
1506 | ||
1507 | return CMD_SUCCESS; | |
1508 | } | |
1509 | ||
1510 | DEFUN (no_bgp_timers, | |
1511 | no_bgp_timers_cmd, | |
1512 | "no timers bgp", | |
1513 | NO_STR | |
1514 | "Adjust routing timers\n" | |
1515 | "BGP timers\n") | |
1516 | { | |
1517 | struct bgp *bgp; | |
1518 | ||
1519 | bgp = vty->index; | |
1520 | bgp_timers_unset (bgp); | |
1521 | ||
1522 | return CMD_SUCCESS; | |
1523 | } | |
1524 | ||
1525 | ALIAS (no_bgp_timers, | |
1526 | no_bgp_timers_arg_cmd, | |
1527 | "no timers bgp <0-65535> <0-65535>", | |
1528 | NO_STR | |
1529 | "Adjust routing timers\n" | |
1530 | "BGP timers\n" | |
1531 | "Keepalive interval\n" | |
1532 | "Holdtime\n") | |
6b0655a2 | 1533 | |
718e3744 | 1534 | DEFUN (bgp_client_to_client_reflection, |
1535 | bgp_client_to_client_reflection_cmd, | |
1536 | "bgp client-to-client reflection", | |
1537 | "BGP specific commands\n" | |
1538 | "Configure client to client route reflection\n" | |
1539 | "reflection of routes allowed\n") | |
1540 | { | |
1541 | struct bgp *bgp; | |
1542 | ||
1543 | bgp = vty->index; | |
1544 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
7aafcaca DS |
1545 | bgp_clear_star_soft_out (vty); |
1546 | ||
718e3744 | 1547 | return CMD_SUCCESS; |
1548 | } | |
1549 | ||
1550 | DEFUN (no_bgp_client_to_client_reflection, | |
1551 | no_bgp_client_to_client_reflection_cmd, | |
1552 | "no bgp client-to-client reflection", | |
1553 | NO_STR | |
1554 | "BGP specific commands\n" | |
1555 | "Configure client to client route reflection\n" | |
1556 | "reflection of routes allowed\n") | |
1557 | { | |
1558 | struct bgp *bgp; | |
1559 | ||
1560 | bgp = vty->index; | |
1561 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
7aafcaca DS |
1562 | bgp_clear_star_soft_out (vty); |
1563 | ||
718e3744 | 1564 | return CMD_SUCCESS; |
1565 | } | |
1566 | ||
1567 | /* "bgp always-compare-med" configuration. */ | |
1568 | DEFUN (bgp_always_compare_med, | |
1569 | bgp_always_compare_med_cmd, | |
1570 | "bgp always-compare-med", | |
1571 | "BGP specific commands\n" | |
1572 | "Allow comparing MED from different neighbors\n") | |
1573 | { | |
1574 | struct bgp *bgp; | |
1575 | ||
1576 | bgp = vty->index; | |
1577 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1578 | bgp_recalculate_all_bestpaths (bgp); |
1579 | ||
718e3744 | 1580 | return CMD_SUCCESS; |
1581 | } | |
1582 | ||
1583 | DEFUN (no_bgp_always_compare_med, | |
1584 | no_bgp_always_compare_med_cmd, | |
1585 | "no bgp always-compare-med", | |
1586 | NO_STR | |
1587 | "BGP specific commands\n" | |
1588 | "Allow comparing MED from different neighbors\n") | |
1589 | { | |
1590 | struct bgp *bgp; | |
1591 | ||
1592 | bgp = vty->index; | |
1593 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
7aafcaca DS |
1594 | bgp_recalculate_all_bestpaths (bgp); |
1595 | ||
718e3744 | 1596 | return CMD_SUCCESS; |
1597 | } | |
6b0655a2 | 1598 | |
718e3744 | 1599 | /* "bgp deterministic-med" configuration. */ |
1600 | DEFUN (bgp_deterministic_med, | |
1601 | bgp_deterministic_med_cmd, | |
1602 | "bgp deterministic-med", | |
1603 | "BGP specific commands\n" | |
1604 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1605 | { | |
1606 | struct bgp *bgp; | |
1607 | ||
1608 | bgp = vty->index; | |
1609 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
7aafcaca DS |
1610 | bgp_recalculate_all_bestpaths (bgp); |
1611 | ||
718e3744 | 1612 | return CMD_SUCCESS; |
1613 | } | |
1614 | ||
1615 | DEFUN (no_bgp_deterministic_med, | |
1616 | no_bgp_deterministic_med_cmd, | |
1617 | "no bgp deterministic-med", | |
1618 | NO_STR | |
1619 | "BGP specific commands\n" | |
1620 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1621 | { | |
1622 | struct bgp *bgp; | |
1623 | ||
1624 | bgp = vty->index; | |
1625 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
7aafcaca DS |
1626 | bgp_recalculate_all_bestpaths (bgp); |
1627 | ||
718e3744 | 1628 | return CMD_SUCCESS; |
1629 | } | |
538621f2 | 1630 | |
1631 | /* "bgp graceful-restart" configuration. */ | |
1632 | DEFUN (bgp_graceful_restart, | |
1633 | bgp_graceful_restart_cmd, | |
1634 | "bgp graceful-restart", | |
1635 | "BGP specific commands\n" | |
1636 | "Graceful restart capability parameters\n") | |
1637 | { | |
1638 | struct bgp *bgp; | |
1639 | ||
1640 | bgp = vty->index; | |
1641 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1642 | return CMD_SUCCESS; | |
1643 | } | |
1644 | ||
1645 | DEFUN (no_bgp_graceful_restart, | |
1646 | no_bgp_graceful_restart_cmd, | |
1647 | "no bgp graceful-restart", | |
1648 | NO_STR | |
1649 | "BGP specific commands\n" | |
1650 | "Graceful restart capability parameters\n") | |
1651 | { | |
1652 | struct bgp *bgp; | |
1653 | ||
1654 | bgp = vty->index; | |
1655 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1656 | return CMD_SUCCESS; | |
1657 | } | |
1658 | ||
93406d87 | 1659 | DEFUN (bgp_graceful_restart_stalepath_time, |
1660 | bgp_graceful_restart_stalepath_time_cmd, | |
1661 | "bgp graceful-restart stalepath-time <1-3600>", | |
1662 | "BGP specific commands\n" | |
1663 | "Graceful restart capability parameters\n" | |
1664 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1665 | "Delay value (seconds)\n") | |
1666 | { | |
1667 | struct bgp *bgp; | |
1668 | u_int32_t stalepath; | |
1669 | ||
1670 | bgp = vty->index; | |
1671 | if (! bgp) | |
1672 | return CMD_WARNING; | |
1673 | ||
1674 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
1675 | bgp->stalepath_time = stalepath; | |
1676 | return CMD_SUCCESS; | |
1677 | } | |
1678 | ||
1679 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
1680 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1681 | "no bgp graceful-restart stalepath-time", | |
1682 | NO_STR | |
1683 | "BGP specific commands\n" | |
1684 | "Graceful restart capability parameters\n" | |
1685 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1686 | { | |
1687 | struct bgp *bgp; | |
1688 | ||
1689 | bgp = vty->index; | |
1690 | if (! bgp) | |
1691 | return CMD_WARNING; | |
1692 | ||
1693 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1694 | return CMD_SUCCESS; | |
1695 | } | |
1696 | ||
1697 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
1698 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
1699 | "no bgp graceful-restart stalepath-time <1-3600>", | |
1700 | NO_STR | |
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 | ||
718e3744 | 1706 | /* "bgp fast-external-failover" configuration. */ |
1707 | DEFUN (bgp_fast_external_failover, | |
1708 | bgp_fast_external_failover_cmd, | |
1709 | "bgp fast-external-failover", | |
1710 | BGP_STR | |
1711 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1712 | { | |
1713 | struct bgp *bgp; | |
1714 | ||
1715 | bgp = vty->index; | |
1716 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1717 | return CMD_SUCCESS; | |
1718 | } | |
1719 | ||
1720 | DEFUN (no_bgp_fast_external_failover, | |
1721 | no_bgp_fast_external_failover_cmd, | |
1722 | "no bgp fast-external-failover", | |
1723 | NO_STR | |
1724 | BGP_STR | |
1725 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1726 | { | |
1727 | struct bgp *bgp; | |
1728 | ||
1729 | bgp = vty->index; | |
1730 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1731 | return CMD_SUCCESS; | |
1732 | } | |
6b0655a2 | 1733 | |
718e3744 | 1734 | /* "bgp enforce-first-as" configuration. */ |
1735 | DEFUN (bgp_enforce_first_as, | |
1736 | bgp_enforce_first_as_cmd, | |
1737 | "bgp enforce-first-as", | |
1738 | BGP_STR | |
1739 | "Enforce the first AS for EBGP routes\n") | |
1740 | { | |
1741 | struct bgp *bgp; | |
1742 | ||
1743 | bgp = vty->index; | |
1744 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
7aafcaca DS |
1745 | bgp_clear_star_soft_in (vty); |
1746 | ||
718e3744 | 1747 | return CMD_SUCCESS; |
1748 | } | |
1749 | ||
1750 | DEFUN (no_bgp_enforce_first_as, | |
1751 | no_bgp_enforce_first_as_cmd, | |
1752 | "no bgp enforce-first-as", | |
1753 | NO_STR | |
1754 | BGP_STR | |
1755 | "Enforce the first AS for EBGP routes\n") | |
1756 | { | |
1757 | struct bgp *bgp; | |
1758 | ||
1759 | bgp = vty->index; | |
1760 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
7aafcaca DS |
1761 | bgp_clear_star_soft_in (vty); |
1762 | ||
718e3744 | 1763 | return CMD_SUCCESS; |
1764 | } | |
6b0655a2 | 1765 | |
718e3744 | 1766 | /* "bgp bestpath compare-routerid" configuration. */ |
1767 | DEFUN (bgp_bestpath_compare_router_id, | |
1768 | bgp_bestpath_compare_router_id_cmd, | |
1769 | "bgp bestpath compare-routerid", | |
1770 | "BGP specific commands\n" | |
1771 | "Change the default bestpath selection\n" | |
1772 | "Compare router-id for identical EBGP paths\n") | |
1773 | { | |
1774 | struct bgp *bgp; | |
1775 | ||
1776 | bgp = vty->index; | |
1777 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1778 | bgp_recalculate_all_bestpaths (bgp); |
1779 | ||
718e3744 | 1780 | return CMD_SUCCESS; |
1781 | } | |
1782 | ||
1783 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1784 | no_bgp_bestpath_compare_router_id_cmd, | |
1785 | "no bgp bestpath compare-routerid", | |
1786 | NO_STR | |
1787 | "BGP specific commands\n" | |
1788 | "Change the default bestpath selection\n" | |
1789 | "Compare router-id for identical EBGP paths\n") | |
1790 | { | |
1791 | struct bgp *bgp; | |
1792 | ||
1793 | bgp = vty->index; | |
1794 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
7aafcaca DS |
1795 | bgp_recalculate_all_bestpaths (bgp); |
1796 | ||
718e3744 | 1797 | return CMD_SUCCESS; |
1798 | } | |
6b0655a2 | 1799 | |
718e3744 | 1800 | /* "bgp bestpath as-path ignore" configuration. */ |
1801 | DEFUN (bgp_bestpath_aspath_ignore, | |
1802 | bgp_bestpath_aspath_ignore_cmd, | |
1803 | "bgp bestpath as-path ignore", | |
1804 | "BGP specific commands\n" | |
1805 | "Change the default bestpath selection\n" | |
1806 | "AS-path attribute\n" | |
1807 | "Ignore as-path length in selecting a route\n") | |
1808 | { | |
1809 | struct bgp *bgp; | |
1810 | ||
1811 | bgp = vty->index; | |
1812 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1813 | bgp_recalculate_all_bestpaths (bgp); |
1814 | ||
718e3744 | 1815 | return CMD_SUCCESS; |
1816 | } | |
1817 | ||
1818 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
1819 | no_bgp_bestpath_aspath_ignore_cmd, | |
1820 | "no bgp bestpath as-path ignore", | |
1821 | NO_STR | |
1822 | "BGP specific commands\n" | |
1823 | "Change the default bestpath selection\n" | |
1824 | "AS-path attribute\n" | |
1825 | "Ignore as-path length in selecting a route\n") | |
1826 | { | |
1827 | struct bgp *bgp; | |
1828 | ||
1829 | bgp = vty->index; | |
1830 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
7aafcaca DS |
1831 | bgp_recalculate_all_bestpaths (bgp); |
1832 | ||
718e3744 | 1833 | return CMD_SUCCESS; |
1834 | } | |
6b0655a2 | 1835 | |
6811845b | 1836 | /* "bgp bestpath as-path confed" configuration. */ |
1837 | DEFUN (bgp_bestpath_aspath_confed, | |
1838 | bgp_bestpath_aspath_confed_cmd, | |
1839 | "bgp bestpath as-path confed", | |
1840 | "BGP specific commands\n" | |
1841 | "Change the default bestpath selection\n" | |
1842 | "AS-path attribute\n" | |
1843 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1844 | { | |
1845 | struct bgp *bgp; | |
1846 | ||
1847 | bgp = vty->index; | |
1848 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1849 | bgp_recalculate_all_bestpaths (bgp); |
1850 | ||
6811845b | 1851 | return CMD_SUCCESS; |
1852 | } | |
1853 | ||
1854 | DEFUN (no_bgp_bestpath_aspath_confed, | |
1855 | no_bgp_bestpath_aspath_confed_cmd, | |
1856 | "no bgp bestpath as-path confed", | |
1857 | NO_STR | |
1858 | "BGP specific commands\n" | |
1859 | "Change the default bestpath selection\n" | |
1860 | "AS-path attribute\n" | |
1861 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1862 | { | |
1863 | struct bgp *bgp; | |
1864 | ||
1865 | bgp = vty->index; | |
1866 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
7aafcaca DS |
1867 | bgp_recalculate_all_bestpaths (bgp); |
1868 | ||
6811845b | 1869 | return CMD_SUCCESS; |
1870 | } | |
6b0655a2 | 1871 | |
2fdd455c PM |
1872 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
1873 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
1874 | bgp_bestpath_aspath_multipath_relax_cmd, | |
1875 | "bgp bestpath as-path multipath-relax", | |
1876 | "BGP specific commands\n" | |
1877 | "Change the default bestpath selection\n" | |
1878 | "AS-path attribute\n" | |
1879 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1880 | { | |
1881 | struct bgp *bgp; | |
1882 | ||
1883 | bgp = vty->index; | |
1884 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
16fc1eec | 1885 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); |
7aafcaca DS |
1886 | bgp_recalculate_all_bestpaths (bgp); |
1887 | ||
2fdd455c PM |
1888 | return CMD_SUCCESS; |
1889 | } | |
1890 | ||
1891 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, | |
1892 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
1893 | "no bgp bestpath as-path multipath-relax", | |
1894 | NO_STR | |
1895 | "BGP specific commands\n" | |
1896 | "Change the default bestpath selection\n" | |
1897 | "AS-path attribute\n" | |
1898 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1899 | { | |
1900 | struct bgp *bgp; | |
1901 | ||
1902 | bgp = vty->index; | |
1903 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
16fc1eec | 1904 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); |
7aafcaca DS |
1905 | bgp_recalculate_all_bestpaths (bgp); |
1906 | ||
16fc1eec DS |
1907 | return CMD_SUCCESS; |
1908 | } | |
1909 | ||
1910 | /* "bgp bestpath as-path multipath-relax no-as-set" configuration. */ | |
1911 | DEFUN (bgp_bestpath_aspath_multipath_relax_no_as_set, | |
1912 | bgp_bestpath_aspath_multipath_relax_no_as_set_cmd, | |
1913 | "bgp bestpath as-path multipath-relax no-as-set", | |
1914 | "BGP specific commands\n" | |
1915 | "Change the default bestpath selection\n" | |
1916 | "AS-path attribute\n" | |
1917 | "Allow load sharing across routes that have different AS paths (but same length)\n" | |
1918 | "Do not generate an AS_SET\n") | |
1919 | { | |
1920 | struct bgp *bgp; | |
1921 | ||
1922 | bgp = vty->index; | |
1923 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1924 | bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); | |
7aafcaca DS |
1925 | bgp_recalculate_all_bestpaths (bgp); |
1926 | ||
16fc1eec DS |
1927 | return CMD_SUCCESS; |
1928 | } | |
1929 | ||
1930 | DEFUN (no_bgp_bestpath_aspath_multipath_relax_no_as_set, | |
1931 | no_bgp_bestpath_aspath_multipath_relax_no_as_set_cmd, | |
1932 | "no bgp bestpath as-path multipath-relax no-as-set", | |
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 | "Do not generate an AS_SET\n") | |
1939 | { | |
1940 | struct bgp *bgp; | |
1941 | ||
1942 | bgp = vty->index; | |
1943 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1944 | bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); | |
7aafcaca DS |
1945 | bgp_recalculate_all_bestpaths (bgp); |
1946 | ||
2fdd455c PM |
1947 | return CMD_SUCCESS; |
1948 | } | |
6b0655a2 | 1949 | |
848973c7 | 1950 | /* "bgp log-neighbor-changes" configuration. */ |
1951 | DEFUN (bgp_log_neighbor_changes, | |
1952 | bgp_log_neighbor_changes_cmd, | |
1953 | "bgp log-neighbor-changes", | |
1954 | "BGP specific commands\n" | |
1955 | "Log neighbor up/down and reset reason\n") | |
1956 | { | |
1957 | struct bgp *bgp; | |
1958 | ||
1959 | bgp = vty->index; | |
1960 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1961 | return CMD_SUCCESS; | |
1962 | } | |
1963 | ||
1964 | DEFUN (no_bgp_log_neighbor_changes, | |
1965 | no_bgp_log_neighbor_changes_cmd, | |
1966 | "no bgp log-neighbor-changes", | |
1967 | NO_STR | |
1968 | "BGP specific commands\n" | |
1969 | "Log neighbor up/down and reset reason\n") | |
1970 | { | |
1971 | struct bgp *bgp; | |
1972 | ||
1973 | bgp = vty->index; | |
1974 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1975 | return CMD_SUCCESS; | |
1976 | } | |
6b0655a2 | 1977 | |
718e3744 | 1978 | /* "bgp bestpath med" configuration. */ |
1979 | DEFUN (bgp_bestpath_med, | |
1980 | bgp_bestpath_med_cmd, | |
1981 | "bgp bestpath med (confed|missing-as-worst)", | |
1982 | "BGP specific commands\n" | |
1983 | "Change the default bestpath selection\n" | |
1984 | "MED attribute\n" | |
1985 | "Compare MED among confederation paths\n" | |
1986 | "Treat missing MED as the least preferred one\n") | |
1987 | { | |
1988 | struct bgp *bgp; | |
1989 | ||
1990 | bgp = vty->index; | |
1991 | ||
1992 | if (strncmp (argv[0], "confed", 1) == 0) | |
1993 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
1994 | else | |
1995 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1996 | ||
7aafcaca DS |
1997 | bgp_recalculate_all_bestpaths (bgp); |
1998 | ||
718e3744 | 1999 | return CMD_SUCCESS; |
2000 | } | |
2001 | ||
2002 | DEFUN (bgp_bestpath_med2, | |
2003 | bgp_bestpath_med2_cmd, | |
2004 | "bgp bestpath med confed missing-as-worst", | |
2005 | "BGP specific commands\n" | |
2006 | "Change the default bestpath selection\n" | |
2007 | "MED attribute\n" | |
2008 | "Compare MED among confederation paths\n" | |
2009 | "Treat missing MED as the least preferred one\n") | |
2010 | { | |
2011 | struct bgp *bgp; | |
2012 | ||
2013 | bgp = vty->index; | |
2014 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
2015 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2016 | bgp_recalculate_all_bestpaths (bgp); |
2017 | ||
718e3744 | 2018 | return CMD_SUCCESS; |
2019 | } | |
2020 | ||
2021 | ALIAS (bgp_bestpath_med2, | |
2022 | bgp_bestpath_med3_cmd, | |
2023 | "bgp bestpath med missing-as-worst confed", | |
2024 | "BGP specific commands\n" | |
2025 | "Change the default bestpath selection\n" | |
2026 | "MED attribute\n" | |
2027 | "Treat missing MED as the least preferred one\n" | |
2028 | "Compare MED among confederation paths\n") | |
2029 | ||
2030 | DEFUN (no_bgp_bestpath_med, | |
2031 | no_bgp_bestpath_med_cmd, | |
2032 | "no bgp bestpath med (confed|missing-as-worst)", | |
2033 | NO_STR | |
2034 | "BGP specific commands\n" | |
2035 | "Change the default bestpath selection\n" | |
2036 | "MED attribute\n" | |
2037 | "Compare MED among confederation paths\n" | |
2038 | "Treat missing MED as the least preferred one\n") | |
2039 | { | |
2040 | struct bgp *bgp; | |
2041 | ||
2042 | bgp = vty->index; | |
2043 | ||
2044 | if (strncmp (argv[0], "confed", 1) == 0) | |
2045 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2046 | else | |
2047 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
2048 | ||
7aafcaca DS |
2049 | bgp_recalculate_all_bestpaths (bgp); |
2050 | ||
718e3744 | 2051 | return CMD_SUCCESS; |
2052 | } | |
2053 | ||
2054 | DEFUN (no_bgp_bestpath_med2, | |
2055 | no_bgp_bestpath_med2_cmd, | |
2056 | "no bgp bestpath med confed missing-as-worst", | |
2057 | NO_STR | |
2058 | "BGP specific commands\n" | |
2059 | "Change the default bestpath selection\n" | |
2060 | "MED attribute\n" | |
2061 | "Compare MED among confederation paths\n" | |
2062 | "Treat missing MED as the least preferred one\n") | |
2063 | { | |
2064 | struct bgp *bgp; | |
2065 | ||
2066 | bgp = vty->index; | |
2067 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
2068 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
7aafcaca DS |
2069 | bgp_recalculate_all_bestpaths (bgp); |
2070 | ||
718e3744 | 2071 | return CMD_SUCCESS; |
2072 | } | |
2073 | ||
2074 | ALIAS (no_bgp_bestpath_med2, | |
2075 | no_bgp_bestpath_med3_cmd, | |
2076 | "no bgp bestpath med missing-as-worst confed", | |
2077 | NO_STR | |
2078 | "BGP specific commands\n" | |
2079 | "Change the default bestpath selection\n" | |
2080 | "MED attribute\n" | |
2081 | "Treat missing MED as the least preferred one\n" | |
2082 | "Compare MED among confederation paths\n") | |
6b0655a2 | 2083 | |
718e3744 | 2084 | /* "no bgp default ipv4-unicast". */ |
2085 | DEFUN (no_bgp_default_ipv4_unicast, | |
2086 | no_bgp_default_ipv4_unicast_cmd, | |
2087 | "no bgp default ipv4-unicast", | |
2088 | NO_STR | |
2089 | "BGP specific commands\n" | |
2090 | "Configure BGP defaults\n" | |
2091 | "Activate ipv4-unicast for a peer by default\n") | |
2092 | { | |
2093 | struct bgp *bgp; | |
2094 | ||
2095 | bgp = vty->index; | |
2096 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2097 | return CMD_SUCCESS; | |
2098 | } | |
2099 | ||
2100 | DEFUN (bgp_default_ipv4_unicast, | |
2101 | bgp_default_ipv4_unicast_cmd, | |
2102 | "bgp default ipv4-unicast", | |
2103 | "BGP specific commands\n" | |
2104 | "Configure BGP defaults\n" | |
2105 | "Activate ipv4-unicast for a peer by default\n") | |
2106 | { | |
2107 | struct bgp *bgp; | |
2108 | ||
2109 | bgp = vty->index; | |
2110 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
2111 | return CMD_SUCCESS; | |
2112 | } | |
6b0655a2 | 2113 | |
718e3744 | 2114 | /* "bgp import-check" configuration. */ |
2115 | DEFUN (bgp_network_import_check, | |
2116 | bgp_network_import_check_cmd, | |
2117 | "bgp network import-check", | |
2118 | "BGP specific commands\n" | |
2119 | "BGP network command\n" | |
2120 | "Check BGP network route exists in IGP\n") | |
2121 | { | |
2122 | struct bgp *bgp; | |
2123 | ||
2124 | bgp = vty->index; | |
2125 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
2126 | return CMD_SUCCESS; | |
2127 | } | |
2128 | ||
2129 | DEFUN (no_bgp_network_import_check, | |
2130 | no_bgp_network_import_check_cmd, | |
2131 | "no bgp network import-check", | |
2132 | NO_STR | |
2133 | "BGP specific commands\n" | |
2134 | "BGP network command\n" | |
2135 | "Check BGP network route exists in IGP\n") | |
2136 | { | |
2137 | struct bgp *bgp; | |
2138 | ||
2139 | bgp = vty->index; | |
2140 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
2141 | return CMD_SUCCESS; | |
2142 | } | |
6b0655a2 | 2143 | |
718e3744 | 2144 | DEFUN (bgp_default_local_preference, |
2145 | bgp_default_local_preference_cmd, | |
2146 | "bgp default local-preference <0-4294967295>", | |
2147 | "BGP specific commands\n" | |
2148 | "Configure BGP defaults\n" | |
2149 | "local preference (higher=more preferred)\n" | |
2150 | "Configure default local preference value\n") | |
2151 | { | |
2152 | struct bgp *bgp; | |
2153 | u_int32_t local_pref; | |
2154 | ||
2155 | bgp = vty->index; | |
2156 | ||
2157 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
2158 | ||
2159 | bgp_default_local_preference_set (bgp, local_pref); | |
7aafcaca | 2160 | bgp_clear_star_soft_in (vty); |
718e3744 | 2161 | |
2162 | return CMD_SUCCESS; | |
2163 | } | |
2164 | ||
2165 | DEFUN (no_bgp_default_local_preference, | |
2166 | no_bgp_default_local_preference_cmd, | |
2167 | "no bgp default local-preference", | |
2168 | NO_STR | |
2169 | "BGP specific commands\n" | |
2170 | "Configure BGP defaults\n" | |
2171 | "local preference (higher=more preferred)\n") | |
2172 | { | |
2173 | struct bgp *bgp; | |
2174 | ||
2175 | bgp = vty->index; | |
2176 | bgp_default_local_preference_unset (bgp); | |
7aafcaca DS |
2177 | bgp_clear_star_soft_in (vty); |
2178 | ||
718e3744 | 2179 | return CMD_SUCCESS; |
2180 | } | |
2181 | ||
2182 | ALIAS (no_bgp_default_local_preference, | |
2183 | no_bgp_default_local_preference_val_cmd, | |
2184 | "no bgp default local-preference <0-4294967295>", | |
2185 | NO_STR | |
2186 | "BGP specific commands\n" | |
2187 | "Configure BGP defaults\n" | |
2188 | "local preference (higher=more preferred)\n" | |
2189 | "Configure default local preference value\n") | |
6b0655a2 | 2190 | |
3f9c7369 DS |
2191 | DEFUN (bgp_default_subgroup_pkt_queue_max, |
2192 | bgp_default_subgroup_pkt_queue_max_cmd, | |
2193 | "bgp default subgroup-pkt-queue-max <20-100>", | |
2194 | "BGP specific commands\n" | |
2195 | "Configure BGP defaults\n" | |
2196 | "subgroup-pkt-queue-max\n" | |
2197 | "Configure subgroup packet queue max\n") | |
8bd9d948 | 2198 | { |
3f9c7369 DS |
2199 | struct bgp *bgp; |
2200 | u_int32_t max_size; | |
8bd9d948 | 2201 | |
3f9c7369 DS |
2202 | bgp = vty->index; |
2203 | ||
2204 | VTY_GET_INTEGER ("subgroup packet queue max", max_size, argv[0]); | |
2205 | ||
2206 | bgp_default_subgroup_pkt_queue_max_set (bgp, max_size); | |
2207 | ||
2208 | return CMD_SUCCESS; | |
2209 | } | |
2210 | ||
2211 | DEFUN (no_bgp_default_subgroup_pkt_queue_max, | |
2212 | no_bgp_default_subgroup_pkt_queue_max_cmd, | |
2213 | "no bgp default subgroup-pkt-queue-max", | |
2214 | NO_STR | |
2215 | "BGP specific commands\n" | |
2216 | "Configure BGP defaults\n" | |
2217 | "subgroup-pkt-queue-max\n") | |
2218 | { | |
2219 | struct bgp *bgp; | |
2220 | ||
2221 | bgp = vty->index; | |
2222 | bgp_default_subgroup_pkt_queue_max_unset (bgp); | |
2223 | return CMD_SUCCESS; | |
8bd9d948 DS |
2224 | } |
2225 | ||
2226 | DEFUN (bgp_rr_allow_outbound_policy, | |
2227 | bgp_rr_allow_outbound_policy_cmd, | |
2228 | "bgp route-reflector allow-outbound-policy", | |
2229 | "BGP specific commands\n" | |
2230 | "Allow modifications made by out route-map\n" | |
2231 | "on ibgp neighbors\n") | |
2232 | { | |
2233 | struct bgp *bgp; | |
2234 | u_int32_t local_pref; | |
2235 | int ret; | |
2236 | ||
2237 | bgp = vty->index; | |
2238 | ||
2239 | if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2240 | { | |
2241 | bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2242 | update_group_announce_rrclients(bgp); |
7aafcaca | 2243 | bgp_clear_star_soft_out (vty); |
8bd9d948 DS |
2244 | } |
2245 | ||
2246 | return CMD_SUCCESS; | |
2247 | } | |
2248 | ||
2249 | DEFUN (no_bgp_rr_allow_outbound_policy, | |
2250 | no_bgp_rr_allow_outbound_policy_cmd, | |
2251 | "no bgp route-reflector allow-outbound-policy", | |
2252 | NO_STR | |
2253 | "BGP specific commands\n" | |
2254 | "Allow modifications made by out route-map\n" | |
2255 | "on ibgp neighbors\n") | |
2256 | { | |
2257 | struct bgp *bgp; | |
2258 | u_int32_t local_pref; | |
2259 | ||
2260 | bgp = vty->index; | |
2261 | ||
2262 | if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) | |
2263 | { | |
2264 | bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY); | |
3f9c7369 | 2265 | update_group_announce_rrclients(bgp); |
7aafcaca | 2266 | bgp_clear_star_soft_out (vty); |
8bd9d948 DS |
2267 | } |
2268 | ||
2269 | return CMD_SUCCESS; | |
2270 | } | |
2271 | ||
f14e6fdb DS |
2272 | DEFUN (bgp_listen_limit, |
2273 | bgp_listen_limit_cmd, | |
2274 | "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE, | |
2275 | "BGP specific commands\n" | |
2276 | "Configure BGP defaults\n" | |
2277 | "maximum number of BGP Dynamic Neighbors that can be created\n" | |
2278 | "Configure Dynamic Neighbors listen limit value\n") | |
2279 | { | |
2280 | struct bgp *bgp; | |
2281 | int listen_limit; | |
2282 | ||
2283 | bgp = vty->index; | |
2284 | ||
2285 | VTY_GET_INTEGER_RANGE ("listen limit", listen_limit, argv[0], | |
2286 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN, | |
2287 | BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX); | |
2288 | ||
2289 | bgp_listen_limit_set (bgp, listen_limit); | |
2290 | ||
2291 | return CMD_SUCCESS; | |
2292 | } | |
2293 | ||
2294 | DEFUN (no_bgp_listen_limit, | |
2295 | no_bgp_listen_limit_cmd, | |
2296 | "no bgp listen limit", | |
2297 | "BGP specific commands\n" | |
2298 | "Configure BGP defaults\n" | |
2299 | "unset maximum number of BGP Dynamic Neighbors that can be created\n" | |
2300 | "Configure Dynamic Neighbors listen limit value to default\n") | |
2301 | { | |
2302 | struct bgp *bgp; | |
2303 | ||
2304 | bgp = vty->index; | |
2305 | bgp_listen_limit_unset (bgp); | |
2306 | return CMD_SUCCESS; | |
2307 | } | |
2308 | ||
2309 | ||
2310 | DEFUN (bgp_listen_range, | |
2311 | bgp_listen_range_cmd, | |
2312 | LISTEN_RANGE_CMD "peer-group WORD" , | |
2313 | "BGP specific commands\n" | |
2314 | "Configure BGP Dynamic Neighbors\n" | |
2315 | "add a listening range for Dynamic Neighbors\n" | |
2316 | LISTEN_RANGE_ADDR_STR) | |
2317 | { | |
2318 | struct bgp *bgp; | |
2319 | struct prefix range; | |
2320 | struct peer_group *group; | |
2321 | afi_t afi; | |
2322 | int ret; | |
2323 | ||
2324 | bgp = vty->index; | |
2325 | ||
2326 | //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2327 | ||
2328 | /* Convert IP prefix string to struct prefix. */ | |
2329 | ret = str2prefix (argv[0], &range); | |
2330 | if (! ret) | |
2331 | { | |
2332 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2333 | return CMD_WARNING; | |
2334 | } | |
2335 | ||
2336 | afi = family2afi(range.family); | |
2337 | ||
2338 | #ifdef HAVE_IPV6 | |
2339 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2340 | { | |
2341 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2342 | VTY_NEWLINE); | |
2343 | return CMD_WARNING; | |
2344 | } | |
2345 | #endif /* HAVE_IPV6 */ | |
2346 | ||
2347 | apply_mask (&range); | |
2348 | ||
2349 | ||
2350 | group = peer_group_lookup (bgp, argv[1]); | |
2351 | if (! group) | |
2352 | { | |
2353 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2354 | return CMD_WARNING; | |
2355 | } | |
2356 | ||
2357 | ret = peer_group_listen_range_add(group, &range); | |
2358 | return bgp_vty_return (vty, ret); | |
2359 | } | |
2360 | ||
2361 | DEFUN (no_bgp_listen_range, | |
2362 | no_bgp_listen_range_cmd, | |
2363 | "no bgp listen range A.B.C.D/M peer-group WORD" , | |
2364 | "BGP specific commands\n" | |
2365 | "Configure BGP defaults\n" | |
2366 | "delete a listening range for Dynamic Neighbors\n" | |
2367 | "Remove Dynamic Neighbors listening range\n") | |
2368 | { | |
2369 | struct bgp *bgp; | |
2370 | struct prefix range; | |
2371 | struct peer_group *group; | |
2372 | afi_t afi; | |
2373 | int ret; | |
2374 | ||
2375 | bgp = vty->index; | |
2376 | ||
2377 | // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]); | |
2378 | ||
2379 | /* Convert IP prefix string to struct prefix. */ | |
2380 | ret = str2prefix (argv[0], &range); | |
2381 | if (! ret) | |
2382 | { | |
2383 | vty_out (vty, "%% Malformed listen range%s", VTY_NEWLINE); | |
2384 | return CMD_WARNING; | |
2385 | } | |
2386 | ||
2387 | afi = family2afi(range.family); | |
2388 | ||
2389 | #ifdef HAVE_IPV6 | |
2390 | if (afi == AFI_IP6 && IN6_IS_ADDR_LINKLOCAL (&range.u.prefix6)) | |
2391 | { | |
2392 | vty_out (vty, "%% Malformed listen range (link-local address)%s", | |
2393 | VTY_NEWLINE); | |
2394 | return CMD_WARNING; | |
2395 | } | |
2396 | #endif /* HAVE_IPV6 */ | |
2397 | ||
2398 | apply_mask (&range); | |
2399 | ||
2400 | ||
2401 | group = peer_group_lookup (bgp, argv[1]); | |
2402 | if (! group) | |
2403 | { | |
2404 | vty_out (vty, "%% Peer-group does not exist%s", VTY_NEWLINE); | |
2405 | return CMD_WARNING; | |
2406 | } | |
2407 | ||
2408 | ret = peer_group_listen_range_del(group, &range); | |
2409 | return bgp_vty_return (vty, ret); | |
2410 | } | |
2411 | ||
2412 | int | |
2413 | bgp_config_write_listen (struct vty *vty, struct bgp *bgp) | |
2414 | { | |
2415 | struct peer_group *group; | |
2416 | struct listnode *node, *nnode, *rnode, *nrnode; | |
2417 | struct prefix *range; | |
2418 | afi_t afi; | |
2419 | char buf[128]; | |
2420 | ||
2421 | if (bgp->dynamic_neighbors_limit != BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT) | |
2422 | vty_out (vty, " bgp listen limit %d%s", | |
2423 | bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
2424 | ||
2425 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
2426 | { | |
2427 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
2428 | { | |
2429 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], rnode, nrnode, range)) | |
2430 | { | |
2431 | prefix2str(range, buf, sizeof(buf)); | |
2432 | vty_out(vty, " bgp listen range %s peer-group %s%s", | |
2433 | buf, group->name, VTY_NEWLINE); | |
2434 | } | |
2435 | } | |
2436 | } | |
2437 | ||
2438 | return 0; | |
2439 | } | |
2440 | ||
2441 | ||
907f92c8 DS |
2442 | DEFUN (bgp_disable_connected_route_check, |
2443 | bgp_disable_connected_route_check_cmd, | |
2444 | "bgp disable-ebgp-connected-route-check", | |
2445 | "BGP specific commands\n" | |
2446 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2447 | { | |
2448 | struct bgp *bgp; | |
2449 | ||
2450 | bgp = vty->index; | |
2451 | bgp_flag_set (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
7aafcaca DS |
2452 | bgp_clear_star_soft_in (vty); |
2453 | ||
907f92c8 DS |
2454 | return CMD_SUCCESS; |
2455 | } | |
2456 | ||
2457 | DEFUN (no_bgp_disable_connected_route_check, | |
2458 | no_bgp_disable_connected_route_check_cmd, | |
2459 | "no bgp disable-ebgp-connected-route-check", | |
2460 | NO_STR | |
2461 | "BGP specific commands\n" | |
2462 | "Disable checking if nexthop is connected on ebgp sessions\n") | |
2463 | { | |
2464 | struct bgp *bgp; | |
2465 | ||
2466 | bgp = vty->index; | |
2467 | bgp_flag_unset (bgp, BGP_FLAG_DISABLE_NH_CONNECTED_CHK); | |
7aafcaca DS |
2468 | bgp_clear_star_soft_in (vty); |
2469 | ||
907f92c8 DS |
2470 | return CMD_SUCCESS; |
2471 | } | |
2472 | ||
2473 | ||
718e3744 | 2474 | static int |
fd79ac91 | 2475 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
2476 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 2477 | { |
2478 | int ret; | |
2479 | struct bgp *bgp; | |
2480 | as_t as; | |
2481 | union sockunion su; | |
2482 | ||
2483 | bgp = vty->index; | |
2484 | ||
2485 | /* Get AS number. */ | |
0b2aa3a0 | 2486 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); |
718e3744 | 2487 | |
2488 | /* If peer is peer group, call proper function. */ | |
2489 | ret = str2sockunion (peer_str, &su); | |
2490 | if (ret < 0) | |
2491 | { | |
a80beece DS |
2492 | /* Check for peer by interface */ |
2493 | ret = peer_remote_as (bgp, NULL, peer_str, &as, afi, safi); | |
718e3744 | 2494 | if (ret < 0) |
a80beece DS |
2495 | { |
2496 | ret = peer_group_remote_as (bgp, peer_str, &as); | |
2497 | if (ret < 0) | |
2498 | { | |
2499 | vty_out (vty, "%% Create the peer-group or interface first%s", | |
2500 | VTY_NEWLINE); | |
2501 | return CMD_WARNING; | |
2502 | } | |
2503 | return CMD_SUCCESS; | |
2504 | } | |
718e3744 | 2505 | } |
a80beece | 2506 | else |
718e3744 | 2507 | { |
a80beece DS |
2508 | if (peer_address_self_check (&su)) |
2509 | { | |
2510 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2511 | VTY_NEWLINE); | |
2512 | return CMD_WARNING; | |
2513 | } | |
2514 | ret = peer_remote_as (bgp, &su, NULL, &as, afi, safi); | |
718e3744 | 2515 | } |
2516 | ||
718e3744 | 2517 | /* This peer belongs to peer group. */ |
2518 | switch (ret) | |
2519 | { | |
2520 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 2521 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 2522 | return CMD_WARNING; |
718e3744 | 2523 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 2524 | 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 | 2525 | return CMD_WARNING; |
718e3744 | 2526 | } |
2527 | return bgp_vty_return (vty, ret); | |
2528 | } | |
2529 | ||
2530 | DEFUN (neighbor_remote_as, | |
2531 | neighbor_remote_as_cmd, | |
320da874 | 2532 | NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, |
718e3744 | 2533 | NEIGHBOR_STR |
2534 | NEIGHBOR_ADDR_STR2 | |
2535 | "Specify a BGP neighbor\n" | |
2536 | AS_STR) | |
2537 | { | |
2538 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
2539 | } | |
6b0655a2 | 2540 | |
a80beece DS |
2541 | DEFUN (neighbor_interface_config, |
2542 | neighbor_interface_config_cmd, | |
2543 | "neighbor WORD interface", | |
2544 | NEIGHBOR_STR | |
2545 | "Interface name or neighbor tag\n" | |
2546 | "Enable BGP on interface\n") | |
2547 | { | |
2548 | struct bgp *bgp; | |
2549 | struct peer *peer; | |
2550 | struct peer_group *group; | |
2551 | ||
2552 | bgp = vty->index; | |
2553 | group = peer_group_lookup (bgp, argv[0]); | |
2554 | if (group) | |
2555 | { | |
2556 | vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE); | |
2557 | return CMD_WARNING; | |
2558 | } | |
2559 | ||
2560 | peer = peer_conf_interface_get (bgp, argv[0], AFI_IP, SAFI_UNICAST); | |
2561 | if (!peer) | |
2562 | return CMD_WARNING; | |
2563 | ||
2564 | return CMD_SUCCESS; | |
2565 | } | |
2566 | ||
2567 | ||
718e3744 | 2568 | DEFUN (neighbor_peer_group, |
2569 | neighbor_peer_group_cmd, | |
2570 | "neighbor WORD peer-group", | |
2571 | NEIGHBOR_STR | |
a80beece | 2572 | "Interface name or neighbor tag\n" |
718e3744 | 2573 | "Configure peer-group\n") |
2574 | { | |
2575 | struct bgp *bgp; | |
a80beece | 2576 | struct peer *peer; |
718e3744 | 2577 | struct peer_group *group; |
2578 | ||
2579 | bgp = vty->index; | |
a80beece DS |
2580 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2581 | if (peer) | |
2582 | { | |
2583 | vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); | |
2584 | return CMD_WARNING; | |
2585 | } | |
718e3744 | 2586 | |
2587 | group = peer_group_get (bgp, argv[0]); | |
2588 | if (! group) | |
2589 | return CMD_WARNING; | |
2590 | ||
2591 | return CMD_SUCCESS; | |
2592 | } | |
2593 | ||
2594 | DEFUN (no_neighbor, | |
2595 | no_neighbor_cmd, | |
2596 | NO_NEIGHBOR_CMD2, | |
2597 | NO_STR | |
2598 | NEIGHBOR_STR | |
2599 | NEIGHBOR_ADDR_STR2) | |
2600 | { | |
2601 | int ret; | |
2602 | union sockunion su; | |
2603 | struct peer_group *group; | |
2604 | struct peer *peer; | |
1ff9a340 | 2605 | struct peer *other; |
718e3744 | 2606 | |
2607 | ret = str2sockunion (argv[0], &su); | |
2608 | if (ret < 0) | |
2609 | { | |
a80beece DS |
2610 | /* look up for neighbor by interface name config. */ |
2611 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2612 | if (peer) | |
2613 | { | |
2614 | peer_delete (peer); | |
2615 | return CMD_SUCCESS; | |
2616 | } | |
2617 | ||
718e3744 | 2618 | group = peer_group_lookup (vty->index, argv[0]); |
2619 | if (group) | |
2620 | peer_group_delete (group); | |
2621 | else | |
2622 | { | |
2623 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2624 | return CMD_WARNING; | |
2625 | } | |
2626 | } | |
2627 | else | |
2628 | { | |
2629 | peer = peer_lookup (vty->index, &su); | |
2630 | if (peer) | |
1ff9a340 | 2631 | { |
f14e6fdb DS |
2632 | if (peer_dynamic_neighbor (peer)) |
2633 | { | |
2634 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
2635 | VTY_NEWLINE); | |
2636 | return CMD_WARNING; | |
2637 | } | |
2638 | ||
1ff9a340 DS |
2639 | other = peer->doppelganger; |
2640 | peer_delete (peer); | |
2641 | if (other && other->status != Deleted) | |
2642 | peer_delete(other); | |
2643 | } | |
718e3744 | 2644 | } |
2645 | ||
2646 | return CMD_SUCCESS; | |
2647 | } | |
2648 | ||
2649 | ALIAS (no_neighbor, | |
2650 | no_neighbor_remote_as_cmd, | |
320da874 | 2651 | NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, |
718e3744 | 2652 | NO_STR |
2653 | NEIGHBOR_STR | |
2654 | NEIGHBOR_ADDR_STR | |
2655 | "Specify a BGP neighbor\n" | |
2656 | AS_STR) | |
2657 | ||
a80beece DS |
2658 | DEFUN (no_neighbor_interface_config, |
2659 | no_neighbor_interface_config_cmd, | |
2660 | "no neighbor WORD interface", | |
2661 | NO_STR | |
2662 | NEIGHBOR_STR | |
2663 | "Interface name\n" | |
2664 | "Configure BGP on interface\n") | |
2665 | { | |
2666 | struct peer *peer; | |
2667 | ||
2668 | /* look up for neighbor by interface name config. */ | |
2669 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2670 | if (peer) | |
2671 | { | |
2672 | peer_delete (peer); | |
2673 | } | |
2674 | else | |
2675 | { | |
2676 | vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE); | |
2677 | return CMD_WARNING; | |
2678 | } | |
2679 | return CMD_SUCCESS; | |
2680 | } | |
2681 | ||
718e3744 | 2682 | DEFUN (no_neighbor_peer_group, |
2683 | no_neighbor_peer_group_cmd, | |
2684 | "no neighbor WORD peer-group", | |
2685 | NO_STR | |
2686 | NEIGHBOR_STR | |
2687 | "Neighbor tag\n" | |
2688 | "Configure peer-group\n") | |
2689 | { | |
2690 | struct peer_group *group; | |
2691 | ||
2692 | group = peer_group_lookup (vty->index, argv[0]); | |
2693 | if (group) | |
2694 | peer_group_delete (group); | |
2695 | else | |
2696 | { | |
2697 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
2698 | return CMD_WARNING; | |
2699 | } | |
2700 | return CMD_SUCCESS; | |
2701 | } | |
2702 | ||
a80beece DS |
2703 | DEFUN (no_neighbor_interface_peer_group_remote_as, |
2704 | no_neighbor_interface_peer_group_remote_as_cmd, | |
320da874 | 2705 | "no neighbor WORD remote-as " CMD_AS_RANGE, |
718e3744 | 2706 | NO_STR |
2707 | NEIGHBOR_STR | |
a80beece | 2708 | "Interface name or neighbor tag\n" |
718e3744 | 2709 | "Specify a BGP neighbor\n" |
2710 | AS_STR) | |
2711 | { | |
2712 | struct peer_group *group; | |
a80beece DS |
2713 | struct peer *peer; |
2714 | ||
2715 | /* look up for neighbor by interface name config. */ | |
2716 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
2717 | if (peer) | |
2718 | { | |
2719 | peer_as_change (peer, 0); | |
2720 | return CMD_SUCCESS; | |
2721 | } | |
718e3744 | 2722 | |
2723 | group = peer_group_lookup (vty->index, argv[0]); | |
2724 | if (group) | |
2725 | peer_group_remote_as_delete (group); | |
2726 | else | |
2727 | { | |
a80beece | 2728 | vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE); |
718e3744 | 2729 | return CMD_WARNING; |
2730 | } | |
2731 | return CMD_SUCCESS; | |
2732 | } | |
6b0655a2 | 2733 | |
718e3744 | 2734 | DEFUN (neighbor_local_as, |
2735 | neighbor_local_as_cmd, | |
320da874 | 2736 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 2737 | NEIGHBOR_STR |
2738 | NEIGHBOR_ADDR_STR2 | |
2739 | "Specify a local-as number\n" | |
2740 | "AS number used as local AS\n") | |
2741 | { | |
2742 | struct peer *peer; | |
2743 | int ret; | |
2744 | ||
2745 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2746 | if (! peer) | |
2747 | return CMD_WARNING; | |
2748 | ||
9d3f9705 | 2749 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
718e3744 | 2750 | return bgp_vty_return (vty, ret); |
2751 | } | |
2752 | ||
2753 | DEFUN (neighbor_local_as_no_prepend, | |
2754 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 2755 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 2756 | NEIGHBOR_STR |
2757 | NEIGHBOR_ADDR_STR2 | |
2758 | "Specify a local-as number\n" | |
2759 | "AS number used as local AS\n" | |
2760 | "Do not prepend local-as to updates from ebgp peers\n") | |
2761 | { | |
2762 | struct peer *peer; | |
2763 | int ret; | |
2764 | ||
2765 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2766 | if (! peer) | |
2767 | return CMD_WARNING; | |
2768 | ||
9d3f9705 | 2769 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
718e3744 | 2770 | return bgp_vty_return (vty, ret); |
2771 | } | |
2772 | ||
9d3f9705 AC |
2773 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
2774 | neighbor_local_as_no_prepend_replace_as_cmd, | |
2775 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
2776 | NEIGHBOR_STR | |
2777 | NEIGHBOR_ADDR_STR2 | |
2778 | "Specify a local-as number\n" | |
2779 | "AS number used as local AS\n" | |
2780 | "Do not prepend local-as to updates from ebgp peers\n" | |
2781 | "Do not prepend local-as to updates from ibgp peers\n") | |
2782 | { | |
2783 | struct peer *peer; | |
2784 | int ret; | |
2785 | ||
2786 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2787 | if (! peer) | |
2788 | return CMD_WARNING; | |
2789 | ||
2790 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); | |
2791 | return bgp_vty_return (vty, ret); | |
2792 | } | |
2793 | ||
2794 | ||
718e3744 | 2795 | DEFUN (no_neighbor_local_as, |
2796 | no_neighbor_local_as_cmd, | |
2797 | NO_NEIGHBOR_CMD2 "local-as", | |
2798 | NO_STR | |
2799 | NEIGHBOR_STR | |
2800 | NEIGHBOR_ADDR_STR2 | |
2801 | "Specify a local-as number\n") | |
2802 | { | |
2803 | struct peer *peer; | |
2804 | int ret; | |
2805 | ||
2806 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2807 | if (! peer) | |
2808 | return CMD_WARNING; | |
2809 | ||
2810 | ret = peer_local_as_unset (peer); | |
2811 | return bgp_vty_return (vty, ret); | |
2812 | } | |
2813 | ||
2814 | ALIAS (no_neighbor_local_as, | |
2815 | no_neighbor_local_as_val_cmd, | |
320da874 | 2816 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 2817 | NO_STR |
2818 | NEIGHBOR_STR | |
2819 | NEIGHBOR_ADDR_STR2 | |
2820 | "Specify a local-as number\n" | |
2821 | "AS number used as local AS\n") | |
2822 | ||
2823 | ALIAS (no_neighbor_local_as, | |
2824 | no_neighbor_local_as_val2_cmd, | |
320da874 | 2825 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 2826 | NO_STR |
2827 | NEIGHBOR_STR | |
2828 | NEIGHBOR_ADDR_STR2 | |
2829 | "Specify a local-as number\n" | |
2830 | "AS number used as local AS\n" | |
2831 | "Do not prepend local-as to updates from ebgp peers\n") | |
9d3f9705 AC |
2832 | |
2833 | ALIAS (no_neighbor_local_as, | |
2834 | no_neighbor_local_as_val3_cmd, | |
2835 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
2836 | NO_STR | |
2837 | NEIGHBOR_STR | |
2838 | NEIGHBOR_ADDR_STR2 | |
2839 | "Specify a local-as number\n" | |
2840 | "AS number used as local AS\n" | |
2841 | "Do not prepend local-as to updates from ebgp peers\n" | |
2842 | "Do not prepend local-as to updates from ibgp peers\n") | |
6b0655a2 | 2843 | |
3f9c7369 DS |
2844 | DEFUN (neighbor_solo, |
2845 | neighbor_solo_cmd, | |
2846 | NEIGHBOR_CMD2 "solo", | |
2847 | NEIGHBOR_STR | |
2848 | NEIGHBOR_ADDR_STR2 | |
2849 | "Solo peer - part of its own update group\n") | |
2850 | { | |
2851 | struct peer *peer; | |
2852 | int ret; | |
2853 | ||
2854 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2855 | if (! peer) | |
2856 | return CMD_WARNING; | |
2857 | ||
2858 | ret = update_group_adjust_soloness(peer, 1); | |
2859 | return bgp_vty_return (vty, ret); | |
2860 | } | |
2861 | ||
2862 | DEFUN (no_neighbor_solo, | |
2863 | no_neighbor_solo_cmd, | |
2864 | NO_NEIGHBOR_CMD2 "solo", | |
2865 | NO_STR | |
2866 | NEIGHBOR_STR | |
2867 | NEIGHBOR_ADDR_STR2 | |
2868 | "Solo peer - part of its own update group\n") | |
2869 | { | |
2870 | struct peer *peer; | |
2871 | int ret; | |
2872 | ||
2873 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2874 | if (! peer) | |
2875 | return CMD_WARNING; | |
2876 | ||
2877 | ret = update_group_adjust_soloness(peer, 0); | |
2878 | return bgp_vty_return (vty, ret); | |
2879 | } | |
2880 | ||
0df7c91f PJ |
2881 | DEFUN (neighbor_password, |
2882 | neighbor_password_cmd, | |
2883 | NEIGHBOR_CMD2 "password LINE", | |
2884 | NEIGHBOR_STR | |
2885 | NEIGHBOR_ADDR_STR2 | |
2886 | "Set a password\n" | |
2887 | "The password\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 | ||
2896 | ret = peer_password_set (peer, argv[1]); | |
2897 | return bgp_vty_return (vty, ret); | |
2898 | } | |
2899 | ||
2900 | DEFUN (no_neighbor_password, | |
2901 | no_neighbor_password_cmd, | |
2902 | NO_NEIGHBOR_CMD2 "password", | |
2903 | NO_STR | |
2904 | NEIGHBOR_STR | |
2905 | NEIGHBOR_ADDR_STR2 | |
2906 | "Set a password\n") | |
2907 | { | |
2908 | struct peer *peer; | |
2909 | int ret; | |
2910 | ||
2911 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2912 | if (! peer) | |
2913 | return CMD_WARNING; | |
2914 | ||
2915 | ret = peer_password_unset (peer); | |
2916 | return bgp_vty_return (vty, ret); | |
2917 | } | |
6b0655a2 | 2918 | |
718e3744 | 2919 | DEFUN (neighbor_activate, |
2920 | neighbor_activate_cmd, | |
2921 | NEIGHBOR_CMD2 "activate", | |
2922 | NEIGHBOR_STR | |
2923 | NEIGHBOR_ADDR_STR2 | |
2924 | "Enable the Address Family for this Neighbor\n") | |
2925 | { | |
2926 | struct peer *peer; | |
2927 | ||
2928 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2929 | if (! peer) | |
2930 | return CMD_WARNING; | |
2931 | ||
2932 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
2933 | ||
2934 | return CMD_SUCCESS; | |
2935 | } | |
2936 | ||
2937 | DEFUN (no_neighbor_activate, | |
2938 | no_neighbor_activate_cmd, | |
2939 | NO_NEIGHBOR_CMD2 "activate", | |
2940 | NO_STR | |
2941 | NEIGHBOR_STR | |
2942 | NEIGHBOR_ADDR_STR2 | |
2943 | "Enable the Address Family for this Neighbor\n") | |
2944 | { | |
2945 | int ret; | |
2946 | struct peer *peer; | |
2947 | ||
2948 | /* Lookup peer. */ | |
2949 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2950 | if (! peer) | |
2951 | return CMD_WARNING; | |
2952 | ||
2953 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
2954 | ||
2955 | return bgp_vty_return (vty, ret); | |
2956 | } | |
6b0655a2 | 2957 | |
718e3744 | 2958 | DEFUN (neighbor_set_peer_group, |
2959 | neighbor_set_peer_group_cmd, | |
a80beece | 2960 | NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 2961 | NEIGHBOR_STR |
a80beece | 2962 | NEIGHBOR_ADDR_STR2 |
718e3744 | 2963 | "Member of the peer-group\n" |
2964 | "peer-group name\n") | |
2965 | { | |
2966 | int ret; | |
2967 | as_t as; | |
2968 | union sockunion su; | |
2969 | struct bgp *bgp; | |
a80beece | 2970 | struct peer *peer; |
718e3744 | 2971 | struct peer_group *group; |
2972 | ||
2973 | bgp = vty->index; | |
a80beece | 2974 | peer = NULL; |
718e3744 | 2975 | |
2976 | ret = str2sockunion (argv[0], &su); | |
2977 | if (ret < 0) | |
2978 | { | |
a80beece DS |
2979 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2980 | if (!peer) | |
2981 | { | |
2982 | vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); | |
2983 | return CMD_WARNING; | |
2984 | } | |
2985 | } | |
2986 | else | |
2987 | { | |
2988 | if (peer_address_self_check (&su)) | |
2989 | { | |
2990 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2991 | VTY_NEWLINE); | |
2992 | return CMD_WARNING; | |
2993 | } | |
f14e6fdb DS |
2994 | |
2995 | /* Disallow for dynamic neighbor. */ | |
2996 | peer = peer_lookup (bgp, &su); | |
2997 | if (peer && peer_dynamic_neighbor (peer)) | |
2998 | { | |
2999 | vty_out (vty, "%% Operation not allowed on a dynamic neighbor%s", | |
3000 | VTY_NEWLINE); | |
3001 | return CMD_WARNING; | |
3002 | } | |
718e3744 | 3003 | } |
3004 | ||
3005 | group = peer_group_lookup (bgp, argv[1]); | |
3006 | if (! group) | |
3007 | { | |
3008 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3009 | return CMD_WARNING; | |
3010 | } | |
3011 | ||
a80beece | 3012 | ret = peer_group_bind (bgp, &su, peer, group, bgp_node_afi (vty), |
718e3744 | 3013 | bgp_node_safi (vty), &as); |
3014 | ||
3015 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
3016 | { | |
aea339f7 | 3017 | 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 | 3018 | return CMD_WARNING; |
3019 | } | |
3020 | ||
3021 | return bgp_vty_return (vty, ret); | |
3022 | } | |
3023 | ||
3024 | DEFUN (no_neighbor_set_peer_group, | |
3025 | no_neighbor_set_peer_group_cmd, | |
a80beece | 3026 | NO_NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 3027 | NO_STR |
3028 | NEIGHBOR_STR | |
a80beece | 3029 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3030 | "Member of the peer-group\n" |
3031 | "peer-group name\n") | |
3032 | { | |
3033 | int ret; | |
3034 | struct bgp *bgp; | |
3035 | struct peer *peer; | |
3036 | struct peer_group *group; | |
3037 | ||
3038 | bgp = vty->index; | |
3039 | ||
3040 | peer = peer_lookup_vty (vty, argv[0]); | |
3041 | if (! peer) | |
3042 | return CMD_WARNING; | |
3043 | ||
3044 | group = peer_group_lookup (bgp, argv[1]); | |
3045 | if (! group) | |
3046 | { | |
3047 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
3048 | return CMD_WARNING; | |
3049 | } | |
3050 | ||
3051 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), | |
3052 | bgp_node_safi (vty)); | |
3053 | ||
3054 | return bgp_vty_return (vty, ret); | |
3055 | } | |
6b0655a2 | 3056 | |
94f2b392 | 3057 | static int |
fd79ac91 | 3058 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
3059 | u_int16_t flag, int set) | |
718e3744 | 3060 | { |
3061 | int ret; | |
3062 | struct peer *peer; | |
3063 | ||
3064 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3065 | if (! peer) | |
3066 | return CMD_WARNING; | |
3067 | ||
3068 | if (set) | |
3069 | ret = peer_flag_set (peer, flag); | |
3070 | else | |
3071 | ret = peer_flag_unset (peer, flag); | |
3072 | ||
3073 | return bgp_vty_return (vty, ret); | |
3074 | } | |
3075 | ||
94f2b392 | 3076 | static int |
fd79ac91 | 3077 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3078 | { |
3079 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
3080 | } | |
3081 | ||
94f2b392 | 3082 | static int |
fd79ac91 | 3083 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 3084 | { |
3085 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
3086 | } | |
3087 | ||
3088 | /* neighbor passive. */ | |
3089 | DEFUN (neighbor_passive, | |
3090 | neighbor_passive_cmd, | |
3091 | NEIGHBOR_CMD2 "passive", | |
3092 | NEIGHBOR_STR | |
3093 | NEIGHBOR_ADDR_STR2 | |
3094 | "Don't send open messages to this neighbor\n") | |
3095 | { | |
3096 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3097 | } | |
3098 | ||
3099 | DEFUN (no_neighbor_passive, | |
3100 | no_neighbor_passive_cmd, | |
3101 | NO_NEIGHBOR_CMD2 "passive", | |
3102 | NO_STR | |
3103 | NEIGHBOR_STR | |
3104 | NEIGHBOR_ADDR_STR2 | |
3105 | "Don't send open messages to this neighbor\n") | |
3106 | { | |
3107 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
3108 | } | |
6b0655a2 | 3109 | |
718e3744 | 3110 | /* neighbor shutdown. */ |
3111 | DEFUN (neighbor_shutdown, | |
3112 | neighbor_shutdown_cmd, | |
3113 | NEIGHBOR_CMD2 "shutdown", | |
3114 | NEIGHBOR_STR | |
3115 | NEIGHBOR_ADDR_STR2 | |
3116 | "Administratively shut down this neighbor\n") | |
3117 | { | |
3118 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3119 | } | |
3120 | ||
3121 | DEFUN (no_neighbor_shutdown, | |
3122 | no_neighbor_shutdown_cmd, | |
3123 | NO_NEIGHBOR_CMD2 "shutdown", | |
3124 | NO_STR | |
3125 | NEIGHBOR_STR | |
3126 | NEIGHBOR_ADDR_STR2 | |
3127 | "Administratively shut down this neighbor\n") | |
3128 | { | |
3129 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
3130 | } | |
6b0655a2 | 3131 | |
d5a5c8f0 DS |
3132 | /* neighbor bfd. */ |
3133 | DEFUN (neighbor_bfd, | |
3134 | neighbor_bfd_cmd, | |
3135 | NEIGHBOR_CMD2 "bfd", | |
3136 | NEIGHBOR_STR | |
3137 | NEIGHBOR_ADDR_STR2 | |
3138 | "Respond to BFD session event\n") | |
3139 | { | |
3140 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_BFD); | |
3141 | } | |
3142 | ||
3143 | DEFUN (no_neighbor_bfd, | |
3144 | no_neighbor_bfd_cmd, | |
3145 | NO_NEIGHBOR_CMD2 "bfd", | |
3146 | NO_STR | |
3147 | NEIGHBOR_STR | |
3148 | NEIGHBOR_ADDR_STR2 | |
3149 | "Respond to BFD session event\n") | |
3150 | { | |
3151 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_BFD); | |
3152 | } | |
3153 | ||
c9502438 | 3154 | /* Deprecated neighbor capability route-refresh. */ |
3155 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, | |
3156 | neighbor_capability_route_refresh_cmd, | |
3157 | NEIGHBOR_CMD2 "capability route-refresh", | |
3158 | NEIGHBOR_STR | |
3159 | NEIGHBOR_ADDR_STR2 | |
3160 | "Advertise capability to the peer\n" | |
3161 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 3162 | { |
c9502438 | 3163 | return CMD_SUCCESS; |
718e3744 | 3164 | } |
3165 | ||
c9502438 | 3166 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
3167 | no_neighbor_capability_route_refresh_cmd, | |
3168 | NO_NEIGHBOR_CMD2 "capability route-refresh", | |
3169 | NO_STR | |
3170 | NEIGHBOR_STR | |
3171 | NEIGHBOR_ADDR_STR2 | |
3172 | "Advertise capability to the peer\n" | |
3173 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 3174 | { |
c9502438 | 3175 | return CMD_SUCCESS; |
718e3744 | 3176 | } |
6b0655a2 | 3177 | |
718e3744 | 3178 | /* neighbor capability dynamic. */ |
3179 | DEFUN (neighbor_capability_dynamic, | |
3180 | neighbor_capability_dynamic_cmd, | |
3181 | NEIGHBOR_CMD2 "capability dynamic", | |
3182 | NEIGHBOR_STR | |
3183 | NEIGHBOR_ADDR_STR2 | |
3184 | "Advertise capability to the peer\n" | |
3185 | "Advertise dynamic capability to this neighbor\n") | |
3186 | { | |
3187 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3188 | } | |
3189 | ||
3190 | DEFUN (no_neighbor_capability_dynamic, | |
3191 | no_neighbor_capability_dynamic_cmd, | |
3192 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
3193 | NO_STR | |
3194 | NEIGHBOR_STR | |
3195 | NEIGHBOR_ADDR_STR2 | |
3196 | "Advertise capability to the peer\n" | |
3197 | "Advertise dynamic capability to this neighbor\n") | |
3198 | { | |
3199 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
3200 | } | |
6b0655a2 | 3201 | |
718e3744 | 3202 | /* neighbor dont-capability-negotiate */ |
3203 | DEFUN (neighbor_dont_capability_negotiate, | |
3204 | neighbor_dont_capability_negotiate_cmd, | |
3205 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3206 | NEIGHBOR_STR | |
3207 | NEIGHBOR_ADDR_STR2 | |
3208 | "Do not perform capability negotiation\n") | |
3209 | { | |
3210 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3211 | } | |
3212 | ||
3213 | DEFUN (no_neighbor_dont_capability_negotiate, | |
3214 | no_neighbor_dont_capability_negotiate_cmd, | |
3215 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
3216 | NO_STR | |
3217 | NEIGHBOR_STR | |
3218 | NEIGHBOR_ADDR_STR2 | |
3219 | "Do not perform capability negotiation\n") | |
3220 | { | |
3221 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
3222 | } | |
6b0655a2 | 3223 | |
94f2b392 | 3224 | static int |
fd79ac91 | 3225 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3226 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 3227 | { |
3228 | int ret; | |
3229 | struct peer *peer; | |
3230 | ||
3231 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3232 | if (! peer) | |
3233 | return CMD_WARNING; | |
3234 | ||
3235 | if (set) | |
3236 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
3237 | else | |
3238 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
3239 | ||
3240 | return bgp_vty_return (vty, ret); | |
3241 | } | |
3242 | ||
94f2b392 | 3243 | static int |
fd79ac91 | 3244 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3245 | safi_t safi, u_int32_t flag) |
718e3744 | 3246 | { |
3247 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
3248 | } | |
3249 | ||
94f2b392 | 3250 | static int |
fd79ac91 | 3251 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 3252 | safi_t safi, u_int32_t flag) |
718e3744 | 3253 | { |
3254 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
3255 | } | |
6b0655a2 | 3256 | |
718e3744 | 3257 | /* neighbor capability orf prefix-list. */ |
3258 | DEFUN (neighbor_capability_orf_prefix, | |
3259 | neighbor_capability_orf_prefix_cmd, | |
3260 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3261 | NEIGHBOR_STR | |
3262 | NEIGHBOR_ADDR_STR2 | |
3263 | "Advertise capability to the peer\n" | |
3264 | "Advertise ORF capability to the peer\n" | |
3265 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3266 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3267 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3268 | "Capability to SEND the ORF to this neighbor\n") | |
3269 | { | |
3270 | u_int16_t flag = 0; | |
3271 | ||
3272 | if (strncmp (argv[1], "s", 1) == 0) | |
3273 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3274 | else if (strncmp (argv[1], "r", 1) == 0) | |
3275 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3276 | else if (strncmp (argv[1], "b", 1) == 0) | |
3277 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3278 | else | |
3279 | return CMD_WARNING; | |
3280 | ||
3281 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3282 | bgp_node_safi (vty), flag); | |
3283 | } | |
3284 | ||
3285 | DEFUN (no_neighbor_capability_orf_prefix, | |
3286 | no_neighbor_capability_orf_prefix_cmd, | |
3287 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
3288 | NO_STR | |
3289 | NEIGHBOR_STR | |
3290 | NEIGHBOR_ADDR_STR2 | |
3291 | "Advertise capability to the peer\n" | |
3292 | "Advertise ORF capability to the peer\n" | |
3293 | "Advertise prefixlist ORF capability to this neighbor\n" | |
3294 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
3295 | "Capability to RECEIVE the ORF from this neighbor\n" | |
3296 | "Capability to SEND the ORF to this neighbor\n") | |
3297 | { | |
3298 | u_int16_t flag = 0; | |
3299 | ||
3300 | if (strncmp (argv[1], "s", 1) == 0) | |
3301 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
3302 | else if (strncmp (argv[1], "r", 1) == 0) | |
3303 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
3304 | else if (strncmp (argv[1], "b", 1) == 0) | |
3305 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
3306 | else | |
3307 | return CMD_WARNING; | |
3308 | ||
3309 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3310 | bgp_node_safi (vty), flag); | |
3311 | } | |
6b0655a2 | 3312 | |
718e3744 | 3313 | /* neighbor next-hop-self. */ |
3314 | DEFUN (neighbor_nexthop_self, | |
3315 | neighbor_nexthop_self_cmd, | |
9e7a53c1 | 3316 | NEIGHBOR_CMD2 "next-hop-self {all}", |
718e3744 | 3317 | NEIGHBOR_STR |
3318 | NEIGHBOR_ADDR_STR2 | |
9e7a53c1 TT |
3319 | "Disable the next hop calculation for this neighbor\n" |
3320 | "Apply also to ibgp-learned routes when acting as a route reflector\n") | |
718e3744 | 3321 | { |
9e7a53c1 TT |
3322 | u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0; |
3323 | int rc; | |
3324 | ||
3325 | /* Check if "all" is specified */ | |
3326 | if (argv[1] != NULL) | |
3327 | flags |= PEER_FLAG_NEXTHOP_SELF_ALL; | |
3328 | else | |
3329 | unset |= PEER_FLAG_NEXTHOP_SELF_ALL; | |
3330 | ||
3331 | rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3332 | bgp_node_safi (vty), flags); | |
3333 | if ( rc == CMD_SUCCESS && unset ) | |
3334 | rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3335 | bgp_node_safi (vty), unset); | |
3336 | return rc; | |
718e3744 | 3337 | } |
3338 | ||
3339 | DEFUN (no_neighbor_nexthop_self, | |
3340 | no_neighbor_nexthop_self_cmd, | |
9e7a53c1 | 3341 | NO_NEIGHBOR_CMD2 "next-hop-self {all}", |
718e3744 | 3342 | NO_STR |
3343 | NEIGHBOR_STR | |
3344 | NEIGHBOR_ADDR_STR2 | |
9e7a53c1 TT |
3345 | "Disable the next hop calculation for this neighbor\n" |
3346 | "Apply also to ibgp-learned routes when acting as a route reflector\n") | |
718e3744 | 3347 | { |
3348 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
9e7a53c1 TT |
3349 | bgp_node_safi (vty), |
3350 | PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL); | |
718e3744 | 3351 | } |
6b0655a2 | 3352 | |
c7122e14 DS |
3353 | /* neighbor as-override */ |
3354 | DEFUN (neighbor_as_override, | |
3355 | neighbor_as_override_cmd, | |
3356 | NEIGHBOR_CMD2 "as-override", | |
3357 | NEIGHBOR_STR | |
3358 | NEIGHBOR_ADDR_STR2 | |
3359 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3360 | { | |
3361 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3362 | bgp_node_safi (vty), | |
3363 | PEER_FLAG_AS_OVERRIDE); | |
3364 | } | |
3365 | ||
3366 | DEFUN (no_neighbor_as_override, | |
3367 | no_neighbor_as_override_cmd, | |
3368 | NO_NEIGHBOR_CMD2 "as-override", | |
3369 | NO_STR | |
3370 | NEIGHBOR_STR | |
3371 | NEIGHBOR_ADDR_STR2 | |
3372 | "Override ASNs in outbound updates if aspath equals remote-as\n") | |
3373 | { | |
3374 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3375 | bgp_node_safi (vty), | |
3376 | PEER_FLAG_AS_OVERRIDE); | |
3377 | } | |
3378 | ||
718e3744 | 3379 | /* neighbor remove-private-AS. */ |
3380 | DEFUN (neighbor_remove_private_as, | |
3381 | neighbor_remove_private_as_cmd, | |
3382 | NEIGHBOR_CMD2 "remove-private-AS", | |
3383 | NEIGHBOR_STR | |
3384 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3385 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3386 | { |
5000f21c DS |
3387 | peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), |
3388 | bgp_node_safi (vty), | |
3389 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL| | |
3390 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
718e3744 | 3391 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), |
3392 | bgp_node_safi (vty), | |
3393 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
3394 | } | |
3395 | ||
5000f21c DS |
3396 | DEFUN (neighbor_remove_private_as_all, |
3397 | neighbor_remove_private_as_all_cmd, | |
3398 | NEIGHBOR_CMD2 "remove-private-AS all", | |
3399 | NEIGHBOR_STR | |
3400 | NEIGHBOR_ADDR_STR2 | |
3401 | "Remove private ASNs in outbound updates\n" | |
3402 | "Apply to all AS numbers") | |
3403 | { | |
3404 | peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3405 | bgp_node_safi (vty), | |
3406 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3407 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3408 | bgp_node_safi (vty), | |
3409 | PEER_FLAG_REMOVE_PRIVATE_AS| | |
3410 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3411 | } | |
3412 | ||
3413 | DEFUN (neighbor_remove_private_as_replace_as, | |
3414 | neighbor_remove_private_as_replace_as_cmd, | |
3415 | NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3416 | NEIGHBOR_STR | |
3417 | NEIGHBOR_ADDR_STR2 | |
3418 | "Remove private ASNs in outbound updates\n" | |
3419 | "Replace private ASNs with our ASN in outbound updates\n") | |
3420 | { | |
3421 | peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3422 | bgp_node_safi (vty), | |
3423 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL); | |
3424 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3425 | bgp_node_safi (vty), | |
3426 | PEER_FLAG_REMOVE_PRIVATE_AS| | |
3427 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3428 | } | |
3429 | ||
3430 | DEFUN (neighbor_remove_private_as_all_replace_as, | |
3431 | neighbor_remove_private_as_all_replace_as_cmd, | |
3432 | NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3433 | NEIGHBOR_STR | |
3434 | NEIGHBOR_ADDR_STR2 | |
3435 | "Remove private ASNs in outbound updates\n" | |
3436 | "Apply to all AS numbers" | |
3437 | "Replace private ASNs with our ASN in outbound updates\n") | |
3438 | { | |
3439 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3440 | bgp_node_safi (vty), | |
3441 | PEER_FLAG_REMOVE_PRIVATE_AS| | |
3442 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL| | |
3443 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
3444 | } | |
3445 | ||
718e3744 | 3446 | DEFUN (no_neighbor_remove_private_as, |
3447 | no_neighbor_remove_private_as_cmd, | |
3448 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
3449 | NO_STR | |
3450 | NEIGHBOR_STR | |
3451 | NEIGHBOR_ADDR_STR2 | |
5000f21c | 3452 | "Remove private ASNs in outbound updates\n") |
718e3744 | 3453 | { |
3454 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3455 | bgp_node_safi (vty), | |
5000f21c DS |
3456 | PEER_FLAG_REMOVE_PRIVATE_AS| |
3457 | PEER_FLAG_REMOVE_PRIVATE_AS_ALL| | |
3458 | PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE); | |
718e3744 | 3459 | } |
6b0655a2 | 3460 | |
5000f21c DS |
3461 | ALIAS (no_neighbor_remove_private_as, |
3462 | no_neighbor_remove_private_as_all_cmd, | |
3463 | NO_NEIGHBOR_CMD2 "remove-private-AS all", | |
3464 | NO_STR | |
3465 | NEIGHBOR_STR | |
3466 | NEIGHBOR_ADDR_STR2 | |
3467 | "Remove private ASNs in outbound updates\n" | |
3468 | "Apply to all AS numbers") | |
3469 | ||
3470 | ALIAS (no_neighbor_remove_private_as, | |
3471 | no_neighbor_remove_private_as_replace_as_cmd, | |
3472 | NO_NEIGHBOR_CMD2 "remove-private-AS replace-AS", | |
3473 | NO_STR | |
3474 | NEIGHBOR_STR | |
3475 | NEIGHBOR_ADDR_STR2 | |
3476 | "Remove private ASNs in outbound updates\n" | |
3477 | "Replace private ASNs with our ASN in outbound updates\n") | |
3478 | ||
3479 | ALIAS (no_neighbor_remove_private_as, | |
3480 | no_neighbor_remove_private_as_all_replace_as_cmd, | |
3481 | NO_NEIGHBOR_CMD2 "remove-private-AS all replace-AS", | |
3482 | NO_STR | |
3483 | NEIGHBOR_STR | |
3484 | NEIGHBOR_ADDR_STR2 | |
3485 | "Remove private ASNs in outbound updates\n" | |
3486 | "Apply to all AS numbers" | |
3487 | "Replace private ASNs with our ASN in outbound updates\n") | |
3488 | ||
3489 | ||
718e3744 | 3490 | /* neighbor send-community. */ |
3491 | DEFUN (neighbor_send_community, | |
3492 | neighbor_send_community_cmd, | |
3493 | NEIGHBOR_CMD2 "send-community", | |
3494 | NEIGHBOR_STR | |
3495 | NEIGHBOR_ADDR_STR2 | |
3496 | "Send Community attribute to this neighbor\n") | |
3497 | { | |
3498 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3499 | bgp_node_safi (vty), | |
3500 | PEER_FLAG_SEND_COMMUNITY); | |
3501 | } | |
3502 | ||
3503 | DEFUN (no_neighbor_send_community, | |
3504 | no_neighbor_send_community_cmd, | |
3505 | NO_NEIGHBOR_CMD2 "send-community", | |
3506 | NO_STR | |
3507 | NEIGHBOR_STR | |
3508 | NEIGHBOR_ADDR_STR2 | |
3509 | "Send Community attribute to this neighbor\n") | |
3510 | { | |
3511 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3512 | bgp_node_safi (vty), | |
3513 | PEER_FLAG_SEND_COMMUNITY); | |
3514 | } | |
6b0655a2 | 3515 | |
718e3744 | 3516 | /* neighbor send-community extended. */ |
3517 | DEFUN (neighbor_send_community_type, | |
3518 | neighbor_send_community_type_cmd, | |
3519 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3520 | NEIGHBOR_STR | |
3521 | NEIGHBOR_ADDR_STR2 | |
3522 | "Send Community attribute to this neighbor\n" | |
3523 | "Send Standard and Extended Community attributes\n" | |
3524 | "Send Extended Community attributes\n" | |
3525 | "Send Standard Community attributes\n") | |
3526 | { | |
3527 | if (strncmp (argv[1], "s", 1) == 0) | |
3528 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3529 | bgp_node_safi (vty), | |
3530 | PEER_FLAG_SEND_COMMUNITY); | |
3531 | if (strncmp (argv[1], "e", 1) == 0) | |
3532 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3533 | bgp_node_safi (vty), | |
3534 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3535 | ||
3536 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3537 | bgp_node_safi (vty), | |
3538 | (PEER_FLAG_SEND_COMMUNITY| | |
3539 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3540 | } | |
3541 | ||
3542 | DEFUN (no_neighbor_send_community_type, | |
3543 | no_neighbor_send_community_type_cmd, | |
3544 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
3545 | NO_STR | |
3546 | NEIGHBOR_STR | |
3547 | NEIGHBOR_ADDR_STR2 | |
3548 | "Send Community attribute to this neighbor\n" | |
3549 | "Send Standard and Extended Community attributes\n" | |
3550 | "Send Extended Community attributes\n" | |
3551 | "Send Standard Community attributes\n") | |
3552 | { | |
3553 | if (strncmp (argv[1], "s", 1) == 0) | |
3554 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3555 | bgp_node_safi (vty), | |
3556 | PEER_FLAG_SEND_COMMUNITY); | |
3557 | if (strncmp (argv[1], "e", 1) == 0) | |
3558 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3559 | bgp_node_safi (vty), | |
3560 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
3561 | ||
3562 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3563 | bgp_node_safi (vty), | |
3564 | (PEER_FLAG_SEND_COMMUNITY | | |
3565 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
3566 | } | |
6b0655a2 | 3567 | |
718e3744 | 3568 | /* neighbor soft-reconfig. */ |
3569 | DEFUN (neighbor_soft_reconfiguration, | |
3570 | neighbor_soft_reconfiguration_cmd, | |
3571 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3572 | NEIGHBOR_STR | |
3573 | NEIGHBOR_ADDR_STR2 | |
3574 | "Per neighbor soft reconfiguration\n" | |
3575 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3576 | { | |
3577 | return peer_af_flag_set_vty (vty, argv[0], | |
3578 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3579 | PEER_FLAG_SOFT_RECONFIG); | |
3580 | } | |
3581 | ||
3582 | DEFUN (no_neighbor_soft_reconfiguration, | |
3583 | no_neighbor_soft_reconfiguration_cmd, | |
3584 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
3585 | NO_STR | |
3586 | NEIGHBOR_STR | |
3587 | NEIGHBOR_ADDR_STR2 | |
3588 | "Per neighbor soft reconfiguration\n" | |
3589 | "Allow inbound soft reconfiguration for this neighbor\n") | |
3590 | { | |
3591 | return peer_af_flag_unset_vty (vty, argv[0], | |
3592 | bgp_node_afi (vty), bgp_node_safi (vty), | |
3593 | PEER_FLAG_SOFT_RECONFIG); | |
3594 | } | |
6b0655a2 | 3595 | |
718e3744 | 3596 | DEFUN (neighbor_route_reflector_client, |
3597 | neighbor_route_reflector_client_cmd, | |
3598 | NEIGHBOR_CMD2 "route-reflector-client", | |
3599 | NEIGHBOR_STR | |
3600 | NEIGHBOR_ADDR_STR2 | |
3601 | "Configure a neighbor as Route Reflector client\n") | |
3602 | { | |
3603 | struct peer *peer; | |
3604 | ||
3605 | ||
3606 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3607 | if (! peer) | |
3608 | return CMD_WARNING; | |
3609 | ||
3610 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3611 | bgp_node_safi (vty), | |
3612 | PEER_FLAG_REFLECTOR_CLIENT); | |
3613 | } | |
3614 | ||
3615 | DEFUN (no_neighbor_route_reflector_client, | |
3616 | no_neighbor_route_reflector_client_cmd, | |
3617 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
3618 | NO_STR | |
3619 | NEIGHBOR_STR | |
3620 | NEIGHBOR_ADDR_STR2 | |
3621 | "Configure a neighbor as Route Reflector client\n") | |
3622 | { | |
3623 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3624 | bgp_node_safi (vty), | |
3625 | PEER_FLAG_REFLECTOR_CLIENT); | |
3626 | } | |
6b0655a2 | 3627 | |
94f2b392 | 3628 | static int |
fd79ac91 | 3629 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
3630 | int afi, int safi) | |
fee0f4c6 | 3631 | { |
3632 | int ret; | |
3633 | struct bgp *bgp; | |
3634 | struct peer *peer; | |
3635 | struct peer_group *group; | |
1eb8ef25 | 3636 | struct listnode *node, *nnode; |
fee0f4c6 | 3637 | struct bgp_filter *pfilter; |
3638 | struct bgp_filter *gfilter; | |
228da428 | 3639 | int locked_and_added = 0; |
fee0f4c6 | 3640 | |
3641 | bgp = vty->index; | |
3642 | ||
3643 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3644 | if ( ! peer ) | |
3645 | return CMD_WARNING; | |
3646 | ||
3647 | /* If it is already a RS-Client, don't do anything. */ | |
3648 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
3649 | return CMD_SUCCESS; | |
3650 | ||
3651 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 3652 | { |
3653 | peer = peer_lock (peer); /* rsclient peer list reference */ | |
3654 | listnode_add_sort (bgp->rsclient, peer); | |
228da428 | 3655 | locked_and_added = 1; |
200df115 | 3656 | } |
fee0f4c6 | 3657 | |
3658 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3659 | if (ret < 0) | |
228da428 CC |
3660 | { |
3661 | if (locked_and_added) | |
3662 | { | |
3663 | listnode_delete (bgp->rsclient, peer); | |
3664 | peer_unlock (peer); /* rsclient peer list reference */ | |
3665 | } | |
3666 | ||
3667 | return bgp_vty_return (vty, ret); | |
3668 | } | |
fee0f4c6 | 3669 | |
64e580a7 | 3670 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
fee0f4c6 | 3671 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
228da428 CC |
3672 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
3673 | peer->rib[afi][safi]->owner = peer_lock (peer); | |
fee0f4c6 | 3674 | |
3675 | /* Check for existing 'network' and 'redistribute' routes. */ | |
3676 | bgp_check_local_routes_rsclient (peer, afi, safi); | |
3677 | ||
3678 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ | |
3679 | bgp_soft_reconfig_rsclient (peer, afi, safi); | |
3680 | ||
3681 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
3682 | { | |
3683 | group = peer->group; | |
3684 | gfilter = &peer->filter[afi][safi]; | |
3685 | ||
1eb8ef25 | 3686 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 3687 | { |
3688 | pfilter = &peer->filter[afi][safi]; | |
3689 | ||
3690 | /* Members of a non-RS-Client group should not be RS-Clients, as that | |
3691 | is checked when the become part of the peer-group */ | |
3692 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3693 | if (ret < 0) | |
3694 | return bgp_vty_return (vty, ret); | |
3695 | ||
3696 | /* Make peer's RIB point to group's RIB. */ | |
3697 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; | |
3698 | ||
3699 | /* Import policy. */ | |
3700 | if (pfilter->map[RMAP_IMPORT].name) | |
3701 | free (pfilter->map[RMAP_IMPORT].name); | |
3702 | if (gfilter->map[RMAP_IMPORT].name) | |
3703 | { | |
3704 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); | |
3705 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; | |
3706 | } | |
3707 | else | |
3708 | { | |
3709 | pfilter->map[RMAP_IMPORT].name = NULL; | |
3710 | pfilter->map[RMAP_IMPORT].map =NULL; | |
3711 | } | |
3712 | ||
3713 | /* Export policy. */ | |
3714 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) | |
3715 | { | |
3716 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); | |
3717 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; | |
3718 | } | |
3719 | } | |
3720 | } | |
3721 | return CMD_SUCCESS; | |
3722 | } | |
3723 | ||
94f2b392 | 3724 | static int |
fd79ac91 | 3725 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
3726 | int afi, int safi) | |
fee0f4c6 | 3727 | { |
3728 | int ret; | |
3729 | struct bgp *bgp; | |
3730 | struct peer *peer; | |
3731 | struct peer_group *group; | |
1eb8ef25 | 3732 | struct listnode *node, *nnode; |
fee0f4c6 | 3733 | |
3734 | bgp = vty->index; | |
3735 | ||
3736 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3737 | if ( ! peer ) | |
3738 | return CMD_WARNING; | |
3739 | ||
3740 | /* If it is not a RS-Client, don't do anything. */ | |
3741 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
3742 | return CMD_SUCCESS; | |
3743 | ||
3744 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
3745 | { | |
3746 | group = peer->group; | |
3747 | ||
1eb8ef25 | 3748 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 3749 | { |
3750 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3751 | if (ret < 0) | |
3752 | return bgp_vty_return (vty, ret); | |
3753 | ||
3754 | peer->rib[afi][safi] = NULL; | |
3755 | } | |
3756 | ||
3757 | peer = group->conf; | |
3758 | } | |
3759 | ||
3760 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
3761 | if (ret < 0) | |
3762 | return bgp_vty_return (vty, ret); | |
3763 | ||
3764 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 3765 | { |
228da428 | 3766 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
200df115 | 3767 | listnode_delete (bgp->rsclient, peer); |
228da428 | 3768 | peer_unlock (peer); /* peer bgp rsclient reference */ |
200df115 | 3769 | } |
fee0f4c6 | 3770 | |
b608d5b5 | 3771 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
fee0f4c6 | 3772 | |
3773 | return CMD_SUCCESS; | |
3774 | } | |
6b0655a2 | 3775 | |
718e3744 | 3776 | /* neighbor route-server-client. */ |
3777 | DEFUN (neighbor_route_server_client, | |
3778 | neighbor_route_server_client_cmd, | |
3779 | NEIGHBOR_CMD2 "route-server-client", | |
3780 | NEIGHBOR_STR | |
3781 | NEIGHBOR_ADDR_STR2 | |
3782 | "Configure a neighbor as Route Server client\n") | |
3783 | { | |
fee0f4c6 | 3784 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
3785 | bgp_node_safi(vty)); | |
718e3744 | 3786 | } |
3787 | ||
3788 | DEFUN (no_neighbor_route_server_client, | |
3789 | no_neighbor_route_server_client_cmd, | |
3790 | NO_NEIGHBOR_CMD2 "route-server-client", | |
3791 | NO_STR | |
3792 | NEIGHBOR_STR | |
3793 | NEIGHBOR_ADDR_STR2 | |
3794 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 3795 | { |
3796 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), | |
3797 | bgp_node_safi(vty)); | |
3798 | } | |
6b0655a2 | 3799 | |
fee0f4c6 | 3800 | DEFUN (neighbor_nexthop_local_unchanged, |
3801 | neighbor_nexthop_local_unchanged_cmd, | |
3802 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3803 | NEIGHBOR_STR | |
3804 | NEIGHBOR_ADDR_STR2 | |
3805 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
3806 | "Leave link-local nexthop unchanged for this peer\n") | |
3807 | { | |
3808 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3809 | bgp_node_safi (vty), | |
3810 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
3811 | } | |
6b0655a2 | 3812 | |
fee0f4c6 | 3813 | DEFUN (no_neighbor_nexthop_local_unchanged, |
3814 | no_neighbor_nexthop_local_unchanged_cmd, | |
3815 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
3816 | NO_STR | |
3817 | NEIGHBOR_STR | |
3818 | NEIGHBOR_ADDR_STR2 | |
3819 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
3820 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 3821 | { |
3822 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3823 | bgp_node_safi (vty), | |
fee0f4c6 | 3824 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 3825 | } |
6b0655a2 | 3826 | |
718e3744 | 3827 | DEFUN (neighbor_attr_unchanged, |
3828 | neighbor_attr_unchanged_cmd, | |
3829 | NEIGHBOR_CMD2 "attribute-unchanged", | |
3830 | NEIGHBOR_STR | |
3831 | NEIGHBOR_ADDR_STR2 | |
3832 | "BGP attribute is propagated unchanged to this neighbor\n") | |
3833 | { | |
3834 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3835 | bgp_node_safi (vty), | |
3836 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
3837 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
3838 | PEER_FLAG_MED_UNCHANGED)); | |
3839 | } | |
3840 | ||
3841 | DEFUN (neighbor_attr_unchanged1, | |
3842 | neighbor_attr_unchanged1_cmd, | |
3843 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
3844 | NEIGHBOR_STR | |
3845 | NEIGHBOR_ADDR_STR2 | |
3846 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3847 | "As-path attribute\n" | |
3848 | "Nexthop attribute\n" | |
3849 | "Med attribute\n") | |
3850 | { | |
3851 | u_int16_t flags = 0; | |
3852 | ||
3853 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3854 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3855 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3856 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3857 | else if (strncmp (argv[1], "med", 1) == 0) | |
3858 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3859 | ||
3860 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3861 | bgp_node_safi (vty), flags); | |
3862 | } | |
3863 | ||
3864 | DEFUN (neighbor_attr_unchanged2, | |
3865 | neighbor_attr_unchanged2_cmd, | |
3866 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
3867 | NEIGHBOR_STR | |
3868 | NEIGHBOR_ADDR_STR2 | |
3869 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3870 | "As-path attribute\n" | |
3871 | "Nexthop attribute\n" | |
3872 | "Med attribute\n") | |
3873 | { | |
3874 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
3875 | ||
3876 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
3877 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3878 | else if (strncmp (argv[1], "med", 1) == 0) | |
3879 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3880 | ||
3881 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3882 | bgp_node_safi (vty), flags); | |
3883 | ||
3884 | } | |
3885 | ||
3886 | DEFUN (neighbor_attr_unchanged3, | |
3887 | neighbor_attr_unchanged3_cmd, | |
3888 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
3889 | NEIGHBOR_STR | |
3890 | NEIGHBOR_ADDR_STR2 | |
3891 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3892 | "Nexthop attribute\n" | |
3893 | "As-path attribute\n" | |
3894 | "Med attribute\n") | |
3895 | { | |
3896 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
3897 | ||
3898 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3899 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3900 | else if (strncmp (argv[1], "med", 1) == 0) | |
3901 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
3902 | ||
3903 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3904 | bgp_node_safi (vty), flags); | |
3905 | } | |
3906 | ||
3907 | DEFUN (neighbor_attr_unchanged4, | |
3908 | neighbor_attr_unchanged4_cmd, | |
3909 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
3910 | NEIGHBOR_STR | |
3911 | NEIGHBOR_ADDR_STR2 | |
3912 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3913 | "Med attribute\n" | |
3914 | "As-path attribute\n" | |
3915 | "Nexthop attribute\n") | |
3916 | { | |
3917 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
3918 | ||
3919 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3920 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3921 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3922 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3923 | ||
3924 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3925 | bgp_node_safi (vty), flags); | |
3926 | } | |
3927 | ||
3928 | ALIAS (neighbor_attr_unchanged, | |
3929 | neighbor_attr_unchanged5_cmd, | |
3930 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
3931 | NEIGHBOR_STR | |
3932 | NEIGHBOR_ADDR_STR2 | |
3933 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3934 | "As-path attribute\n" | |
3935 | "Nexthop attribute\n" | |
3936 | "Med attribute\n") | |
3937 | ||
3938 | ALIAS (neighbor_attr_unchanged, | |
3939 | neighbor_attr_unchanged6_cmd, | |
3940 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
3941 | NEIGHBOR_STR | |
3942 | NEIGHBOR_ADDR_STR2 | |
3943 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3944 | "As-path attribute\n" | |
3945 | "Med attribute\n" | |
3946 | "Nexthop attribute\n") | |
3947 | ||
3948 | ALIAS (neighbor_attr_unchanged, | |
3949 | neighbor_attr_unchanged7_cmd, | |
3950 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
3951 | NEIGHBOR_STR | |
3952 | NEIGHBOR_ADDR_STR2 | |
3953 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3954 | "Nexthop attribute\n" | |
3955 | "Med attribute\n" | |
3956 | "As-path attribute\n") | |
3957 | ||
3958 | ALIAS (neighbor_attr_unchanged, | |
3959 | neighbor_attr_unchanged8_cmd, | |
3960 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
3961 | NEIGHBOR_STR | |
3962 | NEIGHBOR_ADDR_STR2 | |
3963 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3964 | "Nexthop attribute\n" | |
3965 | "As-path attribute\n" | |
3966 | "Med attribute\n") | |
3967 | ||
3968 | ALIAS (neighbor_attr_unchanged, | |
3969 | neighbor_attr_unchanged9_cmd, | |
3970 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
3971 | NEIGHBOR_STR | |
3972 | NEIGHBOR_ADDR_STR2 | |
3973 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3974 | "Med attribute\n" | |
3975 | "Nexthop attribute\n" | |
3976 | "As-path attribute\n") | |
3977 | ||
3978 | ALIAS (neighbor_attr_unchanged, | |
3979 | neighbor_attr_unchanged10_cmd, | |
3980 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
3981 | NEIGHBOR_STR | |
3982 | NEIGHBOR_ADDR_STR2 | |
3983 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3984 | "Med attribute\n" | |
3985 | "As-path attribute\n" | |
3986 | "Nexthop attribute\n") | |
3987 | ||
3988 | DEFUN (no_neighbor_attr_unchanged, | |
3989 | no_neighbor_attr_unchanged_cmd, | |
3990 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
3991 | NO_STR | |
3992 | NEIGHBOR_STR | |
3993 | NEIGHBOR_ADDR_STR2 | |
3994 | "BGP attribute is propagated unchanged to this neighbor\n") | |
3995 | { | |
3996 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3997 | bgp_node_safi (vty), | |
3998 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
3999 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
4000 | PEER_FLAG_MED_UNCHANGED)); | |
4001 | } | |
4002 | ||
4003 | DEFUN (no_neighbor_attr_unchanged1, | |
4004 | no_neighbor_attr_unchanged1_cmd, | |
4005 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
4006 | NO_STR | |
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_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4024 | bgp_node_safi (vty), flags); | |
4025 | } | |
4026 | ||
4027 | DEFUN (no_neighbor_attr_unchanged2, | |
4028 | no_neighbor_attr_unchanged2_cmd, | |
4029 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
4030 | NO_STR | |
4031 | NEIGHBOR_STR | |
4032 | NEIGHBOR_ADDR_STR2 | |
4033 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4034 | "As-path attribute\n" | |
4035 | "Nexthop attribute\n" | |
4036 | "Med attribute\n") | |
4037 | { | |
4038 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
4039 | ||
4040 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
4041 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4042 | else if (strncmp (argv[1], "med", 1) == 0) | |
4043 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4044 | ||
4045 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4046 | bgp_node_safi (vty), flags); | |
4047 | } | |
4048 | ||
4049 | DEFUN (no_neighbor_attr_unchanged3, | |
4050 | no_neighbor_attr_unchanged3_cmd, | |
4051 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
4052 | NO_STR | |
4053 | NEIGHBOR_STR | |
4054 | NEIGHBOR_ADDR_STR2 | |
4055 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4056 | "Nexthop attribute\n" | |
4057 | "As-path attribute\n" | |
4058 | "Med attribute\n") | |
4059 | { | |
4060 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
4061 | ||
4062 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4063 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4064 | else if (strncmp (argv[1], "med", 1) == 0) | |
4065 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
4066 | ||
4067 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4068 | bgp_node_safi (vty), flags); | |
4069 | } | |
4070 | ||
4071 | DEFUN (no_neighbor_attr_unchanged4, | |
4072 | no_neighbor_attr_unchanged4_cmd, | |
4073 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
4074 | NO_STR | |
4075 | NEIGHBOR_STR | |
4076 | NEIGHBOR_ADDR_STR2 | |
4077 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4078 | "Med attribute\n" | |
4079 | "As-path attribute\n" | |
4080 | "Nexthop attribute\n") | |
4081 | { | |
4082 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
4083 | ||
4084 | if (strncmp (argv[1], "as-path", 1) == 0) | |
4085 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
4086 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
4087 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
4088 | ||
4089 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4090 | bgp_node_safi (vty), flags); | |
4091 | } | |
4092 | ||
4093 | ALIAS (no_neighbor_attr_unchanged, | |
4094 | no_neighbor_attr_unchanged5_cmd, | |
4095 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
4096 | NO_STR | |
4097 | NEIGHBOR_STR | |
4098 | NEIGHBOR_ADDR_STR2 | |
4099 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4100 | "As-path attribute\n" | |
4101 | "Nexthop attribute\n" | |
4102 | "Med attribute\n") | |
4103 | ||
4104 | ALIAS (no_neighbor_attr_unchanged, | |
4105 | no_neighbor_attr_unchanged6_cmd, | |
4106 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
4107 | NO_STR | |
4108 | NEIGHBOR_STR | |
4109 | NEIGHBOR_ADDR_STR2 | |
4110 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4111 | "As-path attribute\n" | |
4112 | "Med attribute\n" | |
4113 | "Nexthop attribute\n") | |
4114 | ||
4115 | ALIAS (no_neighbor_attr_unchanged, | |
4116 | no_neighbor_attr_unchanged7_cmd, | |
4117 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
4118 | NO_STR | |
4119 | NEIGHBOR_STR | |
4120 | NEIGHBOR_ADDR_STR2 | |
4121 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4122 | "Nexthop attribute\n" | |
4123 | "Med attribute\n" | |
4124 | "As-path attribute\n") | |
4125 | ||
4126 | ALIAS (no_neighbor_attr_unchanged, | |
4127 | no_neighbor_attr_unchanged8_cmd, | |
4128 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
4129 | NO_STR | |
4130 | NEIGHBOR_STR | |
4131 | NEIGHBOR_ADDR_STR2 | |
4132 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4133 | "Nexthop attribute\n" | |
4134 | "As-path attribute\n" | |
4135 | "Med attribute\n") | |
4136 | ||
4137 | ALIAS (no_neighbor_attr_unchanged, | |
4138 | no_neighbor_attr_unchanged9_cmd, | |
4139 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
4140 | NO_STR | |
4141 | NEIGHBOR_STR | |
4142 | NEIGHBOR_ADDR_STR2 | |
4143 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4144 | "Med attribute\n" | |
4145 | "Nexthop attribute\n" | |
4146 | "As-path attribute\n") | |
4147 | ||
4148 | ALIAS (no_neighbor_attr_unchanged, | |
4149 | no_neighbor_attr_unchanged10_cmd, | |
4150 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
4151 | NO_STR | |
4152 | NEIGHBOR_STR | |
4153 | NEIGHBOR_ADDR_STR2 | |
4154 | "BGP attribute is propagated unchanged to this neighbor\n" | |
4155 | "Med attribute\n" | |
4156 | "As-path attribute\n" | |
4157 | "Nexthop attribute\n") | |
4158 | ||
4159 | /* For old version Zebra compatibility. */ | |
dd4c593f | 4160 | DEFUN_DEPRECATED (neighbor_transparent_as, |
4161 | neighbor_transparent_as_cmd, | |
4162 | NEIGHBOR_CMD "transparent-as", | |
4163 | NEIGHBOR_STR | |
4164 | NEIGHBOR_ADDR_STR | |
4165 | "Do not append my AS number even peer is EBGP peer\n") | |
718e3744 | 4166 | { |
4167 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4168 | bgp_node_safi (vty), | |
4169 | PEER_FLAG_AS_PATH_UNCHANGED); | |
4170 | } | |
4171 | ||
dd4c593f | 4172 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
4173 | neighbor_transparent_nexthop_cmd, | |
4174 | NEIGHBOR_CMD "transparent-nexthop", | |
4175 | NEIGHBOR_STR | |
4176 | NEIGHBOR_ADDR_STR | |
4177 | "Do not change nexthop even peer is EBGP peer\n") | |
718e3744 | 4178 | { |
4179 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4180 | bgp_node_safi (vty), | |
4181 | PEER_FLAG_NEXTHOP_UNCHANGED); | |
4182 | } | |
6b0655a2 | 4183 | |
718e3744 | 4184 | /* EBGP multihop configuration. */ |
94f2b392 | 4185 | static int |
fd79ac91 | 4186 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
4187 | const char *ttl_str) | |
718e3744 | 4188 | { |
4189 | struct peer *peer; | |
fd79ac91 | 4190 | unsigned int ttl; |
718e3744 | 4191 | |
4192 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4193 | if (! peer) | |
4194 | return CMD_WARNING; | |
4195 | ||
4196 | if (! ttl_str) | |
4197 | ttl = TTL_MAX; | |
4198 | else | |
4199 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); | |
4200 | ||
89b6d1f8 | 4201 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 4202 | } |
4203 | ||
94f2b392 | 4204 | static int |
fd79ac91 | 4205 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4206 | { |
4207 | struct peer *peer; | |
4208 | ||
4209 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4210 | if (! peer) | |
4211 | return CMD_WARNING; | |
4212 | ||
89b6d1f8 | 4213 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 4214 | } |
4215 | ||
4216 | /* neighbor ebgp-multihop. */ | |
4217 | DEFUN (neighbor_ebgp_multihop, | |
4218 | neighbor_ebgp_multihop_cmd, | |
4219 | NEIGHBOR_CMD2 "ebgp-multihop", | |
4220 | NEIGHBOR_STR | |
4221 | NEIGHBOR_ADDR_STR2 | |
4222 | "Allow EBGP neighbors not on directly connected networks\n") | |
4223 | { | |
4224 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
4225 | } | |
4226 | ||
4227 | DEFUN (neighbor_ebgp_multihop_ttl, | |
4228 | neighbor_ebgp_multihop_ttl_cmd, | |
4229 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
4230 | NEIGHBOR_STR | |
4231 | NEIGHBOR_ADDR_STR2 | |
4232 | "Allow EBGP neighbors not on directly connected networks\n" | |
4233 | "maximum hop count\n") | |
4234 | { | |
4235 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
4236 | } | |
4237 | ||
4238 | DEFUN (no_neighbor_ebgp_multihop, | |
4239 | no_neighbor_ebgp_multihop_cmd, | |
4240 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
4241 | NO_STR | |
4242 | NEIGHBOR_STR | |
4243 | NEIGHBOR_ADDR_STR2 | |
4244 | "Allow EBGP neighbors not on directly connected networks\n") | |
4245 | { | |
4246 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
4247 | } | |
4248 | ||
4249 | ALIAS (no_neighbor_ebgp_multihop, | |
4250 | no_neighbor_ebgp_multihop_ttl_cmd, | |
4251 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
4252 | NO_STR | |
4253 | NEIGHBOR_STR | |
4254 | NEIGHBOR_ADDR_STR2 | |
4255 | "Allow EBGP neighbors not on directly connected networks\n" | |
4256 | "maximum hop count\n") | |
6b0655a2 | 4257 | |
6ffd2079 | 4258 | /* disable-connected-check */ |
4259 | DEFUN (neighbor_disable_connected_check, | |
4260 | neighbor_disable_connected_check_cmd, | |
4261 | NEIGHBOR_CMD2 "disable-connected-check", | |
4262 | NEIGHBOR_STR | |
4263 | NEIGHBOR_ADDR_STR2 | |
4264 | "one-hop away EBGP peer using loopback address\n") | |
4265 | { | |
4266 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4267 | } | |
4268 | ||
4269 | DEFUN (no_neighbor_disable_connected_check, | |
4270 | no_neighbor_disable_connected_check_cmd, | |
4271 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
4272 | NO_STR | |
4273 | NEIGHBOR_STR | |
4274 | NEIGHBOR_ADDR_STR2 | |
4275 | "one-hop away EBGP peer using loopback address\n") | |
4276 | { | |
4277 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
4278 | } | |
4279 | ||
718e3744 | 4280 | /* Enforce multihop. */ |
6ffd2079 | 4281 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 4282 | neighbor_enforce_multihop_cmd, |
4283 | NEIGHBOR_CMD2 "enforce-multihop", | |
4284 | NEIGHBOR_STR | |
4285 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4286 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 4287 | |
6ffd2079 | 4288 | /* Enforce multihop. */ |
4289 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 4290 | no_neighbor_enforce_multihop_cmd, |
4291 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
4292 | NO_STR | |
4293 | NEIGHBOR_STR | |
4294 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 4295 | "Enforce EBGP neighbors perform multihop\n") |
6b0655a2 | 4296 | |
718e3744 | 4297 | DEFUN (neighbor_description, |
4298 | neighbor_description_cmd, | |
4299 | NEIGHBOR_CMD2 "description .LINE", | |
4300 | NEIGHBOR_STR | |
4301 | NEIGHBOR_ADDR_STR2 | |
4302 | "Neighbor specific description\n" | |
4303 | "Up to 80 characters describing this neighbor\n") | |
4304 | { | |
4305 | struct peer *peer; | |
718e3744 | 4306 | char *str; |
718e3744 | 4307 | |
4308 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4309 | if (! peer) | |
4310 | return CMD_WARNING; | |
4311 | ||
4312 | if (argc == 1) | |
4313 | return CMD_SUCCESS; | |
4314 | ||
3b8b1855 | 4315 | str = argv_concat(argv, argc, 1); |
718e3744 | 4316 | |
4317 | peer_description_set (peer, str); | |
4318 | ||
3b8b1855 | 4319 | XFREE (MTYPE_TMP, str); |
718e3744 | 4320 | |
4321 | return CMD_SUCCESS; | |
4322 | } | |
4323 | ||
4324 | DEFUN (no_neighbor_description, | |
4325 | no_neighbor_description_cmd, | |
4326 | NO_NEIGHBOR_CMD2 "description", | |
4327 | NO_STR | |
4328 | NEIGHBOR_STR | |
4329 | NEIGHBOR_ADDR_STR2 | |
4330 | "Neighbor specific description\n") | |
4331 | { | |
4332 | struct peer *peer; | |
4333 | ||
4334 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4335 | if (! peer) | |
4336 | return CMD_WARNING; | |
4337 | ||
4338 | peer_description_unset (peer); | |
4339 | ||
4340 | return CMD_SUCCESS; | |
4341 | } | |
4342 | ||
4343 | ALIAS (no_neighbor_description, | |
4344 | no_neighbor_description_val_cmd, | |
4345 | NO_NEIGHBOR_CMD2 "description .LINE", | |
4346 | NO_STR | |
4347 | NEIGHBOR_STR | |
4348 | NEIGHBOR_ADDR_STR2 | |
4349 | "Neighbor specific description\n" | |
4350 | "Up to 80 characters describing this neighbor\n") | |
6b0655a2 | 4351 | |
718e3744 | 4352 | /* Neighbor update-source. */ |
94f2b392 | 4353 | static int |
fd79ac91 | 4354 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
4355 | const char *source_str) | |
718e3744 | 4356 | { |
4357 | struct peer *peer; | |
718e3744 | 4358 | |
4359 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4360 | if (! peer) | |
4361 | return CMD_WARNING; | |
4362 | ||
a80beece DS |
4363 | if (peer->conf_if) |
4364 | return CMD_WARNING; | |
4365 | ||
718e3744 | 4366 | if (source_str) |
4367 | { | |
c63b83fe JBD |
4368 | union sockunion su; |
4369 | int ret = str2sockunion (source_str, &su); | |
4370 | ||
4371 | if (ret == 0) | |
4372 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 4373 | else |
4374 | peer_update_source_if_set (peer, source_str); | |
4375 | } | |
4376 | else | |
4377 | peer_update_source_unset (peer); | |
4378 | ||
4379 | return CMD_SUCCESS; | |
4380 | } | |
4381 | ||
9a1a331d | 4382 | #define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)" |
369688c0 PJ |
4383 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
4384 | "IPv4 address\n" \ | |
9a1a331d PJ |
4385 | "IPv6 address\n" \ |
4386 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 4387 | |
718e3744 | 4388 | DEFUN (neighbor_update_source, |
4389 | neighbor_update_source_cmd, | |
369688c0 | 4390 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR, |
718e3744 | 4391 | NEIGHBOR_STR |
4392 | NEIGHBOR_ADDR_STR2 | |
4393 | "Source of routing updates\n" | |
369688c0 | 4394 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 4395 | { |
4396 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
4397 | } | |
4398 | ||
4399 | DEFUN (no_neighbor_update_source, | |
4400 | no_neighbor_update_source_cmd, | |
4401 | NO_NEIGHBOR_CMD2 "update-source", | |
4402 | NO_STR | |
4403 | NEIGHBOR_STR | |
4404 | NEIGHBOR_ADDR_STR2 | |
369688c0 | 4405 | "Source of routing updates\n") |
718e3744 | 4406 | { |
4407 | return peer_update_source_vty (vty, argv[0], NULL); | |
4408 | } | |
6b0655a2 | 4409 | |
94f2b392 | 4410 | static int |
fd79ac91 | 4411 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
4412 | afi_t afi, safi_t safi, | |
4413 | const char *rmap, int set) | |
718e3744 | 4414 | { |
4415 | int ret; | |
4416 | struct peer *peer; | |
4417 | ||
4418 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
4419 | if (! peer) | |
4420 | return CMD_WARNING; | |
4421 | ||
4422 | if (set) | |
4423 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
4424 | else | |
4425 | ret = peer_default_originate_unset (peer, afi, safi); | |
4426 | ||
4427 | return bgp_vty_return (vty, ret); | |
4428 | } | |
4429 | ||
4430 | /* neighbor default-originate. */ | |
4431 | DEFUN (neighbor_default_originate, | |
4432 | neighbor_default_originate_cmd, | |
4433 | NEIGHBOR_CMD2 "default-originate", | |
4434 | NEIGHBOR_STR | |
4435 | NEIGHBOR_ADDR_STR2 | |
4436 | "Originate default route to this neighbor\n") | |
4437 | { | |
4438 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4439 | bgp_node_safi (vty), NULL, 1); | |
4440 | } | |
4441 | ||
4442 | DEFUN (neighbor_default_originate_rmap, | |
4443 | neighbor_default_originate_rmap_cmd, | |
4444 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4445 | NEIGHBOR_STR | |
4446 | NEIGHBOR_ADDR_STR2 | |
4447 | "Originate default route to this neighbor\n" | |
4448 | "Route-map to specify criteria to originate default\n" | |
4449 | "route-map name\n") | |
4450 | { | |
4451 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4452 | bgp_node_safi (vty), argv[1], 1); | |
4453 | } | |
4454 | ||
4455 | DEFUN (no_neighbor_default_originate, | |
4456 | no_neighbor_default_originate_cmd, | |
4457 | NO_NEIGHBOR_CMD2 "default-originate", | |
4458 | NO_STR | |
4459 | NEIGHBOR_STR | |
4460 | NEIGHBOR_ADDR_STR2 | |
4461 | "Originate default route to this neighbor\n") | |
4462 | { | |
4463 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4464 | bgp_node_safi (vty), NULL, 0); | |
4465 | } | |
4466 | ||
4467 | ALIAS (no_neighbor_default_originate, | |
4468 | no_neighbor_default_originate_rmap_cmd, | |
4469 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
4470 | NO_STR | |
4471 | NEIGHBOR_STR | |
4472 | NEIGHBOR_ADDR_STR2 | |
4473 | "Originate default route to this neighbor\n" | |
4474 | "Route-map to specify criteria to originate default\n" | |
4475 | "route-map name\n") | |
6b0655a2 | 4476 | |
718e3744 | 4477 | /* Set neighbor's BGP port. */ |
94f2b392 | 4478 | static int |
fd79ac91 | 4479 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
4480 | const char *port_str) | |
718e3744 | 4481 | { |
4482 | struct peer *peer; | |
4483 | u_int16_t port; | |
4484 | struct servent *sp; | |
4485 | ||
4486 | peer = peer_lookup_vty (vty, ip_str); | |
4487 | if (! peer) | |
4488 | return CMD_WARNING; | |
4489 | ||
4490 | if (! port_str) | |
4491 | { | |
4492 | sp = getservbyname ("bgp", "tcp"); | |
4493 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
4494 | } | |
4495 | else | |
4496 | { | |
4497 | VTY_GET_INTEGER("port", port, port_str); | |
4498 | } | |
4499 | ||
4500 | peer_port_set (peer, port); | |
4501 | ||
4502 | return CMD_SUCCESS; | |
4503 | } | |
4504 | ||
f418446b | 4505 | /* Set specified peer's BGP port. */ |
718e3744 | 4506 | DEFUN (neighbor_port, |
4507 | neighbor_port_cmd, | |
4508 | NEIGHBOR_CMD "port <0-65535>", | |
4509 | NEIGHBOR_STR | |
4510 | NEIGHBOR_ADDR_STR | |
4511 | "Neighbor's BGP port\n" | |
4512 | "TCP port number\n") | |
4513 | { | |
4514 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
4515 | } | |
4516 | ||
4517 | DEFUN (no_neighbor_port, | |
4518 | no_neighbor_port_cmd, | |
4519 | NO_NEIGHBOR_CMD "port", | |
4520 | NO_STR | |
4521 | NEIGHBOR_STR | |
4522 | NEIGHBOR_ADDR_STR | |
4523 | "Neighbor's BGP port\n") | |
4524 | { | |
4525 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
4526 | } | |
4527 | ||
4528 | ALIAS (no_neighbor_port, | |
4529 | no_neighbor_port_val_cmd, | |
4530 | NO_NEIGHBOR_CMD "port <0-65535>", | |
4531 | NO_STR | |
4532 | NEIGHBOR_STR | |
4533 | NEIGHBOR_ADDR_STR | |
4534 | "Neighbor's BGP port\n" | |
4535 | "TCP port number\n") | |
6b0655a2 | 4536 | |
718e3744 | 4537 | /* neighbor weight. */ |
94f2b392 | 4538 | static int |
fd79ac91 | 4539 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
4540 | const char *weight_str) | |
718e3744 | 4541 | { |
4542 | int ret; | |
4543 | struct peer *peer; | |
4544 | unsigned long weight; | |
4545 | ||
4546 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4547 | if (! peer) | |
4548 | return CMD_WARNING; | |
4549 | ||
4550 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
4551 | ||
4552 | ret = peer_weight_set (peer, weight); | |
4553 | ||
4554 | return CMD_SUCCESS; | |
4555 | } | |
4556 | ||
94f2b392 | 4557 | static int |
fd79ac91 | 4558 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4559 | { |
4560 | struct peer *peer; | |
4561 | ||
4562 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4563 | if (! peer) | |
4564 | return CMD_WARNING; | |
4565 | ||
4566 | peer_weight_unset (peer); | |
4567 | ||
4568 | return CMD_SUCCESS; | |
4569 | } | |
4570 | ||
4571 | DEFUN (neighbor_weight, | |
4572 | neighbor_weight_cmd, | |
4573 | NEIGHBOR_CMD2 "weight <0-65535>", | |
4574 | NEIGHBOR_STR | |
4575 | NEIGHBOR_ADDR_STR2 | |
4576 | "Set default weight for routes from this neighbor\n" | |
4577 | "default weight\n") | |
4578 | { | |
4579 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
4580 | } | |
4581 | ||
4582 | DEFUN (no_neighbor_weight, | |
4583 | no_neighbor_weight_cmd, | |
4584 | NO_NEIGHBOR_CMD2 "weight", | |
4585 | NO_STR | |
4586 | NEIGHBOR_STR | |
4587 | NEIGHBOR_ADDR_STR2 | |
4588 | "Set default weight for routes from this neighbor\n") | |
4589 | { | |
4590 | return peer_weight_unset_vty (vty, argv[0]); | |
4591 | } | |
4592 | ||
4593 | ALIAS (no_neighbor_weight, | |
4594 | no_neighbor_weight_val_cmd, | |
4595 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
4596 | NO_STR | |
4597 | NEIGHBOR_STR | |
4598 | NEIGHBOR_ADDR_STR2 | |
4599 | "Set default weight for routes from this neighbor\n" | |
4600 | "default weight\n") | |
6b0655a2 | 4601 | |
718e3744 | 4602 | /* Override capability negotiation. */ |
4603 | DEFUN (neighbor_override_capability, | |
4604 | neighbor_override_capability_cmd, | |
4605 | NEIGHBOR_CMD2 "override-capability", | |
4606 | NEIGHBOR_STR | |
4607 | NEIGHBOR_ADDR_STR2 | |
4608 | "Override capability negotiation result\n") | |
4609 | { | |
4610 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4611 | } | |
4612 | ||
4613 | DEFUN (no_neighbor_override_capability, | |
4614 | no_neighbor_override_capability_cmd, | |
4615 | NO_NEIGHBOR_CMD2 "override-capability", | |
4616 | NO_STR | |
4617 | NEIGHBOR_STR | |
4618 | NEIGHBOR_ADDR_STR2 | |
4619 | "Override capability negotiation result\n") | |
4620 | { | |
4621 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
4622 | } | |
6b0655a2 | 4623 | |
718e3744 | 4624 | DEFUN (neighbor_strict_capability, |
4625 | neighbor_strict_capability_cmd, | |
4626 | NEIGHBOR_CMD "strict-capability-match", | |
4627 | NEIGHBOR_STR | |
4628 | NEIGHBOR_ADDR_STR | |
4629 | "Strict capability negotiation match\n") | |
4630 | { | |
4631 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4632 | } | |
4633 | ||
4634 | DEFUN (no_neighbor_strict_capability, | |
4635 | no_neighbor_strict_capability_cmd, | |
4636 | NO_NEIGHBOR_CMD "strict-capability-match", | |
4637 | NO_STR | |
4638 | NEIGHBOR_STR | |
4639 | NEIGHBOR_ADDR_STR | |
4640 | "Strict capability negotiation match\n") | |
4641 | { | |
4642 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
4643 | } | |
6b0655a2 | 4644 | |
94f2b392 | 4645 | static int |
fd79ac91 | 4646 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
4647 | const char *keep_str, const char *hold_str) | |
718e3744 | 4648 | { |
4649 | int ret; | |
4650 | struct peer *peer; | |
4651 | u_int32_t keepalive; | |
4652 | u_int32_t holdtime; | |
4653 | ||
4654 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4655 | if (! peer) | |
4656 | return CMD_WARNING; | |
4657 | ||
4658 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
4659 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
4660 | ||
4661 | ret = peer_timers_set (peer, keepalive, holdtime); | |
4662 | ||
4663 | return bgp_vty_return (vty, ret); | |
4664 | } | |
6b0655a2 | 4665 | |
94f2b392 | 4666 | static int |
fd79ac91 | 4667 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4668 | { |
4669 | int ret; | |
4670 | struct peer *peer; | |
4671 | ||
4672 | peer = peer_lookup_vty (vty, ip_str); | |
4673 | if (! peer) | |
4674 | return CMD_WARNING; | |
4675 | ||
4676 | ret = peer_timers_unset (peer); | |
4677 | ||
4678 | return bgp_vty_return (vty, ret); | |
4679 | } | |
4680 | ||
4681 | DEFUN (neighbor_timers, | |
4682 | neighbor_timers_cmd, | |
4683 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
4684 | NEIGHBOR_STR | |
4685 | NEIGHBOR_ADDR_STR2 | |
4686 | "BGP per neighbor timers\n" | |
4687 | "Keepalive interval\n" | |
4688 | "Holdtime\n") | |
4689 | { | |
4690 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
4691 | } | |
4692 | ||
4693 | DEFUN (no_neighbor_timers, | |
4694 | no_neighbor_timers_cmd, | |
4695 | NO_NEIGHBOR_CMD2 "timers", | |
4696 | NO_STR | |
4697 | NEIGHBOR_STR | |
4698 | NEIGHBOR_ADDR_STR2 | |
4699 | "BGP per neighbor timers\n") | |
4700 | { | |
4701 | return peer_timers_unset_vty (vty, argv[0]); | |
4702 | } | |
6b0655a2 | 4703 | |
94f2b392 | 4704 | static int |
fd79ac91 | 4705 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
4706 | const char *time_str) | |
718e3744 | 4707 | { |
4708 | int ret; | |
4709 | struct peer *peer; | |
4710 | u_int32_t connect; | |
4711 | ||
966f821c | 4712 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4713 | if (! peer) |
4714 | return CMD_WARNING; | |
4715 | ||
4716 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
4717 | ||
4718 | ret = peer_timers_connect_set (peer, connect); | |
4719 | ||
966f821c | 4720 | return bgp_vty_return (vty, ret); |
718e3744 | 4721 | } |
4722 | ||
94f2b392 | 4723 | static int |
fd79ac91 | 4724 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 4725 | { |
4726 | int ret; | |
4727 | struct peer *peer; | |
4728 | ||
4729 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4730 | if (! peer) | |
4731 | return CMD_WARNING; | |
4732 | ||
4733 | ret = peer_timers_connect_unset (peer); | |
4734 | ||
966f821c | 4735 | return bgp_vty_return (vty, ret); |
718e3744 | 4736 | } |
4737 | ||
4738 | DEFUN (neighbor_timers_connect, | |
4739 | neighbor_timers_connect_cmd, | |
966f821c | 4740 | NEIGHBOR_CMD2 "timers connect <0-65535>", |
718e3744 | 4741 | NEIGHBOR_STR |
966f821c | 4742 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4743 | "BGP per neighbor timers\n" |
4744 | "BGP connect timer\n" | |
4745 | "Connect timer\n") | |
4746 | { | |
4747 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
4748 | } | |
4749 | ||
4750 | DEFUN (no_neighbor_timers_connect, | |
4751 | no_neighbor_timers_connect_cmd, | |
966f821c | 4752 | NO_NEIGHBOR_CMD2 "timers connect", |
718e3744 | 4753 | NO_STR |
4754 | NEIGHBOR_STR | |
966f821c | 4755 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4756 | "BGP per neighbor timers\n" |
4757 | "BGP connect timer\n") | |
4758 | { | |
4759 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
4760 | } | |
4761 | ||
4762 | ALIAS (no_neighbor_timers_connect, | |
4763 | no_neighbor_timers_connect_val_cmd, | |
966f821c | 4764 | NO_NEIGHBOR_CMD2 "timers connect <0-65535>", |
718e3744 | 4765 | NO_STR |
4766 | NEIGHBOR_STR | |
966f821c | 4767 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4768 | "BGP per neighbor timers\n" |
4769 | "BGP connect timer\n" | |
4770 | "Connect timer\n") | |
6b0655a2 | 4771 | |
94f2b392 | 4772 | static int |
fd79ac91 | 4773 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
4774 | const char *time_str, int set) | |
718e3744 | 4775 | { |
4776 | int ret; | |
4777 | struct peer *peer; | |
4778 | u_int32_t routeadv = 0; | |
4779 | ||
966f821c | 4780 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 4781 | if (! peer) |
4782 | return CMD_WARNING; | |
4783 | ||
4784 | if (time_str) | |
4785 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
4786 | ||
4787 | if (set) | |
4788 | ret = peer_advertise_interval_set (peer, routeadv); | |
4789 | else | |
4790 | ret = peer_advertise_interval_unset (peer); | |
4791 | ||
966f821c | 4792 | return bgp_vty_return (vty, ret); |
718e3744 | 4793 | } |
4794 | ||
4795 | DEFUN (neighbor_advertise_interval, | |
4796 | neighbor_advertise_interval_cmd, | |
966f821c | 4797 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4798 | NEIGHBOR_STR |
966f821c | 4799 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4800 | "Minimum interval between sending BGP routing updates\n" |
4801 | "time in seconds\n") | |
4802 | { | |
4803 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
4804 | } | |
4805 | ||
4806 | DEFUN (no_neighbor_advertise_interval, | |
4807 | no_neighbor_advertise_interval_cmd, | |
966f821c | 4808 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
718e3744 | 4809 | NO_STR |
4810 | NEIGHBOR_STR | |
966f821c | 4811 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4812 | "Minimum interval between sending BGP routing updates\n") |
4813 | { | |
4814 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
4815 | } | |
4816 | ||
4817 | ALIAS (no_neighbor_advertise_interval, | |
4818 | no_neighbor_advertise_interval_val_cmd, | |
966f821c | 4819 | NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 4820 | NO_STR |
4821 | NEIGHBOR_STR | |
966f821c | 4822 | NEIGHBOR_ADDR_STR2 |
718e3744 | 4823 | "Minimum interval between sending BGP routing updates\n" |
4824 | "time in seconds\n") | |
6b0655a2 | 4825 | |
518f0eb1 DS |
4826 | /* Time to wait before processing route-map updates */ |
4827 | DEFUN (bgp_set_route_map_delay_timer, | |
4828 | bgp_set_route_map_delay_timer_cmd, | |
4829 | "bgp route-map delay-timer <0-600>", | |
4830 | SET_STR | |
4831 | "BGP route-map delay timer\n" | |
4832 | "Time in secs to wait before processing route-map changes\n" | |
4833 | "0 disables the timer and no route updates happen when\n" | |
4834 | "route-maps change") | |
4835 | { | |
4836 | u_int32_t rmap_delay_timer; | |
4837 | struct bgp *bgp; | |
4838 | ||
4839 | bgp = vty->index; | |
4840 | if (argv[0]) | |
4841 | { | |
4842 | VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer, argv[0], 0, 600); | |
4843 | bgp->rmap_update_timer = rmap_delay_timer; | |
4844 | ||
4845 | /* if the dynamic update handling is being disabled, and a timer is | |
4846 | * running, stop the timer and act as if the timer has already fired. | |
4847 | */ | |
4848 | if (!rmap_delay_timer && bgp->t_rmap_update ) | |
4849 | { | |
4850 | BGP_TIMER_OFF(bgp->t_rmap_update); | |
4851 | thread_execute (bm->master, bgp_route_map_update_timer, &bgp, 0); | |
4852 | } | |
4853 | return CMD_SUCCESS; | |
4854 | } | |
4855 | else | |
4856 | CMD_WARNING; | |
4857 | } | |
4858 | ||
4859 | DEFUN (no_bgp_set_route_map_delay_timer, | |
4860 | no_bgp_set_route_map_delay_timer_cmd, | |
4861 | "no bgp route-map delay-timer", | |
4862 | NO_STR | |
4863 | "Default BGP route-map delay timer\n" | |
4864 | "Reset to default time to wait for processing route-map changes") | |
4865 | { | |
4866 | u_int32_t rmap_delay_timer; | |
4867 | struct bgp *bgp; | |
4868 | ||
4869 | bgp = vty->index; | |
4870 | bgp->rmap_update_timer = RMAP_DEFAULT_UPDATE_TIMER; | |
4871 | ||
4872 | return CMD_SUCCESS; | |
4873 | } | |
4874 | ||
718e3744 | 4875 | /* neighbor interface */ |
94f2b392 | 4876 | static int |
fd79ac91 | 4877 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 4878 | { |
4879 | int ret; | |
4880 | struct peer *peer; | |
4881 | ||
4882 | peer = peer_lookup_vty (vty, ip_str); | |
a80beece | 4883 | if (! peer || peer->conf_if) |
718e3744 | 4884 | return CMD_WARNING; |
4885 | ||
4886 | if (str) | |
4887 | ret = peer_interface_set (peer, str); | |
4888 | else | |
4889 | ret = peer_interface_unset (peer); | |
4890 | ||
4891 | return CMD_SUCCESS; | |
4892 | } | |
4893 | ||
4894 | DEFUN (neighbor_interface, | |
4895 | neighbor_interface_cmd, | |
4896 | NEIGHBOR_CMD "interface WORD", | |
4897 | NEIGHBOR_STR | |
4898 | NEIGHBOR_ADDR_STR | |
4899 | "Interface\n" | |
4900 | "Interface name\n") | |
4901 | { | |
4902 | return peer_interface_vty (vty, argv[0], argv[1]); | |
4903 | } | |
4904 | ||
4905 | DEFUN (no_neighbor_interface, | |
4906 | no_neighbor_interface_cmd, | |
4907 | NO_NEIGHBOR_CMD "interface WORD", | |
4908 | NO_STR | |
4909 | NEIGHBOR_STR | |
4910 | NEIGHBOR_ADDR_STR | |
4911 | "Interface\n" | |
4912 | "Interface name\n") | |
4913 | { | |
4914 | return peer_interface_vty (vty, argv[0], NULL); | |
4915 | } | |
6b0655a2 | 4916 | |
718e3744 | 4917 | /* Set distribute list to the peer. */ |
94f2b392 | 4918 | static int |
fd79ac91 | 4919 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
4920 | afi_t afi, safi_t safi, | |
4921 | const char *name_str, const char *direct_str) | |
718e3744 | 4922 | { |
4923 | int ret; | |
4924 | struct peer *peer; | |
4925 | int direct = FILTER_IN; | |
4926 | ||
4927 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4928 | if (! peer) | |
4929 | return CMD_WARNING; | |
4930 | ||
4931 | /* Check filter direction. */ | |
4932 | if (strncmp (direct_str, "i", 1) == 0) | |
4933 | direct = FILTER_IN; | |
4934 | else if (strncmp (direct_str, "o", 1) == 0) | |
4935 | direct = FILTER_OUT; | |
4936 | ||
4937 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
4938 | ||
4939 | return bgp_vty_return (vty, ret); | |
4940 | } | |
4941 | ||
94f2b392 | 4942 | static int |
fd79ac91 | 4943 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4944 | safi_t safi, const char *direct_str) | |
718e3744 | 4945 | { |
4946 | int ret; | |
4947 | struct peer *peer; | |
4948 | int direct = FILTER_IN; | |
4949 | ||
4950 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4951 | if (! peer) | |
4952 | return CMD_WARNING; | |
4953 | ||
4954 | /* Check filter direction. */ | |
4955 | if (strncmp (direct_str, "i", 1) == 0) | |
4956 | direct = FILTER_IN; | |
4957 | else if (strncmp (direct_str, "o", 1) == 0) | |
4958 | direct = FILTER_OUT; | |
4959 | ||
4960 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
4961 | ||
4962 | return bgp_vty_return (vty, ret); | |
4963 | } | |
4964 | ||
4965 | DEFUN (neighbor_distribute_list, | |
4966 | neighbor_distribute_list_cmd, | |
4967 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
4968 | NEIGHBOR_STR | |
4969 | NEIGHBOR_ADDR_STR2 | |
4970 | "Filter updates to/from this neighbor\n" | |
4971 | "IP access-list number\n" | |
4972 | "IP access-list number (expanded range)\n" | |
4973 | "IP Access-list name\n" | |
4974 | "Filter incoming updates\n" | |
4975 | "Filter outgoing updates\n") | |
4976 | { | |
4977 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4978 | bgp_node_safi (vty), argv[1], argv[2]); | |
4979 | } | |
4980 | ||
4981 | DEFUN (no_neighbor_distribute_list, | |
4982 | no_neighbor_distribute_list_cmd, | |
4983 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
4984 | NO_STR | |
4985 | NEIGHBOR_STR | |
4986 | NEIGHBOR_ADDR_STR2 | |
4987 | "Filter updates to/from this neighbor\n" | |
4988 | "IP access-list number\n" | |
4989 | "IP access-list number (expanded range)\n" | |
4990 | "IP Access-list name\n" | |
4991 | "Filter incoming updates\n" | |
4992 | "Filter outgoing updates\n") | |
4993 | { | |
4994 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4995 | bgp_node_safi (vty), argv[2]); | |
4996 | } | |
6b0655a2 | 4997 | |
718e3744 | 4998 | /* Set prefix list to the peer. */ |
94f2b392 | 4999 | static int |
fd79ac91 | 5000 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5001 | safi_t safi, const char *name_str, | |
5002 | const char *direct_str) | |
718e3744 | 5003 | { |
5004 | int ret; | |
5005 | struct peer *peer; | |
5006 | int direct = FILTER_IN; | |
5007 | ||
5008 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5009 | if (! peer) | |
5010 | return CMD_WARNING; | |
5011 | ||
5012 | /* Check filter direction. */ | |
5013 | if (strncmp (direct_str, "i", 1) == 0) | |
5014 | direct = FILTER_IN; | |
5015 | else if (strncmp (direct_str, "o", 1) == 0) | |
5016 | direct = FILTER_OUT; | |
5017 | ||
5018 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
5019 | ||
5020 | return bgp_vty_return (vty, ret); | |
5021 | } | |
5022 | ||
94f2b392 | 5023 | static int |
fd79ac91 | 5024 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5025 | safi_t safi, const char *direct_str) | |
718e3744 | 5026 | { |
5027 | int ret; | |
5028 | struct peer *peer; | |
5029 | int direct = FILTER_IN; | |
5030 | ||
5031 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5032 | if (! peer) | |
5033 | return CMD_WARNING; | |
5034 | ||
5035 | /* Check filter direction. */ | |
5036 | if (strncmp (direct_str, "i", 1) == 0) | |
5037 | direct = FILTER_IN; | |
5038 | else if (strncmp (direct_str, "o", 1) == 0) | |
5039 | direct = FILTER_OUT; | |
5040 | ||
5041 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
5042 | ||
5043 | return bgp_vty_return (vty, ret); | |
5044 | } | |
5045 | ||
5046 | DEFUN (neighbor_prefix_list, | |
5047 | neighbor_prefix_list_cmd, | |
5048 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5049 | NEIGHBOR_STR | |
5050 | NEIGHBOR_ADDR_STR2 | |
5051 | "Filter updates to/from this neighbor\n" | |
5052 | "Name of a prefix list\n" | |
5053 | "Filter incoming updates\n" | |
5054 | "Filter outgoing updates\n") | |
5055 | { | |
5056 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5057 | bgp_node_safi (vty), argv[1], argv[2]); | |
5058 | } | |
5059 | ||
5060 | DEFUN (no_neighbor_prefix_list, | |
5061 | no_neighbor_prefix_list_cmd, | |
5062 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
5063 | NO_STR | |
5064 | NEIGHBOR_STR | |
5065 | NEIGHBOR_ADDR_STR2 | |
5066 | "Filter updates to/from this neighbor\n" | |
5067 | "Name of a prefix list\n" | |
5068 | "Filter incoming updates\n" | |
5069 | "Filter outgoing updates\n") | |
5070 | { | |
5071 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5072 | bgp_node_safi (vty), argv[2]); | |
5073 | } | |
6b0655a2 | 5074 | |
94f2b392 | 5075 | static int |
fd79ac91 | 5076 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
5077 | afi_t afi, safi_t safi, | |
5078 | const char *name_str, const char *direct_str) | |
718e3744 | 5079 | { |
5080 | int ret; | |
5081 | struct peer *peer; | |
5082 | int direct = FILTER_IN; | |
5083 | ||
5084 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5085 | if (! peer) | |
5086 | return CMD_WARNING; | |
5087 | ||
5088 | /* Check filter direction. */ | |
5089 | if (strncmp (direct_str, "i", 1) == 0) | |
5090 | direct = FILTER_IN; | |
5091 | else if (strncmp (direct_str, "o", 1) == 0) | |
5092 | direct = FILTER_OUT; | |
5093 | ||
5094 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
5095 | ||
5096 | return bgp_vty_return (vty, ret); | |
5097 | } | |
5098 | ||
94f2b392 | 5099 | static int |
fd79ac91 | 5100 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
5101 | afi_t afi, safi_t safi, | |
5102 | const char *direct_str) | |
718e3744 | 5103 | { |
5104 | int ret; | |
5105 | struct peer *peer; | |
5106 | int direct = FILTER_IN; | |
5107 | ||
5108 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5109 | if (! peer) | |
5110 | return CMD_WARNING; | |
5111 | ||
5112 | /* Check filter direction. */ | |
5113 | if (strncmp (direct_str, "i", 1) == 0) | |
5114 | direct = FILTER_IN; | |
5115 | else if (strncmp (direct_str, "o", 1) == 0) | |
5116 | direct = FILTER_OUT; | |
5117 | ||
5118 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
5119 | ||
5120 | return bgp_vty_return (vty, ret); | |
5121 | } | |
5122 | ||
5123 | DEFUN (neighbor_filter_list, | |
5124 | neighbor_filter_list_cmd, | |
5125 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5126 | NEIGHBOR_STR | |
5127 | NEIGHBOR_ADDR_STR2 | |
5128 | "Establish BGP filters\n" | |
5129 | "AS path access-list name\n" | |
5130 | "Filter incoming routes\n" | |
5131 | "Filter outgoing routes\n") | |
5132 | { | |
5133 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5134 | bgp_node_safi (vty), argv[1], argv[2]); | |
5135 | } | |
5136 | ||
5137 | DEFUN (no_neighbor_filter_list, | |
5138 | no_neighbor_filter_list_cmd, | |
5139 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
5140 | NO_STR | |
5141 | NEIGHBOR_STR | |
5142 | NEIGHBOR_ADDR_STR2 | |
5143 | "Establish BGP filters\n" | |
5144 | "AS path access-list name\n" | |
5145 | "Filter incoming routes\n" | |
5146 | "Filter outgoing routes\n") | |
5147 | { | |
5148 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5149 | bgp_node_safi (vty), argv[2]); | |
5150 | } | |
6b0655a2 | 5151 | |
718e3744 | 5152 | /* Set route-map to the peer. */ |
94f2b392 | 5153 | static int |
fd79ac91 | 5154 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
5155 | afi_t afi, safi_t safi, | |
5156 | const char *name_str, const char *direct_str) | |
718e3744 | 5157 | { |
5158 | int ret; | |
5159 | struct peer *peer; | |
fee0f4c6 | 5160 | int direct = RMAP_IN; |
718e3744 | 5161 | |
5162 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5163 | if (! peer) | |
5164 | return CMD_WARNING; | |
5165 | ||
5166 | /* Check filter direction. */ | |
fee0f4c6 | 5167 | if (strncmp (direct_str, "in", 2) == 0) |
5168 | direct = RMAP_IN; | |
718e3744 | 5169 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5170 | direct = RMAP_OUT; |
5171 | else if (strncmp (direct_str, "im", 2) == 0) | |
5172 | direct = RMAP_IMPORT; | |
5173 | else if (strncmp (direct_str, "e", 1) == 0) | |
5174 | direct = RMAP_EXPORT; | |
718e3744 | 5175 | |
5176 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
5177 | ||
5178 | return bgp_vty_return (vty, ret); | |
5179 | } | |
5180 | ||
94f2b392 | 5181 | static int |
fd79ac91 | 5182 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5183 | safi_t safi, const char *direct_str) | |
718e3744 | 5184 | { |
5185 | int ret; | |
5186 | struct peer *peer; | |
fee0f4c6 | 5187 | int direct = RMAP_IN; |
718e3744 | 5188 | |
5189 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5190 | if (! peer) | |
5191 | return CMD_WARNING; | |
5192 | ||
5193 | /* Check filter direction. */ | |
fee0f4c6 | 5194 | if (strncmp (direct_str, "in", 2) == 0) |
5195 | direct = RMAP_IN; | |
718e3744 | 5196 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 5197 | direct = RMAP_OUT; |
5198 | else if (strncmp (direct_str, "im", 2) == 0) | |
5199 | direct = RMAP_IMPORT; | |
5200 | else if (strncmp (direct_str, "e", 1) == 0) | |
5201 | direct = RMAP_EXPORT; | |
718e3744 | 5202 | |
5203 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
5204 | ||
5205 | return bgp_vty_return (vty, ret); | |
5206 | } | |
5207 | ||
5208 | DEFUN (neighbor_route_map, | |
5209 | neighbor_route_map_cmd, | |
fee0f4c6 | 5210 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 5211 | NEIGHBOR_STR |
5212 | NEIGHBOR_ADDR_STR2 | |
5213 | "Apply route map to neighbor\n" | |
5214 | "Name of route map\n" | |
5215 | "Apply map to incoming routes\n" | |
fee0f4c6 | 5216 | "Apply map to outbound routes\n" |
5217 | "Apply map to routes going into a Route-Server client's table\n" | |
5218 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 5219 | { |
5220 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5221 | bgp_node_safi (vty), argv[1], argv[2]); | |
5222 | } | |
5223 | ||
5224 | DEFUN (no_neighbor_route_map, | |
5225 | no_neighbor_route_map_cmd, | |
fee0f4c6 | 5226 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 5227 | NO_STR |
5228 | NEIGHBOR_STR | |
5229 | NEIGHBOR_ADDR_STR2 | |
5230 | "Apply route map to neighbor\n" | |
5231 | "Name of route map\n" | |
5232 | "Apply map to incoming routes\n" | |
fee0f4c6 | 5233 | "Apply map to outbound routes\n" |
5234 | "Apply map to routes going into a Route-Server client's table\n" | |
5235 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 5236 | { |
5237 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5238 | bgp_node_safi (vty), argv[2]); | |
5239 | } | |
6b0655a2 | 5240 | |
718e3744 | 5241 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 5242 | static int |
fd79ac91 | 5243 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5244 | safi_t safi, const char *name_str) | |
718e3744 | 5245 | { |
5246 | int ret; | |
5247 | struct peer *peer; | |
5248 | ||
5249 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5250 | if (! peer) | |
5251 | return CMD_WARNING; | |
5252 | ||
5253 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
5254 | ||
5255 | return bgp_vty_return (vty, ret); | |
5256 | } | |
5257 | ||
5258 | /* Unset route-map from the peer. */ | |
94f2b392 | 5259 | static int |
fd79ac91 | 5260 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5261 | safi_t safi) |
5262 | { | |
5263 | int ret; | |
5264 | struct peer *peer; | |
5265 | ||
5266 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5267 | if (! peer) | |
5268 | return CMD_WARNING; | |
5269 | ||
5270 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
5271 | ||
5272 | return bgp_vty_return (vty, ret); | |
5273 | } | |
5274 | ||
5275 | DEFUN (neighbor_unsuppress_map, | |
5276 | neighbor_unsuppress_map_cmd, | |
5277 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5278 | NEIGHBOR_STR | |
5279 | NEIGHBOR_ADDR_STR2 | |
5280 | "Route-map to selectively unsuppress suppressed routes\n" | |
5281 | "Name of route map\n") | |
5282 | { | |
5283 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5284 | bgp_node_safi (vty), argv[1]); | |
5285 | } | |
5286 | ||
5287 | DEFUN (no_neighbor_unsuppress_map, | |
5288 | no_neighbor_unsuppress_map_cmd, | |
5289 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
5290 | NO_STR | |
5291 | NEIGHBOR_STR | |
5292 | NEIGHBOR_ADDR_STR2 | |
5293 | "Route-map to selectively unsuppress suppressed routes\n" | |
5294 | "Name of route map\n") | |
5295 | { | |
5296 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5297 | bgp_node_safi (vty)); | |
5298 | } | |
6b0655a2 | 5299 | |
94f2b392 | 5300 | static int |
fd79ac91 | 5301 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
5302 | safi_t safi, const char *num_str, | |
0a486e5f | 5303 | const char *threshold_str, int warning, |
5304 | const char *restart_str) | |
718e3744 | 5305 | { |
5306 | int ret; | |
5307 | struct peer *peer; | |
5308 | u_int32_t max; | |
e0701b79 | 5309 | u_char threshold; |
0a486e5f | 5310 | u_int16_t restart; |
718e3744 | 5311 | |
5312 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5313 | if (! peer) | |
5314 | return CMD_WARNING; | |
5315 | ||
e6ec1c36 | 5316 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 5317 | if (threshold_str) |
5318 | threshold = atoi (threshold_str); | |
5319 | else | |
5320 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 5321 | |
0a486e5f | 5322 | if (restart_str) |
5323 | restart = atoi (restart_str); | |
5324 | else | |
5325 | restart = 0; | |
5326 | ||
5327 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 5328 | |
5329 | return bgp_vty_return (vty, ret); | |
5330 | } | |
5331 | ||
94f2b392 | 5332 | static int |
fd79ac91 | 5333 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 5334 | safi_t safi) |
5335 | { | |
5336 | int ret; | |
5337 | struct peer *peer; | |
5338 | ||
5339 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
5340 | if (! peer) | |
5341 | return CMD_WARNING; | |
5342 | ||
5343 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
5344 | ||
5345 | return bgp_vty_return (vty, ret); | |
5346 | } | |
5347 | ||
5348 | /* Maximum number of prefix configuration. prefix count is different | |
5349 | for each peer configuration. So this configuration can be set for | |
5350 | each peer configuration. */ | |
5351 | DEFUN (neighbor_maximum_prefix, | |
5352 | neighbor_maximum_prefix_cmd, | |
5353 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5354 | NEIGHBOR_STR | |
5355 | NEIGHBOR_ADDR_STR2 | |
5356 | "Maximum number of prefix accept from this peer\n" | |
5357 | "maximum no. of prefix limit\n") | |
5358 | { | |
5359 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5360 | bgp_node_safi (vty), argv[1], NULL, 0, |
5361 | NULL); | |
718e3744 | 5362 | } |
5363 | ||
e0701b79 | 5364 | DEFUN (neighbor_maximum_prefix_threshold, |
5365 | neighbor_maximum_prefix_threshold_cmd, | |
5366 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
5367 | NEIGHBOR_STR | |
5368 | NEIGHBOR_ADDR_STR2 | |
5369 | "Maximum number of prefix accept from this peer\n" | |
5370 | "maximum no. of prefix limit\n" | |
5371 | "Threshold value (%) at which to generate a warning msg\n") | |
5372 | { | |
5373 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5374 | bgp_node_safi (vty), argv[1], argv[2], 0, |
5375 | NULL); | |
5376 | } | |
e0701b79 | 5377 | |
718e3744 | 5378 | DEFUN (neighbor_maximum_prefix_warning, |
5379 | neighbor_maximum_prefix_warning_cmd, | |
5380 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5381 | NEIGHBOR_STR | |
5382 | NEIGHBOR_ADDR_STR2 | |
5383 | "Maximum number of prefix accept from this peer\n" | |
5384 | "maximum no. of prefix limit\n" | |
5385 | "Only give warning message when limit is exceeded\n") | |
5386 | { | |
5387 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5388 | bgp_node_safi (vty), argv[1], NULL, 1, |
5389 | NULL); | |
718e3744 | 5390 | } |
5391 | ||
e0701b79 | 5392 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
5393 | neighbor_maximum_prefix_threshold_warning_cmd, | |
5394 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
5395 | NEIGHBOR_STR | |
5396 | NEIGHBOR_ADDR_STR2 | |
5397 | "Maximum number of prefix accept from this peer\n" | |
5398 | "maximum no. of prefix limit\n" | |
5399 | "Threshold value (%) at which to generate a warning msg\n" | |
5400 | "Only give warning message when limit is exceeded\n") | |
5401 | { | |
5402 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 5403 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
5404 | } | |
5405 | ||
5406 | DEFUN (neighbor_maximum_prefix_restart, | |
5407 | neighbor_maximum_prefix_restart_cmd, | |
5408 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
5409 | NEIGHBOR_STR | |
5410 | NEIGHBOR_ADDR_STR2 | |
5411 | "Maximum number of prefix accept from this peer\n" | |
5412 | "maximum no. of prefix limit\n" | |
5413 | "Restart bgp connection after limit is exceeded\n" | |
5414 | "Restart interval in minutes") | |
5415 | { | |
5416 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5417 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
5418 | } | |
5419 | ||
5420 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
5421 | neighbor_maximum_prefix_threshold_restart_cmd, | |
5422 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5423 | NEIGHBOR_STR | |
5424 | NEIGHBOR_ADDR_STR2 | |
5425 | "Maximum number of prefix accept from this peer\n" | |
5426 | "maximum no. of prefix limit\n" | |
5427 | "Threshold value (%) at which to generate a warning msg\n" | |
5428 | "Restart bgp connection after limit is exceeded\n" | |
5429 | "Restart interval in minutes") | |
5430 | { | |
5431 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
5432 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
5433 | } | |
e0701b79 | 5434 | |
718e3744 | 5435 | DEFUN (no_neighbor_maximum_prefix, |
5436 | no_neighbor_maximum_prefix_cmd, | |
5437 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
5438 | NO_STR | |
5439 | NEIGHBOR_STR | |
5440 | NEIGHBOR_ADDR_STR2 | |
5441 | "Maximum number of prefix accept from this peer\n") | |
5442 | { | |
5443 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
5444 | bgp_node_safi (vty)); | |
5445 | } | |
5446 | ||
5447 | ALIAS (no_neighbor_maximum_prefix, | |
5448 | no_neighbor_maximum_prefix_val_cmd, | |
5449 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
5450 | NO_STR | |
5451 | NEIGHBOR_STR | |
5452 | NEIGHBOR_ADDR_STR2 | |
5453 | "Maximum number of prefix accept from this peer\n" | |
5454 | "maximum no. of prefix limit\n") | |
5455 | ||
5456 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5457 | no_neighbor_maximum_prefix_threshold_cmd, |
5458 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5459 | NO_STR | |
5460 | NEIGHBOR_STR | |
5461 | NEIGHBOR_ADDR_STR2 | |
5462 | "Maximum number of prefix accept from this peer\n" | |
5463 | "maximum no. of prefix limit\n" | |
5464 | "Threshold value (%) at which to generate a warning msg\n") | |
5465 | ||
5466 | ALIAS (no_neighbor_maximum_prefix, | |
5467 | no_neighbor_maximum_prefix_warning_cmd, | |
5468 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
5469 | NO_STR | |
5470 | NEIGHBOR_STR | |
5471 | NEIGHBOR_ADDR_STR2 | |
5472 | "Maximum number of prefix accept from this peer\n" | |
5473 | "maximum no. of prefix limit\n" | |
e8e1946e | 5474 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 5475 | |
5476 | ALIAS (no_neighbor_maximum_prefix, | |
5477 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 5478 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
5479 | NO_STR | |
5480 | NEIGHBOR_STR | |
5481 | NEIGHBOR_ADDR_STR2 | |
5482 | "Maximum number of prefix accept from this peer\n" | |
5483 | "maximum no. of prefix limit\n" | |
5484 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 5485 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 5486 | |
5487 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 5488 | no_neighbor_maximum_prefix_restart_cmd, |
5489 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 5490 | NO_STR |
5491 | NEIGHBOR_STR | |
5492 | NEIGHBOR_ADDR_STR2 | |
5493 | "Maximum number of prefix accept from this peer\n" | |
5494 | "maximum no. of prefix limit\n" | |
0a486e5f | 5495 | "Restart bgp connection after limit is exceeded\n" |
5496 | "Restart interval in minutes") | |
5497 | ||
5498 | ALIAS (no_neighbor_maximum_prefix, | |
5499 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
5500 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
5501 | NO_STR | |
5502 | NEIGHBOR_STR | |
5503 | NEIGHBOR_ADDR_STR2 | |
5504 | "Maximum number of prefix accept from this peer\n" | |
5505 | "maximum no. of prefix limit\n" | |
5506 | "Threshold value (%) at which to generate a warning msg\n" | |
5507 | "Restart bgp connection after limit is exceeded\n" | |
5508 | "Restart interval in minutes") | |
6b0655a2 | 5509 | |
718e3744 | 5510 | /* "neighbor allowas-in" */ |
5511 | DEFUN (neighbor_allowas_in, | |
5512 | neighbor_allowas_in_cmd, | |
5513 | NEIGHBOR_CMD2 "allowas-in", | |
5514 | NEIGHBOR_STR | |
5515 | NEIGHBOR_ADDR_STR2 | |
5516 | "Accept as-path with my AS present in it\n") | |
5517 | { | |
5518 | int ret; | |
5519 | struct peer *peer; | |
fd79ac91 | 5520 | unsigned int allow_num; |
718e3744 | 5521 | |
5522 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5523 | if (! peer) | |
5524 | return CMD_WARNING; | |
5525 | ||
5526 | if (argc == 1) | |
5527 | allow_num = 3; | |
5528 | else | |
5529 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
5530 | ||
5531 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
5532 | allow_num); | |
5533 | ||
5534 | return bgp_vty_return (vty, ret); | |
5535 | } | |
5536 | ||
5537 | ALIAS (neighbor_allowas_in, | |
5538 | neighbor_allowas_in_arg_cmd, | |
5539 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
5540 | NEIGHBOR_STR | |
5541 | NEIGHBOR_ADDR_STR2 | |
5542 | "Accept as-path with my AS present in it\n" | |
5543 | "Number of occurances of AS number\n") | |
5544 | ||
5545 | DEFUN (no_neighbor_allowas_in, | |
5546 | no_neighbor_allowas_in_cmd, | |
5547 | NO_NEIGHBOR_CMD2 "allowas-in", | |
5548 | NO_STR | |
5549 | NEIGHBOR_STR | |
5550 | NEIGHBOR_ADDR_STR2 | |
5551 | "allow local ASN appears in aspath attribute\n") | |
5552 | { | |
5553 | int ret; | |
5554 | struct peer *peer; | |
5555 | ||
5556 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5557 | if (! peer) | |
5558 | return CMD_WARNING; | |
5559 | ||
5560 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
5561 | ||
5562 | return bgp_vty_return (vty, ret); | |
5563 | } | |
6b0655a2 | 5564 | |
fa411a21 NH |
5565 | DEFUN (neighbor_ttl_security, |
5566 | neighbor_ttl_security_cmd, | |
5567 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5568 | NEIGHBOR_STR | |
5569 | NEIGHBOR_ADDR_STR2 | |
5570 | "Specify the maximum number of hops to the BGP peer\n") | |
5571 | { | |
5572 | struct peer *peer; | |
89b6d1f8 | 5573 | int gtsm_hops; |
fa411a21 NH |
5574 | |
5575 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5576 | if (! peer) | |
5577 | return CMD_WARNING; | |
5578 | ||
5579 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); | |
5580 | ||
89b6d1f8 | 5581 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
5582 | } |
5583 | ||
5584 | DEFUN (no_neighbor_ttl_security, | |
5585 | no_neighbor_ttl_security_cmd, | |
5586 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
5587 | NO_STR | |
5588 | NEIGHBOR_STR | |
5589 | NEIGHBOR_ADDR_STR2 | |
5590 | "Specify the maximum number of hops to the BGP peer\n") | |
5591 | { | |
5592 | struct peer *peer; | |
fa411a21 NH |
5593 | |
5594 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
5595 | if (! peer) | |
5596 | return CMD_WARNING; | |
5597 | ||
89b6d1f8 | 5598 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 5599 | } |
6b0655a2 | 5600 | |
718e3744 | 5601 | /* Address family configuration. */ |
5602 | DEFUN (address_family_ipv4, | |
5603 | address_family_ipv4_cmd, | |
5604 | "address-family ipv4", | |
5605 | "Enter Address Family command mode\n" | |
5606 | "Address family\n") | |
5607 | { | |
5608 | vty->node = BGP_IPV4_NODE; | |
5609 | return CMD_SUCCESS; | |
5610 | } | |
5611 | ||
5612 | DEFUN (address_family_ipv4_safi, | |
5613 | address_family_ipv4_safi_cmd, | |
5614 | "address-family ipv4 (unicast|multicast)", | |
5615 | "Enter Address Family command mode\n" | |
5616 | "Address family\n" | |
5617 | "Address Family modifier\n" | |
5618 | "Address Family modifier\n") | |
5619 | { | |
5620 | if (strncmp (argv[0], "m", 1) == 0) | |
5621 | vty->node = BGP_IPV4M_NODE; | |
5622 | else | |
5623 | vty->node = BGP_IPV4_NODE; | |
5624 | ||
5625 | return CMD_SUCCESS; | |
5626 | } | |
5627 | ||
25ffbdc1 | 5628 | DEFUN (address_family_ipv6, |
5629 | address_family_ipv6_cmd, | |
5630 | "address-family ipv6", | |
718e3744 | 5631 | "Enter Address Family command mode\n" |
25ffbdc1 | 5632 | "Address family\n") |
718e3744 | 5633 | { |
5634 | vty->node = BGP_IPV6_NODE; | |
5635 | return CMD_SUCCESS; | |
5636 | } | |
5637 | ||
25ffbdc1 | 5638 | DEFUN (address_family_ipv6_safi, |
5639 | address_family_ipv6_safi_cmd, | |
5640 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 5641 | "Enter Address Family command mode\n" |
25ffbdc1 | 5642 | "Address family\n" |
5643 | "Address Family modifier\n" | |
5644 | "Address Family modifier\n") | |
5645 | { | |
5646 | if (strncmp (argv[0], "m", 1) == 0) | |
5647 | vty->node = BGP_IPV6M_NODE; | |
5648 | else | |
5649 | vty->node = BGP_IPV6_NODE; | |
5650 | ||
5651 | return CMD_SUCCESS; | |
5652 | } | |
718e3744 | 5653 | |
5654 | DEFUN (address_family_vpnv4, | |
5655 | address_family_vpnv4_cmd, | |
5656 | "address-family vpnv4", | |
5657 | "Enter Address Family command mode\n" | |
5658 | "Address family\n") | |
5659 | { | |
5660 | vty->node = BGP_VPNV4_NODE; | |
5661 | return CMD_SUCCESS; | |
5662 | } | |
5663 | ||
5664 | ALIAS (address_family_vpnv4, | |
5665 | address_family_vpnv4_unicast_cmd, | |
5666 | "address-family vpnv4 unicast", | |
5667 | "Enter Address Family command mode\n" | |
5668 | "Address family\n" | |
5669 | "Address Family Modifier\n") | |
5670 | ||
5671 | DEFUN (exit_address_family, | |
5672 | exit_address_family_cmd, | |
5673 | "exit-address-family", | |
5674 | "Exit from Address Family configuration mode\n") | |
5675 | { | |
a8a80d53 | 5676 | if (vty->node == BGP_IPV4_NODE |
5677 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 5678 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 5679 | || vty->node == BGP_IPV6_NODE |
5680 | || vty->node == BGP_IPV6M_NODE) | |
718e3744 | 5681 | vty->node = BGP_NODE; |
5682 | return CMD_SUCCESS; | |
5683 | } | |
6b0655a2 | 5684 | |
8ad7271d DS |
5685 | /* Recalculate bestpath and re-advertise a prefix */ |
5686 | static int | |
5687 | bgp_clear_prefix (struct vty *vty, char *view_name, const char *ip_str, | |
5688 | afi_t afi, safi_t safi, struct prefix_rd *prd) | |
5689 | { | |
5690 | int ret; | |
5691 | struct prefix match; | |
5692 | struct bgp_node *rn; | |
5693 | struct bgp_node *rm; | |
5694 | struct bgp_info *ri; | |
5695 | struct bgp_info *ri_temp; | |
5696 | struct bgp *bgp; | |
5697 | struct bgp_table *table; | |
5698 | struct bgp_table *rib; | |
5699 | ||
5700 | /* BGP structure lookup. */ | |
5701 | if (view_name) | |
5702 | { | |
5703 | bgp = bgp_lookup_by_name (view_name); | |
5704 | if (bgp == NULL) | |
5705 | { | |
5706 | vty_out (vty, "%% Can't find BGP view %s%s", view_name, VTY_NEWLINE); | |
5707 | return CMD_WARNING; | |
5708 | } | |
5709 | } | |
5710 | else | |
5711 | { | |
5712 | bgp = bgp_get_default (); | |
5713 | if (bgp == NULL) | |
5714 | { | |
5715 | vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE); | |
5716 | return CMD_WARNING; | |
5717 | } | |
5718 | } | |
5719 | ||
5720 | /* Check IP address argument. */ | |
5721 | ret = str2prefix (ip_str, &match); | |
5722 | if (! ret) | |
5723 | { | |
5724 | vty_out (vty, "%% address is malformed%s", VTY_NEWLINE); | |
5725 | return CMD_WARNING; | |
5726 | } | |
5727 | ||
5728 | match.family = afi2family (afi); | |
5729 | rib = bgp->rib[afi][safi]; | |
5730 | ||
5731 | if (safi == SAFI_MPLS_VPN) | |
5732 | { | |
5733 | for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn)) | |
5734 | { | |
5735 | if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0) | |
5736 | continue; | |
5737 | ||
5738 | if ((table = rn->info) != NULL) | |
5739 | { | |
5740 | if ((rm = bgp_node_match (table, &match)) != NULL) | |
5741 | { | |
5742 | if (rm->p.prefixlen == match.prefixlen) | |
5743 | { | |
5744 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5745 | bgp_process (bgp, rm, afi, safi); | |
5746 | } | |
5747 | bgp_unlock_node (rm); | |
5748 | } | |
5749 | } | |
5750 | } | |
5751 | } | |
5752 | else | |
5753 | { | |
5754 | if ((rn = bgp_node_match (rib, &match)) != NULL) | |
5755 | { | |
5756 | if (rn->p.prefixlen == match.prefixlen) | |
5757 | { | |
5758 | SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR); | |
5759 | bgp_process (bgp, rn, afi, safi); | |
5760 | } | |
5761 | bgp_unlock_node (rn); | |
5762 | } | |
5763 | } | |
5764 | ||
5765 | return CMD_SUCCESS; | |
5766 | } | |
5767 | ||
718e3744 | 5768 | DEFUN (clear_ip_bgp_all, |
5769 | clear_ip_bgp_all_cmd, | |
5770 | "clear ip bgp *", | |
5771 | CLEAR_STR | |
5772 | IP_STR | |
5773 | BGP_STR | |
5774 | "Clear all peers\n") | |
5775 | { | |
5776 | if (argc == 1) | |
5777 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5778 | ||
5779 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
5780 | } | |
5781 | ||
5782 | ALIAS (clear_ip_bgp_all, | |
5783 | clear_bgp_all_cmd, | |
5784 | "clear bgp *", | |
5785 | CLEAR_STR | |
5786 | BGP_STR | |
5787 | "Clear all peers\n") | |
5788 | ||
5789 | ALIAS (clear_ip_bgp_all, | |
5790 | clear_bgp_ipv6_all_cmd, | |
5791 | "clear bgp ipv6 *", | |
5792 | CLEAR_STR | |
5793 | BGP_STR | |
5794 | "Address family\n" | |
5795 | "Clear all peers\n") | |
5796 | ||
5797 | ALIAS (clear_ip_bgp_all, | |
5798 | clear_ip_bgp_instance_all_cmd, | |
5799 | "clear ip bgp view WORD *", | |
5800 | CLEAR_STR | |
5801 | IP_STR | |
5802 | BGP_STR | |
5803 | "BGP view\n" | |
5804 | "view name\n" | |
5805 | "Clear all peers\n") | |
5806 | ||
5807 | ALIAS (clear_ip_bgp_all, | |
5808 | clear_bgp_instance_all_cmd, | |
5809 | "clear bgp view WORD *", | |
5810 | CLEAR_STR | |
5811 | BGP_STR | |
5812 | "BGP view\n" | |
5813 | "view name\n" | |
5814 | "Clear all peers\n") | |
5815 | ||
5816 | DEFUN (clear_ip_bgp_peer, | |
5817 | clear_ip_bgp_peer_cmd, | |
a80beece | 5818 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5819 | CLEAR_STR |
5820 | IP_STR | |
5821 | BGP_STR | |
5822 | "BGP neighbor IP address to clear\n" | |
a80beece DS |
5823 | "BGP IPv6 neighbor to clear\n" |
5824 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5825 | { |
5826 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5827 | } | |
5828 | ||
5829 | ALIAS (clear_ip_bgp_peer, | |
5830 | clear_bgp_peer_cmd, | |
a80beece | 5831 | "clear bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5832 | CLEAR_STR |
5833 | BGP_STR | |
5834 | "BGP neighbor address to clear\n" | |
a80beece DS |
5835 | "BGP IPv6 neighbor to clear\n" |
5836 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5837 | |
5838 | ALIAS (clear_ip_bgp_peer, | |
5839 | clear_bgp_ipv6_peer_cmd, | |
a80beece | 5840 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 5841 | CLEAR_STR |
5842 | BGP_STR | |
5843 | "Address family\n" | |
5844 | "BGP neighbor address to clear\n" | |
a80beece DS |
5845 | "BGP IPv6 neighbor to clear\n" |
5846 | "BGP neighbor on interface to clear\n") | |
718e3744 | 5847 | |
5848 | DEFUN (clear_ip_bgp_peer_group, | |
5849 | clear_ip_bgp_peer_group_cmd, | |
5850 | "clear ip bgp peer-group WORD", | |
5851 | CLEAR_STR | |
5852 | IP_STR | |
5853 | BGP_STR | |
5854 | "Clear all members of peer-group\n" | |
5855 | "BGP peer-group name\n") | |
5856 | { | |
5857 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5858 | } | |
5859 | ||
5860 | ALIAS (clear_ip_bgp_peer_group, | |
5861 | clear_bgp_peer_group_cmd, | |
5862 | "clear bgp peer-group WORD", | |
5863 | CLEAR_STR | |
5864 | BGP_STR | |
5865 | "Clear all members of peer-group\n" | |
5866 | "BGP peer-group name\n") | |
5867 | ||
5868 | ALIAS (clear_ip_bgp_peer_group, | |
5869 | clear_bgp_ipv6_peer_group_cmd, | |
5870 | "clear bgp ipv6 peer-group WORD", | |
5871 | CLEAR_STR | |
5872 | BGP_STR | |
5873 | "Address family\n" | |
5874 | "Clear all members of peer-group\n" | |
5875 | "BGP peer-group name\n") | |
5876 | ||
5877 | DEFUN (clear_ip_bgp_external, | |
5878 | clear_ip_bgp_external_cmd, | |
5879 | "clear ip bgp external", | |
5880 | CLEAR_STR | |
5881 | IP_STR | |
5882 | BGP_STR | |
5883 | "Clear all external peers\n") | |
5884 | { | |
5885 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
5886 | } | |
5887 | ||
5888 | ALIAS (clear_ip_bgp_external, | |
5889 | clear_bgp_external_cmd, | |
5890 | "clear bgp external", | |
5891 | CLEAR_STR | |
5892 | BGP_STR | |
5893 | "Clear all external peers\n") | |
5894 | ||
5895 | ALIAS (clear_ip_bgp_external, | |
5896 | clear_bgp_ipv6_external_cmd, | |
5897 | "clear bgp ipv6 external", | |
5898 | CLEAR_STR | |
5899 | BGP_STR | |
5900 | "Address family\n" | |
5901 | "Clear all external peers\n") | |
5902 | ||
8ad7271d DS |
5903 | DEFUN (clear_ip_bgp_prefix, |
5904 | clear_ip_bgp_prefix_cmd, | |
5905 | "clear ip bgp prefix A.B.C.D/M", | |
5906 | CLEAR_STR | |
5907 | IP_STR | |
5908 | BGP_STR | |
5909 | "Clear bestpath and re-advertise\n" | |
5910 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
5911 | { | |
5912 | return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL); | |
5913 | } | |
5914 | ||
5915 | ALIAS (clear_ip_bgp_prefix, | |
5916 | clear_bgp_prefix_cmd, | |
5917 | "clear bgp prefix A.B.C.D/M", | |
5918 | CLEAR_STR | |
5919 | BGP_STR | |
5920 | "Clear bestpath and re-advertise\n" | |
5921 | "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n") | |
5922 | ||
5923 | ||
718e3744 | 5924 | DEFUN (clear_ip_bgp_as, |
5925 | clear_ip_bgp_as_cmd, | |
320da874 | 5926 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 5927 | CLEAR_STR |
5928 | IP_STR | |
5929 | BGP_STR | |
5930 | "Clear peers with the AS number\n") | |
5931 | { | |
5932 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); | |
5933 | } | |
5934 | ||
5935 | ALIAS (clear_ip_bgp_as, | |
5936 | clear_bgp_as_cmd, | |
320da874 | 5937 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 5938 | CLEAR_STR |
5939 | BGP_STR | |
5940 | "Clear peers with the AS number\n") | |
5941 | ||
5942 | ALIAS (clear_ip_bgp_as, | |
5943 | clear_bgp_ipv6_as_cmd, | |
320da874 | 5944 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 5945 | CLEAR_STR |
5946 | BGP_STR | |
5947 | "Address family\n" | |
5948 | "Clear peers with the AS number\n") | |
6b0655a2 | 5949 | |
718e3744 | 5950 | /* Outbound soft-reconfiguration */ |
5951 | DEFUN (clear_ip_bgp_all_soft_out, | |
5952 | clear_ip_bgp_all_soft_out_cmd, | |
5953 | "clear ip bgp * soft out", | |
5954 | CLEAR_STR | |
5955 | IP_STR | |
5956 | BGP_STR | |
5957 | "Clear all peers\n" | |
e0bce756 DS |
5958 | BGP_SOFT_STR |
5959 | BGP_SOFT_OUT_STR) | |
718e3744 | 5960 | { |
5961 | if (argc == 1) | |
5962 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5963 | BGP_CLEAR_SOFT_OUT, NULL); | |
5964 | ||
5965 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5966 | BGP_CLEAR_SOFT_OUT, NULL); | |
5967 | } | |
5968 | ||
5969 | ALIAS (clear_ip_bgp_all_soft_out, | |
5970 | clear_ip_bgp_all_out_cmd, | |
5971 | "clear ip bgp * out", | |
5972 | CLEAR_STR | |
5973 | IP_STR | |
5974 | BGP_STR | |
5975 | "Clear all peers\n" | |
e0bce756 | 5976 | BGP_SOFT_OUT_STR) |
718e3744 | 5977 | |
5978 | ALIAS (clear_ip_bgp_all_soft_out, | |
5979 | clear_ip_bgp_instance_all_soft_out_cmd, | |
5980 | "clear ip bgp view WORD * soft out", | |
5981 | CLEAR_STR | |
5982 | IP_STR | |
5983 | BGP_STR | |
5984 | "BGP view\n" | |
5985 | "view name\n" | |
5986 | "Clear all peers\n" | |
e0bce756 DS |
5987 | BGP_SOFT_STR |
5988 | BGP_SOFT_OUT_STR) | |
718e3744 | 5989 | |
5990 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
5991 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
5992 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
5993 | CLEAR_STR | |
5994 | IP_STR | |
5995 | BGP_STR | |
5996 | "Clear all peers\n" | |
5997 | "Address family\n" | |
5998 | "Address Family modifier\n" | |
5999 | "Address Family modifier\n" | |
e0bce756 DS |
6000 | BGP_SOFT_STR |
6001 | BGP_SOFT_OUT_STR) | |
718e3744 | 6002 | { |
6003 | if (strncmp (argv[0], "m", 1) == 0) | |
6004 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6005 | BGP_CLEAR_SOFT_OUT, NULL); | |
6006 | ||
6007 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6008 | BGP_CLEAR_SOFT_OUT, NULL); | |
6009 | } | |
6010 | ||
6011 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, | |
6012 | clear_ip_bgp_all_ipv4_out_cmd, | |
6013 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
6014 | CLEAR_STR | |
6015 | IP_STR | |
6016 | BGP_STR | |
6017 | "Clear all peers\n" | |
6018 | "Address family\n" | |
6019 | "Address Family modifier\n" | |
6020 | "Address Family modifier\n" | |
e0bce756 | 6021 | BGP_SOFT_OUT_STR) |
718e3744 | 6022 | |
6023 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, | |
6024 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
6025 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", | |
6026 | CLEAR_STR | |
6027 | IP_STR | |
6028 | BGP_STR | |
6029 | "BGP view\n" | |
6030 | "view name\n" | |
6031 | "Clear all peers\n" | |
6032 | "Address family\n" | |
6033 | "Address Family modifier\n" | |
6034 | "Address Family modifier\n" | |
e0bce756 | 6035 | BGP_SOFT_OUT_STR) |
718e3744 | 6036 | { |
6037 | if (strncmp (argv[1], "m", 1) == 0) | |
6038 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6039 | BGP_CLEAR_SOFT_OUT, NULL); | |
6040 | ||
6041 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6042 | BGP_CLEAR_SOFT_OUT, NULL); | |
6043 | } | |
6044 | ||
6045 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
6046 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
6047 | "clear ip bgp * vpnv4 unicast soft out", | |
6048 | CLEAR_STR | |
6049 | IP_STR | |
6050 | BGP_STR | |
6051 | "Clear all peers\n" | |
6052 | "Address family\n" | |
6053 | "Address Family Modifier\n" | |
e0bce756 DS |
6054 | BGP_SOFT_STR |
6055 | BGP_SOFT_OUT_STR) | |
718e3744 | 6056 | { |
6057 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6058 | BGP_CLEAR_SOFT_OUT, NULL); | |
6059 | } | |
6060 | ||
6061 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
6062 | clear_ip_bgp_all_vpnv4_out_cmd, | |
6063 | "clear ip bgp * vpnv4 unicast out", | |
6064 | CLEAR_STR | |
6065 | IP_STR | |
6066 | BGP_STR | |
6067 | "Clear all peers\n" | |
6068 | "Address family\n" | |
6069 | "Address Family Modifier\n" | |
e0bce756 | 6070 | BGP_SOFT_OUT_STR) |
718e3744 | 6071 | |
6072 | DEFUN (clear_bgp_all_soft_out, | |
6073 | clear_bgp_all_soft_out_cmd, | |
6074 | "clear bgp * soft out", | |
6075 | CLEAR_STR | |
6076 | BGP_STR | |
6077 | "Clear all peers\n" | |
e0bce756 DS |
6078 | BGP_SOFT_STR |
6079 | BGP_SOFT_OUT_STR) | |
718e3744 | 6080 | { |
6081 | if (argc == 1) | |
6082 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6083 | BGP_CLEAR_SOFT_OUT, NULL); | |
6084 | ||
6085 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6086 | BGP_CLEAR_SOFT_OUT, NULL); | |
6087 | } | |
6088 | ||
6089 | ALIAS (clear_bgp_all_soft_out, | |
6090 | clear_bgp_instance_all_soft_out_cmd, | |
6091 | "clear bgp view WORD * soft out", | |
6092 | CLEAR_STR | |
6093 | BGP_STR | |
6094 | "BGP view\n" | |
6095 | "view name\n" | |
6096 | "Clear all peers\n" | |
e0bce756 DS |
6097 | BGP_SOFT_STR |
6098 | BGP_SOFT_OUT_STR) | |
718e3744 | 6099 | |
6100 | ALIAS (clear_bgp_all_soft_out, | |
6101 | clear_bgp_all_out_cmd, | |
6102 | "clear bgp * out", | |
6103 | CLEAR_STR | |
6104 | BGP_STR | |
6105 | "Clear all peers\n" | |
e0bce756 | 6106 | BGP_SOFT_OUT_STR) |
718e3744 | 6107 | |
6108 | ALIAS (clear_bgp_all_soft_out, | |
6109 | clear_bgp_ipv6_all_soft_out_cmd, | |
6110 | "clear bgp ipv6 * soft out", | |
6111 | CLEAR_STR | |
6112 | BGP_STR | |
6113 | "Address family\n" | |
6114 | "Clear all peers\n" | |
e0bce756 DS |
6115 | BGP_SOFT_STR |
6116 | BGP_SOFT_OUT_STR) | |
718e3744 | 6117 | |
6118 | ALIAS (clear_bgp_all_soft_out, | |
6119 | clear_bgp_ipv6_all_out_cmd, | |
6120 | "clear bgp ipv6 * out", | |
6121 | CLEAR_STR | |
6122 | BGP_STR | |
6123 | "Address family\n" | |
6124 | "Clear all peers\n" | |
e0bce756 | 6125 | BGP_SOFT_OUT_STR) |
718e3744 | 6126 | |
8ad7271d DS |
6127 | DEFUN (clear_bgp_ipv6_safi_prefix, |
6128 | clear_bgp_ipv6_safi_prefix_cmd, | |
6129 | "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M", | |
6130 | CLEAR_STR | |
6131 | BGP_STR | |
6132 | "Address family\n" | |
6133 | "Address Family Modifier\n" | |
6134 | "Clear bestpath and re-advertise\n" | |
6135 | "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n") | |
6136 | { | |
6137 | if (strncmp (argv[0], "m", 1) == 0) | |
6138 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL); | |
6139 | else | |
6140 | return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL); | |
6141 | } | |
6142 | ||
718e3744 | 6143 | DEFUN (clear_ip_bgp_peer_soft_out, |
6144 | clear_ip_bgp_peer_soft_out_cmd, | |
6145 | "clear ip bgp A.B.C.D soft out", | |
6146 | CLEAR_STR | |
6147 | IP_STR | |
6148 | BGP_STR | |
6149 | "BGP neighbor address to clear\n" | |
e0bce756 DS |
6150 | BGP_SOFT_STR |
6151 | BGP_SOFT_OUT_STR) | |
718e3744 | 6152 | { |
6153 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6154 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6155 | } | |
6156 | ||
6157 | ALIAS (clear_ip_bgp_peer_soft_out, | |
6158 | clear_ip_bgp_peer_out_cmd, | |
6159 | "clear ip bgp A.B.C.D out", | |
6160 | CLEAR_STR | |
6161 | IP_STR | |
6162 | BGP_STR | |
6163 | "BGP neighbor address to clear\n" | |
e0bce756 | 6164 | BGP_SOFT_OUT_STR) |
718e3744 | 6165 | |
6166 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, | |
6167 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
6168 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", | |
6169 | CLEAR_STR | |
6170 | IP_STR | |
6171 | BGP_STR | |
6172 | "BGP neighbor address to clear\n" | |
6173 | "Address family\n" | |
6174 | "Address Family modifier\n" | |
6175 | "Address Family modifier\n" | |
e0bce756 DS |
6176 | BGP_SOFT_STR |
6177 | BGP_SOFT_OUT_STR) | |
718e3744 | 6178 | { |
6179 | if (strncmp (argv[1], "m", 1) == 0) | |
6180 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6181 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6182 | ||
6183 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6184 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6185 | } | |
6186 | ||
6187 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, | |
6188 | clear_ip_bgp_peer_ipv4_out_cmd, | |
6189 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", | |
6190 | CLEAR_STR | |
6191 | IP_STR | |
6192 | BGP_STR | |
6193 | "BGP neighbor address to clear\n" | |
6194 | "Address family\n" | |
6195 | "Address Family modifier\n" | |
6196 | "Address Family modifier\n" | |
e0bce756 | 6197 | BGP_SOFT_OUT_STR) |
718e3744 | 6198 | |
6199 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, | |
6200 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
6201 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", | |
6202 | CLEAR_STR | |
6203 | IP_STR | |
6204 | BGP_STR | |
6205 | "BGP neighbor address to clear\n" | |
6206 | "Address family\n" | |
6207 | "Address Family Modifier\n" | |
e0bce756 DS |
6208 | BGP_SOFT_STR |
6209 | BGP_SOFT_OUT_STR) | |
718e3744 | 6210 | { |
6211 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6212 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6213 | } | |
6214 | ||
6215 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
6216 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
6217 | "clear ip bgp A.B.C.D vpnv4 unicast out", | |
6218 | CLEAR_STR | |
6219 | IP_STR | |
6220 | BGP_STR | |
6221 | "BGP neighbor address to clear\n" | |
6222 | "Address family\n" | |
6223 | "Address Family Modifier\n" | |
e0bce756 | 6224 | BGP_SOFT_OUT_STR) |
718e3744 | 6225 | |
6226 | DEFUN (clear_bgp_peer_soft_out, | |
6227 | clear_bgp_peer_soft_out_cmd, | |
a80beece | 6228 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6229 | CLEAR_STR |
6230 | BGP_STR | |
6231 | "BGP neighbor address to clear\n" | |
6232 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6233 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6234 | BGP_SOFT_STR |
6235 | BGP_SOFT_OUT_STR) | |
718e3744 | 6236 | { |
6237 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6238 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6239 | } | |
6240 | ||
6241 | ALIAS (clear_bgp_peer_soft_out, | |
6242 | clear_bgp_ipv6_peer_soft_out_cmd, | |
a80beece | 6243 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 6244 | CLEAR_STR |
6245 | BGP_STR | |
6246 | "Address family\n" | |
6247 | "BGP neighbor address to clear\n" | |
6248 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6249 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6250 | BGP_SOFT_STR |
6251 | BGP_SOFT_OUT_STR) | |
718e3744 | 6252 | |
6253 | ALIAS (clear_bgp_peer_soft_out, | |
6254 | clear_bgp_peer_out_cmd, | |
a80beece | 6255 | "clear bgp (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 6256 | CLEAR_STR |
6257 | BGP_STR | |
6258 | "BGP neighbor address to clear\n" | |
6259 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6260 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6261 | BGP_SOFT_OUT_STR) |
718e3744 | 6262 | |
6263 | ALIAS (clear_bgp_peer_soft_out, | |
6264 | clear_bgp_ipv6_peer_out_cmd, | |
a80beece | 6265 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 6266 | CLEAR_STR |
6267 | BGP_STR | |
6268 | "Address family\n" | |
6269 | "BGP neighbor address to clear\n" | |
6270 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6271 | "BGP neighbor on interface to clear\n" |
e0bce756 | 6272 | BGP_SOFT_OUT_STR) |
718e3744 | 6273 | |
6274 | DEFUN (clear_ip_bgp_peer_group_soft_out, | |
6275 | clear_ip_bgp_peer_group_soft_out_cmd, | |
6276 | "clear ip bgp peer-group WORD soft out", | |
6277 | CLEAR_STR | |
6278 | IP_STR | |
6279 | BGP_STR | |
6280 | "Clear all members of peer-group\n" | |
6281 | "BGP peer-group name\n" | |
e0bce756 DS |
6282 | BGP_SOFT_STR |
6283 | BGP_SOFT_OUT_STR) | |
718e3744 | 6284 | { |
6285 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6286 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6287 | } | |
6288 | ||
6289 | ALIAS (clear_ip_bgp_peer_group_soft_out, | |
6290 | clear_ip_bgp_peer_group_out_cmd, | |
6291 | "clear ip bgp peer-group WORD out", | |
6292 | CLEAR_STR | |
6293 | IP_STR | |
6294 | BGP_STR | |
6295 | "Clear all members of peer-group\n" | |
6296 | "BGP peer-group name\n" | |
e0bce756 | 6297 | BGP_SOFT_OUT_STR) |
718e3744 | 6298 | |
6299 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, | |
6300 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
6301 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
6302 | CLEAR_STR | |
6303 | IP_STR | |
6304 | BGP_STR | |
6305 | "Clear all members of peer-group\n" | |
6306 | "BGP peer-group name\n" | |
6307 | "Address family\n" | |
6308 | "Address Family modifier\n" | |
6309 | "Address Family modifier\n" | |
e0bce756 DS |
6310 | BGP_SOFT_STR |
6311 | BGP_SOFT_OUT_STR) | |
718e3744 | 6312 | { |
6313 | if (strncmp (argv[1], "m", 1) == 0) | |
6314 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6315 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6316 | ||
6317 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6318 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6319 | } | |
6320 | ||
6321 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, | |
6322 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
6323 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
6324 | CLEAR_STR | |
6325 | IP_STR | |
6326 | BGP_STR | |
6327 | "Clear all members of peer-group\n" | |
6328 | "BGP peer-group name\n" | |
6329 | "Address family\n" | |
6330 | "Address Family modifier\n" | |
6331 | "Address Family modifier\n" | |
e0bce756 | 6332 | BGP_SOFT_OUT_STR) |
718e3744 | 6333 | |
6334 | DEFUN (clear_bgp_peer_group_soft_out, | |
6335 | clear_bgp_peer_group_soft_out_cmd, | |
6336 | "clear bgp peer-group WORD soft out", | |
6337 | CLEAR_STR | |
6338 | BGP_STR | |
6339 | "Clear all members of peer-group\n" | |
6340 | "BGP peer-group name\n" | |
e0bce756 DS |
6341 | BGP_SOFT_STR |
6342 | BGP_SOFT_OUT_STR) | |
718e3744 | 6343 | { |
6344 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6345 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6346 | } | |
6347 | ||
6348 | ALIAS (clear_bgp_peer_group_soft_out, | |
6349 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
6350 | "clear bgp ipv6 peer-group WORD soft out", | |
6351 | CLEAR_STR | |
6352 | BGP_STR | |
6353 | "Address family\n" | |
6354 | "Clear all members of peer-group\n" | |
6355 | "BGP peer-group name\n" | |
e0bce756 DS |
6356 | BGP_SOFT_STR |
6357 | BGP_SOFT_OUT_STR) | |
718e3744 | 6358 | |
6359 | ALIAS (clear_bgp_peer_group_soft_out, | |
6360 | clear_bgp_peer_group_out_cmd, | |
6361 | "clear bgp peer-group WORD out", | |
6362 | CLEAR_STR | |
6363 | BGP_STR | |
6364 | "Clear all members of peer-group\n" | |
6365 | "BGP peer-group name\n" | |
e0bce756 | 6366 | BGP_SOFT_OUT_STR) |
718e3744 | 6367 | |
6368 | ALIAS (clear_bgp_peer_group_soft_out, | |
6369 | clear_bgp_ipv6_peer_group_out_cmd, | |
6370 | "clear bgp ipv6 peer-group WORD out", | |
6371 | CLEAR_STR | |
6372 | BGP_STR | |
6373 | "Address family\n" | |
6374 | "Clear all members of peer-group\n" | |
6375 | "BGP peer-group name\n" | |
e0bce756 | 6376 | BGP_SOFT_OUT_STR) |
718e3744 | 6377 | |
6378 | DEFUN (clear_ip_bgp_external_soft_out, | |
6379 | clear_ip_bgp_external_soft_out_cmd, | |
6380 | "clear ip bgp external soft out", | |
6381 | CLEAR_STR | |
6382 | IP_STR | |
6383 | BGP_STR | |
6384 | "Clear all external peers\n" | |
e0bce756 DS |
6385 | BGP_SOFT_STR |
6386 | BGP_SOFT_OUT_STR) | |
718e3744 | 6387 | { |
6388 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6389 | BGP_CLEAR_SOFT_OUT, NULL); | |
6390 | } | |
6391 | ||
6392 | ALIAS (clear_ip_bgp_external_soft_out, | |
6393 | clear_ip_bgp_external_out_cmd, | |
6394 | "clear ip bgp external out", | |
6395 | CLEAR_STR | |
6396 | IP_STR | |
6397 | BGP_STR | |
6398 | "Clear all external peers\n" | |
e0bce756 | 6399 | BGP_SOFT_OUT_STR) |
718e3744 | 6400 | |
6401 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
6402 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
6403 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
6404 | CLEAR_STR | |
6405 | IP_STR | |
6406 | BGP_STR | |
6407 | "Clear all external peers\n" | |
6408 | "Address family\n" | |
6409 | "Address Family modifier\n" | |
6410 | "Address Family modifier\n" | |
e0bce756 DS |
6411 | BGP_SOFT_STR |
6412 | BGP_SOFT_OUT_STR) | |
718e3744 | 6413 | { |
6414 | if (strncmp (argv[0], "m", 1) == 0) | |
6415 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6416 | BGP_CLEAR_SOFT_OUT, NULL); | |
6417 | ||
6418 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6419 | BGP_CLEAR_SOFT_OUT, NULL); | |
6420 | } | |
6421 | ||
6422 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, | |
6423 | clear_ip_bgp_external_ipv4_out_cmd, | |
6424 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
6425 | CLEAR_STR | |
6426 | IP_STR | |
6427 | BGP_STR | |
6428 | "Clear all external peers\n" | |
6429 | "Address family\n" | |
6430 | "Address Family modifier\n" | |
6431 | "Address Family modifier\n" | |
e0bce756 | 6432 | BGP_SOFT_OUT_STR) |
718e3744 | 6433 | |
6434 | DEFUN (clear_bgp_external_soft_out, | |
6435 | clear_bgp_external_soft_out_cmd, | |
6436 | "clear bgp external soft out", | |
6437 | CLEAR_STR | |
6438 | BGP_STR | |
6439 | "Clear all external peers\n" | |
e0bce756 DS |
6440 | BGP_SOFT_STR |
6441 | BGP_SOFT_OUT_STR) | |
718e3744 | 6442 | { |
6443 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6444 | BGP_CLEAR_SOFT_OUT, NULL); | |
6445 | } | |
6446 | ||
6447 | ALIAS (clear_bgp_external_soft_out, | |
6448 | clear_bgp_ipv6_external_soft_out_cmd, | |
6449 | "clear bgp ipv6 external soft out", | |
6450 | CLEAR_STR | |
6451 | BGP_STR | |
6452 | "Address family\n" | |
6453 | "Clear all external peers\n" | |
e0bce756 DS |
6454 | BGP_SOFT_STR |
6455 | BGP_SOFT_OUT_STR) | |
718e3744 | 6456 | |
6457 | ALIAS (clear_bgp_external_soft_out, | |
6458 | clear_bgp_external_out_cmd, | |
6459 | "clear bgp external out", | |
6460 | CLEAR_STR | |
6461 | BGP_STR | |
6462 | "Clear all external peers\n" | |
e0bce756 | 6463 | BGP_SOFT_OUT_STR) |
718e3744 | 6464 | |
6465 | ALIAS (clear_bgp_external_soft_out, | |
6466 | clear_bgp_ipv6_external_out_cmd, | |
6467 | "clear bgp ipv6 external WORD out", | |
6468 | CLEAR_STR | |
6469 | BGP_STR | |
6470 | "Address family\n" | |
6471 | "Clear all external peers\n" | |
e0bce756 | 6472 | BGP_SOFT_OUT_STR) |
718e3744 | 6473 | |
6474 | DEFUN (clear_ip_bgp_as_soft_out, | |
6475 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 6476 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 6477 | CLEAR_STR |
6478 | IP_STR | |
6479 | BGP_STR | |
6480 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6481 | BGP_SOFT_STR |
6482 | BGP_SOFT_OUT_STR) | |
718e3744 | 6483 | { |
6484 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6485 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6486 | } | |
6487 | ||
6488 | ALIAS (clear_ip_bgp_as_soft_out, | |
6489 | clear_ip_bgp_as_out_cmd, | |
320da874 | 6490 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 6491 | CLEAR_STR |
6492 | IP_STR | |
6493 | BGP_STR | |
6494 | "Clear peers with the AS number\n" | |
e0bce756 | 6495 | BGP_SOFT_OUT_STR) |
718e3744 | 6496 | |
6497 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, | |
6498 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 6499 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 6500 | CLEAR_STR |
6501 | IP_STR | |
6502 | BGP_STR | |
6503 | "Clear peers with the AS number\n" | |
6504 | "Address family\n" | |
6505 | "Address Family modifier\n" | |
6506 | "Address Family modifier\n" | |
e0bce756 DS |
6507 | BGP_SOFT_STR |
6508 | BGP_SOFT_OUT_STR) | |
718e3744 | 6509 | { |
6510 | if (strncmp (argv[1], "m", 1) == 0) | |
6511 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6512 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6513 | ||
6514 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6515 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6516 | } | |
6517 | ||
6518 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, | |
6519 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 6520 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 6521 | CLEAR_STR |
6522 | IP_STR | |
6523 | BGP_STR | |
6524 | "Clear peers with the AS number\n" | |
6525 | "Address family\n" | |
6526 | "Address Family modifier\n" | |
6527 | "Address Family modifier\n" | |
e0bce756 | 6528 | BGP_SOFT_OUT_STR) |
718e3744 | 6529 | |
6530 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, | |
6531 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 6532 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 6533 | CLEAR_STR |
6534 | IP_STR | |
6535 | BGP_STR | |
6536 | "Clear peers with the AS number\n" | |
6537 | "Address family\n" | |
6538 | "Address Family modifier\n" | |
e0bce756 DS |
6539 | BGP_SOFT_STR |
6540 | BGP_SOFT_OUT_STR) | |
718e3744 | 6541 | { |
6542 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
6543 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6544 | } | |
6545 | ||
6546 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
6547 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 6548 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 6549 | CLEAR_STR |
6550 | IP_STR | |
6551 | BGP_STR | |
6552 | "Clear peers with the AS number\n" | |
6553 | "Address family\n" | |
6554 | "Address Family modifier\n" | |
e0bce756 | 6555 | BGP_SOFT_OUT_STR) |
718e3744 | 6556 | |
6557 | DEFUN (clear_bgp_as_soft_out, | |
6558 | clear_bgp_as_soft_out_cmd, | |
320da874 | 6559 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 6560 | CLEAR_STR |
6561 | BGP_STR | |
6562 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6563 | BGP_SOFT_STR |
6564 | BGP_SOFT_OUT_STR) | |
718e3744 | 6565 | { |
6566 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6567 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
6568 | } | |
6569 | ||
6570 | ALIAS (clear_bgp_as_soft_out, | |
6571 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 6572 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 6573 | CLEAR_STR |
6574 | BGP_STR | |
6575 | "Address family\n" | |
6576 | "Clear peers with the AS number\n" | |
e0bce756 DS |
6577 | BGP_SOFT_STR |
6578 | BGP_SOFT_OUT_STR) | |
718e3744 | 6579 | |
6580 | ALIAS (clear_bgp_as_soft_out, | |
6581 | clear_bgp_as_out_cmd, | |
320da874 | 6582 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 6583 | CLEAR_STR |
6584 | BGP_STR | |
6585 | "Clear peers with the AS number\n" | |
e0bce756 | 6586 | BGP_SOFT_OUT_STR) |
718e3744 | 6587 | |
6588 | ALIAS (clear_bgp_as_soft_out, | |
6589 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 6590 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 6591 | CLEAR_STR |
6592 | BGP_STR | |
6593 | "Address family\n" | |
6594 | "Clear peers with the AS number\n" | |
e0bce756 | 6595 | BGP_SOFT_OUT_STR) |
6b0655a2 | 6596 | |
718e3744 | 6597 | /* Inbound soft-reconfiguration */ |
6598 | DEFUN (clear_ip_bgp_all_soft_in, | |
6599 | clear_ip_bgp_all_soft_in_cmd, | |
6600 | "clear ip bgp * soft in", | |
6601 | CLEAR_STR | |
6602 | IP_STR | |
6603 | BGP_STR | |
6604 | "Clear all peers\n" | |
e0bce756 DS |
6605 | BGP_SOFT_STR |
6606 | BGP_SOFT_IN_STR) | |
718e3744 | 6607 | { |
6608 | if (argc == 1) | |
6609 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6610 | BGP_CLEAR_SOFT_IN, NULL); | |
6611 | ||
6612 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6613 | BGP_CLEAR_SOFT_IN, NULL); | |
6614 | } | |
6615 | ||
6616 | ALIAS (clear_ip_bgp_all_soft_in, | |
6617 | clear_ip_bgp_instance_all_soft_in_cmd, | |
6618 | "clear ip bgp view WORD * soft in", | |
6619 | CLEAR_STR | |
6620 | IP_STR | |
6621 | BGP_STR | |
6622 | "BGP view\n" | |
6623 | "view name\n" | |
6624 | "Clear all peers\n" | |
e0bce756 DS |
6625 | BGP_SOFT_STR |
6626 | BGP_SOFT_IN_STR) | |
718e3744 | 6627 | |
6628 | ALIAS (clear_ip_bgp_all_soft_in, | |
6629 | clear_ip_bgp_all_in_cmd, | |
6630 | "clear ip bgp * in", | |
6631 | CLEAR_STR | |
6632 | IP_STR | |
6633 | BGP_STR | |
6634 | "Clear all peers\n" | |
e0bce756 | 6635 | BGP_SOFT_IN_STR) |
718e3744 | 6636 | |
6637 | DEFUN (clear_ip_bgp_all_in_prefix_filter, | |
6638 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
6639 | "clear ip bgp * in prefix-filter", | |
6640 | CLEAR_STR | |
6641 | IP_STR | |
6642 | BGP_STR | |
6643 | "Clear all peers\n" | |
e0bce756 | 6644 | BGP_SOFT_IN_STR |
718e3744 | 6645 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6646 | { | |
6647 | if (argc== 1) | |
6648 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6649 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6650 | ||
6651 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6652 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6653 | } | |
6654 | ||
6655 | ALIAS (clear_ip_bgp_all_in_prefix_filter, | |
6656 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, | |
6657 | "clear ip bgp view WORD * in prefix-filter", | |
6658 | CLEAR_STR | |
6659 | IP_STR | |
6660 | BGP_STR | |
6661 | "BGP view\n" | |
6662 | "view name\n" | |
6663 | "Clear all peers\n" | |
e0bce756 | 6664 | BGP_SOFT_IN_STR |
718e3744 | 6665 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6666 | ||
6667 | ||
6668 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, | |
6669 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
6670 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
6671 | CLEAR_STR | |
6672 | IP_STR | |
6673 | BGP_STR | |
6674 | "Clear all peers\n" | |
6675 | "Address family\n" | |
6676 | "Address Family modifier\n" | |
6677 | "Address Family modifier\n" | |
e0bce756 DS |
6678 | BGP_SOFT_STR |
6679 | BGP_SOFT_IN_STR) | |
718e3744 | 6680 | { |
6681 | if (strncmp (argv[0], "m", 1) == 0) | |
6682 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6683 | BGP_CLEAR_SOFT_IN, NULL); | |
6684 | ||
6685 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6686 | BGP_CLEAR_SOFT_IN, NULL); | |
6687 | } | |
6688 | ||
6689 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, | |
6690 | clear_ip_bgp_all_ipv4_in_cmd, | |
6691 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
6692 | CLEAR_STR | |
6693 | IP_STR | |
6694 | BGP_STR | |
6695 | "Clear all peers\n" | |
6696 | "Address family\n" | |
6697 | "Address Family modifier\n" | |
6698 | "Address Family modifier\n" | |
e0bce756 | 6699 | BGP_SOFT_IN_STR) |
718e3744 | 6700 | |
6701 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, | |
6702 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
6703 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", | |
6704 | CLEAR_STR | |
6705 | IP_STR | |
6706 | BGP_STR | |
6707 | "BGP view\n" | |
6708 | "view name\n" | |
6709 | "Clear all peers\n" | |
6710 | "Address family\n" | |
6711 | "Address Family modifier\n" | |
6712 | "Address Family modifier\n" | |
e0bce756 DS |
6713 | BGP_SOFT_STR |
6714 | BGP_SOFT_IN_STR) | |
718e3744 | 6715 | { |
6716 | if (strncmp (argv[1], "m", 1) == 0) | |
6717 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6718 | BGP_CLEAR_SOFT_IN, NULL); | |
6719 | ||
6720 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6721 | BGP_CLEAR_SOFT_IN, NULL); | |
6722 | } | |
6723 | ||
6724 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, | |
6725 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
6726 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
6727 | CLEAR_STR | |
6728 | IP_STR | |
6729 | BGP_STR | |
6730 | "Clear all peers\n" | |
6731 | "Address family\n" | |
6732 | "Address Family modifier\n" | |
6733 | "Address Family modifier\n" | |
e0bce756 | 6734 | BGP_SOFT_IN_STR |
718e3744 | 6735 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6736 | { | |
6737 | if (strncmp (argv[0], "m", 1) == 0) | |
6738 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6739 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6740 | ||
6741 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6742 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6743 | } | |
6744 | ||
6745 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, | |
6746 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, | |
6747 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", | |
6748 | CLEAR_STR | |
6749 | IP_STR | |
6750 | BGP_STR | |
6751 | "Clear all peers\n" | |
6752 | "Address family\n" | |
6753 | "Address Family modifier\n" | |
6754 | "Address Family modifier\n" | |
e0bce756 | 6755 | BGP_SOFT_IN_STR |
718e3744 | 6756 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6757 | { | |
6758 | if (strncmp (argv[1], "m", 1) == 0) | |
6759 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
6760 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6761 | ||
6762 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6763 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6764 | } | |
6765 | ||
6766 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
6767 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
6768 | "clear ip bgp * vpnv4 unicast soft in", | |
6769 | CLEAR_STR | |
6770 | IP_STR | |
6771 | BGP_STR | |
6772 | "Clear all peers\n" | |
6773 | "Address family\n" | |
6774 | "Address Family Modifier\n" | |
e0bce756 DS |
6775 | BGP_SOFT_STR |
6776 | BGP_SOFT_IN_STR) | |
718e3744 | 6777 | { |
6778 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6779 | BGP_CLEAR_SOFT_IN, NULL); | |
6780 | } | |
6781 | ||
6782 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
6783 | clear_ip_bgp_all_vpnv4_in_cmd, | |
6784 | "clear ip bgp * vpnv4 unicast in", | |
6785 | CLEAR_STR | |
6786 | IP_STR | |
6787 | BGP_STR | |
6788 | "Clear all peers\n" | |
6789 | "Address family\n" | |
6790 | "Address Family Modifier\n" | |
e0bce756 | 6791 | BGP_SOFT_IN_STR) |
718e3744 | 6792 | |
6793 | DEFUN (clear_bgp_all_soft_in, | |
6794 | clear_bgp_all_soft_in_cmd, | |
6795 | "clear bgp * soft in", | |
6796 | CLEAR_STR | |
6797 | BGP_STR | |
6798 | "Clear all peers\n" | |
e0bce756 DS |
6799 | BGP_SOFT_STR |
6800 | BGP_SOFT_IN_STR) | |
718e3744 | 6801 | { |
6802 | if (argc == 1) | |
6803 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6804 | BGP_CLEAR_SOFT_IN, NULL); | |
6805 | ||
6806 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6807 | BGP_CLEAR_SOFT_IN, NULL); | |
6808 | } | |
6809 | ||
6810 | ALIAS (clear_bgp_all_soft_in, | |
6811 | clear_bgp_instance_all_soft_in_cmd, | |
6812 | "clear bgp view WORD * soft in", | |
6813 | CLEAR_STR | |
6814 | BGP_STR | |
6815 | "BGP view\n" | |
6816 | "view name\n" | |
6817 | "Clear all peers\n" | |
e0bce756 DS |
6818 | BGP_SOFT_STR |
6819 | BGP_SOFT_IN_STR) | |
718e3744 | 6820 | |
6821 | ALIAS (clear_bgp_all_soft_in, | |
6822 | clear_bgp_ipv6_all_soft_in_cmd, | |
6823 | "clear bgp ipv6 * soft in", | |
6824 | CLEAR_STR | |
6825 | BGP_STR | |
6826 | "Address family\n" | |
6827 | "Clear all peers\n" | |
e0bce756 DS |
6828 | BGP_SOFT_STR |
6829 | BGP_SOFT_IN_STR) | |
718e3744 | 6830 | |
6831 | ALIAS (clear_bgp_all_soft_in, | |
6832 | clear_bgp_all_in_cmd, | |
6833 | "clear bgp * in", | |
6834 | CLEAR_STR | |
6835 | BGP_STR | |
6836 | "Clear all peers\n" | |
e0bce756 | 6837 | BGP_SOFT_IN_STR) |
718e3744 | 6838 | |
6839 | ALIAS (clear_bgp_all_soft_in, | |
6840 | clear_bgp_ipv6_all_in_cmd, | |
6841 | "clear bgp ipv6 * in", | |
6842 | CLEAR_STR | |
6843 | BGP_STR | |
6844 | "Address family\n" | |
6845 | "Clear all peers\n" | |
e0bce756 | 6846 | BGP_SOFT_IN_STR) |
718e3744 | 6847 | |
6848 | DEFUN (clear_bgp_all_in_prefix_filter, | |
6849 | clear_bgp_all_in_prefix_filter_cmd, | |
6850 | "clear bgp * in prefix-filter", | |
6851 | CLEAR_STR | |
6852 | BGP_STR | |
6853 | "Clear all peers\n" | |
e0bce756 | 6854 | BGP_SOFT_IN_STR |
718e3744 | 6855 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6856 | { | |
6857 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6858 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6859 | } | |
6860 | ||
6861 | ALIAS (clear_bgp_all_in_prefix_filter, | |
6862 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
6863 | "clear bgp ipv6 * in prefix-filter", | |
6864 | CLEAR_STR | |
6865 | BGP_STR | |
6866 | "Address family\n" | |
6867 | "Clear all peers\n" | |
e0bce756 | 6868 | BGP_SOFT_IN_STR |
718e3744 | 6869 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6870 | ||
6871 | DEFUN (clear_ip_bgp_peer_soft_in, | |
6872 | clear_ip_bgp_peer_soft_in_cmd, | |
6873 | "clear ip bgp A.B.C.D soft in", | |
6874 | CLEAR_STR | |
6875 | IP_STR | |
6876 | BGP_STR | |
6877 | "BGP neighbor address to clear\n" | |
e0bce756 DS |
6878 | BGP_SOFT_STR |
6879 | BGP_SOFT_IN_STR) | |
718e3744 | 6880 | { |
6881 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6882 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6883 | } | |
6884 | ||
6885 | ALIAS (clear_ip_bgp_peer_soft_in, | |
6886 | clear_ip_bgp_peer_in_cmd, | |
6887 | "clear ip bgp A.B.C.D in", | |
6888 | CLEAR_STR | |
6889 | IP_STR | |
6890 | BGP_STR | |
6891 | "BGP neighbor address to clear\n" | |
e0bce756 | 6892 | BGP_SOFT_IN_STR) |
718e3744 | 6893 | |
6894 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, | |
6895 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
6896 | "clear ip bgp A.B.C.D in prefix-filter", | |
6897 | CLEAR_STR | |
6898 | IP_STR | |
6899 | BGP_STR | |
6900 | "BGP neighbor address to clear\n" | |
e0bce756 | 6901 | BGP_SOFT_IN_STR |
718e3744 | 6902 | "Push out the existing ORF prefix-list\n") |
6903 | { | |
6904 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6905 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6906 | } | |
6907 | ||
6908 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
6909 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
6910 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", | |
6911 | CLEAR_STR | |
6912 | IP_STR | |
6913 | BGP_STR | |
6914 | "BGP neighbor address to clear\n" | |
6915 | "Address family\n" | |
6916 | "Address Family modifier\n" | |
6917 | "Address Family modifier\n" | |
e0bce756 DS |
6918 | BGP_SOFT_STR |
6919 | BGP_SOFT_IN_STR) | |
718e3744 | 6920 | { |
6921 | if (strncmp (argv[1], "m", 1) == 0) | |
6922 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6923 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6924 | ||
6925 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6926 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6927 | } | |
6928 | ||
6929 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, | |
6930 | clear_ip_bgp_peer_ipv4_in_cmd, | |
6931 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", | |
6932 | CLEAR_STR | |
6933 | IP_STR | |
6934 | BGP_STR | |
6935 | "BGP neighbor address to clear\n" | |
6936 | "Address family\n" | |
6937 | "Address Family modifier\n" | |
6938 | "Address Family modifier\n" | |
e0bce756 | 6939 | BGP_SOFT_IN_STR) |
718e3744 | 6940 | |
6941 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, | |
6942 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
6943 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", | |
6944 | CLEAR_STR | |
6945 | IP_STR | |
6946 | BGP_STR | |
6947 | "BGP neighbor address to clear\n" | |
6948 | "Address family\n" | |
6949 | "Address Family modifier\n" | |
6950 | "Address Family modifier\n" | |
e0bce756 | 6951 | BGP_SOFT_IN_STR |
718e3744 | 6952 | "Push out the existing ORF prefix-list\n") |
6953 | { | |
6954 | if (strncmp (argv[1], "m", 1) == 0) | |
6955 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6956 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6957 | ||
6958 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6959 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6960 | } | |
6961 | ||
6962 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
6963 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
6964 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", | |
6965 | CLEAR_STR | |
6966 | IP_STR | |
6967 | BGP_STR | |
6968 | "BGP neighbor address to clear\n" | |
6969 | "Address family\n" | |
6970 | "Address Family Modifier\n" | |
e0bce756 DS |
6971 | BGP_SOFT_STR |
6972 | BGP_SOFT_IN_STR) | |
718e3744 | 6973 | { |
6974 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6975 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6976 | } | |
6977 | ||
6978 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
6979 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
6980 | "clear ip bgp A.B.C.D vpnv4 unicast in", | |
6981 | CLEAR_STR | |
6982 | IP_STR | |
6983 | BGP_STR | |
6984 | "BGP neighbor address to clear\n" | |
6985 | "Address family\n" | |
6986 | "Address Family Modifier\n" | |
e0bce756 | 6987 | BGP_SOFT_IN_STR) |
718e3744 | 6988 | |
6989 | DEFUN (clear_bgp_peer_soft_in, | |
6990 | clear_bgp_peer_soft_in_cmd, | |
a80beece | 6991 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 6992 | CLEAR_STR |
6993 | BGP_STR | |
6994 | "BGP neighbor address to clear\n" | |
6995 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6996 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
6997 | BGP_SOFT_STR |
6998 | BGP_SOFT_IN_STR) | |
718e3744 | 6999 | { |
7000 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7001 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7002 | } | |
7003 | ||
7004 | ALIAS (clear_bgp_peer_soft_in, | |
7005 | clear_bgp_ipv6_peer_soft_in_cmd, | |
a80beece | 7006 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 7007 | CLEAR_STR |
7008 | BGP_STR | |
7009 | "Address family\n" | |
7010 | "BGP neighbor address to clear\n" | |
7011 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7012 | "BGP neighbor on interface to clear\n" |
e0bce756 DS |
7013 | BGP_SOFT_STR |
7014 | BGP_SOFT_IN_STR) | |
718e3744 | 7015 | |
7016 | ALIAS (clear_bgp_peer_soft_in, | |
7017 | clear_bgp_peer_in_cmd, | |
a80beece | 7018 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 7019 | CLEAR_STR |
7020 | BGP_STR | |
7021 | "BGP neighbor address to clear\n" | |
7022 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7023 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7024 | BGP_SOFT_IN_STR) |
718e3744 | 7025 | |
7026 | ALIAS (clear_bgp_peer_soft_in, | |
7027 | clear_bgp_ipv6_peer_in_cmd, | |
a80beece | 7028 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 7029 | CLEAR_STR |
7030 | BGP_STR | |
7031 | "Address family\n" | |
7032 | "BGP neighbor address to clear\n" | |
7033 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7034 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7035 | BGP_SOFT_IN_STR) |
718e3744 | 7036 | |
7037 | DEFUN (clear_bgp_peer_in_prefix_filter, | |
7038 | clear_bgp_peer_in_prefix_filter_cmd, | |
a80beece | 7039 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 7040 | CLEAR_STR |
7041 | BGP_STR | |
7042 | "BGP neighbor address to clear\n" | |
7043 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7044 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7045 | BGP_SOFT_IN_STR |
718e3744 | 7046 | "Push out the existing ORF prefix-list\n") |
7047 | { | |
7048 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7049 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7050 | } | |
7051 | ||
7052 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
7053 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
a80beece | 7054 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 7055 | CLEAR_STR |
7056 | BGP_STR | |
7057 | "Address family\n" | |
7058 | "BGP neighbor address to clear\n" | |
7059 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7060 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7061 | BGP_SOFT_IN_STR |
718e3744 | 7062 | "Push out the existing ORF prefix-list\n") |
7063 | ||
7064 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
7065 | clear_ip_bgp_peer_group_soft_in_cmd, | |
7066 | "clear ip bgp peer-group WORD soft in", | |
7067 | CLEAR_STR | |
7068 | IP_STR | |
7069 | BGP_STR | |
7070 | "Clear all members of peer-group\n" | |
7071 | "BGP peer-group name\n" | |
e0bce756 DS |
7072 | BGP_SOFT_STR |
7073 | BGP_SOFT_IN_STR) | |
718e3744 | 7074 | { |
7075 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7076 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7077 | } | |
7078 | ||
7079 | ALIAS (clear_ip_bgp_peer_group_soft_in, | |
7080 | clear_ip_bgp_peer_group_in_cmd, | |
7081 | "clear ip bgp peer-group WORD in", | |
7082 | CLEAR_STR | |
7083 | IP_STR | |
7084 | BGP_STR | |
7085 | "Clear all members of peer-group\n" | |
7086 | "BGP peer-group name\n" | |
e0bce756 | 7087 | BGP_SOFT_IN_STR) |
718e3744 | 7088 | |
7089 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, | |
7090 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
7091 | "clear ip bgp peer-group WORD in prefix-filter", | |
7092 | CLEAR_STR | |
7093 | IP_STR | |
7094 | BGP_STR | |
7095 | "Clear all members of peer-group\n" | |
7096 | "BGP peer-group name\n" | |
e0bce756 | 7097 | BGP_SOFT_IN_STR |
718e3744 | 7098 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7099 | { | |
7100 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7101 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7102 | } | |
7103 | ||
7104 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
7105 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
7106 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
7107 | CLEAR_STR | |
7108 | IP_STR | |
7109 | BGP_STR | |
7110 | "Clear all members of peer-group\n" | |
7111 | "BGP peer-group name\n" | |
7112 | "Address family\n" | |
7113 | "Address Family modifier\n" | |
7114 | "Address Family modifier\n" | |
e0bce756 DS |
7115 | BGP_SOFT_STR |
7116 | BGP_SOFT_IN_STR) | |
718e3744 | 7117 | { |
7118 | if (strncmp (argv[1], "m", 1) == 0) | |
7119 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7120 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7121 | ||
7122 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7123 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7124 | } | |
7125 | ||
7126 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, | |
7127 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
7128 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
7129 | CLEAR_STR | |
7130 | IP_STR | |
7131 | BGP_STR | |
7132 | "Clear all members of peer-group\n" | |
7133 | "BGP peer-group name\n" | |
7134 | "Address family\n" | |
7135 | "Address Family modifier\n" | |
7136 | "Address Family modifier\n" | |
e0bce756 | 7137 | BGP_SOFT_IN_STR) |
718e3744 | 7138 | |
7139 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, | |
7140 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
7141 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
7142 | CLEAR_STR | |
7143 | IP_STR | |
7144 | BGP_STR | |
7145 | "Clear all members of peer-group\n" | |
7146 | "BGP peer-group name\n" | |
7147 | "Address family\n" | |
7148 | "Address Family modifier\n" | |
7149 | "Address Family modifier\n" | |
e0bce756 | 7150 | BGP_SOFT_IN_STR |
718e3744 | 7151 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7152 | { | |
7153 | if (strncmp (argv[1], "m", 1) == 0) | |
7154 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7155 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7156 | ||
7157 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7158 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7159 | } | |
7160 | ||
7161 | DEFUN (clear_bgp_peer_group_soft_in, | |
7162 | clear_bgp_peer_group_soft_in_cmd, | |
7163 | "clear bgp peer-group WORD soft in", | |
7164 | CLEAR_STR | |
7165 | BGP_STR | |
7166 | "Clear all members of peer-group\n" | |
7167 | "BGP peer-group name\n" | |
e0bce756 DS |
7168 | BGP_SOFT_STR |
7169 | BGP_SOFT_IN_STR) | |
718e3744 | 7170 | { |
7171 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7172 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7173 | } | |
7174 | ||
7175 | ALIAS (clear_bgp_peer_group_soft_in, | |
7176 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
7177 | "clear bgp ipv6 peer-group WORD soft in", | |
7178 | CLEAR_STR | |
7179 | BGP_STR | |
7180 | "Address family\n" | |
7181 | "Clear all members of peer-group\n" | |
7182 | "BGP peer-group name\n" | |
e0bce756 DS |
7183 | BGP_SOFT_STR |
7184 | BGP_SOFT_IN_STR) | |
718e3744 | 7185 | |
7186 | ALIAS (clear_bgp_peer_group_soft_in, | |
7187 | clear_bgp_peer_group_in_cmd, | |
7188 | "clear bgp peer-group WORD in", | |
7189 | CLEAR_STR | |
7190 | BGP_STR | |
7191 | "Clear all members of peer-group\n" | |
7192 | "BGP peer-group name\n" | |
e0bce756 | 7193 | BGP_SOFT_IN_STR) |
718e3744 | 7194 | |
7195 | ALIAS (clear_bgp_peer_group_soft_in, | |
7196 | clear_bgp_ipv6_peer_group_in_cmd, | |
7197 | "clear bgp ipv6 peer-group WORD in", | |
7198 | CLEAR_STR | |
7199 | BGP_STR | |
7200 | "Address family\n" | |
7201 | "Clear all members of peer-group\n" | |
7202 | "BGP peer-group name\n" | |
e0bce756 | 7203 | BGP_SOFT_IN_STR) |
718e3744 | 7204 | |
7205 | DEFUN (clear_bgp_peer_group_in_prefix_filter, | |
7206 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
7207 | "clear bgp peer-group WORD in prefix-filter", | |
7208 | CLEAR_STR | |
7209 | BGP_STR | |
7210 | "Clear all members of peer-group\n" | |
7211 | "BGP peer-group name\n" | |
e0bce756 | 7212 | BGP_SOFT_IN_STR |
718e3744 | 7213 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7214 | { | |
7215 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7216 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7217 | } | |
7218 | ||
7219 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
7220 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
7221 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
7222 | CLEAR_STR | |
7223 | BGP_STR | |
7224 | "Address family\n" | |
7225 | "Clear all members of peer-group\n" | |
7226 | "BGP peer-group name\n" | |
e0bce756 | 7227 | BGP_SOFT_IN_STR |
718e3744 | 7228 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7229 | ||
7230 | DEFUN (clear_ip_bgp_external_soft_in, | |
7231 | clear_ip_bgp_external_soft_in_cmd, | |
7232 | "clear ip bgp external soft in", | |
7233 | CLEAR_STR | |
7234 | IP_STR | |
7235 | BGP_STR | |
7236 | "Clear all external peers\n" | |
e0bce756 DS |
7237 | BGP_SOFT_STR |
7238 | BGP_SOFT_IN_STR) | |
718e3744 | 7239 | { |
7240 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7241 | BGP_CLEAR_SOFT_IN, NULL); | |
7242 | } | |
7243 | ||
7244 | ALIAS (clear_ip_bgp_external_soft_in, | |
7245 | clear_ip_bgp_external_in_cmd, | |
7246 | "clear ip bgp external in", | |
7247 | CLEAR_STR | |
7248 | IP_STR | |
7249 | BGP_STR | |
7250 | "Clear all external peers\n" | |
e0bce756 | 7251 | BGP_SOFT_IN_STR) |
718e3744 | 7252 | |
7253 | DEFUN (clear_ip_bgp_external_in_prefix_filter, | |
7254 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
7255 | "clear ip bgp external in prefix-filter", | |
7256 | CLEAR_STR | |
7257 | IP_STR | |
7258 | BGP_STR | |
7259 | "Clear all external peers\n" | |
e0bce756 | 7260 | BGP_SOFT_IN_STR |
718e3744 | 7261 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7262 | { | |
7263 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7264 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7265 | } | |
7266 | ||
7267 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
7268 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
7269 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
7270 | CLEAR_STR | |
7271 | IP_STR | |
7272 | BGP_STR | |
7273 | "Clear all external peers\n" | |
7274 | "Address family\n" | |
7275 | "Address Family modifier\n" | |
7276 | "Address Family modifier\n" | |
e0bce756 DS |
7277 | BGP_SOFT_STR |
7278 | BGP_SOFT_IN_STR) | |
718e3744 | 7279 | { |
7280 | if (strncmp (argv[0], "m", 1) == 0) | |
7281 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7282 | BGP_CLEAR_SOFT_IN, NULL); | |
7283 | ||
7284 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7285 | BGP_CLEAR_SOFT_IN, NULL); | |
7286 | } | |
7287 | ||
7288 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, | |
7289 | clear_ip_bgp_external_ipv4_in_cmd, | |
7290 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
7291 | CLEAR_STR | |
7292 | IP_STR | |
7293 | BGP_STR | |
7294 | "Clear all external peers\n" | |
7295 | "Address family\n" | |
7296 | "Address Family modifier\n" | |
7297 | "Address Family modifier\n" | |
e0bce756 | 7298 | BGP_SOFT_IN_STR) |
718e3744 | 7299 | |
7300 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, | |
7301 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
7302 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
7303 | CLEAR_STR | |
7304 | IP_STR | |
7305 | BGP_STR | |
7306 | "Clear all external peers\n" | |
7307 | "Address family\n" | |
7308 | "Address Family modifier\n" | |
7309 | "Address Family modifier\n" | |
e0bce756 | 7310 | BGP_SOFT_IN_STR |
718e3744 | 7311 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7312 | { | |
7313 | if (strncmp (argv[0], "m", 1) == 0) | |
7314 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7315 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7316 | ||
7317 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7318 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7319 | } | |
7320 | ||
7321 | DEFUN (clear_bgp_external_soft_in, | |
7322 | clear_bgp_external_soft_in_cmd, | |
7323 | "clear bgp external soft in", | |
7324 | CLEAR_STR | |
7325 | BGP_STR | |
7326 | "Clear all external peers\n" | |
e0bce756 DS |
7327 | BGP_SOFT_STR |
7328 | BGP_SOFT_IN_STR) | |
718e3744 | 7329 | { |
7330 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7331 | BGP_CLEAR_SOFT_IN, NULL); | |
7332 | } | |
7333 | ||
7334 | ALIAS (clear_bgp_external_soft_in, | |
7335 | clear_bgp_ipv6_external_soft_in_cmd, | |
7336 | "clear bgp ipv6 external soft in", | |
7337 | CLEAR_STR | |
7338 | BGP_STR | |
7339 | "Address family\n" | |
7340 | "Clear all external peers\n" | |
e0bce756 DS |
7341 | BGP_SOFT_STR |
7342 | BGP_SOFT_IN_STR) | |
718e3744 | 7343 | |
7344 | ALIAS (clear_bgp_external_soft_in, | |
7345 | clear_bgp_external_in_cmd, | |
7346 | "clear bgp external in", | |
7347 | CLEAR_STR | |
7348 | BGP_STR | |
7349 | "Clear all external peers\n" | |
e0bce756 | 7350 | BGP_SOFT_IN_STR) |
718e3744 | 7351 | |
7352 | ALIAS (clear_bgp_external_soft_in, | |
7353 | clear_bgp_ipv6_external_in_cmd, | |
7354 | "clear bgp ipv6 external WORD in", | |
7355 | CLEAR_STR | |
7356 | BGP_STR | |
7357 | "Address family\n" | |
7358 | "Clear all external peers\n" | |
e0bce756 | 7359 | BGP_SOFT_IN_STR) |
718e3744 | 7360 | |
7361 | DEFUN (clear_bgp_external_in_prefix_filter, | |
7362 | clear_bgp_external_in_prefix_filter_cmd, | |
7363 | "clear bgp external in prefix-filter", | |
7364 | CLEAR_STR | |
7365 | BGP_STR | |
7366 | "Clear all external peers\n" | |
e0bce756 | 7367 | BGP_SOFT_IN_STR |
718e3744 | 7368 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7369 | { | |
7370 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7371 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
7372 | } | |
7373 | ||
7374 | ALIAS (clear_bgp_external_in_prefix_filter, | |
7375 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
7376 | "clear bgp ipv6 external in prefix-filter", | |
7377 | CLEAR_STR | |
7378 | BGP_STR | |
7379 | "Address family\n" | |
7380 | "Clear all external peers\n" | |
e0bce756 | 7381 | BGP_SOFT_IN_STR |
718e3744 | 7382 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7383 | ||
7384 | DEFUN (clear_ip_bgp_as_soft_in, | |
7385 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 7386 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 7387 | CLEAR_STR |
7388 | IP_STR | |
7389 | BGP_STR | |
7390 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7391 | BGP_SOFT_STR |
7392 | BGP_SOFT_IN_STR) | |
718e3744 | 7393 | { |
7394 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7395 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7396 | } | |
7397 | ||
7398 | ALIAS (clear_ip_bgp_as_soft_in, | |
7399 | clear_ip_bgp_as_in_cmd, | |
320da874 | 7400 | "clear ip bgp " CMD_AS_RANGE " in", |
718e3744 | 7401 | CLEAR_STR |
7402 | IP_STR | |
7403 | BGP_STR | |
7404 | "Clear peers with the AS number\n" | |
e0bce756 | 7405 | BGP_SOFT_IN_STR) |
718e3744 | 7406 | |
7407 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
7408 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 7409 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7410 | CLEAR_STR |
7411 | IP_STR | |
7412 | BGP_STR | |
7413 | "Clear peers with the AS number\n" | |
e0bce756 | 7414 | BGP_SOFT_IN_STR |
718e3744 | 7415 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7416 | { | |
7417 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7418 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7419 | } | |
7420 | ||
7421 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
7422 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 7423 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 7424 | CLEAR_STR |
7425 | IP_STR | |
7426 | BGP_STR | |
7427 | "Clear peers with the AS number\n" | |
7428 | "Address family\n" | |
7429 | "Address Family modifier\n" | |
7430 | "Address Family modifier\n" | |
e0bce756 DS |
7431 | BGP_SOFT_STR |
7432 | BGP_SOFT_IN_STR) | |
718e3744 | 7433 | { |
7434 | if (strncmp (argv[1], "m", 1) == 0) | |
7435 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7436 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7437 | ||
7438 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7439 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7440 | } | |
7441 | ||
7442 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, | |
7443 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 7444 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 7445 | CLEAR_STR |
7446 | IP_STR | |
7447 | BGP_STR | |
7448 | "Clear peers with the AS number\n" | |
7449 | "Address family\n" | |
7450 | "Address Family modifier\n" | |
7451 | "Address Family modifier\n" | |
e0bce756 | 7452 | BGP_SOFT_IN_STR) |
718e3744 | 7453 | |
7454 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, | |
7455 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 7456 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 7457 | CLEAR_STR |
7458 | IP_STR | |
7459 | BGP_STR | |
7460 | "Clear peers with the AS number\n" | |
7461 | "Address family\n" | |
7462 | "Address Family modifier\n" | |
7463 | "Address Family modifier\n" | |
e0bce756 | 7464 | BGP_SOFT_IN_STR |
718e3744 | 7465 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7466 | { | |
7467 | if (strncmp (argv[1], "m", 1) == 0) | |
7468 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7469 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7470 | ||
7471 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7472 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7473 | } | |
7474 | ||
7475 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
7476 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 7477 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 7478 | CLEAR_STR |
7479 | IP_STR | |
7480 | BGP_STR | |
7481 | "Clear peers with the AS number\n" | |
7482 | "Address family\n" | |
7483 | "Address Family modifier\n" | |
e0bce756 DS |
7484 | BGP_SOFT_STR |
7485 | BGP_SOFT_IN_STR) | |
718e3744 | 7486 | { |
7487 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7488 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7489 | } | |
7490 | ||
7491 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
7492 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 7493 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 7494 | CLEAR_STR |
7495 | IP_STR | |
7496 | BGP_STR | |
7497 | "Clear peers with the AS number\n" | |
7498 | "Address family\n" | |
7499 | "Address Family modifier\n" | |
e0bce756 | 7500 | BGP_SOFT_IN_STR) |
718e3744 | 7501 | |
7502 | DEFUN (clear_bgp_as_soft_in, | |
7503 | clear_bgp_as_soft_in_cmd, | |
320da874 | 7504 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 7505 | CLEAR_STR |
7506 | BGP_STR | |
7507 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7508 | BGP_SOFT_STR |
7509 | BGP_SOFT_IN_STR) | |
718e3744 | 7510 | { |
7511 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7512 | BGP_CLEAR_SOFT_IN, argv[0]); | |
7513 | } | |
7514 | ||
7515 | ALIAS (clear_bgp_as_soft_in, | |
7516 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 7517 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 7518 | CLEAR_STR |
7519 | BGP_STR | |
7520 | "Address family\n" | |
7521 | "Clear peers with the AS number\n" | |
e0bce756 DS |
7522 | BGP_SOFT_STR |
7523 | BGP_SOFT_IN_STR) | |
718e3744 | 7524 | |
7525 | ALIAS (clear_bgp_as_soft_in, | |
7526 | clear_bgp_as_in_cmd, | |
320da874 | 7527 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 7528 | CLEAR_STR |
7529 | BGP_STR | |
7530 | "Clear peers with the AS number\n" | |
e0bce756 | 7531 | BGP_SOFT_IN_STR) |
718e3744 | 7532 | |
7533 | ALIAS (clear_bgp_as_soft_in, | |
7534 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 7535 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 7536 | CLEAR_STR |
7537 | BGP_STR | |
7538 | "Address family\n" | |
7539 | "Clear peers with the AS number\n" | |
e0bce756 | 7540 | BGP_SOFT_IN_STR) |
718e3744 | 7541 | |
7542 | DEFUN (clear_bgp_as_in_prefix_filter, | |
7543 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 7544 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7545 | CLEAR_STR |
7546 | BGP_STR | |
7547 | "Clear peers with the AS number\n" | |
e0bce756 | 7548 | BGP_SOFT_IN_STR |
718e3744 | 7549 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
7550 | { | |
7551 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7552 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
7553 | } | |
7554 | ||
7555 | ALIAS (clear_bgp_as_in_prefix_filter, | |
7556 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 7557 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 7558 | CLEAR_STR |
7559 | BGP_STR | |
7560 | "Address family\n" | |
7561 | "Clear peers with the AS number\n" | |
e0bce756 | 7562 | BGP_SOFT_IN_STR |
718e3744 | 7563 | "Push out prefix-list ORF and do inbound soft reconfig\n") |
6b0655a2 | 7564 | |
718e3744 | 7565 | /* Both soft-reconfiguration */ |
7566 | DEFUN (clear_ip_bgp_all_soft, | |
7567 | clear_ip_bgp_all_soft_cmd, | |
7568 | "clear ip bgp * soft", | |
7569 | CLEAR_STR | |
7570 | IP_STR | |
7571 | BGP_STR | |
7572 | "Clear all peers\n" | |
e0bce756 | 7573 | BGP_SOFT_STR) |
718e3744 | 7574 | { |
7575 | if (argc == 1) | |
7576 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
7577 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7578 | ||
7579 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7580 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7581 | } | |
7582 | ||
7583 | ALIAS (clear_ip_bgp_all_soft, | |
7584 | clear_ip_bgp_instance_all_soft_cmd, | |
7585 | "clear ip bgp view WORD * soft", | |
7586 | CLEAR_STR | |
7587 | IP_STR | |
7588 | BGP_STR | |
7589 | "BGP view\n" | |
7590 | "view name\n" | |
7591 | "Clear all peers\n" | |
e0bce756 | 7592 | BGP_SOFT_STR) |
718e3744 | 7593 | |
7594 | ||
7595 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
7596 | clear_ip_bgp_all_ipv4_soft_cmd, | |
7597 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
7598 | CLEAR_STR | |
7599 | IP_STR | |
7600 | BGP_STR | |
7601 | "Clear all peers\n" | |
7602 | "Address family\n" | |
7603 | "Address Family Modifier\n" | |
7604 | "Address Family Modifier\n" | |
e0bce756 | 7605 | BGP_SOFT_STR) |
718e3744 | 7606 | { |
7607 | if (strncmp (argv[0], "m", 1) == 0) | |
7608 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7609 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7610 | ||
7611 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7612 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7613 | } | |
7614 | ||
7615 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
7616 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
7617 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", | |
7618 | CLEAR_STR | |
7619 | IP_STR | |
7620 | BGP_STR | |
7621 | "BGP view\n" | |
7622 | "view name\n" | |
7623 | "Clear all peers\n" | |
7624 | "Address family\n" | |
7625 | "Address Family Modifier\n" | |
7626 | "Address Family Modifier\n" | |
e0bce756 | 7627 | BGP_SOFT_STR) |
718e3744 | 7628 | { |
7629 | if (strncmp (argv[1], "m", 1) == 0) | |
7630 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
7631 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7632 | ||
7633 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
7634 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7635 | } | |
7636 | ||
7637 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
7638 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
7639 | "clear ip bgp * vpnv4 unicast soft", | |
7640 | CLEAR_STR | |
7641 | IP_STR | |
7642 | BGP_STR | |
7643 | "Clear all peers\n" | |
7644 | "Address family\n" | |
7645 | "Address Family Modifier\n" | |
e0bce756 | 7646 | BGP_SOFT_STR) |
718e3744 | 7647 | { |
7648 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
7649 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7650 | } | |
7651 | ||
7652 | DEFUN (clear_bgp_all_soft, | |
7653 | clear_bgp_all_soft_cmd, | |
7654 | "clear bgp * soft", | |
7655 | CLEAR_STR | |
7656 | BGP_STR | |
7657 | "Clear all peers\n" | |
e0bce756 | 7658 | BGP_SOFT_STR) |
718e3744 | 7659 | { |
7660 | if (argc == 1) | |
7661 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
7662 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7663 | ||
7664 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7665 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7666 | } | |
7667 | ||
7668 | ALIAS (clear_bgp_all_soft, | |
7669 | clear_bgp_instance_all_soft_cmd, | |
7670 | "clear bgp view WORD * soft", | |
7671 | CLEAR_STR | |
7672 | BGP_STR | |
7673 | "BGP view\n" | |
7674 | "view name\n" | |
7675 | "Clear all peers\n" | |
e0bce756 | 7676 | BGP_SOFT_STR) |
718e3744 | 7677 | |
7678 | ALIAS (clear_bgp_all_soft, | |
7679 | clear_bgp_ipv6_all_soft_cmd, | |
7680 | "clear bgp ipv6 * soft", | |
7681 | CLEAR_STR | |
7682 | BGP_STR | |
7683 | "Address family\n" | |
7684 | "Clear all peers\n" | |
e0bce756 | 7685 | BGP_SOFT_STR) |
718e3744 | 7686 | |
7687 | DEFUN (clear_ip_bgp_peer_soft, | |
7688 | clear_ip_bgp_peer_soft_cmd, | |
7689 | "clear ip bgp A.B.C.D soft", | |
7690 | CLEAR_STR | |
7691 | IP_STR | |
7692 | BGP_STR | |
7693 | "BGP neighbor address to clear\n" | |
e0bce756 | 7694 | BGP_SOFT_STR) |
718e3744 | 7695 | { |
7696 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7697 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7698 | } | |
7699 | ||
7700 | DEFUN (clear_ip_bgp_peer_ipv4_soft, | |
7701 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
7702 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", | |
7703 | CLEAR_STR | |
7704 | IP_STR | |
7705 | BGP_STR | |
7706 | "BGP neighbor address to clear\n" | |
7707 | "Address family\n" | |
7708 | "Address Family Modifier\n" | |
7709 | "Address Family Modifier\n" | |
e0bce756 | 7710 | BGP_SOFT_STR) |
718e3744 | 7711 | { |
7712 | if (strncmp (argv[1], "m", 1) == 0) | |
7713 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
7714 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7715 | ||
7716 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7717 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7718 | } | |
7719 | ||
7720 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, | |
7721 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
7722 | "clear ip bgp A.B.C.D vpnv4 unicast soft", | |
7723 | CLEAR_STR | |
7724 | IP_STR | |
7725 | BGP_STR | |
7726 | "BGP neighbor address to clear\n" | |
7727 | "Address family\n" | |
7728 | "Address Family Modifier\n" | |
e0bce756 | 7729 | BGP_SOFT_STR) |
718e3744 | 7730 | { |
7731 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
7732 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7733 | } | |
7734 | ||
7735 | DEFUN (clear_bgp_peer_soft, | |
7736 | clear_bgp_peer_soft_cmd, | |
a80beece | 7737 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 7738 | CLEAR_STR |
7739 | BGP_STR | |
7740 | "BGP neighbor address to clear\n" | |
7741 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7742 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7743 | BGP_SOFT_STR) |
718e3744 | 7744 | { |
7745 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7746 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7747 | } | |
7748 | ||
7749 | ALIAS (clear_bgp_peer_soft, | |
7750 | clear_bgp_ipv6_peer_soft_cmd, | |
a80beece | 7751 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 7752 | CLEAR_STR |
7753 | BGP_STR | |
7754 | "Address family\n" | |
7755 | "BGP neighbor address to clear\n" | |
7756 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7757 | "BGP neighbor on interface to clear\n" |
e0bce756 | 7758 | BGP_SOFT_STR) |
718e3744 | 7759 | |
7760 | DEFUN (clear_ip_bgp_peer_group_soft, | |
7761 | clear_ip_bgp_peer_group_soft_cmd, | |
7762 | "clear ip bgp peer-group WORD soft", | |
7763 | CLEAR_STR | |
7764 | IP_STR | |
7765 | BGP_STR | |
7766 | "Clear all members of peer-group\n" | |
7767 | "BGP peer-group name\n" | |
e0bce756 | 7768 | BGP_SOFT_STR) |
718e3744 | 7769 | { |
7770 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7771 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7772 | } | |
7773 | ||
7774 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, | |
7775 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
7776 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
7777 | CLEAR_STR | |
7778 | IP_STR | |
7779 | BGP_STR | |
7780 | "Clear all members of peer-group\n" | |
7781 | "BGP peer-group name\n" | |
7782 | "Address family\n" | |
7783 | "Address Family modifier\n" | |
7784 | "Address Family modifier\n" | |
e0bce756 | 7785 | BGP_SOFT_STR) |
718e3744 | 7786 | { |
7787 | if (strncmp (argv[1], "m", 1) == 0) | |
7788 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
7789 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7790 | ||
7791 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
7792 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7793 | } | |
7794 | ||
7795 | DEFUN (clear_bgp_peer_group_soft, | |
7796 | clear_bgp_peer_group_soft_cmd, | |
7797 | "clear bgp peer-group WORD soft", | |
7798 | CLEAR_STR | |
7799 | BGP_STR | |
7800 | "Clear all members of peer-group\n" | |
7801 | "BGP peer-group name\n" | |
e0bce756 | 7802 | BGP_SOFT_STR) |
718e3744 | 7803 | { |
7804 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
7805 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7806 | } | |
7807 | ||
7808 | ALIAS (clear_bgp_peer_group_soft, | |
7809 | clear_bgp_ipv6_peer_group_soft_cmd, | |
7810 | "clear bgp ipv6 peer-group WORD soft", | |
7811 | CLEAR_STR | |
7812 | BGP_STR | |
7813 | "Address family\n" | |
7814 | "Clear all members of peer-group\n" | |
7815 | "BGP peer-group name\n" | |
e0bce756 | 7816 | BGP_SOFT_STR) |
718e3744 | 7817 | |
7818 | DEFUN (clear_ip_bgp_external_soft, | |
7819 | clear_ip_bgp_external_soft_cmd, | |
7820 | "clear ip bgp external soft", | |
7821 | CLEAR_STR | |
7822 | IP_STR | |
7823 | BGP_STR | |
7824 | "Clear all external peers\n" | |
e0bce756 | 7825 | BGP_SOFT_STR) |
718e3744 | 7826 | { |
7827 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7828 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7829 | } | |
7830 | ||
7831 | DEFUN (clear_ip_bgp_external_ipv4_soft, | |
7832 | clear_ip_bgp_external_ipv4_soft_cmd, | |
7833 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
7834 | CLEAR_STR | |
7835 | IP_STR | |
7836 | BGP_STR | |
7837 | "Clear all external peers\n" | |
7838 | "Address family\n" | |
7839 | "Address Family modifier\n" | |
7840 | "Address Family modifier\n" | |
e0bce756 | 7841 | BGP_SOFT_STR) |
718e3744 | 7842 | { |
7843 | if (strncmp (argv[0], "m", 1) == 0) | |
7844 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
7845 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7846 | ||
7847 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
7848 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7849 | } | |
7850 | ||
7851 | DEFUN (clear_bgp_external_soft, | |
7852 | clear_bgp_external_soft_cmd, | |
7853 | "clear bgp external soft", | |
7854 | CLEAR_STR | |
7855 | BGP_STR | |
7856 | "Clear all external peers\n" | |
e0bce756 | 7857 | BGP_SOFT_STR) |
718e3744 | 7858 | { |
7859 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
7860 | BGP_CLEAR_SOFT_BOTH, NULL); | |
7861 | } | |
7862 | ||
7863 | ALIAS (clear_bgp_external_soft, | |
7864 | clear_bgp_ipv6_external_soft_cmd, | |
7865 | "clear bgp ipv6 external soft", | |
7866 | CLEAR_STR | |
7867 | BGP_STR | |
7868 | "Address family\n" | |
7869 | "Clear all external peers\n" | |
e0bce756 | 7870 | BGP_SOFT_STR) |
718e3744 | 7871 | |
7872 | DEFUN (clear_ip_bgp_as_soft, | |
7873 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 7874 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 7875 | CLEAR_STR |
7876 | IP_STR | |
7877 | BGP_STR | |
7878 | "Clear peers with the AS number\n" | |
e0bce756 | 7879 | BGP_SOFT_STR) |
718e3744 | 7880 | { |
7881 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
7882 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7883 | } | |
7884 | ||
7885 | DEFUN (clear_ip_bgp_as_ipv4_soft, | |
7886 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 7887 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 7888 | CLEAR_STR |
7889 | IP_STR | |
7890 | BGP_STR | |
7891 | "Clear peers with the AS number\n" | |
7892 | "Address family\n" | |
7893 | "Address Family Modifier\n" | |
7894 | "Address Family Modifier\n" | |
e0bce756 | 7895 | BGP_SOFT_STR) |
718e3744 | 7896 | { |
7897 | if (strncmp (argv[1], "m", 1) == 0) | |
7898 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
7899 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7900 | ||
7901 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
7902 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7903 | } | |
7904 | ||
7905 | DEFUN (clear_ip_bgp_as_vpnv4_soft, | |
7906 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 7907 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 7908 | CLEAR_STR |
7909 | IP_STR | |
7910 | BGP_STR | |
7911 | "Clear peers with the AS number\n" | |
7912 | "Address family\n" | |
7913 | "Address Family Modifier\n" | |
e0bce756 | 7914 | BGP_SOFT_STR) |
718e3744 | 7915 | { |
7916 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
7917 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7918 | } | |
7919 | ||
7920 | DEFUN (clear_bgp_as_soft, | |
7921 | clear_bgp_as_soft_cmd, | |
320da874 | 7922 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 7923 | CLEAR_STR |
7924 | BGP_STR | |
7925 | "Clear peers with the AS number\n" | |
e0bce756 | 7926 | BGP_SOFT_STR) |
718e3744 | 7927 | { |
7928 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
7929 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
7930 | } | |
7931 | ||
7932 | ALIAS (clear_bgp_as_soft, | |
7933 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 7934 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 7935 | CLEAR_STR |
7936 | BGP_STR | |
7937 | "Address family\n" | |
7938 | "Clear peers with the AS number\n" | |
e0bce756 | 7939 | BGP_SOFT_STR) |
6b0655a2 | 7940 | |
fee0f4c6 | 7941 | /* RS-client soft reconfiguration. */ |
7942 | #ifdef HAVE_IPV6 | |
7943 | DEFUN (clear_bgp_all_rsclient, | |
7944 | clear_bgp_all_rsclient_cmd, | |
7945 | "clear bgp * rsclient", | |
7946 | CLEAR_STR | |
7947 | BGP_STR | |
7948 | "Clear all peers\n" | |
e0bce756 | 7949 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7950 | { |
7951 | if (argc == 1) | |
7952 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
7953 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
7954 | ||
7955 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
7956 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
7957 | } | |
7958 | ||
7959 | ALIAS (clear_bgp_all_rsclient, | |
7960 | clear_bgp_ipv6_all_rsclient_cmd, | |
7961 | "clear bgp ipv6 * rsclient", | |
7962 | CLEAR_STR | |
7963 | BGP_STR | |
7964 | "Address family\n" | |
7965 | "Clear all peers\n" | |
e0bce756 | 7966 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7967 | |
7968 | ALIAS (clear_bgp_all_rsclient, | |
7969 | clear_bgp_instance_all_rsclient_cmd, | |
7970 | "clear bgp view WORD * rsclient", | |
7971 | CLEAR_STR | |
7972 | BGP_STR | |
7973 | "BGP view\n" | |
7974 | "view name\n" | |
7975 | "Clear all peers\n" | |
e0bce756 | 7976 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7977 | |
7978 | ALIAS (clear_bgp_all_rsclient, | |
7979 | clear_bgp_ipv6_instance_all_rsclient_cmd, | |
7980 | "clear bgp ipv6 view WORD * rsclient", | |
7981 | CLEAR_STR | |
7982 | BGP_STR | |
7983 | "Address family\n" | |
7984 | "BGP view\n" | |
7985 | "view name\n" | |
7986 | "Clear all peers\n" | |
e0bce756 | 7987 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7988 | #endif /* HAVE_IPV6 */ |
7989 | ||
7990 | DEFUN (clear_ip_bgp_all_rsclient, | |
7991 | clear_ip_bgp_all_rsclient_cmd, | |
7992 | "clear ip bgp * rsclient", | |
7993 | CLEAR_STR | |
7994 | IP_STR | |
7995 | BGP_STR | |
7996 | "Clear all peers\n" | |
e0bce756 | 7997 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 7998 | { |
7999 | if (argc == 1) | |
8000 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
8001 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
8002 | ||
8003 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
8004 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
8005 | } | |
8006 | ||
8007 | ALIAS (clear_ip_bgp_all_rsclient, | |
8008 | clear_ip_bgp_instance_all_rsclient_cmd, | |
8009 | "clear ip bgp view WORD * rsclient", | |
8010 | CLEAR_STR | |
8011 | IP_STR | |
8012 | BGP_STR | |
8013 | "BGP view\n" | |
8014 | "view name\n" | |
8015 | "Clear all peers\n" | |
e0bce756 | 8016 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8017 | |
8018 | #ifdef HAVE_IPV6 | |
8019 | DEFUN (clear_bgp_peer_rsclient, | |
8020 | clear_bgp_peer_rsclient_cmd, | |
a80beece | 8021 | "clear bgp (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8022 | CLEAR_STR |
8023 | BGP_STR | |
8024 | "BGP neighbor IP address to clear\n" | |
8025 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8026 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8027 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8028 | { |
8029 | if (argc == 2) | |
8030 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, | |
8031 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
8032 | ||
8033 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
8034 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
8035 | } | |
8036 | ||
8037 | ALIAS (clear_bgp_peer_rsclient, | |
8038 | clear_bgp_ipv6_peer_rsclient_cmd, | |
a80beece | 8039 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8040 | CLEAR_STR |
8041 | BGP_STR | |
8042 | "Address family\n" | |
8043 | "BGP neighbor IP address to clear\n" | |
8044 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8045 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8046 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8047 | |
8048 | ALIAS (clear_bgp_peer_rsclient, | |
8049 | clear_bgp_instance_peer_rsclient_cmd, | |
a80beece | 8050 | "clear bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8051 | CLEAR_STR |
8052 | BGP_STR | |
8053 | "BGP view\n" | |
8054 | "view name\n" | |
8055 | "BGP neighbor IP address to clear\n" | |
8056 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8057 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8058 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8059 | |
8060 | ALIAS (clear_bgp_peer_rsclient, | |
8061 | clear_bgp_ipv6_instance_peer_rsclient_cmd, | |
a80beece | 8062 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8063 | CLEAR_STR |
8064 | BGP_STR | |
8065 | "Address family\n" | |
8066 | "BGP view\n" | |
8067 | "view name\n" | |
8068 | "BGP neighbor IP address to clear\n" | |
8069 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8070 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8071 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8072 | #endif /* HAVE_IPV6 */ |
8073 | ||
8074 | DEFUN (clear_ip_bgp_peer_rsclient, | |
8075 | clear_ip_bgp_peer_rsclient_cmd, | |
a80beece | 8076 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8077 | CLEAR_STR |
8078 | IP_STR | |
8079 | BGP_STR | |
8080 | "BGP neighbor IP address to clear\n" | |
8081 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8082 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8083 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8084 | { |
8085 | if (argc == 2) | |
8086 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, | |
8087 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
8088 | ||
8089 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
8090 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
8091 | } | |
8092 | ||
8093 | ALIAS (clear_ip_bgp_peer_rsclient, | |
8094 | clear_ip_bgp_instance_peer_rsclient_cmd, | |
a80beece | 8095 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 8096 | CLEAR_STR |
8097 | IP_STR | |
8098 | BGP_STR | |
8099 | "BGP view\n" | |
8100 | "view name\n" | |
8101 | "BGP neighbor IP address to clear\n" | |
8102 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 8103 | "BGP neighbor on interface to clear\n" |
e0bce756 | 8104 | BGP_SOFT_RSCLIENT_RIB_STR) |
fee0f4c6 | 8105 | |
e0081f70 ML |
8106 | DEFUN (show_bgp_views, |
8107 | show_bgp_views_cmd, | |
8108 | "show bgp views", | |
8109 | SHOW_STR | |
8110 | BGP_STR | |
8111 | "Show the defined BGP views\n") | |
8112 | { | |
8113 | struct list *inst = bm->bgp; | |
8114 | struct listnode *node; | |
8115 | struct bgp *bgp; | |
8116 | ||
8117 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
8118 | { | |
8119 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); | |
8120 | return CMD_WARNING; | |
8121 | } | |
8122 | ||
8123 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
8124 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
8125 | vty_out (vty, "\t%s (AS%u)%s", | |
8126 | bgp->name ? bgp->name : "(null)", | |
8127 | bgp->as, VTY_NEWLINE); | |
8128 | ||
8129 | return CMD_SUCCESS; | |
8130 | } | |
8131 | ||
4bf6a362 PJ |
8132 | DEFUN (show_bgp_memory, |
8133 | show_bgp_memory_cmd, | |
8134 | "show bgp memory", | |
8135 | SHOW_STR | |
8136 | BGP_STR | |
8137 | "Global BGP memory statistics\n") | |
8138 | { | |
8139 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
8140 | unsigned long count; | |
8141 | ||
8142 | /* RIB related usage stats */ | |
8143 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
8144 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
8145 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8146 | count * sizeof (struct bgp_node)), | |
8147 | VTY_NEWLINE); | |
8148 | ||
8149 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
8150 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
8151 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8152 | count * sizeof (struct bgp_info)), | |
8153 | VTY_NEWLINE); | |
fb982c25 PJ |
8154 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
8155 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
8156 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8157 | count * sizeof (struct bgp_info_extra)), | |
8158 | VTY_NEWLINE); | |
4bf6a362 PJ |
8159 | |
8160 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
8161 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
8162 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8163 | count * sizeof (struct bgp_static)), | |
8164 | VTY_NEWLINE); | |
3f9c7369 DS |
8165 | |
8166 | if ((count = mtype_stats_alloc (MTYPE_BGP_PACKET))) | |
8167 | vty_out (vty, "%ld Packets, using %s of memory%s", count, | |
8168 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8169 | count * sizeof (struct bpacket)), | |
8170 | VTY_NEWLINE); | |
4bf6a362 PJ |
8171 | |
8172 | /* Adj-In/Out */ | |
8173 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
8174 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
8175 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8176 | count * sizeof (struct bgp_adj_in)), | |
8177 | VTY_NEWLINE); | |
8178 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
8179 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
8180 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8181 | count * sizeof (struct bgp_adj_out)), | |
8182 | VTY_NEWLINE); | |
8183 | ||
8184 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
8185 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
8186 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8187 | count * sizeof (struct bgp_nexthop_cache)), | |
8188 | VTY_NEWLINE); | |
8189 | ||
8190 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
8191 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
8192 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8193 | count * sizeof (struct bgp_damp_info)), | |
8194 | VTY_NEWLINE); | |
8195 | ||
8196 | /* Attributes */ | |
8197 | count = attr_count(); | |
8198 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
8199 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8200 | count * sizeof(struct attr)), | |
8201 | VTY_NEWLINE); | |
fb982c25 PJ |
8202 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
8203 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
8204 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8205 | count * sizeof(struct attr_extra)), | |
8206 | VTY_NEWLINE); | |
4bf6a362 PJ |
8207 | |
8208 | if ((count = attr_unknown_count())) | |
8209 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
8210 | ||
8211 | /* AS_PATH attributes */ | |
8212 | count = aspath_count (); | |
8213 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
8214 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8215 | count * sizeof (struct aspath)), | |
8216 | VTY_NEWLINE); | |
8217 | ||
8218 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
8219 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
8220 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8221 | count * sizeof (struct assegment)), | |
8222 | VTY_NEWLINE); | |
8223 | ||
8224 | /* Other attributes */ | |
8225 | if ((count = community_count ())) | |
8226 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
8227 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8228 | count * sizeof (struct community)), | |
8229 | VTY_NEWLINE); | |
8230 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
8231 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
8232 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8233 | count * sizeof (struct ecommunity)), | |
8234 | VTY_NEWLINE); | |
8235 | ||
8236 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
8237 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
8238 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8239 | count * sizeof (struct cluster_list)), | |
8240 | VTY_NEWLINE); | |
8241 | ||
8242 | /* Peer related usage */ | |
8243 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
8244 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
8245 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8246 | count * sizeof (struct peer)), | |
8247 | VTY_NEWLINE); | |
8248 | ||
8249 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) | |
8250 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, | |
8251 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8252 | count * sizeof (struct peer_group)), | |
8253 | VTY_NEWLINE); | |
8254 | ||
8255 | /* Other */ | |
8256 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
8257 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
8258 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8259 | count * sizeof (struct hash)), | |
8260 | VTY_NEWLINE); | |
8261 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
8262 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
8263 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8264 | count * sizeof (struct hash_backet)), | |
8265 | VTY_NEWLINE); | |
8266 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
8267 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
8268 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8269 | count * sizeof (regex_t)), | |
8270 | VTY_NEWLINE); | |
8271 | return CMD_SUCCESS; | |
8272 | } | |
fee0f4c6 | 8273 | |
47fc97cc DS |
8274 | static int |
8275 | bgp_adj_out_count (struct peer *peer, int afi, int safi) | |
8276 | { | |
8277 | struct bgp_table *table; | |
8278 | struct bgp_node *rn; | |
8279 | struct bgp_adj_out *adj; | |
8280 | int count = 0; | |
8281 | ||
8282 | if (!peer) return(0); | |
8283 | ||
8284 | table = peer->bgp->rib[afi][safi]; | |
8285 | if (!table) return(0); | |
8286 | for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) | |
8287 | if (bgp_adj_out_lookup(peer, NULL, afi, safi, rn)) | |
8288 | count++; | |
8289 | return (count); | |
8290 | } | |
8291 | ||
718e3744 | 8292 | /* Show BGP peer's summary information. */ |
94f2b392 | 8293 | static int |
b05a1c8b DS |
8294 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, |
8295 | u_char use_json) | |
718e3744 | 8296 | { |
8297 | struct peer *peer; | |
1eb8ef25 | 8298 | struct listnode *node, *nnode; |
f14e6fdb DS |
8299 | unsigned int count = 0, dn_count = 0; |
8300 | char timebuf[BGP_UPTIME_LEN], dn_flag[2]; | |
718e3744 | 8301 | int len; |
f14e6fdb | 8302 | struct peer_group *group; |
b05a1c8b DS |
8303 | json_object *json; |
8304 | json_object *json_int; | |
8305 | json_object *json_string; | |
8306 | json_object *json_peer; | |
8307 | json_object *json_peers; | |
8308 | json_object *json_boolean_true; | |
718e3744 | 8309 | |
8310 | /* Header string for each address family. */ | |
8311 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; | |
47fc97cc DS |
8312 | static char header_csv[] = "Neighbor, V, AS, MsgRcvd, MsgSent, TblVer, InQ, OutQ, Up/Down, State/PfxRcd, PfxAdv"; |
8313 | ||
b05a1c8b DS |
8314 | if (use_json) |
8315 | { | |
8316 | json = json_object_new_object(); | |
8317 | json_peers = json_object_new_array(); | |
8318 | json_boolean_true = json_object_new_boolean(1); | |
8319 | } | |
8320 | ||
1eb8ef25 | 8321 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 8322 | { |
1ff9a340 DS |
8323 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
8324 | continue; | |
8325 | ||
718e3744 | 8326 | if (peer->afc[afi][safi]) |
8327 | { | |
b05a1c8b | 8328 | if (!count) |
4bf6a362 PJ |
8329 | { |
8330 | unsigned long ents; | |
8331 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
b05a1c8b | 8332 | |
4bf6a362 | 8333 | /* Usage summary and header */ |
b05a1c8b DS |
8334 | if (use_json) |
8335 | { | |
8336 | json_string = json_object_new_string(inet_ntoa (bgp->router_id)); | |
8337 | json_object_object_add(json, "router-id", json_string); | |
8338 | ||
8339 | json_int = json_object_new_int(bgp->as); | |
8340 | json_object_object_add(json, "as", json_int); | |
8341 | } | |
8342 | else | |
8343 | { | |
8344 | vty_out (vty, | |
8345 | "BGP router identifier %s, local AS number %u%s", | |
8346 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); | |
8347 | } | |
8348 | ||
f188f2c4 DS |
8349 | if (bgp_update_delay_configured(bgp)) |
8350 | { | |
b05a1c8b | 8351 | if (use_json) |
f188f2c4 | 8352 | { |
b05a1c8b DS |
8353 | json_int = json_object_new_int(bgp->v_update_delay); |
8354 | json_object_object_add(json, "update-delay-limit", json_int); | |
8355 | ||
8356 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
8357 | { | |
8358 | json_int = json_object_new_int(bgp->v_establish_wait); | |
8359 | json_object_object_add(json, "update-delay-establish-wait", json_int); | |
8360 | } | |
8361 | ||
8362 | if (bgp_update_delay_active(bgp)) | |
8363 | { | |
8364 | json_string = json_object_new_string(bgp->update_delay_begin_time); | |
8365 | json_object_object_add(json, "update-delay-first-neighbor", json_string); | |
8366 | json_object_object_add(json, "update-delay-in-progress", json_boolean_true); | |
8367 | } | |
8368 | else | |
8369 | { | |
8370 | if (bgp->update_delay_over) | |
8371 | { | |
8372 | json_string = json_object_new_string(bgp->update_delay_begin_time); | |
8373 | json_object_object_add(json, "update-delay-first-neighbor", json_string); | |
8374 | ||
8375 | json_string = json_object_new_string(bgp->update_delay_end_time); | |
8376 | json_object_object_add(json, "update-delay-bestpath-resumed", json_string); | |
8377 | ||
8378 | json_string = json_object_new_string(bgp->update_delay_zebra_resume_time); | |
8379 | json_object_object_add(json, "update-delay-zebra-update-resume", json_string); | |
8380 | ||
8381 | json_string = json_object_new_string(bgp->update_delay_peers_resume_time); | |
8382 | json_object_object_add(json, "update-delay-peer-update-resume", json_string); | |
8383 | } | |
8384 | } | |
f188f2c4 DS |
8385 | } |
8386 | else | |
8387 | { | |
b05a1c8b DS |
8388 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", |
8389 | bgp->v_update_delay, VTY_NEWLINE); | |
8390 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
8391 | vty_out (vty, " Establish wait: %d seconds%s", | |
8392 | bgp->v_establish_wait, VTY_NEWLINE); | |
8393 | ||
8394 | if (bgp_update_delay_active(bgp)) | |
f188f2c4 DS |
8395 | { |
8396 | vty_out (vty, " First neighbor established: %s%s", | |
8397 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
b05a1c8b DS |
8398 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); |
8399 | } | |
8400 | else | |
8401 | { | |
8402 | if (bgp->update_delay_over) | |
8403 | { | |
8404 | vty_out (vty, " First neighbor established: %s%s", | |
8405 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
8406 | vty_out (vty, " Best-paths resumed: %s%s", | |
8407 | bgp->update_delay_end_time, VTY_NEWLINE); | |
8408 | vty_out (vty, " zebra update resumed: %s%s", | |
8409 | bgp->update_delay_zebra_resume_time, VTY_NEWLINE); | |
8410 | vty_out (vty, " peers update resumed: %s%s", | |
8411 | bgp->update_delay_peers_resume_time, VTY_NEWLINE); | |
8412 | } | |
f188f2c4 DS |
8413 | } |
8414 | } | |
8415 | } | |
4bf6a362 | 8416 | |
b05a1c8b DS |
8417 | if (use_json) |
8418 | { | |
8419 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
8420 | json_object_object_add(json, "max-med-on-startup", json_boolean_true); | |
8421 | if (bgp->v_maxmed_admin) | |
8422 | json_object_object_add(json, "max-med-administrative", json_boolean_true); | |
8423 | ||
8424 | json_int = json_object_new_int(bgp_table_version(bgp->rib[afi][safi])); | |
8425 | json_object_object_add(json, "table-version", json_int); | |
8426 | ||
8427 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
8428 | json_int = json_object_new_int(ents); | |
8429 | json_object_object_add(json, "rib-count", json_int); | |
8430 | json_int = json_object_new_int(ents * sizeof (struct bgp_node)); | |
8431 | json_object_object_add(json, "rib-memory", json_int); | |
8432 | ||
8433 | ents = listcount (bgp->peer); | |
8434 | json_int = json_object_new_int(ents); | |
8435 | json_object_object_add(json, "peer-count", json_int); | |
8436 | json_int = json_object_new_int(ents * sizeof (struct peer)); | |
8437 | json_object_object_add(json, "peer-memory", json_int); | |
8438 | ||
8439 | if ((ents = listcount (bgp->rsclient))) | |
8440 | { | |
8441 | json_int = json_object_new_int(ents); | |
8442 | json_object_object_add(json, "rsclient-count", json_int); | |
8443 | json_int = json_object_new_int(ents * sizeof (struct peer)); | |
8444 | json_object_object_add(json, "rsclient-memory", json_int); | |
8445 | } | |
abc920f8 | 8446 | |
b05a1c8b DS |
8447 | if ((ents = listcount (bgp->group))) |
8448 | { | |
8449 | json_int = json_object_new_int(ents); | |
8450 | json_object_object_add(json, "peer-group-count", json_int); | |
8451 | json_int = json_object_new_int(ents * sizeof (struct peer_group)); | |
8452 | json_object_object_add(json, "peer-group-memory", json_int); | |
8453 | } | |
3f9c7369 | 8454 | |
b05a1c8b DS |
8455 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
8456 | json_object_object_add(json, "dampening-enabled", json_boolean_true); | |
8457 | } | |
8458 | else | |
8459 | { | |
8460 | if (bgp_maxmed_onstartup_configured(bgp) && bgp->maxmed_active) | |
8461 | vty_out (vty, "Max-med on-startup active%s", VTY_NEWLINE); | |
8462 | if (bgp->v_maxmed_admin) | |
8463 | vty_out (vty, "Max-med administrative active%s", VTY_NEWLINE); | |
8464 | ||
8465 | vty_out(vty, "BGP table version %llu%s", | |
8466 | bgp_table_version(bgp->rib[afi][safi]), VTY_NEWLINE); | |
8467 | ||
8468 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
8469 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
8470 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8471 | ents * sizeof (struct bgp_node)), | |
8472 | VTY_NEWLINE); | |
8473 | ||
8474 | /* Peer related usage */ | |
8475 | ents = listcount (bgp->peer); | |
8476 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
8477 | ents, | |
8478 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8479 | ents * sizeof (struct peer)), | |
8480 | VTY_NEWLINE); | |
8481 | ||
8482 | if ((ents = listcount (bgp->rsclient))) | |
8483 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", | |
8484 | ents, | |
8485 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8486 | ents * sizeof (struct peer)), | |
8487 | VTY_NEWLINE); | |
8488 | ||
8489 | if ((ents = listcount (bgp->group))) | |
8490 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
8491 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
8492 | ents * sizeof (struct peer_group)), | |
8493 | VTY_NEWLINE); | |
8494 | ||
8495 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
8496 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
8497 | vty_out (vty, "%s", VTY_NEWLINE); | |
8498 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
8499 | } | |
4bf6a362 PJ |
8500 | } |
8501 | ||
b05a1c8b | 8502 | count++; |
718e3744 | 8503 | |
b05a1c8b DS |
8504 | if (use_json) |
8505 | { | |
8506 | json_peer = json_object_new_object(); | |
f14e6fdb | 8507 | |
b05a1c8b DS |
8508 | if (peer_dynamic_neighbor(peer)) |
8509 | json_object_object_add(json_peer, "dynamic-peer", json_boolean_true); | |
718e3744 | 8510 | |
b05a1c8b DS |
8511 | json_string = json_object_new_string(peer->host); |
8512 | json_object_object_add(json_peer, "ip", json_string); | |
8513 | ||
8514 | json_int = json_object_new_int(peer->as); | |
8515 | json_object_object_add(json_peer, "remote-as", json_int); | |
8516 | ||
8517 | json_int = json_object_new_int(4); | |
8518 | json_object_object_add(json_peer, "version", json_int); | |
8519 | ||
8520 | json_int = json_object_new_int(peer->open_in + peer->update_in + peer->keepalive_in | |
8521 | + peer->notify_in + peer->refresh_in | |
8522 | + peer->dynamic_cap_in); | |
8523 | json_object_object_add(json_peer, "msgrcvd", json_int); | |
8524 | ||
8525 | json_int = json_object_new_int(peer->open_out + peer->update_out + peer->keepalive_out | |
8526 | + peer->notify_out + peer->refresh_out | |
8527 | + peer->dynamic_cap_out); | |
8528 | json_object_object_add(json_peer, "msgsent", json_int); | |
8529 | ||
8530 | json_int = json_object_new_int(peer->version[afi][safi]); | |
8531 | json_object_object_add(json_peer, "table-version", json_int); | |
8532 | ||
8533 | json_int = json_object_new_int(peer->obuf->count); | |
8534 | json_object_object_add(json_peer, "outq", json_int); | |
8535 | ||
8536 | json_string = json_object_new_string(peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); | |
8537 | json_object_object_add(json_peer, "uptime", json_string); | |
8538 | ||
8539 | json_int = json_object_new_int(peer->pcount[afi][safi]); | |
8540 | json_object_object_add(json_peer, "prefix-received-count", json_int); | |
8541 | ||
8542 | json_int = json_object_new_int(bgp_adj_out_count(peer, afi, safi)); | |
8543 | json_object_object_add(json_peer, "prefix-advertised-count", json_int); | |
8544 | ||
8545 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
8546 | json_string = json_object_new_string("Idle (Admin)"); | |
8547 | ||
8548 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
8549 | json_string = json_object_new_string("Idle (PfxCt)"); | |
8550 | ||
8551 | else | |
8552 | json_string = json_object_new_string(LOOKUP(bgp_status_msg, peer->status)); | |
8553 | ||
8554 | json_object_object_add(json_peer, "state", json_string); | |
8555 | ||
8556 | json_object_array_add(json_peers, json_peer); | |
8557 | } | |
8558 | else | |
8559 | { | |
8560 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
8561 | if (peer_dynamic_neighbor(peer)) | |
8562 | { | |
8563 | dn_count++; | |
8564 | dn_flag[0] = '*'; | |
8565 | } | |
8566 | ||
8567 | len = vty_out (vty, "%s%s", dn_flag, peer->host); | |
8568 | len = 16 - len; | |
8569 | ||
8570 | if (len < 1) | |
8571 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
8572 | else | |
8573 | vty_out (vty, "%*s", len, " "); | |
8574 | ||
8575 | vty_out (vty, "4 "); | |
8576 | ||
8577 | vty_out (vty, "%5u %7d %7d %8lu %4d %4u ", | |
8578 | peer->as, | |
8579 | peer->open_in + peer->update_in + peer->keepalive_in | |
8580 | + peer->notify_in + peer->refresh_in | |
8581 | + peer->dynamic_cap_in, | |
8582 | peer->open_out + peer->update_out + peer->keepalive_out | |
8583 | + peer->notify_out + peer->refresh_out | |
8584 | + peer->dynamic_cap_out, | |
8585 | peer->version[afi][safi], | |
8586 | 0, | |
8587 | (unsigned long) peer->obuf->count); | |
8588 | ||
8589 | vty_out (vty, "%8s", | |
8590 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); | |
8591 | ||
8592 | if (peer->status == Established) | |
8593 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); | |
8594 | else | |
8595 | { | |
8596 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
8597 | vty_out (vty, " Idle (Admin)"); | |
8598 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
8599 | vty_out (vty, " Idle (PfxCt)"); | |
8600 | else | |
8601 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
8602 | } | |
8603 | vty_out (vty, "%s", VTY_NEWLINE); | |
8604 | } | |
718e3744 | 8605 | } |
8606 | } | |
8607 | ||
b05a1c8b DS |
8608 | if (use_json) |
8609 | { | |
8610 | json_object_object_add(json, "peers", json_peers); | |
8611 | vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); | |
f14e6fdb | 8612 | |
b05a1c8b DS |
8613 | // Recursively free all json structures |
8614 | json_object_put(json); | |
8615 | } | |
8616 | else | |
f14e6fdb | 8617 | { |
b05a1c8b DS |
8618 | if (count) |
8619 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
8620 | count, VTY_NEWLINE); | |
8621 | else | |
8622 | vty_out (vty, "No %s neighbor is configured%s", | |
8623 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
8624 | ||
8625 | if (dn_count) | |
8626 | { | |
8627 | vty_out(vty, "* - dynamic neighbor%s", VTY_NEWLINE); | |
8628 | vty_out(vty, | |
8629 | "%d dynamic neighbor(s), limit %d%s", | |
8630 | dn_count, bgp->dynamic_neighbors_limit, VTY_NEWLINE); | |
8631 | } | |
f14e6fdb DS |
8632 | } |
8633 | ||
718e3744 | 8634 | return CMD_SUCCESS; |
8635 | } | |
8636 | ||
47fc97cc DS |
8637 | static int |
8638 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
b05a1c8b | 8639 | afi_t afi, safi_t safi, u_char use_json) |
718e3744 | 8640 | { |
8641 | struct bgp *bgp; | |
8642 | ||
8643 | if (name) | |
8644 | { | |
8645 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 8646 | |
718e3744 | 8647 | if (! bgp) |
8648 | { | |
47fc97cc | 8649 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 8650 | return CMD_WARNING; |
8651 | } | |
8652 | ||
b05a1c8b | 8653 | bgp_show_summary (vty, bgp, afi, safi, use_json); |
718e3744 | 8654 | return CMD_SUCCESS; |
8655 | } | |
47fc97cc | 8656 | |
718e3744 | 8657 | bgp = bgp_get_default (); |
8658 | ||
8659 | if (bgp) | |
b05a1c8b | 8660 | bgp_show_summary (vty, bgp, afi, safi, use_json); |
47fc97cc | 8661 | |
718e3744 | 8662 | return CMD_SUCCESS; |
8663 | } | |
8664 | ||
8665 | /* `show ip bgp summary' commands. */ | |
47fc97cc | 8666 | DEFUN (show_ip_bgp_summary, |
718e3744 | 8667 | show_ip_bgp_summary_cmd, |
b05a1c8b | 8668 | "show ip bgp summary {json}", |
47fc97cc DS |
8669 | SHOW_STR |
8670 | IP_STR | |
8671 | BGP_STR | |
b05a1c8b DS |
8672 | "Summary of BGP neighbor status\n" |
8673 | "JavaScript Object Notation\n") | |
47fc97cc | 8674 | { |
b05a1c8b DS |
8675 | u_char use_json = (argv[0] != NULL); |
8676 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, use_json); | |
718e3744 | 8677 | } |
8678 | ||
8679 | DEFUN (show_ip_bgp_instance_summary, | |
8680 | show_ip_bgp_instance_summary_cmd, | |
b05a1c8b | 8681 | "show ip bgp view WORD summary {json}", |
718e3744 | 8682 | SHOW_STR |
8683 | IP_STR | |
8684 | BGP_STR | |
8685 | "BGP view\n" | |
8686 | "View name\n" | |
b05a1c8b DS |
8687 | "Summary of BGP neighbor status\n" |
8688 | "JavaScript Object Notation\n") | |
718e3744 | 8689 | { |
b05a1c8b DS |
8690 | u_char use_json = (argv[1] != NULL); |
8691 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, use_json); | |
718e3744 | 8692 | } |
8693 | ||
8694 | DEFUN (show_ip_bgp_ipv4_summary, | |
8695 | show_ip_bgp_ipv4_summary_cmd, | |
b05a1c8b | 8696 | "show ip bgp ipv4 (unicast|multicast) summary {json}", |
718e3744 | 8697 | SHOW_STR |
8698 | IP_STR | |
8699 | BGP_STR | |
8700 | "Address family\n" | |
8701 | "Address Family modifier\n" | |
8702 | "Address Family modifier\n" | |
b05a1c8b DS |
8703 | "Summary of BGP neighbor status\n" |
8704 | "JavaScript Object Notation\n") | |
718e3744 | 8705 | { |
b05a1c8b | 8706 | u_char use_json = (argv[1] != NULL); |
718e3744 | 8707 | if (strncmp (argv[0], "m", 1) == 0) |
b05a1c8b | 8708 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, use_json); |
718e3744 | 8709 | |
b05a1c8b | 8710 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, use_json); |
718e3744 | 8711 | } |
8712 | ||
95cbbd2a ML |
8713 | ALIAS (show_ip_bgp_ipv4_summary, |
8714 | show_bgp_ipv4_safi_summary_cmd, | |
b05a1c8b | 8715 | "show bgp ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8716 | SHOW_STR |
8717 | BGP_STR | |
8718 | "Address family\n" | |
8719 | "Address Family modifier\n" | |
8720 | "Address Family modifier\n" | |
8721 | "Summary of BGP neighbor status\n") | |
8722 | ||
718e3744 | 8723 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
8724 | show_ip_bgp_instance_ipv4_summary_cmd, | |
b05a1c8b | 8725 | "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}", |
718e3744 | 8726 | SHOW_STR |
8727 | IP_STR | |
8728 | BGP_STR | |
8729 | "BGP view\n" | |
8730 | "View name\n" | |
8731 | "Address family\n" | |
8732 | "Address Family modifier\n" | |
8733 | "Address Family modifier\n" | |
b05a1c8b DS |
8734 | "Summary of BGP neighbor status\n" |
8735 | "JavaScript Object Notation\n") | |
718e3744 | 8736 | { |
b05a1c8b | 8737 | u_char use_json = (argv[2] != NULL); |
718e3744 | 8738 | if (strncmp (argv[1], "m", 1) == 0) |
b05a1c8b | 8739 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, use_json); |
718e3744 | 8740 | else |
b05a1c8b | 8741 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, use_json); |
718e3744 | 8742 | } |
8743 | ||
95cbbd2a ML |
8744 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
8745 | show_bgp_instance_ipv4_safi_summary_cmd, | |
b05a1c8b | 8746 | "show bgp view WORD ipv4 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8747 | SHOW_STR |
8748 | BGP_STR | |
8749 | "BGP view\n" | |
8750 | "View name\n" | |
8751 | "Address family\n" | |
8752 | "Address Family modifier\n" | |
8753 | "Address Family modifier\n" | |
8754 | "Summary of BGP neighbor status\n") | |
8755 | ||
718e3744 | 8756 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
8757 | show_ip_bgp_vpnv4_all_summary_cmd, | |
b05a1c8b | 8758 | "show ip bgp vpnv4 all summary {json}", |
718e3744 | 8759 | SHOW_STR |
8760 | IP_STR | |
8761 | BGP_STR | |
8762 | "Display VPNv4 NLRI specific information\n" | |
8763 | "Display information about all VPNv4 NLRIs\n" | |
b05a1c8b DS |
8764 | "Summary of BGP neighbor status\n" |
8765 | "JavaScript Object Notation\n") | |
718e3744 | 8766 | { |
b05a1c8b DS |
8767 | u_char use_json = (argv[0] != NULL); |
8768 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json); | |
718e3744 | 8769 | } |
8770 | ||
8771 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
8772 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
b05a1c8b | 8773 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}", |
718e3744 | 8774 | SHOW_STR |
8775 | IP_STR | |
8776 | BGP_STR | |
8777 | "Display VPNv4 NLRI specific information\n" | |
8778 | "Display information for a route distinguisher\n" | |
8779 | "VPN Route Distinguisher\n" | |
b05a1c8b DS |
8780 | "Summary of BGP neighbor status\n" |
8781 | "JavaScript Object Notation\n") | |
718e3744 | 8782 | { |
8783 | int ret; | |
8784 | struct prefix_rd prd; | |
b05a1c8b | 8785 | u_char use_json = (argv[1] != NULL); |
718e3744 | 8786 | |
8787 | ret = str2prefix_rd (argv[0], &prd); | |
8788 | if (! ret) | |
8789 | { | |
8790 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
8791 | return CMD_WARNING; | |
8792 | } | |
8793 | ||
b05a1c8b | 8794 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json); |
718e3744 | 8795 | } |
8796 | ||
8797 | #ifdef HAVE_IPV6 | |
47fc97cc | 8798 | DEFUN (show_bgp_summary, |
718e3744 | 8799 | show_bgp_summary_cmd, |
b05a1c8b | 8800 | "show bgp summary {json}", |
718e3744 | 8801 | SHOW_STR |
8802 | BGP_STR | |
b05a1c8b DS |
8803 | "Summary of BGP neighbor status\n" |
8804 | "JavaScript Object Notation\n") | |
718e3744 | 8805 | { |
b05a1c8b DS |
8806 | u_char use_json = (argv[0] != NULL); |
8807 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json); | |
718e3744 | 8808 | } |
8809 | ||
8810 | DEFUN (show_bgp_instance_summary, | |
8811 | show_bgp_instance_summary_cmd, | |
b05a1c8b | 8812 | "show bgp view WORD summary {json}", |
718e3744 | 8813 | SHOW_STR |
8814 | BGP_STR | |
8815 | "BGP view\n" | |
8816 | "View name\n" | |
b05a1c8b DS |
8817 | "Summary of BGP neighbor status\n" |
8818 | "JavaScript Object Notation\n") | |
718e3744 | 8819 | { |
b05a1c8b DS |
8820 | u_char use_json = (argv[1] != NULL); |
8821 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, use_json); | |
718e3744 | 8822 | } |
8823 | ||
8824 | ALIAS (show_bgp_summary, | |
8825 | show_bgp_ipv6_summary_cmd, | |
b05a1c8b | 8826 | "show bgp ipv6 summary {json}", |
718e3744 | 8827 | SHOW_STR |
8828 | BGP_STR | |
8829 | "Address family\n" | |
8830 | "Summary of BGP neighbor status\n") | |
8831 | ||
8832 | ALIAS (show_bgp_instance_summary, | |
8833 | show_bgp_instance_ipv6_summary_cmd, | |
b05a1c8b | 8834 | "show bgp view WORD ipv6 summary {json}", |
718e3744 | 8835 | SHOW_STR |
8836 | BGP_STR | |
8837 | "BGP view\n" | |
8838 | "View name\n" | |
8839 | "Address family\n" | |
8840 | "Summary of BGP neighbor status\n") | |
8841 | ||
95cbbd2a ML |
8842 | DEFUN (show_bgp_ipv6_safi_summary, |
8843 | show_bgp_ipv6_safi_summary_cmd, | |
b05a1c8b | 8844 | "show bgp ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8845 | SHOW_STR |
8846 | BGP_STR | |
8847 | "Address family\n" | |
8848 | "Address Family modifier\n" | |
8849 | "Address Family modifier\n" | |
b05a1c8b DS |
8850 | "Summary of BGP neighbor status\n" |
8851 | "JavaScript Object Notation\n") | |
95cbbd2a | 8852 | { |
b05a1c8b | 8853 | u_char use_json = (argv[1] != NULL); |
95cbbd2a | 8854 | if (strncmp (argv[0], "m", 1) == 0) |
b05a1c8b | 8855 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, use_json); |
95cbbd2a | 8856 | |
b05a1c8b | 8857 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json); |
95cbbd2a ML |
8858 | } |
8859 | ||
8860 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
8861 | show_bgp_instance_ipv6_safi_summary_cmd, | |
b05a1c8b | 8862 | "show bgp view WORD ipv6 (unicast|multicast) summary {json}", |
95cbbd2a ML |
8863 | SHOW_STR |
8864 | BGP_STR | |
8865 | "BGP view\n" | |
8866 | "View name\n" | |
8867 | "Address family\n" | |
8868 | "Address Family modifier\n" | |
8869 | "Address Family modifier\n" | |
b05a1c8b DS |
8870 | "Summary of BGP neighbor status\n" |
8871 | "JavaScript Object Notation\n") | |
95cbbd2a | 8872 | { |
b05a1c8b | 8873 | u_char use_json = (argv[2] != NULL); |
95cbbd2a | 8874 | if (strncmp (argv[1], "m", 1) == 0) |
b05a1c8b | 8875 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST, use_json); |
95cbbd2a | 8876 | |
b05a1c8b | 8877 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, use_json); |
95cbbd2a ML |
8878 | } |
8879 | ||
718e3744 | 8880 | /* old command */ |
8881 | DEFUN (show_ipv6_bgp_summary, | |
8882 | show_ipv6_bgp_summary_cmd, | |
b05a1c8b | 8883 | "show ipv6 bgp summary {json}", |
718e3744 | 8884 | SHOW_STR |
8885 | IPV6_STR | |
8886 | BGP_STR | |
b05a1c8b DS |
8887 | "Summary of BGP neighbor status\n" |
8888 | "JavaScript Object Notation\n") | |
718e3744 | 8889 | { |
b05a1c8b DS |
8890 | u_char use_json = (argv[0] != NULL); |
8891 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, use_json); | |
718e3744 | 8892 | } |
8893 | ||
8894 | /* old command */ | |
8895 | DEFUN (show_ipv6_mbgp_summary, | |
8896 | show_ipv6_mbgp_summary_cmd, | |
b05a1c8b | 8897 | "show ipv6 mbgp summary {json}", |
718e3744 | 8898 | SHOW_STR |
8899 | IPV6_STR | |
8900 | MBGP_STR | |
b05a1c8b DS |
8901 | "Summary of BGP neighbor status\n" |
8902 | "JavaScript Object Notation\n") | |
718e3744 | 8903 | { |
b05a1c8b DS |
8904 | u_char use_json = (argv[0] != NULL); |
8905 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, use_json); | |
718e3744 | 8906 | } |
8907 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 8908 | |
fd79ac91 | 8909 | const char * |
538621f2 | 8910 | afi_safi_print (afi_t afi, safi_t safi) |
8911 | { | |
8912 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
8913 | return "IPv4 Unicast"; | |
8914 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
8915 | return "IPv4 Multicast"; | |
8916 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
8917 | return "VPNv4 Unicast"; | |
8918 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) | |
8919 | return "IPv6 Unicast"; | |
8920 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
8921 | return "IPv6 Multicast"; | |
8922 | else | |
8923 | return "Unknown"; | |
8924 | } | |
8925 | ||
718e3744 | 8926 | /* Show BGP peer's information. */ |
8927 | enum show_type | |
8928 | { | |
8929 | show_all, | |
8930 | show_peer | |
8931 | }; | |
8932 | ||
94f2b392 | 8933 | static void |
718e3744 | 8934 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
8935 | afi_t afi, safi_t safi, | |
8936 | u_int16_t adv_smcap, u_int16_t adv_rmcap, | |
8937 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) | |
8938 | { | |
8939 | /* Send-Mode */ | |
8940 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
8941 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8942 | { | |
8943 | vty_out (vty, " Send-mode: "); | |
8944 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
8945 | vty_out (vty, "advertised"); | |
8946 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
8947 | vty_out (vty, "%sreceived", | |
8948 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
8949 | ", " : ""); | |
8950 | vty_out (vty, "%s", VTY_NEWLINE); | |
8951 | } | |
8952 | ||
8953 | /* Receive-Mode */ | |
8954 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
8955 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
8956 | { | |
8957 | vty_out (vty, " Receive-mode: "); | |
8958 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
8959 | vty_out (vty, "advertised"); | |
8960 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
8961 | vty_out (vty, "%sreceived", | |
8962 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
8963 | ", " : ""); | |
8964 | vty_out (vty, "%s", VTY_NEWLINE); | |
8965 | } | |
8966 | } | |
8967 | ||
94f2b392 | 8968 | static void |
718e3744 | 8969 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
8970 | { | |
8971 | struct bgp_filter *filter; | |
3f9c7369 | 8972 | struct peer_af *paf; |
718e3744 | 8973 | char orf_pfx_name[BUFSIZ]; |
8974 | int orf_pfx_count; | |
8975 | ||
8976 | filter = &p->filter[afi][safi]; | |
8977 | ||
538621f2 | 8978 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
718e3744 | 8979 | VTY_NEWLINE); |
538621f2 | 8980 | |
718e3744 | 8981 | if (p->af_group[afi][safi]) |
8982 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); | |
8983 | ||
3f9c7369 DS |
8984 | paf = peer_af_find(p, afi, safi); |
8985 | if (paf && PAF_SUBGRP(paf)) | |
8986 | { | |
8987 | vty_out (vty, " Update group %llu, subgroup %llu%s", | |
8988 | PAF_UPDGRP(paf)->id, PAF_SUBGRP(paf)->id, VTY_NEWLINE); | |
8989 | vty_out (vty, " Packet Queue length %d%s", | |
8990 | bpacket_queue_virtual_length(paf), VTY_NEWLINE); | |
8991 | } else | |
8992 | { | |
8993 | vty_out(vty, " Not part of any update group%s", VTY_NEWLINE); | |
8994 | } | |
718e3744 | 8995 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) |
8996 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
8997 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
8998 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
8999 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
9000 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
9001 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
9002 | ||
9003 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9004 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
9005 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9006 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
9007 | { | |
9008 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
9009 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
9010 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
9011 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
9012 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
9013 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
9014 | PEER_CAP_ORF_PREFIX_RM_RCV); | |
9015 | } | |
9016 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
9017 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
9018 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
9019 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
9020 | { | |
9021 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
9022 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
9023 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
9024 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
9025 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
9026 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
9027 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); | |
9028 | } | |
9029 | ||
9030 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
9031 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); | |
9032 | ||
9033 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
9034 | || orf_pfx_count) | |
9035 | { | |
9036 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
9037 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
9038 | vty_out (vty, " sent;"); | |
9039 | if (orf_pfx_count) | |
9040 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
9041 | vty_out (vty, "%s", VTY_NEWLINE); | |
9042 | } | |
9043 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
9044 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
9045 | ||
9046 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
9047 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
9048 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
9049 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
9050 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
9051 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
5000f21c DS |
9052 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE)) |
9053 | vty_out (vty, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE); | |
9054 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) | |
9055 | vty_out (vty, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE); | |
9056 | ||
c7122e14 DS |
9057 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_OVERRIDE)) |
9058 | vty_out (vty, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE); | |
9059 | ||
5000f21c DS |
9060 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF) || |
9061 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF_ALL)) | |
718e3744 | 9062 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); |
9063 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
9064 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
9065 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
9066 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
9067 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
9068 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
9069 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
9070 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
9071 | { | |
9072 | vty_out (vty, " Community attribute sent to this neighbor"); | |
9073 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
9074 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
538621f2 | 9075 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
718e3744 | 9076 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
538621f2 | 9077 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
718e3744 | 9078 | else |
538621f2 | 9079 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
718e3744 | 9080 | } |
9081 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
9082 | { | |
9083 | vty_out (vty, " Default information originate,"); | |
9084 | ||
9085 | if (p->default_rmap[afi][safi].name) | |
9086 | vty_out (vty, " default route-map %s%s,", | |
9087 | p->default_rmap[afi][safi].map ? "*" : "", | |
9088 | p->default_rmap[afi][safi].name); | |
3f9c7369 DS |
9089 | if (paf && PAF_SUBGRP(paf) && CHECK_FLAG(PAF_SUBGRP(paf)->sflags, |
9090 | SUBGRP_STATUS_DEFAULT_ORIGINATE)) | |
718e3744 | 9091 | vty_out (vty, " default sent%s", VTY_NEWLINE); |
9092 | else | |
9093 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
9094 | } | |
9095 | ||
9096 | if (filter->plist[FILTER_IN].name | |
9097 | || filter->dlist[FILTER_IN].name | |
9098 | || filter->aslist[FILTER_IN].name | |
fee0f4c6 | 9099 | || filter->map[RMAP_IN].name) |
718e3744 | 9100 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
9101 | if (filter->plist[FILTER_OUT].name | |
9102 | || filter->dlist[FILTER_OUT].name | |
9103 | || filter->aslist[FILTER_OUT].name | |
fee0f4c6 | 9104 | || filter->map[RMAP_OUT].name |
718e3744 | 9105 | || filter->usmap.name) |
9106 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
fee0f4c6 | 9107 | if (filter->map[RMAP_IMPORT].name) |
9108 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); | |
9109 | if (filter->map[RMAP_EXPORT].name) | |
9110 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); | |
718e3744 | 9111 | |
9112 | /* prefix-list */ | |
9113 | if (filter->plist[FILTER_IN].name) | |
9114 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
9115 | filter->plist[FILTER_IN].plist ? "*" : "", | |
9116 | filter->plist[FILTER_IN].name, | |
9117 | VTY_NEWLINE); | |
9118 | if (filter->plist[FILTER_OUT].name) | |
9119 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
9120 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
9121 | filter->plist[FILTER_OUT].name, | |
9122 | VTY_NEWLINE); | |
9123 | ||
9124 | /* distribute-list */ | |
9125 | if (filter->dlist[FILTER_IN].name) | |
9126 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
9127 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
9128 | filter->dlist[FILTER_IN].name, | |
9129 | VTY_NEWLINE); | |
9130 | if (filter->dlist[FILTER_OUT].name) | |
9131 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
9132 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
9133 | filter->dlist[FILTER_OUT].name, | |
9134 | VTY_NEWLINE); | |
9135 | ||
9136 | /* filter-list. */ | |
9137 | if (filter->aslist[FILTER_IN].name) | |
9138 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
9139 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
9140 | filter->aslist[FILTER_IN].name, | |
9141 | VTY_NEWLINE); | |
9142 | if (filter->aslist[FILTER_OUT].name) | |
9143 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
9144 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
9145 | filter->aslist[FILTER_OUT].name, | |
9146 | VTY_NEWLINE); | |
9147 | ||
9148 | /* route-map. */ | |
fee0f4c6 | 9149 | if (filter->map[RMAP_IN].name) |
718e3744 | 9150 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
fee0f4c6 | 9151 | filter->map[RMAP_IN].map ? "*" : "", |
9152 | filter->map[RMAP_IN].name, | |
718e3744 | 9153 | VTY_NEWLINE); |
fee0f4c6 | 9154 | if (filter->map[RMAP_OUT].name) |
718e3744 | 9155 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
fee0f4c6 | 9156 | filter->map[RMAP_OUT].map ? "*" : "", |
9157 | filter->map[RMAP_OUT].name, | |
9158 | VTY_NEWLINE); | |
9159 | if (filter->map[RMAP_IMPORT].name) | |
9160 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", | |
9161 | filter->map[RMAP_IMPORT].map ? "*" : "", | |
9162 | filter->map[RMAP_IMPORT].name, | |
9163 | VTY_NEWLINE); | |
9164 | if (filter->map[RMAP_EXPORT].name) | |
9165 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", | |
9166 | filter->map[RMAP_EXPORT].map ? "*" : "", | |
9167 | filter->map[RMAP_EXPORT].name, | |
718e3744 | 9168 | VTY_NEWLINE); |
9169 | ||
9170 | /* unsuppress-map */ | |
9171 | if (filter->usmap.name) | |
9172 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
9173 | filter->usmap.map ? "*" : "", | |
9174 | filter->usmap.name, VTY_NEWLINE); | |
9175 | ||
9176 | /* Receive prefix count */ | |
e0701b79 | 9177 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
9178 | ||
718e3744 | 9179 | /* Maximum prefix */ |
9180 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
9181 | { | |
0a486e5f | 9182 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
718e3744 | 9183 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
0a486e5f | 9184 | ? " (warning-only)" : "", VTY_NEWLINE); |
9185 | vty_out (vty, " Threshold for warning message %d%%", | |
9186 | p->pmax_threshold[afi][safi]); | |
9187 | if (p->pmax_restart[afi][safi]) | |
9188 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
9189 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 9190 | } |
718e3744 | 9191 | |
9192 | vty_out (vty, "%s", VTY_NEWLINE); | |
9193 | } | |
9194 | ||
94f2b392 | 9195 | static void |
718e3744 | 9196 | bgp_show_peer (struct vty *vty, struct peer *p) |
9197 | { | |
9198 | struct bgp *bgp; | |
a80beece | 9199 | char buf1[BUFSIZ], buf[SU_ADDRSTRLEN]; |
718e3744 | 9200 | char timebuf[BGP_UPTIME_LEN]; |
f14e6fdb | 9201 | char dn_flag[2]; |
538621f2 | 9202 | afi_t afi; |
9203 | safi_t safi; | |
d6661008 DS |
9204 | u_int16_t i; |
9205 | u_char *msg; | |
718e3744 | 9206 | |
9207 | bgp = p->bgp; | |
9208 | ||
a80beece DS |
9209 | if (p->conf_if) /* Configured interface name. */ |
9210 | vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if, | |
9211 | BGP_PEER_SU_UNSPEC(p) ? "None" : | |
9212 | sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
9213 | else /* Configured IP address. */ | |
f14e6fdb DS |
9214 | { |
9215 | memset(dn_flag, '\0', sizeof(dn_flag)); | |
9216 | if (peer_dynamic_neighbor(p)) | |
9217 | dn_flag[0] = '*'; | |
9218 | ||
9219 | vty_out (vty, "BGP neighbor is %s%s, ", dn_flag, p->host); | |
9220 | } | |
9221 | ||
aea339f7 | 9222 | vty_out (vty, "remote AS %u, ", p->as); |
9d3f9705 | 9223 | vty_out (vty, "local AS %u%s%s, ", |
718e3744 | 9224 | p->change_local_as ? p->change_local_as : p->local_as, |
9225 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
9d3f9705 AC |
9226 | " no-prepend" : "", |
9227 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
9228 | " replace-as" : ""); | |
718e3744 | 9229 | vty_out (vty, "%s link%s", |
9230 | p->as == p->local_as ? "internal" : "external", | |
9231 | VTY_NEWLINE); | |
9232 | ||
9233 | /* Description. */ | |
9234 | if (p->desc) | |
9235 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
9236 | ||
9237 | /* Peer-group */ | |
9238 | if (p->group) | |
f14e6fdb DS |
9239 | { |
9240 | vty_out (vty, " Member of peer-group %s for session parameters%s", | |
9241 | p->group->name, VTY_NEWLINE); | |
9242 | ||
9243 | if (dn_flag[0]) | |
9244 | { | |
9245 | struct prefix *prefix = NULL, *range = NULL; | |
9246 | ||
9247 | prefix = sockunion2hostprefix(&(p->su)); | |
9248 | if (prefix) | |
9249 | range = peer_group_lookup_dynamic_neighbor_range (p->group, | |
9250 | prefix); | |
9251 | if (range) | |
9252 | { | |
9253 | prefix2str(range, buf1, sizeof(buf1)); | |
9254 | vty_out (vty, " Belongs to the subnet range group: %s%s", | |
9255 | buf1, VTY_NEWLINE); | |
9256 | } | |
9257 | } | |
9258 | } | |
718e3744 | 9259 | |
9260 | /* Administrative shutdown. */ | |
9261 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
9262 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
9263 | ||
9264 | /* BGP Version. */ | |
9265 | vty_out (vty, " BGP version 4"); | |
718e3744 | 9266 | vty_out (vty, ", remote router ID %s%s", |
9267 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
9268 | VTY_NEWLINE); | |
9269 | ||
9270 | /* Confederation */ | |
e0701b79 | 9271 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
9272 | && bgp_confederation_peers_check (bgp, p->as)) | |
718e3744 | 9273 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
9274 | ||
9275 | /* Status. */ | |
9276 | vty_out (vty, " BGP state = %s", | |
9277 | LOOKUP (bgp_status_msg, p->status)); | |
9278 | if (p->status == Established) | |
9279 | vty_out (vty, ", up for %8s", | |
9280 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); | |
93406d87 | 9281 | else if (p->status == Active) |
9282 | { | |
9283 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
9284 | vty_out (vty, " (passive)"); | |
9285 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
9286 | vty_out (vty, " (NSF passive)"); | |
9287 | } | |
718e3744 | 9288 | vty_out (vty, "%s", VTY_NEWLINE); |
9289 | ||
9290 | /* read timer */ | |
9291 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); | |
cb1faec9 DS |
9292 | vty_out (vty, ", Last write %s%s", |
9293 | peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN), VTY_NEWLINE); | |
718e3744 | 9294 | |
9295 | /* Configured timer values. */ | |
cb1faec9 | 9296 | vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s", |
718e3744 | 9297 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
9298 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
9299 | { | |
9300 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
9301 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
9302 | p->keepalive, VTY_NEWLINE); | |
9303 | } | |
93406d87 | 9304 | |
718e3744 | 9305 | /* Capability. */ |
9306 | if (p->status == Established) | |
9307 | { | |
538621f2 | 9308 | if (p->cap |
718e3744 | 9309 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
9310 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
9311 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
9312 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
9313 | #ifdef HAVE_IPV6 | |
9314 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
9315 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
9316 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
9317 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
9318 | #endif /* HAVE_IPV6 */ | |
9319 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] | |
9320 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
9321 | { | |
9322 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
9323 | ||
0b2aa3a0 PJ |
9324 | /* AS4 */ |
9325 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
9326 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9327 | { | |
9328 | vty_out (vty, " 4 Byte AS:"); | |
9329 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
9330 | vty_out (vty, " advertised"); | |
9331 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
9332 | vty_out (vty, " %sreceived", | |
9333 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
9334 | vty_out (vty, "%s", VTY_NEWLINE); | |
9335 | } | |
a82478b9 DS |
9336 | |
9337 | /* AddPath */ | |
9338 | if (CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_RCV) | |
9339 | || CHECK_FLAG (p->cap, PEER_CAP_ADDPATH_ADV)) | |
9340 | { | |
9341 | vty_out (vty, " AddPath:%s", VTY_NEWLINE); | |
9342 | ||
9343 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9344 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9345 | { | |
9346 | ||
9347 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) || | |
9348 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
9349 | { | |
9350 | vty_out (vty, " %s: TX ", afi_safi_print (afi, safi)); | |
9351 | ||
9352 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV)) | |
9353 | vty_out (vty, "advertised", afi_safi_print (afi, safi)); | |
9354 | ||
9355 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_RCV)) | |
9356 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_TX_ADV) ? " and " : "" ); | |
9357 | ||
9358 | vty_out (vty, "%s", VTY_NEWLINE); | |
9359 | } | |
9360 | ||
9361 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) || | |
9362 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9363 | { | |
9364 | vty_out (vty, " %s: RX ", afi_safi_print (afi, safi)); | |
9365 | ||
9366 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV)) | |
9367 | vty_out (vty, "advertised", afi_safi_print (afi, safi)); | |
9368 | ||
9369 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_RCV)) | |
9370 | vty_out (vty, "%sreceived", CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ADDPATH_AF_RX_ADV) ? " and " : "" ); | |
9371 | ||
9372 | vty_out (vty, "%s", VTY_NEWLINE); | |
9373 | } | |
9374 | } | |
9375 | } | |
9376 | ||
718e3744 | 9377 | /* Dynamic */ |
9378 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
9379 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9380 | { | |
9381 | vty_out (vty, " Dynamic:"); | |
9382 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
9383 | vty_out (vty, " advertised"); | |
9384 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
538621f2 | 9385 | vty_out (vty, " %sreceived", |
9386 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
718e3744 | 9387 | vty_out (vty, "%s", VTY_NEWLINE); |
9388 | } | |
9389 | ||
9390 | /* Route Refresh */ | |
9391 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
9392 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
9393 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
9394 | { | |
9395 | vty_out (vty, " Route refresh:"); | |
9396 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
9397 | vty_out (vty, " advertised"); | |
9398 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
9399 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
538621f2 | 9400 | vty_out (vty, " %sreceived(%s)", |
9401 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
9402 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
9403 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
9404 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
718e3744 | 9405 | |
718e3744 | 9406 | vty_out (vty, "%s", VTY_NEWLINE); |
9407 | } | |
538621f2 | 9408 | |
9409 | /* Multiprotocol Extensions */ | |
9410 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9411 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9412 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
718e3744 | 9413 | { |
538621f2 | 9414 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
9415 | if (p->afc_adv[afi][safi]) | |
9416 | vty_out (vty, " advertised"); | |
9417 | if (p->afc_recv[afi][safi]) | |
9418 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
9419 | vty_out (vty, "%s", VTY_NEWLINE); | |
9420 | } | |
9421 | ||
9422 | /* Gracefull Restart */ | |
9423 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
9424 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 9425 | { |
538621f2 | 9426 | vty_out (vty, " Graceful Restart Capabilty:"); |
9427 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 9428 | vty_out (vty, " advertised"); |
538621f2 | 9429 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
9430 | vty_out (vty, " %sreceived", | |
9431 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
718e3744 | 9432 | vty_out (vty, "%s", VTY_NEWLINE); |
538621f2 | 9433 | |
9434 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
718e3744 | 9435 | { |
538621f2 | 9436 | int restart_af_count = 0; |
9437 | ||
9438 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
93406d87 | 9439 | p->v_gr_restart, VTY_NEWLINE); |
9440 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
538621f2 | 9441 | |
9442 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9443 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9444 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
9445 | { | |
93406d87 | 9446 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
9447 | afi_safi_print (afi, safi), | |
9448 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
9449 | "preserved" : "not preserved"); | |
538621f2 | 9450 | restart_af_count++; |
93406d87 | 9451 | } |
538621f2 | 9452 | if (! restart_af_count) |
9453 | vty_out (vty, "none"); | |
9454 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 9455 | } |
718e3744 | 9456 | } |
718e3744 | 9457 | } |
9458 | } | |
9459 | ||
93406d87 | 9460 | /* graceful restart information */ |
9461 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
9462 | || p->t_gr_restart | |
9463 | || p->t_gr_stale) | |
9464 | { | |
9465 | int eor_send_af_count = 0; | |
9466 | int eor_receive_af_count = 0; | |
9467 | ||
9468 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
9469 | if (p->status == Established) | |
9470 | { | |
9471 | vty_out (vty, " End-of-RIB send: "); | |
9472 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9473 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9474 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
9475 | { | |
9476 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
9477 | afi_safi_print (afi, safi)); | |
9478 | eor_send_af_count++; | |
9479 | } | |
9480 | vty_out (vty, "%s", VTY_NEWLINE); | |
9481 | ||
9482 | vty_out (vty, " End-of-RIB received: "); | |
9483 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
9484 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9485 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
9486 | { | |
9487 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
9488 | afi_safi_print (afi, safi)); | |
9489 | eor_receive_af_count++; | |
9490 | } | |
9491 | vty_out (vty, "%s", VTY_NEWLINE); | |
9492 | } | |
9493 | ||
9494 | if (p->t_gr_restart) | |
0b2aa3a0 PJ |
9495 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
9496 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
9497 | ||
93406d87 | 9498 | if (p->t_gr_stale) |
0b2aa3a0 PJ |
9499 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
9500 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
93406d87 | 9501 | } |
9502 | ||
718e3744 | 9503 | /* Packet counts. */ |
93406d87 | 9504 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
9505 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
0b2aa3a0 | 9506 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); |
93406d87 | 9507 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
9508 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
9509 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
9510 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
9511 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
9512 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
9513 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
9514 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
9515 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
9516 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
9517 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 9518 | |
9519 | /* advertisement-interval */ | |
9520 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
9521 | p->v_routeadv, VTY_NEWLINE); | |
9522 | ||
9523 | /* Update-source. */ | |
9524 | if (p->update_if || p->update_source) | |
9525 | { | |
9526 | vty_out (vty, " Update source is "); | |
9527 | if (p->update_if) | |
9528 | vty_out (vty, "%s", p->update_if); | |
9529 | else if (p->update_source) | |
9530 | vty_out (vty, "%s", | |
9531 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
9532 | vty_out (vty, "%s", VTY_NEWLINE); | |
9533 | } | |
9534 | ||
9535 | /* Default weight */ | |
9536 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
9537 | vty_out (vty, " Default weight %d%s", p->weight, | |
9538 | VTY_NEWLINE); | |
9539 | ||
9540 | vty_out (vty, "%s", VTY_NEWLINE); | |
9541 | ||
9542 | /* Address Family Information */ | |
538621f2 | 9543 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
9544 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
9545 | if (p->afc[afi][safi]) | |
9546 | bgp_show_peer_afi (vty, p, afi, safi); | |
718e3744 | 9547 | |
9548 | vty_out (vty, " Connections established %d; dropped %d%s", | |
9549 | p->established, p->dropped, | |
9550 | VTY_NEWLINE); | |
9551 | ||
d6661008 | 9552 | if (! p->last_reset) |
e0701b79 | 9553 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
9554 | else | |
d6661008 DS |
9555 | { |
9556 | vty_out (vty, " Last reset %s, due to %s%s", | |
9557 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), | |
9558 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
9559 | ||
9560 | if (p->last_reset_cause_size) | |
9561 | { | |
9562 | msg = p->last_reset_cause; | |
9563 | vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); | |
9564 | for (i = 1; i <= p->last_reset_cause_size; i++) | |
9565 | { | |
9566 | vty_out(vty, "%02X", *msg++); | |
9567 | ||
9568 | if (i != p->last_reset_cause_size) | |
9569 | if (i % 16 == 0) | |
9570 | vty_out(vty, "%s ", VTY_NEWLINE); | |
9571 | else if (i % 4 == 0) | |
9572 | vty_out(vty, " "); | |
9573 | } | |
9574 | vty_out(vty, "%s", VTY_NEWLINE); | |
9575 | } | |
9576 | } | |
848973c7 | 9577 | |
718e3744 | 9578 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
9579 | { | |
9580 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 9581 | |
9582 | if (p->t_pmax_restart) | |
9583 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
9584 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
9585 | VTY_NEWLINE); | |
9586 | else | |
9587 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
9588 | p->host, VTY_NEWLINE); | |
718e3744 | 9589 | } |
9590 | ||
f5a4827d | 9591 | /* EBGP Multihop and GTSM */ |
6d85b15b | 9592 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d SH |
9593 | { |
9594 | if (p->gtsm_hops > 0) | |
9595 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
9596 | p->gtsm_hops, VTY_NEWLINE); | |
9597 | else if (p->ttl > 1) | |
9598 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
9599 | p->ttl, VTY_NEWLINE); | |
9600 | } | |
5d804b43 PM |
9601 | else |
9602 | { | |
9603 | if (p->gtsm_hops > 0) | |
9604 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
9605 | p->gtsm_hops, VTY_NEWLINE); | |
9606 | } | |
718e3744 | 9607 | |
9608 | /* Local address. */ | |
9609 | if (p->su_local) | |
9610 | { | |
93406d87 | 9611 | vty_out (vty, "Local host: %s, Local port: %d%s", |
718e3744 | 9612 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
9613 | ntohs (p->su_local->sin.sin_port), | |
718e3744 | 9614 | VTY_NEWLINE); |
9615 | } | |
9616 | ||
9617 | /* Remote address. */ | |
9618 | if (p->su_remote) | |
9619 | { | |
9620 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
9621 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), | |
9622 | ntohs (p->su_remote->sin.sin_port), | |
9623 | VTY_NEWLINE); | |
9624 | } | |
9625 | ||
9626 | /* Nexthop display. */ | |
9627 | if (p->su_local) | |
9628 | { | |
9629 | vty_out (vty, "Nexthop: %s%s", | |
9630 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
9631 | VTY_NEWLINE); | |
9632 | #ifdef HAVE_IPV6 | |
9633 | vty_out (vty, "Nexthop global: %s%s", | |
9634 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
9635 | VTY_NEWLINE); | |
9636 | vty_out (vty, "Nexthop local: %s%s", | |
9637 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
9638 | VTY_NEWLINE); | |
9639 | vty_out (vty, "BGP connection: %s%s", | |
9640 | p->shared_network ? "shared network" : "non shared network", | |
9641 | VTY_NEWLINE); | |
9642 | #endif /* HAVE_IPV6 */ | |
9643 | } | |
9644 | ||
9645 | /* Timer information. */ | |
9646 | if (p->t_start) | |
9647 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
9648 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
9649 | if (p->t_connect) | |
9650 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
9651 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
cb1faec9 | 9652 | if (p->t_routeadv) |
3f9c7369 | 9653 | vty_out (vty, "MRAI (interval %u) timer expires in %ld seconds%s", |
cb1faec9 DS |
9654 | p->v_routeadv, thread_timer_remain_second (p->t_routeadv), |
9655 | VTY_NEWLINE); | |
9656 | ||
9657 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
718e3744 | 9658 | p->t_read ? "on" : "off", |
9659 | p->t_write ? "on" : "off", | |
9660 | VTY_NEWLINE); | |
9661 | ||
9662 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
9663 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
9664 | bgp_capability_vty_out (vty, p); | |
9665 | ||
9666 | vty_out (vty, "%s", VTY_NEWLINE); | |
9667 | } | |
9668 | ||
94f2b392 | 9669 | static int |
718e3744 | 9670 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
a80beece | 9671 | enum show_type type, union sockunion *su, const char *conf_if) |
718e3744 | 9672 | { |
1eb8ef25 | 9673 | struct listnode *node, *nnode; |
718e3744 | 9674 | struct peer *peer; |
9675 | int find = 0; | |
9676 | ||
1eb8ef25 | 9677 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 9678 | { |
1ff9a340 DS |
9679 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
9680 | continue; | |
9681 | ||
718e3744 | 9682 | switch (type) |
9683 | { | |
9684 | case show_all: | |
9685 | bgp_show_peer (vty, peer); | |
9686 | break; | |
9687 | case show_peer: | |
a80beece DS |
9688 | if (conf_if) |
9689 | { | |
9690 | if (peer->conf_if && !strcmp(peer->conf_if, conf_if)) | |
9691 | { | |
9692 | find = 1; | |
9693 | bgp_show_peer (vty, peer); | |
9694 | } | |
9695 | } | |
9696 | else | |
9697 | { | |
9698 | if (sockunion_same (&peer->su, su)) | |
9699 | { | |
9700 | find = 1; | |
9701 | bgp_show_peer (vty, peer); | |
9702 | } | |
9703 | } | |
718e3744 | 9704 | break; |
9705 | } | |
9706 | } | |
9707 | ||
9708 | if (type == show_peer && ! find) | |
9709 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
9710 | ||
9711 | return CMD_SUCCESS; | |
9712 | } | |
9713 | ||
94f2b392 | 9714 | static int |
fd79ac91 | 9715 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
9716 | enum show_type type, const char *ip_str) | |
718e3744 | 9717 | { |
9718 | int ret; | |
9719 | struct bgp *bgp; | |
9720 | union sockunion su; | |
9721 | ||
718e3744 | 9722 | if (name) |
9723 | { | |
9724 | bgp = bgp_lookup_by_name (name); | |
718e3744 | 9725 | if (! bgp) |
9726 | { | |
9727 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
9728 | return CMD_WARNING; | |
9729 | } | |
718e3744 | 9730 | } |
a80beece DS |
9731 | else |
9732 | { | |
9733 | bgp = bgp_get_default (); | |
9734 | } | |
718e3744 | 9735 | |
9736 | if (bgp) | |
a80beece DS |
9737 | { |
9738 | if (ip_str) | |
9739 | { | |
9740 | ret = str2sockunion (ip_str, &su); | |
9741 | if (ret < 0) | |
9742 | bgp_show_neighbor (vty, bgp, type, NULL, ip_str); | |
9743 | else | |
9744 | bgp_show_neighbor (vty, bgp, type, &su, NULL); | |
9745 | } | |
9746 | else | |
9747 | { | |
9748 | bgp_show_neighbor (vty, bgp, type, NULL, NULL); | |
9749 | } | |
9750 | } | |
718e3744 | 9751 | |
9752 | return CMD_SUCCESS; | |
9753 | } | |
9754 | ||
9755 | /* "show ip bgp neighbors" commands. */ | |
9756 | DEFUN (show_ip_bgp_neighbors, | |
9757 | show_ip_bgp_neighbors_cmd, | |
9758 | "show ip bgp neighbors", | |
9759 | SHOW_STR | |
9760 | IP_STR | |
9761 | BGP_STR | |
9762 | "Detailed information on TCP and BGP neighbor connections\n") | |
9763 | { | |
9764 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); | |
9765 | } | |
9766 | ||
9767 | ALIAS (show_ip_bgp_neighbors, | |
9768 | show_ip_bgp_ipv4_neighbors_cmd, | |
9769 | "show ip bgp ipv4 (unicast|multicast) neighbors", | |
9770 | SHOW_STR | |
9771 | IP_STR | |
9772 | BGP_STR | |
9773 | "Address family\n" | |
9774 | "Address Family modifier\n" | |
9775 | "Address Family modifier\n" | |
9776 | "Detailed information on TCP and BGP neighbor connections\n") | |
9777 | ||
9778 | ALIAS (show_ip_bgp_neighbors, | |
9779 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
9780 | "show ip bgp vpnv4 all neighbors", | |
9781 | SHOW_STR | |
9782 | IP_STR | |
9783 | BGP_STR | |
9784 | "Display VPNv4 NLRI specific information\n" | |
9785 | "Display information about all VPNv4 NLRIs\n" | |
9786 | "Detailed information on TCP and BGP neighbor connections\n") | |
9787 | ||
9788 | ALIAS (show_ip_bgp_neighbors, | |
9789 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
9790 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", | |
9791 | SHOW_STR | |
9792 | IP_STR | |
9793 | BGP_STR | |
9794 | "Display VPNv4 NLRI specific information\n" | |
9795 | "Display information for a route distinguisher\n" | |
9796 | "VPN Route Distinguisher\n" | |
9797 | "Detailed information on TCP and BGP neighbor connections\n") | |
9798 | ||
9799 | ALIAS (show_ip_bgp_neighbors, | |
9800 | show_bgp_neighbors_cmd, | |
9801 | "show bgp neighbors", | |
9802 | SHOW_STR | |
9803 | BGP_STR | |
9804 | "Detailed information on TCP and BGP neighbor connections\n") | |
9805 | ||
9806 | ALIAS (show_ip_bgp_neighbors, | |
9807 | show_bgp_ipv6_neighbors_cmd, | |
9808 | "show bgp ipv6 neighbors", | |
9809 | SHOW_STR | |
9810 | BGP_STR | |
9811 | "Address family\n" | |
9812 | "Detailed information on TCP and BGP neighbor connections\n") | |
9813 | ||
9814 | DEFUN (show_ip_bgp_neighbors_peer, | |
9815 | show_ip_bgp_neighbors_peer_cmd, | |
a80beece | 9816 | "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9817 | SHOW_STR |
9818 | IP_STR | |
9819 | BGP_STR | |
9820 | "Detailed information on TCP and BGP neighbor connections\n" | |
9821 | "Neighbor to display information about\n" | |
a80beece DS |
9822 | "Neighbor to display information about\n" |
9823 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9824 | { |
9825 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); | |
9826 | } | |
9827 | ||
9828 | ALIAS (show_ip_bgp_neighbors_peer, | |
9829 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
a80beece | 9830 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9831 | SHOW_STR |
9832 | IP_STR | |
9833 | BGP_STR | |
9834 | "Address family\n" | |
9835 | "Address Family modifier\n" | |
9836 | "Address Family modifier\n" | |
9837 | "Detailed information on TCP and BGP neighbor connections\n" | |
9838 | "Neighbor to display information about\n" | |
a80beece DS |
9839 | "Neighbor to display information about\n" |
9840 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9841 | |
9842 | ALIAS (show_ip_bgp_neighbors_peer, | |
9843 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
9844 | "show ip bgp vpnv4 all neighbors A.B.C.D", | |
9845 | SHOW_STR | |
9846 | IP_STR | |
9847 | BGP_STR | |
9848 | "Display VPNv4 NLRI specific information\n" | |
9849 | "Display information about all VPNv4 NLRIs\n" | |
9850 | "Detailed information on TCP and BGP neighbor connections\n" | |
9851 | "Neighbor to display information about\n") | |
9852 | ||
9853 | ALIAS (show_ip_bgp_neighbors_peer, | |
9854 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
9855 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", | |
9856 | SHOW_STR | |
9857 | IP_STR | |
9858 | BGP_STR | |
9859 | "Display VPNv4 NLRI specific information\n" | |
9860 | "Display information about all VPNv4 NLRIs\n" | |
9861 | "Detailed information on TCP and BGP neighbor connections\n" | |
9862 | "Neighbor to display information about\n") | |
9863 | ||
9864 | ALIAS (show_ip_bgp_neighbors_peer, | |
9865 | show_bgp_neighbors_peer_cmd, | |
a80beece | 9866 | "show bgp neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9867 | SHOW_STR |
9868 | BGP_STR | |
9869 | "Detailed information on TCP and BGP neighbor connections\n" | |
9870 | "Neighbor to display information about\n" | |
a80beece DS |
9871 | "Neighbor to display information about\n" |
9872 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9873 | |
9874 | ALIAS (show_ip_bgp_neighbors_peer, | |
9875 | show_bgp_ipv6_neighbors_peer_cmd, | |
a80beece | 9876 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9877 | SHOW_STR |
9878 | BGP_STR | |
9879 | "Address family\n" | |
9880 | "Detailed information on TCP and BGP neighbor connections\n" | |
9881 | "Neighbor to display information about\n" | |
a80beece DS |
9882 | "Neighbor to display information about\n" |
9883 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9884 | |
9885 | DEFUN (show_ip_bgp_instance_neighbors, | |
9886 | show_ip_bgp_instance_neighbors_cmd, | |
9887 | "show ip bgp view WORD neighbors", | |
9888 | SHOW_STR | |
9889 | IP_STR | |
9890 | BGP_STR | |
9891 | "BGP view\n" | |
9892 | "View name\n" | |
9893 | "Detailed information on TCP and BGP neighbor connections\n") | |
9894 | { | |
9895 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); | |
9896 | } | |
9897 | ||
bb46e94f | 9898 | ALIAS (show_ip_bgp_instance_neighbors, |
9899 | show_bgp_instance_neighbors_cmd, | |
9900 | "show bgp view WORD neighbors", | |
9901 | SHOW_STR | |
9902 | BGP_STR | |
9903 | "BGP view\n" | |
9904 | "View name\n" | |
9905 | "Detailed information on TCP and BGP neighbor connections\n") | |
9906 | ||
9907 | ALIAS (show_ip_bgp_instance_neighbors, | |
9908 | show_bgp_instance_ipv6_neighbors_cmd, | |
9909 | "show bgp view WORD ipv6 neighbors", | |
9910 | SHOW_STR | |
9911 | BGP_STR | |
9912 | "BGP view\n" | |
9913 | "View name\n" | |
9914 | "Address family\n" | |
9915 | "Detailed information on TCP and BGP neighbor connections\n") | |
9916 | ||
718e3744 | 9917 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
9918 | show_ip_bgp_instance_neighbors_peer_cmd, | |
a80beece | 9919 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 9920 | SHOW_STR |
9921 | IP_STR | |
9922 | BGP_STR | |
9923 | "BGP view\n" | |
9924 | "View name\n" | |
9925 | "Detailed information on TCP and BGP neighbor connections\n" | |
9926 | "Neighbor to display information about\n" | |
a80beece DS |
9927 | "Neighbor to display information about\n" |
9928 | "Neighbor on bgp configured interface\n") | |
718e3744 | 9929 | { |
9930 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); | |
9931 | } | |
bb46e94f | 9932 | |
9933 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
9934 | show_bgp_instance_neighbors_peer_cmd, | |
a80beece | 9935 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD)", |
bb46e94f | 9936 | SHOW_STR |
9937 | BGP_STR | |
9938 | "BGP view\n" | |
9939 | "View name\n" | |
9940 | "Detailed information on TCP and BGP neighbor connections\n" | |
9941 | "Neighbor to display information about\n" | |
a80beece DS |
9942 | "Neighbor to display information about\n" |
9943 | "Neighbor on bgp configured interface\n") | |
bb46e94f | 9944 | |
9945 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
9946 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
a80beece | 9947 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD)", |
bb46e94f | 9948 | SHOW_STR |
9949 | BGP_STR | |
9950 | "BGP view\n" | |
9951 | "View name\n" | |
9952 | "Address family\n" | |
9953 | "Detailed information on TCP and BGP neighbor connections\n" | |
9954 | "Neighbor to display information about\n" | |
a80beece DS |
9955 | "Neighbor to display information about\n" |
9956 | "Neighbor on bgp configured interface\n") | |
6b0655a2 | 9957 | |
718e3744 | 9958 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
9959 | paths' and `show ip mbgp paths'. Those functions results are the | |
9960 | same.*/ | |
9961 | DEFUN (show_ip_bgp_paths, | |
9962 | show_ip_bgp_paths_cmd, | |
9963 | "show ip bgp paths", | |
9964 | SHOW_STR | |
9965 | IP_STR | |
9966 | BGP_STR | |
9967 | "Path information\n") | |
9968 | { | |
9969 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
9970 | aspath_print_all_vty (vty); | |
9971 | return CMD_SUCCESS; | |
9972 | } | |
9973 | ||
9974 | DEFUN (show_ip_bgp_ipv4_paths, | |
9975 | show_ip_bgp_ipv4_paths_cmd, | |
9976 | "show ip bgp ipv4 (unicast|multicast) paths", | |
9977 | SHOW_STR | |
9978 | IP_STR | |
9979 | BGP_STR | |
9980 | "Address family\n" | |
9981 | "Address Family modifier\n" | |
9982 | "Address Family modifier\n" | |
9983 | "Path information\n") | |
9984 | { | |
9985 | vty_out (vty, "Address Refcnt Path\r\n"); | |
9986 | aspath_print_all_vty (vty); | |
9987 | ||
9988 | return CMD_SUCCESS; | |
9989 | } | |
6b0655a2 | 9990 | |
718e3744 | 9991 | #include "hash.h" |
9992 | ||
94f2b392 | 9993 | static void |
718e3744 | 9994 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
9995 | { | |
9996 | struct community *com; | |
9997 | ||
9998 | com = (struct community *) backet->data; | |
9999 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, | |
10000 | community_str (com), VTY_NEWLINE); | |
10001 | } | |
10002 | ||
10003 | /* Show BGP's community internal data. */ | |
10004 | DEFUN (show_ip_bgp_community_info, | |
10005 | show_ip_bgp_community_info_cmd, | |
10006 | "show ip bgp community-info", | |
10007 | SHOW_STR | |
10008 | IP_STR | |
10009 | BGP_STR | |
10010 | "List all bgp community information\n") | |
10011 | { | |
10012 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
10013 | ||
10014 | hash_iterate (community_hash (), | |
10015 | (void (*) (struct hash_backet *, void *)) | |
10016 | community_show_all_iterator, | |
10017 | vty); | |
10018 | ||
10019 | return CMD_SUCCESS; | |
10020 | } | |
10021 | ||
10022 | DEFUN (show_ip_bgp_attr_info, | |
10023 | show_ip_bgp_attr_info_cmd, | |
10024 | "show ip bgp attribute-info", | |
10025 | SHOW_STR | |
10026 | IP_STR | |
10027 | BGP_STR | |
10028 | "List all bgp attribute information\n") | |
10029 | { | |
10030 | attr_show_all (vty); | |
10031 | return CMD_SUCCESS; | |
10032 | } | |
6b0655a2 | 10033 | |
94f2b392 | 10034 | static int |
fee0f4c6 | 10035 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
10036 | afi_t afi, safi_t safi) | |
10037 | { | |
10038 | char timebuf[BGP_UPTIME_LEN]; | |
10039 | char rmbuf[14]; | |
fd79ac91 | 10040 | const char *rmname; |
fee0f4c6 | 10041 | struct peer *peer; |
1eb8ef25 | 10042 | struct listnode *node, *nnode; |
fee0f4c6 | 10043 | int len; |
10044 | int count = 0; | |
10045 | ||
10046 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) | |
10047 | { | |
1eb8ef25 | 10048 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
fee0f4c6 | 10049 | { |
10050 | count++; | |
10051 | bgp_write_rsclient_summary (vty, peer, afi, safi); | |
10052 | } | |
10053 | return count; | |
10054 | } | |
10055 | ||
10056 | len = vty_out (vty, "%s", rsclient->host); | |
10057 | len = 16 - len; | |
10058 | ||
10059 | if (len < 1) | |
10060 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
10061 | else | |
10062 | vty_out (vty, "%*s", len, " "); | |
10063 | ||
3d515fd9 | 10064 | vty_out (vty, "4 "); |
fee0f4c6 | 10065 | |
0b2aa3a0 | 10066 | vty_out (vty, "%11d ", rsclient->as); |
fee0f4c6 | 10067 | |
10068 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); | |
10069 | if ( rmname && strlen (rmname) > 13 ) | |
10070 | { | |
10071 | sprintf (rmbuf, "%13s", "..."); | |
10072 | rmname = strncpy (rmbuf, rmname, 10); | |
10073 | } | |
10074 | else if (! rmname) | |
10075 | rmname = "<none>"; | |
10076 | vty_out (vty, " %13s ", rmname); | |
10077 | ||
10078 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); | |
10079 | if ( rmname && strlen (rmname) > 13 ) | |
10080 | { | |
10081 | sprintf (rmbuf, "%13s", "..."); | |
10082 | rmname = strncpy (rmbuf, rmname, 10); | |
10083 | } | |
10084 | else if (! rmname) | |
10085 | rmname = "<none>"; | |
10086 | vty_out (vty, " %13s ", rmname); | |
10087 | ||
10088 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); | |
10089 | ||
10090 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) | |
10091 | vty_out (vty, " Idle (Admin)"); | |
10092 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
10093 | vty_out (vty, " Idle (PfxCt)"); | |
10094 | else | |
10095 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); | |
10096 | ||
10097 | vty_out (vty, "%s", VTY_NEWLINE); | |
10098 | ||
10099 | return 1; | |
10100 | } | |
10101 | ||
94f2b392 | 10102 | static int |
fd79ac91 | 10103 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
10104 | afi_t afi, safi_t safi) | |
fee0f4c6 | 10105 | { |
10106 | struct peer *peer; | |
1eb8ef25 | 10107 | struct listnode *node, *nnode; |
fee0f4c6 | 10108 | int count = 0; |
10109 | ||
10110 | /* Header string for each address family. */ | |
10111 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; | |
10112 | ||
1eb8ef25 | 10113 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
fee0f4c6 | 10114 | { |
10115 | if (peer->afc[afi][safi] && | |
10116 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
10117 | { | |
10118 | if (! count) | |
10119 | { | |
10120 | vty_out (vty, | |
10121 | "Route Server's BGP router identifier %s%s", | |
10122 | inet_ntoa (bgp->router_id), VTY_NEWLINE); | |
10123 | vty_out (vty, | |
aea339f7 | 10124 | "Route Server's local AS number %u%s", bgp->as, |
fee0f4c6 | 10125 | VTY_NEWLINE); |
10126 | ||
10127 | vty_out (vty, "%s", VTY_NEWLINE); | |
10128 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
10129 | } | |
10130 | ||
10131 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); | |
10132 | } | |
10133 | } | |
10134 | ||
10135 | if (count) | |
10136 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, | |
10137 | count, VTY_NEWLINE); | |
10138 | else | |
10139 | vty_out (vty, "No %s Route Server Client is configured%s", | |
10140 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
10141 | ||
10142 | return CMD_SUCCESS; | |
10143 | } | |
10144 | ||
94f2b392 | 10145 | static int |
fd79ac91 | 10146 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
10147 | afi_t afi, safi_t safi) | |
fee0f4c6 | 10148 | { |
10149 | struct bgp *bgp; | |
10150 | ||
10151 | if (name) | |
10152 | { | |
10153 | bgp = bgp_lookup_by_name (name); | |
10154 | ||
10155 | if (! bgp) | |
10156 | { | |
10157 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
10158 | return CMD_WARNING; | |
10159 | } | |
10160 | ||
10161 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
10162 | return CMD_SUCCESS; | |
10163 | } | |
10164 | ||
10165 | bgp = bgp_get_default (); | |
10166 | ||
10167 | if (bgp) | |
10168 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
10169 | ||
10170 | return CMD_SUCCESS; | |
10171 | } | |
10172 | ||
10173 | /* 'show bgp rsclient' commands. */ | |
10174 | DEFUN (show_ip_bgp_rsclient_summary, | |
10175 | show_ip_bgp_rsclient_summary_cmd, | |
10176 | "show ip bgp rsclient summary", | |
10177 | SHOW_STR | |
10178 | IP_STR | |
10179 | BGP_STR | |
10180 | "Information about Route Server Clients\n" | |
10181 | "Summary of all Route Server Clients\n") | |
10182 | { | |
10183 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
10184 | } | |
10185 | ||
10186 | DEFUN (show_ip_bgp_instance_rsclient_summary, | |
10187 | show_ip_bgp_instance_rsclient_summary_cmd, | |
10188 | "show ip bgp view WORD rsclient summary", | |
10189 | SHOW_STR | |
10190 | IP_STR | |
10191 | BGP_STR | |
10192 | "BGP view\n" | |
10193 | "View name\n" | |
10194 | "Information about Route Server Clients\n" | |
10195 | "Summary of all Route Server Clients\n") | |
10196 | { | |
10197 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
10198 | } | |
10199 | ||
10200 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, | |
10201 | show_ip_bgp_ipv4_rsclient_summary_cmd, | |
10202 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", | |
10203 | SHOW_STR | |
10204 | IP_STR | |
10205 | BGP_STR | |
10206 | "Address family\n" | |
10207 | "Address Family modifier\n" | |
10208 | "Address Family modifier\n" | |
10209 | "Information about Route Server Clients\n" | |
10210 | "Summary of all Route Server Clients\n") | |
10211 | { | |
10212 | if (strncmp (argv[0], "m", 1) == 0) | |
10213 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); | |
10214 | ||
10215 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
10216 | } | |
10217 | ||
10218 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, | |
10219 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, | |
10220 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
10221 | SHOW_STR | |
10222 | IP_STR | |
10223 | BGP_STR | |
10224 | "BGP view\n" | |
10225 | "View name\n" | |
10226 | "Address family\n" | |
10227 | "Address Family modifier\n" | |
10228 | "Address Family modifier\n" | |
10229 | "Information about Route Server Clients\n" | |
10230 | "Summary of all Route Server Clients\n") | |
10231 | { | |
10232 | if (strncmp (argv[1], "m", 1) == 0) | |
10233 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); | |
10234 | ||
10235 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
10236 | } | |
10237 | ||
95cbbd2a ML |
10238 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
10239 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, | |
10240 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
10241 | SHOW_STR | |
10242 | BGP_STR | |
10243 | "BGP view\n" | |
10244 | "View name\n" | |
10245 | "Address family\n" | |
10246 | "Address Family modifier\n" | |
10247 | "Address Family modifier\n" | |
10248 | "Information about Route Server Clients\n" | |
10249 | "Summary of all Route Server Clients\n") | |
10250 | { | |
10251 | safi_t safi; | |
10252 | ||
10253 | if (argc == 2) { | |
10254 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10255 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); | |
10256 | } else { | |
10257 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10258 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); | |
10259 | } | |
10260 | } | |
10261 | ||
10262 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, | |
10263 | show_bgp_ipv4_safi_rsclient_summary_cmd, | |
10264 | "show bgp ipv4 (unicast|multicast) rsclient summary", | |
10265 | SHOW_STR | |
10266 | BGP_STR | |
10267 | "Address family\n" | |
10268 | "Address Family modifier\n" | |
10269 | "Address Family modifier\n" | |
10270 | "Information about Route Server Clients\n" | |
10271 | "Summary of all Route Server Clients\n") | |
10272 | ||
fee0f4c6 | 10273 | #ifdef HAVE_IPV6 |
10274 | DEFUN (show_bgp_rsclient_summary, | |
10275 | show_bgp_rsclient_summary_cmd, | |
10276 | "show bgp rsclient summary", | |
10277 | SHOW_STR | |
10278 | BGP_STR | |
10279 | "Information about Route Server Clients\n" | |
10280 | "Summary of all Route Server Clients\n") | |
10281 | { | |
10282 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
10283 | } | |
10284 | ||
10285 | DEFUN (show_bgp_instance_rsclient_summary, | |
10286 | show_bgp_instance_rsclient_summary_cmd, | |
10287 | "show bgp view WORD rsclient summary", | |
10288 | SHOW_STR | |
10289 | BGP_STR | |
10290 | "BGP view\n" | |
10291 | "View name\n" | |
10292 | "Information about Route Server Clients\n" | |
10293 | "Summary of all Route Server Clients\n") | |
10294 | { | |
10295 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); | |
10296 | } | |
10297 | ||
10298 | ALIAS (show_bgp_rsclient_summary, | |
10299 | show_bgp_ipv6_rsclient_summary_cmd, | |
10300 | "show bgp ipv6 rsclient summary", | |
10301 | SHOW_STR | |
10302 | BGP_STR | |
10303 | "Address family\n" | |
10304 | "Information about Route Server Clients\n" | |
10305 | "Summary of all Route Server Clients\n") | |
10306 | ||
10307 | ALIAS (show_bgp_instance_rsclient_summary, | |
10308 | show_bgp_instance_ipv6_rsclient_summary_cmd, | |
10309 | "show bgp view WORD ipv6 rsclient summary", | |
10310 | SHOW_STR | |
10311 | BGP_STR | |
10312 | "BGP view\n" | |
10313 | "View name\n" | |
10314 | "Address family\n" | |
10315 | "Information about Route Server Clients\n" | |
10316 | "Summary of all Route Server Clients\n") | |
95cbbd2a ML |
10317 | |
10318 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, | |
10319 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, | |
10320 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", | |
10321 | SHOW_STR | |
10322 | BGP_STR | |
10323 | "BGP view\n" | |
10324 | "View name\n" | |
10325 | "Address family\n" | |
10326 | "Address Family modifier\n" | |
10327 | "Address Family modifier\n" | |
10328 | "Information about Route Server Clients\n" | |
10329 | "Summary of all Route Server Clients\n") | |
10330 | { | |
10331 | safi_t safi; | |
10332 | ||
10333 | if (argc == 2) { | |
10334 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10335 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); | |
10336 | } else { | |
10337 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10338 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); | |
10339 | } | |
10340 | } | |
10341 | ||
10342 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, | |
10343 | show_bgp_ipv6_safi_rsclient_summary_cmd, | |
10344 | "show bgp ipv6 (unicast|multicast) rsclient summary", | |
10345 | SHOW_STR | |
10346 | BGP_STR | |
10347 | "Address family\n" | |
10348 | "Address Family modifier\n" | |
10349 | "Address Family modifier\n" | |
10350 | "Information about Route Server Clients\n" | |
10351 | "Summary of all Route Server Clients\n") | |
10352 | ||
fee0f4c6 | 10353 | #endif /* HAVE IPV6 */ |
6b0655a2 | 10354 | |
3f9c7369 DS |
10355 | DEFUN (show_ip_bgp_updgrps, |
10356 | show_ip_bgp_updgrps_cmd, | |
10357 | "show ip bgp update-groups summary", | |
10358 | SHOW_STR | |
10359 | IP_STR | |
10360 | BGP_STR | |
10361 | "BGP update groups\n" | |
10362 | "Summary information\n") | |
10363 | { | |
10364 | struct bgp *bgp; | |
10365 | ||
10366 | bgp = bgp_get_default(); | |
10367 | if (bgp) | |
10368 | update_group_show(bgp, AFI_IP, SAFI_UNICAST, vty); | |
10369 | return CMD_SUCCESS; | |
10370 | } | |
10371 | ||
10372 | DEFUN (show_bgp_ipv6_updgrps, | |
10373 | show_bgp_ipv6_updgrps_cmd, | |
10374 | "show bgp update-groups summary", | |
10375 | SHOW_STR | |
10376 | BGP_STR | |
10377 | "BGP update groups\n" | |
10378 | "Summary information\n") | |
10379 | { | |
10380 | struct bgp *bgp; | |
10381 | ||
10382 | bgp = bgp_get_default(); | |
10383 | if (bgp) | |
10384 | update_group_show(bgp, AFI_IP6, SAFI_UNICAST, vty); | |
10385 | return CMD_SUCCESS; | |
10386 | } | |
10387 | ||
10388 | DEFUN (show_bgp_updgrps, | |
10389 | show_bgp_updgrps_cmd, | |
10390 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups summary", | |
10391 | SHOW_STR | |
10392 | BGP_STR | |
10393 | "Address family\n" | |
10394 | "Address family\n" | |
10395 | "Address Family modifier\n" | |
10396 | "Address Family modifier\n" | |
10397 | "BGP update groups\n" | |
10398 | "Summary information\n") | |
10399 | { | |
10400 | struct bgp *bgp; | |
10401 | afi_t afi; | |
10402 | safi_t safi; | |
10403 | ||
10404 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
10405 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10406 | bgp = bgp_get_default(); | |
10407 | if (bgp) | |
10408 | update_group_show(bgp, afi, safi, vty); | |
10409 | return CMD_SUCCESS; | |
10410 | } | |
10411 | ||
10412 | DEFUN (show_bgp_updgrps_stats, | |
10413 | show_bgp_updgrps_stats_cmd, | |
10414 | "show bgp update-groups statistics", | |
10415 | SHOW_STR | |
10416 | BGP_STR | |
10417 | "BGP update groups\n" | |
10418 | "Statistics\n") | |
10419 | { | |
10420 | struct bgp *bgp; | |
10421 | ||
10422 | bgp = bgp_get_default(); | |
10423 | if (bgp) | |
10424 | update_group_show_stats(bgp, vty); | |
10425 | ||
10426 | return CMD_SUCCESS; | |
10427 | } | |
10428 | ||
10429 | static void | |
10430 | show_bgp_updgrps_adj_info_aux (struct vty *vty, afi_t afi, safi_t safi, | |
10431 | const char *what, u_int64_t subgrp_id) | |
10432 | { | |
10433 | struct bgp *bgp; | |
10434 | bgp = bgp_get_default(); | |
10435 | if (bgp) | |
10436 | { | |
10437 | if (!strcmp(what, "advertise-queue")) | |
10438 | update_group_show_adj_queue(bgp, afi, safi, vty, subgrp_id); | |
10439 | else if (!strcmp(what, "advertised-routes")) | |
10440 | update_group_show_advertised(bgp, afi, safi, vty, subgrp_id); | |
10441 | else if (!strcmp(what, "packet-queue")) | |
10442 | update_group_show_packet_queue(bgp, afi, safi, vty, subgrp_id); | |
10443 | } | |
10444 | } | |
10445 | ||
10446 | DEFUN (show_ip_bgp_updgrps_adj, | |
10447 | show_ip_bgp_updgrps_adj_cmd, | |
10448 | "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
10449 | SHOW_STR | |
10450 | IP_STR | |
10451 | BGP_STR | |
10452 | "BGP update groups\n" | |
10453 | "Advertisement queue\n" | |
10454 | "Announced routes\n" | |
10455 | "Packet queue\n") | |
10456 | { | |
10457 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP, SAFI_UNICAST, argv[0], 0); | |
10458 | return CMD_SUCCESS; | |
10459 | } | |
10460 | ||
10461 | DEFUN (show_bgp_updgrps_afi_adj, | |
10462 | show_bgp_updgrps_afi_adj_cmd, | |
10463 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)", | |
10464 | SHOW_STR | |
10465 | BGP_STR | |
10466 | "Address family\n" | |
10467 | "Address family\n" | |
10468 | "Address Family modifier\n" | |
10469 | "Address Family modifier\n" | |
10470 | "BGP update groups\n" | |
10471 | "Advertisement queue\n" | |
10472 | "Announced routes\n" | |
10473 | "Packet queue\n") | |
10474 | { | |
10475 | afi_t afi; | |
10476 | safi_t safi; | |
10477 | ||
10478 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
10479 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10480 | show_bgp_updgrps_adj_info_aux(vty, afi, safi, argv[2], 0); | |
10481 | } | |
10482 | ||
10483 | DEFUN (show_bgp_updgrps_adj, | |
10484 | show_bgp_updgrps_adj_cmd, | |
10485 | "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)", | |
10486 | SHOW_STR | |
10487 | BGP_STR | |
10488 | "BGP update groups\n" | |
10489 | "Advertisement queue\n" | |
10490 | "Announced routes\n" | |
10491 | "Packet queue\n") | |
10492 | { | |
10493 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP6, SAFI_UNICAST, argv[0], 0); | |
10494 | return CMD_SUCCESS; | |
10495 | } | |
10496 | ||
10497 | DEFUN (show_ip_bgp_updgrps_adj_s, | |
10498 | show_ip_bgp_updgrps_adj_subgroup_cmd, | |
10499 | "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
10500 | SHOW_STR | |
10501 | IP_STR | |
10502 | BGP_STR | |
10503 | "BGP update groups\n" | |
10504 | "64-bit subgroup id\n" | |
10505 | "Advertisement queue\n" | |
10506 | "Announced routes\n" | |
10507 | "Packet queue\n") | |
10508 | { | |
10509 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP, SAFI_UNICAST, argv[1], | |
10510 | atoll(argv[0])); | |
10511 | return CMD_SUCCESS; | |
10512 | } | |
10513 | ||
10514 | DEFUN (show_bgp_updgrps_adj_s, | |
10515 | show_bgp_updgrps_adj_subgroup_cmd, | |
10516 | "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
10517 | SHOW_STR | |
10518 | BGP_STR | |
10519 | "BGP update groups\n" | |
10520 | "64-bit subgroup id\n" | |
10521 | "Advertisement queue\n" | |
10522 | "Announced routes\n" | |
10523 | "Packet queue\n") | |
10524 | { | |
10525 | show_bgp_updgrps_adj_info_aux(vty, AFI_IP6, SAFI_UNICAST, argv[1], | |
10526 | atoll(argv[0])); | |
10527 | return CMD_SUCCESS; | |
10528 | } | |
10529 | ||
10530 | DEFUN (show_bgp_updgrps_afi_adj_subgroup, | |
10531 | show_bgp_updgrps_afi_adj_subgroup_cmd, | |
10532 | "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)", | |
10533 | SHOW_STR | |
10534 | BGP_STR | |
10535 | "Address family\n" | |
10536 | "Address family\n" | |
10537 | "Address Family modifier\n" | |
10538 | "Address Family modifier\n" | |
10539 | "BGP update groups\n" | |
10540 | "64-bit subgroup id\n" | |
10541 | "Advertisement queue\n" | |
10542 | "Announced routes\n" | |
10543 | "Packet queue\n") | |
10544 | { | |
10545 | afi_t afi; | |
10546 | safi_t safi; | |
10547 | ||
10548 | afi = (strcmp(argv[0], "ipv4") == 0) ? AFI_IP : AFI_IP6; | |
10549 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
10550 | show_bgp_updgrps_adj_info_aux(vty, afi, safi, argv[3], atoll(argv[2])); | |
10551 | } | |
10552 | ||
f14e6fdb DS |
10553 | static int |
10554 | bgp_show_one_peer_group (struct vty *vty, struct peer_group *group) | |
10555 | { | |
10556 | struct listnode *node, *nnode; | |
10557 | struct prefix *range; | |
10558 | struct peer *conf; | |
10559 | struct peer *peer; | |
10560 | char buf[128]; | |
10561 | afi_t afi; | |
10562 | safi_t safi; | |
10563 | char *peer_status, *af_str; | |
10564 | int lr_count; | |
10565 | int dynamic; | |
10566 | int af_cfgd; | |
10567 | ||
10568 | conf = group->conf; | |
10569 | ||
10570 | vty_out (vty, "%sBGP peer-group %s, remote AS %d%s", | |
10571 | VTY_NEWLINE, group->name, conf->as, VTY_NEWLINE); | |
10572 | ||
10573 | if (group->bgp->as == conf->as) | |
10574 | vty_out (vty, " Peer-group type is internal%s", VTY_NEWLINE); | |
10575 | else | |
10576 | vty_out (vty, " Peer-group type is external%s", VTY_NEWLINE); | |
10577 | ||
10578 | /* Display AFs configured. */ | |
10579 | vty_out (vty, " Configured address-families:"); | |
10580 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
10581 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
10582 | { | |
10583 | if (conf->afc[afi][safi]) | |
10584 | { | |
10585 | af_cfgd = 1; | |
10586 | vty_out (vty, " %s;", afi_safi_print(afi, safi)); | |
10587 | } | |
10588 | } | |
10589 | if (!af_cfgd) | |
10590 | vty_out (vty, " none%s", VTY_NEWLINE); | |
10591 | else | |
10592 | vty_out (vty, "%s", VTY_NEWLINE); | |
10593 | ||
10594 | /* Display listen ranges (for dynamic neighbors), if any */ | |
10595 | for (afi = AFI_IP; afi < AFI_MAX; afi++) | |
10596 | { | |
10597 | if (afi == AFI_IP) | |
10598 | af_str = "IPv4"; | |
10599 | else if (afi == AFI_IP6) | |
10600 | af_str = "IPv6"; | |
10601 | lr_count = listcount(group->listen_range[afi]); | |
10602 | if (lr_count) | |
10603 | { | |
10604 | vty_out(vty, | |
10605 | " %d %s listen range(s)%s", | |
10606 | lr_count, af_str, VTY_NEWLINE); | |
10607 | ||
10608 | ||
10609 | for (ALL_LIST_ELEMENTS (group->listen_range[afi], node, | |
10610 | nnode, range)) | |
10611 | { | |
10612 | prefix2str(range, buf, sizeof(buf)); | |
10613 | vty_out(vty, " %s%s", buf, VTY_NEWLINE); | |
10614 | } | |
10615 | } | |
10616 | } | |
10617 | ||
10618 | /* Display group members and their status */ | |
10619 | if (listcount(group->peer)) | |
10620 | { | |
10621 | vty_out (vty, " Peer-group members:%s", VTY_NEWLINE); | |
10622 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) | |
10623 | { | |
10624 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
10625 | peer_status = "Idle (Admin)"; | |
10626 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
10627 | peer_status = "Idle (PfxCt)"; | |
10628 | else | |
10629 | peer_status = LOOKUP(bgp_status_msg, peer->status); | |
10630 | ||
10631 | dynamic = peer_dynamic_neighbor(peer); | |
10632 | vty_out (vty, " %s %s %s %s", | |
10633 | peer->host, dynamic ? "(dynamic)" : "", | |
10634 | peer_status, VTY_NEWLINE); | |
10635 | } | |
10636 | } | |
10637 | ||
10638 | return CMD_SUCCESS; | |
10639 | } | |
10640 | ||
10641 | /* Show BGP peer group's information. */ | |
10642 | enum show_group_type | |
10643 | { | |
10644 | show_all_groups, | |
10645 | show_peer_group | |
10646 | }; | |
10647 | ||
10648 | static int | |
10649 | bgp_show_peer_group (struct vty *vty, struct bgp *bgp, | |
10650 | enum show_group_type type, const char *group_name) | |
10651 | { | |
10652 | struct listnode *node, *nnode; | |
10653 | struct peer_group *group; | |
10654 | int find = 0; | |
10655 | ||
10656 | for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) | |
10657 | { | |
10658 | switch (type) | |
10659 | { | |
10660 | case show_all_groups: | |
10661 | bgp_show_one_peer_group (vty, group); | |
10662 | break; | |
10663 | case show_peer_group: | |
10664 | if (group_name && (strcmp(group->name, group_name) == 0)) | |
10665 | { | |
10666 | find = 1; | |
10667 | bgp_show_one_peer_group (vty, group); | |
10668 | } | |
10669 | break; | |
10670 | } | |
10671 | } | |
10672 | ||
10673 | if (type == show_peer_group && ! find) | |
10674 | vty_out (vty, "%% No such peer-groupr%s", VTY_NEWLINE); | |
10675 | ||
10676 | return CMD_SUCCESS; | |
10677 | } | |
10678 | ||
10679 | static int | |
10680 | bgp_show_peer_group_vty (struct vty *vty, const char *name, | |
10681 | enum show_group_type type, const char *group_name) | |
10682 | { | |
10683 | struct bgp *bgp; | |
10684 | int ret = CMD_SUCCESS; | |
10685 | ||
10686 | if (name) | |
10687 | { | |
10688 | bgp = bgp_lookup_by_name (name); | |
10689 | ||
10690 | if (! bgp) | |
10691 | { | |
10692 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
10693 | return CMD_WARNING; | |
10694 | } | |
10695 | } | |
10696 | ||
10697 | bgp = bgp_get_default (); | |
10698 | ||
10699 | if (bgp) | |
10700 | ret = bgp_show_peer_group (vty, bgp, type, group_name); | |
10701 | ||
10702 | return ret; | |
10703 | } | |
10704 | ||
10705 | DEFUN (show_ip_bgp_peer_groups, | |
10706 | show_ip_bgp_peer_groups_cmd, | |
10707 | "show ip bgp peer-group", | |
10708 | SHOW_STR | |
10709 | IP_STR | |
10710 | BGP_STR | |
10711 | "Detailed information on all BGP peer groups\n") | |
10712 | { | |
10713 | return bgp_show_peer_group_vty (vty, NULL, show_all_groups, NULL); | |
10714 | } | |
10715 | ||
10716 | DEFUN (show_ip_bgp_instance_peer_groups, | |
10717 | show_ip_bgp_instance_peer_groups_cmd, | |
10718 | "show ip bgp view WORD peer-group", | |
10719 | SHOW_STR | |
10720 | IP_STR | |
10721 | BGP_STR | |
10722 | "BGP View\n" | |
10723 | "Detailed information on all BGP peer groups\n") | |
10724 | { | |
10725 | return bgp_show_peer_group_vty (vty, argv[0], show_all_groups, NULL); | |
10726 | } | |
10727 | ||
10728 | DEFUN (show_ip_bgp_peer_group, | |
10729 | show_ip_bgp_peer_group_cmd, | |
10730 | "show ip bgp peer-group WORD", | |
10731 | SHOW_STR | |
10732 | IP_STR | |
10733 | BGP_STR | |
10734 | "BGP peer-group name\n" | |
10735 | "Detailed information on a BGP peer group\n") | |
10736 | { | |
10737 | return bgp_show_peer_group_vty (vty, NULL, show_peer_group, argv[0]); | |
10738 | } | |
10739 | ||
10740 | DEFUN (show_ip_bgp_instance_peer_group, | |
10741 | show_ip_bgp_instance_peer_group_cmd, | |
10742 | "show ip bgp view WORD peer-group WORD", | |
10743 | SHOW_STR | |
10744 | IP_STR | |
10745 | BGP_STR | |
10746 | "BGP View\n" | |
10747 | "BGP peer-group name\n" | |
10748 | "Detailed information on a BGP peer group\n") | |
10749 | { | |
10750 | return bgp_show_peer_group_vty (vty, argv[0], show_peer_group, argv[1]); | |
10751 | } | |
3f9c7369 | 10752 | |
718e3744 | 10753 | /* Redistribute VTY commands. */ |
10754 | ||
718e3744 | 10755 | DEFUN (bgp_redistribute_ipv4, |
10756 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 10757 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 10758 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 10759 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 10760 | { |
10761 | int type; | |
10762 | ||
e0ca5fde DL |
10763 | type = proto_redistnum (AFI_IP, argv[0]); |
10764 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 10765 | { |
10766 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
10767 | return CMD_WARNING; | |
10768 | } | |
7c8ff89e | 10769 | bgp_redist_add(vty->index, AFI_IP, type, 0); |
8bb0831e | 10770 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 10771 | } |
10772 | ||
10773 | DEFUN (bgp_redistribute_ipv4_rmap, | |
10774 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 10775 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 10776 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 10777 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 10778 | "Route map reference\n" |
10779 | "Pointer to route-map entries\n") | |
10780 | { | |
10781 | int type; | |
7c8ff89e | 10782 | struct bgp_redist *red; |
718e3744 | 10783 | |
e0ca5fde DL |
10784 | type = proto_redistnum (AFI_IP, argv[0]); |
10785 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 10786 | { |
10787 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
10788 | return CMD_WARNING; | |
10789 | } | |
10790 | ||
7c8ff89e DS |
10791 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
10792 | bgp_redistribute_rmap_set (red, argv[1]); | |
8bb0831e | 10793 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 10794 | } |
10795 | ||
10796 | DEFUN (bgp_redistribute_ipv4_metric, | |
10797 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 10798 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 10799 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 10800 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 10801 | "Metric for redistributed routes\n" |
10802 | "Default metric\n") | |
10803 | { | |
10804 | int type; | |
10805 | u_int32_t metric; | |
7c8ff89e | 10806 | struct bgp_redist *red; |
718e3744 | 10807 | |
e0ca5fde DL |
10808 | type = proto_redistnum (AFI_IP, argv[0]); |
10809 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 10810 | { |
10811 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
10812 | return CMD_WARNING; | |
10813 | } | |
10814 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
10815 | ||
7c8ff89e DS |
10816 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
10817 | bgp_redistribute_metric_set (red, metric); | |
8bb0831e | 10818 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 10819 | } |
10820 | ||
10821 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
10822 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 10823 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 10824 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 10825 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 10826 | "Route map reference\n" |
10827 | "Pointer to route-map entries\n" | |
10828 | "Metric for redistributed routes\n" | |
10829 | "Default metric\n") | |
10830 | { | |
10831 | int type; | |
10832 | u_int32_t metric; | |
7c8ff89e | 10833 | struct bgp_redist *red; |
718e3744 | 10834 | |
e0ca5fde DL |
10835 | type = proto_redistnum (AFI_IP, argv[0]); |
10836 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 10837 | { |
10838 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
10839 | return CMD_WARNING; | |
10840 | } | |
10841 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
10842 | ||
7c8ff89e DS |
10843 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
10844 | bgp_redistribute_rmap_set (red, argv[1]); | |
10845 | bgp_redistribute_metric_set (red, metric); | |
8bb0831e | 10846 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 10847 | } |
10848 | ||
10849 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
10850 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 10851 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 10852 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 10853 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 10854 | "Metric for redistributed routes\n" |
10855 | "Default metric\n" | |
10856 | "Route map reference\n" | |
10857 | "Pointer to route-map entries\n") | |
10858 | { | |
10859 | int type; | |
10860 | u_int32_t metric; | |
7c8ff89e | 10861 | struct bgp_redist *red; |
718e3744 | 10862 | |
e0ca5fde DL |
10863 | type = proto_redistnum (AFI_IP, argv[0]); |
10864 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 10865 | { |
10866 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
10867 | return CMD_WARNING; | |
10868 | } | |
10869 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
10870 | ||
7c8ff89e DS |
10871 | red = bgp_redist_add(vty->index, AFI_IP, type, 0); |
10872 | bgp_redistribute_metric_set (red, metric); | |
10873 | bgp_redistribute_rmap_set (red, argv[2]); | |
8bb0831e | 10874 | return bgp_redistribute_set (AFI_IP, type, 0); |
718e3744 | 10875 | } |
10876 | ||
7c8ff89e DS |
10877 | DEFUN (bgp_redistribute_ipv4_ospf, |
10878 | bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 10879 | "redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
10880 | "Redistribute information from another routing protocol\n" |
10881 | "Open Shortest Path First (OSPFv2)\n" | |
10882 | "Instance ID\n") | |
10883 | { | |
10884 | u_short instance; | |
7a4bb9c5 | 10885 | u_short protocol; |
7c8ff89e | 10886 | |
7a4bb9c5 DS |
10887 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
10888 | ||
10889 | if (strncmp(argv[0], "o", 1) == 0) | |
10890 | protocol = ZEBRA_ROUTE_OSPF; | |
10891 | else | |
10892 | protocol = ZEBRA_ROUTE_TABLE; | |
10893 | ||
10894 | bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
8bb0831e | 10895 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
10896 | } |
10897 | ||
10898 | DEFUN (bgp_redistribute_ipv4_ospf_rmap, | |
10899 | bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 10900 | "redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
10901 | "Redistribute information from another routing protocol\n" |
10902 | "Open Shortest Path First (OSPFv2)\n" | |
10903 | "Instance ID\n" | |
10904 | "Route map reference\n" | |
10905 | "Pointer to route-map entries\n") | |
10906 | { | |
10907 | struct bgp_redist *red; | |
10908 | u_short instance; | |
7a4bb9c5 | 10909 | int protocol; |
7c8ff89e | 10910 | |
7a4bb9c5 DS |
10911 | if (strncmp(argv[0], "o", 1) == 0) |
10912 | protocol = ZEBRA_ROUTE_OSPF; | |
10913 | else | |
10914 | protocol = ZEBRA_ROUTE_TABLE; | |
10915 | ||
10916 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); | |
10917 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
10918 | bgp_redistribute_rmap_set (red, argv[2]); | |
8bb0831e | 10919 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
10920 | } |
10921 | ||
10922 | DEFUN (bgp_redistribute_ipv4_ospf_metric, | |
10923 | bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 10924 | "redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
10925 | "Redistribute information from another routing protocol\n" |
10926 | "Open Shortest Path First (OSPFv2)\n" | |
10927 | "Instance ID\n" | |
10928 | "Metric for redistributed routes\n" | |
10929 | "Default metric\n") | |
10930 | { | |
10931 | u_int32_t metric; | |
10932 | struct bgp_redist *red; | |
10933 | u_short instance; | |
7a4bb9c5 | 10934 | int protocol; |
7c8ff89e | 10935 | |
7a4bb9c5 DS |
10936 | if (strncmp(argv[0], "o", 1) == 0) |
10937 | protocol = ZEBRA_ROUTE_OSPF; | |
10938 | else | |
10939 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 10940 | |
7a4bb9c5 DS |
10941 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
10942 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
10943 | ||
10944 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
7c8ff89e | 10945 | bgp_redistribute_metric_set (red, metric); |
8bb0831e | 10946 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
10947 | } |
10948 | ||
10949 | DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric, | |
10950 | bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 10951 | "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
10952 | "Redistribute information from another routing protocol\n" |
10953 | "Open Shortest Path First (OSPFv2)\n" | |
10954 | "Instance ID\n" | |
10955 | "Route map reference\n" | |
10956 | "Pointer to route-map entries\n" | |
10957 | "Metric for redistributed routes\n" | |
10958 | "Default metric\n") | |
10959 | { | |
10960 | u_int32_t metric; | |
10961 | struct bgp_redist *red; | |
10962 | u_short instance; | |
7a4bb9c5 | 10963 | int protocol; |
7c8ff89e | 10964 | |
7a4bb9c5 DS |
10965 | if (strncmp(argv[0], "o", 1) == 0) |
10966 | protocol = ZEBRA_ROUTE_OSPF; | |
10967 | else | |
10968 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 10969 | |
7a4bb9c5 DS |
10970 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
10971 | VTY_GET_INTEGER ("metric", metric, argv[3]); | |
10972 | ||
10973 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
10974 | bgp_redistribute_rmap_set (red, argv[2]); | |
7c8ff89e | 10975 | bgp_redistribute_metric_set (red, metric); |
8bb0831e | 10976 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
10977 | } |
10978 | ||
10979 | DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap, | |
10980 | bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 10981 | "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
10982 | "Redistribute information from another routing protocol\n" |
10983 | "Open Shortest Path First (OSPFv2)\n" | |
10984 | "Instance ID\n" | |
10985 | "Metric for redistributed routes\n" | |
10986 | "Default metric\n" | |
10987 | "Route map reference\n" | |
10988 | "Pointer to route-map entries\n") | |
10989 | { | |
10990 | u_int32_t metric; | |
10991 | struct bgp_redist *red; | |
10992 | u_short instance; | |
7a4bb9c5 | 10993 | int protocol; |
7c8ff89e | 10994 | |
7a4bb9c5 DS |
10995 | if (strncmp(argv[0], "o", 1) == 0) |
10996 | protocol = ZEBRA_ROUTE_OSPF; | |
10997 | else | |
10998 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 10999 | |
7a4bb9c5 DS |
11000 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
11001 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
11002 | ||
11003 | red = bgp_redist_add(vty->index, AFI_IP, protocol, instance); | |
7c8ff89e | 11004 | bgp_redistribute_metric_set (red, metric); |
7a4bb9c5 | 11005 | bgp_redistribute_rmap_set (red, argv[3]); |
8bb0831e | 11006 | return bgp_redistribute_set (AFI_IP, protocol, instance); |
7c8ff89e DS |
11007 | } |
11008 | ||
11009 | DEFUN (no_bgp_redistribute_ipv4_ospf, | |
11010 | no_bgp_redistribute_ipv4_ospf_cmd, | |
7a4bb9c5 | 11011 | "no redistribute (ospf|table) <1-65535>", |
7c8ff89e DS |
11012 | NO_STR |
11013 | "Redistribute information from another routing protocol\n" | |
11014 | "Open Shortest Path First (OSPFv2)\n" | |
11015 | "Instance ID\n") | |
11016 | { | |
11017 | u_short instance; | |
7a4bb9c5 DS |
11018 | int protocol; |
11019 | ||
11020 | if (strncmp(argv[0], "o", 1) == 0) | |
11021 | protocol = ZEBRA_ROUTE_OSPF; | |
11022 | else | |
11023 | protocol = ZEBRA_ROUTE_TABLE; | |
7c8ff89e | 11024 | |
7a4bb9c5 DS |
11025 | VTY_GET_INTEGER ("Instance ID", instance, argv[1]); |
11026 | return bgp_redistribute_unset (vty->index, AFI_IP, protocol, instance); | |
7c8ff89e DS |
11027 | } |
11028 | ||
11029 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
11030 | no_bgp_redistribute_ipv4_ospf_rmap_cmd, | |
7a4bb9c5 | 11031 | "no redistribute (ospf|table) <1-65535> route-map WORD", |
7c8ff89e DS |
11032 | NO_STR |
11033 | "Redistribute information from another routing protocol\n" | |
11034 | "Open Shortest Path First (OSPFv2)\n" | |
11035 | "Instance ID\n" | |
11036 | "Route map reference\n" | |
11037 | "Pointer to route-map entries\n") | |
11038 | ||
11039 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
11040 | no_bgp_redistribute_ipv4_ospf_metric_cmd, | |
7a4bb9c5 | 11041 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295>", |
7c8ff89e DS |
11042 | NO_STR |
11043 | "Redistribute information from another routing protocol\n" | |
11044 | "Open Shortest Path First (OSPFv2)\n" | |
11045 | "Instance ID\n" | |
11046 | "Metric for redistributed routes\n" | |
11047 | "Default metric\n") | |
11048 | ||
11049 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
11050 | no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd, | |
7a4bb9c5 | 11051 | "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>", |
7c8ff89e DS |
11052 | NO_STR |
11053 | "Redistribute information from another routing protocol\n" | |
11054 | "Open Shortest Path First (OSPFv2)\n" | |
11055 | "Instance ID\n" | |
11056 | "Route map reference\n" | |
11057 | "Pointer to route-map entries\n" | |
11058 | "Metric for redistributed routes\n" | |
11059 | "Default metric\n") | |
11060 | ||
11061 | ALIAS (no_bgp_redistribute_ipv4_ospf, | |
11062 | no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd, | |
7a4bb9c5 | 11063 | "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD", |
7c8ff89e DS |
11064 | NO_STR |
11065 | "Redistribute information from another routing protocol\n" | |
11066 | "Open Shortest Path First (OSPFv2)\n" | |
11067 | "Instance ID\n" | |
11068 | "Metric for redistributed routes\n" | |
11069 | "Default metric\n" | |
11070 | "Route map reference\n" | |
11071 | "Pointer to route-map entries\n") | |
11072 | ||
718e3744 | 11073 | DEFUN (no_bgp_redistribute_ipv4, |
11074 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 11075 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 11076 | NO_STR |
11077 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11078 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 11079 | { |
11080 | int type; | |
11081 | ||
e0ca5fde DL |
11082 | type = proto_redistnum (AFI_IP, argv[0]); |
11083 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11084 | { |
11085 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11086 | return CMD_WARNING; | |
11087 | } | |
7c8ff89e | 11088 | return bgp_redistribute_unset (vty->index, AFI_IP, type, 0); |
718e3744 | 11089 | } |
11090 | ||
503006bc | 11091 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 11092 | no_bgp_redistribute_ipv4_rmap_cmd, |
e0ca5fde | 11093 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 11094 | NO_STR |
11095 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11096 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11097 | "Route map reference\n" |
11098 | "Pointer to route-map entries\n") | |
718e3744 | 11099 | |
503006bc | 11100 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 11101 | no_bgp_redistribute_ipv4_metric_cmd, |
e0ca5fde | 11102 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 11103 | NO_STR |
11104 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11105 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11106 | "Metric for redistributed routes\n" |
11107 | "Default metric\n") | |
718e3744 | 11108 | |
503006bc | 11109 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 11110 | no_bgp_redistribute_ipv4_rmap_metric_cmd, |
e0ca5fde | 11111 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 11112 | NO_STR |
11113 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11114 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11115 | "Route map reference\n" |
11116 | "Pointer to route-map entries\n" | |
11117 | "Metric for redistributed routes\n" | |
11118 | "Default metric\n") | |
718e3744 | 11119 | |
503006bc | 11120 | ALIAS (no_bgp_redistribute_ipv4, |
718e3744 | 11121 | no_bgp_redistribute_ipv4_metric_rmap_cmd, |
e0ca5fde | 11122 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 11123 | NO_STR |
11124 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11125 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 11126 | "Metric for redistributed routes\n" |
11127 | "Default metric\n" | |
11128 | "Route map reference\n" | |
11129 | "Pointer to route-map entries\n") | |
6b0655a2 | 11130 | |
718e3744 | 11131 | #ifdef HAVE_IPV6 |
11132 | DEFUN (bgp_redistribute_ipv6, | |
11133 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 11134 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 11135 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11136 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 11137 | { |
11138 | int type; | |
11139 | ||
e0ca5fde DL |
11140 | type = proto_redistnum (AFI_IP6, argv[0]); |
11141 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11142 | { |
11143 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11144 | return CMD_WARNING; | |
11145 | } | |
11146 | ||
7c8ff89e | 11147 | bgp_redist_add(vty->index, AFI_IP6, type, 0); |
8bb0831e | 11148 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11149 | } |
11150 | ||
11151 | DEFUN (bgp_redistribute_ipv6_rmap, | |
11152 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 11153 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 11154 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11155 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11156 | "Route map reference\n" |
11157 | "Pointer to route-map entries\n") | |
11158 | { | |
11159 | int type; | |
7c8ff89e | 11160 | struct bgp_redist *red; |
718e3744 | 11161 | |
e0ca5fde DL |
11162 | type = proto_redistnum (AFI_IP6, argv[0]); |
11163 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11164 | { |
11165 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11166 | return CMD_WARNING; | |
11167 | } | |
11168 | ||
7c8ff89e DS |
11169 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
11170 | bgp_redistribute_rmap_set (red, argv[1]); | |
8bb0831e | 11171 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11172 | } |
11173 | ||
11174 | DEFUN (bgp_redistribute_ipv6_metric, | |
11175 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 11176 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 11177 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11178 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11179 | "Metric for redistributed routes\n" |
11180 | "Default metric\n") | |
11181 | { | |
11182 | int type; | |
11183 | u_int32_t metric; | |
7c8ff89e | 11184 | struct bgp_redist *red; |
718e3744 | 11185 | |
e0ca5fde DL |
11186 | type = proto_redistnum (AFI_IP6, argv[0]); |
11187 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11188 | { |
11189 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11190 | return CMD_WARNING; | |
11191 | } | |
11192 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
11193 | ||
7c8ff89e DS |
11194 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
11195 | bgp_redistribute_metric_set (red, metric); | |
8bb0831e | 11196 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11197 | } |
11198 | ||
11199 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
11200 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 11201 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 11202 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11203 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11204 | "Route map reference\n" |
11205 | "Pointer to route-map entries\n" | |
11206 | "Metric for redistributed routes\n" | |
11207 | "Default metric\n") | |
11208 | { | |
11209 | int type; | |
11210 | u_int32_t metric; | |
7c8ff89e | 11211 | struct bgp_redist *red; |
718e3744 | 11212 | |
e0ca5fde DL |
11213 | type = proto_redistnum (AFI_IP6, argv[0]); |
11214 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11215 | { |
11216 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11217 | return CMD_WARNING; | |
11218 | } | |
11219 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
11220 | ||
7c8ff89e DS |
11221 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
11222 | bgp_redistribute_rmap_set (red, argv[1]); | |
11223 | bgp_redistribute_metric_set (red, metric); | |
8bb0831e | 11224 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11225 | } |
11226 | ||
11227 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
11228 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 11229 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 11230 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 11231 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11232 | "Metric for redistributed routes\n" |
11233 | "Default metric\n" | |
11234 | "Route map reference\n" | |
11235 | "Pointer to route-map entries\n") | |
11236 | { | |
11237 | int type; | |
11238 | u_int32_t metric; | |
7c8ff89e | 11239 | struct bgp_redist *red; |
718e3744 | 11240 | |
e0ca5fde DL |
11241 | type = proto_redistnum (AFI_IP6, argv[0]); |
11242 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11243 | { |
11244 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11245 | return CMD_WARNING; | |
11246 | } | |
11247 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
11248 | ||
7c8ff89e DS |
11249 | red = bgp_redist_add(vty->index, AFI_IP6, type, 0); |
11250 | bgp_redistribute_metric_set (red, metric); | |
11251 | bgp_redistribute_rmap_set (red, argv[2]); | |
8bb0831e | 11252 | return bgp_redistribute_set (AFI_IP6, type, 0); |
718e3744 | 11253 | } |
11254 | ||
11255 | DEFUN (no_bgp_redistribute_ipv6, | |
11256 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 11257 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 11258 | NO_STR |
11259 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11260 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 11261 | { |
11262 | int type; | |
11263 | ||
e0ca5fde DL |
11264 | type = proto_redistnum (AFI_IP6, argv[0]); |
11265 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 11266 | { |
11267 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
11268 | return CMD_WARNING; | |
11269 | } | |
11270 | ||
7c8ff89e | 11271 | return bgp_redistribute_unset (vty->index, AFI_IP6, type, 0); |
718e3744 | 11272 | } |
11273 | ||
503006bc | 11274 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 11275 | no_bgp_redistribute_ipv6_rmap_cmd, |
e0ca5fde | 11276 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 11277 | NO_STR |
11278 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11279 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11280 | "Route map reference\n" |
11281 | "Pointer to route-map entries\n") | |
718e3744 | 11282 | |
503006bc | 11283 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 11284 | no_bgp_redistribute_ipv6_metric_cmd, |
e0ca5fde | 11285 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 11286 | NO_STR |
11287 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11288 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11289 | "Metric for redistributed routes\n" |
11290 | "Default metric\n") | |
718e3744 | 11291 | |
503006bc | 11292 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 11293 | no_bgp_redistribute_ipv6_rmap_metric_cmd, |
e0ca5fde | 11294 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 11295 | NO_STR |
11296 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11297 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11298 | "Route map reference\n" |
11299 | "Pointer to route-map entries\n" | |
11300 | "Metric for redistributed routes\n" | |
11301 | "Default metric\n") | |
718e3744 | 11302 | |
503006bc | 11303 | ALIAS (no_bgp_redistribute_ipv6, |
718e3744 | 11304 | no_bgp_redistribute_ipv6_metric_rmap_cmd, |
e0ca5fde | 11305 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 11306 | NO_STR |
11307 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 11308 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 11309 | "Metric for redistributed routes\n" |
11310 | "Default metric\n" | |
11311 | "Route map reference\n" | |
11312 | "Pointer to route-map entries\n") | |
11313 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 11314 | |
718e3744 | 11315 | int |
11316 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
11317 | safi_t safi, int *write) | |
11318 | { | |
11319 | int i; | |
718e3744 | 11320 | |
11321 | /* Unicast redistribution only. */ | |
11322 | if (safi != SAFI_UNICAST) | |
11323 | return 0; | |
11324 | ||
11325 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
11326 | { | |
11327 | /* Redistribute BGP does not make sense. */ | |
7c8ff89e | 11328 | if (i != ZEBRA_ROUTE_BGP) |
718e3744 | 11329 | { |
7c8ff89e DS |
11330 | struct list *red_list; |
11331 | struct listnode *node; | |
11332 | struct bgp_redist *red; | |
718e3744 | 11333 | |
7c8ff89e DS |
11334 | red_list = bgp->redist[afi][i]; |
11335 | if (!red_list) | |
11336 | continue; | |
718e3744 | 11337 | |
7c8ff89e DS |
11338 | for (ALL_LIST_ELEMENTS_RO(red_list, node, red)) |
11339 | { | |
11340 | /* Display "address-family" when it is not yet diplayed. */ | |
11341 | bgp_config_write_family_header (vty, afi, safi, write); | |
11342 | ||
11343 | /* "redistribute" configuration. */ | |
11344 | vty_out (vty, " redistribute %s", zebra_route_string(i)); | |
11345 | if (red->instance) | |
11346 | vty_out (vty, " %d", red->instance); | |
11347 | if (red->redist_metric_flag) | |
11348 | vty_out (vty, " metric %u", red->redist_metric); | |
11349 | if (red->rmap.name) | |
11350 | vty_out (vty, " route-map %s", red->rmap.name); | |
11351 | vty_out (vty, "%s", VTY_NEWLINE); | |
11352 | } | |
718e3744 | 11353 | } |
11354 | } | |
11355 | return *write; | |
11356 | } | |
6b0655a2 | 11357 | |
718e3744 | 11358 | /* BGP node structure. */ |
7fc626de | 11359 | static struct cmd_node bgp_node = |
718e3744 | 11360 | { |
11361 | BGP_NODE, | |
11362 | "%s(config-router)# ", | |
11363 | 1, | |
11364 | }; | |
11365 | ||
7fc626de | 11366 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 11367 | { |
11368 | BGP_IPV4_NODE, | |
11369 | "%s(config-router-af)# ", | |
11370 | 1, | |
11371 | }; | |
11372 | ||
7fc626de | 11373 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 11374 | { |
11375 | BGP_IPV4M_NODE, | |
11376 | "%s(config-router-af)# ", | |
11377 | 1, | |
11378 | }; | |
11379 | ||
7fc626de | 11380 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 11381 | { |
11382 | BGP_IPV6_NODE, | |
11383 | "%s(config-router-af)# ", | |
11384 | 1, | |
11385 | }; | |
11386 | ||
7fc626de | 11387 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 11388 | { |
11389 | BGP_IPV6M_NODE, | |
11390 | "%s(config-router-af)# ", | |
11391 | 1, | |
11392 | }; | |
11393 | ||
7fc626de | 11394 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 11395 | { |
11396 | BGP_VPNV4_NODE, | |
11397 | "%s(config-router-af)# ", | |
11398 | 1 | |
11399 | }; | |
6b0655a2 | 11400 | |
1f8ae70b | 11401 | static void community_list_vty (void); |
11402 | ||
718e3744 | 11403 | void |
94f2b392 | 11404 | bgp_vty_init (void) |
718e3744 | 11405 | { |
718e3744 | 11406 | /* Install bgp top node. */ |
11407 | install_node (&bgp_node, bgp_config_write); | |
11408 | install_node (&bgp_ipv4_unicast_node, NULL); | |
11409 | install_node (&bgp_ipv4_multicast_node, NULL); | |
11410 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 11411 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 11412 | install_node (&bgp_vpnv4_node, NULL); |
11413 | ||
11414 | /* Install default VTY commands to new nodes. */ | |
11415 | install_default (BGP_NODE); | |
11416 | install_default (BGP_IPV4_NODE); | |
11417 | install_default (BGP_IPV4M_NODE); | |
11418 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 11419 | install_default (BGP_IPV6M_NODE); |
718e3744 | 11420 | install_default (BGP_VPNV4_NODE); |
11421 | ||
11422 | /* "bgp multiple-instance" commands. */ | |
11423 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
11424 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
11425 | ||
11426 | /* "bgp config-type" commands. */ | |
11427 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
11428 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); | |
11429 | ||
11430 | /* Dummy commands (Currently not supported) */ | |
11431 | install_element (BGP_NODE, &no_synchronization_cmd); | |
11432 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
11433 | ||
11434 | /* "router bgp" commands. */ | |
11435 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
11436 | install_element (CONFIG_NODE, &router_bgp_view_cmd); | |
11437 | ||
11438 | /* "no router bgp" commands. */ | |
11439 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
11440 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); | |
11441 | ||
11442 | /* "bgp router-id" commands. */ | |
11443 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
11444 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
11445 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
11446 | ||
11447 | /* "bgp cluster-id" commands. */ | |
11448 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
11449 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
11450 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
11451 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); | |
11452 | ||
11453 | /* "bgp confederation" commands. */ | |
11454 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
11455 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
11456 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
11457 | ||
11458 | /* "bgp confederation peers" commands. */ | |
11459 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
11460 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
11461 | ||
abc920f8 DS |
11462 | /* bgp max-med command */ |
11463 | install_element (BGP_NODE, &bgp_maxmed_admin_cmd); | |
11464 | install_element (BGP_NODE, &no_bgp_maxmed_admin_cmd); | |
11465 | install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); | |
11466 | install_element (BGP_NODE, &no_bgp_maxmed_admin_medv_cmd); | |
11467 | install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); | |
11468 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); | |
11469 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_cmd); | |
11470 | install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); | |
11471 | install_element (BGP_NODE, &no_bgp_maxmed_onstartup_period_medv_cmd); | |
11472 | ||
907f92c8 DS |
11473 | /* bgp disable-ebgp-connected-nh-check */ |
11474 | install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd); | |
11475 | install_element (BGP_NODE, &no_bgp_disable_connected_route_check_cmd); | |
11476 | ||
f188f2c4 DS |
11477 | /* bgp update-delay command */ |
11478 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
11479 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
11480 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
11481 | install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); | |
11482 | ||
cb1faec9 DS |
11483 | install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); |
11484 | install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); | |
11485 | ||
3f9c7369 DS |
11486 | install_element (BGP_NODE, &bgp_coalesce_time_cmd); |
11487 | install_element (BGP_NODE, &no_bgp_coalesce_time_cmd); | |
11488 | ||
165b5fff JB |
11489 | /* "maximum-paths" commands. */ |
11490 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
11491 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
11492 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); | |
11493 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); | |
11494 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
11495 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); | |
431aa9f9 DS |
11496 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
11497 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
11498 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); | |
165b5fff | 11499 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 11500 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff JB |
11501 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
11502 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 11503 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 11504 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 11505 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 11506 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
5e242b0d | 11507 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 11508 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
431aa9f9 | 11509 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 11510 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 DS |
11511 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
11512 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 11513 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 11514 | |
718e3744 | 11515 | /* "timers bgp" commands. */ |
11516 | install_element (BGP_NODE, &bgp_timers_cmd); | |
11517 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
11518 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
11519 | ||
518f0eb1 DS |
11520 | /* route-map delay-timer commands */ |
11521 | install_element (BGP_NODE, &bgp_set_route_map_delay_timer_cmd); | |
11522 | install_element (BGP_NODE, &no_bgp_set_route_map_delay_timer_cmd); | |
11523 | ||
718e3744 | 11524 | /* "bgp client-to-client reflection" commands */ |
11525 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
11526 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
11527 | ||
11528 | /* "bgp always-compare-med" commands */ | |
11529 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
11530 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
11531 | ||
11532 | /* "bgp deterministic-med" commands */ | |
11533 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
11534 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 11535 | |
538621f2 | 11536 | /* "bgp graceful-restart" commands */ |
11537 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
11538 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 11539 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
11540 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
11541 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 11542 | |
11543 | /* "bgp fast-external-failover" commands */ | |
11544 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
11545 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
11546 | ||
11547 | /* "bgp enforce-first-as" commands */ | |
11548 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
11549 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
11550 | ||
11551 | /* "bgp bestpath compare-routerid" commands */ | |
11552 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
11553 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
11554 | ||
11555 | /* "bgp bestpath as-path ignore" commands */ | |
11556 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
11557 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
11558 | ||
6811845b | 11559 | /* "bgp bestpath as-path confed" commands */ |
11560 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
11561 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
11562 | ||
2fdd455c PM |
11563 | /* "bgp bestpath as-path multipath-relax" commands */ |
11564 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
11565 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
11566 | ||
16fc1eec DS |
11567 | /* "bgp bestpath as-path multipath-relax no-as-set" commands */ |
11568 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_no_as_set_cmd); | |
11569 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_no_as_set_cmd); | |
11570 | ||
848973c7 | 11571 | /* "bgp log-neighbor-changes" commands */ |
11572 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
11573 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
11574 | ||
718e3744 | 11575 | /* "bgp bestpath med" commands */ |
11576 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
11577 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
11578 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
11579 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
11580 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
11581 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
11582 | ||
11583 | /* "no bgp default ipv4-unicast" commands. */ | |
11584 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
11585 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
11586 | ||
11587 | /* "bgp network import-check" commands. */ | |
11588 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
11589 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); | |
11590 | ||
11591 | /* "bgp default local-preference" commands. */ | |
11592 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
11593 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
11594 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
11595 | ||
3f9c7369 DS |
11596 | /* "bgp default subgroup-pkt-queue-max" commands. */ |
11597 | install_element (BGP_NODE, &bgp_default_subgroup_pkt_queue_max_cmd); | |
11598 | install_element (BGP_NODE, &no_bgp_default_subgroup_pkt_queue_max_cmd); | |
11599 | ||
8bd9d948 DS |
11600 | /* bgp ibgp-allow-policy-mods command */ |
11601 | install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd); | |
11602 | install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd); | |
11603 | ||
f14e6fdb DS |
11604 | /* "bgp listen limit" commands. */ |
11605 | install_element (BGP_NODE, &bgp_listen_limit_cmd); | |
11606 | install_element (BGP_NODE, &no_bgp_listen_limit_cmd); | |
11607 | ||
11608 | /* "bgp listen range" commands. */ | |
11609 | install_element (BGP_NODE, &bgp_listen_range_cmd); | |
11610 | install_element (BGP_NODE, &no_bgp_listen_range_cmd); | |
11611 | ||
718e3744 | 11612 | /* "neighbor remote-as" commands. */ |
11613 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
a80beece | 11614 | install_element (BGP_NODE, &neighbor_interface_config_cmd); |
718e3744 | 11615 | install_element (BGP_NODE, &no_neighbor_cmd); |
11616 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
a80beece | 11617 | install_element (BGP_NODE, &no_neighbor_interface_config_cmd); |
718e3744 | 11618 | |
11619 | /* "neighbor peer-group" commands. */ | |
11620 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
11621 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
a80beece | 11622 | install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd); |
718e3744 | 11623 | |
11624 | /* "neighbor local-as" commands. */ | |
11625 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
11626 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 11627 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 11628 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
11629 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
11630 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
9d3f9705 | 11631 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
718e3744 | 11632 | |
3f9c7369 DS |
11633 | /* "neighbor solo" commands. */ |
11634 | install_element (BGP_NODE, &neighbor_solo_cmd); | |
11635 | install_element (BGP_NODE, &no_neighbor_solo_cmd); | |
11636 | ||
0df7c91f PJ |
11637 | /* "neighbor password" commands. */ |
11638 | install_element (BGP_NODE, &neighbor_password_cmd); | |
11639 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
11640 | ||
718e3744 | 11641 | /* "neighbor activate" commands. */ |
11642 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
11643 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
11644 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
11645 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 11646 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 11647 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
11648 | ||
11649 | /* "no neighbor activate" commands. */ | |
11650 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
11651 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
11652 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
11653 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 11654 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 11655 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
11656 | ||
11657 | /* "neighbor peer-group set" commands. */ | |
11658 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); | |
11659 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
11660 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
11661 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 11662 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 11663 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
11664 | ||
718e3744 | 11665 | /* "no neighbor peer-group unset" commands. */ |
11666 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
11667 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
11668 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
11669 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 11670 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 11671 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
11672 | ||
718e3744 | 11673 | /* "neighbor softreconfiguration inbound" commands.*/ |
11674 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
11675 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
11676 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
11677 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
11678 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
11679 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
11680 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
11681 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 11682 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
11683 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 11684 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
11685 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 11686 | |
11687 | /* "neighbor attribute-unchanged" commands. */ | |
11688 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
11689 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
11690 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
11691 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
11692 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
11693 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
11694 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
11695 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
11696 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
11697 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
11698 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
11699 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
11700 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
11701 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
11702 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
11703 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
11704 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
11705 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
11706 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
11707 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
11708 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
11709 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
11710 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
11711 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
11712 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
11713 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
11714 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
11715 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
11716 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
11717 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
11718 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
11719 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
11720 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
11721 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
11722 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
11723 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
11724 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
11725 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
11726 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
11727 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
11728 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
11729 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
11730 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
11731 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
11732 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
11733 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
11734 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
11735 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
11736 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
11737 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
11738 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
11739 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
11740 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
11741 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
11742 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
11743 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
11744 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
11745 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
11746 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
11747 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
11748 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
11749 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
11750 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
11751 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
11752 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
11753 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
11754 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
11755 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
11756 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
11757 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
11758 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
11759 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
11760 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
11761 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
11762 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
11763 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
11764 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
11765 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
11766 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
11767 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
11768 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
11769 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
11770 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
11771 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
11772 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
11773 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
11774 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
11775 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 11776 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
11777 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
11778 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
11779 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
11780 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
11781 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
11782 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
11783 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
11784 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
11785 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
11786 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
11787 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
11788 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
11789 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
11790 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
11791 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
11792 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
11793 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
11794 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
11795 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
11796 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
11797 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 11798 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
11799 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
11800 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
11801 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
11802 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
11803 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
11804 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
11805 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
11806 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
11807 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
11808 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
11809 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
11810 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
11811 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
11812 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
11813 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
11814 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
11815 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
11816 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
11817 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
11818 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
11819 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
11820 | ||
fee0f4c6 | 11821 | /* "nexthop-local unchanged" commands */ |
11822 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
11823 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
11824 | ||
718e3744 | 11825 | /* "transparent-as" and "transparent-nexthop" for old version |
11826 | compatibility. */ | |
11827 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); | |
11828 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); | |
11829 | ||
11830 | /* "neighbor next-hop-self" commands. */ | |
11831 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
11832 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
11833 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
11834 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
11835 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
11836 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
11837 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
11838 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 11839 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
11840 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 11841 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
11842 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
11843 | ||
c7122e14 DS |
11844 | /* "neighbor as-override" commands. */ |
11845 | install_element (BGP_NODE, &neighbor_as_override_cmd); | |
11846 | install_element (BGP_NODE, &no_neighbor_as_override_cmd); | |
11847 | install_element (BGP_IPV4_NODE, &neighbor_as_override_cmd); | |
11848 | install_element (BGP_IPV4_NODE, &no_neighbor_as_override_cmd); | |
11849 | install_element (BGP_IPV4M_NODE, &neighbor_as_override_cmd); | |
11850 | install_element (BGP_IPV4M_NODE, &no_neighbor_as_override_cmd); | |
11851 | install_element (BGP_IPV6_NODE, &neighbor_as_override_cmd); | |
11852 | install_element (BGP_IPV6_NODE, &no_neighbor_as_override_cmd); | |
11853 | install_element (BGP_IPV6M_NODE, &neighbor_as_override_cmd); | |
11854 | install_element (BGP_IPV6M_NODE, &no_neighbor_as_override_cmd); | |
11855 | install_element (BGP_VPNV4_NODE, &neighbor_as_override_cmd); | |
11856 | install_element (BGP_VPNV4_NODE, &no_neighbor_as_override_cmd); | |
11857 | ||
718e3744 | 11858 | /* "neighbor remove-private-AS" commands. */ |
11859 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
11860 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
11861 | install_element (BGP_NODE, &neighbor_remove_private_as_all_cmd); |
11862 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_cmd); | |
11863 | install_element (BGP_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
11864 | install_element (BGP_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
11865 | install_element (BGP_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
11866 | install_element (BGP_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 11867 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); |
11868 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
11869 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_cmd); |
11870 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
11871 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
11872 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
11873 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
11874 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 11875 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); |
11876 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
11877 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_cmd); |
11878 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
11879 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
11880 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
11881 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
11882 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 11883 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); |
11884 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
11885 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_cmd); |
11886 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_cmd); | |
11887 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
11888 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
11889 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
11890 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
25ffbdc1 | 11891 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
11892 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
11893 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_cmd); |
11894 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_cmd); | |
11895 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
11896 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
11897 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
11898 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 11899 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
11900 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
5000f21c DS |
11901 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_cmd); |
11902 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_cmd); | |
11903 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_replace_as_cmd); | |
11904 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_replace_as_cmd); | |
11905 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_all_replace_as_cmd); | |
11906 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_all_replace_as_cmd); | |
718e3744 | 11907 | |
11908 | /* "neighbor send-community" commands.*/ | |
11909 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
11910 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
11911 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
11912 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
11913 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
11914 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
11915 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
11916 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
11917 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
11918 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
11919 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
11920 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
11921 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
11922 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
11923 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
11924 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 11925 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
11926 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
11927 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
11928 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 11929 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
11930 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
11931 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
11932 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
11933 | ||
11934 | /* "neighbor route-reflector" commands.*/ | |
11935 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
11936 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
11937 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
11938 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
11939 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
11940 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
11941 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
11942 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 11943 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
11944 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 11945 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
11946 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
11947 | ||
11948 | /* "neighbor route-server" commands.*/ | |
11949 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
11950 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
11951 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
11952 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
11953 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
11954 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
11955 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
11956 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 11957 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
11958 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 11959 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
11960 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
11961 | ||
11962 | /* "neighbor passive" commands. */ | |
11963 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
11964 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
11965 | ||
d5a5c8f0 DS |
11966 | /* "neighbor bfd" commands. */ |
11967 | install_element (BGP_NODE, &neighbor_bfd_cmd); | |
11968 | install_element (BGP_NODE, &no_neighbor_bfd_cmd); | |
11969 | ||
718e3744 | 11970 | /* "neighbor shutdown" commands. */ |
11971 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
11972 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
11973 | ||
c9502438 | 11974 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
718e3744 | 11975 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
11976 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); | |
11977 | ||
11978 | /* "neighbor capability orf prefix-list" commands.*/ | |
11979 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
11980 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
11981 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
11982 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
11983 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
11984 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
11985 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
11986 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 11987 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
11988 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 11989 | |
11990 | /* "neighbor capability dynamic" commands.*/ | |
11991 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
11992 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
11993 | ||
11994 | /* "neighbor dont-capability-negotiate" commands. */ | |
11995 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
11996 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
11997 | ||
11998 | /* "neighbor ebgp-multihop" commands. */ | |
11999 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
12000 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
12001 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
12002 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
12003 | ||
6ffd2079 | 12004 | /* "neighbor disable-connected-check" commands. */ |
12005 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
12006 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 12007 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
12008 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
12009 | ||
12010 | /* "neighbor description" commands. */ | |
12011 | install_element (BGP_NODE, &neighbor_description_cmd); | |
12012 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
12013 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
12014 | ||
12015 | /* "neighbor update-source" commands. "*/ | |
12016 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
12017 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
12018 | ||
12019 | /* "neighbor default-originate" commands. */ | |
12020 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
12021 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
12022 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
12023 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
12024 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
12025 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
12026 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
12027 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
12028 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
12029 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
12030 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
12031 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
12032 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
12033 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
12034 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
12035 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 12036 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
12037 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
12038 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
12039 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 12040 | |
12041 | /* "neighbor port" commands. */ | |
12042 | install_element (BGP_NODE, &neighbor_port_cmd); | |
12043 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
12044 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
12045 | ||
12046 | /* "neighbor weight" commands. */ | |
12047 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
12048 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
12049 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
12050 | ||
12051 | /* "neighbor override-capability" commands. */ | |
12052 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
12053 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
12054 | ||
12055 | /* "neighbor strict-capability-match" commands. */ | |
12056 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
12057 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
12058 | ||
12059 | /* "neighbor timers" commands. */ | |
12060 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
12061 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
12062 | ||
12063 | /* "neighbor timers connect" commands. */ | |
12064 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
12065 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
12066 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
12067 | ||
12068 | /* "neighbor advertisement-interval" commands. */ | |
12069 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
12070 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
12071 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
12072 | ||
12073 | /* "neighbor version" commands. */ | |
12074 | install_element (BGP_NODE, &neighbor_version_cmd); | |
718e3744 | 12075 | |
12076 | /* "neighbor interface" commands. */ | |
12077 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
12078 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
12079 | ||
12080 | /* "neighbor distribute" commands. */ | |
12081 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
12082 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
12083 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
12084 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
12085 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
12086 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
12087 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
12088 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 12089 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
12090 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 12091 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
12092 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
12093 | ||
12094 | /* "neighbor prefix-list" commands. */ | |
12095 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
12096 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
12097 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
12098 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
12099 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
12100 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
12101 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
12102 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 12103 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
12104 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 12105 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
12106 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
12107 | ||
12108 | /* "neighbor filter-list" commands. */ | |
12109 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
12110 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
12111 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
12112 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
12113 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
12114 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
12115 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
12116 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 12117 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
12118 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 12119 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
12120 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
12121 | ||
12122 | /* "neighbor route-map" commands. */ | |
12123 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
12124 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
12125 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
12126 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
12127 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
12128 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
12129 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
12130 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 12131 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
12132 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 12133 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
12134 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
12135 | ||
12136 | /* "neighbor unsuppress-map" commands. */ | |
12137 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
12138 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
12139 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
12140 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
12141 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
12142 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
12143 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
12144 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 12145 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
12146 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 12147 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
12148 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 12149 | |
12150 | /* "neighbor maximum-prefix" commands. */ | |
12151 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 12152 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12153 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12154 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12155 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
12156 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12157 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
12158 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12159 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12160 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12161 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12162 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12163 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12164 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 12165 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12166 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12167 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12168 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
12169 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12170 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
12171 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12172 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12173 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12174 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12175 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12176 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12177 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 12178 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12179 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12180 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12181 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
12182 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12183 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
12184 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12185 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12186 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12187 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12188 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12189 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12190 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 12191 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12192 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12193 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12194 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
12195 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12196 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
12197 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12198 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12199 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12200 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12201 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12202 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 12203 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
12204 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
12205 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
12206 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
12207 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
12208 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
12209 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
12210 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
12211 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
12212 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12213 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12214 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12215 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12216 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 12217 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 12218 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 12219 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 12220 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
12221 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12222 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
12223 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 12224 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
12225 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
12226 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
12227 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
12228 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 12229 | |
12230 | /* "neighbor allowas-in" */ | |
12231 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
12232 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
12233 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
12234 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); | |
12235 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
12236 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
12237 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); | |
12238 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
12239 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
12240 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); | |
12241 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
12242 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
25ffbdc1 | 12243 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
12244 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
12245 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
718e3744 | 12246 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
12247 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
12248 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
12249 | ||
12250 | /* address-family commands. */ | |
12251 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
12252 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
12253 | #ifdef HAVE_IPV6 | |
12254 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 12255 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 12256 | #endif /* HAVE_IPV6 */ |
12257 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
12258 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
12259 | ||
12260 | /* "exit-address-family" command. */ | |
12261 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
12262 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
12263 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 12264 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 12265 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
12266 | ||
12267 | /* "clear ip bgp commands" */ | |
12268 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
12269 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
12270 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
12271 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); | |
12272 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); | |
12273 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); | |
12274 | #ifdef HAVE_IPV6 | |
12275 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); | |
12276 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
12277 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
12278 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); | |
12279 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); | |
12280 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); | |
12281 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); | |
12282 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); | |
12283 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); | |
12284 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); | |
12285 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); | |
12286 | #endif /* HAVE_IPV6 */ | |
12287 | ||
12288 | /* "clear ip bgp neighbor soft in" */ | |
12289 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
12290 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
12291 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
12292 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); | |
12293 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); | |
12294 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); | |
12295 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); | |
12296 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); | |
12297 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
12298 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); | |
12299 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); | |
12300 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
12301 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); | |
12302 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); | |
12303 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
12304 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); | |
12305 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); | |
12306 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
12307 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
12308 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
12309 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); | |
12310 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); | |
12311 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); | |
12312 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); | |
12313 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); | |
12314 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
12315 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); | |
12316 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); | |
12317 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
12318 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); | |
12319 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); | |
12320 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
12321 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); | |
12322 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); | |
12323 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
12324 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
12325 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
12326 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
12327 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
12328 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
12329 | #ifdef HAVE_IPV6 | |
12330 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); | |
12331 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
12332 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
12333 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); | |
12334 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
12335 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); | |
12336 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); | |
12337 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
12338 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); | |
12339 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); | |
12340 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
12341 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); | |
12342 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); | |
12343 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
12344 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); | |
12345 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); | |
12346 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
12347 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); | |
12348 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); | |
12349 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
12350 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); | |
12351 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); | |
12352 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
12353 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); | |
12354 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); | |
12355 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
12356 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); | |
12357 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); | |
12358 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
12359 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); | |
12360 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); | |
12361 | #endif /* HAVE_IPV6 */ | |
12362 | ||
8ad7271d DS |
12363 | /* clear ip bgp prefix */ |
12364 | install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd); | |
12365 | install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd); | |
12366 | ||
718e3744 | 12367 | /* "clear ip bgp neighbor soft out" */ |
12368 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
12369 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
12370 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
12371 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); | |
12372 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); | |
12373 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); | |
12374 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); | |
12375 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); | |
12376 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); | |
12377 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); | |
12378 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); | |
12379 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); | |
12380 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
12381 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
12382 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); | |
12383 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); | |
12384 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); | |
12385 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); | |
12386 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); | |
12387 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); | |
12388 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); | |
12389 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); | |
12390 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); | |
12391 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
12392 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
12393 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
12394 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
12395 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
12396 | #ifdef HAVE_IPV6 | |
12397 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); | |
12398 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
12399 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
12400 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); | |
12401 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); | |
12402 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); | |
12403 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); | |
12404 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); | |
12405 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); | |
12406 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); | |
12407 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); | |
12408 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); | |
12409 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); | |
12410 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); | |
12411 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); | |
12412 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); | |
12413 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); | |
12414 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); | |
12415 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); | |
12416 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); | |
12417 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); | |
12418 | #endif /* HAVE_IPV6 */ | |
12419 | ||
12420 | /* "clear ip bgp neighbor soft" */ | |
12421 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
12422 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
12423 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
12424 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); | |
12425 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); | |
12426 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); | |
12427 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); | |
12428 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
12429 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
12430 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); | |
12431 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); | |
12432 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); | |
12433 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); | |
12434 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
12435 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
12436 | #ifdef HAVE_IPV6 | |
12437 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); | |
12438 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
12439 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
12440 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); | |
12441 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); | |
12442 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); | |
12443 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); | |
12444 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); | |
12445 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); | |
12446 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); | |
12447 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); | |
12448 | #endif /* HAVE_IPV6 */ | |
12449 | ||
fee0f4c6 | 12450 | /* "clear ip bgp neighbor rsclient" */ |
12451 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); | |
12452 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); | |
12453 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); | |
12454 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); | |
12455 | #ifdef HAVE_IPV6 | |
12456 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); | |
12457 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); | |
12458 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); | |
12459 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); | |
12460 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); | |
12461 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); | |
12462 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); | |
12463 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); | |
12464 | #endif /* HAVE_IPV6 */ | |
12465 | ||
718e3744 | 12466 | /* "show ip bgp summary" commands. */ |
12467 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
12468 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd); |
12469 | install_element (VIEW_NODE, &show_bgp_updgrps_cmd); | |
12470 | install_element (VIEW_NODE, &show_bgp_ipv6_updgrps_cmd); | |
12471 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd); | |
12472 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_cmd); | |
12473 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
12474 | install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_subgroup_cmd); | |
12475 | install_element (VIEW_NODE, &show_bgp_updgrps_adj_subgroup_cmd); | |
12476 | install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_subgroup_cmd); | |
718e3744 | 12477 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
12478 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 12479 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 12480 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 12481 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 12482 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
12483 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
12484 | #ifdef HAVE_IPV6 | |
12485 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
12486 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); | |
12487 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 12488 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 12489 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 12490 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
12491 | #endif /* HAVE_IPV6 */ |
12492 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
12493 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_cmd); |
12494 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_cmd); | |
12495 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_updgrps_cmd); | |
12496 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_cmd); | |
12497 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_cmd); | |
12498 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
12499 | install_element (RESTRICTED_NODE, &show_ip_bgp_updgrps_adj_subgroup_cmd); | |
12500 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_adj_subgroup_cmd); | |
12501 | install_element (RESTRICTED_NODE, &show_bgp_updgrps_afi_adj_subgroup_cmd); | |
62687ff1 PJ |
12502 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
12503 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 12504 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
62687ff1 | 12505 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 12506 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
62687ff1 PJ |
12507 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
12508 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
12509 | #ifdef HAVE_IPV6 | |
12510 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
12511 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); | |
12512 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 12513 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
62687ff1 | 12514 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 12515 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 12516 | #endif /* HAVE_IPV6 */ |
12517 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
3f9c7369 DS |
12518 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_cmd); |
12519 | install_element (ENABLE_NODE, &show_bgp_updgrps_cmd); | |
12520 | install_element (ENABLE_NODE, &show_bgp_ipv6_updgrps_cmd); | |
12521 | install_element (ENABLE_NODE, &show_bgp_updgrps_stats_cmd); | |
12522 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_cmd); | |
12523 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_cmd); | |
12524 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_cmd); | |
12525 | install_element (ENABLE_NODE, &show_ip_bgp_updgrps_adj_subgroup_cmd); | |
12526 | install_element (ENABLE_NODE, &show_bgp_updgrps_adj_subgroup_cmd); | |
12527 | install_element (ENABLE_NODE, &show_bgp_updgrps_afi_adj_subgroup_cmd); | |
718e3744 | 12528 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
12529 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 12530 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 12531 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 12532 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 12533 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
12534 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
12535 | #ifdef HAVE_IPV6 | |
12536 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
12537 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); | |
12538 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 12539 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 12540 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 12541 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 12542 | #endif /* HAVE_IPV6 */ |
12543 | ||
12544 | /* "show ip bgp neighbors" commands. */ | |
12545 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
12546 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
12547 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
12548 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
12549 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
12550 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
12551 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
12552 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
12553 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
12554 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
62687ff1 PJ |
12555 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
12556 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
12557 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
12558 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
12559 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 12560 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
12561 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
12562 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
12563 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
12564 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
12565 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
12566 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
12567 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
12568 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
12569 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
12570 | ||
12571 | #ifdef HAVE_IPV6 | |
12572 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
12573 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
12574 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
12575 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 12576 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
12577 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
12578 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
12579 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
12580 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
12581 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
12582 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
12583 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 12584 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
12585 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
12586 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
12587 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 12588 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
12589 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
12590 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
12591 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 12592 | |
12593 | /* Old commands. */ | |
12594 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
12595 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
12596 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
12597 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
12598 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 12599 | |
f14e6fdb DS |
12600 | /* "show ip bgp peer-group" commands. */ |
12601 | install_element (VIEW_NODE, &show_ip_bgp_peer_groups_cmd); | |
12602 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
12603 | install_element (VIEW_NODE, &show_ip_bgp_peer_group_cmd); | |
12604 | install_element (VIEW_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
12605 | install_element (ENABLE_NODE, &show_ip_bgp_peer_groups_cmd); | |
12606 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_groups_cmd); | |
12607 | install_element (ENABLE_NODE, &show_ip_bgp_peer_group_cmd); | |
12608 | install_element (ENABLE_NODE, &show_ip_bgp_instance_peer_group_cmd); | |
12609 | ||
fee0f4c6 | 12610 | /* "show ip bgp rsclient" commands. */ |
12611 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); | |
12612 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
12613 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
12614 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
12615 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
12616 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
12617 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
12618 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
12619 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
12620 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
12621 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
12622 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 12623 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
12624 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
12625 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
12626 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
12627 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
12628 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 12629 | |
12630 | #ifdef HAVE_IPV6 | |
12631 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); | |
12632 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
12633 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
12634 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
12635 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
12636 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
12637 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
12638 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
12639 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
12640 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
12641 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
12642 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 12643 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
12644 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
12645 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
12646 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
12647 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
12648 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 12649 | #endif /* HAVE_IPV6 */ |
718e3744 | 12650 | |
12651 | /* "show ip bgp paths" commands. */ | |
12652 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
12653 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
12654 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
12655 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
12656 | ||
12657 | /* "show ip bgp community" commands. */ | |
12658 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
12659 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
12660 | ||
12661 | /* "show ip bgp attribute-info" commands. */ | |
12662 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
12663 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
12664 | ||
12665 | /* "redistribute" commands. */ | |
12666 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
12667 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
12668 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
12669 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
12670 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
12671 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
12672 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
12673 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
12674 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
12675 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
7c8ff89e DS |
12676 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_cmd); |
12677 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_cmd); | |
12678 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_cmd); | |
12679 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_cmd); | |
12680 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_cmd); | |
12681 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_cmd); | |
12682 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
12683 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd); | |
12684 | install_element (BGP_NODE, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
12685 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd); | |
718e3744 | 12686 | #ifdef HAVE_IPV6 |
12687 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
12688 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
12689 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
12690 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
12691 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
12692 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
12693 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
12694 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
12695 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
12696 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
12697 | #endif /* HAVE_IPV6 */ | |
12698 | ||
fa411a21 NH |
12699 | /* ttl_security commands */ |
12700 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
12701 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
12702 | ||
4bf6a362 PJ |
12703 | /* "show bgp memory" commands. */ |
12704 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 12705 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
12706 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
12707 | ||
e0081f70 ML |
12708 | /* "show bgp views" commands. */ |
12709 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
12710 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
12711 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
12712 | ||
718e3744 | 12713 | /* Community-list. */ |
12714 | community_list_vty (); | |
12715 | } | |
6b0655a2 | 12716 | |
718e3744 | 12717 | #include "memory.h" |
12718 | #include "bgp_regex.h" | |
12719 | #include "bgp_clist.h" | |
12720 | #include "bgp_ecommunity.h" | |
12721 | ||
12722 | /* VTY functions. */ | |
12723 | ||
12724 | /* Direction value to string conversion. */ | |
94f2b392 | 12725 | static const char * |
718e3744 | 12726 | community_direct_str (int direct) |
12727 | { | |
12728 | switch (direct) | |
12729 | { | |
12730 | case COMMUNITY_DENY: | |
12731 | return "deny"; | |
718e3744 | 12732 | case COMMUNITY_PERMIT: |
12733 | return "permit"; | |
718e3744 | 12734 | default: |
12735 | return "unknown"; | |
718e3744 | 12736 | } |
12737 | } | |
12738 | ||
12739 | /* Display error string. */ | |
94f2b392 | 12740 | static void |
718e3744 | 12741 | community_list_perror (struct vty *vty, int ret) |
12742 | { | |
12743 | switch (ret) | |
12744 | { | |
12745 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 12746 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 12747 | break; |
12748 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
12749 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
12750 | break; | |
12751 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
12752 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
12753 | break; | |
12754 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
12755 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
12756 | break; | |
12757 | } | |
12758 | } | |
12759 | ||
12760 | /* VTY interface for community_set() function. */ | |
94f2b392 | 12761 | static int |
fd79ac91 | 12762 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
12763 | int style, int reject_all_digit_name) | |
718e3744 | 12764 | { |
12765 | int ret; | |
12766 | int direct; | |
12767 | char *str; | |
12768 | ||
12769 | /* Check the list type. */ | |
12770 | if (strncmp (argv[1], "p", 1) == 0) | |
12771 | direct = COMMUNITY_PERMIT; | |
12772 | else if (strncmp (argv[1], "d", 1) == 0) | |
12773 | direct = COMMUNITY_DENY; | |
12774 | else | |
12775 | { | |
12776 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
12777 | VTY_NEWLINE); | |
12778 | return CMD_WARNING; | |
12779 | } | |
12780 | ||
12781 | /* All digit name check. */ | |
12782 | if (reject_all_digit_name && all_digit (argv[0])) | |
12783 | { | |
12784 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
12785 | return CMD_WARNING; | |
12786 | } | |
12787 | ||
12788 | /* Concat community string argument. */ | |
12789 | if (argc > 1) | |
12790 | str = argv_concat (argv, argc, 2); | |
12791 | else | |
12792 | str = NULL; | |
12793 | ||
12794 | /* When community_list_set() return nevetive value, it means | |
12795 | malformed community string. */ | |
12796 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
12797 | ||
12798 | /* Free temporary community list string allocated by | |
12799 | argv_concat(). */ | |
12800 | if (str) | |
12801 | XFREE (MTYPE_TMP, str); | |
12802 | ||
12803 | if (ret < 0) | |
12804 | { | |
12805 | /* Display error string. */ | |
12806 | community_list_perror (vty, ret); | |
12807 | return CMD_WARNING; | |
12808 | } | |
12809 | ||
12810 | return CMD_SUCCESS; | |
12811 | } | |
12812 | ||
718e3744 | 12813 | /* Communiyt-list entry delete. */ |
94f2b392 | 12814 | static int |
fee6e4e4 | 12815 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
12816 | int style) | |
718e3744 | 12817 | { |
12818 | int ret; | |
fee6e4e4 | 12819 | int direct = 0; |
12820 | char *str = NULL; | |
718e3744 | 12821 | |
fee6e4e4 | 12822 | if (argc > 1) |
718e3744 | 12823 | { |
fee6e4e4 | 12824 | /* Check the list direct. */ |
12825 | if (strncmp (argv[1], "p", 1) == 0) | |
12826 | direct = COMMUNITY_PERMIT; | |
12827 | else if (strncmp (argv[1], "d", 1) == 0) | |
12828 | direct = COMMUNITY_DENY; | |
12829 | else | |
12830 | { | |
12831 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
12832 | VTY_NEWLINE); | |
12833 | return CMD_WARNING; | |
12834 | } | |
718e3744 | 12835 | |
fee6e4e4 | 12836 | /* Concat community string argument. */ |
12837 | str = argv_concat (argv, argc, 2); | |
12838 | } | |
718e3744 | 12839 | |
12840 | /* Unset community list. */ | |
12841 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); | |
12842 | ||
12843 | /* Free temporary community list string allocated by | |
12844 | argv_concat(). */ | |
fee6e4e4 | 12845 | if (str) |
12846 | XFREE (MTYPE_TMP, str); | |
718e3744 | 12847 | |
12848 | if (ret < 0) | |
12849 | { | |
12850 | community_list_perror (vty, ret); | |
12851 | return CMD_WARNING; | |
12852 | } | |
12853 | ||
12854 | return CMD_SUCCESS; | |
12855 | } | |
12856 | ||
12857 | /* "community-list" keyword help string. */ | |
12858 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
12859 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" | |
12860 | ||
718e3744 | 12861 | DEFUN (ip_community_list_standard, |
12862 | ip_community_list_standard_cmd, | |
12863 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
12864 | IP_STR | |
12865 | COMMUNITY_LIST_STR | |
12866 | "Community list number (standard)\n" | |
12867 | "Specify community to reject\n" | |
12868 | "Specify community to accept\n" | |
12869 | COMMUNITY_VAL_STR) | |
12870 | { | |
12871 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
12872 | } | |
12873 | ||
12874 | ALIAS (ip_community_list_standard, | |
12875 | ip_community_list_standard2_cmd, | |
12876 | "ip community-list <1-99> (deny|permit)", | |
12877 | IP_STR | |
12878 | COMMUNITY_LIST_STR | |
12879 | "Community list number (standard)\n" | |
12880 | "Specify community to reject\n" | |
12881 | "Specify community to accept\n") | |
12882 | ||
12883 | DEFUN (ip_community_list_expanded, | |
12884 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 12885 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 12886 | IP_STR |
12887 | COMMUNITY_LIST_STR | |
12888 | "Community list number (expanded)\n" | |
12889 | "Specify community to reject\n" | |
12890 | "Specify community to accept\n" | |
12891 | "An ordered list as a regular-expression\n") | |
12892 | { | |
12893 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
12894 | } | |
12895 | ||
12896 | DEFUN (ip_community_list_name_standard, | |
12897 | ip_community_list_name_standard_cmd, | |
12898 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
12899 | IP_STR | |
12900 | COMMUNITY_LIST_STR | |
12901 | "Add a standard community-list entry\n" | |
12902 | "Community list name\n" | |
12903 | "Specify community to reject\n" | |
12904 | "Specify community to accept\n" | |
12905 | COMMUNITY_VAL_STR) | |
12906 | { | |
12907 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
12908 | } | |
12909 | ||
12910 | ALIAS (ip_community_list_name_standard, | |
12911 | ip_community_list_name_standard2_cmd, | |
12912 | "ip community-list standard WORD (deny|permit)", | |
12913 | IP_STR | |
12914 | COMMUNITY_LIST_STR | |
12915 | "Add a standard community-list entry\n" | |
12916 | "Community list name\n" | |
12917 | "Specify community to reject\n" | |
12918 | "Specify community to accept\n") | |
12919 | ||
12920 | DEFUN (ip_community_list_name_expanded, | |
12921 | ip_community_list_name_expanded_cmd, | |
12922 | "ip community-list expanded WORD (deny|permit) .LINE", | |
12923 | IP_STR | |
12924 | COMMUNITY_LIST_STR | |
12925 | "Add an expanded community-list entry\n" | |
12926 | "Community list name\n" | |
12927 | "Specify community to reject\n" | |
12928 | "Specify community to accept\n" | |
12929 | "An ordered list as a regular-expression\n") | |
12930 | { | |
12931 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
12932 | } | |
12933 | ||
fee6e4e4 | 12934 | DEFUN (no_ip_community_list_standard_all, |
12935 | no_ip_community_list_standard_all_cmd, | |
12936 | "no ip community-list <1-99>", | |
12937 | NO_STR | |
12938 | IP_STR | |
12939 | COMMUNITY_LIST_STR | |
12940 | "Community list number (standard)\n") | |
12941 | { | |
12942 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
12943 | } | |
12944 | ||
12945 | DEFUN (no_ip_community_list_expanded_all, | |
12946 | no_ip_community_list_expanded_all_cmd, | |
12947 | "no ip community-list <100-500>", | |
718e3744 | 12948 | NO_STR |
12949 | IP_STR | |
12950 | COMMUNITY_LIST_STR | |
718e3744 | 12951 | "Community list number (expanded)\n") |
12952 | { | |
fee6e4e4 | 12953 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 12954 | } |
12955 | ||
fee6e4e4 | 12956 | DEFUN (no_ip_community_list_name_standard_all, |
12957 | no_ip_community_list_name_standard_all_cmd, | |
12958 | "no ip community-list standard WORD", | |
718e3744 | 12959 | NO_STR |
12960 | IP_STR | |
12961 | COMMUNITY_LIST_STR | |
12962 | "Add a standard community-list entry\n" | |
718e3744 | 12963 | "Community list name\n") |
12964 | { | |
fee6e4e4 | 12965 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
718e3744 | 12966 | } |
12967 | ||
fee6e4e4 | 12968 | DEFUN (no_ip_community_list_name_expanded_all, |
12969 | no_ip_community_list_name_expanded_all_cmd, | |
12970 | "no ip community-list expanded WORD", | |
718e3744 | 12971 | NO_STR |
12972 | IP_STR | |
12973 | COMMUNITY_LIST_STR | |
fee6e4e4 | 12974 | "Add an expanded community-list entry\n" |
12975 | "Community list name\n") | |
718e3744 | 12976 | { |
fee6e4e4 | 12977 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 12978 | } |
12979 | ||
12980 | DEFUN (no_ip_community_list_standard, | |
12981 | no_ip_community_list_standard_cmd, | |
12982 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
12983 | NO_STR | |
12984 | IP_STR | |
12985 | COMMUNITY_LIST_STR | |
12986 | "Community list number (standard)\n" | |
12987 | "Specify community to reject\n" | |
12988 | "Specify community to accept\n" | |
12989 | COMMUNITY_VAL_STR) | |
12990 | { | |
12991 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
12992 | } | |
12993 | ||
12994 | DEFUN (no_ip_community_list_expanded, | |
12995 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 12996 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 12997 | NO_STR |
12998 | IP_STR | |
12999 | COMMUNITY_LIST_STR | |
13000 | "Community list number (expanded)\n" | |
13001 | "Specify community to reject\n" | |
13002 | "Specify community to accept\n" | |
13003 | "An ordered list as a regular-expression\n") | |
13004 | { | |
13005 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
13006 | } | |
13007 | ||
13008 | DEFUN (no_ip_community_list_name_standard, | |
13009 | no_ip_community_list_name_standard_cmd, | |
13010 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
13011 | NO_STR | |
13012 | IP_STR | |
13013 | COMMUNITY_LIST_STR | |
13014 | "Specify a standard community-list\n" | |
13015 | "Community list name\n" | |
13016 | "Specify community to reject\n" | |
13017 | "Specify community to accept\n" | |
13018 | COMMUNITY_VAL_STR) | |
13019 | { | |
13020 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
13021 | } | |
13022 | ||
13023 | DEFUN (no_ip_community_list_name_expanded, | |
13024 | no_ip_community_list_name_expanded_cmd, | |
13025 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
13026 | NO_STR | |
13027 | IP_STR | |
13028 | COMMUNITY_LIST_STR | |
13029 | "Specify an expanded community-list\n" | |
13030 | "Community list name\n" | |
13031 | "Specify community to reject\n" | |
13032 | "Specify community to accept\n" | |
13033 | "An ordered list as a regular-expression\n") | |
13034 | { | |
13035 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
13036 | } | |
13037 | ||
94f2b392 | 13038 | static void |
718e3744 | 13039 | community_list_show (struct vty *vty, struct community_list *list) |
13040 | { | |
13041 | struct community_entry *entry; | |
13042 | ||
13043 | for (entry = list->head; entry; entry = entry->next) | |
13044 | { | |
13045 | if (entry == list->head) | |
13046 | { | |
13047 | if (all_digit (list->name)) | |
13048 | vty_out (vty, "Community %s list %s%s", | |
13049 | entry->style == COMMUNITY_LIST_STANDARD ? | |
13050 | "standard" : "(expanded) access", | |
13051 | list->name, VTY_NEWLINE); | |
13052 | else | |
13053 | vty_out (vty, "Named Community %s list %s%s", | |
13054 | entry->style == COMMUNITY_LIST_STANDARD ? | |
13055 | "standard" : "expanded", | |
13056 | list->name, VTY_NEWLINE); | |
13057 | } | |
13058 | if (entry->any) | |
13059 | vty_out (vty, " %s%s", | |
13060 | community_direct_str (entry->direct), VTY_NEWLINE); | |
13061 | else | |
13062 | vty_out (vty, " %s %s%s", | |
13063 | community_direct_str (entry->direct), | |
13064 | entry->style == COMMUNITY_LIST_STANDARD | |
13065 | ? community_str (entry->u.com) : entry->config, | |
13066 | VTY_NEWLINE); | |
13067 | } | |
13068 | } | |
13069 | ||
13070 | DEFUN (show_ip_community_list, | |
13071 | show_ip_community_list_cmd, | |
13072 | "show ip community-list", | |
13073 | SHOW_STR | |
13074 | IP_STR | |
13075 | "List community-list\n") | |
13076 | { | |
13077 | struct community_list *list; | |
13078 | struct community_list_master *cm; | |
13079 | ||
fee6e4e4 | 13080 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 13081 | if (! cm) |
13082 | return CMD_SUCCESS; | |
13083 | ||
13084 | for (list = cm->num.head; list; list = list->next) | |
13085 | community_list_show (vty, list); | |
13086 | ||
13087 | for (list = cm->str.head; list; list = list->next) | |
13088 | community_list_show (vty, list); | |
13089 | ||
13090 | return CMD_SUCCESS; | |
13091 | } | |
13092 | ||
13093 | DEFUN (show_ip_community_list_arg, | |
13094 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 13095 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 13096 | SHOW_STR |
13097 | IP_STR | |
13098 | "List community-list\n" | |
13099 | "Community-list number\n" | |
13100 | "Community-list name\n") | |
13101 | { | |
13102 | struct community_list *list; | |
13103 | ||
fee6e4e4 | 13104 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 13105 | if (! list) |
13106 | { | |
b729294c | 13107 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 13108 | return CMD_WARNING; |
13109 | } | |
13110 | ||
13111 | community_list_show (vty, list); | |
13112 | ||
13113 | return CMD_SUCCESS; | |
13114 | } | |
6b0655a2 | 13115 | |
94f2b392 | 13116 | static int |
fd79ac91 | 13117 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
13118 | int style, int reject_all_digit_name) | |
718e3744 | 13119 | { |
13120 | int ret; | |
13121 | int direct; | |
13122 | char *str; | |
13123 | ||
13124 | /* Check the list type. */ | |
13125 | if (strncmp (argv[1], "p", 1) == 0) | |
13126 | direct = COMMUNITY_PERMIT; | |
13127 | else if (strncmp (argv[1], "d", 1) == 0) | |
13128 | direct = COMMUNITY_DENY; | |
13129 | else | |
13130 | { | |
13131 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
13132 | VTY_NEWLINE); | |
13133 | return CMD_WARNING; | |
13134 | } | |
13135 | ||
13136 | /* All digit name check. */ | |
13137 | if (reject_all_digit_name && all_digit (argv[0])) | |
13138 | { | |
13139 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
13140 | return CMD_WARNING; | |
13141 | } | |
13142 | ||
13143 | /* Concat community string argument. */ | |
13144 | if (argc > 1) | |
13145 | str = argv_concat (argv, argc, 2); | |
13146 | else | |
13147 | str = NULL; | |
13148 | ||
13149 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
13150 | ||
13151 | /* Free temporary community list string allocated by | |
13152 | argv_concat(). */ | |
13153 | if (str) | |
13154 | XFREE (MTYPE_TMP, str); | |
13155 | ||
13156 | if (ret < 0) | |
13157 | { | |
13158 | community_list_perror (vty, ret); | |
13159 | return CMD_WARNING; | |
13160 | } | |
13161 | return CMD_SUCCESS; | |
13162 | } | |
13163 | ||
94f2b392 | 13164 | static int |
fee6e4e4 | 13165 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
13166 | int style) | |
718e3744 | 13167 | { |
13168 | int ret; | |
fee6e4e4 | 13169 | int direct = 0; |
13170 | char *str = NULL; | |
718e3744 | 13171 | |
fee6e4e4 | 13172 | if (argc > 1) |
718e3744 | 13173 | { |
fee6e4e4 | 13174 | /* Check the list direct. */ |
13175 | if (strncmp (argv[1], "p", 1) == 0) | |
13176 | direct = COMMUNITY_PERMIT; | |
13177 | else if (strncmp (argv[1], "d", 1) == 0) | |
13178 | direct = COMMUNITY_DENY; | |
13179 | else | |
13180 | { | |
13181 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
13182 | VTY_NEWLINE); | |
13183 | return CMD_WARNING; | |
13184 | } | |
718e3744 | 13185 | |
fee6e4e4 | 13186 | /* Concat community string argument. */ |
13187 | str = argv_concat (argv, argc, 2); | |
718e3744 | 13188 | } |
13189 | ||
718e3744 | 13190 | /* Unset community list. */ |
13191 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); | |
13192 | ||
13193 | /* Free temporary community list string allocated by | |
13194 | argv_concat(). */ | |
fee6e4e4 | 13195 | if (str) |
13196 | XFREE (MTYPE_TMP, str); | |
718e3744 | 13197 | |
13198 | if (ret < 0) | |
13199 | { | |
13200 | community_list_perror (vty, ret); | |
13201 | return CMD_WARNING; | |
13202 | } | |
13203 | ||
13204 | return CMD_SUCCESS; | |
13205 | } | |
13206 | ||
13207 | /* "extcommunity-list" keyword help string. */ | |
13208 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
13209 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
13210 | ||
13211 | DEFUN (ip_extcommunity_list_standard, | |
13212 | ip_extcommunity_list_standard_cmd, | |
13213 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
13214 | IP_STR | |
13215 | EXTCOMMUNITY_LIST_STR | |
13216 | "Extended Community list number (standard)\n" | |
13217 | "Specify community to reject\n" | |
13218 | "Specify community to accept\n" | |
13219 | EXTCOMMUNITY_VAL_STR) | |
13220 | { | |
13221 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
13222 | } | |
13223 | ||
13224 | ALIAS (ip_extcommunity_list_standard, | |
13225 | ip_extcommunity_list_standard2_cmd, | |
13226 | "ip extcommunity-list <1-99> (deny|permit)", | |
13227 | IP_STR | |
13228 | EXTCOMMUNITY_LIST_STR | |
13229 | "Extended Community list number (standard)\n" | |
13230 | "Specify community to reject\n" | |
13231 | "Specify community to accept\n") | |
13232 | ||
13233 | DEFUN (ip_extcommunity_list_expanded, | |
13234 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 13235 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 13236 | IP_STR |
13237 | EXTCOMMUNITY_LIST_STR | |
13238 | "Extended Community list number (expanded)\n" | |
13239 | "Specify community to reject\n" | |
13240 | "Specify community to accept\n" | |
13241 | "An ordered list as a regular-expression\n") | |
13242 | { | |
13243 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
13244 | } | |
13245 | ||
13246 | DEFUN (ip_extcommunity_list_name_standard, | |
13247 | ip_extcommunity_list_name_standard_cmd, | |
13248 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
13249 | IP_STR | |
13250 | EXTCOMMUNITY_LIST_STR | |
13251 | "Specify standard extcommunity-list\n" | |
13252 | "Extended Community list name\n" | |
13253 | "Specify community to reject\n" | |
13254 | "Specify community to accept\n" | |
13255 | EXTCOMMUNITY_VAL_STR) | |
13256 | { | |
13257 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
13258 | } | |
13259 | ||
13260 | ALIAS (ip_extcommunity_list_name_standard, | |
13261 | ip_extcommunity_list_name_standard2_cmd, | |
13262 | "ip extcommunity-list standard WORD (deny|permit)", | |
13263 | IP_STR | |
13264 | EXTCOMMUNITY_LIST_STR | |
13265 | "Specify standard extcommunity-list\n" | |
13266 | "Extended Community list name\n" | |
13267 | "Specify community to reject\n" | |
13268 | "Specify community to accept\n") | |
13269 | ||
13270 | DEFUN (ip_extcommunity_list_name_expanded, | |
13271 | ip_extcommunity_list_name_expanded_cmd, | |
13272 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
13273 | IP_STR | |
13274 | EXTCOMMUNITY_LIST_STR | |
13275 | "Specify expanded extcommunity-list\n" | |
13276 | "Extended Community list name\n" | |
13277 | "Specify community to reject\n" | |
13278 | "Specify community to accept\n" | |
13279 | "An ordered list as a regular-expression\n") | |
13280 | { | |
13281 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
13282 | } | |
13283 | ||
fee6e4e4 | 13284 | DEFUN (no_ip_extcommunity_list_standard_all, |
13285 | no_ip_extcommunity_list_standard_all_cmd, | |
13286 | "no ip extcommunity-list <1-99>", | |
13287 | NO_STR | |
13288 | IP_STR | |
13289 | EXTCOMMUNITY_LIST_STR | |
13290 | "Extended Community list number (standard)\n") | |
13291 | { | |
13292 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
13293 | } | |
13294 | ||
13295 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
13296 | no_ip_extcommunity_list_expanded_all_cmd, | |
13297 | "no ip extcommunity-list <100-500>", | |
718e3744 | 13298 | NO_STR |
13299 | IP_STR | |
13300 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 13301 | "Extended Community list number (expanded)\n") |
13302 | { | |
fee6e4e4 | 13303 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 13304 | } |
13305 | ||
fee6e4e4 | 13306 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
13307 | no_ip_extcommunity_list_name_standard_all_cmd, | |
13308 | "no ip extcommunity-list standard WORD", | |
718e3744 | 13309 | NO_STR |
13310 | IP_STR | |
13311 | EXTCOMMUNITY_LIST_STR | |
13312 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 13313 | "Extended Community list name\n") |
13314 | { | |
13315 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
13316 | } | |
13317 | ||
13318 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
13319 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
13320 | "no ip extcommunity-list expanded WORD", | |
13321 | NO_STR | |
13322 | IP_STR | |
13323 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 13324 | "Specify expanded extcommunity-list\n" |
13325 | "Extended Community list name\n") | |
13326 | { | |
fee6e4e4 | 13327 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 13328 | } |
13329 | ||
13330 | DEFUN (no_ip_extcommunity_list_standard, | |
13331 | no_ip_extcommunity_list_standard_cmd, | |
13332 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
13333 | NO_STR | |
13334 | IP_STR | |
13335 | EXTCOMMUNITY_LIST_STR | |
13336 | "Extended Community list number (standard)\n" | |
13337 | "Specify community to reject\n" | |
13338 | "Specify community to accept\n" | |
13339 | EXTCOMMUNITY_VAL_STR) | |
13340 | { | |
13341 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
13342 | } | |
13343 | ||
13344 | DEFUN (no_ip_extcommunity_list_expanded, | |
13345 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 13346 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 13347 | NO_STR |
13348 | IP_STR | |
13349 | EXTCOMMUNITY_LIST_STR | |
13350 | "Extended Community list number (expanded)\n" | |
13351 | "Specify community to reject\n" | |
13352 | "Specify community to accept\n" | |
13353 | "An ordered list as a regular-expression\n") | |
13354 | { | |
13355 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
13356 | } | |
13357 | ||
13358 | DEFUN (no_ip_extcommunity_list_name_standard, | |
13359 | no_ip_extcommunity_list_name_standard_cmd, | |
13360 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
13361 | NO_STR | |
13362 | IP_STR | |
13363 | EXTCOMMUNITY_LIST_STR | |
13364 | "Specify standard extcommunity-list\n" | |
13365 | "Extended Community list name\n" | |
13366 | "Specify community to reject\n" | |
13367 | "Specify community to accept\n" | |
13368 | EXTCOMMUNITY_VAL_STR) | |
13369 | { | |
13370 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
13371 | } | |
13372 | ||
13373 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
13374 | no_ip_extcommunity_list_name_expanded_cmd, | |
13375 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
13376 | NO_STR | |
13377 | IP_STR | |
13378 | EXTCOMMUNITY_LIST_STR | |
13379 | "Specify expanded extcommunity-list\n" | |
13380 | "Community list name\n" | |
13381 | "Specify community to reject\n" | |
13382 | "Specify community to accept\n" | |
13383 | "An ordered list as a regular-expression\n") | |
13384 | { | |
13385 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
13386 | } | |
13387 | ||
94f2b392 | 13388 | static void |
718e3744 | 13389 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
13390 | { | |
13391 | struct community_entry *entry; | |
13392 | ||
13393 | for (entry = list->head; entry; entry = entry->next) | |
13394 | { | |
13395 | if (entry == list->head) | |
13396 | { | |
13397 | if (all_digit (list->name)) | |
13398 | vty_out (vty, "Extended community %s list %s%s", | |
13399 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
13400 | "standard" : "(expanded) access", | |
13401 | list->name, VTY_NEWLINE); | |
13402 | else | |
13403 | vty_out (vty, "Named extended community %s list %s%s", | |
13404 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
13405 | "standard" : "expanded", | |
13406 | list->name, VTY_NEWLINE); | |
13407 | } | |
13408 | if (entry->any) | |
13409 | vty_out (vty, " %s%s", | |
13410 | community_direct_str (entry->direct), VTY_NEWLINE); | |
13411 | else | |
13412 | vty_out (vty, " %s %s%s", | |
13413 | community_direct_str (entry->direct), | |
13414 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
13415 | entry->u.ecom->str : entry->config, | |
13416 | VTY_NEWLINE); | |
13417 | } | |
13418 | } | |
13419 | ||
13420 | DEFUN (show_ip_extcommunity_list, | |
13421 | show_ip_extcommunity_list_cmd, | |
13422 | "show ip extcommunity-list", | |
13423 | SHOW_STR | |
13424 | IP_STR | |
13425 | "List extended-community list\n") | |
13426 | { | |
13427 | struct community_list *list; | |
13428 | struct community_list_master *cm; | |
13429 | ||
fee6e4e4 | 13430 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 13431 | if (! cm) |
13432 | return CMD_SUCCESS; | |
13433 | ||
13434 | for (list = cm->num.head; list; list = list->next) | |
13435 | extcommunity_list_show (vty, list); | |
13436 | ||
13437 | for (list = cm->str.head; list; list = list->next) | |
13438 | extcommunity_list_show (vty, list); | |
13439 | ||
13440 | return CMD_SUCCESS; | |
13441 | } | |
13442 | ||
13443 | DEFUN (show_ip_extcommunity_list_arg, | |
13444 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 13445 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 13446 | SHOW_STR |
13447 | IP_STR | |
13448 | "List extended-community list\n" | |
13449 | "Extcommunity-list number\n" | |
13450 | "Extcommunity-list name\n") | |
13451 | { | |
13452 | struct community_list *list; | |
13453 | ||
fee6e4e4 | 13454 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 13455 | if (! list) |
13456 | { | |
b729294c | 13457 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 13458 | return CMD_WARNING; |
13459 | } | |
13460 | ||
13461 | extcommunity_list_show (vty, list); | |
13462 | ||
13463 | return CMD_SUCCESS; | |
13464 | } | |
6b0655a2 | 13465 | |
718e3744 | 13466 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 13467 | static const char * |
718e3744 | 13468 | community_list_config_str (struct community_entry *entry) |
13469 | { | |
fd79ac91 | 13470 | const char *str; |
718e3744 | 13471 | |
13472 | if (entry->any) | |
13473 | str = ""; | |
13474 | else | |
13475 | { | |
13476 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
13477 | str = community_str (entry->u.com); | |
13478 | else | |
13479 | str = entry->config; | |
13480 | } | |
13481 | return str; | |
13482 | } | |
13483 | ||
13484 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 13485 | static int |
718e3744 | 13486 | community_list_config_write (struct vty *vty) |
13487 | { | |
13488 | struct community_list *list; | |
13489 | struct community_entry *entry; | |
13490 | struct community_list_master *cm; | |
13491 | int write = 0; | |
13492 | ||
13493 | /* Community-list. */ | |
fee6e4e4 | 13494 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 13495 | |
13496 | for (list = cm->num.head; list; list = list->next) | |
13497 | for (entry = list->head; entry; entry = entry->next) | |
13498 | { | |
fee6e4e4 | 13499 | vty_out (vty, "ip community-list %s %s %s%s", |
13500 | list->name, community_direct_str (entry->direct), | |
13501 | community_list_config_str (entry), | |
13502 | VTY_NEWLINE); | |
718e3744 | 13503 | write++; |
13504 | } | |
13505 | for (list = cm->str.head; list; list = list->next) | |
13506 | for (entry = list->head; entry; entry = entry->next) | |
13507 | { | |
13508 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
13509 | entry->style == COMMUNITY_LIST_STANDARD | |
13510 | ? "standard" : "expanded", | |
13511 | list->name, community_direct_str (entry->direct), | |
13512 | community_list_config_str (entry), | |
13513 | VTY_NEWLINE); | |
13514 | write++; | |
13515 | } | |
13516 | ||
13517 | /* Extcommunity-list. */ | |
fee6e4e4 | 13518 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 13519 | |
13520 | for (list = cm->num.head; list; list = list->next) | |
13521 | for (entry = list->head; entry; entry = entry->next) | |
13522 | { | |
fee6e4e4 | 13523 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
13524 | list->name, community_direct_str (entry->direct), | |
13525 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 13526 | write++; |
13527 | } | |
13528 | for (list = cm->str.head; list; list = list->next) | |
13529 | for (entry = list->head; entry; entry = entry->next) | |
13530 | { | |
13531 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
13532 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
13533 | ? "standard" : "expanded", | |
13534 | list->name, community_direct_str (entry->direct), | |
13535 | community_list_config_str (entry), VTY_NEWLINE); | |
13536 | write++; | |
13537 | } | |
13538 | return write; | |
13539 | } | |
13540 | ||
7fc626de | 13541 | static struct cmd_node community_list_node = |
718e3744 | 13542 | { |
13543 | COMMUNITY_LIST_NODE, | |
13544 | "", | |
13545 | 1 /* Export to vtysh. */ | |
13546 | }; | |
13547 | ||
94f2b392 | 13548 | static void |
13549 | community_list_vty (void) | |
718e3744 | 13550 | { |
13551 | install_node (&community_list_node, community_list_config_write); | |
13552 | ||
13553 | /* Community-list. */ | |
718e3744 | 13554 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
13555 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
13556 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
13557 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
13558 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
13559 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 13560 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
13561 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); | |
13562 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
13563 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 13564 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
13565 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
13566 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
13567 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); | |
13568 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
13569 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
13570 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
13571 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
13572 | ||
13573 | /* Extcommunity-list. */ | |
13574 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
13575 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
13576 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
13577 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
13578 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
13579 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 13580 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
13581 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); | |
13582 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
13583 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 13584 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
13585 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
13586 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
13587 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); | |
13588 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
13589 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
13590 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
13591 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
13592 | } |