]>
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" |
718e3744 | 52 | |
18a6dce6 | 53 | extern struct in_addr router_id_zebra; |
54 | ||
718e3744 | 55 | /* Utility function to get address family from current node. */ |
56 | afi_t | |
57 | bgp_node_afi (struct vty *vty) | |
58 | { | |
25ffbdc1 | 59 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 60 | return AFI_IP6; |
61 | return AFI_IP; | |
62 | } | |
63 | ||
64 | /* Utility function to get subsequent address family from current | |
65 | node. */ | |
66 | safi_t | |
67 | bgp_node_safi (struct vty *vty) | |
68 | { | |
69 | if (vty->node == BGP_VPNV4_NODE) | |
70 | return SAFI_MPLS_VPN; | |
25ffbdc1 | 71 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 72 | return SAFI_MULTICAST; |
73 | return SAFI_UNICAST; | |
74 | } | |
75 | ||
94f2b392 | 76 | static int |
718e3744 | 77 | peer_address_self_check (union sockunion *su) |
78 | { | |
79 | struct interface *ifp = NULL; | |
80 | ||
81 | if (su->sa.sa_family == AF_INET) | |
82 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); | |
83 | #ifdef HAVE_IPV6 | |
84 | else if (su->sa.sa_family == AF_INET6) | |
85 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); | |
86 | #endif /* HAVE IPV6 */ | |
87 | ||
88 | if (ifp) | |
89 | return 1; | |
90 | ||
91 | return 0; | |
92 | } | |
93 | ||
94 | /* Utility function for looking up peer from VTY. */ | |
94f2b392 | 95 | static struct peer * |
fd79ac91 | 96 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 97 | { |
98 | int ret; | |
99 | struct bgp *bgp; | |
100 | union sockunion su; | |
101 | struct peer *peer; | |
102 | ||
103 | bgp = vty->index; | |
104 | ||
105 | ret = str2sockunion (ip_str, &su); | |
106 | if (ret < 0) | |
107 | { | |
108 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); | |
109 | return NULL; | |
110 | } | |
111 | ||
112 | peer = peer_lookup (bgp, &su); | |
113 | if (! peer) | |
114 | { | |
115 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE); | |
116 | return NULL; | |
117 | } | |
118 | return peer; | |
119 | } | |
120 | ||
121 | /* Utility function for looking up peer or peer group. */ | |
94f2b392 | 122 | static struct peer * |
fd79ac91 | 123 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 124 | { |
125 | int ret; | |
126 | struct bgp *bgp; | |
127 | union sockunion su; | |
128 | struct peer *peer; | |
129 | struct peer_group *group; | |
130 | ||
131 | bgp = vty->index; | |
132 | ||
133 | ret = str2sockunion (peer_str, &su); | |
134 | if (ret == 0) | |
135 | { | |
136 | peer = peer_lookup (bgp, &su); | |
137 | if (peer) | |
138 | return peer; | |
139 | } | |
140 | else | |
141 | { | |
142 | group = peer_group_lookup (bgp, peer_str); | |
143 | if (group) | |
144 | return group->conf; | |
145 | } | |
146 | ||
147 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
148 | VTY_NEWLINE); | |
149 | ||
150 | return NULL; | |
151 | } | |
152 | ||
94f2b392 | 153 | static int |
718e3744 | 154 | bgp_vty_return (struct vty *vty, int ret) |
155 | { | |
fd79ac91 | 156 | const char *str = NULL; |
718e3744 | 157 | |
158 | switch (ret) | |
159 | { | |
160 | case BGP_ERR_INVALID_VALUE: | |
161 | str = "Invalid value"; | |
162 | break; | |
163 | case BGP_ERR_INVALID_FLAG: | |
164 | str = "Invalid flag"; | |
165 | break; | |
166 | case BGP_ERR_PEER_INACTIVE: | |
167 | str = "Activate the neighbor for the address family first"; | |
168 | break; | |
169 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: | |
170 | str = "Invalid command for a peer-group member"; | |
171 | break; | |
172 | case BGP_ERR_PEER_GROUP_SHUTDOWN: | |
173 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
174 | break; | |
175 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: | |
176 | str = "This peer is a peer-group member. Please change peer-group configuration"; | |
177 | break; | |
178 | case BGP_ERR_PEER_FLAG_CONFLICT: | |
179 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
180 | break; | |
181 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: | |
182 | str = "No activate for peergroup can be given only if peer-group has no members"; | |
183 | break; | |
184 | case BGP_ERR_PEER_BELONGS_TO_GROUP: | |
185 | str = "No activate for an individual peer-group member is invalid"; | |
186 | break; | |
187 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: | |
188 | str = "Activate the peer-group for the address family first"; | |
189 | break; | |
190 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: | |
191 | str = "Specify remote-as or peer-group remote AS first"; | |
192 | break; | |
193 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
194 | str = "Cannot change the peer-group. Deconfigure first"; | |
195 | break; | |
196 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
197 | str = "Cannot have different peer-group for the neighbor"; | |
198 | break; | |
199 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
200 | str = "Prefix/distribute list can not co-exist"; | |
201 | break; | |
202 | case BGP_ERR_NOT_INTERNAL_PEER: | |
203 | str = "Invalid command. Not an internal neighbor"; | |
204 | break; | |
205 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
206 | str = "Private AS cannot be removed for IBGP peers"; | |
207 | break; | |
208 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
209 | str = "Local-AS allowed only for EBGP peers"; | |
210 | break; | |
211 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
212 | str = "Cannot have local-as same as BGP AS number"; | |
213 | break; | |
0df7c91f PJ |
214 | case BGP_ERR_TCPSIG_FAILED: |
215 | str = "Error while applying TCP-Sig to session(s)"; | |
216 | break; | |
fa411a21 NH |
217 | case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK: |
218 | str = "ebgp-multihop and ttl-security cannot be configured together"; | |
219 | break; | |
f5a4827d SH |
220 | case BGP_ERR_NO_IBGP_WITH_TTLHACK: |
221 | str = "ttl-security only allowed for EBGP peers"; | |
222 | break; | |
718e3744 | 223 | } |
224 | if (str) | |
225 | { | |
226 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
227 | return CMD_WARNING; | |
228 | } | |
229 | return CMD_SUCCESS; | |
230 | } | |
231 | ||
232 | /* BGP global configuration. */ | |
233 | ||
234 | DEFUN (bgp_multiple_instance_func, | |
235 | bgp_multiple_instance_cmd, | |
236 | "bgp multiple-instance", | |
237 | BGP_STR | |
238 | "Enable bgp multiple instance\n") | |
239 | { | |
240 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
241 | return CMD_SUCCESS; | |
242 | } | |
243 | ||
244 | DEFUN (no_bgp_multiple_instance, | |
245 | no_bgp_multiple_instance_cmd, | |
246 | "no bgp multiple-instance", | |
247 | NO_STR | |
248 | BGP_STR | |
249 | "BGP multiple instance\n") | |
250 | { | |
251 | int ret; | |
252 | ||
253 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
254 | if (ret < 0) | |
255 | { | |
256 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
257 | return CMD_WARNING; | |
258 | } | |
259 | return CMD_SUCCESS; | |
260 | } | |
261 | ||
262 | DEFUN (bgp_config_type, | |
263 | bgp_config_type_cmd, | |
264 | "bgp config-type (cisco|zebra)", | |
265 | BGP_STR | |
266 | "Configuration type\n" | |
267 | "cisco\n" | |
268 | "zebra\n") | |
269 | { | |
270 | if (strncmp (argv[0], "c", 1) == 0) | |
271 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
272 | else | |
273 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
274 | ||
275 | return CMD_SUCCESS; | |
276 | } | |
277 | ||
278 | DEFUN (no_bgp_config_type, | |
279 | no_bgp_config_type_cmd, | |
280 | "no bgp config-type", | |
281 | NO_STR | |
282 | BGP_STR | |
283 | "Display configuration type\n") | |
284 | { | |
285 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
286 | return CMD_SUCCESS; | |
287 | } | |
288 | ||
289 | DEFUN (no_synchronization, | |
290 | no_synchronization_cmd, | |
291 | "no synchronization", | |
292 | NO_STR | |
293 | "Perform IGP synchronization\n") | |
294 | { | |
295 | return CMD_SUCCESS; | |
296 | } | |
297 | ||
298 | DEFUN (no_auto_summary, | |
299 | no_auto_summary_cmd, | |
300 | "no auto-summary", | |
301 | NO_STR | |
302 | "Enable automatic network number summarization\n") | |
303 | { | |
304 | return CMD_SUCCESS; | |
305 | } | |
3d515fd9 | 306 | |
307 | DEFUN_DEPRECATED (neighbor_version, | |
308 | neighbor_version_cmd, | |
309 | NEIGHBOR_CMD "version (4|4-)", | |
310 | NEIGHBOR_STR | |
311 | NEIGHBOR_ADDR_STR | |
312 | "Set the BGP version to match a neighbor\n" | |
313 | "Neighbor's BGP version\n") | |
314 | { | |
315 | return CMD_SUCCESS; | |
316 | } | |
6b0655a2 | 317 | |
718e3744 | 318 | /* "router bgp" commands. */ |
319 | DEFUN (router_bgp, | |
320 | router_bgp_cmd, | |
320da874 | 321 | "router bgp " CMD_AS_RANGE, |
718e3744 | 322 | ROUTER_STR |
323 | BGP_STR | |
324 | AS_STR) | |
325 | { | |
326 | int ret; | |
327 | as_t as; | |
328 | struct bgp *bgp; | |
fd79ac91 | 329 | const char *name = NULL; |
718e3744 | 330 | |
0b2aa3a0 | 331 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 332 | |
333 | if (argc == 2) | |
334 | name = argv[1]; | |
335 | ||
336 | ret = bgp_get (&bgp, &as, name); | |
337 | switch (ret) | |
338 | { | |
339 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
340 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
341 | VTY_NEWLINE); | |
342 | return CMD_WARNING; | |
718e3744 | 343 | case BGP_ERR_AS_MISMATCH: |
aea339f7 | 344 | vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE); |
718e3744 | 345 | return CMD_WARNING; |
718e3744 | 346 | case BGP_ERR_INSTANCE_MISMATCH: |
347 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); | |
aea339f7 | 348 | vty_out (vty, "BGP instance is already running; AS is %u%s", |
718e3744 | 349 | as, VTY_NEWLINE); |
350 | return CMD_WARNING; | |
718e3744 | 351 | } |
352 | ||
353 | vty->node = BGP_NODE; | |
354 | vty->index = bgp; | |
355 | ||
356 | return CMD_SUCCESS; | |
357 | } | |
358 | ||
359 | ALIAS (router_bgp, | |
360 | router_bgp_view_cmd, | |
320da874 | 361 | "router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 362 | ROUTER_STR |
363 | BGP_STR | |
364 | AS_STR | |
365 | "BGP view\n" | |
366 | "view name\n") | |
6b0655a2 | 367 | |
718e3744 | 368 | /* "no router bgp" commands. */ |
369 | DEFUN (no_router_bgp, | |
370 | no_router_bgp_cmd, | |
320da874 | 371 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 372 | NO_STR |
373 | ROUTER_STR | |
374 | BGP_STR | |
375 | AS_STR) | |
376 | { | |
377 | as_t as; | |
378 | struct bgp *bgp; | |
fd79ac91 | 379 | const char *name = NULL; |
718e3744 | 380 | |
0b2aa3a0 | 381 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 382 | |
383 | if (argc == 2) | |
384 | name = argv[1]; | |
385 | ||
386 | /* Lookup bgp structure. */ | |
387 | bgp = bgp_lookup (as, name); | |
388 | if (! bgp) | |
389 | { | |
390 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
391 | return CMD_WARNING; | |
392 | } | |
393 | ||
394 | bgp_delete (bgp); | |
395 | ||
396 | return CMD_SUCCESS; | |
397 | } | |
398 | ||
399 | ALIAS (no_router_bgp, | |
400 | no_router_bgp_view_cmd, | |
320da874 | 401 | "no router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 402 | NO_STR |
403 | ROUTER_STR | |
404 | BGP_STR | |
405 | AS_STR | |
406 | "BGP view\n" | |
407 | "view name\n") | |
6b0655a2 | 408 | |
718e3744 | 409 | /* BGP router-id. */ |
410 | ||
411 | DEFUN (bgp_router_id, | |
412 | bgp_router_id_cmd, | |
413 | "bgp router-id A.B.C.D", | |
414 | BGP_STR | |
415 | "Override configured router identifier\n" | |
416 | "Manually configured router identifier\n") | |
417 | { | |
418 | int ret; | |
419 | struct in_addr id; | |
420 | struct bgp *bgp; | |
421 | ||
422 | bgp = vty->index; | |
423 | ||
424 | ret = inet_aton (argv[0], &id); | |
425 | if (! ret) | |
426 | { | |
427 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
428 | return CMD_WARNING; | |
429 | } | |
430 | ||
18a6dce6 | 431 | bgp->router_id_static = id; |
718e3744 | 432 | bgp_router_id_set (bgp, &id); |
433 | ||
434 | return CMD_SUCCESS; | |
435 | } | |
436 | ||
437 | DEFUN (no_bgp_router_id, | |
438 | no_bgp_router_id_cmd, | |
439 | "no bgp router-id", | |
440 | NO_STR | |
441 | BGP_STR | |
442 | "Override configured router identifier\n") | |
443 | { | |
444 | int ret; | |
445 | struct in_addr id; | |
446 | struct bgp *bgp; | |
447 | ||
448 | bgp = vty->index; | |
449 | ||
450 | if (argc == 1) | |
451 | { | |
452 | ret = inet_aton (argv[0], &id); | |
453 | if (! ret) | |
454 | { | |
455 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
456 | return CMD_WARNING; | |
457 | } | |
458 | ||
18a6dce6 | 459 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
718e3744 | 460 | { |
461 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
462 | return CMD_WARNING; | |
463 | } | |
464 | } | |
465 | ||
18a6dce6 | 466 | bgp->router_id_static.s_addr = 0; |
467 | bgp_router_id_set (bgp, &router_id_zebra); | |
718e3744 | 468 | |
469 | return CMD_SUCCESS; | |
470 | } | |
471 | ||
472 | ALIAS (no_bgp_router_id, | |
473 | no_bgp_router_id_val_cmd, | |
474 | "no bgp router-id A.B.C.D", | |
475 | NO_STR | |
476 | BGP_STR | |
477 | "Override configured router identifier\n" | |
478 | "Manually configured router identifier\n") | |
6b0655a2 | 479 | |
718e3744 | 480 | /* BGP Cluster ID. */ |
481 | ||
482 | DEFUN (bgp_cluster_id, | |
483 | bgp_cluster_id_cmd, | |
484 | "bgp cluster-id A.B.C.D", | |
485 | BGP_STR | |
486 | "Configure Route-Reflector Cluster-id\n" | |
487 | "Route-Reflector Cluster-id in IP address format\n") | |
488 | { | |
489 | int ret; | |
490 | struct bgp *bgp; | |
491 | struct in_addr cluster; | |
492 | ||
493 | bgp = vty->index; | |
494 | ||
495 | ret = inet_aton (argv[0], &cluster); | |
496 | if (! ret) | |
497 | { | |
498 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
499 | return CMD_WARNING; | |
500 | } | |
501 | ||
502 | bgp_cluster_id_set (bgp, &cluster); | |
503 | ||
504 | return CMD_SUCCESS; | |
505 | } | |
506 | ||
507 | ALIAS (bgp_cluster_id, | |
508 | bgp_cluster_id32_cmd, | |
509 | "bgp cluster-id <1-4294967295>", | |
510 | BGP_STR | |
511 | "Configure Route-Reflector Cluster-id\n" | |
512 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
513 | ||
514 | DEFUN (no_bgp_cluster_id, | |
515 | no_bgp_cluster_id_cmd, | |
516 | "no bgp cluster-id", | |
517 | NO_STR | |
518 | BGP_STR | |
519 | "Configure Route-Reflector Cluster-id\n") | |
520 | { | |
521 | int ret; | |
522 | struct bgp *bgp; | |
523 | struct in_addr cluster; | |
524 | ||
525 | bgp = vty->index; | |
526 | ||
527 | if (argc == 1) | |
528 | { | |
529 | ret = inet_aton (argv[0], &cluster); | |
530 | if (! ret) | |
531 | { | |
532 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
533 | return CMD_WARNING; | |
534 | } | |
535 | } | |
536 | ||
537 | bgp_cluster_id_unset (bgp); | |
538 | ||
539 | return CMD_SUCCESS; | |
540 | } | |
541 | ||
542 | ALIAS (no_bgp_cluster_id, | |
543 | no_bgp_cluster_id_arg_cmd, | |
544 | "no bgp cluster-id A.B.C.D", | |
545 | NO_STR | |
546 | BGP_STR | |
547 | "Configure Route-Reflector Cluster-id\n" | |
548 | "Route-Reflector Cluster-id in IP address format\n") | |
6b0655a2 | 549 | |
718e3744 | 550 | DEFUN (bgp_confederation_identifier, |
551 | bgp_confederation_identifier_cmd, | |
320da874 | 552 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 553 | "BGP specific commands\n" |
554 | "AS confederation parameters\n" | |
555 | "AS number\n" | |
556 | "Set routing domain confederation AS\n") | |
557 | { | |
558 | struct bgp *bgp; | |
559 | as_t as; | |
560 | ||
561 | bgp = vty->index; | |
562 | ||
0b2aa3a0 | 563 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 564 | |
565 | bgp_confederation_id_set (bgp, as); | |
566 | ||
567 | return CMD_SUCCESS; | |
568 | } | |
569 | ||
570 | DEFUN (no_bgp_confederation_identifier, | |
571 | no_bgp_confederation_identifier_cmd, | |
572 | "no bgp confederation identifier", | |
573 | NO_STR | |
574 | "BGP specific commands\n" | |
575 | "AS confederation parameters\n" | |
576 | "AS number\n") | |
577 | { | |
578 | struct bgp *bgp; | |
579 | as_t as; | |
580 | ||
581 | bgp = vty->index; | |
582 | ||
583 | if (argc == 1) | |
0b2aa3a0 | 584 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 585 | |
586 | bgp_confederation_id_unset (bgp); | |
587 | ||
588 | return CMD_SUCCESS; | |
589 | } | |
590 | ||
591 | ALIAS (no_bgp_confederation_identifier, | |
592 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 593 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 594 | NO_STR |
595 | "BGP specific commands\n" | |
596 | "AS confederation parameters\n" | |
597 | "AS number\n" | |
598 | "Set routing domain confederation AS\n") | |
6b0655a2 | 599 | |
718e3744 | 600 | DEFUN (bgp_confederation_peers, |
601 | bgp_confederation_peers_cmd, | |
320da874 | 602 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 603 | "BGP specific commands\n" |
604 | "AS confederation parameters\n" | |
605 | "Peer ASs in BGP confederation\n" | |
606 | AS_STR) | |
607 | { | |
608 | struct bgp *bgp; | |
609 | as_t as; | |
610 | int i; | |
611 | ||
612 | bgp = vty->index; | |
613 | ||
614 | for (i = 0; i < argc; i++) | |
615 | { | |
0b2aa3a0 | 616 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 617 | |
618 | if (bgp->as == as) | |
619 | { | |
620 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
621 | VTY_NEWLINE); | |
622 | continue; | |
623 | } | |
624 | ||
625 | bgp_confederation_peers_add (bgp, as); | |
626 | } | |
627 | return CMD_SUCCESS; | |
628 | } | |
629 | ||
630 | DEFUN (no_bgp_confederation_peers, | |
631 | no_bgp_confederation_peers_cmd, | |
320da874 | 632 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 633 | NO_STR |
634 | "BGP specific commands\n" | |
635 | "AS confederation parameters\n" | |
636 | "Peer ASs in BGP confederation\n" | |
637 | AS_STR) | |
638 | { | |
639 | struct bgp *bgp; | |
640 | as_t as; | |
641 | int i; | |
642 | ||
643 | bgp = vty->index; | |
644 | ||
645 | for (i = 0; i < argc; i++) | |
646 | { | |
0b2aa3a0 PJ |
647 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
648 | ||
718e3744 | 649 | bgp_confederation_peers_remove (bgp, as); |
650 | } | |
651 | return CMD_SUCCESS; | |
652 | } | |
6b0655a2 | 653 | |
5e242b0d DS |
654 | /** |
655 | * Central routine for maximum-paths configuration. | |
656 | * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP | |
657 | * @set: 1 for setting values, 0 for removing the max-paths config. | |
658 | */ | |
659 | int | |
660 | bgp_maxpaths_config_vty (struct vty *vty, int peer_type, char *mpaths, | |
661 | u_int16_t options, int set) | |
165b5fff JB |
662 | { |
663 | struct bgp *bgp; | |
664 | u_int16_t maxpaths; | |
665 | int ret; | |
5e242b0d DS |
666 | afi_t afi; |
667 | safi_t safi; | |
165b5fff JB |
668 | |
669 | bgp = vty->index; | |
5e242b0d DS |
670 | afi = bgp_node_afi (vty); |
671 | safi = bgp_node_safi (vty); | |
165b5fff | 672 | |
5e242b0d DS |
673 | if (set) |
674 | { | |
73ac8160 DS |
675 | VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, |
676 | BGP_MAXIMUM_MAXPATHS); | |
5e242b0d DS |
677 | ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, |
678 | options); | |
679 | } | |
680 | else | |
681 | ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type); | |
165b5fff | 682 | |
165b5fff JB |
683 | if (ret < 0) |
684 | { | |
685 | vty_out (vty, | |
5e242b0d DS |
686 | "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s", |
687 | (set == 1) ? "" : "un", | |
688 | (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp", | |
689 | maxpaths, afi, safi, VTY_NEWLINE); | |
165b5fff JB |
690 | return CMD_WARNING; |
691 | } | |
692 | ||
693 | return CMD_SUCCESS; | |
694 | } | |
695 | ||
f188f2c4 DS |
696 | static int |
697 | bgp_update_delay_config_vty (struct vty *vty, const char *delay, | |
698 | const char *wait) | |
699 | { | |
700 | struct bgp *bgp; | |
701 | u_int16_t update_delay; | |
702 | u_int16_t establish_wait; | |
703 | ||
704 | ||
705 | bgp = vty->index; | |
706 | ||
707 | VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay, | |
708 | BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX); | |
709 | ||
710 | if (!wait) /* update-delay <delay> */ | |
711 | { | |
712 | bgp->v_update_delay = update_delay; | |
713 | bgp->v_establish_wait = bgp->v_update_delay; | |
714 | return CMD_SUCCESS; | |
715 | } | |
716 | ||
717 | /* update-delay <delay> <establish-wait> */ | |
718 | establish_wait = atoi (wait); | |
719 | if (update_delay < establish_wait) | |
720 | { | |
721 | vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s", | |
722 | VTY_NEWLINE); | |
723 | return CMD_WARNING; | |
724 | } | |
725 | ||
726 | bgp->v_update_delay = update_delay; | |
727 | bgp->v_establish_wait = establish_wait; | |
728 | ||
729 | return CMD_SUCCESS; | |
730 | } | |
731 | ||
732 | static int | |
733 | bgp_update_delay_deconfig_vty (struct vty *vty) | |
734 | { | |
735 | struct bgp *bgp; | |
736 | ||
737 | bgp = vty->index; | |
738 | ||
739 | bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; | |
740 | bgp->v_establish_wait = bgp->v_update_delay; | |
741 | ||
742 | return CMD_SUCCESS; | |
743 | } | |
744 | ||
745 | int | |
746 | bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp) | |
747 | { | |
748 | if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) | |
749 | { | |
750 | vty_out (vty, " update-delay %d", bgp->v_update_delay); | |
751 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
752 | vty_out (vty, " %d", bgp->v_establish_wait); | |
753 | vty_out (vty, "%s", VTY_NEWLINE); | |
754 | } | |
755 | ||
756 | return 0; | |
757 | } | |
758 | ||
759 | ||
760 | /* Update-delay configuration */ | |
761 | DEFUN (bgp_update_delay, | |
762 | bgp_update_delay_cmd, | |
763 | "update-delay <0-3600>", | |
764 | "Force initial delay for best-path and updates\n" | |
765 | "Seconds\n") | |
766 | { | |
767 | return bgp_update_delay_config_vty(vty, argv[0], NULL); | |
768 | } | |
769 | ||
770 | DEFUN (bgp_update_delay_establish_wait, | |
771 | bgp_update_delay_establish_wait_cmd, | |
772 | "update-delay <0-3600> <1-3600>", | |
773 | "Force initial delay for best-path and updates\n" | |
774 | "Seconds\n" | |
775 | "Wait for peers to be established\n" | |
776 | "Seconds\n") | |
777 | { | |
778 | return bgp_update_delay_config_vty(vty, argv[0], argv[1]); | |
779 | } | |
780 | ||
781 | /* Update-delay deconfiguration */ | |
782 | DEFUN (no_bgp_update_delay, | |
783 | no_bgp_update_delay_cmd, | |
784 | "no update-delay <0-3600>", | |
785 | "Force initial delay for best-path and updates\n" | |
786 | "Seconds\n") | |
787 | { | |
788 | return bgp_update_delay_deconfig_vty(vty); | |
789 | } | |
790 | ||
791 | ALIAS (no_bgp_update_delay, | |
792 | no_bgp_update_delay_establish_wait_cmd, | |
793 | "no update-delay <0-3600> <1-3600>", | |
794 | "Force initial delay for best-path and updates\n" | |
795 | "Seconds\n" | |
796 | "Wait for peers to be established\n" | |
797 | "Seconds\n") | |
5e242b0d DS |
798 | |
799 | /* Maximum-paths configuration */ | |
800 | DEFUN (bgp_maxpaths, | |
801 | bgp_maxpaths_cmd, | |
802 | "maximum-paths <1-255>", | |
803 | "Forward packets over multiple paths\n" | |
804 | "Number of paths\n") | |
805 | { | |
806 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1); | |
807 | } | |
808 | ||
165b5fff JB |
809 | DEFUN (bgp_maxpaths_ibgp, |
810 | bgp_maxpaths_ibgp_cmd, | |
811 | "maximum-paths ibgp <1-255>", | |
812 | "Forward packets over multiple paths\n" | |
813 | "iBGP-multipath\n" | |
814 | "Number of paths\n") | |
815 | { | |
5e242b0d DS |
816 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1); |
817 | } | |
165b5fff | 818 | |
5e242b0d DS |
819 | DEFUN (bgp_maxpaths_ibgp_cluster, |
820 | bgp_maxpaths_ibgp_cluster_cmd, | |
821 | "maximum-paths ibgp <1-255> equal-cluster-length", | |
822 | "Forward packets over multiple paths\n" | |
823 | "iBGP-multipath\n" | |
824 | "Number of paths\n" | |
825 | "Match the cluster length\n") | |
826 | { | |
827 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], | |
828 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1); | |
165b5fff JB |
829 | } |
830 | ||
831 | DEFUN (no_bgp_maxpaths, | |
832 | no_bgp_maxpaths_cmd, | |
833 | "no maximum-paths", | |
834 | NO_STR | |
835 | "Forward packets over multiple paths\n" | |
836 | "Number of paths\n") | |
837 | { | |
5e242b0d | 838 | return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0); |
165b5fff JB |
839 | } |
840 | ||
841 | ALIAS (no_bgp_maxpaths, | |
842 | no_bgp_maxpaths_arg_cmd, | |
843 | "no maximum-paths <1-255>", | |
844 | NO_STR | |
845 | "Forward packets over multiple paths\n" | |
846 | "Number of paths\n") | |
847 | ||
848 | DEFUN (no_bgp_maxpaths_ibgp, | |
849 | no_bgp_maxpaths_ibgp_cmd, | |
850 | "no maximum-paths ibgp", | |
851 | NO_STR | |
852 | "Forward packets over multiple paths\n" | |
853 | "iBGP-multipath\n" | |
854 | "Number of paths\n") | |
855 | { | |
5e242b0d | 856 | return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0); |
165b5fff JB |
857 | } |
858 | ||
859 | ALIAS (no_bgp_maxpaths_ibgp, | |
860 | no_bgp_maxpaths_ibgp_arg_cmd, | |
861 | "no maximum-paths ibgp <1-255>", | |
862 | NO_STR | |
863 | "Forward packets over multiple paths\n" | |
864 | "iBGP-multipath\n" | |
865 | "Number of paths\n") | |
866 | ||
5e242b0d DS |
867 | ALIAS (no_bgp_maxpaths_ibgp, |
868 | no_bgp_maxpaths_ibgp_cluster_cmd, | |
869 | "no maximum-paths ibgp <1-255> equal-cluster-length", | |
870 | NO_STR | |
871 | "Forward packets over multiple paths\n" | |
872 | "iBGP-multipath\n" | |
873 | "Number of paths\n" | |
874 | "Match the cluster length\n") | |
875 | ||
165b5fff JB |
876 | int |
877 | bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi, | |
878 | safi_t safi, int *write) | |
879 | { | |
880 | if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS) | |
881 | { | |
882 | bgp_config_write_family_header (vty, afi, safi, write); | |
883 | vty_out (vty, " maximum-paths %d%s", | |
884 | bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE); | |
885 | } | |
886 | ||
887 | if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS) | |
888 | { | |
889 | bgp_config_write_family_header (vty, afi, safi, write); | |
5e242b0d DS |
890 | vty_out (vty, " maximum-paths ibgp %d", |
891 | bgp->maxpaths[afi][safi].maxpaths_ibgp); | |
892 | if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags, | |
893 | BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN)) | |
894 | vty_out (vty, " equal-cluster-length"); | |
895 | vty_out (vty, "%s", VTY_NEWLINE); | |
165b5fff JB |
896 | } |
897 | ||
898 | return 0; | |
899 | } | |
6b0655a2 | 900 | |
718e3744 | 901 | /* BGP timers. */ |
902 | ||
903 | DEFUN (bgp_timers, | |
904 | bgp_timers_cmd, | |
905 | "timers bgp <0-65535> <0-65535>", | |
906 | "Adjust routing timers\n" | |
907 | "BGP timers\n" | |
908 | "Keepalive interval\n" | |
909 | "Holdtime\n") | |
910 | { | |
911 | struct bgp *bgp; | |
912 | unsigned long keepalive = 0; | |
913 | unsigned long holdtime = 0; | |
914 | ||
915 | bgp = vty->index; | |
916 | ||
917 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
918 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
919 | ||
920 | /* Holdtime value check. */ | |
921 | if (holdtime < 3 && holdtime != 0) | |
922 | { | |
923 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
924 | VTY_NEWLINE); | |
925 | return CMD_WARNING; | |
926 | } | |
927 | ||
928 | bgp_timers_set (bgp, keepalive, holdtime); | |
929 | ||
930 | return CMD_SUCCESS; | |
931 | } | |
932 | ||
933 | DEFUN (no_bgp_timers, | |
934 | no_bgp_timers_cmd, | |
935 | "no timers bgp", | |
936 | NO_STR | |
937 | "Adjust routing timers\n" | |
938 | "BGP timers\n") | |
939 | { | |
940 | struct bgp *bgp; | |
941 | ||
942 | bgp = vty->index; | |
943 | bgp_timers_unset (bgp); | |
944 | ||
945 | return CMD_SUCCESS; | |
946 | } | |
947 | ||
948 | ALIAS (no_bgp_timers, | |
949 | no_bgp_timers_arg_cmd, | |
950 | "no timers bgp <0-65535> <0-65535>", | |
951 | NO_STR | |
952 | "Adjust routing timers\n" | |
953 | "BGP timers\n" | |
954 | "Keepalive interval\n" | |
955 | "Holdtime\n") | |
6b0655a2 | 956 | |
718e3744 | 957 | DEFUN (bgp_client_to_client_reflection, |
958 | bgp_client_to_client_reflection_cmd, | |
959 | "bgp client-to-client reflection", | |
960 | "BGP specific commands\n" | |
961 | "Configure client to client route reflection\n" | |
962 | "reflection of routes allowed\n") | |
963 | { | |
964 | struct bgp *bgp; | |
965 | ||
966 | bgp = vty->index; | |
967 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
968 | return CMD_SUCCESS; | |
969 | } | |
970 | ||
971 | DEFUN (no_bgp_client_to_client_reflection, | |
972 | no_bgp_client_to_client_reflection_cmd, | |
973 | "no bgp client-to-client reflection", | |
974 | NO_STR | |
975 | "BGP specific commands\n" | |
976 | "Configure client to client route reflection\n" | |
977 | "reflection of routes allowed\n") | |
978 | { | |
979 | struct bgp *bgp; | |
980 | ||
981 | bgp = vty->index; | |
982 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
983 | return CMD_SUCCESS; | |
984 | } | |
985 | ||
986 | /* "bgp always-compare-med" configuration. */ | |
987 | DEFUN (bgp_always_compare_med, | |
988 | bgp_always_compare_med_cmd, | |
989 | "bgp always-compare-med", | |
990 | "BGP specific commands\n" | |
991 | "Allow comparing MED from different neighbors\n") | |
992 | { | |
993 | struct bgp *bgp; | |
994 | ||
995 | bgp = vty->index; | |
996 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
997 | return CMD_SUCCESS; | |
998 | } | |
999 | ||
1000 | DEFUN (no_bgp_always_compare_med, | |
1001 | no_bgp_always_compare_med_cmd, | |
1002 | "no bgp always-compare-med", | |
1003 | NO_STR | |
1004 | "BGP specific commands\n" | |
1005 | "Allow comparing MED from different neighbors\n") | |
1006 | { | |
1007 | struct bgp *bgp; | |
1008 | ||
1009 | bgp = vty->index; | |
1010 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
1011 | return CMD_SUCCESS; | |
1012 | } | |
6b0655a2 | 1013 | |
718e3744 | 1014 | /* "bgp deterministic-med" configuration. */ |
1015 | DEFUN (bgp_deterministic_med, | |
1016 | bgp_deterministic_med_cmd, | |
1017 | "bgp deterministic-med", | |
1018 | "BGP specific commands\n" | |
1019 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1020 | { | |
1021 | struct bgp *bgp; | |
1022 | ||
1023 | bgp = vty->index; | |
1024 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1025 | return CMD_SUCCESS; | |
1026 | } | |
1027 | ||
1028 | DEFUN (no_bgp_deterministic_med, | |
1029 | no_bgp_deterministic_med_cmd, | |
1030 | "no bgp deterministic-med", | |
1031 | NO_STR | |
1032 | "BGP specific commands\n" | |
1033 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
1034 | { | |
1035 | struct bgp *bgp; | |
1036 | ||
1037 | bgp = vty->index; | |
1038 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
1039 | return CMD_SUCCESS; | |
1040 | } | |
538621f2 | 1041 | |
1042 | /* "bgp graceful-restart" configuration. */ | |
1043 | DEFUN (bgp_graceful_restart, | |
1044 | bgp_graceful_restart_cmd, | |
1045 | "bgp graceful-restart", | |
1046 | "BGP specific commands\n" | |
1047 | "Graceful restart capability parameters\n") | |
1048 | { | |
1049 | struct bgp *bgp; | |
1050 | ||
1051 | bgp = vty->index; | |
1052 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1053 | return CMD_SUCCESS; | |
1054 | } | |
1055 | ||
1056 | DEFUN (no_bgp_graceful_restart, | |
1057 | no_bgp_graceful_restart_cmd, | |
1058 | "no bgp graceful-restart", | |
1059 | NO_STR | |
1060 | "BGP specific commands\n" | |
1061 | "Graceful restart capability parameters\n") | |
1062 | { | |
1063 | struct bgp *bgp; | |
1064 | ||
1065 | bgp = vty->index; | |
1066 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
1067 | return CMD_SUCCESS; | |
1068 | } | |
1069 | ||
93406d87 | 1070 | DEFUN (bgp_graceful_restart_stalepath_time, |
1071 | bgp_graceful_restart_stalepath_time_cmd, | |
1072 | "bgp graceful-restart stalepath-time <1-3600>", | |
1073 | "BGP specific commands\n" | |
1074 | "Graceful restart capability parameters\n" | |
1075 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1076 | "Delay value (seconds)\n") | |
1077 | { | |
1078 | struct bgp *bgp; | |
1079 | u_int32_t stalepath; | |
1080 | ||
1081 | bgp = vty->index; | |
1082 | if (! bgp) | |
1083 | return CMD_WARNING; | |
1084 | ||
1085 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
1086 | bgp->stalepath_time = stalepath; | |
1087 | return CMD_SUCCESS; | |
1088 | } | |
1089 | ||
1090 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
1091 | no_bgp_graceful_restart_stalepath_time_cmd, | |
1092 | "no bgp graceful-restart stalepath-time", | |
1093 | NO_STR | |
1094 | "BGP specific commands\n" | |
1095 | "Graceful restart capability parameters\n" | |
1096 | "Set the max time to hold onto restarting peer's stale paths\n") | |
1097 | { | |
1098 | struct bgp *bgp; | |
1099 | ||
1100 | bgp = vty->index; | |
1101 | if (! bgp) | |
1102 | return CMD_WARNING; | |
1103 | ||
1104 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
1105 | return CMD_SUCCESS; | |
1106 | } | |
1107 | ||
1108 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
1109 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
1110 | "no bgp graceful-restart stalepath-time <1-3600>", | |
1111 | NO_STR | |
1112 | "BGP specific commands\n" | |
1113 | "Graceful restart capability parameters\n" | |
1114 | "Set the max time to hold onto restarting peer's stale paths\n" | |
1115 | "Delay value (seconds)\n") | |
1116 | ||
718e3744 | 1117 | /* "bgp fast-external-failover" configuration. */ |
1118 | DEFUN (bgp_fast_external_failover, | |
1119 | bgp_fast_external_failover_cmd, | |
1120 | "bgp fast-external-failover", | |
1121 | BGP_STR | |
1122 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1123 | { | |
1124 | struct bgp *bgp; | |
1125 | ||
1126 | bgp = vty->index; | |
1127 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1128 | return CMD_SUCCESS; | |
1129 | } | |
1130 | ||
1131 | DEFUN (no_bgp_fast_external_failover, | |
1132 | no_bgp_fast_external_failover_cmd, | |
1133 | "no bgp fast-external-failover", | |
1134 | NO_STR | |
1135 | BGP_STR | |
1136 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
1137 | { | |
1138 | struct bgp *bgp; | |
1139 | ||
1140 | bgp = vty->index; | |
1141 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
1142 | return CMD_SUCCESS; | |
1143 | } | |
6b0655a2 | 1144 | |
718e3744 | 1145 | /* "bgp enforce-first-as" configuration. */ |
1146 | DEFUN (bgp_enforce_first_as, | |
1147 | bgp_enforce_first_as_cmd, | |
1148 | "bgp enforce-first-as", | |
1149 | BGP_STR | |
1150 | "Enforce the first AS for EBGP routes\n") | |
1151 | { | |
1152 | struct bgp *bgp; | |
1153 | ||
1154 | bgp = vty->index; | |
1155 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
1156 | return CMD_SUCCESS; | |
1157 | } | |
1158 | ||
1159 | DEFUN (no_bgp_enforce_first_as, | |
1160 | no_bgp_enforce_first_as_cmd, | |
1161 | "no bgp enforce-first-as", | |
1162 | NO_STR | |
1163 | BGP_STR | |
1164 | "Enforce the first AS for EBGP routes\n") | |
1165 | { | |
1166 | struct bgp *bgp; | |
1167 | ||
1168 | bgp = vty->index; | |
1169 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
1170 | return CMD_SUCCESS; | |
1171 | } | |
6b0655a2 | 1172 | |
718e3744 | 1173 | /* "bgp bestpath compare-routerid" configuration. */ |
1174 | DEFUN (bgp_bestpath_compare_router_id, | |
1175 | bgp_bestpath_compare_router_id_cmd, | |
1176 | "bgp bestpath compare-routerid", | |
1177 | "BGP specific commands\n" | |
1178 | "Change the default bestpath selection\n" | |
1179 | "Compare router-id for identical EBGP paths\n") | |
1180 | { | |
1181 | struct bgp *bgp; | |
1182 | ||
1183 | bgp = vty->index; | |
1184 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
1185 | return CMD_SUCCESS; | |
1186 | } | |
1187 | ||
1188 | DEFUN (no_bgp_bestpath_compare_router_id, | |
1189 | no_bgp_bestpath_compare_router_id_cmd, | |
1190 | "no bgp bestpath compare-routerid", | |
1191 | NO_STR | |
1192 | "BGP specific commands\n" | |
1193 | "Change the default bestpath selection\n" | |
1194 | "Compare router-id for identical EBGP paths\n") | |
1195 | { | |
1196 | struct bgp *bgp; | |
1197 | ||
1198 | bgp = vty->index; | |
1199 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
1200 | return CMD_SUCCESS; | |
1201 | } | |
6b0655a2 | 1202 | |
718e3744 | 1203 | /* "bgp bestpath as-path ignore" configuration. */ |
1204 | DEFUN (bgp_bestpath_aspath_ignore, | |
1205 | bgp_bestpath_aspath_ignore_cmd, | |
1206 | "bgp bestpath as-path ignore", | |
1207 | "BGP specific commands\n" | |
1208 | "Change the default bestpath selection\n" | |
1209 | "AS-path attribute\n" | |
1210 | "Ignore as-path length in selecting a route\n") | |
1211 | { | |
1212 | struct bgp *bgp; | |
1213 | ||
1214 | bgp = vty->index; | |
1215 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
1216 | return CMD_SUCCESS; | |
1217 | } | |
1218 | ||
1219 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
1220 | no_bgp_bestpath_aspath_ignore_cmd, | |
1221 | "no bgp bestpath as-path ignore", | |
1222 | NO_STR | |
1223 | "BGP specific commands\n" | |
1224 | "Change the default bestpath selection\n" | |
1225 | "AS-path attribute\n" | |
1226 | "Ignore as-path length in selecting a route\n") | |
1227 | { | |
1228 | struct bgp *bgp; | |
1229 | ||
1230 | bgp = vty->index; | |
1231 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
1232 | return CMD_SUCCESS; | |
1233 | } | |
6b0655a2 | 1234 | |
6811845b | 1235 | /* "bgp bestpath as-path confed" configuration. */ |
1236 | DEFUN (bgp_bestpath_aspath_confed, | |
1237 | bgp_bestpath_aspath_confed_cmd, | |
1238 | "bgp bestpath as-path confed", | |
1239 | "BGP specific commands\n" | |
1240 | "Change the default bestpath selection\n" | |
1241 | "AS-path attribute\n" | |
1242 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1243 | { | |
1244 | struct bgp *bgp; | |
1245 | ||
1246 | bgp = vty->index; | |
1247 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
1248 | return CMD_SUCCESS; | |
1249 | } | |
1250 | ||
1251 | DEFUN (no_bgp_bestpath_aspath_confed, | |
1252 | no_bgp_bestpath_aspath_confed_cmd, | |
1253 | "no bgp bestpath as-path confed", | |
1254 | NO_STR | |
1255 | "BGP specific commands\n" | |
1256 | "Change the default bestpath selection\n" | |
1257 | "AS-path attribute\n" | |
1258 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1259 | { | |
1260 | struct bgp *bgp; | |
1261 | ||
1262 | bgp = vty->index; | |
1263 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
1264 | return CMD_SUCCESS; | |
1265 | } | |
6b0655a2 | 1266 | |
2fdd455c PM |
1267 | /* "bgp bestpath as-path multipath-relax" configuration. */ |
1268 | DEFUN (bgp_bestpath_aspath_multipath_relax, | |
1269 | bgp_bestpath_aspath_multipath_relax_cmd, | |
1270 | "bgp bestpath as-path multipath-relax", | |
1271 | "BGP specific commands\n" | |
1272 | "Change the default bestpath selection\n" | |
1273 | "AS-path attribute\n" | |
1274 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1275 | { | |
1276 | struct bgp *bgp; | |
1277 | ||
1278 | bgp = vty->index; | |
1279 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1280 | return CMD_SUCCESS; | |
1281 | } | |
1282 | ||
1283 | DEFUN (no_bgp_bestpath_aspath_multipath_relax, | |
1284 | no_bgp_bestpath_aspath_multipath_relax_cmd, | |
1285 | "no bgp bestpath as-path multipath-relax", | |
1286 | NO_STR | |
1287 | "BGP specific commands\n" | |
1288 | "Change the default bestpath selection\n" | |
1289 | "AS-path attribute\n" | |
1290 | "Allow load sharing across routes that have different AS paths (but same length)\n") | |
1291 | { | |
1292 | struct bgp *bgp; | |
1293 | ||
1294 | bgp = vty->index; | |
1295 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); | |
1296 | return CMD_SUCCESS; | |
1297 | } | |
6b0655a2 | 1298 | |
848973c7 | 1299 | /* "bgp log-neighbor-changes" configuration. */ |
1300 | DEFUN (bgp_log_neighbor_changes, | |
1301 | bgp_log_neighbor_changes_cmd, | |
1302 | "bgp log-neighbor-changes", | |
1303 | "BGP specific commands\n" | |
1304 | "Log neighbor up/down and reset reason\n") | |
1305 | { | |
1306 | struct bgp *bgp; | |
1307 | ||
1308 | bgp = vty->index; | |
1309 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1310 | return CMD_SUCCESS; | |
1311 | } | |
1312 | ||
1313 | DEFUN (no_bgp_log_neighbor_changes, | |
1314 | no_bgp_log_neighbor_changes_cmd, | |
1315 | "no bgp log-neighbor-changes", | |
1316 | NO_STR | |
1317 | "BGP specific commands\n" | |
1318 | "Log neighbor up/down and reset reason\n") | |
1319 | { | |
1320 | struct bgp *bgp; | |
1321 | ||
1322 | bgp = vty->index; | |
1323 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1324 | return CMD_SUCCESS; | |
1325 | } | |
6b0655a2 | 1326 | |
718e3744 | 1327 | /* "bgp bestpath med" configuration. */ |
1328 | DEFUN (bgp_bestpath_med, | |
1329 | bgp_bestpath_med_cmd, | |
1330 | "bgp bestpath med (confed|missing-as-worst)", | |
1331 | "BGP specific commands\n" | |
1332 | "Change the default bestpath selection\n" | |
1333 | "MED attribute\n" | |
1334 | "Compare MED among confederation paths\n" | |
1335 | "Treat missing MED as the least preferred one\n") | |
1336 | { | |
1337 | struct bgp *bgp; | |
1338 | ||
1339 | bgp = vty->index; | |
1340 | ||
1341 | if (strncmp (argv[0], "confed", 1) == 0) | |
1342 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
1343 | else | |
1344 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1345 | ||
1346 | return CMD_SUCCESS; | |
1347 | } | |
1348 | ||
1349 | DEFUN (bgp_bestpath_med2, | |
1350 | bgp_bestpath_med2_cmd, | |
1351 | "bgp bestpath med confed missing-as-worst", | |
1352 | "BGP specific commands\n" | |
1353 | "Change the default bestpath selection\n" | |
1354 | "MED attribute\n" | |
1355 | "Compare MED among confederation paths\n" | |
1356 | "Treat missing MED as the least preferred one\n") | |
1357 | { | |
1358 | struct bgp *bgp; | |
1359 | ||
1360 | bgp = vty->index; | |
1361 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
1362 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1363 | return CMD_SUCCESS; | |
1364 | } | |
1365 | ||
1366 | ALIAS (bgp_bestpath_med2, | |
1367 | bgp_bestpath_med3_cmd, | |
1368 | "bgp bestpath med missing-as-worst confed", | |
1369 | "BGP specific commands\n" | |
1370 | "Change the default bestpath selection\n" | |
1371 | "MED attribute\n" | |
1372 | "Treat missing MED as the least preferred one\n" | |
1373 | "Compare MED among confederation paths\n") | |
1374 | ||
1375 | DEFUN (no_bgp_bestpath_med, | |
1376 | no_bgp_bestpath_med_cmd, | |
1377 | "no bgp bestpath med (confed|missing-as-worst)", | |
1378 | NO_STR | |
1379 | "BGP specific commands\n" | |
1380 | "Change the default bestpath selection\n" | |
1381 | "MED attribute\n" | |
1382 | "Compare MED among confederation paths\n" | |
1383 | "Treat missing MED as the least preferred one\n") | |
1384 | { | |
1385 | struct bgp *bgp; | |
1386 | ||
1387 | bgp = vty->index; | |
1388 | ||
1389 | if (strncmp (argv[0], "confed", 1) == 0) | |
1390 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
1391 | else | |
1392 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1393 | ||
1394 | return CMD_SUCCESS; | |
1395 | } | |
1396 | ||
1397 | DEFUN (no_bgp_bestpath_med2, | |
1398 | no_bgp_bestpath_med2_cmd, | |
1399 | "no bgp bestpath med confed missing-as-worst", | |
1400 | NO_STR | |
1401 | "BGP specific commands\n" | |
1402 | "Change the default bestpath selection\n" | |
1403 | "MED attribute\n" | |
1404 | "Compare MED among confederation paths\n" | |
1405 | "Treat missing MED as the least preferred one\n") | |
1406 | { | |
1407 | struct bgp *bgp; | |
1408 | ||
1409 | bgp = vty->index; | |
1410 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
1411 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1412 | return CMD_SUCCESS; | |
1413 | } | |
1414 | ||
1415 | ALIAS (no_bgp_bestpath_med2, | |
1416 | no_bgp_bestpath_med3_cmd, | |
1417 | "no bgp bestpath med missing-as-worst confed", | |
1418 | NO_STR | |
1419 | "BGP specific commands\n" | |
1420 | "Change the default bestpath selection\n" | |
1421 | "MED attribute\n" | |
1422 | "Treat missing MED as the least preferred one\n" | |
1423 | "Compare MED among confederation paths\n") | |
6b0655a2 | 1424 | |
718e3744 | 1425 | /* "no bgp default ipv4-unicast". */ |
1426 | DEFUN (no_bgp_default_ipv4_unicast, | |
1427 | no_bgp_default_ipv4_unicast_cmd, | |
1428 | "no bgp default ipv4-unicast", | |
1429 | NO_STR | |
1430 | "BGP specific commands\n" | |
1431 | "Configure BGP defaults\n" | |
1432 | "Activate ipv4-unicast for a peer by default\n") | |
1433 | { | |
1434 | struct bgp *bgp; | |
1435 | ||
1436 | bgp = vty->index; | |
1437 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
1438 | return CMD_SUCCESS; | |
1439 | } | |
1440 | ||
1441 | DEFUN (bgp_default_ipv4_unicast, | |
1442 | bgp_default_ipv4_unicast_cmd, | |
1443 | "bgp default ipv4-unicast", | |
1444 | "BGP specific commands\n" | |
1445 | "Configure BGP defaults\n" | |
1446 | "Activate ipv4-unicast for a peer by default\n") | |
1447 | { | |
1448 | struct bgp *bgp; | |
1449 | ||
1450 | bgp = vty->index; | |
1451 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
1452 | return CMD_SUCCESS; | |
1453 | } | |
6b0655a2 | 1454 | |
718e3744 | 1455 | /* "bgp import-check" configuration. */ |
1456 | DEFUN (bgp_network_import_check, | |
1457 | bgp_network_import_check_cmd, | |
1458 | "bgp network import-check", | |
1459 | "BGP specific commands\n" | |
1460 | "BGP network command\n" | |
1461 | "Check BGP network route exists in IGP\n") | |
1462 | { | |
1463 | struct bgp *bgp; | |
1464 | ||
1465 | bgp = vty->index; | |
1466 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
1467 | return CMD_SUCCESS; | |
1468 | } | |
1469 | ||
1470 | DEFUN (no_bgp_network_import_check, | |
1471 | no_bgp_network_import_check_cmd, | |
1472 | "no bgp network import-check", | |
1473 | NO_STR | |
1474 | "BGP specific commands\n" | |
1475 | "BGP network command\n" | |
1476 | "Check BGP network route exists in IGP\n") | |
1477 | { | |
1478 | struct bgp *bgp; | |
1479 | ||
1480 | bgp = vty->index; | |
1481 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
1482 | return CMD_SUCCESS; | |
1483 | } | |
6b0655a2 | 1484 | |
718e3744 | 1485 | DEFUN (bgp_default_local_preference, |
1486 | bgp_default_local_preference_cmd, | |
1487 | "bgp default local-preference <0-4294967295>", | |
1488 | "BGP specific commands\n" | |
1489 | "Configure BGP defaults\n" | |
1490 | "local preference (higher=more preferred)\n" | |
1491 | "Configure default local preference value\n") | |
1492 | { | |
1493 | struct bgp *bgp; | |
1494 | u_int32_t local_pref; | |
1495 | ||
1496 | bgp = vty->index; | |
1497 | ||
1498 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
1499 | ||
1500 | bgp_default_local_preference_set (bgp, local_pref); | |
1501 | ||
1502 | return CMD_SUCCESS; | |
1503 | } | |
1504 | ||
1505 | DEFUN (no_bgp_default_local_preference, | |
1506 | no_bgp_default_local_preference_cmd, | |
1507 | "no bgp default local-preference", | |
1508 | NO_STR | |
1509 | "BGP specific commands\n" | |
1510 | "Configure BGP defaults\n" | |
1511 | "local preference (higher=more preferred)\n") | |
1512 | { | |
1513 | struct bgp *bgp; | |
1514 | ||
1515 | bgp = vty->index; | |
1516 | bgp_default_local_preference_unset (bgp); | |
1517 | return CMD_SUCCESS; | |
1518 | } | |
1519 | ||
1520 | ALIAS (no_bgp_default_local_preference, | |
1521 | no_bgp_default_local_preference_val_cmd, | |
1522 | "no bgp default local-preference <0-4294967295>", | |
1523 | NO_STR | |
1524 | "BGP specific commands\n" | |
1525 | "Configure BGP defaults\n" | |
1526 | "local preference (higher=more preferred)\n" | |
1527 | "Configure default local preference value\n") | |
6b0655a2 | 1528 | |
718e3744 | 1529 | static int |
fd79ac91 | 1530 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
1531 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 1532 | { |
1533 | int ret; | |
1534 | struct bgp *bgp; | |
1535 | as_t as; | |
1536 | union sockunion su; | |
1537 | ||
1538 | bgp = vty->index; | |
1539 | ||
1540 | /* Get AS number. */ | |
0b2aa3a0 | 1541 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); |
718e3744 | 1542 | |
1543 | /* If peer is peer group, call proper function. */ | |
1544 | ret = str2sockunion (peer_str, &su); | |
1545 | if (ret < 0) | |
1546 | { | |
1547 | ret = peer_group_remote_as (bgp, peer_str, &as); | |
1548 | if (ret < 0) | |
1549 | { | |
1550 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1551 | return CMD_WARNING; | |
1552 | } | |
1553 | return CMD_SUCCESS; | |
1554 | } | |
1555 | ||
1556 | if (peer_address_self_check (&su)) | |
1557 | { | |
1558 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
1559 | VTY_NEWLINE); | |
1560 | return CMD_WARNING; | |
1561 | } | |
1562 | ||
1563 | ret = peer_remote_as (bgp, &su, &as, afi, safi); | |
1564 | ||
1565 | /* This peer belongs to peer group. */ | |
1566 | switch (ret) | |
1567 | { | |
1568 | case BGP_ERR_PEER_GROUP_MEMBER: | |
aea339f7 | 1569 | vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE); |
718e3744 | 1570 | return CMD_WARNING; |
718e3744 | 1571 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
aea339f7 | 1572 | 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 | 1573 | return CMD_WARNING; |
718e3744 | 1574 | } |
1575 | return bgp_vty_return (vty, ret); | |
1576 | } | |
1577 | ||
1578 | DEFUN (neighbor_remote_as, | |
1579 | neighbor_remote_as_cmd, | |
320da874 | 1580 | NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, |
718e3744 | 1581 | NEIGHBOR_STR |
1582 | NEIGHBOR_ADDR_STR2 | |
1583 | "Specify a BGP neighbor\n" | |
1584 | AS_STR) | |
1585 | { | |
1586 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
1587 | } | |
6b0655a2 | 1588 | |
718e3744 | 1589 | DEFUN (neighbor_peer_group, |
1590 | neighbor_peer_group_cmd, | |
1591 | "neighbor WORD peer-group", | |
1592 | NEIGHBOR_STR | |
1593 | "Neighbor tag\n" | |
1594 | "Configure peer-group\n") | |
1595 | { | |
1596 | struct bgp *bgp; | |
1597 | struct peer_group *group; | |
1598 | ||
1599 | bgp = vty->index; | |
1600 | ||
1601 | group = peer_group_get (bgp, argv[0]); | |
1602 | if (! group) | |
1603 | return CMD_WARNING; | |
1604 | ||
1605 | return CMD_SUCCESS; | |
1606 | } | |
1607 | ||
1608 | DEFUN (no_neighbor, | |
1609 | no_neighbor_cmd, | |
1610 | NO_NEIGHBOR_CMD2, | |
1611 | NO_STR | |
1612 | NEIGHBOR_STR | |
1613 | NEIGHBOR_ADDR_STR2) | |
1614 | { | |
1615 | int ret; | |
1616 | union sockunion su; | |
1617 | struct peer_group *group; | |
1618 | struct peer *peer; | |
1619 | ||
1620 | ret = str2sockunion (argv[0], &su); | |
1621 | if (ret < 0) | |
1622 | { | |
1623 | group = peer_group_lookup (vty->index, argv[0]); | |
1624 | if (group) | |
1625 | peer_group_delete (group); | |
1626 | else | |
1627 | { | |
1628 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1629 | return CMD_WARNING; | |
1630 | } | |
1631 | } | |
1632 | else | |
1633 | { | |
1634 | peer = peer_lookup (vty->index, &su); | |
1635 | if (peer) | |
200df115 | 1636 | peer_delete (peer); |
718e3744 | 1637 | } |
1638 | ||
1639 | return CMD_SUCCESS; | |
1640 | } | |
1641 | ||
1642 | ALIAS (no_neighbor, | |
1643 | no_neighbor_remote_as_cmd, | |
320da874 | 1644 | NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, |
718e3744 | 1645 | NO_STR |
1646 | NEIGHBOR_STR | |
1647 | NEIGHBOR_ADDR_STR | |
1648 | "Specify a BGP neighbor\n" | |
1649 | AS_STR) | |
1650 | ||
1651 | DEFUN (no_neighbor_peer_group, | |
1652 | no_neighbor_peer_group_cmd, | |
1653 | "no neighbor WORD peer-group", | |
1654 | NO_STR | |
1655 | NEIGHBOR_STR | |
1656 | "Neighbor tag\n" | |
1657 | "Configure peer-group\n") | |
1658 | { | |
1659 | struct peer_group *group; | |
1660 | ||
1661 | group = peer_group_lookup (vty->index, argv[0]); | |
1662 | if (group) | |
1663 | peer_group_delete (group); | |
1664 | else | |
1665 | { | |
1666 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1667 | return CMD_WARNING; | |
1668 | } | |
1669 | return CMD_SUCCESS; | |
1670 | } | |
1671 | ||
1672 | DEFUN (no_neighbor_peer_group_remote_as, | |
1673 | no_neighbor_peer_group_remote_as_cmd, | |
320da874 | 1674 | "no neighbor WORD remote-as " CMD_AS_RANGE, |
718e3744 | 1675 | NO_STR |
1676 | NEIGHBOR_STR | |
1677 | "Neighbor tag\n" | |
1678 | "Specify a BGP neighbor\n" | |
1679 | AS_STR) | |
1680 | { | |
1681 | struct peer_group *group; | |
1682 | ||
1683 | group = peer_group_lookup (vty->index, argv[0]); | |
1684 | if (group) | |
1685 | peer_group_remote_as_delete (group); | |
1686 | else | |
1687 | { | |
1688 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1689 | return CMD_WARNING; | |
1690 | } | |
1691 | return CMD_SUCCESS; | |
1692 | } | |
6b0655a2 | 1693 | |
718e3744 | 1694 | DEFUN (neighbor_local_as, |
1695 | neighbor_local_as_cmd, | |
320da874 | 1696 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 1697 | NEIGHBOR_STR |
1698 | NEIGHBOR_ADDR_STR2 | |
1699 | "Specify a local-as number\n" | |
1700 | "AS number used as local AS\n") | |
1701 | { | |
1702 | struct peer *peer; | |
1703 | int ret; | |
1704 | ||
1705 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1706 | if (! peer) | |
1707 | return CMD_WARNING; | |
1708 | ||
9d3f9705 | 1709 | ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0); |
718e3744 | 1710 | return bgp_vty_return (vty, ret); |
1711 | } | |
1712 | ||
1713 | DEFUN (neighbor_local_as_no_prepend, | |
1714 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 1715 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 1716 | NEIGHBOR_STR |
1717 | NEIGHBOR_ADDR_STR2 | |
1718 | "Specify a local-as number\n" | |
1719 | "AS number used as local AS\n" | |
1720 | "Do not prepend local-as to updates from ebgp peers\n") | |
1721 | { | |
1722 | struct peer *peer; | |
1723 | int ret; | |
1724 | ||
1725 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1726 | if (! peer) | |
1727 | return CMD_WARNING; | |
1728 | ||
9d3f9705 | 1729 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0); |
718e3744 | 1730 | return bgp_vty_return (vty, ret); |
1731 | } | |
1732 | ||
9d3f9705 AC |
1733 | DEFUN (neighbor_local_as_no_prepend_replace_as, |
1734 | neighbor_local_as_no_prepend_replace_as_cmd, | |
1735 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
1736 | NEIGHBOR_STR | |
1737 | NEIGHBOR_ADDR_STR2 | |
1738 | "Specify a local-as number\n" | |
1739 | "AS number used as local AS\n" | |
1740 | "Do not prepend local-as to updates from ebgp peers\n" | |
1741 | "Do not prepend local-as to updates from ibgp peers\n") | |
1742 | { | |
1743 | struct peer *peer; | |
1744 | int ret; | |
1745 | ||
1746 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1747 | if (! peer) | |
1748 | return CMD_WARNING; | |
1749 | ||
1750 | ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1); | |
1751 | return bgp_vty_return (vty, ret); | |
1752 | } | |
1753 | ||
1754 | ||
718e3744 | 1755 | DEFUN (no_neighbor_local_as, |
1756 | no_neighbor_local_as_cmd, | |
1757 | NO_NEIGHBOR_CMD2 "local-as", | |
1758 | NO_STR | |
1759 | NEIGHBOR_STR | |
1760 | NEIGHBOR_ADDR_STR2 | |
1761 | "Specify a local-as number\n") | |
1762 | { | |
1763 | struct peer *peer; | |
1764 | int ret; | |
1765 | ||
1766 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1767 | if (! peer) | |
1768 | return CMD_WARNING; | |
1769 | ||
1770 | ret = peer_local_as_unset (peer); | |
1771 | return bgp_vty_return (vty, ret); | |
1772 | } | |
1773 | ||
1774 | ALIAS (no_neighbor_local_as, | |
1775 | no_neighbor_local_as_val_cmd, | |
320da874 | 1776 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 1777 | NO_STR |
1778 | NEIGHBOR_STR | |
1779 | NEIGHBOR_ADDR_STR2 | |
1780 | "Specify a local-as number\n" | |
1781 | "AS number used as local AS\n") | |
1782 | ||
1783 | ALIAS (no_neighbor_local_as, | |
1784 | no_neighbor_local_as_val2_cmd, | |
320da874 | 1785 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 1786 | NO_STR |
1787 | NEIGHBOR_STR | |
1788 | NEIGHBOR_ADDR_STR2 | |
1789 | "Specify a local-as number\n" | |
1790 | "AS number used as local AS\n" | |
1791 | "Do not prepend local-as to updates from ebgp peers\n") | |
9d3f9705 AC |
1792 | |
1793 | ALIAS (no_neighbor_local_as, | |
1794 | no_neighbor_local_as_val3_cmd, | |
1795 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as", | |
1796 | NO_STR | |
1797 | NEIGHBOR_STR | |
1798 | NEIGHBOR_ADDR_STR2 | |
1799 | "Specify a local-as number\n" | |
1800 | "AS number used as local AS\n" | |
1801 | "Do not prepend local-as to updates from ebgp peers\n" | |
1802 | "Do not prepend local-as to updates from ibgp peers\n") | |
6b0655a2 | 1803 | |
0df7c91f PJ |
1804 | DEFUN (neighbor_password, |
1805 | neighbor_password_cmd, | |
1806 | NEIGHBOR_CMD2 "password LINE", | |
1807 | NEIGHBOR_STR | |
1808 | NEIGHBOR_ADDR_STR2 | |
1809 | "Set a password\n" | |
1810 | "The password\n") | |
1811 | { | |
1812 | struct peer *peer; | |
1813 | int ret; | |
1814 | ||
1815 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1816 | if (! peer) | |
1817 | return CMD_WARNING; | |
1818 | ||
1819 | ret = peer_password_set (peer, argv[1]); | |
1820 | return bgp_vty_return (vty, ret); | |
1821 | } | |
1822 | ||
1823 | DEFUN (no_neighbor_password, | |
1824 | no_neighbor_password_cmd, | |
1825 | NO_NEIGHBOR_CMD2 "password", | |
1826 | NO_STR | |
1827 | NEIGHBOR_STR | |
1828 | NEIGHBOR_ADDR_STR2 | |
1829 | "Set a password\n") | |
1830 | { | |
1831 | struct peer *peer; | |
1832 | int ret; | |
1833 | ||
1834 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1835 | if (! peer) | |
1836 | return CMD_WARNING; | |
1837 | ||
1838 | ret = peer_password_unset (peer); | |
1839 | return bgp_vty_return (vty, ret); | |
1840 | } | |
6b0655a2 | 1841 | |
718e3744 | 1842 | DEFUN (neighbor_activate, |
1843 | neighbor_activate_cmd, | |
1844 | NEIGHBOR_CMD2 "activate", | |
1845 | NEIGHBOR_STR | |
1846 | NEIGHBOR_ADDR_STR2 | |
1847 | "Enable the Address Family for this Neighbor\n") | |
1848 | { | |
1849 | struct peer *peer; | |
1850 | ||
1851 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1852 | if (! peer) | |
1853 | return CMD_WARNING; | |
1854 | ||
1855 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
1856 | ||
1857 | return CMD_SUCCESS; | |
1858 | } | |
1859 | ||
1860 | DEFUN (no_neighbor_activate, | |
1861 | no_neighbor_activate_cmd, | |
1862 | NO_NEIGHBOR_CMD2 "activate", | |
1863 | NO_STR | |
1864 | NEIGHBOR_STR | |
1865 | NEIGHBOR_ADDR_STR2 | |
1866 | "Enable the Address Family for this Neighbor\n") | |
1867 | { | |
1868 | int ret; | |
1869 | struct peer *peer; | |
1870 | ||
1871 | /* Lookup peer. */ | |
1872 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1873 | if (! peer) | |
1874 | return CMD_WARNING; | |
1875 | ||
1876 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
1877 | ||
1878 | return bgp_vty_return (vty, ret); | |
1879 | } | |
6b0655a2 | 1880 | |
718e3744 | 1881 | DEFUN (neighbor_set_peer_group, |
1882 | neighbor_set_peer_group_cmd, | |
1883 | NEIGHBOR_CMD "peer-group WORD", | |
1884 | NEIGHBOR_STR | |
1885 | NEIGHBOR_ADDR_STR | |
1886 | "Member of the peer-group\n" | |
1887 | "peer-group name\n") | |
1888 | { | |
1889 | int ret; | |
1890 | as_t as; | |
1891 | union sockunion su; | |
1892 | struct bgp *bgp; | |
1893 | struct peer_group *group; | |
1894 | ||
1895 | bgp = vty->index; | |
1896 | ||
1897 | ret = str2sockunion (argv[0], &su); | |
1898 | if (ret < 0) | |
1899 | { | |
1900 | vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); | |
1901 | return CMD_WARNING; | |
1902 | } | |
1903 | ||
1904 | group = peer_group_lookup (bgp, argv[1]); | |
1905 | if (! group) | |
1906 | { | |
1907 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
1908 | return CMD_WARNING; | |
1909 | } | |
1910 | ||
1911 | if (peer_address_self_check (&su)) | |
1912 | { | |
1913 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
1914 | VTY_NEWLINE); | |
1915 | return CMD_WARNING; | |
1916 | } | |
1917 | ||
1918 | ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), | |
1919 | bgp_node_safi (vty), &as); | |
1920 | ||
1921 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
1922 | { | |
aea339f7 | 1923 | 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 | 1924 | return CMD_WARNING; |
1925 | } | |
1926 | ||
1927 | return bgp_vty_return (vty, ret); | |
1928 | } | |
1929 | ||
1930 | DEFUN (no_neighbor_set_peer_group, | |
1931 | no_neighbor_set_peer_group_cmd, | |
1932 | NO_NEIGHBOR_CMD "peer-group WORD", | |
1933 | NO_STR | |
1934 | NEIGHBOR_STR | |
1935 | NEIGHBOR_ADDR_STR | |
1936 | "Member of the peer-group\n" | |
1937 | "peer-group name\n") | |
1938 | { | |
1939 | int ret; | |
1940 | struct bgp *bgp; | |
1941 | struct peer *peer; | |
1942 | struct peer_group *group; | |
1943 | ||
1944 | bgp = vty->index; | |
1945 | ||
1946 | peer = peer_lookup_vty (vty, argv[0]); | |
1947 | if (! peer) | |
1948 | return CMD_WARNING; | |
1949 | ||
1950 | group = peer_group_lookup (bgp, argv[1]); | |
1951 | if (! group) | |
1952 | { | |
1953 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
1954 | return CMD_WARNING; | |
1955 | } | |
1956 | ||
1957 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), | |
1958 | bgp_node_safi (vty)); | |
1959 | ||
1960 | return bgp_vty_return (vty, ret); | |
1961 | } | |
6b0655a2 | 1962 | |
94f2b392 | 1963 | static int |
fd79ac91 | 1964 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
1965 | u_int16_t flag, int set) | |
718e3744 | 1966 | { |
1967 | int ret; | |
1968 | struct peer *peer; | |
1969 | ||
1970 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
1971 | if (! peer) | |
1972 | return CMD_WARNING; | |
1973 | ||
1974 | if (set) | |
1975 | ret = peer_flag_set (peer, flag); | |
1976 | else | |
1977 | ret = peer_flag_unset (peer, flag); | |
1978 | ||
1979 | return bgp_vty_return (vty, ret); | |
1980 | } | |
1981 | ||
94f2b392 | 1982 | static int |
fd79ac91 | 1983 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 1984 | { |
1985 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
1986 | } | |
1987 | ||
94f2b392 | 1988 | static int |
fd79ac91 | 1989 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 1990 | { |
1991 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
1992 | } | |
1993 | ||
1994 | /* neighbor passive. */ | |
1995 | DEFUN (neighbor_passive, | |
1996 | neighbor_passive_cmd, | |
1997 | NEIGHBOR_CMD2 "passive", | |
1998 | NEIGHBOR_STR | |
1999 | NEIGHBOR_ADDR_STR2 | |
2000 | "Don't send open messages to this neighbor\n") | |
2001 | { | |
2002 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
2003 | } | |
2004 | ||
2005 | DEFUN (no_neighbor_passive, | |
2006 | no_neighbor_passive_cmd, | |
2007 | NO_NEIGHBOR_CMD2 "passive", | |
2008 | NO_STR | |
2009 | NEIGHBOR_STR | |
2010 | NEIGHBOR_ADDR_STR2 | |
2011 | "Don't send open messages to this neighbor\n") | |
2012 | { | |
2013 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
2014 | } | |
6b0655a2 | 2015 | |
718e3744 | 2016 | /* neighbor shutdown. */ |
2017 | DEFUN (neighbor_shutdown, | |
2018 | neighbor_shutdown_cmd, | |
2019 | NEIGHBOR_CMD2 "shutdown", | |
2020 | NEIGHBOR_STR | |
2021 | NEIGHBOR_ADDR_STR2 | |
2022 | "Administratively shut down this neighbor\n") | |
2023 | { | |
2024 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
2025 | } | |
2026 | ||
2027 | DEFUN (no_neighbor_shutdown, | |
2028 | no_neighbor_shutdown_cmd, | |
2029 | NO_NEIGHBOR_CMD2 "shutdown", | |
2030 | NO_STR | |
2031 | NEIGHBOR_STR | |
2032 | NEIGHBOR_ADDR_STR2 | |
2033 | "Administratively shut down this neighbor\n") | |
2034 | { | |
2035 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
2036 | } | |
6b0655a2 | 2037 | |
c9502438 | 2038 | /* Deprecated neighbor capability route-refresh. */ |
2039 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, | |
2040 | neighbor_capability_route_refresh_cmd, | |
2041 | NEIGHBOR_CMD2 "capability route-refresh", | |
2042 | NEIGHBOR_STR | |
2043 | NEIGHBOR_ADDR_STR2 | |
2044 | "Advertise capability to the peer\n" | |
2045 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 2046 | { |
c9502438 | 2047 | return CMD_SUCCESS; |
718e3744 | 2048 | } |
2049 | ||
c9502438 | 2050 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
2051 | no_neighbor_capability_route_refresh_cmd, | |
2052 | NO_NEIGHBOR_CMD2 "capability route-refresh", | |
2053 | NO_STR | |
2054 | NEIGHBOR_STR | |
2055 | NEIGHBOR_ADDR_STR2 | |
2056 | "Advertise capability to the peer\n" | |
2057 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 2058 | { |
c9502438 | 2059 | return CMD_SUCCESS; |
718e3744 | 2060 | } |
6b0655a2 | 2061 | |
718e3744 | 2062 | /* neighbor capability dynamic. */ |
2063 | DEFUN (neighbor_capability_dynamic, | |
2064 | neighbor_capability_dynamic_cmd, | |
2065 | NEIGHBOR_CMD2 "capability dynamic", | |
2066 | NEIGHBOR_STR | |
2067 | NEIGHBOR_ADDR_STR2 | |
2068 | "Advertise capability to the peer\n" | |
2069 | "Advertise dynamic capability to this neighbor\n") | |
2070 | { | |
2071 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
2072 | } | |
2073 | ||
2074 | DEFUN (no_neighbor_capability_dynamic, | |
2075 | no_neighbor_capability_dynamic_cmd, | |
2076 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
2077 | NO_STR | |
2078 | NEIGHBOR_STR | |
2079 | NEIGHBOR_ADDR_STR2 | |
2080 | "Advertise capability to the peer\n" | |
2081 | "Advertise dynamic capability to this neighbor\n") | |
2082 | { | |
2083 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
2084 | } | |
6b0655a2 | 2085 | |
718e3744 | 2086 | /* neighbor dont-capability-negotiate */ |
2087 | DEFUN (neighbor_dont_capability_negotiate, | |
2088 | neighbor_dont_capability_negotiate_cmd, | |
2089 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
2090 | NEIGHBOR_STR | |
2091 | NEIGHBOR_ADDR_STR2 | |
2092 | "Do not perform capability negotiation\n") | |
2093 | { | |
2094 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
2095 | } | |
2096 | ||
2097 | DEFUN (no_neighbor_dont_capability_negotiate, | |
2098 | no_neighbor_dont_capability_negotiate_cmd, | |
2099 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
2100 | NO_STR | |
2101 | NEIGHBOR_STR | |
2102 | NEIGHBOR_ADDR_STR2 | |
2103 | "Do not perform capability negotiation\n") | |
2104 | { | |
2105 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
2106 | } | |
6b0655a2 | 2107 | |
94f2b392 | 2108 | static int |
fd79ac91 | 2109 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 2110 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 2111 | { |
2112 | int ret; | |
2113 | struct peer *peer; | |
2114 | ||
2115 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2116 | if (! peer) | |
2117 | return CMD_WARNING; | |
2118 | ||
2119 | if (set) | |
2120 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
2121 | else | |
2122 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
2123 | ||
2124 | return bgp_vty_return (vty, ret); | |
2125 | } | |
2126 | ||
94f2b392 | 2127 | static int |
fd79ac91 | 2128 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 2129 | safi_t safi, u_int32_t flag) |
718e3744 | 2130 | { |
2131 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
2132 | } | |
2133 | ||
94f2b392 | 2134 | static int |
fd79ac91 | 2135 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 2136 | safi_t safi, u_int32_t flag) |
718e3744 | 2137 | { |
2138 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
2139 | } | |
6b0655a2 | 2140 | |
718e3744 | 2141 | /* neighbor capability orf prefix-list. */ |
2142 | DEFUN (neighbor_capability_orf_prefix, | |
2143 | neighbor_capability_orf_prefix_cmd, | |
2144 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
2145 | NEIGHBOR_STR | |
2146 | NEIGHBOR_ADDR_STR2 | |
2147 | "Advertise capability to the peer\n" | |
2148 | "Advertise ORF capability to the peer\n" | |
2149 | "Advertise prefixlist ORF capability to this neighbor\n" | |
2150 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
2151 | "Capability to RECEIVE the ORF from this neighbor\n" | |
2152 | "Capability to SEND the ORF to this neighbor\n") | |
2153 | { | |
2154 | u_int16_t flag = 0; | |
2155 | ||
2156 | if (strncmp (argv[1], "s", 1) == 0) | |
2157 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
2158 | else if (strncmp (argv[1], "r", 1) == 0) | |
2159 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
2160 | else if (strncmp (argv[1], "b", 1) == 0) | |
2161 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
2162 | else | |
2163 | return CMD_WARNING; | |
2164 | ||
2165 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2166 | bgp_node_safi (vty), flag); | |
2167 | } | |
2168 | ||
2169 | DEFUN (no_neighbor_capability_orf_prefix, | |
2170 | no_neighbor_capability_orf_prefix_cmd, | |
2171 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
2172 | NO_STR | |
2173 | NEIGHBOR_STR | |
2174 | NEIGHBOR_ADDR_STR2 | |
2175 | "Advertise capability to the peer\n" | |
2176 | "Advertise ORF capability to the peer\n" | |
2177 | "Advertise prefixlist ORF capability to this neighbor\n" | |
2178 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
2179 | "Capability to RECEIVE the ORF from this neighbor\n" | |
2180 | "Capability to SEND the ORF to this neighbor\n") | |
2181 | { | |
2182 | u_int16_t flag = 0; | |
2183 | ||
2184 | if (strncmp (argv[1], "s", 1) == 0) | |
2185 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
2186 | else if (strncmp (argv[1], "r", 1) == 0) | |
2187 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
2188 | else if (strncmp (argv[1], "b", 1) == 0) | |
2189 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
2190 | else | |
2191 | return CMD_WARNING; | |
2192 | ||
2193 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2194 | bgp_node_safi (vty), flag); | |
2195 | } | |
6b0655a2 | 2196 | |
718e3744 | 2197 | /* neighbor next-hop-self. */ |
2198 | DEFUN (neighbor_nexthop_self, | |
2199 | neighbor_nexthop_self_cmd, | |
9e7a53c1 | 2200 | NEIGHBOR_CMD2 "next-hop-self {all}", |
718e3744 | 2201 | NEIGHBOR_STR |
2202 | NEIGHBOR_ADDR_STR2 | |
9e7a53c1 TT |
2203 | "Disable the next hop calculation for this neighbor\n" |
2204 | "Apply also to ibgp-learned routes when acting as a route reflector\n") | |
718e3744 | 2205 | { |
9e7a53c1 TT |
2206 | u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0; |
2207 | int rc; | |
2208 | ||
2209 | /* Check if "all" is specified */ | |
2210 | if (argv[1] != NULL) | |
2211 | flags |= PEER_FLAG_NEXTHOP_SELF_ALL; | |
2212 | else | |
2213 | unset |= PEER_FLAG_NEXTHOP_SELF_ALL; | |
2214 | ||
2215 | rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2216 | bgp_node_safi (vty), flags); | |
2217 | if ( rc == CMD_SUCCESS && unset ) | |
2218 | rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2219 | bgp_node_safi (vty), unset); | |
2220 | return rc; | |
718e3744 | 2221 | } |
2222 | ||
2223 | DEFUN (no_neighbor_nexthop_self, | |
2224 | no_neighbor_nexthop_self_cmd, | |
9e7a53c1 | 2225 | NO_NEIGHBOR_CMD2 "next-hop-self {all}", |
718e3744 | 2226 | NO_STR |
2227 | NEIGHBOR_STR | |
2228 | NEIGHBOR_ADDR_STR2 | |
9e7a53c1 TT |
2229 | "Disable the next hop calculation for this neighbor\n" |
2230 | "Apply also to ibgp-learned routes when acting as a route reflector\n") | |
718e3744 | 2231 | { |
2232 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
9e7a53c1 TT |
2233 | bgp_node_safi (vty), |
2234 | PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL); | |
718e3744 | 2235 | } |
6b0655a2 | 2236 | |
718e3744 | 2237 | /* neighbor remove-private-AS. */ |
2238 | DEFUN (neighbor_remove_private_as, | |
2239 | neighbor_remove_private_as_cmd, | |
2240 | NEIGHBOR_CMD2 "remove-private-AS", | |
2241 | NEIGHBOR_STR | |
2242 | NEIGHBOR_ADDR_STR2 | |
2243 | "Remove private AS number from outbound updates\n") | |
2244 | { | |
2245 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2246 | bgp_node_safi (vty), | |
2247 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
2248 | } | |
2249 | ||
2250 | DEFUN (no_neighbor_remove_private_as, | |
2251 | no_neighbor_remove_private_as_cmd, | |
2252 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
2253 | NO_STR | |
2254 | NEIGHBOR_STR | |
2255 | NEIGHBOR_ADDR_STR2 | |
2256 | "Remove private AS number from outbound updates\n") | |
2257 | { | |
2258 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2259 | bgp_node_safi (vty), | |
2260 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
2261 | } | |
6b0655a2 | 2262 | |
718e3744 | 2263 | /* neighbor send-community. */ |
2264 | DEFUN (neighbor_send_community, | |
2265 | neighbor_send_community_cmd, | |
2266 | NEIGHBOR_CMD2 "send-community", | |
2267 | NEIGHBOR_STR | |
2268 | NEIGHBOR_ADDR_STR2 | |
2269 | "Send Community attribute to this neighbor\n") | |
2270 | { | |
2271 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2272 | bgp_node_safi (vty), | |
2273 | PEER_FLAG_SEND_COMMUNITY); | |
2274 | } | |
2275 | ||
2276 | DEFUN (no_neighbor_send_community, | |
2277 | no_neighbor_send_community_cmd, | |
2278 | NO_NEIGHBOR_CMD2 "send-community", | |
2279 | NO_STR | |
2280 | NEIGHBOR_STR | |
2281 | NEIGHBOR_ADDR_STR2 | |
2282 | "Send Community attribute to this neighbor\n") | |
2283 | { | |
2284 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2285 | bgp_node_safi (vty), | |
2286 | PEER_FLAG_SEND_COMMUNITY); | |
2287 | } | |
6b0655a2 | 2288 | |
718e3744 | 2289 | /* neighbor send-community extended. */ |
2290 | DEFUN (neighbor_send_community_type, | |
2291 | neighbor_send_community_type_cmd, | |
2292 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
2293 | NEIGHBOR_STR | |
2294 | NEIGHBOR_ADDR_STR2 | |
2295 | "Send Community attribute to this neighbor\n" | |
2296 | "Send Standard and Extended Community attributes\n" | |
2297 | "Send Extended Community attributes\n" | |
2298 | "Send Standard Community attributes\n") | |
2299 | { | |
2300 | if (strncmp (argv[1], "s", 1) == 0) | |
2301 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2302 | bgp_node_safi (vty), | |
2303 | PEER_FLAG_SEND_COMMUNITY); | |
2304 | if (strncmp (argv[1], "e", 1) == 0) | |
2305 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2306 | bgp_node_safi (vty), | |
2307 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
2308 | ||
2309 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2310 | bgp_node_safi (vty), | |
2311 | (PEER_FLAG_SEND_COMMUNITY| | |
2312 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
2313 | } | |
2314 | ||
2315 | DEFUN (no_neighbor_send_community_type, | |
2316 | no_neighbor_send_community_type_cmd, | |
2317 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
2318 | NO_STR | |
2319 | NEIGHBOR_STR | |
2320 | NEIGHBOR_ADDR_STR2 | |
2321 | "Send Community attribute to this neighbor\n" | |
2322 | "Send Standard and Extended Community attributes\n" | |
2323 | "Send Extended Community attributes\n" | |
2324 | "Send Standard Community attributes\n") | |
2325 | { | |
2326 | if (strncmp (argv[1], "s", 1) == 0) | |
2327 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2328 | bgp_node_safi (vty), | |
2329 | PEER_FLAG_SEND_COMMUNITY); | |
2330 | if (strncmp (argv[1], "e", 1) == 0) | |
2331 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2332 | bgp_node_safi (vty), | |
2333 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
2334 | ||
2335 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2336 | bgp_node_safi (vty), | |
2337 | (PEER_FLAG_SEND_COMMUNITY | | |
2338 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
2339 | } | |
6b0655a2 | 2340 | |
718e3744 | 2341 | /* neighbor soft-reconfig. */ |
2342 | DEFUN (neighbor_soft_reconfiguration, | |
2343 | neighbor_soft_reconfiguration_cmd, | |
2344 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
2345 | NEIGHBOR_STR | |
2346 | NEIGHBOR_ADDR_STR2 | |
2347 | "Per neighbor soft reconfiguration\n" | |
2348 | "Allow inbound soft reconfiguration for this neighbor\n") | |
2349 | { | |
2350 | return peer_af_flag_set_vty (vty, argv[0], | |
2351 | bgp_node_afi (vty), bgp_node_safi (vty), | |
2352 | PEER_FLAG_SOFT_RECONFIG); | |
2353 | } | |
2354 | ||
2355 | DEFUN (no_neighbor_soft_reconfiguration, | |
2356 | no_neighbor_soft_reconfiguration_cmd, | |
2357 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
2358 | NO_STR | |
2359 | NEIGHBOR_STR | |
2360 | NEIGHBOR_ADDR_STR2 | |
2361 | "Per neighbor soft reconfiguration\n" | |
2362 | "Allow inbound soft reconfiguration for this neighbor\n") | |
2363 | { | |
2364 | return peer_af_flag_unset_vty (vty, argv[0], | |
2365 | bgp_node_afi (vty), bgp_node_safi (vty), | |
2366 | PEER_FLAG_SOFT_RECONFIG); | |
2367 | } | |
6b0655a2 | 2368 | |
718e3744 | 2369 | DEFUN (neighbor_route_reflector_client, |
2370 | neighbor_route_reflector_client_cmd, | |
2371 | NEIGHBOR_CMD2 "route-reflector-client", | |
2372 | NEIGHBOR_STR | |
2373 | NEIGHBOR_ADDR_STR2 | |
2374 | "Configure a neighbor as Route Reflector client\n") | |
2375 | { | |
2376 | struct peer *peer; | |
2377 | ||
2378 | ||
2379 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2380 | if (! peer) | |
2381 | return CMD_WARNING; | |
2382 | ||
2383 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2384 | bgp_node_safi (vty), | |
2385 | PEER_FLAG_REFLECTOR_CLIENT); | |
2386 | } | |
2387 | ||
2388 | DEFUN (no_neighbor_route_reflector_client, | |
2389 | no_neighbor_route_reflector_client_cmd, | |
2390 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
2391 | NO_STR | |
2392 | NEIGHBOR_STR | |
2393 | NEIGHBOR_ADDR_STR2 | |
2394 | "Configure a neighbor as Route Reflector client\n") | |
2395 | { | |
2396 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2397 | bgp_node_safi (vty), | |
2398 | PEER_FLAG_REFLECTOR_CLIENT); | |
2399 | } | |
6b0655a2 | 2400 | |
94f2b392 | 2401 | static int |
fd79ac91 | 2402 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
2403 | int afi, int safi) | |
fee0f4c6 | 2404 | { |
2405 | int ret; | |
2406 | struct bgp *bgp; | |
2407 | struct peer *peer; | |
2408 | struct peer_group *group; | |
1eb8ef25 | 2409 | struct listnode *node, *nnode; |
fee0f4c6 | 2410 | struct bgp_filter *pfilter; |
2411 | struct bgp_filter *gfilter; | |
228da428 | 2412 | int locked_and_added = 0; |
fee0f4c6 | 2413 | |
2414 | bgp = vty->index; | |
2415 | ||
2416 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2417 | if ( ! peer ) | |
2418 | return CMD_WARNING; | |
2419 | ||
2420 | /* If it is already a RS-Client, don't do anything. */ | |
2421 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
2422 | return CMD_SUCCESS; | |
2423 | ||
2424 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 2425 | { |
2426 | peer = peer_lock (peer); /* rsclient peer list reference */ | |
2427 | listnode_add_sort (bgp->rsclient, peer); | |
228da428 | 2428 | locked_and_added = 1; |
200df115 | 2429 | } |
fee0f4c6 | 2430 | |
2431 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2432 | if (ret < 0) | |
228da428 CC |
2433 | { |
2434 | if (locked_and_added) | |
2435 | { | |
2436 | listnode_delete (bgp->rsclient, peer); | |
2437 | peer_unlock (peer); /* rsclient peer list reference */ | |
2438 | } | |
2439 | ||
2440 | return bgp_vty_return (vty, ret); | |
2441 | } | |
fee0f4c6 | 2442 | |
64e580a7 | 2443 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
fee0f4c6 | 2444 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
228da428 CC |
2445 | /* RIB peer reference. Released when table is free'd in bgp_table_free. */ |
2446 | peer->rib[afi][safi]->owner = peer_lock (peer); | |
fee0f4c6 | 2447 | |
2448 | /* Check for existing 'network' and 'redistribute' routes. */ | |
2449 | bgp_check_local_routes_rsclient (peer, afi, safi); | |
2450 | ||
2451 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ | |
2452 | bgp_soft_reconfig_rsclient (peer, afi, safi); | |
2453 | ||
2454 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
2455 | { | |
2456 | group = peer->group; | |
2457 | gfilter = &peer->filter[afi][safi]; | |
2458 | ||
1eb8ef25 | 2459 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 2460 | { |
2461 | pfilter = &peer->filter[afi][safi]; | |
2462 | ||
2463 | /* Members of a non-RS-Client group should not be RS-Clients, as that | |
2464 | is checked when the become part of the peer-group */ | |
2465 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2466 | if (ret < 0) | |
2467 | return bgp_vty_return (vty, ret); | |
2468 | ||
2469 | /* Make peer's RIB point to group's RIB. */ | |
2470 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; | |
2471 | ||
2472 | /* Import policy. */ | |
2473 | if (pfilter->map[RMAP_IMPORT].name) | |
2474 | free (pfilter->map[RMAP_IMPORT].name); | |
2475 | if (gfilter->map[RMAP_IMPORT].name) | |
2476 | { | |
2477 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); | |
2478 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; | |
2479 | } | |
2480 | else | |
2481 | { | |
2482 | pfilter->map[RMAP_IMPORT].name = NULL; | |
2483 | pfilter->map[RMAP_IMPORT].map =NULL; | |
2484 | } | |
2485 | ||
2486 | /* Export policy. */ | |
2487 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) | |
2488 | { | |
2489 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); | |
2490 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; | |
2491 | } | |
2492 | } | |
2493 | } | |
2494 | return CMD_SUCCESS; | |
2495 | } | |
2496 | ||
94f2b392 | 2497 | static int |
fd79ac91 | 2498 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
2499 | int afi, int safi) | |
fee0f4c6 | 2500 | { |
2501 | int ret; | |
2502 | struct bgp *bgp; | |
2503 | struct peer *peer; | |
2504 | struct peer_group *group; | |
1eb8ef25 | 2505 | struct listnode *node, *nnode; |
fee0f4c6 | 2506 | |
2507 | bgp = vty->index; | |
2508 | ||
2509 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2510 | if ( ! peer ) | |
2511 | return CMD_WARNING; | |
2512 | ||
2513 | /* If it is not a RS-Client, don't do anything. */ | |
2514 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
2515 | return CMD_SUCCESS; | |
2516 | ||
2517 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
2518 | { | |
2519 | group = peer->group; | |
2520 | ||
1eb8ef25 | 2521 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 2522 | { |
2523 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2524 | if (ret < 0) | |
2525 | return bgp_vty_return (vty, ret); | |
2526 | ||
2527 | peer->rib[afi][safi] = NULL; | |
2528 | } | |
2529 | ||
2530 | peer = group->conf; | |
2531 | } | |
2532 | ||
2533 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2534 | if (ret < 0) | |
2535 | return bgp_vty_return (vty, ret); | |
2536 | ||
2537 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 2538 | { |
228da428 | 2539 | bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); |
200df115 | 2540 | listnode_delete (bgp->rsclient, peer); |
228da428 | 2541 | peer_unlock (peer); /* peer bgp rsclient reference */ |
200df115 | 2542 | } |
fee0f4c6 | 2543 | |
b608d5b5 | 2544 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
fee0f4c6 | 2545 | |
2546 | return CMD_SUCCESS; | |
2547 | } | |
6b0655a2 | 2548 | |
718e3744 | 2549 | /* neighbor route-server-client. */ |
2550 | DEFUN (neighbor_route_server_client, | |
2551 | neighbor_route_server_client_cmd, | |
2552 | NEIGHBOR_CMD2 "route-server-client", | |
2553 | NEIGHBOR_STR | |
2554 | NEIGHBOR_ADDR_STR2 | |
2555 | "Configure a neighbor as Route Server client\n") | |
2556 | { | |
fee0f4c6 | 2557 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
2558 | bgp_node_safi(vty)); | |
718e3744 | 2559 | } |
2560 | ||
2561 | DEFUN (no_neighbor_route_server_client, | |
2562 | no_neighbor_route_server_client_cmd, | |
2563 | NO_NEIGHBOR_CMD2 "route-server-client", | |
2564 | NO_STR | |
2565 | NEIGHBOR_STR | |
2566 | NEIGHBOR_ADDR_STR2 | |
2567 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 2568 | { |
2569 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), | |
2570 | bgp_node_safi(vty)); | |
2571 | } | |
6b0655a2 | 2572 | |
fee0f4c6 | 2573 | DEFUN (neighbor_nexthop_local_unchanged, |
2574 | neighbor_nexthop_local_unchanged_cmd, | |
2575 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
2576 | NEIGHBOR_STR | |
2577 | NEIGHBOR_ADDR_STR2 | |
2578 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
2579 | "Leave link-local nexthop unchanged for this peer\n") | |
2580 | { | |
2581 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2582 | bgp_node_safi (vty), | |
2583 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
2584 | } | |
6b0655a2 | 2585 | |
fee0f4c6 | 2586 | DEFUN (no_neighbor_nexthop_local_unchanged, |
2587 | no_neighbor_nexthop_local_unchanged_cmd, | |
2588 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
2589 | NO_STR | |
2590 | NEIGHBOR_STR | |
2591 | NEIGHBOR_ADDR_STR2 | |
2592 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
2593 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 2594 | { |
2595 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2596 | bgp_node_safi (vty), | |
fee0f4c6 | 2597 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 2598 | } |
6b0655a2 | 2599 | |
718e3744 | 2600 | DEFUN (neighbor_attr_unchanged, |
2601 | neighbor_attr_unchanged_cmd, | |
2602 | NEIGHBOR_CMD2 "attribute-unchanged", | |
2603 | NEIGHBOR_STR | |
2604 | NEIGHBOR_ADDR_STR2 | |
2605 | "BGP attribute is propagated unchanged to this neighbor\n") | |
2606 | { | |
2607 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2608 | bgp_node_safi (vty), | |
2609 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
2610 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
2611 | PEER_FLAG_MED_UNCHANGED)); | |
2612 | } | |
2613 | ||
2614 | DEFUN (neighbor_attr_unchanged1, | |
2615 | neighbor_attr_unchanged1_cmd, | |
2616 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
2617 | NEIGHBOR_STR | |
2618 | NEIGHBOR_ADDR_STR2 | |
2619 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2620 | "As-path attribute\n" | |
2621 | "Nexthop attribute\n" | |
2622 | "Med attribute\n") | |
2623 | { | |
2624 | u_int16_t flags = 0; | |
2625 | ||
2626 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2627 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2628 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2629 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2630 | else if (strncmp (argv[1], "med", 1) == 0) | |
2631 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2632 | ||
2633 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2634 | bgp_node_safi (vty), flags); | |
2635 | } | |
2636 | ||
2637 | DEFUN (neighbor_attr_unchanged2, | |
2638 | neighbor_attr_unchanged2_cmd, | |
2639 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
2640 | NEIGHBOR_STR | |
2641 | NEIGHBOR_ADDR_STR2 | |
2642 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2643 | "As-path attribute\n" | |
2644 | "Nexthop attribute\n" | |
2645 | "Med attribute\n") | |
2646 | { | |
2647 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
2648 | ||
2649 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
2650 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2651 | else if (strncmp (argv[1], "med", 1) == 0) | |
2652 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2653 | ||
2654 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2655 | bgp_node_safi (vty), flags); | |
2656 | ||
2657 | } | |
2658 | ||
2659 | DEFUN (neighbor_attr_unchanged3, | |
2660 | neighbor_attr_unchanged3_cmd, | |
2661 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
2662 | NEIGHBOR_STR | |
2663 | NEIGHBOR_ADDR_STR2 | |
2664 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2665 | "Nexthop attribute\n" | |
2666 | "As-path attribute\n" | |
2667 | "Med attribute\n") | |
2668 | { | |
2669 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
2670 | ||
2671 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2672 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2673 | else if (strncmp (argv[1], "med", 1) == 0) | |
2674 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2675 | ||
2676 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2677 | bgp_node_safi (vty), flags); | |
2678 | } | |
2679 | ||
2680 | DEFUN (neighbor_attr_unchanged4, | |
2681 | neighbor_attr_unchanged4_cmd, | |
2682 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
2683 | NEIGHBOR_STR | |
2684 | NEIGHBOR_ADDR_STR2 | |
2685 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2686 | "Med attribute\n" | |
2687 | "As-path attribute\n" | |
2688 | "Nexthop attribute\n") | |
2689 | { | |
2690 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
2691 | ||
2692 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2693 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2694 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2695 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2696 | ||
2697 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2698 | bgp_node_safi (vty), flags); | |
2699 | } | |
2700 | ||
2701 | ALIAS (neighbor_attr_unchanged, | |
2702 | neighbor_attr_unchanged5_cmd, | |
2703 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
2704 | NEIGHBOR_STR | |
2705 | NEIGHBOR_ADDR_STR2 | |
2706 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2707 | "As-path attribute\n" | |
2708 | "Nexthop attribute\n" | |
2709 | "Med attribute\n") | |
2710 | ||
2711 | ALIAS (neighbor_attr_unchanged, | |
2712 | neighbor_attr_unchanged6_cmd, | |
2713 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
2714 | NEIGHBOR_STR | |
2715 | NEIGHBOR_ADDR_STR2 | |
2716 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2717 | "As-path attribute\n" | |
2718 | "Med attribute\n" | |
2719 | "Nexthop attribute\n") | |
2720 | ||
2721 | ALIAS (neighbor_attr_unchanged, | |
2722 | neighbor_attr_unchanged7_cmd, | |
2723 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
2724 | NEIGHBOR_STR | |
2725 | NEIGHBOR_ADDR_STR2 | |
2726 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2727 | "Nexthop attribute\n" | |
2728 | "Med attribute\n" | |
2729 | "As-path attribute\n") | |
2730 | ||
2731 | ALIAS (neighbor_attr_unchanged, | |
2732 | neighbor_attr_unchanged8_cmd, | |
2733 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
2734 | NEIGHBOR_STR | |
2735 | NEIGHBOR_ADDR_STR2 | |
2736 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2737 | "Nexthop attribute\n" | |
2738 | "As-path attribute\n" | |
2739 | "Med attribute\n") | |
2740 | ||
2741 | ALIAS (neighbor_attr_unchanged, | |
2742 | neighbor_attr_unchanged9_cmd, | |
2743 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
2744 | NEIGHBOR_STR | |
2745 | NEIGHBOR_ADDR_STR2 | |
2746 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2747 | "Med attribute\n" | |
2748 | "Nexthop attribute\n" | |
2749 | "As-path attribute\n") | |
2750 | ||
2751 | ALIAS (neighbor_attr_unchanged, | |
2752 | neighbor_attr_unchanged10_cmd, | |
2753 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
2754 | NEIGHBOR_STR | |
2755 | NEIGHBOR_ADDR_STR2 | |
2756 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2757 | "Med attribute\n" | |
2758 | "As-path attribute\n" | |
2759 | "Nexthop attribute\n") | |
2760 | ||
2761 | DEFUN (no_neighbor_attr_unchanged, | |
2762 | no_neighbor_attr_unchanged_cmd, | |
2763 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
2764 | NO_STR | |
2765 | NEIGHBOR_STR | |
2766 | NEIGHBOR_ADDR_STR2 | |
2767 | "BGP attribute is propagated unchanged to this neighbor\n") | |
2768 | { | |
2769 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2770 | bgp_node_safi (vty), | |
2771 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
2772 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
2773 | PEER_FLAG_MED_UNCHANGED)); | |
2774 | } | |
2775 | ||
2776 | DEFUN (no_neighbor_attr_unchanged1, | |
2777 | no_neighbor_attr_unchanged1_cmd, | |
2778 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
2779 | NO_STR | |
2780 | NEIGHBOR_STR | |
2781 | NEIGHBOR_ADDR_STR2 | |
2782 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2783 | "As-path attribute\n" | |
2784 | "Nexthop attribute\n" | |
2785 | "Med attribute\n") | |
2786 | { | |
2787 | u_int16_t flags = 0; | |
2788 | ||
2789 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2790 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2791 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2792 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2793 | else if (strncmp (argv[1], "med", 1) == 0) | |
2794 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2795 | ||
2796 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2797 | bgp_node_safi (vty), flags); | |
2798 | } | |
2799 | ||
2800 | DEFUN (no_neighbor_attr_unchanged2, | |
2801 | no_neighbor_attr_unchanged2_cmd, | |
2802 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
2803 | NO_STR | |
2804 | NEIGHBOR_STR | |
2805 | NEIGHBOR_ADDR_STR2 | |
2806 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2807 | "As-path attribute\n" | |
2808 | "Nexthop attribute\n" | |
2809 | "Med attribute\n") | |
2810 | { | |
2811 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
2812 | ||
2813 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
2814 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2815 | else if (strncmp (argv[1], "med", 1) == 0) | |
2816 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2817 | ||
2818 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2819 | bgp_node_safi (vty), flags); | |
2820 | } | |
2821 | ||
2822 | DEFUN (no_neighbor_attr_unchanged3, | |
2823 | no_neighbor_attr_unchanged3_cmd, | |
2824 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
2825 | NO_STR | |
2826 | NEIGHBOR_STR | |
2827 | NEIGHBOR_ADDR_STR2 | |
2828 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2829 | "Nexthop attribute\n" | |
2830 | "As-path attribute\n" | |
2831 | "Med attribute\n") | |
2832 | { | |
2833 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
2834 | ||
2835 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2836 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2837 | else if (strncmp (argv[1], "med", 1) == 0) | |
2838 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2839 | ||
2840 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2841 | bgp_node_safi (vty), flags); | |
2842 | } | |
2843 | ||
2844 | DEFUN (no_neighbor_attr_unchanged4, | |
2845 | no_neighbor_attr_unchanged4_cmd, | |
2846 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
2847 | NO_STR | |
2848 | NEIGHBOR_STR | |
2849 | NEIGHBOR_ADDR_STR2 | |
2850 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2851 | "Med attribute\n" | |
2852 | "As-path attribute\n" | |
2853 | "Nexthop attribute\n") | |
2854 | { | |
2855 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
2856 | ||
2857 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2858 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2859 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2860 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2861 | ||
2862 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2863 | bgp_node_safi (vty), flags); | |
2864 | } | |
2865 | ||
2866 | ALIAS (no_neighbor_attr_unchanged, | |
2867 | no_neighbor_attr_unchanged5_cmd, | |
2868 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
2869 | NO_STR | |
2870 | NEIGHBOR_STR | |
2871 | NEIGHBOR_ADDR_STR2 | |
2872 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2873 | "As-path attribute\n" | |
2874 | "Nexthop attribute\n" | |
2875 | "Med attribute\n") | |
2876 | ||
2877 | ALIAS (no_neighbor_attr_unchanged, | |
2878 | no_neighbor_attr_unchanged6_cmd, | |
2879 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
2880 | NO_STR | |
2881 | NEIGHBOR_STR | |
2882 | NEIGHBOR_ADDR_STR2 | |
2883 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2884 | "As-path attribute\n" | |
2885 | "Med attribute\n" | |
2886 | "Nexthop attribute\n") | |
2887 | ||
2888 | ALIAS (no_neighbor_attr_unchanged, | |
2889 | no_neighbor_attr_unchanged7_cmd, | |
2890 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
2891 | NO_STR | |
2892 | NEIGHBOR_STR | |
2893 | NEIGHBOR_ADDR_STR2 | |
2894 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2895 | "Nexthop attribute\n" | |
2896 | "Med attribute\n" | |
2897 | "As-path attribute\n") | |
2898 | ||
2899 | ALIAS (no_neighbor_attr_unchanged, | |
2900 | no_neighbor_attr_unchanged8_cmd, | |
2901 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
2902 | NO_STR | |
2903 | NEIGHBOR_STR | |
2904 | NEIGHBOR_ADDR_STR2 | |
2905 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2906 | "Nexthop attribute\n" | |
2907 | "As-path attribute\n" | |
2908 | "Med attribute\n") | |
2909 | ||
2910 | ALIAS (no_neighbor_attr_unchanged, | |
2911 | no_neighbor_attr_unchanged9_cmd, | |
2912 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
2913 | NO_STR | |
2914 | NEIGHBOR_STR | |
2915 | NEIGHBOR_ADDR_STR2 | |
2916 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2917 | "Med attribute\n" | |
2918 | "Nexthop attribute\n" | |
2919 | "As-path attribute\n") | |
2920 | ||
2921 | ALIAS (no_neighbor_attr_unchanged, | |
2922 | no_neighbor_attr_unchanged10_cmd, | |
2923 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
2924 | NO_STR | |
2925 | NEIGHBOR_STR | |
2926 | NEIGHBOR_ADDR_STR2 | |
2927 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2928 | "Med attribute\n" | |
2929 | "As-path attribute\n" | |
2930 | "Nexthop attribute\n") | |
2931 | ||
2932 | /* For old version Zebra compatibility. */ | |
dd4c593f | 2933 | DEFUN_DEPRECATED (neighbor_transparent_as, |
2934 | neighbor_transparent_as_cmd, | |
2935 | NEIGHBOR_CMD "transparent-as", | |
2936 | NEIGHBOR_STR | |
2937 | NEIGHBOR_ADDR_STR | |
2938 | "Do not append my AS number even peer is EBGP peer\n") | |
718e3744 | 2939 | { |
2940 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2941 | bgp_node_safi (vty), | |
2942 | PEER_FLAG_AS_PATH_UNCHANGED); | |
2943 | } | |
2944 | ||
dd4c593f | 2945 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
2946 | neighbor_transparent_nexthop_cmd, | |
2947 | NEIGHBOR_CMD "transparent-nexthop", | |
2948 | NEIGHBOR_STR | |
2949 | NEIGHBOR_ADDR_STR | |
2950 | "Do not change nexthop even peer is EBGP peer\n") | |
718e3744 | 2951 | { |
2952 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2953 | bgp_node_safi (vty), | |
2954 | PEER_FLAG_NEXTHOP_UNCHANGED); | |
2955 | } | |
6b0655a2 | 2956 | |
718e3744 | 2957 | /* EBGP multihop configuration. */ |
94f2b392 | 2958 | static int |
fd79ac91 | 2959 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
2960 | const char *ttl_str) | |
718e3744 | 2961 | { |
2962 | struct peer *peer; | |
fd79ac91 | 2963 | unsigned int ttl; |
718e3744 | 2964 | |
2965 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2966 | if (! peer) | |
2967 | return CMD_WARNING; | |
2968 | ||
2969 | if (! ttl_str) | |
2970 | ttl = TTL_MAX; | |
2971 | else | |
2972 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); | |
2973 | ||
89b6d1f8 | 2974 | return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl)); |
718e3744 | 2975 | } |
2976 | ||
94f2b392 | 2977 | static int |
fd79ac91 | 2978 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 2979 | { |
2980 | struct peer *peer; | |
2981 | ||
2982 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2983 | if (! peer) | |
2984 | return CMD_WARNING; | |
2985 | ||
89b6d1f8 | 2986 | return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer)); |
718e3744 | 2987 | } |
2988 | ||
2989 | /* neighbor ebgp-multihop. */ | |
2990 | DEFUN (neighbor_ebgp_multihop, | |
2991 | neighbor_ebgp_multihop_cmd, | |
2992 | NEIGHBOR_CMD2 "ebgp-multihop", | |
2993 | NEIGHBOR_STR | |
2994 | NEIGHBOR_ADDR_STR2 | |
2995 | "Allow EBGP neighbors not on directly connected networks\n") | |
2996 | { | |
2997 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
2998 | } | |
2999 | ||
3000 | DEFUN (neighbor_ebgp_multihop_ttl, | |
3001 | neighbor_ebgp_multihop_ttl_cmd, | |
3002 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
3003 | NEIGHBOR_STR | |
3004 | NEIGHBOR_ADDR_STR2 | |
3005 | "Allow EBGP neighbors not on directly connected networks\n" | |
3006 | "maximum hop count\n") | |
3007 | { | |
3008 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
3009 | } | |
3010 | ||
3011 | DEFUN (no_neighbor_ebgp_multihop, | |
3012 | no_neighbor_ebgp_multihop_cmd, | |
3013 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
3014 | NO_STR | |
3015 | NEIGHBOR_STR | |
3016 | NEIGHBOR_ADDR_STR2 | |
3017 | "Allow EBGP neighbors not on directly connected networks\n") | |
3018 | { | |
3019 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
3020 | } | |
3021 | ||
3022 | ALIAS (no_neighbor_ebgp_multihop, | |
3023 | no_neighbor_ebgp_multihop_ttl_cmd, | |
3024 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
3025 | NO_STR | |
3026 | NEIGHBOR_STR | |
3027 | NEIGHBOR_ADDR_STR2 | |
3028 | "Allow EBGP neighbors not on directly connected networks\n" | |
3029 | "maximum hop count\n") | |
6b0655a2 | 3030 | |
6ffd2079 | 3031 | /* disable-connected-check */ |
3032 | DEFUN (neighbor_disable_connected_check, | |
3033 | neighbor_disable_connected_check_cmd, | |
3034 | NEIGHBOR_CMD2 "disable-connected-check", | |
3035 | NEIGHBOR_STR | |
3036 | NEIGHBOR_ADDR_STR2 | |
3037 | "one-hop away EBGP peer using loopback address\n") | |
3038 | { | |
3039 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
3040 | } | |
3041 | ||
3042 | DEFUN (no_neighbor_disable_connected_check, | |
3043 | no_neighbor_disable_connected_check_cmd, | |
3044 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
3045 | NO_STR | |
3046 | NEIGHBOR_STR | |
3047 | NEIGHBOR_ADDR_STR2 | |
3048 | "one-hop away EBGP peer using loopback address\n") | |
3049 | { | |
3050 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
3051 | } | |
3052 | ||
718e3744 | 3053 | /* Enforce multihop. */ |
6ffd2079 | 3054 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 3055 | neighbor_enforce_multihop_cmd, |
3056 | NEIGHBOR_CMD2 "enforce-multihop", | |
3057 | NEIGHBOR_STR | |
3058 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 3059 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 3060 | |
6ffd2079 | 3061 | /* Enforce multihop. */ |
3062 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 3063 | no_neighbor_enforce_multihop_cmd, |
3064 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
3065 | NO_STR | |
3066 | NEIGHBOR_STR | |
3067 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 3068 | "Enforce EBGP neighbors perform multihop\n") |
6b0655a2 | 3069 | |
718e3744 | 3070 | DEFUN (neighbor_description, |
3071 | neighbor_description_cmd, | |
3072 | NEIGHBOR_CMD2 "description .LINE", | |
3073 | NEIGHBOR_STR | |
3074 | NEIGHBOR_ADDR_STR2 | |
3075 | "Neighbor specific description\n" | |
3076 | "Up to 80 characters describing this neighbor\n") | |
3077 | { | |
3078 | struct peer *peer; | |
718e3744 | 3079 | char *str; |
718e3744 | 3080 | |
3081 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3082 | if (! peer) | |
3083 | return CMD_WARNING; | |
3084 | ||
3085 | if (argc == 1) | |
3086 | return CMD_SUCCESS; | |
3087 | ||
3b8b1855 | 3088 | str = argv_concat(argv, argc, 1); |
718e3744 | 3089 | |
3090 | peer_description_set (peer, str); | |
3091 | ||
3b8b1855 | 3092 | XFREE (MTYPE_TMP, str); |
718e3744 | 3093 | |
3094 | return CMD_SUCCESS; | |
3095 | } | |
3096 | ||
3097 | DEFUN (no_neighbor_description, | |
3098 | no_neighbor_description_cmd, | |
3099 | NO_NEIGHBOR_CMD2 "description", | |
3100 | NO_STR | |
3101 | NEIGHBOR_STR | |
3102 | NEIGHBOR_ADDR_STR2 | |
3103 | "Neighbor specific description\n") | |
3104 | { | |
3105 | struct peer *peer; | |
3106 | ||
3107 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3108 | if (! peer) | |
3109 | return CMD_WARNING; | |
3110 | ||
3111 | peer_description_unset (peer); | |
3112 | ||
3113 | return CMD_SUCCESS; | |
3114 | } | |
3115 | ||
3116 | ALIAS (no_neighbor_description, | |
3117 | no_neighbor_description_val_cmd, | |
3118 | NO_NEIGHBOR_CMD2 "description .LINE", | |
3119 | NO_STR | |
3120 | NEIGHBOR_STR | |
3121 | NEIGHBOR_ADDR_STR2 | |
3122 | "Neighbor specific description\n" | |
3123 | "Up to 80 characters describing this neighbor\n") | |
6b0655a2 | 3124 | |
718e3744 | 3125 | /* Neighbor update-source. */ |
94f2b392 | 3126 | static int |
fd79ac91 | 3127 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
3128 | const char *source_str) | |
718e3744 | 3129 | { |
3130 | struct peer *peer; | |
718e3744 | 3131 | |
3132 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3133 | if (! peer) | |
3134 | return CMD_WARNING; | |
3135 | ||
3136 | if (source_str) | |
3137 | { | |
c63b83fe JBD |
3138 | union sockunion su; |
3139 | int ret = str2sockunion (source_str, &su); | |
3140 | ||
3141 | if (ret == 0) | |
3142 | peer_update_source_addr_set (peer, &su); | |
718e3744 | 3143 | else |
3144 | peer_update_source_if_set (peer, source_str); | |
3145 | } | |
3146 | else | |
3147 | peer_update_source_unset (peer); | |
3148 | ||
3149 | return CMD_SUCCESS; | |
3150 | } | |
3151 | ||
9a1a331d | 3152 | #define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)" |
369688c0 PJ |
3153 | #define BGP_UPDATE_SOURCE_HELP_STR \ |
3154 | "IPv4 address\n" \ | |
9a1a331d PJ |
3155 | "IPv6 address\n" \ |
3156 | "Interface name (requires zebra to be running)\n" | |
369688c0 | 3157 | |
718e3744 | 3158 | DEFUN (neighbor_update_source, |
3159 | neighbor_update_source_cmd, | |
369688c0 | 3160 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR, |
718e3744 | 3161 | NEIGHBOR_STR |
3162 | NEIGHBOR_ADDR_STR2 | |
3163 | "Source of routing updates\n" | |
369688c0 | 3164 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 3165 | { |
3166 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
3167 | } | |
3168 | ||
3169 | DEFUN (no_neighbor_update_source, | |
3170 | no_neighbor_update_source_cmd, | |
3171 | NO_NEIGHBOR_CMD2 "update-source", | |
3172 | NO_STR | |
3173 | NEIGHBOR_STR | |
3174 | NEIGHBOR_ADDR_STR2 | |
369688c0 | 3175 | "Source of routing updates\n") |
718e3744 | 3176 | { |
3177 | return peer_update_source_vty (vty, argv[0], NULL); | |
3178 | } | |
6b0655a2 | 3179 | |
94f2b392 | 3180 | static int |
fd79ac91 | 3181 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
3182 | afi_t afi, safi_t safi, | |
3183 | const char *rmap, int set) | |
718e3744 | 3184 | { |
3185 | int ret; | |
3186 | struct peer *peer; | |
3187 | ||
3188 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
3189 | if (! peer) | |
3190 | return CMD_WARNING; | |
3191 | ||
3192 | if (set) | |
3193 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
3194 | else | |
3195 | ret = peer_default_originate_unset (peer, afi, safi); | |
3196 | ||
3197 | return bgp_vty_return (vty, ret); | |
3198 | } | |
3199 | ||
3200 | /* neighbor default-originate. */ | |
3201 | DEFUN (neighbor_default_originate, | |
3202 | neighbor_default_originate_cmd, | |
3203 | NEIGHBOR_CMD2 "default-originate", | |
3204 | NEIGHBOR_STR | |
3205 | NEIGHBOR_ADDR_STR2 | |
3206 | "Originate default route to this neighbor\n") | |
3207 | { | |
3208 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3209 | bgp_node_safi (vty), NULL, 1); | |
3210 | } | |
3211 | ||
3212 | DEFUN (neighbor_default_originate_rmap, | |
3213 | neighbor_default_originate_rmap_cmd, | |
3214 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
3215 | NEIGHBOR_STR | |
3216 | NEIGHBOR_ADDR_STR2 | |
3217 | "Originate default route to this neighbor\n" | |
3218 | "Route-map to specify criteria to originate default\n" | |
3219 | "route-map name\n") | |
3220 | { | |
3221 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3222 | bgp_node_safi (vty), argv[1], 1); | |
3223 | } | |
3224 | ||
3225 | DEFUN (no_neighbor_default_originate, | |
3226 | no_neighbor_default_originate_cmd, | |
3227 | NO_NEIGHBOR_CMD2 "default-originate", | |
3228 | NO_STR | |
3229 | NEIGHBOR_STR | |
3230 | NEIGHBOR_ADDR_STR2 | |
3231 | "Originate default route to this neighbor\n") | |
3232 | { | |
3233 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3234 | bgp_node_safi (vty), NULL, 0); | |
3235 | } | |
3236 | ||
3237 | ALIAS (no_neighbor_default_originate, | |
3238 | no_neighbor_default_originate_rmap_cmd, | |
3239 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
3240 | NO_STR | |
3241 | NEIGHBOR_STR | |
3242 | NEIGHBOR_ADDR_STR2 | |
3243 | "Originate default route to this neighbor\n" | |
3244 | "Route-map to specify criteria to originate default\n" | |
3245 | "route-map name\n") | |
6b0655a2 | 3246 | |
718e3744 | 3247 | /* Set neighbor's BGP port. */ |
94f2b392 | 3248 | static int |
fd79ac91 | 3249 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
3250 | const char *port_str) | |
718e3744 | 3251 | { |
3252 | struct peer *peer; | |
3253 | u_int16_t port; | |
3254 | struct servent *sp; | |
3255 | ||
3256 | peer = peer_lookup_vty (vty, ip_str); | |
3257 | if (! peer) | |
3258 | return CMD_WARNING; | |
3259 | ||
3260 | if (! port_str) | |
3261 | { | |
3262 | sp = getservbyname ("bgp", "tcp"); | |
3263 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
3264 | } | |
3265 | else | |
3266 | { | |
3267 | VTY_GET_INTEGER("port", port, port_str); | |
3268 | } | |
3269 | ||
3270 | peer_port_set (peer, port); | |
3271 | ||
3272 | return CMD_SUCCESS; | |
3273 | } | |
3274 | ||
f418446b | 3275 | /* Set specified peer's BGP port. */ |
718e3744 | 3276 | DEFUN (neighbor_port, |
3277 | neighbor_port_cmd, | |
3278 | NEIGHBOR_CMD "port <0-65535>", | |
3279 | NEIGHBOR_STR | |
3280 | NEIGHBOR_ADDR_STR | |
3281 | "Neighbor's BGP port\n" | |
3282 | "TCP port number\n") | |
3283 | { | |
3284 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
3285 | } | |
3286 | ||
3287 | DEFUN (no_neighbor_port, | |
3288 | no_neighbor_port_cmd, | |
3289 | NO_NEIGHBOR_CMD "port", | |
3290 | NO_STR | |
3291 | NEIGHBOR_STR | |
3292 | NEIGHBOR_ADDR_STR | |
3293 | "Neighbor's BGP port\n") | |
3294 | { | |
3295 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
3296 | } | |
3297 | ||
3298 | ALIAS (no_neighbor_port, | |
3299 | no_neighbor_port_val_cmd, | |
3300 | NO_NEIGHBOR_CMD "port <0-65535>", | |
3301 | NO_STR | |
3302 | NEIGHBOR_STR | |
3303 | NEIGHBOR_ADDR_STR | |
3304 | "Neighbor's BGP port\n" | |
3305 | "TCP port number\n") | |
6b0655a2 | 3306 | |
718e3744 | 3307 | /* neighbor weight. */ |
94f2b392 | 3308 | static int |
fd79ac91 | 3309 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
3310 | const char *weight_str) | |
718e3744 | 3311 | { |
3312 | int ret; | |
3313 | struct peer *peer; | |
3314 | unsigned long weight; | |
3315 | ||
3316 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3317 | if (! peer) | |
3318 | return CMD_WARNING; | |
3319 | ||
3320 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
3321 | ||
3322 | ret = peer_weight_set (peer, weight); | |
3323 | ||
3324 | return CMD_SUCCESS; | |
3325 | } | |
3326 | ||
94f2b392 | 3327 | static int |
fd79ac91 | 3328 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3329 | { |
3330 | struct peer *peer; | |
3331 | ||
3332 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3333 | if (! peer) | |
3334 | return CMD_WARNING; | |
3335 | ||
3336 | peer_weight_unset (peer); | |
3337 | ||
3338 | return CMD_SUCCESS; | |
3339 | } | |
3340 | ||
3341 | DEFUN (neighbor_weight, | |
3342 | neighbor_weight_cmd, | |
3343 | NEIGHBOR_CMD2 "weight <0-65535>", | |
3344 | NEIGHBOR_STR | |
3345 | NEIGHBOR_ADDR_STR2 | |
3346 | "Set default weight for routes from this neighbor\n" | |
3347 | "default weight\n") | |
3348 | { | |
3349 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
3350 | } | |
3351 | ||
3352 | DEFUN (no_neighbor_weight, | |
3353 | no_neighbor_weight_cmd, | |
3354 | NO_NEIGHBOR_CMD2 "weight", | |
3355 | NO_STR | |
3356 | NEIGHBOR_STR | |
3357 | NEIGHBOR_ADDR_STR2 | |
3358 | "Set default weight for routes from this neighbor\n") | |
3359 | { | |
3360 | return peer_weight_unset_vty (vty, argv[0]); | |
3361 | } | |
3362 | ||
3363 | ALIAS (no_neighbor_weight, | |
3364 | no_neighbor_weight_val_cmd, | |
3365 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
3366 | NO_STR | |
3367 | NEIGHBOR_STR | |
3368 | NEIGHBOR_ADDR_STR2 | |
3369 | "Set default weight for routes from this neighbor\n" | |
3370 | "default weight\n") | |
6b0655a2 | 3371 | |
718e3744 | 3372 | /* Override capability negotiation. */ |
3373 | DEFUN (neighbor_override_capability, | |
3374 | neighbor_override_capability_cmd, | |
3375 | NEIGHBOR_CMD2 "override-capability", | |
3376 | NEIGHBOR_STR | |
3377 | NEIGHBOR_ADDR_STR2 | |
3378 | "Override capability negotiation result\n") | |
3379 | { | |
3380 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
3381 | } | |
3382 | ||
3383 | DEFUN (no_neighbor_override_capability, | |
3384 | no_neighbor_override_capability_cmd, | |
3385 | NO_NEIGHBOR_CMD2 "override-capability", | |
3386 | NO_STR | |
3387 | NEIGHBOR_STR | |
3388 | NEIGHBOR_ADDR_STR2 | |
3389 | "Override capability negotiation result\n") | |
3390 | { | |
3391 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
3392 | } | |
6b0655a2 | 3393 | |
718e3744 | 3394 | DEFUN (neighbor_strict_capability, |
3395 | neighbor_strict_capability_cmd, | |
3396 | NEIGHBOR_CMD "strict-capability-match", | |
3397 | NEIGHBOR_STR | |
3398 | NEIGHBOR_ADDR_STR | |
3399 | "Strict capability negotiation match\n") | |
3400 | { | |
3401 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
3402 | } | |
3403 | ||
3404 | DEFUN (no_neighbor_strict_capability, | |
3405 | no_neighbor_strict_capability_cmd, | |
3406 | NO_NEIGHBOR_CMD "strict-capability-match", | |
3407 | NO_STR | |
3408 | NEIGHBOR_STR | |
3409 | NEIGHBOR_ADDR_STR | |
3410 | "Strict capability negotiation match\n") | |
3411 | { | |
3412 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
3413 | } | |
6b0655a2 | 3414 | |
94f2b392 | 3415 | static int |
fd79ac91 | 3416 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
3417 | const char *keep_str, const char *hold_str) | |
718e3744 | 3418 | { |
3419 | int ret; | |
3420 | struct peer *peer; | |
3421 | u_int32_t keepalive; | |
3422 | u_int32_t holdtime; | |
3423 | ||
3424 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3425 | if (! peer) | |
3426 | return CMD_WARNING; | |
3427 | ||
3428 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
3429 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
3430 | ||
3431 | ret = peer_timers_set (peer, keepalive, holdtime); | |
3432 | ||
3433 | return bgp_vty_return (vty, ret); | |
3434 | } | |
6b0655a2 | 3435 | |
94f2b392 | 3436 | static int |
fd79ac91 | 3437 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3438 | { |
3439 | int ret; | |
3440 | struct peer *peer; | |
3441 | ||
3442 | peer = peer_lookup_vty (vty, ip_str); | |
3443 | if (! peer) | |
3444 | return CMD_WARNING; | |
3445 | ||
3446 | ret = peer_timers_unset (peer); | |
3447 | ||
3448 | return bgp_vty_return (vty, ret); | |
3449 | } | |
3450 | ||
3451 | DEFUN (neighbor_timers, | |
3452 | neighbor_timers_cmd, | |
3453 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
3454 | NEIGHBOR_STR | |
3455 | NEIGHBOR_ADDR_STR2 | |
3456 | "BGP per neighbor timers\n" | |
3457 | "Keepalive interval\n" | |
3458 | "Holdtime\n") | |
3459 | { | |
3460 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
3461 | } | |
3462 | ||
3463 | DEFUN (no_neighbor_timers, | |
3464 | no_neighbor_timers_cmd, | |
3465 | NO_NEIGHBOR_CMD2 "timers", | |
3466 | NO_STR | |
3467 | NEIGHBOR_STR | |
3468 | NEIGHBOR_ADDR_STR2 | |
3469 | "BGP per neighbor timers\n") | |
3470 | { | |
3471 | return peer_timers_unset_vty (vty, argv[0]); | |
3472 | } | |
6b0655a2 | 3473 | |
94f2b392 | 3474 | static int |
fd79ac91 | 3475 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
3476 | const char *time_str) | |
718e3744 | 3477 | { |
3478 | int ret; | |
3479 | struct peer *peer; | |
3480 | u_int32_t connect; | |
3481 | ||
3482 | peer = peer_lookup_vty (vty, ip_str); | |
3483 | if (! peer) | |
3484 | return CMD_WARNING; | |
3485 | ||
3486 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
3487 | ||
3488 | ret = peer_timers_connect_set (peer, connect); | |
3489 | ||
3490 | return CMD_SUCCESS; | |
3491 | } | |
3492 | ||
94f2b392 | 3493 | static int |
fd79ac91 | 3494 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3495 | { |
3496 | int ret; | |
3497 | struct peer *peer; | |
3498 | ||
3499 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3500 | if (! peer) | |
3501 | return CMD_WARNING; | |
3502 | ||
3503 | ret = peer_timers_connect_unset (peer); | |
3504 | ||
3505 | return CMD_SUCCESS; | |
3506 | } | |
3507 | ||
3508 | DEFUN (neighbor_timers_connect, | |
3509 | neighbor_timers_connect_cmd, | |
3510 | NEIGHBOR_CMD "timers connect <0-65535>", | |
3511 | NEIGHBOR_STR | |
3512 | NEIGHBOR_ADDR_STR | |
3513 | "BGP per neighbor timers\n" | |
3514 | "BGP connect timer\n" | |
3515 | "Connect timer\n") | |
3516 | { | |
3517 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
3518 | } | |
3519 | ||
3520 | DEFUN (no_neighbor_timers_connect, | |
3521 | no_neighbor_timers_connect_cmd, | |
3522 | NO_NEIGHBOR_CMD "timers connect", | |
3523 | NO_STR | |
3524 | NEIGHBOR_STR | |
3525 | NEIGHBOR_ADDR_STR | |
3526 | "BGP per neighbor timers\n" | |
3527 | "BGP connect timer\n") | |
3528 | { | |
3529 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
3530 | } | |
3531 | ||
3532 | ALIAS (no_neighbor_timers_connect, | |
3533 | no_neighbor_timers_connect_val_cmd, | |
3534 | NO_NEIGHBOR_CMD "timers connect <0-65535>", | |
3535 | NO_STR | |
3536 | NEIGHBOR_STR | |
3537 | NEIGHBOR_ADDR_STR | |
3538 | "BGP per neighbor timers\n" | |
3539 | "BGP connect timer\n" | |
3540 | "Connect timer\n") | |
6b0655a2 | 3541 | |
94f2b392 | 3542 | static int |
fd79ac91 | 3543 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
3544 | const char *time_str, int set) | |
718e3744 | 3545 | { |
3546 | int ret; | |
3547 | struct peer *peer; | |
3548 | u_int32_t routeadv = 0; | |
3549 | ||
3550 | peer = peer_lookup_vty (vty, ip_str); | |
3551 | if (! peer) | |
3552 | return CMD_WARNING; | |
3553 | ||
3554 | if (time_str) | |
3555 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
3556 | ||
3557 | if (set) | |
3558 | ret = peer_advertise_interval_set (peer, routeadv); | |
3559 | else | |
3560 | ret = peer_advertise_interval_unset (peer); | |
3561 | ||
3562 | return CMD_SUCCESS; | |
3563 | } | |
3564 | ||
3565 | DEFUN (neighbor_advertise_interval, | |
3566 | neighbor_advertise_interval_cmd, | |
3567 | NEIGHBOR_CMD "advertisement-interval <0-600>", | |
3568 | NEIGHBOR_STR | |
3569 | NEIGHBOR_ADDR_STR | |
3570 | "Minimum interval between sending BGP routing updates\n" | |
3571 | "time in seconds\n") | |
3572 | { | |
3573 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
3574 | } | |
3575 | ||
3576 | DEFUN (no_neighbor_advertise_interval, | |
3577 | no_neighbor_advertise_interval_cmd, | |
3578 | NO_NEIGHBOR_CMD "advertisement-interval", | |
3579 | NO_STR | |
3580 | NEIGHBOR_STR | |
3581 | NEIGHBOR_ADDR_STR | |
3582 | "Minimum interval between sending BGP routing updates\n") | |
3583 | { | |
3584 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
3585 | } | |
3586 | ||
3587 | ALIAS (no_neighbor_advertise_interval, | |
3588 | no_neighbor_advertise_interval_val_cmd, | |
3589 | NO_NEIGHBOR_CMD "advertisement-interval <0-600>", | |
3590 | NO_STR | |
3591 | NEIGHBOR_STR | |
3592 | NEIGHBOR_ADDR_STR | |
3593 | "Minimum interval between sending BGP routing updates\n" | |
3594 | "time in seconds\n") | |
6b0655a2 | 3595 | |
718e3744 | 3596 | /* neighbor interface */ |
94f2b392 | 3597 | static int |
fd79ac91 | 3598 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 3599 | { |
3600 | int ret; | |
3601 | struct peer *peer; | |
3602 | ||
3603 | peer = peer_lookup_vty (vty, ip_str); | |
3604 | if (! peer) | |
3605 | return CMD_WARNING; | |
3606 | ||
3607 | if (str) | |
3608 | ret = peer_interface_set (peer, str); | |
3609 | else | |
3610 | ret = peer_interface_unset (peer); | |
3611 | ||
3612 | return CMD_SUCCESS; | |
3613 | } | |
3614 | ||
3615 | DEFUN (neighbor_interface, | |
3616 | neighbor_interface_cmd, | |
3617 | NEIGHBOR_CMD "interface WORD", | |
3618 | NEIGHBOR_STR | |
3619 | NEIGHBOR_ADDR_STR | |
3620 | "Interface\n" | |
3621 | "Interface name\n") | |
3622 | { | |
3623 | return peer_interface_vty (vty, argv[0], argv[1]); | |
3624 | } | |
3625 | ||
3626 | DEFUN (no_neighbor_interface, | |
3627 | no_neighbor_interface_cmd, | |
3628 | NO_NEIGHBOR_CMD "interface WORD", | |
3629 | NO_STR | |
3630 | NEIGHBOR_STR | |
3631 | NEIGHBOR_ADDR_STR | |
3632 | "Interface\n" | |
3633 | "Interface name\n") | |
3634 | { | |
3635 | return peer_interface_vty (vty, argv[0], NULL); | |
3636 | } | |
6b0655a2 | 3637 | |
718e3744 | 3638 | /* Set distribute list to the peer. */ |
94f2b392 | 3639 | static int |
fd79ac91 | 3640 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
3641 | afi_t afi, safi_t safi, | |
3642 | const char *name_str, const char *direct_str) | |
718e3744 | 3643 | { |
3644 | int ret; | |
3645 | struct peer *peer; | |
3646 | int direct = FILTER_IN; | |
3647 | ||
3648 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3649 | if (! peer) | |
3650 | return CMD_WARNING; | |
3651 | ||
3652 | /* Check filter direction. */ | |
3653 | if (strncmp (direct_str, "i", 1) == 0) | |
3654 | direct = FILTER_IN; | |
3655 | else if (strncmp (direct_str, "o", 1) == 0) | |
3656 | direct = FILTER_OUT; | |
3657 | ||
3658 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
3659 | ||
3660 | return bgp_vty_return (vty, ret); | |
3661 | } | |
3662 | ||
94f2b392 | 3663 | static int |
fd79ac91 | 3664 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3665 | safi_t safi, const char *direct_str) | |
718e3744 | 3666 | { |
3667 | int ret; | |
3668 | struct peer *peer; | |
3669 | int direct = FILTER_IN; | |
3670 | ||
3671 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3672 | if (! peer) | |
3673 | return CMD_WARNING; | |
3674 | ||
3675 | /* Check filter direction. */ | |
3676 | if (strncmp (direct_str, "i", 1) == 0) | |
3677 | direct = FILTER_IN; | |
3678 | else if (strncmp (direct_str, "o", 1) == 0) | |
3679 | direct = FILTER_OUT; | |
3680 | ||
3681 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
3682 | ||
3683 | return bgp_vty_return (vty, ret); | |
3684 | } | |
3685 | ||
3686 | DEFUN (neighbor_distribute_list, | |
3687 | neighbor_distribute_list_cmd, | |
3688 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
3689 | NEIGHBOR_STR | |
3690 | NEIGHBOR_ADDR_STR2 | |
3691 | "Filter updates to/from this neighbor\n" | |
3692 | "IP access-list number\n" | |
3693 | "IP access-list number (expanded range)\n" | |
3694 | "IP Access-list name\n" | |
3695 | "Filter incoming updates\n" | |
3696 | "Filter outgoing updates\n") | |
3697 | { | |
3698 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3699 | bgp_node_safi (vty), argv[1], argv[2]); | |
3700 | } | |
3701 | ||
3702 | DEFUN (no_neighbor_distribute_list, | |
3703 | no_neighbor_distribute_list_cmd, | |
3704 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
3705 | NO_STR | |
3706 | NEIGHBOR_STR | |
3707 | NEIGHBOR_ADDR_STR2 | |
3708 | "Filter updates to/from this neighbor\n" | |
3709 | "IP access-list number\n" | |
3710 | "IP access-list number (expanded range)\n" | |
3711 | "IP Access-list name\n" | |
3712 | "Filter incoming updates\n" | |
3713 | "Filter outgoing updates\n") | |
3714 | { | |
3715 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3716 | bgp_node_safi (vty), argv[2]); | |
3717 | } | |
6b0655a2 | 3718 | |
718e3744 | 3719 | /* Set prefix list to the peer. */ |
94f2b392 | 3720 | static int |
fd79ac91 | 3721 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3722 | safi_t safi, const char *name_str, | |
3723 | const char *direct_str) | |
718e3744 | 3724 | { |
3725 | int ret; | |
3726 | struct peer *peer; | |
3727 | int direct = FILTER_IN; | |
3728 | ||
3729 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3730 | if (! peer) | |
3731 | return CMD_WARNING; | |
3732 | ||
3733 | /* Check filter direction. */ | |
3734 | if (strncmp (direct_str, "i", 1) == 0) | |
3735 | direct = FILTER_IN; | |
3736 | else if (strncmp (direct_str, "o", 1) == 0) | |
3737 | direct = FILTER_OUT; | |
3738 | ||
3739 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
3740 | ||
3741 | return bgp_vty_return (vty, ret); | |
3742 | } | |
3743 | ||
94f2b392 | 3744 | static int |
fd79ac91 | 3745 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3746 | safi_t safi, const char *direct_str) | |
718e3744 | 3747 | { |
3748 | int ret; | |
3749 | struct peer *peer; | |
3750 | int direct = FILTER_IN; | |
3751 | ||
3752 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3753 | if (! peer) | |
3754 | return CMD_WARNING; | |
3755 | ||
3756 | /* Check filter direction. */ | |
3757 | if (strncmp (direct_str, "i", 1) == 0) | |
3758 | direct = FILTER_IN; | |
3759 | else if (strncmp (direct_str, "o", 1) == 0) | |
3760 | direct = FILTER_OUT; | |
3761 | ||
3762 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
3763 | ||
3764 | return bgp_vty_return (vty, ret); | |
3765 | } | |
3766 | ||
3767 | DEFUN (neighbor_prefix_list, | |
3768 | neighbor_prefix_list_cmd, | |
3769 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
3770 | NEIGHBOR_STR | |
3771 | NEIGHBOR_ADDR_STR2 | |
3772 | "Filter updates to/from this neighbor\n" | |
3773 | "Name of a prefix list\n" | |
3774 | "Filter incoming updates\n" | |
3775 | "Filter outgoing updates\n") | |
3776 | { | |
3777 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3778 | bgp_node_safi (vty), argv[1], argv[2]); | |
3779 | } | |
3780 | ||
3781 | DEFUN (no_neighbor_prefix_list, | |
3782 | no_neighbor_prefix_list_cmd, | |
3783 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
3784 | NO_STR | |
3785 | NEIGHBOR_STR | |
3786 | NEIGHBOR_ADDR_STR2 | |
3787 | "Filter updates to/from this neighbor\n" | |
3788 | "Name of a prefix list\n" | |
3789 | "Filter incoming updates\n" | |
3790 | "Filter outgoing updates\n") | |
3791 | { | |
3792 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3793 | bgp_node_safi (vty), argv[2]); | |
3794 | } | |
6b0655a2 | 3795 | |
94f2b392 | 3796 | static int |
fd79ac91 | 3797 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
3798 | afi_t afi, safi_t safi, | |
3799 | const char *name_str, const char *direct_str) | |
718e3744 | 3800 | { |
3801 | int ret; | |
3802 | struct peer *peer; | |
3803 | int direct = FILTER_IN; | |
3804 | ||
3805 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3806 | if (! peer) | |
3807 | return CMD_WARNING; | |
3808 | ||
3809 | /* Check filter direction. */ | |
3810 | if (strncmp (direct_str, "i", 1) == 0) | |
3811 | direct = FILTER_IN; | |
3812 | else if (strncmp (direct_str, "o", 1) == 0) | |
3813 | direct = FILTER_OUT; | |
3814 | ||
3815 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
3816 | ||
3817 | return bgp_vty_return (vty, ret); | |
3818 | } | |
3819 | ||
94f2b392 | 3820 | static int |
fd79ac91 | 3821 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
3822 | afi_t afi, safi_t safi, | |
3823 | const char *direct_str) | |
718e3744 | 3824 | { |
3825 | int ret; | |
3826 | struct peer *peer; | |
3827 | int direct = FILTER_IN; | |
3828 | ||
3829 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3830 | if (! peer) | |
3831 | return CMD_WARNING; | |
3832 | ||
3833 | /* Check filter direction. */ | |
3834 | if (strncmp (direct_str, "i", 1) == 0) | |
3835 | direct = FILTER_IN; | |
3836 | else if (strncmp (direct_str, "o", 1) == 0) | |
3837 | direct = FILTER_OUT; | |
3838 | ||
3839 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
3840 | ||
3841 | return bgp_vty_return (vty, ret); | |
3842 | } | |
3843 | ||
3844 | DEFUN (neighbor_filter_list, | |
3845 | neighbor_filter_list_cmd, | |
3846 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
3847 | NEIGHBOR_STR | |
3848 | NEIGHBOR_ADDR_STR2 | |
3849 | "Establish BGP filters\n" | |
3850 | "AS path access-list name\n" | |
3851 | "Filter incoming routes\n" | |
3852 | "Filter outgoing routes\n") | |
3853 | { | |
3854 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3855 | bgp_node_safi (vty), argv[1], argv[2]); | |
3856 | } | |
3857 | ||
3858 | DEFUN (no_neighbor_filter_list, | |
3859 | no_neighbor_filter_list_cmd, | |
3860 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
3861 | NO_STR | |
3862 | NEIGHBOR_STR | |
3863 | NEIGHBOR_ADDR_STR2 | |
3864 | "Establish BGP filters\n" | |
3865 | "AS path access-list name\n" | |
3866 | "Filter incoming routes\n" | |
3867 | "Filter outgoing routes\n") | |
3868 | { | |
3869 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3870 | bgp_node_safi (vty), argv[2]); | |
3871 | } | |
6b0655a2 | 3872 | |
718e3744 | 3873 | /* Set route-map to the peer. */ |
94f2b392 | 3874 | static int |
fd79ac91 | 3875 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
3876 | afi_t afi, safi_t safi, | |
3877 | const char *name_str, const char *direct_str) | |
718e3744 | 3878 | { |
3879 | int ret; | |
3880 | struct peer *peer; | |
fee0f4c6 | 3881 | int direct = RMAP_IN; |
718e3744 | 3882 | |
3883 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3884 | if (! peer) | |
3885 | return CMD_WARNING; | |
3886 | ||
3887 | /* Check filter direction. */ | |
fee0f4c6 | 3888 | if (strncmp (direct_str, "in", 2) == 0) |
3889 | direct = RMAP_IN; | |
718e3744 | 3890 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 3891 | direct = RMAP_OUT; |
3892 | else if (strncmp (direct_str, "im", 2) == 0) | |
3893 | direct = RMAP_IMPORT; | |
3894 | else if (strncmp (direct_str, "e", 1) == 0) | |
3895 | direct = RMAP_EXPORT; | |
718e3744 | 3896 | |
3897 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
3898 | ||
3899 | return bgp_vty_return (vty, ret); | |
3900 | } | |
3901 | ||
94f2b392 | 3902 | static int |
fd79ac91 | 3903 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3904 | safi_t safi, const char *direct_str) | |
718e3744 | 3905 | { |
3906 | int ret; | |
3907 | struct peer *peer; | |
fee0f4c6 | 3908 | int direct = RMAP_IN; |
718e3744 | 3909 | |
3910 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3911 | if (! peer) | |
3912 | return CMD_WARNING; | |
3913 | ||
3914 | /* Check filter direction. */ | |
fee0f4c6 | 3915 | if (strncmp (direct_str, "in", 2) == 0) |
3916 | direct = RMAP_IN; | |
718e3744 | 3917 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 3918 | direct = RMAP_OUT; |
3919 | else if (strncmp (direct_str, "im", 2) == 0) | |
3920 | direct = RMAP_IMPORT; | |
3921 | else if (strncmp (direct_str, "e", 1) == 0) | |
3922 | direct = RMAP_EXPORT; | |
718e3744 | 3923 | |
3924 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
3925 | ||
3926 | return bgp_vty_return (vty, ret); | |
3927 | } | |
3928 | ||
3929 | DEFUN (neighbor_route_map, | |
3930 | neighbor_route_map_cmd, | |
fee0f4c6 | 3931 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 3932 | NEIGHBOR_STR |
3933 | NEIGHBOR_ADDR_STR2 | |
3934 | "Apply route map to neighbor\n" | |
3935 | "Name of route map\n" | |
3936 | "Apply map to incoming routes\n" | |
fee0f4c6 | 3937 | "Apply map to outbound routes\n" |
3938 | "Apply map to routes going into a Route-Server client's table\n" | |
3939 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 3940 | { |
3941 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3942 | bgp_node_safi (vty), argv[1], argv[2]); | |
3943 | } | |
3944 | ||
3945 | DEFUN (no_neighbor_route_map, | |
3946 | no_neighbor_route_map_cmd, | |
fee0f4c6 | 3947 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 3948 | NO_STR |
3949 | NEIGHBOR_STR | |
3950 | NEIGHBOR_ADDR_STR2 | |
3951 | "Apply route map to neighbor\n" | |
3952 | "Name of route map\n" | |
3953 | "Apply map to incoming routes\n" | |
fee0f4c6 | 3954 | "Apply map to outbound routes\n" |
3955 | "Apply map to routes going into a Route-Server client's table\n" | |
3956 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 3957 | { |
3958 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3959 | bgp_node_safi (vty), argv[2]); | |
3960 | } | |
6b0655a2 | 3961 | |
718e3744 | 3962 | /* Set unsuppress-map to the peer. */ |
94f2b392 | 3963 | static int |
fd79ac91 | 3964 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3965 | safi_t safi, const char *name_str) | |
718e3744 | 3966 | { |
3967 | int ret; | |
3968 | struct peer *peer; | |
3969 | ||
3970 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3971 | if (! peer) | |
3972 | return CMD_WARNING; | |
3973 | ||
3974 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
3975 | ||
3976 | return bgp_vty_return (vty, ret); | |
3977 | } | |
3978 | ||
3979 | /* Unset route-map from the peer. */ | |
94f2b392 | 3980 | static int |
fd79ac91 | 3981 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 3982 | safi_t safi) |
3983 | { | |
3984 | int ret; | |
3985 | struct peer *peer; | |
3986 | ||
3987 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3988 | if (! peer) | |
3989 | return CMD_WARNING; | |
3990 | ||
3991 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
3992 | ||
3993 | return bgp_vty_return (vty, ret); | |
3994 | } | |
3995 | ||
3996 | DEFUN (neighbor_unsuppress_map, | |
3997 | neighbor_unsuppress_map_cmd, | |
3998 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
3999 | NEIGHBOR_STR | |
4000 | NEIGHBOR_ADDR_STR2 | |
4001 | "Route-map to selectively unsuppress suppressed routes\n" | |
4002 | "Name of route map\n") | |
4003 | { | |
4004 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4005 | bgp_node_safi (vty), argv[1]); | |
4006 | } | |
4007 | ||
4008 | DEFUN (no_neighbor_unsuppress_map, | |
4009 | no_neighbor_unsuppress_map_cmd, | |
4010 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
4011 | NO_STR | |
4012 | NEIGHBOR_STR | |
4013 | NEIGHBOR_ADDR_STR2 | |
4014 | "Route-map to selectively unsuppress suppressed routes\n" | |
4015 | "Name of route map\n") | |
4016 | { | |
4017 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4018 | bgp_node_safi (vty)); | |
4019 | } | |
6b0655a2 | 4020 | |
94f2b392 | 4021 | static int |
fd79ac91 | 4022 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
4023 | safi_t safi, const char *num_str, | |
0a486e5f | 4024 | const char *threshold_str, int warning, |
4025 | const char *restart_str) | |
718e3744 | 4026 | { |
4027 | int ret; | |
4028 | struct peer *peer; | |
4029 | u_int32_t max; | |
e0701b79 | 4030 | u_char threshold; |
0a486e5f | 4031 | u_int16_t restart; |
718e3744 | 4032 | |
4033 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4034 | if (! peer) | |
4035 | return CMD_WARNING; | |
4036 | ||
e6ec1c36 | 4037 | VTY_GET_INTEGER ("maximum number", max, num_str); |
e0701b79 | 4038 | if (threshold_str) |
4039 | threshold = atoi (threshold_str); | |
4040 | else | |
4041 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 4042 | |
0a486e5f | 4043 | if (restart_str) |
4044 | restart = atoi (restart_str); | |
4045 | else | |
4046 | restart = 0; | |
4047 | ||
4048 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 4049 | |
4050 | return bgp_vty_return (vty, ret); | |
4051 | } | |
4052 | ||
94f2b392 | 4053 | static int |
fd79ac91 | 4054 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 4055 | safi_t safi) |
4056 | { | |
4057 | int ret; | |
4058 | struct peer *peer; | |
4059 | ||
4060 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
4061 | if (! peer) | |
4062 | return CMD_WARNING; | |
4063 | ||
4064 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
4065 | ||
4066 | return bgp_vty_return (vty, ret); | |
4067 | } | |
4068 | ||
4069 | /* Maximum number of prefix configuration. prefix count is different | |
4070 | for each peer configuration. So this configuration can be set for | |
4071 | each peer configuration. */ | |
4072 | DEFUN (neighbor_maximum_prefix, | |
4073 | neighbor_maximum_prefix_cmd, | |
4074 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
4075 | NEIGHBOR_STR | |
4076 | NEIGHBOR_ADDR_STR2 | |
4077 | "Maximum number of prefix accept from this peer\n" | |
4078 | "maximum no. of prefix limit\n") | |
4079 | { | |
4080 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 4081 | bgp_node_safi (vty), argv[1], NULL, 0, |
4082 | NULL); | |
718e3744 | 4083 | } |
4084 | ||
e0701b79 | 4085 | DEFUN (neighbor_maximum_prefix_threshold, |
4086 | neighbor_maximum_prefix_threshold_cmd, | |
4087 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
4088 | NEIGHBOR_STR | |
4089 | NEIGHBOR_ADDR_STR2 | |
4090 | "Maximum number of prefix accept from this peer\n" | |
4091 | "maximum no. of prefix limit\n" | |
4092 | "Threshold value (%) at which to generate a warning msg\n") | |
4093 | { | |
4094 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 4095 | bgp_node_safi (vty), argv[1], argv[2], 0, |
4096 | NULL); | |
4097 | } | |
e0701b79 | 4098 | |
718e3744 | 4099 | DEFUN (neighbor_maximum_prefix_warning, |
4100 | neighbor_maximum_prefix_warning_cmd, | |
4101 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
4102 | NEIGHBOR_STR | |
4103 | NEIGHBOR_ADDR_STR2 | |
4104 | "Maximum number of prefix accept from this peer\n" | |
4105 | "maximum no. of prefix limit\n" | |
4106 | "Only give warning message when limit is exceeded\n") | |
4107 | { | |
4108 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 4109 | bgp_node_safi (vty), argv[1], NULL, 1, |
4110 | NULL); | |
718e3744 | 4111 | } |
4112 | ||
e0701b79 | 4113 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
4114 | neighbor_maximum_prefix_threshold_warning_cmd, | |
4115 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
4116 | NEIGHBOR_STR | |
4117 | NEIGHBOR_ADDR_STR2 | |
4118 | "Maximum number of prefix accept from this peer\n" | |
4119 | "maximum no. of prefix limit\n" | |
4120 | "Threshold value (%) at which to generate a warning msg\n" | |
4121 | "Only give warning message when limit is exceeded\n") | |
4122 | { | |
4123 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 4124 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
4125 | } | |
4126 | ||
4127 | DEFUN (neighbor_maximum_prefix_restart, | |
4128 | neighbor_maximum_prefix_restart_cmd, | |
4129 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
4130 | NEIGHBOR_STR | |
4131 | NEIGHBOR_ADDR_STR2 | |
4132 | "Maximum number of prefix accept from this peer\n" | |
4133 | "maximum no. of prefix limit\n" | |
4134 | "Restart bgp connection after limit is exceeded\n" | |
4135 | "Restart interval in minutes") | |
4136 | { | |
4137 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4138 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
4139 | } | |
4140 | ||
4141 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
4142 | neighbor_maximum_prefix_threshold_restart_cmd, | |
4143 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
4144 | NEIGHBOR_STR | |
4145 | NEIGHBOR_ADDR_STR2 | |
4146 | "Maximum number of prefix accept from this peer\n" | |
4147 | "maximum no. of prefix limit\n" | |
4148 | "Threshold value (%) at which to generate a warning msg\n" | |
4149 | "Restart bgp connection after limit is exceeded\n" | |
4150 | "Restart interval in minutes") | |
4151 | { | |
4152 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
4153 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
4154 | } | |
e0701b79 | 4155 | |
718e3744 | 4156 | DEFUN (no_neighbor_maximum_prefix, |
4157 | no_neighbor_maximum_prefix_cmd, | |
4158 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
4159 | NO_STR | |
4160 | NEIGHBOR_STR | |
4161 | NEIGHBOR_ADDR_STR2 | |
4162 | "Maximum number of prefix accept from this peer\n") | |
4163 | { | |
4164 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
4165 | bgp_node_safi (vty)); | |
4166 | } | |
4167 | ||
4168 | ALIAS (no_neighbor_maximum_prefix, | |
4169 | no_neighbor_maximum_prefix_val_cmd, | |
4170 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
4171 | NO_STR | |
4172 | NEIGHBOR_STR | |
4173 | NEIGHBOR_ADDR_STR2 | |
4174 | "Maximum number of prefix accept from this peer\n" | |
4175 | "maximum no. of prefix limit\n") | |
4176 | ||
4177 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 4178 | no_neighbor_maximum_prefix_threshold_cmd, |
4179 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
4180 | NO_STR | |
4181 | NEIGHBOR_STR | |
4182 | NEIGHBOR_ADDR_STR2 | |
4183 | "Maximum number of prefix accept from this peer\n" | |
4184 | "maximum no. of prefix limit\n" | |
4185 | "Threshold value (%) at which to generate a warning msg\n") | |
4186 | ||
4187 | ALIAS (no_neighbor_maximum_prefix, | |
4188 | no_neighbor_maximum_prefix_warning_cmd, | |
4189 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
4190 | NO_STR | |
4191 | NEIGHBOR_STR | |
4192 | NEIGHBOR_ADDR_STR2 | |
4193 | "Maximum number of prefix accept from this peer\n" | |
4194 | "maximum no. of prefix limit\n" | |
e8e1946e | 4195 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 4196 | |
4197 | ALIAS (no_neighbor_maximum_prefix, | |
4198 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 4199 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
4200 | NO_STR | |
4201 | NEIGHBOR_STR | |
4202 | NEIGHBOR_ADDR_STR2 | |
4203 | "Maximum number of prefix accept from this peer\n" | |
4204 | "maximum no. of prefix limit\n" | |
4205 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 4206 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 4207 | |
4208 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 4209 | no_neighbor_maximum_prefix_restart_cmd, |
4210 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 4211 | NO_STR |
4212 | NEIGHBOR_STR | |
4213 | NEIGHBOR_ADDR_STR2 | |
4214 | "Maximum number of prefix accept from this peer\n" | |
4215 | "maximum no. of prefix limit\n" | |
0a486e5f | 4216 | "Restart bgp connection after limit is exceeded\n" |
4217 | "Restart interval in minutes") | |
4218 | ||
4219 | ALIAS (no_neighbor_maximum_prefix, | |
4220 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
4221 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
4222 | NO_STR | |
4223 | NEIGHBOR_STR | |
4224 | NEIGHBOR_ADDR_STR2 | |
4225 | "Maximum number of prefix accept from this peer\n" | |
4226 | "maximum no. of prefix limit\n" | |
4227 | "Threshold value (%) at which to generate a warning msg\n" | |
4228 | "Restart bgp connection after limit is exceeded\n" | |
4229 | "Restart interval in minutes") | |
6b0655a2 | 4230 | |
718e3744 | 4231 | /* "neighbor allowas-in" */ |
4232 | DEFUN (neighbor_allowas_in, | |
4233 | neighbor_allowas_in_cmd, | |
4234 | NEIGHBOR_CMD2 "allowas-in", | |
4235 | NEIGHBOR_STR | |
4236 | NEIGHBOR_ADDR_STR2 | |
4237 | "Accept as-path with my AS present in it\n") | |
4238 | { | |
4239 | int ret; | |
4240 | struct peer *peer; | |
fd79ac91 | 4241 | unsigned int allow_num; |
718e3744 | 4242 | |
4243 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4244 | if (! peer) | |
4245 | return CMD_WARNING; | |
4246 | ||
4247 | if (argc == 1) | |
4248 | allow_num = 3; | |
4249 | else | |
4250 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
4251 | ||
4252 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
4253 | allow_num); | |
4254 | ||
4255 | return bgp_vty_return (vty, ret); | |
4256 | } | |
4257 | ||
4258 | ALIAS (neighbor_allowas_in, | |
4259 | neighbor_allowas_in_arg_cmd, | |
4260 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
4261 | NEIGHBOR_STR | |
4262 | NEIGHBOR_ADDR_STR2 | |
4263 | "Accept as-path with my AS present in it\n" | |
4264 | "Number of occurances of AS number\n") | |
4265 | ||
4266 | DEFUN (no_neighbor_allowas_in, | |
4267 | no_neighbor_allowas_in_cmd, | |
4268 | NO_NEIGHBOR_CMD2 "allowas-in", | |
4269 | NO_STR | |
4270 | NEIGHBOR_STR | |
4271 | NEIGHBOR_ADDR_STR2 | |
4272 | "allow local ASN appears in aspath attribute\n") | |
4273 | { | |
4274 | int ret; | |
4275 | struct peer *peer; | |
4276 | ||
4277 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4278 | if (! peer) | |
4279 | return CMD_WARNING; | |
4280 | ||
4281 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
4282 | ||
4283 | return bgp_vty_return (vty, ret); | |
4284 | } | |
6b0655a2 | 4285 | |
fa411a21 NH |
4286 | DEFUN (neighbor_ttl_security, |
4287 | neighbor_ttl_security_cmd, | |
4288 | NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
4289 | NEIGHBOR_STR | |
4290 | NEIGHBOR_ADDR_STR2 | |
4291 | "Specify the maximum number of hops to the BGP peer\n") | |
4292 | { | |
4293 | struct peer *peer; | |
89b6d1f8 | 4294 | int gtsm_hops; |
fa411a21 NH |
4295 | |
4296 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4297 | if (! peer) | |
4298 | return CMD_WARNING; | |
4299 | ||
4300 | VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254); | |
4301 | ||
89b6d1f8 | 4302 | return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops)); |
fa411a21 NH |
4303 | } |
4304 | ||
4305 | DEFUN (no_neighbor_ttl_security, | |
4306 | no_neighbor_ttl_security_cmd, | |
4307 | NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>", | |
4308 | NO_STR | |
4309 | NEIGHBOR_STR | |
4310 | NEIGHBOR_ADDR_STR2 | |
4311 | "Specify the maximum number of hops to the BGP peer\n") | |
4312 | { | |
4313 | struct peer *peer; | |
fa411a21 NH |
4314 | |
4315 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
4316 | if (! peer) | |
4317 | return CMD_WARNING; | |
4318 | ||
89b6d1f8 | 4319 | return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer)); |
fa411a21 | 4320 | } |
6b0655a2 | 4321 | |
718e3744 | 4322 | /* Address family configuration. */ |
4323 | DEFUN (address_family_ipv4, | |
4324 | address_family_ipv4_cmd, | |
4325 | "address-family ipv4", | |
4326 | "Enter Address Family command mode\n" | |
4327 | "Address family\n") | |
4328 | { | |
4329 | vty->node = BGP_IPV4_NODE; | |
4330 | return CMD_SUCCESS; | |
4331 | } | |
4332 | ||
4333 | DEFUN (address_family_ipv4_safi, | |
4334 | address_family_ipv4_safi_cmd, | |
4335 | "address-family ipv4 (unicast|multicast)", | |
4336 | "Enter Address Family command mode\n" | |
4337 | "Address family\n" | |
4338 | "Address Family modifier\n" | |
4339 | "Address Family modifier\n") | |
4340 | { | |
4341 | if (strncmp (argv[0], "m", 1) == 0) | |
4342 | vty->node = BGP_IPV4M_NODE; | |
4343 | else | |
4344 | vty->node = BGP_IPV4_NODE; | |
4345 | ||
4346 | return CMD_SUCCESS; | |
4347 | } | |
4348 | ||
25ffbdc1 | 4349 | DEFUN (address_family_ipv6, |
4350 | address_family_ipv6_cmd, | |
4351 | "address-family ipv6", | |
718e3744 | 4352 | "Enter Address Family command mode\n" |
25ffbdc1 | 4353 | "Address family\n") |
718e3744 | 4354 | { |
4355 | vty->node = BGP_IPV6_NODE; | |
4356 | return CMD_SUCCESS; | |
4357 | } | |
4358 | ||
25ffbdc1 | 4359 | DEFUN (address_family_ipv6_safi, |
4360 | address_family_ipv6_safi_cmd, | |
4361 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 4362 | "Enter Address Family command mode\n" |
25ffbdc1 | 4363 | "Address family\n" |
4364 | "Address Family modifier\n" | |
4365 | "Address Family modifier\n") | |
4366 | { | |
4367 | if (strncmp (argv[0], "m", 1) == 0) | |
4368 | vty->node = BGP_IPV6M_NODE; | |
4369 | else | |
4370 | vty->node = BGP_IPV6_NODE; | |
4371 | ||
4372 | return CMD_SUCCESS; | |
4373 | } | |
718e3744 | 4374 | |
4375 | DEFUN (address_family_vpnv4, | |
4376 | address_family_vpnv4_cmd, | |
4377 | "address-family vpnv4", | |
4378 | "Enter Address Family command mode\n" | |
4379 | "Address family\n") | |
4380 | { | |
4381 | vty->node = BGP_VPNV4_NODE; | |
4382 | return CMD_SUCCESS; | |
4383 | } | |
4384 | ||
4385 | ALIAS (address_family_vpnv4, | |
4386 | address_family_vpnv4_unicast_cmd, | |
4387 | "address-family vpnv4 unicast", | |
4388 | "Enter Address Family command mode\n" | |
4389 | "Address family\n" | |
4390 | "Address Family Modifier\n") | |
4391 | ||
4392 | DEFUN (exit_address_family, | |
4393 | exit_address_family_cmd, | |
4394 | "exit-address-family", | |
4395 | "Exit from Address Family configuration mode\n") | |
4396 | { | |
a8a80d53 | 4397 | if (vty->node == BGP_IPV4_NODE |
4398 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 4399 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 4400 | || vty->node == BGP_IPV6_NODE |
4401 | || vty->node == BGP_IPV6M_NODE) | |
718e3744 | 4402 | vty->node = BGP_NODE; |
4403 | return CMD_SUCCESS; | |
4404 | } | |
6b0655a2 | 4405 | |
718e3744 | 4406 | /* BGP clear sort. */ |
4407 | enum clear_sort | |
4408 | { | |
4409 | clear_all, | |
4410 | clear_peer, | |
4411 | clear_group, | |
4412 | clear_external, | |
4413 | clear_as | |
4414 | }; | |
4415 | ||
94f2b392 | 4416 | static void |
718e3744 | 4417 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
4418 | safi_t safi, int error) | |
4419 | { | |
4420 | switch (error) | |
4421 | { | |
4422 | case BGP_ERR_AF_UNCONFIGURED: | |
4423 | vty_out (vty, | |
4424 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
4425 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
4426 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
4427 | peer->host, VTY_NEWLINE); | |
4428 | break; | |
4429 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
4430 | 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); | |
4431 | break; | |
4432 | default: | |
4433 | break; | |
4434 | } | |
4435 | } | |
4436 | ||
4437 | /* `clear ip bgp' functions. */ | |
94f2b392 | 4438 | static int |
718e3744 | 4439 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, |
fd79ac91 | 4440 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
718e3744 | 4441 | { |
4442 | int ret; | |
4443 | struct peer *peer; | |
1eb8ef25 | 4444 | struct listnode *node, *nnode; |
718e3744 | 4445 | |
4446 | /* Clear all neighbors. */ | |
4447 | if (sort == clear_all) | |
4448 | { | |
1eb8ef25 | 4449 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 4450 | { |
4451 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4452 | ret = peer_clear (peer); | |
4453 | else | |
4454 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4455 | ||
4456 | if (ret < 0) | |
4457 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4458 | } | |
f188f2c4 DS |
4459 | |
4460 | /* This is to apply read-only mode on this clear. */ | |
4461 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4462 | bgp->update_delay_over = 0; | |
4463 | ||
0b2aa3a0 | 4464 | return CMD_SUCCESS; |
718e3744 | 4465 | } |
4466 | ||
4467 | /* Clear specified neighbors. */ | |
4468 | if (sort == clear_peer) | |
4469 | { | |
4470 | union sockunion su; | |
4471 | int ret; | |
4472 | ||
4473 | /* Make sockunion for lookup. */ | |
4474 | ret = str2sockunion (arg, &su); | |
4475 | if (ret < 0) | |
4476 | { | |
4477 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); | |
0b2aa3a0 | 4478 | return CMD_WARNING; |
718e3744 | 4479 | } |
4480 | peer = peer_lookup (bgp, &su); | |
4481 | if (! peer) | |
4482 | { | |
4483 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
0b2aa3a0 | 4484 | return CMD_WARNING; |
718e3744 | 4485 | } |
4486 | ||
4487 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4488 | ret = peer_clear (peer); | |
4489 | else | |
4490 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4491 | ||
4492 | if (ret < 0) | |
4493 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4494 | ||
0b2aa3a0 | 4495 | return CMD_SUCCESS; |
718e3744 | 4496 | } |
4497 | ||
4498 | /* Clear all peer-group members. */ | |
4499 | if (sort == clear_group) | |
4500 | { | |
4501 | struct peer_group *group; | |
4502 | ||
4503 | group = peer_group_lookup (bgp, arg); | |
4504 | if (! group) | |
4505 | { | |
4506 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
0b2aa3a0 | 4507 | return CMD_WARNING; |
718e3744 | 4508 | } |
4509 | ||
1eb8ef25 | 4510 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
718e3744 | 4511 | { |
4512 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4513 | { | |
4514 | ret = peer_clear (peer); | |
4515 | continue; | |
4516 | } | |
4517 | ||
4518 | if (! peer->af_group[afi][safi]) | |
4519 | continue; | |
4520 | ||
4521 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4522 | ||
4523 | if (ret < 0) | |
4524 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4525 | } | |
0b2aa3a0 | 4526 | return CMD_SUCCESS; |
718e3744 | 4527 | } |
4528 | ||
4529 | if (sort == clear_external) | |
4530 | { | |
1eb8ef25 | 4531 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 4532 | { |
6d85b15b | 4533 | if (peer->sort == BGP_PEER_IBGP) |
718e3744 | 4534 | continue; |
4535 | ||
4536 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4537 | ret = peer_clear (peer); | |
4538 | else | |
4539 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4540 | ||
4541 | if (ret < 0) | |
4542 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4543 | } | |
0b2aa3a0 | 4544 | return CMD_SUCCESS; |
718e3744 | 4545 | } |
4546 | ||
4547 | if (sort == clear_as) | |
4548 | { | |
4549 | as_t as; | |
718e3744 | 4550 | int find = 0; |
4551 | ||
bde12e3f | 4552 | VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX); |
0b2aa3a0 | 4553 | |
1eb8ef25 | 4554 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 4555 | { |
4556 | if (peer->as != as) | |
4557 | continue; | |
4558 | ||
4559 | find = 1; | |
4560 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4561 | ret = peer_clear (peer); | |
4562 | else | |
4563 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4564 | ||
4565 | if (ret < 0) | |
4566 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4567 | } | |
4568 | if (! find) | |
4569 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
4570 | VTY_NEWLINE); | |
0b2aa3a0 | 4571 | return CMD_SUCCESS; |
718e3744 | 4572 | } |
4573 | ||
0b2aa3a0 | 4574 | return CMD_SUCCESS; |
718e3744 | 4575 | } |
4576 | ||
94f2b392 | 4577 | static int |
fd79ac91 | 4578 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
4579 | enum clear_sort sort, enum bgp_clear_type stype, | |
4580 | const char *arg) | |
718e3744 | 4581 | { |
718e3744 | 4582 | struct bgp *bgp; |
4583 | ||
4584 | /* BGP structure lookup. */ | |
4585 | if (name) | |
4586 | { | |
4587 | bgp = bgp_lookup_by_name (name); | |
4588 | if (bgp == NULL) | |
4589 | { | |
4590 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); | |
4591 | return CMD_WARNING; | |
4592 | } | |
4593 | } | |
4594 | else | |
4595 | { | |
4596 | bgp = bgp_get_default (); | |
4597 | if (bgp == NULL) | |
4598 | { | |
4599 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
4600 | return CMD_WARNING; | |
4601 | } | |
4602 | } | |
4603 | ||
0b2aa3a0 | 4604 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
718e3744 | 4605 | } |
4606 | ||
4607 | DEFUN (clear_ip_bgp_all, | |
4608 | clear_ip_bgp_all_cmd, | |
4609 | "clear ip bgp *", | |
4610 | CLEAR_STR | |
4611 | IP_STR | |
4612 | BGP_STR | |
4613 | "Clear all peers\n") | |
4614 | { | |
4615 | if (argc == 1) | |
4616 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
4617 | ||
4618 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
4619 | } | |
4620 | ||
4621 | ALIAS (clear_ip_bgp_all, | |
4622 | clear_bgp_all_cmd, | |
4623 | "clear bgp *", | |
4624 | CLEAR_STR | |
4625 | BGP_STR | |
4626 | "Clear all peers\n") | |
4627 | ||
4628 | ALIAS (clear_ip_bgp_all, | |
4629 | clear_bgp_ipv6_all_cmd, | |
4630 | "clear bgp ipv6 *", | |
4631 | CLEAR_STR | |
4632 | BGP_STR | |
4633 | "Address family\n" | |
4634 | "Clear all peers\n") | |
4635 | ||
4636 | ALIAS (clear_ip_bgp_all, | |
4637 | clear_ip_bgp_instance_all_cmd, | |
4638 | "clear ip bgp view WORD *", | |
4639 | CLEAR_STR | |
4640 | IP_STR | |
4641 | BGP_STR | |
4642 | "BGP view\n" | |
4643 | "view name\n" | |
4644 | "Clear all peers\n") | |
4645 | ||
4646 | ALIAS (clear_ip_bgp_all, | |
4647 | clear_bgp_instance_all_cmd, | |
4648 | "clear bgp view WORD *", | |
4649 | CLEAR_STR | |
4650 | BGP_STR | |
4651 | "BGP view\n" | |
4652 | "view name\n" | |
4653 | "Clear all peers\n") | |
4654 | ||
4655 | DEFUN (clear_ip_bgp_peer, | |
4656 | clear_ip_bgp_peer_cmd, | |
4657 | "clear ip bgp (A.B.C.D|X:X::X:X)", | |
4658 | CLEAR_STR | |
4659 | IP_STR | |
4660 | BGP_STR | |
4661 | "BGP neighbor IP address to clear\n" | |
4662 | "BGP IPv6 neighbor to clear\n") | |
4663 | { | |
4664 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); | |
4665 | } | |
4666 | ||
4667 | ALIAS (clear_ip_bgp_peer, | |
4668 | clear_bgp_peer_cmd, | |
4669 | "clear bgp (A.B.C.D|X:X::X:X)", | |
4670 | CLEAR_STR | |
4671 | BGP_STR | |
4672 | "BGP neighbor address to clear\n" | |
4673 | "BGP IPv6 neighbor to clear\n") | |
4674 | ||
4675 | ALIAS (clear_ip_bgp_peer, | |
4676 | clear_bgp_ipv6_peer_cmd, | |
4677 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", | |
4678 | CLEAR_STR | |
4679 | BGP_STR | |
4680 | "Address family\n" | |
4681 | "BGP neighbor address to clear\n" | |
4682 | "BGP IPv6 neighbor to clear\n") | |
4683 | ||
4684 | DEFUN (clear_ip_bgp_peer_group, | |
4685 | clear_ip_bgp_peer_group_cmd, | |
4686 | "clear ip bgp peer-group WORD", | |
4687 | CLEAR_STR | |
4688 | IP_STR | |
4689 | BGP_STR | |
4690 | "Clear all members of peer-group\n" | |
4691 | "BGP peer-group name\n") | |
4692 | { | |
4693 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); | |
4694 | } | |
4695 | ||
4696 | ALIAS (clear_ip_bgp_peer_group, | |
4697 | clear_bgp_peer_group_cmd, | |
4698 | "clear bgp peer-group WORD", | |
4699 | CLEAR_STR | |
4700 | BGP_STR | |
4701 | "Clear all members of peer-group\n" | |
4702 | "BGP peer-group name\n") | |
4703 | ||
4704 | ALIAS (clear_ip_bgp_peer_group, | |
4705 | clear_bgp_ipv6_peer_group_cmd, | |
4706 | "clear bgp ipv6 peer-group WORD", | |
4707 | CLEAR_STR | |
4708 | BGP_STR | |
4709 | "Address family\n" | |
4710 | "Clear all members of peer-group\n" | |
4711 | "BGP peer-group name\n") | |
4712 | ||
4713 | DEFUN (clear_ip_bgp_external, | |
4714 | clear_ip_bgp_external_cmd, | |
4715 | "clear ip bgp external", | |
4716 | CLEAR_STR | |
4717 | IP_STR | |
4718 | BGP_STR | |
4719 | "Clear all external peers\n") | |
4720 | { | |
4721 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
4722 | } | |
4723 | ||
4724 | ALIAS (clear_ip_bgp_external, | |
4725 | clear_bgp_external_cmd, | |
4726 | "clear bgp external", | |
4727 | CLEAR_STR | |
4728 | BGP_STR | |
4729 | "Clear all external peers\n") | |
4730 | ||
4731 | ALIAS (clear_ip_bgp_external, | |
4732 | clear_bgp_ipv6_external_cmd, | |
4733 | "clear bgp ipv6 external", | |
4734 | CLEAR_STR | |
4735 | BGP_STR | |
4736 | "Address family\n" | |
4737 | "Clear all external peers\n") | |
4738 | ||
4739 | DEFUN (clear_ip_bgp_as, | |
4740 | clear_ip_bgp_as_cmd, | |
320da874 | 4741 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 4742 | CLEAR_STR |
4743 | IP_STR | |
4744 | BGP_STR | |
4745 | "Clear peers with the AS number\n") | |
4746 | { | |
4747 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); | |
4748 | } | |
4749 | ||
4750 | ALIAS (clear_ip_bgp_as, | |
4751 | clear_bgp_as_cmd, | |
320da874 | 4752 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 4753 | CLEAR_STR |
4754 | BGP_STR | |
4755 | "Clear peers with the AS number\n") | |
4756 | ||
4757 | ALIAS (clear_ip_bgp_as, | |
4758 | clear_bgp_ipv6_as_cmd, | |
320da874 | 4759 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 4760 | CLEAR_STR |
4761 | BGP_STR | |
4762 | "Address family\n" | |
4763 | "Clear peers with the AS number\n") | |
6b0655a2 | 4764 | |
718e3744 | 4765 | /* Outbound soft-reconfiguration */ |
4766 | DEFUN (clear_ip_bgp_all_soft_out, | |
4767 | clear_ip_bgp_all_soft_out_cmd, | |
4768 | "clear ip bgp * soft out", | |
4769 | CLEAR_STR | |
4770 | IP_STR | |
4771 | BGP_STR | |
4772 | "Clear all peers\n" | |
4773 | "Soft reconfig\n" | |
4774 | "Soft reconfig outbound update\n") | |
4775 | { | |
4776 | if (argc == 1) | |
4777 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
4778 | BGP_CLEAR_SOFT_OUT, NULL); | |
4779 | ||
4780 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
4781 | BGP_CLEAR_SOFT_OUT, NULL); | |
4782 | } | |
4783 | ||
4784 | ALIAS (clear_ip_bgp_all_soft_out, | |
4785 | clear_ip_bgp_all_out_cmd, | |
4786 | "clear ip bgp * out", | |
4787 | CLEAR_STR | |
4788 | IP_STR | |
4789 | BGP_STR | |
4790 | "Clear all peers\n" | |
4791 | "Soft reconfig outbound update\n") | |
4792 | ||
4793 | ALIAS (clear_ip_bgp_all_soft_out, | |
4794 | clear_ip_bgp_instance_all_soft_out_cmd, | |
4795 | "clear ip bgp view WORD * soft out", | |
4796 | CLEAR_STR | |
4797 | IP_STR | |
4798 | BGP_STR | |
4799 | "BGP view\n" | |
4800 | "view name\n" | |
4801 | "Clear all peers\n" | |
4802 | "Soft reconfig\n" | |
4803 | "Soft reconfig outbound update\n") | |
4804 | ||
4805 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
4806 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
4807 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
4808 | CLEAR_STR | |
4809 | IP_STR | |
4810 | BGP_STR | |
4811 | "Clear all peers\n" | |
4812 | "Address family\n" | |
4813 | "Address Family modifier\n" | |
4814 | "Address Family modifier\n" | |
4815 | "Soft reconfig\n" | |
4816 | "Soft reconfig outbound update\n") | |
4817 | { | |
4818 | if (strncmp (argv[0], "m", 1) == 0) | |
4819 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
4820 | BGP_CLEAR_SOFT_OUT, NULL); | |
4821 | ||
4822 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
4823 | BGP_CLEAR_SOFT_OUT, NULL); | |
4824 | } | |
4825 | ||
4826 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, | |
4827 | clear_ip_bgp_all_ipv4_out_cmd, | |
4828 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
4829 | CLEAR_STR | |
4830 | IP_STR | |
4831 | BGP_STR | |
4832 | "Clear all peers\n" | |
4833 | "Address family\n" | |
4834 | "Address Family modifier\n" | |
4835 | "Address Family modifier\n" | |
4836 | "Soft reconfig outbound update\n") | |
4837 | ||
4838 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, | |
4839 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
4840 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", | |
4841 | CLEAR_STR | |
4842 | IP_STR | |
4843 | BGP_STR | |
4844 | "BGP view\n" | |
4845 | "view name\n" | |
4846 | "Clear all peers\n" | |
4847 | "Address family\n" | |
4848 | "Address Family modifier\n" | |
4849 | "Address Family modifier\n" | |
4850 | "Soft reconfig outbound update\n") | |
4851 | { | |
4852 | if (strncmp (argv[1], "m", 1) == 0) | |
4853 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
4854 | BGP_CLEAR_SOFT_OUT, NULL); | |
4855 | ||
4856 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
4857 | BGP_CLEAR_SOFT_OUT, NULL); | |
4858 | } | |
4859 | ||
4860 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
4861 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
4862 | "clear ip bgp * vpnv4 unicast soft out", | |
4863 | CLEAR_STR | |
4864 | IP_STR | |
4865 | BGP_STR | |
4866 | "Clear all peers\n" | |
4867 | "Address family\n" | |
4868 | "Address Family Modifier\n" | |
4869 | "Soft reconfig\n" | |
4870 | "Soft reconfig outbound update\n") | |
4871 | { | |
4872 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
4873 | BGP_CLEAR_SOFT_OUT, NULL); | |
4874 | } | |
4875 | ||
4876 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
4877 | clear_ip_bgp_all_vpnv4_out_cmd, | |
4878 | "clear ip bgp * vpnv4 unicast out", | |
4879 | CLEAR_STR | |
4880 | IP_STR | |
4881 | BGP_STR | |
4882 | "Clear all peers\n" | |
4883 | "Address family\n" | |
4884 | "Address Family Modifier\n" | |
4885 | "Soft reconfig outbound update\n") | |
4886 | ||
4887 | DEFUN (clear_bgp_all_soft_out, | |
4888 | clear_bgp_all_soft_out_cmd, | |
4889 | "clear bgp * soft out", | |
4890 | CLEAR_STR | |
4891 | BGP_STR | |
4892 | "Clear all peers\n" | |
4893 | "Soft reconfig\n" | |
4894 | "Soft reconfig outbound update\n") | |
4895 | { | |
4896 | if (argc == 1) | |
4897 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
4898 | BGP_CLEAR_SOFT_OUT, NULL); | |
4899 | ||
4900 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
4901 | BGP_CLEAR_SOFT_OUT, NULL); | |
4902 | } | |
4903 | ||
4904 | ALIAS (clear_bgp_all_soft_out, | |
4905 | clear_bgp_instance_all_soft_out_cmd, | |
4906 | "clear bgp view WORD * soft out", | |
4907 | CLEAR_STR | |
4908 | BGP_STR | |
4909 | "BGP view\n" | |
4910 | "view name\n" | |
4911 | "Clear all peers\n" | |
4912 | "Soft reconfig\n" | |
4913 | "Soft reconfig outbound update\n") | |
4914 | ||
4915 | ALIAS (clear_bgp_all_soft_out, | |
4916 | clear_bgp_all_out_cmd, | |
4917 | "clear bgp * out", | |
4918 | CLEAR_STR | |
4919 | BGP_STR | |
4920 | "Clear all peers\n" | |
4921 | "Soft reconfig outbound update\n") | |
4922 | ||
4923 | ALIAS (clear_bgp_all_soft_out, | |
4924 | clear_bgp_ipv6_all_soft_out_cmd, | |
4925 | "clear bgp ipv6 * soft out", | |
4926 | CLEAR_STR | |
4927 | BGP_STR | |
4928 | "Address family\n" | |
4929 | "Clear all peers\n" | |
4930 | "Soft reconfig\n" | |
4931 | "Soft reconfig outbound update\n") | |
4932 | ||
4933 | ALIAS (clear_bgp_all_soft_out, | |
4934 | clear_bgp_ipv6_all_out_cmd, | |
4935 | "clear bgp ipv6 * out", | |
4936 | CLEAR_STR | |
4937 | BGP_STR | |
4938 | "Address family\n" | |
4939 | "Clear all peers\n" | |
4940 | "Soft reconfig outbound update\n") | |
4941 | ||
4942 | DEFUN (clear_ip_bgp_peer_soft_out, | |
4943 | clear_ip_bgp_peer_soft_out_cmd, | |
4944 | "clear ip bgp A.B.C.D soft out", | |
4945 | CLEAR_STR | |
4946 | IP_STR | |
4947 | BGP_STR | |
4948 | "BGP neighbor address to clear\n" | |
4949 | "Soft reconfig\n" | |
4950 | "Soft reconfig outbound update\n") | |
4951 | { | |
4952 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
4953 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4954 | } | |
4955 | ||
4956 | ALIAS (clear_ip_bgp_peer_soft_out, | |
4957 | clear_ip_bgp_peer_out_cmd, | |
4958 | "clear ip bgp A.B.C.D out", | |
4959 | CLEAR_STR | |
4960 | IP_STR | |
4961 | BGP_STR | |
4962 | "BGP neighbor address to clear\n" | |
4963 | "Soft reconfig outbound update\n") | |
4964 | ||
4965 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, | |
4966 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
4967 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", | |
4968 | CLEAR_STR | |
4969 | IP_STR | |
4970 | BGP_STR | |
4971 | "BGP neighbor address to clear\n" | |
4972 | "Address family\n" | |
4973 | "Address Family modifier\n" | |
4974 | "Address Family modifier\n" | |
4975 | "Soft reconfig\n" | |
4976 | "Soft reconfig outbound update\n") | |
4977 | { | |
4978 | if (strncmp (argv[1], "m", 1) == 0) | |
4979 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
4980 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4981 | ||
4982 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
4983 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4984 | } | |
4985 | ||
4986 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, | |
4987 | clear_ip_bgp_peer_ipv4_out_cmd, | |
4988 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", | |
4989 | CLEAR_STR | |
4990 | IP_STR | |
4991 | BGP_STR | |
4992 | "BGP neighbor address to clear\n" | |
4993 | "Address family\n" | |
4994 | "Address Family modifier\n" | |
4995 | "Address Family modifier\n" | |
4996 | "Soft reconfig outbound update\n") | |
4997 | ||
4998 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, | |
4999 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
5000 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", | |
5001 | CLEAR_STR | |
5002 | IP_STR | |
5003 | BGP_STR | |
5004 | "BGP neighbor address to clear\n" | |
5005 | "Address family\n" | |
5006 | "Address Family Modifier\n" | |
5007 | "Soft reconfig\n" | |
5008 | "Soft reconfig outbound update\n") | |
5009 | { | |
5010 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
5011 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5012 | } | |
5013 | ||
5014 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
5015 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
5016 | "clear ip bgp A.B.C.D vpnv4 unicast out", | |
5017 | CLEAR_STR | |
5018 | IP_STR | |
5019 | BGP_STR | |
5020 | "BGP neighbor address to clear\n" | |
5021 | "Address family\n" | |
5022 | "Address Family Modifier\n" | |
5023 | "Soft reconfig outbound update\n") | |
5024 | ||
5025 | DEFUN (clear_bgp_peer_soft_out, | |
5026 | clear_bgp_peer_soft_out_cmd, | |
5027 | "clear bgp (A.B.C.D|X:X::X:X) soft out", | |
5028 | CLEAR_STR | |
5029 | BGP_STR | |
5030 | "BGP neighbor address to clear\n" | |
5031 | "BGP IPv6 neighbor to clear\n" | |
5032 | "Soft reconfig\n" | |
5033 | "Soft reconfig outbound update\n") | |
5034 | { | |
5035 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
5036 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5037 | } | |
5038 | ||
5039 | ALIAS (clear_bgp_peer_soft_out, | |
5040 | clear_bgp_ipv6_peer_soft_out_cmd, | |
5041 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", | |
5042 | CLEAR_STR | |
5043 | BGP_STR | |
5044 | "Address family\n" | |
5045 | "BGP neighbor address to clear\n" | |
5046 | "BGP IPv6 neighbor to clear\n" | |
5047 | "Soft reconfig\n" | |
5048 | "Soft reconfig outbound update\n") | |
5049 | ||
5050 | ALIAS (clear_bgp_peer_soft_out, | |
5051 | clear_bgp_peer_out_cmd, | |
5052 | "clear bgp (A.B.C.D|X:X::X:X) out", | |
5053 | CLEAR_STR | |
5054 | BGP_STR | |
5055 | "BGP neighbor address to clear\n" | |
5056 | "BGP IPv6 neighbor to clear\n" | |
5057 | "Soft reconfig outbound update\n") | |
5058 | ||
5059 | ALIAS (clear_bgp_peer_soft_out, | |
5060 | clear_bgp_ipv6_peer_out_cmd, | |
5061 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", | |
5062 | CLEAR_STR | |
5063 | BGP_STR | |
5064 | "Address family\n" | |
5065 | "BGP neighbor address to clear\n" | |
5066 | "BGP IPv6 neighbor to clear\n" | |
5067 | "Soft reconfig outbound update\n") | |
5068 | ||
5069 | DEFUN (clear_ip_bgp_peer_group_soft_out, | |
5070 | clear_ip_bgp_peer_group_soft_out_cmd, | |
5071 | "clear ip bgp peer-group WORD soft out", | |
5072 | CLEAR_STR | |
5073 | IP_STR | |
5074 | BGP_STR | |
5075 | "Clear all members of peer-group\n" | |
5076 | "BGP peer-group name\n" | |
5077 | "Soft reconfig\n" | |
5078 | "Soft reconfig outbound update\n") | |
5079 | { | |
5080 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5081 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5082 | } | |
5083 | ||
5084 | ALIAS (clear_ip_bgp_peer_group_soft_out, | |
5085 | clear_ip_bgp_peer_group_out_cmd, | |
5086 | "clear ip bgp peer-group WORD out", | |
5087 | CLEAR_STR | |
5088 | IP_STR | |
5089 | BGP_STR | |
5090 | "Clear all members of peer-group\n" | |
5091 | "BGP peer-group name\n" | |
5092 | "Soft reconfig outbound update\n") | |
5093 | ||
5094 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, | |
5095 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
5096 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
5097 | CLEAR_STR | |
5098 | IP_STR | |
5099 | BGP_STR | |
5100 | "Clear all members of peer-group\n" | |
5101 | "BGP peer-group name\n" | |
5102 | "Address family\n" | |
5103 | "Address Family modifier\n" | |
5104 | "Address Family modifier\n" | |
5105 | "Soft reconfig\n" | |
5106 | "Soft reconfig outbound update\n") | |
5107 | { | |
5108 | if (strncmp (argv[1], "m", 1) == 0) | |
5109 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
5110 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5111 | ||
5112 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5113 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5114 | } | |
5115 | ||
5116 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, | |
5117 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
5118 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
5119 | CLEAR_STR | |
5120 | IP_STR | |
5121 | BGP_STR | |
5122 | "Clear all members of peer-group\n" | |
5123 | "BGP peer-group name\n" | |
5124 | "Address family\n" | |
5125 | "Address Family modifier\n" | |
5126 | "Address Family modifier\n" | |
5127 | "Soft reconfig outbound update\n") | |
5128 | ||
5129 | DEFUN (clear_bgp_peer_group_soft_out, | |
5130 | clear_bgp_peer_group_soft_out_cmd, | |
5131 | "clear bgp peer-group WORD soft out", | |
5132 | CLEAR_STR | |
5133 | BGP_STR | |
5134 | "Clear all members of peer-group\n" | |
5135 | "BGP peer-group name\n" | |
5136 | "Soft reconfig\n" | |
5137 | "Soft reconfig outbound update\n") | |
5138 | { | |
5139 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
5140 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5141 | } | |
5142 | ||
5143 | ALIAS (clear_bgp_peer_group_soft_out, | |
5144 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
5145 | "clear bgp ipv6 peer-group WORD soft out", | |
5146 | CLEAR_STR | |
5147 | BGP_STR | |
5148 | "Address family\n" | |
5149 | "Clear all members of peer-group\n" | |
5150 | "BGP peer-group name\n" | |
5151 | "Soft reconfig\n" | |
5152 | "Soft reconfig outbound update\n") | |
5153 | ||
5154 | ALIAS (clear_bgp_peer_group_soft_out, | |
5155 | clear_bgp_peer_group_out_cmd, | |
5156 | "clear bgp peer-group WORD out", | |
5157 | CLEAR_STR | |
5158 | BGP_STR | |
5159 | "Clear all members of peer-group\n" | |
5160 | "BGP peer-group name\n" | |
5161 | "Soft reconfig outbound update\n") | |
5162 | ||
5163 | ALIAS (clear_bgp_peer_group_soft_out, | |
5164 | clear_bgp_ipv6_peer_group_out_cmd, | |
5165 | "clear bgp ipv6 peer-group WORD out", | |
5166 | CLEAR_STR | |
5167 | BGP_STR | |
5168 | "Address family\n" | |
5169 | "Clear all members of peer-group\n" | |
5170 | "BGP peer-group name\n" | |
5171 | "Soft reconfig outbound update\n") | |
5172 | ||
5173 | DEFUN (clear_ip_bgp_external_soft_out, | |
5174 | clear_ip_bgp_external_soft_out_cmd, | |
5175 | "clear ip bgp external soft out", | |
5176 | CLEAR_STR | |
5177 | IP_STR | |
5178 | BGP_STR | |
5179 | "Clear all external peers\n" | |
5180 | "Soft reconfig\n" | |
5181 | "Soft reconfig outbound update\n") | |
5182 | { | |
5183 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5184 | BGP_CLEAR_SOFT_OUT, NULL); | |
5185 | } | |
5186 | ||
5187 | ALIAS (clear_ip_bgp_external_soft_out, | |
5188 | clear_ip_bgp_external_out_cmd, | |
5189 | "clear ip bgp external out", | |
5190 | CLEAR_STR | |
5191 | IP_STR | |
5192 | BGP_STR | |
5193 | "Clear all external peers\n" | |
5194 | "Soft reconfig outbound update\n") | |
5195 | ||
5196 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
5197 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
5198 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
5199 | CLEAR_STR | |
5200 | IP_STR | |
5201 | BGP_STR | |
5202 | "Clear all external peers\n" | |
5203 | "Address family\n" | |
5204 | "Address Family modifier\n" | |
5205 | "Address Family modifier\n" | |
5206 | "Soft reconfig\n" | |
5207 | "Soft reconfig outbound update\n") | |
5208 | { | |
5209 | if (strncmp (argv[0], "m", 1) == 0) | |
5210 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
5211 | BGP_CLEAR_SOFT_OUT, NULL); | |
5212 | ||
5213 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5214 | BGP_CLEAR_SOFT_OUT, NULL); | |
5215 | } | |
5216 | ||
5217 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, | |
5218 | clear_ip_bgp_external_ipv4_out_cmd, | |
5219 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
5220 | CLEAR_STR | |
5221 | IP_STR | |
5222 | BGP_STR | |
5223 | "Clear all external peers\n" | |
5224 | "Address family\n" | |
5225 | "Address Family modifier\n" | |
5226 | "Address Family modifier\n" | |
5227 | "Soft reconfig outbound update\n") | |
5228 | ||
5229 | DEFUN (clear_bgp_external_soft_out, | |
5230 | clear_bgp_external_soft_out_cmd, | |
5231 | "clear bgp external soft out", | |
5232 | CLEAR_STR | |
5233 | BGP_STR | |
5234 | "Clear all external peers\n" | |
5235 | "Soft reconfig\n" | |
5236 | "Soft reconfig outbound update\n") | |
5237 | { | |
5238 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
5239 | BGP_CLEAR_SOFT_OUT, NULL); | |
5240 | } | |
5241 | ||
5242 | ALIAS (clear_bgp_external_soft_out, | |
5243 | clear_bgp_ipv6_external_soft_out_cmd, | |
5244 | "clear bgp ipv6 external soft out", | |
5245 | CLEAR_STR | |
5246 | BGP_STR | |
5247 | "Address family\n" | |
5248 | "Clear all external peers\n" | |
5249 | "Soft reconfig\n" | |
5250 | "Soft reconfig outbound update\n") | |
5251 | ||
5252 | ALIAS (clear_bgp_external_soft_out, | |
5253 | clear_bgp_external_out_cmd, | |
5254 | "clear bgp external out", | |
5255 | CLEAR_STR | |
5256 | BGP_STR | |
5257 | "Clear all external peers\n" | |
5258 | "Soft reconfig outbound update\n") | |
5259 | ||
5260 | ALIAS (clear_bgp_external_soft_out, | |
5261 | clear_bgp_ipv6_external_out_cmd, | |
5262 | "clear bgp ipv6 external WORD out", | |
5263 | CLEAR_STR | |
5264 | BGP_STR | |
5265 | "Address family\n" | |
5266 | "Clear all external peers\n" | |
5267 | "Soft reconfig outbound update\n") | |
5268 | ||
5269 | DEFUN (clear_ip_bgp_as_soft_out, | |
5270 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 5271 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 5272 | CLEAR_STR |
5273 | IP_STR | |
5274 | BGP_STR | |
5275 | "Clear peers with the AS number\n" | |
5276 | "Soft reconfig\n" | |
5277 | "Soft reconfig outbound update\n") | |
5278 | { | |
5279 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
5280 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5281 | } | |
5282 | ||
5283 | ALIAS (clear_ip_bgp_as_soft_out, | |
5284 | clear_ip_bgp_as_out_cmd, | |
320da874 | 5285 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 5286 | CLEAR_STR |
5287 | IP_STR | |
5288 | BGP_STR | |
5289 | "Clear peers with the AS number\n" | |
5290 | "Soft reconfig outbound update\n") | |
5291 | ||
5292 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, | |
5293 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 5294 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 5295 | CLEAR_STR |
5296 | IP_STR | |
5297 | BGP_STR | |
5298 | "Clear peers with the AS number\n" | |
5299 | "Address family\n" | |
5300 | "Address Family modifier\n" | |
5301 | "Address Family modifier\n" | |
5302 | "Soft reconfig\n" | |
5303 | "Soft reconfig outbound update\n") | |
5304 | { | |
5305 | if (strncmp (argv[1], "m", 1) == 0) | |
5306 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
5307 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5308 | ||
5309 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
5310 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5311 | } | |
5312 | ||
5313 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, | |
5314 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 5315 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 5316 | CLEAR_STR |
5317 | IP_STR | |
5318 | BGP_STR | |
5319 | "Clear peers with the AS number\n" | |
5320 | "Address family\n" | |
5321 | "Address Family modifier\n" | |
5322 | "Address Family modifier\n" | |
5323 | "Soft reconfig outbound update\n") | |
5324 | ||
5325 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, | |
5326 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 5327 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 5328 | CLEAR_STR |
5329 | IP_STR | |
5330 | BGP_STR | |
5331 | "Clear peers with the AS number\n" | |
5332 | "Address family\n" | |
5333 | "Address Family modifier\n" | |
5334 | "Soft reconfig\n" | |
5335 | "Soft reconfig outbound update\n") | |
5336 | { | |
5337 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
5338 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5339 | } | |
5340 | ||
5341 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
5342 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 5343 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 5344 | CLEAR_STR |
5345 | IP_STR | |
5346 | BGP_STR | |
5347 | "Clear peers with the AS number\n" | |
5348 | "Address family\n" | |
5349 | "Address Family modifier\n" | |
5350 | "Soft reconfig outbound update\n") | |
5351 | ||
5352 | DEFUN (clear_bgp_as_soft_out, | |
5353 | clear_bgp_as_soft_out_cmd, | |
320da874 | 5354 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 5355 | CLEAR_STR |
5356 | BGP_STR | |
5357 | "Clear peers with the AS number\n" | |
5358 | "Soft reconfig\n" | |
5359 | "Soft reconfig outbound update\n") | |
5360 | { | |
5361 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
5362 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
5363 | } | |
5364 | ||
5365 | ALIAS (clear_bgp_as_soft_out, | |
5366 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 5367 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 5368 | CLEAR_STR |
5369 | BGP_STR | |
5370 | "Address family\n" | |
5371 | "Clear peers with the AS number\n" | |
5372 | "Soft reconfig\n" | |
5373 | "Soft reconfig outbound update\n") | |
5374 | ||
5375 | ALIAS (clear_bgp_as_soft_out, | |
5376 | clear_bgp_as_out_cmd, | |
320da874 | 5377 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 5378 | CLEAR_STR |
5379 | BGP_STR | |
5380 | "Clear peers with the AS number\n" | |
5381 | "Soft reconfig outbound update\n") | |
5382 | ||
5383 | ALIAS (clear_bgp_as_soft_out, | |
5384 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 5385 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 5386 | CLEAR_STR |
5387 | BGP_STR | |
5388 | "Address family\n" | |
5389 | "Clear peers with the AS number\n" | |
5390 | "Soft reconfig outbound update\n") | |
6b0655a2 | 5391 | |
718e3744 | 5392 | /* Inbound soft-reconfiguration */ |
5393 | DEFUN (clear_ip_bgp_all_soft_in, | |
5394 | clear_ip_bgp_all_soft_in_cmd, | |
5395 | "clear ip bgp * soft in", | |
5396 | CLEAR_STR | |
5397 | IP_STR | |
5398 | BGP_STR | |
5399 | "Clear all peers\n" | |
5400 | "Soft reconfig\n" | |
5401 | "Soft reconfig inbound update\n") | |
5402 | { | |
5403 | if (argc == 1) | |
5404 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5405 | BGP_CLEAR_SOFT_IN, NULL); | |
5406 | ||
5407 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5408 | BGP_CLEAR_SOFT_IN, NULL); | |
5409 | } | |
5410 | ||
5411 | ALIAS (clear_ip_bgp_all_soft_in, | |
5412 | clear_ip_bgp_instance_all_soft_in_cmd, | |
5413 | "clear ip bgp view WORD * soft in", | |
5414 | CLEAR_STR | |
5415 | IP_STR | |
5416 | BGP_STR | |
5417 | "BGP view\n" | |
5418 | "view name\n" | |
5419 | "Clear all peers\n" | |
5420 | "Soft reconfig\n" | |
5421 | "Soft reconfig inbound update\n") | |
5422 | ||
5423 | ALIAS (clear_ip_bgp_all_soft_in, | |
5424 | clear_ip_bgp_all_in_cmd, | |
5425 | "clear ip bgp * in", | |
5426 | CLEAR_STR | |
5427 | IP_STR | |
5428 | BGP_STR | |
5429 | "Clear all peers\n" | |
5430 | "Soft reconfig inbound update\n") | |
5431 | ||
5432 | DEFUN (clear_ip_bgp_all_in_prefix_filter, | |
5433 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
5434 | "clear ip bgp * in prefix-filter", | |
5435 | CLEAR_STR | |
5436 | IP_STR | |
5437 | BGP_STR | |
5438 | "Clear all peers\n" | |
5439 | "Soft reconfig inbound update\n" | |
5440 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5441 | { | |
5442 | if (argc== 1) | |
5443 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5444 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5445 | ||
5446 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5447 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5448 | } | |
5449 | ||
5450 | ALIAS (clear_ip_bgp_all_in_prefix_filter, | |
5451 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, | |
5452 | "clear ip bgp view WORD * in prefix-filter", | |
5453 | CLEAR_STR | |
5454 | IP_STR | |
5455 | BGP_STR | |
5456 | "BGP view\n" | |
5457 | "view name\n" | |
5458 | "Clear all peers\n" | |
5459 | "Soft reconfig inbound update\n" | |
5460 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5461 | ||
5462 | ||
5463 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, | |
5464 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
5465 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
5466 | CLEAR_STR | |
5467 | IP_STR | |
5468 | BGP_STR | |
5469 | "Clear all peers\n" | |
5470 | "Address family\n" | |
5471 | "Address Family modifier\n" | |
5472 | "Address Family modifier\n" | |
5473 | "Soft reconfig\n" | |
5474 | "Soft reconfig inbound update\n") | |
5475 | { | |
5476 | if (strncmp (argv[0], "m", 1) == 0) | |
5477 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
5478 | BGP_CLEAR_SOFT_IN, NULL); | |
5479 | ||
5480 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5481 | BGP_CLEAR_SOFT_IN, NULL); | |
5482 | } | |
5483 | ||
5484 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, | |
5485 | clear_ip_bgp_all_ipv4_in_cmd, | |
5486 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
5487 | CLEAR_STR | |
5488 | IP_STR | |
5489 | BGP_STR | |
5490 | "Clear all peers\n" | |
5491 | "Address family\n" | |
5492 | "Address Family modifier\n" | |
5493 | "Address Family modifier\n" | |
5494 | "Soft reconfig inbound update\n") | |
5495 | ||
5496 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, | |
5497 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
5498 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", | |
5499 | CLEAR_STR | |
5500 | IP_STR | |
5501 | BGP_STR | |
5502 | "BGP view\n" | |
5503 | "view name\n" | |
5504 | "Clear all peers\n" | |
5505 | "Address family\n" | |
5506 | "Address Family modifier\n" | |
5507 | "Address Family modifier\n" | |
5508 | "Soft reconfig\n" | |
5509 | "Soft reconfig inbound update\n") | |
5510 | { | |
5511 | if (strncmp (argv[1], "m", 1) == 0) | |
5512 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
5513 | BGP_CLEAR_SOFT_IN, NULL); | |
5514 | ||
5515 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5516 | BGP_CLEAR_SOFT_IN, NULL); | |
5517 | } | |
5518 | ||
5519 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, | |
5520 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
5521 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
5522 | CLEAR_STR | |
5523 | IP_STR | |
5524 | BGP_STR | |
5525 | "Clear all peers\n" | |
5526 | "Address family\n" | |
5527 | "Address Family modifier\n" | |
5528 | "Address Family modifier\n" | |
5529 | "Soft reconfig inbound update\n" | |
5530 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5531 | { | |
5532 | if (strncmp (argv[0], "m", 1) == 0) | |
5533 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
5534 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5535 | ||
5536 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5537 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5538 | } | |
5539 | ||
5540 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, | |
5541 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, | |
5542 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", | |
5543 | CLEAR_STR | |
5544 | IP_STR | |
5545 | BGP_STR | |
5546 | "Clear all peers\n" | |
5547 | "Address family\n" | |
5548 | "Address Family modifier\n" | |
5549 | "Address Family modifier\n" | |
5550 | "Soft reconfig inbound update\n" | |
5551 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5552 | { | |
5553 | if (strncmp (argv[1], "m", 1) == 0) | |
5554 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
5555 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5556 | ||
5557 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5558 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5559 | } | |
5560 | ||
5561 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
5562 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
5563 | "clear ip bgp * vpnv4 unicast soft in", | |
5564 | CLEAR_STR | |
5565 | IP_STR | |
5566 | BGP_STR | |
5567 | "Clear all peers\n" | |
5568 | "Address family\n" | |
5569 | "Address Family Modifier\n" | |
5570 | "Soft reconfig\n" | |
5571 | "Soft reconfig inbound update\n") | |
5572 | { | |
5573 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
5574 | BGP_CLEAR_SOFT_IN, NULL); | |
5575 | } | |
5576 | ||
5577 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
5578 | clear_ip_bgp_all_vpnv4_in_cmd, | |
5579 | "clear ip bgp * vpnv4 unicast in", | |
5580 | CLEAR_STR | |
5581 | IP_STR | |
5582 | BGP_STR | |
5583 | "Clear all peers\n" | |
5584 | "Address family\n" | |
5585 | "Address Family Modifier\n" | |
5586 | "Soft reconfig inbound update\n") | |
5587 | ||
5588 | DEFUN (clear_bgp_all_soft_in, | |
5589 | clear_bgp_all_soft_in_cmd, | |
5590 | "clear bgp * soft in", | |
5591 | CLEAR_STR | |
5592 | BGP_STR | |
5593 | "Clear all peers\n" | |
5594 | "Soft reconfig\n" | |
5595 | "Soft reconfig inbound update\n") | |
5596 | { | |
5597 | if (argc == 1) | |
5598 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
5599 | BGP_CLEAR_SOFT_IN, NULL); | |
5600 | ||
5601 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
5602 | BGP_CLEAR_SOFT_IN, NULL); | |
5603 | } | |
5604 | ||
5605 | ALIAS (clear_bgp_all_soft_in, | |
5606 | clear_bgp_instance_all_soft_in_cmd, | |
5607 | "clear bgp view WORD * soft in", | |
5608 | CLEAR_STR | |
5609 | BGP_STR | |
5610 | "BGP view\n" | |
5611 | "view name\n" | |
5612 | "Clear all peers\n" | |
5613 | "Soft reconfig\n" | |
5614 | "Soft reconfig inbound update\n") | |
5615 | ||
5616 | ALIAS (clear_bgp_all_soft_in, | |
5617 | clear_bgp_ipv6_all_soft_in_cmd, | |
5618 | "clear bgp ipv6 * soft in", | |
5619 | CLEAR_STR | |
5620 | BGP_STR | |
5621 | "Address family\n" | |
5622 | "Clear all peers\n" | |
5623 | "Soft reconfig\n" | |
5624 | "Soft reconfig inbound update\n") | |
5625 | ||
5626 | ALIAS (clear_bgp_all_soft_in, | |
5627 | clear_bgp_all_in_cmd, | |
5628 | "clear bgp * in", | |
5629 | CLEAR_STR | |
5630 | BGP_STR | |
5631 | "Clear all peers\n" | |
5632 | "Soft reconfig inbound update\n") | |
5633 | ||
5634 | ALIAS (clear_bgp_all_soft_in, | |
5635 | clear_bgp_ipv6_all_in_cmd, | |
5636 | "clear bgp ipv6 * in", | |
5637 | CLEAR_STR | |
5638 | BGP_STR | |
5639 | "Address family\n" | |
5640 | "Clear all peers\n" | |
5641 | "Soft reconfig inbound update\n") | |
5642 | ||
5643 | DEFUN (clear_bgp_all_in_prefix_filter, | |
5644 | clear_bgp_all_in_prefix_filter_cmd, | |
5645 | "clear bgp * in prefix-filter", | |
5646 | CLEAR_STR | |
5647 | BGP_STR | |
5648 | "Clear all peers\n" | |
5649 | "Soft reconfig inbound update\n" | |
5650 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5651 | { | |
5652 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
5653 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5654 | } | |
5655 | ||
5656 | ALIAS (clear_bgp_all_in_prefix_filter, | |
5657 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
5658 | "clear bgp ipv6 * in prefix-filter", | |
5659 | CLEAR_STR | |
5660 | BGP_STR | |
5661 | "Address family\n" | |
5662 | "Clear all peers\n" | |
5663 | "Soft reconfig inbound update\n" | |
5664 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5665 | ||
5666 | DEFUN (clear_ip_bgp_peer_soft_in, | |
5667 | clear_ip_bgp_peer_soft_in_cmd, | |
5668 | "clear ip bgp A.B.C.D soft in", | |
5669 | CLEAR_STR | |
5670 | IP_STR | |
5671 | BGP_STR | |
5672 | "BGP neighbor address to clear\n" | |
5673 | "Soft reconfig\n" | |
5674 | "Soft reconfig inbound update\n") | |
5675 | { | |
5676 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5677 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5678 | } | |
5679 | ||
5680 | ALIAS (clear_ip_bgp_peer_soft_in, | |
5681 | clear_ip_bgp_peer_in_cmd, | |
5682 | "clear ip bgp A.B.C.D in", | |
5683 | CLEAR_STR | |
5684 | IP_STR | |
5685 | BGP_STR | |
5686 | "BGP neighbor address to clear\n" | |
5687 | "Soft reconfig inbound update\n") | |
5688 | ||
5689 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, | |
5690 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
5691 | "clear ip bgp A.B.C.D in prefix-filter", | |
5692 | CLEAR_STR | |
5693 | IP_STR | |
5694 | BGP_STR | |
5695 | "BGP neighbor address to clear\n" | |
5696 | "Soft reconfig inbound update\n" | |
5697 | "Push out the existing ORF prefix-list\n") | |
5698 | { | |
5699 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5700 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5701 | } | |
5702 | ||
5703 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
5704 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
5705 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", | |
5706 | CLEAR_STR | |
5707 | IP_STR | |
5708 | BGP_STR | |
5709 | "BGP neighbor address to clear\n" | |
5710 | "Address family\n" | |
5711 | "Address Family modifier\n" | |
5712 | "Address Family modifier\n" | |
5713 | "Soft reconfig\n" | |
5714 | "Soft reconfig inbound update\n") | |
5715 | { | |
5716 | if (strncmp (argv[1], "m", 1) == 0) | |
5717 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
5718 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5719 | ||
5720 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5721 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5722 | } | |
5723 | ||
5724 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, | |
5725 | clear_ip_bgp_peer_ipv4_in_cmd, | |
5726 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", | |
5727 | CLEAR_STR | |
5728 | IP_STR | |
5729 | BGP_STR | |
5730 | "BGP neighbor address to clear\n" | |
5731 | "Address family\n" | |
5732 | "Address Family modifier\n" | |
5733 | "Address Family modifier\n" | |
5734 | "Soft reconfig inbound update\n") | |
5735 | ||
5736 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, | |
5737 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
5738 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", | |
5739 | CLEAR_STR | |
5740 | IP_STR | |
5741 | BGP_STR | |
5742 | "BGP neighbor address to clear\n" | |
5743 | "Address family\n" | |
5744 | "Address Family modifier\n" | |
5745 | "Address Family modifier\n" | |
5746 | "Soft reconfig inbound update\n" | |
5747 | "Push out the existing ORF prefix-list\n") | |
5748 | { | |
5749 | if (strncmp (argv[1], "m", 1) == 0) | |
5750 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
5751 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5752 | ||
5753 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5754 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5755 | } | |
5756 | ||
5757 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
5758 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
5759 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", | |
5760 | CLEAR_STR | |
5761 | IP_STR | |
5762 | BGP_STR | |
5763 | "BGP neighbor address to clear\n" | |
5764 | "Address family\n" | |
5765 | "Address Family Modifier\n" | |
5766 | "Soft reconfig\n" | |
5767 | "Soft reconfig inbound update\n") | |
5768 | { | |
5769 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
5770 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5771 | } | |
5772 | ||
5773 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
5774 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
5775 | "clear ip bgp A.B.C.D vpnv4 unicast in", | |
5776 | CLEAR_STR | |
5777 | IP_STR | |
5778 | BGP_STR | |
5779 | "BGP neighbor address to clear\n" | |
5780 | "Address family\n" | |
5781 | "Address Family Modifier\n" | |
5782 | "Soft reconfig inbound update\n") | |
5783 | ||
5784 | DEFUN (clear_bgp_peer_soft_in, | |
5785 | clear_bgp_peer_soft_in_cmd, | |
5786 | "clear bgp (A.B.C.D|X:X::X:X) soft in", | |
5787 | CLEAR_STR | |
5788 | BGP_STR | |
5789 | "BGP neighbor address to clear\n" | |
5790 | "BGP IPv6 neighbor to clear\n" | |
5791 | "Soft reconfig\n" | |
5792 | "Soft reconfig inbound update\n") | |
5793 | { | |
5794 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
5795 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5796 | } | |
5797 | ||
5798 | ALIAS (clear_bgp_peer_soft_in, | |
5799 | clear_bgp_ipv6_peer_soft_in_cmd, | |
5800 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", | |
5801 | CLEAR_STR | |
5802 | BGP_STR | |
5803 | "Address family\n" | |
5804 | "BGP neighbor address to clear\n" | |
5805 | "BGP IPv6 neighbor to clear\n" | |
5806 | "Soft reconfig\n" | |
5807 | "Soft reconfig inbound update\n") | |
5808 | ||
5809 | ALIAS (clear_bgp_peer_soft_in, | |
5810 | clear_bgp_peer_in_cmd, | |
5811 | "clear bgp (A.B.C.D|X:X::X:X) in", | |
5812 | CLEAR_STR | |
5813 | BGP_STR | |
5814 | "BGP neighbor address to clear\n" | |
5815 | "BGP IPv6 neighbor to clear\n" | |
5816 | "Soft reconfig inbound update\n") | |
5817 | ||
5818 | ALIAS (clear_bgp_peer_soft_in, | |
5819 | clear_bgp_ipv6_peer_in_cmd, | |
5820 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", | |
5821 | CLEAR_STR | |
5822 | BGP_STR | |
5823 | "Address family\n" | |
5824 | "BGP neighbor address to clear\n" | |
5825 | "BGP IPv6 neighbor to clear\n" | |
5826 | "Soft reconfig inbound update\n") | |
5827 | ||
5828 | DEFUN (clear_bgp_peer_in_prefix_filter, | |
5829 | clear_bgp_peer_in_prefix_filter_cmd, | |
5830 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", | |
5831 | CLEAR_STR | |
5832 | BGP_STR | |
5833 | "BGP neighbor address to clear\n" | |
5834 | "BGP IPv6 neighbor to clear\n" | |
5835 | "Soft reconfig inbound update\n" | |
5836 | "Push out the existing ORF prefix-list\n") | |
5837 | { | |
5838 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
5839 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5840 | } | |
5841 | ||
5842 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
5843 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
5844 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", | |
5845 | CLEAR_STR | |
5846 | BGP_STR | |
5847 | "Address family\n" | |
5848 | "BGP neighbor address to clear\n" | |
5849 | "BGP IPv6 neighbor to clear\n" | |
5850 | "Soft reconfig inbound update\n" | |
5851 | "Push out the existing ORF prefix-list\n") | |
5852 | ||
5853 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
5854 | clear_ip_bgp_peer_group_soft_in_cmd, | |
5855 | "clear ip bgp peer-group WORD soft in", | |
5856 | CLEAR_STR | |
5857 | IP_STR | |
5858 | BGP_STR | |
5859 | "Clear all members of peer-group\n" | |
5860 | "BGP peer-group name\n" | |
5861 | "Soft reconfig\n" | |
5862 | "Soft reconfig inbound update\n") | |
5863 | { | |
5864 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5865 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5866 | } | |
5867 | ||
5868 | ALIAS (clear_ip_bgp_peer_group_soft_in, | |
5869 | clear_ip_bgp_peer_group_in_cmd, | |
5870 | "clear ip bgp peer-group WORD in", | |
5871 | CLEAR_STR | |
5872 | IP_STR | |
5873 | BGP_STR | |
5874 | "Clear all members of peer-group\n" | |
5875 | "BGP peer-group name\n" | |
5876 | "Soft reconfig inbound update\n") | |
5877 | ||
5878 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, | |
5879 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
5880 | "clear ip bgp peer-group WORD in prefix-filter", | |
5881 | CLEAR_STR | |
5882 | IP_STR | |
5883 | BGP_STR | |
5884 | "Clear all members of peer-group\n" | |
5885 | "BGP peer-group name\n" | |
5886 | "Soft reconfig inbound update\n" | |
5887 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5888 | { | |
5889 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5890 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5891 | } | |
5892 | ||
5893 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
5894 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
5895 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
5896 | CLEAR_STR | |
5897 | IP_STR | |
5898 | BGP_STR | |
5899 | "Clear all members of peer-group\n" | |
5900 | "BGP peer-group name\n" | |
5901 | "Address family\n" | |
5902 | "Address Family modifier\n" | |
5903 | "Address Family modifier\n" | |
5904 | "Soft reconfig\n" | |
5905 | "Soft reconfig inbound update\n") | |
5906 | { | |
5907 | if (strncmp (argv[1], "m", 1) == 0) | |
5908 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
5909 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5910 | ||
5911 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5912 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5913 | } | |
5914 | ||
5915 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, | |
5916 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
5917 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
5918 | CLEAR_STR | |
5919 | IP_STR | |
5920 | BGP_STR | |
5921 | "Clear all members of peer-group\n" | |
5922 | "BGP peer-group name\n" | |
5923 | "Address family\n" | |
5924 | "Address Family modifier\n" | |
5925 | "Address Family modifier\n" | |
5926 | "Soft reconfig inbound update\n") | |
5927 | ||
5928 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, | |
5929 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
5930 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
5931 | CLEAR_STR | |
5932 | IP_STR | |
5933 | BGP_STR | |
5934 | "Clear all members of peer-group\n" | |
5935 | "BGP peer-group name\n" | |
5936 | "Address family\n" | |
5937 | "Address Family modifier\n" | |
5938 | "Address Family modifier\n" | |
5939 | "Soft reconfig inbound update\n" | |
5940 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5941 | { | |
5942 | if (strncmp (argv[1], "m", 1) == 0) | |
5943 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
5944 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5945 | ||
5946 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5947 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5948 | } | |
5949 | ||
5950 | DEFUN (clear_bgp_peer_group_soft_in, | |
5951 | clear_bgp_peer_group_soft_in_cmd, | |
5952 | "clear bgp peer-group WORD soft in", | |
5953 | CLEAR_STR | |
5954 | BGP_STR | |
5955 | "Clear all members of peer-group\n" | |
5956 | "BGP peer-group name\n" | |
5957 | "Soft reconfig\n" | |
5958 | "Soft reconfig inbound update\n") | |
5959 | { | |
5960 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
5961 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5962 | } | |
5963 | ||
5964 | ALIAS (clear_bgp_peer_group_soft_in, | |
5965 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
5966 | "clear bgp ipv6 peer-group WORD soft in", | |
5967 | CLEAR_STR | |
5968 | BGP_STR | |
5969 | "Address family\n" | |
5970 | "Clear all members of peer-group\n" | |
5971 | "BGP peer-group name\n" | |
5972 | "Soft reconfig\n" | |
5973 | "Soft reconfig inbound update\n") | |
5974 | ||
5975 | ALIAS (clear_bgp_peer_group_soft_in, | |
5976 | clear_bgp_peer_group_in_cmd, | |
5977 | "clear bgp peer-group WORD in", | |
5978 | CLEAR_STR | |
5979 | BGP_STR | |
5980 | "Clear all members of peer-group\n" | |
5981 | "BGP peer-group name\n" | |
5982 | "Soft reconfig inbound update\n") | |
5983 | ||
5984 | ALIAS (clear_bgp_peer_group_soft_in, | |
5985 | clear_bgp_ipv6_peer_group_in_cmd, | |
5986 | "clear bgp ipv6 peer-group WORD in", | |
5987 | CLEAR_STR | |
5988 | BGP_STR | |
5989 | "Address family\n" | |
5990 | "Clear all members of peer-group\n" | |
5991 | "BGP peer-group name\n" | |
5992 | "Soft reconfig inbound update\n") | |
5993 | ||
5994 | DEFUN (clear_bgp_peer_group_in_prefix_filter, | |
5995 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
5996 | "clear bgp peer-group WORD in prefix-filter", | |
5997 | CLEAR_STR | |
5998 | BGP_STR | |
5999 | "Clear all members of peer-group\n" | |
6000 | "BGP peer-group name\n" | |
6001 | "Soft reconfig inbound update\n" | |
6002 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6003 | { | |
6004 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6005 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6006 | } | |
6007 | ||
6008 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
6009 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
6010 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
6011 | CLEAR_STR | |
6012 | BGP_STR | |
6013 | "Address family\n" | |
6014 | "Clear all members of peer-group\n" | |
6015 | "BGP peer-group name\n" | |
6016 | "Soft reconfig inbound update\n" | |
6017 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6018 | ||
6019 | DEFUN (clear_ip_bgp_external_soft_in, | |
6020 | clear_ip_bgp_external_soft_in_cmd, | |
6021 | "clear ip bgp external soft in", | |
6022 | CLEAR_STR | |
6023 | IP_STR | |
6024 | BGP_STR | |
6025 | "Clear all external peers\n" | |
6026 | "Soft reconfig\n" | |
6027 | "Soft reconfig inbound update\n") | |
6028 | { | |
6029 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6030 | BGP_CLEAR_SOFT_IN, NULL); | |
6031 | } | |
6032 | ||
6033 | ALIAS (clear_ip_bgp_external_soft_in, | |
6034 | clear_ip_bgp_external_in_cmd, | |
6035 | "clear ip bgp external in", | |
6036 | CLEAR_STR | |
6037 | IP_STR | |
6038 | BGP_STR | |
6039 | "Clear all external peers\n" | |
6040 | "Soft reconfig inbound update\n") | |
6041 | ||
6042 | DEFUN (clear_ip_bgp_external_in_prefix_filter, | |
6043 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
6044 | "clear ip bgp external in prefix-filter", | |
6045 | CLEAR_STR | |
6046 | IP_STR | |
6047 | BGP_STR | |
6048 | "Clear all external peers\n" | |
6049 | "Soft reconfig inbound update\n" | |
6050 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6051 | { | |
6052 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6053 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6054 | } | |
6055 | ||
6056 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
6057 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
6058 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
6059 | CLEAR_STR | |
6060 | IP_STR | |
6061 | BGP_STR | |
6062 | "Clear all external peers\n" | |
6063 | "Address family\n" | |
6064 | "Address Family modifier\n" | |
6065 | "Address Family modifier\n" | |
6066 | "Soft reconfig\n" | |
6067 | "Soft reconfig inbound update\n") | |
6068 | { | |
6069 | if (strncmp (argv[0], "m", 1) == 0) | |
6070 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6071 | BGP_CLEAR_SOFT_IN, NULL); | |
6072 | ||
6073 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6074 | BGP_CLEAR_SOFT_IN, NULL); | |
6075 | } | |
6076 | ||
6077 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, | |
6078 | clear_ip_bgp_external_ipv4_in_cmd, | |
6079 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
6080 | CLEAR_STR | |
6081 | IP_STR | |
6082 | BGP_STR | |
6083 | "Clear all external peers\n" | |
6084 | "Address family\n" | |
6085 | "Address Family modifier\n" | |
6086 | "Address Family modifier\n" | |
6087 | "Soft reconfig inbound update\n") | |
6088 | ||
6089 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, | |
6090 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
6091 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
6092 | CLEAR_STR | |
6093 | IP_STR | |
6094 | BGP_STR | |
6095 | "Clear all external peers\n" | |
6096 | "Address family\n" | |
6097 | "Address Family modifier\n" | |
6098 | "Address Family modifier\n" | |
6099 | "Soft reconfig inbound update\n" | |
6100 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6101 | { | |
6102 | if (strncmp (argv[0], "m", 1) == 0) | |
6103 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6104 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6105 | ||
6106 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6107 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6108 | } | |
6109 | ||
6110 | DEFUN (clear_bgp_external_soft_in, | |
6111 | clear_bgp_external_soft_in_cmd, | |
6112 | "clear bgp external soft in", | |
6113 | CLEAR_STR | |
6114 | BGP_STR | |
6115 | "Clear all external peers\n" | |
6116 | "Soft reconfig\n" | |
6117 | "Soft reconfig inbound update\n") | |
6118 | { | |
6119 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6120 | BGP_CLEAR_SOFT_IN, NULL); | |
6121 | } | |
6122 | ||
6123 | ALIAS (clear_bgp_external_soft_in, | |
6124 | clear_bgp_ipv6_external_soft_in_cmd, | |
6125 | "clear bgp ipv6 external soft in", | |
6126 | CLEAR_STR | |
6127 | BGP_STR | |
6128 | "Address family\n" | |
6129 | "Clear all external peers\n" | |
6130 | "Soft reconfig\n" | |
6131 | "Soft reconfig inbound update\n") | |
6132 | ||
6133 | ALIAS (clear_bgp_external_soft_in, | |
6134 | clear_bgp_external_in_cmd, | |
6135 | "clear bgp external in", | |
6136 | CLEAR_STR | |
6137 | BGP_STR | |
6138 | "Clear all external peers\n" | |
6139 | "Soft reconfig inbound update\n") | |
6140 | ||
6141 | ALIAS (clear_bgp_external_soft_in, | |
6142 | clear_bgp_ipv6_external_in_cmd, | |
6143 | "clear bgp ipv6 external WORD in", | |
6144 | CLEAR_STR | |
6145 | BGP_STR | |
6146 | "Address family\n" | |
6147 | "Clear all external peers\n" | |
6148 | "Soft reconfig inbound update\n") | |
6149 | ||
6150 | DEFUN (clear_bgp_external_in_prefix_filter, | |
6151 | clear_bgp_external_in_prefix_filter_cmd, | |
6152 | "clear bgp external in prefix-filter", | |
6153 | CLEAR_STR | |
6154 | BGP_STR | |
6155 | "Clear all external peers\n" | |
6156 | "Soft reconfig inbound update\n" | |
6157 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6158 | { | |
6159 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6160 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
6161 | } | |
6162 | ||
6163 | ALIAS (clear_bgp_external_in_prefix_filter, | |
6164 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
6165 | "clear bgp ipv6 external in prefix-filter", | |
6166 | CLEAR_STR | |
6167 | BGP_STR | |
6168 | "Address family\n" | |
6169 | "Clear all external peers\n" | |
6170 | "Soft reconfig inbound update\n" | |
6171 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6172 | ||
6173 | DEFUN (clear_ip_bgp_as_soft_in, | |
6174 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 6175 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 6176 | CLEAR_STR |
6177 | IP_STR | |
6178 | BGP_STR | |
6179 | "Clear peers with the AS number\n" | |
6180 | "Soft reconfig\n" | |
6181 | "Soft reconfig inbound update\n") | |
6182 | { | |
6183 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6184 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6185 | } | |
6186 | ||
6187 | ALIAS (clear_ip_bgp_as_soft_in, | |
6188 | clear_ip_bgp_as_in_cmd, | |
320da874 | 6189 | "clear ip bgp " CMD_AS_RANGE " in", |
718e3744 | 6190 | CLEAR_STR |
6191 | IP_STR | |
6192 | BGP_STR | |
6193 | "Clear peers with the AS number\n" | |
6194 | "Soft reconfig inbound update\n") | |
6195 | ||
6196 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
6197 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 6198 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 6199 | CLEAR_STR |
6200 | IP_STR | |
6201 | BGP_STR | |
6202 | "Clear peers with the AS number\n" | |
6203 | "Soft reconfig inbound update\n" | |
6204 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6205 | { | |
6206 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6207 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6208 | } | |
6209 | ||
6210 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
6211 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 6212 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 6213 | CLEAR_STR |
6214 | IP_STR | |
6215 | BGP_STR | |
6216 | "Clear peers with the AS number\n" | |
6217 | "Address family\n" | |
6218 | "Address Family modifier\n" | |
6219 | "Address Family modifier\n" | |
6220 | "Soft reconfig\n" | |
6221 | "Soft reconfig inbound update\n") | |
6222 | { | |
6223 | if (strncmp (argv[1], "m", 1) == 0) | |
6224 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6225 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6226 | ||
6227 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6228 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6229 | } | |
6230 | ||
6231 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, | |
6232 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 6233 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 6234 | CLEAR_STR |
6235 | IP_STR | |
6236 | BGP_STR | |
6237 | "Clear peers with the AS number\n" | |
6238 | "Address family\n" | |
6239 | "Address Family modifier\n" | |
6240 | "Address Family modifier\n" | |
6241 | "Soft reconfig inbound update\n") | |
6242 | ||
6243 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, | |
6244 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 6245 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 6246 | CLEAR_STR |
6247 | IP_STR | |
6248 | BGP_STR | |
6249 | "Clear peers with the AS number\n" | |
6250 | "Address family\n" | |
6251 | "Address Family modifier\n" | |
6252 | "Address Family modifier\n" | |
6253 | "Soft reconfig inbound update\n" | |
6254 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6255 | { | |
6256 | if (strncmp (argv[1], "m", 1) == 0) | |
6257 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6258 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6259 | ||
6260 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6261 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6262 | } | |
6263 | ||
6264 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
6265 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 6266 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 6267 | CLEAR_STR |
6268 | IP_STR | |
6269 | BGP_STR | |
6270 | "Clear peers with the AS number\n" | |
6271 | "Address family\n" | |
6272 | "Address Family modifier\n" | |
6273 | "Soft reconfig\n" | |
6274 | "Soft reconfig inbound update\n") | |
6275 | { | |
6276 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
6277 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6278 | } | |
6279 | ||
6280 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
6281 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 6282 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 6283 | CLEAR_STR |
6284 | IP_STR | |
6285 | BGP_STR | |
6286 | "Clear peers with the AS number\n" | |
6287 | "Address family\n" | |
6288 | "Address Family modifier\n" | |
6289 | "Soft reconfig inbound update\n") | |
6290 | ||
6291 | DEFUN (clear_bgp_as_soft_in, | |
6292 | clear_bgp_as_soft_in_cmd, | |
320da874 | 6293 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 6294 | CLEAR_STR |
6295 | BGP_STR | |
6296 | "Clear peers with the AS number\n" | |
6297 | "Soft reconfig\n" | |
6298 | "Soft reconfig inbound update\n") | |
6299 | { | |
6300 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6301 | BGP_CLEAR_SOFT_IN, argv[0]); | |
6302 | } | |
6303 | ||
6304 | ALIAS (clear_bgp_as_soft_in, | |
6305 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 6306 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 6307 | CLEAR_STR |
6308 | BGP_STR | |
6309 | "Address family\n" | |
6310 | "Clear peers with the AS number\n" | |
6311 | "Soft reconfig\n" | |
6312 | "Soft reconfig inbound update\n") | |
6313 | ||
6314 | ALIAS (clear_bgp_as_soft_in, | |
6315 | clear_bgp_as_in_cmd, | |
320da874 | 6316 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 6317 | CLEAR_STR |
6318 | BGP_STR | |
6319 | "Clear peers with the AS number\n" | |
6320 | "Soft reconfig inbound update\n") | |
6321 | ||
6322 | ALIAS (clear_bgp_as_soft_in, | |
6323 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 6324 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 6325 | CLEAR_STR |
6326 | BGP_STR | |
6327 | "Address family\n" | |
6328 | "Clear peers with the AS number\n" | |
6329 | "Soft reconfig inbound update\n") | |
6330 | ||
6331 | DEFUN (clear_bgp_as_in_prefix_filter, | |
6332 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 6333 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 6334 | CLEAR_STR |
6335 | BGP_STR | |
6336 | "Clear peers with the AS number\n" | |
6337 | "Soft reconfig inbound update\n" | |
6338 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6339 | { | |
6340 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6341 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
6342 | } | |
6343 | ||
6344 | ALIAS (clear_bgp_as_in_prefix_filter, | |
6345 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 6346 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 6347 | CLEAR_STR |
6348 | BGP_STR | |
6349 | "Address family\n" | |
6350 | "Clear peers with the AS number\n" | |
6351 | "Soft reconfig inbound update\n" | |
6352 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
6b0655a2 | 6353 | |
718e3744 | 6354 | /* Both soft-reconfiguration */ |
6355 | DEFUN (clear_ip_bgp_all_soft, | |
6356 | clear_ip_bgp_all_soft_cmd, | |
6357 | "clear ip bgp * soft", | |
6358 | CLEAR_STR | |
6359 | IP_STR | |
6360 | BGP_STR | |
6361 | "Clear all peers\n" | |
6362 | "Soft reconfig\n") | |
6363 | { | |
6364 | if (argc == 1) | |
6365 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6366 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6367 | ||
6368 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6369 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6370 | } | |
6371 | ||
6372 | ALIAS (clear_ip_bgp_all_soft, | |
6373 | clear_ip_bgp_instance_all_soft_cmd, | |
6374 | "clear ip bgp view WORD * soft", | |
6375 | CLEAR_STR | |
6376 | IP_STR | |
6377 | BGP_STR | |
6378 | "BGP view\n" | |
6379 | "view name\n" | |
6380 | "Clear all peers\n" | |
6381 | "Soft reconfig\n") | |
6382 | ||
6383 | ||
6384 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
6385 | clear_ip_bgp_all_ipv4_soft_cmd, | |
6386 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
6387 | CLEAR_STR | |
6388 | IP_STR | |
6389 | BGP_STR | |
6390 | "Clear all peers\n" | |
6391 | "Address family\n" | |
6392 | "Address Family Modifier\n" | |
6393 | "Address Family Modifier\n" | |
6394 | "Soft reconfig\n") | |
6395 | { | |
6396 | if (strncmp (argv[0], "m", 1) == 0) | |
6397 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6398 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6399 | ||
6400 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6401 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6402 | } | |
6403 | ||
6404 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
6405 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
6406 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", | |
6407 | CLEAR_STR | |
6408 | IP_STR | |
6409 | BGP_STR | |
6410 | "BGP view\n" | |
6411 | "view name\n" | |
6412 | "Clear all peers\n" | |
6413 | "Address family\n" | |
6414 | "Address Family Modifier\n" | |
6415 | "Address Family Modifier\n" | |
6416 | "Soft reconfig\n") | |
6417 | { | |
6418 | if (strncmp (argv[1], "m", 1) == 0) | |
6419 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6420 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6421 | ||
6422 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6423 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6424 | } | |
6425 | ||
6426 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
6427 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
6428 | "clear ip bgp * vpnv4 unicast soft", | |
6429 | CLEAR_STR | |
6430 | IP_STR | |
6431 | BGP_STR | |
6432 | "Clear all peers\n" | |
6433 | "Address family\n" | |
6434 | "Address Family Modifier\n" | |
6435 | "Soft reconfig\n") | |
6436 | { | |
6437 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6438 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6439 | } | |
6440 | ||
6441 | DEFUN (clear_bgp_all_soft, | |
6442 | clear_bgp_all_soft_cmd, | |
6443 | "clear bgp * soft", | |
6444 | CLEAR_STR | |
6445 | BGP_STR | |
6446 | "Clear all peers\n" | |
6447 | "Soft reconfig\n") | |
6448 | { | |
6449 | if (argc == 1) | |
6450 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6451 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6452 | ||
6453 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6454 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6455 | } | |
6456 | ||
6457 | ALIAS (clear_bgp_all_soft, | |
6458 | clear_bgp_instance_all_soft_cmd, | |
6459 | "clear bgp view WORD * soft", | |
6460 | CLEAR_STR | |
6461 | BGP_STR | |
6462 | "BGP view\n" | |
6463 | "view name\n" | |
6464 | "Clear all peers\n" | |
6465 | "Soft reconfig\n") | |
6466 | ||
6467 | ALIAS (clear_bgp_all_soft, | |
6468 | clear_bgp_ipv6_all_soft_cmd, | |
6469 | "clear bgp ipv6 * soft", | |
6470 | CLEAR_STR | |
6471 | BGP_STR | |
6472 | "Address family\n" | |
6473 | "Clear all peers\n" | |
6474 | "Soft reconfig\n") | |
6475 | ||
6476 | DEFUN (clear_ip_bgp_peer_soft, | |
6477 | clear_ip_bgp_peer_soft_cmd, | |
6478 | "clear ip bgp A.B.C.D soft", | |
6479 | CLEAR_STR | |
6480 | IP_STR | |
6481 | BGP_STR | |
6482 | "BGP neighbor address to clear\n" | |
6483 | "Soft reconfig\n") | |
6484 | { | |
6485 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6486 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6487 | } | |
6488 | ||
6489 | DEFUN (clear_ip_bgp_peer_ipv4_soft, | |
6490 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
6491 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", | |
6492 | CLEAR_STR | |
6493 | IP_STR | |
6494 | BGP_STR | |
6495 | "BGP neighbor address to clear\n" | |
6496 | "Address family\n" | |
6497 | "Address Family Modifier\n" | |
6498 | "Address Family Modifier\n" | |
6499 | "Soft reconfig\n") | |
6500 | { | |
6501 | if (strncmp (argv[1], "m", 1) == 0) | |
6502 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6503 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6504 | ||
6505 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6506 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6507 | } | |
6508 | ||
6509 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, | |
6510 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
6511 | "clear ip bgp A.B.C.D vpnv4 unicast soft", | |
6512 | CLEAR_STR | |
6513 | IP_STR | |
6514 | BGP_STR | |
6515 | "BGP neighbor address to clear\n" | |
6516 | "Address family\n" | |
6517 | "Address Family Modifier\n" | |
6518 | "Soft reconfig\n") | |
6519 | { | |
6520 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6521 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6522 | } | |
6523 | ||
6524 | DEFUN (clear_bgp_peer_soft, | |
6525 | clear_bgp_peer_soft_cmd, | |
6526 | "clear bgp (A.B.C.D|X:X::X:X) soft", | |
6527 | CLEAR_STR | |
6528 | BGP_STR | |
6529 | "BGP neighbor address to clear\n" | |
6530 | "BGP IPv6 neighbor to clear\n" | |
6531 | "Soft reconfig\n") | |
6532 | { | |
6533 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6534 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6535 | } | |
6536 | ||
6537 | ALIAS (clear_bgp_peer_soft, | |
6538 | clear_bgp_ipv6_peer_soft_cmd, | |
6539 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", | |
6540 | CLEAR_STR | |
6541 | BGP_STR | |
6542 | "Address family\n" | |
6543 | "BGP neighbor address to clear\n" | |
6544 | "BGP IPv6 neighbor to clear\n" | |
6545 | "Soft reconfig\n") | |
6546 | ||
6547 | DEFUN (clear_ip_bgp_peer_group_soft, | |
6548 | clear_ip_bgp_peer_group_soft_cmd, | |
6549 | "clear ip bgp peer-group WORD soft", | |
6550 | CLEAR_STR | |
6551 | IP_STR | |
6552 | BGP_STR | |
6553 | "Clear all members of peer-group\n" | |
6554 | "BGP peer-group name\n" | |
6555 | "Soft reconfig\n") | |
6556 | { | |
6557 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6558 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6559 | } | |
6560 | ||
6561 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, | |
6562 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
6563 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
6564 | CLEAR_STR | |
6565 | IP_STR | |
6566 | BGP_STR | |
6567 | "Clear all members of peer-group\n" | |
6568 | "BGP peer-group name\n" | |
6569 | "Address family\n" | |
6570 | "Address Family modifier\n" | |
6571 | "Address Family modifier\n" | |
6572 | "Soft reconfig\n") | |
6573 | { | |
6574 | if (strncmp (argv[1], "m", 1) == 0) | |
6575 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6576 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6577 | ||
6578 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6579 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6580 | } | |
6581 | ||
6582 | DEFUN (clear_bgp_peer_group_soft, | |
6583 | clear_bgp_peer_group_soft_cmd, | |
6584 | "clear bgp peer-group WORD soft", | |
6585 | CLEAR_STR | |
6586 | BGP_STR | |
6587 | "Clear all members of peer-group\n" | |
6588 | "BGP peer-group name\n" | |
6589 | "Soft reconfig\n") | |
6590 | { | |
6591 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6592 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6593 | } | |
6594 | ||
6595 | ALIAS (clear_bgp_peer_group_soft, | |
6596 | clear_bgp_ipv6_peer_group_soft_cmd, | |
6597 | "clear bgp ipv6 peer-group WORD soft", | |
6598 | CLEAR_STR | |
6599 | BGP_STR | |
6600 | "Address family\n" | |
6601 | "Clear all members of peer-group\n" | |
6602 | "BGP peer-group name\n" | |
6603 | "Soft reconfig\n") | |
6604 | ||
6605 | DEFUN (clear_ip_bgp_external_soft, | |
6606 | clear_ip_bgp_external_soft_cmd, | |
6607 | "clear ip bgp external soft", | |
6608 | CLEAR_STR | |
6609 | IP_STR | |
6610 | BGP_STR | |
6611 | "Clear all external peers\n" | |
6612 | "Soft reconfig\n") | |
6613 | { | |
6614 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6615 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6616 | } | |
6617 | ||
6618 | DEFUN (clear_ip_bgp_external_ipv4_soft, | |
6619 | clear_ip_bgp_external_ipv4_soft_cmd, | |
6620 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
6621 | CLEAR_STR | |
6622 | IP_STR | |
6623 | BGP_STR | |
6624 | "Clear all external peers\n" | |
6625 | "Address family\n" | |
6626 | "Address Family modifier\n" | |
6627 | "Address Family modifier\n" | |
6628 | "Soft reconfig\n") | |
6629 | { | |
6630 | if (strncmp (argv[0], "m", 1) == 0) | |
6631 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6632 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6633 | ||
6634 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6635 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6636 | } | |
6637 | ||
6638 | DEFUN (clear_bgp_external_soft, | |
6639 | clear_bgp_external_soft_cmd, | |
6640 | "clear bgp external soft", | |
6641 | CLEAR_STR | |
6642 | BGP_STR | |
6643 | "Clear all external peers\n" | |
6644 | "Soft reconfig\n") | |
6645 | { | |
6646 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6647 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6648 | } | |
6649 | ||
6650 | ALIAS (clear_bgp_external_soft, | |
6651 | clear_bgp_ipv6_external_soft_cmd, | |
6652 | "clear bgp ipv6 external soft", | |
6653 | CLEAR_STR | |
6654 | BGP_STR | |
6655 | "Address family\n" | |
6656 | "Clear all external peers\n" | |
6657 | "Soft reconfig\n") | |
6658 | ||
6659 | DEFUN (clear_ip_bgp_as_soft, | |
6660 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 6661 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 6662 | CLEAR_STR |
6663 | IP_STR | |
6664 | BGP_STR | |
6665 | "Clear peers with the AS number\n" | |
6666 | "Soft reconfig\n") | |
6667 | { | |
6668 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6669 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6670 | } | |
6671 | ||
6672 | DEFUN (clear_ip_bgp_as_ipv4_soft, | |
6673 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 6674 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 6675 | CLEAR_STR |
6676 | IP_STR | |
6677 | BGP_STR | |
6678 | "Clear peers with the AS number\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_as, | |
6686 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6687 | ||
6688 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
6689 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6690 | } | |
6691 | ||
6692 | DEFUN (clear_ip_bgp_as_vpnv4_soft, | |
6693 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 6694 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 6695 | CLEAR_STR |
6696 | IP_STR | |
6697 | BGP_STR | |
6698 | "Clear peers with the AS number\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_as, | |
6704 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6705 | } | |
6706 | ||
6707 | DEFUN (clear_bgp_as_soft, | |
6708 | clear_bgp_as_soft_cmd, | |
320da874 | 6709 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 6710 | CLEAR_STR |
6711 | BGP_STR | |
6712 | "Clear peers with the AS number\n" | |
6713 | "Soft reconfig\n") | |
6714 | { | |
6715 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6716 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6717 | } | |
6718 | ||
6719 | ALIAS (clear_bgp_as_soft, | |
6720 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 6721 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 6722 | CLEAR_STR |
6723 | BGP_STR | |
6724 | "Address family\n" | |
6725 | "Clear peers with the AS number\n" | |
6726 | "Soft reconfig\n") | |
6b0655a2 | 6727 | |
fee0f4c6 | 6728 | /* RS-client soft reconfiguration. */ |
6729 | #ifdef HAVE_IPV6 | |
6730 | DEFUN (clear_bgp_all_rsclient, | |
6731 | clear_bgp_all_rsclient_cmd, | |
6732 | "clear bgp * rsclient", | |
6733 | CLEAR_STR | |
6734 | BGP_STR | |
6735 | "Clear all peers\n" | |
6736 | "Soft reconfig for rsclient RIB\n") | |
6737 | { | |
6738 | if (argc == 1) | |
6739 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6740 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6741 | ||
6742 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6743 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6744 | } | |
6745 | ||
6746 | ALIAS (clear_bgp_all_rsclient, | |
6747 | clear_bgp_ipv6_all_rsclient_cmd, | |
6748 | "clear bgp ipv6 * rsclient", | |
6749 | CLEAR_STR | |
6750 | BGP_STR | |
6751 | "Address family\n" | |
6752 | "Clear all peers\n" | |
6753 | "Soft reconfig for rsclient RIB\n") | |
6754 | ||
6755 | ALIAS (clear_bgp_all_rsclient, | |
6756 | clear_bgp_instance_all_rsclient_cmd, | |
6757 | "clear bgp view WORD * rsclient", | |
6758 | CLEAR_STR | |
6759 | BGP_STR | |
6760 | "BGP view\n" | |
6761 | "view name\n" | |
6762 | "Clear all peers\n" | |
6763 | "Soft reconfig for rsclient RIB\n") | |
6764 | ||
6765 | ALIAS (clear_bgp_all_rsclient, | |
6766 | clear_bgp_ipv6_instance_all_rsclient_cmd, | |
6767 | "clear bgp ipv6 view WORD * rsclient", | |
6768 | CLEAR_STR | |
6769 | BGP_STR | |
6770 | "Address family\n" | |
6771 | "BGP view\n" | |
6772 | "view name\n" | |
6773 | "Clear all peers\n" | |
6774 | "Soft reconfig for rsclient RIB\n") | |
6775 | #endif /* HAVE_IPV6 */ | |
6776 | ||
6777 | DEFUN (clear_ip_bgp_all_rsclient, | |
6778 | clear_ip_bgp_all_rsclient_cmd, | |
6779 | "clear ip bgp * rsclient", | |
6780 | CLEAR_STR | |
6781 | IP_STR | |
6782 | BGP_STR | |
6783 | "Clear all peers\n" | |
6784 | "Soft reconfig for rsclient RIB\n") | |
6785 | { | |
6786 | if (argc == 1) | |
6787 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6788 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6789 | ||
6790 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6791 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6792 | } | |
6793 | ||
6794 | ALIAS (clear_ip_bgp_all_rsclient, | |
6795 | clear_ip_bgp_instance_all_rsclient_cmd, | |
6796 | "clear ip bgp view WORD * rsclient", | |
6797 | CLEAR_STR | |
6798 | IP_STR | |
6799 | BGP_STR | |
6800 | "BGP view\n" | |
6801 | "view name\n" | |
6802 | "Clear all peers\n" | |
6803 | "Soft reconfig for rsclient RIB\n") | |
6804 | ||
6805 | #ifdef HAVE_IPV6 | |
6806 | DEFUN (clear_bgp_peer_rsclient, | |
6807 | clear_bgp_peer_rsclient_cmd, | |
6808 | "clear bgp (A.B.C.D|X:X::X:X) rsclient", | |
6809 | CLEAR_STR | |
6810 | BGP_STR | |
6811 | "BGP neighbor IP address to clear\n" | |
6812 | "BGP IPv6 neighbor to clear\n" | |
6813 | "Soft reconfig for rsclient RIB\n") | |
6814 | { | |
6815 | if (argc == 2) | |
6816 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, | |
6817 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
6818 | ||
6819 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6820 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
6821 | } | |
6822 | ||
6823 | ALIAS (clear_bgp_peer_rsclient, | |
6824 | clear_bgp_ipv6_peer_rsclient_cmd, | |
6825 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient", | |
6826 | CLEAR_STR | |
6827 | BGP_STR | |
6828 | "Address family\n" | |
6829 | "BGP neighbor IP address to clear\n" | |
6830 | "BGP IPv6 neighbor to clear\n" | |
6831 | "Soft reconfig for rsclient RIB\n") | |
6832 | ||
6833 | ALIAS (clear_bgp_peer_rsclient, | |
6834 | clear_bgp_instance_peer_rsclient_cmd, | |
6835 | "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient", | |
6836 | CLEAR_STR | |
6837 | BGP_STR | |
6838 | "BGP view\n" | |
6839 | "view name\n" | |
6840 | "BGP neighbor IP address to clear\n" | |
6841 | "BGP IPv6 neighbor to clear\n" | |
6842 | "Soft reconfig for rsclient RIB\n") | |
6843 | ||
6844 | ALIAS (clear_bgp_peer_rsclient, | |
6845 | clear_bgp_ipv6_instance_peer_rsclient_cmd, | |
6846 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient", | |
6847 | CLEAR_STR | |
6848 | BGP_STR | |
6849 | "Address family\n" | |
6850 | "BGP view\n" | |
6851 | "view name\n" | |
6852 | "BGP neighbor IP address to clear\n" | |
6853 | "BGP IPv6 neighbor to clear\n" | |
6854 | "Soft reconfig for rsclient RIB\n") | |
6855 | #endif /* HAVE_IPV6 */ | |
6856 | ||
6857 | DEFUN (clear_ip_bgp_peer_rsclient, | |
6858 | clear_ip_bgp_peer_rsclient_cmd, | |
6859 | "clear ip bgp (A.B.C.D|X:X::X:X) rsclient", | |
6860 | CLEAR_STR | |
6861 | IP_STR | |
6862 | BGP_STR | |
6863 | "BGP neighbor IP address to clear\n" | |
6864 | "BGP IPv6 neighbor to clear\n" | |
6865 | "Soft reconfig for rsclient RIB\n") | |
6866 | { | |
6867 | if (argc == 2) | |
6868 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, | |
6869 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
6870 | ||
6871 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6872 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
6873 | } | |
6874 | ||
6875 | ALIAS (clear_ip_bgp_peer_rsclient, | |
6876 | clear_ip_bgp_instance_peer_rsclient_cmd, | |
6877 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient", | |
6878 | CLEAR_STR | |
6879 | IP_STR | |
6880 | BGP_STR | |
6881 | "BGP view\n" | |
6882 | "view name\n" | |
6883 | "BGP neighbor IP address to clear\n" | |
6884 | "BGP IPv6 neighbor to clear\n" | |
6885 | "Soft reconfig for rsclient RIB\n") | |
6886 | ||
e0081f70 ML |
6887 | DEFUN (show_bgp_views, |
6888 | show_bgp_views_cmd, | |
6889 | "show bgp views", | |
6890 | SHOW_STR | |
6891 | BGP_STR | |
6892 | "Show the defined BGP views\n") | |
6893 | { | |
6894 | struct list *inst = bm->bgp; | |
6895 | struct listnode *node; | |
6896 | struct bgp *bgp; | |
6897 | ||
6898 | if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) | |
6899 | { | |
6900 | vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE); | |
6901 | return CMD_WARNING; | |
6902 | } | |
6903 | ||
6904 | vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE); | |
6905 | for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) | |
6906 | vty_out (vty, "\t%s (AS%u)%s", | |
6907 | bgp->name ? bgp->name : "(null)", | |
6908 | bgp->as, VTY_NEWLINE); | |
6909 | ||
6910 | return CMD_SUCCESS; | |
6911 | } | |
6912 | ||
4bf6a362 PJ |
6913 | DEFUN (show_bgp_memory, |
6914 | show_bgp_memory_cmd, | |
6915 | "show bgp memory", | |
6916 | SHOW_STR | |
6917 | BGP_STR | |
6918 | "Global BGP memory statistics\n") | |
6919 | { | |
6920 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
6921 | unsigned long count; | |
6922 | ||
6923 | /* RIB related usage stats */ | |
6924 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
6925 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
6926 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6927 | count * sizeof (struct bgp_node)), | |
6928 | VTY_NEWLINE); | |
6929 | ||
6930 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
6931 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
6932 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6933 | count * sizeof (struct bgp_info)), | |
6934 | VTY_NEWLINE); | |
fb982c25 PJ |
6935 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
6936 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
6937 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6938 | count * sizeof (struct bgp_info_extra)), | |
6939 | VTY_NEWLINE); | |
4bf6a362 PJ |
6940 | |
6941 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
6942 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
6943 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6944 | count * sizeof (struct bgp_static)), | |
6945 | VTY_NEWLINE); | |
6946 | ||
6947 | /* Adj-In/Out */ | |
6948 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
6949 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
6950 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6951 | count * sizeof (struct bgp_adj_in)), | |
6952 | VTY_NEWLINE); | |
6953 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
6954 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
6955 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6956 | count * sizeof (struct bgp_adj_out)), | |
6957 | VTY_NEWLINE); | |
6958 | ||
6959 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
6960 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
6961 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6962 | count * sizeof (struct bgp_nexthop_cache)), | |
6963 | VTY_NEWLINE); | |
6964 | ||
6965 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
6966 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
6967 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6968 | count * sizeof (struct bgp_damp_info)), | |
6969 | VTY_NEWLINE); | |
6970 | ||
6971 | /* Attributes */ | |
6972 | count = attr_count(); | |
6973 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
6974 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6975 | count * sizeof(struct attr)), | |
6976 | VTY_NEWLINE); | |
fb982c25 PJ |
6977 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
6978 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
6979 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6980 | count * sizeof(struct attr_extra)), | |
6981 | VTY_NEWLINE); | |
4bf6a362 PJ |
6982 | |
6983 | if ((count = attr_unknown_count())) | |
6984 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
6985 | ||
6986 | /* AS_PATH attributes */ | |
6987 | count = aspath_count (); | |
6988 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
6989 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6990 | count * sizeof (struct aspath)), | |
6991 | VTY_NEWLINE); | |
6992 | ||
6993 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
6994 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
6995 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6996 | count * sizeof (struct assegment)), | |
6997 | VTY_NEWLINE); | |
6998 | ||
6999 | /* Other attributes */ | |
7000 | if ((count = community_count ())) | |
7001 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
7002 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7003 | count * sizeof (struct community)), | |
7004 | VTY_NEWLINE); | |
7005 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
7006 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
7007 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7008 | count * sizeof (struct ecommunity)), | |
7009 | VTY_NEWLINE); | |
7010 | ||
7011 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
7012 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
7013 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7014 | count * sizeof (struct cluster_list)), | |
7015 | VTY_NEWLINE); | |
7016 | ||
7017 | /* Peer related usage */ | |
7018 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
7019 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
7020 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7021 | count * sizeof (struct peer)), | |
7022 | VTY_NEWLINE); | |
7023 | ||
7024 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) | |
7025 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, | |
7026 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7027 | count * sizeof (struct peer_group)), | |
7028 | VTY_NEWLINE); | |
7029 | ||
7030 | /* Other */ | |
7031 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
7032 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
7033 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7034 | count * sizeof (struct hash)), | |
7035 | VTY_NEWLINE); | |
7036 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
7037 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
7038 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7039 | count * sizeof (struct hash_backet)), | |
7040 | VTY_NEWLINE); | |
7041 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
7042 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
7043 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7044 | count * sizeof (regex_t)), | |
7045 | VTY_NEWLINE); | |
7046 | return CMD_SUCCESS; | |
7047 | } | |
fee0f4c6 | 7048 | |
47fc97cc DS |
7049 | static int |
7050 | bgp_adj_out_count (struct peer *peer, int afi, int safi) | |
7051 | { | |
7052 | struct bgp_table *table; | |
7053 | struct bgp_node *rn; | |
7054 | struct bgp_adj_out *adj; | |
7055 | int count = 0; | |
7056 | ||
7057 | if (!peer) return(0); | |
7058 | ||
7059 | table = peer->bgp->rib[afi][safi]; | |
7060 | if (!table) return(0); | |
7061 | for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) | |
7062 | if (bgp_adj_out_lookup(peer, NULL, afi, safi, rn)) | |
7063 | count++; | |
7064 | return (count); | |
7065 | } | |
7066 | ||
718e3744 | 7067 | /* Show BGP peer's summary information. */ |
94f2b392 | 7068 | static int |
47fc97cc | 7069 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, char *delimit) |
718e3744 | 7070 | { |
7071 | struct peer *peer; | |
1eb8ef25 | 7072 | struct listnode *node, *nnode; |
4bf6a362 | 7073 | unsigned int count = 0; |
718e3744 | 7074 | char timebuf[BGP_UPTIME_LEN]; |
7075 | int len; | |
7076 | ||
7077 | /* Header string for each address family. */ | |
7078 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; | |
47fc97cc DS |
7079 | static char header_csv[] = "Neighbor, V, AS, MsgRcvd, MsgSent, TblVer, InQ, OutQ, Up/Down, State/PfxRcd, PfxAdv"; |
7080 | ||
1eb8ef25 | 7081 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 7082 | { |
7083 | if (peer->afc[afi][safi]) | |
7084 | { | |
47fc97cc DS |
7085 | if (delimit) |
7086 | { | |
7087 | if (!count) | |
7088 | { | |
7089 | vty_out (vty, "%s%s", header_csv, VTY_NEWLINE); | |
7090 | } | |
7091 | } | |
7092 | else if (!count) | |
4bf6a362 PJ |
7093 | { |
7094 | unsigned long ents; | |
7095 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
7096 | ||
7097 | /* Usage summary and header */ | |
7098 | vty_out (vty, | |
aea339f7 | 7099 | "BGP router identifier %s, local AS number %u%s", |
4bf6a362 | 7100 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); |
f188f2c4 DS |
7101 | if (bgp_update_delay_configured(bgp)) |
7102 | { | |
7103 | vty_out (vty, "Read-only mode update-delay limit: %d seconds%s", | |
7104 | bgp->v_update_delay, VTY_NEWLINE); | |
7105 | if (bgp->v_update_delay != bgp->v_establish_wait) | |
7106 | vty_out (vty, " Establish wait: %d seconds%s", | |
7107 | bgp->v_establish_wait, VTY_NEWLINE); | |
7108 | if (bgp_update_delay_active(bgp)) | |
7109 | { | |
7110 | vty_out (vty, " First neighbor established: %s%s", | |
7111 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
7112 | vty_out (vty, " Delay in progress%s", VTY_NEWLINE); | |
7113 | } | |
7114 | else | |
7115 | { | |
7116 | if (bgp->update_delay_over) | |
7117 | { | |
7118 | vty_out (vty, " First neighbor established: %s%s", | |
7119 | bgp->update_delay_begin_time, VTY_NEWLINE); | |
7120 | vty_out (vty, " Best-paths/updates resumed: %s%s", | |
7121 | bgp->update_delay_end_time, VTY_NEWLINE); | |
7122 | } | |
7123 | } | |
7124 | } | |
4bf6a362 PJ |
7125 | |
7126 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
7127 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
7128 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7129 | ents * sizeof (struct bgp_node)), | |
7130 | VTY_NEWLINE); | |
7131 | ||
7132 | /* Peer related usage */ | |
7133 | ents = listcount (bgp->peer); | |
7134 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
7135 | ents, | |
7136 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7137 | ents * sizeof (struct peer)), | |
7138 | VTY_NEWLINE); | |
7139 | ||
7140 | if ((ents = listcount (bgp->rsclient))) | |
7141 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", | |
7142 | ents, | |
7143 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7144 | ents * sizeof (struct peer)), | |
7145 | VTY_NEWLINE); | |
7146 | ||
7147 | if ((ents = listcount (bgp->group))) | |
7148 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
7149 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
7150 | ents * sizeof (struct peer_group)), | |
7151 | VTY_NEWLINE); | |
7152 | ||
7153 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
7154 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
7155 | vty_out (vty, "%s", VTY_NEWLINE); | |
7156 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
7157 | } | |
7158 | ||
718e3744 | 7159 | count++; |
7160 | ||
7161 | len = vty_out (vty, "%s", peer->host); | |
7162 | len = 16 - len; | |
7163 | if (len < 1) | |
7164 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
7165 | else | |
7166 | vty_out (vty, "%*s", len, " "); | |
7167 | ||
47fc97cc DS |
7168 | if (delimit) |
7169 | vty_out(vty, "%c", *delimit); | |
718e3744 | 7170 | |
47fc97cc | 7171 | vty_out (vty, "4 "); |
718e3744 | 7172 | |
47fc97cc DS |
7173 | if (delimit) |
7174 | vty_out(vty, "%c", *delimit); | |
7175 | ||
7176 | if (!delimit) | |
7177 | vty_out (vty, "%5u %7d %7d %8d %4d %4lu", | |
7178 | peer->as, | |
7179 | peer->open_in + peer->update_in + peer->keepalive_in | |
7180 | + peer->notify_in + peer->refresh_in | |
7181 | + peer->dynamic_cap_in, | |
7182 | peer->open_out + peer->update_out + peer->keepalive_out | |
7183 | + peer->notify_out + peer->refresh_out | |
7184 | + peer->dynamic_cap_out, | |
7185 | 0, | |
7186 | 0, | |
7187 | (unsigned long) peer->obuf->count); | |
7188 | else | |
7189 | vty_out (vty, "%5u %c %7d %c %7d %c %8d %c %4d %c %4lu %c", | |
7190 | peer->as, *delimit, | |
7191 | peer->open_in + peer->update_in + peer->keepalive_in | |
7192 | + peer->notify_in + peer->refresh_in | |
7193 | + peer->dynamic_cap_in, *delimit, | |
7194 | peer->open_out + peer->update_out + peer->keepalive_out | |
7195 | + peer->notify_out + peer->refresh_out | |
7196 | + peer->dynamic_cap_out, *delimit, | |
7197 | 0, *delimit, | |
7198 | 0, *delimit, | |
7199 | (unsigned long) peer->obuf->count, *delimit); | |
7200 | ||
7201 | vty_out (vty, "%8s", | |
718e3744 | 7202 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); |
47fc97cc DS |
7203 | if (delimit) |
7204 | vty_out(vty, "%c", *delimit); | |
718e3744 | 7205 | |
7206 | if (peer->status == Established) | |
718e3744 | 7207 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); |
718e3744 | 7208 | else |
7209 | { | |
7210 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
7211 | vty_out (vty, " Idle (Admin)"); | |
7212 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
7213 | vty_out (vty, " Idle (PfxCt)"); | |
7214 | else | |
7215 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
7216 | } | |
47fc97cc DS |
7217 | if (delimit) |
7218 | vty_out(vty, ", %d", bgp_adj_out_count(peer, afi, safi)); | |
718e3744 | 7219 | |
7220 | vty_out (vty, "%s", VTY_NEWLINE); | |
7221 | } | |
7222 | } | |
7223 | ||
7224 | if (count) | |
7225 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
7226 | count, VTY_NEWLINE); | |
7227 | else | |
7228 | vty_out (vty, "No %s neighbor is configured%s", | |
7229 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
f188f2c4 | 7230 | |
718e3744 | 7231 | return CMD_SUCCESS; |
7232 | } | |
7233 | ||
47fc97cc DS |
7234 | static int |
7235 | bgp_show_summary_vty (struct vty *vty, const char *name, | |
7236 | afi_t afi, safi_t safi, char *delimit) | |
718e3744 | 7237 | { |
7238 | struct bgp *bgp; | |
7239 | ||
7240 | if (name) | |
7241 | { | |
7242 | bgp = bgp_lookup_by_name (name); | |
47fc97cc | 7243 | |
718e3744 | 7244 | if (! bgp) |
7245 | { | |
47fc97cc | 7246 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); |
718e3744 | 7247 | return CMD_WARNING; |
7248 | } | |
7249 | ||
47fc97cc | 7250 | bgp_show_summary (vty, bgp, afi, safi, delimit); |
718e3744 | 7251 | return CMD_SUCCESS; |
7252 | } | |
47fc97cc | 7253 | |
718e3744 | 7254 | bgp = bgp_get_default (); |
7255 | ||
7256 | if (bgp) | |
47fc97cc DS |
7257 | bgp_show_summary (vty, bgp, afi, safi, delimit); |
7258 | ||
718e3744 | 7259 | return CMD_SUCCESS; |
7260 | } | |
7261 | ||
7262 | /* `show ip bgp summary' commands. */ | |
47fc97cc | 7263 | DEFUN (show_ip_bgp_summary, |
718e3744 | 7264 | show_ip_bgp_summary_cmd, |
7265 | "show ip bgp summary", | |
7266 | SHOW_STR | |
7267 | IP_STR | |
7268 | BGP_STR | |
7269 | "Summary of BGP neighbor status\n") | |
7270 | { | |
47fc97cc DS |
7271 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, NULL); |
7272 | } | |
7273 | ||
7274 | DEFUN (show_ip_bgp_summary_csv, | |
7275 | show_ip_bgp_summary_csv_cmd, | |
7276 | "show ip bgp summary csv", | |
7277 | SHOW_STR | |
7278 | IP_STR | |
7279 | BGP_STR | |
7280 | "Summary of BGP neighbor status\n") | |
7281 | { | |
7282 | char csv = ','; | |
7283 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, &csv); | |
718e3744 | 7284 | } |
7285 | ||
7286 | DEFUN (show_ip_bgp_instance_summary, | |
7287 | show_ip_bgp_instance_summary_cmd, | |
7288 | "show ip bgp view WORD summary", | |
7289 | SHOW_STR | |
7290 | IP_STR | |
7291 | BGP_STR | |
7292 | "BGP view\n" | |
7293 | "View name\n" | |
7294 | "Summary of BGP neighbor status\n") | |
7295 | { | |
47fc97cc | 7296 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, NULL); |
718e3744 | 7297 | } |
7298 | ||
7299 | DEFUN (show_ip_bgp_ipv4_summary, | |
7300 | show_ip_bgp_ipv4_summary_cmd, | |
7301 | "show ip bgp ipv4 (unicast|multicast) summary", | |
7302 | SHOW_STR | |
7303 | IP_STR | |
7304 | BGP_STR | |
7305 | "Address family\n" | |
7306 | "Address Family modifier\n" | |
7307 | "Address Family modifier\n" | |
7308 | "Summary of BGP neighbor status\n") | |
7309 | { | |
7310 | if (strncmp (argv[0], "m", 1) == 0) | |
47fc97cc | 7311 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, NULL); |
718e3744 | 7312 | |
47fc97cc | 7313 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, NULL); |
718e3744 | 7314 | } |
7315 | ||
95cbbd2a ML |
7316 | ALIAS (show_ip_bgp_ipv4_summary, |
7317 | show_bgp_ipv4_safi_summary_cmd, | |
7318 | "show bgp ipv4 (unicast|multicast) summary", | |
7319 | SHOW_STR | |
7320 | BGP_STR | |
7321 | "Address family\n" | |
7322 | "Address Family modifier\n" | |
7323 | "Address Family modifier\n" | |
7324 | "Summary of BGP neighbor status\n") | |
7325 | ||
718e3744 | 7326 | DEFUN (show_ip_bgp_instance_ipv4_summary, |
7327 | show_ip_bgp_instance_ipv4_summary_cmd, | |
7328 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", | |
7329 | SHOW_STR | |
7330 | IP_STR | |
7331 | BGP_STR | |
7332 | "BGP view\n" | |
7333 | "View name\n" | |
7334 | "Address family\n" | |
7335 | "Address Family modifier\n" | |
7336 | "Address Family modifier\n" | |
7337 | "Summary of BGP neighbor status\n") | |
7338 | { | |
7339 | if (strncmp (argv[1], "m", 1) == 0) | |
47fc97cc | 7340 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, NULL); |
718e3744 | 7341 | else |
47fc97cc | 7342 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, NULL); |
718e3744 | 7343 | } |
7344 | ||
95cbbd2a ML |
7345 | ALIAS (show_ip_bgp_instance_ipv4_summary, |
7346 | show_bgp_instance_ipv4_safi_summary_cmd, | |
7347 | "show bgp view WORD ipv4 (unicast|multicast) summary", | |
7348 | SHOW_STR | |
7349 | BGP_STR | |
7350 | "BGP view\n" | |
7351 | "View name\n" | |
7352 | "Address family\n" | |
7353 | "Address Family modifier\n" | |
7354 | "Address Family modifier\n" | |
7355 | "Summary of BGP neighbor status\n") | |
7356 | ||
718e3744 | 7357 | DEFUN (show_ip_bgp_vpnv4_all_summary, |
7358 | show_ip_bgp_vpnv4_all_summary_cmd, | |
7359 | "show ip bgp vpnv4 all summary", | |
7360 | SHOW_STR | |
7361 | IP_STR | |
7362 | BGP_STR | |
7363 | "Display VPNv4 NLRI specific information\n" | |
7364 | "Display information about all VPNv4 NLRIs\n" | |
7365 | "Summary of BGP neighbor status\n") | |
7366 | { | |
47fc97cc | 7367 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, NULL); |
718e3744 | 7368 | } |
7369 | ||
7370 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
7371 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
7372 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", | |
7373 | SHOW_STR | |
7374 | IP_STR | |
7375 | BGP_STR | |
7376 | "Display VPNv4 NLRI specific information\n" | |
7377 | "Display information for a route distinguisher\n" | |
7378 | "VPN Route Distinguisher\n" | |
7379 | "Summary of BGP neighbor status\n") | |
7380 | { | |
7381 | int ret; | |
7382 | struct prefix_rd prd; | |
7383 | ||
7384 | ret = str2prefix_rd (argv[0], &prd); | |
7385 | if (! ret) | |
7386 | { | |
7387 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
7388 | return CMD_WARNING; | |
7389 | } | |
7390 | ||
47fc97cc | 7391 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, NULL); |
718e3744 | 7392 | } |
7393 | ||
7394 | #ifdef HAVE_IPV6 | |
47fc97cc | 7395 | DEFUN (show_bgp_summary, |
718e3744 | 7396 | show_bgp_summary_cmd, |
7397 | "show bgp summary", | |
7398 | SHOW_STR | |
7399 | BGP_STR | |
7400 | "Summary of BGP neighbor status\n") | |
7401 | { | |
47fc97cc DS |
7402 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, NULL); |
7403 | } | |
7404 | ||
7405 | DEFUN (show_bgp_summary_csv, | |
7406 | show_bgp_summary_csv_cmd, | |
7407 | "show bgp summary csv", | |
7408 | SHOW_STR | |
7409 | BGP_STR | |
7410 | "Summary of BGP neighbor status\n") | |
7411 | { | |
7412 | char csv = ','; | |
7413 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, &csv); | |
718e3744 | 7414 | } |
7415 | ||
7416 | DEFUN (show_bgp_instance_summary, | |
7417 | show_bgp_instance_summary_cmd, | |
7418 | "show bgp view WORD summary", | |
7419 | SHOW_STR | |
7420 | BGP_STR | |
7421 | "BGP view\n" | |
7422 | "View name\n" | |
7423 | "Summary of BGP neighbor status\n") | |
7424 | { | |
47fc97cc | 7425 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, NULL); |
718e3744 | 7426 | } |
7427 | ||
7428 | ALIAS (show_bgp_summary, | |
7429 | show_bgp_ipv6_summary_cmd, | |
7430 | "show bgp ipv6 summary", | |
7431 | SHOW_STR | |
7432 | BGP_STR | |
7433 | "Address family\n" | |
7434 | "Summary of BGP neighbor status\n") | |
7435 | ||
7436 | ALIAS (show_bgp_instance_summary, | |
7437 | show_bgp_instance_ipv6_summary_cmd, | |
7438 | "show bgp view WORD ipv6 summary", | |
7439 | SHOW_STR | |
7440 | BGP_STR | |
7441 | "BGP view\n" | |
7442 | "View name\n" | |
7443 | "Address family\n" | |
7444 | "Summary of BGP neighbor status\n") | |
7445 | ||
95cbbd2a ML |
7446 | DEFUN (show_bgp_ipv6_safi_summary, |
7447 | show_bgp_ipv6_safi_summary_cmd, | |
7448 | "show bgp ipv6 (unicast|multicast) summary", | |
7449 | SHOW_STR | |
7450 | BGP_STR | |
7451 | "Address family\n" | |
7452 | "Address Family modifier\n" | |
7453 | "Address Family modifier\n" | |
7454 | "Summary of BGP neighbor status\n") | |
7455 | { | |
7456 | if (strncmp (argv[0], "m", 1) == 0) | |
47fc97cc | 7457 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, NULL); |
95cbbd2a | 7458 | |
47fc97cc | 7459 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, NULL); |
95cbbd2a ML |
7460 | } |
7461 | ||
7462 | DEFUN (show_bgp_instance_ipv6_safi_summary, | |
7463 | show_bgp_instance_ipv6_safi_summary_cmd, | |
7464 | "show bgp view WORD ipv6 (unicast|multicast) summary", | |
7465 | SHOW_STR | |
7466 | BGP_STR | |
7467 | "BGP view\n" | |
7468 | "View name\n" | |
7469 | "Address family\n" | |
7470 | "Address Family modifier\n" | |
7471 | "Address Family modifier\n" | |
7472 | "Summary of BGP neighbor status\n") | |
7473 | { | |
7474 | if (strncmp (argv[1], "m", 1) == 0) | |
47fc97cc | 7475 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST, NULL); |
95cbbd2a | 7476 | |
47fc97cc | 7477 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, NULL); |
95cbbd2a ML |
7478 | } |
7479 | ||
718e3744 | 7480 | /* old command */ |
7481 | DEFUN (show_ipv6_bgp_summary, | |
7482 | show_ipv6_bgp_summary_cmd, | |
7483 | "show ipv6 bgp summary", | |
7484 | SHOW_STR | |
7485 | IPV6_STR | |
7486 | BGP_STR | |
7487 | "Summary of BGP neighbor status\n") | |
7488 | { | |
47fc97cc | 7489 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, NULL); |
718e3744 | 7490 | } |
7491 | ||
7492 | /* old command */ | |
7493 | DEFUN (show_ipv6_mbgp_summary, | |
7494 | show_ipv6_mbgp_summary_cmd, | |
7495 | "show ipv6 mbgp summary", | |
7496 | SHOW_STR | |
7497 | IPV6_STR | |
7498 | MBGP_STR | |
7499 | "Summary of BGP neighbor status\n") | |
7500 | { | |
47fc97cc | 7501 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, NULL); |
718e3744 | 7502 | } |
7503 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 7504 | |
fd79ac91 | 7505 | const char * |
538621f2 | 7506 | afi_safi_print (afi_t afi, safi_t safi) |
7507 | { | |
7508 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
7509 | return "IPv4 Unicast"; | |
7510 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
7511 | return "IPv4 Multicast"; | |
7512 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
7513 | return "VPNv4 Unicast"; | |
7514 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) | |
7515 | return "IPv6 Unicast"; | |
7516 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
7517 | return "IPv6 Multicast"; | |
7518 | else | |
7519 | return "Unknown"; | |
7520 | } | |
7521 | ||
718e3744 | 7522 | /* Show BGP peer's information. */ |
7523 | enum show_type | |
7524 | { | |
7525 | show_all, | |
7526 | show_peer | |
7527 | }; | |
7528 | ||
94f2b392 | 7529 | static void |
718e3744 | 7530 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
7531 | afi_t afi, safi_t safi, | |
7532 | u_int16_t adv_smcap, u_int16_t adv_rmcap, | |
7533 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) | |
7534 | { | |
7535 | /* Send-Mode */ | |
7536 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
7537 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
7538 | { | |
7539 | vty_out (vty, " Send-mode: "); | |
7540 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
7541 | vty_out (vty, "advertised"); | |
7542 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
7543 | vty_out (vty, "%sreceived", | |
7544 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
7545 | ", " : ""); | |
7546 | vty_out (vty, "%s", VTY_NEWLINE); | |
7547 | } | |
7548 | ||
7549 | /* Receive-Mode */ | |
7550 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
7551 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
7552 | { | |
7553 | vty_out (vty, " Receive-mode: "); | |
7554 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
7555 | vty_out (vty, "advertised"); | |
7556 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
7557 | vty_out (vty, "%sreceived", | |
7558 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
7559 | ", " : ""); | |
7560 | vty_out (vty, "%s", VTY_NEWLINE); | |
7561 | } | |
7562 | } | |
7563 | ||
94f2b392 | 7564 | static void |
718e3744 | 7565 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
7566 | { | |
7567 | struct bgp_filter *filter; | |
7568 | char orf_pfx_name[BUFSIZ]; | |
7569 | int orf_pfx_count; | |
7570 | ||
7571 | filter = &p->filter[afi][safi]; | |
7572 | ||
538621f2 | 7573 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
718e3744 | 7574 | VTY_NEWLINE); |
538621f2 | 7575 | |
718e3744 | 7576 | if (p->af_group[afi][safi]) |
7577 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); | |
7578 | ||
7579 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
7580 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
7581 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
7582 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
7583 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
7584 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
7585 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
7586 | ||
7587 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
7588 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
7589 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
7590 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
7591 | { | |
7592 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
7593 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
7594 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
7595 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
7596 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
7597 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
7598 | PEER_CAP_ORF_PREFIX_RM_RCV); | |
7599 | } | |
7600 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
7601 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
7602 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
7603 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
7604 | { | |
7605 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
7606 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
7607 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
7608 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
7609 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
7610 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
7611 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); | |
7612 | } | |
7613 | ||
7614 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
7615 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); | |
7616 | ||
7617 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
7618 | || orf_pfx_count) | |
7619 | { | |
7620 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
7621 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
7622 | vty_out (vty, " sent;"); | |
7623 | if (orf_pfx_count) | |
7624 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
7625 | vty_out (vty, "%s", VTY_NEWLINE); | |
7626 | } | |
7627 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
7628 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
7629 | ||
7630 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
7631 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
7632 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
7633 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
7634 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
7635 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
7636 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) | |
7637 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); | |
7638 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) | |
7639 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); | |
7640 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
7641 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
7642 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
7643 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
7644 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
7645 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
7646 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
7647 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
7648 | { | |
7649 | vty_out (vty, " Community attribute sent to this neighbor"); | |
7650 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
7651 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
538621f2 | 7652 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
718e3744 | 7653 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
538621f2 | 7654 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
718e3744 | 7655 | else |
538621f2 | 7656 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
718e3744 | 7657 | } |
7658 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
7659 | { | |
7660 | vty_out (vty, " Default information originate,"); | |
7661 | ||
7662 | if (p->default_rmap[afi][safi].name) | |
7663 | vty_out (vty, " default route-map %s%s,", | |
7664 | p->default_rmap[afi][safi].map ? "*" : "", | |
7665 | p->default_rmap[afi][safi].name); | |
7666 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) | |
7667 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
7668 | else | |
7669 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
7670 | } | |
7671 | ||
7672 | if (filter->plist[FILTER_IN].name | |
7673 | || filter->dlist[FILTER_IN].name | |
7674 | || filter->aslist[FILTER_IN].name | |
fee0f4c6 | 7675 | || filter->map[RMAP_IN].name) |
718e3744 | 7676 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
7677 | if (filter->plist[FILTER_OUT].name | |
7678 | || filter->dlist[FILTER_OUT].name | |
7679 | || filter->aslist[FILTER_OUT].name | |
fee0f4c6 | 7680 | || filter->map[RMAP_OUT].name |
718e3744 | 7681 | || filter->usmap.name) |
7682 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
fee0f4c6 | 7683 | if (filter->map[RMAP_IMPORT].name) |
7684 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); | |
7685 | if (filter->map[RMAP_EXPORT].name) | |
7686 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); | |
718e3744 | 7687 | |
7688 | /* prefix-list */ | |
7689 | if (filter->plist[FILTER_IN].name) | |
7690 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
7691 | filter->plist[FILTER_IN].plist ? "*" : "", | |
7692 | filter->plist[FILTER_IN].name, | |
7693 | VTY_NEWLINE); | |
7694 | if (filter->plist[FILTER_OUT].name) | |
7695 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
7696 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
7697 | filter->plist[FILTER_OUT].name, | |
7698 | VTY_NEWLINE); | |
7699 | ||
7700 | /* distribute-list */ | |
7701 | if (filter->dlist[FILTER_IN].name) | |
7702 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
7703 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
7704 | filter->dlist[FILTER_IN].name, | |
7705 | VTY_NEWLINE); | |
7706 | if (filter->dlist[FILTER_OUT].name) | |
7707 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
7708 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
7709 | filter->dlist[FILTER_OUT].name, | |
7710 | VTY_NEWLINE); | |
7711 | ||
7712 | /* filter-list. */ | |
7713 | if (filter->aslist[FILTER_IN].name) | |
7714 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
7715 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
7716 | filter->aslist[FILTER_IN].name, | |
7717 | VTY_NEWLINE); | |
7718 | if (filter->aslist[FILTER_OUT].name) | |
7719 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
7720 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
7721 | filter->aslist[FILTER_OUT].name, | |
7722 | VTY_NEWLINE); | |
7723 | ||
7724 | /* route-map. */ | |
fee0f4c6 | 7725 | if (filter->map[RMAP_IN].name) |
718e3744 | 7726 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
fee0f4c6 | 7727 | filter->map[RMAP_IN].map ? "*" : "", |
7728 | filter->map[RMAP_IN].name, | |
718e3744 | 7729 | VTY_NEWLINE); |
fee0f4c6 | 7730 | if (filter->map[RMAP_OUT].name) |
718e3744 | 7731 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
fee0f4c6 | 7732 | filter->map[RMAP_OUT].map ? "*" : "", |
7733 | filter->map[RMAP_OUT].name, | |
7734 | VTY_NEWLINE); | |
7735 | if (filter->map[RMAP_IMPORT].name) | |
7736 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", | |
7737 | filter->map[RMAP_IMPORT].map ? "*" : "", | |
7738 | filter->map[RMAP_IMPORT].name, | |
7739 | VTY_NEWLINE); | |
7740 | if (filter->map[RMAP_EXPORT].name) | |
7741 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", | |
7742 | filter->map[RMAP_EXPORT].map ? "*" : "", | |
7743 | filter->map[RMAP_EXPORT].name, | |
718e3744 | 7744 | VTY_NEWLINE); |
7745 | ||
7746 | /* unsuppress-map */ | |
7747 | if (filter->usmap.name) | |
7748 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
7749 | filter->usmap.map ? "*" : "", | |
7750 | filter->usmap.name, VTY_NEWLINE); | |
7751 | ||
7752 | /* Receive prefix count */ | |
e0701b79 | 7753 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
7754 | ||
718e3744 | 7755 | /* Maximum prefix */ |
7756 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
7757 | { | |
0a486e5f | 7758 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
718e3744 | 7759 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
0a486e5f | 7760 | ? " (warning-only)" : "", VTY_NEWLINE); |
7761 | vty_out (vty, " Threshold for warning message %d%%", | |
7762 | p->pmax_threshold[afi][safi]); | |
7763 | if (p->pmax_restart[afi][safi]) | |
7764 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
7765 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 7766 | } |
718e3744 | 7767 | |
7768 | vty_out (vty, "%s", VTY_NEWLINE); | |
7769 | } | |
7770 | ||
94f2b392 | 7771 | static void |
718e3744 | 7772 | bgp_show_peer (struct vty *vty, struct peer *p) |
7773 | { | |
7774 | struct bgp *bgp; | |
7775 | char buf1[BUFSIZ]; | |
7776 | char timebuf[BGP_UPTIME_LEN]; | |
538621f2 | 7777 | afi_t afi; |
7778 | safi_t safi; | |
718e3744 | 7779 | |
7780 | bgp = p->bgp; | |
7781 | ||
7782 | /* Configured IP address. */ | |
7783 | vty_out (vty, "BGP neighbor is %s, ", p->host); | |
aea339f7 | 7784 | vty_out (vty, "remote AS %u, ", p->as); |
9d3f9705 | 7785 | vty_out (vty, "local AS %u%s%s, ", |
718e3744 | 7786 | p->change_local_as ? p->change_local_as : p->local_as, |
7787 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
9d3f9705 AC |
7788 | " no-prepend" : "", |
7789 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ? | |
7790 | " replace-as" : ""); | |
718e3744 | 7791 | vty_out (vty, "%s link%s", |
7792 | p->as == p->local_as ? "internal" : "external", | |
7793 | VTY_NEWLINE); | |
7794 | ||
7795 | /* Description. */ | |
7796 | if (p->desc) | |
7797 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
7798 | ||
7799 | /* Peer-group */ | |
7800 | if (p->group) | |
7801 | vty_out (vty, " Member of peer-group %s for session parameters%s", | |
7802 | p->group->name, VTY_NEWLINE); | |
7803 | ||
7804 | /* Administrative shutdown. */ | |
7805 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
7806 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
7807 | ||
7808 | /* BGP Version. */ | |
7809 | vty_out (vty, " BGP version 4"); | |
718e3744 | 7810 | vty_out (vty, ", remote router ID %s%s", |
7811 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
7812 | VTY_NEWLINE); | |
7813 | ||
7814 | /* Confederation */ | |
e0701b79 | 7815 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
7816 | && bgp_confederation_peers_check (bgp, p->as)) | |
718e3744 | 7817 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
7818 | ||
7819 | /* Status. */ | |
7820 | vty_out (vty, " BGP state = %s", | |
7821 | LOOKUP (bgp_status_msg, p->status)); | |
7822 | if (p->status == Established) | |
7823 | vty_out (vty, ", up for %8s", | |
7824 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); | |
93406d87 | 7825 | else if (p->status == Active) |
7826 | { | |
7827 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
7828 | vty_out (vty, " (passive)"); | |
7829 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
7830 | vty_out (vty, " (NSF passive)"); | |
7831 | } | |
718e3744 | 7832 | vty_out (vty, "%s", VTY_NEWLINE); |
7833 | ||
7834 | /* read timer */ | |
7835 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); | |
7836 | ||
7837 | /* Configured timer values. */ | |
7838 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", | |
7839 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); | |
7840 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
7841 | { | |
7842 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
7843 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
7844 | p->keepalive, VTY_NEWLINE); | |
7845 | } | |
93406d87 | 7846 | |
718e3744 | 7847 | /* Capability. */ |
7848 | if (p->status == Established) | |
7849 | { | |
538621f2 | 7850 | if (p->cap |
718e3744 | 7851 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
7852 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
7853 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
7854 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
7855 | #ifdef HAVE_IPV6 | |
7856 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
7857 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
7858 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
7859 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
7860 | #endif /* HAVE_IPV6 */ | |
7861 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] | |
7862 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
7863 | { | |
7864 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
7865 | ||
0b2aa3a0 PJ |
7866 | /* AS4 */ |
7867 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
7868 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
7869 | { | |
7870 | vty_out (vty, " 4 Byte AS:"); | |
7871 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
7872 | vty_out (vty, " advertised"); | |
7873 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
7874 | vty_out (vty, " %sreceived", | |
7875 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
7876 | vty_out (vty, "%s", VTY_NEWLINE); | |
7877 | } | |
718e3744 | 7878 | /* Dynamic */ |
7879 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
7880 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
7881 | { | |
7882 | vty_out (vty, " Dynamic:"); | |
7883 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
7884 | vty_out (vty, " advertised"); | |
7885 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
538621f2 | 7886 | vty_out (vty, " %sreceived", |
7887 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
718e3744 | 7888 | vty_out (vty, "%s", VTY_NEWLINE); |
7889 | } | |
7890 | ||
7891 | /* Route Refresh */ | |
7892 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
7893 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
7894 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
7895 | { | |
7896 | vty_out (vty, " Route refresh:"); | |
7897 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
7898 | vty_out (vty, " advertised"); | |
7899 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
7900 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
538621f2 | 7901 | vty_out (vty, " %sreceived(%s)", |
7902 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
7903 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
7904 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
7905 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
718e3744 | 7906 | |
718e3744 | 7907 | vty_out (vty, "%s", VTY_NEWLINE); |
7908 | } | |
538621f2 | 7909 | |
7910 | /* Multiprotocol Extensions */ | |
7911 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
7912 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
7913 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
718e3744 | 7914 | { |
538621f2 | 7915 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
7916 | if (p->afc_adv[afi][safi]) | |
7917 | vty_out (vty, " advertised"); | |
7918 | if (p->afc_recv[afi][safi]) | |
7919 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
7920 | vty_out (vty, "%s", VTY_NEWLINE); | |
7921 | } | |
7922 | ||
7923 | /* Gracefull Restart */ | |
7924 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
7925 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 7926 | { |
538621f2 | 7927 | vty_out (vty, " Graceful Restart Capabilty:"); |
7928 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 7929 | vty_out (vty, " advertised"); |
538621f2 | 7930 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
7931 | vty_out (vty, " %sreceived", | |
7932 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
718e3744 | 7933 | vty_out (vty, "%s", VTY_NEWLINE); |
538621f2 | 7934 | |
7935 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
718e3744 | 7936 | { |
538621f2 | 7937 | int restart_af_count = 0; |
7938 | ||
7939 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
93406d87 | 7940 | p->v_gr_restart, VTY_NEWLINE); |
7941 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
538621f2 | 7942 | |
7943 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
7944 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
7945 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
7946 | { | |
93406d87 | 7947 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
7948 | afi_safi_print (afi, safi), | |
7949 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
7950 | "preserved" : "not preserved"); | |
538621f2 | 7951 | restart_af_count++; |
93406d87 | 7952 | } |
538621f2 | 7953 | if (! restart_af_count) |
7954 | vty_out (vty, "none"); | |
7955 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 7956 | } |
718e3744 | 7957 | } |
718e3744 | 7958 | } |
7959 | } | |
7960 | ||
93406d87 | 7961 | /* graceful restart information */ |
7962 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
7963 | || p->t_gr_restart | |
7964 | || p->t_gr_stale) | |
7965 | { | |
7966 | int eor_send_af_count = 0; | |
7967 | int eor_receive_af_count = 0; | |
7968 | ||
7969 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
7970 | if (p->status == Established) | |
7971 | { | |
7972 | vty_out (vty, " End-of-RIB send: "); | |
7973 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
7974 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
7975 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
7976 | { | |
7977 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
7978 | afi_safi_print (afi, safi)); | |
7979 | eor_send_af_count++; | |
7980 | } | |
7981 | vty_out (vty, "%s", VTY_NEWLINE); | |
7982 | ||
7983 | vty_out (vty, " End-of-RIB received: "); | |
7984 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
7985 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
7986 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
7987 | { | |
7988 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
7989 | afi_safi_print (afi, safi)); | |
7990 | eor_receive_af_count++; | |
7991 | } | |
7992 | vty_out (vty, "%s", VTY_NEWLINE); | |
7993 | } | |
7994 | ||
7995 | if (p->t_gr_restart) | |
0b2aa3a0 PJ |
7996 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
7997 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
7998 | ||
93406d87 | 7999 | if (p->t_gr_stale) |
0b2aa3a0 PJ |
8000 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
8001 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
93406d87 | 8002 | } |
8003 | ||
718e3744 | 8004 | /* Packet counts. */ |
93406d87 | 8005 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
8006 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
0b2aa3a0 | 8007 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); |
93406d87 | 8008 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
8009 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
8010 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
8011 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
8012 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
8013 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
8014 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
8015 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
8016 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
8017 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
8018 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 8019 | |
8020 | /* advertisement-interval */ | |
8021 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
8022 | p->v_routeadv, VTY_NEWLINE); | |
8023 | ||
8024 | /* Update-source. */ | |
8025 | if (p->update_if || p->update_source) | |
8026 | { | |
8027 | vty_out (vty, " Update source is "); | |
8028 | if (p->update_if) | |
8029 | vty_out (vty, "%s", p->update_if); | |
8030 | else if (p->update_source) | |
8031 | vty_out (vty, "%s", | |
8032 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
8033 | vty_out (vty, "%s", VTY_NEWLINE); | |
8034 | } | |
8035 | ||
8036 | /* Default weight */ | |
8037 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
8038 | vty_out (vty, " Default weight %d%s", p->weight, | |
8039 | VTY_NEWLINE); | |
8040 | ||
8041 | vty_out (vty, "%s", VTY_NEWLINE); | |
8042 | ||
8043 | /* Address Family Information */ | |
538621f2 | 8044 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
8045 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
8046 | if (p->afc[afi][safi]) | |
8047 | bgp_show_peer_afi (vty, p, afi, safi); | |
718e3744 | 8048 | |
8049 | vty_out (vty, " Connections established %d; dropped %d%s", | |
8050 | p->established, p->dropped, | |
8051 | VTY_NEWLINE); | |
8052 | ||
e0701b79 | 8053 | if (! p->dropped) |
8054 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); | |
8055 | else | |
8056 | vty_out (vty, " Last reset %s, due to %s%s", | |
8057 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), | |
8058 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
848973c7 | 8059 | |
718e3744 | 8060 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
8061 | { | |
8062 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 8063 | |
8064 | if (p->t_pmax_restart) | |
8065 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
8066 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
8067 | VTY_NEWLINE); | |
8068 | else | |
8069 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
8070 | p->host, VTY_NEWLINE); | |
718e3744 | 8071 | } |
8072 | ||
f5a4827d | 8073 | /* EBGP Multihop and GTSM */ |
6d85b15b | 8074 | if (p->sort != BGP_PEER_IBGP) |
f5a4827d SH |
8075 | { |
8076 | if (p->gtsm_hops > 0) | |
8077 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
8078 | p->gtsm_hops, VTY_NEWLINE); | |
8079 | else if (p->ttl > 1) | |
8080 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
8081 | p->ttl, VTY_NEWLINE); | |
8082 | } | |
5d804b43 PM |
8083 | else |
8084 | { | |
8085 | if (p->gtsm_hops > 0) | |
8086 | vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s", | |
8087 | p->gtsm_hops, VTY_NEWLINE); | |
8088 | } | |
718e3744 | 8089 | |
8090 | /* Local address. */ | |
8091 | if (p->su_local) | |
8092 | { | |
93406d87 | 8093 | vty_out (vty, "Local host: %s, Local port: %d%s", |
718e3744 | 8094 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
8095 | ntohs (p->su_local->sin.sin_port), | |
718e3744 | 8096 | VTY_NEWLINE); |
8097 | } | |
8098 | ||
8099 | /* Remote address. */ | |
8100 | if (p->su_remote) | |
8101 | { | |
8102 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
8103 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), | |
8104 | ntohs (p->su_remote->sin.sin_port), | |
8105 | VTY_NEWLINE); | |
8106 | } | |
8107 | ||
8108 | /* Nexthop display. */ | |
8109 | if (p->su_local) | |
8110 | { | |
8111 | vty_out (vty, "Nexthop: %s%s", | |
8112 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
8113 | VTY_NEWLINE); | |
8114 | #ifdef HAVE_IPV6 | |
8115 | vty_out (vty, "Nexthop global: %s%s", | |
8116 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
8117 | VTY_NEWLINE); | |
8118 | vty_out (vty, "Nexthop local: %s%s", | |
8119 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
8120 | VTY_NEWLINE); | |
8121 | vty_out (vty, "BGP connection: %s%s", | |
8122 | p->shared_network ? "shared network" : "non shared network", | |
8123 | VTY_NEWLINE); | |
8124 | #endif /* HAVE_IPV6 */ | |
8125 | } | |
8126 | ||
8127 | /* Timer information. */ | |
8128 | if (p->t_start) | |
8129 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
8130 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
8131 | if (p->t_connect) | |
8132 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
8133 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
8134 | ||
8135 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
8136 | p->t_read ? "on" : "off", | |
8137 | p->t_write ? "on" : "off", | |
8138 | VTY_NEWLINE); | |
8139 | ||
8140 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
8141 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
8142 | bgp_capability_vty_out (vty, p); | |
8143 | ||
8144 | vty_out (vty, "%s", VTY_NEWLINE); | |
8145 | } | |
8146 | ||
94f2b392 | 8147 | static int |
718e3744 | 8148 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
8149 | enum show_type type, union sockunion *su) | |
8150 | { | |
1eb8ef25 | 8151 | struct listnode *node, *nnode; |
718e3744 | 8152 | struct peer *peer; |
8153 | int find = 0; | |
8154 | ||
1eb8ef25 | 8155 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 8156 | { |
8157 | switch (type) | |
8158 | { | |
8159 | case show_all: | |
8160 | bgp_show_peer (vty, peer); | |
8161 | break; | |
8162 | case show_peer: | |
8163 | if (sockunion_same (&peer->su, su)) | |
8164 | { | |
8165 | find = 1; | |
8166 | bgp_show_peer (vty, peer); | |
8167 | } | |
8168 | break; | |
8169 | } | |
8170 | } | |
8171 | ||
8172 | if (type == show_peer && ! find) | |
8173 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
8174 | ||
8175 | return CMD_SUCCESS; | |
8176 | } | |
8177 | ||
94f2b392 | 8178 | static int |
fd79ac91 | 8179 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
8180 | enum show_type type, const char *ip_str) | |
718e3744 | 8181 | { |
8182 | int ret; | |
8183 | struct bgp *bgp; | |
8184 | union sockunion su; | |
8185 | ||
8186 | if (ip_str) | |
8187 | { | |
8188 | ret = str2sockunion (ip_str, &su); | |
8189 | if (ret < 0) | |
8190 | { | |
8191 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); | |
8192 | return CMD_WARNING; | |
8193 | } | |
8194 | } | |
8195 | ||
8196 | if (name) | |
8197 | { | |
8198 | bgp = bgp_lookup_by_name (name); | |
8199 | ||
8200 | if (! bgp) | |
8201 | { | |
8202 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
8203 | return CMD_WARNING; | |
8204 | } | |
8205 | ||
8206 | bgp_show_neighbor (vty, bgp, type, &su); | |
8207 | ||
8208 | return CMD_SUCCESS; | |
8209 | } | |
8210 | ||
8211 | bgp = bgp_get_default (); | |
8212 | ||
8213 | if (bgp) | |
8214 | bgp_show_neighbor (vty, bgp, type, &su); | |
8215 | ||
8216 | return CMD_SUCCESS; | |
8217 | } | |
8218 | ||
8219 | /* "show ip bgp neighbors" commands. */ | |
8220 | DEFUN (show_ip_bgp_neighbors, | |
8221 | show_ip_bgp_neighbors_cmd, | |
8222 | "show ip bgp neighbors", | |
8223 | SHOW_STR | |
8224 | IP_STR | |
8225 | BGP_STR | |
8226 | "Detailed information on TCP and BGP neighbor connections\n") | |
8227 | { | |
8228 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); | |
8229 | } | |
8230 | ||
8231 | ALIAS (show_ip_bgp_neighbors, | |
8232 | show_ip_bgp_ipv4_neighbors_cmd, | |
8233 | "show ip bgp ipv4 (unicast|multicast) neighbors", | |
8234 | SHOW_STR | |
8235 | IP_STR | |
8236 | BGP_STR | |
8237 | "Address family\n" | |
8238 | "Address Family modifier\n" | |
8239 | "Address Family modifier\n" | |
8240 | "Detailed information on TCP and BGP neighbor connections\n") | |
8241 | ||
8242 | ALIAS (show_ip_bgp_neighbors, | |
8243 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
8244 | "show ip bgp vpnv4 all neighbors", | |
8245 | SHOW_STR | |
8246 | IP_STR | |
8247 | BGP_STR | |
8248 | "Display VPNv4 NLRI specific information\n" | |
8249 | "Display information about all VPNv4 NLRIs\n" | |
8250 | "Detailed information on TCP and BGP neighbor connections\n") | |
8251 | ||
8252 | ALIAS (show_ip_bgp_neighbors, | |
8253 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
8254 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", | |
8255 | SHOW_STR | |
8256 | IP_STR | |
8257 | BGP_STR | |
8258 | "Display VPNv4 NLRI specific information\n" | |
8259 | "Display information for a route distinguisher\n" | |
8260 | "VPN Route Distinguisher\n" | |
8261 | "Detailed information on TCP and BGP neighbor connections\n") | |
8262 | ||
8263 | ALIAS (show_ip_bgp_neighbors, | |
8264 | show_bgp_neighbors_cmd, | |
8265 | "show bgp neighbors", | |
8266 | SHOW_STR | |
8267 | BGP_STR | |
8268 | "Detailed information on TCP and BGP neighbor connections\n") | |
8269 | ||
8270 | ALIAS (show_ip_bgp_neighbors, | |
8271 | show_bgp_ipv6_neighbors_cmd, | |
8272 | "show bgp ipv6 neighbors", | |
8273 | SHOW_STR | |
8274 | BGP_STR | |
8275 | "Address family\n" | |
8276 | "Detailed information on TCP and BGP neighbor connections\n") | |
8277 | ||
8278 | DEFUN (show_ip_bgp_neighbors_peer, | |
8279 | show_ip_bgp_neighbors_peer_cmd, | |
8280 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", | |
8281 | SHOW_STR | |
8282 | IP_STR | |
8283 | BGP_STR | |
8284 | "Detailed information on TCP and BGP neighbor connections\n" | |
8285 | "Neighbor to display information about\n" | |
8286 | "Neighbor to display information about\n") | |
8287 | { | |
8288 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); | |
8289 | } | |
8290 | ||
8291 | ALIAS (show_ip_bgp_neighbors_peer, | |
8292 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
8293 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", | |
8294 | SHOW_STR | |
8295 | IP_STR | |
8296 | BGP_STR | |
8297 | "Address family\n" | |
8298 | "Address Family modifier\n" | |
8299 | "Address Family modifier\n" | |
8300 | "Detailed information on TCP and BGP neighbor connections\n" | |
8301 | "Neighbor to display information about\n" | |
8302 | "Neighbor to display information about\n") | |
8303 | ||
8304 | ALIAS (show_ip_bgp_neighbors_peer, | |
8305 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
8306 | "show ip bgp vpnv4 all neighbors A.B.C.D", | |
8307 | SHOW_STR | |
8308 | IP_STR | |
8309 | BGP_STR | |
8310 | "Display VPNv4 NLRI specific information\n" | |
8311 | "Display information about all VPNv4 NLRIs\n" | |
8312 | "Detailed information on TCP and BGP neighbor connections\n" | |
8313 | "Neighbor to display information about\n") | |
8314 | ||
8315 | ALIAS (show_ip_bgp_neighbors_peer, | |
8316 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
8317 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", | |
8318 | SHOW_STR | |
8319 | IP_STR | |
8320 | BGP_STR | |
8321 | "Display VPNv4 NLRI specific information\n" | |
8322 | "Display information about all VPNv4 NLRIs\n" | |
8323 | "Detailed information on TCP and BGP neighbor connections\n" | |
8324 | "Neighbor to display information about\n") | |
8325 | ||
8326 | ALIAS (show_ip_bgp_neighbors_peer, | |
8327 | show_bgp_neighbors_peer_cmd, | |
8328 | "show bgp neighbors (A.B.C.D|X:X::X:X)", | |
8329 | SHOW_STR | |
8330 | BGP_STR | |
8331 | "Detailed information on TCP and BGP neighbor connections\n" | |
8332 | "Neighbor to display information about\n" | |
8333 | "Neighbor to display information about\n") | |
8334 | ||
8335 | ALIAS (show_ip_bgp_neighbors_peer, | |
8336 | show_bgp_ipv6_neighbors_peer_cmd, | |
8337 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", | |
8338 | SHOW_STR | |
8339 | BGP_STR | |
8340 | "Address family\n" | |
8341 | "Detailed information on TCP and BGP neighbor connections\n" | |
8342 | "Neighbor to display information about\n" | |
8343 | "Neighbor to display information about\n") | |
8344 | ||
8345 | DEFUN (show_ip_bgp_instance_neighbors, | |
8346 | show_ip_bgp_instance_neighbors_cmd, | |
8347 | "show ip bgp view WORD neighbors", | |
8348 | SHOW_STR | |
8349 | IP_STR | |
8350 | BGP_STR | |
8351 | "BGP view\n" | |
8352 | "View name\n" | |
8353 | "Detailed information on TCP and BGP neighbor connections\n") | |
8354 | { | |
8355 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); | |
8356 | } | |
8357 | ||
bb46e94f | 8358 | ALIAS (show_ip_bgp_instance_neighbors, |
8359 | show_bgp_instance_neighbors_cmd, | |
8360 | "show bgp view WORD neighbors", | |
8361 | SHOW_STR | |
8362 | BGP_STR | |
8363 | "BGP view\n" | |
8364 | "View name\n" | |
8365 | "Detailed information on TCP and BGP neighbor connections\n") | |
8366 | ||
8367 | ALIAS (show_ip_bgp_instance_neighbors, | |
8368 | show_bgp_instance_ipv6_neighbors_cmd, | |
8369 | "show bgp view WORD ipv6 neighbors", | |
8370 | SHOW_STR | |
8371 | BGP_STR | |
8372 | "BGP view\n" | |
8373 | "View name\n" | |
8374 | "Address family\n" | |
8375 | "Detailed information on TCP and BGP neighbor connections\n") | |
8376 | ||
718e3744 | 8377 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
8378 | show_ip_bgp_instance_neighbors_peer_cmd, | |
8379 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", | |
8380 | SHOW_STR | |
8381 | IP_STR | |
8382 | BGP_STR | |
8383 | "BGP view\n" | |
8384 | "View name\n" | |
8385 | "Detailed information on TCP and BGP neighbor connections\n" | |
8386 | "Neighbor to display information about\n" | |
8387 | "Neighbor to display information about\n") | |
8388 | { | |
8389 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); | |
8390 | } | |
bb46e94f | 8391 | |
8392 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
8393 | show_bgp_instance_neighbors_peer_cmd, | |
8394 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", | |
8395 | SHOW_STR | |
8396 | BGP_STR | |
8397 | "BGP view\n" | |
8398 | "View name\n" | |
8399 | "Detailed information on TCP and BGP neighbor connections\n" | |
8400 | "Neighbor to display information about\n" | |
8401 | "Neighbor to display information about\n") | |
8402 | ||
8403 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
8404 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
8405 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", | |
8406 | SHOW_STR | |
8407 | BGP_STR | |
8408 | "BGP view\n" | |
8409 | "View name\n" | |
8410 | "Address family\n" | |
8411 | "Detailed information on TCP and BGP neighbor connections\n" | |
8412 | "Neighbor to display information about\n" | |
8413 | "Neighbor to display information about\n") | |
6b0655a2 | 8414 | |
718e3744 | 8415 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
8416 | paths' and `show ip mbgp paths'. Those functions results are the | |
8417 | same.*/ | |
8418 | DEFUN (show_ip_bgp_paths, | |
8419 | show_ip_bgp_paths_cmd, | |
8420 | "show ip bgp paths", | |
8421 | SHOW_STR | |
8422 | IP_STR | |
8423 | BGP_STR | |
8424 | "Path information\n") | |
8425 | { | |
8426 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
8427 | aspath_print_all_vty (vty); | |
8428 | return CMD_SUCCESS; | |
8429 | } | |
8430 | ||
8431 | DEFUN (show_ip_bgp_ipv4_paths, | |
8432 | show_ip_bgp_ipv4_paths_cmd, | |
8433 | "show ip bgp ipv4 (unicast|multicast) paths", | |
8434 | SHOW_STR | |
8435 | IP_STR | |
8436 | BGP_STR | |
8437 | "Address family\n" | |
8438 | "Address Family modifier\n" | |
8439 | "Address Family modifier\n" | |
8440 | "Path information\n") | |
8441 | { | |
8442 | vty_out (vty, "Address Refcnt Path\r\n"); | |
8443 | aspath_print_all_vty (vty); | |
8444 | ||
8445 | return CMD_SUCCESS; | |
8446 | } | |
6b0655a2 | 8447 | |
718e3744 | 8448 | #include "hash.h" |
8449 | ||
94f2b392 | 8450 | static void |
718e3744 | 8451 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
8452 | { | |
8453 | struct community *com; | |
8454 | ||
8455 | com = (struct community *) backet->data; | |
8456 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, | |
8457 | community_str (com), VTY_NEWLINE); | |
8458 | } | |
8459 | ||
8460 | /* Show BGP's community internal data. */ | |
8461 | DEFUN (show_ip_bgp_community_info, | |
8462 | show_ip_bgp_community_info_cmd, | |
8463 | "show ip bgp community-info", | |
8464 | SHOW_STR | |
8465 | IP_STR | |
8466 | BGP_STR | |
8467 | "List all bgp community information\n") | |
8468 | { | |
8469 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
8470 | ||
8471 | hash_iterate (community_hash (), | |
8472 | (void (*) (struct hash_backet *, void *)) | |
8473 | community_show_all_iterator, | |
8474 | vty); | |
8475 | ||
8476 | return CMD_SUCCESS; | |
8477 | } | |
8478 | ||
8479 | DEFUN (show_ip_bgp_attr_info, | |
8480 | show_ip_bgp_attr_info_cmd, | |
8481 | "show ip bgp attribute-info", | |
8482 | SHOW_STR | |
8483 | IP_STR | |
8484 | BGP_STR | |
8485 | "List all bgp attribute information\n") | |
8486 | { | |
8487 | attr_show_all (vty); | |
8488 | return CMD_SUCCESS; | |
8489 | } | |
6b0655a2 | 8490 | |
94f2b392 | 8491 | static int |
fee0f4c6 | 8492 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
8493 | afi_t afi, safi_t safi) | |
8494 | { | |
8495 | char timebuf[BGP_UPTIME_LEN]; | |
8496 | char rmbuf[14]; | |
fd79ac91 | 8497 | const char *rmname; |
fee0f4c6 | 8498 | struct peer *peer; |
1eb8ef25 | 8499 | struct listnode *node, *nnode; |
fee0f4c6 | 8500 | int len; |
8501 | int count = 0; | |
8502 | ||
8503 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) | |
8504 | { | |
1eb8ef25 | 8505 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
fee0f4c6 | 8506 | { |
8507 | count++; | |
8508 | bgp_write_rsclient_summary (vty, peer, afi, safi); | |
8509 | } | |
8510 | return count; | |
8511 | } | |
8512 | ||
8513 | len = vty_out (vty, "%s", rsclient->host); | |
8514 | len = 16 - len; | |
8515 | ||
8516 | if (len < 1) | |
8517 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
8518 | else | |
8519 | vty_out (vty, "%*s", len, " "); | |
8520 | ||
3d515fd9 | 8521 | vty_out (vty, "4 "); |
fee0f4c6 | 8522 | |
0b2aa3a0 | 8523 | vty_out (vty, "%11d ", rsclient->as); |
fee0f4c6 | 8524 | |
8525 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); | |
8526 | if ( rmname && strlen (rmname) > 13 ) | |
8527 | { | |
8528 | sprintf (rmbuf, "%13s", "..."); | |
8529 | rmname = strncpy (rmbuf, rmname, 10); | |
8530 | } | |
8531 | else if (! rmname) | |
8532 | rmname = "<none>"; | |
8533 | vty_out (vty, " %13s ", rmname); | |
8534 | ||
8535 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); | |
8536 | if ( rmname && strlen (rmname) > 13 ) | |
8537 | { | |
8538 | sprintf (rmbuf, "%13s", "..."); | |
8539 | rmname = strncpy (rmbuf, rmname, 10); | |
8540 | } | |
8541 | else if (! rmname) | |
8542 | rmname = "<none>"; | |
8543 | vty_out (vty, " %13s ", rmname); | |
8544 | ||
8545 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); | |
8546 | ||
8547 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) | |
8548 | vty_out (vty, " Idle (Admin)"); | |
8549 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
8550 | vty_out (vty, " Idle (PfxCt)"); | |
8551 | else | |
8552 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); | |
8553 | ||
8554 | vty_out (vty, "%s", VTY_NEWLINE); | |
8555 | ||
8556 | return 1; | |
8557 | } | |
8558 | ||
94f2b392 | 8559 | static int |
fd79ac91 | 8560 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
8561 | afi_t afi, safi_t safi) | |
fee0f4c6 | 8562 | { |
8563 | struct peer *peer; | |
1eb8ef25 | 8564 | struct listnode *node, *nnode; |
fee0f4c6 | 8565 | int count = 0; |
8566 | ||
8567 | /* Header string for each address family. */ | |
8568 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; | |
8569 | ||
1eb8ef25 | 8570 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
fee0f4c6 | 8571 | { |
8572 | if (peer->afc[afi][safi] && | |
8573 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
8574 | { | |
8575 | if (! count) | |
8576 | { | |
8577 | vty_out (vty, | |
8578 | "Route Server's BGP router identifier %s%s", | |
8579 | inet_ntoa (bgp->router_id), VTY_NEWLINE); | |
8580 | vty_out (vty, | |
aea339f7 | 8581 | "Route Server's local AS number %u%s", bgp->as, |
fee0f4c6 | 8582 | VTY_NEWLINE); |
8583 | ||
8584 | vty_out (vty, "%s", VTY_NEWLINE); | |
8585 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
8586 | } | |
8587 | ||
8588 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); | |
8589 | } | |
8590 | } | |
8591 | ||
8592 | if (count) | |
8593 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, | |
8594 | count, VTY_NEWLINE); | |
8595 | else | |
8596 | vty_out (vty, "No %s Route Server Client is configured%s", | |
8597 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
8598 | ||
8599 | return CMD_SUCCESS; | |
8600 | } | |
8601 | ||
94f2b392 | 8602 | static int |
fd79ac91 | 8603 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
8604 | afi_t afi, safi_t safi) | |
fee0f4c6 | 8605 | { |
8606 | struct bgp *bgp; | |
8607 | ||
8608 | if (name) | |
8609 | { | |
8610 | bgp = bgp_lookup_by_name (name); | |
8611 | ||
8612 | if (! bgp) | |
8613 | { | |
8614 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
8615 | return CMD_WARNING; | |
8616 | } | |
8617 | ||
8618 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
8619 | return CMD_SUCCESS; | |
8620 | } | |
8621 | ||
8622 | bgp = bgp_get_default (); | |
8623 | ||
8624 | if (bgp) | |
8625 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
8626 | ||
8627 | return CMD_SUCCESS; | |
8628 | } | |
8629 | ||
8630 | /* 'show bgp rsclient' commands. */ | |
8631 | DEFUN (show_ip_bgp_rsclient_summary, | |
8632 | show_ip_bgp_rsclient_summary_cmd, | |
8633 | "show ip bgp rsclient summary", | |
8634 | SHOW_STR | |
8635 | IP_STR | |
8636 | BGP_STR | |
8637 | "Information about Route Server Clients\n" | |
8638 | "Summary of all Route Server Clients\n") | |
8639 | { | |
8640 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
8641 | } | |
8642 | ||
8643 | DEFUN (show_ip_bgp_instance_rsclient_summary, | |
8644 | show_ip_bgp_instance_rsclient_summary_cmd, | |
8645 | "show ip bgp view WORD rsclient summary", | |
8646 | SHOW_STR | |
8647 | IP_STR | |
8648 | BGP_STR | |
8649 | "BGP view\n" | |
8650 | "View name\n" | |
8651 | "Information about Route Server Clients\n" | |
8652 | "Summary of all Route Server Clients\n") | |
8653 | { | |
8654 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
8655 | } | |
8656 | ||
8657 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, | |
8658 | show_ip_bgp_ipv4_rsclient_summary_cmd, | |
8659 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", | |
8660 | SHOW_STR | |
8661 | IP_STR | |
8662 | BGP_STR | |
8663 | "Address family\n" | |
8664 | "Address Family modifier\n" | |
8665 | "Address Family modifier\n" | |
8666 | "Information about Route Server Clients\n" | |
8667 | "Summary of all Route Server Clients\n") | |
8668 | { | |
8669 | if (strncmp (argv[0], "m", 1) == 0) | |
8670 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); | |
8671 | ||
8672 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
8673 | } | |
8674 | ||
8675 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, | |
8676 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, | |
8677 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
8678 | SHOW_STR | |
8679 | IP_STR | |
8680 | BGP_STR | |
8681 | "BGP view\n" | |
8682 | "View name\n" | |
8683 | "Address family\n" | |
8684 | "Address Family modifier\n" | |
8685 | "Address Family modifier\n" | |
8686 | "Information about Route Server Clients\n" | |
8687 | "Summary of all Route Server Clients\n") | |
8688 | { | |
8689 | if (strncmp (argv[1], "m", 1) == 0) | |
8690 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); | |
8691 | ||
8692 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
8693 | } | |
8694 | ||
95cbbd2a ML |
8695 | DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary, |
8696 | show_bgp_instance_ipv4_safi_rsclient_summary_cmd, | |
8697 | "show bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
8698 | SHOW_STR | |
8699 | BGP_STR | |
8700 | "BGP view\n" | |
8701 | "View name\n" | |
8702 | "Address family\n" | |
8703 | "Address Family modifier\n" | |
8704 | "Address Family modifier\n" | |
8705 | "Information about Route Server Clients\n" | |
8706 | "Summary of all Route Server Clients\n") | |
8707 | { | |
8708 | safi_t safi; | |
8709 | ||
8710 | if (argc == 2) { | |
8711 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8712 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi); | |
8713 | } else { | |
8714 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8715 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi); | |
8716 | } | |
8717 | } | |
8718 | ||
8719 | ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary, | |
8720 | show_bgp_ipv4_safi_rsclient_summary_cmd, | |
8721 | "show bgp ipv4 (unicast|multicast) rsclient summary", | |
8722 | SHOW_STR | |
8723 | BGP_STR | |
8724 | "Address family\n" | |
8725 | "Address Family modifier\n" | |
8726 | "Address Family modifier\n" | |
8727 | "Information about Route Server Clients\n" | |
8728 | "Summary of all Route Server Clients\n") | |
8729 | ||
fee0f4c6 | 8730 | #ifdef HAVE_IPV6 |
8731 | DEFUN (show_bgp_rsclient_summary, | |
8732 | show_bgp_rsclient_summary_cmd, | |
8733 | "show bgp rsclient summary", | |
8734 | SHOW_STR | |
8735 | BGP_STR | |
8736 | "Information about Route Server Clients\n" | |
8737 | "Summary of all Route Server Clients\n") | |
8738 | { | |
8739 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
8740 | } | |
8741 | ||
8742 | DEFUN (show_bgp_instance_rsclient_summary, | |
8743 | show_bgp_instance_rsclient_summary_cmd, | |
8744 | "show bgp view WORD rsclient summary", | |
8745 | SHOW_STR | |
8746 | BGP_STR | |
8747 | "BGP view\n" | |
8748 | "View name\n" | |
8749 | "Information about Route Server Clients\n" | |
8750 | "Summary of all Route Server Clients\n") | |
8751 | { | |
8752 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); | |
8753 | } | |
8754 | ||
8755 | ALIAS (show_bgp_rsclient_summary, | |
8756 | show_bgp_ipv6_rsclient_summary_cmd, | |
8757 | "show bgp ipv6 rsclient summary", | |
8758 | SHOW_STR | |
8759 | BGP_STR | |
8760 | "Address family\n" | |
8761 | "Information about Route Server Clients\n" | |
8762 | "Summary of all Route Server Clients\n") | |
8763 | ||
8764 | ALIAS (show_bgp_instance_rsclient_summary, | |
8765 | show_bgp_instance_ipv6_rsclient_summary_cmd, | |
8766 | "show bgp view WORD ipv6 rsclient summary", | |
8767 | SHOW_STR | |
8768 | BGP_STR | |
8769 | "BGP view\n" | |
8770 | "View name\n" | |
8771 | "Address family\n" | |
8772 | "Information about Route Server Clients\n" | |
8773 | "Summary of all Route Server Clients\n") | |
95cbbd2a ML |
8774 | |
8775 | DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary, | |
8776 | show_bgp_instance_ipv6_safi_rsclient_summary_cmd, | |
8777 | "show bgp view WORD ipv6 (unicast|multicast) rsclient summary", | |
8778 | SHOW_STR | |
8779 | BGP_STR | |
8780 | "BGP view\n" | |
8781 | "View name\n" | |
8782 | "Address family\n" | |
8783 | "Address Family modifier\n" | |
8784 | "Address Family modifier\n" | |
8785 | "Information about Route Server Clients\n" | |
8786 | "Summary of all Route Server Clients\n") | |
8787 | { | |
8788 | safi_t safi; | |
8789 | ||
8790 | if (argc == 2) { | |
8791 | safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8792 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi); | |
8793 | } else { | |
8794 | safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST; | |
8795 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi); | |
8796 | } | |
8797 | } | |
8798 | ||
8799 | ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary, | |
8800 | show_bgp_ipv6_safi_rsclient_summary_cmd, | |
8801 | "show bgp ipv6 (unicast|multicast) rsclient summary", | |
8802 | SHOW_STR | |
8803 | BGP_STR | |
8804 | "Address family\n" | |
8805 | "Address Family modifier\n" | |
8806 | "Address Family modifier\n" | |
8807 | "Information about Route Server Clients\n" | |
8808 | "Summary of all Route Server Clients\n") | |
8809 | ||
fee0f4c6 | 8810 | #endif /* HAVE IPV6 */ |
6b0655a2 | 8811 | |
718e3744 | 8812 | /* Redistribute VTY commands. */ |
8813 | ||
718e3744 | 8814 | DEFUN (bgp_redistribute_ipv4, |
8815 | bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 8816 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 8817 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 8818 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 8819 | { |
8820 | int type; | |
8821 | ||
e0ca5fde DL |
8822 | type = proto_redistnum (AFI_IP, argv[0]); |
8823 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 8824 | { |
8825 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8826 | return CMD_WARNING; | |
8827 | } | |
8828 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
8829 | } | |
8830 | ||
8831 | DEFUN (bgp_redistribute_ipv4_rmap, | |
8832 | bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 8833 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 8834 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 8835 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 8836 | "Route map reference\n" |
8837 | "Pointer to route-map entries\n") | |
8838 | { | |
8839 | int type; | |
8840 | ||
e0ca5fde DL |
8841 | type = proto_redistnum (AFI_IP, argv[0]); |
8842 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 8843 | { |
8844 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8845 | return CMD_WARNING; | |
8846 | } | |
8847 | ||
8848 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); | |
8849 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
8850 | } | |
8851 | ||
8852 | DEFUN (bgp_redistribute_ipv4_metric, | |
8853 | bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 8854 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 8855 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 8856 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 8857 | "Metric for redistributed routes\n" |
8858 | "Default metric\n") | |
8859 | { | |
8860 | int type; | |
8861 | u_int32_t metric; | |
8862 | ||
e0ca5fde DL |
8863 | type = proto_redistnum (AFI_IP, argv[0]); |
8864 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 8865 | { |
8866 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8867 | return CMD_WARNING; | |
8868 | } | |
8869 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
8870 | ||
8871 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
8872 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
8873 | } | |
8874 | ||
8875 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
8876 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 8877 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 8878 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 8879 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 8880 | "Route map reference\n" |
8881 | "Pointer to route-map entries\n" | |
8882 | "Metric for redistributed routes\n" | |
8883 | "Default metric\n") | |
8884 | { | |
8885 | int type; | |
8886 | u_int32_t metric; | |
8887 | ||
e0ca5fde DL |
8888 | type = proto_redistnum (AFI_IP, argv[0]); |
8889 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 8890 | { |
8891 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8892 | return CMD_WARNING; | |
8893 | } | |
8894 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
8895 | ||
8896 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); | |
8897 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
8898 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
8899 | } | |
8900 | ||
8901 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
8902 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 8903 | "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 8904 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 8905 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 8906 | "Metric for redistributed routes\n" |
8907 | "Default metric\n" | |
8908 | "Route map reference\n" | |
8909 | "Pointer to route-map entries\n") | |
8910 | { | |
8911 | int type; | |
8912 | u_int32_t metric; | |
8913 | ||
e0ca5fde DL |
8914 | type = proto_redistnum (AFI_IP, argv[0]); |
8915 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 8916 | { |
8917 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8918 | return CMD_WARNING; | |
8919 | } | |
8920 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
8921 | ||
8922 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
8923 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); | |
8924 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
8925 | } | |
8926 | ||
8927 | DEFUN (no_bgp_redistribute_ipv4, | |
8928 | no_bgp_redistribute_ipv4_cmd, | |
e0ca5fde | 8929 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD, |
718e3744 | 8930 | NO_STR |
8931 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 8932 | QUAGGA_IP_REDIST_HELP_STR_BGPD) |
718e3744 | 8933 | { |
8934 | int type; | |
8935 | ||
e0ca5fde DL |
8936 | type = proto_redistnum (AFI_IP, argv[0]); |
8937 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 8938 | { |
8939 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8940 | return CMD_WARNING; | |
8941 | } | |
8942 | ||
8943 | return bgp_redistribute_unset (vty->index, AFI_IP, type); | |
8944 | } | |
8945 | ||
8946 | DEFUN (no_bgp_redistribute_ipv4_rmap, | |
8947 | no_bgp_redistribute_ipv4_rmap_cmd, | |
e0ca5fde | 8948 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 8949 | NO_STR |
8950 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 8951 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 8952 | "Route map reference\n" |
8953 | "Pointer to route-map entries\n") | |
8954 | { | |
8955 | int type; | |
8956 | ||
e0ca5fde DL |
8957 | type = proto_redistnum (AFI_IP, argv[0]); |
8958 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 8959 | { |
8960 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8961 | return CMD_WARNING; | |
8962 | } | |
8963 | ||
8964 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); | |
8965 | return CMD_SUCCESS; | |
8966 | } | |
8967 | ||
8968 | DEFUN (no_bgp_redistribute_ipv4_metric, | |
8969 | no_bgp_redistribute_ipv4_metric_cmd, | |
e0ca5fde | 8970 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 8971 | NO_STR |
8972 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 8973 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 8974 | "Metric for redistributed routes\n" |
8975 | "Default metric\n") | |
8976 | { | |
8977 | int type; | |
8978 | ||
e0ca5fde DL |
8979 | type = proto_redistnum (AFI_IP, argv[0]); |
8980 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 8981 | { |
8982 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8983 | return CMD_WARNING; | |
8984 | } | |
8985 | ||
8986 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); | |
8987 | return CMD_SUCCESS; | |
8988 | } | |
8989 | ||
8990 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, | |
8991 | no_bgp_redistribute_ipv4_rmap_metric_cmd, | |
e0ca5fde | 8992 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 8993 | NO_STR |
8994 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 8995 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 8996 | "Route map reference\n" |
8997 | "Pointer to route-map entries\n" | |
8998 | "Metric for redistributed routes\n" | |
8999 | "Default metric\n") | |
9000 | { | |
9001 | int type; | |
9002 | ||
e0ca5fde DL |
9003 | type = proto_redistnum (AFI_IP, argv[0]); |
9004 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9005 | { |
9006 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9007 | return CMD_WARNING; | |
9008 | } | |
9009 | ||
9010 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); | |
9011 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); | |
9012 | return CMD_SUCCESS; | |
9013 | } | |
9014 | ||
9015 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, | |
9016 | no_bgp_redistribute_ipv4_metric_rmap_cmd, | |
e0ca5fde | 9017 | "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 9018 | NO_STR |
9019 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9020 | QUAGGA_IP_REDIST_HELP_STR_BGPD |
718e3744 | 9021 | "Metric for redistributed routes\n" |
9022 | "Default metric\n" | |
9023 | "Route map reference\n" | |
9024 | "Pointer to route-map entries\n") | |
6b0655a2 | 9025 | |
718e3744 | 9026 | #ifdef HAVE_IPV6 |
9027 | DEFUN (bgp_redistribute_ipv6, | |
9028 | bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 9029 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 9030 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9031 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 9032 | { |
9033 | int type; | |
9034 | ||
e0ca5fde DL |
9035 | type = proto_redistnum (AFI_IP6, argv[0]); |
9036 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9037 | { |
9038 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9039 | return CMD_WARNING; | |
9040 | } | |
9041 | ||
9042 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9043 | } | |
9044 | ||
9045 | DEFUN (bgp_redistribute_ipv6_rmap, | |
9046 | bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 9047 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 9048 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9049 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9050 | "Route map reference\n" |
9051 | "Pointer to route-map entries\n") | |
9052 | { | |
9053 | int type; | |
9054 | ||
e0ca5fde DL |
9055 | type = proto_redistnum (AFI_IP6, argv[0]); |
9056 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9057 | { |
9058 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9059 | return CMD_WARNING; | |
9060 | } | |
9061 | ||
9062 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); | |
9063 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9064 | } | |
9065 | ||
9066 | DEFUN (bgp_redistribute_ipv6_metric, | |
9067 | bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 9068 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 9069 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9070 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9071 | "Metric for redistributed routes\n" |
9072 | "Default metric\n") | |
9073 | { | |
9074 | int type; | |
9075 | u_int32_t metric; | |
9076 | ||
e0ca5fde DL |
9077 | type = proto_redistnum (AFI_IP6, argv[0]); |
9078 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9079 | { |
9080 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9081 | return CMD_WARNING; | |
9082 | } | |
9083 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
9084 | ||
9085 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
9086 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9087 | } | |
9088 | ||
9089 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
9090 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 9091 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 9092 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9093 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9094 | "Route map reference\n" |
9095 | "Pointer to route-map entries\n" | |
9096 | "Metric for redistributed routes\n" | |
9097 | "Default metric\n") | |
9098 | { | |
9099 | int type; | |
9100 | u_int32_t metric; | |
9101 | ||
e0ca5fde DL |
9102 | type = proto_redistnum (AFI_IP6, argv[0]); |
9103 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9104 | { |
9105 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9106 | return CMD_WARNING; | |
9107 | } | |
9108 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
9109 | ||
9110 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); | |
9111 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
9112 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9113 | } | |
9114 | ||
9115 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
9116 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 9117 | "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 9118 | "Redistribute information from another routing protocol\n" |
e0ca5fde | 9119 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9120 | "Metric for redistributed routes\n" |
9121 | "Default metric\n" | |
9122 | "Route map reference\n" | |
9123 | "Pointer to route-map entries\n") | |
9124 | { | |
9125 | int type; | |
9126 | u_int32_t metric; | |
9127 | ||
e0ca5fde DL |
9128 | type = proto_redistnum (AFI_IP6, argv[0]); |
9129 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9130 | { |
9131 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9132 | return CMD_WARNING; | |
9133 | } | |
9134 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
9135 | ||
9136 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
9137 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); | |
9138 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
9139 | } | |
9140 | ||
9141 | DEFUN (no_bgp_redistribute_ipv6, | |
9142 | no_bgp_redistribute_ipv6_cmd, | |
e0ca5fde | 9143 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD, |
718e3744 | 9144 | NO_STR |
9145 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9146 | QUAGGA_IP6_REDIST_HELP_STR_BGPD) |
718e3744 | 9147 | { |
9148 | int type; | |
9149 | ||
e0ca5fde DL |
9150 | type = proto_redistnum (AFI_IP6, argv[0]); |
9151 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9152 | { |
9153 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9154 | return CMD_WARNING; | |
9155 | } | |
9156 | ||
9157 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); | |
9158 | } | |
9159 | ||
9160 | DEFUN (no_bgp_redistribute_ipv6_rmap, | |
9161 | no_bgp_redistribute_ipv6_rmap_cmd, | |
e0ca5fde | 9162 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD", |
718e3744 | 9163 | NO_STR |
9164 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9165 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9166 | "Route map reference\n" |
9167 | "Pointer to route-map entries\n") | |
9168 | { | |
9169 | int type; | |
9170 | ||
e0ca5fde DL |
9171 | type = proto_redistnum (AFI_IP6, argv[0]); |
9172 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9173 | { |
9174 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9175 | return CMD_WARNING; | |
9176 | } | |
9177 | ||
9178 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); | |
9179 | return CMD_SUCCESS; | |
9180 | } | |
9181 | ||
9182 | DEFUN (no_bgp_redistribute_ipv6_metric, | |
9183 | no_bgp_redistribute_ipv6_metric_cmd, | |
e0ca5fde | 9184 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>", |
718e3744 | 9185 | NO_STR |
9186 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9187 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9188 | "Metric for redistributed routes\n" |
9189 | "Default metric\n") | |
9190 | { | |
9191 | int type; | |
9192 | ||
e0ca5fde DL |
9193 | type = proto_redistnum (AFI_IP6, argv[0]); |
9194 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9195 | { |
9196 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9197 | return CMD_WARNING; | |
9198 | } | |
9199 | ||
9200 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); | |
9201 | return CMD_SUCCESS; | |
9202 | } | |
9203 | ||
9204 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, | |
9205 | no_bgp_redistribute_ipv6_rmap_metric_cmd, | |
e0ca5fde | 9206 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>", |
718e3744 | 9207 | NO_STR |
9208 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9209 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9210 | "Route map reference\n" |
9211 | "Pointer to route-map entries\n" | |
9212 | "Metric for redistributed routes\n" | |
9213 | "Default metric\n") | |
9214 | { | |
9215 | int type; | |
9216 | ||
e0ca5fde DL |
9217 | type = proto_redistnum (AFI_IP6, argv[0]); |
9218 | if (type < 0 || type == ZEBRA_ROUTE_BGP) | |
718e3744 | 9219 | { |
9220 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
9221 | return CMD_WARNING; | |
9222 | } | |
9223 | ||
9224 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); | |
9225 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); | |
9226 | return CMD_SUCCESS; | |
9227 | } | |
9228 | ||
9229 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, | |
9230 | no_bgp_redistribute_ipv6_metric_rmap_cmd, | |
e0ca5fde | 9231 | "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD", |
718e3744 | 9232 | NO_STR |
9233 | "Redistribute information from another routing protocol\n" | |
e0ca5fde | 9234 | QUAGGA_IP6_REDIST_HELP_STR_BGPD |
718e3744 | 9235 | "Metric for redistributed routes\n" |
9236 | "Default metric\n" | |
9237 | "Route map reference\n" | |
9238 | "Pointer to route-map entries\n") | |
9239 | #endif /* HAVE_IPV6 */ | |
6b0655a2 | 9240 | |
718e3744 | 9241 | int |
9242 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
9243 | safi_t safi, int *write) | |
9244 | { | |
9245 | int i; | |
718e3744 | 9246 | |
9247 | /* Unicast redistribution only. */ | |
9248 | if (safi != SAFI_UNICAST) | |
9249 | return 0; | |
9250 | ||
9251 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
9252 | { | |
9253 | /* Redistribute BGP does not make sense. */ | |
9254 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) | |
9255 | { | |
9256 | /* Display "address-family" when it is not yet diplayed. */ | |
9257 | bgp_config_write_family_header (vty, afi, safi, write); | |
9258 | ||
9259 | /* "redistribute" configuration. */ | |
f52d13cb | 9260 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
718e3744 | 9261 | |
9262 | if (bgp->redist_metric_flag[afi][i]) | |
ddc943de | 9263 | vty_out (vty, " metric %u", bgp->redist_metric[afi][i]); |
718e3744 | 9264 | |
9265 | if (bgp->rmap[afi][i].name) | |
9266 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); | |
9267 | ||
9268 | vty_out (vty, "%s", VTY_NEWLINE); | |
9269 | } | |
9270 | } | |
9271 | return *write; | |
9272 | } | |
6b0655a2 | 9273 | |
718e3744 | 9274 | /* BGP node structure. */ |
7fc626de | 9275 | static struct cmd_node bgp_node = |
718e3744 | 9276 | { |
9277 | BGP_NODE, | |
9278 | "%s(config-router)# ", | |
9279 | 1, | |
9280 | }; | |
9281 | ||
7fc626de | 9282 | static struct cmd_node bgp_ipv4_unicast_node = |
718e3744 | 9283 | { |
9284 | BGP_IPV4_NODE, | |
9285 | "%s(config-router-af)# ", | |
9286 | 1, | |
9287 | }; | |
9288 | ||
7fc626de | 9289 | static struct cmd_node bgp_ipv4_multicast_node = |
718e3744 | 9290 | { |
9291 | BGP_IPV4M_NODE, | |
9292 | "%s(config-router-af)# ", | |
9293 | 1, | |
9294 | }; | |
9295 | ||
7fc626de | 9296 | static struct cmd_node bgp_ipv6_unicast_node = |
718e3744 | 9297 | { |
9298 | BGP_IPV6_NODE, | |
9299 | "%s(config-router-af)# ", | |
9300 | 1, | |
9301 | }; | |
9302 | ||
7fc626de | 9303 | static struct cmd_node bgp_ipv6_multicast_node = |
25ffbdc1 | 9304 | { |
9305 | BGP_IPV6M_NODE, | |
9306 | "%s(config-router-af)# ", | |
9307 | 1, | |
9308 | }; | |
9309 | ||
7fc626de | 9310 | static struct cmd_node bgp_vpnv4_node = |
718e3744 | 9311 | { |
9312 | BGP_VPNV4_NODE, | |
9313 | "%s(config-router-af)# ", | |
9314 | 1 | |
9315 | }; | |
6b0655a2 | 9316 | |
1f8ae70b | 9317 | static void community_list_vty (void); |
9318 | ||
718e3744 | 9319 | void |
94f2b392 | 9320 | bgp_vty_init (void) |
718e3744 | 9321 | { |
718e3744 | 9322 | /* Install bgp top node. */ |
9323 | install_node (&bgp_node, bgp_config_write); | |
9324 | install_node (&bgp_ipv4_unicast_node, NULL); | |
9325 | install_node (&bgp_ipv4_multicast_node, NULL); | |
9326 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 9327 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 9328 | install_node (&bgp_vpnv4_node, NULL); |
9329 | ||
9330 | /* Install default VTY commands to new nodes. */ | |
9331 | install_default (BGP_NODE); | |
9332 | install_default (BGP_IPV4_NODE); | |
9333 | install_default (BGP_IPV4M_NODE); | |
9334 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 9335 | install_default (BGP_IPV6M_NODE); |
718e3744 | 9336 | install_default (BGP_VPNV4_NODE); |
9337 | ||
9338 | /* "bgp multiple-instance" commands. */ | |
9339 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
9340 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
9341 | ||
9342 | /* "bgp config-type" commands. */ | |
9343 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
9344 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); | |
9345 | ||
9346 | /* Dummy commands (Currently not supported) */ | |
9347 | install_element (BGP_NODE, &no_synchronization_cmd); | |
9348 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
9349 | ||
9350 | /* "router bgp" commands. */ | |
9351 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
9352 | install_element (CONFIG_NODE, &router_bgp_view_cmd); | |
9353 | ||
9354 | /* "no router bgp" commands. */ | |
9355 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
9356 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); | |
9357 | ||
9358 | /* "bgp router-id" commands. */ | |
9359 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
9360 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
9361 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
9362 | ||
9363 | /* "bgp cluster-id" commands. */ | |
9364 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
9365 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
9366 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
9367 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); | |
9368 | ||
9369 | /* "bgp confederation" commands. */ | |
9370 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
9371 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
9372 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
9373 | ||
9374 | /* "bgp confederation peers" commands. */ | |
9375 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
9376 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
9377 | ||
f188f2c4 DS |
9378 | /* bgp update-delay command */ |
9379 | install_element (BGP_NODE, &bgp_update_delay_cmd); | |
9380 | install_element (BGP_NODE, &no_bgp_update_delay_cmd); | |
9381 | install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd); | |
9382 | install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd); | |
9383 | ||
165b5fff JB |
9384 | /* "maximum-paths" commands. */ |
9385 | install_element (BGP_NODE, &bgp_maxpaths_cmd); | |
9386 | install_element (BGP_NODE, &no_bgp_maxpaths_cmd); | |
9387 | install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd); | |
9388 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd); | |
9389 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd); | |
9390 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd); | |
431aa9f9 DS |
9391 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd); |
9392 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd); | |
9393 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd); | |
165b5fff | 9394 | install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 9395 | install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff JB |
9396 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd); |
9397 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 9398 | install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 9399 | install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 9400 | install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 9401 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd); |
5e242b0d | 9402 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 9403 | install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); |
431aa9f9 | 9404 | install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd); |
5e242b0d | 9405 | install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd); |
431aa9f9 DS |
9406 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd); |
9407 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd); | |
5e242b0d | 9408 | install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd); |
165b5fff | 9409 | |
718e3744 | 9410 | /* "timers bgp" commands. */ |
9411 | install_element (BGP_NODE, &bgp_timers_cmd); | |
9412 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
9413 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
9414 | ||
9415 | /* "bgp client-to-client reflection" commands */ | |
9416 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
9417 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
9418 | ||
9419 | /* "bgp always-compare-med" commands */ | |
9420 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
9421 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
9422 | ||
9423 | /* "bgp deterministic-med" commands */ | |
9424 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
9425 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 9426 | |
538621f2 | 9427 | /* "bgp graceful-restart" commands */ |
9428 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
9429 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 9430 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
9431 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
9432 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 9433 | |
9434 | /* "bgp fast-external-failover" commands */ | |
9435 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
9436 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
9437 | ||
9438 | /* "bgp enforce-first-as" commands */ | |
9439 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
9440 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
9441 | ||
9442 | /* "bgp bestpath compare-routerid" commands */ | |
9443 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
9444 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
9445 | ||
9446 | /* "bgp bestpath as-path ignore" commands */ | |
9447 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
9448 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
9449 | ||
6811845b | 9450 | /* "bgp bestpath as-path confed" commands */ |
9451 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
9452 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
9453 | ||
2fdd455c PM |
9454 | /* "bgp bestpath as-path multipath-relax" commands */ |
9455 | install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); | |
9456 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); | |
9457 | ||
848973c7 | 9458 | /* "bgp log-neighbor-changes" commands */ |
9459 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
9460 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
9461 | ||
718e3744 | 9462 | /* "bgp bestpath med" commands */ |
9463 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
9464 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
9465 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
9466 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
9467 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
9468 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
9469 | ||
9470 | /* "no bgp default ipv4-unicast" commands. */ | |
9471 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
9472 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
9473 | ||
9474 | /* "bgp network import-check" commands. */ | |
9475 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
9476 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); | |
9477 | ||
9478 | /* "bgp default local-preference" commands. */ | |
9479 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
9480 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
9481 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
9482 | ||
9483 | /* "neighbor remote-as" commands. */ | |
9484 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
9485 | install_element (BGP_NODE, &no_neighbor_cmd); | |
9486 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
9487 | ||
9488 | /* "neighbor peer-group" commands. */ | |
9489 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
9490 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
9491 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); | |
9492 | ||
9493 | /* "neighbor local-as" commands. */ | |
9494 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
9495 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
9d3f9705 | 9496 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd); |
718e3744 | 9497 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); |
9498 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
9499 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
9d3f9705 | 9500 | install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd); |
718e3744 | 9501 | |
0df7c91f PJ |
9502 | /* "neighbor password" commands. */ |
9503 | install_element (BGP_NODE, &neighbor_password_cmd); | |
9504 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
9505 | ||
718e3744 | 9506 | /* "neighbor activate" commands. */ |
9507 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
9508 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
9509 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
9510 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 9511 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 9512 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
9513 | ||
9514 | /* "no neighbor activate" commands. */ | |
9515 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
9516 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
9517 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
9518 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 9519 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 9520 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
9521 | ||
9522 | /* "neighbor peer-group set" commands. */ | |
9523 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); | |
9524 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
9525 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
9526 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 9527 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 9528 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
9529 | ||
718e3744 | 9530 | /* "no neighbor peer-group unset" commands. */ |
9531 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
9532 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
9533 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
9534 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 9535 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 9536 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
9537 | ||
718e3744 | 9538 | /* "neighbor softreconfiguration inbound" commands.*/ |
9539 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
9540 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
9541 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
9542 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
9543 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
9544 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
9545 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
9546 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 9547 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
9548 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 9549 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
9550 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 9551 | |
9552 | /* "neighbor attribute-unchanged" commands. */ | |
9553 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
9554 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
9555 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
9556 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
9557 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
9558 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
9559 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
9560 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
9561 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
9562 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
9563 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
9564 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
9565 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9566 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9567 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9568 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9569 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9570 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9571 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9572 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9573 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9574 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
9575 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
9576 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
9577 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
9578 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
9579 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
9580 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
9581 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
9582 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
9583 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
9584 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
9585 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
9586 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
9587 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9588 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9589 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9590 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9591 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9592 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9593 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9594 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9595 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9596 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
9597 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
9598 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
9599 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
9600 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
9601 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
9602 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
9603 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
9604 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
9605 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
9606 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
9607 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
9608 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
9609 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9610 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9611 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9612 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9613 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9614 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9615 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9616 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9617 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9618 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
9619 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
9620 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
9621 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
9622 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
9623 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
9624 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
9625 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
9626 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
9627 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
9628 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
9629 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
9630 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
9631 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9632 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9633 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9634 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9635 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9636 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9637 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9638 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9639 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9640 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 9641 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
9642 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
9643 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
9644 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
9645 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
9646 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
9647 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
9648 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
9649 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
9650 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
9651 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
9652 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
9653 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9654 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9655 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9656 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9657 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9658 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9659 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9660 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9661 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9662 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 9663 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
9664 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
9665 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
9666 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
9667 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
9668 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
9669 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
9670 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
9671 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
9672 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
9673 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
9674 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
9675 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9676 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9677 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9678 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9679 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9680 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9681 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9682 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9683 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9684 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
9685 | ||
fee0f4c6 | 9686 | /* "nexthop-local unchanged" commands */ |
9687 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
9688 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
9689 | ||
718e3744 | 9690 | /* "transparent-as" and "transparent-nexthop" for old version |
9691 | compatibility. */ | |
9692 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); | |
9693 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); | |
9694 | ||
9695 | /* "neighbor next-hop-self" commands. */ | |
9696 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
9697 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
9698 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
9699 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
9700 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
9701 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
9702 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
9703 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 9704 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
9705 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 9706 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
9707 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
9708 | ||
9709 | /* "neighbor remove-private-AS" commands. */ | |
9710 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
9711 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
9712 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); | |
9713 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
9714 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); | |
9715 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
9716 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); | |
9717 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
25ffbdc1 | 9718 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
9719 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
718e3744 | 9720 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
9721 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
9722 | ||
9723 | /* "neighbor send-community" commands.*/ | |
9724 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
9725 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
9726 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
9727 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
9728 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
9729 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
9730 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
9731 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
9732 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
9733 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
9734 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
9735 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
9736 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
9737 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
9738 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
9739 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 9740 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
9741 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
9742 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
9743 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 9744 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
9745 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
9746 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
9747 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
9748 | ||
9749 | /* "neighbor route-reflector" commands.*/ | |
9750 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
9751 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
9752 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
9753 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
9754 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
9755 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
9756 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
9757 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 9758 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
9759 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 9760 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
9761 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
9762 | ||
9763 | /* "neighbor route-server" commands.*/ | |
9764 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
9765 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
9766 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
9767 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
9768 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
9769 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
9770 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
9771 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 9772 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
9773 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 9774 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
9775 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
9776 | ||
9777 | /* "neighbor passive" commands. */ | |
9778 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
9779 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
9780 | ||
9781 | /* "neighbor shutdown" commands. */ | |
9782 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
9783 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
9784 | ||
c9502438 | 9785 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
718e3744 | 9786 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
9787 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); | |
9788 | ||
9789 | /* "neighbor capability orf prefix-list" commands.*/ | |
9790 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
9791 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
9792 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
9793 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
9794 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
9795 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
9796 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
9797 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 9798 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
9799 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 9800 | |
9801 | /* "neighbor capability dynamic" commands.*/ | |
9802 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
9803 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
9804 | ||
9805 | /* "neighbor dont-capability-negotiate" commands. */ | |
9806 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
9807 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
9808 | ||
9809 | /* "neighbor ebgp-multihop" commands. */ | |
9810 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
9811 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
9812 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
9813 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
9814 | ||
6ffd2079 | 9815 | /* "neighbor disable-connected-check" commands. */ |
9816 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
9817 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 9818 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
9819 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
9820 | ||
9821 | /* "neighbor description" commands. */ | |
9822 | install_element (BGP_NODE, &neighbor_description_cmd); | |
9823 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
9824 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
9825 | ||
9826 | /* "neighbor update-source" commands. "*/ | |
9827 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
9828 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
9829 | ||
9830 | /* "neighbor default-originate" commands. */ | |
9831 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
9832 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
9833 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
9834 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
9835 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
9836 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
9837 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
9838 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
9839 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
9840 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
9841 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
9842 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
9843 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
9844 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
9845 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
9846 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 9847 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
9848 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
9849 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
9850 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 9851 | |
9852 | /* "neighbor port" commands. */ | |
9853 | install_element (BGP_NODE, &neighbor_port_cmd); | |
9854 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
9855 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
9856 | ||
9857 | /* "neighbor weight" commands. */ | |
9858 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
9859 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
9860 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
9861 | ||
9862 | /* "neighbor override-capability" commands. */ | |
9863 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
9864 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
9865 | ||
9866 | /* "neighbor strict-capability-match" commands. */ | |
9867 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
9868 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
9869 | ||
9870 | /* "neighbor timers" commands. */ | |
9871 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
9872 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
9873 | ||
9874 | /* "neighbor timers connect" commands. */ | |
9875 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
9876 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
9877 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
9878 | ||
9879 | /* "neighbor advertisement-interval" commands. */ | |
9880 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
9881 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
9882 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
9883 | ||
9884 | /* "neighbor version" commands. */ | |
9885 | install_element (BGP_NODE, &neighbor_version_cmd); | |
718e3744 | 9886 | |
9887 | /* "neighbor interface" commands. */ | |
9888 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
9889 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
9890 | ||
9891 | /* "neighbor distribute" commands. */ | |
9892 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
9893 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
9894 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
9895 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
9896 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
9897 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
9898 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
9899 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 9900 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
9901 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 9902 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
9903 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
9904 | ||
9905 | /* "neighbor prefix-list" commands. */ | |
9906 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
9907 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
9908 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
9909 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
9910 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
9911 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
9912 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
9913 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 9914 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
9915 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 9916 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
9917 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
9918 | ||
9919 | /* "neighbor filter-list" commands. */ | |
9920 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
9921 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
9922 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
9923 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
9924 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
9925 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
9926 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
9927 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 9928 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
9929 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 9930 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
9931 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
9932 | ||
9933 | /* "neighbor route-map" commands. */ | |
9934 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
9935 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
9936 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
9937 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
9938 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
9939 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
9940 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
9941 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 9942 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
9943 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 9944 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
9945 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
9946 | ||
9947 | /* "neighbor unsuppress-map" commands. */ | |
9948 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
9949 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
9950 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
9951 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
9952 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
9953 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
9954 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
9955 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 9956 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
9957 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 9958 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
9959 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 9960 | |
9961 | /* "neighbor maximum-prefix" commands. */ | |
9962 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 9963 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 9964 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 9965 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 9966 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
9967 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9968 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
9969 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 9970 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
9971 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
9972 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
9973 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
9974 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9975 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 9976 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 9977 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 9978 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 9979 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
9980 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9981 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
9982 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 9983 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
9984 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
9985 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
9986 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
9987 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9988 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 9989 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 9990 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 9991 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 9992 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
9993 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9994 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
9995 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 9996 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
9997 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
9998 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
9999 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10000 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10001 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 10002 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 10003 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 10004 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 10005 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
10006 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10007 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
10008 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 10009 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
10010 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10011 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10012 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10013 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 10014 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
10015 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
10016 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
10017 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
10018 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
10019 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
10020 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
10021 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
10022 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
10023 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10024 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10025 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10026 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10027 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 10028 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 10029 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 10030 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 10031 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
10032 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10033 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
10034 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 10035 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
10036 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
10037 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
10038 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
10039 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 10040 | |
10041 | /* "neighbor allowas-in" */ | |
10042 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
10043 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
10044 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
10045 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); | |
10046 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
10047 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
10048 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); | |
10049 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
10050 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
10051 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); | |
10052 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
10053 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
25ffbdc1 | 10054 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
10055 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
10056 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
718e3744 | 10057 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
10058 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
10059 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
10060 | ||
10061 | /* address-family commands. */ | |
10062 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
10063 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
10064 | #ifdef HAVE_IPV6 | |
10065 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 10066 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 10067 | #endif /* HAVE_IPV6 */ |
10068 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
10069 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
10070 | ||
10071 | /* "exit-address-family" command. */ | |
10072 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
10073 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
10074 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 10075 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 10076 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
10077 | ||
10078 | /* "clear ip bgp commands" */ | |
10079 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
10080 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
10081 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
10082 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); | |
10083 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); | |
10084 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); | |
10085 | #ifdef HAVE_IPV6 | |
10086 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); | |
10087 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
10088 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
10089 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); | |
10090 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); | |
10091 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); | |
10092 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); | |
10093 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); | |
10094 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); | |
10095 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); | |
10096 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); | |
10097 | #endif /* HAVE_IPV6 */ | |
10098 | ||
10099 | /* "clear ip bgp neighbor soft in" */ | |
10100 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
10101 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
10102 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
10103 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); | |
10104 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); | |
10105 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); | |
10106 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); | |
10107 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); | |
10108 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
10109 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); | |
10110 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); | |
10111 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
10112 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); | |
10113 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); | |
10114 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
10115 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); | |
10116 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); | |
10117 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
10118 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
10119 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
10120 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); | |
10121 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); | |
10122 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); | |
10123 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); | |
10124 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); | |
10125 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
10126 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); | |
10127 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); | |
10128 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
10129 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); | |
10130 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); | |
10131 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
10132 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); | |
10133 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); | |
10134 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
10135 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
10136 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
10137 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
10138 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
10139 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
10140 | #ifdef HAVE_IPV6 | |
10141 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); | |
10142 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
10143 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
10144 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); | |
10145 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
10146 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); | |
10147 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); | |
10148 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
10149 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); | |
10150 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); | |
10151 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
10152 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); | |
10153 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); | |
10154 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
10155 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); | |
10156 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); | |
10157 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
10158 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); | |
10159 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); | |
10160 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
10161 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); | |
10162 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); | |
10163 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
10164 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); | |
10165 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); | |
10166 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
10167 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); | |
10168 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); | |
10169 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
10170 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); | |
10171 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); | |
10172 | #endif /* HAVE_IPV6 */ | |
10173 | ||
10174 | /* "clear ip bgp neighbor soft out" */ | |
10175 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
10176 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
10177 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
10178 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); | |
10179 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); | |
10180 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); | |
10181 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); | |
10182 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); | |
10183 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); | |
10184 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); | |
10185 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); | |
10186 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); | |
10187 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
10188 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
10189 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); | |
10190 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); | |
10191 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); | |
10192 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); | |
10193 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); | |
10194 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); | |
10195 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); | |
10196 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); | |
10197 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); | |
10198 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
10199 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
10200 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
10201 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
10202 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
10203 | #ifdef HAVE_IPV6 | |
10204 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); | |
10205 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
10206 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
10207 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); | |
10208 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); | |
10209 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); | |
10210 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); | |
10211 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); | |
10212 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); | |
10213 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); | |
10214 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); | |
10215 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); | |
10216 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); | |
10217 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); | |
10218 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); | |
10219 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); | |
10220 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); | |
10221 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); | |
10222 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); | |
10223 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); | |
10224 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); | |
10225 | #endif /* HAVE_IPV6 */ | |
10226 | ||
10227 | /* "clear ip bgp neighbor soft" */ | |
10228 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
10229 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
10230 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
10231 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); | |
10232 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); | |
10233 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); | |
10234 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); | |
10235 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
10236 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
10237 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); | |
10238 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); | |
10239 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); | |
10240 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); | |
10241 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
10242 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
10243 | #ifdef HAVE_IPV6 | |
10244 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); | |
10245 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
10246 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
10247 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); | |
10248 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); | |
10249 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); | |
10250 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); | |
10251 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); | |
10252 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); | |
10253 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); | |
10254 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); | |
10255 | #endif /* HAVE_IPV6 */ | |
10256 | ||
fee0f4c6 | 10257 | /* "clear ip bgp neighbor rsclient" */ |
10258 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); | |
10259 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); | |
10260 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); | |
10261 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); | |
10262 | #ifdef HAVE_IPV6 | |
10263 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); | |
10264 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); | |
10265 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); | |
10266 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); | |
10267 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); | |
10268 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); | |
10269 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); | |
10270 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); | |
10271 | #endif /* HAVE_IPV6 */ | |
10272 | ||
718e3744 | 10273 | /* "show ip bgp summary" commands. */ |
10274 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
47fc97cc | 10275 | install_element (VIEW_NODE, &show_ip_bgp_summary_csv_cmd); |
718e3744 | 10276 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); |
10277 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 10278 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 10279 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 10280 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 10281 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
10282 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
10283 | #ifdef HAVE_IPV6 | |
10284 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
47fc97cc | 10285 | install_element (VIEW_NODE, &show_bgp_summary_csv_cmd); |
718e3744 | 10286 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); |
10287 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 10288 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 10289 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 10290 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
62687ff1 PJ |
10291 | #endif /* HAVE_IPV6 */ |
10292 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
47fc97cc | 10293 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_csv_cmd); |
62687ff1 PJ |
10294 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); |
10295 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 10296 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd); |
62687ff1 | 10297 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 10298 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
62687ff1 PJ |
10299 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
10300 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
10301 | #ifdef HAVE_IPV6 | |
10302 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
47fc97cc | 10303 | install_element (RESTRICTED_NODE, &show_bgp_summary_csv_cmd); |
62687ff1 PJ |
10304 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); |
10305 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 10306 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd); |
62687ff1 | 10307 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 10308 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 10309 | #endif /* HAVE_IPV6 */ |
10310 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
47fc97cc | 10311 | install_element (ENABLE_NODE, &show_ip_bgp_summary_csv_cmd); |
718e3744 | 10312 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); |
10313 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
95cbbd2a | 10314 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd); |
718e3744 | 10315 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); |
95cbbd2a | 10316 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd); |
718e3744 | 10317 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); |
10318 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
10319 | #ifdef HAVE_IPV6 | |
10320 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
47fc97cc | 10321 | install_element (ENABLE_NODE, &show_bgp_summary_csv_cmd); |
718e3744 | 10322 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); |
10323 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); | |
95cbbd2a | 10324 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd); |
718e3744 | 10325 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); |
95cbbd2a | 10326 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); |
718e3744 | 10327 | #endif /* HAVE_IPV6 */ |
10328 | ||
10329 | /* "show ip bgp neighbors" commands. */ | |
10330 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
10331 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
10332 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
10333 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
10334 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
10335 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
10336 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
10337 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
10338 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
10339 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
62687ff1 PJ |
10340 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
10341 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
10342 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
10343 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
10344 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 10345 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
10346 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
10347 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
10348 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
10349 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
10350 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
10351 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
10352 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
10353 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
10354 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
10355 | ||
10356 | #ifdef HAVE_IPV6 | |
10357 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
10358 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
10359 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
10360 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 10361 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
10362 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
10363 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
10364 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
10365 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
10366 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
10367 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
10368 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 10369 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
10370 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
10371 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
10372 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 10373 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
10374 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
10375 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
10376 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 10377 | |
10378 | /* Old commands. */ | |
10379 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
10380 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
10381 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
10382 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
10383 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 10384 | |
10385 | /* "show ip bgp rsclient" commands. */ | |
10386 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); | |
10387 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
10388 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
10389 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
10390 | install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
10391 | install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
10392 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
10393 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
10394 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
10395 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
10396 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
10397 | install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 10398 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
10399 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
10400 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
10401 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
95cbbd2a ML |
10402 | install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd); |
10403 | install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd); | |
fee0f4c6 | 10404 | |
10405 | #ifdef HAVE_IPV6 | |
10406 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); | |
10407 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
10408 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
10409 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
10410 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
10411 | install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
62687ff1 PJ |
10412 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
10413 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
10414 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
10415 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
10416 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
10417 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 10418 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
10419 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
10420 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
10421 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
95cbbd2a ML |
10422 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd); |
10423 | install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd); | |
fee0f4c6 | 10424 | #endif /* HAVE_IPV6 */ |
718e3744 | 10425 | |
10426 | /* "show ip bgp paths" commands. */ | |
10427 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
10428 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
10429 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
10430 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
10431 | ||
10432 | /* "show ip bgp community" commands. */ | |
10433 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
10434 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
10435 | ||
10436 | /* "show ip bgp attribute-info" commands. */ | |
10437 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
10438 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
10439 | ||
10440 | /* "redistribute" commands. */ | |
10441 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
10442 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
10443 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
10444 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
10445 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
10446 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
10447 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
10448 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
10449 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
10450 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
10451 | #ifdef HAVE_IPV6 | |
10452 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
10453 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
10454 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
10455 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
10456 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
10457 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
10458 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
10459 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
10460 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
10461 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
10462 | #endif /* HAVE_IPV6 */ | |
10463 | ||
fa411a21 NH |
10464 | /* ttl_security commands */ |
10465 | install_element (BGP_NODE, &neighbor_ttl_security_cmd); | |
10466 | install_element (BGP_NODE, &no_neighbor_ttl_security_cmd); | |
10467 | ||
4bf6a362 PJ |
10468 | /* "show bgp memory" commands. */ |
10469 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 10470 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
10471 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
10472 | ||
e0081f70 ML |
10473 | /* "show bgp views" commands. */ |
10474 | install_element (VIEW_NODE, &show_bgp_views_cmd); | |
10475 | install_element (RESTRICTED_NODE, &show_bgp_views_cmd); | |
10476 | install_element (ENABLE_NODE, &show_bgp_views_cmd); | |
10477 | ||
718e3744 | 10478 | /* Community-list. */ |
10479 | community_list_vty (); | |
10480 | } | |
6b0655a2 | 10481 | |
718e3744 | 10482 | #include "memory.h" |
10483 | #include "bgp_regex.h" | |
10484 | #include "bgp_clist.h" | |
10485 | #include "bgp_ecommunity.h" | |
10486 | ||
10487 | /* VTY functions. */ | |
10488 | ||
10489 | /* Direction value to string conversion. */ | |
94f2b392 | 10490 | static const char * |
718e3744 | 10491 | community_direct_str (int direct) |
10492 | { | |
10493 | switch (direct) | |
10494 | { | |
10495 | case COMMUNITY_DENY: | |
10496 | return "deny"; | |
718e3744 | 10497 | case COMMUNITY_PERMIT: |
10498 | return "permit"; | |
718e3744 | 10499 | default: |
10500 | return "unknown"; | |
718e3744 | 10501 | } |
10502 | } | |
10503 | ||
10504 | /* Display error string. */ | |
94f2b392 | 10505 | static void |
718e3744 | 10506 | community_list_perror (struct vty *vty, int ret) |
10507 | { | |
10508 | switch (ret) | |
10509 | { | |
10510 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
b729294c | 10511 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 10512 | break; |
10513 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
10514 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
10515 | break; | |
10516 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
10517 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
10518 | break; | |
10519 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
10520 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
10521 | break; | |
10522 | } | |
10523 | } | |
10524 | ||
10525 | /* VTY interface for community_set() function. */ | |
94f2b392 | 10526 | static int |
fd79ac91 | 10527 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
10528 | int style, int reject_all_digit_name) | |
718e3744 | 10529 | { |
10530 | int ret; | |
10531 | int direct; | |
10532 | char *str; | |
10533 | ||
10534 | /* Check the list type. */ | |
10535 | if (strncmp (argv[1], "p", 1) == 0) | |
10536 | direct = COMMUNITY_PERMIT; | |
10537 | else if (strncmp (argv[1], "d", 1) == 0) | |
10538 | direct = COMMUNITY_DENY; | |
10539 | else | |
10540 | { | |
10541 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
10542 | VTY_NEWLINE); | |
10543 | return CMD_WARNING; | |
10544 | } | |
10545 | ||
10546 | /* All digit name check. */ | |
10547 | if (reject_all_digit_name && all_digit (argv[0])) | |
10548 | { | |
10549 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
10550 | return CMD_WARNING; | |
10551 | } | |
10552 | ||
10553 | /* Concat community string argument. */ | |
10554 | if (argc > 1) | |
10555 | str = argv_concat (argv, argc, 2); | |
10556 | else | |
10557 | str = NULL; | |
10558 | ||
10559 | /* When community_list_set() return nevetive value, it means | |
10560 | malformed community string. */ | |
10561 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
10562 | ||
10563 | /* Free temporary community list string allocated by | |
10564 | argv_concat(). */ | |
10565 | if (str) | |
10566 | XFREE (MTYPE_TMP, str); | |
10567 | ||
10568 | if (ret < 0) | |
10569 | { | |
10570 | /* Display error string. */ | |
10571 | community_list_perror (vty, ret); | |
10572 | return CMD_WARNING; | |
10573 | } | |
10574 | ||
10575 | return CMD_SUCCESS; | |
10576 | } | |
10577 | ||
718e3744 | 10578 | /* Communiyt-list entry delete. */ |
94f2b392 | 10579 | static int |
fee6e4e4 | 10580 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
10581 | int style) | |
718e3744 | 10582 | { |
10583 | int ret; | |
fee6e4e4 | 10584 | int direct = 0; |
10585 | char *str = NULL; | |
718e3744 | 10586 | |
fee6e4e4 | 10587 | if (argc > 1) |
718e3744 | 10588 | { |
fee6e4e4 | 10589 | /* Check the list direct. */ |
10590 | if (strncmp (argv[1], "p", 1) == 0) | |
10591 | direct = COMMUNITY_PERMIT; | |
10592 | else if (strncmp (argv[1], "d", 1) == 0) | |
10593 | direct = COMMUNITY_DENY; | |
10594 | else | |
10595 | { | |
10596 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
10597 | VTY_NEWLINE); | |
10598 | return CMD_WARNING; | |
10599 | } | |
718e3744 | 10600 | |
fee6e4e4 | 10601 | /* Concat community string argument. */ |
10602 | str = argv_concat (argv, argc, 2); | |
10603 | } | |
718e3744 | 10604 | |
10605 | /* Unset community list. */ | |
10606 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); | |
10607 | ||
10608 | /* Free temporary community list string allocated by | |
10609 | argv_concat(). */ | |
fee6e4e4 | 10610 | if (str) |
10611 | XFREE (MTYPE_TMP, str); | |
718e3744 | 10612 | |
10613 | if (ret < 0) | |
10614 | { | |
10615 | community_list_perror (vty, ret); | |
10616 | return CMD_WARNING; | |
10617 | } | |
10618 | ||
10619 | return CMD_SUCCESS; | |
10620 | } | |
10621 | ||
10622 | /* "community-list" keyword help string. */ | |
10623 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
10624 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" | |
10625 | ||
718e3744 | 10626 | DEFUN (ip_community_list_standard, |
10627 | ip_community_list_standard_cmd, | |
10628 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
10629 | IP_STR | |
10630 | COMMUNITY_LIST_STR | |
10631 | "Community list number (standard)\n" | |
10632 | "Specify community to reject\n" | |
10633 | "Specify community to accept\n" | |
10634 | COMMUNITY_VAL_STR) | |
10635 | { | |
10636 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
10637 | } | |
10638 | ||
10639 | ALIAS (ip_community_list_standard, | |
10640 | ip_community_list_standard2_cmd, | |
10641 | "ip community-list <1-99> (deny|permit)", | |
10642 | IP_STR | |
10643 | COMMUNITY_LIST_STR | |
10644 | "Community list number (standard)\n" | |
10645 | "Specify community to reject\n" | |
10646 | "Specify community to accept\n") | |
10647 | ||
10648 | DEFUN (ip_community_list_expanded, | |
10649 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 10650 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 10651 | IP_STR |
10652 | COMMUNITY_LIST_STR | |
10653 | "Community list number (expanded)\n" | |
10654 | "Specify community to reject\n" | |
10655 | "Specify community to accept\n" | |
10656 | "An ordered list as a regular-expression\n") | |
10657 | { | |
10658 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
10659 | } | |
10660 | ||
10661 | DEFUN (ip_community_list_name_standard, | |
10662 | ip_community_list_name_standard_cmd, | |
10663 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
10664 | IP_STR | |
10665 | COMMUNITY_LIST_STR | |
10666 | "Add a standard community-list entry\n" | |
10667 | "Community list name\n" | |
10668 | "Specify community to reject\n" | |
10669 | "Specify community to accept\n" | |
10670 | COMMUNITY_VAL_STR) | |
10671 | { | |
10672 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
10673 | } | |
10674 | ||
10675 | ALIAS (ip_community_list_name_standard, | |
10676 | ip_community_list_name_standard2_cmd, | |
10677 | "ip community-list standard WORD (deny|permit)", | |
10678 | IP_STR | |
10679 | COMMUNITY_LIST_STR | |
10680 | "Add a standard community-list entry\n" | |
10681 | "Community list name\n" | |
10682 | "Specify community to reject\n" | |
10683 | "Specify community to accept\n") | |
10684 | ||
10685 | DEFUN (ip_community_list_name_expanded, | |
10686 | ip_community_list_name_expanded_cmd, | |
10687 | "ip community-list expanded WORD (deny|permit) .LINE", | |
10688 | IP_STR | |
10689 | COMMUNITY_LIST_STR | |
10690 | "Add an expanded community-list entry\n" | |
10691 | "Community list name\n" | |
10692 | "Specify community to reject\n" | |
10693 | "Specify community to accept\n" | |
10694 | "An ordered list as a regular-expression\n") | |
10695 | { | |
10696 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
10697 | } | |
10698 | ||
fee6e4e4 | 10699 | DEFUN (no_ip_community_list_standard_all, |
10700 | no_ip_community_list_standard_all_cmd, | |
10701 | "no ip community-list <1-99>", | |
10702 | NO_STR | |
10703 | IP_STR | |
10704 | COMMUNITY_LIST_STR | |
10705 | "Community list number (standard)\n") | |
10706 | { | |
10707 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
10708 | } | |
10709 | ||
10710 | DEFUN (no_ip_community_list_expanded_all, | |
10711 | no_ip_community_list_expanded_all_cmd, | |
10712 | "no ip community-list <100-500>", | |
718e3744 | 10713 | NO_STR |
10714 | IP_STR | |
10715 | COMMUNITY_LIST_STR | |
718e3744 | 10716 | "Community list number (expanded)\n") |
10717 | { | |
fee6e4e4 | 10718 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 10719 | } |
10720 | ||
fee6e4e4 | 10721 | DEFUN (no_ip_community_list_name_standard_all, |
10722 | no_ip_community_list_name_standard_all_cmd, | |
10723 | "no ip community-list standard WORD", | |
718e3744 | 10724 | NO_STR |
10725 | IP_STR | |
10726 | COMMUNITY_LIST_STR | |
10727 | "Add a standard community-list entry\n" | |
718e3744 | 10728 | "Community list name\n") |
10729 | { | |
fee6e4e4 | 10730 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
718e3744 | 10731 | } |
10732 | ||
fee6e4e4 | 10733 | DEFUN (no_ip_community_list_name_expanded_all, |
10734 | no_ip_community_list_name_expanded_all_cmd, | |
10735 | "no ip community-list expanded WORD", | |
718e3744 | 10736 | NO_STR |
10737 | IP_STR | |
10738 | COMMUNITY_LIST_STR | |
fee6e4e4 | 10739 | "Add an expanded community-list entry\n" |
10740 | "Community list name\n") | |
718e3744 | 10741 | { |
fee6e4e4 | 10742 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 10743 | } |
10744 | ||
10745 | DEFUN (no_ip_community_list_standard, | |
10746 | no_ip_community_list_standard_cmd, | |
10747 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
10748 | NO_STR | |
10749 | IP_STR | |
10750 | COMMUNITY_LIST_STR | |
10751 | "Community list number (standard)\n" | |
10752 | "Specify community to reject\n" | |
10753 | "Specify community to accept\n" | |
10754 | COMMUNITY_VAL_STR) | |
10755 | { | |
10756 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
10757 | } | |
10758 | ||
10759 | DEFUN (no_ip_community_list_expanded, | |
10760 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 10761 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 10762 | NO_STR |
10763 | IP_STR | |
10764 | COMMUNITY_LIST_STR | |
10765 | "Community list number (expanded)\n" | |
10766 | "Specify community to reject\n" | |
10767 | "Specify community to accept\n" | |
10768 | "An ordered list as a regular-expression\n") | |
10769 | { | |
10770 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
10771 | } | |
10772 | ||
10773 | DEFUN (no_ip_community_list_name_standard, | |
10774 | no_ip_community_list_name_standard_cmd, | |
10775 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
10776 | NO_STR | |
10777 | IP_STR | |
10778 | COMMUNITY_LIST_STR | |
10779 | "Specify a standard community-list\n" | |
10780 | "Community list name\n" | |
10781 | "Specify community to reject\n" | |
10782 | "Specify community to accept\n" | |
10783 | COMMUNITY_VAL_STR) | |
10784 | { | |
10785 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
10786 | } | |
10787 | ||
10788 | DEFUN (no_ip_community_list_name_expanded, | |
10789 | no_ip_community_list_name_expanded_cmd, | |
10790 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
10791 | NO_STR | |
10792 | IP_STR | |
10793 | COMMUNITY_LIST_STR | |
10794 | "Specify an expanded community-list\n" | |
10795 | "Community list name\n" | |
10796 | "Specify community to reject\n" | |
10797 | "Specify community to accept\n" | |
10798 | "An ordered list as a regular-expression\n") | |
10799 | { | |
10800 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
10801 | } | |
10802 | ||
94f2b392 | 10803 | static void |
718e3744 | 10804 | community_list_show (struct vty *vty, struct community_list *list) |
10805 | { | |
10806 | struct community_entry *entry; | |
10807 | ||
10808 | for (entry = list->head; entry; entry = entry->next) | |
10809 | { | |
10810 | if (entry == list->head) | |
10811 | { | |
10812 | if (all_digit (list->name)) | |
10813 | vty_out (vty, "Community %s list %s%s", | |
10814 | entry->style == COMMUNITY_LIST_STANDARD ? | |
10815 | "standard" : "(expanded) access", | |
10816 | list->name, VTY_NEWLINE); | |
10817 | else | |
10818 | vty_out (vty, "Named Community %s list %s%s", | |
10819 | entry->style == COMMUNITY_LIST_STANDARD ? | |
10820 | "standard" : "expanded", | |
10821 | list->name, VTY_NEWLINE); | |
10822 | } | |
10823 | if (entry->any) | |
10824 | vty_out (vty, " %s%s", | |
10825 | community_direct_str (entry->direct), VTY_NEWLINE); | |
10826 | else | |
10827 | vty_out (vty, " %s %s%s", | |
10828 | community_direct_str (entry->direct), | |
10829 | entry->style == COMMUNITY_LIST_STANDARD | |
10830 | ? community_str (entry->u.com) : entry->config, | |
10831 | VTY_NEWLINE); | |
10832 | } | |
10833 | } | |
10834 | ||
10835 | DEFUN (show_ip_community_list, | |
10836 | show_ip_community_list_cmd, | |
10837 | "show ip community-list", | |
10838 | SHOW_STR | |
10839 | IP_STR | |
10840 | "List community-list\n") | |
10841 | { | |
10842 | struct community_list *list; | |
10843 | struct community_list_master *cm; | |
10844 | ||
fee6e4e4 | 10845 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 10846 | if (! cm) |
10847 | return CMD_SUCCESS; | |
10848 | ||
10849 | for (list = cm->num.head; list; list = list->next) | |
10850 | community_list_show (vty, list); | |
10851 | ||
10852 | for (list = cm->str.head; list; list = list->next) | |
10853 | community_list_show (vty, list); | |
10854 | ||
10855 | return CMD_SUCCESS; | |
10856 | } | |
10857 | ||
10858 | DEFUN (show_ip_community_list_arg, | |
10859 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 10860 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 10861 | SHOW_STR |
10862 | IP_STR | |
10863 | "List community-list\n" | |
10864 | "Community-list number\n" | |
10865 | "Community-list name\n") | |
10866 | { | |
10867 | struct community_list *list; | |
10868 | ||
fee6e4e4 | 10869 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 10870 | if (! list) |
10871 | { | |
b729294c | 10872 | vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE); |
718e3744 | 10873 | return CMD_WARNING; |
10874 | } | |
10875 | ||
10876 | community_list_show (vty, list); | |
10877 | ||
10878 | return CMD_SUCCESS; | |
10879 | } | |
6b0655a2 | 10880 | |
94f2b392 | 10881 | static int |
fd79ac91 | 10882 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
10883 | int style, int reject_all_digit_name) | |
718e3744 | 10884 | { |
10885 | int ret; | |
10886 | int direct; | |
10887 | char *str; | |
10888 | ||
10889 | /* Check the list type. */ | |
10890 | if (strncmp (argv[1], "p", 1) == 0) | |
10891 | direct = COMMUNITY_PERMIT; | |
10892 | else if (strncmp (argv[1], "d", 1) == 0) | |
10893 | direct = COMMUNITY_DENY; | |
10894 | else | |
10895 | { | |
10896 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
10897 | VTY_NEWLINE); | |
10898 | return CMD_WARNING; | |
10899 | } | |
10900 | ||
10901 | /* All digit name check. */ | |
10902 | if (reject_all_digit_name && all_digit (argv[0])) | |
10903 | { | |
10904 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
10905 | return CMD_WARNING; | |
10906 | } | |
10907 | ||
10908 | /* Concat community string argument. */ | |
10909 | if (argc > 1) | |
10910 | str = argv_concat (argv, argc, 2); | |
10911 | else | |
10912 | str = NULL; | |
10913 | ||
10914 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
10915 | ||
10916 | /* Free temporary community list string allocated by | |
10917 | argv_concat(). */ | |
10918 | if (str) | |
10919 | XFREE (MTYPE_TMP, str); | |
10920 | ||
10921 | if (ret < 0) | |
10922 | { | |
10923 | community_list_perror (vty, ret); | |
10924 | return CMD_WARNING; | |
10925 | } | |
10926 | return CMD_SUCCESS; | |
10927 | } | |
10928 | ||
94f2b392 | 10929 | static int |
fee6e4e4 | 10930 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
10931 | int style) | |
718e3744 | 10932 | { |
10933 | int ret; | |
fee6e4e4 | 10934 | int direct = 0; |
10935 | char *str = NULL; | |
718e3744 | 10936 | |
fee6e4e4 | 10937 | if (argc > 1) |
718e3744 | 10938 | { |
fee6e4e4 | 10939 | /* Check the list direct. */ |
10940 | if (strncmp (argv[1], "p", 1) == 0) | |
10941 | direct = COMMUNITY_PERMIT; | |
10942 | else if (strncmp (argv[1], "d", 1) == 0) | |
10943 | direct = COMMUNITY_DENY; | |
10944 | else | |
10945 | { | |
10946 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
10947 | VTY_NEWLINE); | |
10948 | return CMD_WARNING; | |
10949 | } | |
718e3744 | 10950 | |
fee6e4e4 | 10951 | /* Concat community string argument. */ |
10952 | str = argv_concat (argv, argc, 2); | |
718e3744 | 10953 | } |
10954 | ||
718e3744 | 10955 | /* Unset community list. */ |
10956 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); | |
10957 | ||
10958 | /* Free temporary community list string allocated by | |
10959 | argv_concat(). */ | |
fee6e4e4 | 10960 | if (str) |
10961 | XFREE (MTYPE_TMP, str); | |
718e3744 | 10962 | |
10963 | if (ret < 0) | |
10964 | { | |
10965 | community_list_perror (vty, ret); | |
10966 | return CMD_WARNING; | |
10967 | } | |
10968 | ||
10969 | return CMD_SUCCESS; | |
10970 | } | |
10971 | ||
10972 | /* "extcommunity-list" keyword help string. */ | |
10973 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
10974 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
10975 | ||
10976 | DEFUN (ip_extcommunity_list_standard, | |
10977 | ip_extcommunity_list_standard_cmd, | |
10978 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
10979 | IP_STR | |
10980 | EXTCOMMUNITY_LIST_STR | |
10981 | "Extended Community list number (standard)\n" | |
10982 | "Specify community to reject\n" | |
10983 | "Specify community to accept\n" | |
10984 | EXTCOMMUNITY_VAL_STR) | |
10985 | { | |
10986 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
10987 | } | |
10988 | ||
10989 | ALIAS (ip_extcommunity_list_standard, | |
10990 | ip_extcommunity_list_standard2_cmd, | |
10991 | "ip extcommunity-list <1-99> (deny|permit)", | |
10992 | IP_STR | |
10993 | EXTCOMMUNITY_LIST_STR | |
10994 | "Extended Community list number (standard)\n" | |
10995 | "Specify community to reject\n" | |
10996 | "Specify community to accept\n") | |
10997 | ||
10998 | DEFUN (ip_extcommunity_list_expanded, | |
10999 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 11000 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 11001 | IP_STR |
11002 | EXTCOMMUNITY_LIST_STR | |
11003 | "Extended Community list number (expanded)\n" | |
11004 | "Specify community to reject\n" | |
11005 | "Specify community to accept\n" | |
11006 | "An ordered list as a regular-expression\n") | |
11007 | { | |
11008 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
11009 | } | |
11010 | ||
11011 | DEFUN (ip_extcommunity_list_name_standard, | |
11012 | ip_extcommunity_list_name_standard_cmd, | |
11013 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
11014 | IP_STR | |
11015 | EXTCOMMUNITY_LIST_STR | |
11016 | "Specify standard extcommunity-list\n" | |
11017 | "Extended Community list name\n" | |
11018 | "Specify community to reject\n" | |
11019 | "Specify community to accept\n" | |
11020 | EXTCOMMUNITY_VAL_STR) | |
11021 | { | |
11022 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
11023 | } | |
11024 | ||
11025 | ALIAS (ip_extcommunity_list_name_standard, | |
11026 | ip_extcommunity_list_name_standard2_cmd, | |
11027 | "ip extcommunity-list standard WORD (deny|permit)", | |
11028 | IP_STR | |
11029 | EXTCOMMUNITY_LIST_STR | |
11030 | "Specify standard extcommunity-list\n" | |
11031 | "Extended Community list name\n" | |
11032 | "Specify community to reject\n" | |
11033 | "Specify community to accept\n") | |
11034 | ||
11035 | DEFUN (ip_extcommunity_list_name_expanded, | |
11036 | ip_extcommunity_list_name_expanded_cmd, | |
11037 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
11038 | IP_STR | |
11039 | EXTCOMMUNITY_LIST_STR | |
11040 | "Specify expanded extcommunity-list\n" | |
11041 | "Extended Community list name\n" | |
11042 | "Specify community to reject\n" | |
11043 | "Specify community to accept\n" | |
11044 | "An ordered list as a regular-expression\n") | |
11045 | { | |
11046 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
11047 | } | |
11048 | ||
fee6e4e4 | 11049 | DEFUN (no_ip_extcommunity_list_standard_all, |
11050 | no_ip_extcommunity_list_standard_all_cmd, | |
11051 | "no ip extcommunity-list <1-99>", | |
11052 | NO_STR | |
11053 | IP_STR | |
11054 | EXTCOMMUNITY_LIST_STR | |
11055 | "Extended Community list number (standard)\n") | |
11056 | { | |
11057 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
11058 | } | |
11059 | ||
11060 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
11061 | no_ip_extcommunity_list_expanded_all_cmd, | |
11062 | "no ip extcommunity-list <100-500>", | |
718e3744 | 11063 | NO_STR |
11064 | IP_STR | |
11065 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 11066 | "Extended Community list number (expanded)\n") |
11067 | { | |
fee6e4e4 | 11068 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 11069 | } |
11070 | ||
fee6e4e4 | 11071 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
11072 | no_ip_extcommunity_list_name_standard_all_cmd, | |
11073 | "no ip extcommunity-list standard WORD", | |
718e3744 | 11074 | NO_STR |
11075 | IP_STR | |
11076 | EXTCOMMUNITY_LIST_STR | |
11077 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 11078 | "Extended Community list name\n") |
11079 | { | |
11080 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
11081 | } | |
11082 | ||
11083 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
11084 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
11085 | "no ip extcommunity-list expanded WORD", | |
11086 | NO_STR | |
11087 | IP_STR | |
11088 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 11089 | "Specify expanded extcommunity-list\n" |
11090 | "Extended Community list name\n") | |
11091 | { | |
fee6e4e4 | 11092 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 11093 | } |
11094 | ||
11095 | DEFUN (no_ip_extcommunity_list_standard, | |
11096 | no_ip_extcommunity_list_standard_cmd, | |
11097 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
11098 | NO_STR | |
11099 | IP_STR | |
11100 | EXTCOMMUNITY_LIST_STR | |
11101 | "Extended Community list number (standard)\n" | |
11102 | "Specify community to reject\n" | |
11103 | "Specify community to accept\n" | |
11104 | EXTCOMMUNITY_VAL_STR) | |
11105 | { | |
11106 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
11107 | } | |
11108 | ||
11109 | DEFUN (no_ip_extcommunity_list_expanded, | |
11110 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 11111 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 11112 | NO_STR |
11113 | IP_STR | |
11114 | EXTCOMMUNITY_LIST_STR | |
11115 | "Extended Community list number (expanded)\n" | |
11116 | "Specify community to reject\n" | |
11117 | "Specify community to accept\n" | |
11118 | "An ordered list as a regular-expression\n") | |
11119 | { | |
11120 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
11121 | } | |
11122 | ||
11123 | DEFUN (no_ip_extcommunity_list_name_standard, | |
11124 | no_ip_extcommunity_list_name_standard_cmd, | |
11125 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
11126 | NO_STR | |
11127 | IP_STR | |
11128 | EXTCOMMUNITY_LIST_STR | |
11129 | "Specify standard extcommunity-list\n" | |
11130 | "Extended Community list name\n" | |
11131 | "Specify community to reject\n" | |
11132 | "Specify community to accept\n" | |
11133 | EXTCOMMUNITY_VAL_STR) | |
11134 | { | |
11135 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
11136 | } | |
11137 | ||
11138 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
11139 | no_ip_extcommunity_list_name_expanded_cmd, | |
11140 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
11141 | NO_STR | |
11142 | IP_STR | |
11143 | EXTCOMMUNITY_LIST_STR | |
11144 | "Specify expanded extcommunity-list\n" | |
11145 | "Community list name\n" | |
11146 | "Specify community to reject\n" | |
11147 | "Specify community to accept\n" | |
11148 | "An ordered list as a regular-expression\n") | |
11149 | { | |
11150 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
11151 | } | |
11152 | ||
94f2b392 | 11153 | static void |
718e3744 | 11154 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
11155 | { | |
11156 | struct community_entry *entry; | |
11157 | ||
11158 | for (entry = list->head; entry; entry = entry->next) | |
11159 | { | |
11160 | if (entry == list->head) | |
11161 | { | |
11162 | if (all_digit (list->name)) | |
11163 | vty_out (vty, "Extended community %s list %s%s", | |
11164 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
11165 | "standard" : "(expanded) access", | |
11166 | list->name, VTY_NEWLINE); | |
11167 | else | |
11168 | vty_out (vty, "Named extended community %s list %s%s", | |
11169 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
11170 | "standard" : "expanded", | |
11171 | list->name, VTY_NEWLINE); | |
11172 | } | |
11173 | if (entry->any) | |
11174 | vty_out (vty, " %s%s", | |
11175 | community_direct_str (entry->direct), VTY_NEWLINE); | |
11176 | else | |
11177 | vty_out (vty, " %s %s%s", | |
11178 | community_direct_str (entry->direct), | |
11179 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
11180 | entry->u.ecom->str : entry->config, | |
11181 | VTY_NEWLINE); | |
11182 | } | |
11183 | } | |
11184 | ||
11185 | DEFUN (show_ip_extcommunity_list, | |
11186 | show_ip_extcommunity_list_cmd, | |
11187 | "show ip extcommunity-list", | |
11188 | SHOW_STR | |
11189 | IP_STR | |
11190 | "List extended-community list\n") | |
11191 | { | |
11192 | struct community_list *list; | |
11193 | struct community_list_master *cm; | |
11194 | ||
fee6e4e4 | 11195 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 11196 | if (! cm) |
11197 | return CMD_SUCCESS; | |
11198 | ||
11199 | for (list = cm->num.head; list; list = list->next) | |
11200 | extcommunity_list_show (vty, list); | |
11201 | ||
11202 | for (list = cm->str.head; list; list = list->next) | |
11203 | extcommunity_list_show (vty, list); | |
11204 | ||
11205 | return CMD_SUCCESS; | |
11206 | } | |
11207 | ||
11208 | DEFUN (show_ip_extcommunity_list_arg, | |
11209 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 11210 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 11211 | SHOW_STR |
11212 | IP_STR | |
11213 | "List extended-community list\n" | |
11214 | "Extcommunity-list number\n" | |
11215 | "Extcommunity-list name\n") | |
11216 | { | |
11217 | struct community_list *list; | |
11218 | ||
fee6e4e4 | 11219 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 11220 | if (! list) |
11221 | { | |
b729294c | 11222 | vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE); |
718e3744 | 11223 | return CMD_WARNING; |
11224 | } | |
11225 | ||
11226 | extcommunity_list_show (vty, list); | |
11227 | ||
11228 | return CMD_SUCCESS; | |
11229 | } | |
6b0655a2 | 11230 | |
718e3744 | 11231 | /* Return configuration string of community-list entry. */ |
fd79ac91 | 11232 | static const char * |
718e3744 | 11233 | community_list_config_str (struct community_entry *entry) |
11234 | { | |
fd79ac91 | 11235 | const char *str; |
718e3744 | 11236 | |
11237 | if (entry->any) | |
11238 | str = ""; | |
11239 | else | |
11240 | { | |
11241 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
11242 | str = community_str (entry->u.com); | |
11243 | else | |
11244 | str = entry->config; | |
11245 | } | |
11246 | return str; | |
11247 | } | |
11248 | ||
11249 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 11250 | static int |
718e3744 | 11251 | community_list_config_write (struct vty *vty) |
11252 | { | |
11253 | struct community_list *list; | |
11254 | struct community_entry *entry; | |
11255 | struct community_list_master *cm; | |
11256 | int write = 0; | |
11257 | ||
11258 | /* Community-list. */ | |
fee6e4e4 | 11259 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 11260 | |
11261 | for (list = cm->num.head; list; list = list->next) | |
11262 | for (entry = list->head; entry; entry = entry->next) | |
11263 | { | |
fee6e4e4 | 11264 | vty_out (vty, "ip community-list %s %s %s%s", |
11265 | list->name, community_direct_str (entry->direct), | |
11266 | community_list_config_str (entry), | |
11267 | VTY_NEWLINE); | |
718e3744 | 11268 | write++; |
11269 | } | |
11270 | for (list = cm->str.head; list; list = list->next) | |
11271 | for (entry = list->head; entry; entry = entry->next) | |
11272 | { | |
11273 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
11274 | entry->style == COMMUNITY_LIST_STANDARD | |
11275 | ? "standard" : "expanded", | |
11276 | list->name, community_direct_str (entry->direct), | |
11277 | community_list_config_str (entry), | |
11278 | VTY_NEWLINE); | |
11279 | write++; | |
11280 | } | |
11281 | ||
11282 | /* Extcommunity-list. */ | |
fee6e4e4 | 11283 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 11284 | |
11285 | for (list = cm->num.head; list; list = list->next) | |
11286 | for (entry = list->head; entry; entry = entry->next) | |
11287 | { | |
fee6e4e4 | 11288 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
11289 | list->name, community_direct_str (entry->direct), | |
11290 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 11291 | write++; |
11292 | } | |
11293 | for (list = cm->str.head; list; list = list->next) | |
11294 | for (entry = list->head; entry; entry = entry->next) | |
11295 | { | |
11296 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
11297 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
11298 | ? "standard" : "expanded", | |
11299 | list->name, community_direct_str (entry->direct), | |
11300 | community_list_config_str (entry), VTY_NEWLINE); | |
11301 | write++; | |
11302 | } | |
11303 | return write; | |
11304 | } | |
11305 | ||
7fc626de | 11306 | static struct cmd_node community_list_node = |
718e3744 | 11307 | { |
11308 | COMMUNITY_LIST_NODE, | |
11309 | "", | |
11310 | 1 /* Export to vtysh. */ | |
11311 | }; | |
11312 | ||
94f2b392 | 11313 | static void |
11314 | community_list_vty (void) | |
718e3744 | 11315 | { |
11316 | install_node (&community_list_node, community_list_config_write); | |
11317 | ||
11318 | /* Community-list. */ | |
718e3744 | 11319 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
11320 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
11321 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
11322 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
11323 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
11324 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 11325 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
11326 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); | |
11327 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
11328 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 11329 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
11330 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
11331 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
11332 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); | |
11333 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
11334 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
11335 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
11336 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
11337 | ||
11338 | /* Extcommunity-list. */ | |
11339 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
11340 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
11341 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
11342 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
11343 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
11344 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 11345 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
11346 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); | |
11347 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
11348 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 11349 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
11350 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
11351 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
11352 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); | |
11353 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
11354 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
11355 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
11356 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
11357 | } |