]>
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" |
718e3744 | 33 | |
34 | #include "bgpd/bgpd.h" | |
4bf6a362 | 35 | #include "bgpd/bgp_advertise.h" |
718e3744 | 36 | #include "bgpd/bgp_attr.h" |
37 | #include "bgpd/bgp_aspath.h" | |
38 | #include "bgpd/bgp_community.h" | |
4bf6a362 PJ |
39 | #include "bgpd/bgp_ecommunity.h" |
40 | #include "bgpd/bgp_damp.h" | |
718e3744 | 41 | #include "bgpd/bgp_debug.h" |
e0701b79 | 42 | #include "bgpd/bgp_fsm.h" |
718e3744 | 43 | #include "bgpd/bgp_mplsvpn.h" |
4bf6a362 | 44 | #include "bgpd/bgp_nexthop.h" |
718e3744 | 45 | #include "bgpd/bgp_open.h" |
4bf6a362 | 46 | #include "bgpd/bgp_regex.h" |
718e3744 | 47 | #include "bgpd/bgp_route.h" |
48 | #include "bgpd/bgp_zebra.h" | |
fee0f4c6 | 49 | #include "bgpd/bgp_table.h" |
94f2b392 | 50 | #include "bgpd/bgp_vty.h" |
165b5fff | 51 | #include "bgpd/bgp_mpath.h" |
cb1faec9 | 52 | #include "bgpd/bgp_packet.h" |
718e3744 | 53 | |
18a6dce6 | 54 | extern struct in_addr router_id_zebra; |
55 | ||
718e3744 | 56 | /* Utility function to get address family from current node. */ |
57 | afi_t | |
58 | bgp_node_afi (struct vty *vty) | |
59 | { | |
25ffbdc1 | 60 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 61 | return AFI_IP6; |
62 | return AFI_IP; | |
63 | } | |
64 | ||
65 | /* Utility function to get subsequent address family from current | |
66 | node. */ | |
67 | safi_t | |
68 | bgp_node_safi (struct vty *vty) | |
69 | { | |
70 | if (vty->node == BGP_VPNV4_NODE) | |
71 | return SAFI_MPLS_VPN; | |
25ffbdc1 | 72 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 73 | return SAFI_MULTICAST; |
74 | return SAFI_UNICAST; | |
75 | } | |
76 | ||
94f2b392 | 77 | static int |
718e3744 | 78 | peer_address_self_check (union sockunion *su) |
79 | { | |
80 | struct interface *ifp = NULL; | |
81 | ||
82 | if (su->sa.sa_family == AF_INET) | |
83 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); | |
84 | #ifdef HAVE_IPV6 | |
85 | else if (su->sa.sa_family == AF_INET6) | |
86 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); | |
87 | #endif /* HAVE IPV6 */ | |
88 | ||
89 | if (ifp) | |
90 | return 1; | |
91 | ||
92 | return 0; | |
93 | } | |
94 | ||
95 | /* Utility function for looking up peer from VTY. */ | |
94f2b392 | 96 | static struct peer * |
fd79ac91 | 97 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 98 | { |
99 | int ret; | |
100 | struct bgp *bgp; | |
101 | union sockunion su; | |
102 | struct peer *peer; | |
103 | ||
104 | bgp = vty->index; | |
105 | ||
106 | ret = str2sockunion (ip_str, &su); | |
107 | if (ret < 0) | |
108 | { | |
a80beece DS |
109 | peer = peer_lookup_by_conf_if (bgp, ip_str); |
110 | if (!peer) | |
111 | { | |
112 | vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE); | |
113 | return NULL; | |
114 | } | |
718e3744 | 115 | } |
a80beece | 116 | else |
718e3744 | 117 | { |
a80beece DS |
118 | peer = peer_lookup (bgp, &su); |
119 | if (! peer) | |
120 | { | |
121 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
122 | VTY_NEWLINE); | |
123 | return NULL; | |
124 | } | |
718e3744 | 125 | } |
126 | return peer; | |
127 | } | |
128 | ||
129 | /* Utility function for looking up peer or peer group. */ | |
94f2b392 | 130 | static struct peer * |
fd79ac91 | 131 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 132 | { |
133 | int ret; | |
134 | struct bgp *bgp; | |
135 | union sockunion su; | |
136 | struct peer *peer; | |
137 | struct peer_group *group; | |
138 | ||
139 | bgp = vty->index; | |
140 | ||
141 | ret = str2sockunion (peer_str, &su); | |
142 | if (ret == 0) | |
143 | { | |
144 | peer = peer_lookup (bgp, &su); | |
145 | if (peer) | |
146 | return peer; | |
147 | } | |
148 | else | |
149 | { | |
a80beece DS |
150 | peer = peer_lookup_by_conf_if (bgp, peer_str); |
151 | if (peer) | |
152 | return peer; | |
153 | ||
718e3744 | 154 | group = peer_group_lookup (bgp, peer_str); |
155 | if (group) | |
156 | return group->conf; | |
157 | } | |
158 | ||
159 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
160 | VTY_NEWLINE); | |
161 | ||
162 | return NULL; | |
163 | } | |
164 | ||
94f2b392 | 165 | static int |
718e3744 | 166 | bgp_vty_return (struct vty *vty, int ret) |
167 | { | |
fd79ac91 | 168 | const char *str = NULL; |
718e3744 | 169 | |
170 | switch (ret) | |
171 | { | |
172 | case BGP_ERR_INVALID_VALUE: | |
173 | str = "Invalid value"; | |
174 | break; | |
175 | case BGP_ERR_INVALID_FLAG: | |
176 | str = "Invalid flag"; | |
177 | break; | |
178 | case BGP_ERR_PEER_INACTIVE: | |
179 | str = "Activate the neighbor for the address family first"; | |
180 | break; | |
181 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: | |
182 | str = "Invalid command for a peer-group member"; | |
183 | break; | |
184 | case BGP_ERR_PEER_GROUP_SHUTDOWN: | |
185 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
186 | break; | |
187 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: | |
188 | str = "This peer is a peer-group member. Please change peer-group configuration"; | |
189 | break; | |
190 | case BGP_ERR_PEER_FLAG_CONFLICT: | |
191 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
192 | break; | |
193 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: | |
194 | str = "No activate for peergroup can be given only if peer-group has no members"; | |
195 | break; | |
196 | case BGP_ERR_PEER_BELONGS_TO_GROUP: | |
197 | str = "No activate for an individual peer-group member is invalid"; | |
198 | break; | |
199 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: | |
200 | str = "Activate the peer-group for the address family first"; | |
201 | break; | |
202 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: | |
203 | str = "Specify remote-as or peer-group remote AS first"; | |
204 | break; | |
205 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
206 | str = "Cannot change the peer-group. Deconfigure first"; | |
207 | break; | |
208 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
209 | str = "Cannot have different peer-group for the neighbor"; | |
210 | break; | |
211 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
212 | str = "Prefix/distribute list can not co-exist"; | |
213 | break; | |
214 | case BGP_ERR_NOT_INTERNAL_PEER: | |
215 | str = "Invalid command. Not an internal neighbor"; | |
216 | break; | |
217 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
218 | str = "Private AS cannot be removed for IBGP peers"; | |
219 | break; | |
220 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
221 | str = "Local-AS allowed only for EBGP peers"; | |
222 | break; | |
223 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
224 | str = "Cannot have local-as same as BGP AS number"; | |
225 | break; | |
0df7c91f PJ |
226 | case BGP_ERR_TCPSIG_FAILED: |
227 | str = "Error while applying TCP-Sig to session(s)"; | |
228 | break; | |
fa411a21 NH |
229 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
230 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
231 | break; | |
f5a4827d SH |
232 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
233 | str = "ttl-security only allowed for EBGP peers"; | |
234 | break; | |
718e3744 | 235 | } |
236 | if (str) | |
237 | { | |
238 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
239 | return CMD_WARNING; | |
240 | } | |
241 | return CMD_SUCCESS; | |
242 | } | |
243 | ||
244 | /* BGP global configuration. */ | |
245 | ||
246 | DEFUN (bgp_multiple_instance_func, | |
247 | bgp_multiple_instance_cmd, | |
248 | "bgp multiple-instance", | |
249 | BGP_STR | |
250 | "Enable bgp multiple instance\n") | |
251 | { | |
252 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
253 | return CMD_SUCCESS; | |
254 | } | |
255 | ||
256 | DEFUN (no_bgp_multiple_instance, | |
257 | no_bgp_multiple_instance_cmd, | |
258 | "no bgp multiple-instance", | |
259 | NO_STR | |
260 | BGP_STR | |
261 | "BGP multiple instance\n") | |
262 | { | |
263 | int ret; | |
264 | ||
265 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
266 | if (ret < 0) | |
267 | { | |
268 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
269 | return CMD_WARNING; | |
270 | } | |
271 | return CMD_SUCCESS; | |
272 | } | |
273 | ||
274 | DEFUN (bgp_config_type, | |
275 | bgp_config_type_cmd, | |
276 | "bgp config-type (cisco|zebra)", | |
277 | BGP_STR | |
278 | "Configuration type\n" | |
279 | "cisco\n" | |
280 | "zebra\n") | |
281 | { | |
282 | if (strncmp (argv[0], "c", 1) == 0) | |
283 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
284 | else | |
285 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
286 | ||
287 | return CMD_SUCCESS; | |
288 | } | |
289 | ||
290 | DEFUN (no_bgp_config_type, | |
291 | no_bgp_config_type_cmd, | |
292 | "no bgp config-type", | |
293 | NO_STR | |
294 | BGP_STR | |
295 | "Display configuration type\n") | |
296 | { | |
297 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
298 | return CMD_SUCCESS; | |
299 | } | |
300 | ||
301 | DEFUN (no_synchronization, | |
302 | no_synchronization_cmd, | |
303 | "no synchronization", | |
304 | NO_STR | |
305 | "Perform IGP synchronization\n") | |
306 | { | |
307 | return CMD_SUCCESS; | |
308 | } | |
309 | ||
310 | DEFUN (no_auto_summary, | |
311 | no_auto_summary_cmd, | |
312 | "no auto-summary", | |
313 | NO_STR | |
314 | "Enable automatic network number summarization\n") | |
315 | { | |
316 | return CMD_SUCCESS; | |
317 | } | |
3d515fd9 | 318 | |
319 | DEFUN_DEPRECATED (neighbor_version, | |
320 | neighbor_version_cmd, | |
321 | NEIGHBOR_CMD "version (4|4-)", | |
322 | NEIGHBOR_STR | |
323 | NEIGHBOR_ADDR_STR | |
324 | "Set the BGP version to match a neighbor\n" | |
325 | "Neighbor's BGP version\n") | |
326 | { | |
327 | return CMD_SUCCESS; | |
328 | } | |
6b0655a2 | 329 | |
718e3744 | 330 | /* "router bgp" commands. */ |
331 | DEFUN (router_bgp, | |
332 | router_bgp_cmd, | |
320da874 | 333 | "router bgp " CMD_AS_RANGE, |
718e3744 | 334 | ROUTER_STR |
335 | BGP_STR | |
336 | AS_STR) | |
337 | { | |
338 | int ret; | |
339 | as_t as; | |
340 | struct bgp *bgp; | |
fd79ac91 | 341 | const char *name = NULL; |
718e3744 | 342 | |
0b2aa3a0 | 343 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 344 | |
345 | if (argc == 2) | |
346 | name = argv[1]; | |
347 | ||
348 | ret = bgp_get (&bgp, &as, name); | |
349 | switch (ret) | |
350 | { | |
351 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
352 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
353 | VTY_NEWLINE); | |
354 | return CMD_WARNING; | |
718e3744 | 355 | case BGP_ERR_AS_MISMATCH: |
aea339f7 | 356 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); |
718e3744 | 357 | return CMD_WARNING; |
718e3744 | 358 | case BGP_ERR_INSTANCE_MISMATCH: |
359 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); | |
aea339f7 | 360 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
718e3744 | 361 | as, VTY_NEWLINE); |
362 | return CMD_WARNING; | |
718e3744 | 363 | } |
364 | ||
365 | vty->node = BGP_NODE; | |
366 | vty->index = bgp; | |
367 | ||
368 | return CMD_SUCCESS; | |
369 | } | |
370 | ||
371 | ALIAS (router_bgp, | |
372 | router_bgp_view_cmd, | |
320da874 | 373 | "router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 374 | ROUTER_STR |
375 | BGP_STR | |
376 | AS_STR | |
377 | "BGP view\n" | |
378 | "view name\n") | |
6b0655a2 | 379 | |
718e3744 | 380 | /* "no router bgp" commands. */ |
381 | DEFUN (no_router_bgp, | |
382 | no_router_bgp_cmd, | |
320da874 | 383 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 384 | NO_STR |
385 | ROUTER_STR | |
386 | BGP_STR | |
387 | AS_STR) | |
388 | { | |
389 | as_t as; | |
390 | struct bgp *bgp; | |
fd79ac91 | 391 | const char *name = NULL; |
718e3744 | 392 | |
0b2aa3a0 | 393 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 394 | |
395 | if (argc == 2) | |
396 | name = argv[1]; | |
397 | ||
398 | /* Lookup bgp structure. */ | |
399 | bgp = bgp_lookup (as, name); | |
400 | if (! bgp) | |
401 | { | |
402 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
403 | return CMD_WARNING; | |
404 | } | |
405 | ||
406 | bgp_delete (bgp); | |
407 | ||
408 | return CMD_SUCCESS; | |
409 | } | |
410 | ||
411 | ALIAS (no_router_bgp, | |
412 | no_router_bgp_view_cmd, | |
320da874 | 413 | "no router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 414 | NO_STR |
415 | ROUTER_STR | |
416 | BGP_STR | |
417 | AS_STR | |
418 | "BGP view\n" | |
419 | "view name\n") | |
6b0655a2 | 420 | |
718e3744 | 421 | /* BGP router-id. */ |
422 | ||
423 | DEFUN (bgp_router_id, | |
424 | bgp_router_id_cmd, | |
425 | "bgp router-id A.B.C.D", | |
426 | BGP_STR | |
427 | "Override configured router identifier\n" | |
428 | "Manually configured router identifier\n") | |
429 | { | |
430 | int ret; | |
431 | struct in_addr id; | |
432 | struct bgp *bgp; | |
433 | ||
434 | bgp = vty->index; | |
435 | ||
436 | ret = inet_aton (argv[0], &id); | |
437 | if (! ret) | |
438 | { | |
439 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
440 | return CMD_WARNING; | |
441 | } | |
442 | ||
18a6dce6 | 443 | bgp->router_id_static = id; |
718e3744 | 444 | bgp_router_id_set (bgp, &id); |
445 | ||
446 | return CMD_SUCCESS; | |
447 | } | |
448 | ||
449 | DEFUN (no_bgp_router_id, | |
450 | no_bgp_router_id_cmd, | |
451 | "no bgp router-id", | |
452 | NO_STR | |
453 | BGP_STR | |
454 | "Override configured router identifier\n") | |
455 | { | |
456 | int ret; | |
457 | struct in_addr id; | |
458 | struct bgp *bgp; | |
459 | ||
460 | bgp = vty->index; | |
461 | ||
462 | if (argc == 1) | |
463 | { | |
464 | ret = inet_aton (argv[0], &id); | |
465 | if (! ret) | |
466 | { | |
467 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
468 | return CMD_WARNING; | |
469 | } | |
470 | ||
18a6dce6 | 471 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
718e3744 | 472 | { |
473 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
474 | return CMD_WARNING; | |
475 | } | |
476 | } | |
477 | ||
18a6dce6 | 478 | bgp->router_id_static.s_addr = 0; |
479 | bgp_router_id_set (bgp, &router_id_zebra); | |
718e3744 | 480 | |
481 | return CMD_SUCCESS; | |
482 | } | |
483 | ||
484 | ALIAS (no_bgp_router_id, | |
485 | no_bgp_router_id_val_cmd, | |
486 | "no bgp router-id A.B.C.D", | |
487 | NO_STR | |
488 | BGP_STR | |
489 | "Override configured router identifier\n" | |
490 | "Manually configured router identifier\n") | |
6b0655a2 | 491 | |
718e3744 | 492 | /* BGP Cluster ID. */ |
493 | ||
494 | DEFUN (bgp_cluster_id, | |
495 | bgp_cluster_id_cmd, | |
496 | "bgp cluster-id A.B.C.D", | |
497 | BGP_STR | |
498 | "Configure Route-Reflector Cluster-id\n" | |
499 | "Route-Reflector Cluster-id in IP address format\n") | |
500 | { | |
501 | int ret; | |
502 | struct bgp *bgp; | |
503 | struct in_addr cluster; | |
504 | ||
505 | bgp = vty->index; | |
506 | ||
507 | ret = inet_aton (argv[0], &cluster); | |
508 | if (! ret) | |
509 | { | |
510 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
511 | return CMD_WARNING; | |
512 | } | |
513 | ||
514 | bgp_cluster_id_set (bgp, &cluster); | |
515 | ||
516 | return CMD_SUCCESS; | |
517 | } | |
518 | ||
519 | ALIAS (bgp_cluster_id, | |
520 | bgp_cluster_id32_cmd, | |
521 | "bgp cluster-id <1-4294967295>", | |
522 | BGP_STR | |
523 | "Configure Route-Reflector Cluster-id\n" | |
524 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
525 | ||
526 | DEFUN (no_bgp_cluster_id, | |
527 | no_bgp_cluster_id_cmd, | |
528 | "no bgp cluster-id", | |
529 | NO_STR | |
530 | BGP_STR | |
531 | "Configure Route-Reflector Cluster-id\n") | |
532 | { | |
533 | int ret; | |
534 | struct bgp *bgp; | |
535 | struct in_addr cluster; | |
536 | ||
537 | bgp = vty->index; | |
538 | ||
539 | if (argc == 1) | |
540 | { | |
541 | ret = inet_aton (argv[0], &cluster); | |
542 | if (! ret) | |
543 | { | |
544 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
545 | return CMD_WARNING; | |
546 | } | |
547 | } | |
548 | ||
549 | bgp_cluster_id_unset (bgp); | |
550 | ||
551 | return CMD_SUCCESS; | |
552 | } | |
553 | ||
554 | ALIAS (no_bgp_cluster_id, | |
555 | no_bgp_cluster_id_arg_cmd, | |
556 | "no bgp cluster-id A.B.C.D", | |
557 | NO_STR | |
558 | BGP_STR | |
559 | "Configure Route-Reflector Cluster-id\n" | |
560 | "Route-Reflector Cluster-id in IP address format\n") | |
6b0655a2 | 561 | |
718e3744 | 562 | DEFUN (bgp_confederation_identifier, |
563 | bgp_confederation_identifier_cmd, | |
320da874 | 564 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 565 | "BGP specific commands\n" |
566 | "AS confederation parameters\n" | |
567 | "AS number\n" | |
568 | "Set routing domain confederation AS\n") | |
569 | { | |
570 | struct bgp *bgp; | |
571 | as_t as; | |
572 | ||
573 | bgp = vty->index; | |
574 | ||
0b2aa3a0 | 575 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 576 | |
577 | bgp_confederation_id_set (bgp, as); | |
578 | ||
579 | return CMD_SUCCESS; | |
580 | } | |
581 | ||
582 | DEFUN (no_bgp_confederation_identifier, | |
583 | no_bgp_confederation_identifier_cmd, | |
584 | "no bgp confederation identifier", | |
585 | NO_STR | |
586 | "BGP specific commands\n" | |
587 | "AS confederation parameters\n" | |
588 | "AS number\n") | |
589 | { | |
590 | struct bgp *bgp; | |
591 | as_t as; | |
592 | ||
593 | bgp = vty->index; | |
594 | ||
595 | if (argc == 1) | |
0b2aa3a0 | 596 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 597 | |
598 | bgp_confederation_id_unset (bgp); | |
599 | ||
600 | return CMD_SUCCESS; | |
601 | } | |
602 | ||
603 | ALIAS (no_bgp_confederation_identifier, | |
604 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 605 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 606 | NO_STR |
607 | "BGP specific commands\n" | |
608 | "AS confederation parameters\n" | |
609 | "AS number\n" | |
610 | "Set routing domain confederation AS\n") | |
6b0655a2 | 611 | |
718e3744 | 612 | DEFUN (bgp_confederation_peers, |
613 | bgp_confederation_peers_cmd, | |
320da874 | 614 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 615 | "BGP specific commands\n" |
616 | "AS confederation parameters\n" | |
617 | "Peer ASs in BGP confederation\n" | |
618 | AS_STR) | |
619 | { | |
620 | struct bgp *bgp; | |
621 | as_t as; | |
622 | int i; | |
623 | ||
624 | bgp = vty->index; | |
625 | ||
626 | for (i = 0; i < argc; i++) | |
627 | { | |
0b2aa3a0 | 628 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 629 | |
630 | if (bgp->as == as) | |
631 | { | |
632 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
633 | VTY_NEWLINE); | |
634 | continue; | |
635 | } | |
636 | ||
637 | bgp_confederation_peers_add (bgp, as); | |
638 | } | |
639 | return CMD_SUCCESS; | |
640 | } | |
641 | ||
642 | DEFUN (no_bgp_confederation_peers, | |
643 | no_bgp_confederation_peers_cmd, | |
320da874 | 644 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 645 | NO_STR |
646 | "BGP specific commands\n" | |
647 | "AS confederation parameters\n" | |
648 | "Peer ASs in BGP confederation\n" | |
649 | AS_STR) | |
650 | { | |
651 | struct bgp *bgp; | |
652 | as_t as; | |
653 | int i; | |
654 | ||
655 | bgp = vty->index; | |
656 | ||
657 | for (i = 0; i < argc; i++) | |
658 | { | |
0b2aa3a0 PJ |
659 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
660 | ||
718e3744 | 661 | bgp_confederation_peers_remove (bgp, as); |
662 | } | |
663 | return CMD_SUCCESS; | |
664 | } | |
6b0655a2 | 665 | |
5e242b0d DS |
666 | /** |
667 | * Central routine for maximum-paths configuration. | |
668 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
669 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
670 | */ | |
671 | int | |
672 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, char *mpaths, | |
673 | u_int16_t options, int set) | |
165b5fff JB |
674 | { |
675 | struct bgp *bgp; | |
676 | u_int16_t maxpaths; | |
677 | int ret; | |
5e242b0d DS |
678 | afi_t afi; |
679 | safi_t safi; | |
165b5fff JB |
680 | |
681 | bgp = vty->index; | |
5e242b0d DS |
682 | afi = bgp_node_afi (vty); |
683 | safi = bgp_node_safi (vty); | |
165b5fff | 684 | |
5e242b0d DS |
685 | if (set) |
686 | { | |
73ac8160 DS |
687 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
688 | BGP_MAXIMUM_MAXPATHS); | |
5e242b0d DS |
689 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
690 | options); | |
691 | } | |
692 | else | |
693 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 694 | |
165b5fff JB |
695 | if (ret < 0) |
696 | { | |
697 | vty_out (vty, | |
5e242b0d DS |
698 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
699 | (set == 1) ? "" : "un", | |
700 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
701 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
702 | return CMD_WARNING; |
703 | } | |
704 | ||
705 | return CMD_SUCCESS; | |
706 | } | |
707 | ||
f188f2c4 DS |
708 | static int |
709 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
710 | const char *wait) | |
711 | { | |
712 | struct bgp *bgp; | |
713 | u_int16_t update_delay; | |
714 | u_int16_t establish_wait; | |
715 | ||
716 | ||
717 | bgp = vty->index; | |
718 | ||
719 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
720 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
721 | ||
722 | if (!wait) /* update-delay <delay> */ | |
723 | { | |
724 | bgp->v_update_delay = update_delay; | |
725 | bgp->v_establish_wait = bgp->v_update_delay; | |
726 | return CMD_SUCCESS; | |
727 | } | |
728 | ||
729 | /* update-delay <delay> <establish-wait> */ | |
730 | establish_wait = atoi (wait); | |
731 | if (update_delay < establish_wait) | |
732 | { | |
733 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
734 | VTY_NEWLINE); | |
735 | return CMD_WARNING; | |
736 | } | |
737 | ||
738 | bgp->v_update_delay = update_delay; | |
739 | bgp->v_establish_wait = establish_wait; | |
740 | ||
741 | return CMD_SUCCESS; | |
742 | } | |
743 | ||
744 | static int | |
745 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
746 | { | |
747 | struct bgp *bgp; | |
748 | ||
749 | bgp = vty->index; | |
750 | ||
751 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
752 | bgp->v_establish_wait = bgp->v_update_delay; | |
753 | ||
754 | return CMD_SUCCESS; | |
755 | } | |
756 | ||
757 | int | |
758 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
759 | { | |
760 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
761 | { | |
762 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
763 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
764 | vty_out (vty, " %d", bgp->v_establish_wait); | |
765 | vty_out (vty, "%s", VTY_NEWLINE); | |
766 | } | |
767 | ||
768 | return 0; | |
769 | } | |
770 | ||
771 | ||
772 | /* Update-delay configuration */ | |
773 | DEFUN (bgp_update_delay, | |
774 | bgp_update_delay_cmd, | |
775 | "update-delay <0-3600>", | |
776 | "Force initial delay for best-path and updates\n" | |
777 | "Seconds\n") | |
778 | { | |
779 | return bgp_update_delay_config_vty(vty, argv[0], NULL); | |
780 | } | |
781 | ||
782 | DEFUN (bgp_update_delay_establish_wait, | |
783 | bgp_update_delay_establish_wait_cmd, | |
784 | "update-delay <0-3600> <1-3600>", | |
785 | "Force initial delay for best-path and updates\n" | |
786 | "Seconds\n" | |
787 | "Wait for peers to be established\n" | |
788 | "Seconds\n") | |
789 | { | |
790 | return bgp_update_delay_config_vty(vty, argv[0], argv[1]); | |
791 | } | |
792 | ||
793 | /* Update-delay deconfiguration */ | |
794 | DEFUN (no_bgp_update_delay, | |
795 | no_bgp_update_delay_cmd, | |
796 | "no update-delay <0-3600>", | |
797 | "Force initial delay for best-path and updates\n" | |
798 | "Seconds\n") | |
799 | { | |
800 | return bgp_update_delay_deconfig_vty(vty); | |
801 | } | |
802 | ||
803 | ALIAS (no_bgp_update_delay, | |
804 | no_bgp_update_delay_establish_wait_cmd, | |
805 | "no update-delay <0-3600> <1-3600>", | |
806 | "Force initial delay for best-path and updates\n" | |
807 | "Seconds\n" | |
808 | "Wait for peers to be established\n" | |
809 | "Seconds\n") | |
5e242b0d | 810 | |
cb1faec9 DS |
811 | int |
812 | bgp_wpkt_quanta_config_vty (struct vty *vty, char *num, char set) | |
813 | { | |
814 | struct bgp *bgp; | |
815 | u_int16_t update_delay; | |
816 | ||
817 | bgp = vty->index; | |
818 | ||
819 | if (set) | |
820 | VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num, | |
821 | 1, 4294967295); | |
822 | else | |
823 | bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX; | |
824 | ||
825 | return CMD_SUCCESS; | |
826 | } | |
827 | ||
828 | int | |
829 | bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp) | |
830 | { | |
831 | if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX) | |
832 | vty_out (vty, " write-quanta %d%s", | |
833 | bgp->wpkt_quanta, VTY_NEWLINE); | |
834 | ||
835 | return 0; | |
836 | } | |
837 | ||
838 | ||
839 | /* Update-delay configuration */ | |
840 | DEFUN (bgp_wpkt_quanta, | |
841 | bgp_wpkt_quanta_cmd, | |
842 | "write-quanta <1-4294967295>", | |
843 | "How many packets to write to peer socket per run\n" | |
844 | "Number of packets\n") | |
845 | { | |
846 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 1); | |
847 | } | |
848 | ||
849 | /* Update-delay deconfiguration */ | |
850 | DEFUN (no_bgp_wpkt_quanta, | |
851 | no_bgp_wpkt_quanta_cmd, | |
852 | "no write-quanta <1-4294967295>", | |
853 | "How many packets to write to peer socket per run\n" | |
854 | "Number of packets\n") | |
855 | { | |
856 | return bgp_wpkt_quanta_config_vty(vty, argv[0], 0); | |
857 | } | |
858 | ||
5e242b0d DS |
859 | /* Maximum-paths configuration */ |
860 | DEFUN (bgp_maxpaths, | |
861 | bgp_maxpaths_cmd, | |
862 | "maximum-paths <1-255>", | |
863 | "Forward packets over multiple paths\n" | |
864 | "Number of paths\n") | |
865 | { | |
866 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); | |
867 | } | |
868 | ||
165b5fff JB |
869 | DEFUN (bgp_maxpaths_ibgp, |
870 | bgp_maxpaths_ibgp_cmd, | |
871 | "maximum-paths ibgp <1-255>", | |
872 | "Forward packets over multiple paths\n" | |
873 | "iBGP-multipath\n" | |
874 | "Number of paths\n") | |
875 | { | |
5e242b0d DS |
876 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); |
877 | } | |
165b5fff | 878 | |
5e242b0d DS |
879 | DEFUN (bgp_maxpaths_ibgp_cluster, |
880 | bgp_maxpaths_ibgp_cluster_cmd, | |
881 | "maximum-paths ibgp <1-255> equal-cluster-length", | |
882 | "Forward packets over multiple paths\n" | |
883 | "iBGP-multipath\n" | |
884 | "Number of paths\n" | |
885 | "Match the cluster length\n") | |
886 | { | |
887 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], | |
888 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); | |
165b5fff JB |
889 | } |
890 | ||
891 | DEFUN (no_bgp_maxpaths, | |
892 | no_bgp_maxpaths_cmd, | |
893 | "no maximum-paths", | |
894 | NO_STR | |
895 | "Forward packets over multiple paths\n" | |
896 | "Number of paths\n") | |
897 | { | |
5e242b0d | 898 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
899 | } |
900 | ||
901 | ALIAS (no_bgp_maxpaths, | |
902 | no_bgp_maxpaths_arg_cmd, | |
903 | "no maximum-paths <1-255>", | |
904 | NO_STR | |
905 | "Forward packets over multiple paths\n" | |
906 | "Number of paths\n") | |
907 | ||
908 | DEFUN (no_bgp_maxpaths_ibgp, | |
909 | no_bgp_maxpaths_ibgp_cmd, | |
910 | "no maximum-paths ibgp", | |
911 | NO_STR | |
912 | "Forward packets over multiple paths\n" | |
913 | "iBGP-multipath\n" | |
914 | "Number of paths\n") | |
915 | { | |
5e242b0d | 916 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
917 | } |
918 | ||
919 | ALIAS (no_bgp_maxpaths_ibgp, | |
920 | no_bgp_maxpaths_ibgp_arg_cmd, | |
921 | "no maximum-paths ibgp <1-255>", | |
922 | NO_STR | |
923 | "Forward packets over multiple paths\n" | |
924 | "iBGP-multipath\n" | |
925 | "Number of paths\n") | |
926 | ||
5e242b0d DS |
927 | ALIAS (no_bgp_maxpaths_ibgp, |
928 | no_bgp_maxpaths_ibgp_cluster_cmd, | |
929 | "no maximum-paths ibgp <1-255> equal-cluster-length", | |
930 | NO_STR | |
931 | "Forward packets over multiple paths\n" | |
932 | "iBGP-multipath\n" | |
933 | "Number of paths\n" | |
934 | "Match the cluster length\n") | |
935 | ||
165b5fff JB |
936 | int |
937 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
938 | safi_t safi, int *write) | |
939 | { | |
940 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) | |
941 | { | |
942 | bgp_config_write_family_header (vty, afi, safi, write); | |
943 | vty_out (vty, " maximum-paths %d%s", | |
944 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); | |
945 | } | |
946 | ||
947 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) | |
948 | { | |
949 | bgp_config_write_family_header (vty, afi, safi, write); | |
5e242b0d DS |
950 | vty_out (vty, " maximum-paths ibgp %d", |
951 | bgp->maxpaths[afi][safi].maxpaths_ibgp); | |
952 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
953 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
954 | vty_out (vty, " equal-cluster-length"); | |
955 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
956 | } |
957 | ||
958 | return 0; | |
959 | } | |
6b0655a2 | 960 | |
718e3744 | 961 | /* BGP timers. */ |
962 | ||
963 | DEFUN (bgp_timers, | |
964 | bgp_timers_cmd, | |
965 | "timers bgp <0-65535> <0-65535>", | |
966 | "Adjust routing timers\n" | |
967 | "BGP timers\n" | |
968 | "Keepalive interval\n" | |
969 | "Holdtime\n") | |
970 | { | |
971 | struct bgp *bgp; | |
972 | unsigned long keepalive = 0; | |
973 | unsigned long holdtime = 0; | |
974 | ||
975 | bgp = vty->index; | |
976 | ||
977 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
978 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
979 | ||
980 | /* Holdtime value check. */ | |
981 | if (holdtime < 3 && holdtime != 0) | |
982 | { | |
983 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
984 | VTY_NEWLINE); | |
985 | return CMD_WARNING; | |
986 | } | |
987 | ||
988 | bgp_timers_set (bgp, keepalive, holdtime); | |
989 | ||
990 | return CMD_SUCCESS; | |
991 | } | |
992 | ||
993 | DEFUN (no_bgp_timers, | |
994 | no_bgp_timers_cmd, | |
995 | "no timers bgp", | |
996 | NO_STR | |
997 | "Adjust routing timers\n" | |
998 | "BGP timers\n") | |
999 | { | |
1000 | struct bgp *bgp; | |
1001 | ||
1002 | bgp = vty->index; | |
1003 | bgp_timers_unset (bgp); | |
1004 | ||
1005 | return CMD_SUCCESS; | |
1006 | } | |
1007 | ||
1008 | ALIAS (no_bgp_timers, | |
1009 | no_bgp_timers_arg_cmd, | |
1010 | "no timers bgp <0-65535> <0-65535>", | |
1011 | NO_STR | |
1012 | "Adjust routing timers\n" | |
1013 | "BGP timers\n" | |
1014 | "Keepalive interval\n" | |
1015 | "Holdtime\n") | |
6b0655a2 | 1016 | |
718e3744 | 1017 | DEFUN (bgp_client_to_client_reflection, |
1018 | bgp_client_to_client_reflection_cmd, | |
1019 | "bgp client-to-client reflection", | |
1020 | "BGP specific commands\n" | |
1021 | "Configure client to client route reflection\n" | |
1022 | "reflection of routes allowed\n") | |
1023 | { | |
1024 | struct bgp *bgp; | |
1025 | ||
1026 | bgp = vty->index; | |
1027 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
1028 | return CMD_SUCCESS; | |
1029 | } | |
1030 | ||
1031 | DEFUN (no_bgp_client_to_client_reflection, | |
1032 | no_bgp_client_to_client_reflection_cmd, | |
1033 | "no bgp client-to-client reflection", | |
1034 | NO_STR | |
1035 | "BGP specific commands\n" | |
1036 | "Configure client to client route reflection\n" | |
1037 | "reflection of routes allowed\n") | |
1038 | { | |
1039 | struct bgp *bgp; | |
1040 | ||
1041 | bgp = vty->index; | |
1042 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
1043 | return CMD_SUCCESS; | |
1044 | } | |
1045 | ||
1046 | /* "bgp always-compare-med" configuration. */ | |
1047 | DEFUN (bgp_always_compare_med, | |
1048 | bgp_always_compare_med_cmd, | |
1049 | "bgp always-compare-med", | |
1050 | "BGP specific commands\n" | |
1051 | "Allow comparing MED from different neighbors\n") | |
1052 | { | |
1053 | struct bgp *bgp; | |
1054 | ||
1055 | bgp = vty->index; | |
1056 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
1057 | return CMD_SUCCESS; | |
1058 | } | |
1059 | ||
1060 | DEFUN (no_bgp_always_compare_med, | |
1061 | no_bgp_always_compare_med_cmd, | |
1062 | "no bgp always-compare-med", | |
1063 | NO_STR | |
1064 | "BGP specific commands\n" | |
1065 | "Allow comparing MED from different neighbors\n") | |
1066 | { | |
1067 | struct bgp *bgp; | |
1068 | ||
1069 | bgp = vty->index; | |
1070 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
1071 | return CMD_SUCCESS; | |
1072 | } | |
6b0655a2 | 1073 | |
718e3744 | 1074 | /* "bgp deterministic-med" configuration. */ |
1075 | DEFUN (bgp_deterministic_med, | |
1076 | bgp_deterministic_med_cmd, | |
1077 | "bgp deterministic-med", | |
1078 | "BGP specific commands\n" | |
1079 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1080 | { | |
1081 | struct bgp *bgp; | |
1082 | ||
1083 | bgp = vty->index; | |
1084 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1085 | return CMD_SUCCESS; | |
1086 | } | |
1087 | ||
1088 | DEFUN (no_bgp_deterministic_med, | |
1089 | no_bgp_deterministic_med_cmd, | |
1090 | "no bgp deterministic-med", | |
1091 | NO_STR | |
1092 | "BGP specific commands\n" | |
1093 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1094 | { | |
1095 | struct bgp *bgp; | |
1096 | ||
1097 | bgp = vty->index; | |
1098 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1099 | return CMD_SUCCESS; | |
1100 | } | |
538621f2 | 1101 | |
1102 | /* "bgp graceful-restart" configuration. */ | |
1103 | DEFUN (bgp_graceful_restart, | |
1104 | bgp_graceful_restart_cmd, | |
1105 | "bgp graceful-restart", | |
1106 | "BGP specific commands\n" | |
1107 | "Graceful restart capability parameters\n") | |
1108 | { | |
1109 | struct bgp *bgp; | |
1110 | ||
1111 | bgp = vty->index; | |
1112 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1113 | return CMD_SUCCESS; | |
1114 | } | |
1115 | ||
1116 | DEFUN (no_bgp_graceful_restart, | |
1117 | no_bgp_graceful_restart_cmd, | |
1118 | "no bgp graceful-restart", | |
1119 | NO_STR | |
1120 | "BGP specific commands\n" | |
1121 | "Graceful restart capability parameters\n") | |
1122 | { | |
1123 | struct bgp *bgp; | |
1124 | ||
1125 | bgp = vty->index; | |
1126 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1127 | return CMD_SUCCESS; | |
1128 | } | |
1129 | ||
93406d87 | 1130 | DEFUN (bgp_graceful_restart_stalepath_time, |
1131 | bgp_graceful_restart_stalepath_time_cmd, | |
1132 | "bgp graceful-restart stalepath-time <1-3600>", | |
1133 | "BGP specific commands\n" | |
1134 | "Graceful restart capability parameters\n" | |
1135 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1136 | "Delay value (seconds)\n") | |
1137 | { | |
1138 | struct bgp *bgp; | |
1139 | u_int32_t stalepath; | |
1140 | ||
1141 | bgp = vty->index; | |
1142 | if (! bgp) | |
1143 | return CMD_WARNING; | |
1144 | ||
1145 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
1146 | bgp->stalepath_time = stalepath; | |
1147 | return CMD_SUCCESS; | |
1148 | } | |
1149 | ||
1150 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
1151 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1152 | "no bgp graceful-restart stalepath-time", | |
1153 | NO_STR | |
1154 | "BGP specific commands\n" | |
1155 | "Graceful restart capability parameters\n" | |
1156 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1157 | { | |
1158 | struct bgp *bgp; | |
1159 | ||
1160 | bgp = vty->index; | |
1161 | if (! bgp) | |
1162 | return CMD_WARNING; | |
1163 | ||
1164 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1165 | return CMD_SUCCESS; | |
1166 | } | |
1167 | ||
1168 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
1169 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
1170 | "no bgp graceful-restart stalepath-time <1-3600>", | |
1171 | NO_STR | |
1172 | "BGP specific commands\n" | |
1173 | "Graceful restart capability parameters\n" | |
1174 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1175 | "Delay value (seconds)\n") | |
1176 | ||
718e3744 | 1177 | /* "bgp fast-external-failover" configuration. */ |
1178 | DEFUN (bgp_fast_external_failover, | |
1179 | bgp_fast_external_failover_cmd, | |
1180 | "bgp fast-external-failover", | |
1181 | BGP_STR | |
1182 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1183 | { | |
1184 | struct bgp *bgp; | |
1185 | ||
1186 | bgp = vty->index; | |
1187 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1188 | return CMD_SUCCESS; | |
1189 | } | |
1190 | ||
1191 | DEFUN (no_bgp_fast_external_failover, | |
1192 | no_bgp_fast_external_failover_cmd, | |
1193 | "no bgp fast-external-failover", | |
1194 | NO_STR | |
1195 | BGP_STR | |
1196 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1197 | { | |
1198 | struct bgp *bgp; | |
1199 | ||
1200 | bgp = vty->index; | |
1201 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1202 | return CMD_SUCCESS; | |
1203 | } | |
6b0655a2 | 1204 | |
718e3744 | 1205 | /* "bgp enforce-first-as" configuration. */ |
1206 | DEFUN (bgp_enforce_first_as, | |
1207 | bgp_enforce_first_as_cmd, | |
1208 | "bgp enforce-first-as", | |
1209 | BGP_STR | |
1210 | "Enforce the first AS for EBGP routes\n") | |
1211 | { | |
1212 | struct bgp *bgp; | |
1213 | ||
1214 | bgp = vty->index; | |
1215 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
1216 | return CMD_SUCCESS; | |
1217 | } | |
1218 | ||
1219 | DEFUN (no_bgp_enforce_first_as, | |
1220 | no_bgp_enforce_first_as_cmd, | |
1221 | "no bgp enforce-first-as", | |
1222 | NO_STR | |
1223 | BGP_STR | |
1224 | "Enforce the first AS for EBGP routes\n") | |
1225 | { | |
1226 | struct bgp *bgp; | |
1227 | ||
1228 | bgp = vty->index; | |
1229 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
1230 | return CMD_SUCCESS; | |
1231 | } | |
6b0655a2 | 1232 | |
718e3744 | 1233 | /* "bgp bestpath compare-routerid" configuration. */ |
1234 | DEFUN (bgp_bestpath_compare_router_id, | |
1235 | bgp_bestpath_compare_router_id_cmd, | |
1236 | "bgp bestpath compare-routerid", | |
1237 | "BGP specific commands\n" | |
1238 | "Change the default bestpath selection\n" | |
1239 | "Compare router-id for identical EBGP paths\n") | |
1240 | { | |
1241 | struct bgp *bgp; | |
1242 | ||
1243 | bgp = vty->index; | |
1244 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
1245 | return CMD_SUCCESS; | |
1246 | } | |
1247 | ||
1248 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1249 | no_bgp_bestpath_compare_router_id_cmd, | |
1250 | "no bgp bestpath compare-routerid", | |
1251 | NO_STR | |
1252 | "BGP specific commands\n" | |
1253 | "Change the default bestpath selection\n" | |
1254 | "Compare router-id for identical EBGP paths\n") | |
1255 | { | |
1256 | struct bgp *bgp; | |
1257 | ||
1258 | bgp = vty->index; | |
1259 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
1260 | return CMD_SUCCESS; | |
1261 | } | |
6b0655a2 | 1262 | |
718e3744 | 1263 | /* "bgp bestpath as-path ignore" configuration. */ |
1264 | DEFUN (bgp_bestpath_aspath_ignore, | |
1265 | bgp_bestpath_aspath_ignore_cmd, | |
1266 | "bgp bestpath as-path ignore", | |
1267 | "BGP specific commands\n" | |
1268 | "Change the default bestpath selection\n" | |
1269 | "AS-path attribute\n" | |
1270 | "Ignore as-path length in selecting a route\n") | |
1271 | { | |
1272 | struct bgp *bgp; | |
1273 | ||
1274 | bgp = vty->index; | |
1275 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
1276 | return CMD_SUCCESS; | |
1277 | } | |
1278 | ||
1279 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
1280 | no_bgp_bestpath_aspath_ignore_cmd, | |
1281 | "no bgp bestpath as-path ignore", | |
1282 | NO_STR | |
1283 | "BGP specific commands\n" | |
1284 | "Change the default bestpath selection\n" | |
1285 | "AS-path attribute\n" | |
1286 | "Ignore as-path length in selecting a route\n") | |
1287 | { | |
1288 | struct bgp *bgp; | |
1289 | ||
1290 | bgp = vty->index; | |
1291 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
1292 | return CMD_SUCCESS; | |
1293 | } | |
6b0655a2 | 1294 | |
6811845b | 1295 | /* "bgp bestpath as-path confed" configuration. */ |
1296 | DEFUN (bgp_bestpath_aspath_confed, | |
1297 | bgp_bestpath_aspath_confed_cmd, | |
1298 | "bgp bestpath as-path confed", | |
1299 | "BGP specific commands\n" | |
1300 | "Change the default bestpath selection\n" | |
1301 | "AS-path attribute\n" | |
1302 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1303 | { | |
1304 | struct bgp *bgp; | |
1305 | ||
1306 | bgp = vty->index; | |
1307 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
1308 | return CMD_SUCCESS; | |
1309 | } | |
1310 | ||
1311 | DEFUN (no_bgp_bestpath_aspath_confed, | |
1312 | no_bgp_bestpath_aspath_confed_cmd, | |
1313 | "no bgp bestpath as-path confed", | |
1314 | NO_STR | |
1315 | "BGP specific commands\n" | |
1316 | "Change the default bestpath selection\n" | |
1317 | "AS-path attribute\n" | |
1318 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1319 | { | |
1320 | struct bgp *bgp; | |
1321 | ||
1322 | bgp = vty->index; | |
1323 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
1324 | return CMD_SUCCESS; | |
1325 | } | |
6b0655a2 | 1326 | |
2fdd455c PM |
1327 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
1328 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
1329 | bgp_bestpath_aspath_multipath_relax_cmd, | |
1330 | "bgp bestpath as-path multipath-relax", | |
1331 | "BGP specific commands\n" | |
1332 | "Change the default bestpath selection\n" | |
1333 | "AS-path attribute\n" | |
1334 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1335 | { | |
1336 | struct bgp *bgp; | |
1337 | ||
1338 | bgp = vty->index; | |
1339 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1340 | return CMD_SUCCESS; | |
1341 | } | |
1342 | ||
1343 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, | |
1344 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
1345 | "no bgp bestpath as-path multipath-relax", | |
1346 | NO_STR | |
1347 | "BGP specific commands\n" | |
1348 | "Change the default bestpath selection\n" | |
1349 | "AS-path attribute\n" | |
1350 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1351 | { | |
1352 | struct bgp *bgp; | |
1353 | ||
1354 | bgp = vty->index; | |
1355 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1356 | return CMD_SUCCESS; | |
1357 | } | |
6b0655a2 | 1358 | |
848973c7 | 1359 | /* "bgp log-neighbor-changes" configuration. */ |
1360 | DEFUN (bgp_log_neighbor_changes, | |
1361 | bgp_log_neighbor_changes_cmd, | |
1362 | "bgp log-neighbor-changes", | |
1363 | "BGP specific commands\n" | |
1364 | "Log neighbor up/down and reset reason\n") | |
1365 | { | |
1366 | struct bgp *bgp; | |
1367 | ||
1368 | bgp = vty->index; | |
1369 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1370 | return CMD_SUCCESS; | |
1371 | } | |
1372 | ||
1373 | DEFUN (no_bgp_log_neighbor_changes, | |
1374 | no_bgp_log_neighbor_changes_cmd, | |
1375 | "no bgp log-neighbor-changes", | |
1376 | NO_STR | |
1377 | "BGP specific commands\n" | |
1378 | "Log neighbor up/down and reset reason\n") | |
1379 | { | |
1380 | struct bgp *bgp; | |
1381 | ||
1382 | bgp = vty->index; | |
1383 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1384 | return CMD_SUCCESS; | |
1385 | } | |
6b0655a2 | 1386 | |
718e3744 | 1387 | /* "bgp bestpath med" configuration. */ |
1388 | DEFUN (bgp_bestpath_med, | |
1389 | bgp_bestpath_med_cmd, | |
1390 | "bgp bestpath med (confed|missing-as-worst)", | |
1391 | "BGP specific commands\n" | |
1392 | "Change the default bestpath selection\n" | |
1393 | "MED attribute\n" | |
1394 | "Compare MED among confederation paths\n" | |
1395 | "Treat missing MED as the least preferred one\n") | |
1396 | { | |
1397 | struct bgp *bgp; | |
1398 | ||
1399 | bgp = vty->index; | |
1400 | ||
1401 | if (strncmp (argv[0], "confed", 1) == 0) | |
1402 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
1403 | else | |
1404 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1405 | ||
1406 | return CMD_SUCCESS; | |
1407 | } | |
1408 | ||
1409 | DEFUN (bgp_bestpath_med2, | |
1410 | bgp_bestpath_med2_cmd, | |
1411 | "bgp bestpath med confed missing-as-worst", | |
1412 | "BGP specific commands\n" | |
1413 | "Change the default bestpath selection\n" | |
1414 | "MED attribute\n" | |
1415 | "Compare MED among confederation paths\n" | |
1416 | "Treat missing MED as the least preferred one\n") | |
1417 | { | |
1418 | struct bgp *bgp; | |
1419 | ||
1420 | bgp = vty->index; | |
1421 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
1422 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1423 | return CMD_SUCCESS; | |
1424 | } | |
1425 | ||
1426 | ALIAS (bgp_bestpath_med2, | |
1427 | bgp_bestpath_med3_cmd, | |
1428 | "bgp bestpath med missing-as-worst confed", | |
1429 | "BGP specific commands\n" | |
1430 | "Change the default bestpath selection\n" | |
1431 | "MED attribute\n" | |
1432 | "Treat missing MED as the least preferred one\n" | |
1433 | "Compare MED among confederation paths\n") | |
1434 | ||
1435 | DEFUN (no_bgp_bestpath_med, | |
1436 | no_bgp_bestpath_med_cmd, | |
1437 | "no bgp bestpath med (confed|missing-as-worst)", | |
1438 | NO_STR | |
1439 | "BGP specific commands\n" | |
1440 | "Change the default bestpath selection\n" | |
1441 | "MED attribute\n" | |
1442 | "Compare MED among confederation paths\n" | |
1443 | "Treat missing MED as the least preferred one\n") | |
1444 | { | |
1445 | struct bgp *bgp; | |
1446 | ||
1447 | bgp = vty->index; | |
1448 | ||
1449 | if (strncmp (argv[0], "confed", 1) == 0) | |
1450 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
1451 | else | |
1452 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1453 | ||
1454 | return CMD_SUCCESS; | |
1455 | } | |
1456 | ||
1457 | DEFUN (no_bgp_bestpath_med2, | |
1458 | no_bgp_bestpath_med2_cmd, | |
1459 | "no bgp bestpath med confed missing-as-worst", | |
1460 | NO_STR | |
1461 | "BGP specific commands\n" | |
1462 | "Change the default bestpath selection\n" | |
1463 | "MED attribute\n" | |
1464 | "Compare MED among confederation paths\n" | |
1465 | "Treat missing MED as the least preferred one\n") | |
1466 | { | |
1467 | struct bgp *bgp; | |
1468 | ||
1469 | bgp = vty->index; | |
1470 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
1471 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1472 | return CMD_SUCCESS; | |
1473 | } | |
1474 | ||
1475 | ALIAS (no_bgp_bestpath_med2, | |
1476 | no_bgp_bestpath_med3_cmd, | |
1477 | "no bgp bestpath med missing-as-worst confed", | |
1478 | NO_STR | |
1479 | "BGP specific commands\n" | |
1480 | "Change the default bestpath selection\n" | |
1481 | "MED attribute\n" | |
1482 | "Treat missing MED as the least preferred one\n" | |
1483 | "Compare MED among confederation paths\n") | |
6b0655a2 | 1484 | |
718e3744 | 1485 | /* "no bgp default ipv4-unicast". */ |
1486 | DEFUN (no_bgp_default_ipv4_unicast, | |
1487 | no_bgp_default_ipv4_unicast_cmd, | |
1488 | "no bgp default ipv4-unicast", | |
1489 | NO_STR | |
1490 | "BGP specific commands\n" | |
1491 | "Configure BGP defaults\n" | |
1492 | "Activate ipv4-unicast for a peer by default\n") | |
1493 | { | |
1494 | struct bgp *bgp; | |
1495 | ||
1496 | bgp = vty->index; | |
1497 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
1498 | return CMD_SUCCESS; | |
1499 | } | |
1500 | ||
1501 | DEFUN (bgp_default_ipv4_unicast, | |
1502 | bgp_default_ipv4_unicast_cmd, | |
1503 | "bgp default ipv4-unicast", | |
1504 | "BGP specific commands\n" | |
1505 | "Configure BGP defaults\n" | |
1506 | "Activate ipv4-unicast for a peer by default\n") | |
1507 | { | |
1508 | struct bgp *bgp; | |
1509 | ||
1510 | bgp = vty->index; | |
1511 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
1512 | return CMD_SUCCESS; | |
1513 | } | |
6b0655a2 | 1514 | |
718e3744 | 1515 | /* "bgp import-check" configuration. */ |
1516 | DEFUN (bgp_network_import_check, | |
1517 | bgp_network_import_check_cmd, | |
1518 | "bgp network import-check", | |
1519 | "BGP specific commands\n" | |
1520 | "BGP network command\n" | |
1521 | "Check BGP network route exists in IGP\n") | |
1522 | { | |
1523 | struct bgp *bgp; | |
1524 | ||
1525 | bgp = vty->index; | |
1526 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
1527 | return CMD_SUCCESS; | |
1528 | } | |
1529 | ||
1530 | DEFUN (no_bgp_network_import_check, | |
1531 | no_bgp_network_import_check_cmd, | |
1532 | "no bgp network import-check", | |
1533 | NO_STR | |
1534 | "BGP specific commands\n" | |
1535 | "BGP network command\n" | |
1536 | "Check BGP network route exists in IGP\n") | |
1537 | { | |
1538 | struct bgp *bgp; | |
1539 | ||
1540 | bgp = vty->index; | |
1541 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
1542 | return CMD_SUCCESS; | |
1543 | } | |
6b0655a2 | 1544 | |
718e3744 | 1545 | DEFUN (bgp_default_local_preference, |
1546 | bgp_default_local_preference_cmd, | |
1547 | "bgp default local-preference <0-4294967295>", | |
1548 | "BGP specific commands\n" | |
1549 | "Configure BGP defaults\n" | |
1550 | "local preference (higher=more preferred)\n" | |
1551 | "Configure default local preference value\n") | |
1552 | { | |
1553 | struct bgp *bgp; | |
1554 | u_int32_t local_pref; | |
1555 | ||
1556 | bgp = vty->index; | |
1557 | ||
1558 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
1559 | ||
1560 | bgp_default_local_preference_set (bgp, local_pref); | |
1561 | ||
1562 | return CMD_SUCCESS; | |
1563 | } | |
1564 | ||
1565 | DEFUN (no_bgp_default_local_preference, | |
1566 | no_bgp_default_local_preference_cmd, | |
1567 | "no bgp default local-preference", | |
1568 | NO_STR | |
1569 | "BGP specific commands\n" | |
1570 | "Configure BGP defaults\n" | |
1571 | "local preference (higher=more preferred)\n") | |
1572 | { | |
1573 | struct bgp *bgp; | |
1574 | ||
1575 | bgp = vty->index; | |
1576 | bgp_default_local_preference_unset (bgp); | |
1577 | return CMD_SUCCESS; | |
1578 | } | |
1579 | ||
1580 | ALIAS (no_bgp_default_local_preference, | |
1581 | no_bgp_default_local_preference_val_cmd, | |
1582 | "no bgp default local-preference <0-4294967295>", | |
1583 | NO_STR | |
1584 | "BGP specific commands\n" | |
1585 | "Configure BGP defaults\n" | |
1586 | "local preference (higher=more preferred)\n" | |
1587 | "Configure default local preference value\n") | |
6b0655a2 | 1588 | |
718e3744 | 1589 | static int |
fd79ac91 | 1590 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
1591 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 1592 | { |
1593 | int ret; | |
1594 | struct bgp *bgp; | |
1595 | as_t as; | |
1596 | union sockunion su; | |
1597 | ||
1598 | bgp = vty->index; | |
1599 | ||
1600 | /* Get AS number. */ | |
0b2aa3a0 | 1601 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); |
718e3744 | 1602 | |
1603 | /* If peer is peer group, call proper function. */ | |
1604 | ret = str2sockunion (peer_str, &su); | |
1605 | if (ret < 0) | |
1606 | { | |
a80beece DS |
1607 | /* Check for peer by interface */ |
1608 | ret = peer_remote_as (bgp, NULL, peer_str, &as, afi, safi); | |
718e3744 | 1609 | if (ret < 0) |
a80beece DS |
1610 | { |
1611 | ret = peer_group_remote_as (bgp, peer_str, &as); | |
1612 | if (ret < 0) | |
1613 | { | |
1614 | vty_out (vty, "%% Create the peer-group or interface first%s", | |
1615 | VTY_NEWLINE); | |
1616 | return CMD_WARNING; | |
1617 | } | |
1618 | return CMD_SUCCESS; | |
1619 | } | |
718e3744 | 1620 | } |
a80beece | 1621 | else |
718e3744 | 1622 | { |
a80beece DS |
1623 | if (peer_address_self_check (&su)) |
1624 | { | |
1625 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
1626 | VTY_NEWLINE); | |
1627 | return CMD_WARNING; | |
1628 | } | |
1629 | ret = peer_remote_as (bgp, &su, NULL, &as, afi, safi); | |
718e3744 | 1630 | } |
1631 | ||
718e3744 | 1632 | /* This peer belongs to peer group. */ |
1633 | switch (ret) | |
1634 | { | |
1635 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 1636 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 1637 | return CMD_WARNING; |
718e3744 | 1638 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 1639 | 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 | 1640 | return CMD_WARNING; |
718e3744 | 1641 | } |
1642 | return bgp_vty_return (vty, ret); | |
1643 | } | |
1644 | ||
1645 | DEFUN (neighbor_remote_as, | |
1646 | neighbor_remote_as_cmd, | |
320da874 | 1647 | NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, |
718e3744 | 1648 | NEIGHBOR_STR |
1649 | NEIGHBOR_ADDR_STR2 | |
1650 | "Specify a BGP neighbor\n" | |
1651 | AS_STR) | |
1652 | { | |
1653 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
1654 | } | |
6b0655a2 | 1655 | |
a80beece DS |
1656 | DEFUN (neighbor_interface_config, |
1657 | neighbor_interface_config_cmd, | |
1658 | "neighbor WORD interface", | |
1659 | NEIGHBOR_STR | |
1660 | "Interface name or neighbor tag\n" | |
1661 | "Enable BGP on interface\n") | |
1662 | { | |
1663 | struct bgp *bgp; | |
1664 | struct peer *peer; | |
1665 | struct peer_group *group; | |
1666 | ||
1667 | bgp = vty->index; | |
1668 | group = peer_group_lookup (bgp, argv[0]); | |
1669 | if (group) | |
1670 | { | |
1671 | vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE); | |
1672 | return CMD_WARNING; | |
1673 | } | |
1674 | ||
1675 | peer = peer_conf_interface_get (bgp, argv[0], AFI_IP, SAFI_UNICAST); | |
1676 | if (!peer) | |
1677 | return CMD_WARNING; | |
1678 | ||
1679 | return CMD_SUCCESS; | |
1680 | } | |
1681 | ||
1682 | ||
718e3744 | 1683 | DEFUN (neighbor_peer_group, |
1684 | neighbor_peer_group_cmd, | |
1685 | "neighbor WORD peer-group", | |
1686 | NEIGHBOR_STR | |
a80beece | 1687 | "Interface name or neighbor tag\n" |
718e3744 | 1688 | "Configure peer-group\n") |
1689 | { | |
1690 | struct bgp *bgp; | |
a80beece | 1691 | struct peer *peer; |
718e3744 | 1692 | struct peer_group *group; |
1693 | ||
1694 | bgp = vty->index; | |
a80beece DS |
1695 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
1696 | if (peer) | |
1697 | { | |
1698 | vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE); | |
1699 | return CMD_WARNING; | |
1700 | } | |
718e3744 | 1701 | |
1702 | group = peer_group_get (bgp, argv[0]); | |
1703 | if (! group) | |
1704 | return CMD_WARNING; | |
1705 | ||
1706 | return CMD_SUCCESS; | |
1707 | } | |
1708 | ||
1709 | DEFUN (no_neighbor, | |
1710 | no_neighbor_cmd, | |
1711 | NO_NEIGHBOR_CMD2, | |
1712 | NO_STR | |
1713 | NEIGHBOR_STR | |
1714 | NEIGHBOR_ADDR_STR2) | |
1715 | { | |
1716 | int ret; | |
1717 | union sockunion su; | |
1718 | struct peer_group *group; | |
1719 | struct peer *peer; | |
1ff9a340 | 1720 | struct peer *other; |
718e3744 | 1721 | |
1722 | ret = str2sockunion (argv[0], &su); | |
1723 | if (ret < 0) | |
1724 | { | |
a80beece DS |
1725 | /* look up for neighbor by interface name config. */ |
1726 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
1727 | if (peer) | |
1728 | { | |
1729 | peer_delete (peer); | |
1730 | return CMD_SUCCESS; | |
1731 | } | |
1732 | ||
718e3744 | 1733 | group = peer_group_lookup (vty->index, argv[0]); |
1734 | if (group) | |
1735 | peer_group_delete (group); | |
1736 | else | |
1737 | { | |
1738 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1739 | return CMD_WARNING; | |
1740 | } | |
1741 | } | |
1742 | else | |
1743 | { | |
1744 | peer = peer_lookup (vty->index, &su); | |
1745 | if (peer) | |
1ff9a340 DS |
1746 | { |
1747 | other = peer->doppelganger; | |
1748 | peer_delete (peer); | |
1749 | if (other && other->status != Deleted) | |
1750 | peer_delete(other); | |
1751 | } | |
718e3744 | 1752 | } |
1753 | ||
1754 | return CMD_SUCCESS; | |
1755 | } | |
1756 | ||
1757 | ALIAS (no_neighbor, | |
1758 | no_neighbor_remote_as_cmd, | |
320da874 | 1759 | NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, |
718e3744 | 1760 | NO_STR |
1761 | NEIGHBOR_STR | |
1762 | NEIGHBOR_ADDR_STR | |
1763 | "Specify a BGP neighbor\n" | |
1764 | AS_STR) | |
1765 | ||
a80beece DS |
1766 | DEFUN (no_neighbor_interface_config, |
1767 | no_neighbor_interface_config_cmd, | |
1768 | "no neighbor WORD interface", | |
1769 | NO_STR | |
1770 | NEIGHBOR_STR | |
1771 | "Interface name\n" | |
1772 | "Configure BGP on interface\n") | |
1773 | { | |
1774 | struct peer *peer; | |
1775 | ||
1776 | /* look up for neighbor by interface name config. */ | |
1777 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
1778 | if (peer) | |
1779 | { | |
1780 | peer_delete (peer); | |
1781 | } | |
1782 | else | |
1783 | { | |
1784 | vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE); | |
1785 | return CMD_WARNING; | |
1786 | } | |
1787 | return CMD_SUCCESS; | |
1788 | } | |
1789 | ||
718e3744 | 1790 | DEFUN (no_neighbor_peer_group, |
1791 | no_neighbor_peer_group_cmd, | |
1792 | "no neighbor WORD peer-group", | |
1793 | NO_STR | |
1794 | NEIGHBOR_STR | |
1795 | "Neighbor tag\n" | |
1796 | "Configure peer-group\n") | |
1797 | { | |
1798 | struct peer_group *group; | |
1799 | ||
1800 | group = peer_group_lookup (vty->index, argv[0]); | |
1801 | if (group) | |
1802 | peer_group_delete (group); | |
1803 | else | |
1804 | { | |
1805 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1806 | return CMD_WARNING; | |
1807 | } | |
1808 | return CMD_SUCCESS; | |
1809 | } | |
1810 | ||
a80beece DS |
1811 | DEFUN (no_neighbor_interface_peer_group_remote_as, |
1812 | no_neighbor_interface_peer_group_remote_as_cmd, | |
320da874 | 1813 | "no neighbor WORD remote-as " CMD_AS_RANGE, |
718e3744 | 1814 | NO_STR |
1815 | NEIGHBOR_STR | |
a80beece | 1816 | "Interface name or neighbor tag\n" |
718e3744 | 1817 | "Specify a BGP neighbor\n" |
1818 | AS_STR) | |
1819 | { | |
1820 | struct peer_group *group; | |
a80beece DS |
1821 | struct peer *peer; |
1822 | ||
1823 | /* look up for neighbor by interface name config. */ | |
1824 | peer = peer_lookup_by_conf_if (vty->index, argv[0]); | |
1825 | if (peer) | |
1826 | { | |
1827 | peer_as_change (peer, 0); | |
1828 | return CMD_SUCCESS; | |
1829 | } | |
718e3744 | 1830 | |
1831 | group = peer_group_lookup (vty->index, argv[0]); | |
1832 | if (group) | |
1833 | peer_group_remote_as_delete (group); | |
1834 | else | |
1835 | { | |
a80beece | 1836 | vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE); |
718e3744 | 1837 | return CMD_WARNING; |
1838 | } | |
1839 | return CMD_SUCCESS; | |
1840 | } | |
6b0655a2 | 1841 | |
718e3744 | 1842 | DEFUN (neighbor_local_as, |
1843 | neighbor_local_as_cmd, | |
320da874 | 1844 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 1845 | NEIGHBOR_STR |
1846 | NEIGHBOR_ADDR_STR2 | |
1847 | "Specify a local-as number\n" | |
1848 | "AS number used as local AS\n") | |
1849 | { | |
1850 | struct peer *peer; | |
1851 | int ret; | |
1852 | ||
1853 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1854 | if (! peer) | |
1855 | return CMD_WARNING; | |
1856 | ||
9d3f9705 | 1857 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
718e3744 | 1858 | return bgp_vty_return (vty, ret); |
1859 | } | |
1860 | ||
1861 | DEFUN (neighbor_local_as_no_prepend, | |
1862 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 1863 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 1864 | NEIGHBOR_STR |
1865 | NEIGHBOR_ADDR_STR2 | |
1866 | "Specify a local-as number\n" | |
1867 | "AS number used as local AS\n" | |
1868 | "Do not prepend local-as to updates from ebgp peers\n") | |
1869 | { | |
1870 | struct peer *peer; | |
1871 | int ret; | |
1872 | ||
1873 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1874 | if (! peer) | |
1875 | return CMD_WARNING; | |
1876 | ||
9d3f9705 | 1877 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
718e3744 | 1878 | return bgp_vty_return (vty, ret); |
1879 | } | |
1880 | ||
9d3f9705 AC |
1881 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
1882 | neighbor_local_as_no_prepend_replace_as_cmd, | |
1883 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
1884 | NEIGHBOR_STR | |
1885 | NEIGHBOR_ADDR_STR2 | |
1886 | "Specify a local-as number\n" | |
1887 | "AS number used as local AS\n" | |
1888 | "Do not prepend local-as to updates from ebgp peers\n" | |
1889 | "Do not prepend local-as to updates from ibgp peers\n") | |
1890 | { | |
1891 | struct peer *peer; | |
1892 | int ret; | |
1893 | ||
1894 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1895 | if (! peer) | |
1896 | return CMD_WARNING; | |
1897 | ||
1898 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); | |
1899 | return bgp_vty_return (vty, ret); | |
1900 | } | |
1901 | ||
1902 | ||
718e3744 | 1903 | DEFUN (no_neighbor_local_as, |
1904 | no_neighbor_local_as_cmd, | |
1905 | NO_NEIGHBOR_CMD2 "local-as", | |
1906 | NO_STR | |
1907 | NEIGHBOR_STR | |
1908 | NEIGHBOR_ADDR_STR2 | |
1909 | "Specify a local-as number\n") | |
1910 | { | |
1911 | struct peer *peer; | |
1912 | int ret; | |
1913 | ||
1914 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1915 | if (! peer) | |
1916 | return CMD_WARNING; | |
1917 | ||
1918 | ret = peer_local_as_unset (peer); | |
1919 | return bgp_vty_return (vty, ret); | |
1920 | } | |
1921 | ||
1922 | ALIAS (no_neighbor_local_as, | |
1923 | no_neighbor_local_as_val_cmd, | |
320da874 | 1924 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 1925 | NO_STR |
1926 | NEIGHBOR_STR | |
1927 | NEIGHBOR_ADDR_STR2 | |
1928 | "Specify a local-as number\n" | |
1929 | "AS number used as local AS\n") | |
1930 | ||
1931 | ALIAS (no_neighbor_local_as, | |
1932 | no_neighbor_local_as_val2_cmd, | |
320da874 | 1933 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 1934 | NO_STR |
1935 | NEIGHBOR_STR | |
1936 | NEIGHBOR_ADDR_STR2 | |
1937 | "Specify a local-as number\n" | |
1938 | "AS number used as local AS\n" | |
1939 | "Do not prepend local-as to updates from ebgp peers\n") | |
9d3f9705 AC |
1940 | |
1941 | ALIAS (no_neighbor_local_as, | |
1942 | no_neighbor_local_as_val3_cmd, | |
1943 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
1944 | NO_STR | |
1945 | NEIGHBOR_STR | |
1946 | NEIGHBOR_ADDR_STR2 | |
1947 | "Specify a local-as number\n" | |
1948 | "AS number used as local AS\n" | |
1949 | "Do not prepend local-as to updates from ebgp peers\n" | |
1950 | "Do not prepend local-as to updates from ibgp peers\n") | |
6b0655a2 | 1951 | |
0df7c91f PJ |
1952 | DEFUN (neighbor_password, |
1953 | neighbor_password_cmd, | |
1954 | NEIGHBOR_CMD2 "password LINE", | |
1955 | NEIGHBOR_STR | |
1956 | NEIGHBOR_ADDR_STR2 | |
1957 | "Set a password\n" | |
1958 | "The password\n") | |
1959 | { | |
1960 | struct peer *peer; | |
1961 | int ret; | |
1962 | ||
1963 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1964 | if (! peer) | |
1965 | return CMD_WARNING; | |
1966 | ||
1967 | ret = peer_password_set (peer, argv[1]); | |
1968 | return bgp_vty_return (vty, ret); | |
1969 | } | |
1970 | ||
1971 | DEFUN (no_neighbor_password, | |
1972 | no_neighbor_password_cmd, | |
1973 | NO_NEIGHBOR_CMD2 "password", | |
1974 | NO_STR | |
1975 | NEIGHBOR_STR | |
1976 | NEIGHBOR_ADDR_STR2 | |
1977 | "Set a password\n") | |
1978 | { | |
1979 | struct peer *peer; | |
1980 | int ret; | |
1981 | ||
1982 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1983 | if (! peer) | |
1984 | return CMD_WARNING; | |
1985 | ||
1986 | ret = peer_password_unset (peer); | |
1987 | return bgp_vty_return (vty, ret); | |
1988 | } | |
6b0655a2 | 1989 | |
718e3744 | 1990 | DEFUN (neighbor_activate, |
1991 | neighbor_activate_cmd, | |
1992 | NEIGHBOR_CMD2 "activate", | |
1993 | NEIGHBOR_STR | |
1994 | NEIGHBOR_ADDR_STR2 | |
1995 | "Enable the Address Family for this Neighbor\n") | |
1996 | { | |
1997 | struct peer *peer; | |
1998 | ||
1999 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2000 | if (! peer) | |
2001 | return CMD_WARNING; | |
2002 | ||
2003 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
2004 | ||
2005 | return CMD_SUCCESS; | |
2006 | } | |
2007 | ||
2008 | DEFUN (no_neighbor_activate, | |
2009 | no_neighbor_activate_cmd, | |
2010 | NO_NEIGHBOR_CMD2 "activate", | |
2011 | NO_STR | |
2012 | NEIGHBOR_STR | |
2013 | NEIGHBOR_ADDR_STR2 | |
2014 | "Enable the Address Family for this Neighbor\n") | |
2015 | { | |
2016 | int ret; | |
2017 | struct peer *peer; | |
2018 | ||
2019 | /* Lookup peer. */ | |
2020 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2021 | if (! peer) | |
2022 | return CMD_WARNING; | |
2023 | ||
2024 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
2025 | ||
2026 | return bgp_vty_return (vty, ret); | |
2027 | } | |
6b0655a2 | 2028 | |
718e3744 | 2029 | DEFUN (neighbor_set_peer_group, |
2030 | neighbor_set_peer_group_cmd, | |
a80beece | 2031 | NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 2032 | NEIGHBOR_STR |
a80beece | 2033 | NEIGHBOR_ADDR_STR2 |
718e3744 | 2034 | "Member of the peer-group\n" |
2035 | "peer-group name\n") | |
2036 | { | |
2037 | int ret; | |
2038 | as_t as; | |
2039 | union sockunion su; | |
2040 | struct bgp *bgp; | |
a80beece | 2041 | struct peer *peer; |
718e3744 | 2042 | struct peer_group *group; |
2043 | ||
2044 | bgp = vty->index; | |
a80beece | 2045 | peer = NULL; |
718e3744 | 2046 | |
2047 | ret = str2sockunion (argv[0], &su); | |
2048 | if (ret < 0) | |
2049 | { | |
a80beece DS |
2050 | peer = peer_lookup_by_conf_if (bgp, argv[0]); |
2051 | if (!peer) | |
2052 | { | |
2053 | vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE); | |
2054 | return CMD_WARNING; | |
2055 | } | |
2056 | } | |
2057 | else | |
2058 | { | |
2059 | if (peer_address_self_check (&su)) | |
2060 | { | |
2061 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
2062 | VTY_NEWLINE); | |
2063 | return CMD_WARNING; | |
2064 | } | |
718e3744 | 2065 | } |
2066 | ||
2067 | group = peer_group_lookup (bgp, argv[1]); | |
2068 | if (! group) | |
2069 | { | |
2070 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2071 | return CMD_WARNING; | |
2072 | } | |
2073 | ||
a80beece | 2074 | ret = peer_group_bind (bgp, &su, peer, group, bgp_node_afi (vty), |
718e3744 | 2075 | bgp_node_safi (vty), &as); |
2076 | ||
2077 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
2078 | { | |
aea339f7 | 2079 | 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 | 2080 | return CMD_WARNING; |
2081 | } | |
2082 | ||
2083 | return bgp_vty_return (vty, ret); | |
2084 | } | |
2085 | ||
2086 | DEFUN (no_neighbor_set_peer_group, | |
2087 | no_neighbor_set_peer_group_cmd, | |
a80beece | 2088 | NO_NEIGHBOR_CMD2 "peer-group WORD", |
718e3744 | 2089 | NO_STR |
2090 | NEIGHBOR_STR | |
a80beece | 2091 | NEIGHBOR_ADDR_STR2 |
718e3744 | 2092 | "Member of the peer-group\n" |
2093 | "peer-group name\n") | |
2094 | { | |
2095 | int ret; | |
2096 | struct bgp *bgp; | |
2097 | struct peer *peer; | |
2098 | struct peer_group *group; | |
2099 | ||
2100 | bgp = vty->index; | |
2101 | ||
2102 | peer = peer_lookup_vty (vty, argv[0]); | |
2103 | if (! peer) | |
2104 | return CMD_WARNING; | |
2105 | ||
2106 | group = peer_group_lookup (bgp, argv[1]); | |
2107 | if (! group) | |
2108 | { | |
2109 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
2110 | return CMD_WARNING; | |
2111 | } | |
2112 | ||
2113 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), | |
2114 | bgp_node_safi (vty)); | |
2115 | ||
2116 | return bgp_vty_return (vty, ret); | |
2117 | } | |
6b0655a2 | 2118 | |
94f2b392 | 2119 | static int |
fd79ac91 | 2120 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
2121 | u_int16_t flag, int set) | |
718e3744 | 2122 | { |
2123 | int ret; | |
2124 | struct peer *peer; | |
2125 | ||
2126 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2127 | if (! peer) | |
2128 | return CMD_WARNING; | |
2129 | ||
2130 | if (set) | |
2131 | ret = peer_flag_set (peer, flag); | |
2132 | else | |
2133 | ret = peer_flag_unset (peer, flag); | |
2134 | ||
2135 | return bgp_vty_return (vty, ret); | |
2136 | } | |
2137 | ||
94f2b392 | 2138 | static int |
fd79ac91 | 2139 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 2140 | { |
2141 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
2142 | } | |
2143 | ||
94f2b392 | 2144 | static int |
fd79ac91 | 2145 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 2146 | { |
2147 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
2148 | } | |
2149 | ||
2150 | /* neighbor passive. */ | |
2151 | DEFUN (neighbor_passive, | |
2152 | neighbor_passive_cmd, | |
2153 | NEIGHBOR_CMD2 "passive", | |
2154 | NEIGHBOR_STR | |
2155 | NEIGHBOR_ADDR_STR2 | |
2156 | "Don't send open messages to this neighbor\n") | |
2157 | { | |
2158 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
2159 | } | |
2160 | ||
2161 | DEFUN (no_neighbor_passive, | |
2162 | no_neighbor_passive_cmd, | |
2163 | NO_NEIGHBOR_CMD2 "passive", | |
2164 | NO_STR | |
2165 | NEIGHBOR_STR | |
2166 | NEIGHBOR_ADDR_STR2 | |
2167 | "Don't send open messages to this neighbor\n") | |
2168 | { | |
2169 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
2170 | } | |
6b0655a2 | 2171 | |
718e3744 | 2172 | /* neighbor shutdown. */ |
2173 | DEFUN (neighbor_shutdown, | |
2174 | neighbor_shutdown_cmd, | |
2175 | NEIGHBOR_CMD2 "shutdown", | |
2176 | NEIGHBOR_STR | |
2177 | NEIGHBOR_ADDR_STR2 | |
2178 | "Administratively shut down this neighbor\n") | |
2179 | { | |
2180 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
2181 | } | |
2182 | ||
2183 | DEFUN (no_neighbor_shutdown, | |
2184 | no_neighbor_shutdown_cmd, | |
2185 | NO_NEIGHBOR_CMD2 "shutdown", | |
2186 | NO_STR | |
2187 | NEIGHBOR_STR | |
2188 | NEIGHBOR_ADDR_STR2 | |
2189 | "Administratively shut down this neighbor\n") | |
2190 | { | |
2191 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
2192 | } | |
6b0655a2 | 2193 | |
c9502438 | 2194 | /* Deprecated neighbor capability route-refresh. */ |
2195 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, | |
2196 | neighbor_capability_route_refresh_cmd, | |
2197 | NEIGHBOR_CMD2 "capability route-refresh", | |
2198 | NEIGHBOR_STR | |
2199 | NEIGHBOR_ADDR_STR2 | |
2200 | "Advertise capability to the peer\n" | |
2201 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 2202 | { |
c9502438 | 2203 | return CMD_SUCCESS; |
718e3744 | 2204 | } |
2205 | ||
c9502438 | 2206 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
2207 | no_neighbor_capability_route_refresh_cmd, | |
2208 | NO_NEIGHBOR_CMD2 "capability route-refresh", | |
2209 | NO_STR | |
2210 | NEIGHBOR_STR | |
2211 | NEIGHBOR_ADDR_STR2 | |
2212 | "Advertise capability to the peer\n" | |
2213 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 2214 | { |
c9502438 | 2215 | return CMD_SUCCESS; |
718e3744 | 2216 | } |
6b0655a2 | 2217 | |
718e3744 | 2218 | /* neighbor capability dynamic. */ |
2219 | DEFUN (neighbor_capability_dynamic, | |
2220 | neighbor_capability_dynamic_cmd, | |
2221 | NEIGHBOR_CMD2 "capability dynamic", | |
2222 | NEIGHBOR_STR | |
2223 | NEIGHBOR_ADDR_STR2 | |
2224 | "Advertise capability to the peer\n" | |
2225 | "Advertise dynamic capability to this neighbor\n") | |
2226 | { | |
2227 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
2228 | } | |
2229 | ||
2230 | DEFUN (no_neighbor_capability_dynamic, | |
2231 | no_neighbor_capability_dynamic_cmd, | |
2232 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
2233 | NO_STR | |
2234 | NEIGHBOR_STR | |
2235 | NEIGHBOR_ADDR_STR2 | |
2236 | "Advertise capability to the peer\n" | |
2237 | "Advertise dynamic capability to this neighbor\n") | |
2238 | { | |
2239 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
2240 | } | |
6b0655a2 | 2241 | |
718e3744 | 2242 | /* neighbor dont-capability-negotiate */ |
2243 | DEFUN (neighbor_dont_capability_negotiate, | |
2244 | neighbor_dont_capability_negotiate_cmd, | |
2245 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
2246 | NEIGHBOR_STR | |
2247 | NEIGHBOR_ADDR_STR2 | |
2248 | "Do not perform capability negotiation\n") | |
2249 | { | |
2250 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
2251 | } | |
2252 | ||
2253 | DEFUN (no_neighbor_dont_capability_negotiate, | |
2254 | no_neighbor_dont_capability_negotiate_cmd, | |
2255 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
2256 | NO_STR | |
2257 | NEIGHBOR_STR | |
2258 | NEIGHBOR_ADDR_STR2 | |
2259 | "Do not perform capability negotiation\n") | |
2260 | { | |
2261 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
2262 | } | |
6b0655a2 | 2263 | |
94f2b392 | 2264 | static int |
fd79ac91 | 2265 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 2266 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 2267 | { |
2268 | int ret; | |
2269 | struct peer *peer; | |
2270 | ||
2271 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2272 | if (! peer) | |
2273 | return CMD_WARNING; | |
2274 | ||
2275 | if (set) | |
2276 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
2277 | else | |
2278 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
2279 | ||
2280 | return bgp_vty_return (vty, ret); | |
2281 | } | |
2282 | ||
94f2b392 | 2283 | static int |
fd79ac91 | 2284 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 2285 | safi_t safi, u_int32_t flag) |
718e3744 | 2286 | { |
2287 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
2288 | } | |
2289 | ||
94f2b392 | 2290 | static int |
fd79ac91 | 2291 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 2292 | safi_t safi, u_int32_t flag) |
718e3744 | 2293 | { |
2294 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
2295 | } | |
6b0655a2 | 2296 | |
718e3744 | 2297 | /* neighbor capability orf prefix-list. */ |
2298 | DEFUN (neighbor_capability_orf_prefix, | |
2299 | neighbor_capability_orf_prefix_cmd, | |
2300 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
2301 | NEIGHBOR_STR | |
2302 | NEIGHBOR_ADDR_STR2 | |
2303 | "Advertise capability to the peer\n" | |
2304 | "Advertise ORF capability to the peer\n" | |
2305 | "Advertise prefixlist ORF capability to this neighbor\n" | |
2306 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
2307 | "Capability to RECEIVE the ORF from this neighbor\n" | |
2308 | "Capability to SEND the ORF to this neighbor\n") | |
2309 | { | |
2310 | u_int16_t flag = 0; | |
2311 | ||
2312 | if (strncmp (argv[1], "s", 1) == 0) | |
2313 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
2314 | else if (strncmp (argv[1], "r", 1) == 0) | |
2315 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
2316 | else if (strncmp (argv[1], "b", 1) == 0) | |
2317 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
2318 | else | |
2319 | return CMD_WARNING; | |
2320 | ||
2321 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2322 | bgp_node_safi (vty), flag); | |
2323 | } | |
2324 | ||
2325 | DEFUN (no_neighbor_capability_orf_prefix, | |
2326 | no_neighbor_capability_orf_prefix_cmd, | |
2327 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
2328 | NO_STR | |
2329 | NEIGHBOR_STR | |
2330 | NEIGHBOR_ADDR_STR2 | |
2331 | "Advertise capability to the peer\n" | |
2332 | "Advertise ORF capability to the peer\n" | |
2333 | "Advertise prefixlist ORF capability to this neighbor\n" | |
2334 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
2335 | "Capability to RECEIVE the ORF from this neighbor\n" | |
2336 | "Capability to SEND the ORF to this neighbor\n") | |
2337 | { | |
2338 | u_int16_t flag = 0; | |
2339 | ||
2340 | if (strncmp (argv[1], "s", 1) == 0) | |
2341 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
2342 | else if (strncmp (argv[1], "r", 1) == 0) | |
2343 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
2344 | else if (strncmp (argv[1], "b", 1) == 0) | |
2345 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
2346 | else | |
2347 | return CMD_WARNING; | |
2348 | ||
2349 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2350 | bgp_node_safi (vty), flag); | |
2351 | } | |
6b0655a2 | 2352 | |
718e3744 | 2353 | /* neighbor next-hop-self. */ |
2354 | DEFUN (neighbor_nexthop_self, | |
2355 | neighbor_nexthop_self_cmd, | |
9e7a53c1 | 2356 | NEIGHBOR_CMD2 "next-hop-self {all}", |
718e3744 | 2357 | NEIGHBOR_STR |
2358 | NEIGHBOR_ADDR_STR2 | |
9e7a53c1 TT |
2359 | "Disable the next hop calculation for this neighbor\n" |
2360 | "Apply also to ibgp-learned routes when acting as a route reflector\n") | |
718e3744 | 2361 | { |
9e7a53c1 TT |
2362 | u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0; |
2363 | int rc; | |
2364 | ||
2365 | /* Check if "all" is specified */ | |
2366 | if (argv[1] != NULL) | |
2367 | flags |= PEER_FLAG_NEXTHOP_SELF_ALL; | |
2368 | else | |
2369 | unset |= PEER_FLAG_NEXTHOP_SELF_ALL; | |
2370 | ||
2371 | rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2372 | bgp_node_safi (vty), flags); | |
2373 | if ( rc == CMD_SUCCESS && unset ) | |
2374 | rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2375 | bgp_node_safi (vty), unset); | |
2376 | return rc; | |
718e3744 | 2377 | } |
2378 | ||
2379 | DEFUN (no_neighbor_nexthop_self, | |
2380 | no_neighbor_nexthop_self_cmd, | |
9e7a53c1 | 2381 | NO_NEIGHBOR_CMD2 "next-hop-self {all}", |
718e3744 | 2382 | NO_STR |
2383 | NEIGHBOR_STR | |
2384 | NEIGHBOR_ADDR_STR2 | |
9e7a53c1 TT |
2385 | "Disable the next hop calculation for this neighbor\n" |
2386 | "Apply also to ibgp-learned routes when acting as a route reflector\n") | |
718e3744 | 2387 | { |
2388 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
9e7a53c1 TT |
2389 | bgp_node_safi (vty), |
2390 | PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL); | |
718e3744 | 2391 | } |
6b0655a2 | 2392 | |
718e3744 | 2393 | /* neighbor remove-private-AS. */ |
2394 | DEFUN (neighbor_remove_private_as, | |
2395 | neighbor_remove_private_as_cmd, | |
2396 | NEIGHBOR_CMD2 "remove-private-AS", | |
2397 | NEIGHBOR_STR | |
2398 | NEIGHBOR_ADDR_STR2 | |
2399 | "Remove private AS number from outbound updates\n") | |
2400 | { | |
2401 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2402 | bgp_node_safi (vty), | |
2403 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
2404 | } | |
2405 | ||
2406 | DEFUN (no_neighbor_remove_private_as, | |
2407 | no_neighbor_remove_private_as_cmd, | |
2408 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
2409 | NO_STR | |
2410 | NEIGHBOR_STR | |
2411 | NEIGHBOR_ADDR_STR2 | |
2412 | "Remove private AS number from outbound updates\n") | |
2413 | { | |
2414 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2415 | bgp_node_safi (vty), | |
2416 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
2417 | } | |
6b0655a2 | 2418 | |
718e3744 | 2419 | /* neighbor send-community. */ |
2420 | DEFUN (neighbor_send_community, | |
2421 | neighbor_send_community_cmd, | |
2422 | NEIGHBOR_CMD2 "send-community", | |
2423 | NEIGHBOR_STR | |
2424 | NEIGHBOR_ADDR_STR2 | |
2425 | "Send Community attribute to this neighbor\n") | |
2426 | { | |
2427 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2428 | bgp_node_safi (vty), | |
2429 | PEER_FLAG_SEND_COMMUNITY); | |
2430 | } | |
2431 | ||
2432 | DEFUN (no_neighbor_send_community, | |
2433 | no_neighbor_send_community_cmd, | |
2434 | NO_NEIGHBOR_CMD2 "send-community", | |
2435 | NO_STR | |
2436 | NEIGHBOR_STR | |
2437 | NEIGHBOR_ADDR_STR2 | |
2438 | "Send Community attribute to this neighbor\n") | |
2439 | { | |
2440 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2441 | bgp_node_safi (vty), | |
2442 | PEER_FLAG_SEND_COMMUNITY); | |
2443 | } | |
6b0655a2 | 2444 | |
718e3744 | 2445 | /* neighbor send-community extended. */ |
2446 | DEFUN (neighbor_send_community_type, | |
2447 | neighbor_send_community_type_cmd, | |
2448 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
2449 | NEIGHBOR_STR | |
2450 | NEIGHBOR_ADDR_STR2 | |
2451 | "Send Community attribute to this neighbor\n" | |
2452 | "Send Standard and Extended Community attributes\n" | |
2453 | "Send Extended Community attributes\n" | |
2454 | "Send Standard Community attributes\n") | |
2455 | { | |
2456 | if (strncmp (argv[1], "s", 1) == 0) | |
2457 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2458 | bgp_node_safi (vty), | |
2459 | PEER_FLAG_SEND_COMMUNITY); | |
2460 | if (strncmp (argv[1], "e", 1) == 0) | |
2461 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2462 | bgp_node_safi (vty), | |
2463 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
2464 | ||
2465 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2466 | bgp_node_safi (vty), | |
2467 | (PEER_FLAG_SEND_COMMUNITY| | |
2468 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
2469 | } | |
2470 | ||
2471 | DEFUN (no_neighbor_send_community_type, | |
2472 | no_neighbor_send_community_type_cmd, | |
2473 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
2474 | NO_STR | |
2475 | NEIGHBOR_STR | |
2476 | NEIGHBOR_ADDR_STR2 | |
2477 | "Send Community attribute to this neighbor\n" | |
2478 | "Send Standard and Extended Community attributes\n" | |
2479 | "Send Extended Community attributes\n" | |
2480 | "Send Standard Community attributes\n") | |
2481 | { | |
2482 | if (strncmp (argv[1], "s", 1) == 0) | |
2483 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2484 | bgp_node_safi (vty), | |
2485 | PEER_FLAG_SEND_COMMUNITY); | |
2486 | if (strncmp (argv[1], "e", 1) == 0) | |
2487 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2488 | bgp_node_safi (vty), | |
2489 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
2490 | ||
2491 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2492 | bgp_node_safi (vty), | |
2493 | (PEER_FLAG_SEND_COMMUNITY | | |
2494 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
2495 | } | |
6b0655a2 | 2496 | |
718e3744 | 2497 | /* neighbor soft-reconfig. */ |
2498 | DEFUN (neighbor_soft_reconfiguration, | |
2499 | neighbor_soft_reconfiguration_cmd, | |
2500 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
2501 | NEIGHBOR_STR | |
2502 | NEIGHBOR_ADDR_STR2 | |
2503 | "Per neighbor soft reconfiguration\n" | |
2504 | "Allow inbound soft reconfiguration for this neighbor\n") | |
2505 | { | |
2506 | return peer_af_flag_set_vty (vty, argv[0], | |
2507 | bgp_node_afi (vty), bgp_node_safi (vty), | |
2508 | PEER_FLAG_SOFT_RECONFIG); | |
2509 | } | |
2510 | ||
2511 | DEFUN (no_neighbor_soft_reconfiguration, | |
2512 | no_neighbor_soft_reconfiguration_cmd, | |
2513 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
2514 | NO_STR | |
2515 | NEIGHBOR_STR | |
2516 | NEIGHBOR_ADDR_STR2 | |
2517 | "Per neighbor soft reconfiguration\n" | |
2518 | "Allow inbound soft reconfiguration for this neighbor\n") | |
2519 | { | |
2520 | return peer_af_flag_unset_vty (vty, argv[0], | |
2521 | bgp_node_afi (vty), bgp_node_safi (vty), | |
2522 | PEER_FLAG_SOFT_RECONFIG); | |
2523 | } | |
6b0655a2 | 2524 | |
718e3744 | 2525 | DEFUN (neighbor_route_reflector_client, |
2526 | neighbor_route_reflector_client_cmd, | |
2527 | NEIGHBOR_CMD2 "route-reflector-client", | |
2528 | NEIGHBOR_STR | |
2529 | NEIGHBOR_ADDR_STR2 | |
2530 | "Configure a neighbor as Route Reflector client\n") | |
2531 | { | |
2532 | struct peer *peer; | |
2533 | ||
2534 | ||
2535 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2536 | if (! peer) | |
2537 | return CMD_WARNING; | |
2538 | ||
2539 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2540 | bgp_node_safi (vty), | |
2541 | PEER_FLAG_REFLECTOR_CLIENT); | |
2542 | } | |
2543 | ||
2544 | DEFUN (no_neighbor_route_reflector_client, | |
2545 | no_neighbor_route_reflector_client_cmd, | |
2546 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
2547 | NO_STR | |
2548 | NEIGHBOR_STR | |
2549 | NEIGHBOR_ADDR_STR2 | |
2550 | "Configure a neighbor as Route Reflector client\n") | |
2551 | { | |
2552 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2553 | bgp_node_safi (vty), | |
2554 | PEER_FLAG_REFLECTOR_CLIENT); | |
2555 | } | |
6b0655a2 | 2556 | |
94f2b392 | 2557 | static int |
fd79ac91 | 2558 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
2559 | int afi, int safi) | |
fee0f4c6 | 2560 | { |
2561 | int ret; | |
2562 | struct bgp *bgp; | |
2563 | struct peer *peer; | |
2564 | struct peer_group *group; | |
1eb8ef25 | 2565 | struct listnode *node, *nnode; |
fee0f4c6 | 2566 | struct bgp_filter *pfilter; |
2567 | struct bgp_filter *gfilter; | |
228da428 | 2568 | int locked_and_added = 0; |
fee0f4c6 | 2569 | |
2570 | bgp = vty->index; | |
2571 | ||
2572 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2573 | if ( ! peer ) | |
2574 | return CMD_WARNING; | |
2575 | ||
2576 | /* If it is already a RS-Client, don't do anything. */ | |
2577 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
2578 | return CMD_SUCCESS; | |
2579 | ||
2580 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 2581 | { |
2582 | peer = peer_lock (peer); /* rsclient peer list reference */ | |
2583 | listnode_add_sort (bgp->rsclient, peer); | |
228da428 | 2584 | locked_and_added = 1; |
200df115 | 2585 | } |
fee0f4c6 | 2586 | |
2587 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2588 | if (ret < 0) | |
228da428 CC |
2589 | { |
2590 | if (locked_and_added) | |
2591 | { | |
2592 | listnode_delete (bgp->rsclient, peer); | |
2593 | peer_unlock (peer); /* rsclient peer list reference */ | |
2594 | } | |
2595 | ||
2596 | return bgp_vty_return (vty, ret); | |
2597 | } | |
fee0f4c6 | 2598 | |
64e580a7 | 2599 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
fee0f4c6 | 2600 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
228da428 CC |
2601 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
2602 | peer->rib[afi][safi]->owner = peer_lock (peer); | |
fee0f4c6 | 2603 | |
2604 | /* Check for existing 'network' and 'redistribute' routes. */ | |
2605 | bgp_check_local_routes_rsclient (peer, afi, safi); | |
2606 | ||
2607 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ | |
2608 | bgp_soft_reconfig_rsclient (peer, afi, safi); | |
2609 | ||
2610 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
2611 | { | |
2612 | group = peer->group; | |
2613 | gfilter = &peer->filter[afi][safi]; | |
2614 | ||
1eb8ef25 | 2615 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 2616 | { |
2617 | pfilter = &peer->filter[afi][safi]; | |
2618 | ||
2619 | /* Members of a non-RS-Client group should not be RS-Clients, as that | |
2620 | is checked when the become part of the peer-group */ | |
2621 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2622 | if (ret < 0) | |
2623 | return bgp_vty_return (vty, ret); | |
2624 | ||
2625 | /* Make peer's RIB point to group's RIB. */ | |
2626 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; | |
2627 | ||
2628 | /* Import policy. */ | |
2629 | if (pfilter->map[RMAP_IMPORT].name) | |
2630 | free (pfilter->map[RMAP_IMPORT].name); | |
2631 | if (gfilter->map[RMAP_IMPORT].name) | |
2632 | { | |
2633 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); | |
2634 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; | |
2635 | } | |
2636 | else | |
2637 | { | |
2638 | pfilter->map[RMAP_IMPORT].name = NULL; | |
2639 | pfilter->map[RMAP_IMPORT].map =NULL; | |
2640 | } | |
2641 | ||
2642 | /* Export policy. */ | |
2643 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) | |
2644 | { | |
2645 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); | |
2646 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; | |
2647 | } | |
2648 | } | |
2649 | } | |
2650 | return CMD_SUCCESS; | |
2651 | } | |
2652 | ||
94f2b392 | 2653 | static int |
fd79ac91 | 2654 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
2655 | int afi, int safi) | |
fee0f4c6 | 2656 | { |
2657 | int ret; | |
2658 | struct bgp *bgp; | |
2659 | struct peer *peer; | |
2660 | struct peer_group *group; | |
1eb8ef25 | 2661 | struct listnode *node, *nnode; |
fee0f4c6 | 2662 | |
2663 | bgp = vty->index; | |
2664 | ||
2665 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2666 | if ( ! peer ) | |
2667 | return CMD_WARNING; | |
2668 | ||
2669 | /* If it is not a RS-Client, don't do anything. */ | |
2670 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
2671 | return CMD_SUCCESS; | |
2672 | ||
2673 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
2674 | { | |
2675 | group = peer->group; | |
2676 | ||
1eb8ef25 | 2677 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 2678 | { |
2679 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2680 | if (ret < 0) | |
2681 | return bgp_vty_return (vty, ret); | |
2682 | ||
2683 | peer->rib[afi][safi] = NULL; | |
2684 | } | |
2685 | ||
2686 | peer = group->conf; | |
2687 | } | |
2688 | ||
2689 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2690 | if (ret < 0) | |
2691 | return bgp_vty_return (vty, ret); | |
2692 | ||
2693 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 2694 | { |
228da428 | 2695 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
200df115 | 2696 | listnode_delete (bgp->rsclient, peer); |
228da428 | 2697 | peer_unlock (peer); /* peer bgp rsclient reference */ |
200df115 | 2698 | } |
fee0f4c6 | 2699 | |
b608d5b5 | 2700 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
fee0f4c6 | 2701 | |
2702 | return CMD_SUCCESS; | |
2703 | } | |
6b0655a2 | 2704 | |
718e3744 | 2705 | /* neighbor route-server-client. */ |
2706 | DEFUN (neighbor_route_server_client, | |
2707 | neighbor_route_server_client_cmd, | |
2708 | NEIGHBOR_CMD2 "route-server-client", | |
2709 | NEIGHBOR_STR | |
2710 | NEIGHBOR_ADDR_STR2 | |
2711 | "Configure a neighbor as Route Server client\n") | |
2712 | { | |
fee0f4c6 | 2713 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
2714 | bgp_node_safi(vty)); | |
718e3744 | 2715 | } |
2716 | ||
2717 | DEFUN (no_neighbor_route_server_client, | |
2718 | no_neighbor_route_server_client_cmd, | |
2719 | NO_NEIGHBOR_CMD2 "route-server-client", | |
2720 | NO_STR | |
2721 | NEIGHBOR_STR | |
2722 | NEIGHBOR_ADDR_STR2 | |
2723 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 2724 | { |
2725 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), | |
2726 | bgp_node_safi(vty)); | |
2727 | } | |
6b0655a2 | 2728 | |
fee0f4c6 | 2729 | DEFUN (neighbor_nexthop_local_unchanged, |
2730 | neighbor_nexthop_local_unchanged_cmd, | |
2731 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
2732 | NEIGHBOR_STR | |
2733 | NEIGHBOR_ADDR_STR2 | |
2734 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
2735 | "Leave link-local nexthop unchanged for this peer\n") | |
2736 | { | |
2737 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2738 | bgp_node_safi (vty), | |
2739 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
2740 | } | |
6b0655a2 | 2741 | |
fee0f4c6 | 2742 | DEFUN (no_neighbor_nexthop_local_unchanged, |
2743 | no_neighbor_nexthop_local_unchanged_cmd, | |
2744 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
2745 | NO_STR | |
2746 | NEIGHBOR_STR | |
2747 | NEIGHBOR_ADDR_STR2 | |
2748 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
2749 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 2750 | { |
2751 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2752 | bgp_node_safi (vty), | |
fee0f4c6 | 2753 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 2754 | } |
6b0655a2 | 2755 | |
718e3744 | 2756 | DEFUN (neighbor_attr_unchanged, |
2757 | neighbor_attr_unchanged_cmd, | |
2758 | NEIGHBOR_CMD2 "attribute-unchanged", | |
2759 | NEIGHBOR_STR | |
2760 | NEIGHBOR_ADDR_STR2 | |
2761 | "BGP attribute is propagated unchanged to this neighbor\n") | |
2762 | { | |
2763 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2764 | bgp_node_safi (vty), | |
2765 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
2766 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
2767 | PEER_FLAG_MED_UNCHANGED)); | |
2768 | } | |
2769 | ||
2770 | DEFUN (neighbor_attr_unchanged1, | |
2771 | neighbor_attr_unchanged1_cmd, | |
2772 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
2773 | NEIGHBOR_STR | |
2774 | NEIGHBOR_ADDR_STR2 | |
2775 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2776 | "As-path attribute\n" | |
2777 | "Nexthop attribute\n" | |
2778 | "Med attribute\n") | |
2779 | { | |
2780 | u_int16_t flags = 0; | |
2781 | ||
2782 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2783 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2784 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2785 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2786 | else if (strncmp (argv[1], "med", 1) == 0) | |
2787 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2788 | ||
2789 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2790 | bgp_node_safi (vty), flags); | |
2791 | } | |
2792 | ||
2793 | DEFUN (neighbor_attr_unchanged2, | |
2794 | neighbor_attr_unchanged2_cmd, | |
2795 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
2796 | NEIGHBOR_STR | |
2797 | NEIGHBOR_ADDR_STR2 | |
2798 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2799 | "As-path attribute\n" | |
2800 | "Nexthop attribute\n" | |
2801 | "Med attribute\n") | |
2802 | { | |
2803 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
2804 | ||
2805 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
2806 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2807 | else if (strncmp (argv[1], "med", 1) == 0) | |
2808 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2809 | ||
2810 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2811 | bgp_node_safi (vty), flags); | |
2812 | ||
2813 | } | |
2814 | ||
2815 | DEFUN (neighbor_attr_unchanged3, | |
2816 | neighbor_attr_unchanged3_cmd, | |
2817 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
2818 | NEIGHBOR_STR | |
2819 | NEIGHBOR_ADDR_STR2 | |
2820 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2821 | "Nexthop attribute\n" | |
2822 | "As-path attribute\n" | |
2823 | "Med attribute\n") | |
2824 | { | |
2825 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
2826 | ||
2827 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2828 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2829 | else if (strncmp (argv[1], "med", 1) == 0) | |
2830 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2831 | ||
2832 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2833 | bgp_node_safi (vty), flags); | |
2834 | } | |
2835 | ||
2836 | DEFUN (neighbor_attr_unchanged4, | |
2837 | neighbor_attr_unchanged4_cmd, | |
2838 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
2839 | NEIGHBOR_STR | |
2840 | NEIGHBOR_ADDR_STR2 | |
2841 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2842 | "Med attribute\n" | |
2843 | "As-path attribute\n" | |
2844 | "Nexthop attribute\n") | |
2845 | { | |
2846 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
2847 | ||
2848 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2849 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2850 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2851 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2852 | ||
2853 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2854 | bgp_node_safi (vty), flags); | |
2855 | } | |
2856 | ||
2857 | ALIAS (neighbor_attr_unchanged, | |
2858 | neighbor_attr_unchanged5_cmd, | |
2859 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
2860 | NEIGHBOR_STR | |
2861 | NEIGHBOR_ADDR_STR2 | |
2862 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2863 | "As-path attribute\n" | |
2864 | "Nexthop attribute\n" | |
2865 | "Med attribute\n") | |
2866 | ||
2867 | ALIAS (neighbor_attr_unchanged, | |
2868 | neighbor_attr_unchanged6_cmd, | |
2869 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
2870 | NEIGHBOR_STR | |
2871 | NEIGHBOR_ADDR_STR2 | |
2872 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2873 | "As-path attribute\n" | |
2874 | "Med attribute\n" | |
2875 | "Nexthop attribute\n") | |
2876 | ||
2877 | ALIAS (neighbor_attr_unchanged, | |
2878 | neighbor_attr_unchanged7_cmd, | |
2879 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
2880 | NEIGHBOR_STR | |
2881 | NEIGHBOR_ADDR_STR2 | |
2882 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2883 | "Nexthop attribute\n" | |
2884 | "Med attribute\n" | |
2885 | "As-path attribute\n") | |
2886 | ||
2887 | ALIAS (neighbor_attr_unchanged, | |
2888 | neighbor_attr_unchanged8_cmd, | |
2889 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
2890 | NEIGHBOR_STR | |
2891 | NEIGHBOR_ADDR_STR2 | |
2892 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2893 | "Nexthop attribute\n" | |
2894 | "As-path attribute\n" | |
2895 | "Med attribute\n") | |
2896 | ||
2897 | ALIAS (neighbor_attr_unchanged, | |
2898 | neighbor_attr_unchanged9_cmd, | |
2899 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
2900 | NEIGHBOR_STR | |
2901 | NEIGHBOR_ADDR_STR2 | |
2902 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2903 | "Med attribute\n" | |
2904 | "Nexthop attribute\n" | |
2905 | "As-path attribute\n") | |
2906 | ||
2907 | ALIAS (neighbor_attr_unchanged, | |
2908 | neighbor_attr_unchanged10_cmd, | |
2909 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
2910 | NEIGHBOR_STR | |
2911 | NEIGHBOR_ADDR_STR2 | |
2912 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2913 | "Med attribute\n" | |
2914 | "As-path attribute\n" | |
2915 | "Nexthop attribute\n") | |
2916 | ||
2917 | DEFUN (no_neighbor_attr_unchanged, | |
2918 | no_neighbor_attr_unchanged_cmd, | |
2919 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
2920 | NO_STR | |
2921 | NEIGHBOR_STR | |
2922 | NEIGHBOR_ADDR_STR2 | |
2923 | "BGP attribute is propagated unchanged to this neighbor\n") | |
2924 | { | |
2925 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2926 | bgp_node_safi (vty), | |
2927 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
2928 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
2929 | PEER_FLAG_MED_UNCHANGED)); | |
2930 | } | |
2931 | ||
2932 | DEFUN (no_neighbor_attr_unchanged1, | |
2933 | no_neighbor_attr_unchanged1_cmd, | |
2934 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
2935 | NO_STR | |
2936 | NEIGHBOR_STR | |
2937 | NEIGHBOR_ADDR_STR2 | |
2938 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2939 | "As-path attribute\n" | |
2940 | "Nexthop attribute\n" | |
2941 | "Med attribute\n") | |
2942 | { | |
2943 | u_int16_t flags = 0; | |
2944 | ||
2945 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2946 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2947 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2948 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2949 | else if (strncmp (argv[1], "med", 1) == 0) | |
2950 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2951 | ||
2952 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2953 | bgp_node_safi (vty), flags); | |
2954 | } | |
2955 | ||
2956 | DEFUN (no_neighbor_attr_unchanged2, | |
2957 | no_neighbor_attr_unchanged2_cmd, | |
2958 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
2959 | NO_STR | |
2960 | NEIGHBOR_STR | |
2961 | NEIGHBOR_ADDR_STR2 | |
2962 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2963 | "As-path attribute\n" | |
2964 | "Nexthop attribute\n" | |
2965 | "Med attribute\n") | |
2966 | { | |
2967 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
2968 | ||
2969 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
2970 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2971 | else if (strncmp (argv[1], "med", 1) == 0) | |
2972 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2973 | ||
2974 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2975 | bgp_node_safi (vty), flags); | |
2976 | } | |
2977 | ||
2978 | DEFUN (no_neighbor_attr_unchanged3, | |
2979 | no_neighbor_attr_unchanged3_cmd, | |
2980 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
2981 | NO_STR | |
2982 | NEIGHBOR_STR | |
2983 | NEIGHBOR_ADDR_STR2 | |
2984 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2985 | "Nexthop attribute\n" | |
2986 | "As-path attribute\n" | |
2987 | "Med attribute\n") | |
2988 | { | |
2989 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
2990 | ||
2991 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2992 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2993 | else if (strncmp (argv[1], "med", 1) == 0) | |
2994 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2995 | ||
2996 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2997 | bgp_node_safi (vty), flags); | |
2998 | } | |
2999 | ||
3000 | DEFUN (no_neighbor_attr_unchanged4, | |
3001 | no_neighbor_attr_unchanged4_cmd, | |
3002 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
3003 | NO_STR | |
3004 | NEIGHBOR_STR | |
3005 | NEIGHBOR_ADDR_STR2 | |
3006 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3007 | "Med attribute\n" | |
3008 | "As-path attribute\n" | |
3009 | "Nexthop attribute\n") | |
3010 | { | |
3011 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
3012 | ||
3013 | if (strncmp (argv[1], "as-path", 1) == 0) | |
3014 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
3015 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
3016 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
3017 | ||
3018 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3019 | bgp_node_safi (vty), flags); | |
3020 | } | |
3021 | ||
3022 | ALIAS (no_neighbor_attr_unchanged, | |
3023 | no_neighbor_attr_unchanged5_cmd, | |
3024 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
3025 | NO_STR | |
3026 | NEIGHBOR_STR | |
3027 | NEIGHBOR_ADDR_STR2 | |
3028 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3029 | "As-path attribute\n" | |
3030 | "Nexthop attribute\n" | |
3031 | "Med attribute\n") | |
3032 | ||
3033 | ALIAS (no_neighbor_attr_unchanged, | |
3034 | no_neighbor_attr_unchanged6_cmd, | |
3035 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
3036 | NO_STR | |
3037 | NEIGHBOR_STR | |
3038 | NEIGHBOR_ADDR_STR2 | |
3039 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3040 | "As-path attribute\n" | |
3041 | "Med attribute\n" | |
3042 | "Nexthop attribute\n") | |
3043 | ||
3044 | ALIAS (no_neighbor_attr_unchanged, | |
3045 | no_neighbor_attr_unchanged7_cmd, | |
3046 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
3047 | NO_STR | |
3048 | NEIGHBOR_STR | |
3049 | NEIGHBOR_ADDR_STR2 | |
3050 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3051 | "Nexthop attribute\n" | |
3052 | "Med attribute\n" | |
3053 | "As-path attribute\n") | |
3054 | ||
3055 | ALIAS (no_neighbor_attr_unchanged, | |
3056 | no_neighbor_attr_unchanged8_cmd, | |
3057 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
3058 | NO_STR | |
3059 | NEIGHBOR_STR | |
3060 | NEIGHBOR_ADDR_STR2 | |
3061 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3062 | "Nexthop attribute\n" | |
3063 | "As-path attribute\n" | |
3064 | "Med attribute\n") | |
3065 | ||
3066 | ALIAS (no_neighbor_attr_unchanged, | |
3067 | no_neighbor_attr_unchanged9_cmd, | |
3068 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
3069 | NO_STR | |
3070 | NEIGHBOR_STR | |
3071 | NEIGHBOR_ADDR_STR2 | |
3072 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3073 | "Med attribute\n" | |
3074 | "Nexthop attribute\n" | |
3075 | "As-path attribute\n") | |
3076 | ||
3077 | ALIAS (no_neighbor_attr_unchanged, | |
3078 | no_neighbor_attr_unchanged10_cmd, | |
3079 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
3080 | NO_STR | |
3081 | NEIGHBOR_STR | |
3082 | NEIGHBOR_ADDR_STR2 | |
3083 | "BGP attribute is propagated unchanged to this neighbor\n" | |
3084 | "Med attribute\n" | |
3085 | "As-path attribute\n" | |
3086 | "Nexthop attribute\n") | |
3087 | ||
3088 | /* For old version Zebra compatibility. */ | |
dd4c593f | 3089 | DEFUN_DEPRECATED (neighbor_transparent_as, |
3090 | neighbor_transparent_as_cmd, | |
3091 | NEIGHBOR_CMD "transparent-as", | |
3092 | NEIGHBOR_STR | |
3093 | NEIGHBOR_ADDR_STR | |
3094 | "Do not append my AS number even peer is EBGP peer\n") | |
718e3744 | 3095 | { |
3096 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3097 | bgp_node_safi (vty), | |
3098 | PEER_FLAG_AS_PATH_UNCHANGED); | |
3099 | } | |
3100 | ||
dd4c593f | 3101 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
3102 | neighbor_transparent_nexthop_cmd, | |
3103 | NEIGHBOR_CMD "transparent-nexthop", | |
3104 | NEIGHBOR_STR | |
3105 | NEIGHBOR_ADDR_STR | |
3106 | "Do not change nexthop even peer is EBGP peer\n") | |
718e3744 | 3107 | { |
3108 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3109 | bgp_node_safi (vty), | |
3110 | PEER_FLAG_NEXTHOP_UNCHANGED); | |
3111 | } | |
6b0655a2 | 3112 | |
718e3744 | 3113 | /* EBGP multihop configuration. */ |
94f2b392 | 3114 | static int |
fd79ac91 | 3115 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
3116 | const char *ttl_str) | |
718e3744 | 3117 | { |
3118 | struct peer *peer; | |
fd79ac91 | 3119 | unsigned int ttl; |
718e3744 | 3120 | |
3121 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3122 | if (! peer) | |
3123 | return CMD_WARNING; | |
3124 | ||
3125 | if (! ttl_str) | |
3126 | ttl = TTL_MAX; | |
3127 | else | |
3128 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); | |
3129 | ||
89b6d1f8 | 3130 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 3131 | } |
3132 | ||
94f2b392 | 3133 | static int |
fd79ac91 | 3134 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3135 | { |
3136 | struct peer *peer; | |
3137 | ||
3138 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3139 | if (! peer) | |
3140 | return CMD_WARNING; | |
3141 | ||
89b6d1f8 | 3142 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 3143 | } |
3144 | ||
3145 | /* neighbor ebgp-multihop. */ | |
3146 | DEFUN (neighbor_ebgp_multihop, | |
3147 | neighbor_ebgp_multihop_cmd, | |
3148 | NEIGHBOR_CMD2 "ebgp-multihop", | |
3149 | NEIGHBOR_STR | |
3150 | NEIGHBOR_ADDR_STR2 | |
3151 | "Allow EBGP neighbors not on directly connected networks\n") | |
3152 | { | |
3153 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
3154 | } | |
3155 | ||
3156 | DEFUN (neighbor_ebgp_multihop_ttl, | |
3157 | neighbor_ebgp_multihop_ttl_cmd, | |
3158 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
3159 | NEIGHBOR_STR | |
3160 | NEIGHBOR_ADDR_STR2 | |
3161 | "Allow EBGP neighbors not on directly connected networks\n" | |
3162 | "maximum hop count\n") | |
3163 | { | |
3164 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
3165 | } | |
3166 | ||
3167 | DEFUN (no_neighbor_ebgp_multihop, | |
3168 | no_neighbor_ebgp_multihop_cmd, | |
3169 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
3170 | NO_STR | |
3171 | NEIGHBOR_STR | |
3172 | NEIGHBOR_ADDR_STR2 | |
3173 | "Allow EBGP neighbors not on directly connected networks\n") | |
3174 | { | |
3175 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
3176 | } | |
3177 | ||
3178 | ALIAS (no_neighbor_ebgp_multihop, | |
3179 | no_neighbor_ebgp_multihop_ttl_cmd, | |
3180 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
3181 | NO_STR | |
3182 | NEIGHBOR_STR | |
3183 | NEIGHBOR_ADDR_STR2 | |
3184 | "Allow EBGP neighbors not on directly connected networks\n" | |
3185 | "maximum hop count\n") | |
6b0655a2 | 3186 | |
6ffd2079 | 3187 | /* disable-connected-check */ |
3188 | DEFUN (neighbor_disable_connected_check, | |
3189 | neighbor_disable_connected_check_cmd, | |
3190 | NEIGHBOR_CMD2 "disable-connected-check", | |
3191 | NEIGHBOR_STR | |
3192 | NEIGHBOR_ADDR_STR2 | |
3193 | "one-hop away EBGP peer using loopback address\n") | |
3194 | { | |
3195 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
3196 | } | |
3197 | ||
3198 | DEFUN (no_neighbor_disable_connected_check, | |
3199 | no_neighbor_disable_connected_check_cmd, | |
3200 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
3201 | NO_STR | |
3202 | NEIGHBOR_STR | |
3203 | NEIGHBOR_ADDR_STR2 | |
3204 | "one-hop away EBGP peer using loopback address\n") | |
3205 | { | |
3206 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
3207 | } | |
3208 | ||
718e3744 | 3209 | /* Enforce multihop. */ |
6ffd2079 | 3210 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 3211 | neighbor_enforce_multihop_cmd, |
3212 | NEIGHBOR_CMD2 "enforce-multihop", | |
3213 | NEIGHBOR_STR | |
3214 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 3215 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 3216 | |
6ffd2079 | 3217 | /* Enforce multihop. */ |
3218 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 3219 | no_neighbor_enforce_multihop_cmd, |
3220 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
3221 | NO_STR | |
3222 | NEIGHBOR_STR | |
3223 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 3224 | "Enforce EBGP neighbors perform multihop\n") |
6b0655a2 | 3225 | |
718e3744 | 3226 | DEFUN (neighbor_description, |
3227 | neighbor_description_cmd, | |
3228 | NEIGHBOR_CMD2 "description .LINE", | |
3229 | NEIGHBOR_STR | |
3230 | NEIGHBOR_ADDR_STR2 | |
3231 | "Neighbor specific description\n" | |
3232 | "Up to 80 characters describing this neighbor\n") | |
3233 | { | |
3234 | struct peer *peer; | |
718e3744 | 3235 | char *str; |
718e3744 | 3236 | |
3237 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3238 | if (! peer) | |
3239 | return CMD_WARNING; | |
3240 | ||
3241 | if (argc == 1) | |
3242 | return CMD_SUCCESS; | |
3243 | ||
3b8b1855 | 3244 | str = argv_concat(argv, argc, 1); |
718e3744 | 3245 | |
3246 | peer_description_set (peer, str); | |
3247 | ||
3b8b1855 | 3248 | XFREE (MTYPE_TMP, str); |
718e3744 | 3249 | |
3250 | return CMD_SUCCESS; | |
3251 | } | |
3252 | ||
3253 | DEFUN (no_neighbor_description, | |
3254 | no_neighbor_description_cmd, | |
3255 | NO_NEIGHBOR_CMD2 "description", | |
3256 | NO_STR | |
3257 | NEIGHBOR_STR | |
3258 | NEIGHBOR_ADDR_STR2 | |
3259 | "Neighbor specific description\n") | |
3260 | { | |
3261 | struct peer *peer; | |
3262 | ||
3263 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3264 | if (! peer) | |
3265 | return CMD_WARNING; | |
3266 | ||
3267 | peer_description_unset (peer); | |
3268 | ||
3269 | return CMD_SUCCESS; | |
3270 | } | |
3271 | ||
3272 | ALIAS (no_neighbor_description, | |
3273 | no_neighbor_description_val_cmd, | |
3274 | NO_NEIGHBOR_CMD2 "description .LINE", | |
3275 | NO_STR | |
3276 | NEIGHBOR_STR | |
3277 | NEIGHBOR_ADDR_STR2 | |
3278 | "Neighbor specific description\n" | |
3279 | "Up to 80 characters describing this neighbor\n") | |
6b0655a2 | 3280 | |
718e3744 | 3281 | /* Neighbor update-source. */ |
94f2b392 | 3282 | static int |
fd79ac91 | 3283 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
3284 | const char *source_str) | |
718e3744 | 3285 | { |
3286 | struct peer *peer; | |
718e3744 | 3287 | |
3288 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3289 | if (! peer) | |
3290 | return CMD_WARNING; | |
3291 | ||
a80beece DS |
3292 | if (peer->conf_if) |
3293 | return CMD_WARNING; | |
3294 | ||
718e3744 | 3295 | if (source_str) |
3296 | { | |
c63b83fe JBD |
3297 | union sockunion su; |
3298 | int ret = str2sockunion (source_str, &su); | |
3299 | ||
3300 | if (ret == 0) | |
3301 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 3302 | else |
3303 | peer_update_source_if_set (peer, source_str); | |
3304 | } | |
3305 | else | |
3306 | peer_update_source_unset (peer); | |
3307 | ||
3308 | return CMD_SUCCESS; | |
3309 | } | |
3310 | ||
9a1a331d | 3311 | #define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)" |
369688c0 PJ |
3312 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
3313 | "IPv4 address\n" \ | |
9a1a331d PJ |
3314 | "IPv6 address\n" \ |
3315 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 3316 | |
718e3744 | 3317 | DEFUN (neighbor_update_source, |
3318 | neighbor_update_source_cmd, | |
369688c0 | 3319 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR, |
718e3744 | 3320 | NEIGHBOR_STR |
3321 | NEIGHBOR_ADDR_STR2 | |
3322 | "Source of routing updates\n" | |
369688c0 | 3323 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 3324 | { |
3325 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
3326 | } | |
3327 | ||
3328 | DEFUN (no_neighbor_update_source, | |
3329 | no_neighbor_update_source_cmd, | |
3330 | NO_NEIGHBOR_CMD2 "update-source", | |
3331 | NO_STR | |
3332 | NEIGHBOR_STR | |
3333 | NEIGHBOR_ADDR_STR2 | |
369688c0 | 3334 | "Source of routing updates\n") |
718e3744 | 3335 | { |
3336 | return peer_update_source_vty (vty, argv[0], NULL); | |
3337 | } | |
6b0655a2 | 3338 | |
94f2b392 | 3339 | static int |
fd79ac91 | 3340 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
3341 | afi_t afi, safi_t safi, | |
3342 | const char *rmap, int set) | |
718e3744 | 3343 | { |
3344 | int ret; | |
3345 | struct peer *peer; | |
3346 | ||
3347 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3348 | if (! peer) | |
3349 | return CMD_WARNING; | |
3350 | ||
3351 | if (set) | |
3352 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
3353 | else | |
3354 | ret = peer_default_originate_unset (peer, afi, safi); | |
3355 | ||
3356 | return bgp_vty_return (vty, ret); | |
3357 | } | |
3358 | ||
3359 | /* neighbor default-originate. */ | |
3360 | DEFUN (neighbor_default_originate, | |
3361 | neighbor_default_originate_cmd, | |
3362 | NEIGHBOR_CMD2 "default-originate", | |
3363 | NEIGHBOR_STR | |
3364 | NEIGHBOR_ADDR_STR2 | |
3365 | "Originate default route to this neighbor\n") | |
3366 | { | |
3367 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3368 | bgp_node_safi (vty), NULL, 1); | |
3369 | } | |
3370 | ||
3371 | DEFUN (neighbor_default_originate_rmap, | |
3372 | neighbor_default_originate_rmap_cmd, | |
3373 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
3374 | NEIGHBOR_STR | |
3375 | NEIGHBOR_ADDR_STR2 | |
3376 | "Originate default route to this neighbor\n" | |
3377 | "Route-map to specify criteria to originate default\n" | |
3378 | "route-map name\n") | |
3379 | { | |
3380 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3381 | bgp_node_safi (vty), argv[1], 1); | |
3382 | } | |
3383 | ||
3384 | DEFUN (no_neighbor_default_originate, | |
3385 | no_neighbor_default_originate_cmd, | |
3386 | NO_NEIGHBOR_CMD2 "default-originate", | |
3387 | NO_STR | |
3388 | NEIGHBOR_STR | |
3389 | NEIGHBOR_ADDR_STR2 | |
3390 | "Originate default route to this neighbor\n") | |
3391 | { | |
3392 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3393 | bgp_node_safi (vty), NULL, 0); | |
3394 | } | |
3395 | ||
3396 | ALIAS (no_neighbor_default_originate, | |
3397 | no_neighbor_default_originate_rmap_cmd, | |
3398 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
3399 | NO_STR | |
3400 | NEIGHBOR_STR | |
3401 | NEIGHBOR_ADDR_STR2 | |
3402 | "Originate default route to this neighbor\n" | |
3403 | "Route-map to specify criteria to originate default\n" | |
3404 | "route-map name\n") | |
6b0655a2 | 3405 | |
718e3744 | 3406 | /* Set neighbor's BGP port. */ |
94f2b392 | 3407 | static int |
fd79ac91 | 3408 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
3409 | const char *port_str) | |
718e3744 | 3410 | { |
3411 | struct peer *peer; | |
3412 | u_int16_t port; | |
3413 | struct servent *sp; | |
3414 | ||
3415 | peer = peer_lookup_vty (vty, ip_str); | |
3416 | if (! peer) | |
3417 | return CMD_WARNING; | |
3418 | ||
3419 | if (! port_str) | |
3420 | { | |
3421 | sp = getservbyname ("bgp", "tcp"); | |
3422 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
3423 | } | |
3424 | else | |
3425 | { | |
3426 | VTY_GET_INTEGER("port", port, port_str); | |
3427 | } | |
3428 | ||
3429 | peer_port_set (peer, port); | |
3430 | ||
3431 | return CMD_SUCCESS; | |
3432 | } | |
3433 | ||
f418446b | 3434 | /* Set specified peer's BGP port. */ |
718e3744 | 3435 | DEFUN (neighbor_port, |
3436 | neighbor_port_cmd, | |
3437 | NEIGHBOR_CMD "port <0-65535>", | |
3438 | NEIGHBOR_STR | |
3439 | NEIGHBOR_ADDR_STR | |
3440 | "Neighbor's BGP port\n" | |
3441 | "TCP port number\n") | |
3442 | { | |
3443 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
3444 | } | |
3445 | ||
3446 | DEFUN (no_neighbor_port, | |
3447 | no_neighbor_port_cmd, | |
3448 | NO_NEIGHBOR_CMD "port", | |
3449 | NO_STR | |
3450 | NEIGHBOR_STR | |
3451 | NEIGHBOR_ADDR_STR | |
3452 | "Neighbor's BGP port\n") | |
3453 | { | |
3454 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
3455 | } | |
3456 | ||
3457 | ALIAS (no_neighbor_port, | |
3458 | no_neighbor_port_val_cmd, | |
3459 | NO_NEIGHBOR_CMD "port <0-65535>", | |
3460 | NO_STR | |
3461 | NEIGHBOR_STR | |
3462 | NEIGHBOR_ADDR_STR | |
3463 | "Neighbor's BGP port\n" | |
3464 | "TCP port number\n") | |
6b0655a2 | 3465 | |
718e3744 | 3466 | /* neighbor weight. */ |
94f2b392 | 3467 | static int |
fd79ac91 | 3468 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
3469 | const char *weight_str) | |
718e3744 | 3470 | { |
3471 | int ret; | |
3472 | struct peer *peer; | |
3473 | unsigned long weight; | |
3474 | ||
3475 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3476 | if (! peer) | |
3477 | return CMD_WARNING; | |
3478 | ||
3479 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
3480 | ||
3481 | ret = peer_weight_set (peer, weight); | |
3482 | ||
3483 | return CMD_SUCCESS; | |
3484 | } | |
3485 | ||
94f2b392 | 3486 | static int |
fd79ac91 | 3487 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3488 | { |
3489 | struct peer *peer; | |
3490 | ||
3491 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3492 | if (! peer) | |
3493 | return CMD_WARNING; | |
3494 | ||
3495 | peer_weight_unset (peer); | |
3496 | ||
3497 | return CMD_SUCCESS; | |
3498 | } | |
3499 | ||
3500 | DEFUN (neighbor_weight, | |
3501 | neighbor_weight_cmd, | |
3502 | NEIGHBOR_CMD2 "weight <0-65535>", | |
3503 | NEIGHBOR_STR | |
3504 | NEIGHBOR_ADDR_STR2 | |
3505 | "Set default weight for routes from this neighbor\n" | |
3506 | "default weight\n") | |
3507 | { | |
3508 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
3509 | } | |
3510 | ||
3511 | DEFUN (no_neighbor_weight, | |
3512 | no_neighbor_weight_cmd, | |
3513 | NO_NEIGHBOR_CMD2 "weight", | |
3514 | NO_STR | |
3515 | NEIGHBOR_STR | |
3516 | NEIGHBOR_ADDR_STR2 | |
3517 | "Set default weight for routes from this neighbor\n") | |
3518 | { | |
3519 | return peer_weight_unset_vty (vty, argv[0]); | |
3520 | } | |
3521 | ||
3522 | ALIAS (no_neighbor_weight, | |
3523 | no_neighbor_weight_val_cmd, | |
3524 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
3525 | NO_STR | |
3526 | NEIGHBOR_STR | |
3527 | NEIGHBOR_ADDR_STR2 | |
3528 | "Set default weight for routes from this neighbor\n" | |
3529 | "default weight\n") | |
6b0655a2 | 3530 | |
718e3744 | 3531 | /* Override capability negotiation. */ |
3532 | DEFUN (neighbor_override_capability, | |
3533 | neighbor_override_capability_cmd, | |
3534 | NEIGHBOR_CMD2 "override-capability", | |
3535 | NEIGHBOR_STR | |
3536 | NEIGHBOR_ADDR_STR2 | |
3537 | "Override capability negotiation result\n") | |
3538 | { | |
3539 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
3540 | } | |
3541 | ||
3542 | DEFUN (no_neighbor_override_capability, | |
3543 | no_neighbor_override_capability_cmd, | |
3544 | NO_NEIGHBOR_CMD2 "override-capability", | |
3545 | NO_STR | |
3546 | NEIGHBOR_STR | |
3547 | NEIGHBOR_ADDR_STR2 | |
3548 | "Override capability negotiation result\n") | |
3549 | { | |
3550 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
3551 | } | |
6b0655a2 | 3552 | |
718e3744 | 3553 | DEFUN (neighbor_strict_capability, |
3554 | neighbor_strict_capability_cmd, | |
3555 | NEIGHBOR_CMD "strict-capability-match", | |
3556 | NEIGHBOR_STR | |
3557 | NEIGHBOR_ADDR_STR | |
3558 | "Strict capability negotiation match\n") | |
3559 | { | |
3560 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
3561 | } | |
3562 | ||
3563 | DEFUN (no_neighbor_strict_capability, | |
3564 | no_neighbor_strict_capability_cmd, | |
3565 | NO_NEIGHBOR_CMD "strict-capability-match", | |
3566 | NO_STR | |
3567 | NEIGHBOR_STR | |
3568 | NEIGHBOR_ADDR_STR | |
3569 | "Strict capability negotiation match\n") | |
3570 | { | |
3571 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
3572 | } | |
6b0655a2 | 3573 | |
94f2b392 | 3574 | static int |
fd79ac91 | 3575 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
3576 | const char *keep_str, const char *hold_str) | |
718e3744 | 3577 | { |
3578 | int ret; | |
3579 | struct peer *peer; | |
3580 | u_int32_t keepalive; | |
3581 | u_int32_t holdtime; | |
3582 | ||
3583 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3584 | if (! peer) | |
3585 | return CMD_WARNING; | |
3586 | ||
3587 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
3588 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
3589 | ||
3590 | ret = peer_timers_set (peer, keepalive, holdtime); | |
3591 | ||
3592 | return bgp_vty_return (vty, ret); | |
3593 | } | |
6b0655a2 | 3594 | |
94f2b392 | 3595 | static int |
fd79ac91 | 3596 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3597 | { |
3598 | int ret; | |
3599 | struct peer *peer; | |
3600 | ||
3601 | peer = peer_lookup_vty (vty, ip_str); | |
3602 | if (! peer) | |
3603 | return CMD_WARNING; | |
3604 | ||
3605 | ret = peer_timers_unset (peer); | |
3606 | ||
3607 | return bgp_vty_return (vty, ret); | |
3608 | } | |
3609 | ||
3610 | DEFUN (neighbor_timers, | |
3611 | neighbor_timers_cmd, | |
3612 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
3613 | NEIGHBOR_STR | |
3614 | NEIGHBOR_ADDR_STR2 | |
3615 | "BGP per neighbor timers\n" | |
3616 | "Keepalive interval\n" | |
3617 | "Holdtime\n") | |
3618 | { | |
3619 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
3620 | } | |
3621 | ||
3622 | DEFUN (no_neighbor_timers, | |
3623 | no_neighbor_timers_cmd, | |
3624 | NO_NEIGHBOR_CMD2 "timers", | |
3625 | NO_STR | |
3626 | NEIGHBOR_STR | |
3627 | NEIGHBOR_ADDR_STR2 | |
3628 | "BGP per neighbor timers\n") | |
3629 | { | |
3630 | return peer_timers_unset_vty (vty, argv[0]); | |
3631 | } | |
6b0655a2 | 3632 | |
94f2b392 | 3633 | static int |
fd79ac91 | 3634 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
3635 | const char *time_str) | |
718e3744 | 3636 | { |
3637 | int ret; | |
3638 | struct peer *peer; | |
3639 | u_int32_t connect; | |
3640 | ||
966f821c | 3641 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 3642 | if (! peer) |
3643 | return CMD_WARNING; | |
3644 | ||
3645 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
3646 | ||
3647 | ret = peer_timers_connect_set (peer, connect); | |
3648 | ||
966f821c | 3649 | return bgp_vty_return (vty, ret); |
718e3744 | 3650 | } |
3651 | ||
94f2b392 | 3652 | static int |
fd79ac91 | 3653 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3654 | { |
3655 | int ret; | |
3656 | struct peer *peer; | |
3657 | ||
3658 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3659 | if (! peer) | |
3660 | return CMD_WARNING; | |
3661 | ||
3662 | ret = peer_timers_connect_unset (peer); | |
3663 | ||
966f821c | 3664 | return bgp_vty_return (vty, ret); |
718e3744 | 3665 | } |
3666 | ||
3667 | DEFUN (neighbor_timers_connect, | |
3668 | neighbor_timers_connect_cmd, | |
966f821c | 3669 | NEIGHBOR_CMD2 "timers connect <0-65535>", |
718e3744 | 3670 | NEIGHBOR_STR |
966f821c | 3671 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3672 | "BGP per neighbor timers\n" |
3673 | "BGP connect timer\n" | |
3674 | "Connect timer\n") | |
3675 | { | |
3676 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
3677 | } | |
3678 | ||
3679 | DEFUN (no_neighbor_timers_connect, | |
3680 | no_neighbor_timers_connect_cmd, | |
966f821c | 3681 | NO_NEIGHBOR_CMD2 "timers connect", |
718e3744 | 3682 | NO_STR |
3683 | NEIGHBOR_STR | |
966f821c | 3684 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3685 | "BGP per neighbor timers\n" |
3686 | "BGP connect timer\n") | |
3687 | { | |
3688 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
3689 | } | |
3690 | ||
3691 | ALIAS (no_neighbor_timers_connect, | |
3692 | no_neighbor_timers_connect_val_cmd, | |
966f821c | 3693 | NO_NEIGHBOR_CMD2 "timers connect <0-65535>", |
718e3744 | 3694 | NO_STR |
3695 | NEIGHBOR_STR | |
966f821c | 3696 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3697 | "BGP per neighbor timers\n" |
3698 | "BGP connect timer\n" | |
3699 | "Connect timer\n") | |
6b0655a2 | 3700 | |
94f2b392 | 3701 | static int |
fd79ac91 | 3702 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
3703 | const char *time_str, int set) | |
718e3744 | 3704 | { |
3705 | int ret; | |
3706 | struct peer *peer; | |
3707 | u_int32_t routeadv = 0; | |
3708 | ||
966f821c | 3709 | peer = peer_and_group_lookup_vty (vty, ip_str); |
718e3744 | 3710 | if (! peer) |
3711 | return CMD_WARNING; | |
3712 | ||
3713 | if (time_str) | |
3714 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
3715 | ||
3716 | if (set) | |
3717 | ret = peer_advertise_interval_set (peer, routeadv); | |
3718 | else | |
3719 | ret = peer_advertise_interval_unset (peer); | |
3720 | ||
966f821c | 3721 | return bgp_vty_return (vty, ret); |
718e3744 | 3722 | } |
3723 | ||
3724 | DEFUN (neighbor_advertise_interval, | |
3725 | neighbor_advertise_interval_cmd, | |
966f821c | 3726 | NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 3727 | NEIGHBOR_STR |
966f821c | 3728 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3729 | "Minimum interval between sending BGP routing updates\n" |
3730 | "time in seconds\n") | |
3731 | { | |
3732 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
3733 | } | |
3734 | ||
3735 | DEFUN (no_neighbor_advertise_interval, | |
3736 | no_neighbor_advertise_interval_cmd, | |
966f821c | 3737 | NO_NEIGHBOR_CMD2 "advertisement-interval", |
718e3744 | 3738 | NO_STR |
3739 | NEIGHBOR_STR | |
966f821c | 3740 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3741 | "Minimum interval between sending BGP routing updates\n") |
3742 | { | |
3743 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
3744 | } | |
3745 | ||
3746 | ALIAS (no_neighbor_advertise_interval, | |
3747 | no_neighbor_advertise_interval_val_cmd, | |
966f821c | 3748 | NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>", |
718e3744 | 3749 | NO_STR |
3750 | NEIGHBOR_STR | |
966f821c | 3751 | NEIGHBOR_ADDR_STR2 |
718e3744 | 3752 | "Minimum interval between sending BGP routing updates\n" |
3753 | "time in seconds\n") | |
6b0655a2 | 3754 | |
718e3744 | 3755 | /* neighbor interface */ |
94f2b392 | 3756 | static int |
fd79ac91 | 3757 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 3758 | { |
3759 | int ret; | |
3760 | struct peer *peer; | |
3761 | ||
3762 | peer = peer_lookup_vty (vty, ip_str); | |
a80beece | 3763 | if (! peer || peer->conf_if) |
718e3744 | 3764 | return CMD_WARNING; |
3765 | ||
3766 | if (str) | |
3767 | ret = peer_interface_set (peer, str); | |
3768 | else | |
3769 | ret = peer_interface_unset (peer); | |
3770 | ||
3771 | return CMD_SUCCESS; | |
3772 | } | |
3773 | ||
3774 | DEFUN (neighbor_interface, | |
3775 | neighbor_interface_cmd, | |
3776 | NEIGHBOR_CMD "interface WORD", | |
3777 | NEIGHBOR_STR | |
3778 | NEIGHBOR_ADDR_STR | |
3779 | "Interface\n" | |
3780 | "Interface name\n") | |
3781 | { | |
3782 | return peer_interface_vty (vty, argv[0], argv[1]); | |
3783 | } | |
3784 | ||
3785 | DEFUN (no_neighbor_interface, | |
3786 | no_neighbor_interface_cmd, | |
3787 | NO_NEIGHBOR_CMD "interface WORD", | |
3788 | NO_STR | |
3789 | NEIGHBOR_STR | |
3790 | NEIGHBOR_ADDR_STR | |
3791 | "Interface\n" | |
3792 | "Interface name\n") | |
3793 | { | |
3794 | return peer_interface_vty (vty, argv[0], NULL); | |
3795 | } | |
6b0655a2 | 3796 | |
718e3744 | 3797 | /* Set distribute list to the peer. */ |
94f2b392 | 3798 | static int |
fd79ac91 | 3799 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
3800 | afi_t afi, safi_t safi, | |
3801 | const char *name_str, const char *direct_str) | |
718e3744 | 3802 | { |
3803 | int ret; | |
3804 | struct peer *peer; | |
3805 | int direct = FILTER_IN; | |
3806 | ||
3807 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3808 | if (! peer) | |
3809 | return CMD_WARNING; | |
3810 | ||
3811 | /* Check filter direction. */ | |
3812 | if (strncmp (direct_str, "i", 1) == 0) | |
3813 | direct = FILTER_IN; | |
3814 | else if (strncmp (direct_str, "o", 1) == 0) | |
3815 | direct = FILTER_OUT; | |
3816 | ||
3817 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
3818 | ||
3819 | return bgp_vty_return (vty, ret); | |
3820 | } | |
3821 | ||
94f2b392 | 3822 | static int |
fd79ac91 | 3823 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3824 | safi_t safi, const char *direct_str) | |
718e3744 | 3825 | { |
3826 | int ret; | |
3827 | struct peer *peer; | |
3828 | int direct = FILTER_IN; | |
3829 | ||
3830 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3831 | if (! peer) | |
3832 | return CMD_WARNING; | |
3833 | ||
3834 | /* Check filter direction. */ | |
3835 | if (strncmp (direct_str, "i", 1) == 0) | |
3836 | direct = FILTER_IN; | |
3837 | else if (strncmp (direct_str, "o", 1) == 0) | |
3838 | direct = FILTER_OUT; | |
3839 | ||
3840 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
3841 | ||
3842 | return bgp_vty_return (vty, ret); | |
3843 | } | |
3844 | ||
3845 | DEFUN (neighbor_distribute_list, | |
3846 | neighbor_distribute_list_cmd, | |
3847 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
3848 | NEIGHBOR_STR | |
3849 | NEIGHBOR_ADDR_STR2 | |
3850 | "Filter updates to/from this neighbor\n" | |
3851 | "IP access-list number\n" | |
3852 | "IP access-list number (expanded range)\n" | |
3853 | "IP Access-list name\n" | |
3854 | "Filter incoming updates\n" | |
3855 | "Filter outgoing updates\n") | |
3856 | { | |
3857 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3858 | bgp_node_safi (vty), argv[1], argv[2]); | |
3859 | } | |
3860 | ||
3861 | DEFUN (no_neighbor_distribute_list, | |
3862 | no_neighbor_distribute_list_cmd, | |
3863 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
3864 | NO_STR | |
3865 | NEIGHBOR_STR | |
3866 | NEIGHBOR_ADDR_STR2 | |
3867 | "Filter updates to/from this neighbor\n" | |
3868 | "IP access-list number\n" | |
3869 | "IP access-list number (expanded range)\n" | |
3870 | "IP Access-list name\n" | |
3871 | "Filter incoming updates\n" | |
3872 | "Filter outgoing updates\n") | |
3873 | { | |
3874 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3875 | bgp_node_safi (vty), argv[2]); | |
3876 | } | |
6b0655a2 | 3877 | |
718e3744 | 3878 | /* Set prefix list to the peer. */ |
94f2b392 | 3879 | static int |
fd79ac91 | 3880 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3881 | safi_t safi, const char *name_str, | |
3882 | const char *direct_str) | |
718e3744 | 3883 | { |
3884 | int ret; | |
3885 | struct peer *peer; | |
3886 | int direct = FILTER_IN; | |
3887 | ||
3888 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3889 | if (! peer) | |
3890 | return CMD_WARNING; | |
3891 | ||
3892 | /* Check filter direction. */ | |
3893 | if (strncmp (direct_str, "i", 1) == 0) | |
3894 | direct = FILTER_IN; | |
3895 | else if (strncmp (direct_str, "o", 1) == 0) | |
3896 | direct = FILTER_OUT; | |
3897 | ||
3898 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
3899 | ||
3900 | return bgp_vty_return (vty, ret); | |
3901 | } | |
3902 | ||
94f2b392 | 3903 | static int |
fd79ac91 | 3904 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3905 | safi_t safi, const char *direct_str) | |
718e3744 | 3906 | { |
3907 | int ret; | |
3908 | struct peer *peer; | |
3909 | int direct = FILTER_IN; | |
3910 | ||
3911 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3912 | if (! peer) | |
3913 | return CMD_WARNING; | |
3914 | ||
3915 | /* Check filter direction. */ | |
3916 | if (strncmp (direct_str, "i", 1) == 0) | |
3917 | direct = FILTER_IN; | |
3918 | else if (strncmp (direct_str, "o", 1) == 0) | |
3919 | direct = FILTER_OUT; | |
3920 | ||
3921 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
3922 | ||
3923 | return bgp_vty_return (vty, ret); | |
3924 | } | |
3925 | ||
3926 | DEFUN (neighbor_prefix_list, | |
3927 | neighbor_prefix_list_cmd, | |
3928 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
3929 | NEIGHBOR_STR | |
3930 | NEIGHBOR_ADDR_STR2 | |
3931 | "Filter updates to/from this neighbor\n" | |
3932 | "Name of a prefix list\n" | |
3933 | "Filter incoming updates\n" | |
3934 | "Filter outgoing updates\n") | |
3935 | { | |
3936 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3937 | bgp_node_safi (vty), argv[1], argv[2]); | |
3938 | } | |
3939 | ||
3940 | DEFUN (no_neighbor_prefix_list, | |
3941 | no_neighbor_prefix_list_cmd, | |
3942 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
3943 | NO_STR | |
3944 | NEIGHBOR_STR | |
3945 | NEIGHBOR_ADDR_STR2 | |
3946 | "Filter updates to/from this neighbor\n" | |
3947 | "Name of a prefix list\n" | |
3948 | "Filter incoming updates\n" | |
3949 | "Filter outgoing updates\n") | |
3950 | { | |
3951 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3952 | bgp_node_safi (vty), argv[2]); | |
3953 | } | |
6b0655a2 | 3954 | |
94f2b392 | 3955 | static int |
fd79ac91 | 3956 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
3957 | afi_t afi, safi_t safi, | |
3958 | const char *name_str, const char *direct_str) | |
718e3744 | 3959 | { |
3960 | int ret; | |
3961 | struct peer *peer; | |
3962 | int direct = FILTER_IN; | |
3963 | ||
3964 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3965 | if (! peer) | |
3966 | return CMD_WARNING; | |
3967 | ||
3968 | /* Check filter direction. */ | |
3969 | if (strncmp (direct_str, "i", 1) == 0) | |
3970 | direct = FILTER_IN; | |
3971 | else if (strncmp (direct_str, "o", 1) == 0) | |
3972 | direct = FILTER_OUT; | |
3973 | ||
3974 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
3975 | ||
3976 | return bgp_vty_return (vty, ret); | |
3977 | } | |
3978 | ||
94f2b392 | 3979 | static int |
fd79ac91 | 3980 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
3981 | afi_t afi, safi_t safi, | |
3982 | const char *direct_str) | |
718e3744 | 3983 | { |
3984 | int ret; | |
3985 | struct peer *peer; | |
3986 | int direct = FILTER_IN; | |
3987 | ||
3988 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3989 | if (! peer) | |
3990 | return CMD_WARNING; | |
3991 | ||
3992 | /* Check filter direction. */ | |
3993 | if (strncmp (direct_str, "i", 1) == 0) | |
3994 | direct = FILTER_IN; | |
3995 | else if (strncmp (direct_str, "o", 1) == 0) | |
3996 | direct = FILTER_OUT; | |
3997 | ||
3998 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
3999 | ||
4000 | return bgp_vty_return (vty, ret); | |
4001 | } | |
4002 | ||
4003 | DEFUN (neighbor_filter_list, | |
4004 | neighbor_filter_list_cmd, | |
4005 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
4006 | NEIGHBOR_STR | |
4007 | NEIGHBOR_ADDR_STR2 | |
4008 | "Establish BGP filters\n" | |
4009 | "AS path access-list name\n" | |
4010 | "Filter incoming routes\n" | |
4011 | "Filter outgoing routes\n") | |
4012 | { | |
4013 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4014 | bgp_node_safi (vty), argv[1], argv[2]); | |
4015 | } | |
4016 | ||
4017 | DEFUN (no_neighbor_filter_list, | |
4018 | no_neighbor_filter_list_cmd, | |
4019 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
4020 | NO_STR | |
4021 | NEIGHBOR_STR | |
4022 | NEIGHBOR_ADDR_STR2 | |
4023 | "Establish BGP filters\n" | |
4024 | "AS path access-list name\n" | |
4025 | "Filter incoming routes\n" | |
4026 | "Filter outgoing routes\n") | |
4027 | { | |
4028 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4029 | bgp_node_safi (vty), argv[2]); | |
4030 | } | |
6b0655a2 | 4031 | |
718e3744 | 4032 | /* Set route-map to the peer. */ |
94f2b392 | 4033 | static int |
fd79ac91 | 4034 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
4035 | afi_t afi, safi_t safi, | |
4036 | const char *name_str, const char *direct_str) | |
718e3744 | 4037 | { |
4038 | int ret; | |
4039 | struct peer *peer; | |
fee0f4c6 | 4040 | int direct = RMAP_IN; |
718e3744 | 4041 | |
4042 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4043 | if (! peer) | |
4044 | return CMD_WARNING; | |
4045 | ||
4046 | /* Check filter direction. */ | |
fee0f4c6 | 4047 | if (strncmp (direct_str, "in", 2) == 0) |
4048 | direct = RMAP_IN; | |
718e3744 | 4049 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 4050 | direct = RMAP_OUT; |
4051 | else if (strncmp (direct_str, "im", 2) == 0) | |
4052 | direct = RMAP_IMPORT; | |
4053 | else if (strncmp (direct_str, "e", 1) == 0) | |
4054 | direct = RMAP_EXPORT; | |
718e3744 | 4055 | |
4056 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
4057 | ||
4058 | return bgp_vty_return (vty, ret); | |
4059 | } | |
4060 | ||
94f2b392 | 4061 | static int |
fd79ac91 | 4062 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4063 | safi_t safi, const char *direct_str) | |
718e3744 | 4064 | { |
4065 | int ret; | |
4066 | struct peer *peer; | |
fee0f4c6 | 4067 | int direct = RMAP_IN; |
718e3744 | 4068 | |
4069 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4070 | if (! peer) | |
4071 | return CMD_WARNING; | |
4072 | ||
4073 | /* Check filter direction. */ | |
fee0f4c6 | 4074 | if (strncmp (direct_str, "in", 2) == 0) |
4075 | direct = RMAP_IN; | |
718e3744 | 4076 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 4077 | direct = RMAP_OUT; |
4078 | else if (strncmp (direct_str, "im", 2) == 0) | |
4079 | direct = RMAP_IMPORT; | |
4080 | else if (strncmp (direct_str, "e", 1) == 0) | |
4081 | direct = RMAP_EXPORT; | |
718e3744 | 4082 | |
4083 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
4084 | ||
4085 | return bgp_vty_return (vty, ret); | |
4086 | } | |
4087 | ||
4088 | DEFUN (neighbor_route_map, | |
4089 | neighbor_route_map_cmd, | |
fee0f4c6 | 4090 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 4091 | NEIGHBOR_STR |
4092 | NEIGHBOR_ADDR_STR2 | |
4093 | "Apply route map to neighbor\n" | |
4094 | "Name of route map\n" | |
4095 | "Apply map to incoming routes\n" | |
fee0f4c6 | 4096 | "Apply map to outbound routes\n" |
4097 | "Apply map to routes going into a Route-Server client's table\n" | |
4098 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 4099 | { |
4100 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4101 | bgp_node_safi (vty), argv[1], argv[2]); | |
4102 | } | |
4103 | ||
4104 | DEFUN (no_neighbor_route_map, | |
4105 | no_neighbor_route_map_cmd, | |
fee0f4c6 | 4106 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 4107 | NO_STR |
4108 | NEIGHBOR_STR | |
4109 | NEIGHBOR_ADDR_STR2 | |
4110 | "Apply route map to neighbor\n" | |
4111 | "Name of route map\n" | |
4112 | "Apply map to incoming routes\n" | |
fee0f4c6 | 4113 | "Apply map to outbound routes\n" |
4114 | "Apply map to routes going into a Route-Server client's table\n" | |
4115 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 4116 | { |
4117 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4118 | bgp_node_safi (vty), argv[2]); | |
4119 | } | |
6b0655a2 | 4120 | |
718e3744 | 4121 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 4122 | static int |
fd79ac91 | 4123 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4124 | safi_t safi, const char *name_str) | |
718e3744 | 4125 | { |
4126 | int ret; | |
4127 | struct peer *peer; | |
4128 | ||
4129 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4130 | if (! peer) | |
4131 | return CMD_WARNING; | |
4132 | ||
4133 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
4134 | ||
4135 | return bgp_vty_return (vty, ret); | |
4136 | } | |
4137 | ||
4138 | /* Unset route-map from the peer. */ | |
94f2b392 | 4139 | static int |
fd79ac91 | 4140 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 4141 | safi_t safi) |
4142 | { | |
4143 | int ret; | |
4144 | struct peer *peer; | |
4145 | ||
4146 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4147 | if (! peer) | |
4148 | return CMD_WARNING; | |
4149 | ||
4150 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
4151 | ||
4152 | return bgp_vty_return (vty, ret); | |
4153 | } | |
4154 | ||
4155 | DEFUN (neighbor_unsuppress_map, | |
4156 | neighbor_unsuppress_map_cmd, | |
4157 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
4158 | NEIGHBOR_STR | |
4159 | NEIGHBOR_ADDR_STR2 | |
4160 | "Route-map to selectively unsuppress suppressed routes\n" | |
4161 | "Name of route map\n") | |
4162 | { | |
4163 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4164 | bgp_node_safi (vty), argv[1]); | |
4165 | } | |
4166 | ||
4167 | DEFUN (no_neighbor_unsuppress_map, | |
4168 | no_neighbor_unsuppress_map_cmd, | |
4169 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
4170 | NO_STR | |
4171 | NEIGHBOR_STR | |
4172 | NEIGHBOR_ADDR_STR2 | |
4173 | "Route-map to selectively unsuppress suppressed routes\n" | |
4174 | "Name of route map\n") | |
4175 | { | |
4176 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4177 | bgp_node_safi (vty)); | |
4178 | } | |
6b0655a2 | 4179 | |
94f2b392 | 4180 | static int |
fd79ac91 | 4181 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4182 | safi_t safi, const char *num_str, | |
0a486e5f | 4183 | const char *threshold_str, int warning, |
4184 | const char *restart_str) | |
718e3744 | 4185 | { |
4186 | int ret; | |
4187 | struct peer *peer; | |
4188 | u_int32_t max; | |
e0701b79 | 4189 | u_char threshold; |
0a486e5f | 4190 | u_int16_t restart; |
718e3744 | 4191 | |
4192 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4193 | if (! peer) | |
4194 | return CMD_WARNING; | |
4195 | ||
e6ec1c36 | 4196 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 4197 | if (threshold_str) |
4198 | threshold = atoi (threshold_str); | |
4199 | else | |
4200 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 4201 | |
0a486e5f | 4202 | if (restart_str) |
4203 | restart = atoi (restart_str); | |
4204 | else | |
4205 | restart = 0; | |
4206 | ||
4207 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 4208 | |
4209 | return bgp_vty_return (vty, ret); | |
4210 | } | |
4211 | ||
94f2b392 | 4212 | static int |
fd79ac91 | 4213 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 4214 | safi_t safi) |
4215 | { | |
4216 | int ret; | |
4217 | struct peer *peer; | |
4218 | ||
4219 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4220 | if (! peer) | |
4221 | return CMD_WARNING; | |
4222 | ||
4223 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
4224 | ||
4225 | return bgp_vty_return (vty, ret); | |
4226 | } | |
4227 | ||
4228 | /* Maximum number of prefix configuration. prefix count is different | |
4229 | for each peer configuration. So this configuration can be set for | |
4230 | each peer configuration. */ | |
4231 | DEFUN (neighbor_maximum_prefix, | |
4232 | neighbor_maximum_prefix_cmd, | |
4233 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
4234 | NEIGHBOR_STR | |
4235 | NEIGHBOR_ADDR_STR2 | |
4236 | "Maximum number of prefix accept from this peer\n" | |
4237 | "maximum no. of prefix limit\n") | |
4238 | { | |
4239 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 4240 | bgp_node_safi (vty), argv[1], NULL, 0, |
4241 | NULL); | |
718e3744 | 4242 | } |
4243 | ||
e0701b79 | 4244 | DEFUN (neighbor_maximum_prefix_threshold, |
4245 | neighbor_maximum_prefix_threshold_cmd, | |
4246 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
4247 | NEIGHBOR_STR | |
4248 | NEIGHBOR_ADDR_STR2 | |
4249 | "Maximum number of prefix accept from this peer\n" | |
4250 | "maximum no. of prefix limit\n" | |
4251 | "Threshold value (%) at which to generate a warning msg\n") | |
4252 | { | |
4253 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 4254 | bgp_node_safi (vty), argv[1], argv[2], 0, |
4255 | NULL); | |
4256 | } | |
e0701b79 | 4257 | |
718e3744 | 4258 | DEFUN (neighbor_maximum_prefix_warning, |
4259 | neighbor_maximum_prefix_warning_cmd, | |
4260 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
4261 | NEIGHBOR_STR | |
4262 | NEIGHBOR_ADDR_STR2 | |
4263 | "Maximum number of prefix accept from this peer\n" | |
4264 | "maximum no. of prefix limit\n" | |
4265 | "Only give warning message when limit is exceeded\n") | |
4266 | { | |
4267 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 4268 | bgp_node_safi (vty), argv[1], NULL, 1, |
4269 | NULL); | |
718e3744 | 4270 | } |
4271 | ||
e0701b79 | 4272 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
4273 | neighbor_maximum_prefix_threshold_warning_cmd, | |
4274 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
4275 | NEIGHBOR_STR | |
4276 | NEIGHBOR_ADDR_STR2 | |
4277 | "Maximum number of prefix accept from this peer\n" | |
4278 | "maximum no. of prefix limit\n" | |
4279 | "Threshold value (%) at which to generate a warning msg\n" | |
4280 | "Only give warning message when limit is exceeded\n") | |
4281 | { | |
4282 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 4283 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
4284 | } | |
4285 | ||
4286 | DEFUN (neighbor_maximum_prefix_restart, | |
4287 | neighbor_maximum_prefix_restart_cmd, | |
4288 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
4289 | NEIGHBOR_STR | |
4290 | NEIGHBOR_ADDR_STR2 | |
4291 | "Maximum number of prefix accept from this peer\n" | |
4292 | "maximum no. of prefix limit\n" | |
4293 | "Restart bgp connection after limit is exceeded\n" | |
4294 | "Restart interval in minutes") | |
4295 | { | |
4296 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4297 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
4298 | } | |
4299 | ||
4300 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
4301 | neighbor_maximum_prefix_threshold_restart_cmd, | |
4302 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
4303 | NEIGHBOR_STR | |
4304 | NEIGHBOR_ADDR_STR2 | |
4305 | "Maximum number of prefix accept from this peer\n" | |
4306 | "maximum no. of prefix limit\n" | |
4307 | "Threshold value (%) at which to generate a warning msg\n" | |
4308 | "Restart bgp connection after limit is exceeded\n" | |
4309 | "Restart interval in minutes") | |
4310 | { | |
4311 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4312 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
4313 | } | |
e0701b79 | 4314 | |
718e3744 | 4315 | DEFUN (no_neighbor_maximum_prefix, |
4316 | no_neighbor_maximum_prefix_cmd, | |
4317 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
4318 | NO_STR | |
4319 | NEIGHBOR_STR | |
4320 | NEIGHBOR_ADDR_STR2 | |
4321 | "Maximum number of prefix accept from this peer\n") | |
4322 | { | |
4323 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4324 | bgp_node_safi (vty)); | |
4325 | } | |
4326 | ||
4327 | ALIAS (no_neighbor_maximum_prefix, | |
4328 | no_neighbor_maximum_prefix_val_cmd, | |
4329 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
4330 | NO_STR | |
4331 | NEIGHBOR_STR | |
4332 | NEIGHBOR_ADDR_STR2 | |
4333 | "Maximum number of prefix accept from this peer\n" | |
4334 | "maximum no. of prefix limit\n") | |
4335 | ||
4336 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 4337 | no_neighbor_maximum_prefix_threshold_cmd, |
4338 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
4339 | NO_STR | |
4340 | NEIGHBOR_STR | |
4341 | NEIGHBOR_ADDR_STR2 | |
4342 | "Maximum number of prefix accept from this peer\n" | |
4343 | "maximum no. of prefix limit\n" | |
4344 | "Threshold value (%) at which to generate a warning msg\n") | |
4345 | ||
4346 | ALIAS (no_neighbor_maximum_prefix, | |
4347 | no_neighbor_maximum_prefix_warning_cmd, | |
4348 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
4349 | NO_STR | |
4350 | NEIGHBOR_STR | |
4351 | NEIGHBOR_ADDR_STR2 | |
4352 | "Maximum number of prefix accept from this peer\n" | |
4353 | "maximum no. of prefix limit\n" | |
e8e1946e | 4354 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 4355 | |
4356 | ALIAS (no_neighbor_maximum_prefix, | |
4357 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 4358 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
4359 | NO_STR | |
4360 | NEIGHBOR_STR | |
4361 | NEIGHBOR_ADDR_STR2 | |
4362 | "Maximum number of prefix accept from this peer\n" | |
4363 | "maximum no. of prefix limit\n" | |
4364 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 4365 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 4366 | |
4367 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 4368 | no_neighbor_maximum_prefix_restart_cmd, |
4369 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 4370 | NO_STR |
4371 | NEIGHBOR_STR | |
4372 | NEIGHBOR_ADDR_STR2 | |
4373 | "Maximum number of prefix accept from this peer\n" | |
4374 | "maximum no. of prefix limit\n" | |
0a486e5f | 4375 | "Restart bgp connection after limit is exceeded\n" |
4376 | "Restart interval in minutes") | |
4377 | ||
4378 | ALIAS (no_neighbor_maximum_prefix, | |
4379 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
4380 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
4381 | NO_STR | |
4382 | NEIGHBOR_STR | |
4383 | NEIGHBOR_ADDR_STR2 | |
4384 | "Maximum number of prefix accept from this peer\n" | |
4385 | "maximum no. of prefix limit\n" | |
4386 | "Threshold value (%) at which to generate a warning msg\n" | |
4387 | "Restart bgp connection after limit is exceeded\n" | |
4388 | "Restart interval in minutes") | |
6b0655a2 | 4389 | |
718e3744 | 4390 | /* "neighbor allowas-in" */ |
4391 | DEFUN (neighbor_allowas_in, | |
4392 | neighbor_allowas_in_cmd, | |
4393 | NEIGHBOR_CMD2 "allowas-in", | |
4394 | NEIGHBOR_STR | |
4395 | NEIGHBOR_ADDR_STR2 | |
4396 | "Accept as-path with my AS present in it\n") | |
4397 | { | |
4398 | int ret; | |
4399 | struct peer *peer; | |
fd79ac91 | 4400 | unsigned int allow_num; |
718e3744 | 4401 | |
4402 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4403 | if (! peer) | |
4404 | return CMD_WARNING; | |
4405 | ||
4406 | if (argc == 1) | |
4407 | allow_num = 3; | |
4408 | else | |
4409 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
4410 | ||
4411 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
4412 | allow_num); | |
4413 | ||
4414 | return bgp_vty_return (vty, ret); | |
4415 | } | |
4416 | ||
4417 | ALIAS (neighbor_allowas_in, | |
4418 | neighbor_allowas_in_arg_cmd, | |
4419 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
4420 | NEIGHBOR_STR | |
4421 | NEIGHBOR_ADDR_STR2 | |
4422 | "Accept as-path with my AS present in it\n" | |
4423 | "Number of occurances of AS number\n") | |
4424 | ||
4425 | DEFUN (no_neighbor_allowas_in, | |
4426 | no_neighbor_allowas_in_cmd, | |
4427 | NO_NEIGHBOR_CMD2 "allowas-in", | |
4428 | NO_STR | |
4429 | NEIGHBOR_STR | |
4430 | NEIGHBOR_ADDR_STR2 | |
4431 | "allow local ASN appears in aspath attribute\n") | |
4432 | { | |
4433 | int ret; | |
4434 | struct peer *peer; | |
4435 | ||
4436 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4437 | if (! peer) | |
4438 | return CMD_WARNING; | |
4439 | ||
4440 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
4441 | ||
4442 | return bgp_vty_return (vty, ret); | |
4443 | } | |
6b0655a2 | 4444 | |
fa411a21 NH |
4445 | DEFUN (neighbor_ttl_security, |
4446 | neighbor_ttl_security_cmd, | |
4447 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
4448 | NEIGHBOR_STR | |
4449 | NEIGHBOR_ADDR_STR2 | |
4450 | "Specify the maximum number of hops to the BGP peer\n") | |
4451 | { | |
4452 | struct peer *peer; | |
89b6d1f8 | 4453 | int gtsm_hops; |
fa411a21 NH |
4454 | |
4455 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4456 | if (! peer) | |
4457 | return CMD_WARNING; | |
4458 | ||
4459 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); | |
4460 | ||
89b6d1f8 | 4461 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
4462 | } |
4463 | ||
4464 | DEFUN (no_neighbor_ttl_security, | |
4465 | no_neighbor_ttl_security_cmd, | |
4466 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
4467 | NO_STR | |
4468 | NEIGHBOR_STR | |
4469 | NEIGHBOR_ADDR_STR2 | |
4470 | "Specify the maximum number of hops to the BGP peer\n") | |
4471 | { | |
4472 | struct peer *peer; | |
fa411a21 NH |
4473 | |
4474 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4475 | if (! peer) | |
4476 | return CMD_WARNING; | |
4477 | ||
89b6d1f8 | 4478 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 4479 | } |
6b0655a2 | 4480 | |
718e3744 | 4481 | /* Address family configuration. */ |
4482 | DEFUN (address_family_ipv4, | |
4483 | address_family_ipv4_cmd, | |
4484 | "address-family ipv4", | |
4485 | "Enter Address Family command mode\n" | |
4486 | "Address family\n") | |
4487 | { | |
4488 | vty->node = BGP_IPV4_NODE; | |
4489 | return CMD_SUCCESS; | |
4490 | } | |
4491 | ||
4492 | DEFUN (address_family_ipv4_safi, | |
4493 | address_family_ipv4_safi_cmd, | |
4494 | "address-family ipv4 (unicast|multicast)", | |
4495 | "Enter Address Family command mode\n" | |
4496 | "Address family\n" | |
4497 | "Address Family modifier\n" | |
4498 | "Address Family modifier\n") | |
4499 | { | |
4500 | if (strncmp (argv[0], "m", 1) == 0) | |
4501 | vty->node = BGP_IPV4M_NODE; | |
4502 | else | |
4503 | vty->node = BGP_IPV4_NODE; | |
4504 | ||
4505 | return CMD_SUCCESS; | |
4506 | } | |
4507 | ||
25ffbdc1 | 4508 | DEFUN (address_family_ipv6, |
4509 | address_family_ipv6_cmd, | |
4510 | "address-family ipv6", | |
718e3744 | 4511 | "Enter Address Family command mode\n" |
25ffbdc1 | 4512 | "Address family\n") |
718e3744 | 4513 | { |
4514 | vty->node = BGP_IPV6_NODE; | |
4515 | return CMD_SUCCESS; | |
4516 | } | |
4517 | ||
25ffbdc1 | 4518 | DEFUN (address_family_ipv6_safi, |
4519 | address_family_ipv6_safi_cmd, | |
4520 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 4521 | "Enter Address Family command mode\n" |
25ffbdc1 | 4522 | "Address family\n" |
4523 | "Address Family modifier\n" | |
4524 | "Address Family modifier\n") | |
4525 | { | |
4526 | if (strncmp (argv[0], "m", 1) == 0) | |
4527 | vty->node = BGP_IPV6M_NODE; | |
4528 | else | |
4529 | vty->node = BGP_IPV6_NODE; | |
4530 | ||
4531 | return CMD_SUCCESS; | |
4532 | } | |
718e3744 | 4533 | |
4534 | DEFUN (address_family_vpnv4, | |
4535 | address_family_vpnv4_cmd, | |
4536 | "address-family vpnv4", | |
4537 | "Enter Address Family command mode\n" | |
4538 | "Address family\n") | |
4539 | { | |
4540 | vty->node = BGP_VPNV4_NODE; | |
4541 | return CMD_SUCCESS; | |
4542 | } | |
4543 | ||
4544 | ALIAS (address_family_vpnv4, | |
4545 | address_family_vpnv4_unicast_cmd, | |
4546 | "address-family vpnv4 unicast", | |
4547 | "Enter Address Family command mode\n" | |
4548 | "Address family\n" | |
4549 | "Address Family Modifier\n") | |
4550 | ||
4551 | DEFUN (exit_address_family, | |
4552 | exit_address_family_cmd, | |
4553 | "exit-address-family", | |
4554 | "Exit from Address Family configuration mode\n") | |
4555 | { | |
a8a80d53 | 4556 | if (vty->node == BGP_IPV4_NODE |
4557 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 4558 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 4559 | || vty->node == BGP_IPV6_NODE |
4560 | || vty->node == BGP_IPV6M_NODE) | |
718e3744 | 4561 | vty->node = BGP_NODE; |
4562 | return CMD_SUCCESS; | |
4563 | } | |
6b0655a2 | 4564 | |
718e3744 | 4565 | /* BGP clear sort. */ |
4566 | enum clear_sort | |
4567 | { | |
4568 | clear_all, | |
4569 | clear_peer, | |
4570 | clear_group, | |
4571 | clear_external, | |
4572 | clear_as | |
4573 | }; | |
4574 | ||
94f2b392 | 4575 | static void |
718e3744 | 4576 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
4577 | safi_t safi, int error) | |
4578 | { | |
4579 | switch (error) | |
4580 | { | |
4581 | case BGP_ERR_AF_UNCONFIGURED: | |
4582 | vty_out (vty, | |
4583 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
4584 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
4585 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
4586 | peer->host, VTY_NEWLINE); | |
4587 | break; | |
4588 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
4589 | 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); | |
4590 | break; | |
4591 | default: | |
4592 | break; | |
4593 | } | |
4594 | } | |
4595 | ||
4596 | /* `clear ip bgp' functions. */ | |
94f2b392 | 4597 | static int |
718e3744 | 4598 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, |
fd79ac91 | 4599 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
718e3744 | 4600 | { |
4601 | int ret; | |
4602 | struct peer *peer; | |
1eb8ef25 | 4603 | struct listnode *node, *nnode; |
718e3744 | 4604 | |
4605 | /* Clear all neighbors. */ | |
1ff9a340 DS |
4606 | /* |
4607 | * Pass along pointer to next node to peer_clear() when walking all nodes | |
4608 | * on the BGP instance as that may get freed if it is a doppelganger | |
4609 | */ | |
718e3744 | 4610 | if (sort == clear_all) |
4611 | { | |
1eb8ef25 | 4612 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 4613 | { |
4614 | if (stype == BGP_CLEAR_SOFT_NONE) | |
1ff9a340 | 4615 | ret = peer_clear (peer, &nnode); |
718e3744 | 4616 | else |
4617 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4618 | ||
4619 | if (ret < 0) | |
4620 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4621 | } | |
f188f2c4 DS |
4622 | |
4623 | /* This is to apply read-only mode on this clear. */ | |
4624 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4625 | bgp->update_delay_over = 0; | |
4626 | ||
0b2aa3a0 | 4627 | return CMD_SUCCESS; |
718e3744 | 4628 | } |
4629 | ||
4630 | /* Clear specified neighbors. */ | |
4631 | if (sort == clear_peer) | |
4632 | { | |
4633 | union sockunion su; | |
4634 | int ret; | |
4635 | ||
4636 | /* Make sockunion for lookup. */ | |
4637 | ret = str2sockunion (arg, &su); | |
4638 | if (ret < 0) | |
a80beece DS |
4639 | { |
4640 | peer = peer_lookup_by_conf_if (bgp, arg); | |
4641 | if (!peer) | |
4642 | { | |
4643 | vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE); | |
4644 | return CMD_WARNING; | |
4645 | } | |
4646 | } | |
4647 | else | |
4648 | { | |
4649 | peer = peer_lookup (bgp, &su); | |
4650 | if (! peer) | |
4651 | { | |
4652 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
4653 | return CMD_WARNING; | |
4654 | } | |
4655 | } | |
718e3744 | 4656 | |
4657 | if (stype == BGP_CLEAR_SOFT_NONE) | |
1ff9a340 | 4658 | ret = peer_clear (peer, NULL); |
718e3744 | 4659 | else |
4660 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4661 | ||
4662 | if (ret < 0) | |
4663 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4664 | ||
0b2aa3a0 | 4665 | return CMD_SUCCESS; |
718e3744 | 4666 | } |
4667 | ||
4668 | /* Clear all peer-group members. */ | |
4669 | if (sort == clear_group) | |
4670 | { | |
4671 | struct peer_group *group; | |
4672 | ||
4673 | group = peer_group_lookup (bgp, arg); | |
4674 | if (! group) | |
4675 | { | |
4676 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
0b2aa3a0 | 4677 | return CMD_WARNING; |
718e3744 | 4678 | } |
4679 | ||
1eb8ef25 | 4680 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
718e3744 | 4681 | { |
4682 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4683 | { | |
1ff9a340 | 4684 | ret = peer_clear (peer, NULL); |
718e3744 | 4685 | continue; |
4686 | } | |
4687 | ||
4688 | if (! peer->af_group[afi][safi]) | |
4689 | continue; | |
4690 | ||
4691 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4692 | ||
4693 | if (ret < 0) | |
4694 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4695 | } | |
0b2aa3a0 | 4696 | return CMD_SUCCESS; |
718e3744 | 4697 | } |
4698 | ||
4699 | if (sort == clear_external) | |
4700 | { | |
1eb8ef25 | 4701 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 4702 | { |
6d85b15b | 4703 | if (peer->sort == BGP_PEER_IBGP) |
718e3744 | 4704 | continue; |
4705 | ||
4706 | if (stype == BGP_CLEAR_SOFT_NONE) | |
1ff9a340 | 4707 | ret = peer_clear (peer, &nnode); |
718e3744 | 4708 | else |
4709 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4710 | ||
4711 | if (ret < 0) | |
4712 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4713 | } | |
0b2aa3a0 | 4714 | return CMD_SUCCESS; |
718e3744 | 4715 | } |
4716 | ||
4717 | if (sort == clear_as) | |
4718 | { | |
4719 | as_t as; | |
718e3744 | 4720 | int find = 0; |
4721 | ||
bde12e3f | 4722 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); |
0b2aa3a0 | 4723 | |
1eb8ef25 | 4724 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 4725 | { |
4726 | if (peer->as != as) | |
4727 | continue; | |
4728 | ||
4729 | find = 1; | |
4730 | if (stype == BGP_CLEAR_SOFT_NONE) | |
1ff9a340 | 4731 | ret = peer_clear (peer, &nnode); |
718e3744 | 4732 | else |
4733 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4734 | ||
4735 | if (ret < 0) | |
4736 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4737 | } | |
4738 | if (! find) | |
4739 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
4740 | VTY_NEWLINE); | |
0b2aa3a0 | 4741 | return CMD_SUCCESS; |
718e3744 | 4742 | } |
4743 | ||
0b2aa3a0 | 4744 | return CMD_SUCCESS; |
718e3744 | 4745 | } |
4746 | ||
94f2b392 | 4747 | static int |
fd79ac91 | 4748 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
4749 | enum clear_sort sort, enum bgp_clear_type stype, | |
4750 | const char *arg) | |
718e3744 | 4751 | { |
718e3744 | 4752 | struct bgp *bgp; |
4753 | ||
4754 | /* BGP structure lookup. */ | |
4755 | if (name) | |
4756 | { | |
4757 | bgp = bgp_lookup_by_name (name); | |
4758 | if (bgp == NULL) | |
4759 | { | |
4760 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); | |
4761 | return CMD_WARNING; | |
4762 | } | |
4763 | } | |
4764 | else | |
4765 | { | |
4766 | bgp = bgp_get_default (); | |
4767 | if (bgp == NULL) | |
4768 | { | |
4769 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
4770 | return CMD_WARNING; | |
4771 | } | |
4772 | } | |
4773 | ||
0b2aa3a0 | 4774 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
718e3744 | 4775 | } |
4776 | ||
4777 | DEFUN (clear_ip_bgp_all, | |
4778 | clear_ip_bgp_all_cmd, | |
4779 | "clear ip bgp *", | |
4780 | CLEAR_STR | |
4781 | IP_STR | |
4782 | BGP_STR | |
4783 | "Clear all peers\n") | |
4784 | { | |
4785 | if (argc == 1) | |
4786 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
4787 | ||
4788 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
4789 | } | |
4790 | ||
4791 | ALIAS (clear_ip_bgp_all, | |
4792 | clear_bgp_all_cmd, | |
4793 | "clear bgp *", | |
4794 | CLEAR_STR | |
4795 | BGP_STR | |
4796 | "Clear all peers\n") | |
4797 | ||
4798 | ALIAS (clear_ip_bgp_all, | |
4799 | clear_bgp_ipv6_all_cmd, | |
4800 | "clear bgp ipv6 *", | |
4801 | CLEAR_STR | |
4802 | BGP_STR | |
4803 | "Address family\n" | |
4804 | "Clear all peers\n") | |
4805 | ||
4806 | ALIAS (clear_ip_bgp_all, | |
4807 | clear_ip_bgp_instance_all_cmd, | |
4808 | "clear ip bgp view WORD *", | |
4809 | CLEAR_STR | |
4810 | IP_STR | |
4811 | BGP_STR | |
4812 | "BGP view\n" | |
4813 | "view name\n" | |
4814 | "Clear all peers\n") | |
4815 | ||
4816 | ALIAS (clear_ip_bgp_all, | |
4817 | clear_bgp_instance_all_cmd, | |
4818 | "clear bgp view WORD *", | |
4819 | CLEAR_STR | |
4820 | BGP_STR | |
4821 | "BGP view\n" | |
4822 | "view name\n" | |
4823 | "Clear all peers\n") | |
4824 | ||
4825 | DEFUN (clear_ip_bgp_peer, | |
4826 | clear_ip_bgp_peer_cmd, | |
a80beece | 4827 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 4828 | CLEAR_STR |
4829 | IP_STR | |
4830 | BGP_STR | |
4831 | "BGP neighbor IP address to clear\n" | |
a80beece DS |
4832 | "BGP IPv6 neighbor to clear\n" |
4833 | "BGP neighbor on interface to clear\n") | |
718e3744 | 4834 | { |
4835 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); | |
4836 | } | |
4837 | ||
4838 | ALIAS (clear_ip_bgp_peer, | |
4839 | clear_bgp_peer_cmd, | |
a80beece | 4840 | "clear bgp (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 4841 | CLEAR_STR |
4842 | BGP_STR | |
4843 | "BGP neighbor address to clear\n" | |
a80beece DS |
4844 | "BGP IPv6 neighbor to clear\n" |
4845 | "BGP neighbor on interface to clear\n") | |
718e3744 | 4846 | |
4847 | ALIAS (clear_ip_bgp_peer, | |
4848 | clear_bgp_ipv6_peer_cmd, | |
a80beece | 4849 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 4850 | CLEAR_STR |
4851 | BGP_STR | |
4852 | "Address family\n" | |
4853 | "BGP neighbor address to clear\n" | |
a80beece DS |
4854 | "BGP IPv6 neighbor to clear\n" |
4855 | "BGP neighbor on interface to clear\n") | |
718e3744 | 4856 | |
4857 | DEFUN (clear_ip_bgp_peer_group, | |
4858 | clear_ip_bgp_peer_group_cmd, | |
4859 | "clear ip bgp peer-group WORD", | |
4860 | CLEAR_STR | |
4861 | IP_STR | |
4862 | BGP_STR | |
4863 | "Clear all members of peer-group\n" | |
4864 | "BGP peer-group name\n") | |
4865 | { | |
4866 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); | |
4867 | } | |
4868 | ||
4869 | ALIAS (clear_ip_bgp_peer_group, | |
4870 | clear_bgp_peer_group_cmd, | |
4871 | "clear bgp peer-group WORD", | |
4872 | CLEAR_STR | |
4873 | BGP_STR | |
4874 | "Clear all members of peer-group\n" | |
4875 | "BGP peer-group name\n") | |
4876 | ||
4877 | ALIAS (clear_ip_bgp_peer_group, | |
4878 | clear_bgp_ipv6_peer_group_cmd, | |
4879 | "clear bgp ipv6 peer-group WORD", | |
4880 | CLEAR_STR | |
4881 | BGP_STR | |
4882 | "Address family\n" | |
4883 | "Clear all members of peer-group\n" | |
4884 | "BGP peer-group name\n") | |
4885 | ||
4886 | DEFUN (clear_ip_bgp_external, | |
4887 | clear_ip_bgp_external_cmd, | |
4888 | "clear ip bgp external", | |
4889 | CLEAR_STR | |
4890 | IP_STR | |
4891 | BGP_STR | |
4892 | "Clear all external peers\n") | |
4893 | { | |
4894 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
4895 | } | |
4896 | ||
4897 | ALIAS (clear_ip_bgp_external, | |
4898 | clear_bgp_external_cmd, | |
4899 | "clear bgp external", | |
4900 | CLEAR_STR | |
4901 | BGP_STR | |
4902 | "Clear all external peers\n") | |
4903 | ||
4904 | ALIAS (clear_ip_bgp_external, | |
4905 | clear_bgp_ipv6_external_cmd, | |
4906 | "clear bgp ipv6 external", | |
4907 | CLEAR_STR | |
4908 | BGP_STR | |
4909 | "Address family\n" | |
4910 | "Clear all external peers\n") | |
4911 | ||
4912 | DEFUN (clear_ip_bgp_as, | |
4913 | clear_ip_bgp_as_cmd, | |
320da874 | 4914 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 4915 | CLEAR_STR |
4916 | IP_STR | |
4917 | BGP_STR | |
4918 | "Clear peers with the AS number\n") | |
4919 | { | |
4920 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); | |
4921 | } | |
4922 | ||
4923 | ALIAS (clear_ip_bgp_as, | |
4924 | clear_bgp_as_cmd, | |
320da874 | 4925 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 4926 | CLEAR_STR |
4927 | BGP_STR | |
4928 | "Clear peers with the AS number\n") | |
4929 | ||
4930 | ALIAS (clear_ip_bgp_as, | |
4931 | clear_bgp_ipv6_as_cmd, | |
320da874 | 4932 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 4933 | CLEAR_STR |
4934 | BGP_STR | |
4935 | "Address family\n" | |
4936 | "Clear peers with the AS number\n") | |
6b0655a2 | 4937 | |
718e3744 | 4938 | /* Outbound soft-reconfiguration */ |
4939 | DEFUN (clear_ip_bgp_all_soft_out, | |
4940 | clear_ip_bgp_all_soft_out_cmd, | |
4941 | "clear ip bgp * soft out", | |
4942 | CLEAR_STR | |
4943 | IP_STR | |
4944 | BGP_STR | |
4945 | "Clear all peers\n" | |
4946 | "Soft reconfig\n" | |
4947 | "Soft reconfig outbound update\n") | |
4948 | { | |
4949 | if (argc == 1) | |
4950 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
4951 | BGP_CLEAR_SOFT_OUT, NULL); | |
4952 | ||
4953 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
4954 | BGP_CLEAR_SOFT_OUT, NULL); | |
4955 | } | |
4956 | ||
4957 | ALIAS (clear_ip_bgp_all_soft_out, | |
4958 | clear_ip_bgp_all_out_cmd, | |
4959 | "clear ip bgp * out", | |
4960 | CLEAR_STR | |
4961 | IP_STR | |
4962 | BGP_STR | |
4963 | "Clear all peers\n" | |
4964 | "Soft reconfig outbound update\n") | |
4965 | ||
4966 | ALIAS (clear_ip_bgp_all_soft_out, | |
4967 | clear_ip_bgp_instance_all_soft_out_cmd, | |
4968 | "clear ip bgp view WORD * soft out", | |
4969 | CLEAR_STR | |
4970 | IP_STR | |
4971 | BGP_STR | |
4972 | "BGP view\n" | |
4973 | "view name\n" | |
4974 | "Clear all peers\n" | |
4975 | "Soft reconfig\n" | |
4976 | "Soft reconfig outbound update\n") | |
4977 | ||
4978 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
4979 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
4980 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
4981 | CLEAR_STR | |
4982 | IP_STR | |
4983 | BGP_STR | |
4984 | "Clear all peers\n" | |
4985 | "Address family\n" | |
4986 | "Address Family modifier\n" | |
4987 | "Address Family modifier\n" | |
4988 | "Soft reconfig\n" | |
4989 | "Soft reconfig outbound update\n") | |
4990 | { | |
4991 | if (strncmp (argv[0], "m", 1) == 0) | |
4992 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
4993 | BGP_CLEAR_SOFT_OUT, NULL); | |
4994 | ||
4995 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
4996 | BGP_CLEAR_SOFT_OUT, NULL); | |
4997 | } | |
4998 | ||
4999 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, | |
5000 | clear_ip_bgp_all_ipv4_out_cmd, | |
5001 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
5002 | CLEAR_STR | |
5003 | IP_STR | |
5004 | BGP_STR | |
5005 | "Clear all peers\n" | |
5006 | "Address family\n" | |
5007 | "Address Family modifier\n" | |
5008 | "Address Family modifier\n" | |
5009 | "Soft reconfig outbound update\n") | |
5010 | ||
5011 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, | |
5012 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
5013 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", | |
5014 | CLEAR_STR | |
5015 | IP_STR | |
5016 | BGP_STR | |
5017 | "BGP view\n" | |
5018 | "view name\n" | |
5019 | "Clear all peers\n" | |
5020 | "Address family\n" | |
5021 | "Address Family modifier\n" | |
5022 | "Address Family modifier\n" | |
5023 | "Soft reconfig outbound update\n") | |
5024 | { | |
5025 | if (strncmp (argv[1], "m", 1) == 0) | |
5026 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
5027 | BGP_CLEAR_SOFT_OUT, NULL); | |
5028 | ||
5029 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5030 | BGP_CLEAR_SOFT_OUT, NULL); | |
5031 | } | |
5032 | ||
5033 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
5034 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
5035 | "clear ip bgp * vpnv4 unicast soft out", | |
5036 | CLEAR_STR | |
5037 | IP_STR | |
5038 | BGP_STR | |
5039 | "Clear all peers\n" | |
5040 | "Address family\n" | |
5041 | "Address Family Modifier\n" | |
5042 | "Soft reconfig\n" | |
5043 | "Soft reconfig outbound update\n") | |
5044 | { | |
5045 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
5046 | BGP_CLEAR_SOFT_OUT, NULL); | |
5047 | } | |
5048 | ||
5049 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
5050 | clear_ip_bgp_all_vpnv4_out_cmd, | |
5051 | "clear ip bgp * vpnv4 unicast out", | |
5052 | CLEAR_STR | |
5053 | IP_STR | |
5054 | BGP_STR | |
5055 | "Clear all peers\n" | |
5056 | "Address family\n" | |
5057 | "Address Family Modifier\n" | |
5058 | "Soft reconfig outbound update\n") | |
5059 | ||
5060 | DEFUN (clear_bgp_all_soft_out, | |
5061 | clear_bgp_all_soft_out_cmd, | |
5062 | "clear bgp * soft out", | |
5063 | CLEAR_STR | |
5064 | BGP_STR | |
5065 | "Clear all peers\n" | |
5066 | "Soft reconfig\n" | |
5067 | "Soft reconfig outbound update\n") | |
5068 | { | |
5069 | if (argc == 1) | |
5070 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
5071 | BGP_CLEAR_SOFT_OUT, NULL); | |
5072 | ||
5073 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
5074 | BGP_CLEAR_SOFT_OUT, NULL); | |
5075 | } | |
5076 | ||
5077 | ALIAS (clear_bgp_all_soft_out, | |
5078 | clear_bgp_instance_all_soft_out_cmd, | |
5079 | "clear bgp view WORD * soft out", | |
5080 | CLEAR_STR | |
5081 | BGP_STR | |
5082 | "BGP view\n" | |
5083 | "view name\n" | |
5084 | "Clear all peers\n" | |
5085 | "Soft reconfig\n" | |
5086 | "Soft reconfig outbound update\n") | |
5087 | ||
5088 | ALIAS (clear_bgp_all_soft_out, | |
5089 | clear_bgp_all_out_cmd, | |
5090 | "clear bgp * out", | |
5091 | CLEAR_STR | |
5092 | BGP_STR | |
5093 | "Clear all peers\n" | |
5094 | "Soft reconfig outbound update\n") | |
5095 | ||
5096 | ALIAS (clear_bgp_all_soft_out, | |
5097 | clear_bgp_ipv6_all_soft_out_cmd, | |
5098 | "clear bgp ipv6 * soft out", | |
5099 | CLEAR_STR | |
5100 | BGP_STR | |
5101 | "Address family\n" | |
5102 | "Clear all peers\n" | |
5103 | "Soft reconfig\n" | |
5104 | "Soft reconfig outbound update\n") | |
5105 | ||
5106 | ALIAS (clear_bgp_all_soft_out, | |
5107 | clear_bgp_ipv6_all_out_cmd, | |
5108 | "clear bgp ipv6 * out", | |
5109 | CLEAR_STR | |
5110 | BGP_STR | |
5111 | "Address family\n" | |
5112 | "Clear all peers\n" | |
5113 | "Soft reconfig outbound update\n") | |
5114 | ||
5115 | DEFUN (clear_ip_bgp_peer_soft_out, | |
5116 | clear_ip_bgp_peer_soft_out_cmd, | |
5117 | "clear ip bgp A.B.C.D soft out", | |
5118 | CLEAR_STR | |
5119 | IP_STR | |
5120 | BGP_STR | |
5121 | "BGP neighbor address to clear\n" | |
5122 | "Soft reconfig\n" | |
5123 | "Soft reconfig outbound update\n") | |
5124 | { | |
5125 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5126 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5127 | } | |
5128 | ||
5129 | ALIAS (clear_ip_bgp_peer_soft_out, | |
5130 | clear_ip_bgp_peer_out_cmd, | |
5131 | "clear ip bgp A.B.C.D out", | |
5132 | CLEAR_STR | |
5133 | IP_STR | |
5134 | BGP_STR | |
5135 | "BGP neighbor address to clear\n" | |
5136 | "Soft reconfig outbound update\n") | |
5137 | ||
5138 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, | |
5139 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
5140 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", | |
5141 | CLEAR_STR | |
5142 | IP_STR | |
5143 | BGP_STR | |
5144 | "BGP neighbor address to clear\n" | |
5145 | "Address family\n" | |
5146 | "Address Family modifier\n" | |
5147 | "Address Family modifier\n" | |
5148 | "Soft reconfig\n" | |
5149 | "Soft reconfig outbound update\n") | |
5150 | { | |
5151 | if (strncmp (argv[1], "m", 1) == 0) | |
5152 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
5153 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5154 | ||
5155 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5156 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5157 | } | |
5158 | ||
5159 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, | |
5160 | clear_ip_bgp_peer_ipv4_out_cmd, | |
5161 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", | |
5162 | CLEAR_STR | |
5163 | IP_STR | |
5164 | BGP_STR | |
5165 | "BGP neighbor address to clear\n" | |
5166 | "Address family\n" | |
5167 | "Address Family modifier\n" | |
5168 | "Address Family modifier\n" | |
5169 | "Soft reconfig outbound update\n") | |
5170 | ||
5171 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, | |
5172 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
5173 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", | |
5174 | CLEAR_STR | |
5175 | IP_STR | |
5176 | BGP_STR | |
5177 | "BGP neighbor address to clear\n" | |
5178 | "Address family\n" | |
5179 | "Address Family Modifier\n" | |
5180 | "Soft reconfig\n" | |
5181 | "Soft reconfig outbound update\n") | |
5182 | { | |
5183 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
5184 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5185 | } | |
5186 | ||
5187 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
5188 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
5189 | "clear ip bgp A.B.C.D vpnv4 unicast out", | |
5190 | CLEAR_STR | |
5191 | IP_STR | |
5192 | BGP_STR | |
5193 | "BGP neighbor address to clear\n" | |
5194 | "Address family\n" | |
5195 | "Address Family Modifier\n" | |
5196 | "Soft reconfig outbound update\n") | |
5197 | ||
5198 | DEFUN (clear_bgp_peer_soft_out, | |
5199 | clear_bgp_peer_soft_out_cmd, | |
a80beece | 5200 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 5201 | CLEAR_STR |
5202 | BGP_STR | |
5203 | "BGP neighbor address to clear\n" | |
5204 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 5205 | "BGP neighbor on interface to clear\n" |
718e3744 | 5206 | "Soft reconfig\n" |
5207 | "Soft reconfig outbound update\n") | |
5208 | { | |
5209 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
5210 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5211 | } | |
5212 | ||
5213 | ALIAS (clear_bgp_peer_soft_out, | |
5214 | clear_bgp_ipv6_peer_soft_out_cmd, | |
a80beece | 5215 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out", |
718e3744 | 5216 | CLEAR_STR |
5217 | BGP_STR | |
5218 | "Address family\n" | |
5219 | "BGP neighbor address to clear\n" | |
5220 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 5221 | "BGP neighbor on interface to clear\n" |
718e3744 | 5222 | "Soft reconfig\n" |
5223 | "Soft reconfig outbound update\n") | |
5224 | ||
5225 | ALIAS (clear_bgp_peer_soft_out, | |
5226 | clear_bgp_peer_out_cmd, | |
a80beece | 5227 | "clear bgp (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 5228 | CLEAR_STR |
5229 | BGP_STR | |
5230 | "BGP neighbor address to clear\n" | |
5231 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 5232 | "BGP neighbor on interface to clear\n" |
718e3744 | 5233 | "Soft reconfig outbound update\n") |
5234 | ||
5235 | ALIAS (clear_bgp_peer_soft_out, | |
5236 | clear_bgp_ipv6_peer_out_cmd, | |
a80beece | 5237 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out", |
718e3744 | 5238 | CLEAR_STR |
5239 | BGP_STR | |
5240 | "Address family\n" | |
5241 | "BGP neighbor address to clear\n" | |
5242 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 5243 | "BGP neighbor on interface to clear\n" |
718e3744 | 5244 | "Soft reconfig outbound update\n") |
5245 | ||
5246 | DEFUN (clear_ip_bgp_peer_group_soft_out, | |
5247 | clear_ip_bgp_peer_group_soft_out_cmd, | |
5248 | "clear ip bgp peer-group WORD soft out", | |
5249 | CLEAR_STR | |
5250 | IP_STR | |
5251 | BGP_STR | |
5252 | "Clear all members of peer-group\n" | |
5253 | "BGP peer-group name\n" | |
5254 | "Soft reconfig\n" | |
5255 | "Soft reconfig outbound update\n") | |
5256 | { | |
5257 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5258 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5259 | } | |
5260 | ||
5261 | ALIAS (clear_ip_bgp_peer_group_soft_out, | |
5262 | clear_ip_bgp_peer_group_out_cmd, | |
5263 | "clear ip bgp peer-group WORD out", | |
5264 | CLEAR_STR | |
5265 | IP_STR | |
5266 | BGP_STR | |
5267 | "Clear all members of peer-group\n" | |
5268 | "BGP peer-group name\n" | |
5269 | "Soft reconfig outbound update\n") | |
5270 | ||
5271 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, | |
5272 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
5273 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
5274 | CLEAR_STR | |
5275 | IP_STR | |
5276 | BGP_STR | |
5277 | "Clear all members of peer-group\n" | |
5278 | "BGP peer-group name\n" | |
5279 | "Address family\n" | |
5280 | "Address Family modifier\n" | |
5281 | "Address Family modifier\n" | |
5282 | "Soft reconfig\n" | |
5283 | "Soft reconfig outbound update\n") | |
5284 | { | |
5285 | if (strncmp (argv[1], "m", 1) == 0) | |
5286 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
5287 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5288 | ||
5289 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5290 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5291 | } | |
5292 | ||
5293 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, | |
5294 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
5295 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
5296 | CLEAR_STR | |
5297 | IP_STR | |
5298 | BGP_STR | |
5299 | "Clear all members of peer-group\n" | |
5300 | "BGP peer-group name\n" | |
5301 | "Address family\n" | |
5302 | "Address Family modifier\n" | |
5303 | "Address Family modifier\n" | |
5304 | "Soft reconfig outbound update\n") | |
5305 | ||
5306 | DEFUN (clear_bgp_peer_group_soft_out, | |
5307 | clear_bgp_peer_group_soft_out_cmd, | |
5308 | "clear bgp peer-group WORD soft out", | |
5309 | CLEAR_STR | |
5310 | BGP_STR | |
5311 | "Clear all members of peer-group\n" | |
5312 | "BGP peer-group name\n" | |
5313 | "Soft reconfig\n" | |
5314 | "Soft reconfig outbound update\n") | |
5315 | { | |
5316 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
5317 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5318 | } | |
5319 | ||
5320 | ALIAS (clear_bgp_peer_group_soft_out, | |
5321 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
5322 | "clear bgp ipv6 peer-group WORD soft out", | |
5323 | CLEAR_STR | |
5324 | BGP_STR | |
5325 | "Address family\n" | |
5326 | "Clear all members of peer-group\n" | |
5327 | "BGP peer-group name\n" | |
5328 | "Soft reconfig\n" | |
5329 | "Soft reconfig outbound update\n") | |
5330 | ||
5331 | ALIAS (clear_bgp_peer_group_soft_out, | |
5332 | clear_bgp_peer_group_out_cmd, | |
5333 | "clear bgp peer-group WORD out", | |
5334 | CLEAR_STR | |
5335 | BGP_STR | |
5336 | "Clear all members of peer-group\n" | |
5337 | "BGP peer-group name\n" | |
5338 | "Soft reconfig outbound update\n") | |
5339 | ||
5340 | ALIAS (clear_bgp_peer_group_soft_out, | |
5341 | clear_bgp_ipv6_peer_group_out_cmd, | |
5342 | "clear bgp ipv6 peer-group WORD out", | |
5343 | CLEAR_STR | |
5344 | BGP_STR | |
5345 | "Address family\n" | |
5346 | "Clear all members of peer-group\n" | |
5347 | "BGP peer-group name\n" | |
5348 | "Soft reconfig outbound update\n") | |
5349 | ||
5350 | DEFUN (clear_ip_bgp_external_soft_out, | |
5351 | clear_ip_bgp_external_soft_out_cmd, | |
5352 | "clear ip bgp external soft out", | |
5353 | CLEAR_STR | |
5354 | IP_STR | |
5355 | BGP_STR | |
5356 | "Clear all external peers\n" | |
5357 | "Soft reconfig\n" | |
5358 | "Soft reconfig outbound update\n") | |
5359 | { | |
5360 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5361 | BGP_CLEAR_SOFT_OUT, NULL); | |
5362 | } | |
5363 | ||
5364 | ALIAS (clear_ip_bgp_external_soft_out, | |
5365 | clear_ip_bgp_external_out_cmd, | |
5366 | "clear ip bgp external out", | |
5367 | CLEAR_STR | |
5368 | IP_STR | |
5369 | BGP_STR | |
5370 | "Clear all external peers\n" | |
5371 | "Soft reconfig outbound update\n") | |
5372 | ||
5373 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
5374 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
5375 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
5376 | CLEAR_STR | |
5377 | IP_STR | |
5378 | BGP_STR | |
5379 | "Clear all external peers\n" | |
5380 | "Address family\n" | |
5381 | "Address Family modifier\n" | |
5382 | "Address Family modifier\n" | |
5383 | "Soft reconfig\n" | |
5384 | "Soft reconfig outbound update\n") | |
5385 | { | |
5386 | if (strncmp (argv[0], "m", 1) == 0) | |
5387 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
5388 | BGP_CLEAR_SOFT_OUT, NULL); | |
5389 | ||
5390 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5391 | BGP_CLEAR_SOFT_OUT, NULL); | |
5392 | } | |
5393 | ||
5394 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, | |
5395 | clear_ip_bgp_external_ipv4_out_cmd, | |
5396 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
5397 | CLEAR_STR | |
5398 | IP_STR | |
5399 | BGP_STR | |
5400 | "Clear all external peers\n" | |
5401 | "Address family\n" | |
5402 | "Address Family modifier\n" | |
5403 | "Address Family modifier\n" | |
5404 | "Soft reconfig outbound update\n") | |
5405 | ||
5406 | DEFUN (clear_bgp_external_soft_out, | |
5407 | clear_bgp_external_soft_out_cmd, | |
5408 | "clear bgp external soft out", | |
5409 | CLEAR_STR | |
5410 | BGP_STR | |
5411 | "Clear all external peers\n" | |
5412 | "Soft reconfig\n" | |
5413 | "Soft reconfig outbound update\n") | |
5414 | { | |
5415 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
5416 | BGP_CLEAR_SOFT_OUT, NULL); | |
5417 | } | |
5418 | ||
5419 | ALIAS (clear_bgp_external_soft_out, | |
5420 | clear_bgp_ipv6_external_soft_out_cmd, | |
5421 | "clear bgp ipv6 external soft out", | |
5422 | CLEAR_STR | |
5423 | BGP_STR | |
5424 | "Address family\n" | |
5425 | "Clear all external peers\n" | |
5426 | "Soft reconfig\n" | |
5427 | "Soft reconfig outbound update\n") | |
5428 | ||
5429 | ALIAS (clear_bgp_external_soft_out, | |
5430 | clear_bgp_external_out_cmd, | |
5431 | "clear bgp external out", | |
5432 | CLEAR_STR | |
5433 | BGP_STR | |
5434 | "Clear all external peers\n" | |
5435 | "Soft reconfig outbound update\n") | |
5436 | ||
5437 | ALIAS (clear_bgp_external_soft_out, | |
5438 | clear_bgp_ipv6_external_out_cmd, | |
5439 | "clear bgp ipv6 external WORD out", | |
5440 | CLEAR_STR | |
5441 | BGP_STR | |
5442 | "Address family\n" | |
5443 | "Clear all external peers\n" | |
5444 | "Soft reconfig outbound update\n") | |
5445 | ||
5446 | DEFUN (clear_ip_bgp_as_soft_out, | |
5447 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 5448 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 5449 | CLEAR_STR |
5450 | IP_STR | |
5451 | BGP_STR | |
5452 | "Clear peers with the AS number\n" | |
5453 | "Soft reconfig\n" | |
5454 | "Soft reconfig outbound update\n") | |
5455 | { | |
5456 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
5457 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5458 | } | |
5459 | ||
5460 | ALIAS (clear_ip_bgp_as_soft_out, | |
5461 | clear_ip_bgp_as_out_cmd, | |
320da874 | 5462 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 5463 | CLEAR_STR |
5464 | IP_STR | |
5465 | BGP_STR | |
5466 | "Clear peers with the AS number\n" | |
5467 | "Soft reconfig outbound update\n") | |
5468 | ||
5469 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, | |
5470 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 5471 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 5472 | CLEAR_STR |
5473 | IP_STR | |
5474 | BGP_STR | |
5475 | "Clear peers with the AS number\n" | |
5476 | "Address family\n" | |
5477 | "Address Family modifier\n" | |
5478 | "Address Family modifier\n" | |
5479 | "Soft reconfig\n" | |
5480 | "Soft reconfig outbound update\n") | |
5481 | { | |
5482 | if (strncmp (argv[1], "m", 1) == 0) | |
5483 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
5484 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5485 | ||
5486 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
5487 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5488 | } | |
5489 | ||
5490 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, | |
5491 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 5492 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 5493 | CLEAR_STR |
5494 | IP_STR | |
5495 | BGP_STR | |
5496 | "Clear peers with the AS number\n" | |
5497 | "Address family\n" | |
5498 | "Address Family modifier\n" | |
5499 | "Address Family modifier\n" | |
5500 | "Soft reconfig outbound update\n") | |
5501 | ||
5502 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, | |
5503 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 5504 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 5505 | CLEAR_STR |
5506 | IP_STR | |
5507 | BGP_STR | |
5508 | "Clear peers with the AS number\n" | |
5509 | "Address family\n" | |
5510 | "Address Family modifier\n" | |
5511 | "Soft reconfig\n" | |
5512 | "Soft reconfig outbound update\n") | |
5513 | { | |
5514 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
5515 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5516 | } | |
5517 | ||
5518 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
5519 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 5520 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 5521 | CLEAR_STR |
5522 | IP_STR | |
5523 | BGP_STR | |
5524 | "Clear peers with the AS number\n" | |
5525 | "Address family\n" | |
5526 | "Address Family modifier\n" | |
5527 | "Soft reconfig outbound update\n") | |
5528 | ||
5529 | DEFUN (clear_bgp_as_soft_out, | |
5530 | clear_bgp_as_soft_out_cmd, | |
320da874 | 5531 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 5532 | CLEAR_STR |
5533 | BGP_STR | |
5534 | "Clear peers with the AS number\n" | |
5535 | "Soft reconfig\n" | |
5536 | "Soft reconfig outbound update\n") | |
5537 | { | |
5538 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
5539 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5540 | } | |
5541 | ||
5542 | ALIAS (clear_bgp_as_soft_out, | |
5543 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 5544 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 5545 | CLEAR_STR |
5546 | BGP_STR | |
5547 | "Address family\n" | |
5548 | "Clear peers with the AS number\n" | |
5549 | "Soft reconfig\n" | |
5550 | "Soft reconfig outbound update\n") | |
5551 | ||
5552 | ALIAS (clear_bgp_as_soft_out, | |
5553 | clear_bgp_as_out_cmd, | |
320da874 | 5554 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 5555 | CLEAR_STR |
5556 | BGP_STR | |
5557 | "Clear peers with the AS number\n" | |
5558 | "Soft reconfig outbound update\n") | |
5559 | ||
5560 | ALIAS (clear_bgp_as_soft_out, | |
5561 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 5562 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 5563 | CLEAR_STR |
5564 | BGP_STR | |
5565 | "Address family\n" | |
5566 | "Clear peers with the AS number\n" | |
5567 | "Soft reconfig outbound update\n") | |
6b0655a2 | 5568 | |
718e3744 | 5569 | /* Inbound soft-reconfiguration */ |
5570 | DEFUN (clear_ip_bgp_all_soft_in, | |
5571 | clear_ip_bgp_all_soft_in_cmd, | |
5572 | "clear ip bgp * soft in", | |
5573 | CLEAR_STR | |
5574 | IP_STR | |
5575 | BGP_STR | |
5576 | "Clear all peers\n" | |
5577 | "Soft reconfig\n" | |
5578 | "Soft reconfig inbound update\n") | |
5579 | { | |
5580 | if (argc == 1) | |
5581 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5582 | BGP_CLEAR_SOFT_IN, NULL); | |
5583 | ||
5584 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5585 | BGP_CLEAR_SOFT_IN, NULL); | |
5586 | } | |
5587 | ||
5588 | ALIAS (clear_ip_bgp_all_soft_in, | |
5589 | clear_ip_bgp_instance_all_soft_in_cmd, | |
5590 | "clear ip bgp view WORD * soft in", | |
5591 | CLEAR_STR | |
5592 | IP_STR | |
5593 | BGP_STR | |
5594 | "BGP view\n" | |
5595 | "view name\n" | |
5596 | "Clear all peers\n" | |
5597 | "Soft reconfig\n" | |
5598 | "Soft reconfig inbound update\n") | |
5599 | ||
5600 | ALIAS (clear_ip_bgp_all_soft_in, | |
5601 | clear_ip_bgp_all_in_cmd, | |
5602 | "clear ip bgp * in", | |
5603 | CLEAR_STR | |
5604 | IP_STR | |
5605 | BGP_STR | |
5606 | "Clear all peers\n" | |
5607 | "Soft reconfig inbound update\n") | |
5608 | ||
5609 | DEFUN (clear_ip_bgp_all_in_prefix_filter, | |
5610 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
5611 | "clear ip bgp * in prefix-filter", | |
5612 | CLEAR_STR | |
5613 | IP_STR | |
5614 | BGP_STR | |
5615 | "Clear all peers\n" | |
5616 | "Soft reconfig inbound update\n" | |
5617 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5618 | { | |
5619 | if (argc== 1) | |
5620 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5621 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5622 | ||
5623 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5624 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5625 | } | |
5626 | ||
5627 | ALIAS (clear_ip_bgp_all_in_prefix_filter, | |
5628 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, | |
5629 | "clear ip bgp view WORD * in prefix-filter", | |
5630 | CLEAR_STR | |
5631 | IP_STR | |
5632 | BGP_STR | |
5633 | "BGP view\n" | |
5634 | "view name\n" | |
5635 | "Clear all peers\n" | |
5636 | "Soft reconfig inbound update\n" | |
5637 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5638 | ||
5639 | ||
5640 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, | |
5641 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
5642 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
5643 | CLEAR_STR | |
5644 | IP_STR | |
5645 | BGP_STR | |
5646 | "Clear all peers\n" | |
5647 | "Address family\n" | |
5648 | "Address Family modifier\n" | |
5649 | "Address Family modifier\n" | |
5650 | "Soft reconfig\n" | |
5651 | "Soft reconfig inbound update\n") | |
5652 | { | |
5653 | if (strncmp (argv[0], "m", 1) == 0) | |
5654 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
5655 | BGP_CLEAR_SOFT_IN, NULL); | |
5656 | ||
5657 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5658 | BGP_CLEAR_SOFT_IN, NULL); | |
5659 | } | |
5660 | ||
5661 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, | |
5662 | clear_ip_bgp_all_ipv4_in_cmd, | |
5663 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
5664 | CLEAR_STR | |
5665 | IP_STR | |
5666 | BGP_STR | |
5667 | "Clear all peers\n" | |
5668 | "Address family\n" | |
5669 | "Address Family modifier\n" | |
5670 | "Address Family modifier\n" | |
5671 | "Soft reconfig inbound update\n") | |
5672 | ||
5673 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, | |
5674 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
5675 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", | |
5676 | CLEAR_STR | |
5677 | IP_STR | |
5678 | BGP_STR | |
5679 | "BGP view\n" | |
5680 | "view name\n" | |
5681 | "Clear all peers\n" | |
5682 | "Address family\n" | |
5683 | "Address Family modifier\n" | |
5684 | "Address Family modifier\n" | |
5685 | "Soft reconfig\n" | |
5686 | "Soft reconfig inbound update\n") | |
5687 | { | |
5688 | if (strncmp (argv[1], "m", 1) == 0) | |
5689 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
5690 | BGP_CLEAR_SOFT_IN, NULL); | |
5691 | ||
5692 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5693 | BGP_CLEAR_SOFT_IN, NULL); | |
5694 | } | |
5695 | ||
5696 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, | |
5697 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
5698 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
5699 | CLEAR_STR | |
5700 | IP_STR | |
5701 | BGP_STR | |
5702 | "Clear all peers\n" | |
5703 | "Address family\n" | |
5704 | "Address Family modifier\n" | |
5705 | "Address Family modifier\n" | |
5706 | "Soft reconfig inbound update\n" | |
5707 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5708 | { | |
5709 | if (strncmp (argv[0], "m", 1) == 0) | |
5710 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
5711 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5712 | ||
5713 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5714 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5715 | } | |
5716 | ||
5717 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, | |
5718 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, | |
5719 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", | |
5720 | CLEAR_STR | |
5721 | IP_STR | |
5722 | BGP_STR | |
5723 | "Clear all peers\n" | |
5724 | "Address family\n" | |
5725 | "Address Family modifier\n" | |
5726 | "Address Family modifier\n" | |
5727 | "Soft reconfig inbound update\n" | |
5728 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5729 | { | |
5730 | if (strncmp (argv[1], "m", 1) == 0) | |
5731 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
5732 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5733 | ||
5734 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5735 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5736 | } | |
5737 | ||
5738 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
5739 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
5740 | "clear ip bgp * vpnv4 unicast soft in", | |
5741 | CLEAR_STR | |
5742 | IP_STR | |
5743 | BGP_STR | |
5744 | "Clear all peers\n" | |
5745 | "Address family\n" | |
5746 | "Address Family Modifier\n" | |
5747 | "Soft reconfig\n" | |
5748 | "Soft reconfig inbound update\n") | |
5749 | { | |
5750 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
5751 | BGP_CLEAR_SOFT_IN, NULL); | |
5752 | } | |
5753 | ||
5754 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
5755 | clear_ip_bgp_all_vpnv4_in_cmd, | |
5756 | "clear ip bgp * vpnv4 unicast in", | |
5757 | CLEAR_STR | |
5758 | IP_STR | |
5759 | BGP_STR | |
5760 | "Clear all peers\n" | |
5761 | "Address family\n" | |
5762 | "Address Family Modifier\n" | |
5763 | "Soft reconfig inbound update\n") | |
5764 | ||
5765 | DEFUN (clear_bgp_all_soft_in, | |
5766 | clear_bgp_all_soft_in_cmd, | |
5767 | "clear bgp * soft in", | |
5768 | CLEAR_STR | |
5769 | BGP_STR | |
5770 | "Clear all peers\n" | |
5771 | "Soft reconfig\n" | |
5772 | "Soft reconfig inbound update\n") | |
5773 | { | |
5774 | if (argc == 1) | |
5775 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
5776 | BGP_CLEAR_SOFT_IN, NULL); | |
5777 | ||
5778 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
5779 | BGP_CLEAR_SOFT_IN, NULL); | |
5780 | } | |
5781 | ||
5782 | ALIAS (clear_bgp_all_soft_in, | |
5783 | clear_bgp_instance_all_soft_in_cmd, | |
5784 | "clear bgp view WORD * soft in", | |
5785 | CLEAR_STR | |
5786 | BGP_STR | |
5787 | "BGP view\n" | |
5788 | "view name\n" | |
5789 | "Clear all peers\n" | |
5790 | "Soft reconfig\n" | |
5791 | "Soft reconfig inbound update\n") | |
5792 | ||
5793 | ALIAS (clear_bgp_all_soft_in, | |
5794 | clear_bgp_ipv6_all_soft_in_cmd, | |
5795 | "clear bgp ipv6 * soft in", | |
5796 | CLEAR_STR | |
5797 | BGP_STR | |
5798 | "Address family\n" | |
5799 | "Clear all peers\n" | |
5800 | "Soft reconfig\n" | |
5801 | "Soft reconfig inbound update\n") | |
5802 | ||
5803 | ALIAS (clear_bgp_all_soft_in, | |
5804 | clear_bgp_all_in_cmd, | |
5805 | "clear bgp * in", | |
5806 | CLEAR_STR | |
5807 | BGP_STR | |
5808 | "Clear all peers\n" | |
5809 | "Soft reconfig inbound update\n") | |
5810 | ||
5811 | ALIAS (clear_bgp_all_soft_in, | |
5812 | clear_bgp_ipv6_all_in_cmd, | |
5813 | "clear bgp ipv6 * in", | |
5814 | CLEAR_STR | |
5815 | BGP_STR | |
5816 | "Address family\n" | |
5817 | "Clear all peers\n" | |
5818 | "Soft reconfig inbound update\n") | |
5819 | ||
5820 | DEFUN (clear_bgp_all_in_prefix_filter, | |
5821 | clear_bgp_all_in_prefix_filter_cmd, | |
5822 | "clear bgp * in prefix-filter", | |
5823 | CLEAR_STR | |
5824 | BGP_STR | |
5825 | "Clear all peers\n" | |
5826 | "Soft reconfig inbound update\n" | |
5827 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5828 | { | |
5829 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
5830 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5831 | } | |
5832 | ||
5833 | ALIAS (clear_bgp_all_in_prefix_filter, | |
5834 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
5835 | "clear bgp ipv6 * in prefix-filter", | |
5836 | CLEAR_STR | |
5837 | BGP_STR | |
5838 | "Address family\n" | |
5839 | "Clear all peers\n" | |
5840 | "Soft reconfig inbound update\n" | |
5841 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5842 | ||
5843 | DEFUN (clear_ip_bgp_peer_soft_in, | |
5844 | clear_ip_bgp_peer_soft_in_cmd, | |
5845 | "clear ip bgp A.B.C.D soft in", | |
5846 | CLEAR_STR | |
5847 | IP_STR | |
5848 | BGP_STR | |
5849 | "BGP neighbor address to clear\n" | |
5850 | "Soft reconfig\n" | |
5851 | "Soft reconfig inbound update\n") | |
5852 | { | |
5853 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5854 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5855 | } | |
5856 | ||
5857 | ALIAS (clear_ip_bgp_peer_soft_in, | |
5858 | clear_ip_bgp_peer_in_cmd, | |
5859 | "clear ip bgp A.B.C.D in", | |
5860 | CLEAR_STR | |
5861 | IP_STR | |
5862 | BGP_STR | |
5863 | "BGP neighbor address to clear\n" | |
5864 | "Soft reconfig inbound update\n") | |
5865 | ||
5866 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, | |
5867 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
5868 | "clear ip bgp A.B.C.D in prefix-filter", | |
5869 | CLEAR_STR | |
5870 | IP_STR | |
5871 | BGP_STR | |
5872 | "BGP neighbor address to clear\n" | |
5873 | "Soft reconfig inbound update\n" | |
5874 | "Push out the existing ORF prefix-list\n") | |
5875 | { | |
5876 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5877 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5878 | } | |
5879 | ||
5880 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
5881 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
5882 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", | |
5883 | CLEAR_STR | |
5884 | IP_STR | |
5885 | BGP_STR | |
5886 | "BGP neighbor address to clear\n" | |
5887 | "Address family\n" | |
5888 | "Address Family modifier\n" | |
5889 | "Address Family modifier\n" | |
5890 | "Soft reconfig\n" | |
5891 | "Soft reconfig inbound update\n") | |
5892 | { | |
5893 | if (strncmp (argv[1], "m", 1) == 0) | |
5894 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
5895 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5896 | ||
5897 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5898 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5899 | } | |
5900 | ||
5901 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, | |
5902 | clear_ip_bgp_peer_ipv4_in_cmd, | |
5903 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", | |
5904 | CLEAR_STR | |
5905 | IP_STR | |
5906 | BGP_STR | |
5907 | "BGP neighbor address to clear\n" | |
5908 | "Address family\n" | |
5909 | "Address Family modifier\n" | |
5910 | "Address Family modifier\n" | |
5911 | "Soft reconfig inbound update\n") | |
5912 | ||
5913 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, | |
5914 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
5915 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", | |
5916 | CLEAR_STR | |
5917 | IP_STR | |
5918 | BGP_STR | |
5919 | "BGP neighbor address to clear\n" | |
5920 | "Address family\n" | |
5921 | "Address Family modifier\n" | |
5922 | "Address Family modifier\n" | |
5923 | "Soft reconfig inbound update\n" | |
5924 | "Push out the existing ORF prefix-list\n") | |
5925 | { | |
5926 | if (strncmp (argv[1], "m", 1) == 0) | |
5927 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
5928 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5929 | ||
5930 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5931 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5932 | } | |
5933 | ||
5934 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
5935 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
5936 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", | |
5937 | CLEAR_STR | |
5938 | IP_STR | |
5939 | BGP_STR | |
5940 | "BGP neighbor address to clear\n" | |
5941 | "Address family\n" | |
5942 | "Address Family Modifier\n" | |
5943 | "Soft reconfig\n" | |
5944 | "Soft reconfig inbound update\n") | |
5945 | { | |
5946 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
5947 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5948 | } | |
5949 | ||
5950 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
5951 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
5952 | "clear ip bgp A.B.C.D vpnv4 unicast in", | |
5953 | CLEAR_STR | |
5954 | IP_STR | |
5955 | BGP_STR | |
5956 | "BGP neighbor address to clear\n" | |
5957 | "Address family\n" | |
5958 | "Address Family Modifier\n" | |
5959 | "Soft reconfig inbound update\n") | |
5960 | ||
5961 | DEFUN (clear_bgp_peer_soft_in, | |
5962 | clear_bgp_peer_soft_in_cmd, | |
a80beece | 5963 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 5964 | CLEAR_STR |
5965 | BGP_STR | |
5966 | "BGP neighbor address to clear\n" | |
5967 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 5968 | "BGP neighbor on interface to clear\n" |
718e3744 | 5969 | "Soft reconfig\n" |
5970 | "Soft reconfig inbound update\n") | |
5971 | { | |
5972 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
5973 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5974 | } | |
5975 | ||
5976 | ALIAS (clear_bgp_peer_soft_in, | |
5977 | clear_bgp_ipv6_peer_soft_in_cmd, | |
a80beece | 5978 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in", |
718e3744 | 5979 | CLEAR_STR |
5980 | BGP_STR | |
5981 | "Address family\n" | |
5982 | "BGP neighbor address to clear\n" | |
5983 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 5984 | "BGP neighbor on interface to clear\n" |
718e3744 | 5985 | "Soft reconfig\n" |
5986 | "Soft reconfig inbound update\n") | |
5987 | ||
5988 | ALIAS (clear_bgp_peer_soft_in, | |
5989 | clear_bgp_peer_in_cmd, | |
a80beece | 5990 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 5991 | CLEAR_STR |
5992 | BGP_STR | |
5993 | "BGP neighbor address to clear\n" | |
5994 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 5995 | "BGP neighbor on interface to clear\n" |
718e3744 | 5996 | "Soft reconfig inbound update\n") |
5997 | ||
5998 | ALIAS (clear_bgp_peer_soft_in, | |
5999 | clear_bgp_ipv6_peer_in_cmd, | |
a80beece | 6000 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in", |
718e3744 | 6001 | CLEAR_STR |
6002 | BGP_STR | |
6003 | "Address family\n" | |
6004 | "BGP neighbor address to clear\n" | |
6005 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6006 | "BGP neighbor on interface to clear\n" |
718e3744 | 6007 | "Soft reconfig inbound update\n") |
6008 | ||
6009 | DEFUN (clear_bgp_peer_in_prefix_filter, | |
6010 | clear_bgp_peer_in_prefix_filter_cmd, | |
a80beece | 6011 | "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 6012 | CLEAR_STR |
6013 | BGP_STR | |
6014 | "BGP neighbor address to clear\n" | |
6015 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6016 | "BGP neighbor on interface to clear\n" |
718e3744 | 6017 | "Soft reconfig inbound update\n" |
6018 | "Push out the existing ORF prefix-list\n") | |
6019 | { | |
6020 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6021 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6022 | } | |
6023 | ||
6024 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
6025 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
a80beece | 6026 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter", |
718e3744 | 6027 | CLEAR_STR |
6028 | BGP_STR | |
6029 | "Address family\n" | |
6030 | "BGP neighbor address to clear\n" | |
6031 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6032 | "BGP neighbor on interface to clear\n" |
718e3744 | 6033 | "Soft reconfig inbound update\n" |
6034 | "Push out the existing ORF prefix-list\n") | |
6035 | ||
6036 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
6037 | clear_ip_bgp_peer_group_soft_in_cmd, | |
6038 | "clear ip bgp peer-group WORD soft in", | |
6039 | CLEAR_STR | |
6040 | IP_STR | |
6041 | BGP_STR | |
6042 | "Clear all members of peer-group\n" | |
6043 | "BGP peer-group name\n" | |
6044 | "Soft reconfig\n" | |
6045 | "Soft reconfig inbound update\n") | |
6046 | { | |
6047 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6048 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6049 | } | |
6050 | ||
6051 | ALIAS (clear_ip_bgp_peer_group_soft_in, | |
6052 | clear_ip_bgp_peer_group_in_cmd, | |
6053 | "clear ip bgp peer-group WORD in", | |
6054 | CLEAR_STR | |
6055 | IP_STR | |
6056 | BGP_STR | |
6057 | "Clear all members of peer-group\n" | |
6058 | "BGP peer-group name\n" | |
6059 | "Soft reconfig inbound update\n") | |
6060 | ||
6061 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, | |
6062 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
6063 | "clear ip bgp peer-group WORD in prefix-filter", | |
6064 | CLEAR_STR | |
6065 | IP_STR | |
6066 | BGP_STR | |
6067 | "Clear all members of peer-group\n" | |
6068 | "BGP peer-group name\n" | |
6069 | "Soft reconfig inbound update\n" | |
6070 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6071 | { | |
6072 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6073 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6074 | } | |
6075 | ||
6076 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
6077 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
6078 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
6079 | CLEAR_STR | |
6080 | IP_STR | |
6081 | BGP_STR | |
6082 | "Clear all members of peer-group\n" | |
6083 | "BGP peer-group name\n" | |
6084 | "Address family\n" | |
6085 | "Address Family modifier\n" | |
6086 | "Address Family modifier\n" | |
6087 | "Soft reconfig\n" | |
6088 | "Soft reconfig inbound update\n") | |
6089 | { | |
6090 | if (strncmp (argv[1], "m", 1) == 0) | |
6091 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6092 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6093 | ||
6094 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6095 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6096 | } | |
6097 | ||
6098 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, | |
6099 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
6100 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
6101 | CLEAR_STR | |
6102 | IP_STR | |
6103 | BGP_STR | |
6104 | "Clear all members of peer-group\n" | |
6105 | "BGP peer-group name\n" | |
6106 | "Address family\n" | |
6107 | "Address Family modifier\n" | |
6108 | "Address Family modifier\n" | |
6109 | "Soft reconfig inbound update\n") | |
6110 | ||
6111 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, | |
6112 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
6113 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
6114 | CLEAR_STR | |
6115 | IP_STR | |
6116 | BGP_STR | |
6117 | "Clear all members of peer-group\n" | |
6118 | "BGP peer-group name\n" | |
6119 | "Address family\n" | |
6120 | "Address Family modifier\n" | |
6121 | "Address Family modifier\n" | |
6122 | "Soft reconfig inbound update\n" | |
6123 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6124 | { | |
6125 | if (strncmp (argv[1], "m", 1) == 0) | |
6126 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6127 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6128 | ||
6129 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6130 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6131 | } | |
6132 | ||
6133 | DEFUN (clear_bgp_peer_group_soft_in, | |
6134 | clear_bgp_peer_group_soft_in_cmd, | |
6135 | "clear bgp peer-group WORD soft in", | |
6136 | CLEAR_STR | |
6137 | BGP_STR | |
6138 | "Clear all members of peer-group\n" | |
6139 | "BGP peer-group name\n" | |
6140 | "Soft reconfig\n" | |
6141 | "Soft reconfig inbound update\n") | |
6142 | { | |
6143 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6144 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6145 | } | |
6146 | ||
6147 | ALIAS (clear_bgp_peer_group_soft_in, | |
6148 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
6149 | "clear bgp ipv6 peer-group WORD soft in", | |
6150 | CLEAR_STR | |
6151 | BGP_STR | |
6152 | "Address family\n" | |
6153 | "Clear all members of peer-group\n" | |
6154 | "BGP peer-group name\n" | |
6155 | "Soft reconfig\n" | |
6156 | "Soft reconfig inbound update\n") | |
6157 | ||
6158 | ALIAS (clear_bgp_peer_group_soft_in, | |
6159 | clear_bgp_peer_group_in_cmd, | |
6160 | "clear bgp peer-group WORD in", | |
6161 | CLEAR_STR | |
6162 | BGP_STR | |
6163 | "Clear all members of peer-group\n" | |
6164 | "BGP peer-group name\n" | |
6165 | "Soft reconfig inbound update\n") | |
6166 | ||
6167 | ALIAS (clear_bgp_peer_group_soft_in, | |
6168 | clear_bgp_ipv6_peer_group_in_cmd, | |
6169 | "clear bgp ipv6 peer-group WORD in", | |
6170 | CLEAR_STR | |
6171 | BGP_STR | |
6172 | "Address family\n" | |
6173 | "Clear all members of peer-group\n" | |
6174 | "BGP peer-group name\n" | |
6175 | "Soft reconfig inbound update\n") | |
6176 | ||
6177 | DEFUN (clear_bgp_peer_group_in_prefix_filter, | |
6178 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
6179 | "clear bgp peer-group WORD in prefix-filter", | |
6180 | CLEAR_STR | |
6181 | BGP_STR | |
6182 | "Clear all members of peer-group\n" | |
6183 | "BGP peer-group name\n" | |
6184 | "Soft reconfig inbound update\n" | |
6185 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6186 | { | |
6187 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6188 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6189 | } | |
6190 | ||
6191 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
6192 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
6193 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
6194 | CLEAR_STR | |
6195 | BGP_STR | |
6196 | "Address family\n" | |
6197 | "Clear all members of peer-group\n" | |
6198 | "BGP peer-group name\n" | |
6199 | "Soft reconfig inbound update\n" | |
6200 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6201 | ||
6202 | DEFUN (clear_ip_bgp_external_soft_in, | |
6203 | clear_ip_bgp_external_soft_in_cmd, | |
6204 | "clear ip bgp external soft in", | |
6205 | CLEAR_STR | |
6206 | IP_STR | |
6207 | BGP_STR | |
6208 | "Clear all external peers\n" | |
6209 | "Soft reconfig\n" | |
6210 | "Soft reconfig inbound update\n") | |
6211 | { | |
6212 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6213 | BGP_CLEAR_SOFT_IN, NULL); | |
6214 | } | |
6215 | ||
6216 | ALIAS (clear_ip_bgp_external_soft_in, | |
6217 | clear_ip_bgp_external_in_cmd, | |
6218 | "clear ip bgp external in", | |
6219 | CLEAR_STR | |
6220 | IP_STR | |
6221 | BGP_STR | |
6222 | "Clear all external peers\n" | |
6223 | "Soft reconfig inbound update\n") | |
6224 | ||
6225 | DEFUN (clear_ip_bgp_external_in_prefix_filter, | |
6226 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
6227 | "clear ip bgp external in prefix-filter", | |
6228 | CLEAR_STR | |
6229 | IP_STR | |
6230 | BGP_STR | |
6231 | "Clear all external peers\n" | |
6232 | "Soft reconfig inbound update\n" | |
6233 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6234 | { | |
6235 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6236 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6237 | } | |
6238 | ||
6239 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
6240 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
6241 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
6242 | CLEAR_STR | |
6243 | IP_STR | |
6244 | BGP_STR | |
6245 | "Clear all external peers\n" | |
6246 | "Address family\n" | |
6247 | "Address Family modifier\n" | |
6248 | "Address Family modifier\n" | |
6249 | "Soft reconfig\n" | |
6250 | "Soft reconfig inbound update\n") | |
6251 | { | |
6252 | if (strncmp (argv[0], "m", 1) == 0) | |
6253 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6254 | BGP_CLEAR_SOFT_IN, NULL); | |
6255 | ||
6256 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6257 | BGP_CLEAR_SOFT_IN, NULL); | |
6258 | } | |
6259 | ||
6260 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, | |
6261 | clear_ip_bgp_external_ipv4_in_cmd, | |
6262 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
6263 | CLEAR_STR | |
6264 | IP_STR | |
6265 | BGP_STR | |
6266 | "Clear all external peers\n" | |
6267 | "Address family\n" | |
6268 | "Address Family modifier\n" | |
6269 | "Address Family modifier\n" | |
6270 | "Soft reconfig inbound update\n") | |
6271 | ||
6272 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, | |
6273 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
6274 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
6275 | CLEAR_STR | |
6276 | IP_STR | |
6277 | BGP_STR | |
6278 | "Clear all external peers\n" | |
6279 | "Address family\n" | |
6280 | "Address Family modifier\n" | |
6281 | "Address Family modifier\n" | |
6282 | "Soft reconfig inbound update\n" | |
6283 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6284 | { | |
6285 | if (strncmp (argv[0], "m", 1) == 0) | |
6286 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6287 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6288 | ||
6289 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6290 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6291 | } | |
6292 | ||
6293 | DEFUN (clear_bgp_external_soft_in, | |
6294 | clear_bgp_external_soft_in_cmd, | |
6295 | "clear bgp external soft in", | |
6296 | CLEAR_STR | |
6297 | BGP_STR | |
6298 | "Clear all external peers\n" | |
6299 | "Soft reconfig\n" | |
6300 | "Soft reconfig inbound update\n") | |
6301 | { | |
6302 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6303 | BGP_CLEAR_SOFT_IN, NULL); | |
6304 | } | |
6305 | ||
6306 | ALIAS (clear_bgp_external_soft_in, | |
6307 | clear_bgp_ipv6_external_soft_in_cmd, | |
6308 | "clear bgp ipv6 external soft in", | |
6309 | CLEAR_STR | |
6310 | BGP_STR | |
6311 | "Address family\n" | |
6312 | "Clear all external peers\n" | |
6313 | "Soft reconfig\n" | |
6314 | "Soft reconfig inbound update\n") | |
6315 | ||
6316 | ALIAS (clear_bgp_external_soft_in, | |
6317 | clear_bgp_external_in_cmd, | |
6318 | "clear bgp external in", | |
6319 | CLEAR_STR | |
6320 | BGP_STR | |
6321 | "Clear all external peers\n" | |
6322 | "Soft reconfig inbound update\n") | |
6323 | ||
6324 | ALIAS (clear_bgp_external_soft_in, | |
6325 | clear_bgp_ipv6_external_in_cmd, | |
6326 | "clear bgp ipv6 external WORD in", | |
6327 | CLEAR_STR | |
6328 | BGP_STR | |
6329 | "Address family\n" | |
6330 | "Clear all external peers\n" | |
6331 | "Soft reconfig inbound update\n") | |
6332 | ||
6333 | DEFUN (clear_bgp_external_in_prefix_filter, | |
6334 | clear_bgp_external_in_prefix_filter_cmd, | |
6335 | "clear bgp external in prefix-filter", | |
6336 | CLEAR_STR | |
6337 | BGP_STR | |
6338 | "Clear all external peers\n" | |
6339 | "Soft reconfig inbound update\n" | |
6340 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6341 | { | |
6342 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6343 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6344 | } | |
6345 | ||
6346 | ALIAS (clear_bgp_external_in_prefix_filter, | |
6347 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
6348 | "clear bgp ipv6 external in prefix-filter", | |
6349 | CLEAR_STR | |
6350 | BGP_STR | |
6351 | "Address family\n" | |
6352 | "Clear all external peers\n" | |
6353 | "Soft reconfig inbound update\n" | |
6354 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6355 | ||
6356 | DEFUN (clear_ip_bgp_as_soft_in, | |
6357 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 6358 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 6359 | CLEAR_STR |
6360 | IP_STR | |
6361 | BGP_STR | |
6362 | "Clear peers with the AS number\n" | |
6363 | "Soft reconfig\n" | |
6364 | "Soft reconfig inbound update\n") | |
6365 | { | |
6366 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6367 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6368 | } | |
6369 | ||
6370 | ALIAS (clear_ip_bgp_as_soft_in, | |
6371 | clear_ip_bgp_as_in_cmd, | |
320da874 | 6372 | "clear ip bgp " CMD_AS_RANGE " in", |
718e3744 | 6373 | CLEAR_STR |
6374 | IP_STR | |
6375 | BGP_STR | |
6376 | "Clear peers with the AS number\n" | |
6377 | "Soft reconfig inbound update\n") | |
6378 | ||
6379 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
6380 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 6381 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 6382 | CLEAR_STR |
6383 | IP_STR | |
6384 | BGP_STR | |
6385 | "Clear peers with the AS number\n" | |
6386 | "Soft reconfig inbound update\n" | |
6387 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6388 | { | |
6389 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6390 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6391 | } | |
6392 | ||
6393 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
6394 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 6395 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 6396 | CLEAR_STR |
6397 | IP_STR | |
6398 | BGP_STR | |
6399 | "Clear peers with the AS number\n" | |
6400 | "Address family\n" | |
6401 | "Address Family modifier\n" | |
6402 | "Address Family modifier\n" | |
6403 | "Soft reconfig\n" | |
6404 | "Soft reconfig inbound update\n") | |
6405 | { | |
6406 | if (strncmp (argv[1], "m", 1) == 0) | |
6407 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6408 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6409 | ||
6410 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6411 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6412 | } | |
6413 | ||
6414 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, | |
6415 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 6416 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 6417 | CLEAR_STR |
6418 | IP_STR | |
6419 | BGP_STR | |
6420 | "Clear peers with the AS number\n" | |
6421 | "Address family\n" | |
6422 | "Address Family modifier\n" | |
6423 | "Address Family modifier\n" | |
6424 | "Soft reconfig inbound update\n") | |
6425 | ||
6426 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, | |
6427 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 6428 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 6429 | CLEAR_STR |
6430 | IP_STR | |
6431 | BGP_STR | |
6432 | "Clear peers with the AS number\n" | |
6433 | "Address family\n" | |
6434 | "Address Family modifier\n" | |
6435 | "Address Family modifier\n" | |
6436 | "Soft reconfig inbound update\n" | |
6437 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6438 | { | |
6439 | if (strncmp (argv[1], "m", 1) == 0) | |
6440 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6441 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6442 | ||
6443 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6444 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6445 | } | |
6446 | ||
6447 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
6448 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 6449 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 6450 | CLEAR_STR |
6451 | IP_STR | |
6452 | BGP_STR | |
6453 | "Clear peers with the AS number\n" | |
6454 | "Address family\n" | |
6455 | "Address Family modifier\n" | |
6456 | "Soft reconfig\n" | |
6457 | "Soft reconfig inbound update\n") | |
6458 | { | |
6459 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
6460 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6461 | } | |
6462 | ||
6463 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
6464 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 6465 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 6466 | CLEAR_STR |
6467 | IP_STR | |
6468 | BGP_STR | |
6469 | "Clear peers with the AS number\n" | |
6470 | "Address family\n" | |
6471 | "Address Family modifier\n" | |
6472 | "Soft reconfig inbound update\n") | |
6473 | ||
6474 | DEFUN (clear_bgp_as_soft_in, | |
6475 | clear_bgp_as_soft_in_cmd, | |
320da874 | 6476 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 6477 | CLEAR_STR |
6478 | BGP_STR | |
6479 | "Clear peers with the AS number\n" | |
6480 | "Soft reconfig\n" | |
6481 | "Soft reconfig inbound update\n") | |
6482 | { | |
6483 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6484 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6485 | } | |
6486 | ||
6487 | ALIAS (clear_bgp_as_soft_in, | |
6488 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 6489 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 6490 | CLEAR_STR |
6491 | BGP_STR | |
6492 | "Address family\n" | |
6493 | "Clear peers with the AS number\n" | |
6494 | "Soft reconfig\n" | |
6495 | "Soft reconfig inbound update\n") | |
6496 | ||
6497 | ALIAS (clear_bgp_as_soft_in, | |
6498 | clear_bgp_as_in_cmd, | |
320da874 | 6499 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 6500 | CLEAR_STR |
6501 | BGP_STR | |
6502 | "Clear peers with the AS number\n" | |
6503 | "Soft reconfig inbound update\n") | |
6504 | ||
6505 | ALIAS (clear_bgp_as_soft_in, | |
6506 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 6507 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 6508 | CLEAR_STR |
6509 | BGP_STR | |
6510 | "Address family\n" | |
6511 | "Clear peers with the AS number\n" | |
6512 | "Soft reconfig inbound update\n") | |
6513 | ||
6514 | DEFUN (clear_bgp_as_in_prefix_filter, | |
6515 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 6516 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 6517 | CLEAR_STR |
6518 | BGP_STR | |
6519 | "Clear peers with the AS number\n" | |
6520 | "Soft reconfig inbound update\n" | |
6521 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6522 | { | |
6523 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6524 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6525 | } | |
6526 | ||
6527 | ALIAS (clear_bgp_as_in_prefix_filter, | |
6528 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 6529 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 6530 | CLEAR_STR |
6531 | BGP_STR | |
6532 | "Address family\n" | |
6533 | "Clear peers with the AS number\n" | |
6534 | "Soft reconfig inbound update\n" | |
6535 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6b0655a2 | 6536 | |
718e3744 | 6537 | /* Both soft-reconfiguration */ |
6538 | DEFUN (clear_ip_bgp_all_soft, | |
6539 | clear_ip_bgp_all_soft_cmd, | |
6540 | "clear ip bgp * soft", | |
6541 | CLEAR_STR | |
6542 | IP_STR | |
6543 | BGP_STR | |
6544 | "Clear all peers\n" | |
6545 | "Soft reconfig\n") | |
6546 | { | |
6547 | if (argc == 1) | |
6548 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6549 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6550 | ||
6551 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6552 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6553 | } | |
6554 | ||
6555 | ALIAS (clear_ip_bgp_all_soft, | |
6556 | clear_ip_bgp_instance_all_soft_cmd, | |
6557 | "clear ip bgp view WORD * soft", | |
6558 | CLEAR_STR | |
6559 | IP_STR | |
6560 | BGP_STR | |
6561 | "BGP view\n" | |
6562 | "view name\n" | |
6563 | "Clear all peers\n" | |
6564 | "Soft reconfig\n") | |
6565 | ||
6566 | ||
6567 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
6568 | clear_ip_bgp_all_ipv4_soft_cmd, | |
6569 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
6570 | CLEAR_STR | |
6571 | IP_STR | |
6572 | BGP_STR | |
6573 | "Clear all peers\n" | |
6574 | "Address family\n" | |
6575 | "Address Family Modifier\n" | |
6576 | "Address Family Modifier\n" | |
6577 | "Soft reconfig\n") | |
6578 | { | |
6579 | if (strncmp (argv[0], "m", 1) == 0) | |
6580 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6581 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6582 | ||
6583 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6584 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6585 | } | |
6586 | ||
6587 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
6588 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
6589 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", | |
6590 | CLEAR_STR | |
6591 | IP_STR | |
6592 | BGP_STR | |
6593 | "BGP view\n" | |
6594 | "view name\n" | |
6595 | "Clear all peers\n" | |
6596 | "Address family\n" | |
6597 | "Address Family Modifier\n" | |
6598 | "Address Family Modifier\n" | |
6599 | "Soft reconfig\n") | |
6600 | { | |
6601 | if (strncmp (argv[1], "m", 1) == 0) | |
6602 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6603 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6604 | ||
6605 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6606 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6607 | } | |
6608 | ||
6609 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
6610 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
6611 | "clear ip bgp * vpnv4 unicast soft", | |
6612 | CLEAR_STR | |
6613 | IP_STR | |
6614 | BGP_STR | |
6615 | "Clear all peers\n" | |
6616 | "Address family\n" | |
6617 | "Address Family Modifier\n" | |
6618 | "Soft reconfig\n") | |
6619 | { | |
6620 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6621 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6622 | } | |
6623 | ||
6624 | DEFUN (clear_bgp_all_soft, | |
6625 | clear_bgp_all_soft_cmd, | |
6626 | "clear bgp * soft", | |
6627 | CLEAR_STR | |
6628 | BGP_STR | |
6629 | "Clear all peers\n" | |
6630 | "Soft reconfig\n") | |
6631 | { | |
6632 | if (argc == 1) | |
6633 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6634 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6635 | ||
6636 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6637 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6638 | } | |
6639 | ||
6640 | ALIAS (clear_bgp_all_soft, | |
6641 | clear_bgp_instance_all_soft_cmd, | |
6642 | "clear bgp view WORD * soft", | |
6643 | CLEAR_STR | |
6644 | BGP_STR | |
6645 | "BGP view\n" | |
6646 | "view name\n" | |
6647 | "Clear all peers\n" | |
6648 | "Soft reconfig\n") | |
6649 | ||
6650 | ALIAS (clear_bgp_all_soft, | |
6651 | clear_bgp_ipv6_all_soft_cmd, | |
6652 | "clear bgp ipv6 * soft", | |
6653 | CLEAR_STR | |
6654 | BGP_STR | |
6655 | "Address family\n" | |
6656 | "Clear all peers\n" | |
6657 | "Soft reconfig\n") | |
6658 | ||
6659 | DEFUN (clear_ip_bgp_peer_soft, | |
6660 | clear_ip_bgp_peer_soft_cmd, | |
6661 | "clear ip bgp A.B.C.D soft", | |
6662 | CLEAR_STR | |
6663 | IP_STR | |
6664 | BGP_STR | |
6665 | "BGP neighbor address to clear\n" | |
6666 | "Soft reconfig\n") | |
6667 | { | |
6668 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6669 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6670 | } | |
6671 | ||
6672 | DEFUN (clear_ip_bgp_peer_ipv4_soft, | |
6673 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
6674 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", | |
6675 | CLEAR_STR | |
6676 | IP_STR | |
6677 | BGP_STR | |
6678 | "BGP neighbor address to clear\n" | |
6679 | "Address family\n" | |
6680 | "Address Family Modifier\n" | |
6681 | "Address Family Modifier\n" | |
6682 | "Soft reconfig\n") | |
6683 | { | |
6684 | if (strncmp (argv[1], "m", 1) == 0) | |
6685 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6686 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6687 | ||
6688 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6689 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6690 | } | |
6691 | ||
6692 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, | |
6693 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
6694 | "clear ip bgp A.B.C.D vpnv4 unicast soft", | |
6695 | CLEAR_STR | |
6696 | IP_STR | |
6697 | BGP_STR | |
6698 | "BGP neighbor address to clear\n" | |
6699 | "Address family\n" | |
6700 | "Address Family Modifier\n" | |
6701 | "Soft reconfig\n") | |
6702 | { | |
6703 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6704 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6705 | } | |
6706 | ||
6707 | DEFUN (clear_bgp_peer_soft, | |
6708 | clear_bgp_peer_soft_cmd, | |
a80beece | 6709 | "clear bgp (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 6710 | CLEAR_STR |
6711 | BGP_STR | |
6712 | "BGP neighbor address to clear\n" | |
6713 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6714 | "BGP neighbor on interface to clear\n" |
718e3744 | 6715 | "Soft reconfig\n") |
6716 | { | |
6717 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6718 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6719 | } | |
6720 | ||
6721 | ALIAS (clear_bgp_peer_soft, | |
6722 | clear_bgp_ipv6_peer_soft_cmd, | |
a80beece | 6723 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft", |
718e3744 | 6724 | CLEAR_STR |
6725 | BGP_STR | |
6726 | "Address family\n" | |
6727 | "BGP neighbor address to clear\n" | |
6728 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6729 | "BGP neighbor on interface to clear\n" |
718e3744 | 6730 | "Soft reconfig\n") |
6731 | ||
6732 | DEFUN (clear_ip_bgp_peer_group_soft, | |
6733 | clear_ip_bgp_peer_group_soft_cmd, | |
6734 | "clear ip bgp peer-group WORD soft", | |
6735 | CLEAR_STR | |
6736 | IP_STR | |
6737 | BGP_STR | |
6738 | "Clear all members of peer-group\n" | |
6739 | "BGP peer-group name\n" | |
6740 | "Soft reconfig\n") | |
6741 | { | |
6742 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6743 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6744 | } | |
6745 | ||
6746 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, | |
6747 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
6748 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
6749 | CLEAR_STR | |
6750 | IP_STR | |
6751 | BGP_STR | |
6752 | "Clear all members of peer-group\n" | |
6753 | "BGP peer-group name\n" | |
6754 | "Address family\n" | |
6755 | "Address Family modifier\n" | |
6756 | "Address Family modifier\n" | |
6757 | "Soft reconfig\n") | |
6758 | { | |
6759 | if (strncmp (argv[1], "m", 1) == 0) | |
6760 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6761 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6762 | ||
6763 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6764 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6765 | } | |
6766 | ||
6767 | DEFUN (clear_bgp_peer_group_soft, | |
6768 | clear_bgp_peer_group_soft_cmd, | |
6769 | "clear bgp peer-group WORD soft", | |
6770 | CLEAR_STR | |
6771 | BGP_STR | |
6772 | "Clear all members of peer-group\n" | |
6773 | "BGP peer-group name\n" | |
6774 | "Soft reconfig\n") | |
6775 | { | |
6776 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6777 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6778 | } | |
6779 | ||
6780 | ALIAS (clear_bgp_peer_group_soft, | |
6781 | clear_bgp_ipv6_peer_group_soft_cmd, | |
6782 | "clear bgp ipv6 peer-group WORD soft", | |
6783 | CLEAR_STR | |
6784 | BGP_STR | |
6785 | "Address family\n" | |
6786 | "Clear all members of peer-group\n" | |
6787 | "BGP peer-group name\n" | |
6788 | "Soft reconfig\n") | |
6789 | ||
6790 | DEFUN (clear_ip_bgp_external_soft, | |
6791 | clear_ip_bgp_external_soft_cmd, | |
6792 | "clear ip bgp external soft", | |
6793 | CLEAR_STR | |
6794 | IP_STR | |
6795 | BGP_STR | |
6796 | "Clear all external peers\n" | |
6797 | "Soft reconfig\n") | |
6798 | { | |
6799 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6800 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6801 | } | |
6802 | ||
6803 | DEFUN (clear_ip_bgp_external_ipv4_soft, | |
6804 | clear_ip_bgp_external_ipv4_soft_cmd, | |
6805 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
6806 | CLEAR_STR | |
6807 | IP_STR | |
6808 | BGP_STR | |
6809 | "Clear all external peers\n" | |
6810 | "Address family\n" | |
6811 | "Address Family modifier\n" | |
6812 | "Address Family modifier\n" | |
6813 | "Soft reconfig\n") | |
6814 | { | |
6815 | if (strncmp (argv[0], "m", 1) == 0) | |
6816 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6817 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6818 | ||
6819 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6820 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6821 | } | |
6822 | ||
6823 | DEFUN (clear_bgp_external_soft, | |
6824 | clear_bgp_external_soft_cmd, | |
6825 | "clear bgp external soft", | |
6826 | CLEAR_STR | |
6827 | BGP_STR | |
6828 | "Clear all external peers\n" | |
6829 | "Soft reconfig\n") | |
6830 | { | |
6831 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6832 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6833 | } | |
6834 | ||
6835 | ALIAS (clear_bgp_external_soft, | |
6836 | clear_bgp_ipv6_external_soft_cmd, | |
6837 | "clear bgp ipv6 external soft", | |
6838 | CLEAR_STR | |
6839 | BGP_STR | |
6840 | "Address family\n" | |
6841 | "Clear all external peers\n" | |
6842 | "Soft reconfig\n") | |
6843 | ||
6844 | DEFUN (clear_ip_bgp_as_soft, | |
6845 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 6846 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 6847 | CLEAR_STR |
6848 | IP_STR | |
6849 | BGP_STR | |
6850 | "Clear peers with the AS number\n" | |
6851 | "Soft reconfig\n") | |
6852 | { | |
6853 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6854 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6855 | } | |
6856 | ||
6857 | DEFUN (clear_ip_bgp_as_ipv4_soft, | |
6858 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 6859 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 6860 | CLEAR_STR |
6861 | IP_STR | |
6862 | BGP_STR | |
6863 | "Clear peers with the AS number\n" | |
6864 | "Address family\n" | |
6865 | "Address Family Modifier\n" | |
6866 | "Address Family Modifier\n" | |
6867 | "Soft reconfig\n") | |
6868 | { | |
6869 | if (strncmp (argv[1], "m", 1) == 0) | |
6870 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6871 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6872 | ||
6873 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
6874 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6875 | } | |
6876 | ||
6877 | DEFUN (clear_ip_bgp_as_vpnv4_soft, | |
6878 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 6879 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 6880 | CLEAR_STR |
6881 | IP_STR | |
6882 | BGP_STR | |
6883 | "Clear peers with the AS number\n" | |
6884 | "Address family\n" | |
6885 | "Address Family Modifier\n" | |
6886 | "Soft reconfig\n") | |
6887 | { | |
6888 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
6889 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6890 | } | |
6891 | ||
6892 | DEFUN (clear_bgp_as_soft, | |
6893 | clear_bgp_as_soft_cmd, | |
320da874 | 6894 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 6895 | CLEAR_STR |
6896 | BGP_STR | |
6897 | "Clear peers with the AS number\n" | |
6898 | "Soft reconfig\n") | |
6899 | { | |
6900 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6901 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6902 | } | |
6903 | ||
6904 | ALIAS (clear_bgp_as_soft, | |
6905 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 6906 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 6907 | CLEAR_STR |
6908 | BGP_STR | |
6909 | "Address family\n" | |
6910 | "Clear peers with the AS number\n" | |
6911 | "Soft reconfig\n") | |
6b0655a2 | 6912 | |
fee0f4c6 | 6913 | /* RS-client soft reconfiguration. */ |
6914 | #ifdef HAVE_IPV6 | |
6915 | DEFUN (clear_bgp_all_rsclient, | |
6916 | clear_bgp_all_rsclient_cmd, | |
6917 | "clear bgp * rsclient", | |
6918 | CLEAR_STR | |
6919 | BGP_STR | |
6920 | "Clear all peers\n" | |
6921 | "Soft reconfig for rsclient RIB\n") | |
6922 | { | |
6923 | if (argc == 1) | |
6924 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6925 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6926 | ||
6927 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6928 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6929 | } | |
6930 | ||
6931 | ALIAS (clear_bgp_all_rsclient, | |
6932 | clear_bgp_ipv6_all_rsclient_cmd, | |
6933 | "clear bgp ipv6 * rsclient", | |
6934 | CLEAR_STR | |
6935 | BGP_STR | |
6936 | "Address family\n" | |
6937 | "Clear all peers\n" | |
6938 | "Soft reconfig for rsclient RIB\n") | |
6939 | ||
6940 | ALIAS (clear_bgp_all_rsclient, | |
6941 | clear_bgp_instance_all_rsclient_cmd, | |
6942 | "clear bgp view WORD * rsclient", | |
6943 | CLEAR_STR | |
6944 | BGP_STR | |
6945 | "BGP view\n" | |
6946 | "view name\n" | |
6947 | "Clear all peers\n" | |
6948 | "Soft reconfig for rsclient RIB\n") | |
6949 | ||
6950 | ALIAS (clear_bgp_all_rsclient, | |
6951 | clear_bgp_ipv6_instance_all_rsclient_cmd, | |
6952 | "clear bgp ipv6 view WORD * rsclient", | |
6953 | CLEAR_STR | |
6954 | BGP_STR | |
6955 | "Address family\n" | |
6956 | "BGP view\n" | |
6957 | "view name\n" | |
6958 | "Clear all peers\n" | |
6959 | "Soft reconfig for rsclient RIB\n") | |
6960 | #endif /* HAVE_IPV6 */ | |
6961 | ||
6962 | DEFUN (clear_ip_bgp_all_rsclient, | |
6963 | clear_ip_bgp_all_rsclient_cmd, | |
6964 | "clear ip bgp * rsclient", | |
6965 | CLEAR_STR | |
6966 | IP_STR | |
6967 | BGP_STR | |
6968 | "Clear all peers\n" | |
6969 | "Soft reconfig for rsclient RIB\n") | |
6970 | { | |
6971 | if (argc == 1) | |
6972 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6973 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6974 | ||
6975 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6976 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6977 | } | |
6978 | ||
6979 | ALIAS (clear_ip_bgp_all_rsclient, | |
6980 | clear_ip_bgp_instance_all_rsclient_cmd, | |
6981 | "clear ip bgp view WORD * rsclient", | |
6982 | CLEAR_STR | |
6983 | IP_STR | |
6984 | BGP_STR | |
6985 | "BGP view\n" | |
6986 | "view name\n" | |
6987 | "Clear all peers\n" | |
6988 | "Soft reconfig for rsclient RIB\n") | |
6989 | ||
6990 | #ifdef HAVE_IPV6 | |
6991 | DEFUN (clear_bgp_peer_rsclient, | |
6992 | clear_bgp_peer_rsclient_cmd, | |
a80beece | 6993 | "clear bgp (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 6994 | CLEAR_STR |
6995 | BGP_STR | |
6996 | "BGP neighbor IP address to clear\n" | |
6997 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 6998 | "BGP neighbor on interface to clear\n" |
fee0f4c6 | 6999 | "Soft reconfig for rsclient RIB\n") |
7000 | { | |
7001 | if (argc == 2) | |
7002 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, | |
7003 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
7004 | ||
7005 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
7006 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
7007 | } | |
7008 | ||
7009 | ALIAS (clear_bgp_peer_rsclient, | |
7010 | clear_bgp_ipv6_peer_rsclient_cmd, | |
a80beece | 7011 | "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7012 | CLEAR_STR |
7013 | BGP_STR | |
7014 | "Address family\n" | |
7015 | "BGP neighbor IP address to clear\n" | |
7016 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7017 | "BGP neighbor on interface to clear\n" |
fee0f4c6 | 7018 | "Soft reconfig for rsclient RIB\n") |
7019 | ||
7020 | ALIAS (clear_bgp_peer_rsclient, | |
7021 | clear_bgp_instance_peer_rsclient_cmd, | |
a80beece | 7022 | "clear bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7023 | CLEAR_STR |
7024 | BGP_STR | |
7025 | "BGP view\n" | |
7026 | "view name\n" | |
7027 | "BGP neighbor IP address to clear\n" | |
7028 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7029 | "BGP neighbor on interface to clear\n" |
fee0f4c6 | 7030 | "Soft reconfig for rsclient RIB\n") |
7031 | ||
7032 | ALIAS (clear_bgp_peer_rsclient, | |
7033 | clear_bgp_ipv6_instance_peer_rsclient_cmd, | |
a80beece | 7034 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7035 | CLEAR_STR |
7036 | BGP_STR | |
7037 | "Address family\n" | |
7038 | "BGP view\n" | |
7039 | "view name\n" | |
7040 | "BGP neighbor IP address to clear\n" | |
7041 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7042 | "BGP neighbor on interface to clear\n" |
fee0f4c6 | 7043 | "Soft reconfig for rsclient RIB\n") |
7044 | #endif /* HAVE_IPV6 */ | |
7045 | ||
7046 | DEFUN (clear_ip_bgp_peer_rsclient, | |
7047 | clear_ip_bgp_peer_rsclient_cmd, | |
a80beece | 7048 | "clear ip bgp (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7049 | CLEAR_STR |
7050 | IP_STR | |
7051 | BGP_STR | |
7052 | "BGP neighbor IP address to clear\n" | |
7053 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7054 | "BGP neighbor on interface to clear\n" |
fee0f4c6 | 7055 | "Soft reconfig for rsclient RIB\n") |
7056 | { | |
7057 | if (argc == 2) | |
7058 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, | |
7059 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
7060 | ||
7061 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
7062 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
7063 | } | |
7064 | ||
7065 | ALIAS (clear_ip_bgp_peer_rsclient, | |
7066 | clear_ip_bgp_instance_peer_rsclient_cmd, | |
a80beece | 7067 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient", |
fee0f4c6 | 7068 | CLEAR_STR |
7069 | IP_STR | |
7070 | BGP_STR | |
7071 | "BGP view\n" | |
7072 | "view name\n" | |
7073 | "BGP neighbor IP address to clear\n" | |
7074 | "BGP IPv6 neighbor to clear\n" | |
a80beece | 7075 | "BGP neighbor on interface to clear\n" |
fee0f4c6 | 7076 | "Soft reconfig for rsclient RIB\n") |
7077 | ||
e0081f70 ML |
7078 | DEFUN (show_bgp_views, |
7079 | show_bgp_views_cmd, | |
7080 | "show bgp views", | |
7081 | SHOW_STR | |
7082 | BGP_STR | |
7083 | "Show the defined BGP views\n") | |
7084 | { | |
7085 | struct list *inst = bm->bgp; | |
7086 | struct listnode *node; | |
7087 | struct bgp *bgp; | |
7088 | ||
7089 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
7090 | { | |
7091 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); | |
7092 | return CMD_WARNING; | |
7093 | } | |
7094 | ||
7095 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
7096 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
7097 | vty_out (vty, "\t%s (AS%u)%s", | |
7098 | bgp->name ? bgp->name : "(null)", | |
7099 | bgp->as, VTY_NEWLINE); | |
7100 | ||
7101 | return CMD_SUCCESS; | |
7102 | } | |
7103 | ||
4bf6a362 PJ |
7104 | DEFUN (show_bgp_memory, |
7105 | show_bgp_memory_cmd, | |
7106 | "show bgp memory", | |
7107 | SHOW_STR | |
7108 | BGP_STR | |
7109 | "Global BGP memory statistics\n") | |
7110 | { | |
7111 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
7112 | unsigned long count; | |
7113 | ||
7114 | /* RIB related usage stats */ | |
7115 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
7116 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
7117 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7118 | count * sizeof (struct bgp_node)), | |
7119 | VTY_NEWLINE); | |
7120 | ||
7121 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
7122 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
7123 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7124 | count * sizeof (struct bgp_info)), | |
7125 | VTY_NEWLINE); | |
fb982c25 PJ |
7126 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
7127 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
7128 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7129 | count * sizeof (struct bgp_info_extra)), | |
7130 | VTY_NEWLINE); | |
4bf6a362 PJ |
7131 | |
7132 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
7133 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
7134 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7135 | count * sizeof (struct bgp_static)), | |
7136 | VTY_NEWLINE); | |
7137 | ||
7138 | /* Adj-In/Out */ | |
7139 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
7140 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
7141 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7142 | count * sizeof (struct bgp_adj_in)), | |
7143 | VTY_NEWLINE); | |
7144 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
7145 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
7146 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7147 | count * sizeof (struct bgp_adj_out)), | |
7148 | VTY_NEWLINE); | |
7149 | ||
7150 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
7151 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
7152 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7153 | count * sizeof (struct bgp_nexthop_cache)), | |
7154 | VTY_NEWLINE); | |
7155 | ||
7156 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
7157 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
7158 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7159 | count * sizeof (struct bgp_damp_info)), | |
7160 | VTY_NEWLINE); | |
7161 | ||
7162 | /* Attributes */ | |
7163 | count = attr_count(); | |
7164 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
7165 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7166 | count * sizeof(struct attr)), | |
7167 | VTY_NEWLINE); | |
fb982c25 PJ |
7168 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
7169 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
7170 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7171 | count * sizeof(struct attr_extra)), | |
7172 | VTY_NEWLINE); | |
4bf6a362 PJ |
7173 | |
7174 | if ((count = attr_unknown_count())) | |
7175 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
7176 | ||
7177 | /* AS_PATH attributes */ | |
7178 | count = aspath_count (); | |
7179 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
7180 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7181 | count * sizeof (struct aspath)), | |
7182 | VTY_NEWLINE); | |
7183 | ||
7184 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
7185 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
7186 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7187 | count * sizeof (struct assegment)), | |
7188 | VTY_NEWLINE); | |
7189 | ||
7190 | /* Other attributes */ | |
7191 | if ((count = community_count ())) | |
7192 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
7193 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7194 | count * sizeof (struct community)), | |
7195 | VTY_NEWLINE); | |
7196 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
7197 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
7198 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7199 | count * sizeof (struct ecommunity)), | |
7200 | VTY_NEWLINE); | |
7201 | ||
7202 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
7203 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
7204 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7205 | count * sizeof (struct cluster_list)), | |
7206 | VTY_NEWLINE); | |
7207 | ||
7208 | /* Peer related usage */ | |
7209 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
7210 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
7211 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7212 | count * sizeof (struct peer)), | |
7213 | VTY_NEWLINE); | |
7214 | ||
7215 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) | |
7216 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, | |
7217 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7218 | count * sizeof (struct peer_group)), | |
7219 | VTY_NEWLINE); | |
7220 | ||
7221 | /* Other */ | |
7222 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
7223 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
7224 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7225 | count * sizeof (struct hash)), | |
7226 | VTY_NEWLINE); | |
7227 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
7228 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
7229 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7230 | count * sizeof (struct hash_backet)), | |
7231 | VTY_NEWLINE); | |
7232 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
7233 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
7234 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7235 | count * sizeof (regex_t)), | |
7236 | VTY_NEWLINE); | |
7237 | return CMD_SUCCESS; | |
7238 | } | |
fee0f4c6 | 7239 | |
47fc97cc DS |
7240 | static int |
7241 | bgp_adj_out_count (struct peer *peer, int afi, int safi) | |
7242 | { | |
7243 | struct bgp_table *table; | |
7244 | struct bgp_node *rn; | |
7245 | struct bgp_adj_out *adj; | |
7246 | int count = 0; | |
7247 | ||
7248 | if (!peer) return(0); | |
7249 | ||
7250 | table = peer->bgp->rib[afi][safi]; | |
7251 | if (!table) return(0); | |
7252 | for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) | |
7253 | if (bgp_adj_out_lookup(peer, NULL, afi, safi, rn)) | |
7254 | count++; | |
7255 | return (count); | |
7256 | } | |
7257 | ||
718e3744 | 7258 | /* Show BGP peer's summary information. */ |
94f2b392 | 7259 | static int |
47fc97cc | 7260 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, char *delimit) |
718e3744 | 7261 | { |
7262 | struct peer *peer; | |
1eb8ef25 | 7263 | struct listnode *node, *nnode; |
4bf6a362 | 7264 | unsigned int count = 0; |
718e3744 | 7265 | char timebuf[BGP_UPTIME_LEN]; |
7266 | int len; | |
7267 | ||
7268 | /* Header string for each address family. */ | |
7269 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; | |
47fc97cc DS |
7270 | static char header_csv[] = "Neighbor, V, AS, MsgRcvd, MsgSent, TblVer, InQ, OutQ, Up/Down, State/PfxRcd, PfxAdv"; |
7271 | ||
1eb8ef25 | 7272 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 7273 | { |
1ff9a340 DS |
7274 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
7275 | continue; | |
7276 | ||
718e3744 | 7277 | if (peer->afc[afi][safi]) |
7278 | { | |
47fc97cc DS |
7279 | if (delimit) |
7280 | { | |
7281 | if (!count) | |
7282 | { | |
7283 | vty_out (vty, "%s%s", header_csv, VTY_NEWLINE); | |
7284 | } | |
7285 | } | |
7286 | else if (!count) | |
4bf6a362 PJ |
7287 | { |
7288 | unsigned long ents; | |
7289 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
7290 | ||
7291 | /* Usage summary and header */ | |
7292 | vty_out (vty, | |
aea339f7 | 7293 | "BGP router identifier %s, local AS number %u%s", |
4bf6a362 | 7294 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
f188f2c4 DS |
7295 | if (bgp_update_delay_configured(bgp)) |
7296 | { | |
7297 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", | |
7298 | bgp->v_update_delay, VTY_NEWLINE); | |
7299 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
7300 | vty_out (vty, " Establish wait: %d seconds%s", | |
7301 | bgp->v_establish_wait, VTY_NEWLINE); | |
7302 | if (bgp_update_delay_active(bgp)) | |
7303 | { | |
7304 | vty_out (vty, " First neighbor established: %s%s", | |
7305 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
7306 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); | |
7307 | } | |
7308 | else | |
7309 | { | |
7310 | if (bgp->update_delay_over) | |
7311 | { | |
7312 | vty_out (vty, " First neighbor established: %s%s", | |
7313 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
7314 | vty_out (vty, " Best-paths/updates resumed: %s%s", | |
7315 | bgp->update_delay_end_time, VTY_NEWLINE); | |
7316 | } | |
7317 | } | |
7318 | } | |
4bf6a362 PJ |
7319 | |
7320 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
7321 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
7322 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7323 | ents * sizeof (struct bgp_node)), | |
7324 | VTY_NEWLINE); | |
7325 | ||
7326 | /* Peer related usage */ | |
7327 | ents = listcount (bgp->peer); | |
7328 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
7329 | ents, | |
7330 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7331 | ents * sizeof (struct peer)), | |
7332 | VTY_NEWLINE); | |
7333 | ||
7334 | if ((ents = listcount (bgp->rsclient))) | |
7335 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", | |
7336 | ents, | |
7337 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7338 | ents * sizeof (struct peer)), | |
7339 | VTY_NEWLINE); | |
7340 | ||
7341 | if ((ents = listcount (bgp->group))) | |
7342 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
7343 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7344 | ents * sizeof (struct peer_group)), | |
7345 | VTY_NEWLINE); | |
7346 | ||
7347 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
7348 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
7349 | vty_out (vty, "%s", VTY_NEWLINE); | |
7350 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
7351 | } | |
7352 | ||
718e3744 | 7353 | count++; |
7354 | ||
7355 | len = vty_out (vty, "%s", peer->host); | |
7356 | len = 16 - len; | |
7357 | if (len < 1) | |
7358 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
7359 | else | |
7360 | vty_out (vty, "%*s", len, " "); | |
7361 | ||
47fc97cc DS |
7362 | if (delimit) |
7363 | vty_out(vty, "%c", *delimit); | |
718e3744 | 7364 | |
47fc97cc | 7365 | vty_out (vty, "4 "); |
718e3744 | 7366 | |
47fc97cc DS |
7367 | if (delimit) |
7368 | vty_out(vty, "%c", *delimit); | |
7369 | ||
7370 | if (!delimit) | |
cdabb8b6 | 7371 | vty_out (vty, "%5u %7d %7d %8d %4d %4lu ", |
47fc97cc DS |
7372 | peer->as, |
7373 | peer->open_in + peer->update_in + peer->keepalive_in | |
7374 | + peer->notify_in + peer->refresh_in | |
7375 | + peer->dynamic_cap_in, | |
7376 | peer->open_out + peer->update_out + peer->keepalive_out | |
7377 | + peer->notify_out + peer->refresh_out | |
7378 | + peer->dynamic_cap_out, | |
7379 | 0, | |
7380 | 0, | |
cdabb8b6 DS |
7381 | peer->sync[afi][safi]->update.count + |
7382 | peer->sync[afi][safi]->withdraw.count); | |
47fc97cc DS |
7383 | else |
7384 | vty_out (vty, "%5u %c %7d %c %7d %c %8d %c %4d %c %4lu %c", | |
7385 | peer->as, *delimit, | |
7386 | peer->open_in + peer->update_in + peer->keepalive_in | |
7387 | + peer->notify_in + peer->refresh_in | |
7388 | + peer->dynamic_cap_in, *delimit, | |
7389 | peer->open_out + peer->update_out + peer->keepalive_out | |
7390 | + peer->notify_out + peer->refresh_out | |
7391 | + peer->dynamic_cap_out, *delimit, | |
7392 | 0, *delimit, | |
7393 | 0, *delimit, | |
cdabb8b6 DS |
7394 | peer->sync[afi][safi]->update.count + |
7395 | peer->sync[afi][safi]->withdraw.count, *delimit); | |
47fc97cc DS |
7396 | |
7397 | vty_out (vty, "%8s", | |
718e3744 | 7398 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
47fc97cc DS |
7399 | if (delimit) |
7400 | vty_out(vty, "%c", *delimit); | |
718e3744 | 7401 | |
7402 | if (peer->status == Established) | |
718e3744 | 7403 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
718e3744 | 7404 | else |
7405 | { | |
7406 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
7407 | vty_out (vty, " Idle (Admin)"); | |
7408 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
7409 | vty_out (vty, " Idle (PfxCt)"); | |
7410 | else | |
7411 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
7412 | } | |
47fc97cc DS |
7413 | if (delimit) |
7414 | vty_out(vty, ", %d", bgp_adj_out_count(peer, afi, safi)); | |
718e3744 | 7415 | |
7416 | vty_out (vty, "%s", VTY_NEWLINE); | |
7417 | } | |
7418 | } | |
7419 | ||
7420 | if (count) | |
7421 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
7422 | count, VTY_NEWLINE); | |
7423 | else | |
7424 | vty_out (vty, "No %s neighbor is configured%s", | |
7425 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
f188f2c4 | 7426 | |
718e3744 | 7427 | return CMD_SUCCESS; |
7428 | } | |
7429 | ||
47fc97cc DS |
7430 | static int |
7431 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
7432 | afi_t afi, safi_t safi, char *delimit) | |
718e3744 | 7433 | { |
7434 | struct bgp *bgp; | |
7435 | ||
7436 | if (name) | |
7437 | { | |
7438 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 7439 | |
718e3744 | 7440 | if (! bgp) |
7441 | { | |
47fc97cc | 7442 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 7443 | return CMD_WARNING; |
7444 | } | |
7445 | ||
47fc97cc | 7446 | bgp_show_summary (vty, bgp, afi, safi, delimit); |
718e3744 | 7447 | return CMD_SUCCESS; |
7448 | } | |
47fc97cc | 7449 | |
718e3744 | 7450 | bgp = bgp_get_default (); |
7451 | ||
7452 | if (bgp) | |
47fc97cc DS |
7453 | bgp_show_summary (vty, bgp, afi, safi, delimit); |
7454 | ||
718e3744 | 7455 | return CMD_SUCCESS; |
7456 | } | |
7457 | ||
7458 | /* `show ip bgp summary' commands. */ | |
47fc97cc | 7459 | DEFUN (show_ip_bgp_summary, |
718e3744 | 7460 | show_ip_bgp_summary_cmd, |
7461 | "show ip bgp summary", | |
7462 | SHOW_STR | |
7463 | IP_STR | |
7464 | BGP_STR | |
7465 | "Summary of BGP neighbor status\n") | |
7466 | { | |
47fc97cc DS |
7467 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, NULL); |
7468 | } | |
7469 | ||
7470 | DEFUN (show_ip_bgp_summary_csv, | |
7471 | show_ip_bgp_summary_csv_cmd, | |
7472 | "show ip bgp summary csv", | |
7473 | SHOW_STR | |
7474 | IP_STR | |
7475 | BGP_STR | |
7476 | "Summary of BGP neighbor status\n") | |
7477 | { | |
7478 | char csv = ','; | |
7479 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, &csv); | |
718e3744 | 7480 | } |
7481 | ||
7482 | DEFUN (show_ip_bgp_instance_summary, | |
7483 | show_ip_bgp_instance_summary_cmd, | |
7484 | "show ip bgp view WORD summary", | |
7485 | SHOW_STR | |
7486 | IP_STR | |
7487 | BGP_STR | |
7488 | "BGP view\n" | |
7489 | "View name\n" | |
7490 | "Summary of BGP neighbor status\n") | |
7491 | { | |
47fc97cc | 7492 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, NULL); |
718e3744 | 7493 | } |
7494 | ||
7495 | DEFUN (show_ip_bgp_ipv4_summary, | |
7496 | show_ip_bgp_ipv4_summary_cmd, | |
7497 | "show ip bgp ipv4 (unicast|multicast) summary", | |
7498 | SHOW_STR | |
7499 | IP_STR | |
7500 | BGP_STR | |
7501 | "Address family\n" | |
7502 | "Address Family modifier\n" | |
7503 | "Address Family modifier\n" | |
7504 | "Summary of BGP neighbor status\n") | |
7505 | { | |
7506 | if (strncmp (argv[0], "m", 1) == 0) | |
47fc97cc | 7507 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, NULL); |
718e3744 | 7508 | |
47fc97cc | 7509 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, NULL); |
718e3744 | 7510 | } |
7511 | ||
95cbbd2a ML |
7512 | ALIAS (show_ip_bgp_ipv4_summary, |
7513 | show_bgp_ipv4_safi_summary_cmd, | |
7514 | "show bgp ipv4 (unicast|multicast) summary", | |
7515 | SHOW_STR | |
7516 | BGP_STR | |
7517 | "Address family\n" | |
7518 | "Address Family modifier\n" | |
7519 | "Address Family modifier\n" | |
7520 | "Summary of BGP neighbor status\n") | |
7521 | ||
718e3744 | 7522 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
7523 | show_ip_bgp_instance_ipv4_summary_cmd, | |
7524 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", | |
7525 | SHOW_STR | |
7526 | IP_STR | |
7527 | BGP_STR | |
7528 | "BGP view\n" | |
7529 | "View name\n" | |
7530 | "Address family\n" | |
7531 | "Address Family modifier\n" | |
7532 | "Address Family modifier\n" | |
7533 | "Summary of BGP neighbor status\n") | |
7534 | { | |
7535 | if (strncmp (argv[1], "m", 1) == 0) | |
47fc97cc | 7536 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, NULL); |
718e3744 | 7537 | else |
47fc97cc | 7538 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, NULL); |
718e3744 | 7539 | } |
7540 | ||
95cbbd2a ML |
7541 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
7542 | show_bgp_instance_ipv4_safi_summary_cmd, | |
7543 | "show bgp view WORD ipv4 (unicast|multicast) summary", | |
7544 | SHOW_STR | |
7545 | BGP_STR | |
7546 | "BGP view\n" | |
7547 | "View name\n" | |
7548 | "Address family\n" | |
7549 | "Address Family modifier\n" | |
7550 | "Address Family modifier\n" | |
7551 | "Summary of BGP neighbor status\n") | |
7552 | ||
718e3744 | 7553 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
7554 | show_ip_bgp_vpnv4_all_summary_cmd, | |
7555 | "show ip bgp vpnv4 all summary", | |
7556 | SHOW_STR | |
7557 | IP_STR | |
7558 | BGP_STR | |
7559 | "Display VPNv4 NLRI specific information\n" | |
7560 | "Display information about all VPNv4 NLRIs\n" | |
7561 | "Summary of BGP neighbor status\n") | |
7562 | { | |
47fc97cc | 7563 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, NULL); |
718e3744 | 7564 | } |
7565 | ||
7566 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
7567 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
7568 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", | |
7569 | SHOW_STR | |
7570 | IP_STR | |
7571 | BGP_STR | |
7572 | "Display VPNv4 NLRI specific information\n" | |
7573 | "Display information for a route distinguisher\n" | |
7574 | "VPN Route Distinguisher\n" | |
7575 | "Summary of BGP neighbor status\n") | |
7576 | { | |
7577 | int ret; | |
7578 | struct prefix_rd prd; | |
7579 | ||
7580 | ret = str2prefix_rd (argv[0], &prd); | |
7581 | if (! ret) | |
7582 | { | |
7583 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
7584 | return CMD_WARNING; | |
7585 | } | |
7586 | ||
47fc97cc | 7587 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, NULL); |
718e3744 | 7588 | } |
7589 | ||
7590 | #ifdef HAVE_IPV6 | |
47fc97cc | 7591 | DEFUN (show_bgp_summary, |
718e3744 | 7592 | show_bgp_summary_cmd, |
7593 | "show bgp summary", | |
7594 | SHOW_STR | |
7595 | BGP_STR | |
7596 | "Summary of BGP neighbor status\n") | |
7597 | { | |
47fc97cc DS |
7598 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, NULL); |
7599 | } | |
7600 | ||
7601 | DEFUN (show_bgp_summary_csv, | |
7602 | show_bgp_summary_csv_cmd, | |
7603 | "show bgp summary csv", | |
7604 | SHOW_STR | |
7605 | BGP_STR | |
7606 | "Summary of BGP neighbor status\n") | |
7607 | { | |
7608 | char csv = ','; | |
7609 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, &csv); | |
718e3744 | 7610 | } |
7611 | ||
7612 | DEFUN (show_bgp_instance_summary, | |
7613 | show_bgp_instance_summary_cmd, | |
7614 | "show bgp view WORD summary", | |
7615 | SHOW_STR | |
7616 | BGP_STR | |
7617 | "BGP view\n" | |
7618 | "View name\n" | |
7619 | "Summary of BGP neighbor status\n") | |
7620 | { | |
47fc97cc | 7621 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, NULL); |
718e3744 | 7622 | } |
7623 | ||
7624 | ALIAS (show_bgp_summary, | |
7625 | show_bgp_ipv6_summary_cmd, | |
7626 | "show bgp ipv6 summary", | |
7627 | SHOW_STR | |
7628 | BGP_STR | |
7629 | "Address family\n" | |
7630 | "Summary of BGP neighbor status\n") | |
7631 | ||
7632 | ALIAS (show_bgp_instance_summary, | |
7633 | show_bgp_instance_ipv6_summary_cmd, | |
7634 | "show bgp view WORD ipv6 summary", | |
7635 | SHOW_STR | |
7636 | BGP_STR | |
7637 | "BGP view\n" | |
7638 | "View name\n" | |
7639 | "Address family\n" | |
7640 | "Summary of BGP neighbor status\n") | |
7641 | ||
95cbbd2a ML |
7642 | DEFUN (show_bgp_ipv6_safi_summary, |
7643 | show_bgp_ipv6_safi_summary_cmd, | |
7644 | "show bgp ipv6 (unicast|multicast) summary", | |
7645 | SHOW_STR | |
7646 | BGP_STR | |
7647 | "Address family\n" | |
7648 | "Address Family modifier\n" | |
7649 | "Address Family modifier\n" | |
7650 | "Summary of BGP neighbor status\n") | |
7651 | { | |
7652 | if (strncmp (argv[0], "m", 1) == 0) | |
47fc97cc | 7653 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, NULL); |
95cbbd2a | 7654 | |
47fc97cc | 7655 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, NULL); |
95cbbd2a ML |
7656 | } |
7657 | ||
7658 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
7659 | show_bgp_instance_ipv6_safi_summary_cmd, | |
7660 | "show bgp view WORD ipv6 (unicast|multicast) summary", | |
7661 | SHOW_STR | |
7662 | BGP_STR | |
7663 | "BGP view\n" | |
7664 | "View name\n" | |
7665 | "Address family\n" | |
7666 | "Address Family modifier\n" | |
7667 | "Address Family modifier\n" | |
7668 | "Summary of BGP neighbor status\n") | |
7669 | { | |
7670 | if (strncmp (argv[1], "m", 1) == 0) | |
47fc97cc | 7671 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST, NULL); |
95cbbd2a | 7672 | |
47fc97cc | 7673 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, NULL); |
95cbbd2a ML |
7674 | } |
7675 | ||
718e3744 | 7676 | /* old command */ |
7677 | DEFUN (show_ipv6_bgp_summary, | |
7678 | show_ipv6_bgp_summary_cmd, | |
7679 | "show ipv6 bgp summary", | |
7680 | SHOW_STR | |
7681 | IPV6_STR | |
7682 | BGP_STR | |
7683 | "Summary of BGP neighbor status\n") | |
7684 | { | |
47fc97cc | 7685 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, NULL); |
718e3744 | 7686 | } |
7687 | ||
7688 | /* old command */ | |
7689 | DEFUN (show_ipv6_mbgp_summary, | |
7690 | show_ipv6_mbgp_summary_cmd, | |
7691 | "show ipv6 mbgp summary", | |
7692 | SHOW_STR | |
7693 | IPV6_STR | |
7694 | MBGP_STR | |
7695 | "Summary of BGP neighbor status\n") | |
7696 | { | |
47fc97cc | 7697 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, NULL); |
718e3744 | 7698 | } |
7699 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 7700 | |
fd79ac91 | 7701 | const char * |
538621f2 | 7702 | afi_safi_print (afi_t afi, safi_t safi) |
7703 | { | |
7704 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
7705 | return "IPv4 Unicast"; | |
7706 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
7707 | return "IPv4 Multicast"; | |
7708 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
7709 | return "VPNv4 Unicast"; | |
7710 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) | |
7711 | return "IPv6 Unicast"; | |
7712 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
7713 | return "IPv6 Multicast"; | |
7714 | else | |
7715 | return "Unknown"; | |
7716 | } | |
7717 | ||
718e3744 | 7718 | /* Show BGP peer's information. */ |
7719 | enum show_type | |
7720 | { | |
7721 | show_all, | |
7722 | show_peer | |
7723 | }; | |
7724 | ||
94f2b392 | 7725 | static void |
718e3744 | 7726 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
7727 | afi_t afi, safi_t safi, | |
7728 | u_int16_t adv_smcap, u_int16_t adv_rmcap, | |
7729 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) | |
7730 | { | |
7731 | /* Send-Mode */ | |
7732 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
7733 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
7734 | { | |
7735 | vty_out (vty, " Send-mode: "); | |
7736 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
7737 | vty_out (vty, "advertised"); | |
7738 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
7739 | vty_out (vty, "%sreceived", | |
7740 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
7741 | ", " : ""); | |
7742 | vty_out (vty, "%s", VTY_NEWLINE); | |
7743 | } | |
7744 | ||
7745 | /* Receive-Mode */ | |
7746 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
7747 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
7748 | { | |
7749 | vty_out (vty, " Receive-mode: "); | |
7750 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
7751 | vty_out (vty, "advertised"); | |
7752 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
7753 | vty_out (vty, "%sreceived", | |
7754 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
7755 | ", " : ""); | |
7756 | vty_out (vty, "%s", VTY_NEWLINE); | |
7757 | } | |
7758 | } | |
7759 | ||
94f2b392 | 7760 | static void |
718e3744 | 7761 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
7762 | { | |
7763 | struct bgp_filter *filter; | |
7764 | char orf_pfx_name[BUFSIZ]; | |
7765 | int orf_pfx_count; | |
7766 | ||
7767 | filter = &p->filter[afi][safi]; | |
7768 | ||
538621f2 | 7769 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
718e3744 | 7770 | VTY_NEWLINE); |
538621f2 | 7771 | |
718e3744 | 7772 | if (p->af_group[afi][safi]) |
7773 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); | |
7774 | ||
7775 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
7776 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
7777 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
7778 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
7779 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
7780 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
7781 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
7782 | ||
7783 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
7784 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
7785 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
7786 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
7787 | { | |
7788 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
7789 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
7790 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
7791 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
7792 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
7793 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
7794 | PEER_CAP_ORF_PREFIX_RM_RCV); | |
7795 | } | |
7796 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
7797 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
7798 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
7799 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
7800 | { | |
7801 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
7802 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
7803 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
7804 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
7805 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
7806 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
7807 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); | |
7808 | } | |
7809 | ||
7810 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
7811 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); | |
7812 | ||
7813 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
7814 | || orf_pfx_count) | |
7815 | { | |
7816 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
7817 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
7818 | vty_out (vty, " sent;"); | |
7819 | if (orf_pfx_count) | |
7820 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
7821 | vty_out (vty, "%s", VTY_NEWLINE); | |
7822 | } | |
7823 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
7824 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
7825 | ||
7826 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
7827 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
7828 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
7829 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
7830 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
7831 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
7832 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) | |
7833 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); | |
7834 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) | |
7835 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); | |
7836 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
7837 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
7838 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
7839 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
7840 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
7841 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
7842 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
7843 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
7844 | { | |
7845 | vty_out (vty, " Community attribute sent to this neighbor"); | |
7846 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
7847 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
538621f2 | 7848 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
718e3744 | 7849 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
538621f2 | 7850 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
718e3744 | 7851 | else |
538621f2 | 7852 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
718e3744 | 7853 | } |
7854 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
7855 | { | |
7856 | vty_out (vty, " Default information originate,"); | |
7857 | ||
7858 | if (p->default_rmap[afi][safi].name) | |
7859 | vty_out (vty, " default route-map %s%s,", | |
7860 | p->default_rmap[afi][safi].map ? "*" : "", | |
7861 | p->default_rmap[afi][safi].name); | |
7862 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) | |
7863 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
7864 | else | |
7865 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
7866 | } | |
7867 | ||
7868 | if (filter->plist[FILTER_IN].name | |
7869 | || filter->dlist[FILTER_IN].name | |
7870 | || filter->aslist[FILTER_IN].name | |
fee0f4c6 | 7871 | || filter->map[RMAP_IN].name) |
718e3744 | 7872 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
7873 | if (filter->plist[FILTER_OUT].name | |
7874 | || filter->dlist[FILTER_OUT].name | |
7875 | || filter->aslist[FILTER_OUT].name | |
fee0f4c6 | 7876 | || filter->map[RMAP_OUT].name |
718e3744 | 7877 | || filter->usmap.name) |
7878 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
fee0f4c6 | 7879 | if (filter->map[RMAP_IMPORT].name) |
7880 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); | |
7881 | if (filter->map[RMAP_EXPORT].name) | |
7882 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); | |
718e3744 | 7883 | |
7884 | /* prefix-list */ | |
7885 | if (filter->plist[FILTER_IN].name) | |
7886 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
7887 | filter->plist[FILTER_IN].plist ? "*" : "", | |
7888 | filter->plist[FILTER_IN].name, | |
7889 | VTY_NEWLINE); | |
7890 | if (filter->plist[FILTER_OUT].name) | |
7891 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
7892 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
7893 | filter->plist[FILTER_OUT].name, | |
7894 | VTY_NEWLINE); | |
7895 | ||
7896 | /* distribute-list */ | |
7897 | if (filter->dlist[FILTER_IN].name) | |
7898 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
7899 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
7900 | filter->dlist[FILTER_IN].name, | |
7901 | VTY_NEWLINE); | |
7902 | if (filter->dlist[FILTER_OUT].name) | |
7903 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
7904 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
7905 | filter->dlist[FILTER_OUT].name, | |
7906 | VTY_NEWLINE); | |
7907 | ||
7908 | /* filter-list. */ | |
7909 | if (filter->aslist[FILTER_IN].name) | |
7910 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
7911 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
7912 | filter->aslist[FILTER_IN].name, | |
7913 | VTY_NEWLINE); | |
7914 | if (filter->aslist[FILTER_OUT].name) | |
7915 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
7916 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
7917 | filter->aslist[FILTER_OUT].name, | |
7918 | VTY_NEWLINE); | |
7919 | ||
7920 | /* route-map. */ | |
fee0f4c6 | 7921 | if (filter->map[RMAP_IN].name) |
718e3744 | 7922 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
fee0f4c6 | 7923 | filter->map[RMAP_IN].map ? "*" : "", |
7924 | filter->map[RMAP_IN].name, | |
718e3744 | 7925 | VTY_NEWLINE); |
fee0f4c6 | 7926 | if (filter->map[RMAP_OUT].name) |
718e3744 | 7927 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
fee0f4c6 | 7928 | filter->map[RMAP_OUT].map ? "*" : "", |
7929 | filter->map[RMAP_OUT].name, | |
7930 | VTY_NEWLINE); | |
7931 | if (filter->map[RMAP_IMPORT].name) | |
7932 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", | |
7933 | filter->map[RMAP_IMPORT].map ? "*" : "", | |
7934 | filter->map[RMAP_IMPORT].name, | |
7935 | VTY_NEWLINE); | |
7936 | if (filter->map[RMAP_EXPORT].name) | |
7937 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", | |
7938 | filter->map[RMAP_EXPORT].map ? "*" : "", | |
7939 | filter->map[RMAP_EXPORT].name, | |
718e3744 | 7940 | VTY_NEWLINE); |
7941 | ||
7942 | /* unsuppress-map */ | |
7943 | if (filter->usmap.name) | |
7944 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
7945 | filter->usmap.map ? "*" : "", | |
7946 | filter->usmap.name, VTY_NEWLINE); | |
7947 | ||
7948 | /* Receive prefix count */ | |
e0701b79 | 7949 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
7950 | ||
718e3744 | 7951 | /* Maximum prefix */ |
7952 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
7953 | { | |
0a486e5f | 7954 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
718e3744 | 7955 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
0a486e5f | 7956 | ? " (warning-only)" : "", VTY_NEWLINE); |
7957 | vty_out (vty, " Threshold for warning message %d%%", | |
7958 | p->pmax_threshold[afi][safi]); | |
7959 | if (p->pmax_restart[afi][safi]) | |
7960 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
7961 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 7962 | } |
718e3744 | 7963 | |
7964 | vty_out (vty, "%s", VTY_NEWLINE); | |
7965 | } | |
7966 | ||
94f2b392 | 7967 | static void |
718e3744 | 7968 | bgp_show_peer (struct vty *vty, struct peer *p) |
7969 | { | |
7970 | struct bgp *bgp; | |
a80beece | 7971 | char buf1[BUFSIZ], buf[SU_ADDRSTRLEN]; |
718e3744 | 7972 | char timebuf[BGP_UPTIME_LEN]; |
538621f2 | 7973 | afi_t afi; |
7974 | safi_t safi; | |
d6661008 DS |
7975 | u_int16_t i; |
7976 | u_char *msg; | |
718e3744 | 7977 | |
7978 | bgp = p->bgp; | |
7979 | ||
a80beece DS |
7980 | if (p->conf_if) /* Configured interface name. */ |
7981 | vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if, | |
7982 | BGP_PEER_SU_UNSPEC(p) ? "None" : | |
7983 | sockunion2str (&p->su, buf, SU_ADDRSTRLEN)); | |
7984 | else /* Configured IP address. */ | |
7985 | vty_out (vty, "BGP neighbor is %s, ", p->host); | |
aea339f7 | 7986 | vty_out (vty, "remote AS %u, ", p->as); |
9d3f9705 | 7987 | vty_out (vty, "local AS %u%s%s, ", |
718e3744 | 7988 | p->change_local_as ? p->change_local_as : p->local_as, |
7989 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
9d3f9705 AC |
7990 | " no-prepend" : "", |
7991 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
7992 | " replace-as" : ""); | |
718e3744 | 7993 | vty_out (vty, "%s link%s", |
7994 | p->as == p->local_as ? "internal" : "external", | |
7995 | VTY_NEWLINE); | |
7996 | ||
7997 | /* Description. */ | |
7998 | if (p->desc) | |
7999 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
8000 | ||
8001 | /* Peer-group */ | |
8002 | if (p->group) | |
8003 | vty_out (vty, " Member of peer-group %s for session parameters%s", | |
8004 | p->group->name, VTY_NEWLINE); | |
8005 | ||
8006 | /* Administrative shutdown. */ | |
8007 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
8008 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
8009 | ||
8010 | /* BGP Version. */ | |
8011 | vty_out (vty, " BGP version 4"); | |
718e3744 | 8012 | vty_out (vty, ", remote router ID %s%s", |
8013 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
8014 | VTY_NEWLINE); | |
8015 | ||
8016 | /* Confederation */ | |
e0701b79 | 8017 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
8018 | && bgp_confederation_peers_check (bgp, p->as)) | |
718e3744 | 8019 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
8020 | ||
8021 | /* Status. */ | |
8022 | vty_out (vty, " BGP state = %s", | |
8023 | LOOKUP (bgp_status_msg, p->status)); | |
8024 | if (p->status == Established) | |
8025 | vty_out (vty, ", up for %8s", | |
8026 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); | |
93406d87 | 8027 | else if (p->status == Active) |
8028 | { | |
8029 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
8030 | vty_out (vty, " (passive)"); | |
8031 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
8032 | vty_out (vty, " (NSF passive)"); | |
8033 | } | |
718e3744 | 8034 | vty_out (vty, "%s", VTY_NEWLINE); |
8035 | ||
8036 | /* read timer */ | |
8037 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); | |
cb1faec9 DS |
8038 | vty_out (vty, ", Last write %s%s", |
8039 | peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN), VTY_NEWLINE); | |
718e3744 | 8040 | |
8041 | /* Configured timer values. */ | |
cb1faec9 | 8042 | vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s", |
718e3744 | 8043 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); |
8044 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
8045 | { | |
8046 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
8047 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
8048 | p->keepalive, VTY_NEWLINE); | |
8049 | } | |
93406d87 | 8050 | |
718e3744 | 8051 | /* Capability. */ |
8052 | if (p->status == Established) | |
8053 | { | |
538621f2 | 8054 | if (p->cap |
718e3744 | 8055 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
8056 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
8057 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
8058 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
8059 | #ifdef HAVE_IPV6 | |
8060 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
8061 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
8062 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
8063 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
8064 | #endif /* HAVE_IPV6 */ | |
8065 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] | |
8066 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
8067 | { | |
8068 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
8069 | ||
0b2aa3a0 PJ |
8070 | /* AS4 */ |
8071 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
8072 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
8073 | { | |
8074 | vty_out (vty, " 4 Byte AS:"); | |
8075 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
8076 | vty_out (vty, " advertised"); | |
8077 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
8078 | vty_out (vty, " %sreceived", | |
8079 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
8080 | vty_out (vty, "%s", VTY_NEWLINE); | |
8081 | } | |
718e3744 | 8082 | /* Dynamic */ |
8083 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
8084 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
8085 | { | |
8086 | vty_out (vty, " Dynamic:"); | |
8087 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
8088 | vty_out (vty, " advertised"); | |
8089 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
538621f2 | 8090 | vty_out (vty, " %sreceived", |
8091 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
718e3744 | 8092 | vty_out (vty, "%s", VTY_NEWLINE); |
8093 | } | |
8094 | ||
8095 | /* Route Refresh */ | |
8096 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
8097 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
8098 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
8099 | { | |
8100 | vty_out (vty, " Route refresh:"); | |
8101 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
8102 | vty_out (vty, " advertised"); | |
8103 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
8104 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
538621f2 | 8105 | vty_out (vty, " %sreceived(%s)", |
8106 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
8107 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
8108 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
8109 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
718e3744 | 8110 | |
718e3744 | 8111 | vty_out (vty, "%s", VTY_NEWLINE); |
8112 | } | |
538621f2 | 8113 | |
8114 | /* Multiprotocol Extensions */ | |
8115 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
8116 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
8117 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
718e3744 | 8118 | { |
538621f2 | 8119 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
8120 | if (p->afc_adv[afi][safi]) | |
8121 | vty_out (vty, " advertised"); | |
8122 | if (p->afc_recv[afi][safi]) | |
8123 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
8124 | vty_out (vty, "%s", VTY_NEWLINE); | |
8125 | } | |
8126 | ||
8127 | /* Gracefull Restart */ | |
8128 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
8129 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 8130 | { |
538621f2 | 8131 | vty_out (vty, " Graceful Restart Capabilty:"); |
8132 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 8133 | vty_out (vty, " advertised"); |
538621f2 | 8134 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
8135 | vty_out (vty, " %sreceived", | |
8136 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
718e3744 | 8137 | vty_out (vty, "%s", VTY_NEWLINE); |
538621f2 | 8138 | |
8139 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
718e3744 | 8140 | { |
538621f2 | 8141 | int restart_af_count = 0; |
8142 | ||
8143 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
93406d87 | 8144 | p->v_gr_restart, VTY_NEWLINE); |
8145 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
538621f2 | 8146 | |
8147 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
8148 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
8149 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
8150 | { | |
93406d87 | 8151 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
8152 | afi_safi_print (afi, safi), | |
8153 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
8154 | "preserved" : "not preserved"); | |
538621f2 | 8155 | restart_af_count++; |
93406d87 | 8156 | } |
538621f2 | 8157 | if (! restart_af_count) |
8158 | vty_out (vty, "none"); | |
8159 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 8160 | } |
718e3744 | 8161 | } |
718e3744 | 8162 | } |
8163 | } | |
8164 | ||
93406d87 | 8165 | /* graceful restart information */ |
8166 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
8167 | || p->t_gr_restart | |
8168 | || p->t_gr_stale) | |
8169 | { | |
8170 | int eor_send_af_count = 0; | |
8171 | int eor_receive_af_count = 0; | |
8172 | ||
8173 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
8174 | if (p->status == Established) | |
8175 | { | |
8176 | vty_out (vty, " End-of-RIB send: "); | |
8177 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
8178 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
8179 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
8180 | { | |
8181 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
8182 | afi_safi_print (afi, safi)); | |
8183 | eor_send_af_count++; | |
8184 | } | |
8185 | vty_out (vty, "%s", VTY_NEWLINE); | |
8186 | ||
8187 | vty_out (vty, " End-of-RIB received: "); | |
8188 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
8189 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
8190 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
8191 | { | |
8192 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
8193 | afi_safi_print (afi, safi)); | |
8194 | eor_receive_af_count++; | |
8195 | } | |
8196 | vty_out (vty, "%s", VTY_NEWLINE); | |
8197 | } | |
8198 | ||
8199 | if (p->t_gr_restart) | |
0b2aa3a0 PJ |
8200 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
8201 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
8202 | ||
93406d87 | 8203 | if (p->t_gr_stale) |
0b2aa3a0 PJ |
8204 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
8205 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
93406d87 | 8206 | } |
8207 | ||
718e3744 | 8208 | /* Packet counts. */ |
93406d87 | 8209 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
8210 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
0b2aa3a0 | 8211 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); |
93406d87 | 8212 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
8213 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
8214 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
8215 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
8216 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
8217 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
8218 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
8219 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
8220 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
8221 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
8222 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 8223 | |
8224 | /* advertisement-interval */ | |
8225 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
8226 | p->v_routeadv, VTY_NEWLINE); | |
8227 | ||
8228 | /* Update-source. */ | |
8229 | if (p->update_if || p->update_source) | |
8230 | { | |
8231 | vty_out (vty, " Update source is "); | |
8232 | if (p->update_if) | |
8233 | vty_out (vty, "%s", p->update_if); | |
8234 | else if (p->update_source) | |
8235 | vty_out (vty, "%s", | |
8236 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
8237 | vty_out (vty, "%s", VTY_NEWLINE); | |
8238 | } | |
8239 | ||
8240 | /* Default weight */ | |
8241 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
8242 | vty_out (vty, " Default weight %d%s", p->weight, | |
8243 | VTY_NEWLINE); | |
8244 | ||
8245 | vty_out (vty, "%s", VTY_NEWLINE); | |
8246 | ||
8247 | /* Address Family Information */ | |
538621f2 | 8248 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
8249 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
8250 | if (p->afc[afi][safi]) | |
8251 | bgp_show_peer_afi (vty, p, afi, safi); | |
718e3744 | 8252 | |
8253 | vty_out (vty, " Connections established %d; dropped %d%s", | |
8254 | p->established, p->dropped, | |
8255 | VTY_NEWLINE); | |
8256 | ||
d6661008 | 8257 | if (! p->last_reset) |
e0701b79 | 8258 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); |
8259 | else | |
d6661008 DS |
8260 | { |
8261 | vty_out (vty, " Last reset %s, due to %s%s", | |
8262 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), | |
8263 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
8264 | ||
8265 | if (p->last_reset_cause_size) | |
8266 | { | |
8267 | msg = p->last_reset_cause; | |
8268 | vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE); | |
8269 | for (i = 1; i <= p->last_reset_cause_size; i++) | |
8270 | { | |
8271 | vty_out(vty, "%02X", *msg++); | |
8272 | ||
8273 | if (i != p->last_reset_cause_size) | |
8274 | if (i % 16 == 0) | |
8275 | vty_out(vty, "%s ", VTY_NEWLINE); | |
8276 | else if (i % 4 == 0) | |
8277 | vty_out(vty, " "); | |
8278 | } | |
8279 | vty_out(vty, "%s", VTY_NEWLINE); | |
8280 | } | |
8281 | } | |
848973c7 | 8282 | |
718e3744 | 8283 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
8284 | { | |
8285 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 8286 | |
8287 | if (p->t_pmax_restart) | |
8288 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
8289 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
8290 | VTY_NEWLINE); | |
8291 | else | |
8292 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
8293 | p->host, VTY_NEWLINE); | |
718e3744 | 8294 | } |
8295 | ||
f5a4827d | 8296 | /* EBGP Multihop and GTSM */ |
6d85b15b | 8297 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d SH |
8298 | { |
8299 | if (p->gtsm_hops > 0) | |
8300 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
8301 | p->gtsm_hops, VTY_NEWLINE); | |
8302 | else if (p->ttl > 1) | |
8303 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
8304 | p->ttl, VTY_NEWLINE); | |
8305 | } | |
5d804b43 PM |
8306 | else |
8307 | { | |
8308 | if (p->gtsm_hops > 0) | |
8309 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
8310 | p->gtsm_hops, VTY_NEWLINE); | |
8311 | } | |
718e3744 | 8312 | |
8313 | /* Local address. */ | |
8314 | if (p->su_local) | |
8315 | { | |
93406d87 | 8316 | vty_out (vty, "Local host: %s, Local port: %d%s", |
718e3744 | 8317 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
8318 | ntohs (p->su_local->sin.sin_port), | |
718e3744 | 8319 | VTY_NEWLINE); |
8320 | } | |
8321 | ||
8322 | /* Remote address. */ | |
8323 | if (p->su_remote) | |
8324 | { | |
8325 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
8326 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), | |
8327 | ntohs (p->su_remote->sin.sin_port), | |
8328 | VTY_NEWLINE); | |
8329 | } | |
8330 | ||
8331 | /* Nexthop display. */ | |
8332 | if (p->su_local) | |
8333 | { | |
8334 | vty_out (vty, "Nexthop: %s%s", | |
8335 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
8336 | VTY_NEWLINE); | |
8337 | #ifdef HAVE_IPV6 | |
8338 | vty_out (vty, "Nexthop global: %s%s", | |
8339 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
8340 | VTY_NEWLINE); | |
8341 | vty_out (vty, "Nexthop local: %s%s", | |
8342 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
8343 | VTY_NEWLINE); | |
8344 | vty_out (vty, "BGP connection: %s%s", | |
8345 | p->shared_network ? "shared network" : "non shared network", | |
8346 | VTY_NEWLINE); | |
8347 | #endif /* HAVE_IPV6 */ | |
8348 | } | |
8349 | ||
8350 | /* Timer information. */ | |
8351 | if (p->t_start) | |
8352 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
8353 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
8354 | if (p->t_connect) | |
8355 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
8356 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
cb1faec9 DS |
8357 | if (p->t_routeadv) |
8358 | vty_out (vty, "MRAI (interval %ld) timer expires in %ld seconds%s", | |
8359 | p->v_routeadv, thread_timer_remain_second (p->t_routeadv), | |
8360 | VTY_NEWLINE); | |
8361 | ||
8362 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
718e3744 | 8363 | p->t_read ? "on" : "off", |
8364 | p->t_write ? "on" : "off", | |
8365 | VTY_NEWLINE); | |
8366 | ||
8367 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
8368 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
8369 | bgp_capability_vty_out (vty, p); | |
8370 | ||
8371 | vty_out (vty, "%s", VTY_NEWLINE); | |
8372 | } | |
8373 | ||
94f2b392 | 8374 | static int |
718e3744 | 8375 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
a80beece | 8376 | enum show_type type, union sockunion *su, const char *conf_if) |
718e3744 | 8377 | { |
1eb8ef25 | 8378 | struct listnode *node, *nnode; |
718e3744 | 8379 | struct peer *peer; |
8380 | int find = 0; | |
8381 | ||
1eb8ef25 | 8382 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 8383 | { |
1ff9a340 DS |
8384 | if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) |
8385 | continue; | |
8386 | ||
718e3744 | 8387 | switch (type) |
8388 | { | |
8389 | case show_all: | |
8390 | bgp_show_peer (vty, peer); | |
8391 | break; | |
8392 | case show_peer: | |
a80beece DS |
8393 | if (conf_if) |
8394 | { | |
8395 | if (peer->conf_if && !strcmp(peer->conf_if, conf_if)) | |
8396 | { | |
8397 | find = 1; | |
8398 | bgp_show_peer (vty, peer); | |
8399 | } | |
8400 | } | |
8401 | else | |
8402 | { | |
8403 | if (sockunion_same (&peer->su, su)) | |
8404 | { | |
8405 | find = 1; | |
8406 | bgp_show_peer (vty, peer); | |
8407 | } | |
8408 | } | |
718e3744 | 8409 | break; |
8410 | } | |
8411 | } | |
8412 | ||
8413 | if (type == show_peer && ! find) | |
8414 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
8415 | ||
8416 | return CMD_SUCCESS; | |
8417 | } | |
8418 | ||
94f2b392 | 8419 | static int |
fd79ac91 | 8420 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
8421 | enum show_type type, const char *ip_str) | |
718e3744 | 8422 | { |
8423 | int ret; | |
8424 | struct bgp *bgp; | |
8425 | union sockunion su; | |
8426 | ||
718e3744 | 8427 | if (name) |
8428 | { | |
8429 | bgp = bgp_lookup_by_name (name); | |
718e3744 | 8430 | if (! bgp) |
8431 | { | |
8432 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
8433 | return CMD_WARNING; | |
8434 | } | |
718e3744 | 8435 | } |
a80beece DS |
8436 | else |
8437 | { | |
8438 | bgp = bgp_get_default (); | |
8439 | } | |
718e3744 | 8440 | |
8441 | if (bgp) | |
a80beece DS |
8442 | { |
8443 | if (ip_str) | |
8444 | { | |
8445 | ret = str2sockunion (ip_str, &su); | |
8446 | if (ret < 0) | |
8447 | bgp_show_neighbor (vty, bgp, type, NULL, ip_str); | |
8448 | else | |
8449 | bgp_show_neighbor (vty, bgp, type, &su, NULL); | |
8450 | } | |
8451 | else | |
8452 | { | |
8453 | bgp_show_neighbor (vty, bgp, type, NULL, NULL); | |
8454 | } | |
8455 | } | |
718e3744 | 8456 | |
8457 | return CMD_SUCCESS; | |
8458 | } | |
8459 | ||
8460 | /* "show ip bgp neighbors" commands. */ | |
8461 | DEFUN (show_ip_bgp_neighbors, | |
8462 | show_ip_bgp_neighbors_cmd, | |
8463 | "show ip bgp neighbors", | |
8464 | SHOW_STR | |
8465 | IP_STR | |
8466 | BGP_STR | |
8467 | "Detailed information on TCP and BGP neighbor connections\n") | |
8468 | { | |
8469 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); | |
8470 | } | |
8471 | ||
8472 | ALIAS (show_ip_bgp_neighbors, | |
8473 | show_ip_bgp_ipv4_neighbors_cmd, | |
8474 | "show ip bgp ipv4 (unicast|multicast) neighbors", | |
8475 | SHOW_STR | |
8476 | IP_STR | |
8477 | BGP_STR | |
8478 | "Address family\n" | |
8479 | "Address Family modifier\n" | |
8480 | "Address Family modifier\n" | |
8481 | "Detailed information on TCP and BGP neighbor connections\n") | |
8482 | ||
8483 | ALIAS (show_ip_bgp_neighbors, | |
8484 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
8485 | "show ip bgp vpnv4 all neighbors", | |
8486 | SHOW_STR | |
8487 | IP_STR | |
8488 | BGP_STR | |
8489 | "Display VPNv4 NLRI specific information\n" | |
8490 | "Display information about all VPNv4 NLRIs\n" | |
8491 | "Detailed information on TCP and BGP neighbor connections\n") | |
8492 | ||
8493 | ALIAS (show_ip_bgp_neighbors, | |
8494 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
8495 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", | |
8496 | SHOW_STR | |
8497 | IP_STR | |
8498 | BGP_STR | |
8499 | "Display VPNv4 NLRI specific information\n" | |
8500 | "Display information for a route distinguisher\n" | |
8501 | "VPN Route Distinguisher\n" | |
8502 | "Detailed information on TCP and BGP neighbor connections\n") | |
8503 | ||
8504 | ALIAS (show_ip_bgp_neighbors, | |
8505 | show_bgp_neighbors_cmd, | |
8506 | "show bgp neighbors", | |
8507 | SHOW_STR | |
8508 | BGP_STR | |
8509 | "Detailed information on TCP and BGP neighbor connections\n") | |
8510 | ||
8511 | ALIAS (show_ip_bgp_neighbors, | |
8512 | show_bgp_ipv6_neighbors_cmd, | |
8513 | "show bgp ipv6 neighbors", | |
8514 | SHOW_STR | |
8515 | BGP_STR | |
8516 | "Address family\n" | |
8517 | "Detailed information on TCP and BGP neighbor connections\n") | |
8518 | ||
8519 | DEFUN (show_ip_bgp_neighbors_peer, | |
8520 | show_ip_bgp_neighbors_peer_cmd, | |
a80beece | 8521 | "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 8522 | SHOW_STR |
8523 | IP_STR | |
8524 | BGP_STR | |
8525 | "Detailed information on TCP and BGP neighbor connections\n" | |
8526 | "Neighbor to display information about\n" | |
a80beece DS |
8527 | "Neighbor to display information about\n" |
8528 | "Neighbor on bgp configured interface\n") | |
718e3744 | 8529 | { |
8530 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); | |
8531 | } | |
8532 | ||
8533 | ALIAS (show_ip_bgp_neighbors_peer, | |
8534 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
a80beece | 8535 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 8536 | SHOW_STR |
8537 | IP_STR | |
8538 | BGP_STR | |
8539 | "Address family\n" | |
8540 | "Address Family modifier\n" | |
8541 | "Address Family modifier\n" | |
8542 | "Detailed information on TCP and BGP neighbor connections\n" | |
8543 | "Neighbor to display information about\n" | |
a80beece DS |
8544 | "Neighbor to display information about\n" |
8545 | "Neighbor on bgp configured interface\n") | |
718e3744 | 8546 | |
8547 | ALIAS (show_ip_bgp_neighbors_peer, | |
8548 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
8549 | "show ip bgp vpnv4 all neighbors A.B.C.D", | |
8550 | SHOW_STR | |
8551 | IP_STR | |
8552 | BGP_STR | |
8553 | "Display VPNv4 NLRI specific information\n" | |
8554 | "Display information about all VPNv4 NLRIs\n" | |
8555 | "Detailed information on TCP and BGP neighbor connections\n" | |
8556 | "Neighbor to display information about\n") | |
8557 | ||
8558 | ALIAS (show_ip_bgp_neighbors_peer, | |
8559 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
8560 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", | |
8561 | SHOW_STR | |
8562 | IP_STR | |
8563 | BGP_STR | |
8564 | "Display VPNv4 NLRI specific information\n" | |
8565 | "Display information about all VPNv4 NLRIs\n" | |
8566 | "Detailed information on TCP and BGP neighbor connections\n" | |
8567 | "Neighbor to display information about\n") | |
8568 | ||
8569 | ALIAS (show_ip_bgp_neighbors_peer, | |
8570 | show_bgp_neighbors_peer_cmd, | |
a80beece | 8571 | "show bgp neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 8572 | SHOW_STR |
8573 | BGP_STR | |
8574 | "Detailed information on TCP and BGP neighbor connections\n" | |
8575 | "Neighbor to display information about\n" | |
a80beece DS |
8576 | "Neighbor to display information about\n" |
8577 | "Neighbor on bgp configured interface\n") | |
718e3744 | 8578 | |
8579 | ALIAS (show_ip_bgp_neighbors_peer, | |
8580 | show_bgp_ipv6_neighbors_peer_cmd, | |
a80beece | 8581 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 8582 | SHOW_STR |
8583 | BGP_STR | |
8584 | "Address family\n" | |
8585 | "Detailed information on TCP and BGP neighbor connections\n" | |
8586 | "Neighbor to display information about\n" | |
a80beece DS |
8587 | "Neighbor to display information about\n" |
8588 | "Neighbor on bgp configured interface\n") | |
718e3744 | 8589 | |
8590 | DEFUN (show_ip_bgp_instance_neighbors, | |
8591 | show_ip_bgp_instance_neighbors_cmd, | |
8592 | "show ip bgp view WORD neighbors", | |
8593 | SHOW_STR | |
8594 | IP_STR | |
8595 | BGP_STR | |
8596 | "BGP view\n" | |
8597 | "View name\n" | |
8598 | "Detailed information on TCP and BGP neighbor connections\n") | |
8599 | { | |
8600 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); | |
8601 | } | |
8602 | ||
bb46e94f | 8603 | ALIAS (show_ip_bgp_instance_neighbors, |
8604 | show_bgp_instance_neighbors_cmd, | |
8605 | "show bgp view WORD neighbors", | |
8606 | SHOW_STR | |
8607 | BGP_STR | |
8608 | "BGP view\n" | |
8609 | "View name\n" | |
8610 | "Detailed information on TCP and BGP neighbor connections\n") | |
8611 | ||
8612 | ALIAS (show_ip_bgp_instance_neighbors, | |
8613 | show_bgp_instance_ipv6_neighbors_cmd, | |
8614 | "show bgp view WORD ipv6 neighbors", | |
8615 | SHOW_STR | |
8616 | BGP_STR | |
8617 | "BGP view\n" | |
8618 | "View name\n" | |
8619 | "Address family\n" | |
8620 | "Detailed information on TCP and BGP neighbor connections\n") | |
8621 | ||
718e3744 | 8622 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
8623 | show_ip_bgp_instance_neighbors_peer_cmd, | |
a80beece | 8624 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD)", |
718e3744 | 8625 | SHOW_STR |
8626 | IP_STR | |
8627 | BGP_STR | |
8628 | "BGP view\n" | |
8629 | "View name\n" | |
8630 | "Detailed information on TCP and BGP neighbor connections\n" | |
8631 | "Neighbor to display information about\n" | |
a80beece DS |
8632 | "Neighbor to display information about\n" |
8633 | "Neighbor on bgp configured interface\n") | |
718e3744 | 8634 | { |
8635 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); | |
8636 | } | |
bb46e94f | 8637 | |
8638 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
8639 | show_bgp_instance_neighbors_peer_cmd, | |
a80beece | 8640 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD)", |
bb46e94f | 8641 | SHOW_STR |
8642 | BGP_STR | |
8643 | "BGP view\n" | |
8644 | "View name\n" | |
8645 | "Detailed information on TCP and BGP neighbor connections\n" | |
8646 | "Neighbor to display information about\n" | |
a80beece DS |
8647 | "Neighbor to display information about\n" |
8648 | "Neighbor on bgp configured interface\n") | |
bb46e94f | 8649 | |
8650 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
8651 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
a80beece | 8652 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD)", |
bb46e94f | 8653 | SHOW_STR |
8654 | BGP_STR | |
8655 | "BGP view\n" | |
8656 | "View name\n" | |
8657 | "Address family\n" | |
8658 | "Detailed information on TCP and BGP neighbor connections\n" | |
8659 | "Neighbor to display information about\n" | |
a80beece DS |
8660 | "Neighbor to display information about\n" |
8661 | "Neighbor on bgp configured interface\n") | |
6b0655a2 | 8662 | |
718e3744 | 8663 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
8664 | paths' and `show ip mbgp paths'. Those functions results are the | |
8665 | same.*/ | |
8666 | DEFUN (show_ip_bgp_paths, | |
8667 | show_ip_bgp_paths_cmd, | |
8668 | "show ip bgp paths", | |
8669 | SHOW_STR | |
8670 | IP_STR | |
8671 | BGP_STR | |
8672 | "Path information\n") | |
8673 | { | |
8674 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
8675 | aspath_print_all_vty (vty); | |
8676 | return CMD_SUCCESS; | |
8677 | } | |
8678 | ||
8679 | DEFUN (show_ip_bgp_ipv4_paths, | |
8680 | show_ip_bgp_ipv4_paths_cmd, | |
8681 | "show ip bgp ipv4 (unicast|multicast) paths", | |
8682 | SHOW_STR | |
8683 | IP_STR | |
8684 | BGP_STR | |
8685 | "Address family\n" | |
8686 | "Address Family modifier\n" | |
8687 | "Address Family modifier\n" | |
8688 | "Path information\n") | |
8689 | { | |
8690 | vty_out (vty, "Address Refcnt Path\r\n"); | |
8691 | aspath_print_all_vty (vty); | |
8692 | ||
8693 | return CMD_SUCCESS; | |
8694 | } | |
6b0655a2 | 8695 | |
718e3744 | 8696 | #include "hash.h" |
8697 | ||
94f2b392 | 8698 | static void |
718e3744 | 8699 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
8700 | { | |
8701 | struct community *com; | |
8702 | ||
8703 | com = (struct community *) backet->data; | |
8704 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, | |
8705 | community_str (com), VTY_NEWLINE); | |
8706 | } | |
8707 | ||
8708 | /* Show BGP's community internal data. */ | |
8709 | DEFUN (show_ip_bgp_community_info, | |
8710 | show_ip_bgp_community_info_cmd, | |
8711 | "show ip bgp community-info", | |
8712 | SHOW_STR | |
8713 | IP_STR | |
8714 | BGP_STR | |
8715 | "List all bgp community information\n") | |
8716 | { | |
8717 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
8718 | ||
8719 | hash_iterate (community_hash (), | |
8720 | (void (*) (struct hash_backet *, void *)) | |
8721 | community_show_all_iterator, | |
8722 | vty); | |
8723 | ||
8724 | return CMD_SUCCESS; | |
8725 | } | |
8726 | ||
8727 | DEFUN (show_ip_bgp_attr_info, | |
8728 | show_ip_bgp_attr_info_cmd, | |
8729 | "show ip bgp attribute-info", | |
8730 | SHOW_STR | |
8731 | IP_STR | |
8732 | BGP_STR | |
8733 | "List all bgp attribute information\n") | |
8734 | { | |
8735 | attr_show_all (vty); | |
8736 | return CMD_SUCCESS; | |
8737 | } | |
6b0655a2 | 8738 | |
94f2b392 | 8739 | static int |
fee0f4c6 | 8740 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
8741 | afi_t afi, safi_t safi) | |
8742 | { | |
8743 | char timebuf[BGP_UPTIME_LEN]; | |
8744 | char rmbuf[14]; | |
fd79ac91 | 8745 | const char *rmname; |
fee0f4c6 | 8746 | struct peer *peer; |
1eb8ef25 | 8747 | struct listnode *node, *nnode; |
fee0f4c6 | 8748 | int len; |
8749 | int count = 0; | |
8750 | ||
8751 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) | |
8752 | { | |
1eb8ef25 | 8753 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
fee0f4c6 | 8754 | { |
8755 | count++; | |
8756 | bgp_write_rsclient_summary (vty, peer, afi, safi); | |
8757 | } | |
8758 | return count; | |
8759 | } | |
8760 | ||
8761 | len = vty_out (vty, "%s", rsclient->host); | |
8762 | len = 16 - len; | |
8763 | ||
8764 | if (len < 1) | |
8765 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
8766 | else | |
8767 | vty_out (vty, "%*s", len, " "); | |
8768 | ||
3d515fd9 | 8769 | vty_out (vty, "4 "); |
fee0f4c6 | 8770 | |
0b2aa3a0 | 8771 | vty_out (vty, "%11d ", rsclient->as); |
fee0f4c6 | 8772 | |
8773 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); | |
8774 | if ( rmname && strlen (rmname) > 13 ) | |
8775 | { | |
8776 | sprintf (rmbuf, "%13s", "..."); | |
8777 | rmname = strncpy (rmbuf, rmname, 10); | |
8778 | } | |
8779 | else if (! rmname) | |
8780 | rmname = "<none>"; | |
8781 | vty_out (vty, " %13s ", rmname); | |
8782 | ||
8783 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); | |
8784 | if ( rmname && strlen (rmname) > 13 ) | |
8785 | { | |
8786 | sprintf (rmbuf, "%13s", "..."); | |
8787 | rmname = strncpy (rmbuf, rmname, 10); | |
8788 | } | |
8789 | else if (! rmname) | |
8790 | rmname = "<none>"; | |
8791 | vty_out (vty, " %13s ", rmname); | |
8792 | ||
8793 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); | |
8794 | ||
8795 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) | |
8796 | vty_out (vty, " Idle (Admin)"); | |
8797 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
8798 | vty_out (vty, " Idle (PfxCt)"); | |
8799 | else | |
8800 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); | |
8801 | ||
8802 | vty_out (vty, "%s", VTY_NEWLINE); | |
8803 | ||
8804 | return 1; | |
8805 | } | |
8806 | ||
94f2b392 | 8807 | static int |
fd79ac91 | 8808 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
8809 | afi_t afi, safi_t safi) | |
fee0f4c6 | 8810 | { |
8811 | struct peer *peer; | |
1eb8ef25 | 8812 | struct listnode *node, *nnode; |
fee0f4c6 | 8813 | int count = 0; |
8814 | ||
8815 | /* Header string for each address family. */ | |
8816 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; | |
8817 | ||
1eb8ef25 | 8818 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
fee0f4c6 | 8819 | { |
8820 | if (peer->afc[afi][safi] && | |
8821 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
8822 | { | |
8823 | if (! count) | |
8824 | { | |
8825 | vty_out (vty, | |
8826 | "Route Server's BGP router identifier %s%s", | |
8827 | inet_ntoa (bgp->router_id), VTY_NEWLINE); | |
8828 | vty_out (vty, | |
aea339f7 | 8829 | "Route Server's local AS number %u%s", bgp->as, |
fee0f4c6 | 8830 | VTY_NEWLINE); |
8831 | ||
8832 | vty_out (vty, "%s", VTY_NEWLINE); | |
8833 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
8834 | } | |
8835 | ||
8836 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); | |
8837 | } | |
8838 | } | |
8839 | ||
8840 | if (count) | |
8841 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, | |
8842 | count, VTY_NEWLINE); | |
8843 | else | |
8844 | vty_out (vty, "No %s Route Server Client is configured%s", | |
8845 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
8846 | ||
8847 | return CMD_SUCCESS; | |
8848 | } | |
8849 | ||
94f2b392 | 8850 | static int |
fd79ac91 | 8851 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
8852 | afi_t afi, safi_t safi) | |
fee0f4c6 | 8853 | { |
8854 | struct bgp *bgp; | |
8855 | ||
8856 | if (name) | |
8857 | { | |
8858 | bgp = bgp_lookup_by_name (name); | |
8859 | ||
8860 | if (! bgp) | |
8861 | { | |
8862 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
8863 | return CMD_WARNING; | |
8864 | } | |
8865 | ||
8866 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
8867 | return CMD_SUCCESS; | |
8868 | } | |
8869 | ||
8870 | bgp = bgp_get_default (); | |
8871 | ||
8872 | if (bgp) | |
8873 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
8874 | ||
8875 | return CMD_SUCCESS; | |
8876 | } | |
8877 | ||
8878 | /* 'show bgp rsclient' commands. */ | |
8879 | DEFUN (show_ip_bgp_rsclient_summary, | |
8880 | show_ip_bgp_rsclient_summary_cmd, | |
8881 | "show ip bgp rsclient summary", | |
8882 | SHOW_STR | |
8883 | IP_STR | |
8884 | BGP_STR | |
8885 | "Information about Route Server Clients\n" | |
8886 | "Summary of all Route Server Clients\n") | |
8887 | { | |
8888 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
8889 | } | |
8890 | ||
8891 | DEFUN (show_ip_bgp_instance_rsclient_summary, | |
8892 | show_ip_bgp_instance_rsclient_summary_cmd, | |
8893 | "show ip bgp view WORD rsclient summary", | |
8894 | SHOW_STR | |
8895 | IP_STR | |
8896 | BGP_STR | |
8897 | "BGP view\n" | |
8898 | "View name\n" | |
8899 | "Information about Route Server Clients\n" | |
8900 | "Summary of all Route Server Clients\n") | |
8901 | { | |
8902 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
8903 | } | |
8904 | ||
8905 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, | |
8906 | show_ip_bgp_ipv4_rsclient_summary_cmd, | |
8907 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", | |
8908 | SHOW_STR | |
8909 | IP_STR | |
8910 | BGP_STR | |
8911 | "Address family\n" | |
8912 | "Address Family modifier\n" | |
8913 | "Address Family modifier\n" | |
8914 | "Information about Route Server Clients\n" | |
8915 | "Summary of all Route Server Clients\n") | |
8916 | { | |
8917 | if (strncmp (argv[0], "m", 1) == 0) | |
8918 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); | |
8919 | ||
8920 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
8921 | } | |
8922 | ||
8923 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, | |
8924 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, | |
8925 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
8926 | SHOW_STR | |
8927 | IP_STR | |
8928 | BGP_STR | |
8929 | "BGP view\n" | |
8930 | "View name\n" | |
8931 | "Address family\n" | |
8932 | "Address Family modifier\n" | |
8933 | "Address Family modifier\n" | |
8934 | "Information about Route Server Clients\n" | |
8935 | "Summary of all Route Server Clients\n") | |
8936 | { | |
8937 | if (strncmp (argv[1], "m", 1) == 0) | |
8938 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); | |
8939 | ||
8940 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
8941 | } | |
8942 | ||
95cbbd2a ML |
8943 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
8944 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, | |
8945 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
8946 | SHOW_STR | |
8947 | BGP_STR | |
8948 | "BGP view\n" | |
8949 | "View name\n" | |
8950 | "Address family\n" | |
8951 | "Address Family modifier\n" | |
8952 | "Address Family modifier\n" | |
8953 | "Information about Route Server Clients\n" | |
8954 | "Summary of all Route Server Clients\n") | |
8955 | { | |
8956 | safi_t safi; | |
8957 | ||
8958 | if (argc == 2) { | |
8959 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8960 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); | |
8961 | } else { | |
8962 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8963 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); | |
8964 | } | |
8965 | } | |
8966 | ||
8967 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, | |
8968 | show_bgp_ipv4_safi_rsclient_summary_cmd, | |
8969 | "show bgp ipv4 (unicast|multicast) rsclient summary", | |
8970 | SHOW_STR | |
8971 | BGP_STR | |
8972 | "Address family\n" | |
8973 | "Address Family modifier\n" | |
8974 | "Address Family modifier\n" | |
8975 | "Information about Route Server Clients\n" | |
8976 | "Summary of all Route Server Clients\n") | |
8977 | ||
fee0f4c6 | 8978 | #ifdef HAVE_IPV6 |
8979 | DEFUN (show_bgp_rsclient_summary, | |
8980 | show_bgp_rsclient_summary_cmd, | |
8981 | "show bgp rsclient summary", | |
8982 | SHOW_STR | |
8983 | BGP_STR | |
8984 | "Information about Route Server Clients\n" | |
8985 | "Summary of all Route Server Clients\n") | |
8986 | { | |
8987 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
8988 | } | |
8989 | ||
8990 | DEFUN (show_bgp_instance_rsclient_summary, | |
8991 | show_bgp_instance_rsclient_summary_cmd, | |
8992 | "show bgp view WORD rsclient summary", | |
8993 | SHOW_STR | |
8994 | BGP_STR | |
8995 | "BGP view\n" | |
8996 | "View name\n" | |
8997 | "Information about Route Server Clients\n" | |
8998 | "Summary of all Route Server Clients\n") | |
8999 | { | |
9000 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); | |
9001 | } | |
9002 | ||
9003 | ALIAS (show_bgp_rsclient_summary, | |
9004 | show_bgp_ipv6_rsclient_summary_cmd, | |
9005 | "show bgp ipv6 rsclient summary", | |
9006 | SHOW_STR | |
9007 | BGP_STR | |
9008 | "Address family\n" | |
9009 | "Information about Route Server Clients\n" | |
9010 | "Summary of all Route Server Clients\n") | |
9011 | ||
9012 | ALIAS (show_bgp_instance_rsclient_summary, | |
9013 | show_bgp_instance_ipv6_rsclient_summary_cmd, | |
9014 | "show bgp view WORD ipv6 rsclient summary", | |
9015 | SHOW_STR | |
9016 | BGP_STR | |
9017 | "BGP view\n" | |
9018 | "View name\n" | |
9019 | "Address family\n" | |
9020 | "Information about Route Server Clients\n" | |
9021 | "Summary of all Route Server Clients\n") | |
95cbbd2a ML |
9022 | |
9023 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, | |
9024 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, | |
9025 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", | |
9026 | SHOW_STR | |
9027 | BGP_STR | |
9028 | "BGP view\n" | |
9029 | "View name\n" | |
9030 | "Address family\n" | |
9031 | "Address Family modifier\n" | |
9032 | "Address Family modifier\n" | |
9033 | "Information about Route Server Clients\n" | |
9034 | "Summary of all Route Server Clients\n") | |
9035 | { | |
9036 | safi_t safi; | |
9037 | ||
9038 | if (argc == 2) { | |
9039 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
9040 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); | |
9041 | } else { | |
9042 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
9043 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); | |
9044 | } | |
9045 | } | |
9046 | ||
9047 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, | |
9048 | show_bgp_ipv6_safi_rsclient_summary_cmd, | |
9049 | "show bgp ipv6 (unicast|multicast) rsclient summary", | |
9050 | SHOW_STR | |
9051 | BGP_STR | |
9052 | "Address family\n" | |
9053 | "Address Family modifier\n" | |
9054 | "Address Family modifier\n" | |
9055 | "Information about Route Server Clients\n" | |
9056 | "Summary of all Route Server Clients\n") | |
9057 | ||
fee0f4c6 | 9058 | #endif /* HAVE IPV6 */ |
6b0655a2 | 9059 | |
718e3744 | 9060 | /* Redistribute VTY commands. */ |
9061 | ||
718e3744 | 9062 | DEFUN (bgp_redistribute_ipv4, |
9063 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 9064 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 9065 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9066 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 9067 | { |
9068 | int type; | |
9069 | ||
e0ca5fde DL |
9070 | type = proto_redistnum (AFI_IP, argv[0]); |
9071 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9072 | { |
9073 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9074 | return CMD_WARNING; | |
9075 | } | |
9076 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
9077 | } | |
9078 | ||
9079 | DEFUN (bgp_redistribute_ipv4_rmap, | |
9080 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 9081 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 9082 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9083 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9084 | "Route map reference\n" |
9085 | "Pointer to route-map entries\n") | |
9086 | { | |
9087 | int type; | |
9088 | ||
e0ca5fde DL |
9089 | type = proto_redistnum (AFI_IP, argv[0]); |
9090 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9091 | { |
9092 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9093 | return CMD_WARNING; | |
9094 | } | |
9095 | ||
9096 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); | |
9097 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
9098 | } | |
9099 | ||
9100 | DEFUN (bgp_redistribute_ipv4_metric, | |
9101 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 9102 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 9103 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9104 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9105 | "Metric for redistributed routes\n" |
9106 | "Default metric\n") | |
9107 | { | |
9108 | int type; | |
9109 | u_int32_t metric; | |
9110 | ||
e0ca5fde DL |
9111 | type = proto_redistnum (AFI_IP, argv[0]); |
9112 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9113 | { |
9114 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9115 | return CMD_WARNING; | |
9116 | } | |
9117 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
9118 | ||
9119 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
9120 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
9121 | } | |
9122 | ||
9123 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
9124 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 9125 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 9126 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9127 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9128 | "Route map reference\n" |
9129 | "Pointer to route-map entries\n" | |
9130 | "Metric for redistributed routes\n" | |
9131 | "Default metric\n") | |
9132 | { | |
9133 | int type; | |
9134 | u_int32_t metric; | |
9135 | ||
e0ca5fde DL |
9136 | type = proto_redistnum (AFI_IP, argv[0]); |
9137 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9138 | { |
9139 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9140 | return CMD_WARNING; | |
9141 | } | |
9142 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
9143 | ||
9144 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); | |
9145 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
9146 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
9147 | } | |
9148 | ||
9149 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
9150 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 9151 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 9152 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9153 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9154 | "Metric for redistributed routes\n" |
9155 | "Default metric\n" | |
9156 | "Route map reference\n" | |
9157 | "Pointer to route-map entries\n") | |
9158 | { | |
9159 | int type; | |
9160 | u_int32_t metric; | |
9161 | ||
e0ca5fde DL |
9162 | type = proto_redistnum (AFI_IP, argv[0]); |
9163 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9164 | { |
9165 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9166 | return CMD_WARNING; | |
9167 | } | |
9168 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
9169 | ||
9170 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
9171 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); | |
9172 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
9173 | } | |
9174 | ||
9175 | DEFUN (no_bgp_redistribute_ipv4, | |
9176 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 9177 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 9178 | NO_STR |
9179 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9180 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 9181 | { |
9182 | int type; | |
9183 | ||
e0ca5fde DL |
9184 | type = proto_redistnum (AFI_IP, argv[0]); |
9185 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9186 | { |
9187 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9188 | return CMD_WARNING; | |
9189 | } | |
9190 | ||
9191 | return bgp_redistribute_unset (vty->index, AFI_IP, type); | |
9192 | } | |
9193 | ||
9194 | DEFUN (no_bgp_redistribute_ipv4_rmap, | |
9195 | no_bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 9196 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 9197 | NO_STR |
9198 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9199 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9200 | "Route map reference\n" |
9201 | "Pointer to route-map entries\n") | |
9202 | { | |
9203 | int type; | |
9204 | ||
e0ca5fde DL |
9205 | type = proto_redistnum (AFI_IP, argv[0]); |
9206 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9207 | { |
9208 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9209 | return CMD_WARNING; | |
9210 | } | |
9211 | ||
9212 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); | |
9213 | return CMD_SUCCESS; | |
9214 | } | |
9215 | ||
9216 | DEFUN (no_bgp_redistribute_ipv4_metric, | |
9217 | no_bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 9218 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 9219 | NO_STR |
9220 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9221 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9222 | "Metric for redistributed routes\n" |
9223 | "Default metric\n") | |
9224 | { | |
9225 | int type; | |
9226 | ||
e0ca5fde DL |
9227 | type = proto_redistnum (AFI_IP, argv[0]); |
9228 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9229 | { |
9230 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9231 | return CMD_WARNING; | |
9232 | } | |
9233 | ||
9234 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); | |
9235 | return CMD_SUCCESS; | |
9236 | } | |
9237 | ||
9238 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, | |
9239 | no_bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 9240 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 9241 | NO_STR |
9242 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9243 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9244 | "Route map reference\n" |
9245 | "Pointer to route-map entries\n" | |
9246 | "Metric for redistributed routes\n" | |
9247 | "Default metric\n") | |
9248 | { | |
9249 | int type; | |
9250 | ||
e0ca5fde DL |
9251 | type = proto_redistnum (AFI_IP, argv[0]); |
9252 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9253 | { |
9254 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9255 | return CMD_WARNING; | |
9256 | } | |
9257 | ||
9258 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); | |
9259 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); | |
9260 | return CMD_SUCCESS; | |
9261 | } | |
9262 | ||
9263 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, | |
9264 | no_bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 9265 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 9266 | NO_STR |
9267 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9268 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9269 | "Metric for redistributed routes\n" |
9270 | "Default metric\n" | |
9271 | "Route map reference\n" | |
9272 | "Pointer to route-map entries\n") | |
6b0655a2 | 9273 | |
718e3744 | 9274 | #ifdef HAVE_IPV6 |
9275 | DEFUN (bgp_redistribute_ipv6, | |
9276 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 9277 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 9278 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9279 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 9280 | { |
9281 | int type; | |
9282 | ||
e0ca5fde DL |
9283 | type = proto_redistnum (AFI_IP6, argv[0]); |
9284 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9285 | { |
9286 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9287 | return CMD_WARNING; | |
9288 | } | |
9289 | ||
9290 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9291 | } | |
9292 | ||
9293 | DEFUN (bgp_redistribute_ipv6_rmap, | |
9294 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 9295 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 9296 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9297 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9298 | "Route map reference\n" |
9299 | "Pointer to route-map entries\n") | |
9300 | { | |
9301 | int type; | |
9302 | ||
e0ca5fde DL |
9303 | type = proto_redistnum (AFI_IP6, argv[0]); |
9304 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9305 | { |
9306 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9307 | return CMD_WARNING; | |
9308 | } | |
9309 | ||
9310 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); | |
9311 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9312 | } | |
9313 | ||
9314 | DEFUN (bgp_redistribute_ipv6_metric, | |
9315 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 9316 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 9317 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9318 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9319 | "Metric for redistributed routes\n" |
9320 | "Default metric\n") | |
9321 | { | |
9322 | int type; | |
9323 | u_int32_t metric; | |
9324 | ||
e0ca5fde DL |
9325 | type = proto_redistnum (AFI_IP6, argv[0]); |
9326 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9327 | { |
9328 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9329 | return CMD_WARNING; | |
9330 | } | |
9331 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
9332 | ||
9333 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
9334 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9335 | } | |
9336 | ||
9337 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
9338 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 9339 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 9340 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9341 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9342 | "Route map reference\n" |
9343 | "Pointer to route-map entries\n" | |
9344 | "Metric for redistributed routes\n" | |
9345 | "Default metric\n") | |
9346 | { | |
9347 | int type; | |
9348 | u_int32_t metric; | |
9349 | ||
e0ca5fde DL |
9350 | type = proto_redistnum (AFI_IP6, argv[0]); |
9351 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9352 | { |
9353 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9354 | return CMD_WARNING; | |
9355 | } | |
9356 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
9357 | ||
9358 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); | |
9359 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
9360 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9361 | } | |
9362 | ||
9363 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
9364 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 9365 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 9366 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9367 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9368 | "Metric for redistributed routes\n" |
9369 | "Default metric\n" | |
9370 | "Route map reference\n" | |
9371 | "Pointer to route-map entries\n") | |
9372 | { | |
9373 | int type; | |
9374 | u_int32_t metric; | |
9375 | ||
e0ca5fde DL |
9376 | type = proto_redistnum (AFI_IP6, argv[0]); |
9377 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9378 | { |
9379 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9380 | return CMD_WARNING; | |
9381 | } | |
9382 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
9383 | ||
9384 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
9385 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); | |
9386 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9387 | } | |
9388 | ||
9389 | DEFUN (no_bgp_redistribute_ipv6, | |
9390 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 9391 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 9392 | NO_STR |
9393 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9394 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 9395 | { |
9396 | int type; | |
9397 | ||
e0ca5fde DL |
9398 | type = proto_redistnum (AFI_IP6, argv[0]); |
9399 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9400 | { |
9401 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9402 | return CMD_WARNING; | |
9403 | } | |
9404 | ||
9405 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); | |
9406 | } | |
9407 | ||
9408 | DEFUN (no_bgp_redistribute_ipv6_rmap, | |
9409 | no_bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 9410 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 9411 | NO_STR |
9412 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9413 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9414 | "Route map reference\n" |
9415 | "Pointer to route-map entries\n") | |
9416 | { | |
9417 | int type; | |
9418 | ||
e0ca5fde DL |
9419 | type = proto_redistnum (AFI_IP6, argv[0]); |
9420 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9421 | { |
9422 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9423 | return CMD_WARNING; | |
9424 | } | |
9425 | ||
9426 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); | |
9427 | return CMD_SUCCESS; | |
9428 | } | |
9429 | ||
9430 | DEFUN (no_bgp_redistribute_ipv6_metric, | |
9431 | no_bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 9432 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 9433 | NO_STR |
9434 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9435 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9436 | "Metric for redistributed routes\n" |
9437 | "Default metric\n") | |
9438 | { | |
9439 | int type; | |
9440 | ||
e0ca5fde DL |
9441 | type = proto_redistnum (AFI_IP6, argv[0]); |
9442 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9443 | { |
9444 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9445 | return CMD_WARNING; | |
9446 | } | |
9447 | ||
9448 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); | |
9449 | return CMD_SUCCESS; | |
9450 | } | |
9451 | ||
9452 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, | |
9453 | no_bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 9454 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 9455 | NO_STR |
9456 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9457 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9458 | "Route map reference\n" |
9459 | "Pointer to route-map entries\n" | |
9460 | "Metric for redistributed routes\n" | |
9461 | "Default metric\n") | |
9462 | { | |
9463 | int type; | |
9464 | ||
e0ca5fde DL |
9465 | type = proto_redistnum (AFI_IP6, argv[0]); |
9466 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9467 | { |
9468 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9469 | return CMD_WARNING; | |
9470 | } | |
9471 | ||
9472 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); | |
9473 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); | |
9474 | return CMD_SUCCESS; | |
9475 | } | |
9476 | ||
9477 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, | |
9478 | no_bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 9479 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 9480 | NO_STR |
9481 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9482 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9483 | "Metric for redistributed routes\n" |
9484 | "Default metric\n" | |
9485 | "Route map reference\n" | |
9486 | "Pointer to route-map entries\n") | |
9487 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 9488 | |
718e3744 | 9489 | int |
9490 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
9491 | safi_t safi, int *write) | |
9492 | { | |
9493 | int i; | |
718e3744 | 9494 | |
9495 | /* Unicast redistribution only. */ | |
9496 | if (safi != SAFI_UNICAST) | |
9497 | return 0; | |
9498 | ||
9499 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
9500 | { | |
9501 | /* Redistribute BGP does not make sense. */ | |
9502 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) | |
9503 | { | |
9504 | /* Display "address-family" when it is not yet diplayed. */ | |
9505 | bgp_config_write_family_header (vty, afi, safi, write); | |
9506 | ||
9507 | /* "redistribute" configuration. */ | |
f52d13cb | 9508 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
718e3744 | 9509 | |
9510 | if (bgp->redist_metric_flag[afi][i]) | |
ddc943de | 9511 | vty_out (vty, " metric %u", bgp->redist_metric[afi][i]); |
718e3744 | 9512 | |
9513 | if (bgp->rmap[afi][i].name) | |
9514 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); | |
9515 | ||
9516 | vty_out (vty, "%s", VTY_NEWLINE); | |
9517 | } | |
9518 | } | |
9519 | return *write; | |
9520 | } | |
6b0655a2 | 9521 | |
718e3744 | 9522 | /* BGP node structure. */ |
7fc626de | 9523 | static struct cmd_node bgp_node = |
718e3744 | 9524 | { |
9525 | BGP_NODE, | |
9526 | "%s(config-router)# ", | |
9527 | 1, | |
9528 | }; | |
9529 | ||
7fc626de | 9530 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 9531 | { |
9532 | BGP_IPV4_NODE, | |
9533 | "%s(config-router-af)# ", | |
9534 | 1, | |
9535 | }; | |
9536 | ||
7fc626de | 9537 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 9538 | { |
9539 | BGP_IPV4M_NODE, | |
9540 | "%s(config-router-af)# ", | |
9541 | 1, | |
9542 | }; | |
9543 | ||
7fc626de | 9544 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 9545 | { |
9546 | BGP_IPV6_NODE, | |
9547 | "%s(config-router-af)# ", | |
9548 | 1, | |
9549 | }; | |
9550 | ||
7fc626de | 9551 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 9552 | { |
9553 | BGP_IPV6M_NODE, | |
9554 | "%s(config-router-af)# ", | |
9555 | 1, | |
9556 | }; | |
9557 | ||
7fc626de | 9558 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 9559 | { |
9560 | BGP_VPNV4_NODE, | |
9561 | "%s(config-router-af)# ", | |
9562 | 1 | |
9563 | }; | |
6b0655a2 | 9564 | |
1f8ae70b | 9565 | static void community_list_vty (void); |
9566 | ||
718e3744 | 9567 | void |
94f2b392 | 9568 | bgp_vty_init (void) |
718e3744 | 9569 | { |
718e3744 | 9570 | /* Install bgp top node. */ |
9571 | install_node (&bgp_node, bgp_config_write); | |
9572 | install_node (&bgp_ipv4_unicast_node, NULL); | |
9573 | install_node (&bgp_ipv4_multicast_node, NULL); | |
9574 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 9575 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 9576 | install_node (&bgp_vpnv4_node, NULL); |
9577 | ||
9578 | /* Install default VTY commands to new nodes. */ | |
9579 | install_default (BGP_NODE); | |
9580 | install_default (BGP_IPV4_NODE); | |
9581 | install_default (BGP_IPV4M_NODE); | |
9582 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 9583 | install_default (BGP_IPV6M_NODE); |
718e3744 | 9584 | install_default (BGP_VPNV4_NODE); |
9585 | ||
9586 | /* "bgp multiple-instance" commands. */ | |
9587 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
9588 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
9589 | ||
9590 | /* "bgp config-type" commands. */ | |
9591 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
9592 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); | |
9593 | ||
9594 | /* Dummy commands (Currently not supported) */ | |
9595 | install_element (BGP_NODE, &no_synchronization_cmd); | |
9596 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
9597 | ||
9598 | /* "router bgp" commands. */ | |
9599 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
9600 | install_element (CONFIG_NODE, &router_bgp_view_cmd); | |
9601 | ||
9602 | /* "no router bgp" commands. */ | |
9603 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
9604 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); | |
9605 | ||
9606 | /* "bgp router-id" commands. */ | |
9607 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
9608 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
9609 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
9610 | ||
9611 | /* "bgp cluster-id" commands. */ | |
9612 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
9613 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
9614 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
9615 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); | |
9616 | ||
9617 | /* "bgp confederation" commands. */ | |
9618 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
9619 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
9620 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
9621 | ||
9622 | /* "bgp confederation peers" commands. */ | |
9623 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
9624 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
9625 | ||
f188f2c4 DS |
9626 | /* bgp update-delay command */ |
9627 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
9628 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
9629 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
9630 | install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); | |
9631 | ||
cb1faec9 DS |
9632 | install_element (BGP_NODE, &bgp_wpkt_quanta_cmd); |
9633 | install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd); | |
9634 | ||
165b5fff JB |
9635 | /* "maximum-paths" commands. */ |
9636 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
9637 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
9638 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); | |
9639 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); | |
9640 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
9641 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); | |
431aa9f9 DS |
9642 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
9643 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
9644 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); | |
165b5fff | 9645 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 9646 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff JB |
9647 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
9648 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 9649 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 9650 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 9651 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 9652 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
5e242b0d | 9653 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 9654 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
431aa9f9 | 9655 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 9656 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 DS |
9657 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
9658 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 9659 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 9660 | |
718e3744 | 9661 | /* "timers bgp" commands. */ |
9662 | install_element (BGP_NODE, &bgp_timers_cmd); | |
9663 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
9664 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
9665 | ||
9666 | /* "bgp client-to-client reflection" commands */ | |
9667 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
9668 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
9669 | ||
9670 | /* "bgp always-compare-med" commands */ | |
9671 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
9672 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
9673 | ||
9674 | /* "bgp deterministic-med" commands */ | |
9675 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
9676 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 9677 | |
538621f2 | 9678 | /* "bgp graceful-restart" commands */ |
9679 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
9680 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 9681 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
9682 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
9683 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 9684 | |
9685 | /* "bgp fast-external-failover" commands */ | |
9686 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
9687 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
9688 | ||
9689 | /* "bgp enforce-first-as" commands */ | |
9690 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
9691 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
9692 | ||
9693 | /* "bgp bestpath compare-routerid" commands */ | |
9694 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
9695 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
9696 | ||
9697 | /* "bgp bestpath as-path ignore" commands */ | |
9698 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
9699 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
9700 | ||
6811845b | 9701 | /* "bgp bestpath as-path confed" commands */ |
9702 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
9703 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
9704 | ||
2fdd455c PM |
9705 | /* "bgp bestpath as-path multipath-relax" commands */ |
9706 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
9707 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
9708 | ||
848973c7 | 9709 | /* "bgp log-neighbor-changes" commands */ |
9710 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
9711 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
9712 | ||
718e3744 | 9713 | /* "bgp bestpath med" commands */ |
9714 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
9715 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
9716 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
9717 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
9718 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
9719 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
9720 | ||
9721 | /* "no bgp default ipv4-unicast" commands. */ | |
9722 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
9723 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
9724 | ||
9725 | /* "bgp network import-check" commands. */ | |
9726 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
9727 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); | |
9728 | ||
9729 | /* "bgp default local-preference" commands. */ | |
9730 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
9731 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
9732 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
9733 | ||
9734 | /* "neighbor remote-as" commands. */ | |
9735 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
a80beece | 9736 | install_element (BGP_NODE, &neighbor_interface_config_cmd); |
718e3744 | 9737 | install_element (BGP_NODE, &no_neighbor_cmd); |
9738 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
a80beece | 9739 | install_element (BGP_NODE, &no_neighbor_interface_config_cmd); |
718e3744 | 9740 | |
9741 | /* "neighbor peer-group" commands. */ | |
9742 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
9743 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
a80beece | 9744 | install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd); |
718e3744 | 9745 | |
9746 | /* "neighbor local-as" commands. */ | |
9747 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
9748 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 9749 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 9750 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
9751 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
9752 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
9d3f9705 | 9753 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
718e3744 | 9754 | |
0df7c91f PJ |
9755 | /* "neighbor password" commands. */ |
9756 | install_element (BGP_NODE, &neighbor_password_cmd); | |
9757 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
9758 | ||
718e3744 | 9759 | /* "neighbor activate" commands. */ |
9760 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
9761 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
9762 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
9763 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 9764 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 9765 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
9766 | ||
9767 | /* "no neighbor activate" commands. */ | |
9768 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
9769 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
9770 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
9771 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 9772 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 9773 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
9774 | ||
9775 | /* "neighbor peer-group set" commands. */ | |
9776 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); | |
9777 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
9778 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
9779 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 9780 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 9781 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
9782 | ||
718e3744 | 9783 | /* "no neighbor peer-group unset" commands. */ |
9784 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
9785 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
9786 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
9787 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 9788 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 9789 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
9790 | ||
718e3744 | 9791 | /* "neighbor softreconfiguration inbound" commands.*/ |
9792 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
9793 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
9794 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
9795 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
9796 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
9797 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
9798 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
9799 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 9800 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
9801 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 9802 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
9803 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 9804 | |
9805 | /* "neighbor attribute-unchanged" commands. */ | |
9806 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
9807 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
9808 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
9809 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
9810 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
9811 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
9812 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
9813 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
9814 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
9815 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
9816 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
9817 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
9818 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9819 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9820 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9821 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9822 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9823 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9824 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9825 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9826 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9827 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
9828 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
9829 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
9830 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
9831 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
9832 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
9833 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
9834 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
9835 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
9836 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
9837 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
9838 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
9839 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
9840 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9841 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9842 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9843 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9844 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9845 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9846 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9847 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9848 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9849 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
9850 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
9851 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
9852 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
9853 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
9854 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
9855 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
9856 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
9857 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
9858 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
9859 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
9860 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
9861 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
9862 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9863 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9864 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9865 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9866 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9867 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9868 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9869 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9870 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9871 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
9872 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
9873 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
9874 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
9875 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
9876 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
9877 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
9878 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
9879 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
9880 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
9881 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
9882 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
9883 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
9884 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9885 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9886 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9887 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9888 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9889 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9890 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9891 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9892 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9893 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 9894 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
9895 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
9896 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
9897 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
9898 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
9899 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
9900 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
9901 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
9902 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
9903 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
9904 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
9905 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
9906 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9907 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9908 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9909 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9910 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9911 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9912 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9913 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9914 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9915 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 9916 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
9917 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
9918 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
9919 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
9920 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
9921 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
9922 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
9923 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
9924 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
9925 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
9926 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
9927 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
9928 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9929 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9930 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9931 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9932 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9933 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9934 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9935 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9936 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9937 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
9938 | ||
fee0f4c6 | 9939 | /* "nexthop-local unchanged" commands */ |
9940 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
9941 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
9942 | ||
718e3744 | 9943 | /* "transparent-as" and "transparent-nexthop" for old version |
9944 | compatibility. */ | |
9945 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); | |
9946 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); | |
9947 | ||
9948 | /* "neighbor next-hop-self" commands. */ | |
9949 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
9950 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
9951 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
9952 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
9953 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
9954 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
9955 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
9956 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 9957 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
9958 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 9959 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
9960 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
9961 | ||
9962 | /* "neighbor remove-private-AS" commands. */ | |
9963 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
9964 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
9965 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); | |
9966 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
9967 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); | |
9968 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
9969 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); | |
9970 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
25ffbdc1 | 9971 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
9972 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
718e3744 | 9973 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
9974 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
9975 | ||
9976 | /* "neighbor send-community" commands.*/ | |
9977 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
9978 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
9979 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
9980 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
9981 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
9982 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
9983 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
9984 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
9985 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
9986 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
9987 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
9988 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
9989 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
9990 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
9991 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
9992 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 9993 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
9994 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
9995 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
9996 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 9997 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
9998 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
9999 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
10000 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
10001 | ||
10002 | /* "neighbor route-reflector" commands.*/ | |
10003 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
10004 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
10005 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
10006 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
10007 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
10008 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
10009 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
10010 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 10011 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
10012 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 10013 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
10014 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
10015 | ||
10016 | /* "neighbor route-server" commands.*/ | |
10017 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
10018 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
10019 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
10020 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
10021 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
10022 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
10023 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
10024 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 10025 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
10026 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 10027 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
10028 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
10029 | ||
10030 | /* "neighbor passive" commands. */ | |
10031 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
10032 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
10033 | ||
10034 | /* "neighbor shutdown" commands. */ | |
10035 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
10036 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
10037 | ||
c9502438 | 10038 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
718e3744 | 10039 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
10040 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); | |
10041 | ||
10042 | /* "neighbor capability orf prefix-list" commands.*/ | |
10043 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
10044 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
10045 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
10046 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
10047 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
10048 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
10049 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
10050 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 10051 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
10052 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 10053 | |
10054 | /* "neighbor capability dynamic" commands.*/ | |
10055 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
10056 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
10057 | ||
10058 | /* "neighbor dont-capability-negotiate" commands. */ | |
10059 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
10060 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
10061 | ||
10062 | /* "neighbor ebgp-multihop" commands. */ | |
10063 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
10064 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
10065 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
10066 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
10067 | ||
6ffd2079 | 10068 | /* "neighbor disable-connected-check" commands. */ |
10069 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
10070 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 10071 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
10072 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
10073 | ||
10074 | /* "neighbor description" commands. */ | |
10075 | install_element (BGP_NODE, &neighbor_description_cmd); | |
10076 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
10077 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
10078 | ||
10079 | /* "neighbor update-source" commands. "*/ | |
10080 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
10081 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
10082 | ||
10083 | /* "neighbor default-originate" commands. */ | |
10084 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
10085 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
10086 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
10087 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
10088 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
10089 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
10090 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
10091 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
10092 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
10093 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
10094 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
10095 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
10096 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
10097 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
10098 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
10099 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 10100 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
10101 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
10102 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
10103 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 10104 | |
10105 | /* "neighbor port" commands. */ | |
10106 | install_element (BGP_NODE, &neighbor_port_cmd); | |
10107 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
10108 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
10109 | ||
10110 | /* "neighbor weight" commands. */ | |
10111 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
10112 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
10113 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
10114 | ||
10115 | /* "neighbor override-capability" commands. */ | |
10116 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
10117 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
10118 | ||
10119 | /* "neighbor strict-capability-match" commands. */ | |
10120 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
10121 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
10122 | ||
10123 | /* "neighbor timers" commands. */ | |
10124 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
10125 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
10126 | ||
10127 | /* "neighbor timers connect" commands. */ | |
10128 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
10129 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
10130 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
10131 | ||
10132 | /* "neighbor advertisement-interval" commands. */ | |
10133 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
10134 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
10135 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
10136 | ||
10137 | /* "neighbor version" commands. */ | |
10138 | install_element (BGP_NODE, &neighbor_version_cmd); | |
718e3744 | 10139 | |
10140 | /* "neighbor interface" commands. */ | |
10141 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
10142 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
10143 | ||
10144 | /* "neighbor distribute" commands. */ | |
10145 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
10146 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
10147 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
10148 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
10149 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
10150 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
10151 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
10152 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 10153 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
10154 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 10155 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
10156 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
10157 | ||
10158 | /* "neighbor prefix-list" commands. */ | |
10159 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
10160 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
10161 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
10162 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
10163 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
10164 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
10165 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
10166 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 10167 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
10168 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 10169 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
10170 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
10171 | ||
10172 | /* "neighbor filter-list" commands. */ | |
10173 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
10174 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
10175 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
10176 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
10177 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
10178 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
10179 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
10180 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 10181 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
10182 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 10183 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
10184 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
10185 | ||
10186 | /* "neighbor route-map" commands. */ | |
10187 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
10188 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
10189 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
10190 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
10191 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
10192 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
10193 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
10194 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 10195 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
10196 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 10197 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
10198 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
10199 | ||
10200 | /* "neighbor unsuppress-map" commands. */ | |
10201 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
10202 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
10203 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
10204 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
10205 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
10206 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
10207 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
10208 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 10209 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
10210 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 10211 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
10212 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 10213 | |
10214 | /* "neighbor maximum-prefix" commands. */ | |
10215 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 10216 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 10217 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 10218 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 10219 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
10220 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10221 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
10222 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 10223 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
10224 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10225 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10226 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10227 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10228 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 10229 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 10230 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 10231 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 10232 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
10233 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10234 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
10235 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 10236 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
10237 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10238 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10239 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10240 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10241 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 10242 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 10243 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 10244 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 10245 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
10246 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10247 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
10248 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 10249 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
10250 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10251 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10252 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10253 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10254 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 10255 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 10256 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 10257 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 10258 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
10259 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10260 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
10261 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 10262 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
10263 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10264 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10265 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10266 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 10267 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
10268 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
10269 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
10270 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
10271 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
10272 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
10273 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
10274 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
10275 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
10276 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10277 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10278 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10279 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10280 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 10281 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 10282 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 10283 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 10284 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
10285 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10286 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
10287 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 10288 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
10289 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10290 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10291 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10292 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10293 | |
10294 | /* "neighbor allowas-in" */ | |
10295 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
10296 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
10297 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
10298 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); | |
10299 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
10300 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
10301 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); | |
10302 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
10303 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
10304 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); | |
10305 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
10306 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
25ffbdc1 | 10307 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
10308 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
10309 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
718e3744 | 10310 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
10311 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
10312 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
10313 | ||
10314 | /* address-family commands. */ | |
10315 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
10316 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
10317 | #ifdef HAVE_IPV6 | |
10318 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 10319 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 10320 | #endif /* HAVE_IPV6 */ |
10321 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
10322 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
10323 | ||
10324 | /* "exit-address-family" command. */ | |
10325 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
10326 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
10327 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 10328 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 10329 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
10330 | ||
10331 | /* "clear ip bgp commands" */ | |
10332 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
10333 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
10334 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
10335 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); | |
10336 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); | |
10337 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); | |
10338 | #ifdef HAVE_IPV6 | |
10339 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); | |
10340 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
10341 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
10342 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); | |
10343 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); | |
10344 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); | |
10345 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); | |
10346 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); | |
10347 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); | |
10348 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); | |
10349 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); | |
10350 | #endif /* HAVE_IPV6 */ | |
10351 | ||
10352 | /* "clear ip bgp neighbor soft in" */ | |
10353 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
10354 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
10355 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
10356 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); | |
10357 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); | |
10358 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); | |
10359 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); | |
10360 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); | |
10361 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
10362 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); | |
10363 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); | |
10364 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
10365 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); | |
10366 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); | |
10367 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
10368 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); | |
10369 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); | |
10370 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
10371 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
10372 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
10373 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); | |
10374 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); | |
10375 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); | |
10376 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); | |
10377 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); | |
10378 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
10379 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); | |
10380 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); | |
10381 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
10382 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); | |
10383 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); | |
10384 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
10385 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); | |
10386 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); | |
10387 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
10388 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
10389 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
10390 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
10391 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
10392 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
10393 | #ifdef HAVE_IPV6 | |
10394 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); | |
10395 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
10396 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
10397 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); | |
10398 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
10399 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); | |
10400 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); | |
10401 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
10402 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); | |
10403 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); | |
10404 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
10405 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); | |
10406 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); | |
10407 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
10408 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); | |
10409 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); | |
10410 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
10411 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); | |
10412 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); | |
10413 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
10414 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); | |
10415 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); | |
10416 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
10417 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); | |
10418 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); | |
10419 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
10420 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); | |
10421 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); | |
10422 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
10423 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); | |
10424 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); | |
10425 | #endif /* HAVE_IPV6 */ | |
10426 | ||
10427 | /* "clear ip bgp neighbor soft out" */ | |
10428 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
10429 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
10430 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
10431 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); | |
10432 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); | |
10433 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); | |
10434 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); | |
10435 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); | |
10436 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); | |
10437 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); | |
10438 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); | |
10439 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); | |
10440 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
10441 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
10442 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); | |
10443 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); | |
10444 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); | |
10445 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); | |
10446 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); | |
10447 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); | |
10448 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); | |
10449 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); | |
10450 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); | |
10451 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
10452 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
10453 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
10454 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
10455 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
10456 | #ifdef HAVE_IPV6 | |
10457 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); | |
10458 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
10459 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
10460 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); | |
10461 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); | |
10462 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); | |
10463 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); | |
10464 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); | |
10465 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); | |
10466 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); | |
10467 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); | |
10468 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); | |
10469 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); | |
10470 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); | |
10471 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); | |
10472 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); | |
10473 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); | |
10474 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); | |
10475 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); | |
10476 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); | |
10477 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); | |
10478 | #endif /* HAVE_IPV6 */ | |
10479 | ||
10480 | /* "clear ip bgp neighbor soft" */ | |
10481 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
10482 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
10483 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
10484 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); | |
10485 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); | |
10486 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); | |
10487 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); | |
10488 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
10489 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
10490 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); | |
10491 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); | |
10492 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); | |
10493 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); | |
10494 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
10495 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
10496 | #ifdef HAVE_IPV6 | |
10497 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); | |
10498 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
10499 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
10500 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); | |
10501 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); | |
10502 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); | |
10503 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); | |
10504 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); | |
10505 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); | |
10506 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); | |
10507 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); | |
10508 | #endif /* HAVE_IPV6 */ | |
10509 | ||
fee0f4c6 | 10510 | /* "clear ip bgp neighbor rsclient" */ |
10511 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); | |
10512 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); | |
10513 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); | |
10514 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); | |
10515 | #ifdef HAVE_IPV6 | |
10516 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); | |
10517 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); | |
10518 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); | |
10519 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); | |
10520 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); | |
10521 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); | |
10522 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); | |
10523 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); | |
10524 | #endif /* HAVE_IPV6 */ | |
10525 | ||
718e3744 | 10526 | /* "show ip bgp summary" commands. */ |
10527 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
47fc97cc | 10528 | install_element (VIEW_NODE, &show_ip_bgp_summary_csv_cmd); |
718e3744 | 10529 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
10530 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 10531 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 10532 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 10533 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 10534 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
10535 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
10536 | #ifdef HAVE_IPV6 | |
10537 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
47fc97cc | 10538 | install_element (VIEW_NODE, &show_bgp_summary_csv_cmd); |
718e3744 | 10539 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
10540 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 10541 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 10542 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 10543 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
10544 | #endif /* HAVE_IPV6 */ |
10545 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
47fc97cc | 10546 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_csv_cmd); |
62687ff1 PJ |
10547 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
10548 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 10549 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
62687ff1 | 10550 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 10551 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
62687ff1 PJ |
10552 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
10553 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
10554 | #ifdef HAVE_IPV6 | |
10555 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
47fc97cc | 10556 | install_element (RESTRICTED_NODE, &show_bgp_summary_csv_cmd); |
62687ff1 PJ |
10557 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); |
10558 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 10559 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
62687ff1 | 10560 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 10561 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 10562 | #endif /* HAVE_IPV6 */ |
10563 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
47fc97cc | 10564 | install_element (ENABLE_NODE, &show_ip_bgp_summary_csv_cmd); |
718e3744 | 10565 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
10566 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 10567 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 10568 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 10569 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 10570 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
10571 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
10572 | #ifdef HAVE_IPV6 | |
10573 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
47fc97cc | 10574 | install_element (ENABLE_NODE, &show_bgp_summary_csv_cmd); |
718e3744 | 10575 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
10576 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 10577 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 10578 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 10579 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 10580 | #endif /* HAVE_IPV6 */ |
10581 | ||
10582 | /* "show ip bgp neighbors" commands. */ | |
10583 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
10584 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
10585 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
10586 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
10587 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
10588 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
10589 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
10590 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
10591 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
10592 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
62687ff1 PJ |
10593 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
10594 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
10595 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
10596 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
10597 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 10598 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
10599 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
10600 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
10601 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
10602 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
10603 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
10604 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
10605 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
10606 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
10607 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
10608 | ||
10609 | #ifdef HAVE_IPV6 | |
10610 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
10611 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
10612 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
10613 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 10614 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
10615 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
10616 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
10617 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
10618 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
10619 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
10620 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
10621 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 10622 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
10623 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
10624 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
10625 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 10626 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
10627 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
10628 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
10629 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 10630 | |
10631 | /* Old commands. */ | |
10632 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
10633 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
10634 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
10635 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
10636 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 10637 | |
10638 | /* "show ip bgp rsclient" commands. */ | |
10639 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); | |
10640 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
10641 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
10642 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
10643 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
10644 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
10645 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
10646 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
10647 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
10648 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
10649 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
10650 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 10651 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
10652 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
10653 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
10654 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
10655 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
10656 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 10657 | |
10658 | #ifdef HAVE_IPV6 | |
10659 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); | |
10660 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
10661 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
10662 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
10663 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
10664 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
10665 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
10666 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
10667 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
10668 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
10669 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
10670 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 10671 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
10672 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
10673 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
10674 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
10675 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
10676 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 10677 | #endif /* HAVE_IPV6 */ |
718e3744 | 10678 | |
10679 | /* "show ip bgp paths" commands. */ | |
10680 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
10681 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
10682 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
10683 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
10684 | ||
10685 | /* "show ip bgp community" commands. */ | |
10686 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
10687 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
10688 | ||
10689 | /* "show ip bgp attribute-info" commands. */ | |
10690 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
10691 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
10692 | ||
10693 | /* "redistribute" commands. */ | |
10694 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
10695 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
10696 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
10697 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
10698 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
10699 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
10700 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
10701 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
10702 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
10703 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
10704 | #ifdef HAVE_IPV6 | |
10705 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
10706 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
10707 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
10708 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
10709 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
10710 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
10711 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
10712 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
10713 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
10714 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
10715 | #endif /* HAVE_IPV6 */ | |
10716 | ||
fa411a21 NH |
10717 | /* ttl_security commands */ |
10718 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
10719 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
10720 | ||
4bf6a362 PJ |
10721 | /* "show bgp memory" commands. */ |
10722 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 10723 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
10724 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
10725 | ||
e0081f70 ML |
10726 | /* "show bgp views" commands. */ |
10727 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
10728 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
10729 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
10730 | ||
718e3744 | 10731 | /* Community-list. */ |
10732 | community_list_vty (); | |
10733 | } | |
6b0655a2 | 10734 | |
718e3744 | 10735 | #include "memory.h" |
10736 | #include "bgp_regex.h" | |
10737 | #include "bgp_clist.h" | |
10738 | #include "bgp_ecommunity.h" | |
10739 | ||
10740 | /* VTY functions. */ | |
10741 | ||
10742 | /* Direction value to string conversion. */ | |
94f2b392 | 10743 | static const char * |
718e3744 | 10744 | community_direct_str (int direct) |
10745 | { | |
10746 | switch (direct) | |
10747 | { | |
10748 | case COMMUNITY_DENY: | |
10749 | return "deny"; | |
718e3744 | 10750 | case COMMUNITY_PERMIT: |
10751 | return "permit"; | |
718e3744 | 10752 | default: |
10753 | return "unknown"; | |
718e3744 | 10754 | } |
10755 | } | |
10756 | ||
10757 | /* Display error string. */ | |
94f2b392 | 10758 | static void |
718e3744 | 10759 | community_list_perror (struct vty *vty, int ret) |
10760 | { | |
10761 | switch (ret) | |
10762 | { | |
10763 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 10764 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 10765 | break; |
10766 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
10767 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
10768 | break; | |
10769 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
10770 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
10771 | break; | |
10772 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
10773 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
10774 | break; | |
10775 | } | |
10776 | } | |
10777 | ||
10778 | /* VTY interface for community_set() function. */ | |
94f2b392 | 10779 | static int |
fd79ac91 | 10780 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
10781 | int style, int reject_all_digit_name) | |
718e3744 | 10782 | { |
10783 | int ret; | |
10784 | int direct; | |
10785 | char *str; | |
10786 | ||
10787 | /* Check the list type. */ | |
10788 | if (strncmp (argv[1], "p", 1) == 0) | |
10789 | direct = COMMUNITY_PERMIT; | |
10790 | else if (strncmp (argv[1], "d", 1) == 0) | |
10791 | direct = COMMUNITY_DENY; | |
10792 | else | |
10793 | { | |
10794 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
10795 | VTY_NEWLINE); | |
10796 | return CMD_WARNING; | |
10797 | } | |
10798 | ||
10799 | /* All digit name check. */ | |
10800 | if (reject_all_digit_name && all_digit (argv[0])) | |
10801 | { | |
10802 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
10803 | return CMD_WARNING; | |
10804 | } | |
10805 | ||
10806 | /* Concat community string argument. */ | |
10807 | if (argc > 1) | |
10808 | str = argv_concat (argv, argc, 2); | |
10809 | else | |
10810 | str = NULL; | |
10811 | ||
10812 | /* When community_list_set() return nevetive value, it means | |
10813 | malformed community string. */ | |
10814 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
10815 | ||
10816 | /* Free temporary community list string allocated by | |
10817 | argv_concat(). */ | |
10818 | if (str) | |
10819 | XFREE (MTYPE_TMP, str); | |
10820 | ||
10821 | if (ret < 0) | |
10822 | { | |
10823 | /* Display error string. */ | |
10824 | community_list_perror (vty, ret); | |
10825 | return CMD_WARNING; | |
10826 | } | |
10827 | ||
10828 | return CMD_SUCCESS; | |
10829 | } | |
10830 | ||
718e3744 | 10831 | /* Communiyt-list entry delete. */ |
94f2b392 | 10832 | static int |
fee6e4e4 | 10833 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
10834 | int style) | |
718e3744 | 10835 | { |
10836 | int ret; | |
fee6e4e4 | 10837 | int direct = 0; |
10838 | char *str = NULL; | |
718e3744 | 10839 | |
fee6e4e4 | 10840 | if (argc > 1) |
718e3744 | 10841 | { |
fee6e4e4 | 10842 | /* Check the list direct. */ |
10843 | if (strncmp (argv[1], "p", 1) == 0) | |
10844 | direct = COMMUNITY_PERMIT; | |
10845 | else if (strncmp (argv[1], "d", 1) == 0) | |
10846 | direct = COMMUNITY_DENY; | |
10847 | else | |
10848 | { | |
10849 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
10850 | VTY_NEWLINE); | |
10851 | return CMD_WARNING; | |
10852 | } | |
718e3744 | 10853 | |
fee6e4e4 | 10854 | /* Concat community string argument. */ |
10855 | str = argv_concat (argv, argc, 2); | |
10856 | } | |
718e3744 | 10857 | |
10858 | /* Unset community list. */ | |
10859 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); | |
10860 | ||
10861 | /* Free temporary community list string allocated by | |
10862 | argv_concat(). */ | |
fee6e4e4 | 10863 | if (str) |
10864 | XFREE (MTYPE_TMP, str); | |
718e3744 | 10865 | |
10866 | if (ret < 0) | |
10867 | { | |
10868 | community_list_perror (vty, ret); | |
10869 | return CMD_WARNING; | |
10870 | } | |
10871 | ||
10872 | return CMD_SUCCESS; | |
10873 | } | |
10874 | ||
10875 | /* "community-list" keyword help string. */ | |
10876 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
10877 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" | |
10878 | ||
718e3744 | 10879 | DEFUN (ip_community_list_standard, |
10880 | ip_community_list_standard_cmd, | |
10881 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
10882 | IP_STR | |
10883 | COMMUNITY_LIST_STR | |
10884 | "Community list number (standard)\n" | |
10885 | "Specify community to reject\n" | |
10886 | "Specify community to accept\n" | |
10887 | COMMUNITY_VAL_STR) | |
10888 | { | |
10889 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
10890 | } | |
10891 | ||
10892 | ALIAS (ip_community_list_standard, | |
10893 | ip_community_list_standard2_cmd, | |
10894 | "ip community-list <1-99> (deny|permit)", | |
10895 | IP_STR | |
10896 | COMMUNITY_LIST_STR | |
10897 | "Community list number (standard)\n" | |
10898 | "Specify community to reject\n" | |
10899 | "Specify community to accept\n") | |
10900 | ||
10901 | DEFUN (ip_community_list_expanded, | |
10902 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 10903 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 10904 | IP_STR |
10905 | COMMUNITY_LIST_STR | |
10906 | "Community list number (expanded)\n" | |
10907 | "Specify community to reject\n" | |
10908 | "Specify community to accept\n" | |
10909 | "An ordered list as a regular-expression\n") | |
10910 | { | |
10911 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
10912 | } | |
10913 | ||
10914 | DEFUN (ip_community_list_name_standard, | |
10915 | ip_community_list_name_standard_cmd, | |
10916 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
10917 | IP_STR | |
10918 | COMMUNITY_LIST_STR | |
10919 | "Add a standard community-list entry\n" | |
10920 | "Community list name\n" | |
10921 | "Specify community to reject\n" | |
10922 | "Specify community to accept\n" | |
10923 | COMMUNITY_VAL_STR) | |
10924 | { | |
10925 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
10926 | } | |
10927 | ||
10928 | ALIAS (ip_community_list_name_standard, | |
10929 | ip_community_list_name_standard2_cmd, | |
10930 | "ip community-list standard WORD (deny|permit)", | |
10931 | IP_STR | |
10932 | COMMUNITY_LIST_STR | |
10933 | "Add a standard community-list entry\n" | |
10934 | "Community list name\n" | |
10935 | "Specify community to reject\n" | |
10936 | "Specify community to accept\n") | |
10937 | ||
10938 | DEFUN (ip_community_list_name_expanded, | |
10939 | ip_community_list_name_expanded_cmd, | |
10940 | "ip community-list expanded WORD (deny|permit) .LINE", | |
10941 | IP_STR | |
10942 | COMMUNITY_LIST_STR | |
10943 | "Add an expanded community-list entry\n" | |
10944 | "Community list name\n" | |
10945 | "Specify community to reject\n" | |
10946 | "Specify community to accept\n" | |
10947 | "An ordered list as a regular-expression\n") | |
10948 | { | |
10949 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
10950 | } | |
10951 | ||
fee6e4e4 | 10952 | DEFUN (no_ip_community_list_standard_all, |
10953 | no_ip_community_list_standard_all_cmd, | |
10954 | "no ip community-list <1-99>", | |
10955 | NO_STR | |
10956 | IP_STR | |
10957 | COMMUNITY_LIST_STR | |
10958 | "Community list number (standard)\n") | |
10959 | { | |
10960 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
10961 | } | |
10962 | ||
10963 | DEFUN (no_ip_community_list_expanded_all, | |
10964 | no_ip_community_list_expanded_all_cmd, | |
10965 | "no ip community-list <100-500>", | |
718e3744 | 10966 | NO_STR |
10967 | IP_STR | |
10968 | COMMUNITY_LIST_STR | |
718e3744 | 10969 | "Community list number (expanded)\n") |
10970 | { | |
fee6e4e4 | 10971 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 10972 | } |
10973 | ||
fee6e4e4 | 10974 | DEFUN (no_ip_community_list_name_standard_all, |
10975 | no_ip_community_list_name_standard_all_cmd, | |
10976 | "no ip community-list standard WORD", | |
718e3744 | 10977 | NO_STR |
10978 | IP_STR | |
10979 | COMMUNITY_LIST_STR | |
10980 | "Add a standard community-list entry\n" | |
718e3744 | 10981 | "Community list name\n") |
10982 | { | |
fee6e4e4 | 10983 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
718e3744 | 10984 | } |
10985 | ||
fee6e4e4 | 10986 | DEFUN (no_ip_community_list_name_expanded_all, |
10987 | no_ip_community_list_name_expanded_all_cmd, | |
10988 | "no ip community-list expanded WORD", | |
718e3744 | 10989 | NO_STR |
10990 | IP_STR | |
10991 | COMMUNITY_LIST_STR | |
fee6e4e4 | 10992 | "Add an expanded community-list entry\n" |
10993 | "Community list name\n") | |
718e3744 | 10994 | { |
fee6e4e4 | 10995 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 10996 | } |
10997 | ||
10998 | DEFUN (no_ip_community_list_standard, | |
10999 | no_ip_community_list_standard_cmd, | |
11000 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
11001 | NO_STR | |
11002 | IP_STR | |
11003 | COMMUNITY_LIST_STR | |
11004 | "Community list number (standard)\n" | |
11005 | "Specify community to reject\n" | |
11006 | "Specify community to accept\n" | |
11007 | COMMUNITY_VAL_STR) | |
11008 | { | |
11009 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
11010 | } | |
11011 | ||
11012 | DEFUN (no_ip_community_list_expanded, | |
11013 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 11014 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 11015 | NO_STR |
11016 | IP_STR | |
11017 | COMMUNITY_LIST_STR | |
11018 | "Community list number (expanded)\n" | |
11019 | "Specify community to reject\n" | |
11020 | "Specify community to accept\n" | |
11021 | "An ordered list as a regular-expression\n") | |
11022 | { | |
11023 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
11024 | } | |
11025 | ||
11026 | DEFUN (no_ip_community_list_name_standard, | |
11027 | no_ip_community_list_name_standard_cmd, | |
11028 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
11029 | NO_STR | |
11030 | IP_STR | |
11031 | COMMUNITY_LIST_STR | |
11032 | "Specify a standard community-list\n" | |
11033 | "Community list name\n" | |
11034 | "Specify community to reject\n" | |
11035 | "Specify community to accept\n" | |
11036 | COMMUNITY_VAL_STR) | |
11037 | { | |
11038 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
11039 | } | |
11040 | ||
11041 | DEFUN (no_ip_community_list_name_expanded, | |
11042 | no_ip_community_list_name_expanded_cmd, | |
11043 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
11044 | NO_STR | |
11045 | IP_STR | |
11046 | COMMUNITY_LIST_STR | |
11047 | "Specify an expanded community-list\n" | |
11048 | "Community list name\n" | |
11049 | "Specify community to reject\n" | |
11050 | "Specify community to accept\n" | |
11051 | "An ordered list as a regular-expression\n") | |
11052 | { | |
11053 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
11054 | } | |
11055 | ||
94f2b392 | 11056 | static void |
718e3744 | 11057 | community_list_show (struct vty *vty, struct community_list *list) |
11058 | { | |
11059 | struct community_entry *entry; | |
11060 | ||
11061 | for (entry = list->head; entry; entry = entry->next) | |
11062 | { | |
11063 | if (entry == list->head) | |
11064 | { | |
11065 | if (all_digit (list->name)) | |
11066 | vty_out (vty, "Community %s list %s%s", | |
11067 | entry->style == COMMUNITY_LIST_STANDARD ? | |
11068 | "standard" : "(expanded) access", | |
11069 | list->name, VTY_NEWLINE); | |
11070 | else | |
11071 | vty_out (vty, "Named Community %s list %s%s", | |
11072 | entry->style == COMMUNITY_LIST_STANDARD ? | |
11073 | "standard" : "expanded", | |
11074 | list->name, VTY_NEWLINE); | |
11075 | } | |
11076 | if (entry->any) | |
11077 | vty_out (vty, " %s%s", | |
11078 | community_direct_str (entry->direct), VTY_NEWLINE); | |
11079 | else | |
11080 | vty_out (vty, " %s %s%s", | |
11081 | community_direct_str (entry->direct), | |
11082 | entry->style == COMMUNITY_LIST_STANDARD | |
11083 | ? community_str (entry->u.com) : entry->config, | |
11084 | VTY_NEWLINE); | |
11085 | } | |
11086 | } | |
11087 | ||
11088 | DEFUN (show_ip_community_list, | |
11089 | show_ip_community_list_cmd, | |
11090 | "show ip community-list", | |
11091 | SHOW_STR | |
11092 | IP_STR | |
11093 | "List community-list\n") | |
11094 | { | |
11095 | struct community_list *list; | |
11096 | struct community_list_master *cm; | |
11097 | ||
fee6e4e4 | 11098 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 11099 | if (! cm) |
11100 | return CMD_SUCCESS; | |
11101 | ||
11102 | for (list = cm->num.head; list; list = list->next) | |
11103 | community_list_show (vty, list); | |
11104 | ||
11105 | for (list = cm->str.head; list; list = list->next) | |
11106 | community_list_show (vty, list); | |
11107 | ||
11108 | return CMD_SUCCESS; | |
11109 | } | |
11110 | ||
11111 | DEFUN (show_ip_community_list_arg, | |
11112 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 11113 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 11114 | SHOW_STR |
11115 | IP_STR | |
11116 | "List community-list\n" | |
11117 | "Community-list number\n" | |
11118 | "Community-list name\n") | |
11119 | { | |
11120 | struct community_list *list; | |
11121 | ||
fee6e4e4 | 11122 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 11123 | if (! list) |
11124 | { | |
b729294c | 11125 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 11126 | return CMD_WARNING; |
11127 | } | |
11128 | ||
11129 | community_list_show (vty, list); | |
11130 | ||
11131 | return CMD_SUCCESS; | |
11132 | } | |
6b0655a2 | 11133 | |
94f2b392 | 11134 | static int |
fd79ac91 | 11135 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
11136 | int style, int reject_all_digit_name) | |
718e3744 | 11137 | { |
11138 | int ret; | |
11139 | int direct; | |
11140 | char *str; | |
11141 | ||
11142 | /* Check the list type. */ | |
11143 | if (strncmp (argv[1], "p", 1) == 0) | |
11144 | direct = COMMUNITY_PERMIT; | |
11145 | else if (strncmp (argv[1], "d", 1) == 0) | |
11146 | direct = COMMUNITY_DENY; | |
11147 | else | |
11148 | { | |
11149 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
11150 | VTY_NEWLINE); | |
11151 | return CMD_WARNING; | |
11152 | } | |
11153 | ||
11154 | /* All digit name check. */ | |
11155 | if (reject_all_digit_name && all_digit (argv[0])) | |
11156 | { | |
11157 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
11158 | return CMD_WARNING; | |
11159 | } | |
11160 | ||
11161 | /* Concat community string argument. */ | |
11162 | if (argc > 1) | |
11163 | str = argv_concat (argv, argc, 2); | |
11164 | else | |
11165 | str = NULL; | |
11166 | ||
11167 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
11168 | ||
11169 | /* Free temporary community list string allocated by | |
11170 | argv_concat(). */ | |
11171 | if (str) | |
11172 | XFREE (MTYPE_TMP, str); | |
11173 | ||
11174 | if (ret < 0) | |
11175 | { | |
11176 | community_list_perror (vty, ret); | |
11177 | return CMD_WARNING; | |
11178 | } | |
11179 | return CMD_SUCCESS; | |
11180 | } | |
11181 | ||
94f2b392 | 11182 | static int |
fee6e4e4 | 11183 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
11184 | int style) | |
718e3744 | 11185 | { |
11186 | int ret; | |
fee6e4e4 | 11187 | int direct = 0; |
11188 | char *str = NULL; | |
718e3744 | 11189 | |
fee6e4e4 | 11190 | if (argc > 1) |
718e3744 | 11191 | { |
fee6e4e4 | 11192 | /* Check the list direct. */ |
11193 | if (strncmp (argv[1], "p", 1) == 0) | |
11194 | direct = COMMUNITY_PERMIT; | |
11195 | else if (strncmp (argv[1], "d", 1) == 0) | |
11196 | direct = COMMUNITY_DENY; | |
11197 | else | |
11198 | { | |
11199 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
11200 | VTY_NEWLINE); | |
11201 | return CMD_WARNING; | |
11202 | } | |
718e3744 | 11203 | |
fee6e4e4 | 11204 | /* Concat community string argument. */ |
11205 | str = argv_concat (argv, argc, 2); | |
718e3744 | 11206 | } |
11207 | ||
718e3744 | 11208 | /* Unset community list. */ |
11209 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); | |
11210 | ||
11211 | /* Free temporary community list string allocated by | |
11212 | argv_concat(). */ | |
fee6e4e4 | 11213 | if (str) |
11214 | XFREE (MTYPE_TMP, str); | |
718e3744 | 11215 | |
11216 | if (ret < 0) | |
11217 | { | |
11218 | community_list_perror (vty, ret); | |
11219 | return CMD_WARNING; | |
11220 | } | |
11221 | ||
11222 | return CMD_SUCCESS; | |
11223 | } | |
11224 | ||
11225 | /* "extcommunity-list" keyword help string. */ | |
11226 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
11227 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
11228 | ||
11229 | DEFUN (ip_extcommunity_list_standard, | |
11230 | ip_extcommunity_list_standard_cmd, | |
11231 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
11232 | IP_STR | |
11233 | EXTCOMMUNITY_LIST_STR | |
11234 | "Extended Community list number (standard)\n" | |
11235 | "Specify community to reject\n" | |
11236 | "Specify community to accept\n" | |
11237 | EXTCOMMUNITY_VAL_STR) | |
11238 | { | |
11239 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
11240 | } | |
11241 | ||
11242 | ALIAS (ip_extcommunity_list_standard, | |
11243 | ip_extcommunity_list_standard2_cmd, | |
11244 | "ip extcommunity-list <1-99> (deny|permit)", | |
11245 | IP_STR | |
11246 | EXTCOMMUNITY_LIST_STR | |
11247 | "Extended Community list number (standard)\n" | |
11248 | "Specify community to reject\n" | |
11249 | "Specify community to accept\n") | |
11250 | ||
11251 | DEFUN (ip_extcommunity_list_expanded, | |
11252 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 11253 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 11254 | IP_STR |
11255 | EXTCOMMUNITY_LIST_STR | |
11256 | "Extended Community list number (expanded)\n" | |
11257 | "Specify community to reject\n" | |
11258 | "Specify community to accept\n" | |
11259 | "An ordered list as a regular-expression\n") | |
11260 | { | |
11261 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
11262 | } | |
11263 | ||
11264 | DEFUN (ip_extcommunity_list_name_standard, | |
11265 | ip_extcommunity_list_name_standard_cmd, | |
11266 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
11267 | IP_STR | |
11268 | EXTCOMMUNITY_LIST_STR | |
11269 | "Specify standard extcommunity-list\n" | |
11270 | "Extended Community list name\n" | |
11271 | "Specify community to reject\n" | |
11272 | "Specify community to accept\n" | |
11273 | EXTCOMMUNITY_VAL_STR) | |
11274 | { | |
11275 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
11276 | } | |
11277 | ||
11278 | ALIAS (ip_extcommunity_list_name_standard, | |
11279 | ip_extcommunity_list_name_standard2_cmd, | |
11280 | "ip extcommunity-list standard WORD (deny|permit)", | |
11281 | IP_STR | |
11282 | EXTCOMMUNITY_LIST_STR | |
11283 | "Specify standard extcommunity-list\n" | |
11284 | "Extended Community list name\n" | |
11285 | "Specify community to reject\n" | |
11286 | "Specify community to accept\n") | |
11287 | ||
11288 | DEFUN (ip_extcommunity_list_name_expanded, | |
11289 | ip_extcommunity_list_name_expanded_cmd, | |
11290 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
11291 | IP_STR | |
11292 | EXTCOMMUNITY_LIST_STR | |
11293 | "Specify expanded extcommunity-list\n" | |
11294 | "Extended Community list name\n" | |
11295 | "Specify community to reject\n" | |
11296 | "Specify community to accept\n" | |
11297 | "An ordered list as a regular-expression\n") | |
11298 | { | |
11299 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
11300 | } | |
11301 | ||
fee6e4e4 | 11302 | DEFUN (no_ip_extcommunity_list_standard_all, |
11303 | no_ip_extcommunity_list_standard_all_cmd, | |
11304 | "no ip extcommunity-list <1-99>", | |
11305 | NO_STR | |
11306 | IP_STR | |
11307 | EXTCOMMUNITY_LIST_STR | |
11308 | "Extended Community list number (standard)\n") | |
11309 | { | |
11310 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
11311 | } | |
11312 | ||
11313 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
11314 | no_ip_extcommunity_list_expanded_all_cmd, | |
11315 | "no ip extcommunity-list <100-500>", | |
718e3744 | 11316 | NO_STR |
11317 | IP_STR | |
11318 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 11319 | "Extended Community list number (expanded)\n") |
11320 | { | |
fee6e4e4 | 11321 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 11322 | } |
11323 | ||
fee6e4e4 | 11324 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
11325 | no_ip_extcommunity_list_name_standard_all_cmd, | |
11326 | "no ip extcommunity-list standard WORD", | |
718e3744 | 11327 | NO_STR |
11328 | IP_STR | |
11329 | EXTCOMMUNITY_LIST_STR | |
11330 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 11331 | "Extended Community list name\n") |
11332 | { | |
11333 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
11334 | } | |
11335 | ||
11336 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
11337 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
11338 | "no ip extcommunity-list expanded WORD", | |
11339 | NO_STR | |
11340 | IP_STR | |
11341 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 11342 | "Specify expanded extcommunity-list\n" |
11343 | "Extended Community list name\n") | |
11344 | { | |
fee6e4e4 | 11345 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 11346 | } |
11347 | ||
11348 | DEFUN (no_ip_extcommunity_list_standard, | |
11349 | no_ip_extcommunity_list_standard_cmd, | |
11350 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
11351 | NO_STR | |
11352 | IP_STR | |
11353 | EXTCOMMUNITY_LIST_STR | |
11354 | "Extended Community list number (standard)\n" | |
11355 | "Specify community to reject\n" | |
11356 | "Specify community to accept\n" | |
11357 | EXTCOMMUNITY_VAL_STR) | |
11358 | { | |
11359 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
11360 | } | |
11361 | ||
11362 | DEFUN (no_ip_extcommunity_list_expanded, | |
11363 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 11364 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 11365 | NO_STR |
11366 | IP_STR | |
11367 | EXTCOMMUNITY_LIST_STR | |
11368 | "Extended Community list number (expanded)\n" | |
11369 | "Specify community to reject\n" | |
11370 | "Specify community to accept\n" | |
11371 | "An ordered list as a regular-expression\n") | |
11372 | { | |
11373 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
11374 | } | |
11375 | ||
11376 | DEFUN (no_ip_extcommunity_list_name_standard, | |
11377 | no_ip_extcommunity_list_name_standard_cmd, | |
11378 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
11379 | NO_STR | |
11380 | IP_STR | |
11381 | EXTCOMMUNITY_LIST_STR | |
11382 | "Specify standard extcommunity-list\n" | |
11383 | "Extended Community list name\n" | |
11384 | "Specify community to reject\n" | |
11385 | "Specify community to accept\n" | |
11386 | EXTCOMMUNITY_VAL_STR) | |
11387 | { | |
11388 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
11389 | } | |
11390 | ||
11391 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
11392 | no_ip_extcommunity_list_name_expanded_cmd, | |
11393 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
11394 | NO_STR | |
11395 | IP_STR | |
11396 | EXTCOMMUNITY_LIST_STR | |
11397 | "Specify expanded extcommunity-list\n" | |
11398 | "Community list name\n" | |
11399 | "Specify community to reject\n" | |
11400 | "Specify community to accept\n" | |
11401 | "An ordered list as a regular-expression\n") | |
11402 | { | |
11403 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
11404 | } | |
11405 | ||
94f2b392 | 11406 | static void |
718e3744 | 11407 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
11408 | { | |
11409 | struct community_entry *entry; | |
11410 | ||
11411 | for (entry = list->head; entry; entry = entry->next) | |
11412 | { | |
11413 | if (entry == list->head) | |
11414 | { | |
11415 | if (all_digit (list->name)) | |
11416 | vty_out (vty, "Extended community %s list %s%s", | |
11417 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
11418 | "standard" : "(expanded) access", | |
11419 | list->name, VTY_NEWLINE); | |
11420 | else | |
11421 | vty_out (vty, "Named extended community %s list %s%s", | |
11422 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
11423 | "standard" : "expanded", | |
11424 | list->name, VTY_NEWLINE); | |
11425 | } | |
11426 | if (entry->any) | |
11427 | vty_out (vty, " %s%s", | |
11428 | community_direct_str (entry->direct), VTY_NEWLINE); | |
11429 | else | |
11430 | vty_out (vty, " %s %s%s", | |
11431 | community_direct_str (entry->direct), | |
11432 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
11433 | entry->u.ecom->str : entry->config, | |
11434 | VTY_NEWLINE); | |
11435 | } | |
11436 | } | |
11437 | ||
11438 | DEFUN (show_ip_extcommunity_list, | |
11439 | show_ip_extcommunity_list_cmd, | |
11440 | "show ip extcommunity-list", | |
11441 | SHOW_STR | |
11442 | IP_STR | |
11443 | "List extended-community list\n") | |
11444 | { | |
11445 | struct community_list *list; | |
11446 | struct community_list_master *cm; | |
11447 | ||
fee6e4e4 | 11448 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 11449 | if (! cm) |
11450 | return CMD_SUCCESS; | |
11451 | ||
11452 | for (list = cm->num.head; list; list = list->next) | |
11453 | extcommunity_list_show (vty, list); | |
11454 | ||
11455 | for (list = cm->str.head; list; list = list->next) | |
11456 | extcommunity_list_show (vty, list); | |
11457 | ||
11458 | return CMD_SUCCESS; | |
11459 | } | |
11460 | ||
11461 | DEFUN (show_ip_extcommunity_list_arg, | |
11462 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 11463 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 11464 | SHOW_STR |
11465 | IP_STR | |
11466 | "List extended-community list\n" | |
11467 | "Extcommunity-list number\n" | |
11468 | "Extcommunity-list name\n") | |
11469 | { | |
11470 | struct community_list *list; | |
11471 | ||
fee6e4e4 | 11472 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 11473 | if (! list) |
11474 | { | |
b729294c | 11475 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 11476 | return CMD_WARNING; |
11477 | } | |
11478 | ||
11479 | extcommunity_list_show (vty, list); | |
11480 | ||
11481 | return CMD_SUCCESS; | |
11482 | } | |
6b0655a2 | 11483 | |
718e3744 | 11484 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 11485 | static const char * |
718e3744 | 11486 | community_list_config_str (struct community_entry *entry) |
11487 | { | |
fd79ac91 | 11488 | const char *str; |
718e3744 | 11489 | |
11490 | if (entry->any) | |
11491 | str = ""; | |
11492 | else | |
11493 | { | |
11494 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
11495 | str = community_str (entry->u.com); | |
11496 | else | |
11497 | str = entry->config; | |
11498 | } | |
11499 | return str; | |
11500 | } | |
11501 | ||
11502 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 11503 | static int |
718e3744 | 11504 | community_list_config_write (struct vty *vty) |
11505 | { | |
11506 | struct community_list *list; | |
11507 | struct community_entry *entry; | |
11508 | struct community_list_master *cm; | |
11509 | int write = 0; | |
11510 | ||
11511 | /* Community-list. */ | |
fee6e4e4 | 11512 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 11513 | |
11514 | for (list = cm->num.head; list; list = list->next) | |
11515 | for (entry = list->head; entry; entry = entry->next) | |
11516 | { | |
fee6e4e4 | 11517 | vty_out (vty, "ip community-list %s %s %s%s", |
11518 | list->name, community_direct_str (entry->direct), | |
11519 | community_list_config_str (entry), | |
11520 | VTY_NEWLINE); | |
718e3744 | 11521 | write++; |
11522 | } | |
11523 | for (list = cm->str.head; list; list = list->next) | |
11524 | for (entry = list->head; entry; entry = entry->next) | |
11525 | { | |
11526 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
11527 | entry->style == COMMUNITY_LIST_STANDARD | |
11528 | ? "standard" : "expanded", | |
11529 | list->name, community_direct_str (entry->direct), | |
11530 | community_list_config_str (entry), | |
11531 | VTY_NEWLINE); | |
11532 | write++; | |
11533 | } | |
11534 | ||
11535 | /* Extcommunity-list. */ | |
fee6e4e4 | 11536 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 11537 | |
11538 | for (list = cm->num.head; list; list = list->next) | |
11539 | for (entry = list->head; entry; entry = entry->next) | |
11540 | { | |
fee6e4e4 | 11541 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
11542 | list->name, community_direct_str (entry->direct), | |
11543 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 11544 | write++; |
11545 | } | |
11546 | for (list = cm->str.head; list; list = list->next) | |
11547 | for (entry = list->head; entry; entry = entry->next) | |
11548 | { | |
11549 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
11550 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
11551 | ? "standard" : "expanded", | |
11552 | list->name, community_direct_str (entry->direct), | |
11553 | community_list_config_str (entry), VTY_NEWLINE); | |
11554 | write++; | |
11555 | } | |
11556 | return write; | |
11557 | } | |
11558 | ||
7fc626de | 11559 | static struct cmd_node community_list_node = |
718e3744 | 11560 | { |
11561 | COMMUNITY_LIST_NODE, | |
11562 | "", | |
11563 | 1 /* Export to vtysh. */ | |
11564 | }; | |
11565 | ||
94f2b392 | 11566 | static void |
11567 | community_list_vty (void) | |
718e3744 | 11568 | { |
11569 | install_node (&community_list_node, community_list_config_write); | |
11570 | ||
11571 | /* Community-list. */ | |
718e3744 | 11572 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
11573 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
11574 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
11575 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
11576 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
11577 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 11578 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
11579 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); | |
11580 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
11581 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 11582 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
11583 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
11584 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
11585 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); | |
11586 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
11587 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
11588 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
11589 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
11590 | ||
11591 | /* Extcommunity-list. */ | |
11592 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
11593 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
11594 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
11595 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
11596 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
11597 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 11598 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
11599 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); | |
11600 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
11601 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 11602 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
11603 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
11604 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
11605 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); | |
11606 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
11607 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
11608 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
11609 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
11610 | } |