]>
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" |
718e3744 | 51 | |
18a6dce6 | 52 | extern struct in_addr router_id_zebra; |
53 | ||
718e3744 | 54 | /* Utility function to get address family from current node. */ |
55 | afi_t | |
56 | bgp_node_afi (struct vty *vty) | |
57 | { | |
25ffbdc1 | 58 | if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 59 | return AFI_IP6; |
60 | return AFI_IP; | |
61 | } | |
62 | ||
63 | /* Utility function to get subsequent address family from current | |
64 | node. */ | |
65 | safi_t | |
66 | bgp_node_safi (struct vty *vty) | |
67 | { | |
68 | if (vty->node == BGP_VPNV4_NODE) | |
69 | return SAFI_MPLS_VPN; | |
25ffbdc1 | 70 | if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE) |
718e3744 | 71 | return SAFI_MULTICAST; |
72 | return SAFI_UNICAST; | |
73 | } | |
74 | ||
94f2b392 | 75 | static int |
718e3744 | 76 | peer_address_self_check (union sockunion *su) |
77 | { | |
78 | struct interface *ifp = NULL; | |
79 | ||
80 | if (su->sa.sa_family == AF_INET) | |
81 | ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); | |
82 | #ifdef HAVE_IPV6 | |
83 | else if (su->sa.sa_family == AF_INET6) | |
84 | ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); | |
85 | #endif /* HAVE IPV6 */ | |
86 | ||
87 | if (ifp) | |
88 | return 1; | |
89 | ||
90 | return 0; | |
91 | } | |
92 | ||
93 | /* Utility function for looking up peer from VTY. */ | |
94f2b392 | 94 | static struct peer * |
fd79ac91 | 95 | peer_lookup_vty (struct vty *vty, const char *ip_str) |
718e3744 | 96 | { |
97 | int ret; | |
98 | struct bgp *bgp; | |
99 | union sockunion su; | |
100 | struct peer *peer; | |
101 | ||
102 | bgp = vty->index; | |
103 | ||
104 | ret = str2sockunion (ip_str, &su); | |
105 | if (ret < 0) | |
106 | { | |
107 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); | |
108 | return NULL; | |
109 | } | |
110 | ||
111 | peer = peer_lookup (bgp, &su); | |
112 | if (! peer) | |
113 | { | |
114 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE); | |
115 | return NULL; | |
116 | } | |
117 | return peer; | |
118 | } | |
119 | ||
120 | /* Utility function for looking up peer or peer group. */ | |
94f2b392 | 121 | static struct peer * |
fd79ac91 | 122 | peer_and_group_lookup_vty (struct vty *vty, const char *peer_str) |
718e3744 | 123 | { |
124 | int ret; | |
125 | struct bgp *bgp; | |
126 | union sockunion su; | |
127 | struct peer *peer; | |
128 | struct peer_group *group; | |
129 | ||
130 | bgp = vty->index; | |
131 | ||
132 | ret = str2sockunion (peer_str, &su); | |
133 | if (ret == 0) | |
134 | { | |
135 | peer = peer_lookup (bgp, &su); | |
136 | if (peer) | |
137 | return peer; | |
138 | } | |
139 | else | |
140 | { | |
141 | group = peer_group_lookup (bgp, peer_str); | |
142 | if (group) | |
143 | return group->conf; | |
144 | } | |
145 | ||
146 | vty_out (vty, "%% Specify remote-as or peer-group commands first%s", | |
147 | VTY_NEWLINE); | |
148 | ||
149 | return NULL; | |
150 | } | |
151 | ||
94f2b392 | 152 | static int |
718e3744 | 153 | bgp_vty_return (struct vty *vty, int ret) |
154 | { | |
fd79ac91 | 155 | const char *str = NULL; |
718e3744 | 156 | |
157 | switch (ret) | |
158 | { | |
159 | case BGP_ERR_INVALID_VALUE: | |
160 | str = "Invalid value"; | |
161 | break; | |
162 | case BGP_ERR_INVALID_FLAG: | |
163 | str = "Invalid flag"; | |
164 | break; | |
165 | case BGP_ERR_PEER_INACTIVE: | |
166 | str = "Activate the neighbor for the address family first"; | |
167 | break; | |
168 | case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER: | |
169 | str = "Invalid command for a peer-group member"; | |
170 | break; | |
171 | case BGP_ERR_PEER_GROUP_SHUTDOWN: | |
172 | str = "Peer-group has been shutdown. Activate the peer-group first"; | |
173 | break; | |
174 | case BGP_ERR_PEER_GROUP_HAS_THE_FLAG: | |
175 | str = "This peer is a peer-group member. Please change peer-group configuration"; | |
176 | break; | |
177 | case BGP_ERR_PEER_FLAG_CONFLICT: | |
178 | str = "Can't set override-capability and strict-capability-match at the same time"; | |
179 | break; | |
180 | case BGP_ERR_PEER_GROUP_MEMBER_EXISTS: | |
181 | str = "No activate for peergroup can be given only if peer-group has no members"; | |
182 | break; | |
183 | case BGP_ERR_PEER_BELONGS_TO_GROUP: | |
184 | str = "No activate for an individual peer-group member is invalid"; | |
185 | break; | |
186 | case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED: | |
187 | str = "Activate the peer-group for the address family first"; | |
188 | break; | |
189 | case BGP_ERR_PEER_GROUP_NO_REMOTE_AS: | |
190 | str = "Specify remote-as or peer-group remote AS first"; | |
191 | break; | |
192 | case BGP_ERR_PEER_GROUP_CANT_CHANGE: | |
193 | str = "Cannot change the peer-group. Deconfigure first"; | |
194 | break; | |
195 | case BGP_ERR_PEER_GROUP_MISMATCH: | |
196 | str = "Cannot have different peer-group for the neighbor"; | |
197 | break; | |
198 | case BGP_ERR_PEER_FILTER_CONFLICT: | |
199 | str = "Prefix/distribute list can not co-exist"; | |
200 | break; | |
201 | case BGP_ERR_NOT_INTERNAL_PEER: | |
202 | str = "Invalid command. Not an internal neighbor"; | |
203 | break; | |
204 | case BGP_ERR_REMOVE_PRIVATE_AS: | |
205 | str = "Private AS cannot be removed for IBGP peers"; | |
206 | break; | |
207 | case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP: | |
208 | str = "Local-AS allowed only for EBGP peers"; | |
209 | break; | |
210 | case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: | |
211 | str = "Cannot have local-as same as BGP AS number"; | |
212 | break; | |
0df7c91f PJ |
213 | case BGP_ERR_TCPSIG_FAILED: |
214 | str = "Error while applying TCP-Sig to session(s)"; | |
215 | break; | |
718e3744 | 216 | } |
217 | if (str) | |
218 | { | |
219 | vty_out (vty, "%% %s%s", str, VTY_NEWLINE); | |
220 | return CMD_WARNING; | |
221 | } | |
222 | return CMD_SUCCESS; | |
223 | } | |
224 | ||
225 | /* BGP global configuration. */ | |
226 | ||
227 | DEFUN (bgp_multiple_instance_func, | |
228 | bgp_multiple_instance_cmd, | |
229 | "bgp multiple-instance", | |
230 | BGP_STR | |
231 | "Enable bgp multiple instance\n") | |
232 | { | |
233 | bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); | |
234 | return CMD_SUCCESS; | |
235 | } | |
236 | ||
237 | DEFUN (no_bgp_multiple_instance, | |
238 | no_bgp_multiple_instance_cmd, | |
239 | "no bgp multiple-instance", | |
240 | NO_STR | |
241 | BGP_STR | |
242 | "BGP multiple instance\n") | |
243 | { | |
244 | int ret; | |
245 | ||
246 | ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE); | |
247 | if (ret < 0) | |
248 | { | |
249 | vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE); | |
250 | return CMD_WARNING; | |
251 | } | |
252 | return CMD_SUCCESS; | |
253 | } | |
254 | ||
255 | DEFUN (bgp_config_type, | |
256 | bgp_config_type_cmd, | |
257 | "bgp config-type (cisco|zebra)", | |
258 | BGP_STR | |
259 | "Configuration type\n" | |
260 | "cisco\n" | |
261 | "zebra\n") | |
262 | { | |
263 | if (strncmp (argv[0], "c", 1) == 0) | |
264 | bgp_option_set (BGP_OPT_CONFIG_CISCO); | |
265 | else | |
266 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
267 | ||
268 | return CMD_SUCCESS; | |
269 | } | |
270 | ||
271 | DEFUN (no_bgp_config_type, | |
272 | no_bgp_config_type_cmd, | |
273 | "no bgp config-type", | |
274 | NO_STR | |
275 | BGP_STR | |
276 | "Display configuration type\n") | |
277 | { | |
278 | bgp_option_unset (BGP_OPT_CONFIG_CISCO); | |
279 | return CMD_SUCCESS; | |
280 | } | |
281 | ||
282 | DEFUN (no_synchronization, | |
283 | no_synchronization_cmd, | |
284 | "no synchronization", | |
285 | NO_STR | |
286 | "Perform IGP synchronization\n") | |
287 | { | |
288 | return CMD_SUCCESS; | |
289 | } | |
290 | ||
291 | DEFUN (no_auto_summary, | |
292 | no_auto_summary_cmd, | |
293 | "no auto-summary", | |
294 | NO_STR | |
295 | "Enable automatic network number summarization\n") | |
296 | { | |
297 | return CMD_SUCCESS; | |
298 | } | |
3d515fd9 | 299 | |
300 | DEFUN_DEPRECATED (neighbor_version, | |
301 | neighbor_version_cmd, | |
302 | NEIGHBOR_CMD "version (4|4-)", | |
303 | NEIGHBOR_STR | |
304 | NEIGHBOR_ADDR_STR | |
305 | "Set the BGP version to match a neighbor\n" | |
306 | "Neighbor's BGP version\n") | |
307 | { | |
308 | return CMD_SUCCESS; | |
309 | } | |
718e3744 | 310 | \f |
311 | /* "router bgp" commands. */ | |
312 | DEFUN (router_bgp, | |
313 | router_bgp_cmd, | |
320da874 | 314 | "router bgp " CMD_AS_RANGE, |
718e3744 | 315 | ROUTER_STR |
316 | BGP_STR | |
317 | AS_STR) | |
318 | { | |
319 | int ret; | |
320 | as_t as; | |
321 | struct bgp *bgp; | |
fd79ac91 | 322 | const char *name = NULL; |
718e3744 | 323 | |
0b2aa3a0 | 324 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 325 | |
326 | if (argc == 2) | |
327 | name = argv[1]; | |
328 | ||
329 | ret = bgp_get (&bgp, &as, name); | |
330 | switch (ret) | |
331 | { | |
332 | case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET: | |
333 | vty_out (vty, "Please specify 'bgp multiple-instance' first%s", | |
334 | VTY_NEWLINE); | |
335 | return CMD_WARNING; | |
718e3744 | 336 | case BGP_ERR_AS_MISMATCH: |
337 | vty_out (vty, "BGP is already running; AS is %d%s", as, VTY_NEWLINE); | |
338 | return CMD_WARNING; | |
718e3744 | 339 | case BGP_ERR_INSTANCE_MISMATCH: |
340 | vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); | |
341 | vty_out (vty, "BGP instance is already running; AS is %d%s", | |
342 | as, VTY_NEWLINE); | |
343 | return CMD_WARNING; | |
718e3744 | 344 | } |
345 | ||
346 | vty->node = BGP_NODE; | |
347 | vty->index = bgp; | |
348 | ||
349 | return CMD_SUCCESS; | |
350 | } | |
351 | ||
352 | ALIAS (router_bgp, | |
353 | router_bgp_view_cmd, | |
320da874 | 354 | "router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 355 | ROUTER_STR |
356 | BGP_STR | |
357 | AS_STR | |
358 | "BGP view\n" | |
359 | "view name\n") | |
360 | \f | |
361 | /* "no router bgp" commands. */ | |
362 | DEFUN (no_router_bgp, | |
363 | no_router_bgp_cmd, | |
320da874 | 364 | "no router bgp " CMD_AS_RANGE, |
718e3744 | 365 | NO_STR |
366 | ROUTER_STR | |
367 | BGP_STR | |
368 | AS_STR) | |
369 | { | |
370 | as_t as; | |
371 | struct bgp *bgp; | |
fd79ac91 | 372 | const char *name = NULL; |
718e3744 | 373 | |
0b2aa3a0 | 374 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 375 | |
376 | if (argc == 2) | |
377 | name = argv[1]; | |
378 | ||
379 | /* Lookup bgp structure. */ | |
380 | bgp = bgp_lookup (as, name); | |
381 | if (! bgp) | |
382 | { | |
383 | vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE); | |
384 | return CMD_WARNING; | |
385 | } | |
386 | ||
387 | bgp_delete (bgp); | |
388 | ||
389 | return CMD_SUCCESS; | |
390 | } | |
391 | ||
392 | ALIAS (no_router_bgp, | |
393 | no_router_bgp_view_cmd, | |
320da874 | 394 | "no router bgp " CMD_AS_RANGE " view WORD", |
718e3744 | 395 | NO_STR |
396 | ROUTER_STR | |
397 | BGP_STR | |
398 | AS_STR | |
399 | "BGP view\n" | |
400 | "view name\n") | |
401 | \f | |
402 | /* BGP router-id. */ | |
403 | ||
404 | DEFUN (bgp_router_id, | |
405 | bgp_router_id_cmd, | |
406 | "bgp router-id A.B.C.D", | |
407 | BGP_STR | |
408 | "Override configured router identifier\n" | |
409 | "Manually configured router identifier\n") | |
410 | { | |
411 | int ret; | |
412 | struct in_addr id; | |
413 | struct bgp *bgp; | |
414 | ||
415 | bgp = vty->index; | |
416 | ||
417 | ret = inet_aton (argv[0], &id); | |
418 | if (! ret) | |
419 | { | |
420 | vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE); | |
421 | return CMD_WARNING; | |
422 | } | |
423 | ||
18a6dce6 | 424 | bgp->router_id_static = id; |
718e3744 | 425 | bgp_router_id_set (bgp, &id); |
426 | ||
427 | return CMD_SUCCESS; | |
428 | } | |
429 | ||
430 | DEFUN (no_bgp_router_id, | |
431 | no_bgp_router_id_cmd, | |
432 | "no bgp router-id", | |
433 | NO_STR | |
434 | BGP_STR | |
435 | "Override configured router identifier\n") | |
436 | { | |
437 | int ret; | |
438 | struct in_addr id; | |
439 | struct bgp *bgp; | |
440 | ||
441 | bgp = vty->index; | |
442 | ||
443 | if (argc == 1) | |
444 | { | |
445 | ret = inet_aton (argv[0], &id); | |
446 | if (! ret) | |
447 | { | |
448 | vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE); | |
449 | return CMD_WARNING; | |
450 | } | |
451 | ||
18a6dce6 | 452 | if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id)) |
718e3744 | 453 | { |
454 | vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE); | |
455 | return CMD_WARNING; | |
456 | } | |
457 | } | |
458 | ||
18a6dce6 | 459 | bgp->router_id_static.s_addr = 0; |
460 | bgp_router_id_set (bgp, &router_id_zebra); | |
718e3744 | 461 | |
462 | return CMD_SUCCESS; | |
463 | } | |
464 | ||
465 | ALIAS (no_bgp_router_id, | |
466 | no_bgp_router_id_val_cmd, | |
467 | "no bgp router-id A.B.C.D", | |
468 | NO_STR | |
469 | BGP_STR | |
470 | "Override configured router identifier\n" | |
471 | "Manually configured router identifier\n") | |
472 | \f | |
473 | /* BGP Cluster ID. */ | |
474 | ||
475 | DEFUN (bgp_cluster_id, | |
476 | bgp_cluster_id_cmd, | |
477 | "bgp cluster-id A.B.C.D", | |
478 | BGP_STR | |
479 | "Configure Route-Reflector Cluster-id\n" | |
480 | "Route-Reflector Cluster-id in IP address format\n") | |
481 | { | |
482 | int ret; | |
483 | struct bgp *bgp; | |
484 | struct in_addr cluster; | |
485 | ||
486 | bgp = vty->index; | |
487 | ||
488 | ret = inet_aton (argv[0], &cluster); | |
489 | if (! ret) | |
490 | { | |
491 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
492 | return CMD_WARNING; | |
493 | } | |
494 | ||
495 | bgp_cluster_id_set (bgp, &cluster); | |
496 | ||
497 | return CMD_SUCCESS; | |
498 | } | |
499 | ||
500 | ALIAS (bgp_cluster_id, | |
501 | bgp_cluster_id32_cmd, | |
502 | "bgp cluster-id <1-4294967295>", | |
503 | BGP_STR | |
504 | "Configure Route-Reflector Cluster-id\n" | |
505 | "Route-Reflector Cluster-id as 32 bit quantity\n") | |
506 | ||
507 | DEFUN (no_bgp_cluster_id, | |
508 | no_bgp_cluster_id_cmd, | |
509 | "no bgp cluster-id", | |
510 | NO_STR | |
511 | BGP_STR | |
512 | "Configure Route-Reflector Cluster-id\n") | |
513 | { | |
514 | int ret; | |
515 | struct bgp *bgp; | |
516 | struct in_addr cluster; | |
517 | ||
518 | bgp = vty->index; | |
519 | ||
520 | if (argc == 1) | |
521 | { | |
522 | ret = inet_aton (argv[0], &cluster); | |
523 | if (! ret) | |
524 | { | |
525 | vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE); | |
526 | return CMD_WARNING; | |
527 | } | |
528 | } | |
529 | ||
530 | bgp_cluster_id_unset (bgp); | |
531 | ||
532 | return CMD_SUCCESS; | |
533 | } | |
534 | ||
535 | ALIAS (no_bgp_cluster_id, | |
536 | no_bgp_cluster_id_arg_cmd, | |
537 | "no bgp cluster-id A.B.C.D", | |
538 | NO_STR | |
539 | BGP_STR | |
540 | "Configure Route-Reflector Cluster-id\n" | |
541 | "Route-Reflector Cluster-id in IP address format\n") | |
542 | \f | |
543 | DEFUN (bgp_confederation_identifier, | |
544 | bgp_confederation_identifier_cmd, | |
320da874 | 545 | "bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 546 | "BGP specific commands\n" |
547 | "AS confederation parameters\n" | |
548 | "AS number\n" | |
549 | "Set routing domain confederation AS\n") | |
550 | { | |
551 | struct bgp *bgp; | |
552 | as_t as; | |
553 | ||
554 | bgp = vty->index; | |
555 | ||
0b2aa3a0 | 556 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 557 | |
558 | bgp_confederation_id_set (bgp, as); | |
559 | ||
560 | return CMD_SUCCESS; | |
561 | } | |
562 | ||
563 | DEFUN (no_bgp_confederation_identifier, | |
564 | no_bgp_confederation_identifier_cmd, | |
565 | "no bgp confederation identifier", | |
566 | NO_STR | |
567 | "BGP specific commands\n" | |
568 | "AS confederation parameters\n" | |
569 | "AS number\n") | |
570 | { | |
571 | struct bgp *bgp; | |
572 | as_t as; | |
573 | ||
574 | bgp = vty->index; | |
575 | ||
576 | if (argc == 1) | |
0b2aa3a0 | 577 | VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX); |
718e3744 | 578 | |
579 | bgp_confederation_id_unset (bgp); | |
580 | ||
581 | return CMD_SUCCESS; | |
582 | } | |
583 | ||
584 | ALIAS (no_bgp_confederation_identifier, | |
585 | no_bgp_confederation_identifier_arg_cmd, | |
320da874 | 586 | "no bgp confederation identifier " CMD_AS_RANGE, |
718e3744 | 587 | NO_STR |
588 | "BGP specific commands\n" | |
589 | "AS confederation parameters\n" | |
590 | "AS number\n" | |
591 | "Set routing domain confederation AS\n") | |
592 | \f | |
593 | DEFUN (bgp_confederation_peers, | |
594 | bgp_confederation_peers_cmd, | |
320da874 | 595 | "bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 596 | "BGP specific commands\n" |
597 | "AS confederation parameters\n" | |
598 | "Peer ASs in BGP confederation\n" | |
599 | AS_STR) | |
600 | { | |
601 | struct bgp *bgp; | |
602 | as_t as; | |
603 | int i; | |
604 | ||
605 | bgp = vty->index; | |
606 | ||
607 | for (i = 0; i < argc; i++) | |
608 | { | |
0b2aa3a0 | 609 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
718e3744 | 610 | |
611 | if (bgp->as == as) | |
612 | { | |
613 | vty_out (vty, "%% Local member-AS not allowed in confed peer list%s", | |
614 | VTY_NEWLINE); | |
615 | continue; | |
616 | } | |
617 | ||
618 | bgp_confederation_peers_add (bgp, as); | |
619 | } | |
620 | return CMD_SUCCESS; | |
621 | } | |
622 | ||
623 | DEFUN (no_bgp_confederation_peers, | |
624 | no_bgp_confederation_peers_cmd, | |
320da874 | 625 | "no bgp confederation peers ." CMD_AS_RANGE, |
718e3744 | 626 | NO_STR |
627 | "BGP specific commands\n" | |
628 | "AS confederation parameters\n" | |
629 | "Peer ASs in BGP confederation\n" | |
630 | AS_STR) | |
631 | { | |
632 | struct bgp *bgp; | |
633 | as_t as; | |
634 | int i; | |
635 | ||
636 | bgp = vty->index; | |
637 | ||
638 | for (i = 0; i < argc; i++) | |
639 | { | |
0b2aa3a0 PJ |
640 | VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX); |
641 | ||
718e3744 | 642 | bgp_confederation_peers_remove (bgp, as); |
643 | } | |
644 | return CMD_SUCCESS; | |
645 | } | |
646 | \f | |
647 | /* BGP timers. */ | |
648 | ||
649 | DEFUN (bgp_timers, | |
650 | bgp_timers_cmd, | |
651 | "timers bgp <0-65535> <0-65535>", | |
652 | "Adjust routing timers\n" | |
653 | "BGP timers\n" | |
654 | "Keepalive interval\n" | |
655 | "Holdtime\n") | |
656 | { | |
657 | struct bgp *bgp; | |
658 | unsigned long keepalive = 0; | |
659 | unsigned long holdtime = 0; | |
660 | ||
661 | bgp = vty->index; | |
662 | ||
663 | VTY_GET_INTEGER ("keepalive", keepalive, argv[0]); | |
664 | VTY_GET_INTEGER ("holdtime", holdtime, argv[1]); | |
665 | ||
666 | /* Holdtime value check. */ | |
667 | if (holdtime < 3 && holdtime != 0) | |
668 | { | |
669 | vty_out (vty, "%% hold time value must be either 0 or greater than 3%s", | |
670 | VTY_NEWLINE); | |
671 | return CMD_WARNING; | |
672 | } | |
673 | ||
674 | bgp_timers_set (bgp, keepalive, holdtime); | |
675 | ||
676 | return CMD_SUCCESS; | |
677 | } | |
678 | ||
679 | DEFUN (no_bgp_timers, | |
680 | no_bgp_timers_cmd, | |
681 | "no timers bgp", | |
682 | NO_STR | |
683 | "Adjust routing timers\n" | |
684 | "BGP timers\n") | |
685 | { | |
686 | struct bgp *bgp; | |
687 | ||
688 | bgp = vty->index; | |
689 | bgp_timers_unset (bgp); | |
690 | ||
691 | return CMD_SUCCESS; | |
692 | } | |
693 | ||
694 | ALIAS (no_bgp_timers, | |
695 | no_bgp_timers_arg_cmd, | |
696 | "no timers bgp <0-65535> <0-65535>", | |
697 | NO_STR | |
698 | "Adjust routing timers\n" | |
699 | "BGP timers\n" | |
700 | "Keepalive interval\n" | |
701 | "Holdtime\n") | |
702 | \f | |
703 | DEFUN (bgp_client_to_client_reflection, | |
704 | bgp_client_to_client_reflection_cmd, | |
705 | "bgp client-to-client reflection", | |
706 | "BGP specific commands\n" | |
707 | "Configure client to client route reflection\n" | |
708 | "reflection of routes allowed\n") | |
709 | { | |
710 | struct bgp *bgp; | |
711 | ||
712 | bgp = vty->index; | |
713 | bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
714 | return CMD_SUCCESS; | |
715 | } | |
716 | ||
717 | DEFUN (no_bgp_client_to_client_reflection, | |
718 | no_bgp_client_to_client_reflection_cmd, | |
719 | "no bgp client-to-client reflection", | |
720 | NO_STR | |
721 | "BGP specific commands\n" | |
722 | "Configure client to client route reflection\n" | |
723 | "reflection of routes allowed\n") | |
724 | { | |
725 | struct bgp *bgp; | |
726 | ||
727 | bgp = vty->index; | |
728 | bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT); | |
729 | return CMD_SUCCESS; | |
730 | } | |
731 | ||
732 | /* "bgp always-compare-med" configuration. */ | |
733 | DEFUN (bgp_always_compare_med, | |
734 | bgp_always_compare_med_cmd, | |
735 | "bgp always-compare-med", | |
736 | "BGP specific commands\n" | |
737 | "Allow comparing MED from different neighbors\n") | |
738 | { | |
739 | struct bgp *bgp; | |
740 | ||
741 | bgp = vty->index; | |
742 | bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
743 | return CMD_SUCCESS; | |
744 | } | |
745 | ||
746 | DEFUN (no_bgp_always_compare_med, | |
747 | no_bgp_always_compare_med_cmd, | |
748 | "no bgp always-compare-med", | |
749 | NO_STR | |
750 | "BGP specific commands\n" | |
751 | "Allow comparing MED from different neighbors\n") | |
752 | { | |
753 | struct bgp *bgp; | |
754 | ||
755 | bgp = vty->index; | |
756 | bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED); | |
757 | return CMD_SUCCESS; | |
758 | } | |
759 | \f | |
760 | /* "bgp deterministic-med" configuration. */ | |
761 | DEFUN (bgp_deterministic_med, | |
762 | bgp_deterministic_med_cmd, | |
763 | "bgp deterministic-med", | |
764 | "BGP specific commands\n" | |
765 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
766 | { | |
767 | struct bgp *bgp; | |
768 | ||
769 | bgp = vty->index; | |
770 | bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
771 | return CMD_SUCCESS; | |
772 | } | |
773 | ||
774 | DEFUN (no_bgp_deterministic_med, | |
775 | no_bgp_deterministic_med_cmd, | |
776 | "no bgp deterministic-med", | |
777 | NO_STR | |
778 | "BGP specific commands\n" | |
779 | "Pick the best-MED path among paths advertised from the neighboring AS\n") | |
780 | { | |
781 | struct bgp *bgp; | |
782 | ||
783 | bgp = vty->index; | |
784 | bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED); | |
785 | return CMD_SUCCESS; | |
786 | } | |
538621f2 | 787 | |
788 | /* "bgp graceful-restart" configuration. */ | |
789 | DEFUN (bgp_graceful_restart, | |
790 | bgp_graceful_restart_cmd, | |
791 | "bgp graceful-restart", | |
792 | "BGP specific commands\n" | |
793 | "Graceful restart capability parameters\n") | |
794 | { | |
795 | struct bgp *bgp; | |
796 | ||
797 | bgp = vty->index; | |
798 | bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
799 | return CMD_SUCCESS; | |
800 | } | |
801 | ||
802 | DEFUN (no_bgp_graceful_restart, | |
803 | no_bgp_graceful_restart_cmd, | |
804 | "no bgp graceful-restart", | |
805 | NO_STR | |
806 | "BGP specific commands\n" | |
807 | "Graceful restart capability parameters\n") | |
808 | { | |
809 | struct bgp *bgp; | |
810 | ||
811 | bgp = vty->index; | |
812 | bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART); | |
813 | return CMD_SUCCESS; | |
814 | } | |
815 | ||
93406d87 | 816 | DEFUN (bgp_graceful_restart_stalepath_time, |
817 | bgp_graceful_restart_stalepath_time_cmd, | |
818 | "bgp graceful-restart stalepath-time <1-3600>", | |
819 | "BGP specific commands\n" | |
820 | "Graceful restart capability parameters\n" | |
821 | "Set the max time to hold onto restarting peer's stale paths\n" | |
822 | "Delay value (seconds)\n") | |
823 | { | |
824 | struct bgp *bgp; | |
825 | u_int32_t stalepath; | |
826 | ||
827 | bgp = vty->index; | |
828 | if (! bgp) | |
829 | return CMD_WARNING; | |
830 | ||
831 | VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600); | |
832 | bgp->stalepath_time = stalepath; | |
833 | return CMD_SUCCESS; | |
834 | } | |
835 | ||
836 | DEFUN (no_bgp_graceful_restart_stalepath_time, | |
837 | no_bgp_graceful_restart_stalepath_time_cmd, | |
838 | "no bgp graceful-restart stalepath-time", | |
839 | NO_STR | |
840 | "BGP specific commands\n" | |
841 | "Graceful restart capability parameters\n" | |
842 | "Set the max time to hold onto restarting peer's stale paths\n") | |
843 | { | |
844 | struct bgp *bgp; | |
845 | ||
846 | bgp = vty->index; | |
847 | if (! bgp) | |
848 | return CMD_WARNING; | |
849 | ||
850 | bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; | |
851 | return CMD_SUCCESS; | |
852 | } | |
853 | ||
854 | ALIAS (no_bgp_graceful_restart_stalepath_time, | |
855 | no_bgp_graceful_restart_stalepath_time_val_cmd, | |
856 | "no bgp graceful-restart stalepath-time <1-3600>", | |
857 | NO_STR | |
858 | "BGP specific commands\n" | |
859 | "Graceful restart capability parameters\n" | |
860 | "Set the max time to hold onto restarting peer's stale paths\n" | |
861 | "Delay value (seconds)\n") | |
862 | ||
718e3744 | 863 | /* "bgp fast-external-failover" configuration. */ |
864 | DEFUN (bgp_fast_external_failover, | |
865 | bgp_fast_external_failover_cmd, | |
866 | "bgp fast-external-failover", | |
867 | BGP_STR | |
868 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
869 | { | |
870 | struct bgp *bgp; | |
871 | ||
872 | bgp = vty->index; | |
873 | bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
874 | return CMD_SUCCESS; | |
875 | } | |
876 | ||
877 | DEFUN (no_bgp_fast_external_failover, | |
878 | no_bgp_fast_external_failover_cmd, | |
879 | "no bgp fast-external-failover", | |
880 | NO_STR | |
881 | BGP_STR | |
882 | "Immediately reset session if a link to a directly connected external peer goes down\n") | |
883 | { | |
884 | struct bgp *bgp; | |
885 | ||
886 | bgp = vty->index; | |
887 | bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER); | |
888 | return CMD_SUCCESS; | |
889 | } | |
890 | \f | |
891 | /* "bgp enforce-first-as" configuration. */ | |
892 | DEFUN (bgp_enforce_first_as, | |
893 | bgp_enforce_first_as_cmd, | |
894 | "bgp enforce-first-as", | |
895 | BGP_STR | |
896 | "Enforce the first AS for EBGP routes\n") | |
897 | { | |
898 | struct bgp *bgp; | |
899 | ||
900 | bgp = vty->index; | |
901 | bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
902 | return CMD_SUCCESS; | |
903 | } | |
904 | ||
905 | DEFUN (no_bgp_enforce_first_as, | |
906 | no_bgp_enforce_first_as_cmd, | |
907 | "no bgp enforce-first-as", | |
908 | NO_STR | |
909 | BGP_STR | |
910 | "Enforce the first AS for EBGP routes\n") | |
911 | { | |
912 | struct bgp *bgp; | |
913 | ||
914 | bgp = vty->index; | |
915 | bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS); | |
916 | return CMD_SUCCESS; | |
917 | } | |
918 | \f | |
919 | /* "bgp bestpath compare-routerid" configuration. */ | |
920 | DEFUN (bgp_bestpath_compare_router_id, | |
921 | bgp_bestpath_compare_router_id_cmd, | |
922 | "bgp bestpath compare-routerid", | |
923 | "BGP specific commands\n" | |
924 | "Change the default bestpath selection\n" | |
925 | "Compare router-id for identical EBGP paths\n") | |
926 | { | |
927 | struct bgp *bgp; | |
928 | ||
929 | bgp = vty->index; | |
930 | bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
931 | return CMD_SUCCESS; | |
932 | } | |
933 | ||
934 | DEFUN (no_bgp_bestpath_compare_router_id, | |
935 | no_bgp_bestpath_compare_router_id_cmd, | |
936 | "no bgp bestpath compare-routerid", | |
937 | NO_STR | |
938 | "BGP specific commands\n" | |
939 | "Change the default bestpath selection\n" | |
940 | "Compare router-id for identical EBGP paths\n") | |
941 | { | |
942 | struct bgp *bgp; | |
943 | ||
944 | bgp = vty->index; | |
945 | bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID); | |
946 | return CMD_SUCCESS; | |
947 | } | |
948 | \f | |
949 | /* "bgp bestpath as-path ignore" configuration. */ | |
950 | DEFUN (bgp_bestpath_aspath_ignore, | |
951 | bgp_bestpath_aspath_ignore_cmd, | |
952 | "bgp bestpath as-path ignore", | |
953 | "BGP specific commands\n" | |
954 | "Change the default bestpath selection\n" | |
955 | "AS-path attribute\n" | |
956 | "Ignore as-path length in selecting a route\n") | |
957 | { | |
958 | struct bgp *bgp; | |
959 | ||
960 | bgp = vty->index; | |
961 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE); | |
962 | return CMD_SUCCESS; | |
963 | } | |
964 | ||
965 | DEFUN (no_bgp_bestpath_aspath_ignore, | |
966 | no_bgp_bestpath_aspath_ignore_cmd, | |
967 | "no bgp bestpath as-path ignore", | |
968 | NO_STR | |
969 | "BGP specific commands\n" | |
970 | "Change the default bestpath selection\n" | |
971 | "AS-path attribute\n" | |
972 | "Ignore as-path length in selecting a route\n") | |
973 | { | |
974 | struct bgp *bgp; | |
975 | ||
976 | bgp = vty->index; | |
977 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE); | |
978 | return CMD_SUCCESS; | |
979 | } | |
980 | \f | |
6811845b | 981 | /* "bgp bestpath as-path confed" configuration. */ |
982 | DEFUN (bgp_bestpath_aspath_confed, | |
983 | bgp_bestpath_aspath_confed_cmd, | |
984 | "bgp bestpath as-path confed", | |
985 | "BGP specific commands\n" | |
986 | "Change the default bestpath selection\n" | |
987 | "AS-path attribute\n" | |
988 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
989 | { | |
990 | struct bgp *bgp; | |
991 | ||
992 | bgp = vty->index; | |
993 | bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED); | |
994 | return CMD_SUCCESS; | |
995 | } | |
996 | ||
997 | DEFUN (no_bgp_bestpath_aspath_confed, | |
998 | no_bgp_bestpath_aspath_confed_cmd, | |
999 | "no bgp bestpath as-path confed", | |
1000 | NO_STR | |
1001 | "BGP specific commands\n" | |
1002 | "Change the default bestpath selection\n" | |
1003 | "AS-path attribute\n" | |
1004 | "Compare path lengths including confederation sets & sequences in selecting a route\n") | |
1005 | { | |
1006 | struct bgp *bgp; | |
1007 | ||
1008 | bgp = vty->index; | |
1009 | bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED); | |
1010 | return CMD_SUCCESS; | |
1011 | } | |
1012 | \f | |
848973c7 | 1013 | /* "bgp log-neighbor-changes" configuration. */ |
1014 | DEFUN (bgp_log_neighbor_changes, | |
1015 | bgp_log_neighbor_changes_cmd, | |
1016 | "bgp log-neighbor-changes", | |
1017 | "BGP specific commands\n" | |
1018 | "Log neighbor up/down and reset reason\n") | |
1019 | { | |
1020 | struct bgp *bgp; | |
1021 | ||
1022 | bgp = vty->index; | |
1023 | bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1024 | return CMD_SUCCESS; | |
1025 | } | |
1026 | ||
1027 | DEFUN (no_bgp_log_neighbor_changes, | |
1028 | no_bgp_log_neighbor_changes_cmd, | |
1029 | "no bgp log-neighbor-changes", | |
1030 | NO_STR | |
1031 | "BGP specific commands\n" | |
1032 | "Log neighbor up/down and reset reason\n") | |
1033 | { | |
1034 | struct bgp *bgp; | |
1035 | ||
1036 | bgp = vty->index; | |
1037 | bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES); | |
1038 | return CMD_SUCCESS; | |
1039 | } | |
1040 | \f | |
718e3744 | 1041 | /* "bgp bestpath med" configuration. */ |
1042 | DEFUN (bgp_bestpath_med, | |
1043 | bgp_bestpath_med_cmd, | |
1044 | "bgp bestpath med (confed|missing-as-worst)", | |
1045 | "BGP specific commands\n" | |
1046 | "Change the default bestpath selection\n" | |
1047 | "MED attribute\n" | |
1048 | "Compare MED among confederation paths\n" | |
1049 | "Treat missing MED as the least preferred one\n") | |
1050 | { | |
1051 | struct bgp *bgp; | |
1052 | ||
1053 | bgp = vty->index; | |
1054 | ||
1055 | if (strncmp (argv[0], "confed", 1) == 0) | |
1056 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
1057 | else | |
1058 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1059 | ||
1060 | return CMD_SUCCESS; | |
1061 | } | |
1062 | ||
1063 | DEFUN (bgp_bestpath_med2, | |
1064 | bgp_bestpath_med2_cmd, | |
1065 | "bgp bestpath med confed missing-as-worst", | |
1066 | "BGP specific commands\n" | |
1067 | "Change the default bestpath selection\n" | |
1068 | "MED attribute\n" | |
1069 | "Compare MED among confederation paths\n" | |
1070 | "Treat missing MED as the least preferred one\n") | |
1071 | { | |
1072 | struct bgp *bgp; | |
1073 | ||
1074 | bgp = vty->index; | |
1075 | bgp_flag_set (bgp, BGP_FLAG_MED_CONFED); | |
1076 | bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1077 | return CMD_SUCCESS; | |
1078 | } | |
1079 | ||
1080 | ALIAS (bgp_bestpath_med2, | |
1081 | bgp_bestpath_med3_cmd, | |
1082 | "bgp bestpath med missing-as-worst confed", | |
1083 | "BGP specific commands\n" | |
1084 | "Change the default bestpath selection\n" | |
1085 | "MED attribute\n" | |
1086 | "Treat missing MED as the least preferred one\n" | |
1087 | "Compare MED among confederation paths\n") | |
1088 | ||
1089 | DEFUN (no_bgp_bestpath_med, | |
1090 | no_bgp_bestpath_med_cmd, | |
1091 | "no bgp bestpath med (confed|missing-as-worst)", | |
1092 | NO_STR | |
1093 | "BGP specific commands\n" | |
1094 | "Change the default bestpath selection\n" | |
1095 | "MED attribute\n" | |
1096 | "Compare MED among confederation paths\n" | |
1097 | "Treat missing MED as the least preferred one\n") | |
1098 | { | |
1099 | struct bgp *bgp; | |
1100 | ||
1101 | bgp = vty->index; | |
1102 | ||
1103 | if (strncmp (argv[0], "confed", 1) == 0) | |
1104 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
1105 | else | |
1106 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1107 | ||
1108 | return CMD_SUCCESS; | |
1109 | } | |
1110 | ||
1111 | DEFUN (no_bgp_bestpath_med2, | |
1112 | no_bgp_bestpath_med2_cmd, | |
1113 | "no bgp bestpath med confed missing-as-worst", | |
1114 | NO_STR | |
1115 | "BGP specific commands\n" | |
1116 | "Change the default bestpath selection\n" | |
1117 | "MED attribute\n" | |
1118 | "Compare MED among confederation paths\n" | |
1119 | "Treat missing MED as the least preferred one\n") | |
1120 | { | |
1121 | struct bgp *bgp; | |
1122 | ||
1123 | bgp = vty->index; | |
1124 | bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED); | |
1125 | bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST); | |
1126 | return CMD_SUCCESS; | |
1127 | } | |
1128 | ||
1129 | ALIAS (no_bgp_bestpath_med2, | |
1130 | no_bgp_bestpath_med3_cmd, | |
1131 | "no bgp bestpath med missing-as-worst confed", | |
1132 | NO_STR | |
1133 | "BGP specific commands\n" | |
1134 | "Change the default bestpath selection\n" | |
1135 | "MED attribute\n" | |
1136 | "Treat missing MED as the least preferred one\n" | |
1137 | "Compare MED among confederation paths\n") | |
1138 | \f | |
1139 | /* "no bgp default ipv4-unicast". */ | |
1140 | DEFUN (no_bgp_default_ipv4_unicast, | |
1141 | no_bgp_default_ipv4_unicast_cmd, | |
1142 | "no bgp default ipv4-unicast", | |
1143 | NO_STR | |
1144 | "BGP specific commands\n" | |
1145 | "Configure BGP defaults\n" | |
1146 | "Activate ipv4-unicast for a peer by default\n") | |
1147 | { | |
1148 | struct bgp *bgp; | |
1149 | ||
1150 | bgp = vty->index; | |
1151 | bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
1152 | return CMD_SUCCESS; | |
1153 | } | |
1154 | ||
1155 | DEFUN (bgp_default_ipv4_unicast, | |
1156 | bgp_default_ipv4_unicast_cmd, | |
1157 | "bgp default ipv4-unicast", | |
1158 | "BGP specific commands\n" | |
1159 | "Configure BGP defaults\n" | |
1160 | "Activate ipv4-unicast for a peer by default\n") | |
1161 | { | |
1162 | struct bgp *bgp; | |
1163 | ||
1164 | bgp = vty->index; | |
1165 | bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4); | |
1166 | return CMD_SUCCESS; | |
1167 | } | |
1168 | \f | |
1169 | /* "bgp import-check" configuration. */ | |
1170 | DEFUN (bgp_network_import_check, | |
1171 | bgp_network_import_check_cmd, | |
1172 | "bgp network import-check", | |
1173 | "BGP specific commands\n" | |
1174 | "BGP network command\n" | |
1175 | "Check BGP network route exists in IGP\n") | |
1176 | { | |
1177 | struct bgp *bgp; | |
1178 | ||
1179 | bgp = vty->index; | |
1180 | bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK); | |
1181 | return CMD_SUCCESS; | |
1182 | } | |
1183 | ||
1184 | DEFUN (no_bgp_network_import_check, | |
1185 | no_bgp_network_import_check_cmd, | |
1186 | "no bgp network import-check", | |
1187 | NO_STR | |
1188 | "BGP specific commands\n" | |
1189 | "BGP network command\n" | |
1190 | "Check BGP network route exists in IGP\n") | |
1191 | { | |
1192 | struct bgp *bgp; | |
1193 | ||
1194 | bgp = vty->index; | |
1195 | bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK); | |
1196 | return CMD_SUCCESS; | |
1197 | } | |
1198 | \f | |
1199 | DEFUN (bgp_default_local_preference, | |
1200 | bgp_default_local_preference_cmd, | |
1201 | "bgp default local-preference <0-4294967295>", | |
1202 | "BGP specific commands\n" | |
1203 | "Configure BGP defaults\n" | |
1204 | "local preference (higher=more preferred)\n" | |
1205 | "Configure default local preference value\n") | |
1206 | { | |
1207 | struct bgp *bgp; | |
1208 | u_int32_t local_pref; | |
1209 | ||
1210 | bgp = vty->index; | |
1211 | ||
1212 | VTY_GET_INTEGER ("local preference", local_pref, argv[0]); | |
1213 | ||
1214 | bgp_default_local_preference_set (bgp, local_pref); | |
1215 | ||
1216 | return CMD_SUCCESS; | |
1217 | } | |
1218 | ||
1219 | DEFUN (no_bgp_default_local_preference, | |
1220 | no_bgp_default_local_preference_cmd, | |
1221 | "no bgp default local-preference", | |
1222 | NO_STR | |
1223 | "BGP specific commands\n" | |
1224 | "Configure BGP defaults\n" | |
1225 | "local preference (higher=more preferred)\n") | |
1226 | { | |
1227 | struct bgp *bgp; | |
1228 | ||
1229 | bgp = vty->index; | |
1230 | bgp_default_local_preference_unset (bgp); | |
1231 | return CMD_SUCCESS; | |
1232 | } | |
1233 | ||
1234 | ALIAS (no_bgp_default_local_preference, | |
1235 | no_bgp_default_local_preference_val_cmd, | |
1236 | "no bgp default local-preference <0-4294967295>", | |
1237 | NO_STR | |
1238 | "BGP specific commands\n" | |
1239 | "Configure BGP defaults\n" | |
1240 | "local preference (higher=more preferred)\n" | |
1241 | "Configure default local preference value\n") | |
1242 | \f | |
1243 | static int | |
fd79ac91 | 1244 | peer_remote_as_vty (struct vty *vty, const char *peer_str, |
1245 | const char *as_str, afi_t afi, safi_t safi) | |
718e3744 | 1246 | { |
1247 | int ret; | |
1248 | struct bgp *bgp; | |
1249 | as_t as; | |
1250 | union sockunion su; | |
1251 | ||
1252 | bgp = vty->index; | |
1253 | ||
1254 | /* Get AS number. */ | |
0b2aa3a0 | 1255 | VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX); |
718e3744 | 1256 | |
1257 | /* If peer is peer group, call proper function. */ | |
1258 | ret = str2sockunion (peer_str, &su); | |
1259 | if (ret < 0) | |
1260 | { | |
1261 | ret = peer_group_remote_as (bgp, peer_str, &as); | |
1262 | if (ret < 0) | |
1263 | { | |
1264 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1265 | return CMD_WARNING; | |
1266 | } | |
1267 | return CMD_SUCCESS; | |
1268 | } | |
1269 | ||
1270 | if (peer_address_self_check (&su)) | |
1271 | { | |
1272 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
1273 | VTY_NEWLINE); | |
1274 | return CMD_WARNING; | |
1275 | } | |
1276 | ||
1277 | ret = peer_remote_as (bgp, &su, &as, afi, safi); | |
1278 | ||
1279 | /* This peer belongs to peer group. */ | |
1280 | switch (ret) | |
1281 | { | |
1282 | case BGP_ERR_PEER_GROUP_MEMBER: | |
1283 | vty_out (vty, "%% Peer-group AS %d. Cannot configure remote-as for member%s", as, VTY_NEWLINE); | |
1284 | return CMD_WARNING; | |
718e3744 | 1285 | case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: |
1286 | vty_out (vty, "%% The AS# can not be changed from %d to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE); | |
1287 | return CMD_WARNING; | |
718e3744 | 1288 | } |
1289 | return bgp_vty_return (vty, ret); | |
1290 | } | |
1291 | ||
1292 | DEFUN (neighbor_remote_as, | |
1293 | neighbor_remote_as_cmd, | |
320da874 | 1294 | NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, |
718e3744 | 1295 | NEIGHBOR_STR |
1296 | NEIGHBOR_ADDR_STR2 | |
1297 | "Specify a BGP neighbor\n" | |
1298 | AS_STR) | |
1299 | { | |
1300 | return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST); | |
1301 | } | |
1302 | \f | |
1303 | DEFUN (neighbor_peer_group, | |
1304 | neighbor_peer_group_cmd, | |
1305 | "neighbor WORD peer-group", | |
1306 | NEIGHBOR_STR | |
1307 | "Neighbor tag\n" | |
1308 | "Configure peer-group\n") | |
1309 | { | |
1310 | struct bgp *bgp; | |
1311 | struct peer_group *group; | |
1312 | ||
1313 | bgp = vty->index; | |
1314 | ||
1315 | group = peer_group_get (bgp, argv[0]); | |
1316 | if (! group) | |
1317 | return CMD_WARNING; | |
1318 | ||
1319 | return CMD_SUCCESS; | |
1320 | } | |
1321 | ||
1322 | DEFUN (no_neighbor, | |
1323 | no_neighbor_cmd, | |
1324 | NO_NEIGHBOR_CMD2, | |
1325 | NO_STR | |
1326 | NEIGHBOR_STR | |
1327 | NEIGHBOR_ADDR_STR2) | |
1328 | { | |
1329 | int ret; | |
1330 | union sockunion su; | |
1331 | struct peer_group *group; | |
1332 | struct peer *peer; | |
1333 | ||
1334 | ret = str2sockunion (argv[0], &su); | |
1335 | if (ret < 0) | |
1336 | { | |
1337 | group = peer_group_lookup (vty->index, argv[0]); | |
1338 | if (group) | |
1339 | peer_group_delete (group); | |
1340 | else | |
1341 | { | |
1342 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1343 | return CMD_WARNING; | |
1344 | } | |
1345 | } | |
1346 | else | |
1347 | { | |
1348 | peer = peer_lookup (vty->index, &su); | |
1349 | if (peer) | |
200df115 | 1350 | peer_delete (peer); |
718e3744 | 1351 | } |
1352 | ||
1353 | return CMD_SUCCESS; | |
1354 | } | |
1355 | ||
1356 | ALIAS (no_neighbor, | |
1357 | no_neighbor_remote_as_cmd, | |
320da874 | 1358 | NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, |
718e3744 | 1359 | NO_STR |
1360 | NEIGHBOR_STR | |
1361 | NEIGHBOR_ADDR_STR | |
1362 | "Specify a BGP neighbor\n" | |
1363 | AS_STR) | |
1364 | ||
1365 | DEFUN (no_neighbor_peer_group, | |
1366 | no_neighbor_peer_group_cmd, | |
1367 | "no neighbor WORD peer-group", | |
1368 | NO_STR | |
1369 | NEIGHBOR_STR | |
1370 | "Neighbor tag\n" | |
1371 | "Configure peer-group\n") | |
1372 | { | |
1373 | struct peer_group *group; | |
1374 | ||
1375 | group = peer_group_lookup (vty->index, argv[0]); | |
1376 | if (group) | |
1377 | peer_group_delete (group); | |
1378 | else | |
1379 | { | |
1380 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1381 | return CMD_WARNING; | |
1382 | } | |
1383 | return CMD_SUCCESS; | |
1384 | } | |
1385 | ||
1386 | DEFUN (no_neighbor_peer_group_remote_as, | |
1387 | no_neighbor_peer_group_remote_as_cmd, | |
320da874 | 1388 | "no neighbor WORD remote-as " CMD_AS_RANGE, |
718e3744 | 1389 | NO_STR |
1390 | NEIGHBOR_STR | |
1391 | "Neighbor tag\n" | |
1392 | "Specify a BGP neighbor\n" | |
1393 | AS_STR) | |
1394 | { | |
1395 | struct peer_group *group; | |
1396 | ||
1397 | group = peer_group_lookup (vty->index, argv[0]); | |
1398 | if (group) | |
1399 | peer_group_remote_as_delete (group); | |
1400 | else | |
1401 | { | |
1402 | vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); | |
1403 | return CMD_WARNING; | |
1404 | } | |
1405 | return CMD_SUCCESS; | |
1406 | } | |
1407 | \f | |
1408 | DEFUN (neighbor_local_as, | |
1409 | neighbor_local_as_cmd, | |
320da874 | 1410 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 1411 | NEIGHBOR_STR |
1412 | NEIGHBOR_ADDR_STR2 | |
1413 | "Specify a local-as number\n" | |
1414 | "AS number used as local AS\n") | |
1415 | { | |
1416 | struct peer *peer; | |
1417 | int ret; | |
1418 | ||
1419 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1420 | if (! peer) | |
1421 | return CMD_WARNING; | |
1422 | ||
1423 | ret = peer_local_as_set (peer, atoi (argv[1]), 0); | |
1424 | return bgp_vty_return (vty, ret); | |
1425 | } | |
1426 | ||
1427 | DEFUN (neighbor_local_as_no_prepend, | |
1428 | neighbor_local_as_no_prepend_cmd, | |
320da874 | 1429 | NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 1430 | NEIGHBOR_STR |
1431 | NEIGHBOR_ADDR_STR2 | |
1432 | "Specify a local-as number\n" | |
1433 | "AS number used as local AS\n" | |
1434 | "Do not prepend local-as to updates from ebgp peers\n") | |
1435 | { | |
1436 | struct peer *peer; | |
1437 | int ret; | |
1438 | ||
1439 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1440 | if (! peer) | |
1441 | return CMD_WARNING; | |
1442 | ||
1443 | ret = peer_local_as_set (peer, atoi (argv[1]), 1); | |
1444 | return bgp_vty_return (vty, ret); | |
1445 | } | |
1446 | ||
1447 | DEFUN (no_neighbor_local_as, | |
1448 | no_neighbor_local_as_cmd, | |
1449 | NO_NEIGHBOR_CMD2 "local-as", | |
1450 | NO_STR | |
1451 | NEIGHBOR_STR | |
1452 | NEIGHBOR_ADDR_STR2 | |
1453 | "Specify a local-as number\n") | |
1454 | { | |
1455 | struct peer *peer; | |
1456 | int ret; | |
1457 | ||
1458 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1459 | if (! peer) | |
1460 | return CMD_WARNING; | |
1461 | ||
1462 | ret = peer_local_as_unset (peer); | |
1463 | return bgp_vty_return (vty, ret); | |
1464 | } | |
1465 | ||
1466 | ALIAS (no_neighbor_local_as, | |
1467 | no_neighbor_local_as_val_cmd, | |
320da874 | 1468 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, |
718e3744 | 1469 | NO_STR |
1470 | NEIGHBOR_STR | |
1471 | NEIGHBOR_ADDR_STR2 | |
1472 | "Specify a local-as number\n" | |
1473 | "AS number used as local AS\n") | |
1474 | ||
1475 | ALIAS (no_neighbor_local_as, | |
1476 | no_neighbor_local_as_val2_cmd, | |
320da874 | 1477 | NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", |
718e3744 | 1478 | NO_STR |
1479 | NEIGHBOR_STR | |
1480 | NEIGHBOR_ADDR_STR2 | |
1481 | "Specify a local-as number\n" | |
1482 | "AS number used as local AS\n" | |
1483 | "Do not prepend local-as to updates from ebgp peers\n") | |
1484 | \f | |
0df7c91f PJ |
1485 | DEFUN (neighbor_password, |
1486 | neighbor_password_cmd, | |
1487 | NEIGHBOR_CMD2 "password LINE", | |
1488 | NEIGHBOR_STR | |
1489 | NEIGHBOR_ADDR_STR2 | |
1490 | "Set a password\n" | |
1491 | "The password\n") | |
1492 | { | |
1493 | struct peer *peer; | |
1494 | int ret; | |
1495 | ||
1496 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1497 | if (! peer) | |
1498 | return CMD_WARNING; | |
1499 | ||
1500 | ret = peer_password_set (peer, argv[1]); | |
1501 | return bgp_vty_return (vty, ret); | |
1502 | } | |
1503 | ||
1504 | DEFUN (no_neighbor_password, | |
1505 | no_neighbor_password_cmd, | |
1506 | NO_NEIGHBOR_CMD2 "password", | |
1507 | NO_STR | |
1508 | NEIGHBOR_STR | |
1509 | NEIGHBOR_ADDR_STR2 | |
1510 | "Set a password\n") | |
1511 | { | |
1512 | struct peer *peer; | |
1513 | int ret; | |
1514 | ||
1515 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1516 | if (! peer) | |
1517 | return CMD_WARNING; | |
1518 | ||
1519 | ret = peer_password_unset (peer); | |
1520 | return bgp_vty_return (vty, ret); | |
1521 | } | |
1522 | \f | |
718e3744 | 1523 | DEFUN (neighbor_activate, |
1524 | neighbor_activate_cmd, | |
1525 | NEIGHBOR_CMD2 "activate", | |
1526 | NEIGHBOR_STR | |
1527 | NEIGHBOR_ADDR_STR2 | |
1528 | "Enable the Address Family for this Neighbor\n") | |
1529 | { | |
1530 | struct peer *peer; | |
1531 | ||
1532 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1533 | if (! peer) | |
1534 | return CMD_WARNING; | |
1535 | ||
1536 | peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
1537 | ||
1538 | return CMD_SUCCESS; | |
1539 | } | |
1540 | ||
1541 | DEFUN (no_neighbor_activate, | |
1542 | no_neighbor_activate_cmd, | |
1543 | NO_NEIGHBOR_CMD2 "activate", | |
1544 | NO_STR | |
1545 | NEIGHBOR_STR | |
1546 | NEIGHBOR_ADDR_STR2 | |
1547 | "Enable the Address Family for this Neighbor\n") | |
1548 | { | |
1549 | int ret; | |
1550 | struct peer *peer; | |
1551 | ||
1552 | /* Lookup peer. */ | |
1553 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
1554 | if (! peer) | |
1555 | return CMD_WARNING; | |
1556 | ||
1557 | ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
1558 | ||
1559 | return bgp_vty_return (vty, ret); | |
1560 | } | |
1561 | \f | |
1562 | DEFUN (neighbor_set_peer_group, | |
1563 | neighbor_set_peer_group_cmd, | |
1564 | NEIGHBOR_CMD "peer-group WORD", | |
1565 | NEIGHBOR_STR | |
1566 | NEIGHBOR_ADDR_STR | |
1567 | "Member of the peer-group\n" | |
1568 | "peer-group name\n") | |
1569 | { | |
1570 | int ret; | |
1571 | as_t as; | |
1572 | union sockunion su; | |
1573 | struct bgp *bgp; | |
1574 | struct peer_group *group; | |
1575 | ||
1576 | bgp = vty->index; | |
1577 | ||
1578 | ret = str2sockunion (argv[0], &su); | |
1579 | if (ret < 0) | |
1580 | { | |
1581 | vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE); | |
1582 | return CMD_WARNING; | |
1583 | } | |
1584 | ||
1585 | group = peer_group_lookup (bgp, argv[1]); | |
1586 | if (! group) | |
1587 | { | |
1588 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
1589 | return CMD_WARNING; | |
1590 | } | |
1591 | ||
1592 | if (peer_address_self_check (&su)) | |
1593 | { | |
1594 | vty_out (vty, "%% Can not configure the local system as neighbor%s", | |
1595 | VTY_NEWLINE); | |
1596 | return CMD_WARNING; | |
1597 | } | |
1598 | ||
1599 | ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty), | |
1600 | bgp_node_safi (vty), &as); | |
1601 | ||
1602 | if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) | |
1603 | { | |
1604 | vty_out (vty, "%% Peer with AS %d cannot be in this peer-group, members must be all internal or all external%s", as, VTY_NEWLINE); | |
1605 | return CMD_WARNING; | |
1606 | } | |
1607 | ||
1608 | return bgp_vty_return (vty, ret); | |
1609 | } | |
1610 | ||
1611 | DEFUN (no_neighbor_set_peer_group, | |
1612 | no_neighbor_set_peer_group_cmd, | |
1613 | NO_NEIGHBOR_CMD "peer-group WORD", | |
1614 | NO_STR | |
1615 | NEIGHBOR_STR | |
1616 | NEIGHBOR_ADDR_STR | |
1617 | "Member of the peer-group\n" | |
1618 | "peer-group name\n") | |
1619 | { | |
1620 | int ret; | |
1621 | struct bgp *bgp; | |
1622 | struct peer *peer; | |
1623 | struct peer_group *group; | |
1624 | ||
1625 | bgp = vty->index; | |
1626 | ||
1627 | peer = peer_lookup_vty (vty, argv[0]); | |
1628 | if (! peer) | |
1629 | return CMD_WARNING; | |
1630 | ||
1631 | group = peer_group_lookup (bgp, argv[1]); | |
1632 | if (! group) | |
1633 | { | |
1634 | vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE); | |
1635 | return CMD_WARNING; | |
1636 | } | |
1637 | ||
1638 | ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty), | |
1639 | bgp_node_safi (vty)); | |
1640 | ||
1641 | return bgp_vty_return (vty, ret); | |
1642 | } | |
1643 | \f | |
94f2b392 | 1644 | static int |
fd79ac91 | 1645 | peer_flag_modify_vty (struct vty *vty, const char *ip_str, |
1646 | u_int16_t flag, int set) | |
718e3744 | 1647 | { |
1648 | int ret; | |
1649 | struct peer *peer; | |
1650 | ||
1651 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
1652 | if (! peer) | |
1653 | return CMD_WARNING; | |
1654 | ||
1655 | if (set) | |
1656 | ret = peer_flag_set (peer, flag); | |
1657 | else | |
1658 | ret = peer_flag_unset (peer, flag); | |
1659 | ||
1660 | return bgp_vty_return (vty, ret); | |
1661 | } | |
1662 | ||
94f2b392 | 1663 | static int |
fd79ac91 | 1664 | peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 1665 | { |
1666 | return peer_flag_modify_vty (vty, ip_str, flag, 1); | |
1667 | } | |
1668 | ||
94f2b392 | 1669 | static int |
fd79ac91 | 1670 | peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag) |
718e3744 | 1671 | { |
1672 | return peer_flag_modify_vty (vty, ip_str, flag, 0); | |
1673 | } | |
1674 | ||
1675 | /* neighbor passive. */ | |
1676 | DEFUN (neighbor_passive, | |
1677 | neighbor_passive_cmd, | |
1678 | NEIGHBOR_CMD2 "passive", | |
1679 | NEIGHBOR_STR | |
1680 | NEIGHBOR_ADDR_STR2 | |
1681 | "Don't send open messages to this neighbor\n") | |
1682 | { | |
1683 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
1684 | } | |
1685 | ||
1686 | DEFUN (no_neighbor_passive, | |
1687 | no_neighbor_passive_cmd, | |
1688 | NO_NEIGHBOR_CMD2 "passive", | |
1689 | NO_STR | |
1690 | NEIGHBOR_STR | |
1691 | NEIGHBOR_ADDR_STR2 | |
1692 | "Don't send open messages to this neighbor\n") | |
1693 | { | |
1694 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE); | |
1695 | } | |
1696 | \f | |
1697 | /* neighbor shutdown. */ | |
1698 | DEFUN (neighbor_shutdown, | |
1699 | neighbor_shutdown_cmd, | |
1700 | NEIGHBOR_CMD2 "shutdown", | |
1701 | NEIGHBOR_STR | |
1702 | NEIGHBOR_ADDR_STR2 | |
1703 | "Administratively shut down this neighbor\n") | |
1704 | { | |
1705 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
1706 | } | |
1707 | ||
1708 | DEFUN (no_neighbor_shutdown, | |
1709 | no_neighbor_shutdown_cmd, | |
1710 | NO_NEIGHBOR_CMD2 "shutdown", | |
1711 | NO_STR | |
1712 | NEIGHBOR_STR | |
1713 | NEIGHBOR_ADDR_STR2 | |
1714 | "Administratively shut down this neighbor\n") | |
1715 | { | |
1716 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN); | |
1717 | } | |
1718 | \f | |
c9502438 | 1719 | /* Deprecated neighbor capability route-refresh. */ |
1720 | DEFUN_DEPRECATED (neighbor_capability_route_refresh, | |
1721 | neighbor_capability_route_refresh_cmd, | |
1722 | NEIGHBOR_CMD2 "capability route-refresh", | |
1723 | NEIGHBOR_STR | |
1724 | NEIGHBOR_ADDR_STR2 | |
1725 | "Advertise capability to the peer\n" | |
1726 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 1727 | { |
c9502438 | 1728 | return CMD_SUCCESS; |
718e3744 | 1729 | } |
1730 | ||
c9502438 | 1731 | DEFUN_DEPRECATED (no_neighbor_capability_route_refresh, |
1732 | no_neighbor_capability_route_refresh_cmd, | |
1733 | NO_NEIGHBOR_CMD2 "capability route-refresh", | |
1734 | NO_STR | |
1735 | NEIGHBOR_STR | |
1736 | NEIGHBOR_ADDR_STR2 | |
1737 | "Advertise capability to the peer\n" | |
1738 | "Advertise route-refresh capability to this neighbor\n") | |
718e3744 | 1739 | { |
c9502438 | 1740 | return CMD_SUCCESS; |
718e3744 | 1741 | } |
1742 | \f | |
1743 | /* neighbor capability dynamic. */ | |
1744 | DEFUN (neighbor_capability_dynamic, | |
1745 | neighbor_capability_dynamic_cmd, | |
1746 | NEIGHBOR_CMD2 "capability dynamic", | |
1747 | NEIGHBOR_STR | |
1748 | NEIGHBOR_ADDR_STR2 | |
1749 | "Advertise capability to the peer\n" | |
1750 | "Advertise dynamic capability to this neighbor\n") | |
1751 | { | |
1752 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
1753 | } | |
1754 | ||
1755 | DEFUN (no_neighbor_capability_dynamic, | |
1756 | no_neighbor_capability_dynamic_cmd, | |
1757 | NO_NEIGHBOR_CMD2 "capability dynamic", | |
1758 | NO_STR | |
1759 | NEIGHBOR_STR | |
1760 | NEIGHBOR_ADDR_STR2 | |
1761 | "Advertise capability to the peer\n" | |
1762 | "Advertise dynamic capability to this neighbor\n") | |
1763 | { | |
1764 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY); | |
1765 | } | |
1766 | \f | |
1767 | /* neighbor dont-capability-negotiate */ | |
1768 | DEFUN (neighbor_dont_capability_negotiate, | |
1769 | neighbor_dont_capability_negotiate_cmd, | |
1770 | NEIGHBOR_CMD2 "dont-capability-negotiate", | |
1771 | NEIGHBOR_STR | |
1772 | NEIGHBOR_ADDR_STR2 | |
1773 | "Do not perform capability negotiation\n") | |
1774 | { | |
1775 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
1776 | } | |
1777 | ||
1778 | DEFUN (no_neighbor_dont_capability_negotiate, | |
1779 | no_neighbor_dont_capability_negotiate_cmd, | |
1780 | NO_NEIGHBOR_CMD2 "dont-capability-negotiate", | |
1781 | NO_STR | |
1782 | NEIGHBOR_STR | |
1783 | NEIGHBOR_ADDR_STR2 | |
1784 | "Do not perform capability negotiation\n") | |
1785 | { | |
1786 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY); | |
1787 | } | |
1788 | \f | |
94f2b392 | 1789 | static int |
fd79ac91 | 1790 | peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 1791 | safi_t safi, u_int32_t flag, int set) |
718e3744 | 1792 | { |
1793 | int ret; | |
1794 | struct peer *peer; | |
1795 | ||
1796 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
1797 | if (! peer) | |
1798 | return CMD_WARNING; | |
1799 | ||
1800 | if (set) | |
1801 | ret = peer_af_flag_set (peer, afi, safi, flag); | |
1802 | else | |
1803 | ret = peer_af_flag_unset (peer, afi, safi, flag); | |
1804 | ||
1805 | return bgp_vty_return (vty, ret); | |
1806 | } | |
1807 | ||
94f2b392 | 1808 | static int |
fd79ac91 | 1809 | peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 1810 | safi_t safi, u_int32_t flag) |
718e3744 | 1811 | { |
1812 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1); | |
1813 | } | |
1814 | ||
94f2b392 | 1815 | static int |
fd79ac91 | 1816 | peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi, |
fee0f4c6 | 1817 | safi_t safi, u_int32_t flag) |
718e3744 | 1818 | { |
1819 | return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0); | |
1820 | } | |
1821 | \f | |
1822 | /* neighbor capability orf prefix-list. */ | |
1823 | DEFUN (neighbor_capability_orf_prefix, | |
1824 | neighbor_capability_orf_prefix_cmd, | |
1825 | NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
1826 | NEIGHBOR_STR | |
1827 | NEIGHBOR_ADDR_STR2 | |
1828 | "Advertise capability to the peer\n" | |
1829 | "Advertise ORF capability to the peer\n" | |
1830 | "Advertise prefixlist ORF capability to this neighbor\n" | |
1831 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
1832 | "Capability to RECEIVE the ORF from this neighbor\n" | |
1833 | "Capability to SEND the ORF to this neighbor\n") | |
1834 | { | |
1835 | u_int16_t flag = 0; | |
1836 | ||
1837 | if (strncmp (argv[1], "s", 1) == 0) | |
1838 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
1839 | else if (strncmp (argv[1], "r", 1) == 0) | |
1840 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
1841 | else if (strncmp (argv[1], "b", 1) == 0) | |
1842 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
1843 | else | |
1844 | return CMD_WARNING; | |
1845 | ||
1846 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1847 | bgp_node_safi (vty), flag); | |
1848 | } | |
1849 | ||
1850 | DEFUN (no_neighbor_capability_orf_prefix, | |
1851 | no_neighbor_capability_orf_prefix_cmd, | |
1852 | NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)", | |
1853 | NO_STR | |
1854 | NEIGHBOR_STR | |
1855 | NEIGHBOR_ADDR_STR2 | |
1856 | "Advertise capability to the peer\n" | |
1857 | "Advertise ORF capability to the peer\n" | |
1858 | "Advertise prefixlist ORF capability to this neighbor\n" | |
1859 | "Capability to SEND and RECEIVE the ORF to/from this neighbor\n" | |
1860 | "Capability to RECEIVE the ORF from this neighbor\n" | |
1861 | "Capability to SEND the ORF to this neighbor\n") | |
1862 | { | |
1863 | u_int16_t flag = 0; | |
1864 | ||
1865 | if (strncmp (argv[1], "s", 1) == 0) | |
1866 | flag = PEER_FLAG_ORF_PREFIX_SM; | |
1867 | else if (strncmp (argv[1], "r", 1) == 0) | |
1868 | flag = PEER_FLAG_ORF_PREFIX_RM; | |
1869 | else if (strncmp (argv[1], "b", 1) == 0) | |
1870 | flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM; | |
1871 | else | |
1872 | return CMD_WARNING; | |
1873 | ||
1874 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1875 | bgp_node_safi (vty), flag); | |
1876 | } | |
1877 | \f | |
1878 | /* neighbor next-hop-self. */ | |
1879 | DEFUN (neighbor_nexthop_self, | |
1880 | neighbor_nexthop_self_cmd, | |
1881 | NEIGHBOR_CMD2 "next-hop-self", | |
1882 | NEIGHBOR_STR | |
1883 | NEIGHBOR_ADDR_STR2 | |
1884 | "Disable the next hop calculation for this neighbor\n") | |
1885 | { | |
1886 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1887 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); | |
1888 | } | |
1889 | ||
1890 | DEFUN (no_neighbor_nexthop_self, | |
1891 | no_neighbor_nexthop_self_cmd, | |
1892 | NO_NEIGHBOR_CMD2 "next-hop-self", | |
1893 | NO_STR | |
1894 | NEIGHBOR_STR | |
1895 | NEIGHBOR_ADDR_STR2 | |
1896 | "Disable the next hop calculation for this neighbor\n") | |
1897 | { | |
1898 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1899 | bgp_node_safi (vty), PEER_FLAG_NEXTHOP_SELF); | |
1900 | } | |
1901 | \f | |
1902 | /* neighbor remove-private-AS. */ | |
1903 | DEFUN (neighbor_remove_private_as, | |
1904 | neighbor_remove_private_as_cmd, | |
1905 | NEIGHBOR_CMD2 "remove-private-AS", | |
1906 | NEIGHBOR_STR | |
1907 | NEIGHBOR_ADDR_STR2 | |
1908 | "Remove private AS number from outbound updates\n") | |
1909 | { | |
1910 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1911 | bgp_node_safi (vty), | |
1912 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
1913 | } | |
1914 | ||
1915 | DEFUN (no_neighbor_remove_private_as, | |
1916 | no_neighbor_remove_private_as_cmd, | |
1917 | NO_NEIGHBOR_CMD2 "remove-private-AS", | |
1918 | NO_STR | |
1919 | NEIGHBOR_STR | |
1920 | NEIGHBOR_ADDR_STR2 | |
1921 | "Remove private AS number from outbound updates\n") | |
1922 | { | |
1923 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1924 | bgp_node_safi (vty), | |
1925 | PEER_FLAG_REMOVE_PRIVATE_AS); | |
1926 | } | |
1927 | \f | |
1928 | /* neighbor send-community. */ | |
1929 | DEFUN (neighbor_send_community, | |
1930 | neighbor_send_community_cmd, | |
1931 | NEIGHBOR_CMD2 "send-community", | |
1932 | NEIGHBOR_STR | |
1933 | NEIGHBOR_ADDR_STR2 | |
1934 | "Send Community attribute to this neighbor\n") | |
1935 | { | |
1936 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1937 | bgp_node_safi (vty), | |
1938 | PEER_FLAG_SEND_COMMUNITY); | |
1939 | } | |
1940 | ||
1941 | DEFUN (no_neighbor_send_community, | |
1942 | no_neighbor_send_community_cmd, | |
1943 | NO_NEIGHBOR_CMD2 "send-community", | |
1944 | NO_STR | |
1945 | NEIGHBOR_STR | |
1946 | NEIGHBOR_ADDR_STR2 | |
1947 | "Send Community attribute to this neighbor\n") | |
1948 | { | |
1949 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1950 | bgp_node_safi (vty), | |
1951 | PEER_FLAG_SEND_COMMUNITY); | |
1952 | } | |
1953 | \f | |
1954 | /* neighbor send-community extended. */ | |
1955 | DEFUN (neighbor_send_community_type, | |
1956 | neighbor_send_community_type_cmd, | |
1957 | NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
1958 | NEIGHBOR_STR | |
1959 | NEIGHBOR_ADDR_STR2 | |
1960 | "Send Community attribute to this neighbor\n" | |
1961 | "Send Standard and Extended Community attributes\n" | |
1962 | "Send Extended Community attributes\n" | |
1963 | "Send Standard Community attributes\n") | |
1964 | { | |
1965 | if (strncmp (argv[1], "s", 1) == 0) | |
1966 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1967 | bgp_node_safi (vty), | |
1968 | PEER_FLAG_SEND_COMMUNITY); | |
1969 | if (strncmp (argv[1], "e", 1) == 0) | |
1970 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1971 | bgp_node_safi (vty), | |
1972 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
1973 | ||
1974 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
1975 | bgp_node_safi (vty), | |
1976 | (PEER_FLAG_SEND_COMMUNITY| | |
1977 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
1978 | } | |
1979 | ||
1980 | DEFUN (no_neighbor_send_community_type, | |
1981 | no_neighbor_send_community_type_cmd, | |
1982 | NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)", | |
1983 | NO_STR | |
1984 | NEIGHBOR_STR | |
1985 | NEIGHBOR_ADDR_STR2 | |
1986 | "Send Community attribute to this neighbor\n" | |
1987 | "Send Standard and Extended Community attributes\n" | |
1988 | "Send Extended Community attributes\n" | |
1989 | "Send Standard Community attributes\n") | |
1990 | { | |
1991 | if (strncmp (argv[1], "s", 1) == 0) | |
1992 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1993 | bgp_node_safi (vty), | |
1994 | PEER_FLAG_SEND_COMMUNITY); | |
1995 | if (strncmp (argv[1], "e", 1) == 0) | |
1996 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
1997 | bgp_node_safi (vty), | |
1998 | PEER_FLAG_SEND_EXT_COMMUNITY); | |
1999 | ||
2000 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2001 | bgp_node_safi (vty), | |
2002 | (PEER_FLAG_SEND_COMMUNITY | | |
2003 | PEER_FLAG_SEND_EXT_COMMUNITY)); | |
2004 | } | |
2005 | \f | |
2006 | /* neighbor soft-reconfig. */ | |
2007 | DEFUN (neighbor_soft_reconfiguration, | |
2008 | neighbor_soft_reconfiguration_cmd, | |
2009 | NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
2010 | NEIGHBOR_STR | |
2011 | NEIGHBOR_ADDR_STR2 | |
2012 | "Per neighbor soft reconfiguration\n" | |
2013 | "Allow inbound soft reconfiguration for this neighbor\n") | |
2014 | { | |
2015 | return peer_af_flag_set_vty (vty, argv[0], | |
2016 | bgp_node_afi (vty), bgp_node_safi (vty), | |
2017 | PEER_FLAG_SOFT_RECONFIG); | |
2018 | } | |
2019 | ||
2020 | DEFUN (no_neighbor_soft_reconfiguration, | |
2021 | no_neighbor_soft_reconfiguration_cmd, | |
2022 | NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound", | |
2023 | NO_STR | |
2024 | NEIGHBOR_STR | |
2025 | NEIGHBOR_ADDR_STR2 | |
2026 | "Per neighbor soft reconfiguration\n" | |
2027 | "Allow inbound soft reconfiguration for this neighbor\n") | |
2028 | { | |
2029 | return peer_af_flag_unset_vty (vty, argv[0], | |
2030 | bgp_node_afi (vty), bgp_node_safi (vty), | |
2031 | PEER_FLAG_SOFT_RECONFIG); | |
2032 | } | |
2033 | \f | |
2034 | DEFUN (neighbor_route_reflector_client, | |
2035 | neighbor_route_reflector_client_cmd, | |
2036 | NEIGHBOR_CMD2 "route-reflector-client", | |
2037 | NEIGHBOR_STR | |
2038 | NEIGHBOR_ADDR_STR2 | |
2039 | "Configure a neighbor as Route Reflector client\n") | |
2040 | { | |
2041 | struct peer *peer; | |
2042 | ||
2043 | ||
2044 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2045 | if (! peer) | |
2046 | return CMD_WARNING; | |
2047 | ||
2048 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2049 | bgp_node_safi (vty), | |
2050 | PEER_FLAG_REFLECTOR_CLIENT); | |
2051 | } | |
2052 | ||
2053 | DEFUN (no_neighbor_route_reflector_client, | |
2054 | no_neighbor_route_reflector_client_cmd, | |
2055 | NO_NEIGHBOR_CMD2 "route-reflector-client", | |
2056 | NO_STR | |
2057 | NEIGHBOR_STR | |
2058 | NEIGHBOR_ADDR_STR2 | |
2059 | "Configure a neighbor as Route Reflector client\n") | |
2060 | { | |
2061 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2062 | bgp_node_safi (vty), | |
2063 | PEER_FLAG_REFLECTOR_CLIENT); | |
2064 | } | |
2065 | \f | |
94f2b392 | 2066 | static int |
fd79ac91 | 2067 | peer_rsclient_set_vty (struct vty *vty, const char *peer_str, |
2068 | int afi, int safi) | |
fee0f4c6 | 2069 | { |
2070 | int ret; | |
2071 | struct bgp *bgp; | |
2072 | struct peer *peer; | |
2073 | struct peer_group *group; | |
1eb8ef25 | 2074 | struct listnode *node, *nnode; |
fee0f4c6 | 2075 | struct bgp_filter *pfilter; |
2076 | struct bgp_filter *gfilter; | |
2077 | ||
2078 | bgp = vty->index; | |
2079 | ||
2080 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2081 | if ( ! peer ) | |
2082 | return CMD_WARNING; | |
2083 | ||
2084 | /* If it is already a RS-Client, don't do anything. */ | |
2085 | if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
2086 | return CMD_SUCCESS; | |
2087 | ||
2088 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 2089 | { |
2090 | peer = peer_lock (peer); /* rsclient peer list reference */ | |
2091 | listnode_add_sort (bgp->rsclient, peer); | |
2092 | } | |
fee0f4c6 | 2093 | |
2094 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2095 | if (ret < 0) | |
2096 | return bgp_vty_return (vty, ret); | |
2097 | ||
64e580a7 | 2098 | peer->rib[afi][safi] = bgp_table_init (afi, safi); |
fee0f4c6 | 2099 | peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT; |
2100 | peer->rib[afi][safi]->owner = peer; | |
2101 | ||
2102 | /* Check for existing 'network' and 'redistribute' routes. */ | |
2103 | bgp_check_local_routes_rsclient (peer, afi, safi); | |
2104 | ||
2105 | /* Check for routes for peers configured with 'soft-reconfiguration'. */ | |
2106 | bgp_soft_reconfig_rsclient (peer, afi, safi); | |
2107 | ||
2108 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
2109 | { | |
2110 | group = peer->group; | |
2111 | gfilter = &peer->filter[afi][safi]; | |
2112 | ||
1eb8ef25 | 2113 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 2114 | { |
2115 | pfilter = &peer->filter[afi][safi]; | |
2116 | ||
2117 | /* Members of a non-RS-Client group should not be RS-Clients, as that | |
2118 | is checked when the become part of the peer-group */ | |
2119 | ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2120 | if (ret < 0) | |
2121 | return bgp_vty_return (vty, ret); | |
2122 | ||
2123 | /* Make peer's RIB point to group's RIB. */ | |
2124 | peer->rib[afi][safi] = group->conf->rib[afi][safi]; | |
2125 | ||
2126 | /* Import policy. */ | |
2127 | if (pfilter->map[RMAP_IMPORT].name) | |
2128 | free (pfilter->map[RMAP_IMPORT].name); | |
2129 | if (gfilter->map[RMAP_IMPORT].name) | |
2130 | { | |
2131 | pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); | |
2132 | pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; | |
2133 | } | |
2134 | else | |
2135 | { | |
2136 | pfilter->map[RMAP_IMPORT].name = NULL; | |
2137 | pfilter->map[RMAP_IMPORT].map =NULL; | |
2138 | } | |
2139 | ||
2140 | /* Export policy. */ | |
2141 | if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) | |
2142 | { | |
2143 | pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); | |
2144 | pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; | |
2145 | } | |
2146 | } | |
2147 | } | |
2148 | return CMD_SUCCESS; | |
2149 | } | |
2150 | ||
94f2b392 | 2151 | static int |
fd79ac91 | 2152 | peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, |
2153 | int afi, int safi) | |
fee0f4c6 | 2154 | { |
2155 | int ret; | |
2156 | struct bgp *bgp; | |
2157 | struct peer *peer; | |
2158 | struct peer_group *group; | |
1eb8ef25 | 2159 | struct listnode *node, *nnode; |
fee0f4c6 | 2160 | |
2161 | bgp = vty->index; | |
2162 | ||
2163 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2164 | if ( ! peer ) | |
2165 | return CMD_WARNING; | |
2166 | ||
2167 | /* If it is not a RS-Client, don't do anything. */ | |
2168 | if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) ) | |
2169 | return CMD_SUCCESS; | |
2170 | ||
2171 | if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) | |
2172 | { | |
2173 | group = peer->group; | |
2174 | ||
1eb8ef25 | 2175 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
fee0f4c6 | 2176 | { |
2177 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2178 | if (ret < 0) | |
2179 | return bgp_vty_return (vty, ret); | |
2180 | ||
2181 | peer->rib[afi][safi] = NULL; | |
2182 | } | |
2183 | ||
2184 | peer = group->conf; | |
2185 | } | |
2186 | ||
2187 | ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT); | |
2188 | if (ret < 0) | |
2189 | return bgp_vty_return (vty, ret); | |
2190 | ||
2191 | if ( ! peer_rsclient_active (peer) ) | |
200df115 | 2192 | { |
2193 | peer_unlock (peer); /* peer bgp rsclient reference */ | |
2194 | listnode_delete (bgp->rsclient, peer); | |
2195 | } | |
fee0f4c6 | 2196 | |
b608d5b5 | 2197 | bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); |
fee0f4c6 | 2198 | |
2199 | return CMD_SUCCESS; | |
2200 | } | |
2201 | \f | |
718e3744 | 2202 | /* neighbor route-server-client. */ |
2203 | DEFUN (neighbor_route_server_client, | |
2204 | neighbor_route_server_client_cmd, | |
2205 | NEIGHBOR_CMD2 "route-server-client", | |
2206 | NEIGHBOR_STR | |
2207 | NEIGHBOR_ADDR_STR2 | |
2208 | "Configure a neighbor as Route Server client\n") | |
2209 | { | |
fee0f4c6 | 2210 | return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty), |
2211 | bgp_node_safi(vty)); | |
718e3744 | 2212 | } |
2213 | ||
2214 | DEFUN (no_neighbor_route_server_client, | |
2215 | no_neighbor_route_server_client_cmd, | |
2216 | NO_NEIGHBOR_CMD2 "route-server-client", | |
2217 | NO_STR | |
2218 | NEIGHBOR_STR | |
2219 | NEIGHBOR_ADDR_STR2 | |
2220 | "Configure a neighbor as Route Server client\n") | |
fee0f4c6 | 2221 | { |
2222 | return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty), | |
2223 | bgp_node_safi(vty)); | |
2224 | } | |
2225 | \f | |
2226 | DEFUN (neighbor_nexthop_local_unchanged, | |
2227 | neighbor_nexthop_local_unchanged_cmd, | |
2228 | NEIGHBOR_CMD2 "nexthop-local unchanged", | |
2229 | NEIGHBOR_STR | |
2230 | NEIGHBOR_ADDR_STR2 | |
2231 | "Configure treatment of outgoing link-local nexthop attribute\n" | |
2232 | "Leave link-local nexthop unchanged for this peer\n") | |
2233 | { | |
2234 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2235 | bgp_node_safi (vty), | |
2236 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); | |
2237 | } | |
2238 | \f | |
2239 | DEFUN (no_neighbor_nexthop_local_unchanged, | |
2240 | no_neighbor_nexthop_local_unchanged_cmd, | |
2241 | NO_NEIGHBOR_CMD2 "nexthop-local unchanged", | |
2242 | NO_STR | |
2243 | NEIGHBOR_STR | |
2244 | NEIGHBOR_ADDR_STR2 | |
2245 | "Configure treatment of outgoing link-local-nexthop attribute\n" | |
2246 | "Leave link-local nexthop unchanged for this peer\n") | |
718e3744 | 2247 | { |
2248 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2249 | bgp_node_safi (vty), | |
fee0f4c6 | 2250 | PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED ); |
718e3744 | 2251 | } |
2252 | \f | |
2253 | DEFUN (neighbor_attr_unchanged, | |
2254 | neighbor_attr_unchanged_cmd, | |
2255 | NEIGHBOR_CMD2 "attribute-unchanged", | |
2256 | NEIGHBOR_STR | |
2257 | NEIGHBOR_ADDR_STR2 | |
2258 | "BGP attribute is propagated unchanged to this neighbor\n") | |
2259 | { | |
2260 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2261 | bgp_node_safi (vty), | |
2262 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
2263 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
2264 | PEER_FLAG_MED_UNCHANGED)); | |
2265 | } | |
2266 | ||
2267 | DEFUN (neighbor_attr_unchanged1, | |
2268 | neighbor_attr_unchanged1_cmd, | |
2269 | NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
2270 | NEIGHBOR_STR | |
2271 | NEIGHBOR_ADDR_STR2 | |
2272 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2273 | "As-path attribute\n" | |
2274 | "Nexthop attribute\n" | |
2275 | "Med attribute\n") | |
2276 | { | |
2277 | u_int16_t flags = 0; | |
2278 | ||
2279 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2280 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2281 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2282 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2283 | else if (strncmp (argv[1], "med", 1) == 0) | |
2284 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2285 | ||
2286 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2287 | bgp_node_safi (vty), flags); | |
2288 | } | |
2289 | ||
2290 | DEFUN (neighbor_attr_unchanged2, | |
2291 | neighbor_attr_unchanged2_cmd, | |
2292 | NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
2293 | NEIGHBOR_STR | |
2294 | NEIGHBOR_ADDR_STR2 | |
2295 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2296 | "As-path attribute\n" | |
2297 | "Nexthop attribute\n" | |
2298 | "Med attribute\n") | |
2299 | { | |
2300 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
2301 | ||
2302 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
2303 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2304 | else if (strncmp (argv[1], "med", 1) == 0) | |
2305 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2306 | ||
2307 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2308 | bgp_node_safi (vty), flags); | |
2309 | ||
2310 | } | |
2311 | ||
2312 | DEFUN (neighbor_attr_unchanged3, | |
2313 | neighbor_attr_unchanged3_cmd, | |
2314 | NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
2315 | NEIGHBOR_STR | |
2316 | NEIGHBOR_ADDR_STR2 | |
2317 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2318 | "Nexthop attribute\n" | |
2319 | "As-path attribute\n" | |
2320 | "Med attribute\n") | |
2321 | { | |
2322 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
2323 | ||
2324 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2325 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2326 | else if (strncmp (argv[1], "med", 1) == 0) | |
2327 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2328 | ||
2329 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2330 | bgp_node_safi (vty), flags); | |
2331 | } | |
2332 | ||
2333 | DEFUN (neighbor_attr_unchanged4, | |
2334 | neighbor_attr_unchanged4_cmd, | |
2335 | NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
2336 | NEIGHBOR_STR | |
2337 | NEIGHBOR_ADDR_STR2 | |
2338 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2339 | "Med attribute\n" | |
2340 | "As-path attribute\n" | |
2341 | "Nexthop attribute\n") | |
2342 | { | |
2343 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
2344 | ||
2345 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2346 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2347 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2348 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2349 | ||
2350 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2351 | bgp_node_safi (vty), flags); | |
2352 | } | |
2353 | ||
2354 | ALIAS (neighbor_attr_unchanged, | |
2355 | neighbor_attr_unchanged5_cmd, | |
2356 | NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
2357 | NEIGHBOR_STR | |
2358 | NEIGHBOR_ADDR_STR2 | |
2359 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2360 | "As-path attribute\n" | |
2361 | "Nexthop attribute\n" | |
2362 | "Med attribute\n") | |
2363 | ||
2364 | ALIAS (neighbor_attr_unchanged, | |
2365 | neighbor_attr_unchanged6_cmd, | |
2366 | NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
2367 | NEIGHBOR_STR | |
2368 | NEIGHBOR_ADDR_STR2 | |
2369 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2370 | "As-path attribute\n" | |
2371 | "Med attribute\n" | |
2372 | "Nexthop attribute\n") | |
2373 | ||
2374 | ALIAS (neighbor_attr_unchanged, | |
2375 | neighbor_attr_unchanged7_cmd, | |
2376 | NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
2377 | NEIGHBOR_STR | |
2378 | NEIGHBOR_ADDR_STR2 | |
2379 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2380 | "Nexthop attribute\n" | |
2381 | "Med attribute\n" | |
2382 | "As-path attribute\n") | |
2383 | ||
2384 | ALIAS (neighbor_attr_unchanged, | |
2385 | neighbor_attr_unchanged8_cmd, | |
2386 | NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
2387 | NEIGHBOR_STR | |
2388 | NEIGHBOR_ADDR_STR2 | |
2389 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2390 | "Nexthop attribute\n" | |
2391 | "As-path attribute\n" | |
2392 | "Med attribute\n") | |
2393 | ||
2394 | ALIAS (neighbor_attr_unchanged, | |
2395 | neighbor_attr_unchanged9_cmd, | |
2396 | NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
2397 | NEIGHBOR_STR | |
2398 | NEIGHBOR_ADDR_STR2 | |
2399 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2400 | "Med attribute\n" | |
2401 | "Nexthop attribute\n" | |
2402 | "As-path attribute\n") | |
2403 | ||
2404 | ALIAS (neighbor_attr_unchanged, | |
2405 | neighbor_attr_unchanged10_cmd, | |
2406 | NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
2407 | NEIGHBOR_STR | |
2408 | NEIGHBOR_ADDR_STR2 | |
2409 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2410 | "Med attribute\n" | |
2411 | "As-path attribute\n" | |
2412 | "Nexthop attribute\n") | |
2413 | ||
2414 | DEFUN (no_neighbor_attr_unchanged, | |
2415 | no_neighbor_attr_unchanged_cmd, | |
2416 | NO_NEIGHBOR_CMD2 "attribute-unchanged", | |
2417 | NO_STR | |
2418 | NEIGHBOR_STR | |
2419 | NEIGHBOR_ADDR_STR2 | |
2420 | "BGP attribute is propagated unchanged to this neighbor\n") | |
2421 | { | |
2422 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2423 | bgp_node_safi (vty), | |
2424 | (PEER_FLAG_AS_PATH_UNCHANGED | | |
2425 | PEER_FLAG_NEXTHOP_UNCHANGED | | |
2426 | PEER_FLAG_MED_UNCHANGED)); | |
2427 | } | |
2428 | ||
2429 | DEFUN (no_neighbor_attr_unchanged1, | |
2430 | no_neighbor_attr_unchanged1_cmd, | |
2431 | NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)", | |
2432 | NO_STR | |
2433 | NEIGHBOR_STR | |
2434 | NEIGHBOR_ADDR_STR2 | |
2435 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2436 | "As-path attribute\n" | |
2437 | "Nexthop attribute\n" | |
2438 | "Med attribute\n") | |
2439 | { | |
2440 | u_int16_t flags = 0; | |
2441 | ||
2442 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2443 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2444 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2445 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2446 | else if (strncmp (argv[1], "med", 1) == 0) | |
2447 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2448 | ||
2449 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2450 | bgp_node_safi (vty), flags); | |
2451 | } | |
2452 | ||
2453 | DEFUN (no_neighbor_attr_unchanged2, | |
2454 | no_neighbor_attr_unchanged2_cmd, | |
2455 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)", | |
2456 | NO_STR | |
2457 | NEIGHBOR_STR | |
2458 | NEIGHBOR_ADDR_STR2 | |
2459 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2460 | "As-path attribute\n" | |
2461 | "Nexthop attribute\n" | |
2462 | "Med attribute\n") | |
2463 | { | |
2464 | u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED; | |
2465 | ||
2466 | if (strncmp (argv[1], "next-hop", 1) == 0) | |
2467 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2468 | else if (strncmp (argv[1], "med", 1) == 0) | |
2469 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2470 | ||
2471 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2472 | bgp_node_safi (vty), flags); | |
2473 | } | |
2474 | ||
2475 | DEFUN (no_neighbor_attr_unchanged3, | |
2476 | no_neighbor_attr_unchanged3_cmd, | |
2477 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)", | |
2478 | NO_STR | |
2479 | NEIGHBOR_STR | |
2480 | NEIGHBOR_ADDR_STR2 | |
2481 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2482 | "Nexthop attribute\n" | |
2483 | "As-path attribute\n" | |
2484 | "Med attribute\n") | |
2485 | { | |
2486 | u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED; | |
2487 | ||
2488 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2489 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2490 | else if (strncmp (argv[1], "med", 1) == 0) | |
2491 | SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED); | |
2492 | ||
2493 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2494 | bgp_node_safi (vty), flags); | |
2495 | } | |
2496 | ||
2497 | DEFUN (no_neighbor_attr_unchanged4, | |
2498 | no_neighbor_attr_unchanged4_cmd, | |
2499 | NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)", | |
2500 | NO_STR | |
2501 | NEIGHBOR_STR | |
2502 | NEIGHBOR_ADDR_STR2 | |
2503 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2504 | "Med attribute\n" | |
2505 | "As-path attribute\n" | |
2506 | "Nexthop attribute\n") | |
2507 | { | |
2508 | u_int16_t flags = PEER_FLAG_MED_UNCHANGED; | |
2509 | ||
2510 | if (strncmp (argv[1], "as-path", 1) == 0) | |
2511 | SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED); | |
2512 | else if (strncmp (argv[1], "next-hop", 1) == 0) | |
2513 | SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED); | |
2514 | ||
2515 | return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
2516 | bgp_node_safi (vty), flags); | |
2517 | } | |
2518 | ||
2519 | ALIAS (no_neighbor_attr_unchanged, | |
2520 | no_neighbor_attr_unchanged5_cmd, | |
2521 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med", | |
2522 | NO_STR | |
2523 | NEIGHBOR_STR | |
2524 | NEIGHBOR_ADDR_STR2 | |
2525 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2526 | "As-path attribute\n" | |
2527 | "Nexthop attribute\n" | |
2528 | "Med attribute\n") | |
2529 | ||
2530 | ALIAS (no_neighbor_attr_unchanged, | |
2531 | no_neighbor_attr_unchanged6_cmd, | |
2532 | NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop", | |
2533 | NO_STR | |
2534 | NEIGHBOR_STR | |
2535 | NEIGHBOR_ADDR_STR2 | |
2536 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2537 | "As-path attribute\n" | |
2538 | "Med attribute\n" | |
2539 | "Nexthop attribute\n") | |
2540 | ||
2541 | ALIAS (no_neighbor_attr_unchanged, | |
2542 | no_neighbor_attr_unchanged7_cmd, | |
2543 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path", | |
2544 | NO_STR | |
2545 | NEIGHBOR_STR | |
2546 | NEIGHBOR_ADDR_STR2 | |
2547 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2548 | "Nexthop attribute\n" | |
2549 | "Med attribute\n" | |
2550 | "As-path attribute\n") | |
2551 | ||
2552 | ALIAS (no_neighbor_attr_unchanged, | |
2553 | no_neighbor_attr_unchanged8_cmd, | |
2554 | NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med", | |
2555 | NO_STR | |
2556 | NEIGHBOR_STR | |
2557 | NEIGHBOR_ADDR_STR2 | |
2558 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2559 | "Nexthop attribute\n" | |
2560 | "As-path attribute\n" | |
2561 | "Med attribute\n") | |
2562 | ||
2563 | ALIAS (no_neighbor_attr_unchanged, | |
2564 | no_neighbor_attr_unchanged9_cmd, | |
2565 | NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path", | |
2566 | NO_STR | |
2567 | NEIGHBOR_STR | |
2568 | NEIGHBOR_ADDR_STR2 | |
2569 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2570 | "Med attribute\n" | |
2571 | "Nexthop attribute\n" | |
2572 | "As-path attribute\n") | |
2573 | ||
2574 | ALIAS (no_neighbor_attr_unchanged, | |
2575 | no_neighbor_attr_unchanged10_cmd, | |
2576 | NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop", | |
2577 | NO_STR | |
2578 | NEIGHBOR_STR | |
2579 | NEIGHBOR_ADDR_STR2 | |
2580 | "BGP attribute is propagated unchanged to this neighbor\n" | |
2581 | "Med attribute\n" | |
2582 | "As-path attribute\n" | |
2583 | "Nexthop attribute\n") | |
2584 | ||
2585 | /* For old version Zebra compatibility. */ | |
dd4c593f | 2586 | DEFUN_DEPRECATED (neighbor_transparent_as, |
2587 | neighbor_transparent_as_cmd, | |
2588 | NEIGHBOR_CMD "transparent-as", | |
2589 | NEIGHBOR_STR | |
2590 | NEIGHBOR_ADDR_STR | |
2591 | "Do not append my AS number even peer is EBGP peer\n") | |
718e3744 | 2592 | { |
2593 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2594 | bgp_node_safi (vty), | |
2595 | PEER_FLAG_AS_PATH_UNCHANGED); | |
2596 | } | |
2597 | ||
dd4c593f | 2598 | DEFUN_DEPRECATED (neighbor_transparent_nexthop, |
2599 | neighbor_transparent_nexthop_cmd, | |
2600 | NEIGHBOR_CMD "transparent-nexthop", | |
2601 | NEIGHBOR_STR | |
2602 | NEIGHBOR_ADDR_STR | |
2603 | "Do not change nexthop even peer is EBGP peer\n") | |
718e3744 | 2604 | { |
2605 | return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2606 | bgp_node_safi (vty), | |
2607 | PEER_FLAG_NEXTHOP_UNCHANGED); | |
2608 | } | |
2609 | \f | |
2610 | /* EBGP multihop configuration. */ | |
94f2b392 | 2611 | static int |
fd79ac91 | 2612 | peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str, |
2613 | const char *ttl_str) | |
718e3744 | 2614 | { |
2615 | struct peer *peer; | |
fd79ac91 | 2616 | unsigned int ttl; |
718e3744 | 2617 | |
2618 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2619 | if (! peer) | |
2620 | return CMD_WARNING; | |
2621 | ||
2622 | if (! ttl_str) | |
2623 | ttl = TTL_MAX; | |
2624 | else | |
2625 | VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255); | |
2626 | ||
2627 | peer_ebgp_multihop_set (peer, ttl); | |
2628 | ||
2629 | return CMD_SUCCESS; | |
2630 | } | |
2631 | ||
94f2b392 | 2632 | static int |
fd79ac91 | 2633 | peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 2634 | { |
2635 | struct peer *peer; | |
2636 | ||
2637 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2638 | if (! peer) | |
2639 | return CMD_WARNING; | |
2640 | ||
2641 | peer_ebgp_multihop_unset (peer); | |
2642 | ||
2643 | return CMD_SUCCESS; | |
2644 | } | |
2645 | ||
2646 | /* neighbor ebgp-multihop. */ | |
2647 | DEFUN (neighbor_ebgp_multihop, | |
2648 | neighbor_ebgp_multihop_cmd, | |
2649 | NEIGHBOR_CMD2 "ebgp-multihop", | |
2650 | NEIGHBOR_STR | |
2651 | NEIGHBOR_ADDR_STR2 | |
2652 | "Allow EBGP neighbors not on directly connected networks\n") | |
2653 | { | |
2654 | return peer_ebgp_multihop_set_vty (vty, argv[0], NULL); | |
2655 | } | |
2656 | ||
2657 | DEFUN (neighbor_ebgp_multihop_ttl, | |
2658 | neighbor_ebgp_multihop_ttl_cmd, | |
2659 | NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
2660 | NEIGHBOR_STR | |
2661 | NEIGHBOR_ADDR_STR2 | |
2662 | "Allow EBGP neighbors not on directly connected networks\n" | |
2663 | "maximum hop count\n") | |
2664 | { | |
2665 | return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]); | |
2666 | } | |
2667 | ||
2668 | DEFUN (no_neighbor_ebgp_multihop, | |
2669 | no_neighbor_ebgp_multihop_cmd, | |
2670 | NO_NEIGHBOR_CMD2 "ebgp-multihop", | |
2671 | NO_STR | |
2672 | NEIGHBOR_STR | |
2673 | NEIGHBOR_ADDR_STR2 | |
2674 | "Allow EBGP neighbors not on directly connected networks\n") | |
2675 | { | |
2676 | return peer_ebgp_multihop_unset_vty (vty, argv[0]); | |
2677 | } | |
2678 | ||
2679 | ALIAS (no_neighbor_ebgp_multihop, | |
2680 | no_neighbor_ebgp_multihop_ttl_cmd, | |
2681 | NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>", | |
2682 | NO_STR | |
2683 | NEIGHBOR_STR | |
2684 | NEIGHBOR_ADDR_STR2 | |
2685 | "Allow EBGP neighbors not on directly connected networks\n" | |
2686 | "maximum hop count\n") | |
2687 | \f | |
6ffd2079 | 2688 | /* disable-connected-check */ |
2689 | DEFUN (neighbor_disable_connected_check, | |
2690 | neighbor_disable_connected_check_cmd, | |
2691 | NEIGHBOR_CMD2 "disable-connected-check", | |
2692 | NEIGHBOR_STR | |
2693 | NEIGHBOR_ADDR_STR2 | |
2694 | "one-hop away EBGP peer using loopback address\n") | |
2695 | { | |
2696 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
2697 | } | |
2698 | ||
2699 | DEFUN (no_neighbor_disable_connected_check, | |
2700 | no_neighbor_disable_connected_check_cmd, | |
2701 | NO_NEIGHBOR_CMD2 "disable-connected-check", | |
2702 | NO_STR | |
2703 | NEIGHBOR_STR | |
2704 | NEIGHBOR_ADDR_STR2 | |
2705 | "one-hop away EBGP peer using loopback address\n") | |
2706 | { | |
2707 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK); | |
2708 | } | |
2709 | ||
718e3744 | 2710 | /* Enforce multihop. */ |
6ffd2079 | 2711 | ALIAS (neighbor_disable_connected_check, |
718e3744 | 2712 | neighbor_enforce_multihop_cmd, |
2713 | NEIGHBOR_CMD2 "enforce-multihop", | |
2714 | NEIGHBOR_STR | |
2715 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 2716 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 2717 | |
6ffd2079 | 2718 | /* Enforce multihop. */ |
2719 | ALIAS (no_neighbor_disable_connected_check, | |
718e3744 | 2720 | no_neighbor_enforce_multihop_cmd, |
2721 | NO_NEIGHBOR_CMD2 "enforce-multihop", | |
2722 | NO_STR | |
2723 | NEIGHBOR_STR | |
2724 | NEIGHBOR_ADDR_STR2 | |
e8e1946e | 2725 | "Enforce EBGP neighbors perform multihop\n") |
718e3744 | 2726 | \f |
2727 | DEFUN (neighbor_description, | |
2728 | neighbor_description_cmd, | |
2729 | NEIGHBOR_CMD2 "description .LINE", | |
2730 | NEIGHBOR_STR | |
2731 | NEIGHBOR_ADDR_STR2 | |
2732 | "Neighbor specific description\n" | |
2733 | "Up to 80 characters describing this neighbor\n") | |
2734 | { | |
2735 | struct peer *peer; | |
718e3744 | 2736 | char *str; |
718e3744 | 2737 | |
2738 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2739 | if (! peer) | |
2740 | return CMD_WARNING; | |
2741 | ||
2742 | if (argc == 1) | |
2743 | return CMD_SUCCESS; | |
2744 | ||
3b8b1855 | 2745 | str = argv_concat(argv, argc, 1); |
718e3744 | 2746 | |
2747 | peer_description_set (peer, str); | |
2748 | ||
3b8b1855 | 2749 | XFREE (MTYPE_TMP, str); |
718e3744 | 2750 | |
2751 | return CMD_SUCCESS; | |
2752 | } | |
2753 | ||
2754 | DEFUN (no_neighbor_description, | |
2755 | no_neighbor_description_cmd, | |
2756 | NO_NEIGHBOR_CMD2 "description", | |
2757 | NO_STR | |
2758 | NEIGHBOR_STR | |
2759 | NEIGHBOR_ADDR_STR2 | |
2760 | "Neighbor specific description\n") | |
2761 | { | |
2762 | struct peer *peer; | |
2763 | ||
2764 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
2765 | if (! peer) | |
2766 | return CMD_WARNING; | |
2767 | ||
2768 | peer_description_unset (peer); | |
2769 | ||
2770 | return CMD_SUCCESS; | |
2771 | } | |
2772 | ||
2773 | ALIAS (no_neighbor_description, | |
2774 | no_neighbor_description_val_cmd, | |
2775 | NO_NEIGHBOR_CMD2 "description .LINE", | |
2776 | NO_STR | |
2777 | NEIGHBOR_STR | |
2778 | NEIGHBOR_ADDR_STR2 | |
2779 | "Neighbor specific description\n" | |
2780 | "Up to 80 characters describing this neighbor\n") | |
2781 | \f | |
2782 | /* Neighbor update-source. */ | |
94f2b392 | 2783 | static int |
fd79ac91 | 2784 | peer_update_source_vty (struct vty *vty, const char *peer_str, |
2785 | const char *source_str) | |
718e3744 | 2786 | { |
2787 | struct peer *peer; | |
2788 | union sockunion *su; | |
2789 | ||
2790 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2791 | if (! peer) | |
2792 | return CMD_WARNING; | |
2793 | ||
2794 | if (source_str) | |
2795 | { | |
2796 | su = sockunion_str2su (source_str); | |
2797 | if (su) | |
2798 | { | |
2799 | peer_update_source_addr_set (peer, su); | |
2800 | sockunion_free (su); | |
2801 | } | |
2802 | else | |
2803 | peer_update_source_if_set (peer, source_str); | |
2804 | } | |
2805 | else | |
2806 | peer_update_source_unset (peer); | |
2807 | ||
2808 | return CMD_SUCCESS; | |
2809 | } | |
2810 | ||
369688c0 PJ |
2811 | #define BGP_UPDATE_SOURCE_STR "(A.B.C.D|WORD)" |
2812 | #define BGP_UPDATE_SOURCE_HELP_STR \ | |
2813 | "IPv4 address\n" \ | |
2814 | "Interface name\n" | |
2815 | ||
718e3744 | 2816 | DEFUN (neighbor_update_source, |
2817 | neighbor_update_source_cmd, | |
369688c0 | 2818 | NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR, |
718e3744 | 2819 | NEIGHBOR_STR |
2820 | NEIGHBOR_ADDR_STR2 | |
2821 | "Source of routing updates\n" | |
369688c0 | 2822 | BGP_UPDATE_SOURCE_HELP_STR) |
718e3744 | 2823 | { |
2824 | return peer_update_source_vty (vty, argv[0], argv[1]); | |
2825 | } | |
2826 | ||
2827 | DEFUN (no_neighbor_update_source, | |
2828 | no_neighbor_update_source_cmd, | |
2829 | NO_NEIGHBOR_CMD2 "update-source", | |
2830 | NO_STR | |
2831 | NEIGHBOR_STR | |
2832 | NEIGHBOR_ADDR_STR2 | |
369688c0 | 2833 | "Source of routing updates\n") |
718e3744 | 2834 | { |
2835 | return peer_update_source_vty (vty, argv[0], NULL); | |
2836 | } | |
2837 | \f | |
94f2b392 | 2838 | static int |
fd79ac91 | 2839 | peer_default_originate_set_vty (struct vty *vty, const char *peer_str, |
2840 | afi_t afi, safi_t safi, | |
2841 | const char *rmap, int set) | |
718e3744 | 2842 | { |
2843 | int ret; | |
2844 | struct peer *peer; | |
2845 | ||
2846 | peer = peer_and_group_lookup_vty (vty, peer_str); | |
2847 | if (! peer) | |
2848 | return CMD_WARNING; | |
2849 | ||
2850 | if (set) | |
2851 | ret = peer_default_originate_set (peer, afi, safi, rmap); | |
2852 | else | |
2853 | ret = peer_default_originate_unset (peer, afi, safi); | |
2854 | ||
2855 | return bgp_vty_return (vty, ret); | |
2856 | } | |
2857 | ||
2858 | /* neighbor default-originate. */ | |
2859 | DEFUN (neighbor_default_originate, | |
2860 | neighbor_default_originate_cmd, | |
2861 | NEIGHBOR_CMD2 "default-originate", | |
2862 | NEIGHBOR_STR | |
2863 | NEIGHBOR_ADDR_STR2 | |
2864 | "Originate default route to this neighbor\n") | |
2865 | { | |
2866 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2867 | bgp_node_safi (vty), NULL, 1); | |
2868 | } | |
2869 | ||
2870 | DEFUN (neighbor_default_originate_rmap, | |
2871 | neighbor_default_originate_rmap_cmd, | |
2872 | NEIGHBOR_CMD2 "default-originate route-map WORD", | |
2873 | NEIGHBOR_STR | |
2874 | NEIGHBOR_ADDR_STR2 | |
2875 | "Originate default route to this neighbor\n" | |
2876 | "Route-map to specify criteria to originate default\n" | |
2877 | "route-map name\n") | |
2878 | { | |
2879 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2880 | bgp_node_safi (vty), argv[1], 1); | |
2881 | } | |
2882 | ||
2883 | DEFUN (no_neighbor_default_originate, | |
2884 | no_neighbor_default_originate_cmd, | |
2885 | NO_NEIGHBOR_CMD2 "default-originate", | |
2886 | NO_STR | |
2887 | NEIGHBOR_STR | |
2888 | NEIGHBOR_ADDR_STR2 | |
2889 | "Originate default route to this neighbor\n") | |
2890 | { | |
2891 | return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty), | |
2892 | bgp_node_safi (vty), NULL, 0); | |
2893 | } | |
2894 | ||
2895 | ALIAS (no_neighbor_default_originate, | |
2896 | no_neighbor_default_originate_rmap_cmd, | |
2897 | NO_NEIGHBOR_CMD2 "default-originate route-map WORD", | |
2898 | NO_STR | |
2899 | NEIGHBOR_STR | |
2900 | NEIGHBOR_ADDR_STR2 | |
2901 | "Originate default route to this neighbor\n" | |
2902 | "Route-map to specify criteria to originate default\n" | |
2903 | "route-map name\n") | |
2904 | \f | |
2905 | /* Set neighbor's BGP port. */ | |
94f2b392 | 2906 | static int |
fd79ac91 | 2907 | peer_port_vty (struct vty *vty, const char *ip_str, int afi, |
2908 | const char *port_str) | |
718e3744 | 2909 | { |
2910 | struct peer *peer; | |
2911 | u_int16_t port; | |
2912 | struct servent *sp; | |
2913 | ||
2914 | peer = peer_lookup_vty (vty, ip_str); | |
2915 | if (! peer) | |
2916 | return CMD_WARNING; | |
2917 | ||
2918 | if (! port_str) | |
2919 | { | |
2920 | sp = getservbyname ("bgp", "tcp"); | |
2921 | port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); | |
2922 | } | |
2923 | else | |
2924 | { | |
2925 | VTY_GET_INTEGER("port", port, port_str); | |
2926 | } | |
2927 | ||
2928 | peer_port_set (peer, port); | |
2929 | ||
2930 | return CMD_SUCCESS; | |
2931 | } | |
2932 | ||
f418446b | 2933 | /* Set specified peer's BGP port. */ |
718e3744 | 2934 | DEFUN (neighbor_port, |
2935 | neighbor_port_cmd, | |
2936 | NEIGHBOR_CMD "port <0-65535>", | |
2937 | NEIGHBOR_STR | |
2938 | NEIGHBOR_ADDR_STR | |
2939 | "Neighbor's BGP port\n" | |
2940 | "TCP port number\n") | |
2941 | { | |
2942 | return peer_port_vty (vty, argv[0], AFI_IP, argv[1]); | |
2943 | } | |
2944 | ||
2945 | DEFUN (no_neighbor_port, | |
2946 | no_neighbor_port_cmd, | |
2947 | NO_NEIGHBOR_CMD "port", | |
2948 | NO_STR | |
2949 | NEIGHBOR_STR | |
2950 | NEIGHBOR_ADDR_STR | |
2951 | "Neighbor's BGP port\n") | |
2952 | { | |
2953 | return peer_port_vty (vty, argv[0], AFI_IP, NULL); | |
2954 | } | |
2955 | ||
2956 | ALIAS (no_neighbor_port, | |
2957 | no_neighbor_port_val_cmd, | |
2958 | NO_NEIGHBOR_CMD "port <0-65535>", | |
2959 | NO_STR | |
2960 | NEIGHBOR_STR | |
2961 | NEIGHBOR_ADDR_STR | |
2962 | "Neighbor's BGP port\n" | |
2963 | "TCP port number\n") | |
2964 | \f | |
2965 | /* neighbor weight. */ | |
94f2b392 | 2966 | static int |
fd79ac91 | 2967 | peer_weight_set_vty (struct vty *vty, const char *ip_str, |
2968 | const char *weight_str) | |
718e3744 | 2969 | { |
2970 | int ret; | |
2971 | struct peer *peer; | |
2972 | unsigned long weight; | |
2973 | ||
2974 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2975 | if (! peer) | |
2976 | return CMD_WARNING; | |
2977 | ||
2978 | VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535); | |
2979 | ||
2980 | ret = peer_weight_set (peer, weight); | |
2981 | ||
2982 | return CMD_SUCCESS; | |
2983 | } | |
2984 | ||
94f2b392 | 2985 | static int |
fd79ac91 | 2986 | peer_weight_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 2987 | { |
2988 | struct peer *peer; | |
2989 | ||
2990 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
2991 | if (! peer) | |
2992 | return CMD_WARNING; | |
2993 | ||
2994 | peer_weight_unset (peer); | |
2995 | ||
2996 | return CMD_SUCCESS; | |
2997 | } | |
2998 | ||
2999 | DEFUN (neighbor_weight, | |
3000 | neighbor_weight_cmd, | |
3001 | NEIGHBOR_CMD2 "weight <0-65535>", | |
3002 | NEIGHBOR_STR | |
3003 | NEIGHBOR_ADDR_STR2 | |
3004 | "Set default weight for routes from this neighbor\n" | |
3005 | "default weight\n") | |
3006 | { | |
3007 | return peer_weight_set_vty (vty, argv[0], argv[1]); | |
3008 | } | |
3009 | ||
3010 | DEFUN (no_neighbor_weight, | |
3011 | no_neighbor_weight_cmd, | |
3012 | NO_NEIGHBOR_CMD2 "weight", | |
3013 | NO_STR | |
3014 | NEIGHBOR_STR | |
3015 | NEIGHBOR_ADDR_STR2 | |
3016 | "Set default weight for routes from this neighbor\n") | |
3017 | { | |
3018 | return peer_weight_unset_vty (vty, argv[0]); | |
3019 | } | |
3020 | ||
3021 | ALIAS (no_neighbor_weight, | |
3022 | no_neighbor_weight_val_cmd, | |
3023 | NO_NEIGHBOR_CMD2 "weight <0-65535>", | |
3024 | NO_STR | |
3025 | NEIGHBOR_STR | |
3026 | NEIGHBOR_ADDR_STR2 | |
3027 | "Set default weight for routes from this neighbor\n" | |
3028 | "default weight\n") | |
3029 | \f | |
3030 | /* Override capability negotiation. */ | |
3031 | DEFUN (neighbor_override_capability, | |
3032 | neighbor_override_capability_cmd, | |
3033 | NEIGHBOR_CMD2 "override-capability", | |
3034 | NEIGHBOR_STR | |
3035 | NEIGHBOR_ADDR_STR2 | |
3036 | "Override capability negotiation result\n") | |
3037 | { | |
3038 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
3039 | } | |
3040 | ||
3041 | DEFUN (no_neighbor_override_capability, | |
3042 | no_neighbor_override_capability_cmd, | |
3043 | NO_NEIGHBOR_CMD2 "override-capability", | |
3044 | NO_STR | |
3045 | NEIGHBOR_STR | |
3046 | NEIGHBOR_ADDR_STR2 | |
3047 | "Override capability negotiation result\n") | |
3048 | { | |
3049 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY); | |
3050 | } | |
3051 | \f | |
3052 | DEFUN (neighbor_strict_capability, | |
3053 | neighbor_strict_capability_cmd, | |
3054 | NEIGHBOR_CMD "strict-capability-match", | |
3055 | NEIGHBOR_STR | |
3056 | NEIGHBOR_ADDR_STR | |
3057 | "Strict capability negotiation match\n") | |
3058 | { | |
3059 | return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
3060 | } | |
3061 | ||
3062 | DEFUN (no_neighbor_strict_capability, | |
3063 | no_neighbor_strict_capability_cmd, | |
3064 | NO_NEIGHBOR_CMD "strict-capability-match", | |
3065 | NO_STR | |
3066 | NEIGHBOR_STR | |
3067 | NEIGHBOR_ADDR_STR | |
3068 | "Strict capability negotiation match\n") | |
3069 | { | |
3070 | return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH); | |
3071 | } | |
3072 | \f | |
94f2b392 | 3073 | static int |
fd79ac91 | 3074 | peer_timers_set_vty (struct vty *vty, const char *ip_str, |
3075 | const char *keep_str, const char *hold_str) | |
718e3744 | 3076 | { |
3077 | int ret; | |
3078 | struct peer *peer; | |
3079 | u_int32_t keepalive; | |
3080 | u_int32_t holdtime; | |
3081 | ||
3082 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3083 | if (! peer) | |
3084 | return CMD_WARNING; | |
3085 | ||
3086 | VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535); | |
3087 | VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535); | |
3088 | ||
3089 | ret = peer_timers_set (peer, keepalive, holdtime); | |
3090 | ||
3091 | return bgp_vty_return (vty, ret); | |
3092 | } | |
3093 | \f | |
94f2b392 | 3094 | static int |
fd79ac91 | 3095 | peer_timers_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3096 | { |
3097 | int ret; | |
3098 | struct peer *peer; | |
3099 | ||
3100 | peer = peer_lookup_vty (vty, ip_str); | |
3101 | if (! peer) | |
3102 | return CMD_WARNING; | |
3103 | ||
3104 | ret = peer_timers_unset (peer); | |
3105 | ||
3106 | return bgp_vty_return (vty, ret); | |
3107 | } | |
3108 | ||
3109 | DEFUN (neighbor_timers, | |
3110 | neighbor_timers_cmd, | |
3111 | NEIGHBOR_CMD2 "timers <0-65535> <0-65535>", | |
3112 | NEIGHBOR_STR | |
3113 | NEIGHBOR_ADDR_STR2 | |
3114 | "BGP per neighbor timers\n" | |
3115 | "Keepalive interval\n" | |
3116 | "Holdtime\n") | |
3117 | { | |
3118 | return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]); | |
3119 | } | |
3120 | ||
3121 | DEFUN (no_neighbor_timers, | |
3122 | no_neighbor_timers_cmd, | |
3123 | NO_NEIGHBOR_CMD2 "timers", | |
3124 | NO_STR | |
3125 | NEIGHBOR_STR | |
3126 | NEIGHBOR_ADDR_STR2 | |
3127 | "BGP per neighbor timers\n") | |
3128 | { | |
3129 | return peer_timers_unset_vty (vty, argv[0]); | |
3130 | } | |
3131 | \f | |
94f2b392 | 3132 | static int |
fd79ac91 | 3133 | peer_timers_connect_set_vty (struct vty *vty, const char *ip_str, |
3134 | const char *time_str) | |
718e3744 | 3135 | { |
3136 | int ret; | |
3137 | struct peer *peer; | |
3138 | u_int32_t connect; | |
3139 | ||
3140 | peer = peer_lookup_vty (vty, ip_str); | |
3141 | if (! peer) | |
3142 | return CMD_WARNING; | |
3143 | ||
3144 | VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535); | |
3145 | ||
3146 | ret = peer_timers_connect_set (peer, connect); | |
3147 | ||
3148 | return CMD_SUCCESS; | |
3149 | } | |
3150 | ||
94f2b392 | 3151 | static int |
fd79ac91 | 3152 | peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str) |
718e3744 | 3153 | { |
3154 | int ret; | |
3155 | struct peer *peer; | |
3156 | ||
3157 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3158 | if (! peer) | |
3159 | return CMD_WARNING; | |
3160 | ||
3161 | ret = peer_timers_connect_unset (peer); | |
3162 | ||
3163 | return CMD_SUCCESS; | |
3164 | } | |
3165 | ||
3166 | DEFUN (neighbor_timers_connect, | |
3167 | neighbor_timers_connect_cmd, | |
3168 | NEIGHBOR_CMD "timers connect <0-65535>", | |
3169 | NEIGHBOR_STR | |
3170 | NEIGHBOR_ADDR_STR | |
3171 | "BGP per neighbor timers\n" | |
3172 | "BGP connect timer\n" | |
3173 | "Connect timer\n") | |
3174 | { | |
3175 | return peer_timers_connect_set_vty (vty, argv[0], argv[1]); | |
3176 | } | |
3177 | ||
3178 | DEFUN (no_neighbor_timers_connect, | |
3179 | no_neighbor_timers_connect_cmd, | |
3180 | NO_NEIGHBOR_CMD "timers connect", | |
3181 | NO_STR | |
3182 | NEIGHBOR_STR | |
3183 | NEIGHBOR_ADDR_STR | |
3184 | "BGP per neighbor timers\n" | |
3185 | "BGP connect timer\n") | |
3186 | { | |
3187 | return peer_timers_connect_unset_vty (vty, argv[0]); | |
3188 | } | |
3189 | ||
3190 | ALIAS (no_neighbor_timers_connect, | |
3191 | no_neighbor_timers_connect_val_cmd, | |
3192 | NO_NEIGHBOR_CMD "timers connect <0-65535>", | |
3193 | NO_STR | |
3194 | NEIGHBOR_STR | |
3195 | NEIGHBOR_ADDR_STR | |
3196 | "BGP per neighbor timers\n" | |
3197 | "BGP connect timer\n" | |
3198 | "Connect timer\n") | |
3199 | \f | |
94f2b392 | 3200 | static int |
fd79ac91 | 3201 | peer_advertise_interval_vty (struct vty *vty, const char *ip_str, |
3202 | const char *time_str, int set) | |
718e3744 | 3203 | { |
3204 | int ret; | |
3205 | struct peer *peer; | |
3206 | u_int32_t routeadv = 0; | |
3207 | ||
3208 | peer = peer_lookup_vty (vty, ip_str); | |
3209 | if (! peer) | |
3210 | return CMD_WARNING; | |
3211 | ||
3212 | if (time_str) | |
3213 | VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600); | |
3214 | ||
3215 | if (set) | |
3216 | ret = peer_advertise_interval_set (peer, routeadv); | |
3217 | else | |
3218 | ret = peer_advertise_interval_unset (peer); | |
3219 | ||
3220 | return CMD_SUCCESS; | |
3221 | } | |
3222 | ||
3223 | DEFUN (neighbor_advertise_interval, | |
3224 | neighbor_advertise_interval_cmd, | |
3225 | NEIGHBOR_CMD "advertisement-interval <0-600>", | |
3226 | NEIGHBOR_STR | |
3227 | NEIGHBOR_ADDR_STR | |
3228 | "Minimum interval between sending BGP routing updates\n" | |
3229 | "time in seconds\n") | |
3230 | { | |
3231 | return peer_advertise_interval_vty (vty, argv[0], argv[1], 1); | |
3232 | } | |
3233 | ||
3234 | DEFUN (no_neighbor_advertise_interval, | |
3235 | no_neighbor_advertise_interval_cmd, | |
3236 | NO_NEIGHBOR_CMD "advertisement-interval", | |
3237 | NO_STR | |
3238 | NEIGHBOR_STR | |
3239 | NEIGHBOR_ADDR_STR | |
3240 | "Minimum interval between sending BGP routing updates\n") | |
3241 | { | |
3242 | return peer_advertise_interval_vty (vty, argv[0], NULL, 0); | |
3243 | } | |
3244 | ||
3245 | ALIAS (no_neighbor_advertise_interval, | |
3246 | no_neighbor_advertise_interval_val_cmd, | |
3247 | NO_NEIGHBOR_CMD "advertisement-interval <0-600>", | |
3248 | NO_STR | |
3249 | NEIGHBOR_STR | |
3250 | NEIGHBOR_ADDR_STR | |
3251 | "Minimum interval between sending BGP routing updates\n" | |
3252 | "time in seconds\n") | |
3253 | \f | |
718e3744 | 3254 | /* neighbor interface */ |
94f2b392 | 3255 | static int |
fd79ac91 | 3256 | peer_interface_vty (struct vty *vty, const char *ip_str, const char *str) |
718e3744 | 3257 | { |
3258 | int ret; | |
3259 | struct peer *peer; | |
3260 | ||
3261 | peer = peer_lookup_vty (vty, ip_str); | |
3262 | if (! peer) | |
3263 | return CMD_WARNING; | |
3264 | ||
3265 | if (str) | |
3266 | ret = peer_interface_set (peer, str); | |
3267 | else | |
3268 | ret = peer_interface_unset (peer); | |
3269 | ||
3270 | return CMD_SUCCESS; | |
3271 | } | |
3272 | ||
3273 | DEFUN (neighbor_interface, | |
3274 | neighbor_interface_cmd, | |
3275 | NEIGHBOR_CMD "interface WORD", | |
3276 | NEIGHBOR_STR | |
3277 | NEIGHBOR_ADDR_STR | |
3278 | "Interface\n" | |
3279 | "Interface name\n") | |
3280 | { | |
3281 | return peer_interface_vty (vty, argv[0], argv[1]); | |
3282 | } | |
3283 | ||
3284 | DEFUN (no_neighbor_interface, | |
3285 | no_neighbor_interface_cmd, | |
3286 | NO_NEIGHBOR_CMD "interface WORD", | |
3287 | NO_STR | |
3288 | NEIGHBOR_STR | |
3289 | NEIGHBOR_ADDR_STR | |
3290 | "Interface\n" | |
3291 | "Interface name\n") | |
3292 | { | |
3293 | return peer_interface_vty (vty, argv[0], NULL); | |
3294 | } | |
3295 | \f | |
3296 | /* Set distribute list to the peer. */ | |
94f2b392 | 3297 | static int |
fd79ac91 | 3298 | peer_distribute_set_vty (struct vty *vty, const char *ip_str, |
3299 | afi_t afi, safi_t safi, | |
3300 | const char *name_str, const char *direct_str) | |
718e3744 | 3301 | { |
3302 | int ret; | |
3303 | struct peer *peer; | |
3304 | int direct = FILTER_IN; | |
3305 | ||
3306 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3307 | if (! peer) | |
3308 | return CMD_WARNING; | |
3309 | ||
3310 | /* Check filter direction. */ | |
3311 | if (strncmp (direct_str, "i", 1) == 0) | |
3312 | direct = FILTER_IN; | |
3313 | else if (strncmp (direct_str, "o", 1) == 0) | |
3314 | direct = FILTER_OUT; | |
3315 | ||
3316 | ret = peer_distribute_set (peer, afi, safi, direct, name_str); | |
3317 | ||
3318 | return bgp_vty_return (vty, ret); | |
3319 | } | |
3320 | ||
94f2b392 | 3321 | static int |
fd79ac91 | 3322 | peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3323 | safi_t safi, const char *direct_str) | |
718e3744 | 3324 | { |
3325 | int ret; | |
3326 | struct peer *peer; | |
3327 | int direct = FILTER_IN; | |
3328 | ||
3329 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3330 | if (! peer) | |
3331 | return CMD_WARNING; | |
3332 | ||
3333 | /* Check filter direction. */ | |
3334 | if (strncmp (direct_str, "i", 1) == 0) | |
3335 | direct = FILTER_IN; | |
3336 | else if (strncmp (direct_str, "o", 1) == 0) | |
3337 | direct = FILTER_OUT; | |
3338 | ||
3339 | ret = peer_distribute_unset (peer, afi, safi, direct); | |
3340 | ||
3341 | return bgp_vty_return (vty, ret); | |
3342 | } | |
3343 | ||
3344 | DEFUN (neighbor_distribute_list, | |
3345 | neighbor_distribute_list_cmd, | |
3346 | NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
3347 | NEIGHBOR_STR | |
3348 | NEIGHBOR_ADDR_STR2 | |
3349 | "Filter updates to/from this neighbor\n" | |
3350 | "IP access-list number\n" | |
3351 | "IP access-list number (expanded range)\n" | |
3352 | "IP Access-list name\n" | |
3353 | "Filter incoming updates\n" | |
3354 | "Filter outgoing updates\n") | |
3355 | { | |
3356 | return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3357 | bgp_node_safi (vty), argv[1], argv[2]); | |
3358 | } | |
3359 | ||
3360 | DEFUN (no_neighbor_distribute_list, | |
3361 | no_neighbor_distribute_list_cmd, | |
3362 | NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)", | |
3363 | NO_STR | |
3364 | NEIGHBOR_STR | |
3365 | NEIGHBOR_ADDR_STR2 | |
3366 | "Filter updates to/from this neighbor\n" | |
3367 | "IP access-list number\n" | |
3368 | "IP access-list number (expanded range)\n" | |
3369 | "IP Access-list name\n" | |
3370 | "Filter incoming updates\n" | |
3371 | "Filter outgoing updates\n") | |
3372 | { | |
3373 | return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3374 | bgp_node_safi (vty), argv[2]); | |
3375 | } | |
3376 | \f | |
3377 | /* Set prefix list to the peer. */ | |
94f2b392 | 3378 | static int |
fd79ac91 | 3379 | peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3380 | safi_t safi, const char *name_str, | |
3381 | const char *direct_str) | |
718e3744 | 3382 | { |
3383 | int ret; | |
3384 | struct peer *peer; | |
3385 | int direct = FILTER_IN; | |
3386 | ||
3387 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3388 | if (! peer) | |
3389 | return CMD_WARNING; | |
3390 | ||
3391 | /* Check filter direction. */ | |
3392 | if (strncmp (direct_str, "i", 1) == 0) | |
3393 | direct = FILTER_IN; | |
3394 | else if (strncmp (direct_str, "o", 1) == 0) | |
3395 | direct = FILTER_OUT; | |
3396 | ||
3397 | ret = peer_prefix_list_set (peer, afi, safi, direct, name_str); | |
3398 | ||
3399 | return bgp_vty_return (vty, ret); | |
3400 | } | |
3401 | ||
94f2b392 | 3402 | static int |
fd79ac91 | 3403 | peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3404 | safi_t safi, const char *direct_str) | |
718e3744 | 3405 | { |
3406 | int ret; | |
3407 | struct peer *peer; | |
3408 | int direct = FILTER_IN; | |
3409 | ||
3410 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3411 | if (! peer) | |
3412 | return CMD_WARNING; | |
3413 | ||
3414 | /* Check filter direction. */ | |
3415 | if (strncmp (direct_str, "i", 1) == 0) | |
3416 | direct = FILTER_IN; | |
3417 | else if (strncmp (direct_str, "o", 1) == 0) | |
3418 | direct = FILTER_OUT; | |
3419 | ||
3420 | ret = peer_prefix_list_unset (peer, afi, safi, direct); | |
3421 | ||
3422 | return bgp_vty_return (vty, ret); | |
3423 | } | |
3424 | ||
3425 | DEFUN (neighbor_prefix_list, | |
3426 | neighbor_prefix_list_cmd, | |
3427 | NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
3428 | NEIGHBOR_STR | |
3429 | NEIGHBOR_ADDR_STR2 | |
3430 | "Filter updates to/from this neighbor\n" | |
3431 | "Name of a prefix list\n" | |
3432 | "Filter incoming updates\n" | |
3433 | "Filter outgoing updates\n") | |
3434 | { | |
3435 | return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3436 | bgp_node_safi (vty), argv[1], argv[2]); | |
3437 | } | |
3438 | ||
3439 | DEFUN (no_neighbor_prefix_list, | |
3440 | no_neighbor_prefix_list_cmd, | |
3441 | NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)", | |
3442 | NO_STR | |
3443 | NEIGHBOR_STR | |
3444 | NEIGHBOR_ADDR_STR2 | |
3445 | "Filter updates to/from this neighbor\n" | |
3446 | "Name of a prefix list\n" | |
3447 | "Filter incoming updates\n" | |
3448 | "Filter outgoing updates\n") | |
3449 | { | |
3450 | return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3451 | bgp_node_safi (vty), argv[2]); | |
3452 | } | |
3453 | \f | |
94f2b392 | 3454 | static int |
fd79ac91 | 3455 | peer_aslist_set_vty (struct vty *vty, const char *ip_str, |
3456 | afi_t afi, safi_t safi, | |
3457 | const char *name_str, const char *direct_str) | |
718e3744 | 3458 | { |
3459 | int ret; | |
3460 | struct peer *peer; | |
3461 | int direct = FILTER_IN; | |
3462 | ||
3463 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3464 | if (! peer) | |
3465 | return CMD_WARNING; | |
3466 | ||
3467 | /* Check filter direction. */ | |
3468 | if (strncmp (direct_str, "i", 1) == 0) | |
3469 | direct = FILTER_IN; | |
3470 | else if (strncmp (direct_str, "o", 1) == 0) | |
3471 | direct = FILTER_OUT; | |
3472 | ||
3473 | ret = peer_aslist_set (peer, afi, safi, direct, name_str); | |
3474 | ||
3475 | return bgp_vty_return (vty, ret); | |
3476 | } | |
3477 | ||
94f2b392 | 3478 | static int |
fd79ac91 | 3479 | peer_aslist_unset_vty (struct vty *vty, const char *ip_str, |
3480 | afi_t afi, safi_t safi, | |
3481 | const char *direct_str) | |
718e3744 | 3482 | { |
3483 | int ret; | |
3484 | struct peer *peer; | |
3485 | int direct = FILTER_IN; | |
3486 | ||
3487 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3488 | if (! peer) | |
3489 | return CMD_WARNING; | |
3490 | ||
3491 | /* Check filter direction. */ | |
3492 | if (strncmp (direct_str, "i", 1) == 0) | |
3493 | direct = FILTER_IN; | |
3494 | else if (strncmp (direct_str, "o", 1) == 0) | |
3495 | direct = FILTER_OUT; | |
3496 | ||
3497 | ret = peer_aslist_unset (peer, afi, safi, direct); | |
3498 | ||
3499 | return bgp_vty_return (vty, ret); | |
3500 | } | |
3501 | ||
3502 | DEFUN (neighbor_filter_list, | |
3503 | neighbor_filter_list_cmd, | |
3504 | NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
3505 | NEIGHBOR_STR | |
3506 | NEIGHBOR_ADDR_STR2 | |
3507 | "Establish BGP filters\n" | |
3508 | "AS path access-list name\n" | |
3509 | "Filter incoming routes\n" | |
3510 | "Filter outgoing routes\n") | |
3511 | { | |
3512 | return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3513 | bgp_node_safi (vty), argv[1], argv[2]); | |
3514 | } | |
3515 | ||
3516 | DEFUN (no_neighbor_filter_list, | |
3517 | no_neighbor_filter_list_cmd, | |
3518 | NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)", | |
3519 | NO_STR | |
3520 | NEIGHBOR_STR | |
3521 | NEIGHBOR_ADDR_STR2 | |
3522 | "Establish BGP filters\n" | |
3523 | "AS path access-list name\n" | |
3524 | "Filter incoming routes\n" | |
3525 | "Filter outgoing routes\n") | |
3526 | { | |
3527 | return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3528 | bgp_node_safi (vty), argv[2]); | |
3529 | } | |
3530 | \f | |
3531 | /* Set route-map to the peer. */ | |
94f2b392 | 3532 | static int |
fd79ac91 | 3533 | peer_route_map_set_vty (struct vty *vty, const char *ip_str, |
3534 | afi_t afi, safi_t safi, | |
3535 | const char *name_str, const char *direct_str) | |
718e3744 | 3536 | { |
3537 | int ret; | |
3538 | struct peer *peer; | |
fee0f4c6 | 3539 | int direct = RMAP_IN; |
718e3744 | 3540 | |
3541 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3542 | if (! peer) | |
3543 | return CMD_WARNING; | |
3544 | ||
3545 | /* Check filter direction. */ | |
fee0f4c6 | 3546 | if (strncmp (direct_str, "in", 2) == 0) |
3547 | direct = RMAP_IN; | |
718e3744 | 3548 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 3549 | direct = RMAP_OUT; |
3550 | else if (strncmp (direct_str, "im", 2) == 0) | |
3551 | direct = RMAP_IMPORT; | |
3552 | else if (strncmp (direct_str, "e", 1) == 0) | |
3553 | direct = RMAP_EXPORT; | |
718e3744 | 3554 | |
3555 | ret = peer_route_map_set (peer, afi, safi, direct, name_str); | |
3556 | ||
3557 | return bgp_vty_return (vty, ret); | |
3558 | } | |
3559 | ||
94f2b392 | 3560 | static int |
fd79ac91 | 3561 | peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3562 | safi_t safi, const char *direct_str) | |
718e3744 | 3563 | { |
3564 | int ret; | |
3565 | struct peer *peer; | |
fee0f4c6 | 3566 | int direct = RMAP_IN; |
718e3744 | 3567 | |
3568 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3569 | if (! peer) | |
3570 | return CMD_WARNING; | |
3571 | ||
3572 | /* Check filter direction. */ | |
fee0f4c6 | 3573 | if (strncmp (direct_str, "in", 2) == 0) |
3574 | direct = RMAP_IN; | |
718e3744 | 3575 | else if (strncmp (direct_str, "o", 1) == 0) |
fee0f4c6 | 3576 | direct = RMAP_OUT; |
3577 | else if (strncmp (direct_str, "im", 2) == 0) | |
3578 | direct = RMAP_IMPORT; | |
3579 | else if (strncmp (direct_str, "e", 1) == 0) | |
3580 | direct = RMAP_EXPORT; | |
718e3744 | 3581 | |
3582 | ret = peer_route_map_unset (peer, afi, safi, direct); | |
3583 | ||
3584 | return bgp_vty_return (vty, ret); | |
3585 | } | |
3586 | ||
3587 | DEFUN (neighbor_route_map, | |
3588 | neighbor_route_map_cmd, | |
fee0f4c6 | 3589 | NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 3590 | NEIGHBOR_STR |
3591 | NEIGHBOR_ADDR_STR2 | |
3592 | "Apply route map to neighbor\n" | |
3593 | "Name of route map\n" | |
3594 | "Apply map to incoming routes\n" | |
fee0f4c6 | 3595 | "Apply map to outbound routes\n" |
3596 | "Apply map to routes going into a Route-Server client's table\n" | |
3597 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 3598 | { |
3599 | return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3600 | bgp_node_safi (vty), argv[1], argv[2]); | |
3601 | } | |
3602 | ||
3603 | DEFUN (no_neighbor_route_map, | |
3604 | no_neighbor_route_map_cmd, | |
fee0f4c6 | 3605 | NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)", |
718e3744 | 3606 | NO_STR |
3607 | NEIGHBOR_STR | |
3608 | NEIGHBOR_ADDR_STR2 | |
3609 | "Apply route map to neighbor\n" | |
3610 | "Name of route map\n" | |
3611 | "Apply map to incoming routes\n" | |
fee0f4c6 | 3612 | "Apply map to outbound routes\n" |
3613 | "Apply map to routes going into a Route-Server client's table\n" | |
3614 | "Apply map to routes coming from a Route-Server client") | |
718e3744 | 3615 | { |
3616 | return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3617 | bgp_node_safi (vty), argv[2]); | |
3618 | } | |
3619 | \f | |
3620 | /* Set unsuppress-map to the peer. */ | |
94f2b392 | 3621 | static int |
fd79ac91 | 3622 | peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3623 | safi_t safi, const char *name_str) | |
718e3744 | 3624 | { |
3625 | int ret; | |
3626 | struct peer *peer; | |
3627 | ||
3628 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3629 | if (! peer) | |
3630 | return CMD_WARNING; | |
3631 | ||
3632 | ret = peer_unsuppress_map_set (peer, afi, safi, name_str); | |
3633 | ||
3634 | return bgp_vty_return (vty, ret); | |
3635 | } | |
3636 | ||
3637 | /* Unset route-map from the peer. */ | |
94f2b392 | 3638 | static int |
fd79ac91 | 3639 | peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 3640 | safi_t safi) |
3641 | { | |
3642 | int ret; | |
3643 | struct peer *peer; | |
3644 | ||
3645 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3646 | if (! peer) | |
3647 | return CMD_WARNING; | |
3648 | ||
3649 | ret = peer_unsuppress_map_unset (peer, afi, safi); | |
3650 | ||
3651 | return bgp_vty_return (vty, ret); | |
3652 | } | |
3653 | ||
3654 | DEFUN (neighbor_unsuppress_map, | |
3655 | neighbor_unsuppress_map_cmd, | |
3656 | NEIGHBOR_CMD2 "unsuppress-map WORD", | |
3657 | NEIGHBOR_STR | |
3658 | NEIGHBOR_ADDR_STR2 | |
3659 | "Route-map to selectively unsuppress suppressed routes\n" | |
3660 | "Name of route map\n") | |
3661 | { | |
3662 | return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3663 | bgp_node_safi (vty), argv[1]); | |
3664 | } | |
3665 | ||
3666 | DEFUN (no_neighbor_unsuppress_map, | |
3667 | no_neighbor_unsuppress_map_cmd, | |
3668 | NO_NEIGHBOR_CMD2 "unsuppress-map WORD", | |
3669 | NO_STR | |
3670 | NEIGHBOR_STR | |
3671 | NEIGHBOR_ADDR_STR2 | |
3672 | "Route-map to selectively unsuppress suppressed routes\n" | |
3673 | "Name of route map\n") | |
3674 | { | |
3675 | return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3676 | bgp_node_safi (vty)); | |
3677 | } | |
3678 | \f | |
94f2b392 | 3679 | static int |
fd79ac91 | 3680 | peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi, |
3681 | safi_t safi, const char *num_str, | |
0a486e5f | 3682 | const char *threshold_str, int warning, |
3683 | const char *restart_str) | |
718e3744 | 3684 | { |
3685 | int ret; | |
3686 | struct peer *peer; | |
3687 | u_int32_t max; | |
e0701b79 | 3688 | u_char threshold; |
0a486e5f | 3689 | u_int16_t restart; |
718e3744 | 3690 | |
3691 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3692 | if (! peer) | |
3693 | return CMD_WARNING; | |
3694 | ||
3695 | VTY_GET_INTEGER ("maxmum number", max, num_str); | |
e0701b79 | 3696 | if (threshold_str) |
3697 | threshold = atoi (threshold_str); | |
3698 | else | |
3699 | threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; | |
718e3744 | 3700 | |
0a486e5f | 3701 | if (restart_str) |
3702 | restart = atoi (restart_str); | |
3703 | else | |
3704 | restart = 0; | |
3705 | ||
3706 | ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart); | |
718e3744 | 3707 | |
3708 | return bgp_vty_return (vty, ret); | |
3709 | } | |
3710 | ||
94f2b392 | 3711 | static int |
fd79ac91 | 3712 | peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi, |
718e3744 | 3713 | safi_t safi) |
3714 | { | |
3715 | int ret; | |
3716 | struct peer *peer; | |
3717 | ||
3718 | peer = peer_and_group_lookup_vty (vty, ip_str); | |
3719 | if (! peer) | |
3720 | return CMD_WARNING; | |
3721 | ||
3722 | ret = peer_maximum_prefix_unset (peer, afi, safi); | |
3723 | ||
3724 | return bgp_vty_return (vty, ret); | |
3725 | } | |
3726 | ||
3727 | /* Maximum number of prefix configuration. prefix count is different | |
3728 | for each peer configuration. So this configuration can be set for | |
3729 | each peer configuration. */ | |
3730 | DEFUN (neighbor_maximum_prefix, | |
3731 | neighbor_maximum_prefix_cmd, | |
3732 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
3733 | NEIGHBOR_STR | |
3734 | NEIGHBOR_ADDR_STR2 | |
3735 | "Maximum number of prefix accept from this peer\n" | |
3736 | "maximum no. of prefix limit\n") | |
3737 | { | |
3738 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 3739 | bgp_node_safi (vty), argv[1], NULL, 0, |
3740 | NULL); | |
718e3744 | 3741 | } |
3742 | ||
e0701b79 | 3743 | DEFUN (neighbor_maximum_prefix_threshold, |
3744 | neighbor_maximum_prefix_threshold_cmd, | |
3745 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>", | |
3746 | NEIGHBOR_STR | |
3747 | NEIGHBOR_ADDR_STR2 | |
3748 | "Maximum number of prefix accept from this peer\n" | |
3749 | "maximum no. of prefix limit\n" | |
3750 | "Threshold value (%) at which to generate a warning msg\n") | |
3751 | { | |
3752 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 3753 | bgp_node_safi (vty), argv[1], argv[2], 0, |
3754 | NULL); | |
3755 | } | |
e0701b79 | 3756 | |
718e3744 | 3757 | DEFUN (neighbor_maximum_prefix_warning, |
3758 | neighbor_maximum_prefix_warning_cmd, | |
3759 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
3760 | NEIGHBOR_STR | |
3761 | NEIGHBOR_ADDR_STR2 | |
3762 | "Maximum number of prefix accept from this peer\n" | |
3763 | "maximum no. of prefix limit\n" | |
3764 | "Only give warning message when limit is exceeded\n") | |
3765 | { | |
3766 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 3767 | bgp_node_safi (vty), argv[1], NULL, 1, |
3768 | NULL); | |
718e3744 | 3769 | } |
3770 | ||
e0701b79 | 3771 | DEFUN (neighbor_maximum_prefix_threshold_warning, |
3772 | neighbor_maximum_prefix_threshold_warning_cmd, | |
3773 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", | |
3774 | NEIGHBOR_STR | |
3775 | NEIGHBOR_ADDR_STR2 | |
3776 | "Maximum number of prefix accept from this peer\n" | |
3777 | "maximum no. of prefix limit\n" | |
3778 | "Threshold value (%) at which to generate a warning msg\n" | |
3779 | "Only give warning message when limit is exceeded\n") | |
3780 | { | |
3781 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
0a486e5f | 3782 | bgp_node_safi (vty), argv[1], argv[2], 1, NULL); |
3783 | } | |
3784 | ||
3785 | DEFUN (neighbor_maximum_prefix_restart, | |
3786 | neighbor_maximum_prefix_restart_cmd, | |
3787 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
3788 | NEIGHBOR_STR | |
3789 | NEIGHBOR_ADDR_STR2 | |
3790 | "Maximum number of prefix accept from this peer\n" | |
3791 | "maximum no. of prefix limit\n" | |
3792 | "Restart bgp connection after limit is exceeded\n" | |
3793 | "Restart interval in minutes") | |
3794 | { | |
3795 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3796 | bgp_node_safi (vty), argv[1], NULL, 0, argv[2]); | |
3797 | } | |
3798 | ||
3799 | DEFUN (neighbor_maximum_prefix_threshold_restart, | |
3800 | neighbor_maximum_prefix_threshold_restart_cmd, | |
3801 | NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
3802 | NEIGHBOR_STR | |
3803 | NEIGHBOR_ADDR_STR2 | |
3804 | "Maximum number of prefix accept from this peer\n" | |
3805 | "maximum no. of prefix limit\n" | |
3806 | "Threshold value (%) at which to generate a warning msg\n" | |
3807 | "Restart bgp connection after limit is exceeded\n" | |
3808 | "Restart interval in minutes") | |
3809 | { | |
3810 | return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty), | |
3811 | bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]); | |
3812 | } | |
e0701b79 | 3813 | |
718e3744 | 3814 | DEFUN (no_neighbor_maximum_prefix, |
3815 | no_neighbor_maximum_prefix_cmd, | |
3816 | NO_NEIGHBOR_CMD2 "maximum-prefix", | |
3817 | NO_STR | |
3818 | NEIGHBOR_STR | |
3819 | NEIGHBOR_ADDR_STR2 | |
3820 | "Maximum number of prefix accept from this peer\n") | |
3821 | { | |
3822 | return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty), | |
3823 | bgp_node_safi (vty)); | |
3824 | } | |
3825 | ||
3826 | ALIAS (no_neighbor_maximum_prefix, | |
3827 | no_neighbor_maximum_prefix_val_cmd, | |
3828 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>", | |
3829 | NO_STR | |
3830 | NEIGHBOR_STR | |
3831 | NEIGHBOR_ADDR_STR2 | |
3832 | "Maximum number of prefix accept from this peer\n" | |
3833 | "maximum no. of prefix limit\n") | |
3834 | ||
3835 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 3836 | no_neighbor_maximum_prefix_threshold_cmd, |
3837 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
3838 | NO_STR | |
3839 | NEIGHBOR_STR | |
3840 | NEIGHBOR_ADDR_STR2 | |
3841 | "Maximum number of prefix accept from this peer\n" | |
3842 | "maximum no. of prefix limit\n" | |
3843 | "Threshold value (%) at which to generate a warning msg\n") | |
3844 | ||
3845 | ALIAS (no_neighbor_maximum_prefix, | |
3846 | no_neighbor_maximum_prefix_warning_cmd, | |
3847 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only", | |
3848 | NO_STR | |
3849 | NEIGHBOR_STR | |
3850 | NEIGHBOR_ADDR_STR2 | |
3851 | "Maximum number of prefix accept from this peer\n" | |
3852 | "maximum no. of prefix limit\n" | |
e8e1946e | 3853 | "Only give warning message when limit is exceeded\n") |
0a486e5f | 3854 | |
3855 | ALIAS (no_neighbor_maximum_prefix, | |
3856 | no_neighbor_maximum_prefix_threshold_warning_cmd, | |
e0701b79 | 3857 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only", |
3858 | NO_STR | |
3859 | NEIGHBOR_STR | |
3860 | NEIGHBOR_ADDR_STR2 | |
3861 | "Maximum number of prefix accept from this peer\n" | |
3862 | "maximum no. of prefix limit\n" | |
3863 | "Threshold value (%) at which to generate a warning msg\n" | |
e8e1946e | 3864 | "Only give warning message when limit is exceeded\n") |
e0701b79 | 3865 | |
3866 | ALIAS (no_neighbor_maximum_prefix, | |
0a486e5f | 3867 | no_neighbor_maximum_prefix_restart_cmd, |
3868 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>", | |
718e3744 | 3869 | NO_STR |
3870 | NEIGHBOR_STR | |
3871 | NEIGHBOR_ADDR_STR2 | |
3872 | "Maximum number of prefix accept from this peer\n" | |
3873 | "maximum no. of prefix limit\n" | |
0a486e5f | 3874 | "Restart bgp connection after limit is exceeded\n" |
3875 | "Restart interval in minutes") | |
3876 | ||
3877 | ALIAS (no_neighbor_maximum_prefix, | |
3878 | no_neighbor_maximum_prefix_threshold_restart_cmd, | |
3879 | NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>", | |
3880 | NO_STR | |
3881 | NEIGHBOR_STR | |
3882 | NEIGHBOR_ADDR_STR2 | |
3883 | "Maximum number of prefix accept from this peer\n" | |
3884 | "maximum no. of prefix limit\n" | |
3885 | "Threshold value (%) at which to generate a warning msg\n" | |
3886 | "Restart bgp connection after limit is exceeded\n" | |
3887 | "Restart interval in minutes") | |
718e3744 | 3888 | \f |
3889 | /* "neighbor allowas-in" */ | |
3890 | DEFUN (neighbor_allowas_in, | |
3891 | neighbor_allowas_in_cmd, | |
3892 | NEIGHBOR_CMD2 "allowas-in", | |
3893 | NEIGHBOR_STR | |
3894 | NEIGHBOR_ADDR_STR2 | |
3895 | "Accept as-path with my AS present in it\n") | |
3896 | { | |
3897 | int ret; | |
3898 | struct peer *peer; | |
fd79ac91 | 3899 | unsigned int allow_num; |
718e3744 | 3900 | |
3901 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3902 | if (! peer) | |
3903 | return CMD_WARNING; | |
3904 | ||
3905 | if (argc == 1) | |
3906 | allow_num = 3; | |
3907 | else | |
3908 | VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10); | |
3909 | ||
3910 | ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty), | |
3911 | allow_num); | |
3912 | ||
3913 | return bgp_vty_return (vty, ret); | |
3914 | } | |
3915 | ||
3916 | ALIAS (neighbor_allowas_in, | |
3917 | neighbor_allowas_in_arg_cmd, | |
3918 | NEIGHBOR_CMD2 "allowas-in <1-10>", | |
3919 | NEIGHBOR_STR | |
3920 | NEIGHBOR_ADDR_STR2 | |
3921 | "Accept as-path with my AS present in it\n" | |
3922 | "Number of occurances of AS number\n") | |
3923 | ||
3924 | DEFUN (no_neighbor_allowas_in, | |
3925 | no_neighbor_allowas_in_cmd, | |
3926 | NO_NEIGHBOR_CMD2 "allowas-in", | |
3927 | NO_STR | |
3928 | NEIGHBOR_STR | |
3929 | NEIGHBOR_ADDR_STR2 | |
3930 | "allow local ASN appears in aspath attribute\n") | |
3931 | { | |
3932 | int ret; | |
3933 | struct peer *peer; | |
3934 | ||
3935 | peer = peer_and_group_lookup_vty (vty, argv[0]); | |
3936 | if (! peer) | |
3937 | return CMD_WARNING; | |
3938 | ||
3939 | ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty)); | |
3940 | ||
3941 | return bgp_vty_return (vty, ret); | |
3942 | } | |
3943 | \f | |
3944 | /* Address family configuration. */ | |
3945 | DEFUN (address_family_ipv4, | |
3946 | address_family_ipv4_cmd, | |
3947 | "address-family ipv4", | |
3948 | "Enter Address Family command mode\n" | |
3949 | "Address family\n") | |
3950 | { | |
3951 | vty->node = BGP_IPV4_NODE; | |
3952 | return CMD_SUCCESS; | |
3953 | } | |
3954 | ||
3955 | DEFUN (address_family_ipv4_safi, | |
3956 | address_family_ipv4_safi_cmd, | |
3957 | "address-family ipv4 (unicast|multicast)", | |
3958 | "Enter Address Family command mode\n" | |
3959 | "Address family\n" | |
3960 | "Address Family modifier\n" | |
3961 | "Address Family modifier\n") | |
3962 | { | |
3963 | if (strncmp (argv[0], "m", 1) == 0) | |
3964 | vty->node = BGP_IPV4M_NODE; | |
3965 | else | |
3966 | vty->node = BGP_IPV4_NODE; | |
3967 | ||
3968 | return CMD_SUCCESS; | |
3969 | } | |
3970 | ||
25ffbdc1 | 3971 | DEFUN (address_family_ipv6, |
3972 | address_family_ipv6_cmd, | |
3973 | "address-family ipv6", | |
718e3744 | 3974 | "Enter Address Family command mode\n" |
25ffbdc1 | 3975 | "Address family\n") |
718e3744 | 3976 | { |
3977 | vty->node = BGP_IPV6_NODE; | |
3978 | return CMD_SUCCESS; | |
3979 | } | |
3980 | ||
25ffbdc1 | 3981 | DEFUN (address_family_ipv6_safi, |
3982 | address_family_ipv6_safi_cmd, | |
3983 | "address-family ipv6 (unicast|multicast)", | |
718e3744 | 3984 | "Enter Address Family command mode\n" |
25ffbdc1 | 3985 | "Address family\n" |
3986 | "Address Family modifier\n" | |
3987 | "Address Family modifier\n") | |
3988 | { | |
3989 | if (strncmp (argv[0], "m", 1) == 0) | |
3990 | vty->node = BGP_IPV6M_NODE; | |
3991 | else | |
3992 | vty->node = BGP_IPV6_NODE; | |
3993 | ||
3994 | return CMD_SUCCESS; | |
3995 | } | |
718e3744 | 3996 | |
3997 | DEFUN (address_family_vpnv4, | |
3998 | address_family_vpnv4_cmd, | |
3999 | "address-family vpnv4", | |
4000 | "Enter Address Family command mode\n" | |
4001 | "Address family\n") | |
4002 | { | |
4003 | vty->node = BGP_VPNV4_NODE; | |
4004 | return CMD_SUCCESS; | |
4005 | } | |
4006 | ||
4007 | ALIAS (address_family_vpnv4, | |
4008 | address_family_vpnv4_unicast_cmd, | |
4009 | "address-family vpnv4 unicast", | |
4010 | "Enter Address Family command mode\n" | |
4011 | "Address family\n" | |
4012 | "Address Family Modifier\n") | |
4013 | ||
4014 | DEFUN (exit_address_family, | |
4015 | exit_address_family_cmd, | |
4016 | "exit-address-family", | |
4017 | "Exit from Address Family configuration mode\n") | |
4018 | { | |
a8a80d53 | 4019 | if (vty->node == BGP_IPV4_NODE |
4020 | || vty->node == BGP_IPV4M_NODE | |
718e3744 | 4021 | || vty->node == BGP_VPNV4_NODE |
25ffbdc1 | 4022 | || vty->node == BGP_IPV6_NODE |
4023 | || vty->node == BGP_IPV6M_NODE) | |
718e3744 | 4024 | vty->node = BGP_NODE; |
4025 | return CMD_SUCCESS; | |
4026 | } | |
4027 | \f | |
4028 | /* BGP clear sort. */ | |
4029 | enum clear_sort | |
4030 | { | |
4031 | clear_all, | |
4032 | clear_peer, | |
4033 | clear_group, | |
4034 | clear_external, | |
4035 | clear_as | |
4036 | }; | |
4037 | ||
94f2b392 | 4038 | static void |
718e3744 | 4039 | bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi, |
4040 | safi_t safi, int error) | |
4041 | { | |
4042 | switch (error) | |
4043 | { | |
4044 | case BGP_ERR_AF_UNCONFIGURED: | |
4045 | vty_out (vty, | |
4046 | "%%BGP: Enable %s %s address family for the neighbor %s%s", | |
4047 | afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4", | |
4048 | safi == SAFI_MULTICAST ? "Multicast" : "Unicast", | |
4049 | peer->host, VTY_NEWLINE); | |
4050 | break; | |
4051 | case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED: | |
4052 | 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); | |
4053 | break; | |
4054 | default: | |
4055 | break; | |
4056 | } | |
4057 | } | |
4058 | ||
4059 | /* `clear ip bgp' functions. */ | |
94f2b392 | 4060 | static int |
718e3744 | 4061 | bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, |
fd79ac91 | 4062 | enum clear_sort sort,enum bgp_clear_type stype, const char *arg) |
718e3744 | 4063 | { |
4064 | int ret; | |
4065 | struct peer *peer; | |
1eb8ef25 | 4066 | struct listnode *node, *nnode; |
718e3744 | 4067 | |
4068 | /* Clear all neighbors. */ | |
4069 | if (sort == clear_all) | |
4070 | { | |
1eb8ef25 | 4071 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 4072 | { |
4073 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4074 | ret = peer_clear (peer); | |
4075 | else | |
4076 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4077 | ||
4078 | if (ret < 0) | |
4079 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4080 | } | |
0b2aa3a0 | 4081 | return CMD_SUCCESS; |
718e3744 | 4082 | } |
4083 | ||
4084 | /* Clear specified neighbors. */ | |
4085 | if (sort == clear_peer) | |
4086 | { | |
4087 | union sockunion su; | |
4088 | int ret; | |
4089 | ||
4090 | /* Make sockunion for lookup. */ | |
4091 | ret = str2sockunion (arg, &su); | |
4092 | if (ret < 0) | |
4093 | { | |
4094 | vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE); | |
0b2aa3a0 | 4095 | return CMD_WARNING; |
718e3744 | 4096 | } |
4097 | peer = peer_lookup (bgp, &su); | |
4098 | if (! peer) | |
4099 | { | |
4100 | vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE); | |
0b2aa3a0 | 4101 | return CMD_WARNING; |
718e3744 | 4102 | } |
4103 | ||
4104 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4105 | ret = peer_clear (peer); | |
4106 | else | |
4107 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4108 | ||
4109 | if (ret < 0) | |
4110 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4111 | ||
0b2aa3a0 | 4112 | return CMD_SUCCESS; |
718e3744 | 4113 | } |
4114 | ||
4115 | /* Clear all peer-group members. */ | |
4116 | if (sort == clear_group) | |
4117 | { | |
4118 | struct peer_group *group; | |
4119 | ||
4120 | group = peer_group_lookup (bgp, arg); | |
4121 | if (! group) | |
4122 | { | |
4123 | vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE); | |
0b2aa3a0 | 4124 | return CMD_WARNING; |
718e3744 | 4125 | } |
4126 | ||
1eb8ef25 | 4127 | for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) |
718e3744 | 4128 | { |
4129 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4130 | { | |
4131 | ret = peer_clear (peer); | |
4132 | continue; | |
4133 | } | |
4134 | ||
4135 | if (! peer->af_group[afi][safi]) | |
4136 | continue; | |
4137 | ||
4138 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4139 | ||
4140 | if (ret < 0) | |
4141 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4142 | } | |
0b2aa3a0 | 4143 | return CMD_SUCCESS; |
718e3744 | 4144 | } |
4145 | ||
4146 | if (sort == clear_external) | |
4147 | { | |
1eb8ef25 | 4148 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 4149 | { |
4150 | if (peer_sort (peer) == BGP_PEER_IBGP) | |
4151 | continue; | |
4152 | ||
4153 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4154 | ret = peer_clear (peer); | |
4155 | else | |
4156 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4157 | ||
4158 | if (ret < 0) | |
4159 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4160 | } | |
0b2aa3a0 | 4161 | return CMD_SUCCESS; |
718e3744 | 4162 | } |
4163 | ||
4164 | if (sort == clear_as) | |
4165 | { | |
4166 | as_t as; | |
4167 | unsigned long as_ul; | |
718e3744 | 4168 | int find = 0; |
4169 | ||
0b2aa3a0 PJ |
4170 | VTY_GET_LONG ("AS", as_ul, arg); |
4171 | ||
4172 | if (!as_ul) | |
718e3744 | 4173 | { |
4174 | vty_out (vty, "Invalid AS number%s", VTY_NEWLINE); | |
0b2aa3a0 | 4175 | return CMD_WARNING; |
718e3744 | 4176 | } |
4177 | as = (as_t) as_ul; | |
4178 | ||
1eb8ef25 | 4179 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 4180 | { |
4181 | if (peer->as != as) | |
4182 | continue; | |
4183 | ||
4184 | find = 1; | |
4185 | if (stype == BGP_CLEAR_SOFT_NONE) | |
4186 | ret = peer_clear (peer); | |
4187 | else | |
4188 | ret = peer_clear_soft (peer, afi, safi, stype); | |
4189 | ||
4190 | if (ret < 0) | |
4191 | bgp_clear_vty_error (vty, peer, afi, safi, ret); | |
4192 | } | |
4193 | if (! find) | |
4194 | vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg, | |
4195 | VTY_NEWLINE); | |
0b2aa3a0 | 4196 | return CMD_SUCCESS; |
718e3744 | 4197 | } |
4198 | ||
0b2aa3a0 | 4199 | return CMD_SUCCESS; |
718e3744 | 4200 | } |
4201 | ||
94f2b392 | 4202 | static int |
fd79ac91 | 4203 | bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi, |
4204 | enum clear_sort sort, enum bgp_clear_type stype, | |
4205 | const char *arg) | |
718e3744 | 4206 | { |
718e3744 | 4207 | struct bgp *bgp; |
4208 | ||
4209 | /* BGP structure lookup. */ | |
4210 | if (name) | |
4211 | { | |
4212 | bgp = bgp_lookup_by_name (name); | |
4213 | if (bgp == NULL) | |
4214 | { | |
4215 | vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE); | |
4216 | return CMD_WARNING; | |
4217 | } | |
4218 | } | |
4219 | else | |
4220 | { | |
4221 | bgp = bgp_get_default (); | |
4222 | if (bgp == NULL) | |
4223 | { | |
4224 | vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); | |
4225 | return CMD_WARNING; | |
4226 | } | |
4227 | } | |
4228 | ||
0b2aa3a0 | 4229 | return bgp_clear (vty, bgp, afi, safi, sort, stype, arg); |
718e3744 | 4230 | } |
4231 | ||
4232 | DEFUN (clear_ip_bgp_all, | |
4233 | clear_ip_bgp_all_cmd, | |
4234 | "clear ip bgp *", | |
4235 | CLEAR_STR | |
4236 | IP_STR | |
4237 | BGP_STR | |
4238 | "Clear all peers\n") | |
4239 | { | |
4240 | if (argc == 1) | |
4241 | return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
4242 | ||
4243 | return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); | |
4244 | } | |
4245 | ||
4246 | ALIAS (clear_ip_bgp_all, | |
4247 | clear_bgp_all_cmd, | |
4248 | "clear bgp *", | |
4249 | CLEAR_STR | |
4250 | BGP_STR | |
4251 | "Clear all peers\n") | |
4252 | ||
4253 | ALIAS (clear_ip_bgp_all, | |
4254 | clear_bgp_ipv6_all_cmd, | |
4255 | "clear bgp ipv6 *", | |
4256 | CLEAR_STR | |
4257 | BGP_STR | |
4258 | "Address family\n" | |
4259 | "Clear all peers\n") | |
4260 | ||
4261 | ALIAS (clear_ip_bgp_all, | |
4262 | clear_ip_bgp_instance_all_cmd, | |
4263 | "clear ip bgp view WORD *", | |
4264 | CLEAR_STR | |
4265 | IP_STR | |
4266 | BGP_STR | |
4267 | "BGP view\n" | |
4268 | "view name\n" | |
4269 | "Clear all peers\n") | |
4270 | ||
4271 | ALIAS (clear_ip_bgp_all, | |
4272 | clear_bgp_instance_all_cmd, | |
4273 | "clear bgp view WORD *", | |
4274 | CLEAR_STR | |
4275 | BGP_STR | |
4276 | "BGP view\n" | |
4277 | "view name\n" | |
4278 | "Clear all peers\n") | |
4279 | ||
4280 | DEFUN (clear_ip_bgp_peer, | |
4281 | clear_ip_bgp_peer_cmd, | |
4282 | "clear ip bgp (A.B.C.D|X:X::X:X)", | |
4283 | CLEAR_STR | |
4284 | IP_STR | |
4285 | BGP_STR | |
4286 | "BGP neighbor IP address to clear\n" | |
4287 | "BGP IPv6 neighbor to clear\n") | |
4288 | { | |
4289 | return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]); | |
4290 | } | |
4291 | ||
4292 | ALIAS (clear_ip_bgp_peer, | |
4293 | clear_bgp_peer_cmd, | |
4294 | "clear bgp (A.B.C.D|X:X::X:X)", | |
4295 | CLEAR_STR | |
4296 | BGP_STR | |
4297 | "BGP neighbor address to clear\n" | |
4298 | "BGP IPv6 neighbor to clear\n") | |
4299 | ||
4300 | ALIAS (clear_ip_bgp_peer, | |
4301 | clear_bgp_ipv6_peer_cmd, | |
4302 | "clear bgp ipv6 (A.B.C.D|X:X::X:X)", | |
4303 | CLEAR_STR | |
4304 | BGP_STR | |
4305 | "Address family\n" | |
4306 | "BGP neighbor address to clear\n" | |
4307 | "BGP IPv6 neighbor to clear\n") | |
4308 | ||
4309 | DEFUN (clear_ip_bgp_peer_group, | |
4310 | clear_ip_bgp_peer_group_cmd, | |
4311 | "clear ip bgp peer-group WORD", | |
4312 | CLEAR_STR | |
4313 | IP_STR | |
4314 | BGP_STR | |
4315 | "Clear all members of peer-group\n" | |
4316 | "BGP peer-group name\n") | |
4317 | { | |
4318 | return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]); | |
4319 | } | |
4320 | ||
4321 | ALIAS (clear_ip_bgp_peer_group, | |
4322 | clear_bgp_peer_group_cmd, | |
4323 | "clear bgp peer-group WORD", | |
4324 | CLEAR_STR | |
4325 | BGP_STR | |
4326 | "Clear all members of peer-group\n" | |
4327 | "BGP peer-group name\n") | |
4328 | ||
4329 | ALIAS (clear_ip_bgp_peer_group, | |
4330 | clear_bgp_ipv6_peer_group_cmd, | |
4331 | "clear bgp ipv6 peer-group WORD", | |
4332 | CLEAR_STR | |
4333 | BGP_STR | |
4334 | "Address family\n" | |
4335 | "Clear all members of peer-group\n" | |
4336 | "BGP peer-group name\n") | |
4337 | ||
4338 | DEFUN (clear_ip_bgp_external, | |
4339 | clear_ip_bgp_external_cmd, | |
4340 | "clear ip bgp external", | |
4341 | CLEAR_STR | |
4342 | IP_STR | |
4343 | BGP_STR | |
4344 | "Clear all external peers\n") | |
4345 | { | |
4346 | return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL); | |
4347 | } | |
4348 | ||
4349 | ALIAS (clear_ip_bgp_external, | |
4350 | clear_bgp_external_cmd, | |
4351 | "clear bgp external", | |
4352 | CLEAR_STR | |
4353 | BGP_STR | |
4354 | "Clear all external peers\n") | |
4355 | ||
4356 | ALIAS (clear_ip_bgp_external, | |
4357 | clear_bgp_ipv6_external_cmd, | |
4358 | "clear bgp ipv6 external", | |
4359 | CLEAR_STR | |
4360 | BGP_STR | |
4361 | "Address family\n" | |
4362 | "Clear all external peers\n") | |
4363 | ||
4364 | DEFUN (clear_ip_bgp_as, | |
4365 | clear_ip_bgp_as_cmd, | |
320da874 | 4366 | "clear ip bgp " CMD_AS_RANGE, |
718e3744 | 4367 | CLEAR_STR |
4368 | IP_STR | |
4369 | BGP_STR | |
4370 | "Clear peers with the AS number\n") | |
4371 | { | |
4372 | return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]); | |
4373 | } | |
4374 | ||
4375 | ALIAS (clear_ip_bgp_as, | |
4376 | clear_bgp_as_cmd, | |
320da874 | 4377 | "clear bgp " CMD_AS_RANGE, |
718e3744 | 4378 | CLEAR_STR |
4379 | BGP_STR | |
4380 | "Clear peers with the AS number\n") | |
4381 | ||
4382 | ALIAS (clear_ip_bgp_as, | |
4383 | clear_bgp_ipv6_as_cmd, | |
320da874 | 4384 | "clear bgp ipv6 " CMD_AS_RANGE, |
718e3744 | 4385 | CLEAR_STR |
4386 | BGP_STR | |
4387 | "Address family\n" | |
4388 | "Clear peers with the AS number\n") | |
4389 | \f | |
4390 | /* Outbound soft-reconfiguration */ | |
4391 | DEFUN (clear_ip_bgp_all_soft_out, | |
4392 | clear_ip_bgp_all_soft_out_cmd, | |
4393 | "clear ip bgp * soft out", | |
4394 | CLEAR_STR | |
4395 | IP_STR | |
4396 | BGP_STR | |
4397 | "Clear all peers\n" | |
4398 | "Soft reconfig\n" | |
4399 | "Soft reconfig outbound update\n") | |
4400 | { | |
4401 | if (argc == 1) | |
4402 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
4403 | BGP_CLEAR_SOFT_OUT, NULL); | |
4404 | ||
4405 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
4406 | BGP_CLEAR_SOFT_OUT, NULL); | |
4407 | } | |
4408 | ||
4409 | ALIAS (clear_ip_bgp_all_soft_out, | |
4410 | clear_ip_bgp_all_out_cmd, | |
4411 | "clear ip bgp * out", | |
4412 | CLEAR_STR | |
4413 | IP_STR | |
4414 | BGP_STR | |
4415 | "Clear all peers\n" | |
4416 | "Soft reconfig outbound update\n") | |
4417 | ||
4418 | ALIAS (clear_ip_bgp_all_soft_out, | |
4419 | clear_ip_bgp_instance_all_soft_out_cmd, | |
4420 | "clear ip bgp view WORD * soft out", | |
4421 | CLEAR_STR | |
4422 | IP_STR | |
4423 | BGP_STR | |
4424 | "BGP view\n" | |
4425 | "view name\n" | |
4426 | "Clear all peers\n" | |
4427 | "Soft reconfig\n" | |
4428 | "Soft reconfig outbound update\n") | |
4429 | ||
4430 | DEFUN (clear_ip_bgp_all_ipv4_soft_out, | |
4431 | clear_ip_bgp_all_ipv4_soft_out_cmd, | |
4432 | "clear ip bgp * ipv4 (unicast|multicast) soft out", | |
4433 | CLEAR_STR | |
4434 | IP_STR | |
4435 | BGP_STR | |
4436 | "Clear all peers\n" | |
4437 | "Address family\n" | |
4438 | "Address Family modifier\n" | |
4439 | "Address Family modifier\n" | |
4440 | "Soft reconfig\n" | |
4441 | "Soft reconfig outbound update\n") | |
4442 | { | |
4443 | if (strncmp (argv[0], "m", 1) == 0) | |
4444 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
4445 | BGP_CLEAR_SOFT_OUT, NULL); | |
4446 | ||
4447 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
4448 | BGP_CLEAR_SOFT_OUT, NULL); | |
4449 | } | |
4450 | ||
4451 | ALIAS (clear_ip_bgp_all_ipv4_soft_out, | |
4452 | clear_ip_bgp_all_ipv4_out_cmd, | |
4453 | "clear ip bgp * ipv4 (unicast|multicast) out", | |
4454 | CLEAR_STR | |
4455 | IP_STR | |
4456 | BGP_STR | |
4457 | "Clear all peers\n" | |
4458 | "Address family\n" | |
4459 | "Address Family modifier\n" | |
4460 | "Address Family modifier\n" | |
4461 | "Soft reconfig outbound update\n") | |
4462 | ||
4463 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out, | |
4464 | clear_ip_bgp_instance_all_ipv4_soft_out_cmd, | |
4465 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out", | |
4466 | CLEAR_STR | |
4467 | IP_STR | |
4468 | BGP_STR | |
4469 | "BGP view\n" | |
4470 | "view name\n" | |
4471 | "Clear all peers\n" | |
4472 | "Address family\n" | |
4473 | "Address Family modifier\n" | |
4474 | "Address Family modifier\n" | |
4475 | "Soft reconfig outbound update\n") | |
4476 | { | |
4477 | if (strncmp (argv[1], "m", 1) == 0) | |
4478 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
4479 | BGP_CLEAR_SOFT_OUT, NULL); | |
4480 | ||
4481 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
4482 | BGP_CLEAR_SOFT_OUT, NULL); | |
4483 | } | |
4484 | ||
4485 | DEFUN (clear_ip_bgp_all_vpnv4_soft_out, | |
4486 | clear_ip_bgp_all_vpnv4_soft_out_cmd, | |
4487 | "clear ip bgp * vpnv4 unicast soft out", | |
4488 | CLEAR_STR | |
4489 | IP_STR | |
4490 | BGP_STR | |
4491 | "Clear all peers\n" | |
4492 | "Address family\n" | |
4493 | "Address Family Modifier\n" | |
4494 | "Soft reconfig\n" | |
4495 | "Soft reconfig outbound update\n") | |
4496 | { | |
4497 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
4498 | BGP_CLEAR_SOFT_OUT, NULL); | |
4499 | } | |
4500 | ||
4501 | ALIAS (clear_ip_bgp_all_vpnv4_soft_out, | |
4502 | clear_ip_bgp_all_vpnv4_out_cmd, | |
4503 | "clear ip bgp * vpnv4 unicast out", | |
4504 | CLEAR_STR | |
4505 | IP_STR | |
4506 | BGP_STR | |
4507 | "Clear all peers\n" | |
4508 | "Address family\n" | |
4509 | "Address Family Modifier\n" | |
4510 | "Soft reconfig outbound update\n") | |
4511 | ||
4512 | DEFUN (clear_bgp_all_soft_out, | |
4513 | clear_bgp_all_soft_out_cmd, | |
4514 | "clear bgp * soft out", | |
4515 | CLEAR_STR | |
4516 | BGP_STR | |
4517 | "Clear all peers\n" | |
4518 | "Soft reconfig\n" | |
4519 | "Soft reconfig outbound update\n") | |
4520 | { | |
4521 | if (argc == 1) | |
4522 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
4523 | BGP_CLEAR_SOFT_OUT, NULL); | |
4524 | ||
4525 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
4526 | BGP_CLEAR_SOFT_OUT, NULL); | |
4527 | } | |
4528 | ||
4529 | ALIAS (clear_bgp_all_soft_out, | |
4530 | clear_bgp_instance_all_soft_out_cmd, | |
4531 | "clear bgp view WORD * soft out", | |
4532 | CLEAR_STR | |
4533 | BGP_STR | |
4534 | "BGP view\n" | |
4535 | "view name\n" | |
4536 | "Clear all peers\n" | |
4537 | "Soft reconfig\n" | |
4538 | "Soft reconfig outbound update\n") | |
4539 | ||
4540 | ALIAS (clear_bgp_all_soft_out, | |
4541 | clear_bgp_all_out_cmd, | |
4542 | "clear bgp * out", | |
4543 | CLEAR_STR | |
4544 | BGP_STR | |
4545 | "Clear all peers\n" | |
4546 | "Soft reconfig outbound update\n") | |
4547 | ||
4548 | ALIAS (clear_bgp_all_soft_out, | |
4549 | clear_bgp_ipv6_all_soft_out_cmd, | |
4550 | "clear bgp ipv6 * soft out", | |
4551 | CLEAR_STR | |
4552 | BGP_STR | |
4553 | "Address family\n" | |
4554 | "Clear all peers\n" | |
4555 | "Soft reconfig\n" | |
4556 | "Soft reconfig outbound update\n") | |
4557 | ||
4558 | ALIAS (clear_bgp_all_soft_out, | |
4559 | clear_bgp_ipv6_all_out_cmd, | |
4560 | "clear bgp ipv6 * out", | |
4561 | CLEAR_STR | |
4562 | BGP_STR | |
4563 | "Address family\n" | |
4564 | "Clear all peers\n" | |
4565 | "Soft reconfig outbound update\n") | |
4566 | ||
4567 | DEFUN (clear_ip_bgp_peer_soft_out, | |
4568 | clear_ip_bgp_peer_soft_out_cmd, | |
4569 | "clear ip bgp A.B.C.D soft out", | |
4570 | CLEAR_STR | |
4571 | IP_STR | |
4572 | BGP_STR | |
4573 | "BGP neighbor address to clear\n" | |
4574 | "Soft reconfig\n" | |
4575 | "Soft reconfig outbound update\n") | |
4576 | { | |
4577 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
4578 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4579 | } | |
4580 | ||
4581 | ALIAS (clear_ip_bgp_peer_soft_out, | |
4582 | clear_ip_bgp_peer_out_cmd, | |
4583 | "clear ip bgp A.B.C.D out", | |
4584 | CLEAR_STR | |
4585 | IP_STR | |
4586 | BGP_STR | |
4587 | "BGP neighbor address to clear\n" | |
4588 | "Soft reconfig outbound update\n") | |
4589 | ||
4590 | DEFUN (clear_ip_bgp_peer_ipv4_soft_out, | |
4591 | clear_ip_bgp_peer_ipv4_soft_out_cmd, | |
4592 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out", | |
4593 | CLEAR_STR | |
4594 | IP_STR | |
4595 | BGP_STR | |
4596 | "BGP neighbor address to clear\n" | |
4597 | "Address family\n" | |
4598 | "Address Family modifier\n" | |
4599 | "Address Family modifier\n" | |
4600 | "Soft reconfig\n" | |
4601 | "Soft reconfig outbound update\n") | |
4602 | { | |
4603 | if (strncmp (argv[1], "m", 1) == 0) | |
4604 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
4605 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4606 | ||
4607 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
4608 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4609 | } | |
4610 | ||
4611 | ALIAS (clear_ip_bgp_peer_ipv4_soft_out, | |
4612 | clear_ip_bgp_peer_ipv4_out_cmd, | |
4613 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out", | |
4614 | CLEAR_STR | |
4615 | IP_STR | |
4616 | BGP_STR | |
4617 | "BGP neighbor address to clear\n" | |
4618 | "Address family\n" | |
4619 | "Address Family modifier\n" | |
4620 | "Address Family modifier\n" | |
4621 | "Soft reconfig outbound update\n") | |
4622 | ||
4623 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_out, | |
4624 | clear_ip_bgp_peer_vpnv4_soft_out_cmd, | |
4625 | "clear ip bgp A.B.C.D vpnv4 unicast soft out", | |
4626 | CLEAR_STR | |
4627 | IP_STR | |
4628 | BGP_STR | |
4629 | "BGP neighbor address to clear\n" | |
4630 | "Address family\n" | |
4631 | "Address Family Modifier\n" | |
4632 | "Soft reconfig\n" | |
4633 | "Soft reconfig outbound update\n") | |
4634 | { | |
4635 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
4636 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4637 | } | |
4638 | ||
4639 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_out, | |
4640 | clear_ip_bgp_peer_vpnv4_out_cmd, | |
4641 | "clear ip bgp A.B.C.D vpnv4 unicast out", | |
4642 | CLEAR_STR | |
4643 | IP_STR | |
4644 | BGP_STR | |
4645 | "BGP neighbor address to clear\n" | |
4646 | "Address family\n" | |
4647 | "Address Family Modifier\n" | |
4648 | "Soft reconfig outbound update\n") | |
4649 | ||
4650 | DEFUN (clear_bgp_peer_soft_out, | |
4651 | clear_bgp_peer_soft_out_cmd, | |
4652 | "clear bgp (A.B.C.D|X:X::X:X) soft out", | |
4653 | CLEAR_STR | |
4654 | BGP_STR | |
4655 | "BGP neighbor address to clear\n" | |
4656 | "BGP IPv6 neighbor to clear\n" | |
4657 | "Soft reconfig\n" | |
4658 | "Soft reconfig outbound update\n") | |
4659 | { | |
4660 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
4661 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4662 | } | |
4663 | ||
4664 | ALIAS (clear_bgp_peer_soft_out, | |
4665 | clear_bgp_ipv6_peer_soft_out_cmd, | |
4666 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out", | |
4667 | CLEAR_STR | |
4668 | BGP_STR | |
4669 | "Address family\n" | |
4670 | "BGP neighbor address to clear\n" | |
4671 | "BGP IPv6 neighbor to clear\n" | |
4672 | "Soft reconfig\n" | |
4673 | "Soft reconfig outbound update\n") | |
4674 | ||
4675 | ALIAS (clear_bgp_peer_soft_out, | |
4676 | clear_bgp_peer_out_cmd, | |
4677 | "clear bgp (A.B.C.D|X:X::X:X) out", | |
4678 | CLEAR_STR | |
4679 | BGP_STR | |
4680 | "BGP neighbor address to clear\n" | |
4681 | "BGP IPv6 neighbor to clear\n" | |
4682 | "Soft reconfig outbound update\n") | |
4683 | ||
4684 | ALIAS (clear_bgp_peer_soft_out, | |
4685 | clear_bgp_ipv6_peer_out_cmd, | |
4686 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) out", | |
4687 | CLEAR_STR | |
4688 | BGP_STR | |
4689 | "Address family\n" | |
4690 | "BGP neighbor address to clear\n" | |
4691 | "BGP IPv6 neighbor to clear\n" | |
4692 | "Soft reconfig outbound update\n") | |
4693 | ||
4694 | DEFUN (clear_ip_bgp_peer_group_soft_out, | |
4695 | clear_ip_bgp_peer_group_soft_out_cmd, | |
4696 | "clear ip bgp peer-group WORD soft out", | |
4697 | CLEAR_STR | |
4698 | IP_STR | |
4699 | BGP_STR | |
4700 | "Clear all members of peer-group\n" | |
4701 | "BGP peer-group name\n" | |
4702 | "Soft reconfig\n" | |
4703 | "Soft reconfig outbound update\n") | |
4704 | { | |
4705 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
4706 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4707 | } | |
4708 | ||
4709 | ALIAS (clear_ip_bgp_peer_group_soft_out, | |
4710 | clear_ip_bgp_peer_group_out_cmd, | |
4711 | "clear ip bgp peer-group WORD out", | |
4712 | CLEAR_STR | |
4713 | IP_STR | |
4714 | BGP_STR | |
4715 | "Clear all members of peer-group\n" | |
4716 | "BGP peer-group name\n" | |
4717 | "Soft reconfig outbound update\n") | |
4718 | ||
4719 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out, | |
4720 | clear_ip_bgp_peer_group_ipv4_soft_out_cmd, | |
4721 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out", | |
4722 | CLEAR_STR | |
4723 | IP_STR | |
4724 | BGP_STR | |
4725 | "Clear all members of peer-group\n" | |
4726 | "BGP peer-group name\n" | |
4727 | "Address family\n" | |
4728 | "Address Family modifier\n" | |
4729 | "Address Family modifier\n" | |
4730 | "Soft reconfig\n" | |
4731 | "Soft reconfig outbound update\n") | |
4732 | { | |
4733 | if (strncmp (argv[1], "m", 1) == 0) | |
4734 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
4735 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4736 | ||
4737 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
4738 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4739 | } | |
4740 | ||
4741 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out, | |
4742 | clear_ip_bgp_peer_group_ipv4_out_cmd, | |
4743 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out", | |
4744 | CLEAR_STR | |
4745 | IP_STR | |
4746 | BGP_STR | |
4747 | "Clear all members of peer-group\n" | |
4748 | "BGP peer-group name\n" | |
4749 | "Address family\n" | |
4750 | "Address Family modifier\n" | |
4751 | "Address Family modifier\n" | |
4752 | "Soft reconfig outbound update\n") | |
4753 | ||
4754 | DEFUN (clear_bgp_peer_group_soft_out, | |
4755 | clear_bgp_peer_group_soft_out_cmd, | |
4756 | "clear bgp peer-group WORD soft out", | |
4757 | CLEAR_STR | |
4758 | BGP_STR | |
4759 | "Clear all members of peer-group\n" | |
4760 | "BGP peer-group name\n" | |
4761 | "Soft reconfig\n" | |
4762 | "Soft reconfig outbound update\n") | |
4763 | { | |
4764 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
4765 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4766 | } | |
4767 | ||
4768 | ALIAS (clear_bgp_peer_group_soft_out, | |
4769 | clear_bgp_ipv6_peer_group_soft_out_cmd, | |
4770 | "clear bgp ipv6 peer-group WORD soft out", | |
4771 | CLEAR_STR | |
4772 | BGP_STR | |
4773 | "Address family\n" | |
4774 | "Clear all members of peer-group\n" | |
4775 | "BGP peer-group name\n" | |
4776 | "Soft reconfig\n" | |
4777 | "Soft reconfig outbound update\n") | |
4778 | ||
4779 | ALIAS (clear_bgp_peer_group_soft_out, | |
4780 | clear_bgp_peer_group_out_cmd, | |
4781 | "clear bgp peer-group WORD out", | |
4782 | CLEAR_STR | |
4783 | BGP_STR | |
4784 | "Clear all members of peer-group\n" | |
4785 | "BGP peer-group name\n" | |
4786 | "Soft reconfig outbound update\n") | |
4787 | ||
4788 | ALIAS (clear_bgp_peer_group_soft_out, | |
4789 | clear_bgp_ipv6_peer_group_out_cmd, | |
4790 | "clear bgp ipv6 peer-group WORD out", | |
4791 | CLEAR_STR | |
4792 | BGP_STR | |
4793 | "Address family\n" | |
4794 | "Clear all members of peer-group\n" | |
4795 | "BGP peer-group name\n" | |
4796 | "Soft reconfig outbound update\n") | |
4797 | ||
4798 | DEFUN (clear_ip_bgp_external_soft_out, | |
4799 | clear_ip_bgp_external_soft_out_cmd, | |
4800 | "clear ip bgp external soft out", | |
4801 | CLEAR_STR | |
4802 | IP_STR | |
4803 | BGP_STR | |
4804 | "Clear all external peers\n" | |
4805 | "Soft reconfig\n" | |
4806 | "Soft reconfig outbound update\n") | |
4807 | { | |
4808 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
4809 | BGP_CLEAR_SOFT_OUT, NULL); | |
4810 | } | |
4811 | ||
4812 | ALIAS (clear_ip_bgp_external_soft_out, | |
4813 | clear_ip_bgp_external_out_cmd, | |
4814 | "clear ip bgp external out", | |
4815 | CLEAR_STR | |
4816 | IP_STR | |
4817 | BGP_STR | |
4818 | "Clear all external peers\n" | |
4819 | "Soft reconfig outbound update\n") | |
4820 | ||
4821 | DEFUN (clear_ip_bgp_external_ipv4_soft_out, | |
4822 | clear_ip_bgp_external_ipv4_soft_out_cmd, | |
4823 | "clear ip bgp external ipv4 (unicast|multicast) soft out", | |
4824 | CLEAR_STR | |
4825 | IP_STR | |
4826 | BGP_STR | |
4827 | "Clear all external peers\n" | |
4828 | "Address family\n" | |
4829 | "Address Family modifier\n" | |
4830 | "Address Family modifier\n" | |
4831 | "Soft reconfig\n" | |
4832 | "Soft reconfig outbound update\n") | |
4833 | { | |
4834 | if (strncmp (argv[0], "m", 1) == 0) | |
4835 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
4836 | BGP_CLEAR_SOFT_OUT, NULL); | |
4837 | ||
4838 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
4839 | BGP_CLEAR_SOFT_OUT, NULL); | |
4840 | } | |
4841 | ||
4842 | ALIAS (clear_ip_bgp_external_ipv4_soft_out, | |
4843 | clear_ip_bgp_external_ipv4_out_cmd, | |
4844 | "clear ip bgp external ipv4 (unicast|multicast) out", | |
4845 | CLEAR_STR | |
4846 | IP_STR | |
4847 | BGP_STR | |
4848 | "Clear all external peers\n" | |
4849 | "Address family\n" | |
4850 | "Address Family modifier\n" | |
4851 | "Address Family modifier\n" | |
4852 | "Soft reconfig outbound update\n") | |
4853 | ||
4854 | DEFUN (clear_bgp_external_soft_out, | |
4855 | clear_bgp_external_soft_out_cmd, | |
4856 | "clear bgp external soft out", | |
4857 | CLEAR_STR | |
4858 | BGP_STR | |
4859 | "Clear all external peers\n" | |
4860 | "Soft reconfig\n" | |
4861 | "Soft reconfig outbound update\n") | |
4862 | { | |
4863 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
4864 | BGP_CLEAR_SOFT_OUT, NULL); | |
4865 | } | |
4866 | ||
4867 | ALIAS (clear_bgp_external_soft_out, | |
4868 | clear_bgp_ipv6_external_soft_out_cmd, | |
4869 | "clear bgp ipv6 external soft out", | |
4870 | CLEAR_STR | |
4871 | BGP_STR | |
4872 | "Address family\n" | |
4873 | "Clear all external peers\n" | |
4874 | "Soft reconfig\n" | |
4875 | "Soft reconfig outbound update\n") | |
4876 | ||
4877 | ALIAS (clear_bgp_external_soft_out, | |
4878 | clear_bgp_external_out_cmd, | |
4879 | "clear bgp external out", | |
4880 | CLEAR_STR | |
4881 | BGP_STR | |
4882 | "Clear all external peers\n" | |
4883 | "Soft reconfig outbound update\n") | |
4884 | ||
4885 | ALIAS (clear_bgp_external_soft_out, | |
4886 | clear_bgp_ipv6_external_out_cmd, | |
4887 | "clear bgp ipv6 external WORD out", | |
4888 | CLEAR_STR | |
4889 | BGP_STR | |
4890 | "Address family\n" | |
4891 | "Clear all external peers\n" | |
4892 | "Soft reconfig outbound update\n") | |
4893 | ||
4894 | DEFUN (clear_ip_bgp_as_soft_out, | |
4895 | clear_ip_bgp_as_soft_out_cmd, | |
320da874 | 4896 | "clear ip bgp " CMD_AS_RANGE " soft out", |
718e3744 | 4897 | CLEAR_STR |
4898 | IP_STR | |
4899 | BGP_STR | |
4900 | "Clear peers with the AS number\n" | |
4901 | "Soft reconfig\n" | |
4902 | "Soft reconfig outbound update\n") | |
4903 | { | |
4904 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
4905 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4906 | } | |
4907 | ||
4908 | ALIAS (clear_ip_bgp_as_soft_out, | |
4909 | clear_ip_bgp_as_out_cmd, | |
320da874 | 4910 | "clear ip bgp " CMD_AS_RANGE " out", |
718e3744 | 4911 | CLEAR_STR |
4912 | IP_STR | |
4913 | BGP_STR | |
4914 | "Clear peers with the AS number\n" | |
4915 | "Soft reconfig outbound update\n") | |
4916 | ||
4917 | DEFUN (clear_ip_bgp_as_ipv4_soft_out, | |
4918 | clear_ip_bgp_as_ipv4_soft_out_cmd, | |
320da874 | 4919 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", |
718e3744 | 4920 | CLEAR_STR |
4921 | IP_STR | |
4922 | BGP_STR | |
4923 | "Clear peers with the AS number\n" | |
4924 | "Address family\n" | |
4925 | "Address Family modifier\n" | |
4926 | "Address Family modifier\n" | |
4927 | "Soft reconfig\n" | |
4928 | "Soft reconfig outbound update\n") | |
4929 | { | |
4930 | if (strncmp (argv[1], "m", 1) == 0) | |
4931 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
4932 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4933 | ||
4934 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
4935 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4936 | } | |
4937 | ||
4938 | ALIAS (clear_ip_bgp_as_ipv4_soft_out, | |
4939 | clear_ip_bgp_as_ipv4_out_cmd, | |
320da874 | 4940 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", |
718e3744 | 4941 | CLEAR_STR |
4942 | IP_STR | |
4943 | BGP_STR | |
4944 | "Clear peers with the AS number\n" | |
4945 | "Address family\n" | |
4946 | "Address Family modifier\n" | |
4947 | "Address Family modifier\n" | |
4948 | "Soft reconfig outbound update\n") | |
4949 | ||
4950 | DEFUN (clear_ip_bgp_as_vpnv4_soft_out, | |
4951 | clear_ip_bgp_as_vpnv4_soft_out_cmd, | |
320da874 | 4952 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", |
718e3744 | 4953 | CLEAR_STR |
4954 | IP_STR | |
4955 | BGP_STR | |
4956 | "Clear peers with the AS number\n" | |
4957 | "Address family\n" | |
4958 | "Address Family modifier\n" | |
4959 | "Soft reconfig\n" | |
4960 | "Soft reconfig outbound update\n") | |
4961 | { | |
4962 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
4963 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4964 | } | |
4965 | ||
4966 | ALIAS (clear_ip_bgp_as_vpnv4_soft_out, | |
4967 | clear_ip_bgp_as_vpnv4_out_cmd, | |
320da874 | 4968 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", |
718e3744 | 4969 | CLEAR_STR |
4970 | IP_STR | |
4971 | BGP_STR | |
4972 | "Clear peers with the AS number\n" | |
4973 | "Address family\n" | |
4974 | "Address Family modifier\n" | |
4975 | "Soft reconfig outbound update\n") | |
4976 | ||
4977 | DEFUN (clear_bgp_as_soft_out, | |
4978 | clear_bgp_as_soft_out_cmd, | |
320da874 | 4979 | "clear bgp " CMD_AS_RANGE " soft out", |
718e3744 | 4980 | CLEAR_STR |
4981 | BGP_STR | |
4982 | "Clear peers with the AS number\n" | |
4983 | "Soft reconfig\n" | |
4984 | "Soft reconfig outbound update\n") | |
4985 | { | |
4986 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
4987 | BGP_CLEAR_SOFT_OUT, argv[0]); | |
4988 | } | |
4989 | ||
4990 | ALIAS (clear_bgp_as_soft_out, | |
4991 | clear_bgp_ipv6_as_soft_out_cmd, | |
320da874 | 4992 | "clear bgp ipv6 " CMD_AS_RANGE " soft out", |
718e3744 | 4993 | CLEAR_STR |
4994 | BGP_STR | |
4995 | "Address family\n" | |
4996 | "Clear peers with the AS number\n" | |
4997 | "Soft reconfig\n" | |
4998 | "Soft reconfig outbound update\n") | |
4999 | ||
5000 | ALIAS (clear_bgp_as_soft_out, | |
5001 | clear_bgp_as_out_cmd, | |
320da874 | 5002 | "clear bgp " CMD_AS_RANGE " out", |
718e3744 | 5003 | CLEAR_STR |
5004 | BGP_STR | |
5005 | "Clear peers with the AS number\n" | |
5006 | "Soft reconfig outbound update\n") | |
5007 | ||
5008 | ALIAS (clear_bgp_as_soft_out, | |
5009 | clear_bgp_ipv6_as_out_cmd, | |
320da874 | 5010 | "clear bgp ipv6 " CMD_AS_RANGE " out", |
718e3744 | 5011 | CLEAR_STR |
5012 | BGP_STR | |
5013 | "Address family\n" | |
5014 | "Clear peers with the AS number\n" | |
5015 | "Soft reconfig outbound update\n") | |
5016 | \f | |
5017 | /* Inbound soft-reconfiguration */ | |
5018 | DEFUN (clear_ip_bgp_all_soft_in, | |
5019 | clear_ip_bgp_all_soft_in_cmd, | |
5020 | "clear ip bgp * soft in", | |
5021 | CLEAR_STR | |
5022 | IP_STR | |
5023 | BGP_STR | |
5024 | "Clear all peers\n" | |
5025 | "Soft reconfig\n" | |
5026 | "Soft reconfig inbound update\n") | |
5027 | { | |
5028 | if (argc == 1) | |
5029 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5030 | BGP_CLEAR_SOFT_IN, NULL); | |
5031 | ||
5032 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5033 | BGP_CLEAR_SOFT_IN, NULL); | |
5034 | } | |
5035 | ||
5036 | ALIAS (clear_ip_bgp_all_soft_in, | |
5037 | clear_ip_bgp_instance_all_soft_in_cmd, | |
5038 | "clear ip bgp view WORD * soft in", | |
5039 | CLEAR_STR | |
5040 | IP_STR | |
5041 | BGP_STR | |
5042 | "BGP view\n" | |
5043 | "view name\n" | |
5044 | "Clear all peers\n" | |
5045 | "Soft reconfig\n" | |
5046 | "Soft reconfig inbound update\n") | |
5047 | ||
5048 | ALIAS (clear_ip_bgp_all_soft_in, | |
5049 | clear_ip_bgp_all_in_cmd, | |
5050 | "clear ip bgp * in", | |
5051 | CLEAR_STR | |
5052 | IP_STR | |
5053 | BGP_STR | |
5054 | "Clear all peers\n" | |
5055 | "Soft reconfig inbound update\n") | |
5056 | ||
5057 | DEFUN (clear_ip_bgp_all_in_prefix_filter, | |
5058 | clear_ip_bgp_all_in_prefix_filter_cmd, | |
5059 | "clear ip bgp * in prefix-filter", | |
5060 | CLEAR_STR | |
5061 | IP_STR | |
5062 | BGP_STR | |
5063 | "Clear all peers\n" | |
5064 | "Soft reconfig inbound update\n" | |
5065 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5066 | { | |
5067 | if (argc== 1) | |
5068 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5069 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5070 | ||
5071 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5072 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5073 | } | |
5074 | ||
5075 | ALIAS (clear_ip_bgp_all_in_prefix_filter, | |
5076 | clear_ip_bgp_instance_all_in_prefix_filter_cmd, | |
5077 | "clear ip bgp view WORD * in prefix-filter", | |
5078 | CLEAR_STR | |
5079 | IP_STR | |
5080 | BGP_STR | |
5081 | "BGP view\n" | |
5082 | "view name\n" | |
5083 | "Clear all peers\n" | |
5084 | "Soft reconfig inbound update\n" | |
5085 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5086 | ||
5087 | ||
5088 | DEFUN (clear_ip_bgp_all_ipv4_soft_in, | |
5089 | clear_ip_bgp_all_ipv4_soft_in_cmd, | |
5090 | "clear ip bgp * ipv4 (unicast|multicast) soft in", | |
5091 | CLEAR_STR | |
5092 | IP_STR | |
5093 | BGP_STR | |
5094 | "Clear all peers\n" | |
5095 | "Address family\n" | |
5096 | "Address Family modifier\n" | |
5097 | "Address Family modifier\n" | |
5098 | "Soft reconfig\n" | |
5099 | "Soft reconfig inbound update\n") | |
5100 | { | |
5101 | if (strncmp (argv[0], "m", 1) == 0) | |
5102 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
5103 | BGP_CLEAR_SOFT_IN, NULL); | |
5104 | ||
5105 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5106 | BGP_CLEAR_SOFT_IN, NULL); | |
5107 | } | |
5108 | ||
5109 | ALIAS (clear_ip_bgp_all_ipv4_soft_in, | |
5110 | clear_ip_bgp_all_ipv4_in_cmd, | |
5111 | "clear ip bgp * ipv4 (unicast|multicast) in", | |
5112 | CLEAR_STR | |
5113 | IP_STR | |
5114 | BGP_STR | |
5115 | "Clear all peers\n" | |
5116 | "Address family\n" | |
5117 | "Address Family modifier\n" | |
5118 | "Address Family modifier\n" | |
5119 | "Soft reconfig inbound update\n") | |
5120 | ||
5121 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in, | |
5122 | clear_ip_bgp_instance_all_ipv4_soft_in_cmd, | |
5123 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in", | |
5124 | CLEAR_STR | |
5125 | IP_STR | |
5126 | BGP_STR | |
5127 | "BGP view\n" | |
5128 | "view name\n" | |
5129 | "Clear all peers\n" | |
5130 | "Address family\n" | |
5131 | "Address Family modifier\n" | |
5132 | "Address Family modifier\n" | |
5133 | "Soft reconfig\n" | |
5134 | "Soft reconfig inbound update\n") | |
5135 | { | |
5136 | if (strncmp (argv[1], "m", 1) == 0) | |
5137 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
5138 | BGP_CLEAR_SOFT_IN, NULL); | |
5139 | ||
5140 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5141 | BGP_CLEAR_SOFT_IN, NULL); | |
5142 | } | |
5143 | ||
5144 | DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter, | |
5145 | clear_ip_bgp_all_ipv4_in_prefix_filter_cmd, | |
5146 | "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter", | |
5147 | CLEAR_STR | |
5148 | IP_STR | |
5149 | BGP_STR | |
5150 | "Clear all peers\n" | |
5151 | "Address family\n" | |
5152 | "Address Family modifier\n" | |
5153 | "Address Family modifier\n" | |
5154 | "Soft reconfig inbound update\n" | |
5155 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5156 | { | |
5157 | if (strncmp (argv[0], "m", 1) == 0) | |
5158 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
5159 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5160 | ||
5161 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5162 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5163 | } | |
5164 | ||
5165 | DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter, | |
5166 | clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd, | |
5167 | "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter", | |
5168 | CLEAR_STR | |
5169 | IP_STR | |
5170 | BGP_STR | |
5171 | "Clear all peers\n" | |
5172 | "Address family\n" | |
5173 | "Address Family modifier\n" | |
5174 | "Address Family modifier\n" | |
5175 | "Soft reconfig inbound update\n" | |
5176 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5177 | { | |
5178 | if (strncmp (argv[1], "m", 1) == 0) | |
5179 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all, | |
5180 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5181 | ||
5182 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5183 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5184 | } | |
5185 | ||
5186 | DEFUN (clear_ip_bgp_all_vpnv4_soft_in, | |
5187 | clear_ip_bgp_all_vpnv4_soft_in_cmd, | |
5188 | "clear ip bgp * vpnv4 unicast soft in", | |
5189 | CLEAR_STR | |
5190 | IP_STR | |
5191 | BGP_STR | |
5192 | "Clear all peers\n" | |
5193 | "Address family\n" | |
5194 | "Address Family Modifier\n" | |
5195 | "Soft reconfig\n" | |
5196 | "Soft reconfig inbound update\n") | |
5197 | { | |
5198 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
5199 | BGP_CLEAR_SOFT_IN, NULL); | |
5200 | } | |
5201 | ||
5202 | ALIAS (clear_ip_bgp_all_vpnv4_soft_in, | |
5203 | clear_ip_bgp_all_vpnv4_in_cmd, | |
5204 | "clear ip bgp * vpnv4 unicast in", | |
5205 | CLEAR_STR | |
5206 | IP_STR | |
5207 | BGP_STR | |
5208 | "Clear all peers\n" | |
5209 | "Address family\n" | |
5210 | "Address Family Modifier\n" | |
5211 | "Soft reconfig inbound update\n") | |
5212 | ||
5213 | DEFUN (clear_bgp_all_soft_in, | |
5214 | clear_bgp_all_soft_in_cmd, | |
5215 | "clear bgp * soft in", | |
5216 | CLEAR_STR | |
5217 | BGP_STR | |
5218 | "Clear all peers\n" | |
5219 | "Soft reconfig\n" | |
5220 | "Soft reconfig inbound update\n") | |
5221 | { | |
5222 | if (argc == 1) | |
5223 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
5224 | BGP_CLEAR_SOFT_IN, NULL); | |
5225 | ||
5226 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
5227 | BGP_CLEAR_SOFT_IN, NULL); | |
5228 | } | |
5229 | ||
5230 | ALIAS (clear_bgp_all_soft_in, | |
5231 | clear_bgp_instance_all_soft_in_cmd, | |
5232 | "clear bgp view WORD * soft in", | |
5233 | CLEAR_STR | |
5234 | BGP_STR | |
5235 | "BGP view\n" | |
5236 | "view name\n" | |
5237 | "Clear all peers\n" | |
5238 | "Soft reconfig\n" | |
5239 | "Soft reconfig inbound update\n") | |
5240 | ||
5241 | ALIAS (clear_bgp_all_soft_in, | |
5242 | clear_bgp_ipv6_all_soft_in_cmd, | |
5243 | "clear bgp ipv6 * soft in", | |
5244 | CLEAR_STR | |
5245 | BGP_STR | |
5246 | "Address family\n" | |
5247 | "Clear all peers\n" | |
5248 | "Soft reconfig\n" | |
5249 | "Soft reconfig inbound update\n") | |
5250 | ||
5251 | ALIAS (clear_bgp_all_soft_in, | |
5252 | clear_bgp_all_in_cmd, | |
5253 | "clear bgp * in", | |
5254 | CLEAR_STR | |
5255 | BGP_STR | |
5256 | "Clear all peers\n" | |
5257 | "Soft reconfig inbound update\n") | |
5258 | ||
5259 | ALIAS (clear_bgp_all_soft_in, | |
5260 | clear_bgp_ipv6_all_in_cmd, | |
5261 | "clear bgp ipv6 * in", | |
5262 | CLEAR_STR | |
5263 | BGP_STR | |
5264 | "Address family\n" | |
5265 | "Clear all peers\n" | |
5266 | "Soft reconfig inbound update\n") | |
5267 | ||
5268 | DEFUN (clear_bgp_all_in_prefix_filter, | |
5269 | clear_bgp_all_in_prefix_filter_cmd, | |
5270 | "clear bgp * in prefix-filter", | |
5271 | CLEAR_STR | |
5272 | BGP_STR | |
5273 | "Clear all peers\n" | |
5274 | "Soft reconfig inbound update\n" | |
5275 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5276 | { | |
5277 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
5278 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5279 | } | |
5280 | ||
5281 | ALIAS (clear_bgp_all_in_prefix_filter, | |
5282 | clear_bgp_ipv6_all_in_prefix_filter_cmd, | |
5283 | "clear bgp ipv6 * in prefix-filter", | |
5284 | CLEAR_STR | |
5285 | BGP_STR | |
5286 | "Address family\n" | |
5287 | "Clear all peers\n" | |
5288 | "Soft reconfig inbound update\n" | |
5289 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5290 | ||
5291 | DEFUN (clear_ip_bgp_peer_soft_in, | |
5292 | clear_ip_bgp_peer_soft_in_cmd, | |
5293 | "clear ip bgp A.B.C.D soft in", | |
5294 | CLEAR_STR | |
5295 | IP_STR | |
5296 | BGP_STR | |
5297 | "BGP neighbor address to clear\n" | |
5298 | "Soft reconfig\n" | |
5299 | "Soft reconfig inbound update\n") | |
5300 | { | |
5301 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5302 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5303 | } | |
5304 | ||
5305 | ALIAS (clear_ip_bgp_peer_soft_in, | |
5306 | clear_ip_bgp_peer_in_cmd, | |
5307 | "clear ip bgp A.B.C.D in", | |
5308 | CLEAR_STR | |
5309 | IP_STR | |
5310 | BGP_STR | |
5311 | "BGP neighbor address to clear\n" | |
5312 | "Soft reconfig inbound update\n") | |
5313 | ||
5314 | DEFUN (clear_ip_bgp_peer_in_prefix_filter, | |
5315 | clear_ip_bgp_peer_in_prefix_filter_cmd, | |
5316 | "clear ip bgp A.B.C.D in prefix-filter", | |
5317 | CLEAR_STR | |
5318 | IP_STR | |
5319 | BGP_STR | |
5320 | "BGP neighbor address to clear\n" | |
5321 | "Soft reconfig inbound update\n" | |
5322 | "Push out the existing ORF prefix-list\n") | |
5323 | { | |
5324 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5325 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5326 | } | |
5327 | ||
5328 | DEFUN (clear_ip_bgp_peer_ipv4_soft_in, | |
5329 | clear_ip_bgp_peer_ipv4_soft_in_cmd, | |
5330 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in", | |
5331 | CLEAR_STR | |
5332 | IP_STR | |
5333 | BGP_STR | |
5334 | "BGP neighbor address to clear\n" | |
5335 | "Address family\n" | |
5336 | "Address Family modifier\n" | |
5337 | "Address Family modifier\n" | |
5338 | "Soft reconfig\n" | |
5339 | "Soft reconfig inbound update\n") | |
5340 | { | |
5341 | if (strncmp (argv[1], "m", 1) == 0) | |
5342 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
5343 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5344 | ||
5345 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5346 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5347 | } | |
5348 | ||
5349 | ALIAS (clear_ip_bgp_peer_ipv4_soft_in, | |
5350 | clear_ip_bgp_peer_ipv4_in_cmd, | |
5351 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in", | |
5352 | CLEAR_STR | |
5353 | IP_STR | |
5354 | BGP_STR | |
5355 | "BGP neighbor address to clear\n" | |
5356 | "Address family\n" | |
5357 | "Address Family modifier\n" | |
5358 | "Address Family modifier\n" | |
5359 | "Soft reconfig inbound update\n") | |
5360 | ||
5361 | DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter, | |
5362 | clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd, | |
5363 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter", | |
5364 | CLEAR_STR | |
5365 | IP_STR | |
5366 | BGP_STR | |
5367 | "BGP neighbor address to clear\n" | |
5368 | "Address family\n" | |
5369 | "Address Family modifier\n" | |
5370 | "Address Family modifier\n" | |
5371 | "Soft reconfig inbound update\n" | |
5372 | "Push out the existing ORF prefix-list\n") | |
5373 | { | |
5374 | if (strncmp (argv[1], "m", 1) == 0) | |
5375 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
5376 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5377 | ||
5378 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
5379 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5380 | } | |
5381 | ||
5382 | DEFUN (clear_ip_bgp_peer_vpnv4_soft_in, | |
5383 | clear_ip_bgp_peer_vpnv4_soft_in_cmd, | |
5384 | "clear ip bgp A.B.C.D vpnv4 unicast soft in", | |
5385 | CLEAR_STR | |
5386 | IP_STR | |
5387 | BGP_STR | |
5388 | "BGP neighbor address to clear\n" | |
5389 | "Address family\n" | |
5390 | "Address Family Modifier\n" | |
5391 | "Soft reconfig\n" | |
5392 | "Soft reconfig inbound update\n") | |
5393 | { | |
5394 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
5395 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5396 | } | |
5397 | ||
5398 | ALIAS (clear_ip_bgp_peer_vpnv4_soft_in, | |
5399 | clear_ip_bgp_peer_vpnv4_in_cmd, | |
5400 | "clear ip bgp A.B.C.D vpnv4 unicast in", | |
5401 | CLEAR_STR | |
5402 | IP_STR | |
5403 | BGP_STR | |
5404 | "BGP neighbor address to clear\n" | |
5405 | "Address family\n" | |
5406 | "Address Family Modifier\n" | |
5407 | "Soft reconfig inbound update\n") | |
5408 | ||
5409 | DEFUN (clear_bgp_peer_soft_in, | |
5410 | clear_bgp_peer_soft_in_cmd, | |
5411 | "clear bgp (A.B.C.D|X:X::X:X) soft in", | |
5412 | CLEAR_STR | |
5413 | BGP_STR | |
5414 | "BGP neighbor address to clear\n" | |
5415 | "BGP IPv6 neighbor to clear\n" | |
5416 | "Soft reconfig\n" | |
5417 | "Soft reconfig inbound update\n") | |
5418 | { | |
5419 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
5420 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5421 | } | |
5422 | ||
5423 | ALIAS (clear_bgp_peer_soft_in, | |
5424 | clear_bgp_ipv6_peer_soft_in_cmd, | |
5425 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in", | |
5426 | CLEAR_STR | |
5427 | BGP_STR | |
5428 | "Address family\n" | |
5429 | "BGP neighbor address to clear\n" | |
5430 | "BGP IPv6 neighbor to clear\n" | |
5431 | "Soft reconfig\n" | |
5432 | "Soft reconfig inbound update\n") | |
5433 | ||
5434 | ALIAS (clear_bgp_peer_soft_in, | |
5435 | clear_bgp_peer_in_cmd, | |
5436 | "clear bgp (A.B.C.D|X:X::X:X) in", | |
5437 | CLEAR_STR | |
5438 | BGP_STR | |
5439 | "BGP neighbor address to clear\n" | |
5440 | "BGP IPv6 neighbor to clear\n" | |
5441 | "Soft reconfig inbound update\n") | |
5442 | ||
5443 | ALIAS (clear_bgp_peer_soft_in, | |
5444 | clear_bgp_ipv6_peer_in_cmd, | |
5445 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in", | |
5446 | CLEAR_STR | |
5447 | BGP_STR | |
5448 | "Address family\n" | |
5449 | "BGP neighbor address to clear\n" | |
5450 | "BGP IPv6 neighbor to clear\n" | |
5451 | "Soft reconfig inbound update\n") | |
5452 | ||
5453 | DEFUN (clear_bgp_peer_in_prefix_filter, | |
5454 | clear_bgp_peer_in_prefix_filter_cmd, | |
5455 | "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter", | |
5456 | CLEAR_STR | |
5457 | BGP_STR | |
5458 | "BGP neighbor address to clear\n" | |
5459 | "BGP IPv6 neighbor to clear\n" | |
5460 | "Soft reconfig inbound update\n" | |
5461 | "Push out the existing ORF prefix-list\n") | |
5462 | { | |
5463 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
5464 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5465 | } | |
5466 | ||
5467 | ALIAS (clear_bgp_peer_in_prefix_filter, | |
5468 | clear_bgp_ipv6_peer_in_prefix_filter_cmd, | |
5469 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter", | |
5470 | CLEAR_STR | |
5471 | BGP_STR | |
5472 | "Address family\n" | |
5473 | "BGP neighbor address to clear\n" | |
5474 | "BGP IPv6 neighbor to clear\n" | |
5475 | "Soft reconfig inbound update\n" | |
5476 | "Push out the existing ORF prefix-list\n") | |
5477 | ||
5478 | DEFUN (clear_ip_bgp_peer_group_soft_in, | |
5479 | clear_ip_bgp_peer_group_soft_in_cmd, | |
5480 | "clear ip bgp peer-group WORD soft in", | |
5481 | CLEAR_STR | |
5482 | IP_STR | |
5483 | BGP_STR | |
5484 | "Clear all members of peer-group\n" | |
5485 | "BGP peer-group name\n" | |
5486 | "Soft reconfig\n" | |
5487 | "Soft reconfig inbound update\n") | |
5488 | { | |
5489 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5490 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5491 | } | |
5492 | ||
5493 | ALIAS (clear_ip_bgp_peer_group_soft_in, | |
5494 | clear_ip_bgp_peer_group_in_cmd, | |
5495 | "clear ip bgp peer-group WORD in", | |
5496 | CLEAR_STR | |
5497 | IP_STR | |
5498 | BGP_STR | |
5499 | "Clear all members of peer-group\n" | |
5500 | "BGP peer-group name\n" | |
5501 | "Soft reconfig inbound update\n") | |
5502 | ||
5503 | DEFUN (clear_ip_bgp_peer_group_in_prefix_filter, | |
5504 | clear_ip_bgp_peer_group_in_prefix_filter_cmd, | |
5505 | "clear ip bgp peer-group WORD in prefix-filter", | |
5506 | CLEAR_STR | |
5507 | IP_STR | |
5508 | BGP_STR | |
5509 | "Clear all members of peer-group\n" | |
5510 | "BGP peer-group name\n" | |
5511 | "Soft reconfig inbound update\n" | |
5512 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5513 | { | |
5514 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5515 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5516 | } | |
5517 | ||
5518 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in, | |
5519 | clear_ip_bgp_peer_group_ipv4_soft_in_cmd, | |
5520 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in", | |
5521 | CLEAR_STR | |
5522 | IP_STR | |
5523 | BGP_STR | |
5524 | "Clear all members of peer-group\n" | |
5525 | "BGP peer-group name\n" | |
5526 | "Address family\n" | |
5527 | "Address Family modifier\n" | |
5528 | "Address Family modifier\n" | |
5529 | "Soft reconfig\n" | |
5530 | "Soft reconfig inbound update\n") | |
5531 | { | |
5532 | if (strncmp (argv[1], "m", 1) == 0) | |
5533 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
5534 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5535 | ||
5536 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5537 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5538 | } | |
5539 | ||
5540 | ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in, | |
5541 | clear_ip_bgp_peer_group_ipv4_in_cmd, | |
5542 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in", | |
5543 | CLEAR_STR | |
5544 | IP_STR | |
5545 | BGP_STR | |
5546 | "Clear all members of peer-group\n" | |
5547 | "BGP peer-group name\n" | |
5548 | "Address family\n" | |
5549 | "Address Family modifier\n" | |
5550 | "Address Family modifier\n" | |
5551 | "Soft reconfig inbound update\n") | |
5552 | ||
5553 | DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter, | |
5554 | clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd, | |
5555 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter", | |
5556 | CLEAR_STR | |
5557 | IP_STR | |
5558 | BGP_STR | |
5559 | "Clear all members of peer-group\n" | |
5560 | "BGP peer-group name\n" | |
5561 | "Address family\n" | |
5562 | "Address Family modifier\n" | |
5563 | "Address Family modifier\n" | |
5564 | "Soft reconfig inbound update\n" | |
5565 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5566 | { | |
5567 | if (strncmp (argv[1], "m", 1) == 0) | |
5568 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
5569 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5570 | ||
5571 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
5572 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5573 | } | |
5574 | ||
5575 | DEFUN (clear_bgp_peer_group_soft_in, | |
5576 | clear_bgp_peer_group_soft_in_cmd, | |
5577 | "clear bgp peer-group WORD soft in", | |
5578 | CLEAR_STR | |
5579 | BGP_STR | |
5580 | "Clear all members of peer-group\n" | |
5581 | "BGP peer-group name\n" | |
5582 | "Soft reconfig\n" | |
5583 | "Soft reconfig inbound update\n") | |
5584 | { | |
5585 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
5586 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5587 | } | |
5588 | ||
5589 | ALIAS (clear_bgp_peer_group_soft_in, | |
5590 | clear_bgp_ipv6_peer_group_soft_in_cmd, | |
5591 | "clear bgp ipv6 peer-group WORD soft in", | |
5592 | CLEAR_STR | |
5593 | BGP_STR | |
5594 | "Address family\n" | |
5595 | "Clear all members of peer-group\n" | |
5596 | "BGP peer-group name\n" | |
5597 | "Soft reconfig\n" | |
5598 | "Soft reconfig inbound update\n") | |
5599 | ||
5600 | ALIAS (clear_bgp_peer_group_soft_in, | |
5601 | clear_bgp_peer_group_in_cmd, | |
5602 | "clear bgp peer-group WORD in", | |
5603 | CLEAR_STR | |
5604 | BGP_STR | |
5605 | "Clear all members of peer-group\n" | |
5606 | "BGP peer-group name\n" | |
5607 | "Soft reconfig inbound update\n") | |
5608 | ||
5609 | ALIAS (clear_bgp_peer_group_soft_in, | |
5610 | clear_bgp_ipv6_peer_group_in_cmd, | |
5611 | "clear bgp ipv6 peer-group WORD in", | |
5612 | CLEAR_STR | |
5613 | BGP_STR | |
5614 | "Address family\n" | |
5615 | "Clear all members of peer-group\n" | |
5616 | "BGP peer-group name\n" | |
5617 | "Soft reconfig inbound update\n") | |
5618 | ||
5619 | DEFUN (clear_bgp_peer_group_in_prefix_filter, | |
5620 | clear_bgp_peer_group_in_prefix_filter_cmd, | |
5621 | "clear bgp peer-group WORD in prefix-filter", | |
5622 | CLEAR_STR | |
5623 | BGP_STR | |
5624 | "Clear all members of peer-group\n" | |
5625 | "BGP peer-group name\n" | |
5626 | "Soft reconfig inbound update\n" | |
5627 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5628 | { | |
5629 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
5630 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5631 | } | |
5632 | ||
5633 | ALIAS (clear_bgp_peer_group_in_prefix_filter, | |
5634 | clear_bgp_ipv6_peer_group_in_prefix_filter_cmd, | |
5635 | "clear bgp ipv6 peer-group WORD in prefix-filter", | |
5636 | CLEAR_STR | |
5637 | BGP_STR | |
5638 | "Address family\n" | |
5639 | "Clear all members of peer-group\n" | |
5640 | "BGP peer-group name\n" | |
5641 | "Soft reconfig inbound update\n" | |
5642 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5643 | ||
5644 | DEFUN (clear_ip_bgp_external_soft_in, | |
5645 | clear_ip_bgp_external_soft_in_cmd, | |
5646 | "clear ip bgp external soft in", | |
5647 | CLEAR_STR | |
5648 | IP_STR | |
5649 | BGP_STR | |
5650 | "Clear all external peers\n" | |
5651 | "Soft reconfig\n" | |
5652 | "Soft reconfig inbound update\n") | |
5653 | { | |
5654 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5655 | BGP_CLEAR_SOFT_IN, NULL); | |
5656 | } | |
5657 | ||
5658 | ALIAS (clear_ip_bgp_external_soft_in, | |
5659 | clear_ip_bgp_external_in_cmd, | |
5660 | "clear ip bgp external in", | |
5661 | CLEAR_STR | |
5662 | IP_STR | |
5663 | BGP_STR | |
5664 | "Clear all external peers\n" | |
5665 | "Soft reconfig inbound update\n") | |
5666 | ||
5667 | DEFUN (clear_ip_bgp_external_in_prefix_filter, | |
5668 | clear_ip_bgp_external_in_prefix_filter_cmd, | |
5669 | "clear ip bgp external in prefix-filter", | |
5670 | CLEAR_STR | |
5671 | IP_STR | |
5672 | BGP_STR | |
5673 | "Clear all external peers\n" | |
5674 | "Soft reconfig inbound update\n" | |
5675 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5676 | { | |
5677 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5678 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5679 | } | |
5680 | ||
5681 | DEFUN (clear_ip_bgp_external_ipv4_soft_in, | |
5682 | clear_ip_bgp_external_ipv4_soft_in_cmd, | |
5683 | "clear ip bgp external ipv4 (unicast|multicast) soft in", | |
5684 | CLEAR_STR | |
5685 | IP_STR | |
5686 | BGP_STR | |
5687 | "Clear all external peers\n" | |
5688 | "Address family\n" | |
5689 | "Address Family modifier\n" | |
5690 | "Address Family modifier\n" | |
5691 | "Soft reconfig\n" | |
5692 | "Soft reconfig inbound update\n") | |
5693 | { | |
5694 | if (strncmp (argv[0], "m", 1) == 0) | |
5695 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
5696 | BGP_CLEAR_SOFT_IN, NULL); | |
5697 | ||
5698 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5699 | BGP_CLEAR_SOFT_IN, NULL); | |
5700 | } | |
5701 | ||
5702 | ALIAS (clear_ip_bgp_external_ipv4_soft_in, | |
5703 | clear_ip_bgp_external_ipv4_in_cmd, | |
5704 | "clear ip bgp external ipv4 (unicast|multicast) in", | |
5705 | CLEAR_STR | |
5706 | IP_STR | |
5707 | BGP_STR | |
5708 | "Clear all external peers\n" | |
5709 | "Address family\n" | |
5710 | "Address Family modifier\n" | |
5711 | "Address Family modifier\n" | |
5712 | "Soft reconfig inbound update\n") | |
5713 | ||
5714 | DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter, | |
5715 | clear_ip_bgp_external_ipv4_in_prefix_filter_cmd, | |
5716 | "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter", | |
5717 | CLEAR_STR | |
5718 | IP_STR | |
5719 | BGP_STR | |
5720 | "Clear all external peers\n" | |
5721 | "Address family\n" | |
5722 | "Address Family modifier\n" | |
5723 | "Address Family modifier\n" | |
5724 | "Soft reconfig inbound update\n" | |
5725 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5726 | { | |
5727 | if (strncmp (argv[0], "m", 1) == 0) | |
5728 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
5729 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5730 | ||
5731 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
5732 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5733 | } | |
5734 | ||
5735 | DEFUN (clear_bgp_external_soft_in, | |
5736 | clear_bgp_external_soft_in_cmd, | |
5737 | "clear bgp external soft in", | |
5738 | CLEAR_STR | |
5739 | BGP_STR | |
5740 | "Clear all external peers\n" | |
5741 | "Soft reconfig\n" | |
5742 | "Soft reconfig inbound update\n") | |
5743 | { | |
5744 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
5745 | BGP_CLEAR_SOFT_IN, NULL); | |
5746 | } | |
5747 | ||
5748 | ALIAS (clear_bgp_external_soft_in, | |
5749 | clear_bgp_ipv6_external_soft_in_cmd, | |
5750 | "clear bgp ipv6 external soft in", | |
5751 | CLEAR_STR | |
5752 | BGP_STR | |
5753 | "Address family\n" | |
5754 | "Clear all external peers\n" | |
5755 | "Soft reconfig\n" | |
5756 | "Soft reconfig inbound update\n") | |
5757 | ||
5758 | ALIAS (clear_bgp_external_soft_in, | |
5759 | clear_bgp_external_in_cmd, | |
5760 | "clear bgp external in", | |
5761 | CLEAR_STR | |
5762 | BGP_STR | |
5763 | "Clear all external peers\n" | |
5764 | "Soft reconfig inbound update\n") | |
5765 | ||
5766 | ALIAS (clear_bgp_external_soft_in, | |
5767 | clear_bgp_ipv6_external_in_cmd, | |
5768 | "clear bgp ipv6 external WORD in", | |
5769 | CLEAR_STR | |
5770 | BGP_STR | |
5771 | "Address family\n" | |
5772 | "Clear all external peers\n" | |
5773 | "Soft reconfig inbound update\n") | |
5774 | ||
5775 | DEFUN (clear_bgp_external_in_prefix_filter, | |
5776 | clear_bgp_external_in_prefix_filter_cmd, | |
5777 | "clear bgp external in prefix-filter", | |
5778 | CLEAR_STR | |
5779 | BGP_STR | |
5780 | "Clear all external peers\n" | |
5781 | "Soft reconfig inbound update\n" | |
5782 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5783 | { | |
5784 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
5785 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL); | |
5786 | } | |
5787 | ||
5788 | ALIAS (clear_bgp_external_in_prefix_filter, | |
5789 | clear_bgp_ipv6_external_in_prefix_filter_cmd, | |
5790 | "clear bgp ipv6 external in prefix-filter", | |
5791 | CLEAR_STR | |
5792 | BGP_STR | |
5793 | "Address family\n" | |
5794 | "Clear all external peers\n" | |
5795 | "Soft reconfig inbound update\n" | |
5796 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5797 | ||
5798 | DEFUN (clear_ip_bgp_as_soft_in, | |
5799 | clear_ip_bgp_as_soft_in_cmd, | |
320da874 | 5800 | "clear ip bgp " CMD_AS_RANGE " soft in", |
718e3744 | 5801 | CLEAR_STR |
5802 | IP_STR | |
5803 | BGP_STR | |
5804 | "Clear peers with the AS number\n" | |
5805 | "Soft reconfig\n" | |
5806 | "Soft reconfig inbound update\n") | |
5807 | { | |
5808 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
5809 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5810 | } | |
5811 | ||
5812 | ALIAS (clear_ip_bgp_as_soft_in, | |
5813 | clear_ip_bgp_as_in_cmd, | |
320da874 | 5814 | "clear ip bgp " CMD_AS_RANGE " in", |
718e3744 | 5815 | CLEAR_STR |
5816 | IP_STR | |
5817 | BGP_STR | |
5818 | "Clear peers with the AS number\n" | |
5819 | "Soft reconfig inbound update\n") | |
5820 | ||
5821 | DEFUN (clear_ip_bgp_as_in_prefix_filter, | |
5822 | clear_ip_bgp_as_in_prefix_filter_cmd, | |
320da874 | 5823 | "clear ip bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 5824 | CLEAR_STR |
5825 | IP_STR | |
5826 | BGP_STR | |
5827 | "Clear peers with the AS number\n" | |
5828 | "Soft reconfig inbound update\n" | |
5829 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5830 | { | |
5831 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
5832 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5833 | } | |
5834 | ||
5835 | DEFUN (clear_ip_bgp_as_ipv4_soft_in, | |
5836 | clear_ip_bgp_as_ipv4_soft_in_cmd, | |
320da874 | 5837 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", |
718e3744 | 5838 | CLEAR_STR |
5839 | IP_STR | |
5840 | BGP_STR | |
5841 | "Clear peers with the AS number\n" | |
5842 | "Address family\n" | |
5843 | "Address Family modifier\n" | |
5844 | "Address Family modifier\n" | |
5845 | "Soft reconfig\n" | |
5846 | "Soft reconfig inbound update\n") | |
5847 | { | |
5848 | if (strncmp (argv[1], "m", 1) == 0) | |
5849 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
5850 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5851 | ||
5852 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
5853 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5854 | } | |
5855 | ||
5856 | ALIAS (clear_ip_bgp_as_ipv4_soft_in, | |
5857 | clear_ip_bgp_as_ipv4_in_cmd, | |
320da874 | 5858 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", |
718e3744 | 5859 | CLEAR_STR |
5860 | IP_STR | |
5861 | BGP_STR | |
5862 | "Clear peers with the AS number\n" | |
5863 | "Address family\n" | |
5864 | "Address Family modifier\n" | |
5865 | "Address Family modifier\n" | |
5866 | "Soft reconfig inbound update\n") | |
5867 | ||
5868 | DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, | |
5869 | clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, | |
320da874 | 5870 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", |
718e3744 | 5871 | CLEAR_STR |
5872 | IP_STR | |
5873 | BGP_STR | |
5874 | "Clear peers with the AS number\n" | |
5875 | "Address family\n" | |
5876 | "Address Family modifier\n" | |
5877 | "Address Family modifier\n" | |
5878 | "Soft reconfig inbound update\n" | |
5879 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5880 | { | |
5881 | if (strncmp (argv[1], "m", 1) == 0) | |
5882 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
5883 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5884 | ||
5885 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
5886 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5887 | } | |
5888 | ||
5889 | DEFUN (clear_ip_bgp_as_vpnv4_soft_in, | |
5890 | clear_ip_bgp_as_vpnv4_soft_in_cmd, | |
320da874 | 5891 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", |
718e3744 | 5892 | CLEAR_STR |
5893 | IP_STR | |
5894 | BGP_STR | |
5895 | "Clear peers with the AS number\n" | |
5896 | "Address family\n" | |
5897 | "Address Family modifier\n" | |
5898 | "Soft reconfig\n" | |
5899 | "Soft reconfig inbound update\n") | |
5900 | { | |
5901 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
5902 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5903 | } | |
5904 | ||
5905 | ALIAS (clear_ip_bgp_as_vpnv4_soft_in, | |
5906 | clear_ip_bgp_as_vpnv4_in_cmd, | |
320da874 | 5907 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", |
718e3744 | 5908 | CLEAR_STR |
5909 | IP_STR | |
5910 | BGP_STR | |
5911 | "Clear peers with the AS number\n" | |
5912 | "Address family\n" | |
5913 | "Address Family modifier\n" | |
5914 | "Soft reconfig inbound update\n") | |
5915 | ||
5916 | DEFUN (clear_bgp_as_soft_in, | |
5917 | clear_bgp_as_soft_in_cmd, | |
320da874 | 5918 | "clear bgp " CMD_AS_RANGE " soft in", |
718e3744 | 5919 | CLEAR_STR |
5920 | BGP_STR | |
5921 | "Clear peers with the AS number\n" | |
5922 | "Soft reconfig\n" | |
5923 | "Soft reconfig inbound update\n") | |
5924 | { | |
5925 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
5926 | BGP_CLEAR_SOFT_IN, argv[0]); | |
5927 | } | |
5928 | ||
5929 | ALIAS (clear_bgp_as_soft_in, | |
5930 | clear_bgp_ipv6_as_soft_in_cmd, | |
320da874 | 5931 | "clear bgp ipv6 " CMD_AS_RANGE " soft in", |
718e3744 | 5932 | CLEAR_STR |
5933 | BGP_STR | |
5934 | "Address family\n" | |
5935 | "Clear peers with the AS number\n" | |
5936 | "Soft reconfig\n" | |
5937 | "Soft reconfig inbound update\n") | |
5938 | ||
5939 | ALIAS (clear_bgp_as_soft_in, | |
5940 | clear_bgp_as_in_cmd, | |
320da874 | 5941 | "clear bgp " CMD_AS_RANGE " in", |
718e3744 | 5942 | CLEAR_STR |
5943 | BGP_STR | |
5944 | "Clear peers with the AS number\n" | |
5945 | "Soft reconfig inbound update\n") | |
5946 | ||
5947 | ALIAS (clear_bgp_as_soft_in, | |
5948 | clear_bgp_ipv6_as_in_cmd, | |
320da874 | 5949 | "clear bgp ipv6 " CMD_AS_RANGE " in", |
718e3744 | 5950 | CLEAR_STR |
5951 | BGP_STR | |
5952 | "Address family\n" | |
5953 | "Clear peers with the AS number\n" | |
5954 | "Soft reconfig inbound update\n") | |
5955 | ||
5956 | DEFUN (clear_bgp_as_in_prefix_filter, | |
5957 | clear_bgp_as_in_prefix_filter_cmd, | |
320da874 | 5958 | "clear bgp " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 5959 | CLEAR_STR |
5960 | BGP_STR | |
5961 | "Clear peers with the AS number\n" | |
5962 | "Soft reconfig inbound update\n" | |
5963 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5964 | { | |
5965 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
5966 | BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]); | |
5967 | } | |
5968 | ||
5969 | ALIAS (clear_bgp_as_in_prefix_filter, | |
5970 | clear_bgp_ipv6_as_in_prefix_filter_cmd, | |
320da874 | 5971 | "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", |
718e3744 | 5972 | CLEAR_STR |
5973 | BGP_STR | |
5974 | "Address family\n" | |
5975 | "Clear peers with the AS number\n" | |
5976 | "Soft reconfig inbound update\n" | |
5977 | "Push out prefix-list ORF and do inbound soft reconfig\n") | |
5978 | \f | |
5979 | /* Both soft-reconfiguration */ | |
5980 | DEFUN (clear_ip_bgp_all_soft, | |
5981 | clear_ip_bgp_all_soft_cmd, | |
5982 | "clear ip bgp * soft", | |
5983 | CLEAR_STR | |
5984 | IP_STR | |
5985 | BGP_STR | |
5986 | "Clear all peers\n" | |
5987 | "Soft reconfig\n") | |
5988 | { | |
5989 | if (argc == 1) | |
5990 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
5991 | BGP_CLEAR_SOFT_BOTH, NULL); | |
5992 | ||
5993 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
5994 | BGP_CLEAR_SOFT_BOTH, NULL); | |
5995 | } | |
5996 | ||
5997 | ALIAS (clear_ip_bgp_all_soft, | |
5998 | clear_ip_bgp_instance_all_soft_cmd, | |
5999 | "clear ip bgp view WORD * soft", | |
6000 | CLEAR_STR | |
6001 | IP_STR | |
6002 | BGP_STR | |
6003 | "BGP view\n" | |
6004 | "view name\n" | |
6005 | "Clear all peers\n" | |
6006 | "Soft reconfig\n") | |
6007 | ||
6008 | ||
6009 | DEFUN (clear_ip_bgp_all_ipv4_soft, | |
6010 | clear_ip_bgp_all_ipv4_soft_cmd, | |
6011 | "clear ip bgp * ipv4 (unicast|multicast) soft", | |
6012 | CLEAR_STR | |
6013 | IP_STR | |
6014 | BGP_STR | |
6015 | "Clear all peers\n" | |
6016 | "Address family\n" | |
6017 | "Address Family Modifier\n" | |
6018 | "Address Family Modifier\n" | |
6019 | "Soft reconfig\n") | |
6020 | { | |
6021 | if (strncmp (argv[0], "m", 1) == 0) | |
6022 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6023 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6024 | ||
6025 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6026 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6027 | } | |
6028 | ||
6029 | DEFUN (clear_ip_bgp_instance_all_ipv4_soft, | |
6030 | clear_ip_bgp_instance_all_ipv4_soft_cmd, | |
6031 | "clear ip bgp view WORD * ipv4 (unicast|multicast) soft", | |
6032 | CLEAR_STR | |
6033 | IP_STR | |
6034 | BGP_STR | |
6035 | "BGP view\n" | |
6036 | "view name\n" | |
6037 | "Clear all peers\n" | |
6038 | "Address family\n" | |
6039 | "Address Family Modifier\n" | |
6040 | "Address Family Modifier\n" | |
6041 | "Soft reconfig\n") | |
6042 | { | |
6043 | if (strncmp (argv[1], "m", 1) == 0) | |
6044 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, | |
6045 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6046 | ||
6047 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6048 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6049 | } | |
6050 | ||
6051 | DEFUN (clear_ip_bgp_all_vpnv4_soft, | |
6052 | clear_ip_bgp_all_vpnv4_soft_cmd, | |
6053 | "clear ip bgp * vpnv4 unicast soft", | |
6054 | CLEAR_STR | |
6055 | IP_STR | |
6056 | BGP_STR | |
6057 | "Clear all peers\n" | |
6058 | "Address family\n" | |
6059 | "Address Family Modifier\n" | |
6060 | "Soft reconfig\n") | |
6061 | { | |
6062 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all, | |
6063 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6064 | } | |
6065 | ||
6066 | DEFUN (clear_bgp_all_soft, | |
6067 | clear_bgp_all_soft_cmd, | |
6068 | "clear bgp * soft", | |
6069 | CLEAR_STR | |
6070 | BGP_STR | |
6071 | "Clear all peers\n" | |
6072 | "Soft reconfig\n") | |
6073 | { | |
6074 | if (argc == 1) | |
6075 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6076 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6077 | ||
6078 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6079 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6080 | } | |
6081 | ||
6082 | ALIAS (clear_bgp_all_soft, | |
6083 | clear_bgp_instance_all_soft_cmd, | |
6084 | "clear bgp view WORD * soft", | |
6085 | CLEAR_STR | |
6086 | BGP_STR | |
6087 | "BGP view\n" | |
6088 | "view name\n" | |
6089 | "Clear all peers\n" | |
6090 | "Soft reconfig\n") | |
6091 | ||
6092 | ALIAS (clear_bgp_all_soft, | |
6093 | clear_bgp_ipv6_all_soft_cmd, | |
6094 | "clear bgp ipv6 * soft", | |
6095 | CLEAR_STR | |
6096 | BGP_STR | |
6097 | "Address family\n" | |
6098 | "Clear all peers\n" | |
6099 | "Soft reconfig\n") | |
6100 | ||
6101 | DEFUN (clear_ip_bgp_peer_soft, | |
6102 | clear_ip_bgp_peer_soft_cmd, | |
6103 | "clear ip bgp A.B.C.D soft", | |
6104 | CLEAR_STR | |
6105 | IP_STR | |
6106 | BGP_STR | |
6107 | "BGP neighbor address to clear\n" | |
6108 | "Soft reconfig\n") | |
6109 | { | |
6110 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6111 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6112 | } | |
6113 | ||
6114 | DEFUN (clear_ip_bgp_peer_ipv4_soft, | |
6115 | clear_ip_bgp_peer_ipv4_soft_cmd, | |
6116 | "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft", | |
6117 | CLEAR_STR | |
6118 | IP_STR | |
6119 | BGP_STR | |
6120 | "BGP neighbor address to clear\n" | |
6121 | "Address family\n" | |
6122 | "Address Family Modifier\n" | |
6123 | "Address Family Modifier\n" | |
6124 | "Soft reconfig\n") | |
6125 | { | |
6126 | if (strncmp (argv[1], "m", 1) == 0) | |
6127 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer, | |
6128 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6129 | ||
6130 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6131 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6132 | } | |
6133 | ||
6134 | DEFUN (clear_ip_bgp_peer_vpnv4_soft, | |
6135 | clear_ip_bgp_peer_vpnv4_soft_cmd, | |
6136 | "clear ip bgp A.B.C.D vpnv4 unicast soft", | |
6137 | CLEAR_STR | |
6138 | IP_STR | |
6139 | BGP_STR | |
6140 | "BGP neighbor address to clear\n" | |
6141 | "Address family\n" | |
6142 | "Address Family Modifier\n" | |
6143 | "Soft reconfig\n") | |
6144 | { | |
6145 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer, | |
6146 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6147 | } | |
6148 | ||
6149 | DEFUN (clear_bgp_peer_soft, | |
6150 | clear_bgp_peer_soft_cmd, | |
6151 | "clear bgp (A.B.C.D|X:X::X:X) soft", | |
6152 | CLEAR_STR | |
6153 | BGP_STR | |
6154 | "BGP neighbor address to clear\n" | |
6155 | "BGP IPv6 neighbor to clear\n" | |
6156 | "Soft reconfig\n") | |
6157 | { | |
6158 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6159 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6160 | } | |
6161 | ||
6162 | ALIAS (clear_bgp_peer_soft, | |
6163 | clear_bgp_ipv6_peer_soft_cmd, | |
6164 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft", | |
6165 | CLEAR_STR | |
6166 | BGP_STR | |
6167 | "Address family\n" | |
6168 | "BGP neighbor address to clear\n" | |
6169 | "BGP IPv6 neighbor to clear\n" | |
6170 | "Soft reconfig\n") | |
6171 | ||
6172 | DEFUN (clear_ip_bgp_peer_group_soft, | |
6173 | clear_ip_bgp_peer_group_soft_cmd, | |
6174 | "clear ip bgp peer-group WORD soft", | |
6175 | CLEAR_STR | |
6176 | IP_STR | |
6177 | BGP_STR | |
6178 | "Clear all members of peer-group\n" | |
6179 | "BGP peer-group name\n" | |
6180 | "Soft reconfig\n") | |
6181 | { | |
6182 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6183 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6184 | } | |
6185 | ||
6186 | DEFUN (clear_ip_bgp_peer_group_ipv4_soft, | |
6187 | clear_ip_bgp_peer_group_ipv4_soft_cmd, | |
6188 | "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft", | |
6189 | CLEAR_STR | |
6190 | IP_STR | |
6191 | BGP_STR | |
6192 | "Clear all members of peer-group\n" | |
6193 | "BGP peer-group name\n" | |
6194 | "Address family\n" | |
6195 | "Address Family modifier\n" | |
6196 | "Address Family modifier\n" | |
6197 | "Soft reconfig\n") | |
6198 | { | |
6199 | if (strncmp (argv[1], "m", 1) == 0) | |
6200 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group, | |
6201 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6202 | ||
6203 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group, | |
6204 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6205 | } | |
6206 | ||
6207 | DEFUN (clear_bgp_peer_group_soft, | |
6208 | clear_bgp_peer_group_soft_cmd, | |
6209 | "clear bgp peer-group WORD soft", | |
6210 | CLEAR_STR | |
6211 | BGP_STR | |
6212 | "Clear all members of peer-group\n" | |
6213 | "BGP peer-group name\n" | |
6214 | "Soft reconfig\n") | |
6215 | { | |
6216 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group, | |
6217 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6218 | } | |
6219 | ||
6220 | ALIAS (clear_bgp_peer_group_soft, | |
6221 | clear_bgp_ipv6_peer_group_soft_cmd, | |
6222 | "clear bgp ipv6 peer-group WORD soft", | |
6223 | CLEAR_STR | |
6224 | BGP_STR | |
6225 | "Address family\n" | |
6226 | "Clear all members of peer-group\n" | |
6227 | "BGP peer-group name\n" | |
6228 | "Soft reconfig\n") | |
6229 | ||
6230 | DEFUN (clear_ip_bgp_external_soft, | |
6231 | clear_ip_bgp_external_soft_cmd, | |
6232 | "clear ip bgp external soft", | |
6233 | CLEAR_STR | |
6234 | IP_STR | |
6235 | BGP_STR | |
6236 | "Clear all external peers\n" | |
6237 | "Soft reconfig\n") | |
6238 | { | |
6239 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6240 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6241 | } | |
6242 | ||
6243 | DEFUN (clear_ip_bgp_external_ipv4_soft, | |
6244 | clear_ip_bgp_external_ipv4_soft_cmd, | |
6245 | "clear ip bgp external ipv4 (unicast|multicast) soft", | |
6246 | CLEAR_STR | |
6247 | IP_STR | |
6248 | BGP_STR | |
6249 | "Clear all external peers\n" | |
6250 | "Address family\n" | |
6251 | "Address Family modifier\n" | |
6252 | "Address Family modifier\n" | |
6253 | "Soft reconfig\n") | |
6254 | { | |
6255 | if (strncmp (argv[0], "m", 1) == 0) | |
6256 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external, | |
6257 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6258 | ||
6259 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external, | |
6260 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6261 | } | |
6262 | ||
6263 | DEFUN (clear_bgp_external_soft, | |
6264 | clear_bgp_external_soft_cmd, | |
6265 | "clear bgp external soft", | |
6266 | CLEAR_STR | |
6267 | BGP_STR | |
6268 | "Clear all external peers\n" | |
6269 | "Soft reconfig\n") | |
6270 | { | |
6271 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external, | |
6272 | BGP_CLEAR_SOFT_BOTH, NULL); | |
6273 | } | |
6274 | ||
6275 | ALIAS (clear_bgp_external_soft, | |
6276 | clear_bgp_ipv6_external_soft_cmd, | |
6277 | "clear bgp ipv6 external soft", | |
6278 | CLEAR_STR | |
6279 | BGP_STR | |
6280 | "Address family\n" | |
6281 | "Clear all external peers\n" | |
6282 | "Soft reconfig\n") | |
6283 | ||
6284 | DEFUN (clear_ip_bgp_as_soft, | |
6285 | clear_ip_bgp_as_soft_cmd, | |
320da874 | 6286 | "clear ip bgp " CMD_AS_RANGE " soft", |
718e3744 | 6287 | CLEAR_STR |
6288 | IP_STR | |
6289 | BGP_STR | |
6290 | "Clear peers with the AS number\n" | |
6291 | "Soft reconfig\n") | |
6292 | { | |
6293 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as, | |
6294 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6295 | } | |
6296 | ||
6297 | DEFUN (clear_ip_bgp_as_ipv4_soft, | |
6298 | clear_ip_bgp_as_ipv4_soft_cmd, | |
320da874 | 6299 | "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", |
718e3744 | 6300 | CLEAR_STR |
6301 | IP_STR | |
6302 | BGP_STR | |
6303 | "Clear peers with the AS number\n" | |
6304 | "Address family\n" | |
6305 | "Address Family Modifier\n" | |
6306 | "Address Family Modifier\n" | |
6307 | "Soft reconfig\n") | |
6308 | { | |
6309 | if (strncmp (argv[1], "m", 1) == 0) | |
6310 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as, | |
6311 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6312 | ||
6313 | return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as, | |
6314 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6315 | } | |
6316 | ||
6317 | DEFUN (clear_ip_bgp_as_vpnv4_soft, | |
6318 | clear_ip_bgp_as_vpnv4_soft_cmd, | |
320da874 | 6319 | "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", |
718e3744 | 6320 | CLEAR_STR |
6321 | IP_STR | |
6322 | BGP_STR | |
6323 | "Clear peers with the AS number\n" | |
6324 | "Address family\n" | |
6325 | "Address Family Modifier\n" | |
6326 | "Soft reconfig\n") | |
6327 | { | |
6328 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as, | |
6329 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6330 | } | |
6331 | ||
6332 | DEFUN (clear_bgp_as_soft, | |
6333 | clear_bgp_as_soft_cmd, | |
320da874 | 6334 | "clear bgp " CMD_AS_RANGE " soft", |
718e3744 | 6335 | CLEAR_STR |
6336 | BGP_STR | |
6337 | "Clear peers with the AS number\n" | |
6338 | "Soft reconfig\n") | |
6339 | { | |
6340 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as, | |
6341 | BGP_CLEAR_SOFT_BOTH, argv[0]); | |
6342 | } | |
6343 | ||
6344 | ALIAS (clear_bgp_as_soft, | |
6345 | clear_bgp_ipv6_as_soft_cmd, | |
320da874 | 6346 | "clear bgp ipv6 " CMD_AS_RANGE " soft", |
718e3744 | 6347 | CLEAR_STR |
6348 | BGP_STR | |
6349 | "Address family\n" | |
6350 | "Clear peers with the AS number\n" | |
6351 | "Soft reconfig\n") | |
6352 | \f | |
fee0f4c6 | 6353 | /* RS-client soft reconfiguration. */ |
6354 | #ifdef HAVE_IPV6 | |
6355 | DEFUN (clear_bgp_all_rsclient, | |
6356 | clear_bgp_all_rsclient_cmd, | |
6357 | "clear bgp * rsclient", | |
6358 | CLEAR_STR | |
6359 | BGP_STR | |
6360 | "Clear all peers\n" | |
6361 | "Soft reconfig for rsclient RIB\n") | |
6362 | { | |
6363 | if (argc == 1) | |
6364 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all, | |
6365 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6366 | ||
6367 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all, | |
6368 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6369 | } | |
6370 | ||
6371 | ALIAS (clear_bgp_all_rsclient, | |
6372 | clear_bgp_ipv6_all_rsclient_cmd, | |
6373 | "clear bgp ipv6 * rsclient", | |
6374 | CLEAR_STR | |
6375 | BGP_STR | |
6376 | "Address family\n" | |
6377 | "Clear all peers\n" | |
6378 | "Soft reconfig for rsclient RIB\n") | |
6379 | ||
6380 | ALIAS (clear_bgp_all_rsclient, | |
6381 | clear_bgp_instance_all_rsclient_cmd, | |
6382 | "clear bgp view WORD * rsclient", | |
6383 | CLEAR_STR | |
6384 | BGP_STR | |
6385 | "BGP view\n" | |
6386 | "view name\n" | |
6387 | "Clear all peers\n" | |
6388 | "Soft reconfig for rsclient RIB\n") | |
6389 | ||
6390 | ALIAS (clear_bgp_all_rsclient, | |
6391 | clear_bgp_ipv6_instance_all_rsclient_cmd, | |
6392 | "clear bgp ipv6 view WORD * rsclient", | |
6393 | CLEAR_STR | |
6394 | BGP_STR | |
6395 | "Address family\n" | |
6396 | "BGP view\n" | |
6397 | "view name\n" | |
6398 | "Clear all peers\n" | |
6399 | "Soft reconfig for rsclient RIB\n") | |
6400 | #endif /* HAVE_IPV6 */ | |
6401 | ||
6402 | DEFUN (clear_ip_bgp_all_rsclient, | |
6403 | clear_ip_bgp_all_rsclient_cmd, | |
6404 | "clear ip bgp * rsclient", | |
6405 | CLEAR_STR | |
6406 | IP_STR | |
6407 | BGP_STR | |
6408 | "Clear all peers\n" | |
6409 | "Soft reconfig for rsclient RIB\n") | |
6410 | { | |
6411 | if (argc == 1) | |
6412 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all, | |
6413 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6414 | ||
6415 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, | |
6416 | BGP_CLEAR_SOFT_RSCLIENT, NULL); | |
6417 | } | |
6418 | ||
6419 | ALIAS (clear_ip_bgp_all_rsclient, | |
6420 | clear_ip_bgp_instance_all_rsclient_cmd, | |
6421 | "clear ip bgp view WORD * rsclient", | |
6422 | CLEAR_STR | |
6423 | IP_STR | |
6424 | BGP_STR | |
6425 | "BGP view\n" | |
6426 | "view name\n" | |
6427 | "Clear all peers\n" | |
6428 | "Soft reconfig for rsclient RIB\n") | |
6429 | ||
6430 | #ifdef HAVE_IPV6 | |
6431 | DEFUN (clear_bgp_peer_rsclient, | |
6432 | clear_bgp_peer_rsclient_cmd, | |
6433 | "clear bgp (A.B.C.D|X:X::X:X) rsclient", | |
6434 | CLEAR_STR | |
6435 | BGP_STR | |
6436 | "BGP neighbor IP address to clear\n" | |
6437 | "BGP IPv6 neighbor to clear\n" | |
6438 | "Soft reconfig for rsclient RIB\n") | |
6439 | { | |
6440 | if (argc == 2) | |
6441 | return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer, | |
6442 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
6443 | ||
6444 | return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer, | |
6445 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
6446 | } | |
6447 | ||
6448 | ALIAS (clear_bgp_peer_rsclient, | |
6449 | clear_bgp_ipv6_peer_rsclient_cmd, | |
6450 | "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient", | |
6451 | CLEAR_STR | |
6452 | BGP_STR | |
6453 | "Address family\n" | |
6454 | "BGP neighbor IP address to clear\n" | |
6455 | "BGP IPv6 neighbor to clear\n" | |
6456 | "Soft reconfig for rsclient RIB\n") | |
6457 | ||
6458 | ALIAS (clear_bgp_peer_rsclient, | |
6459 | clear_bgp_instance_peer_rsclient_cmd, | |
6460 | "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient", | |
6461 | CLEAR_STR | |
6462 | BGP_STR | |
6463 | "BGP view\n" | |
6464 | "view name\n" | |
6465 | "BGP neighbor IP address to clear\n" | |
6466 | "BGP IPv6 neighbor to clear\n" | |
6467 | "Soft reconfig for rsclient RIB\n") | |
6468 | ||
6469 | ALIAS (clear_bgp_peer_rsclient, | |
6470 | clear_bgp_ipv6_instance_peer_rsclient_cmd, | |
6471 | "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient", | |
6472 | CLEAR_STR | |
6473 | BGP_STR | |
6474 | "Address family\n" | |
6475 | "BGP view\n" | |
6476 | "view name\n" | |
6477 | "BGP neighbor IP address to clear\n" | |
6478 | "BGP IPv6 neighbor to clear\n" | |
6479 | "Soft reconfig for rsclient RIB\n") | |
6480 | #endif /* HAVE_IPV6 */ | |
6481 | ||
6482 | DEFUN (clear_ip_bgp_peer_rsclient, | |
6483 | clear_ip_bgp_peer_rsclient_cmd, | |
6484 | "clear ip bgp (A.B.C.D|X:X::X:X) rsclient", | |
6485 | CLEAR_STR | |
6486 | IP_STR | |
6487 | BGP_STR | |
6488 | "BGP neighbor IP address to clear\n" | |
6489 | "BGP IPv6 neighbor to clear\n" | |
6490 | "Soft reconfig for rsclient RIB\n") | |
6491 | { | |
6492 | if (argc == 2) | |
6493 | return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer, | |
6494 | BGP_CLEAR_SOFT_RSCLIENT, argv[1]); | |
6495 | ||
6496 | return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer, | |
6497 | BGP_CLEAR_SOFT_RSCLIENT, argv[0]); | |
6498 | } | |
6499 | ||
6500 | ALIAS (clear_ip_bgp_peer_rsclient, | |
6501 | clear_ip_bgp_instance_peer_rsclient_cmd, | |
6502 | "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient", | |
6503 | CLEAR_STR | |
6504 | IP_STR | |
6505 | BGP_STR | |
6506 | "BGP view\n" | |
6507 | "view name\n" | |
6508 | "BGP neighbor IP address to clear\n" | |
6509 | "BGP IPv6 neighbor to clear\n" | |
6510 | "Soft reconfig for rsclient RIB\n") | |
6511 | ||
4bf6a362 PJ |
6512 | DEFUN (show_bgp_memory, |
6513 | show_bgp_memory_cmd, | |
6514 | "show bgp memory", | |
6515 | SHOW_STR | |
6516 | BGP_STR | |
6517 | "Global BGP memory statistics\n") | |
6518 | { | |
6519 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
6520 | unsigned long count; | |
6521 | ||
6522 | /* RIB related usage stats */ | |
6523 | count = mtype_stats_alloc (MTYPE_BGP_NODE); | |
6524 | vty_out (vty, "%ld RIB nodes, using %s of memory%s", count, | |
6525 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6526 | count * sizeof (struct bgp_node)), | |
6527 | VTY_NEWLINE); | |
6528 | ||
6529 | count = mtype_stats_alloc (MTYPE_BGP_ROUTE); | |
6530 | vty_out (vty, "%ld BGP routes, using %s of memory%s", count, | |
6531 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6532 | count * sizeof (struct bgp_info)), | |
6533 | VTY_NEWLINE); | |
fb982c25 PJ |
6534 | if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA))) |
6535 | vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count, | |
6536 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6537 | count * sizeof (struct bgp_info_extra)), | |
6538 | VTY_NEWLINE); | |
4bf6a362 PJ |
6539 | |
6540 | if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC))) | |
6541 | vty_out (vty, "%ld Static routes, using %s of memory%s", count, | |
6542 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6543 | count * sizeof (struct bgp_static)), | |
6544 | VTY_NEWLINE); | |
6545 | ||
6546 | /* Adj-In/Out */ | |
6547 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN))) | |
6548 | vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count, | |
6549 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6550 | count * sizeof (struct bgp_adj_in)), | |
6551 | VTY_NEWLINE); | |
6552 | if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT))) | |
6553 | vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count, | |
6554 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6555 | count * sizeof (struct bgp_adj_out)), | |
6556 | VTY_NEWLINE); | |
6557 | ||
6558 | if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE))) | |
6559 | vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count, | |
6560 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6561 | count * sizeof (struct bgp_nexthop_cache)), | |
6562 | VTY_NEWLINE); | |
6563 | ||
6564 | if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO))) | |
6565 | vty_out (vty, "%ld Dampening entries, using %s of memory%s", count, | |
6566 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6567 | count * sizeof (struct bgp_damp_info)), | |
6568 | VTY_NEWLINE); | |
6569 | ||
6570 | /* Attributes */ | |
6571 | count = attr_count(); | |
6572 | vty_out (vty, "%ld BGP attributes, using %s of memory%s", count, | |
6573 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6574 | count * sizeof(struct attr)), | |
6575 | VTY_NEWLINE); | |
fb982c25 PJ |
6576 | if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA))) |
6577 | vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count, | |
6578 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6579 | count * sizeof(struct attr_extra)), | |
6580 | VTY_NEWLINE); | |
4bf6a362 PJ |
6581 | |
6582 | if ((count = attr_unknown_count())) | |
6583 | vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE); | |
6584 | ||
6585 | /* AS_PATH attributes */ | |
6586 | count = aspath_count (); | |
6587 | vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count, | |
6588 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6589 | count * sizeof (struct aspath)), | |
6590 | VTY_NEWLINE); | |
6591 | ||
6592 | count = mtype_stats_alloc (MTYPE_AS_SEG); | |
6593 | vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count, | |
6594 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6595 | count * sizeof (struct assegment)), | |
6596 | VTY_NEWLINE); | |
6597 | ||
6598 | /* Other attributes */ | |
6599 | if ((count = community_count ())) | |
6600 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
6601 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6602 | count * sizeof (struct community)), | |
6603 | VTY_NEWLINE); | |
6604 | if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY))) | |
6605 | vty_out (vty, "%ld BGP community entries, using %s of memory%s", count, | |
6606 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6607 | count * sizeof (struct ecommunity)), | |
6608 | VTY_NEWLINE); | |
6609 | ||
6610 | if ((count = mtype_stats_alloc (MTYPE_CLUSTER))) | |
6611 | vty_out (vty, "%ld Cluster lists, using %s of memory%s", count, | |
6612 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6613 | count * sizeof (struct cluster_list)), | |
6614 | VTY_NEWLINE); | |
6615 | ||
6616 | /* Peer related usage */ | |
6617 | count = mtype_stats_alloc (MTYPE_BGP_PEER); | |
6618 | vty_out (vty, "%ld peers, using %s of memory%s", count, | |
6619 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6620 | count * sizeof (struct peer)), | |
6621 | VTY_NEWLINE); | |
6622 | ||
6623 | if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP))) | |
6624 | vty_out (vty, "%ld peer groups, using %s of memory%s", count, | |
6625 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6626 | count * sizeof (struct peer_group)), | |
6627 | VTY_NEWLINE); | |
6628 | ||
6629 | /* Other */ | |
6630 | if ((count = mtype_stats_alloc (MTYPE_HASH))) | |
6631 | vty_out (vty, "%ld hash tables, using %s of memory%s", count, | |
6632 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6633 | count * sizeof (struct hash)), | |
6634 | VTY_NEWLINE); | |
6635 | if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET))) | |
6636 | vty_out (vty, "%ld hash buckets, using %s of memory%s", count, | |
6637 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6638 | count * sizeof (struct hash_backet)), | |
6639 | VTY_NEWLINE); | |
6640 | if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP))) | |
6641 | vty_out (vty, "%ld compiled regexes, using %s of memory%s", count, | |
6642 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6643 | count * sizeof (regex_t)), | |
6644 | VTY_NEWLINE); | |
6645 | return CMD_SUCCESS; | |
6646 | } | |
fee0f4c6 | 6647 | |
718e3744 | 6648 | /* Show BGP peer's summary information. */ |
94f2b392 | 6649 | static int |
718e3744 | 6650 | bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) |
6651 | { | |
6652 | struct peer *peer; | |
1eb8ef25 | 6653 | struct listnode *node, *nnode; |
4bf6a362 | 6654 | unsigned int count = 0; |
718e3744 | 6655 | char timebuf[BGP_UPTIME_LEN]; |
6656 | int len; | |
6657 | ||
6658 | /* Header string for each address family. */ | |
6659 | static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd"; | |
4bf6a362 | 6660 | |
1eb8ef25 | 6661 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 6662 | { |
6663 | if (peer->afc[afi][safi]) | |
6664 | { | |
4bf6a362 PJ |
6665 | if (!count) |
6666 | { | |
6667 | unsigned long ents; | |
6668 | char memstrbuf[MTYPE_MEMSTR_LEN]; | |
6669 | ||
6670 | /* Usage summary and header */ | |
6671 | vty_out (vty, | |
6672 | "BGP router identifier %s, local AS number %d%s", | |
6673 | inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); | |
6674 | ||
6675 | ents = bgp_table_count (bgp->rib[afi][safi]); | |
6676 | vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, | |
6677 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6678 | ents * sizeof (struct bgp_node)), | |
6679 | VTY_NEWLINE); | |
6680 | ||
6681 | /* Peer related usage */ | |
6682 | ents = listcount (bgp->peer); | |
6683 | vty_out (vty, "Peers %ld, using %s of memory%s", | |
6684 | ents, | |
6685 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6686 | ents * sizeof (struct peer)), | |
6687 | VTY_NEWLINE); | |
6688 | ||
6689 | if ((ents = listcount (bgp->rsclient))) | |
6690 | vty_out (vty, "RS-Client peers %ld, using %s of memory%s", | |
6691 | ents, | |
6692 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6693 | ents * sizeof (struct peer)), | |
6694 | VTY_NEWLINE); | |
6695 | ||
6696 | if ((ents = listcount (bgp->group))) | |
6697 | vty_out (vty, "Peer groups %ld, using %s of memory%s", ents, | |
6698 | mtype_memstr (memstrbuf, sizeof (memstrbuf), | |
6699 | ents * sizeof (struct peer_group)), | |
6700 | VTY_NEWLINE); | |
6701 | ||
6702 | if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) | |
6703 | vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE); | |
6704 | vty_out (vty, "%s", VTY_NEWLINE); | |
6705 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
6706 | } | |
6707 | ||
718e3744 | 6708 | count++; |
6709 | ||
6710 | len = vty_out (vty, "%s", peer->host); | |
6711 | len = 16 - len; | |
6712 | if (len < 1) | |
6713 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
6714 | else | |
6715 | vty_out (vty, "%*s", len, " "); | |
6716 | ||
3d515fd9 | 6717 | vty_out (vty, "4 "); |
718e3744 | 6718 | |
6d58272b | 6719 | vty_out (vty, "%5d %7d %7d %8d %4d %4lu ", |
718e3744 | 6720 | peer->as, |
6721 | peer->open_in + peer->update_in + peer->keepalive_in | |
6722 | + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, | |
6723 | peer->open_out + peer->update_out + peer->keepalive_out | |
6724 | + peer->notify_out + peer->refresh_out | |
6725 | + peer->dynamic_cap_out, | |
0b2aa3a0 | 6726 | 0, 0, (unsigned long) peer->obuf->count); |
718e3744 | 6727 | |
6728 | vty_out (vty, "%8s", | |
6729 | peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN)); | |
6730 | ||
6731 | if (peer->status == Established) | |
6732 | { | |
6733 | vty_out (vty, " %8ld", peer->pcount[afi][safi]); | |
6734 | } | |
6735 | else | |
6736 | { | |
6737 | if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) | |
6738 | vty_out (vty, " Idle (Admin)"); | |
6739 | else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
6740 | vty_out (vty, " Idle (PfxCt)"); | |
6741 | else | |
6742 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status)); | |
6743 | } | |
6744 | ||
6745 | vty_out (vty, "%s", VTY_NEWLINE); | |
6746 | } | |
6747 | } | |
6748 | ||
6749 | if (count) | |
6750 | vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE, | |
6751 | count, VTY_NEWLINE); | |
6752 | else | |
6753 | vty_out (vty, "No %s neighbor is configured%s", | |
6754 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
6755 | return CMD_SUCCESS; | |
6756 | } | |
6757 | ||
94f2b392 | 6758 | static int |
fd79ac91 | 6759 | bgp_show_summary_vty (struct vty *vty, const char *name, |
6760 | afi_t afi, safi_t safi) | |
718e3744 | 6761 | { |
6762 | struct bgp *bgp; | |
6763 | ||
6764 | if (name) | |
6765 | { | |
6766 | bgp = bgp_lookup_by_name (name); | |
6767 | ||
6768 | if (! bgp) | |
6769 | { | |
6770 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
6771 | return CMD_WARNING; | |
6772 | } | |
6773 | ||
6774 | bgp_show_summary (vty, bgp, afi, safi); | |
6775 | return CMD_SUCCESS; | |
6776 | } | |
6777 | ||
6778 | bgp = bgp_get_default (); | |
6779 | ||
6780 | if (bgp) | |
6781 | bgp_show_summary (vty, bgp, afi, safi); | |
6782 | ||
6783 | return CMD_SUCCESS; | |
6784 | } | |
6785 | ||
6786 | /* `show ip bgp summary' commands. */ | |
6787 | DEFUN (show_ip_bgp_summary, | |
6788 | show_ip_bgp_summary_cmd, | |
6789 | "show ip bgp summary", | |
6790 | SHOW_STR | |
6791 | IP_STR | |
6792 | BGP_STR | |
6793 | "Summary of BGP neighbor status\n") | |
6794 | { | |
6795 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
6796 | } | |
6797 | ||
6798 | DEFUN (show_ip_bgp_instance_summary, | |
6799 | show_ip_bgp_instance_summary_cmd, | |
6800 | "show ip bgp view WORD summary", | |
6801 | SHOW_STR | |
6802 | IP_STR | |
6803 | BGP_STR | |
6804 | "BGP view\n" | |
6805 | "View name\n" | |
6806 | "Summary of BGP neighbor status\n") | |
6807 | { | |
6808 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
6809 | } | |
6810 | ||
6811 | DEFUN (show_ip_bgp_ipv4_summary, | |
6812 | show_ip_bgp_ipv4_summary_cmd, | |
6813 | "show ip bgp ipv4 (unicast|multicast) summary", | |
6814 | SHOW_STR | |
6815 | IP_STR | |
6816 | BGP_STR | |
6817 | "Address family\n" | |
6818 | "Address Family modifier\n" | |
6819 | "Address Family modifier\n" | |
6820 | "Summary of BGP neighbor status\n") | |
6821 | { | |
6822 | if (strncmp (argv[0], "m", 1) == 0) | |
6823 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); | |
6824 | ||
6825 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
6826 | } | |
6827 | ||
6828 | DEFUN (show_ip_bgp_instance_ipv4_summary, | |
6829 | show_ip_bgp_instance_ipv4_summary_cmd, | |
6830 | "show ip bgp view WORD ipv4 (unicast|multicast) summary", | |
6831 | SHOW_STR | |
6832 | IP_STR | |
6833 | BGP_STR | |
6834 | "BGP view\n" | |
6835 | "View name\n" | |
6836 | "Address family\n" | |
6837 | "Address Family modifier\n" | |
6838 | "Address Family modifier\n" | |
6839 | "Summary of BGP neighbor status\n") | |
6840 | { | |
6841 | if (strncmp (argv[1], "m", 1) == 0) | |
6842 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); | |
6843 | else | |
6844 | return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
6845 | } | |
6846 | ||
6847 | DEFUN (show_ip_bgp_vpnv4_all_summary, | |
6848 | show_ip_bgp_vpnv4_all_summary_cmd, | |
6849 | "show ip bgp vpnv4 all summary", | |
6850 | SHOW_STR | |
6851 | IP_STR | |
6852 | BGP_STR | |
6853 | "Display VPNv4 NLRI specific information\n" | |
6854 | "Display information about all VPNv4 NLRIs\n" | |
6855 | "Summary of BGP neighbor status\n") | |
6856 | { | |
6857 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); | |
6858 | } | |
6859 | ||
6860 | DEFUN (show_ip_bgp_vpnv4_rd_summary, | |
6861 | show_ip_bgp_vpnv4_rd_summary_cmd, | |
6862 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary", | |
6863 | SHOW_STR | |
6864 | IP_STR | |
6865 | BGP_STR | |
6866 | "Display VPNv4 NLRI specific information\n" | |
6867 | "Display information for a route distinguisher\n" | |
6868 | "VPN Route Distinguisher\n" | |
6869 | "Summary of BGP neighbor status\n") | |
6870 | { | |
6871 | int ret; | |
6872 | struct prefix_rd prd; | |
6873 | ||
6874 | ret = str2prefix_rd (argv[0], &prd); | |
6875 | if (! ret) | |
6876 | { | |
6877 | vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); | |
6878 | return CMD_WARNING; | |
6879 | } | |
6880 | ||
6881 | return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN); | |
6882 | } | |
6883 | ||
6884 | #ifdef HAVE_IPV6 | |
6885 | DEFUN (show_bgp_summary, | |
6886 | show_bgp_summary_cmd, | |
6887 | "show bgp summary", | |
6888 | SHOW_STR | |
6889 | BGP_STR | |
6890 | "Summary of BGP neighbor status\n") | |
6891 | { | |
6892 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
6893 | } | |
6894 | ||
6895 | DEFUN (show_bgp_instance_summary, | |
6896 | show_bgp_instance_summary_cmd, | |
6897 | "show bgp view WORD summary", | |
6898 | SHOW_STR | |
6899 | BGP_STR | |
6900 | "BGP view\n" | |
6901 | "View name\n" | |
6902 | "Summary of BGP neighbor status\n") | |
6903 | { | |
6904 | return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); | |
6905 | } | |
6906 | ||
6907 | ALIAS (show_bgp_summary, | |
6908 | show_bgp_ipv6_summary_cmd, | |
6909 | "show bgp ipv6 summary", | |
6910 | SHOW_STR | |
6911 | BGP_STR | |
6912 | "Address family\n" | |
6913 | "Summary of BGP neighbor status\n") | |
6914 | ||
6915 | ALIAS (show_bgp_instance_summary, | |
6916 | show_bgp_instance_ipv6_summary_cmd, | |
6917 | "show bgp view WORD ipv6 summary", | |
6918 | SHOW_STR | |
6919 | BGP_STR | |
6920 | "BGP view\n" | |
6921 | "View name\n" | |
6922 | "Address family\n" | |
6923 | "Summary of BGP neighbor status\n") | |
6924 | ||
6925 | /* old command */ | |
6926 | DEFUN (show_ipv6_bgp_summary, | |
6927 | show_ipv6_bgp_summary_cmd, | |
6928 | "show ipv6 bgp summary", | |
6929 | SHOW_STR | |
6930 | IPV6_STR | |
6931 | BGP_STR | |
6932 | "Summary of BGP neighbor status\n") | |
6933 | { | |
6934 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
6935 | } | |
6936 | ||
6937 | /* old command */ | |
6938 | DEFUN (show_ipv6_mbgp_summary, | |
6939 | show_ipv6_mbgp_summary_cmd, | |
6940 | "show ipv6 mbgp summary", | |
6941 | SHOW_STR | |
6942 | IPV6_STR | |
6943 | MBGP_STR | |
6944 | "Summary of BGP neighbor status\n") | |
6945 | { | |
6946 | return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST); | |
6947 | } | |
6948 | #endif /* HAVE_IPV6 */ | |
6949 | \f | |
fd79ac91 | 6950 | const char * |
538621f2 | 6951 | afi_safi_print (afi_t afi, safi_t safi) |
6952 | { | |
6953 | if (afi == AFI_IP && safi == SAFI_UNICAST) | |
6954 | return "IPv4 Unicast"; | |
6955 | else if (afi == AFI_IP && safi == SAFI_MULTICAST) | |
6956 | return "IPv4 Multicast"; | |
6957 | else if (afi == AFI_IP && safi == SAFI_MPLS_VPN) | |
6958 | return "VPNv4 Unicast"; | |
6959 | else if (afi == AFI_IP6 && safi == SAFI_UNICAST) | |
6960 | return "IPv6 Unicast"; | |
6961 | else if (afi == AFI_IP6 && safi == SAFI_MULTICAST) | |
6962 | return "IPv6 Multicast"; | |
6963 | else | |
6964 | return "Unknown"; | |
6965 | } | |
6966 | ||
718e3744 | 6967 | /* Show BGP peer's information. */ |
6968 | enum show_type | |
6969 | { | |
6970 | show_all, | |
6971 | show_peer | |
6972 | }; | |
6973 | ||
94f2b392 | 6974 | static void |
718e3744 | 6975 | bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p, |
6976 | afi_t afi, safi_t safi, | |
6977 | u_int16_t adv_smcap, u_int16_t adv_rmcap, | |
6978 | u_int16_t rcv_smcap, u_int16_t rcv_rmcap) | |
6979 | { | |
6980 | /* Send-Mode */ | |
6981 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) | |
6982 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
6983 | { | |
6984 | vty_out (vty, " Send-mode: "); | |
6985 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)) | |
6986 | vty_out (vty, "advertised"); | |
6987 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap)) | |
6988 | vty_out (vty, "%sreceived", | |
6989 | CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ? | |
6990 | ", " : ""); | |
6991 | vty_out (vty, "%s", VTY_NEWLINE); | |
6992 | } | |
6993 | ||
6994 | /* Receive-Mode */ | |
6995 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) | |
6996 | || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
6997 | { | |
6998 | vty_out (vty, " Receive-mode: "); | |
6999 | if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)) | |
7000 | vty_out (vty, "advertised"); | |
7001 | if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap)) | |
7002 | vty_out (vty, "%sreceived", | |
7003 | CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ? | |
7004 | ", " : ""); | |
7005 | vty_out (vty, "%s", VTY_NEWLINE); | |
7006 | } | |
7007 | } | |
7008 | ||
94f2b392 | 7009 | static void |
718e3744 | 7010 | bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi) |
7011 | { | |
7012 | struct bgp_filter *filter; | |
7013 | char orf_pfx_name[BUFSIZ]; | |
7014 | int orf_pfx_count; | |
7015 | ||
7016 | filter = &p->filter[afi][safi]; | |
7017 | ||
538621f2 | 7018 | vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi), |
718e3744 | 7019 | VTY_NEWLINE); |
538621f2 | 7020 | |
718e3744 | 7021 | if (p->af_group[afi][safi]) |
7022 | vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE); | |
7023 | ||
7024 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
7025 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
7026 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
7027 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
7028 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) | |
7029 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
7030 | vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE); | |
7031 | ||
7032 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
7033 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV) | |
7034 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
7035 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) | |
7036 | { | |
7037 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
7038 | ORF_TYPE_PREFIX, VTY_NEWLINE); | |
7039 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
7040 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
7041 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
7042 | PEER_CAP_ORF_PREFIX_SM_RCV, | |
7043 | PEER_CAP_ORF_PREFIX_RM_RCV); | |
7044 | } | |
7045 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) | |
7046 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV) | |
7047 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV) | |
7048 | || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV)) | |
7049 | { | |
7050 | vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s", | |
7051 | ORF_TYPE_PREFIX_OLD, VTY_NEWLINE); | |
7052 | bgp_show_peer_afi_orf_cap (vty, p, afi, safi, | |
7053 | PEER_CAP_ORF_PREFIX_SM_ADV, | |
7054 | PEER_CAP_ORF_PREFIX_RM_ADV, | |
7055 | PEER_CAP_ORF_PREFIX_SM_OLD_RCV, | |
7056 | PEER_CAP_ORF_PREFIX_RM_OLD_RCV); | |
7057 | } | |
7058 | ||
7059 | sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi); | |
7060 | orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name); | |
7061 | ||
7062 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND) | |
7063 | || orf_pfx_count) | |
7064 | { | |
7065 | vty_out (vty, " Outbound Route Filter (ORF):"); | |
7066 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) | |
7067 | vty_out (vty, " sent;"); | |
7068 | if (orf_pfx_count) | |
7069 | vty_out (vty, " received (%d entries)", orf_pfx_count); | |
7070 | vty_out (vty, "%s", VTY_NEWLINE); | |
7071 | } | |
7072 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH)) | |
7073 | vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE); | |
7074 | ||
7075 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT)) | |
7076 | vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE); | |
7077 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
7078 | vty_out (vty, " Route-Server Client%s", VTY_NEWLINE); | |
7079 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) | |
7080 | vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE); | |
7081 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS)) | |
7082 | vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE); | |
7083 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF)) | |
7084 | vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE); | |
7085 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) | |
7086 | vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
7087 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) | |
7088 | vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
7089 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) | |
7090 | vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE); | |
7091 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
7092 | || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
7093 | { | |
7094 | vty_out (vty, " Community attribute sent to this neighbor"); | |
7095 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY) | |
7096 | && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) | |
538621f2 | 7097 | vty_out (vty, "(both)%s", VTY_NEWLINE); |
718e3744 | 7098 | else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)) |
538621f2 | 7099 | vty_out (vty, "(extended)%s", VTY_NEWLINE); |
718e3744 | 7100 | else |
538621f2 | 7101 | vty_out (vty, "(standard)%s", VTY_NEWLINE); |
718e3744 | 7102 | } |
7103 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) | |
7104 | { | |
7105 | vty_out (vty, " Default information originate,"); | |
7106 | ||
7107 | if (p->default_rmap[afi][safi].name) | |
7108 | vty_out (vty, " default route-map %s%s,", | |
7109 | p->default_rmap[afi][safi].map ? "*" : "", | |
7110 | p->default_rmap[afi][safi].name); | |
7111 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE)) | |
7112 | vty_out (vty, " default sent%s", VTY_NEWLINE); | |
7113 | else | |
7114 | vty_out (vty, " default not sent%s", VTY_NEWLINE); | |
7115 | } | |
7116 | ||
7117 | if (filter->plist[FILTER_IN].name | |
7118 | || filter->dlist[FILTER_IN].name | |
7119 | || filter->aslist[FILTER_IN].name | |
fee0f4c6 | 7120 | || filter->map[RMAP_IN].name) |
718e3744 | 7121 | vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE); |
7122 | if (filter->plist[FILTER_OUT].name | |
7123 | || filter->dlist[FILTER_OUT].name | |
7124 | || filter->aslist[FILTER_OUT].name | |
fee0f4c6 | 7125 | || filter->map[RMAP_OUT].name |
718e3744 | 7126 | || filter->usmap.name) |
7127 | vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE); | |
fee0f4c6 | 7128 | if (filter->map[RMAP_IMPORT].name) |
7129 | vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE); | |
7130 | if (filter->map[RMAP_EXPORT].name) | |
7131 | vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE); | |
718e3744 | 7132 | |
7133 | /* prefix-list */ | |
7134 | if (filter->plist[FILTER_IN].name) | |
7135 | vty_out (vty, " Incoming update prefix filter list is %s%s%s", | |
7136 | filter->plist[FILTER_IN].plist ? "*" : "", | |
7137 | filter->plist[FILTER_IN].name, | |
7138 | VTY_NEWLINE); | |
7139 | if (filter->plist[FILTER_OUT].name) | |
7140 | vty_out (vty, " Outgoing update prefix filter list is %s%s%s", | |
7141 | filter->plist[FILTER_OUT].plist ? "*" : "", | |
7142 | filter->plist[FILTER_OUT].name, | |
7143 | VTY_NEWLINE); | |
7144 | ||
7145 | /* distribute-list */ | |
7146 | if (filter->dlist[FILTER_IN].name) | |
7147 | vty_out (vty, " Incoming update network filter list is %s%s%s", | |
7148 | filter->dlist[FILTER_IN].alist ? "*" : "", | |
7149 | filter->dlist[FILTER_IN].name, | |
7150 | VTY_NEWLINE); | |
7151 | if (filter->dlist[FILTER_OUT].name) | |
7152 | vty_out (vty, " Outgoing update network filter list is %s%s%s", | |
7153 | filter->dlist[FILTER_OUT].alist ? "*" : "", | |
7154 | filter->dlist[FILTER_OUT].name, | |
7155 | VTY_NEWLINE); | |
7156 | ||
7157 | /* filter-list. */ | |
7158 | if (filter->aslist[FILTER_IN].name) | |
7159 | vty_out (vty, " Incoming update AS path filter list is %s%s%s", | |
7160 | filter->aslist[FILTER_IN].aslist ? "*" : "", | |
7161 | filter->aslist[FILTER_IN].name, | |
7162 | VTY_NEWLINE); | |
7163 | if (filter->aslist[FILTER_OUT].name) | |
7164 | vty_out (vty, " Outgoing update AS path filter list is %s%s%s", | |
7165 | filter->aslist[FILTER_OUT].aslist ? "*" : "", | |
7166 | filter->aslist[FILTER_OUT].name, | |
7167 | VTY_NEWLINE); | |
7168 | ||
7169 | /* route-map. */ | |
fee0f4c6 | 7170 | if (filter->map[RMAP_IN].name) |
718e3744 | 7171 | vty_out (vty, " Route map for incoming advertisements is %s%s%s", |
fee0f4c6 | 7172 | filter->map[RMAP_IN].map ? "*" : "", |
7173 | filter->map[RMAP_IN].name, | |
718e3744 | 7174 | VTY_NEWLINE); |
fee0f4c6 | 7175 | if (filter->map[RMAP_OUT].name) |
718e3744 | 7176 | vty_out (vty, " Route map for outgoing advertisements is %s%s%s", |
fee0f4c6 | 7177 | filter->map[RMAP_OUT].map ? "*" : "", |
7178 | filter->map[RMAP_OUT].name, | |
7179 | VTY_NEWLINE); | |
7180 | if (filter->map[RMAP_IMPORT].name) | |
7181 | vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s", | |
7182 | filter->map[RMAP_IMPORT].map ? "*" : "", | |
7183 | filter->map[RMAP_IMPORT].name, | |
7184 | VTY_NEWLINE); | |
7185 | if (filter->map[RMAP_EXPORT].name) | |
7186 | vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s", | |
7187 | filter->map[RMAP_EXPORT].map ? "*" : "", | |
7188 | filter->map[RMAP_EXPORT].name, | |
718e3744 | 7189 | VTY_NEWLINE); |
7190 | ||
7191 | /* unsuppress-map */ | |
7192 | if (filter->usmap.name) | |
7193 | vty_out (vty, " Route map for selective unsuppress is %s%s%s", | |
7194 | filter->usmap.map ? "*" : "", | |
7195 | filter->usmap.name, VTY_NEWLINE); | |
7196 | ||
7197 | /* Receive prefix count */ | |
e0701b79 | 7198 | vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE); |
7199 | ||
718e3744 | 7200 | /* Maximum prefix */ |
7201 | if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) | |
7202 | { | |
0a486e5f | 7203 | vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi], |
718e3744 | 7204 | CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) |
0a486e5f | 7205 | ? " (warning-only)" : "", VTY_NEWLINE); |
7206 | vty_out (vty, " Threshold for warning message %d%%", | |
7207 | p->pmax_threshold[afi][safi]); | |
7208 | if (p->pmax_restart[afi][safi]) | |
7209 | vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]); | |
7210 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 7211 | } |
718e3744 | 7212 | |
7213 | vty_out (vty, "%s", VTY_NEWLINE); | |
7214 | } | |
7215 | ||
94f2b392 | 7216 | static void |
718e3744 | 7217 | bgp_show_peer (struct vty *vty, struct peer *p) |
7218 | { | |
7219 | struct bgp *bgp; | |
7220 | char buf1[BUFSIZ]; | |
7221 | char timebuf[BGP_UPTIME_LEN]; | |
538621f2 | 7222 | afi_t afi; |
7223 | safi_t safi; | |
718e3744 | 7224 | |
7225 | bgp = p->bgp; | |
7226 | ||
7227 | /* Configured IP address. */ | |
7228 | vty_out (vty, "BGP neighbor is %s, ", p->host); | |
7229 | vty_out (vty, "remote AS %d, ", p->as); | |
7230 | vty_out (vty, "local AS %d%s, ", | |
7231 | p->change_local_as ? p->change_local_as : p->local_as, | |
7232 | CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? | |
7233 | " no-prepend" : ""); | |
7234 | vty_out (vty, "%s link%s", | |
7235 | p->as == p->local_as ? "internal" : "external", | |
7236 | VTY_NEWLINE); | |
7237 | ||
7238 | /* Description. */ | |
7239 | if (p->desc) | |
7240 | vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE); | |
7241 | ||
7242 | /* Peer-group */ | |
7243 | if (p->group) | |
7244 | vty_out (vty, " Member of peer-group %s for session parameters%s", | |
7245 | p->group->name, VTY_NEWLINE); | |
7246 | ||
7247 | /* Administrative shutdown. */ | |
7248 | if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN)) | |
7249 | vty_out (vty, " Administratively shut down%s", VTY_NEWLINE); | |
7250 | ||
7251 | /* BGP Version. */ | |
7252 | vty_out (vty, " BGP version 4"); | |
718e3744 | 7253 | vty_out (vty, ", remote router ID %s%s", |
7254 | inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ), | |
7255 | VTY_NEWLINE); | |
7256 | ||
7257 | /* Confederation */ | |
e0701b79 | 7258 | if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION) |
7259 | && bgp_confederation_peers_check (bgp, p->as)) | |
718e3744 | 7260 | vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE); |
7261 | ||
7262 | /* Status. */ | |
7263 | vty_out (vty, " BGP state = %s", | |
7264 | LOOKUP (bgp_status_msg, p->status)); | |
7265 | if (p->status == Established) | |
7266 | vty_out (vty, ", up for %8s", | |
7267 | peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN)); | |
93406d87 | 7268 | else if (p->status == Active) |
7269 | { | |
7270 | if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE)) | |
7271 | vty_out (vty, " (passive)"); | |
7272 | else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT)) | |
7273 | vty_out (vty, " (NSF passive)"); | |
7274 | } | |
718e3744 | 7275 | vty_out (vty, "%s", VTY_NEWLINE); |
7276 | ||
7277 | /* read timer */ | |
7278 | vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN)); | |
7279 | ||
7280 | /* Configured timer values. */ | |
7281 | vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s", | |
7282 | p->v_holdtime, p->v_keepalive, VTY_NEWLINE); | |
7283 | if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER)) | |
7284 | { | |
7285 | vty_out (vty, " Configured hold time is %d", p->holdtime); | |
7286 | vty_out (vty, ", keepalive interval is %d seconds%s", | |
7287 | p->keepalive, VTY_NEWLINE); | |
7288 | } | |
93406d87 | 7289 | |
718e3744 | 7290 | /* Capability. */ |
7291 | if (p->status == Established) | |
7292 | { | |
538621f2 | 7293 | if (p->cap |
718e3744 | 7294 | || p->afc_adv[AFI_IP][SAFI_UNICAST] |
7295 | || p->afc_recv[AFI_IP][SAFI_UNICAST] | |
7296 | || p->afc_adv[AFI_IP][SAFI_MULTICAST] | |
7297 | || p->afc_recv[AFI_IP][SAFI_MULTICAST] | |
7298 | #ifdef HAVE_IPV6 | |
7299 | || p->afc_adv[AFI_IP6][SAFI_UNICAST] | |
7300 | || p->afc_recv[AFI_IP6][SAFI_UNICAST] | |
7301 | || p->afc_adv[AFI_IP6][SAFI_MULTICAST] | |
7302 | || p->afc_recv[AFI_IP6][SAFI_MULTICAST] | |
7303 | #endif /* HAVE_IPV6 */ | |
7304 | || p->afc_adv[AFI_IP][SAFI_MPLS_VPN] | |
7305 | || p->afc_recv[AFI_IP][SAFI_MPLS_VPN]) | |
7306 | { | |
7307 | vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE); | |
7308 | ||
0b2aa3a0 PJ |
7309 | /* AS4 */ |
7310 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV) | |
7311 | || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
7312 | { | |
7313 | vty_out (vty, " 4 Byte AS:"); | |
7314 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV)) | |
7315 | vty_out (vty, " advertised"); | |
7316 | if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)) | |
7317 | vty_out (vty, " %sreceived", | |
7318 | CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : ""); | |
7319 | vty_out (vty, "%s", VTY_NEWLINE); | |
7320 | } | |
718e3744 | 7321 | /* Dynamic */ |
7322 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV) | |
7323 | || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
7324 | { | |
7325 | vty_out (vty, " Dynamic:"); | |
7326 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV)) | |
7327 | vty_out (vty, " advertised"); | |
7328 | if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)) | |
538621f2 | 7329 | vty_out (vty, " %sreceived", |
7330 | CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : ""); | |
718e3744 | 7331 | vty_out (vty, "%s", VTY_NEWLINE); |
7332 | } | |
7333 | ||
7334 | /* Route Refresh */ | |
7335 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) | |
7336 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
7337 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
7338 | { | |
7339 | vty_out (vty, " Route refresh:"); | |
7340 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)) | |
7341 | vty_out (vty, " advertised"); | |
7342 | if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV) | |
7343 | || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)) | |
538621f2 | 7344 | vty_out (vty, " %sreceived(%s)", |
7345 | CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "", | |
7346 | (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) | |
7347 | && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ? | |
7348 | "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new"); | |
718e3744 | 7349 | |
718e3744 | 7350 | vty_out (vty, "%s", VTY_NEWLINE); |
7351 | } | |
538621f2 | 7352 | |
7353 | /* Multiprotocol Extensions */ | |
7354 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
7355 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
7356 | if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi]) | |
718e3744 | 7357 | { |
538621f2 | 7358 | vty_out (vty, " Address family %s:", afi_safi_print (afi, safi)); |
7359 | if (p->afc_adv[afi][safi]) | |
7360 | vty_out (vty, " advertised"); | |
7361 | if (p->afc_recv[afi][safi]) | |
7362 | vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : ""); | |
7363 | vty_out (vty, "%s", VTY_NEWLINE); | |
7364 | } | |
7365 | ||
7366 | /* Gracefull Restart */ | |
7367 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
7368 | || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 7369 | { |
538621f2 | 7370 | vty_out (vty, " Graceful Restart Capabilty:"); |
7371 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV)) | |
718e3744 | 7372 | vty_out (vty, " advertised"); |
538621f2 | 7373 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) |
7374 | vty_out (vty, " %sreceived", | |
7375 | CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : ""); | |
718e3744 | 7376 | vty_out (vty, "%s", VTY_NEWLINE); |
538621f2 | 7377 | |
7378 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)) | |
718e3744 | 7379 | { |
538621f2 | 7380 | int restart_af_count = 0; |
7381 | ||
7382 | vty_out (vty, " Remote Restart timer is %d seconds%s", | |
93406d87 | 7383 | p->v_gr_restart, VTY_NEWLINE); |
7384 | vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE); | |
538621f2 | 7385 | |
7386 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
7387 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
7388 | if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV)) | |
7389 | { | |
93406d87 | 7390 | vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "", |
7391 | afi_safi_print (afi, safi), | |
7392 | CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ? | |
7393 | "preserved" : "not preserved"); | |
538621f2 | 7394 | restart_af_count++; |
93406d87 | 7395 | } |
538621f2 | 7396 | if (! restart_af_count) |
7397 | vty_out (vty, "none"); | |
7398 | vty_out (vty, "%s", VTY_NEWLINE); | |
718e3744 | 7399 | } |
718e3744 | 7400 | } |
718e3744 | 7401 | } |
7402 | } | |
7403 | ||
93406d87 | 7404 | /* graceful restart information */ |
7405 | if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV) | |
7406 | || p->t_gr_restart | |
7407 | || p->t_gr_stale) | |
7408 | { | |
7409 | int eor_send_af_count = 0; | |
7410 | int eor_receive_af_count = 0; | |
7411 | ||
7412 | vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE); | |
7413 | if (p->status == Established) | |
7414 | { | |
7415 | vty_out (vty, " End-of-RIB send: "); | |
7416 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
7417 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
7418 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND)) | |
7419 | { | |
7420 | vty_out (vty, "%s%s", eor_send_af_count ? ", " : "", | |
7421 | afi_safi_print (afi, safi)); | |
7422 | eor_send_af_count++; | |
7423 | } | |
7424 | vty_out (vty, "%s", VTY_NEWLINE); | |
7425 | ||
7426 | vty_out (vty, " End-of-RIB received: "); | |
7427 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) | |
7428 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
7429 | if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED)) | |
7430 | { | |
7431 | vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "", | |
7432 | afi_safi_print (afi, safi)); | |
7433 | eor_receive_af_count++; | |
7434 | } | |
7435 | vty_out (vty, "%s", VTY_NEWLINE); | |
7436 | } | |
7437 | ||
7438 | if (p->t_gr_restart) | |
0b2aa3a0 PJ |
7439 | vty_out (vty, " The remaining time of restart timer is %ld%s", |
7440 | thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE); | |
7441 | ||
93406d87 | 7442 | if (p->t_gr_stale) |
0b2aa3a0 PJ |
7443 | vty_out (vty, " The remaining time of stalepath timer is %ld%s", |
7444 | thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE); | |
93406d87 | 7445 | } |
7446 | ||
718e3744 | 7447 | /* Packet counts. */ |
93406d87 | 7448 | vty_out (vty, " Message statistics:%s", VTY_NEWLINE); |
7449 | vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE); | |
0b2aa3a0 | 7450 | vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE); |
93406d87 | 7451 | vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE); |
7452 | vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE); | |
7453 | vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE); | |
7454 | vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE); | |
7455 | vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE); | |
7456 | vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE); | |
7457 | vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE); | |
7458 | vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out + | |
7459 | p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out, | |
7460 | p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in + | |
7461 | p->dynamic_cap_in, VTY_NEWLINE); | |
718e3744 | 7462 | |
7463 | /* advertisement-interval */ | |
7464 | vty_out (vty, " Minimum time between advertisement runs is %d seconds%s", | |
7465 | p->v_routeadv, VTY_NEWLINE); | |
7466 | ||
7467 | /* Update-source. */ | |
7468 | if (p->update_if || p->update_source) | |
7469 | { | |
7470 | vty_out (vty, " Update source is "); | |
7471 | if (p->update_if) | |
7472 | vty_out (vty, "%s", p->update_if); | |
7473 | else if (p->update_source) | |
7474 | vty_out (vty, "%s", | |
7475 | sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN)); | |
7476 | vty_out (vty, "%s", VTY_NEWLINE); | |
7477 | } | |
7478 | ||
7479 | /* Default weight */ | |
7480 | if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT)) | |
7481 | vty_out (vty, " Default weight %d%s", p->weight, | |
7482 | VTY_NEWLINE); | |
7483 | ||
7484 | vty_out (vty, "%s", VTY_NEWLINE); | |
7485 | ||
7486 | /* Address Family Information */ | |
538621f2 | 7487 | for (afi = AFI_IP ; afi < AFI_MAX ; afi++) |
7488 | for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++) | |
7489 | if (p->afc[afi][safi]) | |
7490 | bgp_show_peer_afi (vty, p, afi, safi); | |
718e3744 | 7491 | |
7492 | vty_out (vty, " Connections established %d; dropped %d%s", | |
7493 | p->established, p->dropped, | |
7494 | VTY_NEWLINE); | |
7495 | ||
e0701b79 | 7496 | if (! p->dropped) |
7497 | vty_out (vty, " Last reset never%s", VTY_NEWLINE); | |
7498 | else | |
7499 | vty_out (vty, " Last reset %s, due to %s%s", | |
7500 | peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN), | |
7501 | peer_down_str[(int) p->last_reset], VTY_NEWLINE); | |
848973c7 | 7502 | |
718e3744 | 7503 | if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW)) |
7504 | { | |
7505 | vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE); | |
0a486e5f | 7506 | |
7507 | if (p->t_pmax_restart) | |
7508 | vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s", | |
7509 | p->host, thread_timer_remain_second (p->t_pmax_restart), | |
7510 | VTY_NEWLINE); | |
7511 | else | |
7512 | vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s", | |
7513 | p->host, VTY_NEWLINE); | |
718e3744 | 7514 | } |
7515 | ||
7516 | /* EBGP Multihop */ | |
7517 | if (peer_sort (p) != BGP_PEER_IBGP && p->ttl > 1) | |
7518 | vty_out (vty, " External BGP neighbor may be up to %d hops away.%s", | |
7519 | p->ttl, VTY_NEWLINE); | |
7520 | ||
7521 | /* Local address. */ | |
7522 | if (p->su_local) | |
7523 | { | |
93406d87 | 7524 | vty_out (vty, "Local host: %s, Local port: %d%s", |
718e3744 | 7525 | sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN), |
7526 | ntohs (p->su_local->sin.sin_port), | |
718e3744 | 7527 | VTY_NEWLINE); |
7528 | } | |
7529 | ||
7530 | /* Remote address. */ | |
7531 | if (p->su_remote) | |
7532 | { | |
7533 | vty_out (vty, "Foreign host: %s, Foreign port: %d%s", | |
7534 | sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN), | |
7535 | ntohs (p->su_remote->sin.sin_port), | |
7536 | VTY_NEWLINE); | |
7537 | } | |
7538 | ||
7539 | /* Nexthop display. */ | |
7540 | if (p->su_local) | |
7541 | { | |
7542 | vty_out (vty, "Nexthop: %s%s", | |
7543 | inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ), | |
7544 | VTY_NEWLINE); | |
7545 | #ifdef HAVE_IPV6 | |
7546 | vty_out (vty, "Nexthop global: %s%s", | |
7547 | inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ), | |
7548 | VTY_NEWLINE); | |
7549 | vty_out (vty, "Nexthop local: %s%s", | |
7550 | inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ), | |
7551 | VTY_NEWLINE); | |
7552 | vty_out (vty, "BGP connection: %s%s", | |
7553 | p->shared_network ? "shared network" : "non shared network", | |
7554 | VTY_NEWLINE); | |
7555 | #endif /* HAVE_IPV6 */ | |
7556 | } | |
7557 | ||
7558 | /* Timer information. */ | |
7559 | if (p->t_start) | |
7560 | vty_out (vty, "Next start timer due in %ld seconds%s", | |
7561 | thread_timer_remain_second (p->t_start), VTY_NEWLINE); | |
7562 | if (p->t_connect) | |
7563 | vty_out (vty, "Next connect timer due in %ld seconds%s", | |
7564 | thread_timer_remain_second (p->t_connect), VTY_NEWLINE); | |
7565 | ||
7566 | vty_out (vty, "Read thread: %s Write thread: %s%s", | |
7567 | p->t_read ? "on" : "off", | |
7568 | p->t_write ? "on" : "off", | |
7569 | VTY_NEWLINE); | |
7570 | ||
7571 | if (p->notify.code == BGP_NOTIFY_OPEN_ERR | |
7572 | && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL) | |
7573 | bgp_capability_vty_out (vty, p); | |
7574 | ||
7575 | vty_out (vty, "%s", VTY_NEWLINE); | |
7576 | } | |
7577 | ||
94f2b392 | 7578 | static int |
718e3744 | 7579 | bgp_show_neighbor (struct vty *vty, struct bgp *bgp, |
7580 | enum show_type type, union sockunion *su) | |
7581 | { | |
1eb8ef25 | 7582 | struct listnode *node, *nnode; |
718e3744 | 7583 | struct peer *peer; |
7584 | int find = 0; | |
7585 | ||
1eb8ef25 | 7586 | for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) |
718e3744 | 7587 | { |
7588 | switch (type) | |
7589 | { | |
7590 | case show_all: | |
7591 | bgp_show_peer (vty, peer); | |
7592 | break; | |
7593 | case show_peer: | |
7594 | if (sockunion_same (&peer->su, su)) | |
7595 | { | |
7596 | find = 1; | |
7597 | bgp_show_peer (vty, peer); | |
7598 | } | |
7599 | break; | |
7600 | } | |
7601 | } | |
7602 | ||
7603 | if (type == show_peer && ! find) | |
7604 | vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE); | |
7605 | ||
7606 | return CMD_SUCCESS; | |
7607 | } | |
7608 | ||
94f2b392 | 7609 | static int |
fd79ac91 | 7610 | bgp_show_neighbor_vty (struct vty *vty, const char *name, |
7611 | enum show_type type, const char *ip_str) | |
718e3744 | 7612 | { |
7613 | int ret; | |
7614 | struct bgp *bgp; | |
7615 | union sockunion su; | |
7616 | ||
7617 | if (ip_str) | |
7618 | { | |
7619 | ret = str2sockunion (ip_str, &su); | |
7620 | if (ret < 0) | |
7621 | { | |
7622 | vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE); | |
7623 | return CMD_WARNING; | |
7624 | } | |
7625 | } | |
7626 | ||
7627 | if (name) | |
7628 | { | |
7629 | bgp = bgp_lookup_by_name (name); | |
7630 | ||
7631 | if (! bgp) | |
7632 | { | |
7633 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
7634 | return CMD_WARNING; | |
7635 | } | |
7636 | ||
7637 | bgp_show_neighbor (vty, bgp, type, &su); | |
7638 | ||
7639 | return CMD_SUCCESS; | |
7640 | } | |
7641 | ||
7642 | bgp = bgp_get_default (); | |
7643 | ||
7644 | if (bgp) | |
7645 | bgp_show_neighbor (vty, bgp, type, &su); | |
7646 | ||
7647 | return CMD_SUCCESS; | |
7648 | } | |
7649 | ||
7650 | /* "show ip bgp neighbors" commands. */ | |
7651 | DEFUN (show_ip_bgp_neighbors, | |
7652 | show_ip_bgp_neighbors_cmd, | |
7653 | "show ip bgp neighbors", | |
7654 | SHOW_STR | |
7655 | IP_STR | |
7656 | BGP_STR | |
7657 | "Detailed information on TCP and BGP neighbor connections\n") | |
7658 | { | |
7659 | return bgp_show_neighbor_vty (vty, NULL, show_all, NULL); | |
7660 | } | |
7661 | ||
7662 | ALIAS (show_ip_bgp_neighbors, | |
7663 | show_ip_bgp_ipv4_neighbors_cmd, | |
7664 | "show ip bgp ipv4 (unicast|multicast) neighbors", | |
7665 | SHOW_STR | |
7666 | IP_STR | |
7667 | BGP_STR | |
7668 | "Address family\n" | |
7669 | "Address Family modifier\n" | |
7670 | "Address Family modifier\n" | |
7671 | "Detailed information on TCP and BGP neighbor connections\n") | |
7672 | ||
7673 | ALIAS (show_ip_bgp_neighbors, | |
7674 | show_ip_bgp_vpnv4_all_neighbors_cmd, | |
7675 | "show ip bgp vpnv4 all neighbors", | |
7676 | SHOW_STR | |
7677 | IP_STR | |
7678 | BGP_STR | |
7679 | "Display VPNv4 NLRI specific information\n" | |
7680 | "Display information about all VPNv4 NLRIs\n" | |
7681 | "Detailed information on TCP and BGP neighbor connections\n") | |
7682 | ||
7683 | ALIAS (show_ip_bgp_neighbors, | |
7684 | show_ip_bgp_vpnv4_rd_neighbors_cmd, | |
7685 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors", | |
7686 | SHOW_STR | |
7687 | IP_STR | |
7688 | BGP_STR | |
7689 | "Display VPNv4 NLRI specific information\n" | |
7690 | "Display information for a route distinguisher\n" | |
7691 | "VPN Route Distinguisher\n" | |
7692 | "Detailed information on TCP and BGP neighbor connections\n") | |
7693 | ||
7694 | ALIAS (show_ip_bgp_neighbors, | |
7695 | show_bgp_neighbors_cmd, | |
7696 | "show bgp neighbors", | |
7697 | SHOW_STR | |
7698 | BGP_STR | |
7699 | "Detailed information on TCP and BGP neighbor connections\n") | |
7700 | ||
7701 | ALIAS (show_ip_bgp_neighbors, | |
7702 | show_bgp_ipv6_neighbors_cmd, | |
7703 | "show bgp ipv6 neighbors", | |
7704 | SHOW_STR | |
7705 | BGP_STR | |
7706 | "Address family\n" | |
7707 | "Detailed information on TCP and BGP neighbor connections\n") | |
7708 | ||
7709 | DEFUN (show_ip_bgp_neighbors_peer, | |
7710 | show_ip_bgp_neighbors_peer_cmd, | |
7711 | "show ip bgp neighbors (A.B.C.D|X:X::X:X)", | |
7712 | SHOW_STR | |
7713 | IP_STR | |
7714 | BGP_STR | |
7715 | "Detailed information on TCP and BGP neighbor connections\n" | |
7716 | "Neighbor to display information about\n" | |
7717 | "Neighbor to display information about\n") | |
7718 | { | |
7719 | return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]); | |
7720 | } | |
7721 | ||
7722 | ALIAS (show_ip_bgp_neighbors_peer, | |
7723 | show_ip_bgp_ipv4_neighbors_peer_cmd, | |
7724 | "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)", | |
7725 | SHOW_STR | |
7726 | IP_STR | |
7727 | BGP_STR | |
7728 | "Address family\n" | |
7729 | "Address Family modifier\n" | |
7730 | "Address Family modifier\n" | |
7731 | "Detailed information on TCP and BGP neighbor connections\n" | |
7732 | "Neighbor to display information about\n" | |
7733 | "Neighbor to display information about\n") | |
7734 | ||
7735 | ALIAS (show_ip_bgp_neighbors_peer, | |
7736 | show_ip_bgp_vpnv4_all_neighbors_peer_cmd, | |
7737 | "show ip bgp vpnv4 all neighbors A.B.C.D", | |
7738 | SHOW_STR | |
7739 | IP_STR | |
7740 | BGP_STR | |
7741 | "Display VPNv4 NLRI specific information\n" | |
7742 | "Display information about all VPNv4 NLRIs\n" | |
7743 | "Detailed information on TCP and BGP neighbor connections\n" | |
7744 | "Neighbor to display information about\n") | |
7745 | ||
7746 | ALIAS (show_ip_bgp_neighbors_peer, | |
7747 | show_ip_bgp_vpnv4_rd_neighbors_peer_cmd, | |
7748 | "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D", | |
7749 | SHOW_STR | |
7750 | IP_STR | |
7751 | BGP_STR | |
7752 | "Display VPNv4 NLRI specific information\n" | |
7753 | "Display information about all VPNv4 NLRIs\n" | |
7754 | "Detailed information on TCP and BGP neighbor connections\n" | |
7755 | "Neighbor to display information about\n") | |
7756 | ||
7757 | ALIAS (show_ip_bgp_neighbors_peer, | |
7758 | show_bgp_neighbors_peer_cmd, | |
7759 | "show bgp neighbors (A.B.C.D|X:X::X:X)", | |
7760 | SHOW_STR | |
7761 | BGP_STR | |
7762 | "Detailed information on TCP and BGP neighbor connections\n" | |
7763 | "Neighbor to display information about\n" | |
7764 | "Neighbor to display information about\n") | |
7765 | ||
7766 | ALIAS (show_ip_bgp_neighbors_peer, | |
7767 | show_bgp_ipv6_neighbors_peer_cmd, | |
7768 | "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)", | |
7769 | SHOW_STR | |
7770 | BGP_STR | |
7771 | "Address family\n" | |
7772 | "Detailed information on TCP and BGP neighbor connections\n" | |
7773 | "Neighbor to display information about\n" | |
7774 | "Neighbor to display information about\n") | |
7775 | ||
7776 | DEFUN (show_ip_bgp_instance_neighbors, | |
7777 | show_ip_bgp_instance_neighbors_cmd, | |
7778 | "show ip bgp view WORD neighbors", | |
7779 | SHOW_STR | |
7780 | IP_STR | |
7781 | BGP_STR | |
7782 | "BGP view\n" | |
7783 | "View name\n" | |
7784 | "Detailed information on TCP and BGP neighbor connections\n") | |
7785 | { | |
7786 | return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL); | |
7787 | } | |
7788 | ||
bb46e94f | 7789 | ALIAS (show_ip_bgp_instance_neighbors, |
7790 | show_bgp_instance_neighbors_cmd, | |
7791 | "show bgp view WORD neighbors", | |
7792 | SHOW_STR | |
7793 | BGP_STR | |
7794 | "BGP view\n" | |
7795 | "View name\n" | |
7796 | "Detailed information on TCP and BGP neighbor connections\n") | |
7797 | ||
7798 | ALIAS (show_ip_bgp_instance_neighbors, | |
7799 | show_bgp_instance_ipv6_neighbors_cmd, | |
7800 | "show bgp view WORD ipv6 neighbors", | |
7801 | SHOW_STR | |
7802 | BGP_STR | |
7803 | "BGP view\n" | |
7804 | "View name\n" | |
7805 | "Address family\n" | |
7806 | "Detailed information on TCP and BGP neighbor connections\n") | |
7807 | ||
718e3744 | 7808 | DEFUN (show_ip_bgp_instance_neighbors_peer, |
7809 | show_ip_bgp_instance_neighbors_peer_cmd, | |
7810 | "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)", | |
7811 | SHOW_STR | |
7812 | IP_STR | |
7813 | BGP_STR | |
7814 | "BGP view\n" | |
7815 | "View name\n" | |
7816 | "Detailed information on TCP and BGP neighbor connections\n" | |
7817 | "Neighbor to display information about\n" | |
7818 | "Neighbor to display information about\n") | |
7819 | { | |
7820 | return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]); | |
7821 | } | |
bb46e94f | 7822 | |
7823 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
7824 | show_bgp_instance_neighbors_peer_cmd, | |
7825 | "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)", | |
7826 | SHOW_STR | |
7827 | BGP_STR | |
7828 | "BGP view\n" | |
7829 | "View name\n" | |
7830 | "Detailed information on TCP and BGP neighbor connections\n" | |
7831 | "Neighbor to display information about\n" | |
7832 | "Neighbor to display information about\n") | |
7833 | ||
7834 | ALIAS (show_ip_bgp_instance_neighbors_peer, | |
7835 | show_bgp_instance_ipv6_neighbors_peer_cmd, | |
7836 | "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)", | |
7837 | SHOW_STR | |
7838 | BGP_STR | |
7839 | "BGP view\n" | |
7840 | "View name\n" | |
7841 | "Address family\n" | |
7842 | "Detailed information on TCP and BGP neighbor connections\n" | |
7843 | "Neighbor to display information about\n" | |
7844 | "Neighbor to display information about\n") | |
7845 | \f | |
718e3744 | 7846 | /* Show BGP's AS paths internal data. There are both `show ip bgp |
7847 | paths' and `show ip mbgp paths'. Those functions results are the | |
7848 | same.*/ | |
7849 | DEFUN (show_ip_bgp_paths, | |
7850 | show_ip_bgp_paths_cmd, | |
7851 | "show ip bgp paths", | |
7852 | SHOW_STR | |
7853 | IP_STR | |
7854 | BGP_STR | |
7855 | "Path information\n") | |
7856 | { | |
7857 | vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE); | |
7858 | aspath_print_all_vty (vty); | |
7859 | return CMD_SUCCESS; | |
7860 | } | |
7861 | ||
7862 | DEFUN (show_ip_bgp_ipv4_paths, | |
7863 | show_ip_bgp_ipv4_paths_cmd, | |
7864 | "show ip bgp ipv4 (unicast|multicast) paths", | |
7865 | SHOW_STR | |
7866 | IP_STR | |
7867 | BGP_STR | |
7868 | "Address family\n" | |
7869 | "Address Family modifier\n" | |
7870 | "Address Family modifier\n" | |
7871 | "Path information\n") | |
7872 | { | |
7873 | vty_out (vty, "Address Refcnt Path\r\n"); | |
7874 | aspath_print_all_vty (vty); | |
7875 | ||
7876 | return CMD_SUCCESS; | |
7877 | } | |
7878 | \f | |
7879 | #include "hash.h" | |
7880 | ||
94f2b392 | 7881 | static void |
718e3744 | 7882 | community_show_all_iterator (struct hash_backet *backet, struct vty *vty) |
7883 | { | |
7884 | struct community *com; | |
7885 | ||
7886 | com = (struct community *) backet->data; | |
7887 | vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt, | |
7888 | community_str (com), VTY_NEWLINE); | |
7889 | } | |
7890 | ||
7891 | /* Show BGP's community internal data. */ | |
7892 | DEFUN (show_ip_bgp_community_info, | |
7893 | show_ip_bgp_community_info_cmd, | |
7894 | "show ip bgp community-info", | |
7895 | SHOW_STR | |
7896 | IP_STR | |
7897 | BGP_STR | |
7898 | "List all bgp community information\n") | |
7899 | { | |
7900 | vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE); | |
7901 | ||
7902 | hash_iterate (community_hash (), | |
7903 | (void (*) (struct hash_backet *, void *)) | |
7904 | community_show_all_iterator, | |
7905 | vty); | |
7906 | ||
7907 | return CMD_SUCCESS; | |
7908 | } | |
7909 | ||
7910 | DEFUN (show_ip_bgp_attr_info, | |
7911 | show_ip_bgp_attr_info_cmd, | |
7912 | "show ip bgp attribute-info", | |
7913 | SHOW_STR | |
7914 | IP_STR | |
7915 | BGP_STR | |
7916 | "List all bgp attribute information\n") | |
7917 | { | |
7918 | attr_show_all (vty); | |
7919 | return CMD_SUCCESS; | |
7920 | } | |
7921 | \f | |
94f2b392 | 7922 | static int |
fee0f4c6 | 7923 | bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient, |
7924 | afi_t afi, safi_t safi) | |
7925 | { | |
7926 | char timebuf[BGP_UPTIME_LEN]; | |
7927 | char rmbuf[14]; | |
fd79ac91 | 7928 | const char *rmname; |
fee0f4c6 | 7929 | struct peer *peer; |
1eb8ef25 | 7930 | struct listnode *node, *nnode; |
fee0f4c6 | 7931 | int len; |
7932 | int count = 0; | |
7933 | ||
7934 | if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP)) | |
7935 | { | |
1eb8ef25 | 7936 | for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer)) |
fee0f4c6 | 7937 | { |
7938 | count++; | |
7939 | bgp_write_rsclient_summary (vty, peer, afi, safi); | |
7940 | } | |
7941 | return count; | |
7942 | } | |
7943 | ||
7944 | len = vty_out (vty, "%s", rsclient->host); | |
7945 | len = 16 - len; | |
7946 | ||
7947 | if (len < 1) | |
7948 | vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " "); | |
7949 | else | |
7950 | vty_out (vty, "%*s", len, " "); | |
7951 | ||
3d515fd9 | 7952 | vty_out (vty, "4 "); |
fee0f4c6 | 7953 | |
0b2aa3a0 | 7954 | vty_out (vty, "%11d ", rsclient->as); |
fee0f4c6 | 7955 | |
7956 | rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]); | |
7957 | if ( rmname && strlen (rmname) > 13 ) | |
7958 | { | |
7959 | sprintf (rmbuf, "%13s", "..."); | |
7960 | rmname = strncpy (rmbuf, rmname, 10); | |
7961 | } | |
7962 | else if (! rmname) | |
7963 | rmname = "<none>"; | |
7964 | vty_out (vty, " %13s ", rmname); | |
7965 | ||
7966 | rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]); | |
7967 | if ( rmname && strlen (rmname) > 13 ) | |
7968 | { | |
7969 | sprintf (rmbuf, "%13s", "..."); | |
7970 | rmname = strncpy (rmbuf, rmname, 10); | |
7971 | } | |
7972 | else if (! rmname) | |
7973 | rmname = "<none>"; | |
7974 | vty_out (vty, " %13s ", rmname); | |
7975 | ||
7976 | vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN)); | |
7977 | ||
7978 | if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN)) | |
7979 | vty_out (vty, " Idle (Admin)"); | |
7980 | else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW)) | |
7981 | vty_out (vty, " Idle (PfxCt)"); | |
7982 | else | |
7983 | vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status)); | |
7984 | ||
7985 | vty_out (vty, "%s", VTY_NEWLINE); | |
7986 | ||
7987 | return 1; | |
7988 | } | |
7989 | ||
94f2b392 | 7990 | static int |
fd79ac91 | 7991 | bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, |
7992 | afi_t afi, safi_t safi) | |
fee0f4c6 | 7993 | { |
7994 | struct peer *peer; | |
1eb8ef25 | 7995 | struct listnode *node, *nnode; |
fee0f4c6 | 7996 | int count = 0; |
7997 | ||
7998 | /* Header string for each address family. */ | |
7999 | static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State"; | |
8000 | ||
1eb8ef25 | 8001 | for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer)) |
fee0f4c6 | 8002 | { |
8003 | if (peer->afc[afi][safi] && | |
8004 | CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) | |
8005 | { | |
8006 | if (! count) | |
8007 | { | |
8008 | vty_out (vty, | |
8009 | "Route Server's BGP router identifier %s%s", | |
8010 | inet_ntoa (bgp->router_id), VTY_NEWLINE); | |
8011 | vty_out (vty, | |
8012 | "Route Server's local AS number %d%s", bgp->as, | |
8013 | VTY_NEWLINE); | |
8014 | ||
8015 | vty_out (vty, "%s", VTY_NEWLINE); | |
8016 | vty_out (vty, "%s%s", header, VTY_NEWLINE); | |
8017 | } | |
8018 | ||
8019 | count += bgp_write_rsclient_summary (vty, peer, afi, safi); | |
8020 | } | |
8021 | } | |
8022 | ||
8023 | if (count) | |
8024 | vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE, | |
8025 | count, VTY_NEWLINE); | |
8026 | else | |
8027 | vty_out (vty, "No %s Route Server Client is configured%s", | |
8028 | afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); | |
8029 | ||
8030 | return CMD_SUCCESS; | |
8031 | } | |
8032 | ||
94f2b392 | 8033 | static int |
fd79ac91 | 8034 | bgp_show_rsclient_summary_vty (struct vty *vty, const char *name, |
8035 | afi_t afi, safi_t safi) | |
fee0f4c6 | 8036 | { |
8037 | struct bgp *bgp; | |
8038 | ||
8039 | if (name) | |
8040 | { | |
8041 | bgp = bgp_lookup_by_name (name); | |
8042 | ||
8043 | if (! bgp) | |
8044 | { | |
8045 | vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE); | |
8046 | return CMD_WARNING; | |
8047 | } | |
8048 | ||
8049 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
8050 | return CMD_SUCCESS; | |
8051 | } | |
8052 | ||
8053 | bgp = bgp_get_default (); | |
8054 | ||
8055 | if (bgp) | |
8056 | bgp_show_rsclient_summary (vty, bgp, afi, safi); | |
8057 | ||
8058 | return CMD_SUCCESS; | |
8059 | } | |
8060 | ||
8061 | /* 'show bgp rsclient' commands. */ | |
8062 | DEFUN (show_ip_bgp_rsclient_summary, | |
8063 | show_ip_bgp_rsclient_summary_cmd, | |
8064 | "show ip bgp rsclient summary", | |
8065 | SHOW_STR | |
8066 | IP_STR | |
8067 | BGP_STR | |
8068 | "Information about Route Server Clients\n" | |
8069 | "Summary of all Route Server Clients\n") | |
8070 | { | |
8071 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
8072 | } | |
8073 | ||
8074 | DEFUN (show_ip_bgp_instance_rsclient_summary, | |
8075 | show_ip_bgp_instance_rsclient_summary_cmd, | |
8076 | "show ip bgp view WORD rsclient summary", | |
8077 | SHOW_STR | |
8078 | IP_STR | |
8079 | BGP_STR | |
8080 | "BGP view\n" | |
8081 | "View name\n" | |
8082 | "Information about Route Server Clients\n" | |
8083 | "Summary of all Route Server Clients\n") | |
8084 | { | |
8085 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
8086 | } | |
8087 | ||
8088 | DEFUN (show_ip_bgp_ipv4_rsclient_summary, | |
8089 | show_ip_bgp_ipv4_rsclient_summary_cmd, | |
8090 | "show ip bgp ipv4 (unicast|multicast) rsclient summary", | |
8091 | SHOW_STR | |
8092 | IP_STR | |
8093 | BGP_STR | |
8094 | "Address family\n" | |
8095 | "Address Family modifier\n" | |
8096 | "Address Family modifier\n" | |
8097 | "Information about Route Server Clients\n" | |
8098 | "Summary of all Route Server Clients\n") | |
8099 | { | |
8100 | if (strncmp (argv[0], "m", 1) == 0) | |
8101 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST); | |
8102 | ||
8103 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST); | |
8104 | } | |
8105 | ||
8106 | DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary, | |
8107 | show_ip_bgp_instance_ipv4_rsclient_summary_cmd, | |
8108 | "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary", | |
8109 | SHOW_STR | |
8110 | IP_STR | |
8111 | BGP_STR | |
8112 | "BGP view\n" | |
8113 | "View name\n" | |
8114 | "Address family\n" | |
8115 | "Address Family modifier\n" | |
8116 | "Address Family modifier\n" | |
8117 | "Information about Route Server Clients\n" | |
8118 | "Summary of all Route Server Clients\n") | |
8119 | { | |
8120 | if (strncmp (argv[1], "m", 1) == 0) | |
8121 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST); | |
8122 | ||
8123 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST); | |
8124 | } | |
8125 | ||
8126 | #ifdef HAVE_IPV6 | |
8127 | DEFUN (show_bgp_rsclient_summary, | |
8128 | show_bgp_rsclient_summary_cmd, | |
8129 | "show bgp rsclient summary", | |
8130 | SHOW_STR | |
8131 | BGP_STR | |
8132 | "Information about Route Server Clients\n" | |
8133 | "Summary of all Route Server Clients\n") | |
8134 | { | |
8135 | return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST); | |
8136 | } | |
8137 | ||
8138 | DEFUN (show_bgp_instance_rsclient_summary, | |
8139 | show_bgp_instance_rsclient_summary_cmd, | |
8140 | "show bgp view WORD rsclient summary", | |
8141 | SHOW_STR | |
8142 | BGP_STR | |
8143 | "BGP view\n" | |
8144 | "View name\n" | |
8145 | "Information about Route Server Clients\n" | |
8146 | "Summary of all Route Server Clients\n") | |
8147 | { | |
8148 | return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST); | |
8149 | } | |
8150 | ||
8151 | ALIAS (show_bgp_rsclient_summary, | |
8152 | show_bgp_ipv6_rsclient_summary_cmd, | |
8153 | "show bgp ipv6 rsclient summary", | |
8154 | SHOW_STR | |
8155 | BGP_STR | |
8156 | "Address family\n" | |
8157 | "Information about Route Server Clients\n" | |
8158 | "Summary of all Route Server Clients\n") | |
8159 | ||
8160 | ALIAS (show_bgp_instance_rsclient_summary, | |
8161 | show_bgp_instance_ipv6_rsclient_summary_cmd, | |
8162 | "show bgp view WORD ipv6 rsclient summary", | |
8163 | SHOW_STR | |
8164 | BGP_STR | |
8165 | "BGP view\n" | |
8166 | "View name\n" | |
8167 | "Address family\n" | |
8168 | "Information about Route Server Clients\n" | |
8169 | "Summary of all Route Server Clients\n") | |
8170 | #endif /* HAVE IPV6 */ | |
8171 | \f | |
718e3744 | 8172 | /* Redistribute VTY commands. */ |
8173 | ||
8174 | /* Utility function to convert user input route type string to route | |
8175 | type. */ | |
8176 | static int | |
fd79ac91 | 8177 | bgp_str2route_type (int afi, const char *str) |
718e3744 | 8178 | { |
8179 | if (! str) | |
8180 | return 0; | |
8181 | ||
8182 | if (afi == AFI_IP) | |
8183 | { | |
8184 | if (strncmp (str, "k", 1) == 0) | |
8185 | return ZEBRA_ROUTE_KERNEL; | |
8186 | else if (strncmp (str, "c", 1) == 0) | |
8187 | return ZEBRA_ROUTE_CONNECT; | |
8188 | else if (strncmp (str, "s", 1) == 0) | |
8189 | return ZEBRA_ROUTE_STATIC; | |
8190 | else if (strncmp (str, "r", 1) == 0) | |
8191 | return ZEBRA_ROUTE_RIP; | |
8192 | else if (strncmp (str, "o", 1) == 0) | |
8193 | return ZEBRA_ROUTE_OSPF; | |
8194 | } | |
8195 | if (afi == AFI_IP6) | |
8196 | { | |
8197 | if (strncmp (str, "k", 1) == 0) | |
8198 | return ZEBRA_ROUTE_KERNEL; | |
8199 | else if (strncmp (str, "c", 1) == 0) | |
8200 | return ZEBRA_ROUTE_CONNECT; | |
8201 | else if (strncmp (str, "s", 1) == 0) | |
8202 | return ZEBRA_ROUTE_STATIC; | |
8203 | else if (strncmp (str, "r", 1) == 0) | |
8204 | return ZEBRA_ROUTE_RIPNG; | |
8205 | else if (strncmp (str, "o", 1) == 0) | |
8206 | return ZEBRA_ROUTE_OSPF6; | |
8207 | } | |
8208 | return 0; | |
8209 | } | |
8210 | ||
8211 | DEFUN (bgp_redistribute_ipv4, | |
8212 | bgp_redistribute_ipv4_cmd, | |
8213 | "redistribute (connected|kernel|ospf|rip|static)", | |
8214 | "Redistribute information from another routing protocol\n" | |
8215 | "Connected\n" | |
8216 | "Kernel routes\n" | |
8217 | "Open Shurtest Path First (OSPF)\n" | |
8218 | "Routing Information Protocol (RIP)\n" | |
8219 | "Static routes\n") | |
8220 | { | |
8221 | int type; | |
8222 | ||
8223 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
8224 | if (! type) | |
8225 | { | |
8226 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8227 | return CMD_WARNING; | |
8228 | } | |
8229 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
8230 | } | |
8231 | ||
8232 | DEFUN (bgp_redistribute_ipv4_rmap, | |
8233 | bgp_redistribute_ipv4_rmap_cmd, | |
8234 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD", | |
8235 | "Redistribute information from another routing protocol\n" | |
8236 | "Connected\n" | |
8237 | "Kernel routes\n" | |
8238 | "Open Shurtest Path First (OSPF)\n" | |
8239 | "Routing Information Protocol (RIP)\n" | |
8240 | "Static routes\n" | |
8241 | "Route map reference\n" | |
8242 | "Pointer to route-map entries\n") | |
8243 | { | |
8244 | int type; | |
8245 | ||
8246 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
8247 | if (! type) | |
8248 | { | |
8249 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8250 | return CMD_WARNING; | |
8251 | } | |
8252 | ||
8253 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); | |
8254 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
8255 | } | |
8256 | ||
8257 | DEFUN (bgp_redistribute_ipv4_metric, | |
8258 | bgp_redistribute_ipv4_metric_cmd, | |
8259 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", | |
8260 | "Redistribute information from another routing protocol\n" | |
8261 | "Connected\n" | |
8262 | "Kernel routes\n" | |
8263 | "Open Shurtest Path First (OSPF)\n" | |
8264 | "Routing Information Protocol (RIP)\n" | |
8265 | "Static routes\n" | |
8266 | "Metric for redistributed routes\n" | |
8267 | "Default metric\n") | |
8268 | { | |
8269 | int type; | |
8270 | u_int32_t metric; | |
8271 | ||
8272 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
8273 | if (! type) | |
8274 | { | |
8275 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8276 | return CMD_WARNING; | |
8277 | } | |
8278 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
8279 | ||
8280 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
8281 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
8282 | } | |
8283 | ||
8284 | DEFUN (bgp_redistribute_ipv4_rmap_metric, | |
8285 | bgp_redistribute_ipv4_rmap_metric_cmd, | |
8286 | "redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", | |
8287 | "Redistribute information from another routing protocol\n" | |
8288 | "Connected\n" | |
8289 | "Kernel routes\n" | |
8290 | "Open Shurtest Path First (OSPF)\n" | |
8291 | "Routing Information Protocol (RIP)\n" | |
8292 | "Static routes\n" | |
8293 | "Route map reference\n" | |
8294 | "Pointer to route-map entries\n" | |
8295 | "Metric for redistributed routes\n" | |
8296 | "Default metric\n") | |
8297 | { | |
8298 | int type; | |
8299 | u_int32_t metric; | |
8300 | ||
8301 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
8302 | if (! type) | |
8303 | { | |
8304 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8305 | return CMD_WARNING; | |
8306 | } | |
8307 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
8308 | ||
8309 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]); | |
8310 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
8311 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
8312 | } | |
8313 | ||
8314 | DEFUN (bgp_redistribute_ipv4_metric_rmap, | |
8315 | bgp_redistribute_ipv4_metric_rmap_cmd, | |
8316 | "redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", | |
8317 | "Redistribute information from another routing protocol\n" | |
8318 | "Connected\n" | |
8319 | "Kernel routes\n" | |
8320 | "Open Shurtest Path First (OSPF)\n" | |
8321 | "Routing Information Protocol (RIP)\n" | |
8322 | "Static routes\n" | |
8323 | "Metric for redistributed routes\n" | |
8324 | "Default metric\n" | |
8325 | "Route map reference\n" | |
8326 | "Pointer to route-map entries\n") | |
8327 | { | |
8328 | int type; | |
8329 | u_int32_t metric; | |
8330 | ||
8331 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
8332 | if (! type) | |
8333 | { | |
8334 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8335 | return CMD_WARNING; | |
8336 | } | |
8337 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
8338 | ||
8339 | bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric); | |
8340 | bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]); | |
8341 | return bgp_redistribute_set (vty->index, AFI_IP, type); | |
8342 | } | |
8343 | ||
8344 | DEFUN (no_bgp_redistribute_ipv4, | |
8345 | no_bgp_redistribute_ipv4_cmd, | |
8346 | "no redistribute (connected|kernel|ospf|rip|static)", | |
8347 | NO_STR | |
8348 | "Redistribute information from another routing protocol\n" | |
8349 | "Connected\n" | |
8350 | "Kernel routes\n" | |
8351 | "Open Shurtest Path First (OSPF)\n" | |
8352 | "Routing Information Protocol (RIP)\n" | |
8353 | "Static routes\n") | |
8354 | { | |
8355 | int type; | |
8356 | ||
8357 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
8358 | if (! type) | |
8359 | { | |
8360 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8361 | return CMD_WARNING; | |
8362 | } | |
8363 | ||
8364 | return bgp_redistribute_unset (vty->index, AFI_IP, type); | |
8365 | } | |
8366 | ||
8367 | DEFUN (no_bgp_redistribute_ipv4_rmap, | |
8368 | no_bgp_redistribute_ipv4_rmap_cmd, | |
8369 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD", | |
8370 | NO_STR | |
8371 | "Redistribute information from another routing protocol\n" | |
8372 | "Connected\n" | |
8373 | "Kernel routes\n" | |
8374 | "Open Shurtest Path First (OSPF)\n" | |
8375 | "Routing Information Protocol (RIP)\n" | |
8376 | "Static routes\n" | |
8377 | "Route map reference\n" | |
8378 | "Pointer to route-map entries\n") | |
8379 | { | |
8380 | int type; | |
8381 | ||
8382 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
8383 | if (! type) | |
8384 | { | |
8385 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8386 | return CMD_WARNING; | |
8387 | } | |
8388 | ||
8389 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); | |
8390 | return CMD_SUCCESS; | |
8391 | } | |
8392 | ||
8393 | DEFUN (no_bgp_redistribute_ipv4_metric, | |
8394 | no_bgp_redistribute_ipv4_metric_cmd, | |
8395 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295>", | |
8396 | NO_STR | |
8397 | "Redistribute information from another routing protocol\n" | |
8398 | "Connected\n" | |
8399 | "Kernel routes\n" | |
8400 | "Open Shurtest Path First (OSPF)\n" | |
8401 | "Routing Information Protocol (RIP)\n" | |
8402 | "Static routes\n" | |
8403 | "Metric for redistributed routes\n" | |
8404 | "Default metric\n") | |
8405 | { | |
8406 | int type; | |
8407 | ||
8408 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
8409 | if (! type) | |
8410 | { | |
8411 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8412 | return CMD_WARNING; | |
8413 | } | |
8414 | ||
8415 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); | |
8416 | return CMD_SUCCESS; | |
8417 | } | |
8418 | ||
8419 | DEFUN (no_bgp_redistribute_ipv4_rmap_metric, | |
8420 | no_bgp_redistribute_ipv4_rmap_metric_cmd, | |
8421 | "no redistribute (connected|kernel|ospf|rip|static) route-map WORD metric <0-4294967295>", | |
8422 | NO_STR | |
8423 | "Redistribute information from another routing protocol\n" | |
8424 | "Connected\n" | |
8425 | "Kernel routes\n" | |
8426 | "Open Shurtest Path First (OSPF)\n" | |
8427 | "Routing Information Protocol (RIP)\n" | |
8428 | "Static routes\n" | |
8429 | "Route map reference\n" | |
8430 | "Pointer to route-map entries\n" | |
8431 | "Metric for redistributed routes\n" | |
8432 | "Default metric\n") | |
8433 | { | |
8434 | int type; | |
8435 | ||
8436 | type = bgp_str2route_type (AFI_IP, argv[0]); | |
8437 | if (! type) | |
8438 | { | |
8439 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8440 | return CMD_WARNING; | |
8441 | } | |
8442 | ||
8443 | bgp_redistribute_metric_unset (vty->index, AFI_IP, type); | |
8444 | bgp_redistribute_routemap_unset (vty->index, AFI_IP, type); | |
8445 | return CMD_SUCCESS; | |
8446 | } | |
8447 | ||
8448 | ALIAS (no_bgp_redistribute_ipv4_rmap_metric, | |
8449 | no_bgp_redistribute_ipv4_metric_rmap_cmd, | |
8450 | "no redistribute (connected|kernel|ospf|rip|static) metric <0-4294967295> route-map WORD", | |
8451 | NO_STR | |
8452 | "Redistribute information from another routing protocol\n" | |
8453 | "Connected\n" | |
8454 | "Kernel routes\n" | |
8455 | "Open Shurtest Path First (OSPF)\n" | |
8456 | "Routing Information Protocol (RIP)\n" | |
8457 | "Static routes\n" | |
8458 | "Metric for redistributed routes\n" | |
8459 | "Default metric\n" | |
8460 | "Route map reference\n" | |
8461 | "Pointer to route-map entries\n") | |
8462 | \f | |
8463 | #ifdef HAVE_IPV6 | |
8464 | DEFUN (bgp_redistribute_ipv6, | |
8465 | bgp_redistribute_ipv6_cmd, | |
8466 | "redistribute (connected|kernel|ospf6|ripng|static)", | |
8467 | "Redistribute information from another routing protocol\n" | |
8468 | "Connected\n" | |
8469 | "Kernel routes\n" | |
8470 | "Open Shurtest Path First (OSPFv3)\n" | |
8471 | "Routing Information Protocol (RIPng)\n" | |
8472 | "Static routes\n") | |
8473 | { | |
8474 | int type; | |
8475 | ||
8476 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8477 | if (! type) | |
8478 | { | |
8479 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8480 | return CMD_WARNING; | |
8481 | } | |
8482 | ||
8483 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
8484 | } | |
8485 | ||
8486 | DEFUN (bgp_redistribute_ipv6_rmap, | |
8487 | bgp_redistribute_ipv6_rmap_cmd, | |
8488 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", | |
8489 | "Redistribute information from another routing protocol\n" | |
8490 | "Connected\n" | |
8491 | "Kernel routes\n" | |
8492 | "Open Shurtest Path First (OSPFv3)\n" | |
8493 | "Routing Information Protocol (RIPng)\n" | |
8494 | "Static routes\n" | |
8495 | "Route map reference\n" | |
8496 | "Pointer to route-map entries\n") | |
8497 | { | |
8498 | int type; | |
8499 | ||
8500 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8501 | if (! type) | |
8502 | { | |
8503 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8504 | return CMD_WARNING; | |
8505 | } | |
8506 | ||
8507 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); | |
8508 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
8509 | } | |
8510 | ||
8511 | DEFUN (bgp_redistribute_ipv6_metric, | |
8512 | bgp_redistribute_ipv6_metric_cmd, | |
8513 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", | |
8514 | "Redistribute information from another routing protocol\n" | |
8515 | "Connected\n" | |
8516 | "Kernel routes\n" | |
8517 | "Open Shurtest Path First (OSPFv3)\n" | |
8518 | "Routing Information Protocol (RIPng)\n" | |
8519 | "Static routes\n" | |
8520 | "Metric for redistributed routes\n" | |
8521 | "Default metric\n") | |
8522 | { | |
8523 | int type; | |
8524 | u_int32_t metric; | |
8525 | ||
8526 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8527 | if (! type) | |
8528 | { | |
8529 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8530 | return CMD_WARNING; | |
8531 | } | |
8532 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
8533 | ||
8534 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
8535 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
8536 | } | |
8537 | ||
8538 | DEFUN (bgp_redistribute_ipv6_rmap_metric, | |
8539 | bgp_redistribute_ipv6_rmap_metric_cmd, | |
8540 | "redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", | |
8541 | "Redistribute information from another routing protocol\n" | |
8542 | "Connected\n" | |
8543 | "Kernel routes\n" | |
8544 | "Open Shurtest Path First (OSPFv3)\n" | |
8545 | "Routing Information Protocol (RIPng)\n" | |
8546 | "Static routes\n" | |
8547 | "Route map reference\n" | |
8548 | "Pointer to route-map entries\n" | |
8549 | "Metric for redistributed routes\n" | |
8550 | "Default metric\n") | |
8551 | { | |
8552 | int type; | |
8553 | u_int32_t metric; | |
8554 | ||
8555 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8556 | if (! type) | |
8557 | { | |
8558 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8559 | return CMD_WARNING; | |
8560 | } | |
8561 | VTY_GET_INTEGER ("metric", metric, argv[2]); | |
8562 | ||
8563 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]); | |
8564 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
8565 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
8566 | } | |
8567 | ||
8568 | DEFUN (bgp_redistribute_ipv6_metric_rmap, | |
8569 | bgp_redistribute_ipv6_metric_rmap_cmd, | |
8570 | "redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", | |
8571 | "Redistribute information from another routing protocol\n" | |
8572 | "Connected\n" | |
8573 | "Kernel routes\n" | |
8574 | "Open Shurtest Path First (OSPFv3)\n" | |
8575 | "Routing Information Protocol (RIPng)\n" | |
8576 | "Static routes\n" | |
8577 | "Metric for redistributed routes\n" | |
8578 | "Default metric\n" | |
8579 | "Route map reference\n" | |
8580 | "Pointer to route-map entries\n") | |
8581 | { | |
8582 | int type; | |
8583 | u_int32_t metric; | |
8584 | ||
8585 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8586 | if (! type) | |
8587 | { | |
8588 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8589 | return CMD_WARNING; | |
8590 | } | |
8591 | VTY_GET_INTEGER ("metric", metric, argv[1]); | |
8592 | ||
8593 | bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric); | |
8594 | bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]); | |
8595 | return bgp_redistribute_set (vty->index, AFI_IP6, type); | |
8596 | } | |
8597 | ||
8598 | DEFUN (no_bgp_redistribute_ipv6, | |
8599 | no_bgp_redistribute_ipv6_cmd, | |
8600 | "no redistribute (connected|kernel|ospf6|ripng|static)", | |
8601 | NO_STR | |
8602 | "Redistribute information from another routing protocol\n" | |
8603 | "Connected\n" | |
8604 | "Kernel routes\n" | |
8605 | "Open Shurtest Path First (OSPFv3)\n" | |
8606 | "Routing Information Protocol (RIPng)\n" | |
8607 | "Static routes\n") | |
8608 | { | |
8609 | int type; | |
8610 | ||
8611 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8612 | if (! type) | |
8613 | { | |
8614 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8615 | return CMD_WARNING; | |
8616 | } | |
8617 | ||
8618 | return bgp_redistribute_unset (vty->index, AFI_IP6, type); | |
8619 | } | |
8620 | ||
8621 | DEFUN (no_bgp_redistribute_ipv6_rmap, | |
8622 | no_bgp_redistribute_ipv6_rmap_cmd, | |
8623 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD", | |
8624 | NO_STR | |
8625 | "Redistribute information from another routing protocol\n" | |
8626 | "Connected\n" | |
8627 | "Kernel routes\n" | |
8628 | "Open Shurtest Path First (OSPFv3)\n" | |
8629 | "Routing Information Protocol (RIPng)\n" | |
8630 | "Static routes\n" | |
8631 | "Route map reference\n" | |
8632 | "Pointer to route-map entries\n") | |
8633 | { | |
8634 | int type; | |
8635 | ||
8636 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8637 | if (! type) | |
8638 | { | |
8639 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8640 | return CMD_WARNING; | |
8641 | } | |
8642 | ||
8643 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); | |
8644 | return CMD_SUCCESS; | |
8645 | } | |
8646 | ||
8647 | DEFUN (no_bgp_redistribute_ipv6_metric, | |
8648 | no_bgp_redistribute_ipv6_metric_cmd, | |
8649 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295>", | |
8650 | NO_STR | |
8651 | "Redistribute information from another routing protocol\n" | |
8652 | "Connected\n" | |
8653 | "Kernel routes\n" | |
8654 | "Open Shurtest Path First (OSPFv3)\n" | |
8655 | "Routing Information Protocol (RIPng)\n" | |
8656 | "Static routes\n" | |
8657 | "Metric for redistributed routes\n" | |
8658 | "Default metric\n") | |
8659 | { | |
8660 | int type; | |
8661 | ||
8662 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8663 | if (! type) | |
8664 | { | |
8665 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8666 | return CMD_WARNING; | |
8667 | } | |
8668 | ||
8669 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); | |
8670 | return CMD_SUCCESS; | |
8671 | } | |
8672 | ||
8673 | DEFUN (no_bgp_redistribute_ipv6_rmap_metric, | |
8674 | no_bgp_redistribute_ipv6_rmap_metric_cmd, | |
8675 | "no redistribute (connected|kernel|ospf6|ripng|static) route-map WORD metric <0-4294967295>", | |
8676 | NO_STR | |
8677 | "Redistribute information from another routing protocol\n" | |
8678 | "Connected\n" | |
8679 | "Kernel routes\n" | |
8680 | "Open Shurtest Path First (OSPFv3)\n" | |
8681 | "Routing Information Protocol (RIPng)\n" | |
8682 | "Static routes\n" | |
8683 | "Route map reference\n" | |
8684 | "Pointer to route-map entries\n" | |
8685 | "Metric for redistributed routes\n" | |
8686 | "Default metric\n") | |
8687 | { | |
8688 | int type; | |
8689 | ||
8690 | type = bgp_str2route_type (AFI_IP6, argv[0]); | |
8691 | if (! type) | |
8692 | { | |
8693 | vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE); | |
8694 | return CMD_WARNING; | |
8695 | } | |
8696 | ||
8697 | bgp_redistribute_metric_unset (vty->index, AFI_IP6, type); | |
8698 | bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type); | |
8699 | return CMD_SUCCESS; | |
8700 | } | |
8701 | ||
8702 | ALIAS (no_bgp_redistribute_ipv6_rmap_metric, | |
8703 | no_bgp_redistribute_ipv6_metric_rmap_cmd, | |
8704 | "no redistribute (connected|kernel|ospf6|ripng|static) metric <0-4294967295> route-map WORD", | |
8705 | NO_STR | |
8706 | "Redistribute information from another routing protocol\n" | |
8707 | "Connected\n" | |
8708 | "Kernel routes\n" | |
8709 | "Open Shurtest Path First (OSPFv3)\n" | |
8710 | "Routing Information Protocol (RIPng)\n" | |
8711 | "Static routes\n" | |
8712 | "Metric for redistributed routes\n" | |
8713 | "Default metric\n" | |
8714 | "Route map reference\n" | |
8715 | "Pointer to route-map entries\n") | |
8716 | #endif /* HAVE_IPV6 */ | |
8717 | \f | |
8718 | int | |
8719 | bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, | |
8720 | safi_t safi, int *write) | |
8721 | { | |
8722 | int i; | |
718e3744 | 8723 | |
8724 | /* Unicast redistribution only. */ | |
8725 | if (safi != SAFI_UNICAST) | |
8726 | return 0; | |
8727 | ||
8728 | for (i = 0; i < ZEBRA_ROUTE_MAX; i++) | |
8729 | { | |
8730 | /* Redistribute BGP does not make sense. */ | |
8731 | if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) | |
8732 | { | |
8733 | /* Display "address-family" when it is not yet diplayed. */ | |
8734 | bgp_config_write_family_header (vty, afi, safi, write); | |
8735 | ||
8736 | /* "redistribute" configuration. */ | |
f52d13cb | 8737 | vty_out (vty, " redistribute %s", zebra_route_string(i)); |
718e3744 | 8738 | |
8739 | if (bgp->redist_metric_flag[afi][i]) | |
8740 | vty_out (vty, " metric %d", bgp->redist_metric[afi][i]); | |
8741 | ||
8742 | if (bgp->rmap[afi][i].name) | |
8743 | vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); | |
8744 | ||
8745 | vty_out (vty, "%s", VTY_NEWLINE); | |
8746 | } | |
8747 | } | |
8748 | return *write; | |
8749 | } | |
8750 | \f | |
8751 | /* BGP node structure. */ | |
8752 | struct cmd_node bgp_node = | |
8753 | { | |
8754 | BGP_NODE, | |
8755 | "%s(config-router)# ", | |
8756 | 1, | |
8757 | }; | |
8758 | ||
8759 | struct cmd_node bgp_ipv4_unicast_node = | |
8760 | { | |
8761 | BGP_IPV4_NODE, | |
8762 | "%s(config-router-af)# ", | |
8763 | 1, | |
8764 | }; | |
8765 | ||
8766 | struct cmd_node bgp_ipv4_multicast_node = | |
8767 | { | |
8768 | BGP_IPV4M_NODE, | |
8769 | "%s(config-router-af)# ", | |
8770 | 1, | |
8771 | }; | |
8772 | ||
8773 | struct cmd_node bgp_ipv6_unicast_node = | |
8774 | { | |
8775 | BGP_IPV6_NODE, | |
8776 | "%s(config-router-af)# ", | |
8777 | 1, | |
8778 | }; | |
8779 | ||
25ffbdc1 | 8780 | struct cmd_node bgp_ipv6_multicast_node = |
8781 | { | |
8782 | BGP_IPV6M_NODE, | |
8783 | "%s(config-router-af)# ", | |
8784 | 1, | |
8785 | }; | |
8786 | ||
718e3744 | 8787 | struct cmd_node bgp_vpnv4_node = |
8788 | { | |
8789 | BGP_VPNV4_NODE, | |
8790 | "%s(config-router-af)# ", | |
8791 | 1 | |
8792 | }; | |
8793 | \f | |
1f8ae70b | 8794 | static void community_list_vty (void); |
8795 | ||
718e3744 | 8796 | void |
94f2b392 | 8797 | bgp_vty_init (void) |
718e3744 | 8798 | { |
718e3744 | 8799 | /* Install bgp top node. */ |
8800 | install_node (&bgp_node, bgp_config_write); | |
8801 | install_node (&bgp_ipv4_unicast_node, NULL); | |
8802 | install_node (&bgp_ipv4_multicast_node, NULL); | |
8803 | install_node (&bgp_ipv6_unicast_node, NULL); | |
25ffbdc1 | 8804 | install_node (&bgp_ipv6_multicast_node, NULL); |
718e3744 | 8805 | install_node (&bgp_vpnv4_node, NULL); |
8806 | ||
8807 | /* Install default VTY commands to new nodes. */ | |
8808 | install_default (BGP_NODE); | |
8809 | install_default (BGP_IPV4_NODE); | |
8810 | install_default (BGP_IPV4M_NODE); | |
8811 | install_default (BGP_IPV6_NODE); | |
25ffbdc1 | 8812 | install_default (BGP_IPV6M_NODE); |
718e3744 | 8813 | install_default (BGP_VPNV4_NODE); |
8814 | ||
8815 | /* "bgp multiple-instance" commands. */ | |
8816 | install_element (CONFIG_NODE, &bgp_multiple_instance_cmd); | |
8817 | install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd); | |
8818 | ||
8819 | /* "bgp config-type" commands. */ | |
8820 | install_element (CONFIG_NODE, &bgp_config_type_cmd); | |
8821 | install_element (CONFIG_NODE, &no_bgp_config_type_cmd); | |
8822 | ||
8823 | /* Dummy commands (Currently not supported) */ | |
8824 | install_element (BGP_NODE, &no_synchronization_cmd); | |
8825 | install_element (BGP_NODE, &no_auto_summary_cmd); | |
8826 | ||
8827 | /* "router bgp" commands. */ | |
8828 | install_element (CONFIG_NODE, &router_bgp_cmd); | |
8829 | install_element (CONFIG_NODE, &router_bgp_view_cmd); | |
8830 | ||
8831 | /* "no router bgp" commands. */ | |
8832 | install_element (CONFIG_NODE, &no_router_bgp_cmd); | |
8833 | install_element (CONFIG_NODE, &no_router_bgp_view_cmd); | |
8834 | ||
8835 | /* "bgp router-id" commands. */ | |
8836 | install_element (BGP_NODE, &bgp_router_id_cmd); | |
8837 | install_element (BGP_NODE, &no_bgp_router_id_cmd); | |
8838 | install_element (BGP_NODE, &no_bgp_router_id_val_cmd); | |
8839 | ||
8840 | /* "bgp cluster-id" commands. */ | |
8841 | install_element (BGP_NODE, &bgp_cluster_id_cmd); | |
8842 | install_element (BGP_NODE, &bgp_cluster_id32_cmd); | |
8843 | install_element (BGP_NODE, &no_bgp_cluster_id_cmd); | |
8844 | install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd); | |
8845 | ||
8846 | /* "bgp confederation" commands. */ | |
8847 | install_element (BGP_NODE, &bgp_confederation_identifier_cmd); | |
8848 | install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd); | |
8849 | install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd); | |
8850 | ||
8851 | /* "bgp confederation peers" commands. */ | |
8852 | install_element (BGP_NODE, &bgp_confederation_peers_cmd); | |
8853 | install_element (BGP_NODE, &no_bgp_confederation_peers_cmd); | |
8854 | ||
8855 | /* "timers bgp" commands. */ | |
8856 | install_element (BGP_NODE, &bgp_timers_cmd); | |
8857 | install_element (BGP_NODE, &no_bgp_timers_cmd); | |
8858 | install_element (BGP_NODE, &no_bgp_timers_arg_cmd); | |
8859 | ||
8860 | /* "bgp client-to-client reflection" commands */ | |
8861 | install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd); | |
8862 | install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd); | |
8863 | ||
8864 | /* "bgp always-compare-med" commands */ | |
8865 | install_element (BGP_NODE, &bgp_always_compare_med_cmd); | |
8866 | install_element (BGP_NODE, &no_bgp_always_compare_med_cmd); | |
8867 | ||
8868 | /* "bgp deterministic-med" commands */ | |
8869 | install_element (BGP_NODE, &bgp_deterministic_med_cmd); | |
8870 | install_element (BGP_NODE, &no_bgp_deterministic_med_cmd); | |
538621f2 | 8871 | |
538621f2 | 8872 | /* "bgp graceful-restart" commands */ |
8873 | install_element (BGP_NODE, &bgp_graceful_restart_cmd); | |
8874 | install_element (BGP_NODE, &no_bgp_graceful_restart_cmd); | |
93406d87 | 8875 | install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd); |
8876 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd); | |
8877 | install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd); | |
718e3744 | 8878 | |
8879 | /* "bgp fast-external-failover" commands */ | |
8880 | install_element (BGP_NODE, &bgp_fast_external_failover_cmd); | |
8881 | install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd); | |
8882 | ||
8883 | /* "bgp enforce-first-as" commands */ | |
8884 | install_element (BGP_NODE, &bgp_enforce_first_as_cmd); | |
8885 | install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd); | |
8886 | ||
8887 | /* "bgp bestpath compare-routerid" commands */ | |
8888 | install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd); | |
8889 | install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd); | |
8890 | ||
8891 | /* "bgp bestpath as-path ignore" commands */ | |
8892 | install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd); | |
8893 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd); | |
8894 | ||
6811845b | 8895 | /* "bgp bestpath as-path confed" commands */ |
8896 | install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd); | |
8897 | install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd); | |
8898 | ||
848973c7 | 8899 | /* "bgp log-neighbor-changes" commands */ |
8900 | install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); | |
8901 | install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); | |
8902 | ||
718e3744 | 8903 | /* "bgp bestpath med" commands */ |
8904 | install_element (BGP_NODE, &bgp_bestpath_med_cmd); | |
8905 | install_element (BGP_NODE, &bgp_bestpath_med2_cmd); | |
8906 | install_element (BGP_NODE, &bgp_bestpath_med3_cmd); | |
8907 | install_element (BGP_NODE, &no_bgp_bestpath_med_cmd); | |
8908 | install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd); | |
8909 | install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd); | |
8910 | ||
8911 | /* "no bgp default ipv4-unicast" commands. */ | |
8912 | install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd); | |
8913 | install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd); | |
8914 | ||
8915 | /* "bgp network import-check" commands. */ | |
8916 | install_element (BGP_NODE, &bgp_network_import_check_cmd); | |
8917 | install_element (BGP_NODE, &no_bgp_network_import_check_cmd); | |
8918 | ||
8919 | /* "bgp default local-preference" commands. */ | |
8920 | install_element (BGP_NODE, &bgp_default_local_preference_cmd); | |
8921 | install_element (BGP_NODE, &no_bgp_default_local_preference_cmd); | |
8922 | install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd); | |
8923 | ||
8924 | /* "neighbor remote-as" commands. */ | |
8925 | install_element (BGP_NODE, &neighbor_remote_as_cmd); | |
8926 | install_element (BGP_NODE, &no_neighbor_cmd); | |
8927 | install_element (BGP_NODE, &no_neighbor_remote_as_cmd); | |
8928 | ||
8929 | /* "neighbor peer-group" commands. */ | |
8930 | install_element (BGP_NODE, &neighbor_peer_group_cmd); | |
8931 | install_element (BGP_NODE, &no_neighbor_peer_group_cmd); | |
8932 | install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd); | |
8933 | ||
8934 | /* "neighbor local-as" commands. */ | |
8935 | install_element (BGP_NODE, &neighbor_local_as_cmd); | |
8936 | install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd); | |
8937 | install_element (BGP_NODE, &no_neighbor_local_as_cmd); | |
8938 | install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); | |
8939 | install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); | |
8940 | ||
0df7c91f PJ |
8941 | /* "neighbor password" commands. */ |
8942 | install_element (BGP_NODE, &neighbor_password_cmd); | |
8943 | install_element (BGP_NODE, &no_neighbor_password_cmd); | |
8944 | ||
718e3744 | 8945 | /* "neighbor activate" commands. */ |
8946 | install_element (BGP_NODE, &neighbor_activate_cmd); | |
8947 | install_element (BGP_IPV4_NODE, &neighbor_activate_cmd); | |
8948 | install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd); | |
8949 | install_element (BGP_IPV6_NODE, &neighbor_activate_cmd); | |
25ffbdc1 | 8950 | install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd); |
718e3744 | 8951 | install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd); |
8952 | ||
8953 | /* "no neighbor activate" commands. */ | |
8954 | install_element (BGP_NODE, &no_neighbor_activate_cmd); | |
8955 | install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd); | |
8956 | install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd); | |
8957 | install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd); | |
25ffbdc1 | 8958 | install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd); |
718e3744 | 8959 | install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd); |
8960 | ||
8961 | /* "neighbor peer-group set" commands. */ | |
8962 | install_element (BGP_NODE, &neighbor_set_peer_group_cmd); | |
8963 | install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd); | |
8964 | install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd); | |
8965 | install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd); | |
25ffbdc1 | 8966 | install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd); |
a58545bb | 8967 | install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd); |
8968 | ||
718e3744 | 8969 | /* "no neighbor peer-group unset" commands. */ |
8970 | install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd); | |
8971 | install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd); | |
8972 | install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd); | |
8973 | install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd); | |
25ffbdc1 | 8974 | install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd); |
a58545bb | 8975 | install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd); |
8976 | ||
718e3744 | 8977 | /* "neighbor softreconfiguration inbound" commands.*/ |
8978 | install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd); | |
8979 | install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8980 | install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd); | |
8981 | install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8982 | install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd); | |
8983 | install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
8984 | install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd); | |
8985 | install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
25ffbdc1 | 8986 | install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd); |
8987 | install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
a58545bb | 8988 | install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd); |
8989 | install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd); | |
718e3744 | 8990 | |
8991 | /* "neighbor attribute-unchanged" commands. */ | |
8992 | install_element (BGP_NODE, &neighbor_attr_unchanged_cmd); | |
8993 | install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd); | |
8994 | install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd); | |
8995 | install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd); | |
8996 | install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd); | |
8997 | install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd); | |
8998 | install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd); | |
8999 | install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd); | |
9000 | install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd); | |
9001 | install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd); | |
9002 | install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd); | |
9003 | install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd); | |
9004 | install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9005 | install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9006 | install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9007 | install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9008 | install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9009 | install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9010 | install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9011 | install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9012 | install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9013 | install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd); | |
9014 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd); | |
9015 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd); | |
9016 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd); | |
9017 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd); | |
9018 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd); | |
9019 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd); | |
9020 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd); | |
9021 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd); | |
9022 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd); | |
9023 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd); | |
9024 | install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd); | |
9025 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
9026 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9027 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9028 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9029 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9030 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9031 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9032 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9033 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9034 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9035 | install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
9036 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd); | |
9037 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd); | |
9038 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd); | |
9039 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd); | |
9040 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd); | |
9041 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd); | |
9042 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd); | |
9043 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd); | |
9044 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd); | |
9045 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd); | |
9046 | install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd); | |
9047 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd); | |
9048 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9049 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9050 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9051 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9052 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9053 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9054 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9055 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9056 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9057 | install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
9058 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd); | |
9059 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd); | |
9060 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd); | |
9061 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd); | |
9062 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd); | |
9063 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd); | |
9064 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd); | |
9065 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd); | |
9066 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd); | |
9067 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd); | |
9068 | install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd); | |
9069 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd); | |
9070 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9071 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9072 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9073 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9074 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9075 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9076 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9077 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9078 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9079 | install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd); | |
25ffbdc1 | 9080 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd); |
9081 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd); | |
9082 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd); | |
9083 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd); | |
9084 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd); | |
9085 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd); | |
9086 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd); | |
9087 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd); | |
9088 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd); | |
9089 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd); | |
9090 | install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd); | |
9091 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd); | |
9092 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9093 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9094 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9095 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9096 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9097 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9098 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9099 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9100 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9101 | install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd); | |
718e3744 | 9102 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd); |
9103 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd); | |
9104 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd); | |
9105 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd); | |
9106 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd); | |
9107 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd); | |
9108 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd); | |
9109 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd); | |
9110 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd); | |
9111 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd); | |
9112 | install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd); | |
9113 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd); | |
9114 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd); | |
9115 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd); | |
9116 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd); | |
9117 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd); | |
9118 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd); | |
9119 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd); | |
9120 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd); | |
9121 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd); | |
9122 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd); | |
9123 | install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd); | |
9124 | ||
fee0f4c6 | 9125 | /* "nexthop-local unchanged" commands */ |
9126 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd); | |
9127 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd); | |
9128 | ||
718e3744 | 9129 | /* "transparent-as" and "transparent-nexthop" for old version |
9130 | compatibility. */ | |
9131 | install_element (BGP_NODE, &neighbor_transparent_as_cmd); | |
9132 | install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd); | |
9133 | ||
9134 | /* "neighbor next-hop-self" commands. */ | |
9135 | install_element (BGP_NODE, &neighbor_nexthop_self_cmd); | |
9136 | install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd); | |
9137 | install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd); | |
9138 | install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd); | |
9139 | install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd); | |
9140 | install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd); | |
9141 | install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd); | |
9142 | install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd); | |
25ffbdc1 | 9143 | install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd); |
9144 | install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd); | |
718e3744 | 9145 | install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd); |
9146 | install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd); | |
9147 | ||
9148 | /* "neighbor remove-private-AS" commands. */ | |
9149 | install_element (BGP_NODE, &neighbor_remove_private_as_cmd); | |
9150 | install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd); | |
9151 | install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd); | |
9152 | install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd); | |
9153 | install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd); | |
9154 | install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd); | |
9155 | install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd); | |
9156 | install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd); | |
25ffbdc1 | 9157 | install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd); |
9158 | install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd); | |
718e3744 | 9159 | install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd); |
9160 | install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd); | |
9161 | ||
9162 | /* "neighbor send-community" commands.*/ | |
9163 | install_element (BGP_NODE, &neighbor_send_community_cmd); | |
9164 | install_element (BGP_NODE, &neighbor_send_community_type_cmd); | |
9165 | install_element (BGP_NODE, &no_neighbor_send_community_cmd); | |
9166 | install_element (BGP_NODE, &no_neighbor_send_community_type_cmd); | |
9167 | install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd); | |
9168 | install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd); | |
9169 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd); | |
9170 | install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd); | |
9171 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd); | |
9172 | install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd); | |
9173 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd); | |
9174 | install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd); | |
9175 | install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd); | |
9176 | install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd); | |
9177 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd); | |
9178 | install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd); | |
25ffbdc1 | 9179 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd); |
9180 | install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd); | |
9181 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd); | |
9182 | install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd); | |
718e3744 | 9183 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd); |
9184 | install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd); | |
9185 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd); | |
9186 | install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd); | |
9187 | ||
9188 | /* "neighbor route-reflector" commands.*/ | |
9189 | install_element (BGP_NODE, &neighbor_route_reflector_client_cmd); | |
9190 | install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd); | |
9191 | install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd); | |
9192 | install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
9193 | install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd); | |
9194 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd); | |
9195 | install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd); | |
9196 | install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd); | |
25ffbdc1 | 9197 | install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd); |
9198 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd); | |
718e3744 | 9199 | install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd); |
9200 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd); | |
9201 | ||
9202 | /* "neighbor route-server" commands.*/ | |
9203 | install_element (BGP_NODE, &neighbor_route_server_client_cmd); | |
9204 | install_element (BGP_NODE, &no_neighbor_route_server_client_cmd); | |
9205 | install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd); | |
9206 | install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd); | |
9207 | install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd); | |
9208 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd); | |
9209 | install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd); | |
9210 | install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd); | |
25ffbdc1 | 9211 | install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd); |
9212 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd); | |
718e3744 | 9213 | install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd); |
9214 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd); | |
9215 | ||
9216 | /* "neighbor passive" commands. */ | |
9217 | install_element (BGP_NODE, &neighbor_passive_cmd); | |
9218 | install_element (BGP_NODE, &no_neighbor_passive_cmd); | |
9219 | ||
9220 | /* "neighbor shutdown" commands. */ | |
9221 | install_element (BGP_NODE, &neighbor_shutdown_cmd); | |
9222 | install_element (BGP_NODE, &no_neighbor_shutdown_cmd); | |
9223 | ||
c9502438 | 9224 | /* Deprecated "neighbor capability route-refresh" commands.*/ |
718e3744 | 9225 | install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd); |
9226 | install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd); | |
9227 | ||
9228 | /* "neighbor capability orf prefix-list" commands.*/ | |
9229 | install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd); | |
9230 | install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
9231 | install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd); | |
9232 | install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
9233 | install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd); | |
9234 | install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
9235 | install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd); | |
9236 | install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
25ffbdc1 | 9237 | install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd); |
9238 | install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd); | |
718e3744 | 9239 | |
9240 | /* "neighbor capability dynamic" commands.*/ | |
9241 | install_element (BGP_NODE, &neighbor_capability_dynamic_cmd); | |
9242 | install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd); | |
9243 | ||
9244 | /* "neighbor dont-capability-negotiate" commands. */ | |
9245 | install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd); | |
9246 | install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd); | |
9247 | ||
9248 | /* "neighbor ebgp-multihop" commands. */ | |
9249 | install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd); | |
9250 | install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd); | |
9251 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd); | |
9252 | install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd); | |
9253 | ||
6ffd2079 | 9254 | /* "neighbor disable-connected-check" commands. */ |
9255 | install_element (BGP_NODE, &neighbor_disable_connected_check_cmd); | |
9256 | install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd); | |
718e3744 | 9257 | install_element (BGP_NODE, &neighbor_enforce_multihop_cmd); |
9258 | install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd); | |
9259 | ||
9260 | /* "neighbor description" commands. */ | |
9261 | install_element (BGP_NODE, &neighbor_description_cmd); | |
9262 | install_element (BGP_NODE, &no_neighbor_description_cmd); | |
9263 | install_element (BGP_NODE, &no_neighbor_description_val_cmd); | |
9264 | ||
9265 | /* "neighbor update-source" commands. "*/ | |
9266 | install_element (BGP_NODE, &neighbor_update_source_cmd); | |
9267 | install_element (BGP_NODE, &no_neighbor_update_source_cmd); | |
9268 | ||
9269 | /* "neighbor default-originate" commands. */ | |
9270 | install_element (BGP_NODE, &neighbor_default_originate_cmd); | |
9271 | install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd); | |
9272 | install_element (BGP_NODE, &no_neighbor_default_originate_cmd); | |
9273 | install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd); | |
9274 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd); | |
9275 | install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd); | |
9276 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd); | |
9277 | install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd); | |
9278 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd); | |
9279 | install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd); | |
9280 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd); | |
9281 | install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
9282 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd); | |
9283 | install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd); | |
9284 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd); | |
9285 | install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd); | |
25ffbdc1 | 9286 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd); |
9287 | install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd); | |
9288 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd); | |
9289 | install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd); | |
718e3744 | 9290 | |
9291 | /* "neighbor port" commands. */ | |
9292 | install_element (BGP_NODE, &neighbor_port_cmd); | |
9293 | install_element (BGP_NODE, &no_neighbor_port_cmd); | |
9294 | install_element (BGP_NODE, &no_neighbor_port_val_cmd); | |
9295 | ||
9296 | /* "neighbor weight" commands. */ | |
9297 | install_element (BGP_NODE, &neighbor_weight_cmd); | |
9298 | install_element (BGP_NODE, &no_neighbor_weight_cmd); | |
9299 | install_element (BGP_NODE, &no_neighbor_weight_val_cmd); | |
9300 | ||
9301 | /* "neighbor override-capability" commands. */ | |
9302 | install_element (BGP_NODE, &neighbor_override_capability_cmd); | |
9303 | install_element (BGP_NODE, &no_neighbor_override_capability_cmd); | |
9304 | ||
9305 | /* "neighbor strict-capability-match" commands. */ | |
9306 | install_element (BGP_NODE, &neighbor_strict_capability_cmd); | |
9307 | install_element (BGP_NODE, &no_neighbor_strict_capability_cmd); | |
9308 | ||
9309 | /* "neighbor timers" commands. */ | |
9310 | install_element (BGP_NODE, &neighbor_timers_cmd); | |
9311 | install_element (BGP_NODE, &no_neighbor_timers_cmd); | |
9312 | ||
9313 | /* "neighbor timers connect" commands. */ | |
9314 | install_element (BGP_NODE, &neighbor_timers_connect_cmd); | |
9315 | install_element (BGP_NODE, &no_neighbor_timers_connect_cmd); | |
9316 | install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd); | |
9317 | ||
9318 | /* "neighbor advertisement-interval" commands. */ | |
9319 | install_element (BGP_NODE, &neighbor_advertise_interval_cmd); | |
9320 | install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd); | |
9321 | install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd); | |
9322 | ||
9323 | /* "neighbor version" commands. */ | |
9324 | install_element (BGP_NODE, &neighbor_version_cmd); | |
718e3744 | 9325 | |
9326 | /* "neighbor interface" commands. */ | |
9327 | install_element (BGP_NODE, &neighbor_interface_cmd); | |
9328 | install_element (BGP_NODE, &no_neighbor_interface_cmd); | |
9329 | ||
9330 | /* "neighbor distribute" commands. */ | |
9331 | install_element (BGP_NODE, &neighbor_distribute_list_cmd); | |
9332 | install_element (BGP_NODE, &no_neighbor_distribute_list_cmd); | |
9333 | install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd); | |
9334 | install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd); | |
9335 | install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd); | |
9336 | install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd); | |
9337 | install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd); | |
9338 | install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd); | |
25ffbdc1 | 9339 | install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd); |
9340 | install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd); | |
718e3744 | 9341 | install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd); |
9342 | install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd); | |
9343 | ||
9344 | /* "neighbor prefix-list" commands. */ | |
9345 | install_element (BGP_NODE, &neighbor_prefix_list_cmd); | |
9346 | install_element (BGP_NODE, &no_neighbor_prefix_list_cmd); | |
9347 | install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd); | |
9348 | install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd); | |
9349 | install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd); | |
9350 | install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd); | |
9351 | install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd); | |
9352 | install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd); | |
25ffbdc1 | 9353 | install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd); |
9354 | install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd); | |
718e3744 | 9355 | install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd); |
9356 | install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd); | |
9357 | ||
9358 | /* "neighbor filter-list" commands. */ | |
9359 | install_element (BGP_NODE, &neighbor_filter_list_cmd); | |
9360 | install_element (BGP_NODE, &no_neighbor_filter_list_cmd); | |
9361 | install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd); | |
9362 | install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd); | |
9363 | install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd); | |
9364 | install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd); | |
9365 | install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd); | |
9366 | install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd); | |
25ffbdc1 | 9367 | install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd); |
9368 | install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd); | |
718e3744 | 9369 | install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd); |
9370 | install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd); | |
9371 | ||
9372 | /* "neighbor route-map" commands. */ | |
9373 | install_element (BGP_NODE, &neighbor_route_map_cmd); | |
9374 | install_element (BGP_NODE, &no_neighbor_route_map_cmd); | |
9375 | install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd); | |
9376 | install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd); | |
9377 | install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd); | |
9378 | install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd); | |
9379 | install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd); | |
9380 | install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd); | |
25ffbdc1 | 9381 | install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd); |
9382 | install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd); | |
718e3744 | 9383 | install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd); |
9384 | install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd); | |
9385 | ||
9386 | /* "neighbor unsuppress-map" commands. */ | |
9387 | install_element (BGP_NODE, &neighbor_unsuppress_map_cmd); | |
9388 | install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd); | |
9389 | install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd); | |
9390 | install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
9391 | install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd); | |
9392 | install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd); | |
9393 | install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd); | |
9394 | install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd); | |
25ffbdc1 | 9395 | install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd); |
9396 | install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd); | |
a58545bb | 9397 | install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd); |
9398 | install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd); | |
718e3744 | 9399 | |
9400 | /* "neighbor maximum-prefix" commands. */ | |
9401 | install_element (BGP_NODE, &neighbor_maximum_prefix_cmd); | |
e0701b79 | 9402 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 9403 | install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 9404 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 9405 | install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd); |
9406 | install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9407 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd); |
9408 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 9409 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
9410 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
9411 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
9412 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
9413 | install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9414 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 9415 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 9416 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 9417 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 9418 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
9419 | install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9420 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd); |
9421 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 9422 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
9423 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
9424 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
9425 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
9426 | install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9427 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 9428 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 9429 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 9430 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 9431 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd); |
9432 | install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9433 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd); |
9434 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 9435 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
9436 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
9437 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
9438 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
9439 | install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9440 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 9441 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 9442 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 9443 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 9444 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd); |
9445 | install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9446 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd); |
9447 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 9448 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
9449 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
9450 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
9451 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
9452 | install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
25ffbdc1 | 9453 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd); |
9454 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd); | |
9455 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd); | |
9456 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); | |
9457 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd); | |
9458 | install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
9459 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd); | |
9460 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
9461 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd); | |
9462 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
9463 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
9464 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
9465 | install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9466 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd); |
e0701b79 | 9467 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd); |
718e3744 | 9468 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd); |
e0701b79 | 9469 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd); |
0a486e5f | 9470 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd); |
9471 | install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9472 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd); |
9473 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd); | |
0a486e5f | 9474 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd); |
9475 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd); | |
9476 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd); | |
9477 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd); | |
9478 | install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd); | |
718e3744 | 9479 | |
9480 | /* "neighbor allowas-in" */ | |
9481 | install_element (BGP_NODE, &neighbor_allowas_in_cmd); | |
9482 | install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd); | |
9483 | install_element (BGP_NODE, &no_neighbor_allowas_in_cmd); | |
9484 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd); | |
9485 | install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd); | |
9486 | install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd); | |
9487 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd); | |
9488 | install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd); | |
9489 | install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd); | |
9490 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd); | |
9491 | install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd); | |
9492 | install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd); | |
25ffbdc1 | 9493 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd); |
9494 | install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd); | |
9495 | install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd); | |
718e3744 | 9496 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd); |
9497 | install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd); | |
9498 | install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd); | |
9499 | ||
9500 | /* address-family commands. */ | |
9501 | install_element (BGP_NODE, &address_family_ipv4_cmd); | |
9502 | install_element (BGP_NODE, &address_family_ipv4_safi_cmd); | |
9503 | #ifdef HAVE_IPV6 | |
9504 | install_element (BGP_NODE, &address_family_ipv6_cmd); | |
25ffbdc1 | 9505 | install_element (BGP_NODE, &address_family_ipv6_safi_cmd); |
718e3744 | 9506 | #endif /* HAVE_IPV6 */ |
9507 | install_element (BGP_NODE, &address_family_vpnv4_cmd); | |
9508 | install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); | |
9509 | ||
9510 | /* "exit-address-family" command. */ | |
9511 | install_element (BGP_IPV4_NODE, &exit_address_family_cmd); | |
9512 | install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); | |
9513 | install_element (BGP_IPV6_NODE, &exit_address_family_cmd); | |
25ffbdc1 | 9514 | install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); |
718e3744 | 9515 | install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); |
9516 | ||
9517 | /* "clear ip bgp commands" */ | |
9518 | install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd); | |
9519 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd); | |
9520 | install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd); | |
9521 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd); | |
9522 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd); | |
9523 | install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd); | |
9524 | #ifdef HAVE_IPV6 | |
9525 | install_element (ENABLE_NODE, &clear_bgp_all_cmd); | |
9526 | install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd); | |
9527 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd); | |
9528 | install_element (ENABLE_NODE, &clear_bgp_peer_cmd); | |
9529 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd); | |
9530 | install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd); | |
9531 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd); | |
9532 | install_element (ENABLE_NODE, &clear_bgp_external_cmd); | |
9533 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd); | |
9534 | install_element (ENABLE_NODE, &clear_bgp_as_cmd); | |
9535 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd); | |
9536 | #endif /* HAVE_IPV6 */ | |
9537 | ||
9538 | /* "clear ip bgp neighbor soft in" */ | |
9539 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd); | |
9540 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd); | |
9541 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd); | |
9542 | install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd); | |
9543 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd); | |
9544 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd); | |
9545 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd); | |
9546 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd); | |
9547 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd); | |
9548 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd); | |
9549 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd); | |
9550 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd); | |
9551 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd); | |
9552 | install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd); | |
9553 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd); | |
9554 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd); | |
9555 | install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd); | |
9556 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd); | |
9557 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd); | |
9558 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd); | |
9559 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd); | |
9560 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd); | |
9561 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd); | |
9562 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd); | |
9563 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd); | |
9564 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd); | |
9565 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd); | |
9566 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd); | |
9567 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd); | |
9568 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd); | |
9569 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd); | |
9570 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd); | |
9571 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd); | |
9572 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd); | |
9573 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd); | |
9574 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd); | |
9575 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd); | |
9576 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd); | |
9577 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd); | |
9578 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd); | |
9579 | #ifdef HAVE_IPV6 | |
9580 | install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd); | |
9581 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd); | |
9582 | install_element (ENABLE_NODE, &clear_bgp_all_in_cmd); | |
9583 | install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd); | |
9584 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd); | |
9585 | install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd); | |
9586 | install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd); | |
9587 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd); | |
9588 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd); | |
9589 | install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd); | |
9590 | install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd); | |
9591 | install_element (ENABLE_NODE, &clear_bgp_external_in_cmd); | |
9592 | install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd); | |
9593 | install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd); | |
9594 | install_element (ENABLE_NODE, &clear_bgp_as_in_cmd); | |
9595 | install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd); | |
9596 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd); | |
9597 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd); | |
9598 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd); | |
9599 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd); | |
9600 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd); | |
9601 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd); | |
9602 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd); | |
9603 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd); | |
9604 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd); | |
9605 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd); | |
9606 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd); | |
9607 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd); | |
9608 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd); | |
9609 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd); | |
9610 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd); | |
9611 | #endif /* HAVE_IPV6 */ | |
9612 | ||
9613 | /* "clear ip bgp neighbor soft out" */ | |
9614 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd); | |
9615 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd); | |
9616 | install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd); | |
9617 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd); | |
9618 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd); | |
9619 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd); | |
9620 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd); | |
9621 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd); | |
9622 | install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd); | |
9623 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd); | |
9624 | install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd); | |
9625 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd); | |
9626 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd); | |
9627 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd); | |
9628 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd); | |
9629 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd); | |
9630 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd); | |
9631 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd); | |
9632 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd); | |
9633 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd); | |
9634 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd); | |
9635 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd); | |
9636 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd); | |
9637 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd); | |
9638 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd); | |
9639 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd); | |
9640 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd); | |
9641 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd); | |
9642 | #ifdef HAVE_IPV6 | |
9643 | install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd); | |
9644 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd); | |
9645 | install_element (ENABLE_NODE, &clear_bgp_all_out_cmd); | |
9646 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd); | |
9647 | install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd); | |
9648 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd); | |
9649 | install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd); | |
9650 | install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd); | |
9651 | install_element (ENABLE_NODE, &clear_bgp_external_out_cmd); | |
9652 | install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd); | |
9653 | install_element (ENABLE_NODE, &clear_bgp_as_out_cmd); | |
9654 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd); | |
9655 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd); | |
9656 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd); | |
9657 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd); | |
9658 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd); | |
9659 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd); | |
9660 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd); | |
9661 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd); | |
9662 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd); | |
9663 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd); | |
9664 | #endif /* HAVE_IPV6 */ | |
9665 | ||
9666 | /* "clear ip bgp neighbor soft" */ | |
9667 | install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd); | |
9668 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd); | |
9669 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd); | |
9670 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd); | |
9671 | install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd); | |
9672 | install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd); | |
9673 | install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd); | |
9674 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd); | |
9675 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd); | |
9676 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd); | |
9677 | install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd); | |
9678 | install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd); | |
9679 | install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd); | |
9680 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd); | |
9681 | install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd); | |
9682 | #ifdef HAVE_IPV6 | |
9683 | install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd); | |
9684 | install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd); | |
9685 | install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd); | |
9686 | install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd); | |
9687 | install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd); | |
9688 | install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd); | |
9689 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd); | |
9690 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd); | |
9691 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd); | |
9692 | install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd); | |
9693 | install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd); | |
9694 | #endif /* HAVE_IPV6 */ | |
9695 | ||
fee0f4c6 | 9696 | /* "clear ip bgp neighbor rsclient" */ |
9697 | install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd); | |
9698 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd); | |
9699 | install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd); | |
9700 | install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd); | |
9701 | #ifdef HAVE_IPV6 | |
9702 | install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd); | |
9703 | install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd); | |
9704 | install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd); | |
9705 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd); | |
9706 | install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd); | |
9707 | install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd); | |
9708 | install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd); | |
9709 | install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd); | |
9710 | #endif /* HAVE_IPV6 */ | |
9711 | ||
718e3744 | 9712 | /* "show ip bgp summary" commands. */ |
9713 | install_element (VIEW_NODE, &show_ip_bgp_summary_cmd); | |
9714 | install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd); | |
9715 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
9716 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); | |
9717 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); | |
9718 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
9719 | #ifdef HAVE_IPV6 | |
9720 | install_element (VIEW_NODE, &show_bgp_summary_cmd); | |
9721 | install_element (VIEW_NODE, &show_bgp_instance_summary_cmd); | |
9722 | install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd); | |
9723 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd); | |
62687ff1 PJ |
9724 | #endif /* HAVE_IPV6 */ |
9725 | install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd); | |
9726 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd); | |
9727 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
9728 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); | |
9729 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); | |
9730 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
9731 | #ifdef HAVE_IPV6 | |
9732 | install_element (RESTRICTED_NODE, &show_bgp_summary_cmd); | |
9733 | install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd); | |
9734 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd); | |
9735 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd); | |
718e3744 | 9736 | #endif /* HAVE_IPV6 */ |
9737 | install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd); | |
9738 | install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd); | |
9739 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd); | |
9740 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd); | |
9741 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd); | |
9742 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd); | |
9743 | #ifdef HAVE_IPV6 | |
9744 | install_element (ENABLE_NODE, &show_bgp_summary_cmd); | |
9745 | install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd); | |
9746 | install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd); | |
9747 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd); | |
9748 | #endif /* HAVE_IPV6 */ | |
9749 | ||
9750 | /* "show ip bgp neighbors" commands. */ | |
9751 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); | |
9752 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
9753 | install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
9754 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
9755 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
9756 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
9757 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
9758 | install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
9759 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
9760 | install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
62687ff1 PJ |
9761 | install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd); |
9762 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
9763 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
9764 | install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
9765 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
718e3744 | 9766 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd); |
9767 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd); | |
9768 | install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd); | |
9769 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd); | |
9770 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd); | |
9771 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd); | |
9772 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd); | |
9773 | install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd); | |
9774 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd); | |
9775 | install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd); | |
9776 | ||
9777 | #ifdef HAVE_IPV6 | |
9778 | install_element (VIEW_NODE, &show_bgp_neighbors_cmd); | |
9779 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd); | |
9780 | install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd); | |
9781 | install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 9782 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd); |
9783 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
9784 | install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
9785 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
62687ff1 PJ |
9786 | install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd); |
9787 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
9788 | install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
9789 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 9790 | install_element (ENABLE_NODE, &show_bgp_neighbors_cmd); |
9791 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd); | |
9792 | install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd); | |
9793 | install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd); | |
bb46e94f | 9794 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd); |
9795 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd); | |
9796 | install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd); | |
9797 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd); | |
718e3744 | 9798 | |
9799 | /* Old commands. */ | |
9800 | install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd); | |
9801 | install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd); | |
9802 | install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd); | |
9803 | install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd); | |
9804 | #endif /* HAVE_IPV6 */ | |
fee0f4c6 | 9805 | |
9806 | /* "show ip bgp rsclient" commands. */ | |
9807 | install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd); | |
9808 | install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
9809 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
9810 | install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
62687ff1 PJ |
9811 | install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd); |
9812 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
9813 | install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
9814 | install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
fee0f4c6 | 9815 | install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd); |
9816 | install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd); | |
9817 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd); | |
9818 | install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd); | |
9819 | ||
9820 | #ifdef HAVE_IPV6 | |
9821 | install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd); | |
9822 | install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
9823 | install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
9824 | install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
62687ff1 PJ |
9825 | install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd); |
9826 | install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
9827 | install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
9828 | install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
fee0f4c6 | 9829 | install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd); |
9830 | install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd); | |
9831 | install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd); | |
9832 | install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd); | |
9833 | #endif /* HAVE_IPV6 */ | |
718e3744 | 9834 | |
9835 | /* "show ip bgp paths" commands. */ | |
9836 | install_element (VIEW_NODE, &show_ip_bgp_paths_cmd); | |
9837 | install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
9838 | install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd); | |
9839 | install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd); | |
9840 | ||
9841 | /* "show ip bgp community" commands. */ | |
9842 | install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd); | |
9843 | install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd); | |
9844 | ||
9845 | /* "show ip bgp attribute-info" commands. */ | |
9846 | install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd); | |
9847 | install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd); | |
9848 | ||
9849 | /* "redistribute" commands. */ | |
9850 | install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd); | |
9851 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd); | |
9852 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd); | |
9853 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd); | |
9854 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd); | |
9855 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd); | |
9856 | install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd); | |
9857 | install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd); | |
9858 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd); | |
9859 | install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd); | |
9860 | #ifdef HAVE_IPV6 | |
9861 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd); | |
9862 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd); | |
9863 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd); | |
9864 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd); | |
9865 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd); | |
9866 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd); | |
9867 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd); | |
9868 | install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd); | |
9869 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd); | |
9870 | install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd); | |
9871 | #endif /* HAVE_IPV6 */ | |
9872 | ||
4bf6a362 PJ |
9873 | /* "show bgp memory" commands. */ |
9874 | install_element (VIEW_NODE, &show_bgp_memory_cmd); | |
62687ff1 | 9875 | install_element (RESTRICTED_NODE, &show_bgp_memory_cmd); |
4bf6a362 PJ |
9876 | install_element (ENABLE_NODE, &show_bgp_memory_cmd); |
9877 | ||
718e3744 | 9878 | /* Community-list. */ |
9879 | community_list_vty (); | |
9880 | } | |
9881 | \f | |
9882 | #include "memory.h" | |
9883 | #include "bgp_regex.h" | |
9884 | #include "bgp_clist.h" | |
9885 | #include "bgp_ecommunity.h" | |
9886 | ||
9887 | /* VTY functions. */ | |
9888 | ||
9889 | /* Direction value to string conversion. */ | |
94f2b392 | 9890 | static const char * |
718e3744 | 9891 | community_direct_str (int direct) |
9892 | { | |
9893 | switch (direct) | |
9894 | { | |
9895 | case COMMUNITY_DENY: | |
9896 | return "deny"; | |
718e3744 | 9897 | case COMMUNITY_PERMIT: |
9898 | return "permit"; | |
718e3744 | 9899 | default: |
9900 | return "unknown"; | |
718e3744 | 9901 | } |
9902 | } | |
9903 | ||
9904 | /* Display error string. */ | |
94f2b392 | 9905 | static void |
718e3744 | 9906 | community_list_perror (struct vty *vty, int ret) |
9907 | { | |
9908 | switch (ret) | |
9909 | { | |
9910 | case COMMUNITY_LIST_ERR_CANT_FIND_LIST: | |
9911 | vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE); | |
9912 | break; | |
9913 | case COMMUNITY_LIST_ERR_MALFORMED_VAL: | |
9914 | vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE); | |
9915 | break; | |
9916 | case COMMUNITY_LIST_ERR_STANDARD_CONFLICT: | |
9917 | vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE); | |
9918 | break; | |
9919 | case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT: | |
9920 | vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE); | |
9921 | break; | |
9922 | } | |
9923 | } | |
9924 | ||
9925 | /* VTY interface for community_set() function. */ | |
94f2b392 | 9926 | static int |
fd79ac91 | 9927 | community_list_set_vty (struct vty *vty, int argc, const char **argv, |
9928 | int style, int reject_all_digit_name) | |
718e3744 | 9929 | { |
9930 | int ret; | |
9931 | int direct; | |
9932 | char *str; | |
9933 | ||
9934 | /* Check the list type. */ | |
9935 | if (strncmp (argv[1], "p", 1) == 0) | |
9936 | direct = COMMUNITY_PERMIT; | |
9937 | else if (strncmp (argv[1], "d", 1) == 0) | |
9938 | direct = COMMUNITY_DENY; | |
9939 | else | |
9940 | { | |
9941 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
9942 | VTY_NEWLINE); | |
9943 | return CMD_WARNING; | |
9944 | } | |
9945 | ||
9946 | /* All digit name check. */ | |
9947 | if (reject_all_digit_name && all_digit (argv[0])) | |
9948 | { | |
9949 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
9950 | return CMD_WARNING; | |
9951 | } | |
9952 | ||
9953 | /* Concat community string argument. */ | |
9954 | if (argc > 1) | |
9955 | str = argv_concat (argv, argc, 2); | |
9956 | else | |
9957 | str = NULL; | |
9958 | ||
9959 | /* When community_list_set() return nevetive value, it means | |
9960 | malformed community string. */ | |
9961 | ret = community_list_set (bgp_clist, argv[0], str, direct, style); | |
9962 | ||
9963 | /* Free temporary community list string allocated by | |
9964 | argv_concat(). */ | |
9965 | if (str) | |
9966 | XFREE (MTYPE_TMP, str); | |
9967 | ||
9968 | if (ret < 0) | |
9969 | { | |
9970 | /* Display error string. */ | |
9971 | community_list_perror (vty, ret); | |
9972 | return CMD_WARNING; | |
9973 | } | |
9974 | ||
9975 | return CMD_SUCCESS; | |
9976 | } | |
9977 | ||
718e3744 | 9978 | /* Communiyt-list entry delete. */ |
94f2b392 | 9979 | static int |
fee6e4e4 | 9980 | community_list_unset_vty (struct vty *vty, int argc, const char **argv, |
9981 | int style) | |
718e3744 | 9982 | { |
9983 | int ret; | |
fee6e4e4 | 9984 | int direct = 0; |
9985 | char *str = NULL; | |
718e3744 | 9986 | |
fee6e4e4 | 9987 | if (argc > 1) |
718e3744 | 9988 | { |
fee6e4e4 | 9989 | /* Check the list direct. */ |
9990 | if (strncmp (argv[1], "p", 1) == 0) | |
9991 | direct = COMMUNITY_PERMIT; | |
9992 | else if (strncmp (argv[1], "d", 1) == 0) | |
9993 | direct = COMMUNITY_DENY; | |
9994 | else | |
9995 | { | |
9996 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
9997 | VTY_NEWLINE); | |
9998 | return CMD_WARNING; | |
9999 | } | |
718e3744 | 10000 | |
fee6e4e4 | 10001 | /* Concat community string argument. */ |
10002 | str = argv_concat (argv, argc, 2); | |
10003 | } | |
718e3744 | 10004 | |
10005 | /* Unset community list. */ | |
10006 | ret = community_list_unset (bgp_clist, argv[0], str, direct, style); | |
10007 | ||
10008 | /* Free temporary community list string allocated by | |
10009 | argv_concat(). */ | |
fee6e4e4 | 10010 | if (str) |
10011 | XFREE (MTYPE_TMP, str); | |
718e3744 | 10012 | |
10013 | if (ret < 0) | |
10014 | { | |
10015 | community_list_perror (vty, ret); | |
10016 | return CMD_WARNING; | |
10017 | } | |
10018 | ||
10019 | return CMD_SUCCESS; | |
10020 | } | |
10021 | ||
10022 | /* "community-list" keyword help string. */ | |
10023 | #define COMMUNITY_LIST_STR "Add a community list entry\n" | |
10024 | #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n" | |
10025 | ||
718e3744 | 10026 | DEFUN (ip_community_list_standard, |
10027 | ip_community_list_standard_cmd, | |
10028 | "ip community-list <1-99> (deny|permit) .AA:NN", | |
10029 | IP_STR | |
10030 | COMMUNITY_LIST_STR | |
10031 | "Community list number (standard)\n" | |
10032 | "Specify community to reject\n" | |
10033 | "Specify community to accept\n" | |
10034 | COMMUNITY_VAL_STR) | |
10035 | { | |
10036 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0); | |
10037 | } | |
10038 | ||
10039 | ALIAS (ip_community_list_standard, | |
10040 | ip_community_list_standard2_cmd, | |
10041 | "ip community-list <1-99> (deny|permit)", | |
10042 | IP_STR | |
10043 | COMMUNITY_LIST_STR | |
10044 | "Community list number (standard)\n" | |
10045 | "Specify community to reject\n" | |
10046 | "Specify community to accept\n") | |
10047 | ||
10048 | DEFUN (ip_community_list_expanded, | |
10049 | ip_community_list_expanded_cmd, | |
fee6e4e4 | 10050 | "ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 10051 | IP_STR |
10052 | COMMUNITY_LIST_STR | |
10053 | "Community list number (expanded)\n" | |
10054 | "Specify community to reject\n" | |
10055 | "Specify community to accept\n" | |
10056 | "An ordered list as a regular-expression\n") | |
10057 | { | |
10058 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0); | |
10059 | } | |
10060 | ||
10061 | DEFUN (ip_community_list_name_standard, | |
10062 | ip_community_list_name_standard_cmd, | |
10063 | "ip community-list standard WORD (deny|permit) .AA:NN", | |
10064 | IP_STR | |
10065 | COMMUNITY_LIST_STR | |
10066 | "Add a standard community-list entry\n" | |
10067 | "Community list name\n" | |
10068 | "Specify community to reject\n" | |
10069 | "Specify community to accept\n" | |
10070 | COMMUNITY_VAL_STR) | |
10071 | { | |
10072 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1); | |
10073 | } | |
10074 | ||
10075 | ALIAS (ip_community_list_name_standard, | |
10076 | ip_community_list_name_standard2_cmd, | |
10077 | "ip community-list standard WORD (deny|permit)", | |
10078 | IP_STR | |
10079 | COMMUNITY_LIST_STR | |
10080 | "Add a standard community-list entry\n" | |
10081 | "Community list name\n" | |
10082 | "Specify community to reject\n" | |
10083 | "Specify community to accept\n") | |
10084 | ||
10085 | DEFUN (ip_community_list_name_expanded, | |
10086 | ip_community_list_name_expanded_cmd, | |
10087 | "ip community-list expanded WORD (deny|permit) .LINE", | |
10088 | IP_STR | |
10089 | COMMUNITY_LIST_STR | |
10090 | "Add an expanded community-list entry\n" | |
10091 | "Community list name\n" | |
10092 | "Specify community to reject\n" | |
10093 | "Specify community to accept\n" | |
10094 | "An ordered list as a regular-expression\n") | |
10095 | { | |
10096 | return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1); | |
10097 | } | |
10098 | ||
fee6e4e4 | 10099 | DEFUN (no_ip_community_list_standard_all, |
10100 | no_ip_community_list_standard_all_cmd, | |
10101 | "no ip community-list <1-99>", | |
10102 | NO_STR | |
10103 | IP_STR | |
10104 | COMMUNITY_LIST_STR | |
10105 | "Community list number (standard)\n") | |
10106 | { | |
10107 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
10108 | } | |
10109 | ||
10110 | DEFUN (no_ip_community_list_expanded_all, | |
10111 | no_ip_community_list_expanded_all_cmd, | |
10112 | "no ip community-list <100-500>", | |
718e3744 | 10113 | NO_STR |
10114 | IP_STR | |
10115 | COMMUNITY_LIST_STR | |
718e3744 | 10116 | "Community list number (expanded)\n") |
10117 | { | |
fee6e4e4 | 10118 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 10119 | } |
10120 | ||
fee6e4e4 | 10121 | DEFUN (no_ip_community_list_name_standard_all, |
10122 | no_ip_community_list_name_standard_all_cmd, | |
10123 | "no ip community-list standard WORD", | |
718e3744 | 10124 | NO_STR |
10125 | IP_STR | |
10126 | COMMUNITY_LIST_STR | |
10127 | "Add a standard community-list entry\n" | |
718e3744 | 10128 | "Community list name\n") |
10129 | { | |
fee6e4e4 | 10130 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); |
718e3744 | 10131 | } |
10132 | ||
fee6e4e4 | 10133 | DEFUN (no_ip_community_list_name_expanded_all, |
10134 | no_ip_community_list_name_expanded_all_cmd, | |
10135 | "no ip community-list expanded WORD", | |
718e3744 | 10136 | NO_STR |
10137 | IP_STR | |
10138 | COMMUNITY_LIST_STR | |
fee6e4e4 | 10139 | "Add an expanded community-list entry\n" |
10140 | "Community list name\n") | |
718e3744 | 10141 | { |
fee6e4e4 | 10142 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); |
718e3744 | 10143 | } |
10144 | ||
10145 | DEFUN (no_ip_community_list_standard, | |
10146 | no_ip_community_list_standard_cmd, | |
10147 | "no ip community-list <1-99> (deny|permit) .AA:NN", | |
10148 | NO_STR | |
10149 | IP_STR | |
10150 | COMMUNITY_LIST_STR | |
10151 | "Community list number (standard)\n" | |
10152 | "Specify community to reject\n" | |
10153 | "Specify community to accept\n" | |
10154 | COMMUNITY_VAL_STR) | |
10155 | { | |
10156 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
10157 | } | |
10158 | ||
10159 | DEFUN (no_ip_community_list_expanded, | |
10160 | no_ip_community_list_expanded_cmd, | |
fee6e4e4 | 10161 | "no ip community-list <100-500> (deny|permit) .LINE", |
718e3744 | 10162 | NO_STR |
10163 | IP_STR | |
10164 | COMMUNITY_LIST_STR | |
10165 | "Community list number (expanded)\n" | |
10166 | "Specify community to reject\n" | |
10167 | "Specify community to accept\n" | |
10168 | "An ordered list as a regular-expression\n") | |
10169 | { | |
10170 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
10171 | } | |
10172 | ||
10173 | DEFUN (no_ip_community_list_name_standard, | |
10174 | no_ip_community_list_name_standard_cmd, | |
10175 | "no ip community-list standard WORD (deny|permit) .AA:NN", | |
10176 | NO_STR | |
10177 | IP_STR | |
10178 | COMMUNITY_LIST_STR | |
10179 | "Specify a standard community-list\n" | |
10180 | "Community list name\n" | |
10181 | "Specify community to reject\n" | |
10182 | "Specify community to accept\n" | |
10183 | COMMUNITY_VAL_STR) | |
10184 | { | |
10185 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD); | |
10186 | } | |
10187 | ||
10188 | DEFUN (no_ip_community_list_name_expanded, | |
10189 | no_ip_community_list_name_expanded_cmd, | |
10190 | "no ip community-list expanded WORD (deny|permit) .LINE", | |
10191 | NO_STR | |
10192 | IP_STR | |
10193 | COMMUNITY_LIST_STR | |
10194 | "Specify an expanded community-list\n" | |
10195 | "Community list name\n" | |
10196 | "Specify community to reject\n" | |
10197 | "Specify community to accept\n" | |
10198 | "An ordered list as a regular-expression\n") | |
10199 | { | |
10200 | return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED); | |
10201 | } | |
10202 | ||
94f2b392 | 10203 | static void |
718e3744 | 10204 | community_list_show (struct vty *vty, struct community_list *list) |
10205 | { | |
10206 | struct community_entry *entry; | |
10207 | ||
10208 | for (entry = list->head; entry; entry = entry->next) | |
10209 | { | |
10210 | if (entry == list->head) | |
10211 | { | |
10212 | if (all_digit (list->name)) | |
10213 | vty_out (vty, "Community %s list %s%s", | |
10214 | entry->style == COMMUNITY_LIST_STANDARD ? | |
10215 | "standard" : "(expanded) access", | |
10216 | list->name, VTY_NEWLINE); | |
10217 | else | |
10218 | vty_out (vty, "Named Community %s list %s%s", | |
10219 | entry->style == COMMUNITY_LIST_STANDARD ? | |
10220 | "standard" : "expanded", | |
10221 | list->name, VTY_NEWLINE); | |
10222 | } | |
10223 | if (entry->any) | |
10224 | vty_out (vty, " %s%s", | |
10225 | community_direct_str (entry->direct), VTY_NEWLINE); | |
10226 | else | |
10227 | vty_out (vty, " %s %s%s", | |
10228 | community_direct_str (entry->direct), | |
10229 | entry->style == COMMUNITY_LIST_STANDARD | |
10230 | ? community_str (entry->u.com) : entry->config, | |
10231 | VTY_NEWLINE); | |
10232 | } | |
10233 | } | |
10234 | ||
10235 | DEFUN (show_ip_community_list, | |
10236 | show_ip_community_list_cmd, | |
10237 | "show ip community-list", | |
10238 | SHOW_STR | |
10239 | IP_STR | |
10240 | "List community-list\n") | |
10241 | { | |
10242 | struct community_list *list; | |
10243 | struct community_list_master *cm; | |
10244 | ||
fee6e4e4 | 10245 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 10246 | if (! cm) |
10247 | return CMD_SUCCESS; | |
10248 | ||
10249 | for (list = cm->num.head; list; list = list->next) | |
10250 | community_list_show (vty, list); | |
10251 | ||
10252 | for (list = cm->str.head; list; list = list->next) | |
10253 | community_list_show (vty, list); | |
10254 | ||
10255 | return CMD_SUCCESS; | |
10256 | } | |
10257 | ||
10258 | DEFUN (show_ip_community_list_arg, | |
10259 | show_ip_community_list_arg_cmd, | |
fee6e4e4 | 10260 | "show ip community-list (<1-500>|WORD)", |
718e3744 | 10261 | SHOW_STR |
10262 | IP_STR | |
10263 | "List community-list\n" | |
10264 | "Community-list number\n" | |
10265 | "Community-list name\n") | |
10266 | { | |
10267 | struct community_list *list; | |
10268 | ||
fee6e4e4 | 10269 | list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER); |
718e3744 | 10270 | if (! list) |
10271 | { | |
10272 | vty_out (vty, "%% Can't find communit-list%s", VTY_NEWLINE); | |
10273 | return CMD_WARNING; | |
10274 | } | |
10275 | ||
10276 | community_list_show (vty, list); | |
10277 | ||
10278 | return CMD_SUCCESS; | |
10279 | } | |
10280 | \f | |
94f2b392 | 10281 | static int |
fd79ac91 | 10282 | extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv, |
10283 | int style, int reject_all_digit_name) | |
718e3744 | 10284 | { |
10285 | int ret; | |
10286 | int direct; | |
10287 | char *str; | |
10288 | ||
10289 | /* Check the list type. */ | |
10290 | if (strncmp (argv[1], "p", 1) == 0) | |
10291 | direct = COMMUNITY_PERMIT; | |
10292 | else if (strncmp (argv[1], "d", 1) == 0) | |
10293 | direct = COMMUNITY_DENY; | |
10294 | else | |
10295 | { | |
10296 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
10297 | VTY_NEWLINE); | |
10298 | return CMD_WARNING; | |
10299 | } | |
10300 | ||
10301 | /* All digit name check. */ | |
10302 | if (reject_all_digit_name && all_digit (argv[0])) | |
10303 | { | |
10304 | vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); | |
10305 | return CMD_WARNING; | |
10306 | } | |
10307 | ||
10308 | /* Concat community string argument. */ | |
10309 | if (argc > 1) | |
10310 | str = argv_concat (argv, argc, 2); | |
10311 | else | |
10312 | str = NULL; | |
10313 | ||
10314 | ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style); | |
10315 | ||
10316 | /* Free temporary community list string allocated by | |
10317 | argv_concat(). */ | |
10318 | if (str) | |
10319 | XFREE (MTYPE_TMP, str); | |
10320 | ||
10321 | if (ret < 0) | |
10322 | { | |
10323 | community_list_perror (vty, ret); | |
10324 | return CMD_WARNING; | |
10325 | } | |
10326 | return CMD_SUCCESS; | |
10327 | } | |
10328 | ||
94f2b392 | 10329 | static int |
fee6e4e4 | 10330 | extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv, |
10331 | int style) | |
718e3744 | 10332 | { |
10333 | int ret; | |
fee6e4e4 | 10334 | int direct = 0; |
10335 | char *str = NULL; | |
718e3744 | 10336 | |
fee6e4e4 | 10337 | if (argc > 1) |
718e3744 | 10338 | { |
fee6e4e4 | 10339 | /* Check the list direct. */ |
10340 | if (strncmp (argv[1], "p", 1) == 0) | |
10341 | direct = COMMUNITY_PERMIT; | |
10342 | else if (strncmp (argv[1], "d", 1) == 0) | |
10343 | direct = COMMUNITY_DENY; | |
10344 | else | |
10345 | { | |
10346 | vty_out (vty, "%% Matching condition must be permit or deny%s", | |
10347 | VTY_NEWLINE); | |
10348 | return CMD_WARNING; | |
10349 | } | |
718e3744 | 10350 | |
fee6e4e4 | 10351 | /* Concat community string argument. */ |
10352 | str = argv_concat (argv, argc, 2); | |
718e3744 | 10353 | } |
10354 | ||
718e3744 | 10355 | /* Unset community list. */ |
10356 | ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style); | |
10357 | ||
10358 | /* Free temporary community list string allocated by | |
10359 | argv_concat(). */ | |
fee6e4e4 | 10360 | if (str) |
10361 | XFREE (MTYPE_TMP, str); | |
718e3744 | 10362 | |
10363 | if (ret < 0) | |
10364 | { | |
10365 | community_list_perror (vty, ret); | |
10366 | return CMD_WARNING; | |
10367 | } | |
10368 | ||
10369 | return CMD_SUCCESS; | |
10370 | } | |
10371 | ||
10372 | /* "extcommunity-list" keyword help string. */ | |
10373 | #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n" | |
10374 | #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n" | |
10375 | ||
10376 | DEFUN (ip_extcommunity_list_standard, | |
10377 | ip_extcommunity_list_standard_cmd, | |
10378 | "ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
10379 | IP_STR | |
10380 | EXTCOMMUNITY_LIST_STR | |
10381 | "Extended Community list number (standard)\n" | |
10382 | "Specify community to reject\n" | |
10383 | "Specify community to accept\n" | |
10384 | EXTCOMMUNITY_VAL_STR) | |
10385 | { | |
10386 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0); | |
10387 | } | |
10388 | ||
10389 | ALIAS (ip_extcommunity_list_standard, | |
10390 | ip_extcommunity_list_standard2_cmd, | |
10391 | "ip extcommunity-list <1-99> (deny|permit)", | |
10392 | IP_STR | |
10393 | EXTCOMMUNITY_LIST_STR | |
10394 | "Extended Community list number (standard)\n" | |
10395 | "Specify community to reject\n" | |
10396 | "Specify community to accept\n") | |
10397 | ||
10398 | DEFUN (ip_extcommunity_list_expanded, | |
10399 | ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 10400 | "ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 10401 | IP_STR |
10402 | EXTCOMMUNITY_LIST_STR | |
10403 | "Extended Community list number (expanded)\n" | |
10404 | "Specify community to reject\n" | |
10405 | "Specify community to accept\n" | |
10406 | "An ordered list as a regular-expression\n") | |
10407 | { | |
10408 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0); | |
10409 | } | |
10410 | ||
10411 | DEFUN (ip_extcommunity_list_name_standard, | |
10412 | ip_extcommunity_list_name_standard_cmd, | |
10413 | "ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
10414 | IP_STR | |
10415 | EXTCOMMUNITY_LIST_STR | |
10416 | "Specify standard extcommunity-list\n" | |
10417 | "Extended Community list name\n" | |
10418 | "Specify community to reject\n" | |
10419 | "Specify community to accept\n" | |
10420 | EXTCOMMUNITY_VAL_STR) | |
10421 | { | |
10422 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1); | |
10423 | } | |
10424 | ||
10425 | ALIAS (ip_extcommunity_list_name_standard, | |
10426 | ip_extcommunity_list_name_standard2_cmd, | |
10427 | "ip extcommunity-list standard WORD (deny|permit)", | |
10428 | IP_STR | |
10429 | EXTCOMMUNITY_LIST_STR | |
10430 | "Specify standard extcommunity-list\n" | |
10431 | "Extended Community list name\n" | |
10432 | "Specify community to reject\n" | |
10433 | "Specify community to accept\n") | |
10434 | ||
10435 | DEFUN (ip_extcommunity_list_name_expanded, | |
10436 | ip_extcommunity_list_name_expanded_cmd, | |
10437 | "ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
10438 | IP_STR | |
10439 | EXTCOMMUNITY_LIST_STR | |
10440 | "Specify expanded extcommunity-list\n" | |
10441 | "Extended Community list name\n" | |
10442 | "Specify community to reject\n" | |
10443 | "Specify community to accept\n" | |
10444 | "An ordered list as a regular-expression\n") | |
10445 | { | |
10446 | return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1); | |
10447 | } | |
10448 | ||
fee6e4e4 | 10449 | DEFUN (no_ip_extcommunity_list_standard_all, |
10450 | no_ip_extcommunity_list_standard_all_cmd, | |
10451 | "no ip extcommunity-list <1-99>", | |
10452 | NO_STR | |
10453 | IP_STR | |
10454 | EXTCOMMUNITY_LIST_STR | |
10455 | "Extended Community list number (standard)\n") | |
10456 | { | |
10457 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
10458 | } | |
10459 | ||
10460 | DEFUN (no_ip_extcommunity_list_expanded_all, | |
10461 | no_ip_extcommunity_list_expanded_all_cmd, | |
10462 | "no ip extcommunity-list <100-500>", | |
718e3744 | 10463 | NO_STR |
10464 | IP_STR | |
10465 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 10466 | "Extended Community list number (expanded)\n") |
10467 | { | |
fee6e4e4 | 10468 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 10469 | } |
10470 | ||
fee6e4e4 | 10471 | DEFUN (no_ip_extcommunity_list_name_standard_all, |
10472 | no_ip_extcommunity_list_name_standard_all_cmd, | |
10473 | "no ip extcommunity-list standard WORD", | |
718e3744 | 10474 | NO_STR |
10475 | IP_STR | |
10476 | EXTCOMMUNITY_LIST_STR | |
10477 | "Specify standard extcommunity-list\n" | |
fee6e4e4 | 10478 | "Extended Community list name\n") |
10479 | { | |
10480 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
10481 | } | |
10482 | ||
10483 | DEFUN (no_ip_extcommunity_list_name_expanded_all, | |
10484 | no_ip_extcommunity_list_name_expanded_all_cmd, | |
10485 | "no ip extcommunity-list expanded WORD", | |
10486 | NO_STR | |
10487 | IP_STR | |
10488 | EXTCOMMUNITY_LIST_STR | |
718e3744 | 10489 | "Specify expanded extcommunity-list\n" |
10490 | "Extended Community list name\n") | |
10491 | { | |
fee6e4e4 | 10492 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); |
718e3744 | 10493 | } |
10494 | ||
10495 | DEFUN (no_ip_extcommunity_list_standard, | |
10496 | no_ip_extcommunity_list_standard_cmd, | |
10497 | "no ip extcommunity-list <1-99> (deny|permit) .AA:NN", | |
10498 | NO_STR | |
10499 | IP_STR | |
10500 | EXTCOMMUNITY_LIST_STR | |
10501 | "Extended Community list number (standard)\n" | |
10502 | "Specify community to reject\n" | |
10503 | "Specify community to accept\n" | |
10504 | EXTCOMMUNITY_VAL_STR) | |
10505 | { | |
10506 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
10507 | } | |
10508 | ||
10509 | DEFUN (no_ip_extcommunity_list_expanded, | |
10510 | no_ip_extcommunity_list_expanded_cmd, | |
fee6e4e4 | 10511 | "no ip extcommunity-list <100-500> (deny|permit) .LINE", |
718e3744 | 10512 | NO_STR |
10513 | IP_STR | |
10514 | EXTCOMMUNITY_LIST_STR | |
10515 | "Extended Community list number (expanded)\n" | |
10516 | "Specify community to reject\n" | |
10517 | "Specify community to accept\n" | |
10518 | "An ordered list as a regular-expression\n") | |
10519 | { | |
10520 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
10521 | } | |
10522 | ||
10523 | DEFUN (no_ip_extcommunity_list_name_standard, | |
10524 | no_ip_extcommunity_list_name_standard_cmd, | |
10525 | "no ip extcommunity-list standard WORD (deny|permit) .AA:NN", | |
10526 | NO_STR | |
10527 | IP_STR | |
10528 | EXTCOMMUNITY_LIST_STR | |
10529 | "Specify standard extcommunity-list\n" | |
10530 | "Extended Community list name\n" | |
10531 | "Specify community to reject\n" | |
10532 | "Specify community to accept\n" | |
10533 | EXTCOMMUNITY_VAL_STR) | |
10534 | { | |
10535 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD); | |
10536 | } | |
10537 | ||
10538 | DEFUN (no_ip_extcommunity_list_name_expanded, | |
10539 | no_ip_extcommunity_list_name_expanded_cmd, | |
10540 | "no ip extcommunity-list expanded WORD (deny|permit) .LINE", | |
10541 | NO_STR | |
10542 | IP_STR | |
10543 | EXTCOMMUNITY_LIST_STR | |
10544 | "Specify expanded extcommunity-list\n" | |
10545 | "Community list name\n" | |
10546 | "Specify community to reject\n" | |
10547 | "Specify community to accept\n" | |
10548 | "An ordered list as a regular-expression\n") | |
10549 | { | |
10550 | return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED); | |
10551 | } | |
10552 | ||
94f2b392 | 10553 | static void |
718e3744 | 10554 | extcommunity_list_show (struct vty *vty, struct community_list *list) |
10555 | { | |
10556 | struct community_entry *entry; | |
10557 | ||
10558 | for (entry = list->head; entry; entry = entry->next) | |
10559 | { | |
10560 | if (entry == list->head) | |
10561 | { | |
10562 | if (all_digit (list->name)) | |
10563 | vty_out (vty, "Extended community %s list %s%s", | |
10564 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
10565 | "standard" : "(expanded) access", | |
10566 | list->name, VTY_NEWLINE); | |
10567 | else | |
10568 | vty_out (vty, "Named extended community %s list %s%s", | |
10569 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
10570 | "standard" : "expanded", | |
10571 | list->name, VTY_NEWLINE); | |
10572 | } | |
10573 | if (entry->any) | |
10574 | vty_out (vty, " %s%s", | |
10575 | community_direct_str (entry->direct), VTY_NEWLINE); | |
10576 | else | |
10577 | vty_out (vty, " %s %s%s", | |
10578 | community_direct_str (entry->direct), | |
10579 | entry->style == EXTCOMMUNITY_LIST_STANDARD ? | |
10580 | entry->u.ecom->str : entry->config, | |
10581 | VTY_NEWLINE); | |
10582 | } | |
10583 | } | |
10584 | ||
10585 | DEFUN (show_ip_extcommunity_list, | |
10586 | show_ip_extcommunity_list_cmd, | |
10587 | "show ip extcommunity-list", | |
10588 | SHOW_STR | |
10589 | IP_STR | |
10590 | "List extended-community list\n") | |
10591 | { | |
10592 | struct community_list *list; | |
10593 | struct community_list_master *cm; | |
10594 | ||
fee6e4e4 | 10595 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 10596 | if (! cm) |
10597 | return CMD_SUCCESS; | |
10598 | ||
10599 | for (list = cm->num.head; list; list = list->next) | |
10600 | extcommunity_list_show (vty, list); | |
10601 | ||
10602 | for (list = cm->str.head; list; list = list->next) | |
10603 | extcommunity_list_show (vty, list); | |
10604 | ||
10605 | return CMD_SUCCESS; | |
10606 | } | |
10607 | ||
10608 | DEFUN (show_ip_extcommunity_list_arg, | |
10609 | show_ip_extcommunity_list_arg_cmd, | |
fee6e4e4 | 10610 | "show ip extcommunity-list (<1-500>|WORD)", |
718e3744 | 10611 | SHOW_STR |
10612 | IP_STR | |
10613 | "List extended-community list\n" | |
10614 | "Extcommunity-list number\n" | |
10615 | "Extcommunity-list name\n") | |
10616 | { | |
10617 | struct community_list *list; | |
10618 | ||
fee6e4e4 | 10619 | list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 10620 | if (! list) |
10621 | { | |
10622 | vty_out (vty, "%% Can't find extcommunit-list%s", VTY_NEWLINE); | |
10623 | return CMD_WARNING; | |
10624 | } | |
10625 | ||
10626 | extcommunity_list_show (vty, list); | |
10627 | ||
10628 | return CMD_SUCCESS; | |
10629 | } | |
10630 | \f | |
10631 | /* Return configuration string of community-list entry. */ | |
fd79ac91 | 10632 | static const char * |
718e3744 | 10633 | community_list_config_str (struct community_entry *entry) |
10634 | { | |
fd79ac91 | 10635 | const char *str; |
718e3744 | 10636 | |
10637 | if (entry->any) | |
10638 | str = ""; | |
10639 | else | |
10640 | { | |
10641 | if (entry->style == COMMUNITY_LIST_STANDARD) | |
10642 | str = community_str (entry->u.com); | |
10643 | else | |
10644 | str = entry->config; | |
10645 | } | |
10646 | return str; | |
10647 | } | |
10648 | ||
10649 | /* Display community-list and extcommunity-list configuration. */ | |
94f2b392 | 10650 | static int |
718e3744 | 10651 | community_list_config_write (struct vty *vty) |
10652 | { | |
10653 | struct community_list *list; | |
10654 | struct community_entry *entry; | |
10655 | struct community_list_master *cm; | |
10656 | int write = 0; | |
10657 | ||
10658 | /* Community-list. */ | |
fee6e4e4 | 10659 | cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER); |
718e3744 | 10660 | |
10661 | for (list = cm->num.head; list; list = list->next) | |
10662 | for (entry = list->head; entry; entry = entry->next) | |
10663 | { | |
fee6e4e4 | 10664 | vty_out (vty, "ip community-list %s %s %s%s", |
10665 | list->name, community_direct_str (entry->direct), | |
10666 | community_list_config_str (entry), | |
10667 | VTY_NEWLINE); | |
718e3744 | 10668 | write++; |
10669 | } | |
10670 | for (list = cm->str.head; list; list = list->next) | |
10671 | for (entry = list->head; entry; entry = entry->next) | |
10672 | { | |
10673 | vty_out (vty, "ip community-list %s %s %s %s%s", | |
10674 | entry->style == COMMUNITY_LIST_STANDARD | |
10675 | ? "standard" : "expanded", | |
10676 | list->name, community_direct_str (entry->direct), | |
10677 | community_list_config_str (entry), | |
10678 | VTY_NEWLINE); | |
10679 | write++; | |
10680 | } | |
10681 | ||
10682 | /* Extcommunity-list. */ | |
fee6e4e4 | 10683 | cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER); |
718e3744 | 10684 | |
10685 | for (list = cm->num.head; list; list = list->next) | |
10686 | for (entry = list->head; entry; entry = entry->next) | |
10687 | { | |
fee6e4e4 | 10688 | vty_out (vty, "ip extcommunity-list %s %s %s%s", |
10689 | list->name, community_direct_str (entry->direct), | |
10690 | community_list_config_str (entry), VTY_NEWLINE); | |
718e3744 | 10691 | write++; |
10692 | } | |
10693 | for (list = cm->str.head; list; list = list->next) | |
10694 | for (entry = list->head; entry; entry = entry->next) | |
10695 | { | |
10696 | vty_out (vty, "ip extcommunity-list %s %s %s %s%s", | |
10697 | entry->style == EXTCOMMUNITY_LIST_STANDARD | |
10698 | ? "standard" : "expanded", | |
10699 | list->name, community_direct_str (entry->direct), | |
10700 | community_list_config_str (entry), VTY_NEWLINE); | |
10701 | write++; | |
10702 | } | |
10703 | return write; | |
10704 | } | |
10705 | ||
10706 | struct cmd_node community_list_node = | |
10707 | { | |
10708 | COMMUNITY_LIST_NODE, | |
10709 | "", | |
10710 | 1 /* Export to vtysh. */ | |
10711 | }; | |
10712 | ||
94f2b392 | 10713 | static void |
10714 | community_list_vty (void) | |
718e3744 | 10715 | { |
10716 | install_node (&community_list_node, community_list_config_write); | |
10717 | ||
10718 | /* Community-list. */ | |
718e3744 | 10719 | install_element (CONFIG_NODE, &ip_community_list_standard_cmd); |
10720 | install_element (CONFIG_NODE, &ip_community_list_standard2_cmd); | |
10721 | install_element (CONFIG_NODE, &ip_community_list_expanded_cmd); | |
10722 | install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd); | |
10723 | install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd); | |
10724 | install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd); | |
fee6e4e4 | 10725 | install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd); |
10726 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); | |
10727 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd); | |
10728 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd); | |
718e3744 | 10729 | install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd); |
10730 | install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd); | |
10731 | install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd); | |
10732 | install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd); | |
10733 | install_element (VIEW_NODE, &show_ip_community_list_cmd); | |
10734 | install_element (VIEW_NODE, &show_ip_community_list_arg_cmd); | |
10735 | install_element (ENABLE_NODE, &show_ip_community_list_cmd); | |
10736 | install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd); | |
10737 | ||
10738 | /* Extcommunity-list. */ | |
10739 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd); | |
10740 | install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd); | |
10741 | install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd); | |
10742 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd); | |
10743 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd); | |
10744 | install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd); | |
fee6e4e4 | 10745 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd); |
10746 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd); | |
10747 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd); | |
10748 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd); | |
718e3744 | 10749 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd); |
10750 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd); | |
10751 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd); | |
10752 | install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd); | |
10753 | install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd); | |
10754 | install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd); | |
10755 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd); | |
10756 | install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd); | |
10757 | } |